content
stringlengths 5
1.05M
|
---|
local responses = require "kong.tools.responses"
local validations = require "kong.dao.schemas_validation"
local app_helpers = require "lapis.application"
local utils = require "kong.tools.utils"
local is_uuid = validations.is_valid_uuid
local _M = {}
function _M.find_api_by_name_or_id(self, dao_factory, helpers)
local filter_keys = {
[is_uuid(self.params.name_or_id) and "id" or "name"] = self.params.name_or_id
}
self.params.name_or_id = nil
local rows, err = dao_factory.apis:find_all(filter_keys)
if err then
return helpers.yield_error(err)
end
-- We know name and id are unique for APIs, hence if we have a row, it must be the only one
self.api = rows[1]
if not self.api then
return helpers.responses.send_HTTP_NOT_FOUND()
end
end
function _M.find_consumer_by_username_or_id(self, dao_factory, helpers)
local filter_keys = {
[is_uuid(self.params.username_or_id) and "id" or "username"] = self.params.username_or_id
}
self.params.username_or_id = nil
local rows, err = dao_factory.consumers:find_all(filter_keys)
if err then
return helpers.yield_error(err)
end
-- We know username and id are unique, so if we have a row, it must be the only one
self.consumer = rows[1]
if not self.consumer then
return helpers.responses.send_HTTP_NOT_FOUND()
end
end
function _M.paginated_set(self, dao_collection)
local size = self.params.size and tonumber(self.params.size) or 100
local offset = self.params.offset and ngx.decode_base64(self.params.offset) or nil
self.params.size = nil
self.params.offset = nil
local filter_keys = next(self.params) and self.params
local rows, err, offset = dao_collection:find_page(filter_keys, offset, size)
if err then
return app_helpers.yield_error(err)
end
local total_count, err = dao_collection:count(filter_keys)
if err then
return app_helpers.yield_error(err)
end
local next_url
if offset ~= nil then
next_url = self:build_url(self.req.parsed_url.path, {
port = self.req.parsed_url.port,
query = ngx.encode_args {
offset = ngx.encode_base64(offset),
size = size
}
})
end
-- This check is required otherwise the response is going to be a
-- JSON Object and not a JSON array. The reason is because an empty Lua array `{}`
-- will not be translated as an empty array by cjson, but as an empty object.
local result = #rows == 0 and "{\"data\":[],\"total\":0}" or {data = rows, ["next"] = next_url, total = total_count}
return responses.send_HTTP_OK(result, type(result) ~= "table")
end
-- Retrieval of an entity.
-- The DAO requires to be given a table containing the full primary key of the entity
function _M.get(primary_keys, dao_collection)
local row, err = dao_collection:find(primary_keys)
if err then
return app_helpers.yield_error(err)
elseif row == nil then
return responses.send_HTTP_NOT_FOUND()
else
return responses.send_HTTP_OK(row)
end
end
--- Insertion of an entity.
function _M.post(params, dao_collection, success)
local data, err = dao_collection:insert(params)
if err then
return app_helpers.yield_error(err)
else
if success then success(utils.deep_copy(data)) end
return responses.send_HTTP_CREATED(data)
end
end
--- Partial update of an entity.
-- Filter keys must be given to get the row to update.
function _M.patch(params, dao_collection, filter_keys)
local updated_entity, err = dao_collection:update(params, filter_keys)
if err then
return app_helpers.yield_error(err)
elseif updated_entity == nil then
return responses.send_HTTP_NOT_FOUND()
else
return responses.send_HTTP_OK(updated_entity)
end
end
-- Full update of an entity.
-- First, we check if the entity body has primary keys or not,
-- if it does, we are performing an update, if not, an insert.
function _M.put(params, dao_collection)
local new_entity, err
local model = dao_collection.model_mt(params)
if not model:has_primary_keys() then
-- If entity body has no primary key, deal with an insert
new_entity, err = dao_collection:insert(params)
if not err then
return responses.send_HTTP_CREATED(new_entity)
end
else
-- If entity body has primary key, deal with update
new_entity, err = dao_collection:update(params, params, {full = true})
if not err then
return responses.send_HTTP_OK(new_entity)
end
end
if err then
return app_helpers.yield_error(err)
end
end
--- Delete an entity.
-- The DAO requires to be given a table containing the full primary key of the entity
function _M.delete(primary_keys, dao_collection)
local ok, err = dao_collection:delete(primary_keys)
if not ok then
if err then
return app_helpers.yield_error(err)
else
return responses.send_HTTP_NOT_FOUND()
end
else
return responses.send_HTTP_NO_CONTENT()
end
end
return _M
|
function CreateEngineService(name, copyToOutput)
copyToOutput = copyToOutput or true
project(name)
kind "SharedLib"
language "C++"
cppdialect "C++17"
staticruntime "Off"
targetdir ("%{OutputDir}%{prj.name}")
objdir ("%{OutputDir}Intermediate/%{prj.name}")
includedirs
{
IncludeDir,
"%{wks.location}/../Engine/Include"
}
defines
{
EngineDefines,
"BUILD_SERVICE_DLL"
}
links { EngineLinkLibs }
local fileExt = '.so'
if EngineType == "SharedLib" then
defines { "BUILD_SHARED_LIB" }
end
filter "system:windows"
systemversion "latest" -- Windows SDK Version
debugdir "%{OutputDir}%{prj.name}"
fileExt = '.dll'
filter "configurations:Debug"
runtime "Debug"
symbols "On"
-- Copy output file to Assets directory
if copyToOutput then
postbuildcommands
{
"{MKDIR} \"%{wks.location}../Applications/Assets/Services/\" >nul",
"{COPYFILE} \"" .. OutputDir .. "%{prj.name}/%{prj.name}" .. fileExt .. "\" \"%{wks.location}../Applications/Assets/Services/%{prj.name}" .. fileExt .. "\""
}
end
filter "configurations:Release"
runtime "Release"
optimize "On"
-- Copy output file to Assets directory
if copyToOutput then
postbuildcommands
{
"{MKDIR} \"" .. OutputDir .. "Binaries/Assets/Services/\" >nul",
"{COPYFILE} \"" .. OutputDir .. "%{prj.name}/%{prj.name}" .. fileExt .. "\" \"" .. OutputDir .. "Binaries/Assets/Services/%{prj.name}" .. fileExt .. "\""
}
end
filter {}
end
|
--[[
Project: SA-MP-API
Author: Tim4ukys
My url: vk.com/tim4ukys
]]
local sys = require 'SA-MP API.kernel'
sys.ffi.cdef[[
struct stTextLabel {
char *pText;
unsigned int color;
float fPosition[3];
float fMaxViewDistance;
unsigned char byteShowBehindWalls;
unsigned short sAttachedToPlayerID;
unsigned short sAttachedToVehicleID;
}__attribute__ ((packed));
]]
|
---
-- ChannelHandler.server.lua - Instrument channel handler
--
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CollectionSubscriber = require(ReplicatedStorage.Common.CollectionSubscriber)
local events = ReplicatedStorage.Instrument
local Channel = {}
Channel.__index = Channel
function Channel.new(name, listenerEnabled)
local self = setmetatable({}, Channel)
print("Channel: Created channel", name)
self.Name = name
self.ListenerEnabled = listenerEnabled
self._authority = {}
self._listeners = {}
return self
end
function Channel:transmit(player, packets)
local root = self._authority[player]
if not root then
return
end
if self.ListenerEnabled then
for _, listener in pairs(self._listeners) do
events.InstrumentRx:FireClient(listener, player, root, packets)
end
else
for _, listener in pairs(Players:GetPlayers()) do
if listener ~= player then
events.InstrumentRx:FireClient(listener, player, root, packets)
end
end
end
end
function Channel:addAuthority(auth, root)
print("Channel: Player", auth.Name, "joined channel", self.Name, "as authority")
self._authority[auth] = root
end
function Channel:removeAuthority(auth)
print("Channel: Player", auth.Name, "left channel", self.Name, "as authority")
self._authority[auth] = nil
end
function Channel:addListener(listener)
local idx = table.find(self._listeners, listener)
if not idx then
self._listeners[#self._listeners + 1] = listener
end
end
function Channel:removeListener(listener)
local idx = table.find(self._listeners, listener)
if idx then
table.remove(self._listeners, idx)
end
end
-------
local channels = {}
local subscriber = CollectionSubscriber.new("PianoSeat")
subscriber.HandleItem = function(item)
local chanName = item:GetAttribute("Channel")
if not chanName then
return
end
local channel = channels[chanName]
if not channel then
channel = Channel.new(chanName)
channels[chanName] = channel
end
local currentAuth
item:GetPropertyChangedSignal("Occupant"):Connect(function()
if currentAuth then
channel:removeAuthority(currentAuth)
currentAuth = nil
end
local occupant = item.Occupant
if not occupant then
return
end
local player = Players:GetPlayerFromCharacter(occupant.Parent)
if player then
channel:addAuthority(player, item)
currentAuth = player
end
end)
end
subscriber:init()
events.InstrumentTx.OnServerEvent:Connect(function(player, chanName, packets)
local channel = channels[chanName]
if channel then
channel:transmit(player, packets)
end
end)
|
---
-- @module RxBinderUtils
-- @author Quenty
local require = require(script.Parent.loader).load(script)
local Binder = require("Binder")
local Brio = require("Brio")
local Maid = require("Maid")
local Observable = require("Observable")
local Rx = require("Rx")
local RxBrioUtils = require("RxBrioUtils")
local RxInstanceUtils = require("RxInstanceUtils")
local RxLinkUtils = require("RxLinkUtils")
local RxBinderUtils = {}
function RxBinderUtils.observeLinkedBoundClassBrio(linkName, parent, binder)
assert(type(linkName) == "string", "Bad linkName")
assert(typeof(parent) == "Instance", "Bad parent")
assert(Binder.isBinder(binder), "Bad binder")
return RxLinkUtils.observeValidLinksBrio(linkName, parent)
:Pipe({
RxBrioUtils.flatMap(function(_, linkValue)
return RxBinderUtils.observeBoundClassBrio(binder, linkValue)
end);
});
end
function RxBinderUtils.observeBoundChildClassBrio(binder, instance)
assert(Binder.isBinder(binder), "Bad binder")
assert(typeof(instance) == "Instance", "Bad instance")
return RxInstanceUtils.observeChildrenBrio(instance)
:Pipe({
RxBrioUtils.flatMap(function(child)
return RxBinderUtils.observeBoundClassBrio(binder, child)
end);
})
end
function RxBinderUtils.observeBoundParentClassBrio(binder, instance)
assert(Binder.isBinder(binder), "Bad binder")
assert(typeof(instance) == "Instance", "Bad instance")
return RxInstanceUtils.observePropertyBrio(instance, "Parent")
:Pipe({
RxBrioUtils.switchMap(function(child)
if child then
return RxBinderUtils.observeBoundClassBrio(binder, child)
else
return Rx.EMPTY
end
end);
})
end
function RxBinderUtils.observeBoundChildClassesBrio(binders, instance)
assert(Binder.isBinder(binders), "Bad binders")
assert(typeof(instance) == "Instance", "Bad instance")
return RxInstanceUtils.observeChildrenBrio(instance)
:Pipe({
RxBrioUtils.flatMap(function(child)
return RxBinderUtils.observeBoundClassesBrio(binders, child)
end);
})
end
function RxBinderUtils.observeBoundClass(binder, instance)
assert(type(binder) == "table", "Bad binder")
assert(typeof(instance) == "Instance", "Bad instance")
return Observable.new(function(sub)
local maid = Maid.new()
maid:GiveTask(binder:ObserveInstance(instance, function(...)
sub:Fire(...)
end))
sub:Fire(binder:Get(instance))
return maid
end)
end
function RxBinderUtils.observeBoundClassBrio(binder, instance)
assert(type(binder) == "table", "Bad binder")
assert(typeof(instance) == "Instance", "Bad instance")
return Observable.new(function(sub)
local maid = Maid.new()
local function handleClassChanged(class)
if class then
local brio = Brio.new(class)
maid._lastBrio = brio
sub:Fire(brio)
else
maid._lastBrio = nil
end
end
maid:GiveTask(binder:ObserveInstance(instance, handleClassChanged))
handleClassChanged(binder:Get(instance))
return maid
end)
end
function RxBinderUtils.observeBoundClassesBrio(binders, instance)
assert(Binder.isBinder(binders), "Bad binders")
assert(typeof(instance) == "Instance", "Bad instance")
local observables = {}
for _, binder in pairs(binders) do
table.insert(observables, RxBinderUtils.observeBoundClassBrio(binder, instance))
end
return Rx.of(unpack(observables)):Pipe({
Rx.mergeAll();
})
end
function RxBinderUtils.observeAllBrio(binder)
assert(Binder.isBinder(binder), "Bad binder")
return Observable.new(function(sub)
local maid = Maid.new()
local function handleNewClass(class)
local brio = Brio.new(class)
maid[class] = brio
sub:Fire(brio)
end
maid:GiveTask(binder:GetClassAddedSignal():Connect(handleNewClass))
maid:GiveTask(binder:GetClassRemovingSignal():Connect(function(class)
maid[class] = nil
end))
for class, _ in pairs(binder:GetAllSet()) do
handleNewClass(class)
end
return maid
end)
end
return RxBinderUtils
|
local lsp_config = require('lspconfig')
local on_attach = require('lsp/on_attach')
lsp_config.cssls.setup({
filetypes = { 'css', 'sass', 'scss' },
settings = {
css = {
validate = true
},
sass = {
validate = true
},
scss = {
validate = true
}
},
on_attach = function(client)
client.resolved_capabilities.document_formatting = false
on_attach(client)
end
})
|
local _G = _G;
_G.ABP_4H = _G.LibStub("AceAddon-3.0"):NewAddon("ABP_4H", "AceConsole-3.0", "AceComm-3.0", "AceEvent-3.0", "AceTimer-3.0", "AceHook-3.0");
local ABP_4H = _G.ABP_4H;
local AceGUI = _G.LibStub("AceGUI-3.0");
local UnitExists = UnitExists;
local UnitClass = UnitClass;
local UnitGUID = UnitGUID;
local UnitName = UnitName;
local GuildRoster = GuildRoster;
local GetChatWindowInfo = GetChatWindowInfo;
local UnitAffectingCombat = UnitAffectingCombat;
local CreateFrame = CreateFrame;
local GetItemInfo = GetItemInfo;
local IsInGroup = IsInGroup;
local GetInstanceInfo = GetInstanceInfo;
local IsInGuild = IsInGuild;
local C_GuildInfo = C_GuildInfo;
local GetAddOnMetadata = GetAddOnMetadata;
local GetServerTime = GetServerTime;
local UnitIsGroupLeader = UnitIsGroupLeader;
local IsEquippableItem = IsEquippableItem;
local IsAltKeyDown = IsAltKeyDown;
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo;
local UnitIsUnit = UnitIsUnit;
local GetClassColor = GetClassColor;
local EasyMenu = EasyMenu;
local ToggleDropDownMenu = ToggleDropDownMenu;
local COMBATLOG_OBJECT_TYPE_NPC = COMBATLOG_OBJECT_TYPE_NPC;
local COMBATLOG_OBJECT_REACTION_HOSTILE = COMBATLOG_OBJECT_REACTION_HOSTILE;
local select = select;
local pairs = pairs;
local ipairs = ipairs;
local tonumber = tonumber;
local table = table;
local tostring = tostring;
local min = min;
local max = max;
local date = date;
local type = type;
local bit = bit;
local version = "${ADDON_VERSION}";
_G.BINDING_HEADER_ABP_4H = "4H Assist";
_G.BINDING_NAME_ABP_4H_OPENMAINWINDOW = "Open the map window";
_G.BINDING_NAME_ABP_4H_OPENSTARTWINDOW = "Open the raid config window";
local function OnGroupJoined(self)
self:VersionOnGroupJoined();
self:UIOnGroupJoined();
end
function ABP_4H:OnEnable()
if GetAddOnMetadata("4H-Assist", "Version") ~= version then
self:NotifyVersionMismatch();
self:RegisterChatCommand("ABP_4H", function()
self:Error("Please restart your game client!");
end);
return;
end
self:RegisterComm("ABPN");
self:RegisterComm(self:GetCommPrefix());
self:InitOptions();
self:InitSpells();
if self:IsClassic() then
-- Trigger a guild roster update to refresh priorities.
GuildRoster();
end
self:SetCallback(self.CommTypes.STATE_SYNC.name, function(self, event, data, distribution, sender, version)
self:UIOnStateSync(data, distribution, sender, version);
end, self);
self:SetCallback(self.CommTypes.STATE_SYNC_ACK.name, function(self, event, data, distribution, sender, version)
self:DriverOnStateSyncAck(data, distribution, sender, version);
end, self);
self:SetCallback(self.CommTypes.STATE_SYNC_REQUEST.name, function(self, event, data, distribution, sender, version)
self:DriverOnStateSyncRequest(data, distribution, sender, version);
end, self);
self:SetCallback(self.CommTypes.MARK_UPDATE.name, function(self, event, data, distribution, sender, version)
self:DriverOnMarkUpdate(data, distribution, sender, version);
end, self);
self:SetCallback(self.CommTypes.VERSION_REQUEST.name, function(self, event, data, distribution, sender, version)
self:OnVersionRequest(data, distribution, sender, version);
end, self);
self:SetCallback(self.CommTypes.VERSION_RESPONSE.name, function(self, event, data, distribution, sender, version)
self:OnVersionResponse(data, distribution, sender, version);
end, self);
if self:IsClassic() then
self:RegisterEvent("GUILD_ROSTER_UPDATE", function(self, event, ...)
self:RebuildGuildInfo();
self:VersionOnGuildRosterUpdate();
end, self);
end
self:RegisterEvent("PLAYER_ENTERING_WORLD", function(self, event, ...)
self:VersionOnEnteringWorld(...);
end, self);
self:RegisterEvent("GROUP_JOINED", function(self, event, ...)
OnGroupJoined(self);
end, self);
self:RegisterEvent("GROUP_LEFT", function(self, event, ...)
self:UIOnGroupLeft();
end, self);
self:RegisterEvent("GROUP_ROSTER_UPDATE", function(self, event, ...)
self:DriverOnGroupUpdate();
end, self);
self:RegisterEvent("PLAYER_LOGOUT", function(self, event, ...)
self:DriverOnLogout();
end, self);
self:RegisterEvent("ENCOUNTER_START", function(self, event, ...)
self:DriverOnEncounterStart(...);
end, self);
self:RegisterEvent("ENCOUNTER_END", function(self, event, ...)
self:DriverOnEncounterEnd(...);
end, self);
self:RegisterEvent("LOADING_SCREEN_ENABLED", function(self, event, ...)
self:DriverOnLoadingScreen(...);
end, self);
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", function(self, event, ...)
local _, event, _, _, _, sourceFlags, _, dest, destName, destFlags, _, spellID, spellName = CombatLogGetCurrentEventInfo();
local expected = bit.bor(COMBATLOG_OBJECT_TYPE_NPC, COMBATLOG_OBJECT_REACTION_HOSTILE);
-- print(table.concat({tostringall(CombatLogGetCurrentEventInfo())}, "||"));
if event == "SPELL_CAST_SUCCESS" and bit.band(sourceFlags, expected) == expected then
self:DriverOnSpellCast(spellID, spellName);
elseif event == "UNIT_DIED" and bit.band(destFlags, expected) == expected then
local npcID = tonumber((select(6, ("-"):split(dest))));
if npcID then
self:DriverOnDeath(npcID, true);
end
end
end, self);
self:RegisterEvent("UNIT_AURA", function(self, event, ...)
local unit = ...;
if UnitIsUnit(unit, "player") then
self:UIOnPlayerAura(...);
else
self:UIOnAura(unit);
end
end, self);
if IsInGroup() then
OnGroupJoined(self);
end
end
--
-- Helpers for chat messages and colorization
--
local function GetSystemFrame()
for i = 1, _G.NUM_CHAT_WINDOWS do
local shown = select(7, GetChatWindowInfo(i));
if shown then
local frame = _G["ChatFrame" .. i];
for _, type in ipairs(frame.messageTypeList) do
if type == "SYSTEM" then
return frame;
end
end
end
end
return _G.DEFAULT_CHAT_FRAME;
end
ABP_4H.Color = "|cFF94E4FF";
ABP_4H.ColorTable = { 0.58, 0.89, 1, r = 0.58, g = 0.89, b = 1 };
function ABP_4H:Notify(str, ...)
local msg = ("%s: %s"):format(self:ColorizeText("4H Assist"), tostring(str):format(...));
GetSystemFrame():AddMessage(msg, 1, 1, 1);
end
function ABP_4H:LogDebug(str, ...)
if self:GetDebugOpt() then
self:Notify(str, ...);
end
end
function ABP_4H:LogVerbose(str, ...)
if self:GetDebugOpt("Verbose") then
self:Notify(str, ...);
end
end
function ABP_4H:Error(str, ...)
self:Notify("|cffff0000ERROR:|r " .. str, ...);
end
function ABP_4H:Alert(str, ...)
local msg = ("%s: %s"):format(self:ColorizeText("4H Assist"), tostring(str):format(...));
_G.RaidNotice_AddMessage(_G.RaidWarningFrame, msg, { r = 1, g = 1, b = 1 });
self:Notify(str, ...);
end
function ABP_4H:ColorizeText(text)
return ("%s%s|r"):format(ABP_4H.Color, text);
end
function ABP_4H:ColorizeName(name, class)
if not class then
if UnitExists(name) then
local _, className = UnitClass(name);
class = className;
end
end
if not class then
local guildInfo = self:GetGuildInfo(name);
if guildInfo then
class = guildInfo[11];
end
end
if not class then return name; end
local color = select(4, GetClassColor(class));
return ("|c%s%s|r"):format(color, name);
end
--
-- Helpers for privilege checks
--
function ABP_4H:IsPrivileged()
-- Check officer status by looking for the privilege to speak in officer chat.
local isOfficer = C_GuildInfo.GuildControlGetRankFlags(C_GuildInfo.GetGuildRankOrder(UnitGUID("player")))[4];
return isOfficer or self:GetDebugOpt();
end
function ABP_4H:CanEditPublicNotes()
return C_GuildInfo.GuildControlGetRankFlags(C_GuildInfo.GetGuildRankOrder(UnitGUID("player")))[10];
end
function ABP_4H:CanEditOfficerNotes(player)
local guid = UnitGUID("player");
if player then
local guildInfo = self:GetGuildInfo(player);
if not guildInfo then return false; end
guid = guildInfo[17];
end
return C_GuildInfo.GuildControlGetRankFlags(C_GuildInfo.GetGuildRankOrder(guid))[12];
end
--
-- Hook for CloseSpecialWindows to allow our UI windows to close on Escape.
--
local openWindows = {};
local openPopups = {};
local function CloseABP_4HWindows(t)
local found = false;
for window in pairs(t) do
found = true;
window:Hide();
end
return found;
end
function ABP_4H:CloseSpecialWindows()
local found = self.hooks.CloseSpecialWindows();
return CloseABP_4HWindows(openWindows) or found;
end
ABP_4H:RawHook("CloseSpecialWindows", true);
function ABP_4H:StaticPopup_EscapePressed()
local found = self.hooks.StaticPopup_EscapePressed();
return CloseABP_4HWindows(openPopups) or found;
end
ABP_4H:RawHook("StaticPopup_EscapePressed", true);
function ABP_4H:OpenWindow(window)
openWindows[window] = true;
end
function ABP_4H:CloseWindow(window)
openWindows[window] = nil;
end
function ABP_4H:OpenPopup(window)
openPopups[window] = true;
end
function ABP_4H:ClosePopup(window)
openPopups[window] = nil;
end
--
-- Support for maintaining window positions/sizes across reloads/relogs
--
_G.ABP_4H_WindowManagement = {};
function ABP_4H:BeginWindowManagement(window, name, defaults)
_G.ABP_4H_WindowManagement[name] = _G.ABP_4H_WindowManagement[name] or {};
local saved = _G.ABP_4H_WindowManagement[name];
if not defaults.version or saved.version ~= defaults.version then
table.wipe(saved);
saved.version = defaults.version;
end
defaults.minWidth = defaults.minWidth or defaults.defaultWidth;
defaults.maxWidth = defaults.maxWidth or defaults.defaultWidth;
defaults.minHeight = defaults.minHeight or defaults.defaultHeight;
defaults.maxHeight = defaults.maxHeight or defaults.defaultHeight;
local management = { name = name, defaults = defaults };
window:SetUserData("windowManagement", management);
saved.width = min(max(defaults.minWidth, saved.width or defaults.defaultWidth), defaults.maxWidth);
saved.height = min(max(defaults.minHeight, saved.height or defaults.defaultHeight), defaults.maxHeight);
window:SetStatusTable(saved);
management.oldMinW, management.oldMinH = window.frame:GetMinResize();
management.oldMaxW, management.oldMaxH = window.frame:GetMaxResize();
window.frame:SetMinResize(defaults.minWidth, defaults.minHeight);
window.frame:SetMaxResize(defaults.maxWidth, defaults.maxHeight);
-- Ensure the window is onscreen.
local offset = window.frame:GetLeft() - _G.UIParent:GetLeft();
if offset < 0 then
saved.left = saved.left - offset;
end
offset = _G.UIParent:GetTop() - window.frame:GetTop();
if offset < 0 then
saved.top = saved.top + offset;
end
offset = _G.UIParent:GetRight() - window.frame:GetRight();
if offset < 0 then
saved.left = saved.left + offset;
end
offset = window.frame:GetBottom() - _G.UIParent:GetBottom();
if offset < 0 then
saved.top = saved.top - offset;
end
window:SetStatusTable(saved);
if defaults.minWidth == defaults.maxWidth and defaults.minHeight == defaults.maxHeight then
window.line1:Hide();
window.line2:Hide();
end
end
function ABP_4H:EndWindowManagement(window)
local management = window:GetUserData("windowManagement");
local name = management.name;
_G.ABP_4H_WindowManagement[name] = _G.ABP_4H_WindowManagement[name] or {};
local saved = _G.ABP_4H_WindowManagement[name];
saved.left = window.frame:GetLeft();
saved.top = window.frame:GetTop();
saved.width = window.frame:GetWidth();
saved.height = window.frame:GetHeight();
window.frame:SetMinResize(management.oldMinW, management.oldMinH);
window.frame:SetMaxResize(management.oldMaxW, management.oldMaxH);
window.line1:Show();
window.line2:Show();
self:HideContextMenu();
end
--
-- Context Menu support (https://wow.gamepedia.com/UI_Object_UIDropDownMenu)
--
local contextFrame = CreateFrame("Frame", "ABP_4HContextMenu", _G.UIParent, "UIDropDownMenuTemplate");
contextFrame.relativePoint = "BOTTOMRIGHT";
function ABP_4H:ShowContextMenu(context, frame)
if self:IsContextMenuOpen() then
self:HideContextMenu();
else
EasyMenu(context, contextFrame, frame or "cursor", 3, -3, "MENU");
end
end
function ABP_4H:IsContextMenuOpen()
return (_G.UIDROPDOWNMENU_OPEN_MENU == contextFrame);
end
function ABP_4H:HideContextMenu()
if self:IsContextMenuOpen() then
ToggleDropDownMenu(nil, nil, contextFrame);
end
end
--
-- Util
--
ABP_4H.tCompare = function(lhsTable, rhsTable, depth)
depth = depth or 1;
for key, value in pairs(lhsTable) do
if type(value) == "table" then
local rhsValue = rhsTable[key];
if type(rhsValue) ~= "table" then
return false;
end
if depth > 1 then
if not ABP_4H.tCompare(value, rhsValue, depth - 1) then
return false;
end
end
elseif value ~= rhsTable[key] then
-- print("mismatched value: " .. key .. ": " .. tostring(value) .. ", " .. tostring(rhsTable[key]));
return false;
end
end
-- Check for any keys that are in rhsTable and not lhsTable.
for key in pairs(rhsTable) do
if lhsTable[key] == nil then
-- print("mismatched key: " .. key);
return false;
end
end
return true;
end
ABP_4H.tCopy = function(t)
local copy = {};
for k, v in pairs(t) do
if type(v) == "table" then
copy[k] = ABP_4H.tCopy(v)
else
copy[k] = v;
end
end
return copy;
end
ABP_4H.reverse = function(arr)
local i, j = 1, #arr;
while i < j do
arr[i], arr[j] = arr[j], arr[i];
i = i + 1;
j = j - 1;
end
end
function ABP_4H:IsClassic()
return _G.WOW_PROJECT_ID == _G.WOW_PROJECT_CLASSIC;
end
function ABP_4H:IsInNaxx()
local instanceId = select(8, GetInstanceInfo());
return instanceId == 533;
end
--
-- Static dialog templates
--
ABP_4H.StaticDialogTemplates = {
JUST_BUTTONS = "JUST_BUTTONS",
EDIT_BOX = "EDIT_BOX",
};
function ABP_4H:StaticDialogTemplate(template, t)
t.timeout = 0;
t.whileDead = true;
t.hideOnEscape = true;
if t.exclusive == nil then
t.exclusive = true;
end
t.OnHyperlinkEnter = function(self, itemLink)
_G.ShowUIPanel(_G.GameTooltip);
_G.GameTooltip:SetOwner(self, "ANCHOR_BOTTOM");
_G.GameTooltip:SetHyperlink(itemLink);
_G.GameTooltip:Show();
end;
t.OnHyperlinkLeave = function(self)
_G.GameTooltip:Hide();
end;
if template == ABP_4H.StaticDialogTemplates.JUST_BUTTONS then
return t;
elseif template == ABP_4H.StaticDialogTemplates.EDIT_BOX then
t.hasEditBox = true;
t.countInvisibleLetters = true;
t.OnAccept = function(self, data)
local text = self.editBox:GetText();
if t.Validate then
text = t.Validate(text, data);
if text then
t.Commit(text, data);
end
else
t.Commit(text, data);
end
end;
t.OnShow = function(self, data)
self.editBox:SetAutoFocus(false);
if t.Validate then
self.button1:Disable();
end
if t.notFocused then
self.editBox:ClearFocus();
end
end;
t.EditBoxOnTextChanged = function(self, data)
if t.Validate then
local parent = self:GetParent();
local text = self:GetText();
if t.Validate(text, data) then
parent.button1:Enable();
else
parent.button1:Disable();
end
end
end;
t.EditBoxOnEnterPressed = function(self, data)
if t.suppressEnterCommit then return; end
local parent = self:GetParent();
local text = self:GetText();
if t.Validate then
if parent.button1:IsEnabled() then
parent.button1:Click();
else
local _, errorText = t.Validate(text, data);
if errorText then ABP_4H:Error("Invalid input! %s.", errorText); end
end
else
parent.button1:Click();
end
end;
t.EditBoxOnEscapePressed = function(self)
self:ClearFocus();
end;
t.OnHide = function(self, data)
self.editBox:SetAutoFocus(true);
end;
return t;
end
end
StaticPopupDialogs["ABP_4H_PROMPT_RELOAD"] = ABP_4H:StaticDialogTemplate(ABP_4H.StaticDialogTemplates.JUST_BUTTONS, {
text = "%s",
button1 = "Reload",
button2 = "Close",
showAlert = true,
OnAccept = ReloadUI,
});
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local common = ReplicatedStorage:WaitForChild("common")
local Thunks = require(common:WaitForChild("Thunks"))
local Assets = require(common:WaitForChild("Assets"))
return {
id = "itempack_spooky",
name = "Spooky Item Pack",
desc = (
"Contains every halloween item!"
),
productId = 838307012,
color = Color3.fromRGB(230, 130, 0),
onSale = true,
order = 0,
flavorText = "EVENT!",
onProductPurchase = (function(player, server)
server:getModule("StoreContainer"):getStore():andThen(function(store)
local allProducts = Assets.all
for _,product in pairs(allProducts) do
if product.shopCatagory == "halloween" then
store:dispatch(Thunks.ASSET_TRYGIVE(player, product.id))
end
end
end)
return true -- Successful
end)
}
|
-- Super Mario Bros. script by ugetab.
-- 2010, April 20th.
-- Competition Recorder:
-- Start the script, then make a recording from Start.
-- Play until you get a score you'd like to keep, then end the movie.
-- A record of your best scores, and the filename you got it in, will be saved.
-- You can easily find your best score, because it will be sorted highest to lowest.
-- The last entry is always erased, but is also always the lowest score.
-- The best score for your current movie file will be displayed above the coin counter.
-- The reason this is good for competition is that you can't get away with cheating,
-- unless the game allows it. A movie file is a collection of button presses which
-- can be played back. If it doesn't play back the same for someone else, then there's
-- probably a problem with the game file, or with what the person recording did.
function text(x,y,str)
if (x > 0 and x < 255 and y > 0 and y < 240) then
gui.text(x,y,str);
end;
end;
function bubbleSort(table)
--http://www.dreamincode.net/code/snippet3406.htm
--check to make sure the table has some items in it
if #table < 2 then
--print("Table does not have enough data in it")
return;
end;
for i = 0, (#table / 2) -1 do --> array start to end. Arrays start at 1, not 0.
for j = 1, (#table / 2) -1 do
if tonumber(table[(j*2)+1]) > tonumber(table[(j*2)-1]) then -->switch
temp1 = table[(j*2) - 1];
temp2 = table[(j*2)];
table[(j*2) - 1] = table[(j*2) + 1];
table[(j*2)] = table[(j*2) + 2];
table[(j*2) + 1] = temp1;
table[(j*2) + 2] = temp2;
end;
end;
end;
return;
end;
filesizefile = io.open("MaxScore_LUA.txt","r");
if filesizefile == nil then
filewritefile = io.open("MaxScore_LUA.txt","w");
filewritefile:close();
filesizefile = io.open("MaxScore_LUA.txt","r");
end;
filesize = filesizefile:seek("end");
filesizefile:close();
scores = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
if filesize == nil then
filesize = 0;
end;
if filesize < 20 then
fileinit = io.open("MaxScore_LUA.txt","w+")
for i = 1, #scores do
fileinit:write(scores[i]..'\n');
end;
fileinit:close();
end;
activescoring = false;
moviename = "";
maxscoresave = -9999999;
text(83,8,"-Inactive-");
while (true) do
if (movie.mode() == "record") then
if movie.ispoweron() then
maxscoretest = memory.readbyte(0x07d7)..memory.readbyte(0x07d8)..memory.readbyte(0x07d9)..memory.readbyte(0x07da)..memory.readbyte(0x07db)..memory.readbyte(0x07dc).."0";
activescoring = true;
--if (tonumber(maxscoretest) >= tonumber(maxscoresave)) then
if (tonumber(maxscoretest) <= 9999990) then
maxscoresave = maxscoretest;
moviename = movie.getname();
end;
--end;
text(83,8,maxscoresave);
end;
end;
if (movie.mode() == nil) then
if (activescoring == true) then
activescoring = false;
text(83,8,"-Inactive-");
readfile = io.open("MaxScore_LUA.txt","r");
linecount = 1
for line in readfile:lines() do
if linecount <= 20 then
scores[linecount] = line;
end;
linecount = linecount + 1;
end;
readfile:close ();
--if tonumber(maxscoresave) > tonumber(scores[19]) then
scores[19] = maxscoresave;
scores[20] = moviename;
bubbleSort(scores);
savefile = io.open("MaxScore_LUA.txt","w+")
for i = 1, #scores do
savefile:write(tostring(scores[i]));
savefile:write('\n');
end;
savefile:close();
--end;
end;
end;
FCEU.frameadvance();
end;
|
--[[
################################################################################
#
# Copyright (c) 2014-2017 Ultraschall (http://ultraschall.fm)
#
# 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.
#
################################################################################
]]
-- Print Message to console (debugging)
function Msg(val)
reaper.ShowConsoleMsg(tostring(val).."\n")
end
-- Used to escape "'s by toCSV
--function escapeCSV (s)
-- _, count = string.gsub(s, "\"", "\"")
-- if count==nil then count=0 end
-- if math.fmod(count,2)==1 then --if we have a odd number of " replace them with ""
-- if string.find(s, '["]') then
-- s = '"' .. string.gsub(s, '"', '""') .. '"'
-- end
-- elseif string.find(s,",")~=nil then
-- s="\""..s.."\""
-- end
-- return s
--end
function notes2csv ()
local csv = ""
local array = {}
local count=0
notes = reaper.GetSetProjectNotes(0, false, "")
for line in notes:gmatch"[^\n]*" do
count=count+1
csv = csv .. "," .. line --escapeCSV(line)
array[count]=line
end
retval= string.sub(csv, 2) -- remove first ","
return retval, count, array
end
function csv2lines (line)
title = line:match("(.-),")
artist= line:match(".-,(.-),")
album = line:match(".-,.-,(.-),")
year = line:match(".-,.-,.-,(.-),")
genre = line:match(".-,.-,.-,.-,(.-),")
comment = line:match(".-,.-,.-,.-,.-,(.*)")
--[[ pos=0
pos_old=1
clean=""
for i=1, 5,1 do
pos=string.find(result,",",pos_old)
substring=string.sub(line,pos_old,pos-1)
clean=clean..substring.."\n"
pos_old=pos+1
end
--check field 6
substring=string.sub(line,pos_old)
clean=clean..substring
]]
return title.."\n"..artist.."\n"..album.."\n"..year.."\n"..genre.."\n"..comment
end
function checkevencharacters(string,character)
local count=0
local even=true
for i=1, string.len(string) do
if string:sub(i,i)==character then
if even==true then even=false
else even=true
end
end
end
return even
end
--reaper.ShowConsoleMsg("") --clear console
dialog_ret_vals, count, dialog_retvals_array = notes2csv() --default values
retval, result = reaper.GetUserInputs("Edit ID3 Podcast Metadata", 6, "Title (no comma allowed):,Artist (no comma allowed):,Podcast (no comma allowed):,Year (no comma allowed):,Genre (no comma allowed):,Comment:", dialog_ret_vals)
count=0
temp=-1
old_pos=0
pos=0
if retval == true then
pos=result:match(".-,.-,.-,.-,.-,()")
firstvals=result:sub(1,pos-1)
restvals=result:sub(pos,-1)
pos=restvals:match(".-,()")
if pos~=nil then restvals="\""..restvals.."\"" end
if restvals:match("\"\".*\"\"")~=nil then restvals=restvals:sub(2,-2) end
even=checkevencharacters(firstvals:match(".-,"),"\"")
if even==false then firstvals=firstvals:match("(.-),").."\""..firstvals:match(".-(,.*)") end
even=checkevencharacters(firstvals:match(".-,(.-,)"),"\"")
if even==false then firstvals=firstvals:match("(.-,.-),").."\""..firstvals:match(".-,.-(,.*)") end
even=checkevencharacters(firstvals:match(".-,.-,(.-,)"),"\"")
if even==false then firstvals=firstvals:match("(.-,.-,.-),").."\""..firstvals:match(".-,.-,.-(,.*)") end
even=checkevencharacters(firstvals:match(".-,.-,.-,(.-,)"),"\"")
if even==false then firstvals=firstvals:match("(.-,.-,.-,.-),").."\""..firstvals:match(".-,.-,.-,.-(,.*)") end
even=checkevencharacters(firstvals:match(".-,.-,.-,.-,(.-,)"),"\"")
if even==false then firstvals=firstvals:match("(.-,.-,.-,.-,.-),").."\""..firstvals:match(".-,.-,.-,.-,.-(,.*)") end
even=checkevencharacters(restvals,"\"")
if even==false then restvals=restvals.."\"" end
notes = reaper.GetSetProjectNotes(0, true, csv2lines(firstvals..restvals)) -- write new notes
end
--[[
if retval == true then
--step through field 1-5 and check if the numer of " is even. Add a " to the end if needed.
pos=0
pos_old=1
clean=""
for i=1, 5,1 do
pos=string.find(result,",",pos_old)
substring=string.sub(result,pos_old,pos-1)
_, count = string.gsub(substring, "\"", "\"")
if math.fmod(count,2)==1 then substring=substring.."\"" end
clean=clean..substring..","
pos_old=pos+1
end
--check field 6
substring=string.sub(result,pos_old)
_, count = string.gsub(substring, "\"", "\"")
if math.fmod(count,2)==1 then substring=substring.."\"" end
clean=clean..substring
result=clean
-- if more than "," 5 then escape the comment field (surround with ")
_, count = string.gsub(result, ",", ",")
if count>5 then
pos=0
for i=1, 5,1 do
pos=string.find(result,",",pos+1)
end
temp=string.sub(result,pos+1,-1)
if temp:match("\"\".*\"\"")~=nil then newresult=string.sub(result,1,pos)..temp:sub(2,-2)
else newresult=string.sub(result,1,pos)..string.sub(result,pos+1)
end
reaper.MB(newresult,result,0)
result=newresult
--reaper.MB(string.sub(result,pos+1,-1),"",0)
end
notes = reaper.GetSetProjectNotes(0, true, csv2lines(result)) -- write new notes
end
--]]
|
--
--------------------------------------------------------------------------------
-- FILE: test.lua
-- USAGE: ./test.lua
-- DESCRIPTION: just for test
-- OPTIONS: ---
-- REQUIREMENTS: ---
-- BUGS: ---
-- NOTES: ---
-- AUTHOR: (), <>
-- COMPANY:
-- VERSION: 1.0
-- CREATED: 2014/4/6 1:06:42 中国标准时间
-- REVISION: ---
--------------------------------------------------------------------------------
--
--
local cards = {1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7}
local MAX_CARD_IN_A_ROW = 8
local maxRow = math.modf(#cards/MAX_CARD_IN_A_ROW)
local minColumn = #cards % MAX_CARD_IN_A_ROW
print('max ' .. maxRow .. ' min ' .. minColumn .. ' count ' .. #cards .. ' cards ' .. MAX_CARD_IN_A_ROW)
local output = ''
for i = 0, maxRow do
for j = 1, MAX_CARD_IN_A_ROW do
if i*MAX_CARD_IN_A_ROW+j <= #cards then
output = output .. cards[i*MAX_CARD_IN_A_ROW + j] .. '\t'
else
break
end
end
if i < maxRow then
output = output .. '\n'
end
end
print(output)
|
--[[-----------------------------------------------------------------------------
Label Widget
Displays text and optionally an icon.
-------------------------------------------------------------------------------]]
local Type, Version = "Label", 26
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local max, select, pairs = math.max, select, pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: GameFontHighlightSmall
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function UpdateImageAnchor(self)
if self.resizing then return end
local frame = self.frame
local width = frame.width or frame:GetWidth() or 0
local image = self.image
local label = self.label
local height
label:ClearAllPoints()
image:ClearAllPoints()
if self.imageshown then
local imagewidth = image:GetWidth()
if (width - imagewidth) < 200 or (label:GetText() or "") == "" then
-- image goes on top centered when less than 200 width for the text, or if there is no text
image:SetPoint("TOP")
label:SetPoint("TOP", image, "BOTTOM")
label:SetPoint("LEFT")
label:SetWidth(width)
height = image:GetHeight() + label:GetStringHeight()
else
-- image on the left
image:SetPoint("TOPLEFT")
if image:GetHeight() > label:GetStringHeight() then
label:SetPoint("LEFT", image, "RIGHT", 4, 0)
else
label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0)
end
label:SetWidth(width - imagewidth - 4)
height = max(image:GetHeight(), label:GetStringHeight())
end
else
-- no image shown
label:SetPoint("TOPLEFT")
label:SetWidth(width)
height = label:GetStringHeight()
end
-- avoid zero-height labels, since they can used as spacers
if not height or height == 0 then
height = 1
end
self.resizing = true
frame:SetHeight(height)
frame.height = height
self.resizing = nil
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
-- set the flag to stop constant size updates
self.resizing = true
-- height is set dynamically by the text and image size
self:SetWidth(200)
self:SetText()
self:SetImage(nil)
self:SetImageSize(16, 16)
self:SetColor()
self:SetFontObject()
self:SetJustifyH("LEFT")
self:SetJustifyV("TOP")
-- reset the flag
self.resizing = nil
-- run the update explicitly
UpdateImageAnchor(self)
end,
-- ["OnRelease"] = nil,
["OnWidthSet"] = function(self, width)
UpdateImageAnchor(self)
end,
["SetText"] = function(self, text)
self.label:SetText(text)
UpdateImageAnchor(self)
end,
["SetColor"] = function(self, r, g, b)
if not (r and g and b) then
r, g, b = 1, 1, 1
end
self.label:SetVertexColor(r, g, b)
end,
["SetImage"] = function(self, path, ...)
local image = self.image
image:SetTexture(path)
if image:GetTexture() then
self.imageshown = true
local n = select("#", ...)
if n == 4 or n == 8 then
image:SetTexCoord(...)
else
image:SetTexCoord(0, 1, 0, 1)
end
else
self.imageshown = nil
end
UpdateImageAnchor(self)
end,
["SetFont"] = function(self, font, height, flags)
self.label:SetFont(font, height, flags)
end,
["SetFontObject"] = function(self, font)
self:SetFont((font or GameFontHighlightSmall):GetFont())
end,
["SetImageSize"] = function(self, width, height)
self.image:SetWidth(width)
self.image:SetHeight(height)
UpdateImageAnchor(self)
end,
["SetJustifyH"] = function(self, justifyH)
self.label:SetJustifyH(justifyH)
end,
["SetJustifyV"] = function(self, justifyV)
self.label:SetJustifyV(justifyV)
end,
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
local image = frame:CreateTexture(nil, "BACKGROUND")
-- create widget
local widget = {
label = label,
image = image,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Tip Jar"
ENT.Author = "FPtje"
ENT.Spawnable = false
function ENT:initVars()
self.model = "models/props_lab/jar01a.mdl"
self.damage = 100
self.callOnRemoveId = "tipjar_activedonation_" .. self:EntIndex() .. "_"
self.activeDonations = {}
self.madeDonations = {}
self.PlayerUse = true
end
function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "owning_ent")
end
function ENT:UpdateActiveDonation(ply, amount)
local old = self.activeDonations[ply]
self.activeDonations[ply] = amount
self:PruneActiveDonations()
ply:CallOnRemove(self.callOnRemoveId .. ply:UserID(), function()
if not IsValid(self) then return end
self:ExitActiveDonation(ply)
end)
hook.Call("tipjarUpdateActiveDonation", DarkRP.hooks, self, ply, amount, old)
end
function ENT:ExitActiveDonation(ply)
local old = self.activeDonations[ply]
self.activeDonations[ply] = nil
self:PruneActiveDonations()
hook.Call("tipjarExitActiveDonation", DarkRP.hooks, self, ply, old)
self:RemoveCallOnRemove(self.callOnRemoveId .. ply:UserID())
end
function ENT:ClearActiveDonations()
table.Empty(self.activeDonations)
hook.Call("tipjarClearActiveDonation", DarkRP.hooks, self)
end
function ENT:PruneActiveDonations()
for ply, _ in pairs(self.activeDonations) do
if not IsValid(ply) then self.activeDonations[ply] = nil end
end
end
function ENT:AddDonation(name, amount)
local lastDonation = self.madeDonations[#self.madeDonations]
if lastDonation and lastDonation.name == name then
lastDonation.amount = lastDonation.amount + amount
else
table.insert(self.madeDonations, {
name = name,
amount = amount,
})
end
-- Enforce maximum of 100 donations
while #self.madeDonations > 100 do
table.remove(self.madeDonations, 1)
end
end
function ENT:ClearDonations()
table.Empty(self.madeDonations)
end
function ENT:CanTool(ply, trace, tool)
if tool == "remover" and ply == self:Getowning_ent() then return true end
end
|
-----------------------------------------
-- ID: 5780
-- Item: coffee_macaron
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Increases rate of synthesis success +5%
-- Increases synthesis skill gain rate +5%
-----------------------------------------
require("scripts/globals/status")
require("scripts/globals/msg")
-----------------------------------------
function onItemCheck(target)
local result = 0
if (target:hasStatusEffect(tpz.effect.FOOD) or target:hasStatusEffect(tpz.effect.FIELD_SUPPORT_FOOD)) then
result = tpz.msg.basic.IS_FULL
end
return result
end
function onItemUse(target)
target:addStatusEffect(tpz.effect.FOOD, 0, 0, 1800, 5780)
end
function onEffectGain(target, effect)
target:addMod(tpz.mod.SYNTH_SUCCESS, 5)
target:addMod(tpz.mod.SYNTH_SKILL_GAIN, 5)
end
function onEffectLose(target, effect)
target:delMod(tpz.mod.SYNTH_SUCCESS, 5)
target:delMod(tpz.mod.SYNTH_SKILL_GAIN, 5)
end
|
----------------------------------------
--- Discord Whitelist, Made by FAXES ---
----------------------------------------
fx_version 'bodacious'
game 'gta5'
server_only 'yes'
author 'FAXES'
description 'Hate updating those ACE Permission white-lists? Well just use Discord! Now you can thanks to this script, and @IllusiveTeas. So keep white lists easy and breezy. This script checks the connecting players Discord roles and checks whether they have the specified role.'
server_script 'server.js'
server_export 'getRoles'
server_export 'userHasRole'
server_export 'getName'
|
local L = require "espalier/elpatt"
local D, E, P, R, S, V = L.D, L.E, L.P, L.R, L.S, L.V
local Grammar = require "espalier/grammar"
local function pegylator(_ENV)
START "rules"
---[[
SUPPRESS ("WS", "enclosed", "form",
"element" ,"elements",
"allowed_prefixed", "allowed_suffixed",
"simple", "compound", "prefixed", "suffixed" )
--]]
local comment_m = -P"\n" * P(1)
local comment_c = comment_m^0 * #P"\n"
local letter = R"AZ" + R"az"
local valid_sym = letter + P"-"
local digit = R"09"
local sym = valid_sym + digit
local WS = (P' ' + P'\n' + P',' + P'\09')^0
local symbol = letter * ( -(P"-" * WS) * sym )^0
local h_string = (-P"`" * core.escape)^0
local d_string = (-P'"' * core.escape)^0
local s_string = (-P"'" * core.escape)^0
local range_match = -P"-" * -P"\\" * -P"]" * P(1)
local range_capture = (range_match + P"\\-" + P"\\]" + P"\\")
local range_c = range_capture^1 * P"-" * range_capture^1
local set_match = -P"}" * -P"\\" * P(1)
local set_c = (set_match + P"\\}" + P"\\")^1
local some_num_c = digit^1 * P".." * digit^1
+ (P"+" + P"-")^0 * digit^1
rules = V"comment"^0 * V"rule"^1
rule = V"lhs" * V"rhs"
lhs = WS * V"pattern" * WS * ( P":" + P"=" + ":=")
rhs = V"form"
form = V"element" * V"elements"
pattern = symbol
+ V"hidden_pattern"
hidden_pattern = P"`" * symbol * P"`"
element = -V"lhs" * WS
* ( V"simple"
+ V"compound"
+ V"comment" )
elements = V"choice"
+ V"cat"
+ P""
choice = WS * P"/" * V"form"
cat = WS * V"form"
compound = V"group"
+ V"enclosed"
+ V"hidden_match"
group = WS * V"pel"
* WS * V"form" * WS
* V"per"
pel = D "("
per = D ")"
enclosed = V"literal"
+ V"hidden_literal"
+ V"set"
+ V"range"
hidden_match = WS * P"``"
* WS * V"form" * WS
* P"``"
simple = V"suffixed"
+ V"prefixed"
+ V"atom"
comment = D";" * comment_c
prefixed = V"if_not_this"
+ V"not_this"
+ V"if_and_this"
+ V"capture"
suffixed = V"optional"
+ V"more_than_one"
+ V"maybe"
+ V"with_suffix"
+ V"some_number"
if_not_this = P"!" * WS * V"allowed_prefixed"
not_this = P"-" * WS * V"allowed_prefixed"
if_and_this = P"&" * WS * V"allowed_prefixed"
capture = P"~" * WS * V"allowed_prefixed"
literal = D'"' * d_string * D'"'
+ D"'" * s_string * D"'"
hidden_literal = -P"``" * D"`" * hidden_string * -P"``" * D"`"
set = P"{" * set_c^1 * P"}"
-- Change range to not use '-' separator instead require even # of bytes.
-- Ru catches edge cases involving multi-byte chars.
range = P"[" * range_c * P"]"
optional = V"allowed_suffixed" * WS * P"*"
more_than_one = V"allowed_suffixed" * WS * P"+"
maybe = V"allowed_suffixed" * WS * P"?"
with_suffix = V"some_number" * V"which_suffix"
which_suffix = ( P"*" + P"+" + P"?")
some_number = V"allowed_suffixed" * WS * V"some_suffix"
some_suffix = P"$" * V"repeats"
repeats = Csp(some_num_c)
allowed_prefixed = V"compound" + V"suffixed" + V"atom"
allowed_suffixed = V"compound" + V"prefixed" + V"atom"
atom = V"ws" + symbol
ws = Csp(P"_")
end
|
local starlib = require('starlib')
local trace = require('tracedoc.test.trace')
local doc = trace.new()
print('-------- set doc')
doc.a = 1
print('dump')
print(debug.dump(doc, nil, 5))
print('commit')
print(debug.dump(trace.commit(doc)))
print('-------- unset doc')
doc.a = nil
print('dump')
print(debug.dump(doc, nil, 5))
print('commit')
print(debug.dump(trace.commit(doc)))
print('-------- set doc table')
doc.a = {a = 1}
trace.commit(doc)
print('commit dump')
print(debug.dump(doc, nil, 10))
doc.a.b = 1
print('dump')
print(debug.dump(doc, nil, 10))
print('commit')
print(debug.dump(trace.commit(doc)))
|
include "app.gameClass.skill.Skill"
include "app.gameClass.Buff"
_ENV=namespace "game"
using_namespace "luaClass"
using_namespace "container"
---@class UniqueSkill : Skill
class("UniqueSkill"){
CLASS_DEBUG(false);
}
function UniqueSkill:UniqueSkill(pSkill,uniqueStruct)
--实例继承
inheritInstance(self,pSkill)
self.pSkill=pSkill
--此处和aoyi字段不同,是因为原始配置表如此,下版本会修改配置表
self.power=self.power+uniqueStruct.poweradd
self.name=uniqueStruct.name
self.info=uniqueStruct.info
self.hard=uniqueStruct.hard
self.animation=uniqueStruct.animation
self.cd=uniqueStruct.cd
self.costball=uniqueStruct.costball
self.picPath=Path:getInstance().root.icon..uniqueStruct.icon..".jpg"
self.castSize=uniqueStruct.castSize
self.coverSize=uniqueStruct.coverSize
self.battleCd=0
local mybuffs=map()
mybuffs:merge(self.buffs)
local buffs=uniqueStruct.buff and uniqueStruct.buff:split('#')
if buffs then
if buffs[1]~="" then
for _,buff in ipairs(buffs) do
local buff_t=buff:split('.')
local buffName=buff_t[1]
local buffLevel=buff_t[2] and tonumber(buff_t[2]) or 1
local buffRound=buff_t[3] and tonumber(buff_t[3]) or 1
local buffProb=buff_t[4] and tonumber(buff_t[4]) or 1
mybuffs:insert(buffName,
Buff:create(buffName,buffLevel,buffRound,buffProb)
)
end
end
end
self.buffs=mybuffs
end
function UniqueSkill:addExp(power)
self.pSkill:addExp(power)
end
function UniqueSkill:toString()
local strArr=array()
strArr:push_back(
string.format( "%s",self.name )
)
strArr:push_back(
string.format("威力 %i",self.power)
)
strArr:push_back(
string.format("消耗内力 %i",self.costMp )
)
strArr:push_back(
string.format("消耗怒气 %i",self.costball )
)
strArr:push_back(
string.format("技能CD %i/%i",self.battleCd,self.cd )
)
strArr:push_back(
string.format("适性 %s",self:getSuitStr() )
)
strArr:push_back(
string.format("buff效果 \n%s",self:getBuffStr() )
)
return strArr:join(" \n ")
end
|
ITEM.name = "작은 탁자"
ITEM.model = Model("models/props_c17/FurnitureDrawer002a.mdl")
ITEM.uniqueID = "stor_sdrawer"
ITEM.maxWeight = 4
ITEM.desc = "조금 작은 탁자입니다."
|
local Button = Object:extend()
function Button:new(scene, x, y, width)
if not Button.load then
Button.tiles = love.graphics.newImage("assets/tiles.png")
Button.tiles:setFilter("linear", "nearest")
Button.load = true
end
self.scene = scene
self.x = x
self.y = y
self.width = width
self.batch = love.graphics.newSpriteBatch(Button.tiles, width, "static")
for i = 0, width - 1 do
local qx = 0
if i > 0 then
qx = qx + 1
end
if i < width - 1 then
qx = qx + 2
end
local quad = love.graphics.newQuad(qx * 10 + 1, 1, 8, 8, 40, 40)
self.batch:add(quad, i, 0, 0, 1 / 8)
end
self.state = "default"
end
function Button:action()
end
function Button:update()
if love.mouse.isDown(1) then
if self.state ~= "missed" then
local tx, ty, scale = self.scene:calcTransform()
local x = (love.mouse.getX() - tx) / scale
local y = (love.mouse.getY() - ty) / scale
if x > self.x and x < self.x + self.width and y > self.y and y < self.y + 1 then
self.state = "pressed"
elseif self.state == "default" then
self.state = "missed"
else
self.state = "active"
end
end
else
if self.state == "pressed" then
self:action()
end
self.state = "default"
end
end
function Button:draw(scene)
if self.state == "pressed" then
love.graphics.rectangle("fill", self.x, self.y, self.width, 1)
love.graphics.setColor(0, 0, 0)
else
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", self.x, self.y, self.width, 1)
love.graphics.setColor(1, 1, 1)
love.graphics.draw(self.batch, self.x, self.y)
end
end
return Button
|
local M = {}
M.config = function()
O.lang.clang = {
diagnostics = {
virtual_text = { spacing = 0, prefix = "" },
signs = true,
underline = true,
},
cross_file_rename = true,
header_insertion = "never",
filetypes = { "c", "cpp", "objc" },
formatter = {
exe = "clang-format",
args = {},
stdin = true,
},
linters = {
"cppcheck",
"clangtidy",
},
debug = {
adapter = {
command = "/usr/bin/lldb-vscode",
},
stop_on_entry = false,
},
}
end
M.format = function()
local shared_config = {
function()
return {
exe = O.lang.clang.formatter.exe,
args = O.lang.clang.formatter.args,
stdin = O.lang.clang.formatter.stdin,
cwd = vim.fn.expand("%:h:p"),
}
end,
}
O.formatters.filetype["c"] = shared_config
O.formatters.filetype["cpp"] = shared_config
O.formatters.filetype["objc"] = shared_config
require("formatter.config").set_defaults({
logging = false,
filetype = O.formatters.filetype,
})
end
M.lint = function()
require("lint").linters_by_ft = {
c = O.lang.clang.linters,
cpp = O.lang.clang.linters,
}
end
M.lsp = function()
require('utils.lua').setup_lsp('clangd', {
handlers = {
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = O.lang.clang.diagnostics.virtual_text,
signs = O.lang.clang.diagnostics.signs,
underline = O.lang.clang.diagnostics.underline,
update_in_insert = true,
}),
}
})
end
M.dap = function()
if O.plugin.dap.active then
local dap_install = require("dap-install")
local dap = require("dap")
dap_install.config("ccppr_vsc_dbg", {})
dap.adapters.lldb = {
type = "executable",
command = O.lang.clang.debug.adapter.command,
name = "lldb",
}
local shared_dap_config = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = O.lang.clang.debug.stop_on_entry,
args = {},
env = function()
local variables = {}
for k, v in pairs(vim.fn.environ()) do
table.insert(variables, string.format("%s=%s", k, v))
end
return variables
end,
runInTerminal = false,
},
{
-- If you get an "Operation not permitted" error using this, try disabling YAMA:
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
name = "Attach to process",
type = "lldb", -- Adjust this to match your adapter name (`dap.adapters.<name>`)
request = "attach",
pid = function()
local output = vim.fn.system({ "ps", "a" })
local lines = vim.split(output, "\n")
local procs = {}
for _, line in pairs(lines) do
-- output format
-- " 107021 pts/4 Ss 0:00 /bin/zsh <args>"
local parts = vim.fn.split(vim.fn.trim(line), " \\+")
local pid = parts[1]
local name = table.concat({ unpack(parts, 5) }, " ")
if pid and pid ~= "PID" then
pid = tonumber(pid)
if pid ~= vim.fn.getpid() then
table.insert(procs, { pid = tonumber(pid), name = name })
end
end
end
local choices = { "Select process" }
for i, proc in ipairs(procs) do
table.insert(choices, string.format("%d: pid=%d name=%s", i, proc.pid, proc.name))
end
local choice = vim.fn.inputlist(choices)
if choice < 1 or choice > #procs then
return nil
end
return procs[choice].pid
end,
args = {},
},
}
dap.configurations.c = shared_dap_config
dap.configurations.cpp = shared_dap_config
end
end
return M
|
local LAM = LibAddonMenu2
local LMP = LibMediaProvider
Recount.SettingsMenu = {
name = "Recount_SettingsMenu",
}
function Recount.SettingsMenu.Initialize()
local panelData = {
type = "panel",
name = Recount.name,
displayName = Recount.name.." Settings",
author = "lwndow, Ferather, Shadow-Fighter, and others",
version = "0.7.6",
registerForRefresh = true,
registerForDefaults = true,
}
LAM:RegisterAddonPanel(Recount.SettingsMenu.name, panelData)
Recount.SettingsMenu:Setup()
end
function Recount.SettingsMenu:SetColor( setting, r, g, b, a )
Recount.settings[setting].r = r
Recount.settings[setting].g = g
Recount.settings[setting].b = b
Recount.settings[setting].a = a
Recount.FitUIElements()
end
function Recount.SettingsMenu:GetFont()
local str = '%s|%d'
if ( Recount.settings.progressBarFontOutline ~= 'none' ) then
str = str .. '|%s'
end
return string.format( str, LMP:Fetch( 'font', Recount.settings.progressBarFontFace ), Recount.settings.progressBarFontSize, Recount.settings.progressBarFontOutline )
end
function Recount.SettingsMenu:Setup()
local optionsData = {
{
type = "header",
name = "Version " .. Recount.versionString,
width = "full",
},
{
type = "checkbox",
name = "Use Account-Wide Settings",
tooltip = "Recount will use the same settings for all characters, reloads UI on click",
getFunc = function() return RecountSettings.Default[GetDisplayName()]['$AccountWide'].useAccountWide end,
setFunc = function( value ) RecountSettings.Default[GetDisplayName()]['$AccountWide'].useAccountWide = value ReloadUI() end,
default = Recount.settings.useAccountWide,
},
{
type = "checkbox",
name = "Disable All Auto Show/Hide",
tooltip = "Recount UI does not auto toggle itself, but only through command shortcuts",
getFunc = function() return Recount.settings.onlyUseKey end,
setFunc = function( value ) Recount.settings.onlyUseKey = value end,
default = Recount.settingsDefaults.onlyUseKey,
},
{
type = "checkbox",
name = "Minimize In Combat",
tooltip = "Minimize the main window while in combat",
getFunc = function() return Recount.settings.minimizeDuringCombat end,
setFunc = function( value ) Recount.settings.minimizeDuringCombat = value end,
default = Recount.settingsDefaults.minimizeDuringCombat,
},
{
type = "checkbox",
name = "Hide While Out Of Combat",
tooltip = "Hide the main window while out of combat",
getFunc = function() return Recount.settings.hideOutOfCombat end,
setFunc = function( value ) Recount.settings.hideOutOfCombat = value Recount.settings.wndMain.isVisible = not Recount.settings.wndMain.isVisible end,
default = Recount.settingsDefaults.hideOutOfCombat,
},
{
type = "slider",
name = "OOC Hide Delay",
tooltip = "Adjust the time the main window will be hidden when out of combat",
min = 1,
max = 30,
step = 1,
getFunc = function() return Recount.settings.hideOutOfCombatDelayInSeconds end,
setFunc = function( value ) Recount.settings.hideOutOfCombatDelayInSeconds = value end,
default = Recount.settingsDefaults.hideOutOfCombatDelayInSeconds,
},
{
type = "checkbox",
name = "Autoswitch Mode",
tooltip = "Autoswitch between log mode and damage overview after combat",
getFunc = function() return Recount.settings.autoSwitchMode end,
setFunc = function( value ) Recount.settings.autoSwitchMode = value end,
default = Recount.settingsDefaults.autoSwitchMode,
},
{
type = "checkbox",
name = "Suspend Data Collection While Hidden",
tooltip = "Do not continue to collect data while the main window is hidden",
getFunc = function() return Recount.settings.suspendDataCollectionWhileHidden end,
setFunc = function( value ) Recount.settings.suspendDataCollectionWhileHidden = value end,
default = Recount.settingsDefaults.suspendDataCollectionWhileHidden,
},
{
type = "checkbox",
name = "Count Deflected Damage",
tooltip = "Count deflected (parried, immune, reflected) damage as normal damage done",
getFunc = function() return Recount.settings.countDeflectedDmg end,
setFunc = function( value ) Recount.settings.countDeflectedDmg = value end,
default = Recount.settingsDefaults.countDeflectedDmg,
},
{
type = "checkbox",
name = "Show Skills Details",
tooltip = "Show hit number and critical strike statistics in the skill bar",
getFunc = function() return Recount.settings.showSkillDetails end,
setFunc = function( value ) Recount.settings.showSkillDetails = value end,
default = Recount.settingsDefaults.showSkillDetails,
},
{
type = "slider",
name = "Damage Bar Height",
tooltip = "Height of the damage bars",
min = 10,
max = 40,
step = 1,
getFunc = function() return Recount.settings.progressBarHeight end,
setFunc = function( value ) Recount.settings.progressBarHeight = value Recount.FitUIElements() end,
default = Recount.settingsDefaults.progressBarHeight,
},
{
type = "fontblock",
name = "Damage Bar Font",
tooltip = "Damage bar font (color is currently ignored)",
getFace = function() return Recount.settings.progressBarFontFace end,
getSize = function() return Recount.settings.progressBarFontSize end,
getOutline = function() return Recount.settings.progressBarFontOutline end,
getColor = function() return Recount.settings.progressBarFontColor.r, Recount.settings.progressBarFontColor.g, Recount.settings.progressBarFontColor.b, Recount.settings.progressBarFontColor.a end,
setFace = function( value ) Recount.settings.progressBarFontFace = value Recount.FitUIElements() end,
setSize = function( value ) Recount.settings.progressBarFontSize = value Recount.FitUIElements() end,
setOutline = function( value ) Recount.settings.progressBarFontOutline = value Recount.FitUIElements() end,
setColor = function( r, g, b, a ) Recount.SettingsMenu:SetColor( 'progressBarFontColor', r, g, b, a ); Recount.FitUIElements() end,
default = {
face = Recount.settingsDefaults.progressBarFontFace,
size = Recount.settingsDefaults.progressBarFontSize,
outline = Recount.settingsDefaults.progressBarFontOutline,
color = Recount.settingsDefaults.progressBarFontColor,
},
},
{
type = "colorpicker",
name = "Damage Bar Color",
tooltip = "Damage bar color",
getFunc = function() return Recount.settings.progressBarColor.r, Recount.settings.progressBarColor.g, Recount.settings.progressBarColor.b, Recount.settings.progressBarColor.a end,
setFunc = function( r, g, b, a ) Recount.SettingsMenu:SetColor( 'progressBarColor', r, g, b, a ) end,
default = {r = Recount.settingsDefaults.progressBarColor.r, g = Recount.settingsDefaults.progressBarColor.g, b = Recount.settingsDefaults.progressBarColor.b, a = Recount.settingsDefaults.progressBarColor.a},
},
{
type = "editbox",
name = "Periodic Tick Tag",
tooltip = "How periodic ticks are shown in the combat log",
getFunc = function() return Recount.settings.dotTag end,
setFunc = function( value ) Recount.settings.dotTag = value end,
isMultiline = false,
default = Recount.settingsDefaults.dotTag,
},
{
type = "editbox",
name = "Critical Strike Tag",
tooltip = "How critical strikes are shown in the combat log",
getFunc = function() return Recount.settings.critTag end,
setFunc = function( value ) Recount.settings.critTag = value end,
isMultiline = false,
default = Recount.settingsDefaults.critTag,
},
{
type = "editbox",
name = "Ignore Damage Logging",
tooltip = "Damage below or equal to this value will not show up in the log, but will count as DPS",
getFunc = function() return Recount.settings.minDPSLogValue end,
setFunc = function( value ) Recount.settings.minDPSLogValue = tonumber(value) or 0 end,
isMultiline = false,
default = Recount.settingsDefaults.minDPSLogValue,
},
{
type = "editbox",
name = "Ignore Healing Logging",
tooltip = "Heals below or equal to this value will not show up in the log, but will count as HPS",
getFunc = function() return Recount.settings.minHPSLogValue end,
setFunc = function( value ) Recount.settings.minHPSLogValue = tonumber(value) or 0 end,
isMultiline = false,
default = Recount.settingsDefaults.minHPSLogValue,
},
{
type = "editbox",
name = "Ignore Damage Done",
tooltip = "Damage below or equal to this value will not be tracked or logged",
getFunc = function() return Recount.settings.damageIgnore end,
setFunc = function( value ) Recount.settings.damageIgnore = tonumber(value) or 0 end,
isMultiline = false,
default = Recount.settingsDefaults.damageIgnore,
},
{
type = "editbox",
name = "Ignore Healing Done",
tooltip = "Healing below or equal to this value will not be tracked or logged",
getFunc = function() return Recount.settings.healIgnore end,
setFunc = function( value ) Recount.settings.healIgnore = tonumber(value) or 0 end,
isMultiline = false,
default = Recount.settingsDefaults.healIgnore,
},
}
LAM:RegisterOptionControls(Recount.SettingsMenu.name, optionsData)
end
|
local module = ...
local function build_list(objects)
local out = {}
for key, value in pairs(objects) do
if type(value) == 'table' then
if type(key) == 'string' then
table.insert(out, key .. "=")
end
table.insert(out, "{")
table.insert(out, build_list(value))
table.insert(out, "},")
elseif value == sjson.NULL then
-- skip it
else
table.insert(out, key)
table.insert(out, "=")
if type(value) == 'string' then
table.insert(out, "\"")
table.insert(out, value)
table.insert(out, "\"")
elseif type(value) == 'boolean' then
table.insert(out, tostring(value))
else
table.insert(out, value)
end
table.insert(out, ",")
end
end
return table.concat(out)
end
local function build(objects)
if not objects then return nil end
local out = {}
table.insert(out, "{")
table.insert(out, build_list(objects))
table.insert(out, "}")
return table.concat(out)
end
return function(objects)
package.loaded[module] = nil
module = nil
return build(objects)
end
|
nevermore_ultimate = class({})
LinkLuaModifier("modifier_nevermore_ultimate", "abilities/heroes/nevermore/nevermore_ultimate/modifier_nevermore_ultimate", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_nevermore_ultimate_thinker", "abilities/heroes/nevermore/nevermore_ultimate/modifier_nevermore_ultimate_thinker", LUA_MODIFIER_MOTION_NONE)
function nevermore_ultimate:GetCastAnimationCustom() return ACT_DOTA_CAST_ABILITY_6 end
function nevermore_ultimate:GetPlaybackRateOverride() return 1.0 end
function nevermore_ultimate:GetCastPointSpeed() return 0 end
function nevermore_ultimate:OnAbilityPhaseStart()
self.thinker = CreateModifierThinker(
self:GetCaster(), --hCaster
self, --hAbility
"modifier_nevermore_ultimate_thinker", --modifierName
{ duration = self:GetCastPoint() },
self:GetCaster():GetAbsOrigin(), --vOrigin
self:GetCaster():GetTeamNumber(), --nTeamNumber
false --bPhantomBlocker
)
local particle_cast = "particles/units/heroes/hero_nevermore/nevermore_wings.vpcf"
self.effect_cast = ParticleManager:CreateParticle(particle_cast, PATTACH_ABSORIGIN_FOLLOW, self:GetCaster())
EmitGlobalSound("Hero_Nevermore.ROS.Arcana.Cast")
return true
end
function nevermore_ultimate:OnAbilityPhaseInterrupted()
self.thinker:Destroy()
ParticleManager:DestroyParticle(self.effect_cast, true)
ParticleManager:ReleaseParticleIndex(self.effect_cast)
StopGlobalSound("Hero_Nevermore.ROS.Arcana.Cast")
end
function nevermore_ultimate:OnSpellStart()
local caster = self:GetCaster()
local origin = self:GetCaster():GetAbsOrigin()
local duration = self:GetSpecialValueFor("slow_duration")
local damage = self:GetSpecialValueFor("damage_per_soul")
local radius = self:GetSpecialValueFor("radius")
local base_damage = self:GetSpecialValueFor("base_damage")
local damage_per_soul = self:GetSpecialValueFor("damage_per_soul")
local damage_table = {
attacker = caster,
damage_type = DAMAGE_TYPE_PURE,
}
local modifier = self:GetCaster():FindModifierByName('modifier_nevermore_souls')
local souls = modifier:GetStackCount()
modifier:SetStackCount(0)
local lines = 5 + (souls * 3)
damage_table.damage = (base_damage + (souls * damage_per_soul))/2
local initial_angle_deg = caster:GetAnglesAsVector().y
local delta_angle = 360/lines
for i = 0, lines - 1 do
local facing_angle_deg = initial_angle_deg + delta_angle * i
if facing_angle_deg>360 then facing_angle_deg = facing_angle_deg - 360 end
local facing_angle = math.rad(facing_angle_deg)
local facing_vector = Vector(math.cos(facing_angle), math.sin(facing_angle), 0):Normalized()
local velocity = facing_vector * 1800
local projectile = {
EffectName = "particles/nevermore/nevermore_basic_attack.vpcf",
vSpawnOrigin = caster:GetAbsOrigin() + Vector(0, 0, 80),
fDistance = radius,
Source = caster,
vVelocity = velocity,
UnitBehavior = PROJECTILES_NOTHING,
TreeBehavior = PROJECTILES_NOTHING,
WallBehavior = PROJECTILES_NOTHING,
GroundBehavior = PROJECTILES_NOTHING,
fGroundOffset = 0,
UnitTest = function(_self, unit) return unit:GetUnitName() ~= "npc_dummy_unit" and not CustomEntitiesLegacy:Allies(_self.Source, unit) end,
OnFinish = function(_self, pos)
self:PlayEffectsOnFinish(pos)
end,
}
ProjectilesManagerInstance:CreateProjectile(projectile)
end
ApplyCallbackForUnitsInArea(caster, origin, radius/2, DOTA_UNIT_TARGET_TEAM_ENEMY, function(enemy)
damage_table.victim = enemy
ApplyDamage(damage_table)
EmitSoundOn("Hero_Spectre.Attack", enemy)
end)
ApplyCallbackForUnitsInArea(caster, origin, radius, DOTA_UNIT_TARGET_TEAM_ENEMY, function(enemy)
damage_table.victim = enemy
ApplyDamage(damage_table)
EmitSoundOn("Hero_Spectre.Attack", enemy)
end)
CreateRadiusMarker(caster, origin, radius/2, RADIUS_SCOPE_PUBLIC, 0.1)
CreateRadiusMarker(caster, origin, radius, RADIUS_SCOPE_PUBLIC, 0.1)
ScreenShake(origin, 100, 300, 0.45, 1000, 0, true)
ParticleManager:ReleaseParticleIndex(self.effect_cast)
self:PlayEffectsLines(lines)
end
function nevermore_ultimate:PlayEffectsLines(lines)
local caster = self:GetCaster()
EmitSoundOn("Hero_Nevermore.ROS.Arcana", caster)
local particle_cast = "particles/units/heroes/hero_nevermore/nevermore_requiemofsouls.vpcf"
local effect_cast = ParticleManager:CreateParticle(particle_cast, PATTACH_ABSORIGIN_FOLLOW, caster)
ParticleManager:SetParticleControl(effect_cast, 1, Vector(lines, 0, 0)) -- Lines
ParticleManager:SetParticleControlForward(effect_cast, 2, caster:GetForwardVector()) -- initial direction
ParticleManager:ReleaseParticleIndex(effect_cast)
end
function nevermore_ultimate:PlayEffectsOnFinish(pos)
local particle_cast = "particles/econ/items/shadow_fiend/sf_desolation/sf_base_attack_desolation_explosion.vpcf"
local effect_cast = ParticleManager:CreateParticle(particle_cast, PATTACH_ABSORIGIN, self:GetCaster())
ParticleManager:SetParticleControl(effect_cast, 3, pos)
ParticleManager:ReleaseParticleIndex(effect_cast)
end
if IsClient() then require("wrappers/abilities") end
Abilities.Castpoint(nevermore_ultimate)
|
--[[
Description: Probability computation functions for multinomial and nested logit models
Author: Harish Loganathan
]]
math.randomseed( os.time() )
local function calculate_multinomial_logit_probability(choices, utility, availables)
local probability = {}
local evsum = 0
local exp = math.exp
for k,c in ipairs(choices) do
--if utility is not a number, then availability is 0
if utility[k] ~= utility[k] then
utility[k] = 0
availables[k] = 0
end
probability[k] = availables[k] * exp(utility[k])
evsum = evsum + probability[k]
end
for cno,avl_ev in pairs(probability) do
if (avl_ev ~= 0) then
probability[cno] = avl_ev/evsum
end
end
return probability
end
local function calculate_nested_logit_probability(choiceset, utility, availables, scales)
local evmu = {}
local evsum = {}
local probability = {}
local exp = math.exp
local pow = math.pow
for nest,choices in pairs(choiceset) do
local mu = scales[nest]
local nest_evsum = 0
for i,c in ipairs(choices) do
if utility[c] ~= utility[c] then
utility[c] = 0
availables[c] = 0
end
local evmuc = availables[c] * exp(mu*utility[c])
evmu[c] = evmuc
nest_evsum = nest_evsum + evmuc
end
evsum[nest] = nest_evsum
end
sum_evsum_pow_muinv = 0
for nest,val in pairs(evsum) do
local mu = scales[nest]
sum_evsum_pow_muinv = sum_evsum_pow_muinv + pow(evsum[nest], (1/mu))
end
for nest,choices in pairs(choiceset) do
local mu = scales[nest]
for i,c in ipairs(choices) do
if evsum[nest] ~= 0 then
probability[c] = evmu[c] * pow(evsum[nest], (1/mu - 1))/sum_evsum_pow_muinv
else
probability[c] = 0
end
end
end
return probability
end
local function binary_search(a, x)
local lo = 1
local hi = #a
local floor = math.floor
while lo ~= hi do
local mid = floor((lo+hi)/2)
local midval = a[mid]
if midval > x then
hi = mid
elseif midval < x then
lo = mid+1
end
end
return hi --or lo since hi == lo is true
end
function calculate_probability(mtype, choiceset, utility, availables, scales)
local probability = {}
if mtype == "mnl" then
probability = calculate_multinomial_logit_probability(choiceset, utility, availables)
elseif mtype == "nl" then
probability = calculate_nested_logit_probability(choiceset,utility,availables,scales)
else
error("unknown model type:" .. mtype .. ". Only 'mnl' and 'nl' are currently supported")
end
return probability
end
function make_final_choice(probability)
local choices = {}
local choices_prob = {}
cum_prob = 0
for c,p in pairs(probability) do
table.insert(choices, c)
if(p~=p) then
p = 0
end
cum_prob = cum_prob + p
table.insert(choices_prob, cum_prob)
end
idx = binary_search(choices_prob, math.random())
return choices[idx]
end
function compute_mnl_logsum(utility, availability)
local evsum = 0
local exp = math.exp
for k,v in ipairs(utility) do
--if utility is not a number, then availability is 0
local avl = availability[k]
if v~=v then
v = 0
avl = 0
end
local ev = avl * exp(v)
evsum = evsum + ev
end
return math.log(evsum)
end
function compute_nl_logsum(choiceset, utility, availables, scales)
local evmu = {}
local evsum = {}
local probability = {}
local exp = math.exp
local pow = math.pow
for nest,choices in pairs(choiceset) do
local mu = scales[nest]
local nest_evsum = 0
for i,c in ipairs(choices) do
if utility[c] ~= utility[c] then
utility[c] = 0
availables[c] = 0
end
local evmuc = availables[c] * exp(mu*utility[c])
evmu[c] = evmuc
nest_evsum = nest_evsum + evmuc
end
evsum[nest] = nest_evsum
end
sum_evsum_pow_muinv = 0
for nest,val in pairs(evsum) do
local mu = scales[nest]
sum_evsum_pow_muinv = sum_evsum_pow_muinv + pow(evsum[nest], (1/mu))
end
return math.log(sum_evsum_pow_muinv)
end
|
--!strict
-- Unit tests are needed in this module more than any other.
local Types = require(script.Parent.Parent.Types)
local spec: Types.Spec = function(practModule, describe)
local PractGlobalSystems = (require :: any)(practModule.PractGlobalSystems)
local Symbols = (require :: any)(practModule.Symbols)
local createReconciler = (require :: any)(practModule.createReconciler)
local Pract = (require :: any)(practModule)
local customHeartbeat = Instance.new('BindableEvent')
local reconciler
describe('createReconciler', function(it)
it('should generate a closure-based reconciler object', function(expect)
reconciler = createReconciler()
expect.truthy(reconciler)
expect.truthy(reconciler.createHost)
end)
it('should set up a controlled global system environment', function(expect)
PractGlobalSystems.Stop()
PractGlobalSystems.HeartbeatFrameCount = 0
PractGlobalSystems.HeartbeatSignal = customHeartbeat.Event
PractGlobalSystems.Run()
expect.equal(0, PractGlobalSystems.HeartbeatFrameCount)
end)
end)
local defaultHost
describe('createHost', function(it)
it('creates a host with no instance, no key, and empty providers', function(expect)
local defaultProviders = {}
defaultHost = reconciler.createHost(nil, nil, defaultProviders, nil)
expect.equal(nil, defaultHost.instance)
expect.equal(nil, defaultHost.childKey)
expect.equal(defaultProviders, defaultHost.providers)
expect.deep_equal({providers = defaultProviders}, defaultHost)
end)
end)
local mountedTrees = {}
describe('mountVirtualTree', function(it)
it('mounts a virtual tree with a default host context', function(expect)
local element = Pract.create('Frame')
local tree = reconciler.mountVirtualTree(element)
table.insert(mountedTrees, tree)
expect.truthy(tree)
expect.equal(true, tree._mounted)
expect.equal(true, tree[Symbols.IsPractTree])
local rootNode = tree._rootNode
expect.truthy(rootNode)
expect.deep_equal(defaultHost, rootNode._hostContext)
expect.equal(element, rootNode._currentElement)
end)
end)
describe('unmountVirtualTree', function(it)
it('unmounts each virtual tree from previous tests', function(expect)
for i = 1, #mountedTrees do
reconciler.unmountVirtualTree(mountedTrees[i])
expect.equal(false, mountedTrees[i]._mounted)
end
end)
end)
describe("ElementKinds.SiblingCluster", function(it)
it("errors if sibling decorate element is mounted with no host instance", function(expect)
local tree
expect.errors(function()
tree = reconciler.mountVirtualTree(
Pract.combine(
Pract.decorate({})
)
)
end)
if tree then
reconciler.unmountVirtualTree(tree)
end
end)
it("propogages stamped element instance to sibling decorate element", function(expect)
local template = Instance.new("Folder")
template:SetAttribute("IsOurTemplate", true)
local tree = reconciler.mountVirtualTree(
Pract.combine(
Pract.stamp(template),
Pract.decorate({
[Pract.Attributes] = {
WasDecorated = true,
}
})
)
)
local rootNode: any = tree._rootNode
expect.truthy(rootNode)
local siblingClusterCache = rootNode._siblingHost.siblingClusterCache
expect.truthy(siblingClusterCache)
local stampedInstance = siblingClusterCache.lastProvidedInstance
expect.truthy(stampedInstance)
expect.equal(true, stampedInstance:GetAttribute("IsOurTemplate"))
expect.equal(true, stampedInstance:GetAttribute("WasDecorated"))
reconciler.unmountVirtualTree(tree)
end)
it("Re-mounts elements dependent on instances created by prior siblings", function(expect)
local template1 = Instance.new("Folder")
template1:SetAttribute("IsTemplate1", true)
local template2 = Instance.new("Folder")
template2:SetAttribute("IsTemplate2", true)
local tree = reconciler.mountVirtualTree(
Pract.combine(
Pract.stamp(template1),
Pract.decorate({
[Pract.Attributes] = {
WasDecorated = true,
}
})
)
)
local rootNode: any = tree._rootNode
expect.truthy(rootNode)
local siblingClusterCache = rootNode._siblingHost.siblingClusterCache
expect.truthy(siblingClusterCache)
local stampedInstance1 = siblingClusterCache.lastProvidedInstance
expect.truthy(stampedInstance1)
expect.equal(true, stampedInstance1:GetAttribute("IsTemplate1"))
expect.equal(nil, stampedInstance1:GetAttribute("IsTemplate2"))
expect.equal(true, stampedInstance1:GetAttribute("WasDecorated"))
reconciler.updateVirtualTree(
tree,
Pract.combine(
Pract.stamp(template2),
Pract.decorate({
[Pract.Attributes] = {
WasDecorated = true,
}
})
)
)
local stampedInstance2 = siblingClusterCache.lastProvidedInstance
expect.truthy(stampedInstance2)
expect.equal(nil, stampedInstance2:GetAttribute("IsTemplate1"))
expect.equal(true, stampedInstance2:GetAttribute("IsTemplate2"))
expect.equal(true, stampedInstance2:GetAttribute("WasDecorated"))
expect.equal(true, stampedInstance1:GetAttribute("IsTemplate1"))
expect.equal(nil, stampedInstance1:GetAttribute("IsTemplate2"))
expect.equal(nil, stampedInstance1:GetAttribute("WasDecorated"))
reconciler.unmountVirtualTree(tree)
end)
it("Waits for child for decorate elements occurring earlier in cluster", function(expect)
local template = Instance.new("Folder")
template:SetAttribute("IsTemplate", true)
local tree
expect.errors(function()
tree = reconciler.mountVirtualTree(
Pract.combine(
Pract.decorate({
[Pract.Attributes] = {
WasDecorated = true,
}
}),
Pract.stamp(template)
)
)
end)
if tree then
reconciler.unmountVirtualTree(tree)
end
local parentFolder = Instance.new("Folder")
tree = reconciler.mountVirtualTree(
Pract.combine(
Pract.decorate({
[Pract.Attributes] = {
WasDecorated = true,
}
}),
Pract.stamp(template)
),
parentFolder,
"ChildName"
)
local instance = parentFolder:FindFirstChild("ChildName")
expect.truthy(instance)
expect.equal(true, instance:GetAttribute("IsTemplate"))
expect.equal(true, instance:GetAttribute("WasDecorated"))
end)
it("Should unmount/remount components based on position, and in the correct order.", function(expect)
local template = Instance.new("Folder")
template:SetAttribute("IsTemplate", true)
local mountCounts = {0, 0, 0, 0}
local unmountCounts = {0, 0, 0 ,0}
local component1 = Pract.withLifecycle(function()
return {
didMount = function()
mountCounts[1] = mountCounts[1] + 1
end,
willUnmount = function()
unmountCounts[1] = unmountCounts[1] + 1
end,
render = function(props)
return Pract.stamp(template)
end
}
end)
local function makeDecoratorComponent(index: number)
return Pract.withLifecycle(function()
return {
didMount = function()
mountCounts[index] = mountCounts[index] + 1
end,
willUnmount = function()
unmountCounts[index] = unmountCounts[index] + 1
end,
render = function(props)
return Pract.decorate({
[Pract.Attributes] = {["Element" .. tostring(index)] = true}
})
end
}
end)
end
local component2 = makeDecoratorComponent(2)
local component3 = makeDecoratorComponent(3)
local component4 = makeDecoratorComponent(4)
local function render(hasElement2: boolean)
local elements = {}
table.insert(elements, Pract.create(component1, {}))
if hasElement2 then
table.insert(elements, Pract.create(component2, {}))
end
table.insert(elements, Pract.create(component3, {}))
table.insert(elements, Pract.create(component4, {}))
return Pract.combine(unpack(elements))
end
local tree = reconciler.mountVirtualTree(render(true))
local rootNode: any = tree._rootNode
expect.truthy(rootNode)
local mountedStampNode = rootNode._siblings[1]._child._child
expect.truthy(mountedStampNode)
local instance = mountedStampNode._instance
expect.truthy(instance)
expect.deep_equal({1, 1, 1, 1}, mountCounts)
expect.deep_equal({0, 0, 0, 0}, unmountCounts)
expect.equal(true, instance:GetAttribute("IsTemplate"))
expect.equal(true, instance:GetAttribute("Element2"))
expect.equal(true, instance:GetAttribute("Element3"))
expect.equal(true, instance:GetAttribute("Element4"))
reconciler.updateVirtualTree(tree, render(false))
expect.deep_equal({1, 1, 2, 2}, mountCounts)
expect.deep_equal({0, 1, 1, 1}, unmountCounts)
expect.equal(true, instance:GetAttribute("IsTemplate"))
expect.equal(nil, instance:GetAttribute("Element2"))
expect.equal(true, instance:GetAttribute("Element3"))
expect.equal(true, instance:GetAttribute("Element4"))
reconciler.updateVirtualTree(tree, render(true))
expect.deep_equal({1, 2, 3, 3}, mountCounts)
expect.deep_equal({0, 1, 2, 2}, unmountCounts)
expect.equal(true, instance:GetAttribute("IsTemplate"))
expect.equal(true, instance:GetAttribute("Element2"))
expect.equal(true, instance:GetAttribute("Element3"))
expect.equal(true, instance:GetAttribute("Element4"))
end)
end)
end
return spec
|
if select(2, UnitClass("player")) ~= "ROGUE" then return end
local GetSpellInfo = DrDamage.SafeGetSpellInfo
local GetSpellCritChance = GetSpellCritChance
local GetCritChance = GetCritChance
local UnitDebuff = UnitDebuff
local UnitCreatureType = UnitCreatureType
local math_min = math.min
local math_max = math.max
local math_floor = math.floor
local math_ceil = math.ceil
local UnitHealth = UnitHealth
local UnitHealthMax = UnitHealthMax
local UnitDamage = UnitDamage
local string_find = string.find
local string_lower = string.lower
local IsEquippedItemType = IsEquippedItemType
local select = select
local IsSpellKnown = IsSpellKnown
function DrDamage:PlayerData()
--Health Updates
self.TargetHealth = { [1] = 0.35, [2] = "player" }
--Special aura handling
--[[
local TargetIsPoisoned = false
local Mutilate = GetSpellInfo(1329)
local poison = GetSpellInfo(2818)
self.Calculation["TargetAura"] = function()
local temp = TargetIsPoisoned
TargetIsPoisoned = false
for i=1,40 do
local name, _, _, _, debuffType = UnitDebuff("target",i)
if name then
if debuffType == poison then
TargetIsPoisoned = true
break
end
else break end
end
if temp ~= TargetIsPoisoned then
return true, Mutilate
end
end
--]]
--GENERAL
self.Calculation["Stats"] = function( calculation, ActiveAuras, Talents, spell, baseSpell )
local mastery = calculation.mastery
local masteryLast = calculation.masteryLast
local spec = calculation.spec
if spec == 1 then
if mastery > 0 and mastery ~= masteryLast then
if calculation.E_dmgM then
local masteryBonus = calculation.masteryBonus
if masteryBonus then
calculation.E_dmgM = calculation.E_dmgM / masteryBonus
end
local bonus = 1 + (mastery * 0.01)
calculation.E_dmgM = calculation.E_dmgM * bonus
calculation.masteryLast = mastery
calculation.masteryBonus = bonus
end
end
elseif spec == 2 then
if mastery > 0 and mastery ~= masteryLast then
if baseSpell.AutoAttack or calculation.spellName == "Killing Spree" then
--Mastery: Main Gauche
--Each point of Mastery increases the chance by an additional 2.00%
calculation.extraWeaponDamageChance = mastery * 0.01
calculation.masteryLast = mastery
end
end
elseif spec == 3 then
if mastery > 0 and mastery ~= masteryLast then
if baseSpell.Finisher then
local masteryBonus = calculation.masteryBonus
if masteryBonus then
calculation.dmgM = calculation.dmgM / masteryBonus
end
--Mastery: Executioner
local bonus = 1 + (mastery * 0.01)
calculation.dmgM = calculation.dmgM * bonus
calculation.masteryLast = mastery
calculation.masteryBonus = bonus
end
end
end
end
--TODO: Verify if poison AP coefficients scale or not
local wpicon = "|T" .. select(3,GetSpellInfo(8679)) .. ":16:16:1:1|t"
local dpicon = "|T" .. select(3,GetSpellInfo(2823)) .. ":16:16:1:-1|t"
local mgicon = "|T" .. select(3,GetSpellInfo(76806)) .. ":16:16:1:1|t"
local hmicon = "|T" .. select(3,GetSpellInfo(56807)) .. ":16:16:1:1|t"
local vwicon = "|T" .. select(3,GetSpellInfo(79134)) .. ":16:16:1:1|t"
self.Calculation["ROGUE"] = function( calculation, ActiveAuras, Talents, spell, baseSpell )
--TODO: Check specialization is active
if IsSpellKnown(86531) then
calculation.agiM = calculation.agiM * 1.05
end
--Specialization
local spec = calculation.spec
local mastery = calculation.mastery
if spec == 1 then
calculation.impPoison = true
elseif spec == 2 then
--Vitality: Increased attack power by 30%
calculation.APM = calculation.APM * 1.4
--Ambidexterity: Increased off-hand damage
calculation.offHdmgM = calculation.offHdmgM * 1.75
if mastery > 0 then
local mgicon = "|T" .. select(3,GetSpellInfo(76806)) .. ":16:16:1:1|t"
--Main gauche
--Your main hand attacks have a chance to grant you an extra attack (1.2x mh weapon damage) based on mastery%
if baseSpell.AutoAttack or calculation.spellName == "Killing Spree" then
--Killing Spree apparently counts for main gauche
if not calculation.extraDamage then calculation.extraDamage = 0 end
calculation.extraWeaponDamage = 1.2
calculation.extraWeaponDamageM = true
calculation.extraWeaponDamageNorm = false
calculation.extraWeaponDamage_dmgM = calculation.dmgM_global
calculation.extra_canCrit = true
--calculation.extra_critPerc = GetCritChance() + calculation.meleeCrit
calculation.extraName = calculation.extraName and (calculation.extraName .. " MG " .. mgicon) or ( " MG " .. mgicon )
end
end
elseif spec == 3 then
--Sinister Calling: Increases agility by 30%
calculation.agiM = calculation.agiM * 1.3
if calculation.spellName == "Hemorrhage" then
--Multiplicative according to tooltip
calculation.WeaponDamage = calculation.WeaponDamage * 1.40
end
--Sanguinary Vein increases damage against bleeding targets
if IsSpellKnown(79147) and ActiveAuras["Bleeding"] then
calculation.dmgM = calculation.dmgM * 1.25
end
--TODO-MINOR: Slice and Dice bonus from Executioner?
end
if ActiveAuras["Blade Flurry"] then
if calculation.aoe then
--calculation.targets = calculation.targets * 2
calculation.targets = 5
calculation.aoeM = 0.4
end
end
if not baseSpell.NoPoison and (ActiveAuras["Wound Poison"] or ActiveAuras["Deadly Poison"]) then
calculation.E_dmgM = calculation.dmgM_Magic --* select(7,UnitDamage("player")) / calculation.dmgM_Physical
calculation.E_canCrit = true
--Improved Poisons
calculation.extraChance = (0.30 + (IsSpellKnown(14117) and 0.2 or 0)) * math_max(0,math_min(1, (calculation.hit + calculation.hitPerc)/100))
if ActiveAuras["Wound Poison"] then
calculation.extra = self:ScaleData(0.417, 0.28, calculation.playerLevel, 0)
calculation.extraDamage = 0.12
calculation.extraName = calculation.extraName and (calculation.extraName .. "+" .. wpicon) or wpicon
elseif ActiveAuras["Deadly Poison"] then
if not ActiveAuras["Poisoned"] then
--Include only DoT portion
calculation.extra = 4 * self:ScaleData(0.6, 0, calculation.playerLevel,0)
calculation.extraDamage = 4 * 0.213
calculation.extraTicks = 4
calculation.extraName = calculation.extraName and (calculation.extraName .. "+" .. dpicon .. " DoT") or (dpicon .. " DoT")
calculation.E_eDuration = 12
else
--Instant portion
calculation.extra = self:ScaleData(0.313,0.28,calculation.playerLevel,0)
calculation.extraDamage = 0.109
calculation.extraName = calculation.extraName and (calculation.extraName .. "+" .. dpicon) or dpicon
--DoT portion into DPS calculation
calculation.extra_DPS = 4 * self:ScaleData(0.6, 0, calculation.playerLevel, 0)
calculation.extra_DPS_canCrit = true
calculation.extraDamage_DPS = 4 * 0.213
calculation.extraDuration_DPS = 12
calculation.extraName_DPS = dpicon .. " DoT"
end
end
end
end
self.Calculation["Relentless Strikes"] = function( calculation, value )
calculation.actionCost = calculation.actionCost - value * calculation.Melee_ComboPoints * 25
end
self.Calculation["Shiv"] = function( calculation, _ )
local spec = calculation.spec
calculation.extraChance_O = 0.01 * math_max(0,math_min(100, self:GetMeleeHit(calculation.playerLevel,calculation.targetLevel) + calculation.meleeHit))
calculation.E_canCrit = false
if spec == 2 and IsSpellKnown(35551) then
calculation.actionCost = calculation.actionCost - 0.3 * 0.2 * (calculation.hitO / 100)
end
end
self.Calculation["Envenom"] = function( calculation, ActiveAuras )
local spec = calculation.spec
if ActiveAuras["Deadly Poison"] then
calculation.Melee_ComboPoints = math_min(ActiveAuras["Deadly Poison"], calculation.Melee_ComboPoints)
else
calculation.Melee_ComboPoints = 0
calculation.zero = true
end
--Assassin's Resolve
if spec == 1 and IsSpellKnown(84601) then
calculation.dmgM = calculation.dmgM * 1.25
end
end
self.Calculation["Mutilate"] = function( calculation, ActiveAuras )
local spec = calculation.spec
--Assassin's Resolve
if spec == 1 and IsSpellKnown(84601) then
calculation.dmgM = calculation.dmgM * 1.25
end
end
self.Calculation["Killing Spree"] = function( calculation, ActiveAuras )
if not ActiveAuras["Killing Spree"] then
-- Killing Spree adds 50% damage (no glyph needed)
calculation.dmgM = calculation.dmgM * 1.5
end
end
self.Calculation["Rupture"] = function( calculation, ActiveAuras )
local spec = calculation.spec
if self:GetSetAmount("T15") >= 2 and calculation.Melee_ComboPoints > 0 then
calculation.Melee_ComboPoints = calculation.Melee_ComboPoints + 1
end
if spec == 1 then
--Venomous Wounds
if IsSpellKnown(79134) then
if not calculation.extraDamage then
calculation.extraDamage = 0
end
--TODO: Add hits and crits?
calculation.extraTickDamage = self:ScaleData(0.6, nil, calculation.playerLevel)
calculation.extraTickDamageBonus = 0.176
if self:GetSetAmount("T14") >= 2 then
calculation.extraTickDamage = calculation.extraTickDamage * 1.2
end
--Chance to do extra damage is at 75%
calculation.extraTickDamageChance = 0.75
calculation.extraTickDamageCost = 10
calculation.extraName = calculation.extraName and (calculation.extraName .. "+" .. vwicon) or vwicon
end
--Assassin's Resolve
if IsSpellKnown(84601) then
calculation.dmgM_Add = calculation.dmgM_Add * 1.25
end
if self:GetSetAmount("T14") >= 2 then
calculation.dmgM_Add = calculation.dmgM_Add * 1.2
end
elseif spec == 3 then
-- Sanguinary Vein adds 50% to rupture
if IsSpellKnown(79147) then
calculation.dmgM_Add = calculation.dmgM_Add * 1.5
end
end
end
self.Calculation["Garrote"] = function( calculation, ActiveAuras )
--Venomous wounds, plus deadly poison or wound poison
if IsSpellKnown(79134) and (ActiveAuras["Deadly Poison"] or ActiveAuras["Wound Poison"]) then
if not calculation.extraDamage then
calculation.extraDamage = 0
end
--TODO: Add hits and crits?
calculation.extraTickDamage = self:ScaleData(0.6, nil, calculation.playerLevel)
calculation.extraTickDamageBonus = 0.176
if self:GetSetAmount("T14") >= 2 then
calculation.extraTickDamage = calculation.extraTickDamage * 1.2
end
calculation.extraTickDamageChance = 0.75
calculation.extraTickDamageCost = 10
calculation.extraName = calculation.extraName and (calculation.extraName .. "+" .. vwicon) or vwicon
end
end
self.Calculation["Hemorrhage"] = function( calculation )
if self:GetNormM() == 1.8 then
calculation.WeaponDamage = calculation.WeaponDamage * 2.03
elseif self:GetNormM() >= 2.0 then
calculation.WeaponDamage = calculation.WeaponDamage * 1.4
end
calculation.extraAvg = 0.5 * calculation.bleedBonus
calculation.extraAvgM = 1
calculation.extraAvgChance = 1
calculation.extraName = calculation.extraName and (calculation.extraName .. "+" .. hmicon) or hmicon
--Duration 24, ticks every 3 seconds
calculation.extraTicks = 8
end
self.Calculation["Crimson Tempest"] = function ( calculation )
local spec = calculation.spec
--Sub gets 24% more damage on this ability
if spec == 3 then
calculation.dmgM = calculation.dmgM * 1.24
end
calculation.extraAvg = 2.4 * calculation.bleedBonus
calculation.extraTicks = 6
calculation.extra_canCrit = true
calculation.extraName = "CoT DoT"
end
self.Calculation["Sinister Strike"] = function( calculation )
if self:GetSetAmount("Legendary Dagger") >= 1 then
calculation.dmgM_Add = calculation.dmgM_Add + 0.45
end
if self:GetSetAmount("T14") >= 2 then
--Multiplicative based on tooltip
calculation.dmgM = calculation.dmgM * 1.15
end
end
self.Calculation["Revealing Strike"] = function( calculation )
if self:GetSetAmount("Legendary Dagger") >= 1 then
calculation.dmgM_Add = calculation.dmgM_Add + 0.45
end
end
self.Calculation["Backstab"] = function( calculation )
if self:GetSetAmount("T14") >= 2 then
calculation.dmgM = calculation.dmgM * 1.10
--if UnitHealth("target") ~= 0 and (UnitHealth("target") / UnitHealthMax("target")) < 0.35 then
-- calculation.actionCost = calculation.actionCost - Talents["Murderous Intent"]
end
end
self.Calculation["Ambush"] = function( calculation )
if Weapon == GetSpellInfo(1180) then
--Daggers
calculation.dmgM_add = calcuation.dmgM_Add * 1.447
end
end
self.Calculation["Attack"] = function( calculation, ActiveAuras )
if ActiveAuras["Shadow Blades"] then
calculation.glancing = nil
calculation.dmgM = calculation.dmgM * calculation.dmgM_Magic
calculation.armorM = 1
end
end
--SETS
-- --T14
self.SetBonuses["T14"] = { 87126, 87128, 87124, 87127, 87125, 85301, 85299, 85303, 85300, 85302, 86641, 86639, 86643, 86640, 86642 }
self.SetBonuses["T15"] = { 95305, 95306, 95307, 95308, 95309, 95935, 95936, 95937, 95938, 95939, 96679, 96680, 96681, 96682, 96683 }
--Legendary Daggers: Fear, The Sleeper, Golad, Twilight of Aspects
self.SetBonuses["Legendary Dagger"] = { 77945, 77947, 77949 }
--AURA
--Player
--Killing Spree (TODO: Verify API handles it properly)
self.PlayerAura[GetSpellInfo(51690)] = { ActiveAura = "Killing Spree", ID = 51690 }
--Envenom (4.0)
self.PlayerAura[GetSpellInfo(32645)] = { ActiveAura = "Envenom", ID = 32645 }
--Blade Flurry (4.0)
self.PlayerAura[GetSpellInfo(13877)] = { ActiveAura = "Blade Flurry", Not = { "Fan of Knives", "Crimson Tempest", "Rupture", "Garrote" }, ID = 13877 }
--Slice and Dice (4.0)
self.PlayerAura[GetSpellInfo(5171)] = { Finisher = true, ID = 5171, Mods = { ["haste"] = function(v) return v * 1.4 end } }
--Shallow Insight
self.PlayerAura[GetSpellInfo(84745)] = { SelfCast = true, ID = 84745, Category = "Bandit's Guile", Value = 0.1 }
--Moderate Insight
self.PlayerAura[GetSpellInfo(84746)] = { SelfCast = true, ID = 84746, Category = "Bandit's Guile", Value = 0.2 }
--Deep Insight
self.PlayerAura[GetSpellInfo(84747)] = { SelfCast = true, ID = 84747, Category = "Bandit's Guile", Value = 0.3 }
--Deadly Poison (4.0)
self.PlayerAura[GetSpellInfo(2823)] = { ActiveAura = "Deadly Poison", ID = 2823, BuffID = 2823 }
--Wound Poison (4.0)
self.PlayerAura[GetSpellInfo(43461)] = { ActiveAura = "Wound Poison", ID = 8679, BuffID = 8679 }
--Target
self.TargetAura[GetSpellInfo(2818)] = { ActiveAura = "Poisoned", ID = 2818, DebuffID = 2818, SelfCast = true }
--Vendetta (4.0)
self.TargetAura[GetSpellInfo(79140)] = { SelfCast = true, ID = 79140, Value = 0.3 }
--Revealing Strike (Only affects Eviscerate and Rupture - verified on WoWhead and WoWDB)
self.TargetAura[GetSpellInfo(84617)] = { SelfCast = true, ID = 84617, Spells = { "Eviscerate", "Rupture" }, ModType =
function( calculation )
calculation.dmgM = calculation.dmgM * 1.35
end
}
--Find Weakness (4.0)
self.TargetAura[GetSpellInfo(91023)] = { Ranks = 1, Value = 0.7, ModType = "armorM", ID = 91023 }
--Bleed effects (TODO: Verify this contains all important ones)
--Crimson Tempest
self.TargetAura[GetSpellInfo(122233)] = { ActiveAura = "Bleeding", ID = 122233 }
--Garrote - 4.0
self.TargetAura[GetSpellInfo(703)] = self.TargetAura[GetSpellInfo(122233)]
--Rupture - 4.0
self.TargetAura[GetSpellInfo(1943)] = self.TargetAura[GetSpellInfo(122233)]
--Shadow blades
self.TargetAura[GetSpellInfo(121471)] = { ActiveAura = "Shadow Blades", ID = 121471 }
self.spellInfo = {
[GetSpellInfo(1752)] = {
["Name"] = "Sinister Strike",
["ID"] = 1752,
["Data"] = { 0.178 },
--AoE here is only relevant to Blade Flurry
[0] = { WeaponDamage = 2.4, AoE = true, NoPoison = true },
[1] = { 0 },
},
[GetSpellInfo(53)] = {
["Name"] = "Backstab",
["ID"] = 53,
["Data"] = { 0.307 },
[0] = { WeaponDamage = 3.8, NoPoison = true, Weapon = GetSpellInfo(1180) }, --Daggers
[1] = { 0 },
},
[GetSpellInfo(2098)] = {
["Name"] = "Eviscerate",
["ID"] = 2098,
["Data"] = { 0.593 * 0.9, 1, ["perCombo"] = 0.786 * 0.9 },
[0] = { School = "Physical", ComboPoints = true, APBonus = 0.16 * 0.9, Finisher = true, AoE = true },
[1] = { 0, 0, PerCombo = 0 },
},
[GetSpellInfo(8676)] = {
["Name"] = "Ambush",
["ID"] = 8676,
["Data"] = { 0.5 },
[0] = { WeaponDamage = 3.25, AoE = true, NoPoison = true },
[1] = { 0 },
},
[GetSpellInfo(703)] = {
-- This matches datamined info, but doesn't match in game values. Need to figure out why.
["Name"] = "Garrote",
["ID"] = 703,
["Data"] = { 0.70769 },
[0] = { DotHits = 6, APBonus = 0.468, eDuration = 18, Ticks = 3, NoWeapon = true, NoPoison = true, Bleed = true },
[1] = { 0 },
},
[GetSpellInfo(1943)] = {
["Name"] = "Rupture",
["ID"] = 1943,
["Data"] = { 0.1853, ["perCombo"] = 0.0256 },
[0] = { ComboPoints = true, APBonus = 0.186, DotHits = 4, eDuration = 8, Ticks = 2, TicksPerCombo = 1, Bleed = true, Finisher = true, NoPoison = true, AoE = false },
[1] = { 0, PerCombo = 0, },
},
[GetSpellInfo(16511)] = {
["Name"] = "Hemorrhage",
["ID"] = 16511,
["Data"] = { 0 },
[0] = { WeaponDamage = 1.6, NoPoison = true },
[1] = { 0 },
},
[GetSpellInfo(121411)] = {
["Name"] = "Crimson Tempest",
["ID"] = 121411,
["Data"] = { 0.476, ["perCombo"] = 0.028 },
[0] = { APBonus = 0.028, ComboPoints = true, Finisher = true, AoE = false, Bleed = true },
[1] = { 0 },
},
[GetSpellInfo(5938)] = {
["Name"] = "Shiv",
["ID"] = 5938,
[0] = { WeaponDamage = 0.25, OffhandAttack = true, NoCrits = true, NoNormalization = true, NoPoison = true },
[1] = { 0 },
},
[GetSpellInfo(32645)] = {
["Name"] = "Envenom",
["ID"] = 32645,
["Data"] = { 0.3849, ["perCombo"] = 0.3851 },
[0] = { School = "Nature", ComboPoints = true, APBonus = 0.112, Finisher = true },
[1] = { 0, PerCombo = 0 },
},
[GetSpellInfo(26679)] = {
["Name"] = "Deadly Throw",
["ID"] = 26679,
["Data"] = { 0.429, 1 },
[0] = { School = { "Physical", "Ranged" }, ComboPoints = true, WeaponDamage = 1, NoPoison = true, NoNormalization = true, Finisher = true },
[1] = { 0, 0, PerCombo = 0 },
},
[GetSpellInfo(1329)] = {
["Name"] = "Mutilate",
["ID"] = 1329,
["Data"] = { 0.179 },
[0] = { WeaponDamage = 2.8, School = "Physical", DualAttack = true, NoPoison = true, Weapon = GetSpellInfo(1180) }, --Daggers
[1] = { 0 },
},
[GetSpellInfo(51723)] = {
["Name"] = "Fan of Knives",
["ID"] = 51723,
["Data"] = { 1 },
[0] = { AoE = false, APBonus = 0.14, NoNormalization = true },
[1] = { 0 },
},
[GetSpellInfo(51690)] = {
["Name"] = "Killing Spree",
["ID"] = 51690,
[0] = { WeaponDamage = 1, DualAttack = true, Hits = 7, NoNormalization = true, AoE = true },
[1] = { 0 },
},
[GetSpellInfo(84617)] = {
["Name"] = "Revealing Strike",
["ID"] = 84617,
["Data"] = { 0 },
[0] = { AoE = true, WeaponDamage = 1.6, NoNormalization = true, NoPoison = true },
[1] = { 0 },
},
[GetSpellInfo(111240)] = {
["Name"] = "Dispatch",
["ID"] = 111240,
["Data"] = { 2.0669 },
[0] = { WeaponDamage = 6.45, NoPoison = true },
[1] = { 0, 0 },
},
[GetSpellInfo(114014)] = {
["Name"] = "Shuriken Toss",
["ID"] = 114014,
["Data"] = { 2 },
[0] = { APBonus = 0.6 },
[1] = { 0, 0 },
},
}
self.talentInfo = {
--ALL:
--Relentless Strikes
--Now affects more abilities (verified on wowhead's "modified by").
[GetSpellInfo(58423)] = { [1] = { Effect = { 0.20 }, Spells = { "Eviscerate", "Rupture", "Slice and Dice", "Crimson Tempest", "Envenom" }, ModType = "Relentless Strikes", }, },
--ASSASSINATION:
--Venomous Wounds
[GetSpellInfo(79134)] = { [1] = { Effect = 0.3, Spells = { "Rupture", "Garrote" }, ModType = "Venomous Wounds" }, },
--COMBAT:
--SUBTLETY:
}
end
|
--final = final drive ratio of car
--gearratio[6] = gear ratio in 6th gear
--tcircumference = tire circumference
gearratio = {}
acceleration = 5.7
redline = 8000
final = 4.2
gearratio[1] = 2.92
gearratio[2] = 1.75
gearratio[3] = 1.31
gearratio[4] = 1.03
gearratio[5] = .848
gearratio[6] = 0
tcircumference = 6.17
price = 40000
|
Set = {}
Set.mt = {} -- metatable for sets
function Set.new (t)
local set = {}
-- important
setmetatable(set, Set.mt)
for _, l in ipairs(t) do set[l] = true end
return Set
end
function Set.union (a,b)
local res = Set.new{}
for k in pairs(a) do res[k] = true end
for k in pairs(b) do res[k] = true end
return res
end
function Set.intersection (a,b)
local res = Set.new{}
for k in pairs(a) do
res[k] = b[k]
end
return res
end
function Set.tostring (set)
local s = "{"
local sep = ""
for e in pairs(set) do
s = s .. sep .. e
sep = ", "
end
return s .. "}"
end
function Set.print (s)
print(Set.tostring(s))
end
s1 = Set.new{10, 20, 30, 50}
s2 = Set.new{30, 1}
--共享相同的metatable
print(getmetatable(s1))
print(getmetatable(s2))
Set.mt.__add = Set.union
s3 = s1 + s2
Set.print(s3) --> {1, 10, 20, 30, 50}
Set.mt.__mul = Set.intersection
Set.print((s1 + s2)*s1) --> {10, 20, 30, 50}
--小于等于
Set.mt.__le = function (a,b) -- set containment
for k in pairs(a) do
if not b[k] then return false end
end
return true
end
--小于
Set.mt.__lt = function (a,b)
return a <= b and not (b <= a)
end
--相等
Set.mt.__eq = function (a,b)
return a <= b and b <= a
end
s1 = Set.new{2, 4}
s2 = Set.new{4, 10, 2}
print(s1 <= s2) --> true
print(s1 < s2) --> true
print(s1 >= s1) --> true
print(s1 > s1) --> false
print(s1 == s2 * s1) --> true
--保护不被修改
Set.mt.__metatable = "not your business"
s1 = Set.new{}
print(getmetatable(s1)) --> not your business
setmetatable(s1, {})
--stdin:1: cannot change protected metatable
|
--// Syn Admin Commands; Loader \\--
--<< Setup >>--
local Folder = script.Parent.Parent.Parent
local Setup = Folder:FindFirstChild('Setup')
local Plugins = Setup:FindFirstChild('Plugins')
local settings = Setup:FindFirstChild('Settings')
-- MainModule; https://www.roblox.com/library/4665853426/Syn-Admin-Commands-MainModule
local MainModule = game:GetService('ReplicatedStorage'):FindFirstChild('MainModule')
--<< Run MainModule >>--
-- Protection
local Success, Error = pcall(function()
require(MainModule)({
Folder = Folder,
Setup = Setup,
Plugins = Plugins,
settings = settings,
})
end)
-- Check success
if not Success then
warn('Syn: Error loading MainModule; ', Error)
end
|
local bin = require "bin"
local nmap = require "nmap"
local shortport = require "shortport"
local stdnse = require "stdnse"
local string = require "string"
local tab = require "tab"
local table = require "table"
description = [[
Queries Quake3-style master servers for game servers (many games other than Quake 3 use this same protocol).
]]
---
-- @usage
-- nmap -sU -p 27950 --script=quake3-master-getservers <target>
-- @output
-- PORT STATE SERVICE REASON
-- 27950/udp open quake3-master
-- | quake3-master-getservers:
-- | 192.0.2.22:26002 Xonotic (Xonotic 3)
-- | 203.0.113.37:26000 Nexuiz (Nexuiz 3)
-- |_ Only 2 shown. Use --script-args quake3-master-getservers.outputlimit=-1 to see all.
--
-- @args quake3-master-getservers.outputlimit If set, limits the amount of
-- hosts returned by the script. All discovered hosts are still
-- stored in the registry for other scripts to use. If set to 0 or
-- less, all files are shown. The default value is 10.
author = "Toni Ruottu"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"default", "discovery", "safe"}
portrule = shortport.port_or_service ({20110, 20510, 27950, 30710}, "quake3-master", {"udp"})
postrule = function()
return (nmap.registry.q3m_servers ~= nil)
end
-- There are various sources for this information. These include:
-- - http://svn.icculus.org/twilight/trunk/dpmaster/readme.txt?view=markup
-- - http://openarena.wikia.com/wiki/Changes
-- - http://dpmaster.deathmask.net/
-- - qstat-2.11, qstat.cfg
-- - scanning master servers
-- - looking at game traffic with Wireshark
local KNOWN_PROTOCOLS = {
["5"] = "Call of Duty",
["10"] = "unknown",
["43"] = "unknown",
["48"] = "unknown",
["50"] = "Return to Castle Wolfenstein",
["57"] = "unknown",
["59"] = "Return to Castle Wolfenstein",
["60"] = "Return to Castle Wolfenstein",
["66"] = "Quake III Arena",
["67"] = "Quake III Arena",
["68"] = "Quake III Arena, or Urban Terror",
["69"] = "OpenArena, or Tremulous",
["70"] = "unknown",
["71"] = "OpenArena",
["72"] = "Wolfenstein: Enemy Territory",
["80"] = "Wolfenstein: Enemy Territory",
["83"] = "Wolfenstein: Enemy Territory",
["84"] = "Wolfenstein: Enemy Territory",
["2003"] = "Soldier of Fortune II: Double Helix",
["2004"] = "Soldier of Fortune II: Double Helix",
["DarkPlaces-Quake 3"] = "DarkPlaces Quake",
["Nexuiz 3"] = "Nexuiz",
["Transfusion 3"] = "Transfusion",
["Warsow 8"] = "Warsow",
["Xonotic 3"] = "Xonotic",
}
local function getservers(host, port, q3protocol)
local socket = nmap.new_socket()
socket:set_timeout(10000)
local status, err = socket:connect(host, port)
if not status then
return {}
end
local probe = bin.pack("CCCCA", 0xff, 0xff, 0xff, 0xff, string.format("getservers %s empty full\n", q3protocol))
socket:send(probe)
local data
status, data = socket:receive() -- get some data
if not status then
return {}
end
nmap.set_port_state(host, port, "open")
local magic = bin.pack("CCCCA", 0xff, 0xff, 0xff, 0xff, "getserversResponse")
local tmp
while #data < #magic do -- get header
status, tmp = socket:receive()
if status then
data = data .. tmp
end
end
if string.sub(data, 1, #magic) ~= magic then -- no match
return {}
end
port.version.name = "quake3-master"
nmap.set_port_version(host, port)
local EOT = bin.pack("ACCC", "EOT", 0, 0, 0)
local pieces = stdnse.strsplit("\\", data)
while pieces[#pieces] ~= EOT do -- get all data
status, tmp = socket:receive()
if status then
data = data .. tmp
pieces = stdnse.strsplit("\\", data)
end
end
table.remove(pieces, 1) --remove magic
table.remove(pieces, #pieces) --remove EOT
local servers = {}
for _, value in ipairs(pieces) do
local parts = {bin.unpack("CCCC>S", value)}
if #parts > 5 then
local o1 = parts[2]
local o2 = parts[3]
local o3 = parts[4]
local o4 = parts[5]
local p = parts[6]
table.insert(servers, {string.format("%d.%d.%d.%d", o1, o2, o3, o4), p})
end
end
socket:close()
return servers
end
local function formatresult(servers, outputlimit, protocols)
local t = tab.new()
if not outputlimit then
outputlimit = #servers
end
for i = 1, outputlimit do
if not servers[i] then
break
end
local node = servers[i]
local protocol = node.protocol
local ip = node.ip
local portnum = node.port
tab.addrow(t, string.format('%s:%d', ip, portnum), string.format('%s (%s)', protocols[protocol], protocol))
end
return tab.dump(t)
end
local function dropdupes(tables, stringify)
local unique = {}
local dupe = {}
local s
for _, v in ipairs(tables) do
s = stringify(v)
if not dupe[s] then
table.insert(unique, v)
dupe[s] = true
end
end
return unique
end
local function scan(host, port, protocols)
local discovered = {}
for protocol, _ in pairs(protocols) do
for _, node in ipairs(getservers(host, port, protocol)) do
local entry = {
protocol = protocol,
ip = node[1],
port = node[2],
masterip = host.ip,
masterport = port.number
}
table.insert(discovered, entry)
end
end
return discovered
end
local function store(servers)
if not nmap.registry.q3m_servers then
nmap.registry.q3m_servers = {}
end
for _, server in ipairs(servers) do
table.insert(nmap.registry.q3m_servers, server)
end
end
local function protocols()
local filter = {}
local count = {}
for _, advert in ipairs(nmap.registry.q3m_servers) do
local key = stdnse.strjoin(":", {advert.ip, advert.port, advert.protocol})
if filter[key] == nil then
if count[advert.protocol] == nil then
count[advert.protocol] = 0
end
count[advert.protocol] = count[advert.protocol] + 1
filter[key] = true
end
local mkey = stdnse.strjoin(":", {advert.masterip, advert.masterport})
end
local sortable = {}
for k, v in pairs(count) do
table.insert(sortable, {k, v})
end
table.sort(sortable, function(a, b) return a[2] > b[2] or (a[2] == b[2] and a[1] > b[1]) end)
local t = tab.new()
tab.addrow(t, '#', 'PROTOCOL', 'GAME', 'SERVERS')
for i, p in ipairs(sortable) do
local pos = i .. '.'
local protocol = p[1]
count = p[2]
local game = KNOWN_PROTOCOLS[protocol]
if game == "unknown" then
game = ""
end
tab.addrow(t, pos, protocol, game, count)
end
return '\n' .. tab.dump(t)
end
action = function(host, port)
if SCRIPT_TYPE == "postrule" then
return protocols()
end
local outputlimit = nmap.registry.args[SCRIPT_NAME .. ".outputlimit"]
if not outputlimit then
outputlimit = 10
else
outputlimit = tonumber(outputlimit)
end
if outputlimit < 1 then
outputlimit = nil
end
local servers = scan(host, port, KNOWN_PROTOCOLS)
store(servers)
local unique = dropdupes(servers, function(t) return string.format("%s: %s:%d", t.protocol, t.ip, t.port) end)
local formatted = formatresult(unique, outputlimit, KNOWN_PROTOCOLS)
if #formatted < 1 then
return
end
local response = {}
table.insert(response, formatted)
if outputlimit and outputlimit < #servers then
table.insert(response, string.format('Only %d/%d shown. Use --script-args %s.outputlimit=-1 to see all.', outputlimit, #servers, SCRIPT_NAME))
end
return stdnse.format_output(true, response)
end
|
local network = {}
network.isClient = game:GetService("RunService"):IsClient()
network.isServer = game:GetService("RunService"):IsServer()
network.binds = {}
network.funcBinds = {}
network.event = function()
local e = game:GetService("ReplicatedStorage"):FindFirstChild("Event")
return e
end
network.func = function()
local f = game:GetService("ReplicatedStorage"):FindFirstChild("Function")
return f
end
network.invoke = function(x, y, ...)
if network.isClient then
return network.func():InvokeServer(x, unpack({y, ...}))
elseif network.isServer then
return network.func():InvokeClient(x, ...)
end
end
network.send = function(x, y, ...)
if network.isClient then
local action = x
local args = {y, ...}
network.event():FireServer(action, unpack(args))
elseif network.isServer then
local target = x
local action = y
local args = {...}
network.event():FireClient(target, action, unpack(args))
end
end
network.sendToAll = function(x, ...)
network.event():FireAllClients(x, ...)
end
network.on = function(action, f)
table.insert(network.binds, {action, f})
end
network.onFunction = function(action, f)
table.insert(network.funcBinds, {action, f})
end
if network.isClient then
network.event().OnClientEvent:connect(function(action, ...)
for i,v in next, network.binds do
if v[1] == action then
v[2](...)
end
end
end)
network.func().OnClientInvoke = function(action, ...)
for i,v in next, network.funcBinds do
if v[1] == action then
return v[2](...)
end
end
end
elseif network.isServer then
network.event().OnServerEvent:connect(function(player, action, ...)
for i,v in next, network.binds do
if v[1] == action then
v[2](player, ...)
end
end
end)
network.func().OnServerInvoke = function(player, action, ...)
for i,v in next, network.funcBinds do
if v[1] == action then
return v[2](player, ...)
end
end
end
end
return network
|
return {
tag = 'listener',
summary = 'Get the name of the active spatializer',
description = [[
Returns the name of the active spatializer (`simple`, `oculus`, or `phonon`).
The `t.audio.spatializer` setting in `lovr.conf` can be used to express a preference for a
particular spatializer. If it's `nil`, all spatializers will be tried in the following order:
`phonon`, `oculus`, `simple`.
]],
arguments = {},
returns = {
{
name = 'spatializer',
type = 'string',
description = 'The name of the active spatializer.'
}
},
related = {
'lovr.conf'
}
}
|
require 'mock_edit.gizmos.BoundGizmo'
require 'mock_edit.gizmos.IconGizmo'
require 'mock_edit.gizmos.PhysicsShapeGizmo'
require 'mock_edit.gizmos.WaypointGraphGizmo'
require 'mock_edit.gizmos.PathGizmo'
|
-- baby
-- babyjeans
--
-- the inevitable lua 'engine'
---
-- should name it 'project killer'
---
local baby = class('baby')
babyDebug = require('script/baby/babydebug')
babyGfx = require('script/baby/babygfx')
function baby:init()
end
return baby()
|
ConCommand = {}
-- Command list
-- { [string command] = { function func = Function callback, bool is_shared = It needs to run shared }, ... }
local ccon_list = {}
--[[
Add console commands
Arguments:
string command = Console command
function func = Function callback name or address
bool is_shared = It needs to run shared (Only the server can run this command)
Return:
nil
]]
function ConCommand.Add(command, func, is_shared)
if not command then return end
if not IsFunction(func) then
Package.Error("Console command '" .. command .. "' couldn't be created because the selected callback doesn't exist")
Package.Error(debug.traceback())
return
end
local cvar = CVar.Get(command) or CLIENT and CVar.Get(command, Client.GetLocalPlayer())
if not cvar and not ConCommand.Exists(command) then
ccon_list[string.upper(command)] = {
func = func,
is_shared = is_shared
}
else
Package.Error("Console command '" .. command .. "' can't be registered. The name is already taken")
Package.Error(debug.traceback())
end
end
--[[
Check if a console command exists
Arguments:
string command = Console command
Return:
bool
]]
function ConCommand.Exists(command)
return ccon_list[string.upper(command or "")] and true or false
end
--[[
Get a console command callback
Arguments:
string command = Console command
Return:
function func = Callback
nil
]]
function ConCommand.Get(command)
local res = ConCommand.Exists(command) and ccon_list[string.upper(command)]
if CLIENT and res and res.is_shared then
res.func = "PROTECTED"
end
return res
end
--[[
Get a copy of all console commands
Arguments:
nil
Return:
table commands = ConCommand table
]]
function ConCommand.GetAll()
local copy = table.Copy(ccon_list)
if CLIENT then
for k, v in pairs(copy) do
if v.is_shared then
v.func = "PROTECTED"
end
end
end
return copy
end
--[[
Run a registered console command passing
(Player player, string command, table arguments)
Arguments:
string command = Console command
string arg = Argument for the stored function
...
Return:
nil
]]
function ConCommand.Run(command, ...)
local cmd_tab = ConCommand.Get(command)
if cmd_tab then
if CLIENT and cmd_tab.is_shared then
Package.Error("Only the Server can run the command '" .. command .. "'")
else
cmd_tab.func(CLIENT and Client.GetLocalPlayer(), command, { string.FormatVarargs(...) })
if cmd_tab.is_shared then
Events.BroadcastRemote("LL_ConCommand_RunShared", command, ... )
end
end
else
Package.Error(command .. "not found")
end
end
-- ------------------------------------------------------------------------
-- Run console commands
Subscribe(Client or Server, "Console", "LL_CommandsConsole", function(text)
local parts = string.Explode(text, " ")
if ConCommand.Exists(parts[1]) then
ConCommand.Run(table.unpack(parts))
end
end)
-- Finish running shared commands
if CLIENT then
Events.Subscribe("LL_ConCommand_RunShared", function(command, ...)
local cmd_tab = ConCommand.Exists(command) and ccon_list[string.upper(command)]
if cmd_tab and cmd_tab.is_shared then
cmd_tab.func(Client.GetLocalPlayer(), command, { string.FormatVarargs(...) })
end
end)
end
|
data:extend({
{
type = "furnace",
name = "electric-furnace-mk2",
icon_size = 32,
icon = "__FactorioExtended-Machines__/graphics/icons/electric-furnace-mk2.png",
flags = {"placeable-neutral", "placeable-player", "player-creation"},
minable = {mining_time = 1, result = "electric-furnace-mk2"},
max_health = 400,
corpse = "big-remnants",
dying_explosion = "medium-explosion",
resistances =
{
{
type = "fire",
percent = 80
}
},
collision_box = {{-1.2, -1.2}, {1.2, 1.2}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
module_specification =
{
module_slots = 4,
module_info_icon_shift = {0, 0.8}
},
allowed_effects = {"consumption", "speed", "productivity", "pollution"},
crafting_categories = {"smelting"},
result_inventory_size = 1,
crafting_speed = 3,
energy_usage = "200kW",
source_inventory_size = 1,
energy_source =
{
type = "electric",
usage_priority = "secondary-input",
emissions = 0.0025
},
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
working_sound =
{
sound =
{
filename = "__base__/sound/electric-furnace.ogg",
volume = 0.7
},
apparent_volume = 1.5
},
animation =
{
layers = {
{
filename = "__FactorioExtended-Machines__/graphics/entity/electric-furnace/electric-furnace-base-mk2.png",
priority = "high",
width = 129,
height = 100,
frame_count = 1,
shift = {0.421875, 0},
hr_version = {
filename = "__FactorioExtended-Machines__/graphics/entity/electric-furnace/hr-electric-furnace-mk2.png",
priority = "high",
width = 239,
height = 219,
frame_count = 1,
shift = util.by_pixel(0.75, 5.75),
scale = 0.5
}
},
{
filename = "__base__/graphics/entity/electric-furnace/electric-furnace-shadow.png",
priority = "high",
width = 129,
height = 100,
frame_count = 1,
shift = {0.421875, 0},
draw_as_shadow = true,
hr_version = {
filename = "__base__/graphics/entity/electric-furnace/hr-electric-furnace-shadow.png",
priority = "high",
width = 227,
height = 171,
frame_count = 1,
draw_as_shadow = true,
shift = util.by_pixel(11.25, 7.75),
scale = 0.5
}
}
}
},
working_visualisations =
{
{
animation =
{
filename = "__base__/graphics/entity/electric-furnace/electric-furnace-heater.png",
priority = "high",
width = 25,
height = 15,
frame_count = 12,
animation_speed = 0.5,
shift = {0.015625, 0.890625},
hr_version = {
filename = "__base__/graphics/entity/electric-furnace/hr-electric-furnace-heater.png",
priority = "high",
width = 60,
height = 56,
frame_count = 12,
animation_speed = 0.5,
shift = util.by_pixel(1.75, 32.75),
scale = 0.5
}
},
light = {intensity = 0.4, size = 6, shift = {0.0, 1.0}, color = {r = 1.0, g = 1.0, b = 1.0}}
},
{
animation =
{
filename = "__base__/graphics/entity/electric-furnace/electric-furnace-propeller-1.png",
priority = "high",
width = 19,
height = 13,
frame_count = 4,
animation_speed = 0.5,
shift = {-0.671875, -0.640625},
hr_version = {
filename = "__base__/graphics/entity/electric-furnace/hr-electric-furnace-propeller-1.png",
priority = "high",
width = 37,
height = 25,
frame_count = 4,
animation_speed = 0.5,
shift = util.by_pixel(-20.5, -18.5),
scale = 0.5
}
}
},
{
animation =
{
filename = "__base__/graphics/entity/electric-furnace/electric-furnace-propeller-2.png",
priority = "high",
width = 12,
height = 9,
frame_count = 4,
animation_speed = 0.5,
shift = {0.0625, -1.234375},
hr_version = {
filename = "__base__/graphics/entity/electric-furnace/hr-electric-furnace-propeller-2.png",
priority = "high",
width = 23,
height = 15,
frame_count = 4,
animation_speed = 0.5,
shift = util.by_pixel(3.5, -38),
scale = 0.5
}
}
}
},
fast_replaceable_group = "furnace"
},
{
type = "furnace",
name = "electric-furnace-mk3",
icon_size = 32,
icon = "__FactorioExtended-Machines__/graphics/icons/electric-furnace-mk3.png",
flags = {"placeable-neutral", "placeable-player", "player-creation"},
minable = {mining_time = 1, result = "electric-furnace-mk3"},
max_health = 450,
corpse = "big-remnants",
dying_explosion = "medium-explosion",
light = {intensity = 1, size = 10},
resistances =
{
{
type = "fire",
percent = 80
}
},
collision_box = {{-1.2, -1.2}, {1.2, 1.2}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
module_specification =
{
module_slots = 4,
module_info_icon_shift = {0, 0.8}
},
allowed_effects = {"consumption", "speed", "productivity", "pollution"},
crafting_categories = {"smelting"},
result_inventory_size = 1,
crafting_speed = 4,
energy_usage = "220kW",
source_inventory_size = 1,
energy_source =
{
type = "electric",
usage_priority = "secondary-input",
emissions = 0.0025
},
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
working_sound =
{
sound =
{
filename = "__base__/sound/electric-furnace.ogg",
volume = 0.7
},
apparent_volume = 1.5
},
animation =
{
layers = {
{
filename = "__FactorioExtended-Machines__/graphics/entity/electric-furnace/electric-furnace-base-mk3.png",
priority = "high",
width = 129,
height = 100,
frame_count = 1,
shift = {0.421875, 0},
hr_version = {
filename = "__FactorioExtended-Machines__/graphics/entity/electric-furnace/hr-electric-furnace-mk3.png",
priority = "high",
width = 239,
height = 219,
frame_count = 1,
shift = util.by_pixel(0.75, 5.75),
scale = 0.5
}
},
{
filename = "__base__/graphics/entity/electric-furnace/electric-furnace-shadow.png",
priority = "high",
width = 129,
height = 100,
frame_count = 1,
shift = {0.421875, 0},
draw_as_shadow = true,
hr_version = {
filename = "__base__/graphics/entity/electric-furnace/hr-electric-furnace-shadow.png",
priority = "high",
width = 227,
height = 171,
frame_count = 1,
draw_as_shadow = true,
shift = util.by_pixel(11.25, 7.75),
scale = 0.5
}
}
}
},
working_visualisations =
{
{
animation =
{
filename = "__base__/graphics/entity/electric-furnace/electric-furnace-heater.png",
priority = "high",
width = 25,
height = 15,
frame_count = 12,
animation_speed = 0.5,
shift = {0.015625, 0.890625},
hr_version = {
filename = "__base__/graphics/entity/electric-furnace/hr-electric-furnace-heater.png",
priority = "high",
width = 60,
height = 56,
frame_count = 12,
animation_speed = 0.5,
shift = util.by_pixel(1.75, 32.75),
scale = 0.5
}
},
light = {intensity = 0.4, size = 6, shift = {0.0, 1.0}, color = {r = 1.0, g = 1.0, b = 1.0}}
},
{
animation =
{
filename = "__base__/graphics/entity/electric-furnace/electric-furnace-propeller-1.png",
priority = "high",
width = 19,
height = 13,
frame_count = 4,
animation_speed = 0.5,
shift = {-0.671875, -0.640625},
hr_version = {
filename = "__base__/graphics/entity/electric-furnace/hr-electric-furnace-propeller-1.png",
priority = "high",
width = 37,
height = 25,
frame_count = 4,
animation_speed = 0.5,
shift = util.by_pixel(-20.5, -18.5),
scale = 0.5
}
}
},
{
animation =
{
filename = "__base__/graphics/entity/electric-furnace/electric-furnace-propeller-2.png",
priority = "high",
width = 12,
height = 9,
frame_count = 4,
animation_speed = 0.5,
shift = {0.0625, -1.234375},
hr_version = {
filename = "__base__/graphics/entity/electric-furnace/hr-electric-furnace-propeller-2.png",
priority = "high",
width = 23,
height = 15,
frame_count = 4,
animation_speed = 0.5,
shift = util.by_pixel(3.5, -38),
scale = 0.5
}
}
}
},
fast_replaceable_group = "furnace"
}
})
|
----------------------------------------------------------------------
-- Metalua: $Id: mlp_meta.lua,v 1.4 2006/11/15 09:07:50 fab13n Exp $
--
-- Summary: Meta-operations: AST quasi-quoting and splicing
--
----------------------------------------------------------------------
--
-- Copyright (c) 2006, Fabien Fleutot <[email protected]>.
--
-- This software is released under the MIT Licence, see licence.txt
-- for details.
--
----------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- Exported API:
-- * [mlp.splice_content()]
-- * [mlp.quote_content()]
--
--------------------------------------------------------------------------------
module ("mlp", package.seeall)
--------------------------------------------------------------------------------
-- External splicing: compile an AST into a chunk, load and evaluate
-- that chunk, and replace the chunk by its result (which must also be
-- an AST).
--------------------------------------------------------------------------------
function splice (ast)
local f = mlc.function_of_ast(ast, '=splice')
local result=f()
return result
end
--------------------------------------------------------------------------------
-- Going from an AST to an AST representing that AST
-- the only key being lifted in this version is ["tag"]
--------------------------------------------------------------------------------
function quote (t)
--print("QUOTING:", _G.table.tostring(t, 60))
local cases = { }
function cases.table (t)
local mt = { tag = "Table" }
--_G.table.insert (mt, { tag = "Pair", quote "quote", { tag = "True" } })
if t.tag == "Splice" then
assert (#t==1, "Invalid splice")
local sp = t[1]
return sp
elseif t.tag then
_G.table.insert (mt, { tag = "Pair", quote "tag", quote (t.tag) })
end
for _, v in ipairs (t) do
_G.table.insert (mt, quote(v))
end
return mt
end
function cases.number (t) return { tag = "Number", t, quote = true } end
function cases.string (t) return { tag = "String", t, quote = true } end
return cases [ type (t) ] (t)
end
--------------------------------------------------------------------------------
-- when this variable is false, code inside [-{...}] is compiled and
-- avaluated immediately. When it's true (supposedly when we're
-- parsing data inside a quasiquote), [-{foo}] is replaced by
-- [`Splice{foo}], which will be unpacked by [quote()].
--------------------------------------------------------------------------------
in_a_quote = false
--------------------------------------------------------------------------------
-- Parse the inside of a "-{ ... }"
--------------------------------------------------------------------------------
function splice_content (lx)
local parser_name = "expr"
if lx:is_keyword (lx:peek(2), ":") then
local a = lx:next()
lx:next() -- skip ":"
assert (a.tag=="Id", "Invalid splice parser name")
parser_name = a[1]
end
local ast = mlp[parser_name](lx)
if in_a_quote then
--printf("SPLICE_IN_QUOTE:\n%s", _G.table.tostring(ast, "nohash", 60))
return { tag="Splice", ast }
else
if parser_name == "expr" then ast = { { tag="Return", ast } }
elseif parser_name == "stat" then ast = { ast }
elseif parser_name ~= "block" then
error ("splice content must be an expr, stat or block") end
--printf("EXEC THIS SPLICE:\n%s", _G.table.tostring(ast, "nohash", 60))
return splice (ast)
end
end
--------------------------------------------------------------------------------
-- Parse the inside of a "+{ ... }"
--------------------------------------------------------------------------------
function quote_content (lx)
local parser
if lx:is_keyword (lx:peek(2), ":") then -- +{parser: content }
parser = mlp[id(lx)[1]]
lx:next()
else -- +{ content }
parser = mlp.expr
end
local prev_iq = in_a_quote
in_a_quote = true
--print("IN_A_QUOTE")
local content = parser (lx)
local q_content = quote (content)
in_a_quote = prev_iq
return q_content
end
|
-- Neovim configuration ~/.config/nvim/init.lua
--[[ Bootstrap Paq by cloning it into the "right place"
git clone https://github.com/savq/paq-nvim.git \
~/.local/share/nvim/site/pack/paqs/opt/paq-nvim
Paq Commands:
:PaqInstall <- Install all packages listed in configuration below
:PaqUpdate <- Update packages already on system
:PaqClean <- Remove packages not in configuration
:PaqSync <- Async execute all three operations above
Location Paq stores repos: ~/.local/share/nvim/site/pack/paqs/start/ ]]
require'paq' {
-- Paq manages itself
"savq/paq-nvim";
-- Colorize hexcodes and names like Blue, Yellow or Green
"norcalli/nvim-colorizer.lua";
-- Tokyo Night colorscheme
"folke/tokyonight.nvim";
-- Statusline - fork of hoob3rt/lualine.nvim
"nvim-lualine/lualine.nvim";
"kyazdani42/nvim-web-devicons";
-- define keybindings; show keybindings in popup
"folke/which-key.nvim";
-- Install language modules for built-in treesitter
"nvim-treesitter/nvim-treesitter";
-- Fuzzy finder over lists
"nvim-telescope/telescope.nvim";
"nvim-lua/plenary.nvim";
"nvim-lua/popup.nvim";
"sharkdp/fd";
-- Built-in LSP client config, completion and snippets support
"neovim/nvim-lspconfig";
"hrsh7th/nvim-cmp";
"hrsh7th/cmp-nvim-lsp";
"hrsh7th/cmp-path";
"hrsh7th/cmp-buffer";
"L3MON4D3/LuaSnip";
"saadparwaiz1/cmp_luasnip";
"rafamadriz/friendly-snippets";
-- Extra functionality over rust analyzer
"simrat39/rust-tools.nvim";
-- Config built-in LSP client for Metals Scala language server
"scalameta/nvim-metals";
}
--[[ Set some default behaviors ]]
vim.o.hidden = true -- Allow hidden buffers
vim.o.shell = "/bin/sh" -- Some packages need a POSIX compatible shell
vim.o.path = vim.o.path .. ".,**" -- Allow gf and :find to use recursive sub-folders
vim.o.wildmenu = true -- Make tab completion in
vim.o.wildmode = "longest:full,full" -- command mode more useful.
--[[ Set default encoding, localizations, and file formats ]]
vim.o.encoding = "utf-8"
vim.o.fileencoding = "utf-8"
vim.o.spelllang = "en_us"
vim.o.fileformats = "unix,mac,dos"
--[[ Set default tabstops and replace tabs with spaces ]]
vim.o.tabstop = 4 -- Display hard tab as 4 spaces
vim.o.shiftwidth = 4 -- Number of spaces used for auto-indent
vim.o.softtabstop = 4 -- Insert/delete 4 spaces when inserting <Tab>/<BS>
vim.o.expandtab = true -- Expand tabs to spaces when inserting tabs
--[[ Settings for LSP client ]]
vim.o.timeoutlen = 1000 -- Milliseconds to wait for key mapped sequence to complete
vim.o.updatetime = 300 -- Set update time for CursorHold event
vim.o.signcolumn = "yes" -- Fixes first column, reduces jitter
vim.o.shortmess = "atToOc"
--[[ Some personnal preferences ]]
vim.o.history = 10000 -- Number lines of command history to keep
vim.o.mouse = "a" -- Enable mouse for all modes
vim.o.scrolloff = 2 -- Keep cursor away from top/bottom of window
vim.o.wrap = false -- Don't wrap lines
vim.o.sidescroll = 1 -- Horizontally scroll nicely
vim.o.sidescrolloff = 5 -- Keep cursor away from side of window
vim.o.splitbelow = true -- Horizontally split below
vim.o.splitright = true -- Vertically split to right
vim.o.hlsearch = true -- Highlight search results
vim.o.incsearch = true -- Highlight search matches as you type
vim.o.nrformats = "bin,hex,octal,alpha" -- bases and single letters used for <C-A> & <C-X>
vim.o.matchpairs = vim.o.matchpairs .. ",<:>,「:」" -- Additional matching pairs of characters
--[[ Case insensitive search, but not in command mode ]]
vim.o.ignorecase = true
vim.o.smartcase = true
vim.api.nvim_exec([[
augroup dynamic_smartcase
au!
au CmdLineEnter : set nosmartcase
au CmdLineEnter : set noignorecase
au CmdLineLeave : set ignorecase
au CmdLineLeave : set smartcase
augroup end
]], false)
--[[ Give visual feedback for yanked text ]]
vim.api.nvim_exec([[
augroup highlight_yank
au!
au TextYankPost * silent! lua vim.highlight.on_yank{timeout=600, on_visual=false}
augroup end
]], false)
--[[ Setup colorssceme ]]
vim.o.termguicolors = true
require'colorizer'.setup()
vim.g.tokyonight_style = "night"
vim.g.tokyonight_colors = {bg = "#000000"}
vim.g.tokyonight_italic_functions = 1
vim.g.tokyonight_sidebars = {"qf", "vista_kind", "terminal", "packer"}
vim.cmd[[colorscheme tokyonight]]
--[[ Setup statusline ]]
vim.o.showcmd = false -- Show partial normal mode commands lower right corner
vim.o.showmode = false -- Show mode lower left corner
require'nvim-web-devicons'.setup {default = true}
require'lualine'.setup {options = {theme = "moonfly"}}
--[[ Setup folke/which-key.nvim ]]
local wk = require'which-key'
wk.setup {
plugins = {
spelling = {
enabled = true,
suggestions = 36
}
}
}
-- Normal mode keybindings
wk.register {
["<Space><Space>"] = {":nohlsearch<CR>", "Clear hlsearch"},
["Y"] = {"y$", "Yank to End of Line"}, -- Fix between Y, D & C inconsistency
["gp"] = {"`[v`]", "Reselect Previous Changed/Yanked Text"},
["<Space>sp"] = {":set invspell<CR>", "Toggle Spelling"},
["<Space>ws"] = {":%s/\\s\\+$//<CR>", "Trim Trailing White Space"},
["<Space>t"] = {":vsplit<CR>:term fish<CR>i", "Fish Shell in vsplit"},
["<Space>k"] = {":dig<CR>a<C-K>", "Pick & Enter Diagraph"},
["<Space>l"] = {":mode<CR>", "Clear & Redraw Screen"}, -- Lost <C-L> for this below
["<Space>b"] = {":enew<CR>", "New Unnamed Buffer"},
-- Telescope related keybindings
["<Space>f"] = {name = "+Telescope"},
["<Space>fb"] = {":Telescope buffers<CR>", "Buffers"},
["<Space>ff"] = {":Telescope find_files<CR>", "Find File"},
["<Space>fg"] = {":Telescope live_grep<CR>", "Live Grep"},
["<Space>fh"] = {":Telescope help_tags<CR>", "Help Tags"},
["<Space>fr"] = {":Telescope oldfiles<CR>", "Open Recent File"},
-- Treesitter related keybindings
["<Space>h"] = {":TSBufToggle highlight<CR>", "Treesitter Highlight Toggle"},
-- Move windows around using CTRL-hjkl
["<C-H>"] = {"<C-W>H", "Move Window LHS"},
["<C-J>"] = {"<C-W>J", "Move Window BOT"},
["<C-K>"] = {"<C-W>K", "Move Window TOP"},
["<C-L>"] = {"<C-W>L", "Move Window RHS"},
-- Navigate between windows using CTRL+arrow-keys
["<M-Left>"] = {"<C-W>h", "Goto Window Left" },
["<M-Down>"] = {"<C-W>j", "Goto Window Down" },
["<M-Up>"] = {"<C-W>k", "Goto Window Up" },
["<M-Right>"] = {"<C-W>l", "Goto Window Right"},
-- Resize windows using ALT-hjkl for Linux
["<M-h>"] = {"2<C-W><", "Make Window Narrower"},
["<M-j>"] = {"2<C-W>-", "Make Window Shorter" },
["<M-k>"] = {"2<C-W>+", "Make Window Taller" },
["<M-l>"] = {"2<C-W>>", "Make Window Wider" }
}
--[[ Toggle between 3 line numbering states ]]
vim.o.number = false
vim.o.relativenumber = false
myLineNumberToggle = function()
if vim.o.relativenumber == true then
vim.o.number = false
vim.o.relativenumber = false
elseif vim.o.number == true then
vim.o.number = false
vim.o.relativenumber = true
else
vim.o.number = true
vim.o.relativenumber = false
end
end
-- Normal mode keybinding for above Lua function
wk.register {
["<Space>n"] = {":lua myLineNumberToggle()<CR>", "Line Number Toggle"}
}
--[[ Setup nvim-treesitter ]]
require'nvim-treesitter.configs'.setup {
ensure_installed = 'maintained',
highlight = {enable = true}
}
--[[ nvim-cmp for completions ]]
vim.o.completeopt = "menuone,noinsert,noselect"
local myHasWordsBefore = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require'luasnip'
local cmp = require'cmp'
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
mapping = {
['<C-Space>'] = cmp.mapping.complete(),
['<C-E>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true },
['<Tab>'] = cmp.mapping(
function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif myHasWordsBefore() then
cmp.complete()
else
fallback()
end
end, {"i", "s"}),
['<S-Tab>'] = cmp.mapping(
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {"i", "s"}),
['<C-D>'] = cmp.mapping.scroll_docs(-4),
['<C-F>'] = cmp.mapping.scroll_docs(4)
},
sources = {
{name = 'luasnip'},
{name = 'nvim_lsp'},
{name = 'treesitter'},
{name = 'nvim_lua'},
{name = 'buffer',
opts = {
get_bufnrs = function()
return vim.api.nvim_list_bufs()
end}},
{name = 'path'}
}
}
--[[ LSP Configurations ]]
local nvim_lsp = require'lspconfig'
local cmp_lsp = require'cmp_nvim_lsp'
local lsp_capabilities = vim.lsp.protocol.make_client_capabilities()
lsp_capabilities = cmp_lsp.update_capabilities(lsp_capabilities)
local lsp_servers = {
"bashls", -- Bash-language-server (pacman or sudo npm i -g bash-language-server)
"clangd", -- C and C++ - both clang and gcc
"html", -- HTML (npm i -g vscode-langservers-extracted)
"pyright" -- Pyright for Python (pacman or npm)
}
for _, lsp_server in ipairs(lsp_servers) do
nvim_lsp[lsp_server].setup {capabilities = lsp_capabilities}
end
--[[ Rust configuration, rust-tools.nvim will call lspconfig itself ]]
local rust_opts = {
tools = {
autoSetHints = true,
hover_with_actions = true,
inlay_hints = {
show_parameter_hints = false,
parameter_hints_prefix = "",
other_hints_prefix = ""
},
},
-- Options to be sent to nvim-lspconfig
-- overriding defaults set by rust-tools.nvim
server = {
settings = {capabilities = lsp_capabilities}
}
}
require('rust-tools').setup(rust_opts)
--[[ Metals configuration ]]
vim.g.metals_server_version = '0.10.8' -- See https://scalameta.org/metals/docs/editors/overview.html
metals_config = require'metals'.bare_config()
metals_config.settings = {showImplicitArguments = true}
vim.api.nvim_exec([[
augroup metals_lsp
au!
au FileType scala,sbt lua require('metals').initialize_or_attach(metals_config)
augroup end
]], false)
--[[ LSP related keybindings ]]
wk.register {
[","] = {name = "+lsp"},
[",g"] = {name = "+goto"},
[",s"] = {name = "+symbol"},
[",w"] = {name = "+workspace folder"},
[",m"] = {":lua require'metals'.open_all_diagnostics()<CR>", "Metals Diagnostics"},
[",F"] = {":lua vim.lsp.buf.formatting()<CR>", "Formatting"},
[",gd"] = {":lua vim.lsp.buf.definition()<CR>", "Goto Definition"},
[",gD"] = {":lua vim.lsp.buf.declaration()<CR>", "Goto Declaration"},
[",gi"] = {":lua vim.lsp.buf.implementation()<CR>", "Goto Implementation"},
[",gr"] = {":lua vim.lsp.buf.references()<CR>", "Goto References"},
[",hs"] = {":lua vim.lsp.buf.signature_help()<CR>", "Signature Help"},
[",H"] = {":lua vim.lsp.buf.hover()<CR>", "Hover"},
[",K"] = {":lua vim.lsp.buf.worksheet_hover()<CR>", "Worksheet Hover"},
[",rn"] = {":lua vim.lsp.buf.rename()<CR>", "Rename"},
[",sd"] = {":lua vim.lsp.buf.document_symbol()<CR>", "Document Symbol"},
[",sw"] = {":lua vim.lsp.buf.workspace_symbol()<CR>", "Workspace Symbol"},
[",wa"] = {":lua vim.lsp.buf.add_workspace_folder()<CR>", "Add Workspace Folder"},
[",wr"] = {":lua vim.lsp.buf.remove_workspace_folder()<CR>", "Remove Workspace Folder"},
[",l"] = {":lua vim.lsp.diagnostic.set_loclist()<CR>", "Diagnostic Set Loclist"},
[",["] = {":lua vim.lsp.diagnostic.goto_prev {wrap = false}<CR>", "Diagnostic Goto Prev"},
[",]"] = {":lua vim.lsp.diagnostic.goto_next {wrap = false}<CR>", "Diagnostic Goto Next"}
}
|
slot0 = class("ThirdAnniversarySquareScene", import("..TemplateMV.BackHillTemplate"))
slot0.UIName = "ThirdAnniversarySquareUI"
slot0.HUB_ID = 9
slot0.edge2area = {
default = "_middle",
3_4 = "_bottom",
4_5 = "_bottom",
7_7 = "_front"
}
slot0.init = function (slot0)
slot0.loader = ThirdAnniversaryAutoloader.New()
slot0.top = slot0:findTF("top")
slot0._map = slot0:findTF("map")
for slot4 = 0, slot0._map.childCount - 1, 1 do
slot0["map_" .. go(slot5).name] = slot0._map:GetChild(slot4)
end
slot0._upper = slot0:findTF("upper")
for slot4 = 0, slot0._upper.childCount - 1, 1 do
slot0["upper_" .. go(slot5).name] = slot0._upper:GetChild(slot4)
end
slot0._front = slot0._map:Find("top")
slot0._middle = slot0._map:Find("middle")
slot0._bottom = slot0._map:Find("bottom")
slot0.containers = {
slot0._front,
slot0._middle,
slot0._bottom
}
slot0._shipTpl = slot0._map:Find("ship")
slot0.graphPath = GraphPath.New(import("GameCfg.BackHillGraphs.ThirdAnniversarySquareGraph"))
slot0.upgradePanel = BuildingUpgradPanel.New(slot0)
slot0.upgradePanel:Load()
slot0.upgradePanel.buffer:Hide()
slot0.usableTxt = slot0.top:Find("usable_count/text"):GetComponent(typeof(Text))
slot0.materialTxt = slot0.top:Find("material/text"):GetComponent(typeof(Text))
slot0:RegisterDataResponse()
end
slot0.RegisterDataResponse = function (slot0)
slot0.Respones = ResponsableTree.CreateShell({})
slot0.Respones:SetRawData("view", slot0)
for slot5, slot6 in ipairs(slot1) do
slot0.Respones:AddRawListener({
"view",
slot6
}, function (slot0, slot1)
if not slot1 then
return
end
slot0.loader:GetSprite("ui/thirdanniversarysquareui_atlas", slot0 .. slot1, slot0["map_" .. slot0])
if not slot0["upper_" .. slot0] or IsNil(slot2:Find("level")) then
return
end
setText(slot2:Find("level"), "LV." .. slot1)
end)
end
slot2 = {
"xiaolongbaodian",
"heguozidian",
"nvpukafeiting",
"zhajihanbaodian",
"gangqvchenlieshi",
"huanzhuangshandian",
"shujvhuigu",
"xianshijianzao"
}
for slot6, slot7 in ipairs(slot2) do
slot0.Respones:AddRawListener({
"view",
slot7 .. "Tip"
}, function (slot0, slot1)
if not slot0["upper_" .. slot0] or IsNil(slot2:Find("tip")) then
return
end
setActive(slot2:Find("tip"), slot1)
end)
end
slot0.Respones.hubData = {}
slot0.Respones.AddRawListener(slot3, {
"view",
"hubData"
}, function (slot0, slot1)
slot0.usableTxt.text = "X" .. slot1.count
end, {
strict = true
})
slot0.Respones.AddRawListener(slot3, {
"view",
"materialCount"
}, function (slot0, slot1)
slot0.materialTxt.text = slot1
end)
end
slot0.didEnter = function (slot0)
slot1 = getProxy(MiniGameProxy)
onButton(slot0, slot0:findTF("top/return_btn"), function ()
slot0:emit(slot1.ON_BACK)
end)
onButton(slot0, slot0.top:Find("daka_count"), function ()
slot0:emit(ThirdAnniversarySquareMediator.ON_OPEN_TOWERCLIMBING_SIGNED)
end)
onButton(slot0, slot0:findTF("top/return_main_btn"), function ()
slot0:emit(slot1.ON_HOME)
end)
onButton(slot0, slot0:findTF("top/help_btn"), function ()
pg.MsgboxMgr.GetInstance():ShowMsgBox({
type = MSGBOX_TYPE_HELP,
helps = pg.gametip.qingdianguangchang_help.tip
})
end)
slot0.InitFacilityCross(slot0, slot0._map, slot0._upper, "nvpukafeiting", function ()
slot0.upgradePanel:Set(slot0.activity, 1)
end)
slot0.InitFacilityCross(slot0, slot0._map, slot0._upper, "xiaolongbaodian", function ()
slot0.upgradePanel:Set(slot0.activity, 2)
end)
slot0.InitFacilityCross(slot0, slot0._map, slot0._upper, "zhajihanbaodian", function ()
slot0.upgradePanel:Set(slot0.activity, 3)
end)
slot0.InitFacilityCross(slot0, slot0._map, slot0._upper, "heguozidian", function ()
slot0.upgradePanel:Set(slot0.activity, 4)
end)
slot0.InitFacilityCross(slot0, slot0._map, slot0._upper, "gangqvchenlieshi", function ()
pg.m02:sendNotification(GAME.GO_MINI_GAME, 13)
end)
slot0.InitFacilityCross(slot0, slot0._map, slot0._upper, "shujvhuigu", function ()
slot0:emit(ThirdAnniversarySquareMediator.GO_SCENE, SCENE.SUMMARY)
end)
slot0.InitFacilityCross(slot0, slot0._map, slot0._upper, "xianshijianzao", function ()
slot0:emit(ThirdAnniversarySquareMediator.GO_SCENE, SCENE.GETBOAT, {
projectName = "new",
page = 1
})
end)
slot0.InitFacilityCross(slot0, slot0._map, slot0._upper, "huanzhuangshandian", function ()
slot0:emit(ThirdAnniversarySquareMediator.GO_SCENE, SCENE.SKINSHOP)
end)
pg.UIMgr.GetInstance().OverlayPanel(slot2, slot0.top, false)
end
slot0.UpdateActivity = function (slot0, slot1)
slot0.activity = slot1
slot0.Respones.nvpukafeiting = slot1.data1KeyValueList[2][1] or 1
slot0.Respones.xiaolongbaodian = slot1.data1KeyValueList[2][2] or 1
slot0.Respones.zhajihanbaodian = slot1.data1KeyValueList[2][3] or 1
slot0.Respones.heguozidian = slot1.data1KeyValueList[2][4] or 1
slot0.Respones.materialCount = slot1.data1KeyValueList[1][next(slot1.data1KeyValueList[1])] or 0
slot0:UpdateView()
if slot0.upgradePanel and slot0.upgradePanel:IsShowing() then
slot0.upgradePanel:Set(slot1)
end
end
slot0.UpdateView = function (slot0)
slot1, slot2 = nil
slot0.Respones.nvpukafeitingTip = slot4(1)
slot0.Respones.xiaolongbaodianTip = slot4(2)
slot0.Respones.zhajihanbaodianTip = slot4(3)
slot0.Respones.heguozidianTip = slot4(4)
slot0.Respones.shujvhuiguTip = false
slot0.Respones.gangqvchenlieshiTip = getProxy(MiniGameProxy).GetHubByHubId(slot6, getProxy(ActivityProxy).getActivityByType(slot3, ActivityConst.ACTIVITY_TYPE_MINIGAME).getConfig(slot5, "config_id")).count > 0
slot0:UpdateHubData(slot7)
if not slot0.InitStudentBegin then
slot0:InitStudents(slot5.id, 2, 3)
slot0.InitStudentBegin = true
end
end
slot0.onBackPressed = function (slot0)
if slot0.upgradePanel and slot0.upgradePanel:IsShowing() then
slot0.upgradePanel:Hide()
return
end
slot0.super.onBackPressed(slot0)
end
slot0.UpdateHubData = function (slot0, slot1)
slot0.Respones.hubData.count = slot1.count
slot0.Respones.hubData.usedtime = slot1.usedtime
slot0.Respones.hubData.id = slot1.id
slot0.Respones:PropertyChange("hubData")
end
slot0.willExit = function (slot0)
pg.UIMgr.GetInstance():UnOverlayPanel(slot0.top, slot0._tf)
slot0:clearStudents()
slot0.Respones = nil
slot0.super.willExit(slot0)
end
return slot0
|
--[[
An interface to have one event listener at a time on an event.
One listener can be registered per SingleEventManager/Instance/Event triple.
For example:
myManager:connect(myPart, "Touched", touchedListener)
myManager:connect(myPart, "Touched", otherTouchedListener)
If myPart is touched, only `otherTouchedListener` will fire, because the
first listener was disconnected during the second connect call.
The hooks provided by SingleEventManager pass the associated Roblox object
as the first parameter to the callback. This differs from normal
Roblox events.
SingleEventManager's public methods operate in terms of instances and string
keys, differentiating between regular events and property changed signals
by calling different methods.
In the internal implementation, everything is handled via indexing by
instances and event objects themselves. This allows the code to use the same
structures for both kinds of instance event.
]]
local SingleEventManager = {}
SingleEventManager.__index = SingleEventManager
--[[
Constructs a `Hook`, which is a bundle containing a method that can be
updated, as well as the signal connection.
]]
local function createHook(instance, event, method)
local hook = {
method = method,
}
hook.connection = event:Connect(function(...)
hook.method(instance, ...)
end)
return hook
end
function SingleEventManager.new()
local self = {
-- Map<Instance, Map<Event, Hook>>
_hooks = {},
}
setmetatable(self, SingleEventManager)
return self
end
function SingleEventManager:connect(instance, key, method)
self:_connectInternal(instance, instance[key], key, method)
end
function SingleEventManager:connectProperty(instance, key, method)
self:_connectInternal(instance, instance:GetPropertyChangedSignal(key), "Property:" .. key, method)
end
--[[
Disconnects the hook attached to the event named `key` on the given
`instance` if there is one, otherwise does nothing.
Note that `key` must identify a valid property on `instance`, or this method
will throw.
]]
function SingleEventManager:disconnect(instance, key)
self:_disconnectInternal(instance, key)
end
--[[
Disconnects the hook attached to the property changed signal on `instance`
with the name `key` if there is one, otherwise does nothing.
Note that `key` must identify a valid property on `instance`, or this method
will throw.
]]
function SingleEventManager:disconnectProperty(instance, key)
self:_disconnectInternal(instance, "Property:" .. key)
end
--[[
Disconnects any hooks managed by SingleEventManager associated with
`instance`.
Calling disconnectAll with an untracked instance won't do anything.
]]
function SingleEventManager:disconnectAll(instance)
local instanceHooks = self._hooks[instance]
if instanceHooks == nil then
return
end
for _, hook in pairs(instanceHooks) do
hook.connection:Disconnect()
end
self._hooks[instance] = nil
end
--[[
Creates a hook using the given event and method and associates it with the
given instance.
Generally, `event` should directly associated with `instance`, but that's
unchecked in this code.
]]
function SingleEventManager:_connectInternal(instance, event, key, method)
local instanceHooks = self._hooks[instance]
if instanceHooks == nil then
instanceHooks = {}
self._hooks[instance] = instanceHooks
end
local existingHook = instanceHooks[key]
if existingHook ~= nil then
existingHook.method = method
else
instanceHooks[key] = createHook(instance, event, method)
end
end
--[[
Disconnects a hook associated with the given instance and event if it's
present, otherwise does nothing.
]]
function SingleEventManager:_disconnectInternal(instance, key)
local instanceHooks = self._hooks[instance]
if instanceHooks == nil then
return
end
local hook = instanceHooks[key]
if hook == nil then
return
end
hook.connection:Disconnect()
instanceHooks[key] = nil
-- If there are no hooks left for this instance, we don't need this record.
if next(instanceHooks) == nil then
self._hooks[instance] = nil
end
end
return SingleEventManager
|
#!@path_to_lua@/lua
-- -*- lua -*-
local sys_lua_path = "@sys_lua_path@"
if (sys_lua_path:sub(1,1) == "@") then
sys_lua_path = package.path
end
local sys_lua_cpath = "@sys_lua_cpath@"
if (sys_lua_cpath:sub(1,1) == "@") then
sys_lua_cpath = package.cpath
end
package.path = sys_lua_path
package.cpath = sys_lua_cpath
local arg_0 = arg[0]
local posix = require("posix")
local readlink = posix.readlink
local stat = posix.stat
local st = stat(arg_0)
while (st.type == "link") do
arg_0 = readlink(arg_0)
st = stat(arg_0)
end
local i,j = arg_0:find(".*/")
local LuaCommandName_dir = "./"
if (i) then
LuaCommandName_dir = arg_0:sub(1,j)
end
package.path = LuaCommandName_dir .. "../tools/?.lua;" ..
LuaCommandName_dir .. "../shells/?.lua;" ..
LuaCommandName_dir .. "?.lua;" ..
sys_lua_path
package.cpath = sys_lua_cpath
require("strict")
local epoch = false
_G._DEBUG = false -- Required by the new lua posix
---------------------------------------------------------------------
-- Build the Epoch function. This function returns the *epoch*
-- depending on what version of posix.gettimeofday is installed.
function build_epoch()
if (posix.gettimeofday) then
local x1, x2 = posix.gettimeofday()
if (x2 == nil) then
epoch = function()
local t = posix.gettimeofday()
return t.sec + t.usec*1.0e-6
end
else
epoch = function()
local t1, t2 = posix.gettimeofday()
return t1 + t2*1.0e-6
end
end
else
epoch = function()
return os.time()
end
end
end
--------------------------------------------------------------------------
-- Build the epoch function and call it.
function main()
build_epoch()
print (epoch())
end
main()
|
VolumeNorm = {}
setmetatable(VolumeNorm, {__index = HiveBaseModule})
VolumeNorm.new = function (varname)
local this = HiveBaseModule.new(varname)
local vf = LoadModule("VolumeFilter")
this.vf = vf
setmetatable(this, {__index=VolumeNorm})
return this
end
function VolumeNorm:Do()
self:UpdateValue()
local v = self.value
if (v.srcvolume == nil) then
return "Invalid volume"
end
self.vf:Norm(v.srcvolume)
return true
end
function VolumeNorm:volume()
return self.vf:VolumeData()
end
|
return {'zowaar','zowat','zowel'}
|
-- Copyright (c) 2020 Trevor Redfern
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
describe("game.ui.title_screen", function()
require "game.ui"
local title_screen
before_each(function()
title_screen = moonpie.ui.components.title_screen()
end)
it("it registers the component", function()
assert.not_nil(moonpie.ui.components.title_screen)
end)
it("is identified by title_screen", function()
assert.equals("title_screen", title_screen.id)
end)
describe("menu options", function()
it("has a new game option", function()
assert.not_nil(title_screen:find_by_id("btn_new_game"))
end)
it("has a continue game option", function()
assert.not_nil(title_screen:find_by_id("btn_continue_game"))
end)
it("has a settings option", function()
assert.not_nil(title_screen:find_by_id("btn_settings"))
end)
it("has a quit option", function()
assert.not_nil(title_screen:find_by_id("btn_quit"))
end)
end)
it("it can transition to the new game screen", function()
local btn = title_screen:find_by_id("btn_new_game")
btn:click()
assert.not_nil(moonpie.ui.current.find_by_id("new_game_screen"))
end)
it("can transition to the settings screen", function()
local btn = title_screen:find_by_id("btn_settings")
btn:click()
assert.not_nil(moonpie.ui.current.find_by_id("settings_screen"))
end)
end)
|
-----------------------------------------
-- ID: 5547
-- Item: Beef Stewpot
-- Food Effect: 3 Hrs, All Races
-----------------------------------------
-- TODO: Group Effect
-- HP +10% Cap 50
-- MP +10
-- HP Recoverd while healing 5
-- MP Recovered while healing 1
-- Attack +18% Cap 40
-- Evasion +5
-----------------------------------------
require("scripts/globals/status")
require("scripts/globals/msg")
-----------------------------------------
function onItemCheck(target)
local result = 0
if target:hasStatusEffect(tpz.effect.FOOD) or target:hasStatusEffect(tpz.effect.FIELD_SUPPORT_FOOD) then
result = tpz.msg.basic.IS_FULL
end
return result
end
function onItemUse(target)
target:addStatusEffect(tpz.effect.FOOD, 0, 0, 10800, 5547)
end
function onEffectGain(target, effect)
target:addMod(tpz.mod.FOOD_HPP, 10)
target:addMod(tpz.mod.FOOD_HP_CAP, 50)
target:addMod(tpz.mod.MP, 10)
target:addMod(tpz.mod.HPHEAL, 5)
target:addMod(tpz.mod.MPHEAL, 1)
target:addMod(tpz.mod.FOOD_ATTP, 18)
target:addMod(tpz.mod.FOOD_ATT_CAP, 40)
target:addMod(tpz.mod.EVA, 5)
end
function onEffectLose(target, effect)
target:delMod(tpz.mod.FOOD_HPP, 10)
target:delMod(tpz.mod.FOOD_HP_CAP, 50)
target:delMod(tpz.mod.MP, 10)
target:delMod(tpz.mod.HPHEAL, 5)
target:delMod(tpz.mod.MPHEAL, 1)
target:delMod(tpz.mod.FOOD_ATTP, 18)
target:delMod(tpz.mod.FOOD_ATT_CAP, 40)
target:delMod(tpz.mod.EVA, 5)
end
|
--[[
基于ip来表征用户
]]--
local _M = {
_VERSION = '0.01'
}
local ffi = require("ffi")
--[[
c库代码
]]--
ffi.cdef[[
struct in_addr {
uint32_t s_addr;
};
int inet_pton(int af, const char *src, void *dst);
int inet_aton(const char *cp, struct in_addr *inp);
uint32_t ntohl(uint32_t netlong);
char *inet_ntoa(struct in_addr in);
uint32_t htonl(uint32_t hostlong);
]]
local C = ffi.C
---
--- ip转换
--- @return number or nil
local ip2long = function(ip)
local inp = ffi.new("struct in_addr[1]")
if C.inet_aton(ip, inp) ~= 0 then
return tonumber(C.ntohl(inp[0].s_addr))
end
return nil
end
---
--- ip转换
--- @return string or nil
local long2ip = function(long)
if type(long) ~= "number" then
return nil
end
local addr = ffi.new("struct in_addr")
addr.s_addr = C.htonl(long)
return ffi.string(C.inet_ntoa(addr))
end
---
--- 基于ip的解析,http头部中提取
--- @return string or nil
_M.get = function()
local ClientIP = ngx.req.get_headers()["X-Real-IP"]
if ClientIP == nil then
ClientIP = ngx.req.get_headers()["X-Forwarded-For"]
if ClientIP then
local colonPos = string.find(ClientIP, ' ')
if colonPos then
ClientIP = string.sub(ClientIP, 1, colonPos - 1)
end
end
end
if ClientIP == nil then
ClientIP = ngx.var.remote_addr
end
if ClientIP then
ClientIP = ip2long(ClientIP)
end
return ClientIP
end
return _M
|
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if (CLIENT) then
SWEP.Slot = 3;
SWEP.SlotPos = 5;
SWEP.DrawAmmo = false;
SWEP.PrintName = "Broom";
SWEP.DrawCrosshair = true;
end
SWEP.Author = "JohnyReaper"
SWEP.Instructions = "Primary Fire: Sweep";
SWEP.Purpose = "To sweep up dirt and trash.";
SWEP.Contact = ""
SWEP.Category = "Vort Swep"
SWEP.Slot = 3
SWEP.SlotPos = 5
SWEP.Weight = 5
SWEP.Spawnable = true
SWEP.AdminSpawnable = false;
// SWEP.ViewModel = "" -- causes console error spam
SWEP.WorldModel = ""
SWEP.HoldType = "sweep"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = 1
SWEP.Secondary.DefaultClip = 1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
function SWEP:Initialize()
self:SetWeaponHoldType(self.HoldType)
end
function SWEP:Deploy()
if (SERVER) then
self.Owner:DrawViewModel(false)
if (!self.Owner:Alive()) then return false end
if (!self.Owner:GetCharacter():IsVortigaunt()) then return false end
self.Owner.broomModel = ents.Create("prop_dynamic")
self.Owner.broomModel:SetModel("models/props_c17/pushbroom.mdl")
self.Owner.broomModel:SetMoveType(MOVETYPE_NONE)
self.Owner.broomModel:SetSolid(SOLID_NONE)
self.Owner.broomModel:SetParent(self.Owner)
self.Owner.broomModel:DrawShadow(true)
self.Owner.broomModel:Spawn()
self.Owner.broomModel:Fire("setparentattachment", "cleaver_attachment", 0.01)
end
end
function SWEP:Holster()
if (SERVER) then
self.Owner:DrawViewModel(true)
end
if (self.Owner.broomModel) then
if (self.Owner.broomModel:IsValid()) then
self.Owner.broomModel:Remove()
end
end
return true
end
function SWEP:OnRemove()
if (SERVER) then
self.Owner:DrawViewModel(true)
end
if (self.Owner.broomModel) then
if (self.Owner.broomModel:IsValid()) then
self.Owner.broomModel:Remove()
end;
end
return true
end
function SWEP:PrimaryAttack()
if (!self.Owner:Alive()) then return false end
if (!self.Owner:GetCharacter():IsVortigaunt()) then return false end
self:SetNextPrimaryFire( CurTime() + 2 )
-- self.Owner:SetAnimation( PLAYER_ATTACK1 )
if (SERVER) then
self.Owner:ForceSequence("sweep", nil,nil, false)
end
end;
function SWEP:SecondaryAttack()
return false
end
|
-----------------------------------
-- Area: Metalworks
-- NPC: Kaela
-- Type: Adventurer's Assistant
-- !pos 40.167 -14.999 16.073 237
-----------------------------------
require("scripts/globals/quests")
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
local WildcatBastok = player:getCharVar("WildcatBastok")
if (player:getQuestStatus(BASTOK, tpz.quest.id.bastok.LURE_OF_THE_WILDCAT) == QUEST_ACCEPTED and player:getMaskBit(WildcatBastok, 8) == false) then
player:startEvent(934)
else
player:startEvent(741)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
if (csid == 934) then
player:setMaskBit(player:getCharVar("WildcatBastok"), "WildcatBastok", 8, true)
end
end
|
local login = require "status.login"
local hall = require "status.hall"
local room = require "status.room"
local status_tbl = {
["login"] = login,
["room"] = room,
["hall"] = hall
}
local M = {
cur = nil
}
function M:enter(name)
if self.cur then
self.cur:leave()
end
self.cur = status_tbl[name]
self.cur:enter()
end
return M
|
dilvin_lormurojo_missions =
{
{
missionType = "assassinate",
primarySpawns =
{
{ npcTemplate = "borvos_thug", npcName = "" }
},
secondarySpawns = {},
itemSpawns = {},
rewards =
{
{ rewardType = "credits", amount = 100 }
}
}
}
-- Has initial convo strings for 3 more missions but is missing most of the other necessary strings.
npcMapDilvinLormurojo =
{
{
spawnData = { npcTemplate = "dilvin_lormurojo", x = 4892, z = 3.8, y = -4997.6, direction = 176, cellID = 0, position = STAND },
npcNumber = 1,
stfFile = "@static_npc/naboo/dilvin_lormurojo",
missions = dilvin_lormurojo_missions
},
}
DilvinLormurojo = ThemeParkLogic:new {
npcMap = npcMapDilvinLormurojo,
className = "DilvinLormurojo",
screenPlayState = "dilvin_lormurojo_task",
planetName = "naboo",
distance = 800,
}
registerScreenPlay("DilvinLormurojo", true)
dilvin_lormurojo_mission_giver_conv_handler = mission_giver_conv_handler:new {
themePark = DilvinLormurojo
}
dilvin_lormurojo_mission_target_conv_handler = mission_target_conv_handler:new {
themePark = DilvinLormurojo
}
|
--[[
> File Name: is_table_empty.lua
> Author: weijie.yuan
> Mail: [email protected]
> Created Time: Tue 13 Mar 2018 03:00:12 PM CST
--]]
function is_table_empty(table)
if type(table) ~= 'table' then return false end
return table == nil or next(table) == nil --t is nil or {}
end
|
Amazon = Amazon or {}
function Amazon.SerializeOrder(order)
return util.TableToJSON(order)
end
function Amazon.DeserializeOrder(order)
return util.JSONToTable(order)
end
|
local window = require 'lspsaga.window'
local vim,api,lsp,vfn = vim,vim.api,vim.lsp,vim.fn
local config = require('lspsaga').config_values
local libs = require('lspsaga.libs')
local home_dir = libs.get_home_dir()
local scroll_in_win = require('lspsaga.action').scroll_in_win
local send_request = function(timeout)
local method = {"textDocument/definition","textDocument/references"}
local def_params = lsp.util.make_position_params()
local ref_params = lsp.util.make_position_params()
ref_params.context = {includeDeclaration = true;}
local def_response = lsp.buf_request_sync(0, method[1], def_params, timeout or 1000)
local ref_response = lsp.buf_request_sync(0, method[2], ref_params, timeout or 1000)
if config.debug then
print(vim.inspect(def_response))
print(vim.inspect(ref_response))
end
local responses = {}
if libs.result_isempty(def_response) then
def_response[1] = {}
def_response[1].result = {}
def_response[1].result.saga_msg = '0 definitions found'
end
table.insert(responses,def_response)
if libs.result_isempty(ref_response) then
ref_response[1] = {}
ref_response[1].result = {}
ref_response[1].result.saga_msg = '0 references found'
end
table.insert(responses,ref_response)
for i,response in ipairs(responses) do
if type(response) == "table" then
for _,res in pairs(response) do
if res.result then
coroutine.yield(res.result,i)
end
end
end
end
end
local Finder = {}
local uv = vim.loop
function Finder:lsp_finder_request()
return uv.new_async(vim.schedule_wrap(function()
local root_dir = libs.get_lsp_root_dir()
if string.len(root_dir) == 0 then
print('[LspSaga] get root dir failed')
return
end
self.WIN_WIDTH = vim.fn.winwidth(0)
self.WIN_HEIGHT = vim.fn.winheight(0)
self.contents = {}
self.short_link = {}
self.definition_uri = 0
self.reference_uri = 0
local request_intance = coroutine.create(send_request)
self.buf_filetype = api.nvim_buf_get_option(0,'filetype')
while true do
local _,result,method_type = coroutine.resume(request_intance)
self:create_finder_contents(result,method_type,root_dir)
if coroutine.status(request_intance) == 'dead' then
break
end
end
self:render_finder_result()
end))
end
function Finder:create_finder_contents(result,method_type,root_dir)
local target_lnum = 0
if type(result) == 'table' then
local method_option = {
{icon = config.finder_definition_icon,title = ': '.. #result ..' Definitions'};
{icon = config.finder_reference_icon,title = ': '.. #result ..' References',};
}
local params = vim.fn.expand("<cword>")
self.param_length = #params
local title = method_option[method_type].icon.. params ..method_option[method_type].title
if method_type == 1 then
self.definition_uri = result.saga_msg and 1 or #result
table.insert(self.contents,title)
target_lnum = 2
if result.saga_msg then
table.insert(self.contents," ")
table.insert(self.contents,'[1] ' .. result.saga_msg)
return
end
else
self.reference_uri = result.saga_msg and 1 or #result
target_lnum = target_lnum + self.definition_uri + 5
table.insert(self.contents," ")
table.insert(self.contents,title)
if result.saga_msg then
table.insert(self.contents," ")
table.insert(self.contents,'[1] ' .. result.saga_msg)
return
end
end
for index,_ in ipairs(result) do
local uri = result[index].targetUri or result[index].uri
if uri == nil then
return
end
local bufnr = vim.uri_to_bufnr(uri)
if not api.nvim_buf_is_loaded(bufnr) then
vim.fn.bufload(bufnr)
end
local link = vim.uri_to_fname(uri) -- returns lowercase drive letters on Windows
if libs.is_windows() then
link = link:gsub('^%l', link:sub(1, 1):upper())
end
local short_name
-- reduce filename length by root_dir or home dir
if link:find(root_dir, 1, true) then
short_name = link:sub(root_dir:len() + 2)
elseif link:find(home_dir, 1, true) then
short_name = link:sub(home_dir:len() + 2)
-- some definition still has a too long path prefix
if #short_name > 40 then
short_name = libs.split_by_pathsep(short_name,4)
end
else
short_name = libs.split_by_pathsep(link,4)
end
local target_line = '['..index..']'..' '..short_name
local range = result[index].targetRange or result[index].range
if index == 1 then
table.insert(self.contents,' ')
end
table.insert(self.contents,target_line)
target_lnum = target_lnum + 1
-- max_preview_lines
local max_preview_lines = config.max_preview_lines
local lines = api.nvim_buf_get_lines(bufnr,range.start.line-0,range["end"].line+1+max_preview_lines,false)
self.short_link[target_lnum] = {
link=link,
preview=lines,
row=range.start.line+1,
col=range.start.character+1
}
end
end
end
function Finder:render_finder_result()
if next(self.contents) == nil then return end
table.insert(self.contents,' ')
-- get dimensions
local width = api.nvim_get_option("columns")
local height = api.nvim_get_option("lines")
-- calculate our floating window size
local win_height = math.ceil(height * 0.8)
local win_width = math.ceil(width * 0.8)
-- and its starting position
local row = math.ceil((height - win_height) * 0.7)
local col = math.ceil((width - win_width))
local opts = {
style = "minimal",
relative = "editor",
row = row,
col = col,
}
local max_height = math.ceil((height - 4) * 0.5)
if #self.contents > max_height then
opts.height = max_height
end
local content_opts = {
contents = self.contents,
filetype = 'lspsagafinder',
enter = true,
highlight = 'LspSagaLspFinderBorder'
}
self.bufnr,self.winid = window.create_win_with_border(content_opts,opts)
api.nvim_buf_set_option(self.contents_buf,'buflisted',false)
api.nvim_win_set_var(self.conents_win,'lsp_finder_win_opts',opts)
api.nvim_win_set_option(self.conents_win,'cursorline',true)
if not self.cursor_line_bg and not self.cursor_line_fg then
self:get_cursorline_highlight()
end
api.nvim_command('highlight! link CursorLine LspSagaFinderSelection')
api.nvim_command('autocmd CursorMoved <buffer> lua require("lspsaga.provider").set_cursor()')
api.nvim_command('autocmd CursorMoved <buffer> lua require("lspsaga.provider").auto_open_preview()')
api.nvim_command("autocmd QuitPre <buffer> lua require('lspsaga.provider').close_lsp_finder_window()")
for i=1,self.definition_uri,1 do
api.nvim_buf_add_highlight(self.contents_buf,-1,"TargetFileName",1+i,0,-1)
end
for i=1,self.reference_uri,1 do
local def_count = self.definition_uri ~= 0 and self.definition_uri or -1
api.nvim_buf_add_highlight(self.contents_buf,-1,"TargetFileName",i+def_count+4,0,-1)
end
-- load float window map
self:apply_float_map()
self:lsp_finder_highlight()
end
function Finder:apply_float_map()
local action = config.finder_action_keys
local nvim_create_keymap = require('lspsaga.libs').nvim_create_keymap
local lhs = {
noremap = true,
silent = true
}
local keymaps = {
{self.bufnr,'n',action.vsplit,":lua require'lspsaga.provider'.open_link(2)<CR>"},
{self.bufnr,'n',action.split,":lua require'lspsaga.provider'.open_link(3)<CR>"},
{self.bufnr,'n',action.scroll_down,":lua require'lspsaga.provider'.scroll_in_preview(1)<CR>"},
{self.bufnr,'n',action.scroll_up,":lua require'lspsaga.provider'.scroll_in_preview(-1)<CR>"}
}
if type(action.open) == 'table' then
for _,key in ipairs(action.open) do
table.insert(keymaps,{self.bufnr,'n',key,":lua require'lspsaga.provider'.open_link(1)<CR>"})
end
elseif type(action.open) == 'string' then
table.insert(keymaps,{self.bufnr,'n',action.open,":lua require'lspsaga.provider'.open_link(1)<CR>"})
end
if type(action.quit) == 'table' then
for _,key in ipairs(action.quit) do
table.insert(keymaps,{self.bufnr,'n',key,":lua require'lspsaga.provider'.close_lsp_finder_window()<CR>"})
end
elseif type(action.quit) == 'string' then
table.insert(keymaps,{self.bufnr,'n',action.quit,":lua require'lspsaga.provider'.close_lsp_finder_window()<CR>"})
end
nvim_create_keymap(keymaps,lhs)
end
function Finder:lsp_finder_highlight ()
local def_icon = config.finder_definition_icon or ''
local ref_icon = config.finder_reference_icon or ''
local def_uri_count = self.definition_uri == 0 and -1 or self.definition_uri
-- add syntax
api.nvim_buf_add_highlight(self.contents_buf,-1,"DefinitionIcon",0,1,#def_icon-1)
api.nvim_buf_add_highlight(self.contents_buf,-1,"TargetWord",0,#def_icon,self.param_length+#def_icon+3)
api.nvim_buf_add_highlight(self.contents_buf,-1,"DefinitionCount",0,0,-1)
api.nvim_buf_add_highlight(self.contents_buf,-1,"TargetWord",3+def_uri_count,#ref_icon,self.param_length+#ref_icon+3)
api.nvim_buf_add_highlight(self.contents_buf,-1,"ReferencesIcon",3+def_uri_count,1,#ref_icon+4)
api.nvim_buf_add_highlight(self.contents_buf,-1,"ReferencesCount",3+def_uri_count,0,-1)
end
function Finder:set_cursor()
local current_line = vim.fn.line('.')
local column = 2
local first_def_uri_lnum = self.definition_uri ~= 0 and 3 or 5
local last_def_uri_lnum = 3 + self.definition_uri - 1
local first_ref_uri_lnum = 3 + self.definition_uri + 3
local count = self.definition_uri == 0 and 1 or 2
local last_ref_uri_lnum = 3 + self.definition_uri + count + self.reference_uri
if current_line == 1 then
vim.fn.cursor(first_def_uri_lnum,column)
elseif current_line == last_def_uri_lnum + 1 then
vim.fn.cursor(first_ref_uri_lnum,column)
elseif current_line == last_ref_uri_lnum + 1 then
vim.fn.cursor(first_def_uri_lnum, column)
elseif current_line == first_ref_uri_lnum - 1 then
if self.definition_uri == 0 then
vim.fn.cursor(first_def_uri_lnum,column)
else
vim.fn.cursor(last_def_uri_lnum,column)
end
elseif current_line == first_def_uri_lnum - 1 then
vim.fn.cursor(last_ref_uri_lnum,column)
end
end
function Finder:get_cursorline_highlight()
self.cursor_line_bg = vfn.synIDattr(vfn.hlID("cursorline"),"bg")
self.cursor_line_fg = vfn.synIDattr(vfn.hlID("cursorline"),"fg")
end
function Finder:auto_open_preview()
local current_line = vim.fn.line('.')
if not self.short_link[current_line] then return end
local content = self.short_link[current_line].preview or {}
if next(content) ~= nil then
local has_var,finder_win_opts = pcall(api.nvim_win_get_var,0,'lsp_finder_win_opts')
if not has_var then print('get finder window options wrong') return end
local width = api.nvim_get_option('columns')
local height = vim.fn.winheight(0)
local opts = {
relative = 'win',
}
local min_width = 42
local pad_right = self.WIN_WIDTH - width - 20 - min_width
local max_height = finder_win_opts.height or height
if pad_right >= 0 then
opts.col = finder_win_opts.col+width+2
opts.row = finder_win_opts.row - 1
opts.width = min_width + math.max(0, math.min(math.floor((pad_right-10)/1.5), 60))
opts.height = self.definition_uri + self.reference_uri + 6
if opts.height > max_height then
opts.height = max_height
end
elseif pad_right < 0 then
opts.row = finder_win_opts.row + height + 2
opts.col = finder_win_opts.col
opts.width = min_width
opts.height = 8
if self.WIN_HEIGHT - height - opts.row < 4 then
return
end
end
local content_opts = {
contents = content,
filetype = self.buf_filetype,
highlight = 'LspSagaAutoPreview'
}
vim.defer_fn(function ()
self:close_auto_preview_win()
local bufnr,winid = window.create_win_with_border(content_opts,opts)
api.nvim_buf_set_option(bufnr,'buflisted',false)
api.nvim_win_set_var(0,'saga_finder_preview',{winid,1,config.max_preview_lines+1})
end,10)
end
end
function Finder:close_auto_preview_win()
local has_var,pdata = pcall(api.nvim_win_get_var,0,'saga_finder_preview')
if has_var then
window.nvim_close_valid_window(pdata[1])
end
end
-- action 1 mean enter
-- action 2 mean vsplit
-- action 3 mean split
function Finder:open_link(action_type)
local action = {"edit ","vsplit ","split "}
local current_line = vim.fn.line('.')
if self.short_link[current_line] == nil then
error('[LspSaga] target file uri not exist')
return
end
self:close_auto_preview_win()
api.nvim_win_close(self.winid,true)
api.nvim_command(action[action_type]..self.short_link[current_line].link)
vim.fn.cursor(self.short_link[current_line].row,self.short_link[current_line].col)
self:clear_tmp_data()
end
function Finder:scroll_in_preview(direction)
local has_var,pdata = pcall(api.nvim_win_get_var,0,'saga_finder_preview')
if not has_var then return end
if not api.nvim_win_is_valid(pdata[1]) then return end
local current_win_lnum,last_lnum = pdata[3],pdata[4]
current_win_lnum = scroll_in_win(pdata[1],direction,current_win_lnum,last_lnum,config.max_preview_lines)
api.nvim_win_set_var(0,'saga_finder_preview',{pdata[1],current_win_lnum,last_lnum})
end
function Finder:quit_float_window()
self:close_auto_preview_win()
if self.winid ~= 0 then
window.nvim_close_valid_window(self.winid)
end
self:clear_tmp_data()
end
function Finder:clear_tmp_data()
self.short_link = {}
self.contents = {}
self.definition_uri = 0
self.reference_uri = 0
self.param_length = 0
self.buf_filetype = ''
self.WIN_HEIGHT = 0
self.WIN_WIDTH = 0
api.nvim_command('hi! CursorLine guibg='..self.cursor_line_bg)
if self.cursor_line_fg == '' then
api.nvim_command('hi! CursorLine guifg=NONE')
end
end
local lspfinder = {}
function lspfinder.lsp_finder()
local active,msg = libs.check_lsp_active()
if not active then print(msg) return end
local async_finder = Finder:lsp_finder_request()
async_finder:send()
end
function lspfinder.close_lsp_finder_window()
Finder:quit_float_window()
end
function lspfinder:auto_open_preview()
Finder:auto_open_preview()
end
function lspfinder:set_cursor()
Finder:set_cursor()
end
function lspfinder.open_link(action_type)
Finder:open_link(action_type)
end
function lspfinder.scroll_in_preview(direction)
Finder:scroll_in_preview(direction)
end
function lspfinder.preview_definition(timeout_ms)
local active,msg = libs.check_lsp_active()
if not active then print(msg) return end
local filetype = vim.api.nvim_buf_get_option(0, "filetype")
local method = "textDocument/definition"
local params = lsp.util.make_position_params()
local result = vim.lsp.buf_request_sync(0,method,params,timeout_ms or 1000)
if result == nil or vim.tbl_isempty(result) then
print("No location found: " .. method)
return nil
end
result = {vim.tbl_deep_extend("force", {}, unpack(result))}
if vim.tbl_islist(result) and not vim.tbl_isempty(result[1]) then
local uri = result[1].result[1].uri or result[1].result[1].targetUri
if #uri == 0 then return end
local bufnr = vim.uri_to_bufnr(uri)
local link = vim.uri_to_fname(uri)
local short_name
local root_dir = libs.get_lsp_root_dir()
-- reduce filename length by root_dir or home dir
if link:find(root_dir, 1, true) then
short_name = link:sub(root_dir:len() + 2)
elseif link:find(home_dir, 1, true) then
short_name = link:sub(home_dir:len() + 2)
-- some definition still has a too long path prefix
if #short_name > 40 then
short_name = libs.split_by_pathsep(short_name,4)
end
else
short_name = libs.split_by_pathsep(link,4)
end
if not vim.api.nvim_buf_is_loaded(bufnr) then
vim.fn.bufload(bufnr)
end
local range = result[1].result[1].targetRange or result[1].result[1].range
local start_line = 0
if range.start.line - 3 >= 1 then
start_line = range.start.line - 3
else
start_line = range.start.line
end
local content =
vim.api.nvim_buf_get_lines(bufnr, start_line, range["end"].line + 1 +
config.max_preview_lines, false)
content = vim.list_extend({config.definition_preview_icon.."Definition Preview: "..short_name,"" },content)
local opts = {
relative = "cursor",
style = "minimal",
}
local WIN_WIDTH = api.nvim_get_option('columns')
local max_width = math.floor(WIN_WIDTH * 0.5)
local width, _ = vim.lsp.util._make_floating_popup_size(content, opts)
if width > max_width then
opts.width = max_width
end
local content_opts = {
contents = content,
filetype = filetype,
highlight = 'LspSagaDefPreviewBorder'
}
local bf,wi = window.create_win_with_border(content_opts,opts)
api.nvim_command(
string.format('autocmd CursorMoved,CursorMovedI,BufHidden,BufLeave <buffer> ++once lua pcall(vim.api.nvim_win_close, %d, true)', winid)
)
wi)
vim.api.nvim_buf_add_highlight(bf,-1,"DefinitionPreviewTitle",0,0,-1)
api.nvim_buf_set_var(0,'lspsaga_def_preview',{wi,1,config.max_preview_lines,10})
end
end
function lspfinder.has_saga_def_preview()
local has_preview,pdata = pcall(api.nvim_buf_get_var,0,'lspsaga_def_preview')
if has_preview and api.nvim_win_is_valid(pdata[1]) then return true end
return false
end
function lspfinder.scroll_in_def_preview(direction)
local has_preview,pdata = pcall(api.nvim_buf_get_var,0,'lspsaga_def_preview')
if not has_preview then return end
local current_win_lnum = scroll_in_win(pdata[1],direction,pdata[2],config.max_preview_lines,pdata[4])
api.nvim_buf_set_var(0,'lspsaga_def_preview',{pdata[1],current_win_lnum,config.max_preview_lines,pdata[4]})
end
return lspfinder
|
--此文件为比赛配置说明
local GameMatchConfig = {};
----------------------------------------------------------------------------------------
-- --场景配置,它必须配
-- GameMatchConfig.scene = {
-- ["controller"] = {filePath,className};
-- ["scene"] = {filePath,className};
-- ["sceneLayout"] = {filePath,className}; --可以不必配置该项,前两项必须配
-- };
------------------------------------------------------------------------------------------
-- GameMatchConfig.match_backgroundFile = "";--比赛房间背景,不配就使用普通房间的背景
-- ----------------------------------------------------------------------------------------
-- --以下部分为控件配置(比赛中所有可以配置的控件),可以不用配,不配的时候就使用公共的控件
-- GameMatchConfig.matchExit = {}; --退赛提示
-- GameMatchConfig.matchFinish = {}; --比赛结束发奖页面
-- GameMatchConfig.matchGameOver = {}; --比赛结算界面
-- GameMatchConfig.matchLoading = {};--报名等待页面
-- GameMatchConfig.matchDetailInfo = {};--比赛详情
-- GameMatchConfig.matchRevive = {}; --复活赛
-- GameMatchConfig.matchTips = {}; --提示
-- GameMatchConfig.matchToolbar = {}; --工具栏
-- GameMatchConfig.matchWaiting = {}; --晋级等待页面
-- GameMatchConfig.matchWaitTable = {}; --配桌等待
-- GameMatchConfig.matchAnimLayer = {}; --比赛动画
-- GameMatchConfig.matchFailTips = {};--比赛开赛失败提示
-- GameMatchConfig.matchRankAndReward = {};--比赛排行和奖励页面
------------------------------------------------------------------------------------------
-- --下面为控件配置说明
-- GameMatchConfig.matchToolbar = {
-- [1] = {
-- path = viewFilePath; --必须配置
-- --下面几项可以不配
-- pos = {
-- ["x"] = x;
-- ["y"] = y;
-- };
-- viewLayer = viewLayer;
-- viewConfig = viewConfig;
-- align = align;
-- config = config;--view需要的配置信息
-- };
-- [2] = {};
-- ...
-- };
----------------------------------------------------------------------------------------
return GameMatchConfig;
|
-- Created as global
new = {}
-- Implements new(), which returns the constructor for cls
local function new_call(_, cls)
return cls[new_call]
end
new.__call = new_call
-- Create a new class, using arguments as mixins
local function new_class(cls, parents)
cls.__index = cls
-- The default constructor
cls[new_call] = function (...)
local o = {}
setmetatable(o, cls)
if type(o.init) == 'function' then
o:init(...)
end
return o
end
for i, parent in ipairs(parents) do
for name, val in pairs(parent) do
if cls[name] == nil then cls[name] = val end
end
end
return cls
end
function new.class(...)
return new_class({}, {...})
end
setmetatable(new, new)
if class_commons ~= false and common == nil then
common = {}
function common.class(name, cls, ...)
return new_class(cls, {...})
end
function common.instance(cls, ...)
return new(cls)(...)
end
end
return new
|
-- xTODO: sets of zones behind a prefix.
-- xTODO: zones with local vs other failover.
-- xTODO: failover on get
-- xTODO: all zone sync on set
-- TODO: fallback cache for broken/overloaded zones.
-- local zone could/should be fetched from environment or local file.
-- doing so allows all configuration files to be identical, simplifying consistency checks.
local my_zone = 'z1'
local STAT_EXAMPLE <const> = 1
local STAT_ANOTHER <const> = 2
function mcp_config_pools(oldss)
mcp.add_stat(STAT_EXAMPLE, "example")
mcp.add_stat(STAT_ANOTHER, "another")
mcp.backend_connect_timeout(5) -- 5 second timeout.
-- alias mcp.backend for convenience.
-- important to alias global variables in routes where speed is concerned.
local srv = mcp.backend
-- local zones = { 'z1', 'z2', 'z3' }
-- IPs are "127" . "zone" . "pool" . "srv"
local pfx = 'fooz1'
local fooz1 = {
srv(pfx .. 'srv1', '127.1.1.1', 11212, 1),
srv(pfx .. 'srv2', '127.1.1.2', 11212, 1),
srv(pfx .. 'srv3', '127.1.1.3', 11212, 1),
}
pfx = 'fooz2'
local fooz2 = {
srv(pfx .. 'srv1', '127.2.1.1', 11213, 1),
srv(pfx .. 'srv2', '127.2.1.2', 11213, 1),
srv(pfx .. 'srv3', '127.2.1.3', 11213, 1),
}
pfx = 'fooz3'
local fooz3 = {
srv(pfx .. 'srv1', '127.3.1.1', 11214, 1),
srv(pfx .. 'srv2', '127.3.1.2', 11214, 1),
srv(pfx .. 'srv3', '127.3.1.3', 11214, 1),
}
pfx = 'barz1'
-- zone "/bar/"-s primary zone should fail; all down.
local barz1 = {
srv(pfx .. 'srv1', '127.1.2.1', 11210, 1),
srv(pfx .. 'srv2', '127.1.2.1', 11210, 1),
srv(pfx .. 'srv3', '127.1.2.1', 11210, 1),
}
pfx = 'barz2'
local barz2 = {
srv(pfx .. 'srv1', '127.2.2.2', 11215, 1),
srv(pfx .. 'srv2', '127.2.2.2', 11215, 1),
srv(pfx .. 'srv3', '127.2.2.2', 11215, 1),
}
pfx = 'barz3'
local barz3 = {
srv(pfx .. 'srv1', '127.3.2.3', 11216, 1),
srv(pfx .. 'srv2', '127.3.2.3', 11216, 1),
srv(pfx .. 'srv3', '127.3.2.3', 11216, 1),
}
-- fallback cache for any zone
-- NOT USED YET
pfx = 'fallz1'
local fallz1 = {
srv(pfx .. 'srv1', '127.0.2.1', 11212, 1),
}
pfx = 'fallz2'
local fallz2 = {
srv(pfx .. 'srv1', '127.0.2.2', 11212, 1),
}
pfx = 'fallz3'
local fallz3 = {
srv(pfx .. 'srv1', '127.0.2.3', 11212, 1),
}
local main_zones = {
foo = { z1 = fooz1, z2 = fooz2, z3 = fooz3 },
bar = { z1 = barz1, z2 = barz2, z3 = barz3 },
-- fall = { z1 = fallz1, z2 = fallz2, z3 = fallz3 },
}
-- FIXME: should we copy the table to keep the pool tables around?
-- does the hash selector hold a reference to the pool (but only available in main config?)
-- uncomment to use the ketama loadable module.
-- FIXME: passing an argument to the ketama module doesn't work yet.
-- local ketama = require("ketama")
-- convert the pools into hash selectors.
-- TODO: is this a good place to add prefixing/hash editing?
for _, subs in pairs(main_zones) do
for k, v in pairs(subs) do
-- use next line instead for a third party ketama hash
-- subs[k] = mcp.pool(v, { dist = ketama })
-- this line overrides the default bucket size for ketama
-- subs[k] = mcp.pool(v, { dist = ketama, obucket = 80 })
-- this line uses the default murmur3 straight hash.
subs[k] = mcp.pool(v)
-- use this next line instead for jump hash.
-- the order of servers in the pool argument _must_ not change!
-- adding the seed string will give a different key distribution
-- for each zone.
-- NOTE: 'k' may not be the right seed here:
-- instead stitch main_zone's key + the sub key?
-- subs[k] = mcp.pool(v, { dist = mcp.hash_jump, seed = k })
end
end
return main_zones
end
-- WORKER CODE:
-- need to redefine main_zones using fetched selectors?
-- TODO: Fallback zone here?
function failover_factory(zones, local_zone)
local near_zone = zones[local_zone]
local far_zones = {}
-- NOTE: could shuffle/sort to re-order zone retry order
-- or use 'next(far_zones, idx)' via a stored upvalue here
for k, v in pairs(zones) do
if k ~= local_zone then
far_zones[k] = v
end
end
return function(r)
local res = near_zone(r)
if res:hit() == false then
for _, zone in pairs(far_zones) do
res = zone(r)
if res:hit() then
break
end
end
end
return res -- send result back to client
end
end
-- SET's to main zone, issues deletes to far zones.
function setinvalidate_factory(zones, local_zone)
local near_zone = zones[local_zone]
local far_zones = {}
-- NOTE: could shuffle/sort to re-order zone retry order
-- or use 'next(far_zones, idx)' via a stored upvalue here
for k, v in pairs(zones) do
if k ~= local_zone then
far_zones[k] = v
end
end
local new_req = mcp.request
return function(r)
local res = near_zone(r)
if res:ok() == true then
-- create a new delete request
local dr = new_req("delete /testing/" .. r:key() .. "\r\n")
for _, zone in pairs(far_zones) do
-- NOTE: can check/do things on the specific response here.
zone(dr)
end
end
-- use original response for client, not DELETE's response.
-- else client won't understand.
return res -- send result back to client
end
end
-- NOTE: this function is culling key prefixes. it is an error to use it
-- without a left anchored (^) pattern.
function prefixtrim_factory(pattern, list, default)
local p = pattern
local l = list
local d = default
local s = mcp.stat
return function(r)
local i, j, match = string.find(r:key(), p)
local route
if match ~= nil then
-- remove the key prefix so we don't waste storage.
r:ltrimkey(j)
route = l[match]
if route == nil then
-- example counter: tick when default route hit.
s(STAT_EXAMPLE, 1)
return d(r)
end
end
return route(r)
end
end
function prefix_factory(pattern, list, default)
local p = pattern
local l = list
local d = default
local s = mcp.stat
return function(r)
local route = l[string.match(r:key(), p)]
if route == nil then
-- example counter: tick when default route hit.
s(STAT_EXAMPLE, 1)
return d(r)
end
return route(r)
end
end
-- TODO: Check tail call requirements?
function command_factory(map, default)
local m = map
local d = default
return function(r)
local f = map[r:command()]
if f == nil then
-- print("default command")
return d(r)
end
-- testing options replacement...
if r:command() == mcp.CMD_SET then
r:token(4, "100") -- set exptime.
end
-- print("override command")
return f(r)
end
end
-- TODO: is the return value the average? anything special?
-- walks a list of selectors and repeats the request.
function walkall_factory(pool)
local p = {}
-- TODO: a shuffle could be useful here.
for _, v in pairs(pool) do
table.insert(p, v)
end
local x = #p
return function(r)
local restable = mcp.await(r, p)
-- walk results and return "best" result
-- print("length of await result table", #restable)
for _, res in pairs(restable) do
if res:ok() then
return res
end
end
-- else we return the first result.
return restable[1]
end
end
function mcp_config_routes(main_zones)
-- generate the prefix routes from zones.
local prefixes = {}
for pfx, z in pairs(main_zones) do
local failover = failover_factory(z, my_zone)
local all = walkall_factory(main_zones[pfx])
local setdel = setinvalidate_factory(z, my_zone)
local map = {}
map[mcp.CMD_SET] = all
-- NOTE: in t/proxy.t all the backends point to the same place
-- which makes replicating delete return NOT_FOUND
map[mcp.CMD_DELETE] = all
-- similar with ADD. will get an NOT_STORED back.
-- need better routes designed for the test suite (edit the key
-- prefix or something)
map[mcp.CMD_ADD] = failover_factory(z, my_zone)
prefixes[pfx] = command_factory(map, failover)
end
local routetop = prefix_factory("^/(%a+)/", prefixes, function(r) return "SERVER_ERROR no route\r\n" end)
-- internally run parser at top of tree
-- also wrap the request string with a convenience object until the C bits
-- are attached to the internal parser.
--mcp.attach(mcp.CMD_ANY, function (r) return routetop(r) end)
mcp.attach(mcp.CMD_ANY_STORAGE, routetop)
end
|
--- @module luci.usbleach.modules.email
local email = {}
function email.index()
return { name = "Email" }
end
--- EDIT ME PLEASE :)
-- Default domain appended to "email" addresses when
-- they don't contain an arobase symbol
local DEFAULT_DOMAIN = "@gmail.com"
-- SMTP server to be used.
local SMTP_HOST = "your_smtp_server.com"
--- STOP EDITING ME PLEASE :)
local mailMessageLink = [===[
Hello, the file %s you've asked me is available here:
%s
This link will work for the next 6 hours, and will then be deleted.
Please stay vigilent, this file may contain malicious things.
]===]
function email.act(t)
local filestat = t.filestat
local file = t.file
local basename = t.basename
local email = luci.http.formvalue("email")
if email == nil or #email < 1 or email == "null" then
return luci.dispatcher.error404('Email not given')
end
if not string.find(email, "@") then
email = email .. DEFAULT_DOMAIN
end
local smtp = require 'socket.smtp'
local fromEmail = uci.cursor():get("usbleach", "main", "email_source", {})
local r, e
if file:sub(1, 7) == "http://" or file:sub(1, 8) == "https://" then
r, e = smtp.send {
from = fromEmail,
rcpt = email,
server = SMTP_HOST,
source = smtp.message {
headers = {
subject = "[USBleach] Your file " .. basename
},
body = string.format(mailMessageLink, basename, file)
}
}
else
if filestat and filestat.type ~= "reg" then
return luci.dispatcher.error404("?? not a regular file (" .. file .. "," .. filestat.type .. ")")
end
r, e = smtp.send {
from = fromEmail,
rcpt = email,
server = SMTP_HOST,
source = smtp.message {
headers = {
subject = "[USBleach] Your file " .. basename,
["content-type"] = 'text/html',
["content-disposition"] = 'attachment; filename="' .. basename .. '"',
["content-description"] = basename,
["content-transfer-encoding"] = "BASE64",
},
body = {
"",
ltn12.source.chain(ltn12.source.file(io.open(file, "rb")),
ltn12.filter.chain(mime.encode("base64"), mime.wrap()))
}
}
}
end
if not r then return { errors = { "ERROR " .. e } } end
table.insert(t.infos, "Mail envoyé")
return { infos = t.infos }
end
function email.config(map)
local s = map:section(luci.cbi.TypedSection, "usbleach", "Module Email")
s.addremove = false
s.anonymous = true
local allow_dangerous = s:option(luci.cbi.Value, "email_source", luci.i18n.translate("Expéditeur"),
luci.i18n.translate("Adresse email à partir de laquelle les informations seront transmises aux utilisateurs"))
allow_dangerous.default = "[email protected]"
allow_dangerous.rmempty = false
if luci.usbleach.is_module_available("luci.usbleach.modules.plik") then
local use_plik = s:option(luci.cbi.Flag, "email_store_on_plik", luci.i18n.translate("Store files on Plik"),
luci.i18n.translate("When enabled, the files you send yourself via email are store on plik and not attached to the email. This way, sensitive files are stored and automatically removed"))
use_plik.enabled = "on"
use_plik.disabled = "off"
use_plik.default = use_plik.enabled
use_plik.rmempty = false
else
s:option(luci.cbi.DummyValue, "option", "", "Did you know? A module is available to host your files on <a href='plik.root.gg'>Plik</a>")
end
end
---
-- Options to include:
-- SMTP Auth (username, password), Host (hostname, port), Auth (PLAIN, LOGIN), Crypto (TLSv1, v1.1, v1.2)
-- SSL: https://stackoverflow.com/questions/29312494/sending-email-using-luasocket-smtp-and-ssl
--
--
return email
|
-- import
local AnimatorClipTreeModule = require 'candy.animator.AnimatorClipTree'
local AnimatorClipTreeNode = AnimatorClipTreeModule.AnimatorClipTreeNode
-- module
local AnimatorClipTreeNodeSelectModule = {}
---@class AnimatorClipTreeNodeSelect : AnimatorClipTreeNode
local AnimatorClipTreeNodeSelect = CLASS: AnimatorClipTreeNodeSelect ( AnimatorClipTreeNode )
:MODEL {
Field ( "var" ):string ():label ( "var" )
}
function AnimatorClipTreeNodeSelect:__init ()
self.var = "state"
self.cases = {}
self.caseCount = 0
self.default = false
end
function AnimatorClipTreeNodeSelect:toString ()
return string.format ( "select %q", self.var )
end
function AnimatorClipTreeNodeSelect:getTypeName ()
return "select"
end
function AnimatorClipTreeNodeSelect:acceptChildType ( typeName )
return "case"
end
function AnimatorClipTreeNodeSelect:getIcon ()
return "animator_clip_tree_node_group"
end
function AnimatorClipTreeNodeSelect:evaluate ( treeState )
local cases = self.cases
for i = 1, self.caseCount do
local child = cases[ i ]
if child:checkCondition ( treeState ) then
return child:evaluateChildren ( treeState )
end
end
local default = self.default
if default then
return default:evaluateChildren ( treeState )
end
end
function AnimatorClipTreeNodeSelect:onBuild ( context )
for i, child in ipairs ( self.children ) do
if child:isDefault () then
if not self.default then
self.default = child
end
else
table.insert ( self.cases, child )
end
end
self.caseCount = #self.cases
end
---@class AnimatorClipTreeNodeSelectCase : AnimatorClipTreeNode
local AnimatorClipTreeNodeSelectCase = CLASS: AnimatorClipTreeNodeSelectCase ( AnimatorClipTreeNode )
:MODEL {
Field ( "value" ):string ()
}
function AnimatorClipTreeNodeSelectCase:__init ()
self.value = "1"
self.checkFunc = false
end
function AnimatorClipTreeNodeSelectCase:toString ()
return string.format ( "case: %s", self.value )
end
function AnimatorClipTreeNodeSelectCase:getTypeName ()
return "case"
end
function AnimatorClipTreeNodeSelectCase:isDefault ()
return false
end
function AnimatorClipTreeNodeSelectCase:acceptChildType ( typeName )
return true
end
function AnimatorClipTreeNodeSelectCase:checkCondition ( treeState )
local func = self.checkFunc
if func then
return func ( treeState )
else
return false
end
end
local type = type
local function isNumber ( v )
return type ( v ) == "number"
end
local function getStateVar ( state, id )
return state.animator.vars[ id ]
end
local function parseConditionPart ( part )
local part = part:trim ()
if tonumber ( part ) then
return string.format ( " ( v==%s or v==%q )", part, part )
elseif part == "true" then
return string.format ( "v==true" )
elseif part == "false" then
return string.format ( "v==false" )
elseif part == "nil" then
return string.format ( "v==nil" )
end
local r0, r1 = part:match ( "^([%d%-%.]+)%s*:%s*([%d%-%.]+)$" )
if tonumber ( r0 ) and tonumber ( r1 ) then
return string.format ( "isn(v) and (v>=%s and v<=%s))", r0, r1 )
end
local op, r = part:match ( "^([<>]=?)%s([%d%-%.]+)$" )
if tonumber ( r ) then
return string.format ( "(isn(v) and (v%s%s)", 90, r )
end
return string.format ( "v==%q", part )
end
local function makeConditionChecker ( var, cond )
local head = string.format ( "local isn, getvar=...; return function ( state ) local v=getvar ( state,%q );", var )
local body = nil
for part in cond:gsplit ( "," ) do
local code = parseConditionPart ( part )
if code then
if body then
body = body .. " or " .. code
else
body = "return " .. code
end
end
end
body = body or "return false"
local tail = ";end"
local src = head .. body .. tail
local funcFunc, err = loadstring ( src )
if funcFunc then
local func = funcFunc ( isNumber, getStateVar )
return func
else
_warn ( "error loading condition", cond )
return false
end
end
function AnimatorClipTreeNodeSelectCase:onBuild ( context )
local parent = self.parent
if not parent:isInstance ( AnimatorClipTreeNodeSelect ) then
return
end
local var = parent.var
local value = self.value
if var:trim () == "" then
self.checkFunc = false
end
if value:trim () == "" then
self.checkFunc = false
end
self.checkFunc = makeConditionChecker ( var, value ) or false
end
---@class AnimatorClipTreeNodeSelectCaseDefault : AnimatorClipTreeNodeSelectCase
local AnimatorClipTreeNodeSelectCaseDefault = CLASS: AnimatorClipTreeNodeSelectCaseDefault ( AnimatorClipTreeNodeSelectCase )
:MODEL {
Field ( "value" ):string ():no_edit ()
}
function AnimatorClipTreeNodeSelectCaseDefault:onBuild ( context )
end
function AnimatorClipTreeNodeSelectCaseDefault:isDefault ()
return true
end
registerAnimatorClipTreeNodeType ( "select", AnimatorClipTreeNodeSelect )
registerAnimatorClipTreeNodeType ( "case", AnimatorClipTreeNodeSelectCase )
registerAnimatorClipTreeNodeType ( "default", AnimatorClipTreeNodeSelectCaseDefault )
AnimatorClipTreeNodeSelectModule.AnimatorClipTreeNodeSelect = AnimatorClipTreeNodeSelect
AnimatorClipTreeNodeSelectModule.AnimatorClipTreeNodeSelectCase = AnimatorClipTreeNodeSelectCase
AnimatorClipTreeNodeSelectModule.AnimatorClipTreeNodeSelectCaseDefault = AnimatorClipTreeNodeSelectCaseDefault
return AnimatorClipTreeNodeSelectModule
|
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then
return
end
local check_backspace = function()
local col = vim.fn.col "." - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
end
-- פּ ﯟ some other good icons
local kind_icons = {
Text = ' ',
Method = ' ',
Function = ' ',
Constructor = ' ',
Field = ' ',
Variable = ' ',
Class = ' ',
Interface = ' ',
Module = ' ',
Property = ' ',
Unit = ' ',
Value = ' ',
Enum = ' ',
Keyword = ' ',
Snippet = ' ',
Color = ' ',
File = ' ',
Reference = ' ',
Folder = ' ',
EnumMember = ' ',
Constant = ' ',
Struct = ' ',
Event = ' ',
Operator = ' ',
TypeParameter = ' ',
}
local source_names = {
nvim_lsp = "(LSP)",
emoji = "(Emoji)",
path = "(Path)",
calc = "(Calc)",
cmp_tabnine = "(Tabnine)",
vsnip = "(Snippet)",
luasnip = "(Snippet)",
buffer = "(Buffer)",
}
local function jumpable(dir)
local win_get_cursor = vim.api.nvim_win_get_cursor
local get_current_buf = vim.api.nvim_get_current_buf
local function inside_snippet()
-- for outdated versions of luasnip
if not luasnip.session.current_nodes then
return false
end
local node = luasnip.session.current_nodes[get_current_buf()]
if not node then
return false
end
local snip_begin_pos, snip_end_pos = node.parent.snippet.mark:pos_begin_end()
local pos = win_get_cursor(0)
pos[1] = pos[1] - 1 -- LuaSnip is 0-based not 1-based like nvim for rows
return pos[1] >= snip_begin_pos[1] and pos[1] <= snip_end_pos[1]
end
---sets the current buffer's luasnip to the one nearest the cursor
---@return boolean true if a node is found, false otherwise
local function seek_luasnip_cursor_node()
-- for outdated versions of luasnip
if not luasnip.session.current_nodes then
return false
end
local pos = win_get_cursor(0)
pos[1] = pos[1] - 1
local node = luasnip.session.current_nodes[get_current_buf()]
if not node then
return false
end
local snippet = node.parent.snippet
local exit_node = snippet.insert_nodes[0]
-- exit early if we're past the exit node
if exit_node then
local exit_pos_end = exit_node.mark:pos_end()
if (pos[1] > exit_pos_end[1]) or (pos[1] == exit_pos_end[1] and pos[2] > exit_pos_end[2]) then
snippet:remove_from_jumplist()
luasnip.session.current_nodes[get_current_buf()] = nil
return false
end
end
node = snippet.inner_first:jump_into(1, true)
while node ~= nil and node.next ~= nil and node ~= snippet do
local n_next = node.next
local next_pos = n_next and n_next.mark:pos_begin()
local candidate = n_next ~= snippet and next_pos and (pos[1] < next_pos[1])
or (pos[1] == next_pos[1] and pos[2] < next_pos[2])
-- Past unmarked exit node, exit early
if n_next == nil or n_next == snippet.next then
snippet:remove_from_jumplist()
luasnip.session.current_nodes[get_current_buf()] = nil
return false
end
if candidate then
luasnip.session.current_nodes[get_current_buf()] = node
return true
end
local ok
ok, node = pcall(node.jump_from, node, 1, true) -- no_move until last stop
if not ok then
snippet:remove_from_jumplist()
luasnip.session.current_nodes[get_current_buf()] = nil
return false
end
end
-- No candidate, but have an exit node
if exit_node then
-- to jump to the exit node, seek to snippet
luasnip.session.current_nodes[get_current_buf()] = snippet
return true
end
-- No exit node, exit from snippet
snippet:remove_from_jumplist()
luasnip.session.current_nodes[get_current_buf()] = nil
return false
end
if dir == -1 then
return inside_snippet() and luasnip.jumpable(-1)
else
return inside_snippet() and seek_luasnip_cursor_node() and luasnip.jumpable()
end
end
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-y>"] = cmp.config.disable,
["<C-e>"] = cmp.mapping {
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif jumpable() then
luasnip.jump(1)
elseif check_backspace() then
fallback()
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {
"i",
"s",
}),
["<CR>"] = cmp.mapping(function(fallback)
if cmp.visible() and cmp.confirm(cmp.confirm_opts) then
if jumpable() then
luasnip.jump(1)
end
return
end
if jumpable() then
if not luasnip.jump(1) then
fallback()
end
else
fallback()
end
end),
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
vim_item.menu = source_names[entry.source.name]
return vim_item
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
{ name = "luasnip" },
{ name = "buffer", keyword_length = 4 },
{ name = "path" },
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
documentation = {
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
},
experimental = {
ghost_text = false,
native_menu = false,
},
}
|
function onCreate()
if difficulty == 0 then
close(true);
end
end
local iconSize = 1;
local iconSpeed = 0.02;
local iconP1X = 0;
local iconP1Y = 0;
local iconP2X = 0;
local iconP2Y = 0;
local funnies = false;
local fuck = 0;
local shit = 0;
-- Sword Icon System by swordcube
-- This script remakes how the icons work, and adds winning icons in the process!
-- You need to put your icons in a path like this:
-- mods/xml-icons/cool-guy/assets
-- You need: assets.png, and assets.xml, grab both files from the "dad" folder for a template.
function onCreatePost()
-- putting semicolons because i'm too used to doing it in haxe
-- hide og icons
setProperty('iconP1.alpha', 0);
setProperty('iconP2.alpha', 0);
-- add dad and bf icon
makeIcons();
end
function onUpdatePost()
if curBeat == 0 then
if not funnies then
iconP2X = getProperty('iconP2.x');
iconP2Y = getProperty('iconP2.y');
iconP1X = getProperty('iconP1.x');
iconP1Y = getProperty('iconP1.y');
funnies = true;
end
end
iconSize = iconSize - iconSpeed;
if iconSize < 1 then
iconSize = 1;
end
scaleObject('dadIcon', iconSize, iconSize);
scaleObject('bfIcon', iconSize, iconSize);
positionIcons();
playIconAnims();
end
function onBeatHit()
iconSize = 1.2;
end
function makeIcons()
makeAnimatedLuaSprite('dadIcon', 'xml-icons/' .. getProperty('dad.healthIcon') .. '/assets', 0, 0);
addAnimationByPrefix('dadIcon', 'normal', 'normal0', 24, true);
addAnimationByPrefix('dadIcon', 'dead', 'dead0', 24, true);
addAnimationByPrefix('dadIcon', 'win', 'win0', 24, true);
addLuaSprite('dadIcon');
makeAnimatedLuaSprite('bfIcon', 'xml-icons/' .. getProperty('boyfriend.healthIcon') .. '/assets', 0, 0);
addAnimationByPrefix('bfIcon', 'normal', 'normal0', 24, true);
addAnimationByPrefix('bfIcon', 'dead', 'dead0', 24, true);
addAnimationByPrefix('bfIcon', 'win', 'win0', 24, true);
addLuaSprite('bfIcon');
-- make the icons be on hud and shti
objectPlayAnimation('dadIcon', 'normal');
objectPlayAnimation('bfIcon', 'normal');
setObjectCamera('dadIcon', 'hud');
setObjectCamera('bfIcon', 'hud');
-- make the icons go in front of health bar lmao
setObjectOrder('dadIcon', 99999);
setObjectOrder('bfIcon', 99999);
-- make score text go in front of icons because i'm 99.99% sure it does that originally
setObjectOrder('scoreTxt', 999999);
-- flip bf icon because f o o d
setProperty('bfIcon.flipX', true);
end
function positionIcons()
fuck = getProperty('health') - 1;
if fuck > 1 then
fuck = 1;
end
if fuck < -1 then
fuck = -1;
end
shit = fuck * 300;
setProperty('dadIcon.x', iconP2X - getProperty('dadIcon.width') + getProperty('dadIcon.frameWidth') - shit);
setProperty('dadIcon.y', iconP2Y);
setProperty('bfIcon.x', iconP1X - shit);
setProperty('bfIcon.y', iconP1Y);
end
function onEvent(eventName, value1, value2)
if eventName == 'Change Character' then
removeIcons();
makeIcons();
end
end
function removeIcons()
removeLuaSprite('dadIcon');
removeLuaSprite('bfIcon');
end
function goodNoteHit()
positionIcons();
end
function playIconAnims()
if getProperty('health') < 0.4150 then
objectPlayAnimation('bfIcon', 'dead');
objectPlayAnimation('dadIcon', 'win');
else
objectPlayAnimation('bfIcon', 'normal');
objectPlayAnimation('dadIcon', 'normal');
end
if getProperty('health') > 1.625 then
objectPlayAnimation('bfIcon', 'win');
objectPlayAnimation('dadIcon', 'dead');
end
end
|
local skynet = require "skynet"
local sharetable = require "skynet.sharetable"
local function queryall_test()
sharetable.loadtable("test_one", {["message"] = "hello one", x = 1, 1})
sharetable.loadtable("test_two", {["message"] = "hello two", x = 2, 2})
sharetable.loadtable("test_three", {["message"] = "hello three", x = 3, 3})
local list = sharetable.queryall({"test_one", "test_two"})
for filename, tbl in pairs(list) do
for k, v in pairs(tbl) do
print(filename, k, v)
end
end
print("test queryall default")
local defaultlist = sharetable.queryall()
for filename, tbl in pairs(defaultlist) do
for k, v in pairs(tbl) do
print(filename, k, v)
end
end
end
skynet.start(function()
-- You can also use sharetable.loadfile / sharetable.loadstring
sharetable.loadtable ("test", { x=1,y={ 'hello world' },['hello world'] = true })
local t = sharetable.query("test")
for k,v in pairs(t) do
print(k,v)
end
sharetable.loadstring ("test", "return { ... }", 1,2,3)
local t = sharetable.query("test")
for k,v in pairs(t) do
print(k,v)
end
queryall_test()
end)
|
---
-- A library providing functions for doing SSLv2 communications
--
--
-- @author Bertrand Bonnefoy-Claudet
-- @author Daniel Miller
local stdnse = require "stdnse"
local bin = require "bin"
local bit = require "bit"
local table = require "table"
local nmap = require "nmap"
local sslcert = require "sslcert"
_ENV = stdnse.module("sslv2", stdnse.seeall)
SSL_MESSAGE_TYPES = {
ERROR = 0,
CLIENT_HELLO = 1,
CLIENT_MASTER_KEY = 2,
CLIENT_FINISHED = 3,
SERVER_HELLO = 4,
SERVER_VERIFY = 5,
SERVER_FINISHED = 6,
REQUEST_CERTIFICATE = 7,
CLIENT_CERTIFICATE = 8,
}
SSL_ERRORS = {
[1] = "SSL_PE_NO_CIPHER",
[2] = "SSL_PE_NO_CERTIFICATE",
[3] = "SSL_PE_BAD_CERTIFICATE",
[4] = "SSL_PE_UNSUPPORTED_CERTIFICATE_TYPE",
}
SSL_CERT_TYPES = {
X509_CERTIFICATE = 1,
}
-- (cut down) table of codes with their corresponding ciphers.
-- inspired by Wireshark's 'epan/dissectors/packet-ssl-utils.h'
--- SSLv2 ciphers, keyed by cipher code as a string of 3 bytes.
--
-- @class table
-- @name SSL_CIPHERS
-- @field str The cipher name as a string
-- @field key_length The length of the cipher's key
-- @field encrypted_key_length How much of the key is encrypted in the handshake (effective key strength)
SSL_CIPHERS = {
["\x01\x00\x80"] = {
str = "SSL2_RC4_128_WITH_MD5",
key_length = 16,
encrypted_key_length = 16,
},
["\x02\x00\x80"] = {
str = "SSL2_RC4_128_EXPORT40_WITH_MD5",
key_length = 16,
encrypted_key_length = 5,
},
["\x03\x00\x80"] = {
str = "SSL2_RC2_128_CBC_WITH_MD5",
key_length = 16,
encrypted_key_length = 16,
},
["\x04\x00\x80"] = {
str = "SSL2_RC2_128_CBC_EXPORT40_WITH_MD5",
key_length = 16,
encrypted_key_length = 5,
},
["\x05\x00\x80"] = {
str = "SSL2_IDEA_128_CBC_WITH_MD5",
key_length = 16,
encrypted_key_length = 16,
},
["\x06\x00\x40"] = {
str = "SSL2_DES_64_CBC_WITH_MD5",
key_length = 8,
encrypted_key_length = 8,
},
["\x07\x00\xc0"] = {
str = "SSL2_DES_192_EDE3_CBC_WITH_MD5",
key_length = 24,
encrypted_key_length = 24,
},
["\x00\x00\x00"] = {
str = "SSL2_NULL_WITH_MD5",
key_length = 0,
encrypted_key_length = 0,
},
["\x08\x00\x80"] = {
str = "SSL2_RC4_64_WITH_MD5",
key_length = 16,
encrypted_key_length = 8,
},
}
--- Another table of ciphers
--
-- Unlike SSL_CIPHERS, this one is keyed by cipher name and the values are the
-- cipher code as a 3-byte string.
-- @class table
-- @name SSL_CIPHER_CODES
SSL_CIPHER_CODES = {}
for k, v in pairs(SSL_CIPHERS) do
SSL_CIPHER_CODES[v.str] = k
end
local SSL_MAX_RECORD_LENGTH_2_BYTE_HEADER = 32767
local SSL_MAX_RECORD_LENGTH_3_BYTE_HEADER = 16383
-- 2 bytes of length minimum
local SSL_MIN_HEADER = 2
local function read_header(buffer, i)
i = i or 1
-- Ensure we have enough data for the header.
if #buffer - i + 1 < SSL_MIN_HEADER then
return i, nil
end
local len
i, len = bin.unpack(">S", buffer, i)
local msb = bit.band(len, 0x8000) == 0x8000
local header_length, record_length, padding_length, is_escape
if msb then
header_length = 2
record_length = bit.band(len, 0x7fff)
padding_length = 0
else
header_length = 3
if #buffer - i + 1 < 1 then
-- don't have enough for the message_type. Back up.
return i - SSL_MIN_HEADER, nil
end
record_length = bit.band(len, 0x3fff)
is_escape = not not bit.band(len, 0x4000)
i, padding_length = bin.unpack("C", buffer, i)
end
return i, {
record_length = record_length,
is_escape = is_escape,
padding_length = padding_length,
}
end
---
-- Read a SSLv2 record
-- @param buffer The read buffer
-- @param i The position in the buffer to start reading
-- @return The current position in the buffer
-- @return The record that was read, as a table
function record_read(buffer, i)
local i, h = read_header(buffer, i)
if #buffer - i + 1 < h.record_length or not h then
return i, nil
end
i, h.message_type = bin.unpack("C", buffer, i)
if h.message_type == SSL_MESSAGE_TYPES.SERVER_HELLO then
local j, SID_hit, certificate_type, ssl_version, certificate_len, ciphers_len, connection_id_len = bin.unpack(">CCSSSS", buffer, i)
local j, certificate = bin.unpack("A" .. certificate_len, buffer, j)
local ciphers_end = j + ciphers_len
local ciphers = {}
while j < ciphers_end do
local cipher
j, cipher = bin.unpack("A3", buffer, j)
local cipher_name = SSL_CIPHERS[cipher] and SSL_CIPHERS[cipher].str or ("0x" .. stdnse.tohex(cipher))
ciphers[#ciphers+1] = cipher_name
end
local j, connection_id = bin.unpack("A" .. connection_id_len, buffer, j)
h.body = {
cert_type = certificate_type,
cert = certificate,
ciphers = ciphers,
connection_id = connection_id,
}
i = j
elseif h.message_type == SSL_MESSAGE_TYPES.ERROR and h.record_length == 3 then
local j, err = bin.unpack(">S", buffer, i)
h.body = {
error = SSL_ERRORS[err] or err
}
i = j
else
-- TODO: Other message types?
h.message_type = "encrypted"
local j, data = bin.unpack("A"..h.record_length, buffer, i)
h.body = {
data = data
}
i = j
end
return i, h
end
--- Wrap a payload in an SSLv2 record header
--
--@param payload The padded payload to send
--@param pad_length The length of the padding. If the payload is not padded, set to 0
--@return An SSLv2 record containing the payload
function ssl_record (payload, pad_length)
local length = #payload
assert(
length < (pad_length == 0 and SSL_MAX_RECORD_LENGTH_2_BYTE_HEADER or SSL_MAX_RECORD_LENGTH_3_BYTE_HEADER),
"SSL record too long")
assert(pad_length < 256, "SSL record padding too long")
if pad_length > 0 then
return bin.pack(">SCA", length, pad_length, payload)
else
return bin.pack(">SA", bit.bor(length, 0x8000), payload)
end
end
---
-- Build a client_hello message
--
-- The <code>ciphers</code> parameter can contain cipher names or raw 3-byte
-- cipher codes.
-- @param ciphers Table of cipher names
-- @return The client_hello record as a string
function client_hello (ciphers)
local cipher_codes = {}
for _, c in ipairs(ciphers) do
local ck = SSL_CIPHER_CODES[c] or c
assert(#ck == 3, "Unknown cipher")
cipher_codes[#cipher_codes+1] = ck
end
local challenge = stdnse.generate_random_string(16)
local ssl_v2_hello = bin.pack(">CSSSSAA",
1, -- MSG-CLIENT-HELLO
2, -- version: SSL 2.0
#cipher_codes * 3, -- cipher spec length
0, -- session ID length
#challenge, -- challenge length
table.concat(cipher_codes),
challenge
)
return ssl_record(ssl_v2_hello, 0)
end
function client_master_secret(cipher_name, clear_key, encrypted_key, key_arg)
local key_arg = key_arg or ""
local ck = SSL_CIPHER_CODES[cipher_name] or cipher_name
assert(#ck == 3, "Unknown cipher in client_master_secret")
return ssl_record( bin.pack(">CASSSAAA",
SSL_MESSAGE_TYPES.CLIENT_MASTER_KEY,
ck,
#clear_key,
#encrypted_key,
#key_arg,
clear_key,
encrypted_key,
key_arg
), 0)
end
local function read_atleast(s, n)
local buf = {}
local count = 0
while count < n do
local status, data = s:receive_bytes(n - count)
if not status then
return status, data, table.concat(buf)
end
buf[#buf+1] = data
count = count + #data
end
return true, table.concat(buf)
end
--- Get an entire record into a buffer
--
-- Caller is responsible for closing the socket if necessary.
-- @param sock The socket to read additional data from
-- @param buffer The string buffer holding any previously-read data
-- (default: "")
-- @param i The position in the buffer where the record should start
-- (default: 1)
-- @return status Socket status
-- @return Buffer containing at least 1 record if status is true
-- @return Error text if there was an error
function record_buffer(sock, buffer, i)
buffer = buffer or ""
i = i or 1
if #buffer - i + 1 < SSL_MIN_HEADER then
local status, resp, rem = read_atleast(sock, SSL_MIN_HEADER - (#buffer - i + 1))
if not status then
return false, buffer .. rem, resp
end
buffer = buffer .. resp
end
local i, h = read_header(buffer, i)
if not h then
return false, buffer, "Couldn't read a SSLv2 header"
end
if (#buffer - i + 1) < h.record_length then
local status, resp = read_atleast(sock, h.record_length - (#buffer - i + 1))
if not status then
return false, buffer, resp
end
buffer = buffer .. resp
end
return true, buffer
end
function test_sslv2 (host, port)
local timeout = stdnse.get_timeout(host, 10000, 5000)
-- Create socket.
local status, socket, err
local starttls = sslcert.getPrepareTLSWithoutReconnect(port)
if starttls then
status, socket = starttls(host, port)
if not status then
stdnse.debug(1, "Can't connect using STARTTLS: %s", socket)
return nil
end
else
socket = nmap.new_socket()
socket:set_timeout(timeout)
status, err = socket:connect(host, port)
if not status then
stdnse.debug(1, "Can't connect: %s", err)
return nil
end
end
socket:set_timeout(timeout)
local ssl_v2_hello = client_hello(stdnse.keys(SSL_CIPHER_CODES))
socket:send(ssl_v2_hello)
local status, record = record_buffer(socket)
socket:close();
if not status then
return nil
end
local _, message = record_read(record)
-- some sanity checks:
-- is it SSLv2?
if not message or not message.body then
return
end
-- is response a server hello?
if (message.message_type ~= SSL_MESSAGE_TYPES.SERVER_HELLO) then
return
end
---- is certificate in X.509 format?
--if (message.body.cert_type ~= 1) then
-- return
--end
return message.body.ciphers
end
return _ENV;
|
---------------------------------------------------------------------------
--- Remote control module allowing usage of awesome-client.
--
-- @author Julien Danjou <[email protected]>
-- @copyright 2009 Julien Danjou
-- @module awful.remote
---------------------------------------------------------------------------
-- Grab environment we need
require("awful.dbus")
local load = loadstring or load -- luacheck: globals loadstring (compatibility with Lua 5.1)
local tostring = tostring
local ipairs = ipairs
local table = table
local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility with Lua 5.1)
local dbus = dbus
local type = type
if dbus then
dbus.connect_signal("org.awesomewm.awful.Remote", function(data, code)
if data.member == "Eval" then
local f, e = load(code)
if not f then
return "s", e
end
local results = { pcall(f) }
if not table.remove(results, 1) then
return "s", "Error during execution: " .. tostring(results[1])
end
local retvals = {}
for _, v in ipairs(results) do
local t = type(v)
if t == "boolean" then
table.insert(retvals, "b")
table.insert(retvals, v)
elseif t == "number" then
table.insert(retvals, "d")
table.insert(retvals, v)
else
table.insert(retvals, "s")
table.insert(retvals, tostring(v))
end
end
return unpack(retvals)
end
end)
end
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
-- Map leader to space
vim.g.mapleader = ' '
vim.g.maplocalleader = ','
-- bootstrap packer plugin
local fn = vim.fn
local execute = vim.api.nvim_command
local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
execute('!git clone https://github.com/wbthomason/packer.nvim ' ..
install_path)
end
vim.cmd [[packadd packer.nvim]]
vim.cmd 'autocmd BufWritePost plugins.lua PackerCompile'
-- load settings
require('settings.init')
require('tmp')
require('settings').setup()
require('plugins').setup()
require('config.lsp').setup()
|
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:25' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
--Team Section
local BATTLEGROUND_TEAM_SECTION_MOVE_SLOTS_PER_SECOND = 4
local BATTLEGROUND_TEAM_SECTION_SPACING = 10
ZO_BattlegroundTeamSection = ZO_Object:Subclass()
function ZO_BattlegroundTeamSection:New(...)
local object = ZO_Object.New(self)
object:Initialize(...)
return object
end
do
local KEYBOARD_STYLE =
{
scoreFont = "ZoFontWinH1",
}
local GAMEPAD_STYLE =
{
scoreFont = "ZoFontGamepad36",
}
function ZO_BattlegroundTeamSection:Initialize(control, battlegroundAlliance)
self.control = control
self.scoreLabel = control:GetNamedChild("Score")
self.attributeBarControl = control:GetNamedChild("ScoreDisplay")
self.statusBar = self.attributeBarControl:GetNamedChild("Bar")
self.scoreLabel = self.attributeBarControl:GetNamedChild("Value")
self.iconTexture = control:GetNamedChild("Icon")
self.battlegroundAlliance = battlegroundAlliance
ZO_StatusBar_SetGradientColor(self.statusBar, ZO_BATTLEGROUND_ALLIANCE_STATUS_BAR_GRADIENTS[battlegroundAlliance])
ZO_PlatformStyle:New(function(style) self:ApplyStyle(style) end, KEYBOARD_STYLE, GAMEPAD_STYLE)
self:UpdateScore()
end
end
function ZO_BattlegroundTeamSection:GetControl()
return self.control
end
function ZO_BattlegroundTeamSection:GetBattlegroundAlliance()
return self.battlegroundAlliance
end
function ZO_BattlegroundTeamSection:SetTargetOrder(order)
self.targetOrder = order
end
function ZO_BattlegroundTeamSection:SetOrder(order)
self.order = order
self.targetOrder = order
self:UpdateAnchor()
end
function ZO_BattlegroundTeamSection:UpdateOrder(deltaMS)
local lastOrder = self.order
if not self.order then
self.order = self.targetOrder
else
if self.targetOrder > self.order then
self.order = zo_min(self.targetOrder, self.order + deltaMS * BATTLEGROUND_TEAM_SECTION_MOVE_SLOTS_PER_SECOND)
else
self.order = zo_max(self.targetOrder, self.order - deltaMS * BATTLEGROUND_TEAM_SECTION_MOVE_SLOTS_PER_SECOND)
end
end
if self.order ~= lastOrder then
self:UpdateAnchor()
end
end
function ZO_BattlegroundTeamSection:UpdateAnchor()
local sectionHeight = self.control:GetHeight()
local zeroBasedOrder = self.order - 1
local topLeftY = zeroBasedOrder * (sectionHeight + BATTLEGROUND_TEAM_SECTION_SPACING)
self.control:SetAnchor(TOPRIGHT, nil, TOPRIGHT, 0, topLeftY)
end
function ZO_BattlegroundTeamSection:ApplyStyle(style)
self.scoreLabel:SetFont(style.scoreFont)
self.iconTexture:SetTexture(GetBattlegroundTeamIcon(self.battlegroundAlliance))
ApplyTemplateToControl(self.control, ZO_GetPlatformTemplate("ZO_BattlegroundTeamSection"))
ApplyTemplateToControl(self.attributeBarControl:GetNamedChild("BgLeft"), ZO_GetPlatformTemplate("ZO_PlayerAttributeBgLeft"))
ApplyTemplateToControl(self.attributeBarControl:GetNamedChild("BgRight"), ZO_GetPlatformTemplate("ZO_PlayerAttributeBgRightArrow"))
ApplyTemplateToControl(self.attributeBarControl:GetNamedChild("BgCenter"), ZO_GetPlatformTemplate("ZO_PlayerAttributeBgCenter"))
ApplyTemplateToControl(self.statusBar, ZO_GetPlatformTemplate("ZO_PlayerAttributeStatusBar"))
ApplyTemplateToControl(self.statusBar, ZO_GetPlatformTemplate("ZO_PlayerAttributeBarAnchorRight"))
ApplyTemplateToControl(self.statusBar:GetNamedChild("Gloss"), ZO_GetPlatformTemplate("ZO_PlayerAttributeStatusBarGloss"))
ApplyTemplateToControl(self.attributeBarControl:GetNamedChild("FrameLeft"), ZO_GetPlatformTemplate("ZO_PlayerAttributeFrameLeft"))
ApplyTemplateToControl(self.attributeBarControl:GetNamedChild("FrameRight"), ZO_GetPlatformTemplate("ZO_PlayerAttributeFrameRightArrow"))
ApplyTemplateToControl(self.attributeBarControl:GetNamedChild("FrameCenter"), ZO_GetPlatformTemplate("ZO_PlayerAttributeFrameCenter"))
ApplyTemplateToControl(self.scoreLabel, ZO_GetPlatformTemplate("ZO_BattlegroundScoreHudScoreLabel"))
end
function ZO_BattlegroundTeamSection:GetScore()
return self.score
end
function ZO_BattlegroundTeamSection:UpdateScore()
local score = GetCurrentBattlegroundScore(self.battlegroundAlliance)
local currentBattlegroundId = GetCurrentBattlegroundId()
local scoreToWin = GetScoreToWinBattleground(currentBattlegroundId)
local lastScore = self.score
if lastScore ~= nil and score > lastScore then
if scoreToWin > 0 then
local lastScorePercent = lastScore / scoreToWin
local currentScorePercent = score / scoreToWin
local nearingVictoryPercent = GetBattlegroundNearingVictoryPercent(currentBattlegroundId)
--Since we use a float for percent it can be slighltly off value. We use float equality for the equals part of these checks.
if (lastScorePercent < nearingVictoryPercent and not zo_floatsAreEqual(lastScorePercent, nearingVictoryPercent)) and
(currentScorePercent > nearingVictoryPercent or zo_floatsAreEqual(currentScorePercent, nearingVictoryPercent)) then
local messageParams = CENTER_SCREEN_ANNOUNCE:CreateMessageParams(CSA_CATEGORY_MAJOR_TEXT, SOUNDS.BATTLEGROUND_NEARING_VICTORY)
local text
if self.battlegroundAlliance == GetUnitBattlegroundAlliance("player") then
text = zo_strformat(SI_BATTLEGROUND_NEARING_VICTORY_OWN_TEAM, GetColoredBattlegroundYourTeamText(self.battlegroundAlliance))
else
text = zo_strformat(SI_BATTLEGROUND_NEARING_VICTORY_OTHER_TEAM, GetColoredBattlegroundAllianceName(self.battlegroundAlliance))
end
messageParams:SetText(text)
messageParams:SetCSAType(CENTER_SCREEN_ANNOUNCE_TYPE_BATTLEGROUND_NEARING_VICTORY)
CENTER_SCREEN_ANNOUNCE:AddMessageWithParams(messageParams)
end
end
end
self.score = score
self.scoreLabel:SetText(score)
self.statusBar:SetMinMax(0, scoreToWin)
self.statusBar:SetValue(score)
end
function ZO_BattlegroundTeamSection:OnUpdate(deltaS)
self:UpdateOrder(deltaS)
end
--Score Hud
ZO_BattlegroundScoreHud = ZO_Object:Subclass()
function ZO_BattlegroundScoreHud:New(...)
local object = ZO_Object.New(self)
object:Initialize(...)
return object
end
function ZO_BattlegroundScoreHud:Initialize(control)
self.control = control
control:SetHandler("OnUpdate", function(...) self:OnUpdate(...) end)
self.objectiveStateDisplayControl = control:GetNamedChild("ObjectiveStateDisplay")
self.teamsControl = control:GetNamedChild("Teams")
self.playerTeamIndicatorTexture = control:GetNamedChild("PlayerTeamIndicator")
self.objectiveStateLayout = ZO_BattlegroundObjectiveStateLayout:New(self.objectiveStateDisplayControl)
self.backgroundTexture = control:GetNamedChild("Background")
self:CreateTeamSections()
self:RegisterEvents()
self.indicatorManager = ZO_BattlegroundObjectiveStateIndicatorManager:New(self)
self.gameType = BATTLEGROUND_GAME_TYPE_NONE
self:UpdateGameType()
end
function ZO_BattlegroundScoreHud:GetControl()
return self.control
end
function ZO_BattlegroundScoreHud:GetObjectiveStateLayout()
return self.objectiveStateLayout
end
function ZO_BattlegroundScoreHud:CreateTeamSections()
self.teamSectionSort = function(a, b)
local aScore = a:GetScore()
local bScore = b:GetScore()
if aScore ~= bScore then
return aScore > bScore
end
return a:GetBattlegroundAlliance() < b:GetBattlegroundAlliance()
end
self.teamSections = {}
for bgAlliance = BATTLEGROUND_ALLIANCE_ITERATION_BEGIN, BATTLEGROUND_ALLIANCE_ITERATION_END do
local control = CreateControlFromVirtual("$(parent)Section", self.teamsControl, "ZO_BattlegroundTeamSection", bgAlliance)
table.insert(self.teamSections, ZO_BattlegroundTeamSection:New(control, bgAlliance))
end
local DONT_ANIMATE = false
self:SortTeamSections(DONT_ANIMATE)
end
function ZO_BattlegroundScoreHud:SortTeamSections(animate)
table.sort(self.teamSections, self.teamSectionSort)
for i, section in ipairs(self.teamSections) do
if animate then
section:SetTargetOrder(i)
else
section:SetOrder(i)
end
end
end
function ZO_BattlegroundScoreHud:RefreshPlayerTeamIndicator()
local playerBattlegroundAlliance = GetUnitBattlegroundAlliance("player")
for _, section in ipairs(self.teamSections) do
if section:GetBattlegroundAlliance() == playerBattlegroundAlliance then
local sectionControl = section:GetControl()
self.playerTeamIndicatorTexture:SetAnchor(RIGHT, sectionControl, LEFT, -9, 0)
break
end
end
end
function ZO_BattlegroundScoreHud:RegisterEvents()
self.control:RegisterForEvent(EVENT_ZONE_SCORING_CHANGED, function() self:OnZoneScoringChanged() end)
self.control:RegisterForEvent(EVENT_PLAYER_ACTIVATED, function() self:OnPlayerActivated() end)
self.control:RegisterForEvent(EVENT_BATTLEGROUND_RULESET_CHANGED, function() self:OnBattlegroundRulesetChanged() end)
self.control:RegisterForEvent(EVENT_OBJECTIVES_UPDATED, function() self:OnObjectivesUpdated() end)
end
function ZO_BattlegroundScoreHud:OnUpdate(control, timeS)
if self.lastUpdateS then
local deltaS = timeS - self.lastUpdateS
for _, section in ipairs(self.teamSections) do
section:OnUpdate(deltaS)
end
end
self.lastUpdateS = timeS
end
function ZO_BattlegroundScoreHud:OnZoneScoringChanged()
self:CallOnTeamSections("UpdateScore")
local ANIMATE = true
self:SortTeamSections(ANIMATE)
end
function ZO_BattlegroundScoreHud:OnPlayerActivated()
self:UpdateGameType()
self.indicatorManager:OnObjectivesUpdated()
self:RefreshPlayerTeamIndicator()
end
function ZO_BattlegroundScoreHud:OnBattlegroundRulesetChanged()
self:UpdateGameType()
self:CallOnTeamSections("UpdateScore")
local DONT_ANIMATE = false
self:SortTeamSections(DONT_ANIMATE)
self:RefreshPlayerTeamIndicator()
end
function ZO_BattlegroundScoreHud:OnObjectivesUpdated()
self.indicatorManager:OnObjectivesUpdated()
end
function ZO_BattlegroundScoreHud:CallOnTeamSections(functionName, ...)
for _, section in ipairs(self.teamSections) do
section[functionName](section, ...)
end
end
function ZO_BattlegroundScoreHud:UpdateGameType()
local battlegroundId = GetCurrentBattlegroundId()
local gameType = GetBattlegroundGameType(battlegroundId)
if self.gameType ~= gameType then
self.gameType = gameType
self.indicatorManager:OnBattlegroundGameTypeChanged(gameType)
end
end
function ZO_BattlegroundScoreHud_OnInitialized(self)
BATTLEGROUND_SCORE_HUD = ZO_BattlegroundScoreHud:New(self)
end
|
--!A cross-platform build utility based on Lua
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- Copyright (C) 2015-2020, TBOOX Open Source Group.
--
-- @author ruki
-- @file install_package.lua
--
-- imports
import("core.base.option")
import("detect.sdks.find_vcpkgdir")
-- install package
--
-- @param name the package name, e.g. pcre2, pcre2/libpcre2-8
-- @param opt the options, e.g. {verbose = true}
--
-- @return true or false
--
function main(name, opt)
-- attempt to find the vcpkg root directory
local vcpkgdir = find_vcpkgdir(opt.vcpkgdir)
if not vcpkgdir then
raise("vcpkg not found!")
end
-- get arch, plat and mode
local arch = opt.arch
local plat = opt.plat
local mode = opt.mode
if plat == "macosx" then
plat = "osx"
end
if arch == "x86_64" then
arch = "x64"
end
-- init triplet
local triplet = arch .. "-" .. plat
if opt.plat == "windows" and opt.shared ~= true then
triplet = triplet .. "-static"
if opt.vs_runtime and opt.vs_runtime:startswith("MD") then
triplet = triplet .. "-md"
end
end
-- init argv
local argv = {"install", name .. ":" .. triplet}
if option.get("diagnosis") then
table.insert(argv, "--debug")
end
-- install package
os.vrunv(path.join(vcpkgdir, "vcpkg"), argv)
end
|
local ffi = require('ffi')
ffi.cdef [[
void *memchr(const void *str, int c, size_t n);
int memcmp(const void *str1, const void *str2, size_t n);
void *memcpy(void *dest, const void *src, size_t n);
void *memmove(void *dest, const void *src, size_t n);
void *memset(void *str, int c, size_t n);
char *strcat(char *dest, const char *src);
char *strncat(char *dest, const char *src, size_t n);
char *strchr(const char *str, int c);
int strcmp(const char *str1, const char *str2);
int strncmp(const char *str1, const char *str2, size_t n);
int strcoll(const char *str1, const char *str2);
char *strcpy(char *dest, const char *src);
char *strncpy(char *dest, const char *src, size_t n);
size_t strcspn(const char *str1, const char *str2);
char *strerror(int errnum);
size_t strlen(const char *str);
char *strpbrk(const char *str1, const char *str2);
char *strrchr(const char *str, int c);
size_t strspn(const char *str1, const char *str2);
char *strstr(const char *haystack, const char *needle);
char *strtok(char *str, const char *delim);
size_t strxfrm(char *dest, const char *src, size_t n);
]]
--
local M = {}
return M
|
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_INITIALIZE_CASH
-- @usage void NETWORK_INITIALIZE_CASH(int p0, int p1);
-- @param p0 int
-- @param p1 int
-- @return void
function NetworkInitializeCash(p0, p1) end
-- Note the 2nd parameters are always 1, 0. I have a feeling it deals with your money, wallet, bank. So when you delete the character it of course wipes the wallet cash at that time. So if that was the case, it would be eg, NETWORK_DELETE_CHARACTER(characterIndex, deleteWalletCash, deleteBankCash);
-- @module native
-- @submodule networkcash
-- @see NETWORK_DELETE_CHARACTER
-- @usage void NETWORK_DELETE_CHARACTER(int characterIndex, BOOL p1, BOOL p2);
-- @param characterIndex int
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkDeleteCharacter(characterIndex, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_CLEAR_CHARACTER_WALLET
-- @usage void NETWORK_CLEAR_CHARACTER_WALLET(Any p0);
-- @param p0 Any
-- @return void
function NetworkClearCharacterWallet(p0) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_GIVE_PLAYER_JOBSHARE_CASH
-- @usage void NETWORK_GIVE_PLAYER_JOBSHARE_CASH(int amount, int* networkHandle);
-- @param amount int
-- @param networkHandle int*
-- @return void
function NetworkGivePlayerJobshareCash(amount, networkHandle) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_RECEIVE_PLAYER_JOBSHARE_CASH
-- @usage void NETWORK_RECEIVE_PLAYER_JOBSHARE_CASH(int value, int* networkHandle);
-- @param value int
-- @param networkHandle int*
-- @return void
function NetworkReceivePlayerJobshareCash(value, networkHandle) end
-- index ------- See function sub_1005 in am_boat_taxi.ysc context ---------- "BACKUP_VAGOS" "BACKUP_LOST" "BACKUP_FAMILIES" "HIRE_MUGGER" "HIRE_MERCENARY" "BUY_CARDROPOFF" "HELI_PICKUP" "BOAT_PICKUP" "CLEAR_WANTED" "HEAD_2_HEAD" "CHALLENGE" "SHARE_LAST_JOB" "DEFAULT" reason --------- "NOTREACHTARGET" "TARGET_ESCAPE" "DELIVERY_FAIL" "NOT_USED" "TEAM_QUIT" "SERVER_ERROR" "RECEIVE_LJ_L" "CHALLENGE_PLAYER_LEFT" "DEFAULT" unk ----- Unknown bool value
-- @module native
-- @submodule networkcash
-- @see NETWORK_REFUND_CASH
-- @usage void NETWORK_REFUND_CASH(int index, char* context, char* reason, BOOL unk);
-- @param index int
-- @param context char*
-- @param reason char*
-- @param unk BOOL
-- @return void
function NetworkRefundCash(index, context, reason, unk) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_MONEY_CAN_BET
-- @usage BOOL NETWORK_MONEY_CAN_BET(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return BOOL
function NetworkMoneyCanBet(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_CAN_BET
-- @usage BOOL NETWORK_CAN_BET(Any p0);
-- @param p0 Any
-- @return BOOL
function NetworkCanBet(p0) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_PICKUP
-- @usage Any NETWORK_EARN_FROM_PICKUP(int amount);
-- @param amount int
-- @return Any
function NetworkEarnFromPickup(amount) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_CRATE_DROP
-- @usage void NETWORK_EARN_FROM_CRATE_DROP(int amount);
-- @param amount int
-- @return void
function NetworkEarnFromCrateDrop(amount) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_BETTING
-- @usage void NETWORK_EARN_FROM_BETTING(int amount, char* p1);
-- @param amount int
-- @param p1 char*
-- @return void
function NetworkEarnFromBetting(amount, p1) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_JOB
-- @usage void NETWORK_EARN_FROM_JOB(int amount, char* p1);
-- @param amount int
-- @param p1 char*
-- @return void
function NetworkEarnFromJob(amount, p1) end
-- Pretty sure this is actually a hash collision. It should be NETWORK_EARN_FROM_A*** or NETWORK_EARN_FROM_B*** ============================================================= Not a hash collision, test it for yourself when finishing heist. lackos; 2017.03.12
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_MISSION_H
-- @usage void NETWORK_EARN_FROM_MISSION_H(int amount, char* heistHash);
-- @param amount int
-- @param heistHash char*
-- @return void
function NetworkEarnFromMissionH(amount, heistHash) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_CHALLENGE_WIN
-- @usage void NETWORK_EARN_FROM_CHALLENGE_WIN(Any p0, Any* p1, BOOL p2);
-- @param p0 Any
-- @param p1 Any*
-- @param p2 BOOL
-- @return void
function NetworkEarnFromChallengeWin(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_BOUNTY
-- @usage void NETWORK_EARN_FROM_BOUNTY(int amount, int* networkHandle, Any* p2, Any p3);
-- @param amount int
-- @param networkHandle int*
-- @param p2 Any*
-- @param p3 Any
-- @return void
function NetworkEarnFromBounty(amount, networkHandle, p2, p3) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_IMPORT_EXPORT
-- @usage void NETWORK_EARN_FROM_IMPORT_EXPORT(Any p0, Any p1);
-- @param p0 Any
-- @param p1 Any
-- @return void
function NetworkEarnFromImportExport(p0, p1) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_HOLDUPS
-- @usage void NETWORK_EARN_FROM_HOLDUPS(int amount);
-- @param amount int
-- @return void
function NetworkEarnFromHoldups(amount) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_PROPERTY
-- @usage void NETWORK_EARN_FROM_PROPERTY(int amount, Hash propertyName);
-- @param amount int
-- @param propertyName Hash
-- @return void
function NetworkEarnFromProperty(amount, propertyName) end
-- DSPORT
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_AI_TARGET_KILL
-- @usage void NETWORK_EARN_FROM_AI_TARGET_KILL(Any p0, Any p1);
-- @param p0 Any
-- @param p1 Any
-- @return void
function NetworkEarnFromAiTargetKill(p0, p1) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_NOT_BADSPORT
-- @usage void NETWORK_EARN_FROM_NOT_BADSPORT(int amount);
-- @param amount int
-- @return void
function NetworkEarnFromNotBadsport(amount) end
-- This merely adds an entry in the Network Transaction Log; it does not grant cash to the player (on PC). Max value for amount is 9999999.
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_ROCKSTAR
-- @usage void NETWORK_EARN_FROM_ROCKSTAR(int amount);
-- @param amount int
-- @return void
function NetworkEarnFromRockstar(amount) end
-- Now has 8 params.
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_VEHICLE
-- @usage void NETWORK_EARN_FROM_VEHICLE(Any p0, Any p1, Any p2, Any p3, Any p4, Any p5, Any p6, Any p7);
-- @param p0 Any
-- @param p1 Any
-- @param p2 Any
-- @param p3 Any
-- @param p4 Any
-- @param p5 Any
-- @param p6 Any
-- @param p7 Any
-- @return void
function NetworkEarnFromVehicle(p0, p1, p2, p3, p4, p5, p6, p7) end
-- Now has 9 parameters.
-- @module native
-- @submodule networkcash
-- @see NETWORK_EARN_FROM_PERSONAL_VEHICLE
-- @usage void NETWORK_EARN_FROM_PERSONAL_VEHICLE(Any p0, Any p1, Any p2, Any p3, Any p4, Any p5, Any p6, Any p7, Any p8);
-- @param p0 Any
-- @param p1 Any
-- @param p2 Any
-- @param p3 Any
-- @param p4 Any
-- @param p5 Any
-- @param p6 Any
-- @param p7 Any
-- @param p8 Any
-- @return void
function NetworkEarnFromPersonalVehicle(p0, p1, p2, p3, p4, p5, p6, p7, p8) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_CAN_SPEND_MONEY
-- @usage BOOL NETWORK_CAN_SPEND_MONEY(Any p0, BOOL p1, BOOL p2, BOOL p3, Any p4);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @param p3 BOOL
-- @param p4 Any
-- @return BOOL
function NetworkCanSpendMoney(p0, p1, p2, p3, p4) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_BUY_ITEM
-- @usage void NETWORK_BUY_ITEM(Ped player, Hash item, Any p2, Any p3, BOOL p4, char* item_name, Any p6, Any p7, Any p8, BOOL p9);
-- @param player Ped
-- @param item Hash
-- @param p2 Any
-- @param p3 Any
-- @param p4 BOOL
-- @param item_name char*
-- @param p6 Any
-- @param p7 Any
-- @param p8 Any
-- @param p9 BOOL
-- @return void
function NetworkBuyItem(player, item, p2, p3, p4, item_name, p6, p7, p8, p9) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_TAXI
-- @usage void NETWORK_SPENT_TAXI(int amount, BOOL p1, BOOL p2);
-- @param amount int
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentTaxi(amount, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_PAY_EMPLOYEE_WAGE
-- @usage void NETWORK_PAY_EMPLOYEE_WAGE(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkPayEmployeeWage(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_PAY_UTILITY_BILL
-- @usage void NETWORK_PAY_UTILITY_BILL(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkPayUtilityBill(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_PAY_MATCH_ENTRY_FEE
-- @usage void NETWORK_PAY_MATCH_ENTRY_FEE(int value, int* p1, BOOL p2, BOOL p3);
-- @param value int
-- @param p1 int*
-- @param p2 BOOL
-- @param p3 BOOL
-- @return void
function NetworkPayMatchEntryFee(value, p1, p2, p3) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_BETTING
-- @usage void NETWORK_SPENT_BETTING(Any p0, Any p1, Any* p2, BOOL p3, BOOL p4);
-- @param p0 Any
-- @param p1 Any
-- @param p2 Any*
-- @param p3 BOOL
-- @param p4 BOOL
-- @return void
function NetworkSpentBetting(p0, p1, p2, p3, p4) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_IN_STRIPCLUB
-- @usage void NETWORK_SPENT_IN_STRIPCLUB(Any p0, BOOL p1, Any p2, BOOL p3);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 Any
-- @param p3 BOOL
-- @return void
function NetworkSpentInStripclub(p0, p1, p2, p3) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_BUY_HEALTHCARE
-- @usage void NETWORK_BUY_HEALTHCARE(int cost, BOOL p1, BOOL p2);
-- @param cost int
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkBuyHealthcare(cost, p1, p2) end
-- p1 = 0 (always) p2 = 1 (always)
-- @module native
-- @submodule networkcash
-- @see NETWORK_BUY_AIRSTRIKE
-- @usage void NETWORK_BUY_AIRSTRIKE(int cost, BOOL p1, BOOL p2);
-- @param cost int
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkBuyAirstrike(cost, p1, p2) end
-- p1 = 0 (always) p2 = 1 (always)
-- @module native
-- @submodule networkcash
-- @see NETWORK_BUY_HELI_STRIKE
-- @usage void NETWORK_BUY_HELI_STRIKE(int cost, BOOL p1, BOOL p2);
-- @param cost int
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkBuyHeliStrike(cost, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_AMMO_DROP
-- @usage void NETWORK_SPENT_AMMO_DROP(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentAmmoDrop(p0, p1, p2) end
-- p1 is just an assumption. p2 was false and p3 was true.
-- @module native
-- @submodule networkcash
-- @see NETWORK_BUY_BOUNTY
-- @usage void NETWORK_BUY_BOUNTY(int amount, Player victim, BOOL p2, BOOL p3);
-- @param amount int
-- @param victim Player
-- @param p2 BOOL
-- @param p3 BOOL
-- @return void
function NetworkBuyBounty(amount, victim, p2, p3) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_BUY_PROPERTY
-- @usage void NETWORK_BUY_PROPERTY(float propertyCost, Hash propertyName, BOOL p2, BOOL p3);
-- @param propertyCost float
-- @param propertyName Hash
-- @param p2 BOOL
-- @param p3 BOOL
-- @return void
function NetworkBuyProperty(propertyCost, propertyName, p2, p3) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_HELI_PICKUP
-- @usage void NETWORK_SPENT_HELI_PICKUP(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentHeliPickup(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_BOAT_PICKUP
-- @usage void NETWORK_SPENT_BOAT_PICKUP(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentBoatPickup(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_BULL_SHARK
-- @usage void NETWORK_SPENT_BULL_SHARK(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentBullShark(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_CASH_DROP
-- @usage void NETWORK_SPENT_CASH_DROP(int amount, BOOL p1, BOOL p2);
-- @param amount int
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentCashDrop(amount, p1, p2) end
-- Only used once in a script (am_contact_requests) p1 = 0 p2 = 1
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_HIRE_MUGGER
-- @usage void NETWORK_SPENT_HIRE_MUGGER(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentHireMugger(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_ROBBED_BY_MUGGER
-- @usage void NETWORK_SPENT_ROBBED_BY_MUGGER(int amount, BOOL p1, BOOL p2);
-- @param amount int
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentRobbedByMugger(amount, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_HIRE_MERCENARY
-- @usage void NETWORK_SPENT_HIRE_MERCENARY(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentHireMercenary(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_BUY_WANTEDLEVEL
-- @usage void NETWORK_SPENT_BUY_WANTEDLEVEL(Any p0, Any* p1, BOOL p2, BOOL p3);
-- @param p0 Any
-- @param p1 Any*
-- @param p2 BOOL
-- @param p3 BOOL
-- @return void
function NetworkSpentBuyWantedlevel(p0, p1, p2, p3) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_BUY_OFFTHERADAR
-- @usage void NETWORK_SPENT_BUY_OFFTHERADAR(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentBuyOfftheradar(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_BUY_REVEAL_PLAYERS
-- @usage void NETWORK_SPENT_BUY_REVEAL_PLAYERS(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentBuyRevealPlayers(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_CARWASH
-- @usage void NETWORK_SPENT_CARWASH(Any p0, Any p1, Any p2, BOOL p3, BOOL p4);
-- @param p0 Any
-- @param p1 Any
-- @param p2 Any
-- @param p3 BOOL
-- @param p4 BOOL
-- @return void
function NetworkSpentCarwash(p0, p1, p2, p3, p4) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_CINEMA
-- @usage void NETWORK_SPENT_CINEMA(Any p0, Any p1, BOOL p2, BOOL p3);
-- @param p0 Any
-- @param p1 Any
-- @param p2 BOOL
-- @param p3 BOOL
-- @return void
function NetworkSpentCinema(p0, p1, p2, p3) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_TELESCOPE
-- @usage void NETWORK_SPENT_TELESCOPE(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentTelescope(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_HOLDUPS
-- @usage void NETWORK_SPENT_HOLDUPS(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentHoldups(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_BUY_PASSIVE_MODE
-- @usage void NETWORK_SPENT_BUY_PASSIVE_MODE(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentBuyPassiveMode(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_PROSTITUTES
-- @usage void NETWORK_SPENT_PROSTITUTES(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentProstitutes(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_ARREST_BAIL
-- @usage void NETWORK_SPENT_ARREST_BAIL(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentArrestBail(p0, p1, p2) end
-- According to how I understood this in the freemode script alone, The first parameter is determined by a function named, func_5749 within the freemode script which has a list of all the vehicles and a set price to return which some vehicles deals with globals as well. So the first parameter is basically the set in stone insurance cost it's gonna charge you for that specific vehicle model. The second parameter whoever put it was right, they call GET_ENTITY_MODEL with the vehicle as the paremeter. The third parameter is the network handle as they call their little struct<13> func or atleast how the script decompiled it to look which in lamens terms just returns the network handle of the previous owner based on DECOR_GET_INT(vehicle, "Previous_Owner"). The fourth parameter is a bool that returns true/false depending on if your bank balance is greater then 0. The fifth and last parameter is a bool that returns true/false depending on if you have the money for the car based on the cost returned by func_5749. In the freemode script eg, bool hasTheMoney = NETWORKCASH::_GET_BANK_BALANCE() < carCost.
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_PAY_VEHICLE_INSURANCE_PREMIUM
-- @usage void NETWORK_SPENT_PAY_VEHICLE_INSURANCE_PREMIUM(int amount, Hash vehicleModel, int* networkHandle, BOOL notBankrupt, BOOL hasTheMoney);
-- @param amount int
-- @param vehicleModel Hash
-- @param networkHandle int*
-- @param notBankrupt BOOL
-- @param hasTheMoney BOOL
-- @return void
function NetworkSpentPayVehicleInsurancePremium(amount, vehicleModel, networkHandle, notBankrupt, hasTheMoney) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_CALL_PLAYER
-- @usage void NETWORK_SPENT_CALL_PLAYER(Any p0, Any* p1, BOOL p2, BOOL p3);
-- @param p0 Any
-- @param p1 Any*
-- @param p2 BOOL
-- @param p3 BOOL
-- @return void
function NetworkSpentCallPlayer(p0, p1, p2, p3) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_BOUNTY
-- @usage void NETWORK_SPENT_BOUNTY(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentBounty(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_FROM_ROCKSTAR
-- @usage void NETWORK_SPENT_FROM_ROCKSTAR(int bank, BOOL p1, BOOL p2);
-- @param bank int
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentFromRockstar(bank, p1, p2) end
-- This isn't a hash collision. It is used to give the player cash via the CASH_GIFT stats.
-- @module native
-- @submodule networkcash
-- @see PROCESS_CASH_GIFT
-- @usage char* PROCESS_CASH_GIFT(int* p0, int* p1, char* p2);
-- @param p0 int*
-- @param p1 int*
-- @param p2 char*
-- @return char*
function ProcessCashGift(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_PLAYER_HEALTHCARE
-- @usage void NETWORK_SPENT_PLAYER_HEALTHCARE(Any p0, Any p1, BOOL p2, BOOL p3);
-- @param p0 Any
-- @param p1 Any
-- @param p2 BOOL
-- @param p3 BOOL
-- @return void
function NetworkSpentPlayerHealthcare(p0, p1, p2, p3) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_NO_COPS
-- @usage void NETWORK_SPENT_NO_COPS(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentNoCops(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_SPENT_REQUEST_JOB
-- @usage void NETWORK_SPENT_REQUEST_JOB(Any p0, BOOL p1, BOOL p2);
-- @param p0 Any
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function NetworkSpentRequestJob(p0, p1, p2) end
-- The first parameter is the amount spent which is store in a global when this native is called. The global returns 10. Which is the price for both rides. The last 3 parameters are, 2,0,1 in the am_ferriswheel.c 1,0,1 in the am_rollercoaster.c
-- @module native
-- @submodule networkcash
-- @see NETWORK_BUY_FAIRGROUND_RIDE
-- @usage void NETWORK_BUY_FAIRGROUND_RIDE(int amountSpent, Any p1, BOOL p2, BOOL p3);
-- @param amountSpent int
-- @param p1 Any
-- @param p2 BOOL
-- @param p3 BOOL
-- @return void
function NetworkBuyFairgroundRide(amountSpent, p1, p2, p3) end
-- From what I can see in ida, I believe it retrieves the players online bank balance.
-- @module native
-- @submodule networkcash
-- @see NETWORK_GET_VC_BANK_BALANCE
-- @usage int NETWORK_GET_VC_BANK_BALANCE();
-- @return int
function NetworkGetVcBankBalance() end
-- From what I understand, it retrieves STAT_WALLET_BALANCE for the specified character (-1 means use MPPLY_LAST_MP_CHAR)
-- @module native
-- @submodule networkcash
-- @see NETWORK_GET_VC_WALLET_BALANCE
-- @usage int NETWORK_GET_VC_WALLET_BALANCE(int character);
-- @param character int
-- @return int
function NetworkGetVcWalletBalance(character) end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_GET_VC_BALANCE
-- @usage int NETWORK_GET_VC_BALANCE();
-- @return int
function NetworkGetVcBalance() end
-- @todo
-- @module native
-- @submodule networkcash
-- @see NETWORK_CAN_RECEIVE_PLAYER_CASH
-- @usage BOOL NETWORK_CAN_RECEIVE_PLAYER_CASH(Any p0, Any p1, Any p2, Any p3);
-- @param p0 Any
-- @param p1 Any
-- @param p2 Any
-- @param p3 Any
-- @return BOOL
function NetworkCanReceivePlayerCash(p0, p1, p2, p3) end
|
------------------------------------------------------------------------------
-- DynASM PPC module.
--
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
-- Module information:
local _info = {
arch = "ppc",
description = "DynASM PPC module",
version = "1.3.0",
vernum = 10300,
release = "2011-05-05",
author = "Mike Pall",
license = "MIT",
}
-- Exported glue functions for the arch-specific module.
local _M = { _info = _info }
-- Cache library functions.
local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
local assert, setmetatable = assert, setmetatable
local _s = string
local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
local match, gmatch = _s.match, _s.gmatch
local concat, sort = table.concat, table.sort
local bit = bit or require("bit")
local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
local tohex = bit.tohex
-- Inherited tables and callbacks.
local g_opt, g_arch
local wline, werror, wfatal, wwarn
-- Action name list.
-- CHECK: Keep this in sync with the C code!
local action_names = {
"STOP", "SECTION", "ESC", "REL_EXT",
"ALIGN", "REL_LG", "LABEL_LG",
"REL_PC", "LABEL_PC", "IMM",
}
-- Maximum number of section buffer positions for dasm_put().
-- CHECK: Keep this in sync with the C code!
local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
-- Action name -> action number.
local map_action = {}
for n,name in ipairs(action_names) do
map_action[name] = n-1
end
-- Action list buffer.
local actlist = {}
-- Argument list for next dasm_put(). Start with offset 0 into action list.
local actargs = { 0 }
-- Current number of section buffer positions for dasm_put().
local secpos = 1
------------------------------------------------------------------------------
-- Dump action names and numbers.
local function dumpactions(out)
out:write("DynASM encoding engine action codes:\n")
for n,name in ipairs(action_names) do
local num = map_action[name]
out:write(format(" %-10s %02X %d\n", name, num, num))
end
out:write("\n")
end
-- Write action list buffer as a huge static C array.
local function writeactions(out, name)
local nn = #actlist
if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
out:write("static const unsigned int ", name, "[", nn, "] = {\n")
for i = 1,nn-1 do
assert(out:write("0x", tohex(actlist[i]), ",\n"))
end
assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
end
------------------------------------------------------------------------------
-- Add word to action list.
local function wputxw(n)
assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
actlist[#actlist+1] = n
end
-- Add action to list with optional arg. Advance buffer pos, too.
local function waction(action, val, a, num)
local w = assert(map_action[action], "bad action name `"..action.."'")
wputxw(w * 0x10000 + (val or 0))
if a then actargs[#actargs+1] = a end
if a or num then secpos = secpos + (num or 1) end
end
-- Flush action list (intervening C code or buffer pos overflow).
local function wflush(term)
if #actlist == actargs[1] then return end -- Nothing to flush.
if not term then waction("STOP") end -- Terminate action list.
wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
secpos = 1 -- The actionlist offset occupies a buffer position, too.
end
-- Put escaped word.
local function wputw(n)
if n <= 0xffffff then waction("ESC") end
wputxw(n)
end
-- Reserve position for word.
local function wpos()
local pos = #actlist+1
actlist[pos] = ""
return pos
end
-- Store word to reserved position.
local function wputpos(pos, n)
assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
actlist[pos] = n
end
------------------------------------------------------------------------------
-- Global label name -> global label number. With auto assignment on 1st use.
local next_global = 20
local map_global = setmetatable({}, { __index = function(t, name)
if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
local n = next_global
if n > 2047 then werror("too many global labels") end
next_global = n + 1
t[name] = n
return n
end})
-- Dump global labels.
local function dumpglobals(out, lvl)
local t = {}
for name, n in pairs(map_global) do t[n] = name end
out:write("Global labels:\n")
for i=20,next_global-1 do
out:write(format(" %s\n", t[i]))
end
out:write("\n")
end
-- Write global label enum.
local function writeglobals(out, prefix)
local t = {}
for name, n in pairs(map_global) do t[n] = name end
out:write("enum {\n")
for i=20,next_global-1 do
out:write(" ", prefix, t[i], ",\n")
end
out:write(" ", prefix, "_MAX\n};\n")
end
-- Write global label names.
local function writeglobalnames(out, name)
local t = {}
for name, n in pairs(map_global) do t[n] = name end
out:write("static const char *const ", name, "[] = {\n")
for i=20,next_global-1 do
out:write(" \"", t[i], "\",\n")
end
out:write(" (const char *)0\n};\n")
end
------------------------------------------------------------------------------
-- Extern label name -> extern label number. With auto assignment on 1st use.
local next_extern = 0
local map_extern_ = {}
local map_extern = setmetatable({}, { __index = function(t, name)
-- No restrictions on the name for now.
local n = next_extern
if n > 2047 then werror("too many extern labels") end
next_extern = n + 1
t[name] = n
map_extern_[n] = name
return n
end})
-- Dump extern labels.
local function dumpexterns(out, lvl)
out:write("Extern labels:\n")
for i=0,next_extern-1 do
out:write(format(" %s\n", map_extern_[i]))
end
out:write("\n")
end
-- Write extern label names.
local function writeexternnames(out, name)
out:write("static const char *const ", name, "[] = {\n")
for i=0,next_extern-1 do
out:write(" \"", map_extern_[i], "\",\n")
end
out:write(" (const char *)0\n};\n")
end
------------------------------------------------------------------------------
-- Arch-specific maps.
local map_archdef = { sp = "r1" } -- Ext. register name -> int. name.
local map_type = {} -- Type name -> { ctype, reg }
local ctypenum = 0 -- Type number (for Dt... macros).
-- Reverse defines for registers.
function _M.revdef(s)
if s == "r1" then return "sp" end
return s
end
local map_cond = {
lt = 0, gt = 1, eq = 2, so = 3,
ge = 4, le = 5, ne = 6, ns = 7,
}
------------------------------------------------------------------------------
-- Template strings for PPC instructions.
local map_op = {
tdi_3 = "08000000ARI",
twi_3 = "0c000000ARI",
mulli_3 = "1c000000RRI",
subfic_3 = "20000000RRI",
cmplwi_3 = "28000000XRU",
cmplwi_2 = "28000000-RU",
cmpldi_3 = "28200000XRU",
cmpldi_2 = "28200000-RU",
cmpwi_3 = "2c000000XRI",
cmpwi_2 = "2c000000-RI",
cmpdi_3 = "2c200000XRI",
cmpdi_2 = "2c200000-RI",
addic_3 = "30000000RRI",
["addic._3"] = "34000000RRI",
addi_3 = "38000000RR0I",
li_2 = "38000000RI",
la_2 = "38000000RD",
addis_3 = "3c000000RR0I",
lis_2 = "3c000000RI",
lus_2 = "3c000000RU",
bc_3 = "40000000AAK",
bcl_3 = "40000001AAK",
bdnz_1 = "42000000K",
bdz_1 = "42400000K",
sc_0 = "44000000",
b_1 = "48000000J",
bl_1 = "48000001J",
rlwimi_5 = "50000000RR~AAA.",
rlwinm_5 = "54000000RR~AAA.",
rlwnm_5 = "5c000000RR~RAA.",
ori_3 = "60000000RR~U",
nop_0 = "60000000",
oris_3 = "64000000RR~U",
xori_3 = "68000000RR~U",
xoris_3 = "6c000000RR~U",
["andi._3"] = "70000000RR~U",
["andis._3"] = "74000000RR~U",
lwz_2 = "80000000RD",
lwzu_2 = "84000000RD",
lbz_2 = "88000000RD",
lbzu_2 = "8c000000RD",
stw_2 = "90000000RD",
stwu_2 = "94000000RD",
stb_2 = "98000000RD",
stbu_2 = "9c000000RD",
lhz_2 = "a0000000RD",
lhzu_2 = "a4000000RD",
lha_2 = "a8000000RD",
lhau_2 = "ac000000RD",
sth_2 = "b0000000RD",
sthu_2 = "b4000000RD",
lmw_2 = "b8000000RD",
stmw_2 = "bc000000RD",
lfs_2 = "c0000000FD",
lfsu_2 = "c4000000FD",
lfd_2 = "c8000000FD",
lfdu_2 = "cc000000FD",
stfs_2 = "d0000000FD",
stfsu_2 = "d4000000FD",
stfd_2 = "d8000000FD",
stfdu_2 = "dc000000FD",
ld_2 = "e8000000RD", -- NYI: displacement must be divisible by 4.
ldu_2 = "e8000001RD",
lwa_2 = "e8000002RD",
std_2 = "f8000000RD",
stdu_2 = "f8000001RD",
-- Primary opcode 19:
mcrf_2 = "4c000000XX",
isync_0 = "4c00012c",
crnor_3 = "4c000042CCC",
crnot_2 = "4c000042CC=",
crandc_3 = "4c000102CCC",
crxor_3 = "4c000182CCC",
crclr_1 = "4c000182C==",
crnand_3 = "4c0001c2CCC",
crand_3 = "4c000202CCC",
creqv_3 = "4c000242CCC",
crset_1 = "4c000242C==",
crorc_3 = "4c000342CCC",
cror_3 = "4c000382CCC",
crmove_2 = "4c000382CC=",
bclr_2 = "4c000020AA",
bclrl_2 = "4c000021AA",
bcctr_2 = "4c000420AA",
bcctrl_2 = "4c000421AA",
blr_0 = "4e800020",
blrl_0 = "4e800021",
bctr_0 = "4e800420",
bctrl_0 = "4e800421",
-- Primary opcode 31:
cmpw_3 = "7c000000XRR",
cmpw_2 = "7c000000-RR",
cmpd_3 = "7c200000XRR",
cmpd_2 = "7c200000-RR",
tw_3 = "7c000008ARR",
subfc_3 = "7c000010RRR.",
subc_3 = "7c000010RRR~.",
mulhdu_3 = "7c000012RRR.",
addc_3 = "7c000014RRR.",
mulhwu_3 = "7c000016RRR.",
isel_4 = "7c00001eRRRC",
isellt_3 = "7c00001eRRR",
iselgt_3 = "7c00005eRRR",
iseleq_3 = "7c00009eRRR",
mfcr_1 = "7c000026R",
mfocrf_2 = "7c100026RG",
mtcrf_2 = "7c000120GR",
mtocrf_2 = "7c100120GR",
lwarx_3 = "7c000028RR0R",
ldx_3 = "7c00002aRR0R",
lwzx_3 = "7c00002eRR0R",
slw_3 = "7c000030RR~R.",
cntlzw_2 = "7c000034RR~",
sld_3 = "7c000036RR~R.",
and_3 = "7c000038RR~R.",
cmplw_3 = "7c000040XRR",
cmplw_2 = "7c000040-RR",
cmpld_3 = "7c200040XRR",
cmpld_2 = "7c200040-RR",
subf_3 = "7c000050RRR.",
sub_3 = "7c000050RRR~.",
ldux_3 = "7c00006aRR0R",
dcbst_2 = "7c00006c-RR",
lwzux_3 = "7c00006eRR0R",
cntlzd_2 = "7c000074RR~",
andc_3 = "7c000078RR~R.",
td_3 = "7c000088ARR",
mulhd_3 = "7c000092RRR.",
mulhw_3 = "7c000096RRR.",
ldarx_3 = "7c0000a8RR0R",
dcbf_2 = "7c0000ac-RR",
lbzx_3 = "7c0000aeRR0R",
neg_2 = "7c0000d0RR.",
lbzux_3 = "7c0000eeRR0R",
popcntb_2 = "7c0000f4RR~",
not_2 = "7c0000f8RR~%.",
nor_3 = "7c0000f8RR~R.",
subfe_3 = "7c000110RRR.",
sube_3 = "7c000110RRR~.",
adde_3 = "7c000114RRR.",
stdx_3 = "7c00012aRR0R",
stwcx_3 = "7c00012cRR0R.",
stwx_3 = "7c00012eRR0R",
prtyw_2 = "7c000134RR~",
stdux_3 = "7c00016aRR0R",
stwux_3 = "7c00016eRR0R",
prtyd_2 = "7c000174RR~",
subfze_2 = "7c000190RR.",
addze_2 = "7c000194RR.",
stdcx_3 = "7c0001acRR0R.",
stbx_3 = "7c0001aeRR0R",
subfme_2 = "7c0001d0RR.",
mulld_3 = "7c0001d2RRR.",
addme_2 = "7c0001d4RR.",
mullw_3 = "7c0001d6RRR.",
dcbtst_2 = "7c0001ec-RR",
stbux_3 = "7c0001eeRR0R",
add_3 = "7c000214RRR.",
dcbt_2 = "7c00022c-RR",
lhzx_3 = "7c00022eRR0R",
eqv_3 = "7c000238RR~R.",
eciwx_3 = "7c00026cRR0R",
lhzux_3 = "7c00026eRR0R",
xor_3 = "7c000278RR~R.",
mfspefscr_1 = "7c0082a6R",
mfxer_1 = "7c0102a6R",
mflr_1 = "7c0802a6R",
mfctr_1 = "7c0902a6R",
lwax_3 = "7c0002aaRR0R",
lhax_3 = "7c0002aeRR0R",
mftb_1 = "7c0c42e6R",
mftbu_1 = "7c0d42e6R",
lwaux_3 = "7c0002eaRR0R",
lhaux_3 = "7c0002eeRR0R",
sthx_3 = "7c00032eRR0R",
orc_3 = "7c000338RR~R.",
ecowx_3 = "7c00036cRR0R",
sthux_3 = "7c00036eRR0R",
or_3 = "7c000378RR~R.",
mr_2 = "7c000378RR~%.",
divdu_3 = "7c000392RRR.",
divwu_3 = "7c000396RRR.",
mtspefscr_1 = "7c0083a6R",
mtxer_1 = "7c0103a6R",
mtlr_1 = "7c0803a6R",
mtctr_1 = "7c0903a6R",
dcbi_2 = "7c0003ac-RR",
nand_3 = "7c0003b8RR~R.",
divd_3 = "7c0003d2RRR.",
divw_3 = "7c0003d6RRR.",
cmpb_3 = "7c0003f8RR~R.",
mcrxr_1 = "7c000400X",
subfco_3 = "7c000410RRR.",
subco_3 = "7c000410RRR~.",
addco_3 = "7c000414RRR.",
ldbrx_3 = "7c000428RR0R",
lswx_3 = "7c00042aRR0R",
lwbrx_3 = "7c00042cRR0R",
lfsx_3 = "7c00042eFR0R",
srw_3 = "7c000430RR~R.",
srd_3 = "7c000436RR~R.",
subfo_3 = "7c000450RRR.",
subo_3 = "7c000450RRR~.",
lfsux_3 = "7c00046eFR0R",
lswi_3 = "7c0004aaRR0A",
sync_0 = "7c0004ac",
lwsync_0 = "7c2004ac",
ptesync_0 = "7c4004ac",
lfdx_3 = "7c0004aeFR0R",
nego_2 = "7c0004d0RR.",
lfdux_3 = "7c0004eeFR0R",
subfeo_3 = "7c000510RRR.",
subeo_3 = "7c000510RRR~.",
addeo_3 = "7c000514RRR.",
stdbrx_3 = "7c000528RR0R",
stswx_3 = "7c00052aRR0R",
stwbrx_3 = "7c00052cRR0R",
stfsx_3 = "7c00052eFR0R",
stfsux_3 = "7c00056eFR0R",
subfzeo_2 = "7c000590RR.",
addzeo_2 = "7c000594RR.",
stswi_3 = "7c0005aaRR0A",
stfdx_3 = "7c0005aeFR0R",
subfmeo_2 = "7c0005d0RR.",
mulldo_3 = "7c0005d2RRR.",
addmeo_2 = "7c0005d4RR.",
mullwo_3 = "7c0005d6RRR.",
dcba_2 = "7c0005ec-RR",
stfdux_3 = "7c0005eeFR0R",
addo_3 = "7c000614RRR.",
lhbrx_3 = "7c00062cRR0R",
sraw_3 = "7c000630RR~R.",
srad_3 = "7c000634RR~R.",
srawi_3 = "7c000670RR~A.",
sradi_3 = "7c000674RR~H.",
eieio_0 = "7c0006ac",
lfiwax_3 = "7c0006aeFR0R",
sthbrx_3 = "7c00072cRR0R",
extsh_2 = "7c000734RR~.",
extsb_2 = "7c000774RR~.",
divduo_3 = "7c000792RRR.",
divwou_3 = "7c000796RRR.",
icbi_2 = "7c0007ac-RR",
stfiwx_3 = "7c0007aeFR0R",
extsw_2 = "7c0007b4RR~.",
divdo_3 = "7c0007d2RRR.",
divwo_3 = "7c0007d6RRR.",
dcbz_2 = "7c0007ec-RR",
-- Primary opcode 30:
rldicl_4 = "78000000RR~HM.",
rldicr_4 = "78000004RR~HM.",
rldic_4 = "78000008RR~HM.",
rldimi_4 = "7800000cRR~HM.",
rldcl_4 = "78000010RR~RM.",
rldcr_4 = "78000012RR~RM.",
-- Primary opcode 59:
fdivs_3 = "ec000024FFF.",
fsubs_3 = "ec000028FFF.",
fadds_3 = "ec00002aFFF.",
fsqrts_2 = "ec00002cF-F.",
fres_2 = "ec000030F-F.",
fmuls_3 = "ec000032FF-F.",
frsqrtes_2 = "ec000034F-F.",
fmsubs_4 = "ec000038FFFF~.",
fmadds_4 = "ec00003aFFFF~.",
fnmsubs_4 = "ec00003cFFFF~.",
fnmadds_4 = "ec00003eFFFF~.",
-- Primary opcode 63:
fdiv_3 = "fc000024FFF.",
fsub_3 = "fc000028FFF.",
fadd_3 = "fc00002aFFF.",
fsqrt_2 = "fc00002cF-F.",
fsel_4 = "fc00002eFFFF~.",
fre_2 = "fc000030F-F.",
fmul_3 = "fc000032FF-F.",
frsqrte_2 = "fc000034F-F.",
fmsub_4 = "fc000038FFFF~.",
fmadd_4 = "fc00003aFFFF~.",
fnmsub_4 = "fc00003cFFFF~.",
fnmadd_4 = "fc00003eFFFF~.",
fcmpu_3 = "fc000000XFF",
fcpsgn_3 = "fc000010FFF.",
fcmpo_3 = "fc000040XFF",
mtfsb1_1 = "fc00004cA",
fneg_2 = "fc000050F-F.",
mcrfs_2 = "fc000080XX",
mtfsb0_1 = "fc00008cA",
fmr_2 = "fc000090F-F.",
frsp_2 = "fc000018F-F.",
fctiw_2 = "fc00001cF-F.",
fctiwz_2 = "fc00001eF-F.",
mtfsfi_2 = "fc00010cAA", -- NYI: upshift.
fnabs_2 = "fc000110F-F.",
fabs_2 = "fc000210F-F.",
frin_2 = "fc000310F-F.",
friz_2 = "fc000350F-F.",
frip_2 = "fc000390F-F.",
frim_2 = "fc0003d0F-F.",
mffs_1 = "fc00048eF.",
-- NYI: mtfsf, mtfsb0, mtfsb1.
fctid_2 = "fc00065cF-F.",
fctidz_2 = "fc00065eF-F.",
fcfid_2 = "fc00069cF-F.",
-- Primary opcode 4, SPE APU extension:
evaddw_3 = "10000200RRR",
evaddiw_3 = "10000202RAR~",
evsubw_3 = "10000204RRR~",
evsubiw_3 = "10000206RAR~",
evabs_2 = "10000208RR",
evneg_2 = "10000209RR",
evextsb_2 = "1000020aRR",
evextsh_2 = "1000020bRR",
evrndw_2 = "1000020cRR",
evcntlzw_2 = "1000020dRR",
evcntlsw_2 = "1000020eRR",
brinc_3 = "1000020fRRR",
evand_3 = "10000211RRR",
evandc_3 = "10000212RRR",
evxor_3 = "10000216RRR",
evor_3 = "10000217RRR",
evmr_2 = "10000217RR=",
evnor_3 = "10000218RRR",
evnot_2 = "10000218RR=",
eveqv_3 = "10000219RRR",
evorc_3 = "1000021bRRR",
evnand_3 = "1000021eRRR",
evsrwu_3 = "10000220RRR",
evsrws_3 = "10000221RRR",
evsrwiu_3 = "10000222RRA",
evsrwis_3 = "10000223RRA",
evslw_3 = "10000224RRR",
evslwi_3 = "10000226RRA",
evrlw_3 = "10000228RRR",
evsplati_2 = "10000229RS",
evrlwi_3 = "1000022aRRA",
evsplatfi_2 = "1000022bRS",
evmergehi_3 = "1000022cRRR",
evmergelo_3 = "1000022dRRR",
evcmpgtu_3 = "10000230XRR",
evcmpgtu_2 = "10000230-RR",
evcmpgts_3 = "10000231XRR",
evcmpgts_2 = "10000231-RR",
evcmpltu_3 = "10000232XRR",
evcmpltu_2 = "10000232-RR",
evcmplts_3 = "10000233XRR",
evcmplts_2 = "10000233-RR",
evcmpeq_3 = "10000234XRR",
evcmpeq_2 = "10000234-RR",
evsel_4 = "10000278RRRW",
evsel_3 = "10000278RRR",
evfsadd_3 = "10000280RRR",
evfssub_3 = "10000281RRR",
evfsabs_2 = "10000284RR",
evfsnabs_2 = "10000285RR",
evfsneg_2 = "10000286RR",
evfsmul_3 = "10000288RRR",
evfsdiv_3 = "10000289RRR",
evfscmpgt_3 = "1000028cXRR",
evfscmpgt_2 = "1000028c-RR",
evfscmplt_3 = "1000028dXRR",
evfscmplt_2 = "1000028d-RR",
evfscmpeq_3 = "1000028eXRR",
evfscmpeq_2 = "1000028e-RR",
evfscfui_2 = "10000290R-R",
evfscfsi_2 = "10000291R-R",
evfscfuf_2 = "10000292R-R",
evfscfsf_2 = "10000293R-R",
evfsctui_2 = "10000294R-R",
evfsctsi_2 = "10000295R-R",
evfsctuf_2 = "10000296R-R",
evfsctsf_2 = "10000297R-R",
evfsctuiz_2 = "10000298R-R",
evfsctsiz_2 = "1000029aR-R",
evfststgt_3 = "1000029cXRR",
evfststgt_2 = "1000029c-RR",
evfststlt_3 = "1000029dXRR",
evfststlt_2 = "1000029d-RR",
evfststeq_3 = "1000029eXRR",
evfststeq_2 = "1000029e-RR",
efsadd_3 = "100002c0RRR",
efssub_3 = "100002c1RRR",
efsabs_2 = "100002c4RR",
efsnabs_2 = "100002c5RR",
efsneg_2 = "100002c6RR",
efsmul_3 = "100002c8RRR",
efsdiv_3 = "100002c9RRR",
efscmpgt_3 = "100002ccXRR",
efscmpgt_2 = "100002cc-RR",
efscmplt_3 = "100002cdXRR",
efscmplt_2 = "100002cd-RR",
efscmpeq_3 = "100002ceXRR",
efscmpeq_2 = "100002ce-RR",
efscfd_2 = "100002cfR-R",
efscfui_2 = "100002d0R-R",
efscfsi_2 = "100002d1R-R",
efscfuf_2 = "100002d2R-R",
efscfsf_2 = "100002d3R-R",
efsctui_2 = "100002d4R-R",
efsctsi_2 = "100002d5R-R",
efsctuf_2 = "100002d6R-R",
efsctsf_2 = "100002d7R-R",
efsctuiz_2 = "100002d8R-R",
efsctsiz_2 = "100002daR-R",
efststgt_3 = "100002dcXRR",
efststgt_2 = "100002dc-RR",
efststlt_3 = "100002ddXRR",
efststlt_2 = "100002dd-RR",
efststeq_3 = "100002deXRR",
efststeq_2 = "100002de-RR",
efdadd_3 = "100002e0RRR",
efdsub_3 = "100002e1RRR",
efdcfuid_2 = "100002e2R-R",
efdcfsid_2 = "100002e3R-R",
efdabs_2 = "100002e4RR",
efdnabs_2 = "100002e5RR",
efdneg_2 = "100002e6RR",
efdmul_3 = "100002e8RRR",
efddiv_3 = "100002e9RRR",
efdctuidz_2 = "100002eaR-R",
efdctsidz_2 = "100002ebR-R",
efdcmpgt_3 = "100002ecXRR",
efdcmpgt_2 = "100002ec-RR",
efdcmplt_3 = "100002edXRR",
efdcmplt_2 = "100002ed-RR",
efdcmpeq_3 = "100002eeXRR",
efdcmpeq_2 = "100002ee-RR",
efdcfs_2 = "100002efR-R",
efdcfui_2 = "100002f0R-R",
efdcfsi_2 = "100002f1R-R",
efdcfuf_2 = "100002f2R-R",
efdcfsf_2 = "100002f3R-R",
efdctui_2 = "100002f4R-R",
efdctsi_2 = "100002f5R-R",
efdctuf_2 = "100002f6R-R",
efdctsf_2 = "100002f7R-R",
efdctuiz_2 = "100002f8R-R",
efdctsiz_2 = "100002faR-R",
efdtstgt_3 = "100002fcXRR",
efdtstgt_2 = "100002fc-RR",
efdtstlt_3 = "100002fdXRR",
efdtstlt_2 = "100002fd-RR",
efdtsteq_3 = "100002feXRR",
efdtsteq_2 = "100002fe-RR",
evlddx_3 = "10000300RR0R",
evldd_2 = "10000301R8",
evldwx_3 = "10000302RR0R",
evldw_2 = "10000303R8",
evldhx_3 = "10000304RR0R",
evldh_2 = "10000305R8",
evlwhex_3 = "10000310RR0R",
evlwhe_2 = "10000311R4",
evlwhoux_3 = "10000314RR0R",
evlwhou_2 = "10000315R4",
evlwhosx_3 = "10000316RR0R",
evlwhos_2 = "10000317R4",
evstddx_3 = "10000320RR0R",
evstdd_2 = "10000321R8",
evstdwx_3 = "10000322RR0R",
evstdw_2 = "10000323R8",
evstdhx_3 = "10000324RR0R",
evstdh_2 = "10000325R8",
evstwhex_3 = "10000330RR0R",
evstwhe_2 = "10000331R4",
evstwhox_3 = "10000334RR0R",
evstwho_2 = "10000335R4",
evstwwex_3 = "10000338RR0R",
evstwwe_2 = "10000339R4",
evstwwox_3 = "1000033cRR0R",
evstwwo_2 = "1000033dR4",
evmhessf_3 = "10000403RRR",
evmhossf_3 = "10000407RRR",
evmheumi_3 = "10000408RRR",
evmhesmi_3 = "10000409RRR",
evmhesmf_3 = "1000040bRRR",
evmhoumi_3 = "1000040cRRR",
evmhosmi_3 = "1000040dRRR",
evmhosmf_3 = "1000040fRRR",
evmhessfa_3 = "10000423RRR",
evmhossfa_3 = "10000427RRR",
evmheumia_3 = "10000428RRR",
evmhesmia_3 = "10000429RRR",
evmhesmfa_3 = "1000042bRRR",
evmhoumia_3 = "1000042cRRR",
evmhosmia_3 = "1000042dRRR",
evmhosmfa_3 = "1000042fRRR",
evmwhssf_3 = "10000447RRR",
evmwlumi_3 = "10000448RRR",
evmwhumi_3 = "1000044cRRR",
evmwhsmi_3 = "1000044dRRR",
evmwhsmf_3 = "1000044fRRR",
evmwssf_3 = "10000453RRR",
evmwumi_3 = "10000458RRR",
evmwsmi_3 = "10000459RRR",
evmwsmf_3 = "1000045bRRR",
evmwhssfa_3 = "10000467RRR",
evmwlumia_3 = "10000468RRR",
evmwhumia_3 = "1000046cRRR",
evmwhsmia_3 = "1000046dRRR",
evmwhsmfa_3 = "1000046fRRR",
evmwssfa_3 = "10000473RRR",
evmwumia_3 = "10000478RRR",
evmwsmia_3 = "10000479RRR",
evmwsmfa_3 = "1000047bRRR",
evmra_2 = "100004c4RR",
evdivws_3 = "100004c6RRR",
evdivwu_3 = "100004c7RRR",
evmwssfaa_3 = "10000553RRR",
evmwumiaa_3 = "10000558RRR",
evmwsmiaa_3 = "10000559RRR",
evmwsmfaa_3 = "1000055bRRR",
evmwssfan_3 = "100005d3RRR",
evmwumian_3 = "100005d8RRR",
evmwsmian_3 = "100005d9RRR",
evmwsmfan_3 = "100005dbRRR",
evmergehilo_3 = "1000022eRRR",
evmergelohi_3 = "1000022fRRR",
evlhhesplatx_3 = "10000308RR0R",
evlhhesplat_2 = "10000309R2",
evlhhousplatx_3 = "1000030cRR0R",
evlhhousplat_2 = "1000030dR2",
evlhhossplatx_3 = "1000030eRR0R",
evlhhossplat_2 = "1000030fR2",
evlwwsplatx_3 = "10000318RR0R",
evlwwsplat_2 = "10000319R4",
evlwhsplatx_3 = "1000031cRR0R",
evlwhsplat_2 = "1000031dR4",
evaddusiaaw_2 = "100004c0RR",
evaddssiaaw_2 = "100004c1RR",
evsubfusiaaw_2 = "100004c2RR",
evsubfssiaaw_2 = "100004c3RR",
evaddumiaaw_2 = "100004c8RR",
evaddsmiaaw_2 = "100004c9RR",
evsubfumiaaw_2 = "100004caRR",
evsubfsmiaaw_2 = "100004cbRR",
evmheusiaaw_3 = "10000500RRR",
evmhessiaaw_3 = "10000501RRR",
evmhessfaaw_3 = "10000503RRR",
evmhousiaaw_3 = "10000504RRR",
evmhossiaaw_3 = "10000505RRR",
evmhossfaaw_3 = "10000507RRR",
evmheumiaaw_3 = "10000508RRR",
evmhesmiaaw_3 = "10000509RRR",
evmhesmfaaw_3 = "1000050bRRR",
evmhoumiaaw_3 = "1000050cRRR",
evmhosmiaaw_3 = "1000050dRRR",
evmhosmfaaw_3 = "1000050fRRR",
evmhegumiaa_3 = "10000528RRR",
evmhegsmiaa_3 = "10000529RRR",
evmhegsmfaa_3 = "1000052bRRR",
evmhogumiaa_3 = "1000052cRRR",
evmhogsmiaa_3 = "1000052dRRR",
evmhogsmfaa_3 = "1000052fRRR",
evmwlusiaaw_3 = "10000540RRR",
evmwlssiaaw_3 = "10000541RRR",
evmwlumiaaw_3 = "10000548RRR",
evmwlsmiaaw_3 = "10000549RRR",
evmheusianw_3 = "10000580RRR",
evmhessianw_3 = "10000581RRR",
evmhessfanw_3 = "10000583RRR",
evmhousianw_3 = "10000584RRR",
evmhossianw_3 = "10000585RRR",
evmhossfanw_3 = "10000587RRR",
evmheumianw_3 = "10000588RRR",
evmhesmianw_3 = "10000589RRR",
evmhesmfanw_3 = "1000058bRRR",
evmhoumianw_3 = "1000058cRRR",
evmhosmianw_3 = "1000058dRRR",
evmhosmfanw_3 = "1000058fRRR",
evmhegumian_3 = "100005a8RRR",
evmhegsmian_3 = "100005a9RRR",
evmhegsmfan_3 = "100005abRRR",
evmhogumian_3 = "100005acRRR",
evmhogsmian_3 = "100005adRRR",
evmhogsmfan_3 = "100005afRRR",
evmwlusianw_3 = "100005c0RRR",
evmwlssianw_3 = "100005c1RRR",
evmwlumianw_3 = "100005c8RRR",
evmwlsmianw_3 = "100005c9RRR",
-- NYI: Book E instructions.
}
-- Add mnemonics for "." variants.
do
local t = {}
for k,v in pairs(map_op) do
if sub(v, -1) == "." then
local v2 = sub(v, 1, 7)..char(byte(v, 8)+1)..sub(v, 9, -2)
t[sub(k, 1, -3).."."..sub(k, -2)] = v2
end
end
for k,v in pairs(t) do
map_op[k] = v
end
end
-- Add more branch mnemonics.
for cond,c in pairs(map_cond) do
local b1 = "b"..cond
local c1 = shl(band(c, 3), 16) + (c < 4 and 0x01000000 or 0)
-- bX[l]
map_op[b1.."_1"] = tohex(0x40800000 + c1).."K"
map_op[b1.."y_1"] = tohex(0x40a00000 + c1).."K"
map_op[b1.."l_1"] = tohex(0x40800001 + c1).."K"
map_op[b1.."_2"] = tohex(0x40800000 + c1).."-XK"
map_op[b1.."y_2"] = tohex(0x40a00000 + c1).."-XK"
map_op[b1.."l_2"] = tohex(0x40800001 + c1).."-XK"
-- bXlr[l]
map_op[b1.."lr_0"] = tohex(0x4c800020 + c1)
map_op[b1.."lrl_0"] = tohex(0x4c800021 + c1)
map_op[b1.."ctr_0"] = tohex(0x4c800420 + c1)
map_op[b1.."ctrl_0"] = tohex(0x4c800421 + c1)
-- bXctr[l]
map_op[b1.."lr_1"] = tohex(0x4c800020 + c1).."-X"
map_op[b1.."lrl_1"] = tohex(0x4c800021 + c1).."-X"
map_op[b1.."ctr_1"] = tohex(0x4c800420 + c1).."-X"
map_op[b1.."ctrl_1"] = tohex(0x4c800421 + c1).."-X"
end
------------------------------------------------------------------------------
local function parse_gpr(expr)
local tname, ovreg = match(expr, "^([%w_]+):(r[1-3]?[0-9])$")
local tp = map_type[tname or expr]
if tp then
local reg = ovreg or tp.reg
if not reg then
werror("type `"..(tname or expr).."' needs a register override")
end
expr = reg
end
local r = match(expr, "^r([1-3]?[0-9])$")
if r then
r = tonumber(r)
if r <= 31 then return r, tp end
end
werror("bad register name `"..expr.."'")
end
local function parse_fpr(expr)
local r = match(expr, "^f([1-3]?[0-9])$")
if r then
r = tonumber(r)
if r <= 31 then return r end
end
werror("bad register name `"..expr.."'")
end
local function parse_cr(expr)
local r = match(expr, "^cr([0-7])$")
if r then return tonumber(r) end
werror("bad condition register name `"..expr.."'")
end
local function parse_cond(expr)
local r, cond = match(expr, "^4%*cr([0-7])%+(%w%w)$")
if r then
r = tonumber(r)
local c = map_cond[cond]
if c and c < 4 then return r*4+c end
end
werror("bad condition bit name `"..expr.."'")
end
local function parse_imm(imm, bits, shift, scale, signed)
local n = tonumber(imm)
if n then
local m = sar(n, scale)
if shl(m, scale) == n then
if signed then
local s = sar(m, bits-1)
if s == 0 then return shl(m, shift)
elseif s == -1 then return shl(m + shl(1, bits), shift) end
else
if sar(m, bits) == 0 then return shl(m, shift) end
end
end
werror("out of range immediate `"..imm.."'")
elseif match(imm, "^r([1-3]?[0-9])$") or
match(imm, "^([%w_]+):(r[1-3]?[0-9])$") then
werror("expected immediate operand, got register")
else
waction("IMM", (signed and 32768 or 0)+scale*1024+bits*32+shift, imm)
return 0
end
end
local function parse_shiftmask(imm, isshift)
local n = tonumber(imm)
if n then
if shr(n, 6) == 0 then
local lsb = band(imm, 31)
local msb = imm - lsb
return isshift and (shl(lsb, 11)+shr(msb, 4)) or (shl(lsb, 6)+msb)
end
werror("out of range immediate `"..imm.."'")
elseif match(imm, "^r([1-3]?[0-9])$") or
match(imm, "^([%w_]+):(r[1-3]?[0-9])$") then
werror("expected immediate operand, got register")
else
werror("NYI: parameterized 64 bit shift/mask")
end
end
local function parse_disp(disp)
local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$")
if imm then
local r = parse_gpr(reg)
if r == 0 then werror("cannot use r0 in displacement") end
return shl(r, 16) + parse_imm(imm, 16, 0, 0, true)
end
local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$")
if reg and tailr ~= "" then
local r, tp = parse_gpr(reg)
if r == 0 then werror("cannot use r0 in displacement") end
if tp then
waction("IMM", 32768+16*32, format(tp.ctypefmt, tailr))
return shl(r, 16)
end
end
werror("bad displacement `"..disp.."'")
end
local function parse_u5disp(disp, scale)
local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$")
if imm then
local r = parse_gpr(reg)
if r == 0 then werror("cannot use r0 in displacement") end
return shl(r, 16) + parse_imm(imm, 5, 11, scale, false)
end
local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$")
if reg and tailr ~= "" then
local r, tp = parse_gpr(reg)
if r == 0 then werror("cannot use r0 in displacement") end
if tp then
waction("IMM", scale*1024+5*32+11, format(tp.ctypefmt, tailr))
return shl(r, 16)
end
end
werror("bad displacement `"..disp.."'")
end
local function parse_label(label, def)
local prefix = sub(label, 1, 2)
-- =>label (pc label reference)
if prefix == "=>" then
return "PC", 0, sub(label, 3)
end
-- ->name (global label reference)
if prefix == "->" then
return "LG", map_global[sub(label, 3)]
end
if def then
-- [1-9] (local label definition)
if match(label, "^[1-9]$") then
return "LG", 10+tonumber(label)
end
else
-- [<>][1-9] (local label reference)
local dir, lnum = match(label, "^([<>])([1-9])$")
if dir then -- Fwd: 1-9, Bkwd: 11-19.
return "LG", lnum + (dir == ">" and 0 or 10)
end
-- extern label (extern label reference)
local extname = match(label, "^extern%s+(%S+)$")
if extname then
return "EXT", map_extern[extname]
end
end
werror("bad label `"..label.."'")
end
------------------------------------------------------------------------------
-- Handle opcodes defined with template strings.
map_op[".template__"] = function(params, template, nparams)
if not params then return sub(template, 9) end
local op = tonumber(sub(template, 1, 8), 16)
local n, rs = 1, 26
-- Limit number of section buffer positions used by a single dasm_put().
-- A single opcode needs a maximum of 3 positions (rlwinm).
if secpos+3 > maxsecpos then wflush() end
local pos = wpos()
-- Process each character.
for p in gmatch(sub(template, 9), ".") do
if p == "R" then
rs = rs - 5; op = op + shl(parse_gpr(params[n]), rs); n = n + 1
elseif p == "F" then
rs = rs - 5; op = op + shl(parse_fpr(params[n]), rs); n = n + 1
elseif p == "A" then
rs = rs - 5; op = op + parse_imm(params[n], 5, rs, 0, false); n = n + 1
elseif p == "S" then
rs = rs - 5; op = op + parse_imm(params[n], 5, rs, 0, true); n = n + 1
elseif p == "I" then
op = op + parse_imm(params[n], 16, 0, 0, true); n = n + 1
elseif p == "U" then
op = op + parse_imm(params[n], 16, 0, 0, false); n = n + 1
elseif p == "D" then
op = op + parse_disp(params[n]); n = n + 1
elseif p == "2" then
op = op + parse_u5disp(params[n], 1); n = n + 1
elseif p == "4" then
op = op + parse_u5disp(params[n], 2); n = n + 1
elseif p == "8" then
op = op + parse_u5disp(params[n], 3); n = n + 1
elseif p == "C" then
rs = rs - 5; op = op + shl(parse_cond(params[n]), rs); n = n + 1
elseif p == "X" then
rs = rs - 5; op = op + shl(parse_cr(params[n]), rs+2); n = n + 1
elseif p == "W" then
op = op + parse_cr(params[n]); n = n + 1
elseif p == "G" then
op = op + parse_imm(params[n], 8, 12, 0, false); n = n + 1
elseif p == "H" then
op = op + parse_shiftmask(params[n], true); n = n + 1
elseif p == "M" then
op = op + parse_shiftmask(params[n], false); n = n + 1
elseif p == "J" or p == "K" then
local mode, n, s = parse_label(params[n], false)
if p == "K" then n = n + 2048 end
waction("REL_"..mode, n, s, 1)
n = n + 1
elseif p == "0" then
if band(shr(op, rs), 31) == 0 then werror("cannot use r0") end
elseif p == "=" or p == "%" then
local t = band(shr(op, p == "%" and rs+5 or rs), 31)
rs = rs - 5
op = op + shl(t, rs)
elseif p == "~" then
local mm = shl(31, rs)
local lo = band(op, mm)
local hi = band(op, shl(mm, 5))
op = op - lo - hi + shl(lo, 5) + shr(hi, 5)
elseif p == "-" then
rs = rs - 5
elseif p == "." then
-- Ignored.
else
assert(false)
end
end
wputpos(pos, op)
end
------------------------------------------------------------------------------
-- Pseudo-opcode to mark the position where the action list is to be emitted.
map_op[".actionlist_1"] = function(params)
if not params then return "cvar" end
local name = params[1] -- No syntax check. You get to keep the pieces.
wline(function(out) writeactions(out, name) end)
end
-- Pseudo-opcode to mark the position where the global enum is to be emitted.
map_op[".globals_1"] = function(params)
if not params then return "prefix" end
local prefix = params[1] -- No syntax check. You get to keep the pieces.
wline(function(out) writeglobals(out, prefix) end)
end
-- Pseudo-opcode to mark the position where the global names are to be emitted.
map_op[".globalnames_1"] = function(params)
if not params then return "cvar" end
local name = params[1] -- No syntax check. You get to keep the pieces.
wline(function(out) writeglobalnames(out, name) end)
end
-- Pseudo-opcode to mark the position where the extern names are to be emitted.
map_op[".externnames_1"] = function(params)
if not params then return "cvar" end
local name = params[1] -- No syntax check. You get to keep the pieces.
wline(function(out) writeexternnames(out, name) end)
end
------------------------------------------------------------------------------
-- Label pseudo-opcode (converted from trailing colon form).
map_op[".label_1"] = function(params)
if not params then return "[1-9] | ->global | =>pcexpr" end
if secpos+1 > maxsecpos then wflush() end
local mode, n, s = parse_label(params[1], true)
if mode == "EXT" then werror("bad label definition") end
waction("LABEL_"..mode, n, s, 1)
end
------------------------------------------------------------------------------
-- Pseudo-opcodes for data storage.
map_op[".long_*"] = function(params)
if not params then return "imm..." end
for _,p in ipairs(params) do
local n = tonumber(p)
if not n then werror("bad immediate `"..p.."'") end
if n < 0 then n = n + 2^32 end
wputw(n)
if secpos+2 > maxsecpos then wflush() end
end
end
-- Alignment pseudo-opcode.
map_op[".align_1"] = function(params)
if not params then return "numpow2" end
if secpos+1 > maxsecpos then wflush() end
local align = tonumber(params[1])
if align then
local x = align
-- Must be a power of 2 in the range (2 ... 256).
for i=1,8 do
x = x / 2
if x == 1 then
waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
return
end
end
end
werror("bad alignment")
end
------------------------------------------------------------------------------
-- Pseudo-opcode for (primitive) type definitions (map to C types).
map_op[".type_3"] = function(params, nparams)
if not params then
return nparams == 2 and "name, ctype" or "name, ctype, reg"
end
local name, ctype, reg = params[1], params[2], params[3]
if not match(name, "^[%a_][%w_]*$") then
werror("bad type name `"..name.."'")
end
local tp = map_type[name]
if tp then
werror("duplicate type `"..name.."'")
end
-- Add #type to defines. A bit unclean to put it in map_archdef.
map_archdef["#"..name] = "sizeof("..ctype..")"
-- Add new type and emit shortcut define.
local num = ctypenum + 1
map_type[name] = {
ctype = ctype,
ctypefmt = format("Dt%X(%%s)", num),
reg = reg,
}
wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
ctypenum = num
end
map_op[".type_2"] = map_op[".type_3"]
-- Dump type definitions.
local function dumptypes(out, lvl)
local t = {}
for name in pairs(map_type) do t[#t+1] = name end
sort(t)
out:write("Type definitions:\n")
for _,name in ipairs(t) do
local tp = map_type[name]
local reg = tp.reg or ""
out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
end
out:write("\n")
end
------------------------------------------------------------------------------
-- Set the current section.
function _M.section(num)
waction("SECTION", num)
wflush(true) -- SECTION is a terminal action.
end
------------------------------------------------------------------------------
-- Dump architecture description.
function _M.dumparch(out)
out:write(format("DynASM %s version %s, released %s\n\n",
_info.arch, _info.version, _info.release))
dumpactions(out)
end
-- Dump all user defined elements.
function _M.dumpdef(out, lvl)
dumptypes(out, lvl)
dumpglobals(out, lvl)
dumpexterns(out, lvl)
end
------------------------------------------------------------------------------
-- Pass callbacks from/to the DynASM core.
function _M.passcb(wl, we, wf, ww)
wline, werror, wfatal, wwarn = wl, we, wf, ww
return wflush
end
-- Setup the arch-specific module.
function _M.setup(arch, opt)
g_arch, g_opt = arch, opt
end
-- Merge the core maps and the arch-specific maps.
function _M.mergemaps(map_coreop, map_def)
setmetatable(map_op, { __index = map_coreop })
setmetatable(map_def, { __index = map_archdef })
return map_op, map_def
end
return _M
------------------------------------------------------------------------------
|
-- Author : bobby.cannon
-- Create Date : 1/13/2012 7:41:32 PM
BobsCastingBarBlockTemplate = {
}
function BobsCastingBarBlockTemplate:Layout(bar)
-- Set the bar settings.
bar:SetWidth(bar.Settings.Width);
bar:SetHeight(bar.Settings.Height);
-- Reset the graphics settings.
local Graphics = bar.Graphics;
Graphics:ClearAllPoints();
Graphics:SetAllPoints();
Graphics:SetScale(1);
Graphics:SetAlpha(1);
Graphics:Show();
-- Setup the resources
Graphics.Bar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar");
Graphics.Bar:SetBackdrop({bgFile = BobbyCode.Texture.SolidBar});
Graphics.Bar:SetBackdropColor(0, 0, 0, 0.5);
Graphics.Bar:SetStatusBarColor(1, 0.7, 0, 1);
Graphics.Bar:ClearAllPoints();
Graphics.Bar:SetAllPoints();
Graphics.Bar:Show();
BobbyCode:SetFont(Graphics.Text, { fontOutline = true, fontSize = bar.Settings.FontSize });
Graphics.Text:SetJustifyH("CENTER");
Graphics.Text:ClearAllPoints();
Graphics.Text:SetPoint("CENTER");
Graphics.Text:Show();
Graphics.Icon:SetWidth(16);
Graphics.Icon:SetHeight(16);
Graphics.Icon:ClearAllPoints();
Graphics.Icon:SetPoint("RIGHT", bar, "LEFT", -5, 0);
Graphics.Icon:Hide();
Graphics.Spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark");
Graphics.Spark:SetBlendMode("ADD");
Graphics.Spark:SetWidth(32);
Graphics.Spark:SetHeight(32);
Graphics.Spark:ClearAllPoints();
Graphics.Spark:SetPoint("CENTER");
Graphics.Spark:Hide();
Graphics.Border:SetTexture("");
Graphics.Border:Hide();
Graphics.BorderShield:SetTexture("");
Graphics.BorderShield:Hide();
Graphics.Flash:SetTexture("");
Graphics.Flash:Hide();
end
|
-- sample rate is 22050
local Kaes = {}
Kaes["ohh"] = {}
Kaes["ohh"]["B"] = 0.44985782687267
Kaes["ohh"]["gainV"] = 1
Kaes["ohh"]["areas"] = {}
Kaes["ohh"]["areas"][1] = 1
Kaes["ohh"]["areas"][2] = 0.012551292341688
Kaes["ohh"]["areas"][3] = 0.4052771830498
Kaes["ohh"]["areas"][4] = 0.034730394189099
Kaes["ohh"]["areas"][5] = 1.0095203941286
Kaes["ohh"]["areas"][6] = 0.051208663226847
Kaes["ohh"]["areas"][7] = 0.5643383595628
Kaes["ohh"]["areas"][8] = 0.067223685621751
Kaes["ohh"]["areas"][9] = 0.2023720643986
Kaes["ohh"]["kaes"] = {}
Kaes["ohh"]["kaes"][1] = -0.97520857968062
Kaes["ohh"]["kaes"][2] = 0.93992131661238
Kaes["ohh"]["kaes"][3] = -0.84213729042106
Kaes["ohh"]["kaes"][4] = 0.93348265650812
Kaes["ohh"]["kaes"][5] = -0.90344628937663
Kaes["ohh"]["kaes"][6] = 0.83361575531705
Kaes["ohh"]["kaes"][7] = -0.78711929846225
Kaes["ohh"]["kaes"][8] = 0.50130010865025
Kaes["ohh"]["A"] = {}
Kaes["ohh"]["A"][1] = -6.1167077991323
Kaes["ohh"]["A"][2] = 17.270539853424
Kaes["ohh"]["A"][3] = -29.369300595111
Kaes["ohh"]["A"][4] = 32.861056316112
Kaes["ohh"]["A"][5] = -24.757737299156
Kaes["ohh"]["A"][6] = 12.267301091841
Kaes["ohh"]["A"][7] = -3.6556210870709
Kaes["ohh"]["A"][8] = 0.50130010865025
Kaes["ohh"]["Gain"] = 0.44985782687267
Kaes["ohh"]["gainN"] = 0
Kaes["altoU"] = {}
Kaes["altoU"]["B"] = 0.80008552380586
Kaes["altoU"]["gainV"] = 1
Kaes["altoU"]["areas"] = {}
Kaes["altoU"]["areas"][1] = 1
Kaes["altoU"]["areas"][2] = 0.0036287538867221
Kaes["altoU"]["areas"][3] = 0.97179343178204
Kaes["altoU"]["areas"][4] = 0.051021889345034
Kaes["altoU"]["areas"][5] = 0.39838104410353
Kaes["altoU"]["areas"][6] = 0.02473123004375
Kaes["altoU"]["areas"][7] = 0.15872938207871
Kaes["altoU"]["areas"][8] = 0.030735252051776
Kaes["altoU"]["areas"][9] = 0.20741060964831
Kaes["altoU"]["areas"][10] = 0.06001787365703
Kaes["altoU"]["areas"][11] = 0.64013684540369
Kaes["altoU"]["kaes"] = {}
Kaes["altoU"]["kaes"][1] = -0.99276873271582
Kaes["altoU"]["kaes"][2] = 0.99255962404785
Kaes["altoU"]["kaes"][3] = -0.90023245000122
Kaes["altoU"]["kaes"][4] = 0.77293477390764
Kaes["altoU"]["kaes"][5] = -0.88309849864983
Kaes["altoU"]["kaes"][6] = 0.73039193800092
Kaes["altoU"]["kaes"][7] = -0.67555684264949
Kaes["altoU"]["kaes"][8] = 0.74187876428033
Kaes["altoU"]["kaes"][9] = -0.55114823286416
Kaes["altoU"]["kaes"][10] = 0.82855825427401
Kaes["altoU"]["A"] = {}
Kaes["altoU"]["A"][1] = -6.7552379371874
Kaes["altoU"]["A"][2] = 22.106474147463
Kaes["altoU"]["A"][3] = -46.505021536253
Kaes["altoU"]["A"][4] = 69.898189692786
Kaes["altoU"]["A"][5] = -78.593031899937
Kaes["altoU"]["A"][6] = 67.024253360951
Kaes["altoU"]["A"][7] = -42.800752934989
Kaes["altoU"]["A"][8] = 19.566696270487
Kaes["altoU"]["A"][9] = -5.769888283963
Kaes["altoU"]["A"][10] = 0.82855825427401
Kaes["altoU"]["Gain"] = 0.80008552380586
Kaes["altoU"]["gainN"] = 0
Kaes["ahh"] = {}
Kaes["ahh"]["B"] = 1.2312038153527
Kaes["ahh"]["gainV"] = 1
Kaes["ahh"]["areas"] = {}
Kaes["ahh"]["areas"][1] = 1
Kaes["ahh"]["areas"][2] = 0.019583397643653
Kaes["ahh"]["areas"][3] = 4.4262038252224
Kaes["ahh"]["areas"][4] = 0.12228888001062
Kaes["ahh"]["areas"][5] = 2.6867643101507
Kaes["ahh"]["areas"][6] = 0.26062115828215
Kaes["ahh"]["areas"][7] = 3.1658775019503
Kaes["ahh"]["areas"][8] = 0.76252795653433
Kaes["ahh"]["areas"][9] = 1.5158628349391
Kaes["ahh"]["kaes"] = {}
Kaes["ahh"]["kaes"][1] = -0.96158549131162
Kaes["ahh"]["kaes"][2] = 0.99119013274278
Kaes["ahh"]["kaes"][3] = -0.94622883318251
Kaes["ahh"]["kaes"][4] = 0.91293231439053
Kaes["ahh"]["kaes"][5] = -0.82315095119151
Kaes["ahh"]["kaes"][6] = 0.84787902513613
Kaes["ahh"]["kaes"][7] = -0.61178754861598
Kaes["ahh"]["kaes"][8] = 0.330643400256
Kaes["ahh"]["A"] = {}
Kaes["ahh"]["A"][1] = -5.8868539780957
Kaes["ahh"]["A"][2] = 15.798768956258
Kaes["ahh"]["A"][3] = -25.325759157617
Kaes["ahh"]["A"][4] = 26.612464968793
Kaes["ahh"]["A"][5] = -18.830416773123
Kaes["ahh"]["A"][6] = 8.793834042051
Kaes["ahh"]["A"][7] = -2.4913532554267
Kaes["ahh"]["A"][8] = 0.330643400256
Kaes["ahh"]["Gain"] = 1.2312038153527
Kaes["ahh"]["gainN"] = 0
Kaes["counterTenorE"] = {}
Kaes["counterTenorE"]["B"] = 2.1332274087822
Kaes["counterTenorE"]["gainV"] = 1
Kaes["counterTenorE"]["areas"] = {}
Kaes["counterTenorE"]["areas"][1] = 1
Kaes["counterTenorE"]["areas"][2] = 0.14894836188896
Kaes["counterTenorE"]["areas"][3] = 5.3266696718424
Kaes["counterTenorE"]["areas"][4] = 0.20098842281831
Kaes["counterTenorE"]["areas"][5] = 2.5300955786727
Kaes["counterTenorE"]["areas"][6] = 0.13449114729771
Kaes["counterTenorE"]["areas"][7] = 1.7758672273344
Kaes["counterTenorE"]["areas"][8] = 0.092657326427984
Kaes["counterTenorE"]["areas"][9] = 2.0617148097069
Kaes["counterTenorE"]["areas"][10] = 0.31718081022907
Kaes["counterTenorE"]["areas"][11] = 4.5506591775796
Kaes["counterTenorE"]["kaes"] = {}
Kaes["counterTenorE"]["kaes"][1] = -0.74072226946027
Kaes["counterTenorE"]["kaes"][2] = 0.9455957807972
Kaes["counterTenorE"]["kaes"][3] = -0.92727899614035
Kaes["counterTenorE"]["kaes"][4] = 0.85281417729474
Kaes["counterTenorE"]["kaes"][5] = -0.89905290303604
Kaes["counterTenorE"]["kaes"][6] = 0.85919799228915
Kaes["counterTenorE"]["kaes"][7] = -0.90082300364594
Kaes["counterTenorE"]["kaes"][8] = 0.91398206013357
Kaes["counterTenorE"]["kaes"][9] = -0.73333776600286
Kaes["counterTenorE"]["kaes"][10] = 0.86968314035653
Kaes["counterTenorE"]["A"] = {}
Kaes["counterTenorE"]["A"][1] = -7.5533138481431
Kaes["counterTenorE"]["A"][2] = 27.467332352738
Kaes["counterTenorE"]["A"][3] = -62.885235281395
Kaes["counterTenorE"]["A"][4] = 99.986261197996
Kaes["counterTenorE"]["A"][5] = -115.13178590028
Kaes["counterTenorE"]["A"][6] = 97.173348214986
Kaes["counterTenorE"]["A"][7] = -59.403882026085
Kaes["counterTenorE"]["A"][8] = 25.226467788267
Kaes["counterTenorE"]["A"][9] = -6.7476683601887
Kaes["counterTenorE"]["A"][10] = 0.86968314035653
Kaes["counterTenorE"]["Gain"] = 2.1332274087822
Kaes["counterTenorE"]["gainN"] = 0
Kaes["nng"] = {}
Kaes["nng"]["B"] = 0.22768163900126
Kaes["nng"]["gainV"] = 1
Kaes["nng"]["areas"] = {}
Kaes["nng"]["areas"][1] = 1
Kaes["nng"]["areas"][2] = 0.0038317951746622
Kaes["nng"]["areas"][3] = 0.056356851629675
Kaes["nng"]["areas"][4] = 0.0022443160991272
Kaes["nng"]["areas"][5] = 0.073742361899106
Kaes["nng"]["areas"][6] = 0.0039524236021426
Kaes["nng"]["areas"][7] = 0.081403550110509
Kaes["nng"]["areas"][8] = 0.016298335307413
Kaes["nng"]["areas"][9] = 0.051838928738298
Kaes["nng"]["kaes"] = {}
Kaes["nng"]["kaes"][1] = -0.99236566286686
Kaes["nng"]["kaes"][2] = 0.87267382212068
Kaes["nng"]["kaes"][3] = -0.92340370726012
Kaes["nng"]["kaes"][4] = 0.94092869544371
Kaes["nng"]["kaes"][5] = -0.89825768675096
Kaes["nng"]["kaes"][6] = 0.90738964292181
Kaes["nng"]["kaes"][7] = -0.66636600229983
Kaes["nng"]["kaes"][8] = 0.52160288395264
Kaes["nng"]["A"] = {}
Kaes["nng"]["A"][1] = -6.1455626794867
Kaes["nng"]["A"][2] = 17.363496534936
Kaes["nng"]["A"][3] = -29.4501410728
Kaes["nng"]["A"][4] = 32.814824062861
Kaes["nng"]["A"][5] = -24.649884412908
Kaes["nng"]["A"][6] = 12.236485385761
Kaes["nng"]["A"][7] = -3.6906113086912
Kaes["nng"]["A"][8] = 0.52160288395264
Kaes["nng"]["Gain"] = 0.22768163900126
Kaes["nng"]["gainN"] = 0
Kaes["tenorO"] = {}
Kaes["tenorO"]["B"] = 1.237876099308
Kaes["tenorO"]["gainV"] = 1
Kaes["tenorO"]["areas"] = {}
Kaes["tenorO"]["areas"][1] = 1
Kaes["tenorO"]["areas"][2] = 0.020259511178938
Kaes["tenorO"]["areas"][3] = 0.18670353980757
Kaes["tenorO"]["areas"][4] = 0.007498990932433
Kaes["tenorO"]["areas"][5] = 0.8823751142891
Kaes["tenorO"]["areas"][6] = 0.086336600295094
Kaes["tenorO"]["areas"][7] = 1.4459114052399
Kaes["tenorO"]["areas"][8] = 0.032931127194684
Kaes["tenorO"]["areas"][9] = 0.76202838286315
Kaes["tenorO"]["areas"][10] = 0.10028414436055
Kaes["tenorO"]["areas"][11] = 1.5323372372381
Kaes["tenorO"]["kaes"] = {}
Kaes["tenorO"]["kaes"][1] = -0.96028557252943
Kaes["tenorO"]["kaes"][2] = 0.80422098454416
Kaes["tenorO"]["kaes"][3] = -0.92277143965263
Kaes["tenorO"]["kaes"][4] = 0.98314595089703
Kaes["tenorO"]["kaes"][5] = -0.82174965163469
Kaes["tenorO"]["kaes"][6] = 0.88730727665075
Kaes["tenorO"]["kaes"][7] = -0.95546364609832
Kaes["tenorO"]["kaes"][8] = 0.91715017739133
Kaes["tenorO"]["kaes"][9] = -0.76740650009244
Kaes["tenorO"]["kaes"][10] = 0.87714953939614
Kaes["tenorO"]["A"] = {}
Kaes["tenorO"]["A"][1] = -8.0199935934986
Kaes["tenorO"]["A"][2] = 30.390914617853
Kaes["tenorO"]["A"][3] = -71.519723273701
Kaes["tenorO"]["A"][4] = 115.5629993198
Kaes["tenorO"]["A"][5] = -133.83773807063
Kaes["tenorO"]["A"][6] = 112.48377993229
Kaes["tenorO"]["A"][7] = -67.770048260216
Kaes["tenorO"]["A"][8] = 28.044501708757
Kaes["tenorO"]["A"][9] = -7.2117042907563
Kaes["tenorO"]["A"][10] = 0.87714953939614
Kaes["tenorO"]["Gain"] = 1.237876099308
Kaes["tenorO"]["gainN"] = 0
Kaes["altoO"] = {}
Kaes["altoO"]["B"] = 1.1457976500779
Kaes["altoO"]["gainV"] = 1
Kaes["altoO"]["areas"] = {}
Kaes["altoO"]["areas"][1] = 1
Kaes["altoO"]["areas"][2] = 0.0067191237753409
Kaes["altoO"]["areas"][3] = 0.72121511424721
Kaes["altoO"]["areas"][4] = 0.10576165806098
Kaes["altoO"]["areas"][5] = 1.6884477519406
Kaes["altoO"]["areas"][6] = 0.096431260547183
Kaes["altoO"]["areas"][7] = 0.44884778228632
Kaes["altoO"]["areas"][8] = 0.067421431080557
Kaes["altoO"]["areas"][9] = 0.38126567133428
Kaes["altoO"]["areas"][10] = 0.096158114863183
Kaes["altoO"]["areas"][11] = 1.3128522549241
Kaes["altoO"]["kaes"] = {}
Kaes["altoO"]["kaes"][1] = -0.98665144305565
Kaes["altoO"]["kaes"][2] = 0.98153920114104
Kaes["altoO"]["kaes"][3] = -0.74422097064277
Kaes["altoO"]["kaes"][4] = 0.88210778800799
Kaes["altoO"]["kaes"][5] = -0.89194644581228
Kaes["altoO"]["kaes"][6] = 0.64630490823163
Kaes["altoO"]["kaes"][7] = -0.73881289321568
Kaes["altoO"]["kaes"][8] = 0.69947239081447
Kaes["altoO"]["kaes"][9] = -0.59717920370473
Kaes["altoO"]["kaes"][10] = 0.86350971302262
Kaes["altoO"]["A"] = {}
Kaes["altoO"]["A"][1] = -6.6329739837288
Kaes["altoO"]["A"][2] = 21.522769286715
Kaes["altoO"]["A"][3] = -45.189642892149
Kaes["altoO"]["A"][4] = 68.048631100223
Kaes["altoO"]["A"][5] = -76.846321737763
Kaes["altoO"]["A"][6] = 65.95238332341
Kaes["altoO"]["A"][7] = -42.466830308345
Kaes["altoO"]["A"][8] = 19.628760826312
Kaes["altoO"]["A"][9] = -5.8795305741961
Kaes["altoO"]["A"][10] = 0.86350971302262
Kaes["altoO"]["Gain"] = 1.1457976500779
Kaes["altoO"]["gainN"] = 0
Kaes["altoI"] = {}
Kaes["altoI"]["B"] = 0.69632696258211
Kaes["altoI"]["gainV"] = 1
Kaes["altoI"]["areas"] = {}
Kaes["altoI"]["areas"][1] = 1
Kaes["altoI"]["areas"][2] = 0.014563903519256
Kaes["altoI"]["areas"][3] = 0.18178730190138
Kaes["altoI"]["areas"][4] = 0.010981293276502
Kaes["altoI"]["areas"][5] = 0.10965327208233
Kaes["altoI"]["areas"][6] = 0.01297432139156
Kaes["altoI"]["areas"][7] = 0.10390454440628
Kaes["altoI"]["areas"][8] = 0.02003318056518
Kaes["altoI"]["areas"][9] = 0.13915824013478
Kaes["altoI"]["areas"][10] = 0.042720057950463
Kaes["altoI"]["areas"][11] = 0.48487123881883
Kaes["altoI"]["kaes"] = {}
Kaes["altoI"]["kaes"][1] = -0.9712903180002
Kaes["altoI"]["kaes"][2] = 0.85165455452075
Kaes["altoI"]["kaes"][3] = -0.88606761110264
Kaes["altoI"]["kaes"][4] = 0.81794118055904
Kaes["altoI"]["kaes"][5] = -0.78839474829419
Kaes["altoI"]["kaes"][6] = 0.77798687037224
Kaes["altoI"]["kaes"][7] = -0.67672182832477
Kaes["altoI"]["kaes"][8] = 0.74831331390732
Kaes["altoI"]["kaes"][9] = -0.53023468549898
Kaes["altoI"]["kaes"][10] = 0.83805624462701
Kaes["altoI"]["A"] = {}
Kaes["altoI"]["A"][1] = -6.4101189548186
Kaes["altoI"]["A"][2] = 20.384513923227
Kaes["altoI"]["A"][3] = -42.235178361493
Kaes["altoI"]["A"][4] = 63.042175131004
Kaes["altoI"]["A"][5] = -70.806713759048
Kaes["altoI"]["A"][6] = 60.612707558469
Kaes["altoI"]["A"][7] = -39.078616620921
Kaes["altoI"]["A"][8] = 18.185067281113
Kaes["altoI"]["A"][9] = -5.5298707931256
Kaes["altoI"]["A"][10] = 0.83805624462701
Kaes["altoI"]["Gain"] = 0.69632696258211
Kaes["altoI"]["gainN"] = 0
Kaes["zhh"] = {}
Kaes["zhh"]["B"] = 5.2091024055613
Kaes["zhh"]["gainV"] = 1
Kaes["zhh"]["areas"] = {}
Kaes["zhh"]["areas"][1] = 1
Kaes["zhh"]["areas"][2] = 0.45081275453368
Kaes["zhh"]["areas"][3] = 1.8244409574397
Kaes["zhh"]["areas"][4] = 1.2970773725668
Kaes["zhh"]["areas"][5] = 7.4203439386635
Kaes["zhh"]["areas"][6] = 8.3454675244331
Kaes["zhh"]["areas"][7] = 17.872286364986
Kaes["zhh"]["areas"][8] = 18.278252019834
Kaes["zhh"]["areas"][9] = 27.134747871624
Kaes["zhh"]["kaes"] = {}
Kaes["zhh"]["kaes"][1] = -0.37853764639865
Kaes["zhh"]["kaes"][2] = 0.60372528816342
Kaes["zhh"]["kaes"][3] = -0.16894457412068
Kaes["zhh"]["kaes"][4] = 0.70241718823528
Kaes["zhh"]["kaes"][5] = 0.058679097357912
Kaes["zhh"]["kaes"][6] = 0.36337280763009
Kaes["zhh"]["kaes"][7] = 0.011229864698718
Kaes["zhh"]["kaes"][8] = 0.195021158544
Kaes["zhh"]["A"] = {}
Kaes["zhh"]["A"][1] = -0.7589257968483
Kaes["zhh"]["A"][2] = 1.4674841079714
Kaes["zhh"]["A"][3] = -0.84231919490837
Kaes["zhh"]["A"][4] = 1.2755771892404
Kaes["zhh"]["A"][5] = -0.36761942086952
Kaes["zhh"]["A"][6] = 0.62747677759946
Kaes["zhh"]["A"][7] = -0.13720383172872
Kaes["zhh"]["A"][8] = 0.195021158544
Kaes["zhh"]["Gain"] = 5.2091024055613
Kaes["zhh"]["gainN"] = 1
Kaes["thh"] = {}
Kaes["thh"]["B"] = 0.17030463396438
Kaes["thh"]["gainV"] = 0
Kaes["thh"]["areas"] = {}
Kaes["thh"]["areas"][1] = 1
Kaes["thh"]["areas"][2] = 0.0051219935739476
Kaes["thh"]["areas"][3] = 0.019240928187052
Kaes["thh"]["areas"][4] = 0.013625465757005
Kaes["thh"]["areas"][5] = 0.023728360156169
Kaes["thh"]["areas"][6] = 0.024946170122049
Kaes["thh"]["areas"][7] = 0.02805718295791
Kaes["thh"]["areas"][8] = 0.028537584204056
Kaes["thh"]["areas"][9] = 0.029003668349742
Kaes["thh"]["kaes"] = {}
Kaes["thh"]["kaes"][1] = -0.98980821510882
Kaes["thh"]["kaes"][2] = 0.57952550813121
Kaes["thh"]["kaes"][3] = -0.17085727261729
Kaes["thh"]["kaes"][4] = 0.27046478244685
Kaes["thh"]["kaes"][5] = 0.025019449780391
Kaes["thh"]["kaes"][6] = 0.058694642038359
Kaes["thh"]["kaes"][7] = 0.0084884393069781
Kaes["thh"]["kaes"][8] = 0.0081
Kaes["thh"]["A"] = {}
Kaes["thh"]["A"][1] = -1.6998519767659
Kaes["thh"]["A"][2] = 1.0732013366061
Kaes["thh"]["A"][3] = -0.62648921115727
Kaes["thh"]["A"][4] = 0.28690913274862
Kaes["thh"]["A"][5] = -0.070830317941863
Kaes["thh"]["A"][6] = 0.05295076578762
Kaes["thh"]["A"][7] = -0.005280918631329
Kaes["thh"]["A"][8] = 0.0081
Kaes["thh"]["Gain"] = 0.17030463396438
Kaes["thh"]["gainN"] = 0.7
Kaes["aww"] = {}
Kaes["aww"]["B"] = 0.44985782687267
Kaes["aww"]["gainV"] = 1
Kaes["aww"]["areas"] = {}
Kaes["aww"]["areas"][1] = 1
Kaes["aww"]["areas"][2] = 0.012551292341688
Kaes["aww"]["areas"][3] = 0.4052771830498
Kaes["aww"]["areas"][4] = 0.034730394189099
Kaes["aww"]["areas"][5] = 1.0095203941286
Kaes["aww"]["areas"][6] = 0.051208663226847
Kaes["aww"]["areas"][7] = 0.5643383595628
Kaes["aww"]["areas"][8] = 0.067223685621751
Kaes["aww"]["areas"][9] = 0.2023720643986
Kaes["aww"]["kaes"] = {}
Kaes["aww"]["kaes"][1] = -0.97520857968062
Kaes["aww"]["kaes"][2] = 0.93992131661238
Kaes["aww"]["kaes"][3] = -0.84213729042106
Kaes["aww"]["kaes"][4] = 0.93348265650812
Kaes["aww"]["kaes"][5] = -0.90344628937663
Kaes["aww"]["kaes"][6] = 0.83361575531705
Kaes["aww"]["kaes"][7] = -0.78711929846225
Kaes["aww"]["kaes"][8] = 0.50130010865025
Kaes["aww"]["A"] = {}
Kaes["aww"]["A"][1] = -6.1167077991323
Kaes["aww"]["A"][2] = 17.270539853424
Kaes["aww"]["A"][3] = -29.369300595111
Kaes["aww"]["A"][4] = 32.861056316112
Kaes["aww"]["A"][5] = -24.757737299156
Kaes["aww"]["A"][6] = 12.267301091841
Kaes["aww"]["A"][7] = -3.6556210870709
Kaes["aww"]["A"][8] = 0.50130010865025
Kaes["aww"]["Gain"] = 0.44985782687267
Kaes["aww"]["gainN"] = 0
Kaes["bassE"] = {}
Kaes["bassE"]["B"] = 1.4319719346287
Kaes["bassE"]["gainV"] = 1
Kaes["bassE"]["areas"] = {}
Kaes["bassE"]["areas"][1] = 1
Kaes["bassE"]["areas"][2] = 0.07567046089544
Kaes["bassE"]["areas"][3] = 1.3391860863374
Kaes["bassE"]["areas"][4] = 0.038971449769911
Kaes["bassE"]["areas"][5] = 0.59179794766234
Kaes["bassE"]["areas"][6] = 0.028628369439224
Kaes["bassE"]["areas"][7] = 0.51644128399813
Kaes["bassE"]["areas"][8] = 0.031717032592174
Kaes["bassE"]["areas"][9] = 0.96648345163024
Kaes["bassE"]["areas"][10] = 0.13419827409089
Kaes["bassE"]["areas"][11] = 2.0505436215643
Kaes["bassE"]["kaes"] = {}
Kaes["bassE"]["kaes"][1] = -0.85930549616014
Kaes["bassE"]["kaes"][2] = 0.89303444077997
Kaes["bassE"]["kaes"][3] = -0.94344412921038
Kaes["bassE"]["kaes"][4] = 0.87643202118379
Kaes["bassE"]["kaes"][5] = -0.90771387786074
Kaes["bassE"]["kaes"][6] = 0.89495518872245
Kaes["bassE"]["kaes"][7] = -0.88427783860158
Kaes["bassE"]["kaes"][8] = 0.93645157842839
Kaes["bassE"]["kaes"][9] = -0.75615426157281
Kaes["bassE"]["kaes"][10] = 0.87714953939614
Kaes["bassE"]["A"] = {}
Kaes["bassE"]["A"][1] = -7.8948350299466
Kaes["bassE"]["A"][2] = 29.627711742072
Kaes["bassE"]["A"][3] = -69.300144368544
Kaes["bassE"]["A"][4] = 111.59644175655
Kaes["bassE"]["A"][5] = -129.10381966968
Kaes["bassE"]["A"][6] = 108.62515924352
Kaes["bassE"]["A"][7] = -65.669252527577
Kaes["bassE"]["A"][8] = 27.341422977252
Kaes["bassE"]["A"][9] = -7.0993266504508
Kaes["bassE"]["A"][10] = 0.87714953939614
Kaes["bassE"]["Gain"] = 1.4319719346287
Kaes["bassE"]["gainN"] = 0
Kaes["thz"] = {}
Kaes["thz"]["B"] = 5.2091024055613
Kaes["thz"]["gainV"] = 1
Kaes["thz"]["areas"] = {}
Kaes["thz"]["areas"][1] = 1
Kaes["thz"]["areas"][2] = 0.45081275453368
Kaes["thz"]["areas"][3] = 1.8244409574397
Kaes["thz"]["areas"][4] = 1.2970773725668
Kaes["thz"]["areas"][5] = 7.4203439386635
Kaes["thz"]["areas"][6] = 8.3454675244331
Kaes["thz"]["areas"][7] = 17.872286364986
Kaes["thz"]["areas"][8] = 18.278252019834
Kaes["thz"]["areas"][9] = 27.134747871624
Kaes["thz"]["kaes"] = {}
Kaes["thz"]["kaes"][1] = -0.37853764639865
Kaes["thz"]["kaes"][2] = 0.60372528816342
Kaes["thz"]["kaes"][3] = -0.16894457412068
Kaes["thz"]["kaes"][4] = 0.70241718823528
Kaes["thz"]["kaes"][5] = 0.058679097357912
Kaes["thz"]["kaes"][6] = 0.36337280763009
Kaes["thz"]["kaes"][7] = 0.011229864698718
Kaes["thz"]["kaes"][8] = 0.195021158544
Kaes["thz"]["A"] = {}
Kaes["thz"]["A"][1] = -0.7589257968483
Kaes["thz"]["A"][2] = 1.4674841079714
Kaes["thz"]["A"][3] = -0.84231919490837
Kaes["thz"]["A"][4] = 1.2755771892404
Kaes["thz"]["A"][5] = -0.36761942086952
Kaes["thz"]["A"][6] = 0.62747677759946
Kaes["thz"]["A"][7] = -0.13720383172872
Kaes["thz"]["A"][8] = 0.195021158544
Kaes["thz"]["Gain"] = 5.2091024055613
Kaes["thz"]["gainN"] = 1
Kaes["shh"] = {}
Kaes["shh"]["B"] = 5.2091024055613
Kaes["shh"]["gainV"] = 0
Kaes["shh"]["areas"] = {}
Kaes["shh"]["areas"][1] = 1
Kaes["shh"]["areas"][2] = 0.45081275453368
Kaes["shh"]["areas"][3] = 1.8244409574397
Kaes["shh"]["areas"][4] = 1.2970773725668
Kaes["shh"]["areas"][5] = 7.4203439386635
Kaes["shh"]["areas"][6] = 8.3454675244331
Kaes["shh"]["areas"][7] = 17.872286364986
Kaes["shh"]["areas"][8] = 18.278252019834
Kaes["shh"]["areas"][9] = 27.134747871624
Kaes["shh"]["kaes"] = {}
Kaes["shh"]["kaes"][1] = -0.37853764639865
Kaes["shh"]["kaes"][2] = 0.60372528816342
Kaes["shh"]["kaes"][3] = -0.16894457412068
Kaes["shh"]["kaes"][4] = 0.70241718823528
Kaes["shh"]["kaes"][5] = 0.058679097357912
Kaes["shh"]["kaes"][6] = 0.36337280763009
Kaes["shh"]["kaes"][7] = 0.011229864698718
Kaes["shh"]["kaes"][8] = 0.195021158544
Kaes["shh"]["A"] = {}
Kaes["shh"]["A"][1] = -0.7589257968483
Kaes["shh"]["A"][2] = 1.4674841079714
Kaes["shh"]["A"][3] = -0.84231919490837
Kaes["shh"]["A"][4] = 1.2755771892404
Kaes["shh"]["A"][5] = -0.36761942086952
Kaes["shh"]["A"][6] = 0.62747677759946
Kaes["shh"]["A"][7] = -0.13720383172872
Kaes["shh"]["A"][8] = 0.195021158544
Kaes["shh"]["Gain"] = 5.2091024055613
Kaes["shh"]["gainN"] = 0.7
Kaes["tenorI"] = {}
Kaes["tenorI"]["B"] = 0.82802662001951
Kaes["tenorI"]["gainV"] = 1
Kaes["tenorI"]["areas"] = {}
Kaes["tenorI"]["areas"][1] = 1
Kaes["tenorI"]["areas"][2] = 0.088790118383921
Kaes["tenorI"]["areas"][3] = 0.83244461105302
Kaes["tenorI"]["areas"][4] = 0.019730150766175
Kaes["tenorI"]["areas"][5] = 0.18232659470481
Kaes["tenorI"]["areas"][6] = 0.010474442962884
Kaes["tenorI"]["areas"][7] = 0.14312825168732
Kaes["tenorI"]["areas"][8] = 0.010977935285358
Kaes["tenorI"]["areas"][9] = 0.24596442408968
Kaes["tenorI"]["areas"][10] = 0.045843658510852
Kaes["tenorI"]["areas"][11] = 0.68562808346093
Kaes["tenorI"]["kaes"] = {}
Kaes["tenorI"]["kaes"][1] = -0.83690131479938
Kaes["tenorI"]["kaes"][2] = 0.80723671058691
Kaes["tenorI"]["kaes"][3] = -0.95369459024096
Kaes["tenorI"]["kaes"][4] = 0.80470683401155
Kaes["tenorI"]["kaes"][5] = -0.89134453746107
Kaes["tenorI"]["kaes"][6] = 0.8636164165383
Kaes["tenorI"]["kaes"][7] = -0.85752765023894
Kaes["tenorI"]["kaes"][8] = 0.9145494319266
Kaes["tenorI"]["kaes"][9] = -0.68579582784477
Kaes["tenorI"]["kaes"][10] = 0.87465364448044
Kaes["tenorI"]["A"] = {}
Kaes["tenorI"]["A"][1] = -7.2886858203344
Kaes["tenorI"]["A"][2] = 25.825675505305
Kaes["tenorI"]["A"][3] = -58.093041114665
Kaes["tenorI"]["A"][4] = 91.431676723155
Kaes["tenorI"]["A"][5] = -104.95643806368
Kaes["tenorI"]["A"][6] = 88.928622900313
Kaes["tenorI"]["A"][7] = -54.965690764949
Kaes["tenorI"]["A"][8] = 23.780252984264
Kaes["tenorI"]["A"][9] = -6.536224607158
Kaes["tenorI"]["A"][10] = 0.87465364448044
Kaes["tenorI"]["Gain"] = 0.82802662001951
Kaes["tenorI"]["gainN"] = 0
Kaes["uhh"] = {}
Kaes["uhh"]["B"] = 0.6274430873755
Kaes["uhh"]["gainV"] = 1
Kaes["uhh"]["areas"] = {}
Kaes["uhh"]["areas"][1] = 1
Kaes["uhh"]["areas"][2] = 0.0096928928806284
Kaes["uhh"]["areas"][3] = 0.78193816474105
Kaes["uhh"]["areas"][4] = 0.055752394794867
Kaes["uhh"]["areas"][5] = 0.94857307991255
Kaes["uhh"]["areas"][6] = 0.058473979853083
Kaes["uhh"]["areas"][7] = 0.69728821174433
Kaes["uhh"]["areas"][8] = 0.10966805014727
Kaes["uhh"]["areas"][9] = 0.3936848278953
Kaes["uhh"]["kaes"] = {}
Kaes["uhh"]["kaes"][1] = -0.98080031473139
Kaes["uhh"]["kaes"][2] = 0.97551159018508
Kaes["uhh"]["kaes"][3] = -0.86689023969483
Kaes["uhh"]["kaes"][4] = 0.88897544431777
Kaes["uhh"]["kaes"][5] = -0.88387041243794
Kaes["uhh"]["kaes"][6] = 0.84525825582915
Kaes["uhh"]["kaes"][7] = -0.72819332267106
Kaes["uhh"]["kaes"][8] = 0.56424983373992
Kaes["uhh"]["A"] = {}
Kaes["uhh"]["A"][1] = -6.1131202365448
Kaes["uhh"]["A"][2] = 17.256920887031
Kaes["uhh"]["A"][3] = -29.427376606142
Kaes["uhh"]["A"][4] = 33.180942453755
Kaes["uhh"]["A"][5] = -25.353239144135
Kaes["uhh"]["A"][6] = 12.838171482279
Kaes["uhh"]["A"][7] = -3.9456797572031
Kaes["uhh"]["A"][8] = 0.56424983373992
Kaes["uhh"]["Gain"] = 0.6274430873755
Kaes["uhh"]["gainN"] = 0
Kaes["nnn"] = {}
Kaes["nnn"]["B"] = 0.22768163900126
Kaes["nnn"]["gainV"] = 1
Kaes["nnn"]["areas"] = {}
Kaes["nnn"]["areas"][1] = 1
Kaes["nnn"]["areas"][2] = 0.0038317951746622
Kaes["nnn"]["areas"][3] = 0.056356851629675
Kaes["nnn"]["areas"][4] = 0.0022443160991272
Kaes["nnn"]["areas"][5] = 0.073742361899106
Kaes["nnn"]["areas"][6] = 0.0039524236021426
Kaes["nnn"]["areas"][7] = 0.081403550110509
Kaes["nnn"]["areas"][8] = 0.016298335307413
Kaes["nnn"]["areas"][9] = 0.051838928738298
Kaes["nnn"]["kaes"] = {}
Kaes["nnn"]["kaes"][1] = -0.99236566286686
Kaes["nnn"]["kaes"][2] = 0.87267382212068
Kaes["nnn"]["kaes"][3] = -0.92340370726012
Kaes["nnn"]["kaes"][4] = 0.94092869544371
Kaes["nnn"]["kaes"][5] = -0.89825768675096
Kaes["nnn"]["kaes"][6] = 0.90738964292181
Kaes["nnn"]["kaes"][7] = -0.66636600229983
Kaes["nnn"]["kaes"][8] = 0.52160288395264
Kaes["nnn"]["A"] = {}
Kaes["nnn"]["A"][1] = -6.1455626794867
Kaes["nnn"]["A"][2] = 17.363496534936
Kaes["nnn"]["A"][3] = -29.4501410728
Kaes["nnn"]["A"][4] = 32.814824062861
Kaes["nnn"]["A"][5] = -24.649884412908
Kaes["nnn"]["A"][6] = 12.236485385761
Kaes["nnn"]["A"][7] = -3.6906113086912
Kaes["nnn"]["A"][8] = 0.52160288395264
Kaes["nnn"]["Gain"] = 0.22768163900126
Kaes["nnn"]["gainN"] = 0
Kaes["hoo"] = {}
Kaes["hoo"]["B"] = 0.50938787989083
Kaes["hoo"]["gainV"] = 0
Kaes["hoo"]["areas"] = {}
Kaes["hoo"]["areas"][1] = 1
Kaes["hoo"]["areas"][2] = 0.0035152094620088
Kaes["hoo"]["areas"][3] = 0.25380072173681
Kaes["hoo"]["areas"][4] = 0.02108233666786
Kaes["hoo"]["areas"][5] = 0.71939548877174
Kaes["hoo"]["areas"][6] = 0.02530369369206
Kaes["hoo"]["areas"][7] = 0.46939867719382
Kaes["hoo"]["areas"][8] = 0.043209043485966
Kaes["hoo"]["areas"][9] = 0.25947601217968
Kaes["hoo"]["kaes"] = {}
Kaes["hoo"]["kaes"][1] = -0.99299420790265
Kaes["hoo"]["kaes"][2] = 0.97267787155166
Kaes["hoo"]["kaes"][3] = -0.8466086866887
Kaes["hoo"]["kaes"][4] = 0.94305748006608
Kaes["hoo"]["kaes"][5] = -0.93204318122562
Kaes["hoo"]["kaes"][6] = 0.89770134456098
Kaes["hoo"]["kaes"][7] = -0.83141477686421
Kaes["hoo"]["kaes"][8] = 0.71449503252849
Kaes["hoo"]["A"] = {}
Kaes["hoo"]["A"][1] = -6.6368064924784
Kaes["hoo"]["A"][2] = 20.080704693849
Kaes["hoo"]["A"][3] = -36.184545910651
Kaes["hoo"]["A"][4] = 42.463200917531
Kaes["hoo"]["A"][5] = -33.230443239496
Kaes["hoo"]["A"][6] = 16.942488720721
Kaes["hoo"]["A"][7] = -5.1489401837934
Kaes["hoo"]["A"][8] = 0.71449503252849
Kaes["hoo"]["Gain"] = 0.50938787989083
Kaes["hoo"]["gainN"] = 0.1
Kaes["ooo"] = {}
Kaes["ooo"]["B"] = 0.50938787989083
Kaes["ooo"]["gainV"] = 1
Kaes["ooo"]["areas"] = {}
Kaes["ooo"]["areas"][1] = 1
Kaes["ooo"]["areas"][2] = 0.0035152094620088
Kaes["ooo"]["areas"][3] = 0.25380072173681
Kaes["ooo"]["areas"][4] = 0.02108233666786
Kaes["ooo"]["areas"][5] = 0.71939548877174
Kaes["ooo"]["areas"][6] = 0.02530369369206
Kaes["ooo"]["areas"][7] = 0.46939867719382
Kaes["ooo"]["areas"][8] = 0.043209043485966
Kaes["ooo"]["areas"][9] = 0.25947601217968
Kaes["ooo"]["kaes"] = {}
Kaes["ooo"]["kaes"][1] = -0.99299420790265
Kaes["ooo"]["kaes"][2] = 0.97267787155166
Kaes["ooo"]["kaes"][3] = -0.8466086866887
Kaes["ooo"]["kaes"][4] = 0.94305748006608
Kaes["ooo"]["kaes"][5] = -0.93204318122562
Kaes["ooo"]["kaes"][6] = 0.89770134456098
Kaes["ooo"]["kaes"][7] = -0.83141477686421
Kaes["ooo"]["kaes"][8] = 0.71449503252849
Kaes["ooo"]["A"] = {}
Kaes["ooo"]["A"][1] = -6.6368064924784
Kaes["ooo"]["A"][2] = 20.080704693849
Kaes["ooo"]["A"][3] = -36.184545910651
Kaes["ooo"]["A"][4] = 42.463200917531
Kaes["ooo"]["A"][5] = -33.230443239496
Kaes["ooo"]["A"][6] = 16.942488720721
Kaes["ooo"]["A"][7] = -5.1489401837934
Kaes["ooo"]["A"][8] = 0.71449503252849
Kaes["ooo"]["Gain"] = 0.50938787989083
Kaes["ooo"]["gainN"] = 0
Kaes["zzz"] = {}
Kaes["zzz"]["B"] = 0.17030463396438
Kaes["zzz"]["gainV"] = 1
Kaes["zzz"]["areas"] = {}
Kaes["zzz"]["areas"][1] = 1
Kaes["zzz"]["areas"][2] = 0.0051219935739476
Kaes["zzz"]["areas"][3] = 0.019240928187052
Kaes["zzz"]["areas"][4] = 0.013625465757005
Kaes["zzz"]["areas"][5] = 0.023728360156169
Kaes["zzz"]["areas"][6] = 0.024946170122049
Kaes["zzz"]["areas"][7] = 0.02805718295791
Kaes["zzz"]["areas"][8] = 0.028537584204056
Kaes["zzz"]["areas"][9] = 0.029003668349742
Kaes["zzz"]["kaes"] = {}
Kaes["zzz"]["kaes"][1] = -0.98980821510882
Kaes["zzz"]["kaes"][2] = 0.57952550813121
Kaes["zzz"]["kaes"][3] = -0.17085727261729
Kaes["zzz"]["kaes"][4] = 0.27046478244685
Kaes["zzz"]["kaes"][5] = 0.025019449780391
Kaes["zzz"]["kaes"][6] = 0.058694642038359
Kaes["zzz"]["kaes"][7] = 0.0084884393069781
Kaes["zzz"]["kaes"][8] = 0.0081
Kaes["zzz"]["A"] = {}
Kaes["zzz"]["A"][1] = -1.6998519767659
Kaes["zzz"]["A"][2] = 1.0732013366061
Kaes["zzz"]["A"][3] = -0.62648921115727
Kaes["zzz"]["A"][4] = 0.28690913274862
Kaes["zzz"]["A"][5] = -0.070830317941863
Kaes["zzz"]["A"][6] = 0.05295076578762
Kaes["zzz"]["A"][7] = -0.005280918631329
Kaes["zzz"]["A"][8] = 0.0081
Kaes["zzz"]["Gain"] = 0.17030463396438
Kaes["zzz"]["gainN"] = 1
Kaes["counterTenorA"] = {}
Kaes["counterTenorA"]["B"] = 2.311056688559
Kaes["counterTenorA"]["gainV"] = 1
Kaes["counterTenorA"]["areas"] = {}
Kaes["counterTenorA"]["areas"][1] = 1
Kaes["counterTenorA"]["areas"][2] = 0.055922246906594
Kaes["counterTenorA"]["areas"][3] = 0.61234702248166
Kaes["counterTenorA"]["areas"][4] = 0.031830413677863
Kaes["counterTenorA"]["areas"][5] = 2.1627758140035
Kaes["counterTenorA"]["areas"][6] = 0.2524078861943
Kaes["counterTenorA"]["areas"][7] = 3.7647341003174
Kaes["counterTenorA"]["areas"][8] = 0.16204755952113
Kaes["counterTenorA"]["areas"][9] = 2.8267057232997
Kaes["counterTenorA"]["areas"][10] = 0.42523628319895
Kaes["counterTenorA"]["areas"][11] = 5.3409830177331
Kaes["counterTenorA"]["kaes"] = {}
Kaes["counterTenorA"]["kaes"][1] = -0.89407885463078
Kaes["counterTenorA"]["kaes"][2] = 0.83263558727521
Kaes["counterTenorA"]["kaes"][3] = -0.90117501206615
Kaes["counterTenorA"]["kaes"][4] = 0.97099214129954
Kaes["counterTenorA"]["kaes"][5] = -0.79098245307499
Kaes["counterTenorA"]["kaes"][6] = 0.87433459556978
Kaes["counterTenorA"]["kaes"][7] = -0.91746545972826
Kaes["counterTenorA"]["kaes"][8] = 0.89156176894723
Kaes["counterTenorA"]["kaes"][9] = -0.7384724067347
Kaes["counterTenorA"]["kaes"][10] = 0.85250776600529
Kaes["counterTenorA"]["A"] = {}
Kaes["counterTenorA"]["A"][1] = -7.6316221828347
Kaes["counterTenorA"]["A"][2] = 27.877887448439
Kaes["counterTenorA"]["A"][3] = -63.929905321912
Kaes["counterTenorA"]["A"][4] = 101.63227808402
Kaes["counterTenorA"]["A"][5] = -116.85246073394
Kaes["counterTenorA"]["A"][6] = 98.363073287591
Kaes["counterTenorA"]["A"][7] = -59.892548542271
Kaes["counterTenorA"]["A"][8] = 25.289700967149
Kaes["counterTenorA"]["A"][9] = -6.707790369586
Kaes["counterTenorA"]["A"][10] = 0.85250776600529
Kaes["counterTenorA"]["Gain"] = 2.311056688559
Kaes["counterTenorA"]["gainN"] = 0
Kaes["tenorU"] = {}
Kaes["tenorU"]["B"] = 1.1739804416113
Kaes["tenorU"]["gainV"] = 1
Kaes["tenorU"]["areas"] = {}
Kaes["tenorU"]["areas"][1] = 1
Kaes["tenorU"]["areas"][2] = 0.0046521096296954
Kaes["tenorU"]["areas"][3] = 0.12059509645006
Kaes["tenorU"]["areas"][4] = 0.01592181927086
Kaes["tenorU"]["areas"][5] = 2.2538755429719
Kaes["tenorU"]["areas"][6] = 0.12498209089609
Kaes["tenorU"]["areas"][7] = 0.97241358800382
Kaes["tenorU"]["areas"][8] = 0.027614863384926
Kaes["tenorU"]["areas"][9] = 0.55708272225119
Kaes["tenorU"]["areas"][10] = 0.086287379547543
Kaes["tenorU"]["areas"][11] = 1.3782300772859
Kaes["tenorU"]["kaes"] = {}
Kaes["tenorU"]["kaes"][1] = -0.99073886455798
Kaes["tenorU"]["kaes"][2] = 0.92571315919441
Kaes["tenorU"]["kaes"][3] = -0.76674217716127
Kaes["tenorU"]["kaes"][4] = 0.98597071303746
Kaes["tenorU"]["kaes"][5] = -0.89492259720236
Kaes["tenorU"]["kaes"][6] = 0.77222055216879
Kaes["tenorU"]["kaes"][7] = -0.94477184454787
Kaes["tenorU"]["kaes"][8] = 0.90554138049028
Kaes["tenorU"]["kaes"][9] = -0.73176440961027
Kaes["tenorU"]["kaes"][10] = 0.88216271626545
Kaes["tenorU"]["A"] = {}
Kaes["tenorU"]["A"][1] = -7.8403730852315
Kaes["tenorU"]["A"][2] = 29.183154191874
Kaes["tenorU"]["A"][3] = -67.816334421256
Kaes["tenorU"]["A"][4] = 108.77483556204
Kaes["tenorU"]["A"][5] = -125.70260984714
Kaes["tenorU"]["A"][6] = 105.96704577843
Kaes["tenorU"]["A"][7] = -64.374304005925
Kaes["tenorU"]["A"][8] = 27.005286924424
Kaes["tenorU"]["A"][9] = -7.0787820716259
Kaes["tenorU"]["A"][10] = 0.88216271626545
Kaes["tenorU"]["Gain"] = 1.1739804416113
Kaes["tenorU"]["gainN"] = 0
Kaes["tenorA"] = {}
Kaes["tenorA"]["B"] = 2.2931582325473
Kaes["tenorA"]["gainV"] = 1
Kaes["tenorA"]["areas"] = {}
Kaes["tenorA"]["areas"][1] = 1
Kaes["tenorA"]["areas"][2] = 0.047022838204803
Kaes["tenorA"]["areas"][3] = 0.56167259473791
Kaes["tenorA"]["areas"][4] = 0.030325643088691
Kaes["tenorA"]["areas"][5] = 2.3253012523053
Kaes["tenorA"]["areas"][6] = 0.24802059912915
Kaes["tenorA"]["areas"][7] = 3.8623555797299
Kaes["tenorA"]["areas"][8] = 0.1600608047408
Kaes["tenorA"]["areas"][9] = 2.984882502107
Kaes["tenorA"]["areas"][10] = 0.41867512856903
Kaes["tenorA"]["areas"][11] = 5.2585746794993
Kaes["tenorA"]["kaes"] = {}
Kaes["tenorA"]["kaes"][1] = -0.91017800856106
Kaes["tenorA"]["kaes"][2] = 0.84549633310875
Kaes["tenorA"]["kaes"][3] = -0.89754819811618
Kaes["tenorA"]["kaes"][4] = 0.9742525922522
Kaes["tenorA"]["kaes"][5] = -0.80723701623961
Kaes["tenorA"]["kaes"][6] = 0.87931975647154
Kaes["tenorA"]["kaes"][7] = -0.92041559627753
Kaes["tenorA"]["kaes"][8] = 0.89821068990828
Kaes["tenorA"]["kaes"][9] = -0.75397794073146
Kaes["tenorA"]["kaes"][10] = 0.85250776600529
Kaes["tenorA"]["A"] = {}
Kaes["tenorA"]["A"][1] = -7.7653846003217
Kaes["tenorA"]["A"][2] = 28.730831404226
Kaes["tenorA"]["A"][3] = -66.463390430295
Kaes["tenorA"]["A"][4] = 106.2004400613
Kaes["tenorA"]["A"][5] = -122.31223526913
Kaes["tenorA"]["A"][6] = 102.78935008264
Kaes["tenorA"]["A"][7] = -62.271709348036
Kaes["tenorA"]["A"][8] = 26.066487062569
Kaes["tenorA"]["A"][9] = -6.826060454238
Kaes["tenorA"]["A"][10] = 0.85250776600529
Kaes["tenorA"]["Gain"] = 2.2931582325473
Kaes["tenorA"]["gainN"] = 0
Kaes["aaa"] = {}
Kaes["aaa"]["B"] = 0.67739794028384
Kaes["aaa"]["gainV"] = 1
Kaes["aaa"]["areas"] = {}
Kaes["aaa"]["areas"][1] = 1
Kaes["aaa"]["areas"][2] = 0.018865297829076
Kaes["aaa"]["areas"][3] = 0.89843049705612
Kaes["aaa"]["areas"][4] = 0.049871644474581
Kaes["aaa"]["areas"][5] = 1.3949529848487
Kaes["aaa"]["areas"][6] = 0.11347477992471
Kaes["aaa"]["areas"][7] = 0.90619599449206
Kaes["aaa"]["areas"][8] = 0.32329622843372
Kaes["aaa"]["areas"][9] = 0.45886796950079
Kaes["aaa"]["kaes"] = {}
Kaes["aaa"]["kaes"][1] = -0.96296802360573
Kaes["aaa"]["kaes"][2] = 0.95886758026306
Kaes["aaa"]["kaes"][3] = -0.89481908288411
Kaes["aaa"]["kaes"][4] = 0.93096512412314
Kaes["aaa"]["kaes"][5] = -0.84954562283364
Kaes["aaa"]["kaes"][6] = 0.77742859210686
Kaes["aaa"]["kaes"][7] = -0.47409796921792
Kaes["aaa"]["kaes"][8] = 0.173329003584
Kaes["aaa"]["A"] = {}
Kaes["aaa"]["A"][1] = -5.4794958586497
Kaes["aaa"]["A"][2] = 13.68882548489
Kaes["aaa"]["A"][3] = -20.345508316543
Kaes["aaa"]["A"][4] = 19.697419620303
Kaes["aaa"]["A"][5] = -12.761762606231
Kaes["aaa"]["A"][6] = 5.4392340688346
Kaes["aaa"]["A"][7] = -1.4096102280455
Kaes["aaa"]["A"][8] = 0.173329003584
Kaes["aaa"]["Gain"] = 0.67739794028384
Kaes["aaa"]["gainN"] = 0
Kaes["sopranoI"] = {}
Kaes["sopranoI"]["B"] = 1.1484649510646
Kaes["sopranoI"]["gainV"] = 1
Kaes["sopranoI"]["areas"] = {}
Kaes["sopranoI"]["areas"][1] = 1
Kaes["sopranoI"]["areas"][2] = 0.032695607653182
Kaes["sopranoI"]["areas"][3] = 0.23663896572614
Kaes["sopranoI"]["areas"][4] = 0.008597501510831
Kaes["sopranoI"]["areas"][5] = 0.057458337583618
Kaes["sopranoI"]["areas"][6] = 0.0084260719088635
Kaes["sopranoI"]["areas"][7] = 0.0920227250182
Kaes["sopranoI"]["areas"][8] = 0.025057824733585
Kaes["sopranoI"]["areas"][9] = 0.26322021454602
Kaes["sopranoI"]["areas"][10] = 0.085561625851881
Kaes["sopranoI"]["areas"][11] = 1.3189717438239
Kaes["sopranoI"]["kaes"] = {}
Kaes["sopranoI"]["kaes"][1] = -0.9366790999964
Kaes["sopranoI"]["kaes"][2] = 0.75721195208657
Kaes["sopranoI"]["kaes"][3] = -0.92988398823636
Kaes["sopranoI"]["kaes"][4] = 0.73968988574839
Kaes["sopranoI"]["kaes"][5] = -0.74421651575021
Kaes["sopranoI"]["kaes"][6] = 0.83223150168774
Kaes["sopranoI"]["kaes"][7] = -0.57195580672095
Kaes["sopranoI"]["kaes"][8] = 0.8261551605096
Kaes["sopranoI"]["kaes"][9] = -0.50936880340863
Kaes["sopranoI"]["kaes"][10] = 0.87816362686829
Kaes["sopranoI"]["A"] = {}
Kaes["sopranoI"]["A"][1] = -6.0243893213245
Kaes["sopranoI"]["A"][2] = 18.56664996853
Kaes["sopranoI"]["A"][3] = -37.89870905618
Kaes["sopranoI"]["A"][4] = 56.29625285229
Kaes["sopranoI"]["A"][5] = -63.396909492451
Kaes["sopranoI"]["A"][6] = 54.74047386732
Kaes["sopranoI"]["A"][7] = -35.844602158214
Kaes["sopranoI"]["A"][8] = 17.094609176149
Kaes["sopranoI"]["A"][9] = -5.4069577488877
Kaes["sopranoI"]["A"][10] = 0.87816362686829
Kaes["sopranoI"]["Gain"] = 1.1484649510646
Kaes["sopranoI"]["gainN"] = 0
Kaes["sopranoE"] = {}
Kaes["sopranoE"]["B"] = 1.6448335311719
Kaes["sopranoE"]["gainV"] = 1
Kaes["sopranoE"]["areas"] = {}
Kaes["sopranoE"]["areas"][1] = 1
Kaes["sopranoE"]["areas"][2] = 0.028144848050475
Kaes["sopranoE"]["areas"][3] = 0.47611756129442
Kaes["sopranoE"]["areas"][4] = 0.018133755680144
Kaes["sopranoE"]["areas"][5] = 0.23882509598247
Kaes["sopranoE"]["areas"][6] = 0.035486317177525
Kaes["sopranoE"]["areas"][7] = 0.40039331517129
Kaes["sopranoE"]["areas"][8] = 0.090177248565829
Kaes["sopranoE"]["areas"][9] = 0.68405879146066
Kaes["sopranoE"]["areas"][10] = 0.22060097592811
Kaes["sopranoE"]["areas"][11] = 2.7054773452673
Kaes["sopranoE"]["kaes"] = {}
Kaes["sopranoE"]["kaes"][1] = -0.94525120054078
Kaes["sopranoE"]["kaes"][2] = 0.88837221443082
Kaes["sopranoE"]["kaes"][3] = -0.92662131568553
Kaes["sopranoE"]["kaes"][4] = 0.85885868058008
Kaes["sopranoE"]["kaes"][5] = -0.74126984532848
Kaes["sopranoE"]["kaes"][6] = 0.83717377668555
Kaes["sopranoE"]["kaes"][7] = -0.63235768620576
Kaes["sopranoE"]["kaes"][8] = 0.76705489307177
Kaes["sopranoE"]["kaes"][9] = -0.51230068169195
Kaes["sopranoE"]["kaes"][10] = 0.84921731292689
Kaes["sopranoE"]["A"] = {}
Kaes["sopranoE"]["A"][1] = -6.5036888934549
Kaes["sopranoE"]["A"][2] = 20.899967319323
Kaes["sopranoE"]["A"][3] = -43.585317693824
Kaes["sopranoE"]["A"][4] = 65.302780780538
Kaes["sopranoE"]["A"][5] = -73.481058627953
Kaes["sopranoE"]["A"][6] = 62.91661769091
Kaes["sopranoE"]["A"][7] = -40.501932630146
Kaes["sopranoE"]["A"][8] = 18.773232000039
Kaes["sopranoE"]["A"][9] = -5.6658899824527
Kaes["sopranoE"]["A"][10] = 0.84921731292689
Kaes["sopranoE"]["Gain"] = 1.6448335311719
Kaes["sopranoE"]["gainN"] = 0
Kaes["jjj"] = {}
Kaes["jjj"]["B"] = 5.2091024055613
Kaes["jjj"]["gainV"] = 1
Kaes["jjj"]["areas"] = {}
Kaes["jjj"]["areas"][1] = 1
Kaes["jjj"]["areas"][2] = 0.45081275453368
Kaes["jjj"]["areas"][3] = 1.8244409574397
Kaes["jjj"]["areas"][4] = 1.2970773725668
Kaes["jjj"]["areas"][5] = 7.4203439386635
Kaes["jjj"]["areas"][6] = 8.3454675244331
Kaes["jjj"]["areas"][7] = 17.872286364986
Kaes["jjj"]["areas"][8] = 18.278252019834
Kaes["jjj"]["areas"][9] = 27.134747871624
Kaes["jjj"]["kaes"] = {}
Kaes["jjj"]["kaes"][1] = -0.37853764639865
Kaes["jjj"]["kaes"][2] = 0.60372528816342
Kaes["jjj"]["kaes"][3] = -0.16894457412068
Kaes["jjj"]["kaes"][4] = 0.70241718823528
Kaes["jjj"]["kaes"][5] = 0.058679097357912
Kaes["jjj"]["kaes"][6] = 0.36337280763009
Kaes["jjj"]["kaes"][7] = 0.011229864698718
Kaes["jjj"]["kaes"][8] = 0.195021158544
Kaes["jjj"]["A"] = {}
Kaes["jjj"]["A"][1] = -0.7589257968483
Kaes["jjj"]["A"][2] = 1.4674841079714
Kaes["jjj"]["A"][3] = -0.84231919490837
Kaes["jjj"]["A"][4] = 1.2755771892404
Kaes["jjj"]["A"][5] = -0.36761942086952
Kaes["jjj"]["A"][6] = 0.62747677759946
Kaes["jjj"]["A"][7] = -0.13720383172872
Kaes["jjj"]["A"][8] = 0.195021158544
Kaes["jjj"]["Gain"] = 5.2091024055613
Kaes["jjj"]["gainN"] = 0.1
Kaes["altoE"] = {}
Kaes["altoE"]["B"] = 0.80469982784526
Kaes["altoE"]["gainV"] = 1
Kaes["altoE"]["areas"] = {}
Kaes["altoE"]["areas"][1] = 1
Kaes["altoE"]["areas"][2] = 0.022930406367989
Kaes["altoE"]["areas"][3] = 0.2968615918143
Kaes["altoE"]["areas"][4] = 0.017204081571361
Kaes["altoE"]["areas"][5] = 0.25616222312968
Kaes["altoE"]["areas"][6] = 0.017116415418041
Kaes["altoE"]["areas"][7] = 0.14077443815065
Kaes["altoE"]["areas"][8] = 0.029671335618707
Kaes["altoE"]["areas"][9] = 0.19409779625898
Kaes["altoE"]["areas"][10] = 0.056136765769831
Kaes["altoE"]["areas"][11] = 0.6475418129342
Kaes["altoE"]["kaes"] = {}
Kaes["altoE"]["kaes"][1] = -0.95516722110274
Kaes["altoE"]["kaes"][2] = 0.85659174401908
Kaes["altoE"]["kaes"][3] = -0.89044277659574
Kaes["altoE"]["kaes"][4] = 0.87413165942177
Kaes["altoE"]["kaes"][5] = -0.87473286965273
Kaes["altoE"]["kaes"][6] = 0.78318673905205
Kaes["altoE"]["kaes"][7] = -0.65183841215262
Kaes["altoE"]["kaes"][8] = 0.73480403333803
Kaes["altoE"]["kaes"][9] = -0.55132684058754
Kaes["altoE"]["kaes"][10] = 0.84044770590226
Kaes["altoE"]["A"] = {}
Kaes["altoE"]["A"][1] = -6.6221398676238
Kaes["altoE"]["A"][2] = 21.527960855772
Kaes["altoE"]["A"][3] = -45.20129244844
Kaes["altoE"]["A"][4] = 67.929258950317
Kaes["altoE"]["A"][5] = -76.459120641914
Kaes["altoE"]["A"][6] = 65.342282608608
Kaes["altoE"]["A"][7] = -41.868427631929
Kaes["altoE"]["A"][8] = 19.240392584474
Kaes["altoE"]["A"][9] = -5.7274580930376
Kaes["altoE"]["A"][10] = 0.84044770590226
Kaes["altoE"]["Gain"] = 0.80469982784526
Kaes["altoE"]["gainN"] = 0
Kaes["ddd"] = {}
Kaes["ddd"]["B"] = 0.17030463396438
Kaes["ddd"]["gainV"] = 1
Kaes["ddd"]["areas"] = {}
Kaes["ddd"]["areas"][1] = 1
Kaes["ddd"]["areas"][2] = 0.0051219935739476
Kaes["ddd"]["areas"][3] = 0.019240928187052
Kaes["ddd"]["areas"][4] = 0.013625465757005
Kaes["ddd"]["areas"][5] = 0.023728360156169
Kaes["ddd"]["areas"][6] = 0.024946170122049
Kaes["ddd"]["areas"][7] = 0.02805718295791
Kaes["ddd"]["areas"][8] = 0.028537584204056
Kaes["ddd"]["areas"][9] = 0.029003668349742
Kaes["ddd"]["kaes"] = {}
Kaes["ddd"]["kaes"][1] = -0.98980821510882
Kaes["ddd"]["kaes"][2] = 0.57952550813121
Kaes["ddd"]["kaes"][3] = -0.17085727261729
Kaes["ddd"]["kaes"][4] = 0.27046478244685
Kaes["ddd"]["kaes"][5] = 0.025019449780391
Kaes["ddd"]["kaes"][6] = 0.058694642038359
Kaes["ddd"]["kaes"][7] = 0.0084884393069781
Kaes["ddd"]["kaes"][8] = 0.0081
Kaes["ddd"]["A"] = {}
Kaes["ddd"]["A"][1] = -1.6998519767659
Kaes["ddd"]["A"][2] = 1.0732013366061
Kaes["ddd"]["A"][3] = -0.62648921115727
Kaes["ddd"]["A"][4] = 0.28690913274862
Kaes["ddd"]["A"][5] = -0.070830317941863
Kaes["ddd"]["A"][6] = 0.05295076578762
Kaes["ddd"]["A"][7] = -0.005280918631329
Kaes["ddd"]["A"][8] = 0.0081
Kaes["ddd"]["Gain"] = 0.17030463396438
Kaes["ddd"]["gainN"] = 0.1
Kaes["bbb"] = {}
Kaes["bbb"]["B"] = 6.5315309590235
Kaes["bbb"]["gainV"] = 1
Kaes["bbb"]["areas"] = {}
Kaes["bbb"]["areas"][1] = 1
Kaes["bbb"]["areas"][2] = 3.6941052012855
Kaes["bbb"]["areas"][3] = 18.377737286937
Kaes["bbb"]["areas"][4] = 24.113384512943
Kaes["bbb"]["areas"][5] = 36.759568430156
Kaes["bbb"]["areas"][6] = 27.345544110955
Kaes["bbb"]["areas"][7] = 38.194438860112
Kaes["bbb"]["areas"][8] = 31.049350222855
Kaes["bbb"]["areas"][9] = 42.660896668683
Kaes["bbb"]["kaes"] = {}
Kaes["bbb"]["kaes"][1] = 0.57393370743965
Kaes["bbb"]["kaes"][2] = 0.66526535306178
Kaes["bbb"]["kaes"][3] = 0.13498460344305
Kaes["bbb"]["kaes"][4] = 0.20774717351126
Kaes["bbb"]["kaes"][5] = -0.14685294114668
Kaes["bbb"]["kaes"][6] = 0.16553093634379
Kaes["bbb"]["kaes"][7] = -0.10318742997579
Kaes["bbb"]["kaes"][8] = 0.15752961
Kaes["bbb"]["A"] = {}
Kaes["bbb"]["A"][1] = 0.98544239185213
Kaes["bbb"]["A"][2] = 0.92270837555598
Kaes["bbb"]["A"][3] = 0.21480981279112
Kaes["bbb"]["A"][4] = 0.20245361142639
Kaes["bbb"]["A"][5] = -0.033151012337579
Kaes["bbb"]["A"][6] = 0.20426071915135
Kaes["bbb"]["A"][7] = 0.054609581410089
Kaes["bbb"]["A"][8] = 0.15752961
Kaes["bbb"]["Gain"] = 6.5315309590235
Kaes["bbb"]["gainN"] = 0.1
Kaes["counterTenorU"] = {}
Kaes["counterTenorU"]["B"] = 1.2569354394343
Kaes["counterTenorU"]["gainV"] = 1
Kaes["counterTenorU"]["areas"] = {}
Kaes["counterTenorU"]["areas"][1] = 1
Kaes["counterTenorU"]["areas"][2] = 0.0049449723450861
Kaes["counterTenorU"]["areas"][3] = 0.14380782741095
Kaes["counterTenorU"]["areas"][4] = 0.021179033961046
Kaes["counterTenorU"]["areas"][5] = 2.2881013813967
Kaes["counterTenorU"]["areas"][6] = 0.13615310681192
Kaes["counterTenorU"]["areas"][7] = 1.0211240867425
Kaes["counterTenorU"]["areas"][8] = 0.031835922175597
Kaes["counterTenorU"]["areas"][9] = 0.6004742443066
Kaes["counterTenorU"]["areas"][10] = 0.098912573072751
Kaes["counterTenorU"]["areas"][11] = 1.5798866989059
Kaes["counterTenorU"]["kaes"] = {}
Kaes["counterTenorU"]["kaes"][1] = -0.99015872016645
Kaes["counterTenorU"]["kaes"][2] = 0.93351422826063
Kaes["counterTenorU"]["kaes"][3] = -0.74326399344862
Kaes["counterTenorU"]["kaes"][4] = 0.98165746020258
Kaes["counterTenorU"]["kaes"][5] = -0.88767424585649
Kaes["counterTenorU"]["kaes"][6] = 0.76470095916477
Kaes["counterTenorU"]["kaes"][7] = -0.93953061482685
Kaes["counterTenorU"]["kaes"][8] = 0.89930282996172
Kaes["counterTenorU"]["kaes"][9] = -0.71714487429608
Kaes["counterTenorU"]["kaes"][10] = 0.88216271626545
Kaes["counterTenorU"]["A"] = {}
Kaes["counterTenorU"]["A"][1] = -7.7291129121762
Kaes["counterTenorU"]["A"][2] = 28.45945447765
Kaes["counterTenorU"]["A"][3] = -65.64073074206
Kaes["counterTenorU"]["A"][4] = 104.82116904395
Kaes["counterTenorU"]["A"][5] = -120.95406550439
Kaes["counterTenorU"]["A"][6] = 102.10856733998
Kaes["counterTenorU"]["A"][7] = -62.301411196137
Kaes["counterTenorU"]["A"][8] = 26.331474152612
Kaes["counterTenorU"]["A"][9] = -6.9773900438809
Kaes["counterTenorU"]["A"][10] = 0.88216271626545
Kaes["counterTenorU"]["Gain"] = 1.2569354394343
Kaes["counterTenorU"]["gainN"] = 0
Kaes["bassO"] = {}
Kaes["bassO"]["B"] = 1.2772122659485
Kaes["bassO"]["gainV"] = 1
Kaes["bassO"]["areas"] = {}
Kaes["bassO"]["areas"][1] = 1
Kaes["bassO"]["areas"][2] = 0.010849446644779
Kaes["bassO"]["areas"][3] = 0.15463621729789
Kaes["bassO"]["areas"][4] = 0.0092184028988996
Kaes["bassO"]["areas"][5] = 1.3361717600793
Kaes["bassO"]["areas"][6] = 0.095606425482711
Kaes["bassO"]["areas"][7] = 1.4118605667827
Kaes["bassO"]["areas"][8] = 0.036360698113394
Kaes["bassO"]["areas"][9] = 0.91906210266819
Kaes["bassO"]["areas"][10] = 0.10675889729595
Kaes["bassO"]["areas"][11] = 1.6312711722893
Kaes["bassO"]["kaes"] = {}
Kaes["bassO"]["kaes"][1] = -0.97853400092211
Kaes["bassO"]["kaes"][2] = 0.86887750411374
Kaes["bassO"]["kaes"][3] = -0.88748070835197
Kaes["bassO"]["kaes"][4] = 0.98629631291715
Kaes["bassO"]["kaes"][5] = -0.86645078623658
Kaes["bassO"]["kaes"][6] = 0.87315619383608
Kaes["bassO"]["kaes"][7] = -0.94978571438667
Kaes["bassO"]["kaes"][8] = 0.92388563872738
Kaes["bassO"]["kaes"][9] = -0.79185667421572
Kaes["bassO"]["kaes"][10] = 0.87714953939614
Kaes["bassO"]["A"] = {}
Kaes["bassO"]["A"][1] = -8.2192816280527
Kaes["bassO"]["A"][2] = 31.722851016055
Kaes["bassO"]["A"][3] = -75.604889642431
Kaes["bassO"]["A"][4] = 123.07490030947
Kaes["bassO"]["A"][5] = -142.89114149125
Kaes["bassO"]["A"][6] = 119.80525407239
Kaes["bassO"]["A"][7] = -71.651834616856
Kaes["bassO"]["A"][8] = 29.279225223823
Kaes["bassO"]["A"][9] = -7.3921481209883
Kaes["bassO"]["A"][10] = 0.87714953939614
Kaes["bassO"]["Gain"] = 1.2772122659485
Kaes["bassO"]["gainN"] = 0
Kaes["hah"] = {}
Kaes["hah"]["B"] = 1.2312038153527
Kaes["hah"]["gainV"] = 0
Kaes["hah"]["areas"] = {}
Kaes["hah"]["areas"][1] = 1
Kaes["hah"]["areas"][2] = 0.019583397643653
Kaes["hah"]["areas"][3] = 4.4262038252224
Kaes["hah"]["areas"][4] = 0.12228888001062
Kaes["hah"]["areas"][5] = 2.6867643101507
Kaes["hah"]["areas"][6] = 0.26062115828215
Kaes["hah"]["areas"][7] = 3.1658775019503
Kaes["hah"]["areas"][8] = 0.76252795653433
Kaes["hah"]["areas"][9] = 1.5158628349391
Kaes["hah"]["kaes"] = {}
Kaes["hah"]["kaes"][1] = -0.96158549131162
Kaes["hah"]["kaes"][2] = 0.99119013274278
Kaes["hah"]["kaes"][3] = -0.94622883318251
Kaes["hah"]["kaes"][4] = 0.91293231439053
Kaes["hah"]["kaes"][5] = -0.82315095119151
Kaes["hah"]["kaes"][6] = 0.84787902513613
Kaes["hah"]["kaes"][7] = -0.61178754861598
Kaes["hah"]["kaes"][8] = 0.330643400256
Kaes["hah"]["A"] = {}
Kaes["hah"]["A"][1] = -5.8868539780957
Kaes["hah"]["A"][2] = 15.798768956258
Kaes["hah"]["A"][3] = -25.325759157617
Kaes["hah"]["A"][4] = 26.612464968793
Kaes["hah"]["A"][5] = -18.830416773123
Kaes["hah"]["A"][6] = 8.793834042051
Kaes["hah"]["A"][7] = -2.4913532554267
Kaes["hah"]["A"][8] = 0.330643400256
Kaes["hah"]["Gain"] = 1.2312038153527
Kaes["hah"]["gainN"] = 0.1
Kaes["rrr"] = {}
Kaes["rrr"]["B"] = 0.38075503524427
Kaes["rrr"]["gainV"] = 1
Kaes["rrr"]["areas"] = {}
Kaes["rrr"]["areas"][1] = 1
Kaes["rrr"]["areas"][2] = 0.012253558833659
Kaes["rrr"]["areas"][3] = 0.57326409885709
Kaes["rrr"]["areas"][4] = 0.008531363629407
Kaes["rrr"]["areas"][5] = 0.31010868411733
Kaes["rrr"]["areas"][6] = 0.026084683042289
Kaes["rrr"]["areas"][7] = 0.57193289271306
Kaes["rrr"]["areas"][8] = 0.050279659082831
Kaes["rrr"]["areas"][9] = 0.14497439686386
Kaes["rrr"]["kaes"] = {}
Kaes["rrr"]["kaes"][1] = -0.97578954654844
Kaes["rrr"]["kaes"][2] = 0.95814452844347
Kaes["rrr"]["kaes"][3] = -0.97067229231062
Kaes["rrr"]["kaes"][4] = 0.94645140377215
Kaes["rrr"]["kaes"][5] = -0.84482333329376
Kaes["rrr"]["kaes"][6] = 0.91276282136243
Kaes["rrr"]["kaes"][7] = -0.838384298299
Kaes["rrr"]["kaes"][8] = 0.48498218037982
Kaes["rrr"]["A"] = {}
Kaes["rrr"]["A"][1] = -6.5020304824074
Kaes["rrr"]["A"][2] = 19.13648219724
Kaes["rrr"]["A"][3] = -33.299723133925
Kaes["rrr"]["A"][4] = 37.462426503169
Kaes["rrr"]["A"][5] = -27.88397175925
Kaes["rrr"]["A"][6] = 13.396586037884
Kaes["rrr"]["A"][7] = -3.7945587632185
Kaes["rrr"]["A"][8] = 0.48498218037982
Kaes["rrr"]["Gain"] = 0.38075503524427
Kaes["rrr"]["gainN"] = 0
Kaes["sopranoU"] = {}
Kaes["sopranoU"]["B"] = 0.79551314613079
Kaes["sopranoU"]["gainV"] = 1
Kaes["sopranoU"]["areas"] = {}
Kaes["sopranoU"]["areas"][1] = 1
Kaes["sopranoU"]["areas"][2] = 0.0035944513882878
Kaes["sopranoU"]["areas"][3] = 0.95096074987092
Kaes["sopranoU"]["areas"][4] = 0.062889344398985
Kaes["sopranoU"]["areas"][5] = 0.37522797897106
Kaes["sopranoU"]["areas"][6] = 0.027706640795476
Kaes["sopranoU"]["areas"][7] = 0.15402814257039
Kaes["sopranoU"]["areas"][8] = 0.026095624308807
Kaes["sopranoU"]["areas"][9] = 0.18931608989898
Kaes["sopranoU"]["areas"][10] = 0.059333846190358
Kaes["sopranoU"]["areas"][11] = 0.6328411656669
Kaes["sopranoU"]["kaes"] = {}
Kaes["sopranoU"]["kaes"][1] = -0.99283684483645
Kaes["sopranoU"]["kaes"][2] = 0.99246884541921
Kaes["sopranoU"]["kaes"][3] = -0.87593955999132
Kaes["sopranoU"]["kaes"][4] = 0.71291094396709
Kaes["sopranoU"]["kaes"][5] = -0.86247574948249
Kaes["sopranoU"]["kaes"][6] = 0.69508709029358
Kaes["sopranoU"]["kaes"][7] = -0.71024785056479
Kaes["sopranoU"]["kaes"][8] = 0.75771397201142
Kaes["sopranoU"]["kaes"][9] = -0.52275196910535
Kaes["sopranoU"]["kaes"][10] = 0.82855825427401
Kaes["sopranoU"]["A"] = {}
Kaes["sopranoU"]["A"][1] = -6.5474460257511
Kaes["sopranoU"]["A"][2] = 20.957978804771
Kaes["sopranoU"]["A"][3] = -43.511071428475
Kaes["sopranoU"]["A"][4] = 64.967883333788
Kaes["sopranoU"]["A"][5] = -72.902634103086
Kaes["sopranoU"]["A"][6] = 62.289593662072
Kaes["sopranoU"]["A"][7] = -40.033263842873
Kaes["sopranoU"]["A"][8] = 18.5395341877
Kaes["sopranoU"]["A"][9] = -5.5888186012226
Kaes["sopranoU"]["A"][10] = 0.82855825427401
Kaes["sopranoU"]["Gain"] = 0.79551314613079
Kaes["sopranoU"]["gainN"] = 0
Kaes["bassA"] = {}
Kaes["bassA"]["B"] = 2.6356366888053
Kaes["bassA"]["gainV"] = 1
Kaes["bassA"]["areas"] = {}
Kaes["bassA"]["areas"][1] = 1
Kaes["bassA"]["areas"][2] = 0.045840174633543
Kaes["bassA"]["areas"][3] = 0.88840137107546
Kaes["bassA"]["areas"][4] = 0.03091189595562
Kaes["bassA"]["areas"][5] = 2.6794740040923
Kaes["bassA"]["areas"][6] = 0.18947155081256
Kaes["bassA"]["areas"][7] = 4.2127406094145
Kaes["bassA"]["areas"][8] = 0.14601351325113
Kaes["bassA"]["areas"][9] = 4.6160434766295
Kaes["bassA"]["areas"][10] = 0.48417647341453
Kaes["bassA"]["areas"][11] = 6.9465807553765
Kaes["bassA"]["kaes"] = {}
Kaes["bassA"]["kaes"][1] = -0.91233808808386
Kaes["bassA"]["kaes"][2] = 0.90186654651768
Kaes["bassA"]["kaes"][3] = -0.93275002751685
Kaes["bassA"]["kaes"][4] = 0.97719004075761
Kaes["bassA"]["kaes"][5] = -0.86791554793459
Kaes["bassA"]["kaes"][6] = 0.91391984578827
Kaes["bassA"]["kaes"][7] = -0.93300217945681
Kaes["bassA"]["kaes"][8] = 0.93867628482338
Kaes["bassA"]["kaes"][9] = -0.81013506156324
Kaes["bassA"]["kaes"][10] = 0.86968314035653
Kaes["bassA"]["A"] = {}
Kaes["bassA"]["A"][1] = -8.3226506474738
Kaes["bassA"]["A"][2] = 32.447076202684
Kaes["bassA"]["A"][3] = -77.879364329045
Kaes["bassA"]["A"][4] = 127.27725705293
Kaes["bassA"]["A"][5] = -147.88513833134
Kaes["bassA"]["A"][6] = 123.69641521097
Kaes["bassA"]["A"][7] = -73.56857673556
Kaes["bassA"]["A"][8] = 29.801016192192
Kaes["bassA"]["A"][9] = -7.4354593597595
Kaes["bassA"]["A"][10] = 0.86968314035653
Kaes["bassA"]["Gain"] = 2.6356366888053
Kaes["bassA"]["gainN"] = 0
Kaes["sopranoO"] = {}
Kaes["sopranoO"]["B"] = 1.1408076017776
Kaes["sopranoO"]["gainV"] = 1
Kaes["sopranoO"]["areas"] = {}
Kaes["sopranoO"]["areas"][1] = 1
Kaes["sopranoO"]["areas"][2] = 0.0065874434898451
Kaes["sopranoO"]["areas"][3] = 0.96211190539907
Kaes["sopranoO"]["areas"][4] = 0.13562862648631
Kaes["sopranoO"]["areas"][5] = 1.33109318699
Kaes["sopranoO"]["areas"][6] = 0.10993614410269
Kaes["sopranoO"]["areas"][7] = 0.49668983080441
Kaes["sopranoO"]["areas"][8] = 0.063069267758133
Kaes["sopranoO"]["areas"][9] = 0.35712855480716
Kaes["sopranoO"]["areas"][10] = 0.095322384786379
Kaes["sopranoO"]["areas"][11] = 1.3014419842735
Kaes["sopranoO"]["kaes"] = {}
Kaes["sopranoO"]["kaes"][1] = -0.98691133386881
Kaes["sopranoO"]["kaes"][2] = 0.9863994055588
Kaes["sopranoO"]["kaes"][3] = -0.75289492817877
Kaes["sopranoO"]["kaes"][4] = 0.81505882677936
Kaes["sopranoO"]["kaes"][5] = -0.84741997719181
Kaes["sopranoO"]["kaes"][6] = 0.63754884014147
Kaes["sopranoO"]["kaes"][7] = -0.77465567627183
Kaes["sopranoO"]["kaes"][8] = 0.69981154412892
Kaes["sopranoO"]["kaes"][9] = -0.57863990791129
Kaes["sopranoO"]["kaes"][10] = 0.86350971302262
Kaes["sopranoO"]["A"] = {}
Kaes["sopranoO"]["A"][1] = -6.4882714905303
Kaes["sopranoO"]["A"][2] = 20.717095554302
Kaes["sopranoO"]["A"][3] = -43.072871963077
Kaes["sopranoO"]["A"][4] = 64.540692870436
Kaes["sopranoO"]["A"][5] = -72.775891755855
Kaes["sopranoO"]["A"][6] = 62.548636410717
Kaes["sopranoO"]["A"][7] = -40.471362433898
Kaes["sopranoO"]["A"][8] = 18.889202484668
Kaes["sopranoO"]["A"][9] = -5.7498630778502
Kaes["sopranoO"]["A"][10] = 0.86350971302262
Kaes["sopranoO"]["Gain"] = 1.1408076017776
Kaes["sopranoO"]["gainN"] = 0
Kaes["altoA"] = {}
Kaes["altoA"]["B"] = 3.1549502751566
Kaes["altoA"]["gainV"] = 1
Kaes["altoA"]["areas"] = {}
Kaes["altoA"]["areas"][1] = 1
Kaes["altoA"]["areas"][2] = 0.020273438588239
Kaes["altoA"]["areas"][3] = 1.4105099288369
Kaes["altoA"]["areas"][4] = 0.22637148117455
Kaes["altoA"]["areas"][5] = 5.2289852432765
Kaes["altoA"]["areas"][6] = 0.498842615477
Kaes["altoA"]["areas"][7] = 3.013479823312
Kaes["altoA"]["areas"][8] = 0.54092123789085
Kaes["altoA"]["areas"][9] = 3.2125212900395
Kaes["altoA"]["areas"][10] = 0.79249066269855
Kaes["altoA"]["areas"][11] = 9.9537112387107
Kaes["altoA"]["kaes"] = {}
Kaes["altoA"]["kaes"][1] = -0.96025881333088
Kaes["altoA"]["kaes"][2] = 0.9716610647708
Kaes["altoA"]["kaes"][3] = -0.72341126267301
Kaes["altoA"]["kaes"][4] = 0.91700946698501
Kaes["altoA"]["kaes"][5] = -0.82581787449682
Kaes["altoA"]["kaes"][6] = 0.71594714086159
Kaes["altoA"]["kaes"][7] = -0.69563297524574
Kaes["altoA"]["kaes"][8] = 0.71177326741213
Kaes["altoA"]["kaes"][9] = -0.60425053805057
Kaes["altoA"]["kaes"][10] = 0.85250776600529
Kaes["altoA"]["A"] = {}
Kaes["altoA"]["A"][1] = -6.546502255067
Kaes["altoA"]["A"][2] = 21.110352513729
Kaes["altoA"]["A"][3] = -44.155257692287
Kaes["altoA"]["A"][4] = 66.329108763879
Kaes["altoA"]["A"][5] = -74.791511485876
Kaes["altoA"]["A"][6] = 64.138687375319
Kaes["altoA"]["A"][7] = -41.302586116617
Kaes["altoA"]["A"][8] = 19.115987939305
Kaes["altoA"]["A"][9] = -5.7460436946308
Kaes["altoA"]["A"][10] = 0.85250776600529
Kaes["altoA"]["Gain"] = 3.1549502751566
Kaes["altoA"]["gainN"] = 0
Kaes["xxx"] = {}
Kaes["xxx"]["B"] = 2.6327262852316
Kaes["xxx"]["gainV"] = 0
Kaes["xxx"]["areas"] = {}
Kaes["xxx"]["areas"][1] = 1
Kaes["xxx"]["areas"][2] = 1.8848538634118
Kaes["xxx"]["areas"][3] = 3.3533245027696
Kaes["xxx"]["areas"][4] = 1.6434194963207
Kaes["xxx"]["areas"][5] = 5.387534648947
Kaes["xxx"]["areas"][6] = 6.6380074530284
Kaes["xxx"]["areas"][7] = 8.7100847167746
Kaes["xxx"]["areas"][8] = 6.5673425705578
Kaes["xxx"]["areas"][9] = 6.9312476929493
Kaes["xxx"]["kaes"] = {}
Kaes["xxx"]["kaes"][1] = 0.30672398163189
Kaes["xxx"]["kaes"][2] = 0.28033994581752
Kaes["xxx"]["kaes"][3] = -0.34220384449557
Kaes["xxx"]["kaes"][4] = 0.53251878411784
Kaes["xxx"]["kaes"][5] = 0.1039847346155
Kaes["xxx"]["kaes"][6] = 0.13500552647338
Kaes["xxx"]["kaes"][7] = -0.1402554308338
Kaes["xxx"]["kaes"][8] = 0.02695875015744
Kaes["xxx"]["A"] = {}
Kaes["xxx"]["A"][1] = 0.16124355249552
Kaes["xxx"]["A"][2] = 0.26316818793945
Kaes["xxx"]["A"][3] = -0.26049002243106
Kaes["xxx"]["A"][4] = 0.61376871435295
Kaes["xxx"]["A"][5] = 0.08084400094063
Kaes["xxx"]["A"][6] = 0.11621946704135
Kaes["xxx"]["A"][7] = -0.13580657215762
Kaes["xxx"]["A"][8] = 0.02695875015744
Kaes["xxx"]["Gain"] = 2.6327262852316
Kaes["xxx"]["gainN"] = 0.7
Kaes["sss"] = {}
Kaes["sss"]["B"] = 0.78267212717021
Kaes["sss"]["gainV"] = 0
Kaes["sss"]["areas"] = {}
Kaes["sss"]["areas"][1] = 1
Kaes["sss"]["areas"][2] = 0.16818238936103
Kaes["sss"]["areas"][3] = 0.53610066476099
Kaes["sss"]["areas"][4] = 0.28750183286597
Kaes["sss"]["areas"][5] = 0.8171423147754
Kaes["sss"]["areas"][6] = 0.43404810051461
Kaes["sss"]["areas"][7] = 0.78059668129571
Kaes["sss"]["areas"][8] = 0.50598194043927
Kaes["sss"]["areas"][9] = 0.61257565864914
Kaes["sss"]["kaes"] = {}
Kaes["sss"]["kaes"][1] = -0.71206141970173
Kaes["sss"]["kaes"][2] = 0.5224011471618
Kaes["sss"]["kaes"][3] = -0.30184322244203
Kaes["sss"]["kaes"][4] = 0.47946706008475
Kaes["sss"]["kaes"][5] = -0.30618378272342
Kaes["sss"]["kaes"][6] = 0.28530858236973
Kaes["sss"]["kaes"][7] = -0.21344575155937
Kaes["sss"]["kaes"][8] = 0.09529569
Kaes["sss"]["A"] = {}
Kaes["sss"]["A"][1] = -1.7018505144452
Kaes["sss"]["A"][2] = 2.0084748207975
Kaes["sss"]["A"][3] = -2.0413544671191
Kaes["sss"]["A"][4] = 1.8540152267006
Kaes["sss"]["A"][5] = -1.3099266992069
Kaes["sss"]["A"][6] = 0.81688806381868
Kaes["sss"]["A"][7] = -0.37368641242323
Kaes["sss"]["A"][8] = 0.09529569
Kaes["sss"]["Gain"] = 0.78267212717021
Kaes["sss"]["gainN"] = 0.7
Kaes["eee"] = {}
Kaes["eee"]["B"] = 0.63711672406145
Kaes["eee"]["gainV"] = 1
Kaes["eee"]["areas"] = {}
Kaes["eee"]["areas"][1] = 1
Kaes["eee"]["areas"][2] = 0.0027277267706031
Kaes["eee"]["areas"][3] = 0.052422003037698
Kaes["eee"]["areas"][4] = 0.0043115302683673
Kaes["eee"]["areas"][5] = 0.29267398105042
Kaes["eee"]["areas"][6] = 0.030146554097609
Kaes["eee"]["areas"][7] = 0.70268887382765
Kaes["eee"]["areas"][8] = 0.29130687173752
Kaes["eee"]["areas"][9] = 0.40591772007879
Kaes["eee"]["kaes"] = {}
Kaes["eee"]["kaes"][1] = -0.99455938696462
Kaes["eee"]["kaes"][2] = 0.90107923356707
Kaes["eee"]["kaes"][3] = -0.84800769431696
Kaes["eee"]["kaes"][4] = 0.97096470969764
Kaes["eee"]["kaes"][5] = -0.81323025758702
Kaes["eee"]["kaes"][6] = 0.91772626445488
Kaes["eee"]["kaes"][7] = -0.41386696464804
Kaes["eee"]["kaes"][8] = 0.16438153456794
Kaes["eee"]["A"] = {}
Kaes["eee"]["A"][1] = -5.4620331827115
Kaes["eee"]["A"][2] = 13.658637075981
Kaes["eee"]["A"][3] = -20.313512407876
Kaes["eee"]["A"][4] = 19.551569476601
Kaes["eee"]["A"][5] = -12.455030382955
Kaes["eee"]["A"][6] = 5.1572864423476
Kaes["eee"]["A"][7] = -1.3005411422624
Kaes["eee"]["A"][8] = 0.16438153456794
Kaes["eee"]["Gain"] = 0.63711672406145
Kaes["eee"]["gainN"] = 0
Kaes["mmm"] = {}
Kaes["mmm"]["B"] = 0.36323298453191
Kaes["mmm"]["gainV"] = 1
Kaes["mmm"]["areas"] = {}
Kaes["mmm"]["areas"][1] = 1
Kaes["mmm"]["areas"][2] = 0.0024227529097224
Kaes["mmm"]["areas"][3] = 0.10871284748118
Kaes["mmm"]["areas"][4] = 0.0074135299357529
Kaes["mmm"]["areas"][5] = 0.21033252318431
Kaes["mmm"]["areas"][6] = 0.013571168615293
Kaes["mmm"]["areas"][7] = 0.17320235260498
Kaes["mmm"]["areas"][8] = 0.021868993619208
Kaes["mmm"]["areas"][9] = 0.13193820105196
Kaes["mmm"]["kaes"] = {}
Kaes["mmm"]["kaes"][1] = -0.9951662052708
Kaes["mmm"]["kaes"][2] = 0.95640005720578
Kaes["mmm"]["kaes"][3] = -0.87231962107737
Kaes["mmm"]["kaes"][4] = 0.93190664235218
Kaes["mmm"]["kaes"][5] = -0.87877673202959
Kaes["mmm"]["kaes"][6] = 0.85467780950291
Kaes["mmm"]["kaes"][7] = -0.77578466502124
Kaes["mmm"]["kaes"][8] = 0.71563107088764
Kaes["mmm"]["A"] = {}
Kaes["mmm"]["A"][1] = -6.3823806004071
Kaes["mmm"]["A"][2] = 18.755383529221
Kaes["mmm"]["A"][3] = -33.1826467943
Kaes["mmm"]["A"][4] = 38.678567623167
Kaes["mmm"]["A"][5] = -30.431898465139
Kaes["mmm"]["A"][6] = 15.793458992363
Kaes["mmm"]["A"][7] = -4.9459136121534
Kaes["mmm"]["A"][8] = 0.71563107088764
Kaes["mmm"]["Gain"] = 0.36323298453191
Kaes["mmm"]["gainN"] = 0
Kaes["bassU"] = {}
Kaes["bassU"]["B"] = 1.1506955865849
Kaes["bassU"]["gainV"] = 1
Kaes["bassU"]["areas"] = {}
Kaes["bassU"]["areas"][1] = 1
Kaes["bassU"]["areas"][2] = 0.0043513551276683
Kaes["bassU"]["areas"][3] = 0.13901900105017
Kaes["bassU"]["areas"][4] = 0.015376792298516
Kaes["bassU"]["areas"][5] = 2.0326132089989
Kaes["bassU"]["areas"][6] = 0.1174799030293
Kaes["bassU"]["areas"][7] = 1.4018731748806
Kaes["bassU"]["areas"][8] = 0.031680333561472
Kaes["bassU"]["areas"][9] = 0.72650319023655
Kaes["bassU"]["areas"][10] = 0.08665603479059
Kaes["bassU"]["areas"][11] = 1.324100332986
Kaes["bassU"]["kaes"] = {}
Kaes["bassU"]["kaes"][1] = -0.99133499426181
Kaes["bassU"]["kaes"][2] = 0.93929909580093
Kaes["bassU"]["kaes"][3] = -0.80081332573887
Kaes["bassU"]["kaes"][4] = 0.98498352795788
Kaes["bassU"]["kaes"][5] = -0.89072110191686
Kaes["bassU"]["kaes"][6] = 0.8453553624403
Kaes["bassU"]["kaes"][7] = -0.95580167273156
Kaes["bassU"]["kaes"][8] = 0.91643096277594
Kaes["bassU"]["kaes"][9] = -0.7868657647272
Kaes["bassU"]["kaes"][10] = 0.87714953939614
Kaes["bassU"]["A"] = {}
Kaes["bassU"]["A"][1] = -8.189033109017
Kaes["bassU"]["A"][2] = 31.505982535971
Kaes["bassU"]["A"][3] = -74.911556790843
Kaes["bassU"]["A"][4] = 121.77074080795
Kaes["bassU"]["A"][5] = -141.30678204035
Kaes["bassU"]["A"][6] = 118.53122823178
Kaes["bassU"]["A"][7] = -70.989887227941
Kaes["bassU"]["A"][8] = 29.076668156866
Kaes["bassU"]["A"][9] = -7.364464699372
Kaes["bassU"]["A"][10] = 0.87714953939614
Kaes["bassU"]["Gain"] = 1.1506955865849
Kaes["bassU"]["gainN"] = 0
Kaes["sopranoA"] = {}
Kaes["sopranoA"]["B"] = 4.0387350567239
Kaes["sopranoA"]["gainV"] = 1
Kaes["sopranoA"]["areas"] = {}
Kaes["sopranoA"]["areas"][1] = 1
Kaes["sopranoA"]["areas"][2] = 0.010449873888105
Kaes["sopranoA"]["areas"][3] = 7.4710085536434
Kaes["sopranoA"]["areas"][4] = 0.11716155278292
Kaes["sopranoA"]["areas"][5] = 10.889404179415
Kaes["sopranoA"]["areas"][6] = 2.5072547634096
Kaes["sopranoA"]["areas"][7] = 14.173295919763
Kaes["sopranoA"]["areas"][8] = 1.1205358913809
Kaes["sopranoA"]["areas"][9] = 4.6766713445888
Kaes["sopranoA"]["areas"][10] = 1.1600273307389
Kaes["sopranoA"]["areas"][11] = 16.31138085841
Kaes["sopranoA"]["kaes"] = {}
Kaes["sopranoA"]["kaes"][1] = -0.9793163933053
Kaes["sopranoA"]["kaes"][2] = 0.99720646074844
Kaes["sopranoA"]["kaes"][3] = -0.96911994561543
Kaes["sopranoA"]["kaes"][4] = 0.97871060680805
Kaes["sopranoA"]["kaes"][5] = -0.62568954332416
Kaes["sopranoA"]["kaes"][6] = 0.69937985729225
Kaes["sopranoA"]["kaes"][7] = -0.85346564481448
Kaes["sopranoA"]["kaes"][8] = 0.61342217182496
Kaes["sopranoA"]["kaes"][9] = -0.60250566449749
Kaes["sopranoA"]["kaes"][10] = 0.86720849078905
Kaes["sopranoA"]["A"] = {}
Kaes["sopranoA"]["A"][1] = -6.9332811165646
Kaes["sopranoA"]["A"][2] = 22.955221226149
Kaes["sopranoA"]["A"][3] = -48.571621122112
Kaes["sopranoA"]["A"][4] = 73.419382441755
Kaes["sopranoA"]["A"][5] = -83.041116751213
Kaes["sopranoA"]["A"][6] = 71.17429012851
Kaes["sopranoA"]["A"][7] = -45.66937025802
Kaes["sopranoA"]["A"][8] = 20.96155988879
Kaes["sopranoA"]["A"][9] = -6.1619911915069
Kaes["sopranoA"]["A"][10] = 0.86720849078905
Kaes["sopranoA"]["Gain"] = 4.0387350567239
Kaes["sopranoA"]["gainN"] = 0
Kaes["uuu"] = {}
Kaes["uuu"]["B"] = 0.69574713349508
Kaes["uuu"]["gainV"] = 1
Kaes["uuu"]["areas"] = {}
Kaes["uuu"]["areas"][1] = 1
Kaes["uuu"]["areas"][2] = 0.0083035860973985
Kaes["uuu"]["areas"][3] = 0.6338058685237
Kaes["uuu"]["areas"][4] = 0.057950008283445
Kaes["uuu"]["areas"][5] = 1.0062672826685
Kaes["uuu"]["areas"][6] = 0.057420235905611
Kaes["uuu"]["areas"][7] = 0.66275927872784
Kaes["uuu"]["areas"][8] = 0.075488349651195
Kaes["uuu"]["areas"][9] = 0.48406407376661
Kaes["uuu"]["kaes"] = {}
Kaes["uuu"]["kaes"][1] = -0.98352959126222
Kaes["uuu"]["kaes"][2] = 0.97413654000065
Kaes["uuu"]["kaes"][3] = -0.83245532065179
Kaes["uuu"]["kaes"][4] = 0.89109365394428
Kaes["uuu"]["kaes"][5] = -0.89203551813302
Kaes["uuu"]["kaes"][6] = 0.84053910243521
Kaes["uuu"]["kaes"][7] = -0.79549314688096
Kaes["uuu"]["kaes"][8] = 0.73018310173655
Kaes["uuu"]["A"] = {}
Kaes["uuu"]["A"][1] = -6.288519175598
Kaes["uuu"]["A"][2] = 18.316614832759
Kaes["uuu"]["A"][3] = -32.301527052989
Kaes["uuu"]["A"][4] = 37.713090212735
Kaes["uuu"]["A"][5] = -29.844160212537
Kaes["uuu"]["A"][6] = 15.638175249523
Kaes["uuu"]["A"][7] = -4.9631326011883
Kaes["uuu"]["A"][8] = 0.73018310173655
Kaes["uuu"]["Gain"] = 0.69574713349508
Kaes["uuu"]["gainN"] = 0
Kaes["ngg"] = {}
Kaes["ngg"]["B"] = 0.22768163900126
Kaes["ngg"]["gainV"] = 1
Kaes["ngg"]["areas"] = {}
Kaes["ngg"]["areas"][1] = 1
Kaes["ngg"]["areas"][2] = 0.0038317951746622
Kaes["ngg"]["areas"][3] = 0.056356851629675
Kaes["ngg"]["areas"][4] = 0.0022443160991272
Kaes["ngg"]["areas"][5] = 0.073742361899106
Kaes["ngg"]["areas"][6] = 0.0039524236021426
Kaes["ngg"]["areas"][7] = 0.081403550110509
Kaes["ngg"]["areas"][8] = 0.016298335307413
Kaes["ngg"]["areas"][9] = 0.051838928738298
Kaes["ngg"]["kaes"] = {}
Kaes["ngg"]["kaes"][1] = -0.99236566286686
Kaes["ngg"]["kaes"][2] = 0.87267382212068
Kaes["ngg"]["kaes"][3] = -0.92340370726012
Kaes["ngg"]["kaes"][4] = 0.94092869544371
Kaes["ngg"]["kaes"][5] = -0.89825768675096
Kaes["ngg"]["kaes"][6] = 0.90738964292181
Kaes["ngg"]["kaes"][7] = -0.66636600229983
Kaes["ngg"]["kaes"][8] = 0.52160288395264
Kaes["ngg"]["A"] = {}
Kaes["ngg"]["A"][1] = -6.1455626794867
Kaes["ngg"]["A"][2] = 17.363496534936
Kaes["ngg"]["A"][3] = -29.4501410728
Kaes["ngg"]["A"][4] = 32.814824062861
Kaes["ngg"]["A"][5] = -24.649884412908
Kaes["ngg"]["A"][6] = 12.236485385761
Kaes["ngg"]["A"][7] = -3.6906113086912
Kaes["ngg"]["A"][8] = 0.52160288395264
Kaes["ngg"]["Gain"] = 0.22768163900126
Kaes["ngg"]["gainN"] = 0
Kaes["fff"] = {}
Kaes["fff"]["B"] = 2.6327262852316
Kaes["fff"]["gainV"] = 0
Kaes["fff"]["areas"] = {}
Kaes["fff"]["areas"][1] = 1
Kaes["fff"]["areas"][2] = 1.8848538634118
Kaes["fff"]["areas"][3] = 3.3533245027696
Kaes["fff"]["areas"][4] = 1.6434194963207
Kaes["fff"]["areas"][5] = 5.387534648947
Kaes["fff"]["areas"][6] = 6.6380074530284
Kaes["fff"]["areas"][7] = 8.7100847167746
Kaes["fff"]["areas"][8] = 6.5673425705578
Kaes["fff"]["areas"][9] = 6.9312476929493
Kaes["fff"]["kaes"] = {}
Kaes["fff"]["kaes"][1] = 0.30672398163189
Kaes["fff"]["kaes"][2] = 0.28033994581752
Kaes["fff"]["kaes"][3] = -0.34220384449557
Kaes["fff"]["kaes"][4] = 0.53251878411784
Kaes["fff"]["kaes"][5] = 0.1039847346155
Kaes["fff"]["kaes"][6] = 0.13500552647338
Kaes["fff"]["kaes"][7] = -0.1402554308338
Kaes["fff"]["kaes"][8] = 0.02695875015744
Kaes["fff"]["A"] = {}
Kaes["fff"]["A"][1] = 0.16124355249552
Kaes["fff"]["A"][2] = 0.26316818793945
Kaes["fff"]["A"][3] = -0.26049002243106
Kaes["fff"]["A"][4] = 0.61376871435295
Kaes["fff"]["A"][5] = 0.08084400094063
Kaes["fff"]["A"][6] = 0.11621946704135
Kaes["fff"]["A"][7] = -0.13580657215762
Kaes["fff"]["A"][8] = 0.02695875015744
Kaes["fff"]["Gain"] = 2.6327262852316
Kaes["fff"]["gainN"] = 0.7
Kaes["lll"] = {}
Kaes["lll"]["B"] = 0.64789613580405
Kaes["lll"]["gainV"] = 1
Kaes["lll"]["areas"] = {}
Kaes["lll"]["areas"][1] = 1
Kaes["lll"]["areas"][2] = 0.0042140685399872
Kaes["lll"]["areas"][3] = 2.462344019303
Kaes["lll"]["areas"][4] = 0.13262456603721
Kaes["lll"]["areas"][5] = 0.61045671162672
Kaes["lll"]["areas"][6] = 0.38981076850811
Kaes["lll"]["areas"][7] = 0.42261530407099
Kaes["lll"]["areas"][8] = 0.41963461164237
Kaes["lll"]["areas"][9] = 0.41976940278981
Kaes["lll"]["kaes"] = {}
Kaes["lll"]["kaes"][1] = -0.99160723062541
Kaes["lll"]["kaes"][2] = 0.9965830372609
Kaes["lll"]["kaes"][3] = -0.89778329742684
Kaes["lll"]["kaes"][4] = 0.64304156214472
Kaes["lll"]["kaes"][5] = -0.22058694049402
Kaes["lll"]["kaes"][6] = 0.040378486941886
Kaes["lll"]["kaes"][7] = -0.0035389643537092
Kaes["lll"]["kaes"][8] = 0.000160579584
Kaes["lll"]["A"] = {}
Kaes["lll"]["A"][1] = -3.6027507597002
Kaes["lll"]["A"][2] = 5.2216560522217
Kaes["lll"]["A"][3] = -3.908892831216
Kaes["lll"]["A"][4] = 1.6270497441153
Kaes["lll"]["A"][5] = -0.38479744505928
Kaes["lll"]["A"][6] = 0.053966475720311
Kaes["lll"]["A"][7] = -0.0041174924807025
Kaes["lll"]["A"][8] = 0.000160579584
Kaes["lll"]["Gain"] = 0.64789613580405
Kaes["lll"]["gainN"] = 0
Kaes["ggg"] = {}
Kaes["ggg"]["B"] = 5.2091024055613
Kaes["ggg"]["gainV"] = 1
Kaes["ggg"]["areas"] = {}
Kaes["ggg"]["areas"][1] = 1
Kaes["ggg"]["areas"][2] = 0.45081275453368
Kaes["ggg"]["areas"][3] = 1.8244409574397
Kaes["ggg"]["areas"][4] = 1.2970773725668
Kaes["ggg"]["areas"][5] = 7.4203439386635
Kaes["ggg"]["areas"][6] = 8.3454675244331
Kaes["ggg"]["areas"][7] = 17.872286364986
Kaes["ggg"]["areas"][8] = 18.278252019834
Kaes["ggg"]["areas"][9] = 27.134747871624
Kaes["ggg"]["kaes"] = {}
Kaes["ggg"]["kaes"][1] = -0.37853764639865
Kaes["ggg"]["kaes"][2] = 0.60372528816342
Kaes["ggg"]["kaes"][3] = -0.16894457412068
Kaes["ggg"]["kaes"][4] = 0.70241718823528
Kaes["ggg"]["kaes"][5] = 0.058679097357912
Kaes["ggg"]["kaes"][6] = 0.36337280763009
Kaes["ggg"]["kaes"][7] = 0.011229864698718
Kaes["ggg"]["kaes"][8] = 0.195021158544
Kaes["ggg"]["A"] = {}
Kaes["ggg"]["A"][1] = -0.7589257968483
Kaes["ggg"]["A"][2] = 1.4674841079714
Kaes["ggg"]["A"][3] = -0.84231919490837
Kaes["ggg"]["A"][4] = 1.2755771892404
Kaes["ggg"]["A"][5] = -0.36761942086952
Kaes["ggg"]["A"][6] = 0.62747677759946
Kaes["ggg"]["A"][7] = -0.13720383172872
Kaes["ggg"]["A"][8] = 0.195021158544
Kaes["ggg"]["Gain"] = 5.2091024055613
Kaes["ggg"]["gainN"] = 0.1
Kaes["hee"] = {}
Kaes["hee"]["B"] = 0.63711672406145
Kaes["hee"]["gainV"] = 0
Kaes["hee"]["areas"] = {}
Kaes["hee"]["areas"][1] = 1
Kaes["hee"]["areas"][2] = 0.0027277267706031
Kaes["hee"]["areas"][3] = 0.052422003037698
Kaes["hee"]["areas"][4] = 0.0043115302683673
Kaes["hee"]["areas"][5] = 0.29267398105042
Kaes["hee"]["areas"][6] = 0.030146554097609
Kaes["hee"]["areas"][7] = 0.70268887382765
Kaes["hee"]["areas"][8] = 0.29130687173752
Kaes["hee"]["areas"][9] = 0.40591772007879
Kaes["hee"]["kaes"] = {}
Kaes["hee"]["kaes"][1] = -0.99455938696462
Kaes["hee"]["kaes"][2] = 0.90107923356707
Kaes["hee"]["kaes"][3] = -0.84800769431696
Kaes["hee"]["kaes"][4] = 0.97096470969764
Kaes["hee"]["kaes"][5] = -0.81323025758702
Kaes["hee"]["kaes"][6] = 0.91772626445488
Kaes["hee"]["kaes"][7] = -0.41386696464804
Kaes["hee"]["kaes"][8] = 0.16438153456794
Kaes["hee"]["A"] = {}
Kaes["hee"]["A"][1] = -5.4620331827115
Kaes["hee"]["A"][2] = 13.658637075981
Kaes["hee"]["A"][3] = -20.313512407876
Kaes["hee"]["A"][4] = 19.551569476601
Kaes["hee"]["A"][5] = -12.455030382955
Kaes["hee"]["A"][6] = 5.1572864423476
Kaes["hee"]["A"][7] = -1.3005411422624
Kaes["hee"]["A"][8] = 0.16438153456794
Kaes["hee"]["Gain"] = 0.63711672406145
Kaes["hee"]["gainN"] = 0.1
Kaes["vvv"] = {}
Kaes["vvv"]["B"] = 6.5315309590235
Kaes["vvv"]["gainV"] = 1
Kaes["vvv"]["areas"] = {}
Kaes["vvv"]["areas"][1] = 1
Kaes["vvv"]["areas"][2] = 3.6941052012855
Kaes["vvv"]["areas"][3] = 18.377737286937
Kaes["vvv"]["areas"][4] = 24.113384512943
Kaes["vvv"]["areas"][5] = 36.759568430156
Kaes["vvv"]["areas"][6] = 27.345544110955
Kaes["vvv"]["areas"][7] = 38.194438860112
Kaes["vvv"]["areas"][8] = 31.049350222855
Kaes["vvv"]["areas"][9] = 42.660896668683
Kaes["vvv"]["kaes"] = {}
Kaes["vvv"]["kaes"][1] = 0.57393370743965
Kaes["vvv"]["kaes"][2] = 0.66526535306178
Kaes["vvv"]["kaes"][3] = 0.13498460344305
Kaes["vvv"]["kaes"][4] = 0.20774717351126
Kaes["vvv"]["kaes"][5] = -0.14685294114668
Kaes["vvv"]["kaes"][6] = 0.16553093634379
Kaes["vvv"]["kaes"][7] = -0.10318742997579
Kaes["vvv"]["kaes"][8] = 0.15752961
Kaes["vvv"]["A"] = {}
Kaes["vvv"]["A"][1] = 0.98544239185213
Kaes["vvv"]["A"][2] = 0.92270837555598
Kaes["vvv"]["A"][3] = 0.21480981279112
Kaes["vvv"]["A"][4] = 0.20245361142639
Kaes["vvv"]["A"][5] = -0.033151012337579
Kaes["vvv"]["A"][6] = 0.20426071915135
Kaes["vvv"]["A"][7] = 0.054609581410089
Kaes["vvv"]["A"][8] = 0.15752961
Kaes["vvv"]["Gain"] = 6.5315309590235
Kaes["vvv"]["gainN"] = 1
Kaes["ihh"] = {}
Kaes["ihh"]["B"] = 0.52013974471577
Kaes["ihh"]["gainV"] = 1
Kaes["ihh"]["areas"] = {}
Kaes["ihh"]["areas"][1] = 1
Kaes["ihh"]["areas"][2] = 0.005518664966442
Kaes["ihh"]["areas"][3] = 0.14545429541507
Kaes["ihh"]["areas"][4] = 0.0086610729654448
Kaes["ihh"]["areas"][5] = 0.43680084553079
Kaes["ihh"]["areas"][6] = 0.047559436343503
Kaes["ihh"]["areas"][7] = 0.45553218359518
Kaes["ihh"]["areas"][8] = 0.21834084931823
Kaes["ihh"]["areas"][9] = 0.27054535403298
Kaes["ihh"]["kaes"] = {}
Kaes["ihh"]["kaes"][1] = -0.98902324708885
Kaes["ihh"]["kaes"][2] = 0.92689200831068
Kaes["ihh"]["kaes"][3] = -0.88760273480241
Kaes["ihh"]["kaes"][4] = 0.96111419357829
Kaes["ihh"]["kaes"][5] = -0.80361958598477
Kaes["ihh"]["kaes"][6] = 0.81093131167918
Kaes["ihh"]["kaes"][7] = -0.35198223210013
Kaes["ihh"]["kaes"][8] = 0.10678252803392
Kaes["ihh"]["A"] = {}
Kaes["ihh"]["A"][1] = -5.3286098999821
Kaes["ihh"]["A"][2] = 12.869476068097
Kaes["ihh"]["A"][3] = -18.33039154027
Kaes["ihh"]["A"][4] = 16.777191906855
Kaes["ihh"]["A"][5] = -10.09399779679
Kaes["ihh"]["A"][6] = 3.9177090790059
Kaes["ihh"]["A"][7] = -0.91697118780618
Kaes["ihh"]["A"][8] = 0.10678252803392
Kaes["ihh"]["Gain"] = 0.52013974471577
Kaes["ihh"]["gainN"] = 0
Kaes["bassI"] = {}
Kaes["bassI"]["B"] = 0.58307341666299
Kaes["bassI"]["gainV"] = 1
Kaes["bassI"]["areas"] = {}
Kaes["bassI"]["areas"][1] = 1
Kaes["bassI"]["areas"][2] = 0.074385016760411
Kaes["bassI"]["areas"][3] = 0.82441409742821
Kaes["bassI"]["areas"][4] = 0.01932086270558
Kaes["bassI"]["areas"][5] = 0.19791354148297
Kaes["bassI"]["areas"][6] = 0.0088619191638315
Kaes["bassI"]["areas"][7] = 0.11938314487621
Kaes["bassI"]["areas"][8] = 0.0071308496009337
Kaes["bassI"]["areas"][9] = 0.15305431452888
Kaes["bassI"]["areas"][10] = 0.023696220218092
Kaes["bassI"]["areas"][11] = 0.33997460921905
Kaes["bassI"]["kaes"] = {}
Kaes["bassI"]["kaes"][1] = -0.8615300556132
Kaes["bassI"]["kaes"][2] = 0.83447910531696
Kaes["bassI"]["kaes"][3] = -0.9542015831547
Kaes["bassI"]["kaes"][4] = 0.82211967963592
Kaes["bassI"]["kaes"][5] = -0.91428461446914
Kaes["bassI"]["kaes"][6] = 0.8617971111767
Kaes["bassI"]["kaes"][7] = -0.88727176577731
Kaes["bassI"]["kaes"][8] = 0.91096741524508
Kaes["bassI"]["kaes"][9] = -0.73186819205933
Kaes["bassI"]["kaes"][10] = 0.86968314035653
Kaes["bassI"]["A"] = {}
Kaes["bassI"]["A"][1] = -7.5768926972486
Kaes["bassI"]["A"][2] = 27.592950190234
Kaes["bassI"]["A"][3] = -63.216943082111
Kaes["bassI"]["A"][4] = 100.54327433769
Kaes["bassI"]["A"][5] = -115.7799584572
Kaes["bassI"]["A"][6] = 97.707733557908
Kaes["bassI"]["A"][7] = -59.709475451298
Kaes["bassI"]["A"][8] = 25.337810219071
Kaes["bassI"]["A"][9] = -6.767816424218
Kaes["bassI"]["A"][10] = 0.86968314035653
Kaes["bassI"]["Gain"] = 0.58307341666299
Kaes["bassI"]["gainN"] = 0
Kaes["counterTenorI"] = {}
Kaes["counterTenorI"]["B"] = 0.74069815762061
Kaes["counterTenorI"]["gainV"] = 1
Kaes["counterTenorI"]["areas"] = {}
Kaes["counterTenorI"]["areas"][1] = 1
Kaes["counterTenorI"]["areas"][2] = 0.092363188930231
Kaes["counterTenorI"]["areas"][3] = 0.73092859654942
Kaes["counterTenorI"]["areas"][4] = 0.015110923004894
Kaes["counterTenorI"]["areas"][5] = 0.13665355446417
Kaes["counterTenorI"]["areas"][6] = 0.0087171692369328
Kaes["counterTenorI"]["areas"][7] = 0.12090160543072
Kaes["counterTenorI"]["areas"][8] = 0.008935217004724
Kaes["counterTenorI"]["areas"][9] = 0.18771959605959
Kaes["counterTenorI"]["areas"][10] = 0.036683705612251
Kaes["counterTenorI"]["areas"][11] = 0.54863376070256
Kaes["counterTenorI"]["kaes"] = {}
Kaes["counterTenorI"]["kaes"][1] = -0.8308928937441
Kaes["counterTenorI"]["kaes"][2] = 0.77562465565858
Kaes["counterTenorI"]["kaes"][3] = -0.95949028809112
Kaes["counterTenorI"]["kaes"][4] = 0.80086350565172
Kaes["counterTenorI"]["kaes"][5] = -0.88006981027547
Kaes["counterTenorI"]["kaes"][6] = 0.86549526857843
Kaes["counterTenorI"]["kaes"][7] = -0.86236235858026
Kaes["counterTenorI"]["kaes"][8] = 0.90912790929961
Kaes["counterTenorI"]["kaes"][9] = -0.67305556256124
Kaes["counterTenorI"]["kaes"][10] = 0.87465364448044
Kaes["counterTenorI"]["A"] = {}
Kaes["counterTenorI"]["A"][1] = -7.1854433651309
Kaes["counterTenorI"]["A"][2] = 25.199430981405
Kaes["counterTenorI"]["A"][3] = -56.292955740501
Kaes["counterTenorI"]["A"][4] = 88.242553565945
Kaes["counterTenorI"]["A"][5] = -101.16043756647
Kaes["counterTenorI"]["A"][6] = 85.822844005823
Kaes["counterTenorI"]["A"][7] = -53.257865698123
Kaes["counterTenorI"]["A"][8] = 23.200938971149
Kaes["counterTenorI"]["A"][9] = -6.4429294971445
Kaes["counterTenorI"]["A"][10] = 0.87465364448044
Kaes["counterTenorI"]["Gain"] = 0.74069815762061
Kaes["counterTenorI"]["gainN"] = 0
Kaes["tenorE"] = {}
Kaes["tenorE"]["B"] = 0.95677397997757
Kaes["tenorE"]["gainV"] = 1
Kaes["tenorE"]["areas"] = {}
Kaes["tenorE"]["areas"][1] = 1
Kaes["tenorE"]["areas"][2] = 0.06723809444307
Kaes["tenorE"]["areas"][3] = 0.81781635329789
Kaes["tenorE"]["areas"][4] = 0.040167328480258
Kaes["tenorE"]["areas"][5] = 0.46477441049111
Kaes["tenorE"]["areas"][6] = 0.027672541894232
Kaes["tenorE"]["areas"][7] = 0.33467417215167
Kaes["tenorE"]["areas"][8] = 0.023099369096765
Kaes["tenorE"]["areas"][9] = 0.38051218769272
Kaes["tenorE"]["areas"][10] = 0.063804499432941
Kaes["tenorE"]["areas"][11] = 0.91541644876212
Kaes["tenorE"]["kaes"] = {}
Kaes["tenorE"]["kaes"][1] = -0.87399607492804
Kaes["tenorE"]["kaes"][2] = 0.84805885193913
Kaes["tenorE"]["kaes"][3] = -0.9063680829057
Kaes["tenorE"]["kaes"][4] = 0.84090311661665
Kaes["tenorE"]["kaes"][5] = -0.88761208995125
Kaes["tenorE"]["kaes"][6] = 0.84725931920152
Kaes["tenorE"]["kaes"][7] = -0.870871562966
Kaes["tenorE"]["kaes"][8] = 0.88553663190168
Kaes["tenorE"]["kaes"][9] = -0.71279719496605
Kaes["tenorE"]["kaes"][10] = 0.86968314035653
Kaes["tenorE"]["A"] = {}
Kaes["tenorE"]["A"][1] = -7.4046092406581
Kaes["tenorE"]["A"][2] = 26.498290964596
Kaes["tenorE"]["A"][3] = -59.966786948775
Kaes["tenorE"]["A"][4] = 94.678763605932
Kaes["tenorE"]["A"][5] = -108.75996099266
Kaes["tenorE"]["A"][6] = 92.003028771611
Kaes["tenorE"]["A"][7] = -56.633562411072
Kaes["tenorE"]["A"][8] = 24.329580316492
Kaes["tenorE"]["A"][9] = -6.6133377346571
Kaes["tenorE"]["A"][10] = 0.86968314035653
Kaes["tenorE"]["Gain"] = 0.95677397997757
Kaes["tenorE"]["gainN"] = 0
Kaes["ehh"] = {}
Kaes["ehh"]["B"] = 0.53881608123445
Kaes["ehh"]["gainV"] = 1
Kaes["ehh"]["areas"] = {}
Kaes["ehh"]["areas"][1] = 1
Kaes["ehh"]["areas"][2] = 0.006866514297257
Kaes["ehh"]["areas"][3] = 0.42493698085293
Kaes["ehh"]["areas"][4] = 0.029973458980779
Kaes["ehh"]["areas"][5] = 0.83363914920602
Kaes["ehh"]["areas"][6] = 0.081198600848335
Kaes["ehh"]["areas"][7] = 0.46305607334113
Kaes["ehh"]["areas"][8] = 0.24895095973909
Kaes["ehh"]["areas"][9] = 0.29032276939685
Kaes["ehh"]["kaes"] = {}
Kaes["ehh"]["kaes"][1] = -0.98636062635959
Kaes["ehh"]["kaes"][2] = 0.96819611524975
Kaes["ehh"]["kaes"][3] = -0.86822259347692
Kaes["ehh"]["kaes"][4] = 0.93058586987582
Kaes["ehh"]["kaes"][5] = -0.82248524212406
Kaes["ehh"]["kaes"][6] = 0.70161542123911
Kaes["ehh"]["kaes"][7] = -0.30070645886151
Kaes["ehh"]["kaes"][8] = 0.07671764342025
Kaes["ehh"]["A"] = {}
Kaes["ehh"]["A"][1] = -5.1664278264157
Kaes["ehh"]["A"][2] = 12.024995841479
Kaes["ehh"]["A"][3] = -16.445543983451
Kaes["ehh"]["A"][4] = 14.425678503082
Kaes["ehh"]["A"][5] = -8.3130578772371
Kaes["ehh"]["A"][6] = 3.094483770002
Kaes["ehh"]["A"][7] = -0.69529278962931
Kaes["ehh"]["A"][8] = 0.07671764342025
Kaes["ehh"]["Gain"] = 0.53881608123445
Kaes["ehh"]["gainN"] = 0
Kaes["counterTenorO"] = {}
Kaes["counterTenorO"]["B"] = 1.3296389005364
Kaes["counterTenorO"]["gainV"] = 1
Kaes["counterTenorO"]["areas"] = {}
Kaes["counterTenorO"]["areas"][1] = 1
Kaes["counterTenorO"]["areas"][2] = 0.010646228362473
Kaes["counterTenorO"]["areas"][3] = 0.12994734313137
Kaes["counterTenorO"]["areas"][4] = 0.01247155658298
Kaes["counterTenorO"]["areas"][5] = 1.2105563619605
Kaes["counterTenorO"]["areas"][6] = 0.11192394181599
Kaes["counterTenorO"]["areas"][7] = 1.2756559598686
Kaes["counterTenorO"]["areas"][8] = 0.040389244493002
Kaes["counterTenorO"]["areas"][9] = 0.75613469551484
Kaes["counterTenorO"]["areas"][10] = 0.11570319270601
Kaes["counterTenorO"]["areas"][11] = 1.7679396058196
Kaes["counterTenorO"]["kaes"] = {}
Kaes["counterTenorO"]["kaes"][1] = -0.97893183972057
Kaes["counterTenorO"]["kaes"][2] = 0.84855312729659
Kaes["counterTenorO"]["kaes"][3] = -0.8248609333734
Kaes["counterTenorO"]["kaes"][4] = 0.97960544253506
Kaes["counterTenorO"]["kaes"][5] = -0.83073631948033
Kaes["counterTenorO"]["kaes"][6] = 0.83867748202447
Kaes["counterTenorO"]["kaes"][7] = -0.93862027784586
Kaes["counterTenorO"]["kaes"][8] = 0.89858623836817
Kaes["counterTenorO"]["kaes"][9] = -0.73457636042379
Kaes["counterTenorO"]["kaes"][10] = 0.87714953939615
Kaes["counterTenorO"]["A"] = {}
Kaes["counterTenorO"]["A"][1] = -7.763142243145
Kaes["counterTenorO"]["A"][2] = 28.698763173315
Kaes["counterTenorO"]["A"][3] = -66.383051806028
Kaes["counterTenorO"]["A"][4] = 106.17461220099
Kaes["counterTenorO"]["A"][5] = -122.54419948293
Kaes["counterTenorO"]["A"][6] = 103.33082825604
Kaes["counterTenorO"]["A"][7] = -62.886314635178
Kaes["counterTenorO"]["A"][8] = 26.474435325603
Kaes["counterTenorO"]["A"][9] = -6.9788363317453
Kaes["counterTenorO"]["A"][10] = 0.87714953939615
Kaes["counterTenorO"]["Gain"] = 1.3296389005364
Kaes["counterTenorO"]["gainN"] = 0
for k,v in pairs(Kaes) do v.kaes = -1*TA(v.kaes) end
return Kaes
|
if not rawget(_G, "yatm_data_logic") then
return
end
--
-- Access Chips are the Data equivalent of Locks
-- They can be installed in place of a lock, and will require the use of an access card to unlock.
--
for _,row in ipairs(yatm.colors_with_default) do
local basename = row.name
local name = row.description
-- Access chips that have been programmed cannot be stacked
minetest.register_craftitem("yatm_security:access_chip_with_pins_" .. basename, {
basename = "yatm_security:access_chip_with_pins",
base_description = "Access Chip [Programmed]",
description = "Access Chip [" .. name .. "] [Programmed]",
groups = {
access_chip = 1,
not_in_creative_inventory = 1,
},
inventory_image = "yatm_access_chips_" .. basename .. "_with_pins.png",
dye_color = basename,
stack_max = 1,
})
-- Unprogrammed access chips can be stacked
minetest.register_craftitem("yatm_security:access_chip_" .. basename, {
basename = "yatm_security:access_chip",
base_description = "Access Chip [Unprogrammed]",
description = "Access Chip [Unprogrammed] (" .. name .. ")",
groups = {
blank_access_chip = 1,
table_programmable = 1,
},
inventory_image = "yatm_access_chips_" .. basename .. "_common.png",
dye_color = basename,
programmed_chip = "yatm_security:access_chip_with_pins_" .. basename,
on_programmed = function (stack, data)
local new_stack = ItemStack({ name = stack:get_definition().programmed_chip, count = 1 })
local meta = new_stack:get_meta()
yatm_security.set_access_chip_pubkey(meta, data)
local lock_id = string.sub(data, 1, 6)
meta:set_string("lock_id", lock_id)
meta:set_string("description", new_stack:get_definition().description .. " (" .. lock_id .. ")")
return new_stack
end,
})
end
|
--name
local results = redis.call('ZRANGE', 'feed.ids:'..ARGV[1], 0, -1);
return {false, results};
|
object_mobile_skeleton_vr_bat = object_mobile_skeleton_shared_vr_bat:new {
}
ObjectTemplates:addTemplate(object_mobile_skeleton_vr_bat, "object/mobile/skeleton/vr_bat.iff")
|
local skynet = require "skynet"
local mysql = require "skynet.db.mysql"
local mysql_file = skynet.getenv("mysql_file")
local mysql_config = load(string.format("return %s", skynet.getenv("mysql")))()
local db_config = {
host = mysql_config.host,
port = mysql_config.port,
user = mysql_config.username,
password = mysql_config.password
}
local target_db = mysql_config.database
local check_db = "mycheck"
local sql_file = skynet.getenv("mysql_file")
local function exist_file(file_path)
local file = io.open(file_path, "r")
if not file then
return
end
return true
end
local function read_file(file_path)
local file = io.open(file_path, "r")
if not file then
assert(false, file_path)
return
end
local content = file:read("*a")
file:close()
return content
end
local function write_file(file_path, content)
local file = io.open(file_path, "w+")
if not file then
assert(false, file_path)
return
end
file:write(content)
file:close()
end
local modelTemplate = [[
local Model = require "meiru.model"
local %s = Model("%s")
function %s:ctor()
--log("%s:ctor id =",self.id)
end
return %s
]]
local function create_models(tableblocks)
local model_path = skynet.getenv("model_path")
for name,_ in pairs(tableblocks) do
local model_file = string.format("%s/%s.lua",model_path, string.lower(name))
if not exist_file(model_file) then
skynet.error("create model:", model_file)
local content = string.format(modelTemplate, name, name, name, name, name)
write_file(model_file, content)
end
end
end
local tableblocks = {}
local function load_sql()
local slqtxt = read_file(sql_file)
local seartidx = 1
while true do
local startidx = string.find(slqtxt, "DROP TABLE", seartidx)
if not startidx then
break
end
seartidx = startidx+1
local endidx = string.find(slqtxt, ";", seartidx)
if not endidx then
break
end
seartidx = endidx+1
local drop_block = string.sub(slqtxt, startidx, endidx)
local table_name = string.match(drop_block,"`([^`]+)`")
------------------------------
local startidx = string.find(slqtxt, "CREATE TABLE", seartidx)
if not startidx then
break
end
seartidx = startidx+1
local endidx = string.find(slqtxt, ";", seartidx)
if not endidx then
break
end
seartidx = endidx+1
local create_block = string.sub(slqtxt, startidx, endidx)
assert(table_name == string.match(create_block,"`([^`]+)`"),table_name)
assert(not tableblocks[table_name],tableblocks)
local tableblock = {
table_name = table_name,
drop_block = drop_block,
create_block = create_block
}
tableblocks[table_name] = tableblock
end
create_models(tableblocks)
end
local function check_error(retval,sql)
if retval.errno then
skynet.error("[MYSQL]sql:",sql)
skynet.error("[MYSQL]发生错误 errno:",retval.errno,",err:",retval.err)
assert(false)
return
end
end
--database---------------------
local function create_db(db, db_name)
local sql = string.format("CREATE DATABASE `%s` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;",db_name)
check_error(db:query(sql),sql)
end
local function use_db(db, db_name)
local sql = string.format("USE `%s`;",db_name)
check_error(db:query(sql),sql)
end
local function drop_db(db, db_name)
local sql = string.format("DROP DATABASE `%s`;",db_name)
check_error(db:query(sql),sql)
end
local function is_exist_db(db, db_name)
local sql = "SHOW DATABASES;"
local databases = db:query(sql)
check_error(databases,sql)
for _,database in pairs(databases) do
if database.Database == db_name then
return true
end
end
end
--table--------------------------------
local function drop_tables(db, db_name, table_names)
use_db(db, db_name)
for _,table_name in ipairs(table_names) do
local sql = string.format("DROP TABLE IF EXISTS `%s`;",table_name)
check_error(db:query(sql),sql)
end
end
local function create_tables(db, db_name, create_rules)
use_db(db, db_name)
for _,create_rule in pairs(create_rules) do
local sql = create_rule.drop_block
local retval = db:query(sql)
check_error(retval,sql)
local sql = create_rule.create_block
local retval = db:query(sql)
check_error(retval,sql)
end
end
local function is_exist_table(db, db_name, table_name)
local sql = string.format("SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='%s' AND TABLE_NAME='%s';",db_name,table_name)
local retval = db:query(sql)
check_error(retval,sql)
return #retval>0
end
local function get_all_tablenames(db, db_name)
local sql = string.format("SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='%s';",db_name)
local retval = db:query(sql)
check_error(retval,sql)
return retval
end
local function desc_tables(db, db_name)
use_db(db, db_name)
local table_names = get_all_tablenames(db, db_name)
local table_descs = {}
for _,v in pairs(table_names) do
local table_name = v.table_name or v.TABLE_NAME
if is_exist_table(db, db_name, table_name) then
local sql = string.format("desc `%s`;",table_name)
local retval = db:query(sql)
check_error(retval,sql)
table_descs[table_name] = retval
end
end
return table_descs
end
--opt-----------------------------------
local function create_mysql(db, db_name)
create_db(db, db_name)
create_tables(db, db_name, tableblocks)
end
local function change_mysql(db, tdb_name, cdb_name)
if is_exist_db(db, cdb_name) then
drop_db(db, cdb_name)
end
create_mysql(db, cdb_name)
local ctable_infos = desc_tables(db, cdb_name)
-- skynet.log("ctable_infos =",ctable_infos)
-- drop_db(db, cdb_name)
local ttable_infos = desc_tables(db, tdb_name)
local new_tableblocks = {}
local table_name,ctable_info,ttable_info,ctable_infomap,cfield,tfield
for _,tableblock in pairs(tableblocks) do
table_name = tableblock.table_name
-- skynet.error("检查表格 table_name =",table_name)
ctable_info = ctable_infos[table_name]
assert(ctable_info,"no create table:"..table_name)
ttable_info = ttable_infos[table_name]
ttable_infos[table_name] = nil
if not ttable_info then
skynet.error("创建新的表:",tableblock.table_name)
table.insert(new_tableblocks, tableblock)
else
ctable_infomap = {}
for _,cfield in pairs(ctable_info) do
ctable_infomap[cfield.Field] = cfield
end
for _,tfield in pairs(ttable_info) do
cfield = ctable_infomap[tfield.Field]
ctable_infomap[tfield.Field] = nil
--需要移除字段
if not cfield then
skynet.error("检查表格:",table_name,"移除字段:", tfield.Field)
table.insert(new_tableblocks, tableblock)
tableblock = nil
else
for key,value in pairs(cfield) do
if tfield[key] ~= value then
skynet.error("检查表格:",table_name,"改变字段:", tfield.Field)
table.insert(new_tableblocks, tableblock)
tableblock = nil
end
end
end
end
if tableblock then
for _,cfield in pairs(ctable_infomap) do
skynet.error("检查表格:",table_name,"加入字段:", cfield.Field)
table.insert(new_tableblocks, tableblock)
tableblock = nil
end
end
end
end
-- do return end
for _,tableblock in pairs(new_tableblocks) do
skynet.error("需要创建的表:",tableblock.table_name)
end
--重新创建表格
create_tables(db, tdb_name, new_tableblocks)
local remove_tablenames = {}
for table_name in pairs(ttable_infos) do
skynet.error("删除丢弃的表:",table_name)
table.insert(remove_tablenames,table_name)
end
--删除丢弃的表格
drop_tables(db, tdb_name, remove_tablenames)
end
local function chech_mysql()
local db = mysql.connect(db_config)
assert(db,"failed to connect mysql")
-- skynet.error("testmysql success to connect to mysql server")
if is_exist_db(db, target_db) then
skynet.error("数据库存在:", target_db)
change_mysql(db,target_db, check_db)
else
skynet.error("数据库不存在:", target_db)
create_mysql(db, target_db)
end
db:disconnect()
end
-------------------------------------------------
-------------------------------------------------
local command = {}
function command.start()
load_sql()
chech_mysql()
skynet.sleep(10)
skynet.fork(skynet.exit)
end
skynet.start(function()
skynet.dispatch("lua", function(_,_,cmd,...)
local f = command[cmd]
if f then
skynet.ret(skynet.pack(f(...)))
else
assert(false, "error no support cmd"..cmd)
end
end)
end)
|
local techUpgradesTable =
{
kTechId.Jetpack,
kTechId.Welder,
kTechId.ClusterGrenade,
kTechId.PulseGrenade,
kTechId.GasGrenade,
kTechId.Mine,
kTechId.Vampirism,
-- kTechId.Carapace,
kTechId.Regeneration,
kTechId.Aura,
kTechId.Neurotoxin,
kTechId.Camouflage,
kTechId.Celerity,
kTechId.Adrenaline,
kTechId.Crush,
kTechId.Parasite,
}
local techUpgradesBitmask = CreateBitMask(techUpgradesTable)
debug.setupvaluex(GetTechIdsFromBitMask, "techUpgradesTable", techUpgradesTable)
debug.setupvaluex(PlayerInfoEntity.UpdateScore, "techUpgradesBitmask", techUpgradesBitmask)
debug.setupvaluex(GetTechIdsFromBitMask, "techUpgradesBitmask", techUpgradesBitmask)
|
-- Transliteration for Marathi (in progress)
local export = {}
local gsub = mw.ustring.gsub
local find = mw.ustring.find
local conv = {
-- consonants
['क'] = 'k', ['ख'] = 'kh', ['ग'] = 'g', ['घ'] = 'gh', ['ङ'] = 'ṅ',
['च'] = 'c', ['छ'] = 'ch', ['ज'] = 'j', ['झ'] = 'jh', ['ञ'] = 'ñ',
['ट'] = 'ṭ', ['ठ'] = 'ṭh', ['ड'] = 'ḍ', ['ढ'] = 'ḍh', ['ण'] = 'ṇ',
['त'] = 't', ['थ'] = 'th', ['द'] = 'd', ['ध'] = 'dh', ['न'] = 'n',
['प'] = 'p', ['फ'] = 'ph', ['ब'] = 'b', ['भ'] = 'bh', ['म'] = 'm',
['य'] = 'y', ['र'] = 'r', ['ल'] = 'l', ['व'] = 'v', ['ळ'] = 'ḷ',
['श'] = 'ś', ['ष'] = 'ṣ', ['स'] = 's', ['ह'] = 'h',
['ऱ'] = 'r',
-- ['ज्ञ'] = 'dny',
-- special nuqta consonants ONLY FOR [[MOD:mr-IPA]] not mainspace entries
['ज़'] = 'j̈', ['झ़'] = 'j̈h', ['च़'] = 'ċ', ['छ़'] = 'ċh',
-- vowel diacritics
['ि'] = 'i', ['ु'] = 'u', ['े'] = 'e', ['ो'] = 'o',
['ा'] = 'ā', ['ी'] = 'ī', ['ू'] = 'ū',
['ृ'] = 'ru',
['ै'] = 'ai', ['ौ'] = 'au',
['ॉ'] = 'ŏ',
['ॅ'] = 'ĕ',
-- vowel signs
['अ'] = 'a', ['इ'] = 'i', ['उ'] = 'u', ['ए'] = 'e', ['ओ'] = 'o',
['आ'] = 'ā', ['ई'] = 'ī', ['ऊ'] = 'ū',
['ऋ'] = 'ŕ',
['ऐ'] = 'ai', ['औ'] = 'au',
['ऑ'] = 'ŏ',
['ॲ'] = 'ĕ', ['ऍ'] = 'ĕ',
['ॐ'] = 'om',
-- chandrabindu
['ँ'] = '̃',
-- anusvara
['ं'] = 'ṁ',
-- visarga
['ः'] = 'ḥ',
-- virama
['्'] = '',
-- numerals
['०'] = '0', ['१'] = '1', ['२'] = '2', ['३'] = '3', ['४'] = '4',
['५'] = '5', ['६'] = '6', ['७'] = '7', ['८'] = '8', ['९'] = '9',
-- punctuation
['।'] = '.', -- danda
['॥'] = '.', -- double danda
['+'] = '', -- compound separator
-- abbreviation sign
['॰'] = '.',
}
local nasal_assim = {
['क'] = 'ङ', ['ख'] = 'ङ', ['ग'] = 'ङ', ['घ'] = 'ङ',
['च'] = 'ञ', ['छ'] = 'ञ', ['ज'] = 'ञ', ['झ'] = 'ञ',
['ट'] = 'ण', ['ठ'] = 'ण', ['ड'] = 'ण', ['ढ'] = 'ण',
['प'] = 'म', ['फ'] = 'म', ['ब'] = 'म', ['भ'] = 'म', ['म'] = 'म',
['य'] = 'इ', ['र'] = 'उ', ['ल'] = 'ल', ['व'] = 'उ',
['श'] = 'उ', ['ष'] = 'उ', ['स'] = 'उ', ['ह'] = 'उ'
}
local perm_cl = {
['म्ल'] = true, ['व्ल'] = true, ['न्ल'] = true,
}
local all_cons, special_cons = 'कखगघङचछजझञटठडढतथदधपफबभशषसयरलवहणनमळ', 'दतयरलवहनम'
local vowel, vowel_sign = '%*aिुृेोाीूैौॉॅ', 'अइउएओआईऊऋऐऔऑऍ'
local syncope_pattern = '([' .. vowel .. vowel_sign .. '])(़?[' .. all_cons .. '])a(़?[' .. all_cons .. '])([ंँ]?[' .. vowel .. vowel_sign .. '])'
local function rev_string(text)
local char_array, i = {}, 1
for char in string.gmatch(text, "[%z\1-\127\194-\244][\128-\191]*") do -- UTF-8 character pattern
char_array[i] = char
i = i + 1
end
return table.concat(require("table").reverse(char_array))
end
function export.tr(text, lang, sc)
text = gsub(text, 'ाँ', 'ॉ' .. 'ं')
text = gsub(text, 'ँ', 'ॅ' .. 'ं')
text = gsub(text, '([^' .. vowel .. vowel_sign .. '])ं ', '%1अ ')
text = gsub(text, '([^' .. vowel .. vowel_sign .. '])ं$', '%1अ')
text = gsub(text, '([' .. all_cons .. ']़?)([' .. vowel .. '्]?)', function(c, d)
return c .. (d == "" and 'a' or d) end)
for word in mw.ustring.gmatch(text, "[ऀ-ॿa]+") do
local orig_word = word
word = rev_string(word)
word = gsub(word, '^a(़?[' .. all_cons .. '][' .. vowel .. vowel_sign .. '])', '%1')
while find(word, syncope_pattern) do
word = gsub(word, syncope_pattern, '%1%2%3%4')
end
word = gsub(word, '(.?)ं(.)', function(succ, prev)
return succ .. (succ..prev == "a" and "्म" or
(succ == "" and find(prev, '[' .. vowel .. ']') and "̃" or nasal_assim[succ] or "n")) .. prev end)
text = gsub(text, orig_word, rev_string(word))
end
text = gsub(text, '.़?', conv)
text = gsub(text, 'a([iu])̃', 'a͠%1')
text = gsub(text, 'aa', 'a')
text = gsub(text, 'ñjñ', 'ndny')
text = gsub(text, 'jñ', 'dny')
return mw.ustring.toNFC(text)
end
return export
|
local S = aurum.get_translator()
aurum.farming = {}
-- Fertilizer and soil.
b.dofile("base.lua")
-- Crops.
b.dodir("crops")
|
local cmd = vim.cmd -- to execute vim commands without any output
local fn = vim.fn -- to execute vim functions
local u = require("util")
vim.g.mapleader = " " -- Set leader to space.
vim.o.termguicolors = true -- Enable termguicolor support.
-- Backup {{{1
vim.opt.backup = false -- Disable backups.
vim.opt.confirm = true -- Prompt to save before destructive actions.
vim.opt.swapfile = false -- Disable swapfiles.
vim.opt.undofile = true -- Save undo history.
if fn.isdirectory(vim.o.undodir) == 0 then
fn.mkdir(vim.o.undodir, "p")
end -- Create undo directory.
vim.opt.writebackup = false -- Disable backups, when a file is written.
-- Buffers {{{1
vim.opt.autoread = true -- Enable automatic reload of unchanged files.
cmd([[
augroup autoreload
autocmd CursorHold * checktime
augroup END
]]) -- Auto reload file, when changes where made somewhere else (for autoreload)
vim.opt.hidden = true -- Enable modified buffers in the background.
vim.opt.modeline = true -- Don't parse modelines (google 'vim modeline vulnerability').
-- Automatically deletes all trailing whitespace and newlines at end of file on
-- save.
cmd([[
function! TrimTrailingLines()
let lastLine = line('$')
let lastNonblankLine = prevnonblank(lastLine)
if lastLine > 0 && lastNonblankLine != lastLine
silent! execute lastNonblankLine + 1 . ',$delete _'
endif
endfunction
augroup remove_trailing_whitespaces_and_lines
autocmd!
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritepre * call TrimTrailingLines()
augroup END
]])
-- Diff {{{1
-- Use in vertical diff mode, blank lines to keep sides aligned, Ignore whitespace changes
vim.opt.diffopt:prepend({
"context:4",
"iwhite",
"vertical",
"hiddenoff",
"foldcolumn:0",
"indent-heuristic",
"algorithm:histogram",
})
-- Display {{{1
vim.opt.colorcolumn = "80" -- Set colorcolumn to 80
vim.opt.cursorline = true -- Enable the cursorline.
vim.opt.display:prepend("lastline") -- On wrap display the last line even if it does not fit
vim.opt.errorbells = false -- Disable annoying errors
vim.opt.lazyredraw = true -- Disables redraw when executing macros and other commands.
vim.opt.linebreak = true -- Prevent wrapping between words.
vim.opt.list = true -- Enable listchars.
-- Set listchar characters.
vim.opt.listchars = {
eol = "↲",
tab = "»·",
space = " ",
trail = "",
extends = "…",
precedes = "…",
conceal = "┊",
nbsp = "☠",
}
vim.opt.number = true -- Print line numbers.
vim.opt.relativenumber = true -- Set line numbers to be relative to the cursor position.
vim.opt.scrolloff = 8 -- Keep 8 lines above or below the cursorline
vim.opt.showbreak = ">>> " -- Show wrapped lines with a prepended string.
vim.opt.showcmd = true -- Show command in the command line.
vim.opt.showmode = false -- Don't show mode in the command line.
vim.opt.signcolumn = "yes" -- Enable sign columns left of the line numbers.
vim.opt.synmaxcol = 1024 -- Don't syntax highlight long lines.
vim.opt.textwidth = 80 -- Max text length.
cmd([[
augroup highlight_on_yank
autocmd TextYankPost * silent! lua vim.highlight.on_yank()
augroup END
]]) -- Enable highlight on yank.
vim.g.vimsyn_embed = "lPr" -- Allow embedded syntax highlighting for lua, python, ruby.
vim.opt.wrap = true -- Enable line wrapping.
vim.opt.virtualedit = "block" -- Allow cursor to move past end of line.
vim.opt.visualbell = false -- Disable annoying beeps
vim.opt.shortmess = "c" -- Avoid showing extra messages when using completion
-- Filetypes {{{1
cmd([[
augroup additionalFiletypes
autocmd!
autocmd BufNewFile,BufRead *.cl set filetype=cpp
autocmd BufNewFile,BufRead *.bb set filetype=sh
autocmd BufNewFile,BufRead *.bbappend set filetype=sh
augroup END
]]) -- Set various filetypes
vim.g.tex_flavor = "latex" -- Set latex as the default tex flavor
-- Folds {{{1
vim.opt.foldlevelstart = 10 -- Set level of opened folds, when starting vim.
vim.opt.foldmethod = "marker" -- The kind of folding for the current window.
vim.opt.foldopen:append("search") -- Open folds, when something is found inside the fold.
function _G.__foldtext()
local foldstart = vim.api.nvim_get_vvar("foldstart")
local line = vim.api.nvim_buf_get_lines(0, foldstart - 1, foldstart, false)
local sub = string.gsub(line[1], "{{{.*", "")
return "▸ " .. sub
end
vim.opt.foldtext = "luaeval('_G.__foldtext()')" -- Function called to display fold line.
-- Indentation {{{1
vim.opt.autoindent = true -- Allow filetype plugins and syntax highlighting
vim.opt.expandtab = true -- Use spaces instead of tabs
vim.opt.joinspaces = false -- No double spaces with join after a dot
vim.opt.shiftround = true -- Round indent
vim.opt.shiftwidth = 2 -- Size of an indent
vim.opt.smartindent = true -- Insert indents automatically
vim.opt.smarttab = true -- Automatically tab to the next softtabstop
vim.opt.softtabstop = 2 -- Number of spaces that a <Tab> counts for while performing edition operations, like inserting a <Tab> or using <BS>
vim.opt.tabstop = 2 -- Number of spaces tabs count for
-- Key mappings {{{1
local opts = { noremap = true, silent = true }
-- Remap jk keys to navigate through visual lines.
u.map("n", "j", "gj", opts)
u.map("v", "j", "gj", opts)
u.map("n", "k", "gk", opts)
u.map("v", "k", "gk", opts)
-- Move lines with <Leader>j and <Leader>k
u.map("n", "<Leader>j", ":m .+1<Cr>==", opts)
u.map("n", "<Leader>k", ":m .-2<Cr>==", opts)
u.map("v", "<Leader>j", ":m '>+1<Cr>gv=gv", opts)
u.map("v", "<Leader>k", ":m '<-2<Cr>gv=gv", opts)
-- Keep the cursor centered and open folds
u.map("n", "n", "nzzzv", opts)
u.map("n", "N", "Nzzzv", opts)
u.map("n", "J", "mzJ`z", opts)
-- Insert undo breakpoints in insert mode
u.map("i", ",", ",<C-g>u", opts)
u.map("i", ".", ".<C-g>u", opts)
u.map("i", "(", "(<C-g>u", opts)
u.map("i", ")", ")<C-g>u", opts)
u.map("i", "[", "[<C-g>u", opts)
u.map("i", "]", "]<C-g>u", opts)
u.map("i", "{", "{<C-g>u", opts)
u.map("i", "}", "}<C-g>u", opts)
-- Open terminal inside nvim with <Leader>tt.
u.map("n", "<Leader>tt", [[:call luaeval("_G.__new_term('h')")<Cr>]], opts)
u.map("n", "<Leader>th", [[:call luaeval("_G.__new_term('h')")<Cr>]], opts)
u.map("n", "<Leader>tv", [[:call luaeval("_G.__new_term('v')")<Cr>]], opts)
-- Execute a lua line
function _G.__execute_line()
local filetype = vim.api.nvim_buf_get_option(0, "filetype")
local line = vim.api.nvim_get_current_line()
if filetype == "vim" then
vim.api.nvim_command(line)
elseif filetype == "lua" then
vim.api.nvim_command("call luaeval('" .. line .. "')")
end
end
u.map("n", "<Leader>x", ":call luaeval('_G.__execute_line()')<Cr>", opts)
-- Map window navigation to CTRL + hjkl.
if not pcall(function()
require("Navigator")
end) then
u.map("n", "<C-h>", "<C-\\><C-n><C-w>h", opts)
u.map("i", "<C-h>", "<C-\\><C-n><C-w>h", opts)
u.map("t", "<C-h>", "<C-\\><C-n><C-w>h", opts)
u.map("n", "<C-j>", "<C-\\><C-n><C-w>j", opts)
u.map("i", "<C-j>", "<C-\\><C-n><C-w>j", opts)
u.map("t", "<C-j>", "<C-\\><C-n><C-w>j", opts)
u.map("n", "<C-k>", "<C-\\><C-n><C-w>k", opts)
u.map("i", "<C-k>", "<C-\\><C-n><C-w>k", opts)
u.map("t", "<C-k>", "<C-\\><C-n><C-w>k", opts)
u.map("n", "<C-l>", "<C-\\><C-n><C-w>l", opts)
u.map("i", "<C-l>", "<C-\\><C-n><C-w>l", opts)
u.map("t", "<C-l>", "<C-\\><C-n><C-w>l", opts)
end
-- Better resizing of windows with CTRL + arrows
u.map("n", "<C-Left>", "<C-\\><C-n>:vertical resize -2<Cr>", opts)
u.map("i", "<C-Left>", "<C-\\><C-n>:vertical resize -2<Cr>", opts)
u.map("t", "<C-Left>", "<C-\\><C-n>:vertical resize -2<Cr>", opts)
u.map("n", "<C-Up>", "<C-\\><C-n>:resize +2<Cr>", opts)
u.map("i", "<C-Up>", "<C-\\><C-n>:resize +2<Cr>", opts)
u.map("t", "<C-Up>", "<C-\\><C-n>:resize +2<Cr>", opts)
u.map("n", "<C-Down>", "<C-\\><C-n>:resize -2<Cr>", opts)
u.map("i", "<C-Down>", "<C-\\><C-n>:resize -2<Cr>", opts)
u.map("t", "<C-Down>", "<C-\\><C-n>:resize -2<Cr>", opts)
u.map("n", "<C-Right>", "<C-\\><C-n>:vertical resize +2<Cr>", opts)
u.map("i", "<C-Right>", "<C-\\><C-n>:vertical resize +2<Cr>", opts)
u.map("t", "<C-Right>", "<C-\\><C-n>:vertical resize +2<Cr>", opts)
-- Change splits layout from vertical to horizontal or vice versa.
u.map("n", "<Leader>lv", "<C-w>t<C-w>H", opts)
u.map("t", "<Leader>lv", "<C-w>t<C-w>H", opts)
u.map("n", "<Leader>lh", "<C-w>t<C-w>K", opts)
u.map("t", "<Leader>lh", "<C-w>t<C-w>K", opts)
-- Better indenting in the visual mode.
u.map("v", "<", "<gv", opts)
u.map("v", ">", ">gv", opts)
-- Show buffers and select one to kill.
u.map("n", "<Leader>bd", ":ls<Cr>:bd<Space>", opts)
-- Toggle spell checking.
u.map("n", "<Leader>o", ":setlocal spell!<Cr>", opts)
-- Try to save file with sudo on files that require root permission
cmd([[ca w!! w !sudo tee >/dev/null "%"]])
-- Mouse {{{1
vim.opt.mouse = "nvicr" -- Enables different support modes for the mouse
-- Netrw {{{1
vim.g.netrw_banner = 0 -- Disable the banner on top of the window.
-- Search {{{1
vim.opt.hlsearch = true -- Enable search highlighting.
vim.opt.incsearch = true -- While typing a search command, show where the pattern, as it was typed so far, matches.
vim.opt.ignorecase = true -- Ignore case when searching.
vim.opt.smartcase = true -- Don't ignore case with capitals.
vim.opt.wrapscan = true -- Searches wraps at the end of the file.
-- Use faster grep alternatives if possible
if fn.executable("rg") > 0 then
vim.opt.grepprg =
[[rg --hidden --glob "!.git" --no-heading --smart-case --vimgrep --follow $*]]
vim.opt.grepformat:prepend("%f:%l:%c:%m")
end
-- Spell checking {{{1
-- Set spell check languages.
vim.opt.spelllang = { "en_us", "de_ch" }
-- Splits {{{1
-- Fill characters for the statusline and vertical separators
vim.opt.fillchars = {
stl = " ",
stlnc = " ",
vert = "│",
fold = " ",
foldopen = "▾",
foldclose = "▸",
foldsep = "│",
diff = "",
msgsep = "‾",
eob = "~",
}
vim.opt.splitbelow = true -- Put new windows below the current.
vim.opt.splitright = true -- Put new windows right of the current.
-- Statusline {{{1
vim.opt.laststatus = 2 -- Always show the statusline
-- Terminal {{{1
function _G.__new_term(split)
if split == "h" then
cmd([[botright 12 split term://$SHELL]])
else
cmd([[botright vsplit term://$SHELL]])
end
cmd([[setlocal nonumber]])
cmd([[setlocal norelativenumber]])
cmd([[startinsert]])
end
cmd([[
augroup terminal
autocmd!
autocmd BufWinEnter,WinEnter term://* startinsert
augroup END
]]) -- Automatically go to insert mode, when changing to the terminal window
-- Timings {{{1
vim.opt.timeout = true -- Determines with 'timeoutlen' how long nvim waits for further commands after a command is received.
vim.opt.timeoutlen = 500 -- Wait 500 milliseconds for further input.
vim.opt.ttimeoutlen = 10 -- Wait 10 milliseconds in mappings with CTRL.
-- Title {{{1
vim.opt.title = true -- Set window title by default.
vim.opt.titlelen = 70 -- Set maximum title length.
vim.opt.titleold = "%{fnamemodify(getcwd(), ':t')}" -- Set title while exiting vim
vim.opt.titlestring = "%t" -- Set title string.
-- Utils {{{1
-- Change backspace to behave more intuitively.
vim.opt.backspace = { "indent", "eol", "start" }
vim.opt.clipboard = "unnamedplus" -- Enable copy paste into and out of nvim.
-- Set completionopt to have a better completion experience.
vim.opt.completeopt = { "menuone", "noselect" }
vim.opt.inccommand = "nosplit" -- Show the effect of a command incrementally, as you type.
vim.opt.path:prepend("**") -- Searches current directory recursively
-- Wildmenu {{{1
vim.opt.wildmenu = true -- Enable commandline autocompletion menu.
vim.opt.wildmode = "full" -- Select completion mode.
vim.opt.wildignorecase = true -- Ignores case when completing.
vim.opt.wildoptions = "pum" -- Display the completion matches using the popupmenu.
-- Load Plugins at the end {{{1
require("plugins")
-- }}}1
|
package.path = "../?.lua;"..package.path
local namespace = require("lj2ps.namespace")
local PostscriptVM = require("lj2ps.ps_vm")
local ops = require("lj2ps.ps_operators")
local ns = namespace(ops)
-- put ops into a local namespace
--[[
3 dict begin
/proc1 { pop } def
/two 2 def
/three (trois) def
currentdict
end
--]]
local vm = PostscriptVM()
-- 3 dict begin
-- {3, ops.push, ops.dict, ops.begin}
--vm:push(3):dict():begin()
vm:push(3)
vm:dict()
vm:BEGIN(vm)
-- /proc1 { pop } def
vm:push("proc1")
vm:push(ops.pop)
vm:def()
vm:currentdict()
vm:END()
vm:pstack()
|
function Client_PresentConfigureUI(rootParent)
rootParentobj = rootParent;
AIDeclerationinit = Mod.Settings.AllowAIDeclaration;
if(AIDeclerationinit == nil)then
AIDeclerationinit = false;
end
SeeAllyTerritoriesinit = Mod.Settings.SeeAllyTerritories;
if(SeeAllyTerritoriesinit == nil)then
SeeAllyTerritoriesinit = true;
end
PublicAlliesinit = Mod.Settings.PublicAllies;
if(PublicAlliesinit == nil)then
PublicAlliesinit = true;
end
AIsdeclearAIsinit = Mod.Settings.AIsdeclearAIs;
if(AIsdeclearAIsinit == nil)then
AIsdeclearAIsinit = true;
end
SanctionCardRequireWarinit = Mod.Settings.SanctionCardRequireWar;
if(SanctionCardRequireWarinit == nil)then
SanctionCardRequireWarinit = true;
end
SanctionCardRequirePeaceinit = Mod.Settings.SanctionCardRequirePeace;
if(SanctionCardRequirePeaceinit == nil)then
SanctionCardRequirePeaceinit = false;
end
SanctionCardRequireAllyinit = Mod.Settings.SanctionCardRequireAlly;
if(SanctionCardRequireAllyinit == nil)then
SanctionCardRequireAllyinit = false;
end
BombCardRequireWarinit = Mod.Settings.BombCardRequireWar;
if(BombCardRequireWarinit == nil)then
BombCardRequireWarinit = true;
end
BombCardRequirePeaceinit = Mod.Settings.BombCardRequirePeace;
if(BombCardRequirePeaceinit == nil)then
BombCardRequirePeaceinit = false;
end
BombCardRequireAllyinit = Mod.Settings.BombCardRequireAlly;
if(BombCardRequireAllyinit == nil)then
BombCardRequireAllyinit = false;
end
SpyCardRequireWarinit = Mod.Settings.SpyCardRequireWar;
if(SpyCardRequireWarinit == nil)then
SpyCardRequireWarinit = true;
end
SpyCardRequirePeaceinit = Mod.Settings.SpyCardRequirePeace;
if(SpyCardRequirePeaceinit == nil)then
SpyCardRequirePeaceinit = false;
end
SpyCardRequireAllyinit = Mod.Settings.SpyCardRequireAlly;
if(SpyCardRequireAllyinit == nil)then
SpyCardRequireAllyinit = false;
end
GiftCardRequireWarinit = Mod.Settings.GiftCardRequireWar;
if(GiftCardRequireWarinit == nil)then
GiftCardRequireWarinit = false;
end
GiftCardRequirePeaceinit = Mod.Settings.GiftCardRequirePeace;
if(GiftCardRequirePeaceinit == nil)then
GiftCardRequirePeaceinit = true;
end
GiftCardRequireAllyinit = Mod.Settings.GiftCardRequireAlly;
if(GiftCardRequireAllyinit == nil)then
GiftCardRequireAllyinit = true;
end
ShowUI();
end
function ShowUI()
horzlist = {};
horzlist[0] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[0]).SetText('AI Settings');
horzlist[1] = UI.CreateHorizontalLayoutGroup(rootParentobj);
AIDeclerationcheckbox = UI.CreateCheckBox(horzlist[1]).SetText('Allow AIs to declare war on Player').SetIsChecked(AIDeclerationinit);
horzlist[1] = UI.CreateHorizontalLayoutGroup(rootParentobj);
AIsdeclearAIsinitcheckbox = UI.CreateCheckBox(horzlist[1]).SetText('Allow AIs to declare war on AIs').SetIsChecked(AIsdeclearAIsinit);
horzlist[2] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[2]).SetText(' ');
horzlist[3] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[3]).SetText('Allianze Settings');
horzlist[5] = UI.CreateHorizontalLayoutGroup(rootParentobj);
SeeAllyTerritoriesCheckbox = UI.CreateCheckBox(horzlist[5]).SetText('Allow Players to see the territories of their allies(requires spy card)').SetIsChecked(SeeAllyTerritoriesinit);
horzlist[6] = UI.CreateHorizontalLayoutGroup(rootParentobj);
PublicAlliesCheckbox = UI.CreateCheckBox(horzlist[6]).SetText('Allow everyone to see every ally').SetIsChecked(PublicAlliesinit);
horzlist[7] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[7]).SetText(' ');
horzlist[8] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[8]).SetText('Card Settings');
horzlist[9] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[9]).SetText('Sanction Card');
horzlist[10] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputSanctionCardRequireWar = UI.CreateCheckBox(horzlist[10]).SetText('Sanction Cards can be played on enemy').SetIsChecked(SanctionCardRequireWarinit);
horzlist[11] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputSanctionCardRequirePeace = UI.CreateCheckBox(horzlist[11]).SetText('Sanction Cards can be played on players you are in peace with').SetIsChecked(SanctionCardRequirePeaceinit);
horzlist[12] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputSanctionCardRequireAlly = UI.CreateCheckBox(horzlist[12]).SetText('Sanction Cards can be played on ally').SetIsChecked(SanctionCardRequireAllyinit);
horzlist[13] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[13]).SetText(' ');
horzlist[14] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[14]).SetText('Bomb Card');
horzlist[15] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputBombCardRequireWar = UI.CreateCheckBox(horzlist[15]).SetText('Bomb Cards can be played on enemy').SetIsChecked(BombCardRequireWarinit);
horzlist[16] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputBombCardRequirePeace = UI.CreateCheckBox(horzlist[16]).SetText('Bomb Cards can be played on players you are in peace with').SetIsChecked(BombCardRequirePeaceinit);
horzlist[17] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputBombCardRequireAlly = UI.CreateCheckBox(horzlist[17]).SetText('Bomb Cards can be played on ally').SetIsChecked(BombCardRequireAllyinit);
horzlist[18] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[18]).SetText(' ');
horzlist[22] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[22]).SetText('Spy Card');
horzlist[23] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputSpyCardRequireWar = UI.CreateCheckBox(horzlist[23]).SetText('Spy Cards can be played on enemy').SetIsChecked(SpyCardRequireWarinit);
horzlist[24] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputSpyCardRequirePeace = UI.CreateCheckBox(horzlist[24]).SetText('Spy Cards can be played on players you are in peace with').SetIsChecked(SpyCardRequirePeaceinit);
horzlist[25] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputSpyCardRequireAlly = UI.CreateCheckBox(horzlist[25]).SetText('Spy Cards can be played on ally').SetIsChecked(SpyCardRequireAllyinit);
horzlist[26] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[26]).SetText(' ');
horzlist[27] = UI.CreateHorizontalLayoutGroup(rootParentobj);
UI.CreateLabel(horzlist[27]).SetText('Gift Card');
horzlist[29] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputGiftCardRequireWar = UI.CreateCheckBox(horzlist[29]).SetText('Gift Cards can be played on enemy').SetIsChecked(GiftCardRequireWarinit);
horzlist[30] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputGiftCardRequirePeace = UI.CreateCheckBox(horzlist[30]).SetText('Gift Cards can be played on players you are in peace with').SetIsChecked(GiftCardRequirePeaceinit);
horzlist[31] = UI.CreateHorizontalLayoutGroup(rootParentobj);
inputGiftCardRequireAlly = UI.CreateCheckBox(horzlist[31]).SetText('Gift Cards can be played on ally').SetIsChecked(GiftCardRequireAllyinit);
end
|
data:extend({
{
type = "int-setting",
name = "muro-wall-builder-thickness",
default_value = 1,
minimum_value = 1,
setting_type = "runtime-per-user",
order = 'a[muro-wall-builder-settings]'
},
{
type = "int-setting",
name = "muro-wall-builder-alt-thickness",
default_value = 2,
minimum_value = 1,
setting_type = "runtime-per-user",
order = 'b[muro-wall-builder-settings]'
},
{
type = "bool-setting",
name = "muro-wall-builder-cheat",
default_value = false,
setting_type = "runtime-per-user",
order = 'd[muro-wall-builder-settings]'
},
{
type = "string-setting",
name = "muro-wall-builder-wall-name",
default_value = 'stone-wall',
setting_type = "runtime-per-user",
order = 'd[muro-wall-builder-settings]'
},
{
type = "bool-setting",
name = "muro-wall-builder-deconstruct",
default_value = true,
setting_type = "runtime-per-user",
order = 'c[muro-wall-builder-settings]'
},
})
|
-- arm specific definitions
return {
ucontext = [[
typedef int greg_t, gregset_t[18];
typedef struct sigcontext {
unsigned long trap_no, error_code, oldmask;
unsigned long arm_r0, arm_r1, arm_r2, arm_r3;
unsigned long arm_r4, arm_r5, arm_r6, arm_r7;
unsigned long arm_r8, arm_r9, arm_r10, arm_fp;
unsigned long arm_ip, arm_sp, arm_lr, arm_pc;
unsigned long arm_cpsr, fault_address;
} mcontext_t;
typedef struct __ucontext {
unsigned long uc_flags;
struct __ucontext *uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
sigset_t uc_sigmask;
unsigned long long uc_regspace[64];
} ucontext_t;
]],
stat = [[
struct stat {
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned int st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
};
]],
statfs = [[
typedef uint32_t statfs_word;
struct statfs64 {
statfs_word f_type;
statfs_word f_bsize;
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_bavail;
uint64_t f_files;
uint64_t f_ffree;
kernel_fsid_t f_fsid;
statfs_word f_namelen;
statfs_word f_frsize;
statfs_word f_flags;
statfs_word f_spare[4];
} __attribute__((packed,aligned(4)));
]],
}
|
--[[
TheNexusAvenger
Implementation of a command.
--]]
local BaseCommand = require(script.Parent.Parent:WaitForChild("BaseCommand"))
local VoteResultsWindow = require(script.Parent.Parent:WaitForChild("Resources"):WaitForChild("VoteResultsWindow"))
local VoteChoiceWindow = require(script.Parent.Parent:WaitForChild("Resources"):WaitForChild("VoteChoiceWindow"))
local Command = BaseCommand:Extend()
--[[
Creates the command.
--]]
function Command:__new()
self:InitializeSuper({"vote","poll"},"BasicCommands","Creates a poll for a set of players and returns the results.")
self.Arguments = {
{
Type = "nexusAdminPlayers",
Name = "Players",
Description = "Players to run the vote for.",
},
{
Type = "integer",
Name = "Time",
Description = "Time to run the poll.",
},
{
Type = "string",
Name = "Question",
Description = "Question to ask.",
},
}
--Connect the remote objects.
self.ResultWindows = {}
self.API.EventContainer:WaitForChild("StartVote").OnClientEvent:Connect(function(AskingPlayer,Duration,Question)
local ChoiceWindow = VoteChoiceWindow.new(Duration,Question)
function ChoiceWindow.OnVote(_,Result)
self.API.EventContainer:WaitForChild("SendVoteResponse"):FireServer(AskingPlayer,Question,Result)
ChoiceWindow:OnClose()
end
ChoiceWindow:Show()
ChoiceWindow:StartCountdown()
end)
self.API.EventContainer:WaitForChild("SendVoteResponse").OnClientEvent:Connect(function(VotingPlayer,Question,Response)
local ResultsWindow = self.ResultWindows[Question]
if ResultsWindow then
ResultsWindow:UpdateVoterResult(VotingPlayer,Response)
end
end)
end
--[[
Runs the command.
--]]
function Command:Run(CommandContext,Players,Duration,Question)
self.super:Run(CommandContext)
--Create the results window.
local Window = VoteResultsWindow.new(Players,Duration,Question)
self.ResultWindows[Question] = Window
Window:Show()
Window:StartCountdown()
--Invoke the server to start the vote.
self.API.EventContainer:WaitForChild("StartVote"):FireServer(Players,Duration,Question)
end
return Command
|
Ship = 0
SubSystem = 1
dofilepath("data:scripts/utilfunc.lua")
dofilepath("data:scripts/techfunc.lua")
dofilepath("data:scripts/races/hiigaran_hwce/scripts/out_hgn_bld.lua")
--PrintBuildNames()
--CountBuildItems()
--build = {}
|
-- Sort a selected text
function lines(str, botlin, toplin)
local t = {}
for i = botlin,toplin do
table.insert(t,(editor:GetLine(i)))
end
return t
end
function real_sort_text(f)
local botlin = editor:LineFromPosition(editor.Anchor)
local toplin = editor:LineFromPosition(editor.CurrentPos)
if botlin>toplin then
local t=toplin toplin=botlin botlin=t end
if botlin==toplin then
botlin=0 toplin=editor.LineCount
editor.Anchor=editor:PositionFromLine(botlin)
editor.CurrentPos=editor:PositionFromLine(toplin) end
local buf = lines(sel, botlin, toplin)
--table.foreach(buf, print) --used for debugging
table.sort(buf,f)
local out = table.concat(buf, "")
editor:ReplaceSel(out)
editor.Anchor=editor:PositionFromLine(botlin)
editor.CurrentPos=editor:PositionFromLine(toplin+1)
end
function sort_text()
real_sort_text(function(a, b) return a < b end)
end
function sort_text_reverse()
real_sort_text(function(a, b) return a > b end)
end
|
--[[
Title: History Manager
Author(s): big
CreateDate: 2018.09.03
ModifyDate: 2021.12.16
place: Foshan
Desc:
use the lib:
------------------------------------------------------------
local HistoryManager = NPL.load('(gl)Mod/WorldShare/cellar/HistoryManager/HistoryManager.lua')
------------------------------------------------------------
]]
local Screen = commonlib.gettable('System.Windows.Screen')
local MdParser = NPL.load('(gl)Mod/WorldShare/parser/MdParser.lua')
local HttpRequest = NPL.load('(gl)Mod/WorldShare/service/HttpRequest.lua')
local KeepworkServiceSession = NPL.load('(gl)Mod/WorldShare/service/KeepworkService/Session.lua')
local KeepworkServiceProject = NPL.load('(gl)Mod/WorldShare/service/KeepworkService/Project.lua')
local LocalService = NPL.load('(gl)Mod/WorldShare/service/LocalService.lua')
local Config = NPL.load('(gl)Mod/WorldShare/config/Config.lua')
local HistoryManager = NPL.export()
function HistoryManager:ShowPage()
local params = Mod.WorldShare.Utils.ShowWindow(0, 0, 'Mod/WorldShare/cellar/HistoryManager/HistoryManager.html', 'HistoryManager', 0, 0, '_fi', false)
Screen:Connect('sizeChanged', HistoryManager, HistoryManager.OnScreenSizeChange, 'UniqueConnection')
HistoryManager.OnScreenSizeChange()
params._page.OnClose = function()
Mod.WorldShare.Store:Remove('page/HistoryManager')
Screen:Disconnect('sizeChanged', HistoryManager, HistoryManager.OnScreenSizeChange)
end
self:GetWorldList()
end
function HistoryManager:SetPage()
Mod.WorldShare.Store:Set('page/HistoryManager', document:GetPageCtrl())
end
function HistoryManager.Refresh()
local HistoryManagerPage = Mod.WorldShare.Store:Get('page/HistoryManager')
if (HistoryManagerPage) then
HistoryManagerPage:Refresh(0.01)
end
end
function HistoryManager:ClosePage()
local HistoryManagerPage = Mod.WorldShare.Store:Get('page/HistoryManager')
if (HistoryManagerPage) then
HistoryManagerPage:CloseWindow()
end
end
function HistoryManager.OnScreenSizeChange()
local HistoryManagerPage = Mod.WorldShare.Store:Get('page/HistoryManager')
if (not HistoryManagerPage) then
return false
end
local height = math.floor(Screen:GetHeight())
local areaHeaderNode = HistoryManagerPage:GetNode('area_header')
local marginLeft = math.floor((Screen:GetWidth() - 850) / 2)
areaHeaderNode:SetCssStyle('margin-left', marginLeft)
local areaContentNode = HistoryManagerPage:GetNode('area_content')
areaContentNode:SetCssStyle('height', height - 47)
areaContentNode:SetCssStyle('margin-left', marginLeft)
local splitNode = HistoryManagerPage:GetNode('area_split')
splitNode:SetCssStyle('height', height - 47)
HistoryManager.Refresh()
end
function HistoryManager:HasData()
local historyItems = Mod.WorldShare.Store:Get('user/historyItems')
return true
end
function HistoryManager:GetLocalRecommendedWorldList()
local data = Mod.WorldShare.Utils.GetFileData('Mod/WorldShare/database/RecommendedWorldList.md')
local tree, items = MdParser:MdToTable(data)
return tree or {}, items or {}
end
function HistoryManager:GetRemoteRecommendedWorldList(callback)
HttpRequest:GetUrl(
Config.RecommendedWorldList,
function (data, err)
if (not data or type(data) ~= 'string') then
return false
end
local tree, items = MdParser:MdToTable(data)
if type(callback) == 'function' then
callback(tree, items)
end
end
)
end
function HistoryManager:MergeRecommendedWorldList(remoteTree, remoteItems)
self:SetRecommendKeyToItems(remoteItems)
local historyTree = Mod.WorldShare.Store:Get('user/historyTree')
local historyItems = Mod.WorldShare.Store:Get('user/historyItems')
local mergeTree = self:MergeTree(remoteTree, historyTree)
local mergeItems = self:MergeItems(remoteItems, historyItems)
Mod.WorldShare.Store:Set('user/historyTree', mergeTree)
Mod.WorldShare.Store:Set('user/historyItems', mergeItems)
self:UpdateList()
self.Refresh()
end
-- It will be running when show page
function HistoryManager:GetWorldList()
local localTree, localItems = self:GetLocalRecommendedWorldList()
local bookmarkTree, bookmarkItems = Bookmark:GetBookmark()
self:SetRecommendKeyToItems(localItems)
local mergeTree = self:MergeTree(localTree, bookmarkTree)
local mergeItems = self:MergeItems(localItems, bookmarkItems)
mergeTree['favorite'] = {
displayName = L'收藏',
name = 'favorite',
type = 'category'
}
Mod.WorldShare.Store:Set('user/historyTree', mergeTree)
Mod.WorldShare.Store:Set('user/historyItems', mergeItems)
self:GetRemoteRecommendedWorldList(
function(remoteTree, remoteItems)
self:MergeRecommendedWorldList(remoteTree, remoteItems)
end
)
self:UpdateList()
self.Refresh()
end
-- set recommend key on items
function HistoryManager:SetRecommendKeyToItems(items)
if type(items) ~= 'table' then
return false
end
for key, item in ipairs(items) do
item['recommend'] = true
end
end
function HistoryManager:MergeTree(target, source)
if type(target) ~= 'table' or type(source) ~= 'table' then
return false
end
local mergeList = commonlib.copy(target)
for key, item in pairs(source) do
if not mergeList[key] then
mergeList[key] = item
else
if not Mod.WorldShare.Utils:IsEquivalent(mergeList[key], item) then
local mergeItem = Mod.WorldShare.Utils.MergeTable(mergeList[key], item)
mergeList[key] = mergeItem
end
end
end
return mergeList
end
function HistoryManager:MergeItems(target, source)
local mergeItems = commonlib.copy(target)
for sKey, sItem in ipairs(source) do
local beExist = false
for mKey, mItem in ipairs(mergeItems) do
if mItem['displayName'] == sItem['displayName'] then
beExist = true
if not Mod.WorldShare.Utils:IsEquivalent(mItem, sItem) then
mergeItems[mKey] = Mod.WorldShare.Utils.MergeTable(mItem, sItem)
end
break
end
end
if not beExist then
mergeItems[#mergeItems + 1] = sItem
end
end
return mergeItems
end
function HistoryManager:UpdateList()
local tree = Mod.WorldShare.Store:Get('user/historyTree')
local items = Mod.WorldShare.Store:Get('user/historyItems')
local HistoryManagerPage = Mod.WorldShare.Store:Get('page/HistoryManager')
if type(tree) ~= 'table' or type(items) ~= 'table' then
return false
end
items = self:FilterItems(items) or items
local treeList = self:SortTree(tree)
local itemsList = self:SortItems(items)
Mod.WorldShare.Store:Set('user/historyTreeList', treeList)
Mod.WorldShare.Store:Set('user/historyItemsList', itemsList)
if not HistoryManagerPage then
return false
end
HistoryManagerPage:GetNode('historyTree'):SetAttribute('DataSource', treeList)
HistoryManagerPage:GetNode('historyItems'):SetAttribute('DataSource', itemsList)
end
function HistoryManager:FilterItems(items)
if not self.selectTagName or self.selectTagName == 'all' or type(items) ~= 'table' then
return false
end
local filterItems = commonlib.Array:new()
for key, item in ipairs(items) do
if item and type(item.tag) == 'string' then
local tagArray = commonlib.split(item.tag, ',')
for tKey, tName in ipairs(tagArray) do
if tName == self.selectTagName then
filterItems:push_back(item)
end
end
end
end
return filterItems
end
function HistoryManager:SortTree(tree)
if type(tree) ~= 'table' then
return false
end
local treeList = commonlib.Array:new()
for key, item in pairs(tree) do
if key ~= 'all' then
treeList:push_back(item)
end
end
if tree['all'] then
treeList:push_front(tree['all'])
end
return treeList
end
function HistoryManager:SortItems(items)
if type(items) ~= 'table' then
return false
end
local itemsListArray = commonlib.ArrayMap:new()
local today = os.date('%Y%m%d', os.time())
local yesterday = os.date('%Y%m%d', os.time() - 86400)
itemsListArray:push(today, commonlib.Array:new())
itemsListArray:push(yesterday, commonlib.Array:new())
for key, item in ipairs(items) do
if item['revision'] and item['displayName'] and item['date'] then
if itemsListArray[item['date']] then
itemsListArray[item['date']]:push_back(item)
else
itemsListArray:push(item['date'], commonlib.Array:new())
itemsListArray[item['date']]:push_back(item)
end
end
end
local function sort(a, b)
if tonumber(a) > tonumber(b) then
return a
end
end
itemsListArray:ksort(sort)
local itemsList = commonlib.Array:new()
for key, item in itemsListArray:pairs() do
itemsList:push_back(
{
type = 'date',
date = key
}
)
if #item ~= 0 then
for iKey, iItem in ipairs(item) do
iItem['type'] = 'world'
itemsList:push_back(iItem)
end
else
itemsList:push_back(
{
type = 'empty'
}
)
end
end
return itemsList
end
function HistoryManager:GetItemsItemByIndex(index)
if type(index) ~= 'number' then
return false
end
local itemsList = Mod.WorldShare.Store:Get('user/historyItemsList')
if not itemsList or
not itemsList[index] or
type(itemsList[index]['tag']) ~= 'string' or
type(itemsList[index]['displayName']) ~= 'string'
then
return false
end
return itemsList[index]
end
function HistoryManager:CollectItem(index)
local curItem = self:GetItemsItemByIndex(index)
if not curItem or not curItem.displayName then
return false
end
local displayName = curItem.displayName
if not Bookmark:IsItemExist(displayName) then
Bookmark:SetItem(displayName, curItem)
Bookmark:SetTag(displayName, Bookmark.tag.FAVORITE)
else
if Bookmark:IsTagExist(displayName, Bookmark.tag.FAVORITE) then
Bookmark:RemoveTag(displayName, Bookmark.tag.FAVORITE)
else
Bookmark:SetTag(displayName, Bookmark.tag.FAVORITE)
end
end
self:UpdateList()
self.Refresh()
end
function HistoryManager:DeleteItem(index)
local itemsList = Mod.WorldShare.Store:Get('user/historyItemsList')
_guihelper.MessageBox(
L'是否删除此记录?',
function(res)
if (res and res == 6) then
local currentItem = itemsList[index]
if type(currentItem) ~= 'table' or not currentItem.displayName then
return false
end
Bookmark:RemoveItem(currentItem.displayName)
self:GetWorldList()
end
end
)
end
function HistoryManager:SelectCategory(index)
local tree = Mod.WorldShare.Store:Get('user/historyTreeList')
if type(index) ~= 'number' or type(tree) ~= 'table' then
return false
end
local curItem = tree[index]
if not curItem or not curItem.name then
return false
end
self.selectTagName = curItem.name
self:GetWorldList()
end
-- clear all local storage data
function HistoryManager:ClearHistory()
local bookmarkTree, bookmarkItems = Bookmark:GetBookmark()
Bookmark:SetBookmark(bookmarkTree, {})
self:GetWorldList()
LocalService:ClearUserWorlds()
end
function HistoryManager.FormatDate(date)
if type(date) ~= 'string' then
return false
end
local formatDate = ''
local today = os.date('%Y%m%d', os.time())
local yesterday = os.date('%Y%m%d', os.time() - 86400)
if tonumber(date) == tonumber(today) then
formatDate = format('%s-', L'今天')
end
if tonumber(date) == tonumber(yesterday) then
formatDate = format('%s-', L'昨天')
end
local year = string.sub(date, 1, 4)
local month = string.sub(date, 5, 6)
local day = string.sub(date, 7, 8)
return format('%s%s%s%s%s%s%s', formatDate, year or '', L'年', month or '', L'月', day or '', L'日')
end
function HistoryManager:WriteLessonRecord(curLesson)
if not curLesson or not curLesson:GetName() then
return false
end
local curData = {
date = os.date('%Y%m%d', os.time()),
displayName = curLesson:GetName(),
revision = 0,
tag = '',
worldType='class'
}
Bookmark:SetItem(displayName, curData)
end
|
local vehicles = {}
local particles = {}
function IsVehicleNitroPurgeEnabled(vehicle)
return vehicles[vehicle] == true
end
function SetVehicleNitroPurgeEnabled(vehicle, enabled)
if IsVehicleNitroPurgeEnabled(vehicle) == enabled then
return
end
if enabled then
local bone = GetEntityBoneIndexByName(vehicle, 'engine')
local pos = GetWorldPositionOfEntityBone(vehicle, bone)
local off = GetOffsetFromEntityGivenWorldCoords(vehicle, pos.x, pos.y, pos.z)
local ptfxs = {}
for i = 0, 3 do
local leftPurge = CreateVehiclePurgeSpray(vehicle, off.x - 0.5, off.y + 0.05, off.z + 0.03, 40.0, -20.0, 0.0, 0.5)
local rightPurge = CreateVehiclePurgeSpray(vehicle, off.x + 0.5, off.y + 0.05, off.z + 0.03, 40.0, 20.0, 0.0, 0.5)
table.insert(ptfxs, leftPurge)
table.insert(ptfxs, rightPurge)
end
vehicles[vehicle] = true
particles[vehicle] = ptfxs
else
if particles[vehicle] and #particles[vehicle] > 0 then
for _, particleId in ipairs(particles[vehicle]) do
StopParticleFxLooped(particleId)
end
end
vehicles[vehicle] = nil
particles[vehicle] = nil
end
end
|
local _
local BLOCK_TABBAR_CALLBACK = true
ZO_GAMEPAD_INVENTORY_SCENE_NAME = "gamepad_inventory_root"
-- Note: "ZOS_*" functions correspond to the shrinkwrapped modules
BUI.Inventory.Class = ZO_GamepadInventory:Subclass()
local NEW_ICON_TEXTURE = "EsoUI/Art/Miscellaneous/Gamepad/gp_icon_new.dds"
local CATEGORY_ITEM_ACTION_MODE = 1
local ITEM_LIST_ACTION_MODE = 2
local CRAFT_BAG_ACTION_MODE = 3
local INVENTORY_TAB_INDEX = 1
local CRAFT_BAG_TAB_INDEX = 2
local DIALOG_QUEUE_WORKAROUND_TIMEOUT_DURATION = 300
local INVENTORY_LEFT_TOOL_TIP_REFRESH_DELAY_MS = 300
local INVENTORY_CATEGORY_LIST = "categoryList"
local INVENTORY_ITEM_LIST = "itemList"
local INVENTORY_CRAFT_BAG_LIST = "craftBagList"
BUI_EQUIP_SLOT_DIALOG = "BUI_EQUIP_SLOT_PROMPT"
-- This is the structure of an "slotAction" array
local INDEX_ACTION_NAME = 1
local INDEX_ACTION_CALLBACK = 2
local INDEX_ACTION_TYPE = 3
local INDEX_ACTION_VISIBILITY = 4
local INDEX_ACTION_OPTIONS = 5
local PRIMARY_ACTION_KEY = 1
-- All of the callbacks that are possible on the "A" button press have to have CallSecureProtected()
local PRIMARY_ACTION = 1
-- local function copied (and slightly edited for unequipped items!) from "inventoryutils_gamepad.lua"
local function BUI_GetEquipSlotForEquipType(equipType)
local equipSlot = nil
for i, testSlot in ZO_Character_EnumerateOrderedEquipSlots() do
local locked = IsLockedWeaponSlot(testSlot)
local isEquipped = HasItemInSlot(BAG_WORN, testSlot)
local isCorrectSlot = ZO_Character_DoesEquipSlotUseEquipType(testSlot, equipType)
if not locked and isCorrectSlot then
equipSlot = testSlot
break
end
end
return equipSlot
end
-- The below functions are included from ZO_GamepadInventory.lua
local function MenuEntryTemplateEquality(left, right)
return left.uniqueId == right.uniqueId
end
local function SetupItemList(list)
list:AddDataTemplate("BUI_GamepadItemSubEntryTemplate", BUI_SharedGamepadEntry_OnSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, MenuEntryTemplateEquality)
list:AddDataTemplateWithHeader("BUI_GamepadItemSubEntryTemplate", BUI_SharedGamepadEntry_OnSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, MenuEntryTemplateEquality, "ZO_GamepadMenuEntryHeaderTemplate")
end
local function SetupCraftBagList(buiList)
buiList.list:AddDataTemplate("BUI_GamepadItemSubEntryTemplate", BUI_SharedGamepadEntry_OnSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, MenuEntryTemplateEquality)
buiList.list:AddDataTemplateWithHeader("BUI_GamepadItemSubEntryTemplate", BUI_SharedGamepadEntry_OnSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, MenuEntryTemplateEquality, "ZO_GamepadMenuEntryHeaderTemplate")
end
local function SetupCategoryList(list)
list:AddDataTemplate("BUI_GamepadItemEntryTemplate", ZO_SharedGamepadEntry_OnSetup, ZO_GamepadMenuEntryTemplateParametricListFunction)
end
local function CanUseItemQuestItem(inventorySlot)
if inventorySlot then
if inventorySlot.toolIndex then
return CanUseQuestTool(inventorySlot.questIndex, inventorySlot.toolIndex)
elseif inventorySlot.conditionIndex then
return CanUseQuestItem(inventorySlot.questIndex, inventorySlot.stepIndex, inventorySlot.conditionIndex)
end
end
return false
end
local function TryUseQuestItem(inventorySlot)
if inventorySlot then
if inventorySlot.toolIndex then
UseQuestTool(inventorySlot.questIndex, inventorySlot.toolIndex)
else
UseQuestItem(inventorySlot.questIndex, inventorySlot.stepIndex, inventorySlot.conditionIndex)
end
end
end
function BUI_InventoryUtils_MatchWeapons(itemData)
return ZO_InventoryUtils_DoesNewItemMatchFilterType(itemData, ITEMFILTERTYPE_WEAPONS) or
ZO_InventoryUtils_DoesNewItemMatchFilterType(itemData, ITEMFILTERTYPE_CONSUMABLE) -- weapons now include consumables
end
function BUI_InventoryUtils_All(itemData)
return true
end
local function WrapValue(newValue, maxValue)
if(newValue < 1) then return maxValue end
if(newValue > maxValue) then return 1 end
return newValue
end
function BUI_TabBar_OnTabNext(parent, successful)
if(successful) then
parent:SaveListPosition()
parent.categoryList.targetSelectedIndex = WrapValue(parent.categoryList.targetSelectedIndex + 1, #parent.categoryList.dataList)
parent.categoryList.selectedIndex = parent.categoryList.targetSelectedIndex
parent.categoryList.selectedData = parent.categoryList.dataList[parent.categoryList.selectedIndex]
parent.categoryList.defaultSelectedIndex = parent.categoryList.selectedIndex
--parent:RefreshItemList()
BUI.GenericHeader.SetTitleText(parent.header, parent.categoryList.selectedData.text)
parent:ToSavedPosition()
end
end
function BUI_TabBar_OnTabPrev(parent, successful)
if(successful) then
parent:SaveListPosition()
parent.categoryList.targetSelectedIndex = WrapValue(parent.categoryList.targetSelectedIndex - 1, #parent.categoryList.dataList)
parent.categoryList.selectedIndex = parent.categoryList.targetSelectedIndex
parent.categoryList.selectedData = parent.categoryList.dataList[parent.categoryList.selectedIndex]
parent.categoryList.defaultSelectedIndex = parent.categoryList.selectedIndex
--parent:RefreshItemList()
BUI.GenericHeader.SetTitleText(parent.header, parent.categoryList.selectedData.text)
parent:ToSavedPosition()
end
end
function BUI.Inventory.Class:ToSavedPosition()
if self.categoryList.selectedData ~= nil then
if not self.categoryList:GetTargetData().onClickDirection then
self:SwitchActiveList(INVENTORY_ITEM_LIST)
self:RefreshItemList()
else
self:SwitchActiveList(INVENTORY_CRAFT_BAG_LIST)
--self._currentList:RefreshList()
self:RefreshCraftBagList()
end
end
if(BUI.Settings.Modules["Inventory"].savePosition) then
local lastPosition
if self:GetCurrentList() == self.itemList then
lastPosition = self.categoryPositions[self.categoryList.selectedIndex]
else
lastPosition = self.categoryCraftPositions[self.categoryList.selectedIndex]
end
if lastPosition ~= nil and self._currentList.dataList ~= nil then
lastPosition = (#self._currentList.dataList > lastPosition) and lastPosition or #self._currentList.dataList
if lastPosition ~= nil and #self._currentList.dataList > 0 then
self._currentList:SetSelectedIndexWithoutAnimation(lastPosition, true, false)
GAMEPAD_TOOLTIPS:Reset(GAMEPAD_LEFT_TOOLTIP)
if self.callLaterLeftToolTip ~= nil then
EVENT_MANAGER:UnregisterForUpdate(self.callLaterLeftToolTip)
end
local callLaterId = zo_callLater(function() self:UpdateItemLeftTooltip(self._currentList.selectedData) end, INVENTORY_LEFT_TOOL_TIP_REFRESH_DELAY_MS)
self.callLaterLeftToolTip = "CallLaterFunction"..callLaterId
end
end
else
self._currentList:SetSelectedIndexWithoutAnimation(1, true, false)
end
end
function BUI.Inventory.Class:SaveListPosition()
if self:GetCurrentList() == self.itemList then
self.categoryPositions[self.categoryList.selectedIndex] = self._currentList.selectedIndex
else
self.categoryCraftPositions[self.categoryList.selectedIndex] = self._currentList.selectedIndex
end
end
function BUI.Inventory.Class:InitializeCategoryList()
self.categoryList = self:AddList("Category", SetupCategoryList)
self.categoryList:SetNoItemText(GetString(SI_GAMEPAD_INVENTORY_EMPTY))
--self.categoryList:SetDefaultSelectedIndex(1)
----self.categoryList:SetDefaultSelectedIndex(2)
--Match the tooltip to the selected data because it looks nicer
local function OnSelectedCategoryChanged(list, selectedData)
if selectedData ~= nil and self.scene:IsShowing() then
self:UpdateCategoryLeftTooltip(selectedData)
if selectedData.onClickDirection then
self:SwitchActiveList(INVENTORY_CRAFT_BAG_LIST)
else
self:SwitchActiveList(INVENTORY_ITEM_LIST)
end
end
end
self.categoryList:SetOnSelectedDataChangedCallback(OnSelectedCategoryChanged)
--Match the functionality to the target data
local function OnTargetCategoryChanged(list, targetData)
if targetData then
self.selectedEquipSlot = targetData.equipSlot
self:SetSelectedItemUniqueId(self:GenerateItemSlotData(targetData))
self.selectedItemFilterType = targetData.filterType
else
self:SetSelectedItemUniqueId(nil)
end
self.currentlySelectedData = targetData
end
self.categoryList:SetOnTargetDataChangedCallback(OnTargetCategoryChanged)
end
local function GetItemDataFilterComparator(filteredEquipSlot, nonEquipableFilterType)
return function(itemData)
if nonEquipableFilterType then
return ZO_InventoryUtils_DoesNewItemMatchFilterType(itemData, nonEquipableFilterType) or
(itemData.equipType == EQUIP_TYPE_POISON and nonEquipableFilterType == ITEMFILTERTYPE_WEAPONS) -- will fix soon, patched to allow Poison in "Weapons"
else
-- for "All"
return true
end
return ZO_InventoryUtils_DoesNewItemMatchSupplies(itemData)
end
end
function BUI.Inventory.Class:IsItemListEmpty(filteredEquipSlot, nonEquipableFilterType)
local comparator = GetItemDataFilterComparator(filteredEquipSlot, nonEquipableFilterType)
return SHARED_INVENTORY:IsFilteredSlotDataEmpty(comparator, BAG_BACKPACK, BAG_WORN)
end
local function CanUnequipItem(inventorySlot)
local bag, slot = ZO_Inventory_GetBagAndIndex(inventorySlot)
--d("unequip check : " .. bag .. " " .. slot)
if bag == BAG_WORN then
local _, stackCount = GetItemInfo(bag, slot)
--d("stack count: " .. stackCount)
return stackCount > 0
end
return false
end
function BUI.Inventory.Class:TryUnequipItem(inventorySlot)
--d("unequip: ")
if CanUnequipItem(inventorySlot) then
local equipSlot = ZO_Inventory_GetSlotIndex(inventorySlot)
UnequipItem(equipSlot)
end
end
function BUI.Inventory.Class:TryEquipItem(inventorySlot, isCallingFromActionDialog)
local equipType = inventorySlot.dataSource.equipType
-- Binding handling
local bound = IsItemBound(inventorySlot.dataSource.bagId, inventorySlot.dataSource.slotIndex)
local equipItemLink = GetItemLink(inventorySlot.dataSource.bagId, inventorySlot.dataSource.slotIndex)
local bindType = GetItemLinkBindType(equipItemLink)
local isBindCheckItem = false
local equipItemCallback = function() end
-- Check if the current item is an armour (or two handed, where it doesn't need a dialog menu), if so, then just equip into it's slot
local armorType = GetItemArmorType(inventorySlot.dataSource.bagId, inventorySlot.dataSource.slotIndex)
if armorType ~= ARMORTYPE_NONE or equipType == EQUIP_TYPE_NECK then
equipItemCallback = function()
CallSecureProtected("RequestMoveItem",inventorySlot.dataSource.bagId, inventorySlot.dataSource.slotIndex, BAG_WORN, BUI_GetEquipSlotForEquipType(equipType), 1)
end
isBindCheckItem = true
elseif equipType == EQUIP_TYPE_COSTUME then
CallSecureProtected("RequestMoveItem",inventorySlot.dataSource.bagId, inventorySlot.dataSource.slotIndex, BAG_WORN, EQUIP_SLOT_COSTUME, 1)
else
-- Else, it's a weapon or poison or ring, so show a dialog so the user can pick either slot!
equipItemCallback = function()
local function showEquipSingleSlotItemDialog()
-- should check if ZO_Dialogs_IsShowingDialog
ZO_Dialogs_ShowDialog(BUI_EQUIP_SLOT_DIALOG, {inventorySlot, self.isPrimaryWeapon}, {mainTextParams={GetString(SI_BUI_INV_EQUIPSLOT_MAIN)}}, true)
end
if isCallingFromActionDialog ~= nil and isCallingFromActionDialog then
zo_callLater(showEquipSingleSlotItemDialog, DIALOG_QUEUE_WORKAROUND_TIMEOUT_DURATION)
else
showEquipSingleSlotItemDialog()
end
end
-- we check the binding dialog later
isBindCheckItem = false
end
if not bound and bindType == BIND_TYPE_ON_EQUIP and isBindCheckItem and BUI.Settings.Modules["Inventory"].bindOnEquipProtection then
local function promptForBindOnEquip()
ZO_Dialogs_ShowPlatformDialog("CONFIRM_EQUIP_BOE", {callback=equipItemCallback}, {mainTextParams={equipItemLink}})
end
if isCallingFromActionDialog ~= nil and isCallingFromActionDialog then
zo_callLater(promptForBindOnEquip, DIALOG_QUEUE_WORKAROUND_TIMEOUT_DURATION)
else
promptForBindOnEquip()
end
else
equipItemCallback()
end
end
function BUI.Inventory.Class:NewCategoryItem(categoryName, filterType, iconFile, FilterFunct)
if FilterFunct == nil then
FilterFunct = ZO_InventoryUtils_DoesNewItemMatchFilterType
end
local isListEmpty = self:IsItemListEmpty(nil, filterType)
if not isListEmpty then
local name = GetString(categoryName)
local hasAnyNewItems = SHARED_INVENTORY:AreAnyItemsNew(FilterFunct, filterType, BAG_BACKPACK)
local data = ZO_GamepadEntryData:New(name, iconFile, nil, nil, hasAnyNewItems)
data.filterType = filterType
data:SetIconTintOnSelection(true)
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCategoryPos then self.categoryPositions[#self.categoryPositions+1] = 1 end
end
end
function BUI.Inventory.Class:RefreshCategoryList()
--local currentPosition = self.header.tabBar.
self.categoryList:Clear()
self.header.tabBar:Clear()
local currentList = self:GetCurrentList()
if currentList == self.craftBagList then
do
local name = "Crafting Bag"
local iconFile = "/esoui/art/inventory/gamepad/gp_inventory_icon_craftbag_all.dds"
local data = ZO_GamepadEntryData:New(name, iconFile)
data.onClickDirection = "CRAFTBAG"
data:SetIconTintOnSelection(true)
if not HasCraftBagAccess() then
data.enabled = false
end
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCraftPos then self.categoryCraftPositions[#self.categoryCraftPositions+1] = 1 end
end
do
local name = "Blacksmithing"
local iconFile = "/esoui/art/inventory/gamepad/gp_inventory_icon_craftbag_blacksmithing.dds"
local data = ZO_GamepadEntryData:New(name, iconFile)
data.onClickDirection = "CRAFTBAG"
data:SetIconTintOnSelection(true)
data.filterType = ITEMFILTERTYPE_BLACKSMITHING
if not HasCraftBagAccess() then
data.enabled = false
end
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCraftPos then self.categoryCraftPositions[#self.categoryCraftPositions+1] = 1 end
end
do
local name = "Alchemy"
local iconFile = "/esoui/art/inventory/gamepad/gp_inventory_icon_craftbag_alchemy.dds"
local data = ZO_GamepadEntryData:New(name, iconFile)
data.onClickDirection = "CRAFTBAG"
data:SetIconTintOnSelection(true)
data.filterType = ITEMFILTERTYPE_ALCHEMY
if not HasCraftBagAccess() then
data.enabled = false
end
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCraftPos then self.categoryCraftPositions[#self.categoryCraftPositions+1] = 1 end
end
do
local name = "Enchanting"
local iconFile = "/esoui/art/inventory/gamepad/gp_inventory_icon_craftbag_enchanting.dds"
local data = ZO_GamepadEntryData:New(name, iconFile)
data.onClickDirection = "CRAFTBAG"
data:SetIconTintOnSelection(true)
data.filterType = ITEMFILTERTYPE_ENCHANTING
if not HasCraftBagAccess() then
data.enabled = false
end
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCraftPos then self.categoryCraftPositions[#self.categoryCraftPositions+1] = 1 end
end
do
local name = "Provisioning"
local iconFile = "/esoui/art/inventory/gamepad/gp_inventory_icon_craftbag_provisioning.dds"
local data = ZO_GamepadEntryData:New(name, iconFile)
data.onClickDirection = "CRAFTBAG"
data:SetIconTintOnSelection(true)
data.filterType = ITEMFILTERTYPE_PROVISIONING
if not HasCraftBagAccess() then
data.enabled = false
end
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCraftPos then self.categoryCraftPositions[#self.categoryCraftPositions+1] = 1 end
end
do
local name = "Woodworking"
local iconFile = "/esoui/art/inventory/gamepad/gp_inventory_icon_craftbag_woodworking.dds"
local data = ZO_GamepadEntryData:New(name, iconFile)
data:SetIconTintOnSelection(true)
data.onClickDirection = "CRAFTBAG"
data.filterType = ITEMFILTERTYPE_WOODWORKING
if not HasCraftBagAccess() then
data.enabled = false
end
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCraftPos then self.categoryCraftPositions[#self.categoryCraftPositions+1] = 1 end
end
do
local name = "Clothing"
local iconFile = "/esoui/art/inventory/gamepad/gp_inventory_icon_craftbag_clothing.dds"
local data = ZO_GamepadEntryData:New(name, iconFile)
data:SetIconTintOnSelection(true)
data.onClickDirection = "CRAFTBAG"
data.filterType = ITEMFILTERTYPE_CLOTHING
if not HasCraftBagAccess() then
data.enabled = false
end
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCraftPos then self.categoryCraftPositions[#self.categoryCraftPositions+1] = 1 end
end
do
local name = "Trait/Style Gems"
local iconFile = "/esoui/art/inventory/gamepad/gp_inventory_icon_craftbag_itemtrait.dds"
local data = ZO_GamepadEntryData:New(name, iconFile)
data:SetIconTintOnSelection(true)
data.onClickDirection = "CRAFTBAG"
data.filterType = { ITEMFILTERTYPE_TRAIT_ITEMS, ITEMFILTERTYPE_STYLE_MATERIALS, ITEMFILTERTYPE_MISCELLANEOUS }
if not HasCraftBagAccess() then
data.enabled = false
end
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCraftPos then self.categoryCraftPositions[#self.categoryCraftPositions+1] = 1 end
end
self.populatedCraftPos = true
else
self:NewCategoryItem(SI_BUI_INV_ITEM_ALL, nil, "EsoUI/Art/Inventory/Gamepad/gp_inventory_icon_all.dds", BUI_InventoryUtils_All)
self:NewCategoryItem(SI_BUI_INV_ITEM_CONSUMABLE, ITEMFILTERTYPE_CONSUMABLE, "EsoUI/Art/Inventory/Gamepad/gp_inventory_icon_consumables.dds")
self:NewCategoryItem(SI_BUI_INV_ITEM_WEAPONS, ITEMFILTERTYPE_WEAPONS, "EsoUI/Art/Inventory/Gamepad/gp_inventory_icon_weapons.dds")
self:NewCategoryItem(SI_BUI_INV_ITEM_APPAREL, ITEMFILTERTYPE_ARMOR, "EsoUI/Art/Inventory/Gamepad/gp_inventory_icon_apparel.dds")
self:NewCategoryItem(SI_BUI_INV_ITEM_MATERIALS, ITEMFILTERTYPE_CRAFTING, "EsoUI/Art/Inventory/Gamepad/gp_inventory_icon_materials.dds")
self:NewCategoryItem(SI_BUI_INV_ITEM_MISC, ITEMFILTERTYPE_MISCELLANEOUS, "EsoUI/Art/Inventory/Gamepad/gp_inventory_icon_miscellaneous.dds")
self:NewCategoryItem(SI_BUI_INV_ITEM_QUICKSLOT, ITEMFILTERTYPE_QUICKSLOT, "EsoUI/Art/Inventory/Gamepad/gp_inventory_icon_quickslot.dds")
do
local questCache = SHARED_INVENTORY:GenerateFullQuestCache()
if next(questCache) then
local name = GetString(SI_GAMEPAD_INVENTORY_QUEST_ITEMS)
local iconFile = "/esoui/art/inventory/gamepad/gp_inventory_icon_quest.dds"
local data = ZO_GamepadEntryData:New(name, iconFile)
data.filterType = ITEMFILTERTYPE_QUEST
data:SetIconTintOnSelection(true)
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCategoryPos then self.categoryPositions[#self.categoryPositions+1] = 1 end
end
end
do
if(BUI.Settings.Modules["Inventory"].enableJunk and HasAnyJunk(BAG_BACKPACK, false)) then
local isListEmpty = self:IsItemListEmpty(nil, nil)
if not isListEmpty then
local name = GetString(SI_BUI_INV_ITEM_JUNK)
local iconFile = "BetterUI/Modules/CIM/Images/inv_junk.dds"
local hasAnyNewItems = SHARED_INVENTORY:AreAnyItemsNew(BUI_InventoryUtils_All, nil, BAG_BACKPACK)
local data = ZO_GamepadEntryData:New(name, iconFile, nil, nil, hasAnyNewItems)
data.showJunk = true
data:SetIconTintOnSelection(true)
self.categoryList:AddEntry("BUI_GamepadItemEntryTemplate", data)
BUI.GenericHeader.AddToList(self.header, data)
if not self.populatedCategoryPos then self.categoryPositions[#self.categoryPositions+1] = 1 end
end
end
end
self.populatedCategoryPos = true
end
self.categoryList:Commit()
self.header.tabBar:Commit()
end
function BUI.Inventory.Class:InitializeHeader()
local function UpdateTitleText()
return GetString(self:GetCurrentList() == self.craftBagList and SI_BUI_INV_ACTION_CB or SI_BUI_INV_ACTION_INV)
end
local tabBarEntries = {
{
text = GetString(SI_GAMEPAD_INVENTORY_CATEGORY_HEADER),
callback = function()
self:SwitchActiveList(INVENTORY_CATEGORY_LIST)
end,
},
{
text = GetString(SI_GAMEPAD_INVENTORY_CRAFT_BAG_HEADER),
callback = function()
self:SwitchActiveList(INVENTORY_CRAFT_BAG_LIST)
end,
},
}
self.categoryHeaderData = {
titleText = UpdateTitleText,
tabBarEntries = tabBarEntries,
tabBarData = { parent = self, onNext = BUI_TabBar_OnTabNext, onPrev = BUI_TabBar_OnTabPrev }
}
self.craftBagHeaderData = {
titleText = UpdateTitleText,
tabBarEntries = tabBarEntries,
data1HeaderText = GetString(SI_GAMEPAD_INVENTORY_AVAILABLE_FUNDS),
data1Text = UpdateGold,
}
self.itemListHeaderData = {
titleText = UpdateTitleText,
data1HeaderText = GetString(SI_GAMEPAD_INVENTORY_AVAILABLE_FUNDS),
data1Text = UpdateGold,
data2HeaderText = GetString(SI_GAMEPAD_INVENTORY_ALLIANCE_POINTS),
data2Text = UpdateAlliancePoints,
data3HeaderText = GetString(SI_GAMEPAD_INVENTORY_TELVAR_STONES),
data3Text = UpdateTelvarStones,
data4HeaderText = GetString(SI_GAMEPAD_INVENTORY_CAPACITY),
data4Text = UpdateCapacityString,
}
BUI.GenericHeader.Initialize(self.header, ZO_GAMEPAD_HEADER_TABBAR_CREATE)
BUI.GenericHeader.SetEquipText(self.header, self.isPrimaryWeapon)
BUI.GenericHeader.SetBackupEquipText(self.header, self.isPrimaryWeapon)
BUI.GenericHeader.Refresh(self.header, self.categoryHeaderData, ZO_GAMEPAD_HEADER_TABBAR_CREATE)
BUI.GenericFooter.Initialize(self)
BUI.GenericFooter.Refresh(self)
--self.header.tabBar:SetDefaultSelectedIndex(1)
end
function BUI.Inventory.Class:InitializeInventoryVisualData(itemData)
self.uniqueId = itemData.uniqueId --need this on self so that it can be used for a compare by EqualityFunction in ParametricScrollList,
self.bestItemCategoryName = itemData.bestItemCategoryName
self:SetDataSource(itemData) --SharedInventory modifies the dataSource's uniqueId before the GamepadEntryData is rebuilt,
self.dataSource.requiredChampionPoints = GetItemRequiredChampionPoints(itemData.bagId, itemData.slotIndex)
self:AddIcon(itemData.icon) --so by copying it over, we can still have access to the old one during the Equality check
if not itemData.questIndex then
self:SetNameColors(self:GetColorsBasedOnQuality(self.quality)) --quest items are only white
end
self.cooldownIcon = itemData.icon or itemData.iconFile
self:SetFontScaleOnSelection(false) --item entries don't grow on selection
end
function BUI.Inventory.Class:RefreshCraftBagList()
-- we need to pass in our current filterType, as refreshing the craft bag list is distinct from the item list's methods (only slightly)
self.craftBagList:RefreshList(self.categoryList:GetTargetData().filterType)
end
function BUI.Inventory.Class:RefreshItemList()
self.itemList:Clear()
if self.categoryList:IsEmpty() then return end
local targetCategoryData = self.categoryList:GetTargetData()
local filteredEquipSlot = targetCategoryData.equipSlot
local nonEquipableFilterType = targetCategoryData.filterType
local showJunkCategory = (self.categoryList:GetTargetData().showJunk ~= nil)
local filteredDataTable
local isQuestItem = nonEquipableFilterType == ITEMFILTERTYPE_QUEST
--special case for quest items
if isQuestItem then
filteredDataTable = {}
local questCache = SHARED_INVENTORY:GenerateFullQuestCache()
for _, questItems in pairs(questCache) do
for _, questItem in pairs(questItems) do
ZO_InventorySlot_SetType(questItem, SLOT_TYPE_QUEST_ITEM)
table.insert(filteredDataTable, questItem)
end
end
else
local comparator = GetItemDataFilterComparator(filteredEquipSlot, nonEquipableFilterType)
filteredDataTable = SHARED_INVENTORY:GenerateFullSlotData(comparator, BAG_BACKPACK, BAG_WORN)
local tempDataTable = {}
for i = 1, #filteredDataTable do
local itemData = filteredDataTable[i]
--use custom categories
local customCategory, matched, catName, catPriority = BUI.Helper.AutoCategory:GetCustomCategory(itemData)
if customCategory and not matched then
itemData.bestItemTypeName = zo_strformat(SI_INVENTORY_HEADER, GetBestItemCategoryDescription(itemData))
itemData.bestItemCategoryName = AC_UNGROUPED_NAME
itemData.sortPriorityName = string.format("%03d%s", 999 , catName)
else
if customCategory then
itemData.bestItemTypeName = zo_strformat(SI_INVENTORY_HEADER, GetBestItemCategoryDescription(itemData))
itemData.bestItemCategoryName = catName
itemData.sortPriorityName = string.format("%03d%s", 100 - catPriority , catName)
else
itemData.bestItemTypeName = zo_strformat(SI_INVENTORY_HEADER, GetBestItemCategoryDescription(itemData))
itemData.bestItemCategoryName = itemData.bestItemTypeName
itemData.sortPriorityName = itemData.bestItemCategoryName
end
end
if itemData.bagId == BAG_WORN then
itemData.isEquippedInCurrentCategory = false
itemData.isEquippedInAnotherCategory = false
if itemData.slotIndex == filteredEquipSlot then
itemData.isEquippedInCurrentCategory = true
else
itemData.isEquippedInAnotherCategory = true
end
itemData.isHiddenByWardrobe = WouldEquipmentBeHidden(itemData.slotIndex or EQUIP_SLOT_NONE)
else
local slotIndex = GetItemCurrentActionBarSlot(itemData.bagId, itemData.slotIndex)
itemData.isEquippedInCurrentCategory = slotIndex and true or nil
end
ZO_InventorySlot_SetType(itemData, SLOT_TYPE_GAMEPAD_INVENTORY_ITEM)
table.insert(tempDataTable, itemData)
end
filteredDataTable = tempDataTable
end
table.sort(filteredDataTable, BUI_GamepadInventory_DefaultItemSortComparator)
local currentBestCategoryName = nil
for i, itemData in ipairs(filteredDataTable) do
local nextItemData = filteredDataTable[i + 1]
local data = ZO_GamepadEntryData:New(itemData.name, itemData.iconFile)
data.InitializeInventoryVisualData = BUI.Inventory.Class.InitializeInventoryVisualData
data:InitializeInventoryVisualData(itemData)
local remaining, duration
if isQuestItem then
if itemData.toolIndex then
remaining, duration = GetQuestToolCooldownInfo(itemData.questIndex, itemData.toolIndex)
elseif itemData.stepIndex and itemData.conditionIndex then
remaining, duration = GetQuestItemCooldownInfo(itemData.questIndex, itemData.stepIndex, itemData.conditionIndex)
end
else
remaining, duration = GetItemCooldownInfo(itemData.bagId, itemData.slotIndex)
end
if remaining > 0 and duration > 0 then
data:SetCooldown(remaining, duration)
end
data.bestItemCategoryName = itemData.bestItemCategoryName
data.bestGamepadItemCategoryName = itemData.bestItemCategoryName
data.isEquippedInCurrentCategory = itemData.isEquippedInCurrentCategory
data.isEquippedInAnotherCategory = itemData.isEquippedInAnotherCategory
data.isJunk = itemData.isJunk
if (not data.isJunk and not showJunkCategory) or (data.isJunk and showJunkCategory) or not BUI.Settings.Modules["Inventory"].enableJunk then
if data.bestGamepadItemCategoryName ~= currentBestCategoryName then
currentBestCategoryName = data.bestGamepadItemCategoryName
data:SetHeader(currentBestCategoryName)
if AutoCategory then
self.itemList:AddEntryWithHeader("BUI_GamepadItemSubEntryTemplate", data)
else
self.itemList:AddEntry("BUI_GamepadItemSubEntryTemplate", data)
end
else
self.itemList:AddEntry("BUI_GamepadItemSubEntryTemplate", data)
end
end
end
self.itemList:Commit()
end
function BUI.Inventory.Class:LayoutCraftBagTooltip()
local title
local description
if HasCraftBagAccess() then
title = GetString(SI_ESO_PLUS_STATUS_UNLOCKED)
description = GetString(SI_CRAFT_BAG_STATUS_ESO_PLUS_UNLOCKED_DESCRIPTION)
else
title = GetString(SI_ESO_PLUS_STATUS_LOCKED)
description = GetString(SI_CRAFT_BAG_STATUS_LOCKED_DESCRIPTION)
end
GAMEPAD_TOOLTIPS:LayoutTitleAndMultiSectionDescriptionTooltip(GAMEPAD_LEFT_TOOLTIP, title, description)
end
function BUI.Inventory.Class:SwitchInfo()
self.switchInfo = not self.switchInfo
if self.actionMode == ITEM_LIST_ACTION_MODE then
self:UpdateItemLeftTooltip(self.itemList.selectedData)
end
end
function BUI.Inventory.Class:UpdateItemLeftTooltip(selectedData)
if selectedData then
GAMEPAD_TOOLTIPS:ResetScrollTooltipToTop(GAMEPAD_RIGHT_TOOLTIP)
if ZO_InventoryUtils_DoesNewItemMatchFilterType(selectedData, ITEMFILTERTYPE_QUEST) then
if selectedData.toolIndex then
GAMEPAD_TOOLTIPS:LayoutQuestItem(GAMEPAD_LEFT_TOOLTIP, GetQuestToolQuestItemId(selectedData.questIndex, selectedData.toolIndex))
else
GAMEPAD_TOOLTIPS:LayoutQuestItem(GAMEPAD_LEFT_TOOLTIP, GetQuestConditionQuestItemId(selectedData.questIndex, selectedData.stepIndex, selectedData.conditionIndex))
end
else
local showRightTooltip = false
if ZO_InventoryUtils_DoesNewItemMatchFilterType(selectedData, ITEMFILTERTYPE_WEAPONS) or
ZO_InventoryUtils_DoesNewItemMatchFilterType(selectedData, ITEMFILTERTYPE_ARMOR) then
if self.switchInfo then
showRightTooltip = true
end
end
if not showRightTooltip then
GAMEPAD_TOOLTIPS:LayoutBagItem(GAMEPAD_LEFT_TOOLTIP, selectedData.bagId, selectedData.slotIndex)
else
self:UpdateRightTooltip()
end
end
if selectedData.isEquippedInCurrentCategory or selectedData.isEquippedInAnotherCategory or selectedData.equipSlot then
local slotIndex = selectedData.bagId == BAG_WORN and selectedData.slotIndex or nil --equipped quickslottables slotIndex is not the same as slot index's in BAG_WORN
self:UpdateTooltipEquippedIndicatorText(GAMEPAD_LEFT_TOOLTIP, slotIndex)
else
GAMEPAD_TOOLTIPS:ClearStatusLabel(GAMEPAD_LEFT_TOOLTIP)
end
end
end
function BUI.Inventory.Class:UpdateRightTooltip()
local selectedItemData = self.currentlySelectedData
--local selectedEquipSlot = BUI_GetEquipSlotForEquipType(selectedItemData.dataSource.equipType)
local selectedEquipSlot
if self:GetCurrentList() == self.itemList then
if (selectedItemData ~= nil and selectedItemData.dataSource ~= nil) then
selectedEquipSlot = BUI_GetEquipSlotForEquipType(selectedItemData.dataSource.equipType)
end
else
selectedEquipSlot = 0
end
local equipSlotHasItem = select(2, GetEquippedItemInfo(selectedEquipSlot))
if selectedItemData and (not equipSlotHasItem or BUI.Settings.Modules["Inventory"].displayCharAttributes) then
GAMEPAD_TOOLTIPS:LayoutItemStatComparison(GAMEPAD_LEFT_TOOLTIP, selectedItemData.bagId, selectedItemData.slotIndex, selectedEquipSlot)
GAMEPAD_TOOLTIPS:SetStatusLabelText(GAMEPAD_LEFT_TOOLTIP, GetString(SI_GAMEPAD_INVENTORY_ITEM_COMPARE_TOOLTIP_TITLE))
elseif GAMEPAD_TOOLTIPS:LayoutBagItem(GAMEPAD_LEFT_TOOLTIP, BAG_WORN, selectedEquipSlot) then
self:UpdateTooltipEquippedIndicatorText(GAMEPAD_LEFT_TOOLTIP, selectedEquipSlot)
end
if selectedItemData ~= nil and selectedItemData.dataSource ~= nil and selectedData ~= nil then
if selectedData.dataSource and selectedItemData.dataSource.equipType == 0 then
GAMEPAD_TOOLTIPS:Reset(GAMEPAD_LEFT_TOOLTIP)
end
end
end
function BUI.Inventory.Class:InitializeItemList()
self.itemList = self:AddList("Items", SetupItemList, BUI_VerticalParametricScrollList)
self.itemList:SetSortFunction(BUI_GamepadInventory_DefaultItemSortComparator)
self.itemList:SetOnSelectedDataChangedCallback(function(list, selectedData)
if selectedData ~= nil and self.scene:IsShowing() then
self.currentlySelectedData = selectedData
self:SetSelectedInventoryData(selectedData)
self:UpdateItemLeftTooltip(selectedData)
if self.callLaterLeftToolTip ~= nil then
EVENT_MANAGER:UnregisterForUpdate(self.callLaterLeftToolTip)
end
local callLaterId = zo_callLater(function() self:UpdateItemLeftTooltip(selectedData) end, INVENTORY_LEFT_TOOL_TIP_REFRESH_DELAY_MS)
self.callLaterLeftToolTip = "CallLaterFunction"..callLaterId
self:PrepareNextClearNewStatus(selectedData)
--self.itemList:RefreshVisible()
--self:UpdateRightTooltip()
self:RefreshActiveKeybinds()
end
end)
self.itemList.maxOffset = 30
self.itemList:SetHeaderPadding(GAMEPAD_HEADER_DEFAULT_PADDING * 0.75, GAMEPAD_HEADER_SELECTED_PADDING * 0.75)
self.itemList:SetUniversalPostPadding(GAMEPAD_DEFAULT_POST_PADDING * 0.75)
end
function BUI.Inventory.Class:InitializeCraftBagList()
local function OnSelectedDataCallback(list, selectedData)
if selectedData ~= nil and self.scene:IsShowing() then
self.currentlySelectedData = selectedData
self:UpdateItemLeftTooltip(selectedData)
--self:SetSelectedInventoryData(selectedData)
local currentList = self:GetCurrentList()
if currentList == self.craftBagList or ZO_Dialogs_IsShowing(ZO_GAMEPAD_INVENTORY_ACTION_DIALOG) then
self:SetSelectedInventoryData(selectedData)
self.craftBagList:RefreshVisible()
end
self:RefreshActiveKeybinds()
end
end
local function VendorEntryTemplateSetup(control, data, selected, selectedDuringRebuild, enabled, activated)
ZO_Inventory_BindSlot(data, slotType, data.slotIndex, data.bagId)
BUI_SharedGamepadEntry_OnSetup(control, data, selected, selectedDuringRebuild, enabled, activated)
end
self.craftBagList = self:AddList("CraftBag", SetupCraftBagList, BUI.Inventory.CraftList, BAG_VIRTUAL, SLOT_TYPE_CRAFT_BAG_ITEM, OnSelectedDataCallback, nil, nil, nil, false, "BUI_GamepadItemSubEntryTemplate")
self.craftBagList:SetNoItemText(GetString(SI_GAMEPAD_INVENTORY_CRAFT_BAG_EMPTY))
self.craftBagList:SetAlignToScreenCenter(true, 30)
self.craftBagList:SetSortFunction(BUI_CraftList_DefaultItemSortComparator)
end
function BUI.Inventory.Class:InitializeItemActions()
self.itemActions = BUI.Inventory.SlotActions:New(KEYBIND_STRIP_ALIGN_LEFT)
end
function BUI.Inventory.Class:InitializeActionsDialog()
local function ActionDialogSetup(dialog)
if self.scene:IsShowing() then
--d("tt inv action setup")
dialog.entryList:SetOnSelectedDataChangedCallback( function(list, selectedData)
self.itemActions:SetSelectedAction(selectedData and selectedData.action)
end)
local function MarkAsJunk()
local target = GAMEPAD_INVENTORY.itemList:GetTargetData()
SetItemIsJunk(target.bagId, target.slotIndex, true)
end
local function UnmarkAsJunk()
local target = GAMEPAD_INVENTORY.itemList:GetTargetData()
SetItemIsJunk(target.bagId, target.slotIndex, false)
end
local parametricList = dialog.info.parametricList
ZO_ClearNumericallyIndexedTable(parametricList)
self:RefreshItemActions()
--ZO_ClearTable(parametricList)
if(BUI.Settings.Modules["Inventory"].enableJunk) then
if(self.categoryList:GetTargetData().showJunk ~= nil) then
self.itemActions.slotActions.m_slotActions[#self.itemActions.slotActions.m_slotActions+1] = {GetString(SI_BUI_ACTION_UNMARK_AS_JUNK), UnmarkAsJunk, "secondary"}
else
self.itemActions.slotActions.m_slotActions[#self.itemActions.slotActions.m_slotActions+1] = {GetString(SI_BUI_ACTION_MARK_AS_JUNK), MarkAsJunk, "secondary"}
end
end
--self:RefreshItemActions()
local actions = self.itemActions:GetSlotActions()
local numActions = actions:GetNumSlotActions()
for i = 1, numActions do
local action = actions:GetSlotAction(i)
local actionName = actions:GetRawActionName(action)
local entryData = ZO_GamepadEntryData:New(actionName)
entryData:SetIconTintOnSelection(true)
entryData.action = action
entryData.setup = ZO_SharedGamepadEntry_OnSetup
local listItem =
{
template = "ZO_GamepadItemEntryTemplate",
entryData = entryData,
}
--if actionName ~= "Use" and actionName ~= "Equip" and i ~= 1 then
table.insert(parametricList, listItem)
--end
end
dialog:setupFunc()
end
end
local function ActionDialogFinish()
if self.scene:IsShowing() then
--d("tt inv action finish")
-- make sure to wipe out the keybinds added by
self:SetActiveKeybinds(self.currentKeybindDescriptor)
--restore the selected inventory item
if self.actionMode == CATEGORY_ITEM_ACTION_MODE then
--if we refresh item actions we will get a keybind conflict
local currentList = self:GetCurrentList()
if currentList then
local targetData = currentList:GetTargetData()
if currentList == self.categoryList then
targetData = self:GenerateItemSlotData(targetData)
end
self:SetSelectedItemUniqueId(targetData)
end
else
self:RefreshItemActions()
end
--refresh so keybinds react to newly selected item
self:RefreshActiveKeybinds()
self:OnUpdate()
if self.actionMode == CATEGORY_ITEM_ACTION_MODE then
self:RefreshCategoryList()
end
end
end
local function ActionDialogButtonConfirm(dialog)
if self.scene:IsShowing() then
--d(ZO_InventorySlotActions:GetRawActionName(self.itemActions.selectedAction))
if (ZO_InventorySlotActions:GetRawActionName(self.itemActions.selectedAction) == GetString(SI_ITEM_ACTION_LINK_TO_CHAT)) then
--Also perform bag stack!
--StackBag(BAG_BACKPACK)
--link in chat
local targetData = self.itemList:GetTargetData()
local itemLink
local bag, slot = ZO_Inventory_GetBagAndIndex(targetData)
if bag and slot then
itemLink = GetItemLink(bag, slot)
end
if itemLink then
ZO_LinkHandler_InsertLink(zo_strformat(SI_TOOLTIP_ITEM_NAME, itemLink))
end
else
self.itemActions:DoSelectedAction()
end
end
end
CALLBACK_MANAGER:RegisterCallback("BUI_EVENT_ACTION_DIALOG_SETUP", ActionDialogSetup)
CALLBACK_MANAGER:RegisterCallback("BUI_EVENT_ACTION_DIALOG_FINISH", ActionDialogFinish)
CALLBACK_MANAGER:RegisterCallback("BUI_EVENT_ACTION_DIALOG_BUTTON_CONFIRM", ActionDialogButtonConfirm)
end
function BUI.Inventory.HookDestroyItem()
-- -- Overwrite the destroy callback because everything called from GAMEPAD_INVENTORY will now be classed as "insecure"
ZO_InventorySlot_InitiateDestroyItem = function(inventorySlot)
SetCursorItemSoundsEnabled(false)
local bag, index = ZO_Inventory_GetBagAndIndex(inventorySlot)
CallSecureProtected("PickupInventoryItem",bag, index) -- > Here is the key change!
SetCursorItemSoundsEnabled(true)
CallSecureProtected("PlaceInWorldLeftClick") -- DESTROY! (also needs to be a secure call)
return true
end
end
function BUI.Inventory.HookActionDialog()
local function ActionsDialogSetup(dialog, data)
dialog.entryList:SetOnSelectedDataChangedCallback(function(list, selectedData)
data.itemActions:SetSelectedAction(selectedData and selectedData.action)
end)
local parametricList = dialog.info.parametricList
ZO_ClearNumericallyIndexedTable(parametricList)
dialog.itemActions = data.itemActions
local actions = data.itemActions:GetSlotActions()
local numActions = actions:GetNumSlotActions()
for i = 1, numActions do
local action = actions:GetSlotAction(i)
local actionName = actions:GetRawActionName(action)
local entryData = ZO_GamepadEntryData:New(actionName)
entryData:SetIconTintOnSelection(true)
entryData.action = action
entryData.setup = ZO_SharedGamepadEntry_OnSetup
local listItem =
{
template = "ZO_GamepadItemEntryTemplate",
entryData = entryData,
}
table.insert(parametricList, listItem)
end
dialog.finishedCallback = data.finishedCallback
dialog:setupFunc()
end
ZO_Dialogs_RegisterCustomDialog(ZO_GAMEPAD_INVENTORY_ACTION_DIALOG,
{
setup = function(...)
if (BUI.Settings.Modules["Inventory"].m_enabled and SCENE_MANAGER.scenes['gamepad_inventory_root']:IsShowing() ) or
(BUI.Settings.Modules["Banking"].m_enabled and SCENE_MANAGER.scenes['gamepad_banking']:IsShowing() ) then
CALLBACK_MANAGER:FireCallbacks("BUI_EVENT_ACTION_DIALOG_SETUP", ...)
return
end
--original function
ActionsDialogSetup(...)
end,
gamepadInfo =
{
dialogType = GAMEPAD_DIALOGS.PARAMETRIC,
},
title =
{
text = SI_GAMEPAD_INVENTORY_ACTION_LIST_KEYBIND,
},
parametricList = {}, --we'll generate the entries on setup
finishedCallback = function(dialog)
if (BUI.Settings.Modules["Inventory"].m_enabled and SCENE_MANAGER.scenes['gamepad_inventory_root']:IsShowing() ) or
(BUI.Settings.Modules["Banking"].m_enabled and SCENE_MANAGER.scenes['gamepad_banking']:IsShowing() ) then
CALLBACK_MANAGER:FireCallbacks("BUI_EVENT_ACTION_DIALOG_FINISH", dialog)
return
end
--original function
dialog.itemActions = nil
if dialog.finishedCallback then
dialog.finishedCallback()
end
dialog.finishedCallback = nil
end,
buttons =
{
{
keybind = "DIALOG_NEGATIVE",
text = GetString(SI_DIALOG_CANCEL),
},
{
keybind = "DIALOG_PRIMARY",
text = GetString(SI_GAMEPAD_SELECT_OPTION),
callback = function(dialog)
if (BUI.Settings.Modules["Inventory"].m_enabled and SCENE_MANAGER.scenes['gamepad_inventory_root']:IsShowing() ) or
(BUI.Settings.Modules["Banking"].m_enabled and SCENE_MANAGER.scenes['gamepad_banking']:IsShowing() ) then
CALLBACK_MANAGER:FireCallbacks("BUI_EVENT_ACTION_DIALOG_BUTTON_CONFIRM", dialog)
return
end
--original function
dialog.itemActions:DoSelectedAction()
end,
},
},
})
end
-- override of ZO_Gamepad_ParametricList_Screen:OnStateChanged
function BUI.Inventory.Class:OnStateChanged(oldState, newState)
if newState == SCENE_SHOWING then
self:PerformDeferredInitialize()
BUI.CIM.SetTooltipWidth(BUI_GAMEPAD_DEFAULT_PANEL_WIDTH)
--figure out which list to land on
local listToActivate = self.previousListType or INVENTORY_CATEGORY_LIST
-- We normally do not want to enter the gamepad inventory on the item list
-- the exception is if we are coming back to the inventory, like from looting a container
if listToActivate == INVENTORY_ITEM_LIST and not SCENE_MANAGER:WasSceneOnStack(ZO_GAMEPAD_INVENTORY_SCENE_NAME) then
listToActivate = INVENTORY_CATEGORY_LIST
end
-- switching the active list will handle activating/refreshing header, keybinds, etc.
self:SwitchActiveList(listToActivate)
self:ActivateHeader()
if wykkydsToolbar then
wykkydsToolbar:SetHidden(true)
end
ZO_InventorySlot_SetUpdateCallback(function() self:RefreshItemActions() end)
elseif newState == SCENE_HIDING then
ZO_InventorySlot_SetUpdateCallback(nil)
self:Deactivate()
self:DeactivateHeader()
if wykkydsToolbar then
wykkydsToolbar:SetHidden(false)
end
if self.callLaterLeftToolTip ~= nil then
EVENT_MANAGER:UnregisterForUpdate(self.callLaterLeftToolTip)
self.callLaterLeftToolTip = nil
end
elseif newState == SCENE_HIDDEN then
self:SwitchActiveList(nil)
BUI.CIM.SetTooltipWidth(BUI_ZO_GAMEPAD_DEFAULT_PANEL_WIDTH)
self.listWaitingOnDestroyRequest = nil
self:TryClearNewStatusOnHidden()
self:ClearActiveKeybinds()
ZO_SavePlayerConsoleProfile()
if wykkydsToolbar then
wykkydsToolbar:SetHidden(false)
end
if self.callLaterLeftToolTip ~= nil then
EVENT_MANAGER:UnregisterForUpdate(self.callLaterLeftToolTip)
self.callLaterLeftToolTip = nil
end
end
end
function BUI.Inventory.Class:InitializeEquipSlotDialog()
local dialog = ZO_GenericGamepadDialog_GetControl(GAMEPAD_DIALOGS.BASIC)
local function ReleaseDialog(data, mainSlot)
local equipType = data[1].dataSource.equipType
local bound = IsItemBound(data[1].dataSource.bagId, data[1].dataSource.slotIndex)
local equipItemLink = GetItemLink(data[1].dataSource.bagId, data[1].dataSource.slotIndex)
local bindType = GetItemLinkBindType(equipItemLink)
local equipItemCallback = function()
if equipType == EQUIP_TYPE_ONE_HAND then
if(mainSlot) then
CallSecureProtected("RequestMoveItem",data[1].dataSource.bagId, data[1].dataSource.slotIndex, BAG_WORN, data[2] and EQUIP_SLOT_MAIN_HAND or EQUIP_SLOT_BACKUP_MAIN, 1)
else
CallSecureProtected("RequestMoveItem",data[1].dataSource.bagId, data[1].dataSource.slotIndex, BAG_WORN, data[2] and EQUIP_SLOT_OFF_HAND or EQUIP_SLOT_BACKUP_OFF, 1)
end
elseif equipType == EQUIP_TYPE_MAIN_HAND or
equipType == EQUIP_TYPE_TWO_HAND then
CallSecureProtected("RequestMoveItem",data[1].dataSource.bagId, data[1].dataSource.slotIndex, BAG_WORN, data[2] and EQUIP_SLOT_MAIN_HAND or EQUIP_SLOT_BACKUP_MAIN, 1)
elseif equipType == EQUIP_TYPE_OFF_HAND then
CallSecureProtected("RequestMoveItem",data[1].dataSource.bagId, data[1].dataSource.slotIndex, BAG_WORN, data[2] and EQUIP_SLOT_OFF_HAND or EQUIP_SLOT_BACKUP_OFF, 1)
elseif equipType == EQUIP_TYPE_POISON then
CallSecureProtected("RequestMoveItem",data[1].dataSource.bagId, data[1].dataSource.slotIndex, BAG_WORN, data[2] and EQUIP_SLOT_POISON or EQUIP_SLOT_BACKUP_POISON, 1)
elseif equipType == EQUIP_TYPE_RING then
if(mainSlot) then
CallSecureProtected("RequestMoveItem",data[1].dataSource.bagId, data[1].dataSource.slotIndex, BAG_WORN, EQUIP_SLOT_RING1, 1)
else
CallSecureProtected("RequestMoveItem",data[1].dataSource.bagId, data[1].dataSource.slotIndex, BAG_WORN, EQUIP_SLOT_RING2, 1)
end
end
end
ZO_Dialogs_ReleaseDialogOnButtonPress(BUI_EQUIP_SLOT_DIALOG)
if not bound and bindType == BIND_TYPE_ON_EQUIP and BUI.Settings.Modules["Inventory"].bindOnEquipProtection then
zo_callLater(function() ZO_Dialogs_ShowPlatformDialog("CONFIRM_EQUIP_BOE", {callback=equipItemCallback}, {mainTextParams={equipItemLink}}) end, DIALOG_QUEUE_WORKAROUND_TIMEOUT_DURATION)
else
equipItemCallback()
end
end
local function GetDialogSwitchButtonText(isPrimary)
return GetString(SI_BUI_INV_SWITCH_EQUIPSLOT)
end
local function GetDialogMainText(dialog)
local equipType = dialog.data[1].dataSource.equipType
local itemName = GetItemName(dialog.data[1].dataSource.bagId, dialog.data[1].dataSource.slotIndex)
local itemLink = GetItemLink(dialog.data[1].dataSource.bagId, dialog.data[1].dataSource.slotIndex)
local itemQuality = GetItemLinkQuality(itemLink)
local itemColor = GetItemQualityColor(itemQuality)
itemName = itemColor:Colorize(itemName)
local str = ""
local weaponChoice = GetString(SI_BUI_INV_EQUIPSLOT_MAIN)
if not dialog.data[2] then
weaponChoice = GetString(SI_BUI_INV_EQUIPSLOT_BACKUP)
end
if equipType == EQUIP_TYPE_ONE_HAND then
--choose Main/Off hand, Primary/Secondary weapon
str = zo_strformat(GetString(SI_BUI_INV_EQUIP_ONE_HAND_WEAPON), itemName, weaponChoice )
elseif equipType == EQUIP_TYPE_MAIN_HAND or
equipType == EQUIP_TYPE_OFF_HAND or
equipType == EQUIP_TYPE_TWO_HAND or
equipType == EQUIP_TYPE_POISON then
--choose Primary/Secondary weapon
str = zo_strformat(GetString(SI_BUI_INV_EQUIP_OTHER_WEAPON), itemName, weaponChoice )
elseif equipType == EQUIP_TYPE_RING then
--choose which rint slot
str = zo_strformat(GetString(SI_BUI_INV_EQUIP_RING), itemName)
end
return str
end
ZO_Dialogs_RegisterCustomDialog(BUI_EQUIP_SLOT_DIALOG,
{
blockDialogReleaseOnPress = true,
gamepadInfo = {
dialogType = GAMEPAD_DIALOGS.BASIC,
allowRightStickPassThrough = true,
},
setup = function()
dialog.setupFunc(dialog)
end,
title =
{
text = GetString(SI_BUI_INV_EQUIPSLOT_TITLE),
},
mainText =
{
text = function(dialog)
return GetDialogMainText(dialog)
end,
},
buttons =
{
{
keybind = "DIALOG_PRIMARY",
text = function(dialog)
local equipType = dialog.data[1].dataSource.equipType
if equipType == EQUIP_TYPE_ONE_HAND then
--choose Main/Off hand, Primary/Secondary weapon
return GetString(SI_BUI_INV_EQUIP_PROMPT_MAIN)
elseif equipType == EQUIP_TYPE_MAIN_HAND or
equipType == EQUIP_TYPE_OFF_HAND or
equipType == EQUIP_TYPE_TWO_HAND or
equipType == EQUIP_TYPE_POISON then
--choose Primary/Secondary weapon
return GetString(SI_BUI_INV_EQUIP)
elseif equipType == EQUIP_TYPE_RING then
--choose which ring slot
return GetString(SI_BUI_INV_FIRST_SLOT)
end
return ""
end,
callback = function()
ReleaseDialog(dialog.data, true)
end,
},
{
keybind = "DIALOG_SECONDARY",
text = function(dialog)
local equipType = dialog.data[1].dataSource.equipType
if equipType == EQUIP_TYPE_ONE_HAND then
--choose Main/Off hand, Primary/Secondary weapon
return GetString(SI_BUI_INV_EQUIP_PROMPT_BACKUP)
elseif equipType == EQUIP_TYPE_MAIN_HAND or
equipType == EQUIP_TYPE_OFF_HAND or
equipType == EQUIP_TYPE_TWO_HAND or
equipType == EQUIP_TYPE_POISON then
--choose Primary/Secondary weapon
return ""
elseif equipType == EQUIP_TYPE_RING then
--choose which rint slot
return GetString(SI_BUI_INV_SECOND_SLOT)
end
return ""
end,
visible = function(dialog)
local equipType = dialog.data[1].dataSource.equipType
if equipType == EQUIP_TYPE_ONE_HAND or
equipType == EQUIP_TYPE_RING then
return true
end
return false
end,
callback = function(dialog)
ReleaseDialog(dialog.data, false)
end,
},
{
keybind = "DIALOG_TERTIARY",
text = function(dialog)
return GetDialogSwitchButtonText(dialog.data[2])
end,
visible = function(dialog)
local equipType = dialog.data[1].dataSource.equipType
return equipType ~= EQUIP_TYPE_RING
end,
callback = function(dialog)
--switch weapon
dialog.data[2] = not dialog.data[2]
--update inventory window's header
GAMEPAD_INVENTORY.isPrimaryWeapon = dialog.data[2]
--d("abc", dialog.data[2])
GAMEPAD_INVENTORY:RefreshHeader()
--update dialog
ZO_GenericGamepadDialog_RefreshText(dialog, dialog.headerData.titleText, GetDialogMainText(dialog), warningText)
ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
end,
},
{
keybind = "DIALOG_NEGATIVE",
alignment = KEYBIND_STRIP_ALIGN_RIGHT,
text = SI_DIALOG_CANCEL,
callback = function()
ZO_Dialogs_ReleaseDialogOnButtonPress(BUI_EQUIP_SLOT_DIALOG)
end,
},
}
})
end
function BUI.Inventory.Class:OnUpdate(currentFrameTimeSeconds)
--if no currentFrameTimeSeconds a manual update was called from outside the update loop.
if not currentFrameTimeSeconds or (self.nextUpdateTimeSeconds and (currentFrameTimeSeconds >= self.nextUpdateTimeSeconds)) then
self.nextUpdateTimeSeconds = nil
if self.actionMode == ITEM_LIST_ACTION_MODE then
self:RefreshItemList()
-- it's possible we removed the last item from this list
-- so we want to switch back to the category list
if self.itemList:IsEmpty() then
self:SwitchActiveList(INVENTORY_CATEGORY_LIST)
else
-- don't refresh item actions if we are switching back to the category view
-- otherwise we get keybindstrip errors (Item actions will try to add an "A" keybind
-- and we already have an "A" keybind)
--self:UpdateRightTooltip()
self:RefreshItemActions()
end
elseif self.actionMode == CRAFT_BAG_ACTION_MODE then
self:RefreshCraftBagList()
self:RefreshItemActions()
else -- CATEGORY_ITEM_ACTION_MODE
self:UpdateCategoryLeftTooltip(self.categoryList:GetTargetData())
end
end
end
function BUI.Inventory.Class:OnDeferredInitialize()
local SAVED_VAR_DEFAULTS =
{
useStatComparisonTooltip = true,
}
self.savedVars = ZO_SavedVars:NewAccountWide("ZO_Ingame_SavedVariables", 2, "GamepadInventory", SAVED_VAR_DEFAULTS)
self.switchInfo = false
self:SetListsUseTriggerKeybinds(true)
self.categoryPositions = {}
self.categoryCraftPositions = {}
self.populatedCategoryPos = false
self.populatedCraftPos = false
self.isPrimaryWeapon = true
self:InitializeCategoryList()
self:InitializeHeader()
self:InitializeCraftBagList()
self:InitializeItemList()
self:InitializeKeybindStrip()
self:InitializeConfirmDestroyDialog()
self:InitializeEquipSlotDialog()
self:InitializeItemActions()
self:InitializeActionsDialog()
local function RefreshHeader()
if not self.control:IsHidden() then
self:RefreshHeader(BLOCK_TABBAR_CALLBACK)
end
end
local function RefreshSelectedData()
if not self.control:IsHidden() then
self:SetSelectedInventoryData(self.currentlySelectedData)
end
end
self:RefreshCategoryList()
self:SetSelectedItemUniqueId(self:GenerateItemSlotData(self.categoryList:GetTargetData()))
self:RefreshHeader()
self:ActivateHeader()
self.control:RegisterForEvent(EVENT_MONEY_UPDATE, RefreshHeader)
self.control:RegisterForEvent(EVENT_ALLIANCE_POINT_UPDATE, RefreshHeader)
self.control:RegisterForEvent(EVENT_TELVAR_STONE_UPDATE, RefreshHeader)
self.control:RegisterForEvent(EVENT_PLAYER_DEAD, RefreshSelectedData)
self.control:RegisterForEvent(EVENT_PLAYER_REINCARNATED, RefreshSelectedData)
local function OnInventoryUpdated(bagId)
self:MarkDirty()
local currentList = self:GetCurrentList()
if self.scene:IsShowing() then
-- we only want to update immediately if we are in the gamepad inventory scene
if ZO_Dialogs_IsShowing(ZO_GAMEPAD_INVENTORY_ACTION_DIALOG) then
self:OnUpdate() --don't wait for next update loop in case item was destroyed and scene/keybinds need immediate update
else
if currentList == self.categoryList then
self:RefreshCategoryList()
elseif currentList == self.itemList then
KEYBIND_STRIP:UpdateKeybindButton(self.currentKeybindDescriptor)
end
RefreshSelectedData() --dialog will refresh selected when it hides, so only do it if it's not showing
self:RefreshHeader(BLOCK_TABBAR_CALLBACK)
end
end
end
SHARED_INVENTORY:RegisterCallback("FullInventoryUpdate", OnInventoryUpdated)
SHARED_INVENTORY:RegisterCallback("SingleSlotInventoryUpdate", OnInventoryUpdated)
SHARED_INVENTORY:RegisterCallback("FullQuestUpdate", OnInventoryUpdated)
SHARED_INVENTORY:RegisterCallback("SingleQuestUpdate", OnInventoryUpdated)
end
function BUI.Inventory.Class:Initialize(control)
GAMEPAD_INVENTORY_ROOT_SCENE = ZO_Scene:New(ZO_GAMEPAD_INVENTORY_SCENE_NAME, SCENE_MANAGER)
BUI_Gamepad_ParametricList_Screen.Initialize(self, control, ZO_GAMEPAD_HEADER_TABBAR_CREATE, false, GAMEPAD_INVENTORY_ROOT_SCENE)
self:InitializeSplitStackDialog()
local function CallbackSplitStackFinished()
--refresh list
if self.scene:IsShowing() then
--d("tt inv splited!")
self:ToSavedPosition()
end
end
CALLBACK_MANAGER:RegisterCallback("BUI_EVENT_SPLIT_STACK_DIALOG_FINISHED", CallbackSplitStackFinished)
local function OnCancelDestroyItemRequest()
if self.listWaitingOnDestroyRequest then
self.listWaitingOnDestroyRequest:Activate()
self.listWaitingOnDestroyRequest = nil
end
ZO_Dialogs_ReleaseDialog(ZO_GAMEPAD_CONFIRM_DESTROY_DIALOG)
end
local function OnUpdate(updateControl, currentFrameTimeSeconds)
self:OnUpdate(currentFrameTimeSeconds)
end
self.trySetClearNewFlagCallback = function(callId)
self:TrySetClearNewFlag(callId)
end
local function RefreshVisualLayer()
if self.scene:IsShowing() then
self:OnUpdate()
if self.actionMode == CATEGORY_ITEM_ACTION_MODE then
self:RefreshCategoryList()
self:SwitchActiveList(INVENTORY_ITEM_LIST)
end
end
end
--self:SetDefaultSort(BUI_ITEM_SORT_BY.SORT_NAME)
control:RegisterForEvent(EVENT_CANCEL_MOUSE_REQUEST_DESTROY_ITEM, OnCancelDestroyItemRequest)
control:RegisterForEvent(EVENT_VISUAL_LAYER_CHANGED, RefreshVisualLayer)
control:SetHandler("OnUpdate", OnUpdate)
end
function BUI.Inventory.Class:RefreshHeader(blockCallback)
local currentList = self:GetCurrentList()
local headerData
if currentList == self.craftBagList then
headerData = self.craftBagHeaderData
elseif currentList == self.categoryList then
headerData = self.categoryHeaderData
else
headerData = self.itemListHeaderData
end
BUI.GenericHeader.Refresh(self.header, headerData, blockCallback)
BUI.GenericHeader.SetEquipText(self.header, self.isPrimaryWeapon)
BUI.GenericHeader.SetBackupEquipText(self.header, self.isPrimaryWeapon)
BUI.GenericHeader.SetEquippedIcons(self.header, GetEquippedItemInfo(EQUIP_SLOT_MAIN_HAND), GetEquippedItemInfo(EQUIP_SLOT_OFF_HAND), GetEquippedItemInfo(EQUIP_SLOT_POISON))
BUI.GenericHeader.SetBackupEquippedIcons(self.header, GetEquippedItemInfo(EQUIP_SLOT_BACKUP_MAIN), GetEquippedItemInfo(EQUIP_SLOT_BACKUP_OFF), GetEquippedItemInfo(EQUIP_SLOT_BACKUP_POISON))
self:RefreshCategoryList()
BUI.GenericFooter.Refresh(self)
end
function BUI.Inventory:RefreshFooter()
BUI.GenericFooter.Refresh(self.footer)
end
function BUI.Inventory.Class:Select()
if not self.categoryList:GetTargetData().onClickDirection then
self:SwitchActiveList(INVENTORY_ITEM_LIST)
else
self:SwitchActiveList(INVENTORY_CRAFT_BAG_LIST)
end
end
function BUI.Inventory.Class:Switch()
if self:GetCurrentList() == self.craftBagList then
self:SwitchActiveList(INVENTORY_ITEM_LIST)
else
self:SwitchActiveList(INVENTORY_CRAFT_BAG_LIST)
self:RefreshCraftBagList()
end
end
function BUI.Inventory.Class:SwitchActiveList(listDescriptor)
if listDescriptor == self.currentListType then return end
self.previousListType = self.currentListType
self.currentListType = listDescriptor
if self.previousListType == INVENTORY_ITEM_LIST or self.previousListType == INVENTORY_CATEGORY_LIST then
self.listWaitingOnDestroyRequest = nil
self:TryClearNewStatusOnHidden()
ZO_SavePlayerConsoleProfile()
else
self.listWaitingOnDestroyRequest = nil
self:TryClearNewStatusOnHidden()
ZO_SavePlayerConsoleProfile()
end
GAMEPAD_TOOLTIPS:Reset(GAMEPAD_LEFT_TOOLTIP)
GAMEPAD_TOOLTIPS:Reset(GAMEPAD_RIGHT_TOOLTIP)
if listDescriptor == INVENTORY_CATEGORY_LIST then
listDescriptor = INVENTORY_ITEM_LIST
elseif listDescriptor ~= INVENTORY_ITEM_LIST and listDescriptor ~= INVENTORY_CATEGORY_LIST then
listDescriptor = INVENTORY_CRAFT_BAG_LIST
end
if self.scene:IsShowing() then
if listDescriptor == INVENTORY_ITEM_LIST then
self:SetCurrentList(self.itemList)
self:SetActiveKeybinds(self.mainKeybindStripDescriptor)
self:RefreshCategoryList()
self:RefreshItemList()
self:SetSelectedItemUniqueId(self.itemList:GetTargetData())
self.actionMode = ITEM_LIST_ACTION_MODE
self:RefreshItemActions()
-- if self.callLaterRightToolTip ~= nil then
-- EVENT_MANAGER:UnregisterForUpdate(self.callLaterRightToolTip)
-- end
-- local callLaterId = zo_callLater(function() self:UpdateRightTooltip() end, 100)
-- self.callLaterRightToolTip = "CallLaterFunction"..callLaterId
self:RefreshHeader(BLOCK_TABBAR_CALLBACK)
self:UpdateItemLeftTooltip(self.itemList.selectedData)
--if self.callLaterLeftToolTip ~= nil then
-- EVENT_MANAGER:UnregisterForUpdate(self.callLaterLeftToolTip)
--end
--
--local callLaterId = zo_callLater(function() self:UpdateItemLeftTooltip(self.itemList.selectedData) end, 100)
--self.callLaterLeftToolTip = "CallLaterFunction"..callLaterId
elseif listDescriptor == INVENTORY_CRAFT_BAG_LIST then
self:SetCurrentList(self.craftBagList)
self:SetActiveKeybinds(self.mainKeybindStripDescriptor)
self:RefreshCategoryList()
self:RefreshCraftBagList()
self:SetSelectedItemUniqueId(self.craftBagList:GetTargetData())
self.actionMode = CRAFT_BAG_ACTION_MODE
self:RefreshItemActions()
self:RefreshHeader()
self:ActivateHeader()
self:LayoutCraftBagTooltip(GAMEPAD_LEFT_TOOLTIP)
--TriggerTutorial(TUTORIAL_TRIGGER_CRAFT_BAG_OPENED)
end
self:RefreshActiveKeybinds()
else
self.actionMode = nil
end
end
function BUI.Inventory.Class:ActivateHeader()
ZO_GamepadGenericHeader_Activate(self.header)
self.header.tabBar:SetSelectedIndexWithoutAnimation(self.categoryList.selectedIndex, true, false)
end
function BUI.Inventory.Class:AddList(name, callbackParam, listClass, ...)
local listContainer = CreateControlFromVirtual("$(parent)"..name, self.control.container, "BUI_Gamepad_ParametricList_Screen_ListContainer")
local list = self.CreateAndSetupList(self, listContainer.list, callbackParam, listClass, ...)
list.alignToScreenCenterExpectedEntryHalfHeight = 15
self.lists[name] = list
local CREATE_HIDDEN = true
self:CreateListFragment(name, CREATE_HIDDEN)
return list
end
function BUI.Inventory.Class:BUI_IsSlotLocked(inventorySlot)
if (not inventorySlot) then
return false
end
local slot = PLAYER_INVENTORY:SlotForInventoryControl(inventorySlot)
if slot then
return slot.locked
end
end
--------------
-- Keybinds --
--------------
local function IsInventorySlotLockedOrJunk(targetData)
local bag, index = ZO_Inventory_GetBagAndIndex(targetData)
return (not IsItemPlayerLocked(bag, index) or IsItemJunk(bag, index))
end
function BUI.Inventory.Class:InitializeKeybindStrip()
self.mainKeybindStripDescriptor = {
--X Button for Quick Action
{
alignment = KEYBIND_STRIP_ALIGN_LEFT,
name = function()
if self.actionMode == ITEM_LIST_ACTION_MODE then
--bag mode
local isQuickslot = ZO_InventoryUtils_DoesNewItemMatchFilterType(self.itemList.selectedData, ITEMFILTERTYPE_QUICKSLOT)
local filterType = GetItemFilterTypeInfo(self.itemList.selectedData.bagId, self.itemList.selectedData.slotIndex)
if isQuickslot then
--assign
return GetString(SI_BUI_INV_ACTION_QUICKSLOT_ASSIGN)
elseif filterType == ITEMFILTERTYPE_WEAPONS or filterType == ITEMFILTERTYPE_ARMOR then
--switch compare
return GetString(SI_BUI_INV_SWITCH_INFO)
end
elseif self.actionMode == CRAFT_BAG_ACTION_MODE then
--craftbag mode
return GetString(SI_ITEM_ACTION_LINK_TO_CHAT)
else
return ""
end
end,
keybind = "UI_SHORTCUT_SECONDARY",
visible = function()
if self.actionMode == ITEM_LIST_ACTION_MODE then
local isQuickslot = ZO_InventoryUtils_DoesNewItemMatchFilterType(self.itemList.selectedData, ITEMFILTERTYPE_QUICKSLOT)
local filterType = GetItemFilterTypeInfo(self.itemList.selectedData.bagId, self.itemList.selectedData.slotIndex)
if not isQuickslot and filterType ~= ITEMFILTERTYPE_WEAPONS and filterType ~= ITEMFILTERTYPE_ARMOR then
return false
end
return true
end
end,
callback = function()
if self.actionMode == ITEM_LIST_ACTION_MODE then
--bag mode
local isQuickslot = ZO_InventoryUtils_DoesNewItemMatchFilterType(self.itemList.selectedData, ITEMFILTERTYPE_QUICKSLOT)
local filterType = GetItemFilterTypeInfo(self.itemList.selectedData.bagId, self.itemList.selectedData.slotIndex)
if isQuickslot then
--assign
self:ShowQuickslot()
elseif filterType == ITEMFILTERTYPE_WEAPONS or filterType == ITEMFILTERTYPE_ARMOR then
--switch compare
self:SwitchInfo()
end
elseif self.actionMode == CRAFT_BAG_ACTION_MODE then
--craftbag mode
local targetData = self.craftBagList:GetTargetData()
local itemLink
local bag, slot = ZO_Inventory_GetBagAndIndex(targetData)
if bag and slot then
itemLink = GetItemLink(bag, slot)
end
if itemLink then
ZO_LinkHandler_InsertLink(zo_strformat(SI_TOOLTIP_ITEM_NAME, itemLink))
end
end
end,
},
--Y Button for Actions
{
name = GetString(SI_GAMEPAD_INVENTORY_ACTION_LIST_KEYBIND),
alignment = KEYBIND_STRIP_ALIGN_LEFT,
keybind = "UI_SHORTCUT_TERTIARY",
order = 1000,
visible = function()
if self.actionMode == ITEM_LIST_ACTION_MODE then
return self.selectedItemUniqueId ~= nil or self.itemList:GetTargetData() ~= nil
elseif self.actionMode == CRAFT_BAG_ACTION_MODE then
return self.selectedItemUniqueId ~= nil
end
end,
callback = function()
self:SaveListPosition()
self:ShowActions()
end,
},
--L Stick for Stacking Items
{
name = GetString(SI_ITEM_ACTION_STACK_ALL),
alignment = KEYBIND_STRIP_ALIGN_LEFT,
keybind = "UI_SHORTCUT_LEFT_STICK",
disabledDuringSceneHiding = true,
visible = function()
return self.actionMode == ITEM_LIST_ACTION_MODE
end,
callback = function()
StackBag(BAG_BACKPACK)
end,
},
--R Stick for Switching Bags
{
name = function()
return zo_strformat(GetString(SI_BUI_INV_ACTION_TO_TEMPLATE), GetString(self:GetCurrentList() == self.craftBagList and SI_BUI_INV_ACTION_INV or SI_BUI_INV_ACTION_CB))
end,
alignment = KEYBIND_STRIP_ALIGN_RIGHT,
keybind = "UI_SHORTCUT_RIGHT_STICK",
disabledDuringSceneHiding = true,
callback = function()
self:Switch()
end,
},
}
ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.mainKeybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON)
end
local function BUI_TryPlaceInventoryItemInEmptySlot(targetBag)
local emptySlotIndex, bagId
if targetBag == BAG_BANK or targetBag == BAG_SUBSCRIBER_BANK then
--should find both in bank and subscriber bank
emptySlotIndex = FindFirstEmptySlotInBag(BAG_BANK)
if emptySlotIndex ~= nil then
bagId = BAG_BANK
else
emptySlotIndex = FindFirstEmptySlotInBag(BAG_SUBSCRIBER_BANK)
if emptySlotIndex ~= nil then
bagId = BAG_SUBSCRIBER_BANK
end
end
else
--just find the bag
emptySlotIndex = FindFirstEmptySlotInBag(targetBag)
if emptySlotIndex ~= nil then
bagId = targetBag
end
end
if bagId ~= nil then
CallSecureProtected("PlaceInInventory", bagId, emptySlotIndex)
else
local errorStringId = (targetBag == BAG_BACKPACK) and SI_INVENTORY_ERROR_INVENTORY_FULL or SI_INVENTORY_ERROR_BANK_FULL
ZO_Alert(UI_ALERT_CATEGORY_ERROR, SOUNDS.NEGATIVE_CLICK, errorStringId)
end
end
function BUI.Inventory.Class:InitializeSplitStackDialog()
ZO_Dialogs_RegisterCustomDialog(ZO_GAMEPAD_SPLIT_STACK_DIALOG,
{
blockDirectionalInput = true,
canQueue = true,
gamepadInfo = {
dialogType = GAMEPAD_DIALOGS.ITEM_SLIDER,
},
setup = function(dialog, data)
dialog:setupFunc()
end,
title =
{
text = SI_GAMEPAD_INVENTORY_SPLIT_STACK_TITLE,
},
mainText =
{
text = SI_GAMEPAD_INVENTORY_SPLIT_STACK_PROMPT,
},
OnSliderValueChanged = function(dialog, sliderControl, value)
dialog.sliderValue1:SetText(dialog.data.stackSize - value)
dialog.sliderValue2:SetText(value)
end,
buttons =
{
{
keybind = "DIALOG_NEGATIVE",
text = GetString(SI_DIALOG_CANCEL),
},
{
keybind = "DIALOG_PRIMARY",
text = GetString(SI_GAMEPAD_SELECT_OPTION),
callback = function(dialog)
local dialogData = dialog.data
local quantity = ZO_GenericGamepadItemSliderDialogTemplate_GetSliderValue(dialog)
CallSecureProtected("PickupInventoryItem",dialogData.bagId, dialogData.slotIndex, quantity)
BUI_TryPlaceInventoryItemInEmptySlot(dialogData.bagId)
CALLBACK_MANAGER:FireCallbacks("BUI_EVENT_SPLIT_STACK_DIALOG_FINISHED")
end,
},
}
})
end
|
-- luacheck: std max+busted
describe("Primitives", function()
local G2D, G2D12
setup(function()
G2D = require"geometry2d"
G2D12 = G2D:new(1, 2, 1)
end)
test("dot", function()
assert.equal(1, G2D12:dot(0, 1, 0, 1))
assert.equal(0, G2D12:dot(0, 1, 1, 0))
assert.equal(2, G2D12:dot(1, 1, 1, 1))
assert.equal(1, G2D12:dot(0, 1, 1, 1))
end)
test("point_to_point", function()
assert.equal(0, G2D12:point_to_point(0, 1, 0, 1))
assert.equal(1, G2D12:point_to_point(0, 0, 0, 1))
assert.equal(math.sqrt(2), G2D12:point_to_point(0, 0, 1, 1))
assert.equal(math.sqrt(2), G2D12:point_to_point(0, 0, -1, -1))
end)
test("to_left", function()
assert(G2D12:to_left(-1, 0, 0, -1, 0, 1) > 0)
assert(G2D12:to_left( 1, 0, 0, -1, 0, 1) < 0)
assert(G2D12:to_left( 0, 0, 0, -1, 0, 1) == 0)
assert(G2D12:to_left(-1, 0, 0, 1, 0, -1) < 0)
assert(G2D12:to_left( 1, 0, 0, 1, 0, -1) > 0)
assert(G2D12:to_left( 0, 0, 0, 1, 0, -1) == 0)
end)
test("left_normal", function()
assert.are.same({ -1, 0 }, { G2D12:left_normal(0, 0, 0, 1) })
assert.are.same({ 1, 0 }, { G2D12:left_normal(0, 0, 0, -1) })
assert.are.same({ 0, 1 }, { G2D12:left_normal(0, 0, 1, 0) })
assert.are.same({ 0, -1 }, { G2D12:left_normal(0, 0, -1, 0) })
assert.are.same({ -1, 0 }, { G2D12:left_normal(1, 1, 1, 2) })
-- If you change this to math.sqrt(0.5), then it's not floating-point exact.
-- This should really be a test for closeness, but...
assert.are.same({ -1 / math.sqrt(2), 1 / math.sqrt(2) }, { G2D12:left_normal(1, 1, 2, 2) })
end)
test("point_to_segment", function()
assert.equal(1, G2D12:point_to_segment(-1, 0, 0, 0, 2, 0))
assert.equal(0, G2D12:point_to_segment( 0, 0, 0, 0, 2, 0))
assert.equal(0, G2D12:point_to_segment( 1, 0, 0, 0, 2, 0))
assert.equal(0, G2D12:point_to_segment( 2, 0, 0, 0, 2, 0))
assert.equal(1, G2D12:point_to_segment( 3, 0, 0, 0, 2, 0))
assert.equal(math.sqrt(2), G2D12:point_to_segment(-1, 1, 0, 0, 2, 0))
assert.equal(1, G2D12:point_to_segment( 0, 1, 0, 0, 2, 0))
assert.equal(1, G2D12:point_to_segment( 1, 1, 0, 0, 2, 0))
assert.equal(1, G2D12:point_to_segment( 2, 1, 0, 0, 2, 0))
assert.equal(math.sqrt(2), G2D12:point_to_segment( 3, 1, 0, 0, 2, 0))
assert.equal(1, G2D12:point_to_segment( 0, -1, 0, 0, 0, 2))
assert.equal(0, G2D12:point_to_segment( 0, 0, 0, 0, 0, 2))
assert.equal(0, G2D12:point_to_segment( 0, 1, 0, 0, 0, 2))
assert.equal(0, G2D12:point_to_segment( 0, 2, 0, 0, 0, 2))
assert.equal(1, G2D12:point_to_segment( 0, 3, 0, 0, 0, 2))
assert.equal(math.sqrt(2), G2D12:point_to_segment(1, -1, 0, 0, 0, 2))
assert.equal(1, G2D12:point_to_segment( 1, 0, 0, 0, 0, 2))
assert.equal(1, G2D12:point_to_segment( 1, 1, 0, 0, 0, 2))
assert.equal(1, G2D12:point_to_segment( 1, 2, 0, 0, 0, 2))
assert.equal(math.sqrt(2), G2D12:point_to_segment(1, 3, 0, 0, 0, 2))
end)
test("segment_to_segment", function()
assert.equal(1, G2D12:segment_to_segment( 0, 0, 1, 0, -2, 0, -1, 0))
assert.equal(0, G2D12:segment_to_segment( 0, 0, 1, 0, -1, 0, 0, 0))
assert.equal(0, G2D12:segment_to_segment( 0, 0, 1, 0, 0, 0, 1, 0))
assert.equal(0, G2D12:segment_to_segment( 0, 0, 1, 0, 1, 0, 2, 0))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 1, 0, 2, 0, 3, 0))
assert.equal(math.sqrt(2), G2D12:segment_to_segment( 0, 0, 1, 0, -2, 1, -1, 1))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 1, 0, -1, 1, 0, 1))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 1, 0, 0, 1, 1, 1))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 1, 0, 1, 1, 2, 1))
assert.equal(math.sqrt(2), G2D12:segment_to_segment( 0, 0, 1, 0, 2, 1, 3, 1))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 2, 0, 1, -3, 1, -1))
assert.equal(0, G2D12:segment_to_segment( 0, 0, 2, 0, 1, -2, 1, 0))
assert.equal(0, G2D12:segment_to_segment( 0, 0, 2, 0, 1, -1, 1, 1))
assert.equal(0, G2D12:segment_to_segment( 0, 0, 2, 0, 1, 0, 1, 1))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 2, 0, 1, 1, 1, 2))
assert.equal(math.sqrt(2), G2D12:segment_to_segment( 0, 0, 2, 0, -1, -3, -1, -1))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 2, 0, -1, -2, -1, 0))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 2, 0, -1, -1, -1, 1))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 2, 0, -1, 0, -1, 1))
assert.equal(math.sqrt(2), G2D12:segment_to_segment( 0, 0, 2, 0, -1, 1, -1, 2))
assert.equal(math.sqrt(2), G2D12:segment_to_segment( 0, 0, 2, 0, 3, -3, 3, -1))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 2, 0, 3, -2, 3, 0))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 2, 0, 3, -1, 3, 1))
assert.equal(1, G2D12:segment_to_segment( 0, 0, 2, 0, 3, 0, 3, 1))
assert.equal(math.sqrt(2), G2D12:segment_to_segment( 0, 0, 2, 0, 3, 1, 3, 2))
end)
end)
describe("Polylines", function()
local G2D, G2D12
setup(function()
G2D = require"geometry2d"
G2D12 = G2D:new(1, 2, 1)
end)
test("polyline_length", function()
assert.equal(2, G2D12:polyline_length({{0,0}, {1,0}, {1,1}}))
assert.equal(math.sqrt(8), G2D12:polyline_length({{0,0}, {1,1}, {2,0}}))
end)
test("polyline_length_to", function()
assert.equal(2, G2D12:polyline_length_to({{0,0}, {1,0}, {1,1}}, 3, 0))
assert.equal(1, G2D12:polyline_length_to({{0,0}, {1,0}, {1,1}}, 2, 0))
assert.equal(1.5, G2D12:polyline_length_to({{0,0}, {1,0}, {1,1}}, 2, 0.5))
end)
test("point_to_polyline", function()
assert.equal(math.sqrt(0.5), G2D12:point_to_polyline(0, 0, {{0,1},{1,0}}))
assert.equal(1, G2D12:point_to_polyline(0, 0, {{2,0},{2,1},{-2,1}}))
end)
test("polyline_to_polyline", function()
assert.equal(1, G2D12:polyline_to_polyline({{0,0},{1,0},{2,0},{3,0}}, {{0,1},{1,1},{3,1}}))
assert.equal(1, G2D12:polyline_to_polyline({{0,0},{1,0},{2,1},{3,0}}, {{0,3},{1,2},{3,2}}))
assert.equal(0, G2D12:polyline_to_polyline({{0,0},{1,1},{5,5}}, {{0,5},{1,4},{5,0}}))
end)
test("reverse_points", function()
assert.are_same({{1,0},{0,0}}, G2D12:reverse_points({{0,0},{1,0}}))
assert.are_same({{2,0},{1,0},{0,0}}, G2D12:reverse_points({{0,0},{1,0},{2,0}}))
end)
test("reverse_coordinates", function()
assert.are_same({{1,0},{0,0}}, G2D12:reverse_coordinates({{0,0},{1,0}}))
assert.are_same({{2,0},{1,0},{0,0}}, G2D12:reverse_coordinates({{0,0},{1,0},{2,0}}))
end)
end)
describe("Polygons", function()
local G2D, G2D12
local squares
setup(function()
G2D = require"geometry2d"
G2D12 = G2D:new(1, 2, 1)
local square_data = {{ -1, -1 }, { -1, 1 }, { 1, 1 }, { 1, -1 }}
squares = {}
for i = 1, 4 do
squares[i] = {}
for j = 1, 5 do
squares[i][j] = square_data[(i + j - 2) % 4 + 1]
end
end
for i = 5, 8 do
squares[i] = {}
for j = 1, 5 do
squares[i][j] = square_data[-(i + j - 2) % 4 + 1]
end
end
end)
test("inside_polygon", function()
for _, p in ipairs{{0,0},{0.9,0.9}} do
for i = 1, 8 do
assert(G2D12:inside_polygon(p[1], p[2], squares[i]))
end
end
for _, p in ipairs{{2,2},{0,1.1},{1.1,1.1}} do
for i = 1, 8 do
assert(not G2D12:inside_polygon(p[1], p[2], squares[i]))
end
end
end)
test("polygon_orientation", function()
assert.equal("degenerate", G2D12:polygon_orientation({{0,0},{0,1},{0,0}}))
for i = 1, 4 do
assert.equal("clockwise", G2D12:polygon_orientation(squares[i]))
end
for i = 5, 8 do
assert.equal("counterclockwise", G2D12:polygon_orientation(squares[i]))
end
end)
test("polygon_centroid", function()
for i = 1, 8 do
assert.are.same({0,0}, { G2D12:polygon_centroid(squares[i]) })
end
end)
test("polygon_area", function()
assert.equal(0, G2D12:polygon_area({{0,0},{0,1},{0,0}}))
for i = 1, 4 do
assert.equal(4, G2D12:polygon_area(squares[i]))
end
for i = 5, 8 do
assert.equal(-4, G2D12:polygon_area(squares[i]))
end
end)
end)
|
function Initialize()
-- Get info from Skin
measureOriginalWidth = SKIN:GetMeasure('MeasureOriginalWidth')
measureOriginalHeight = SKIN:GetMeasure('MeasureOriginalHeight')
sizeOfSquare = SELF:GetOption('SizeOfSquare')
end -- function Initialize
function Update()
-- TODO Allow Height Customization
newWidth = sizeOfSquare
newHeight = 200
originalWidth = measureOriginalWidth:GetValue()
originalHeight = measureOriginalHeight:GetValue()
-- Set height to 500, height gets calculated based on width
resize = "0,"..sizeOfSquare..",5"
-- Calculate the height and width after resizing
widthAfterResize = originalWidth / originalHeight * sizeOfSquare
heightAfterResize = originalHeight / originalWidth * sizeOfSquare
-- Starting points for where to crop
cropX = 0
cropY = 0
-- Calculate values based on ratio
if originalWidth > originalHeight then
cropX = math.floor((widthAfterResize - sizeOfSquare) / 2)
crop = cropX..","..cropY..","..newWidth..","..newHeight..",1"
elseif originalHeight > originalWidth then
resize = sizeOfSquare..",0,5" -- Set width to 500 instead of height
cropY = math.floor((heightAfterResize - sizeOfSquare) / 2)
crop = cropX.."," ..cropY..","..newWidth..","..newHeight..",1"
else
cropY = (sizeOfSquare - newHeight) / 2
crop = cropX..","..cropY..","..newWidth..","..newHeight..",1"
end
SKIN:Bang('!SetOption MeasureImage Image "File #ImagePath#| Resize '..resize..' | Crop '..crop..'"')
SKIN:Bang('!UpdateMeasure MeasureImage')
end -- function Update
|
PLoop(function()
namespace "KittyBox.Layout"
import "KittyBox.Layout"
class "FrameLayout"(function()
inherit "ViewGroup"
__Sealed__()
struct "LayoutParams"(function()
__base = KittyBox.Layout.LayoutParams
-- The gravity to apply with the View to which these layout parameters are associated.
member "gravity" { Type = Gravity }
end)
function OnLayout(self)
local paddingStart, paddingTop, paddingEnd, paddingBottom = self.PaddingStart, self.PaddingTop, self.PaddingEnd, self.PaddingBottom
local width, height = self:GetSize()
local widthAvaliable = width - paddingStart - paddingEnd
local heightAvaliable = height - paddingTop - paddingBottom
for _, child in self:GetNonGoneChilds() do
child:Layout()
local childWidth, childHeight = child:GetSize()
local lp = child.LayoutParams
local gravity = lp and lp.gravity or (Gravity.START + Gravity.TOP)
local marginStart, marginTop, marginEnd, marginBottom = child.MarginStart, child.MarginTop, child.MarginEnd, child.MarginBottom
local xOffset
if Enum.ValidateFlags(Gravity.CENTER_HORIZONTAL, gravity) then
local centerXOffset = paddingStart + widthAvaliable/2
xOffset = centerXOffset - childWidth/2
elseif Enum.ValidateFlags(Gravity.END, gravity) then
xOffset = paddingStart + (widthAvaliable - childWidth)
else
xOffset = paddingStart
end
xOffset = xOffset + marginStart
local yOffset
if Enum.ValidateFlags(Gravity.CENTER_HORIZONTAL, gravity) then
local centerYOffset = paddingTop + heightAvaliable/2
yOffset = centerYOffset - childHeight/2
elseif Enum.ValidateFlags(Gravity.BOTTOM, gravity) then
yOffset = paddingTop + (heightAvaliable - childHeight)
else
yOffset = paddingTop
end
yOffset = yOffset + marginTop
self:LayoutChild(child, xOffset, yOffset)
end
end
function OnMeasure(self, widthMeasureSpec, heightMeasureSpec)
local paddingStart, paddingTop, paddingEnd, paddingBottom = self.PaddingStart, self.PaddingTop, self.PaddingEnd, self.PaddingBottom
local measuredWidth, measuredHeight = 0, 0
for _, child in self:GetNonGoneChilds() do
local marginStart, marginEnd, marginTop, marginBottom = child.MarginStart, child.MarginEnd, child.MarginTop, child.MarginBottom
local usedWidth = paddingStart + paddingEnd + marginStart + marginEnd
local usedHeight = paddingTop + paddingBottom + marginTop + marginBottom
child:Measure(IView.GetChildMeasureSpec(widthMeasureSpec, usedWidth, child.Width, child.MaxWidth),
IView.GetChildMeasureSpec(heightMeasureSpec, usedHeight, child.Height, child.MaxHeight))
measuredWidth = math.max(measuredWidth, usedWidth + child:GetMeasuredWidth())
measuredHeight = math.max(measuredHeight, usedHeight + child:GetMeasuredHeight())
end
self:SetMeasuredSize(IView.GetDefaultMeasureSize(measuredWidth, widthMeasureSpec), IView.GetDefaultMeasureSize(measuredHeight, heightMeasureSpec))
end
function OnChildAdded(self)
for index, child in self:GetChildViews() do
child:SetViewFrameLevelInternal(self:GetFrameLevel() + index)
end
end
function CheckLayoutParams(self, layoutParams)
if not layoutParams then return true end
return Struct.ValidateValue(FrameLayout.LayoutParams, layoutParams, true) and true or false
end
end)
end)
|
-- package with minimal resources size
wpkconf = {
-- result package name
label = "hms-tiny",
-- list of skins IDs, see 'id' tags of 'skinlist' in 'resmodel.json' file
skinset = {
"daylight", "blue", "dark",
},
-- list of icons collections IDs, see 'id' tags of 'iconlist' in 'resmodel.json' file
iconset = {
tulliana = {"webp"},
},
-- default skin ID if nothing was selected
defskinid = "blue",
-- default icons collection ID if nothing was selected
deficonid = "tulliana",
}
-- enable/disable progress log
logrec = false
logdir = false
dofile(path.join(scrdir, "pack.lua"))
|
local ReactFiberCompleteWork = require "ReactFiberCompleteWork"
local pi = require "pi"
pi(ReactFiberCompleteWork)
|
--- Premake 5 Glasslight Ninja generator.
--- Mykola Konyk, 2021
local p = premake
local tree = p.tree
local ninja = p.modules.ninja
ninja.rules = {}
local m = ninja.rules
function m.build_command_cc_cxx(toolset, cfg, exe)
local result = ""
if toolset.getname() == "msc" then
result = "$out.d /showIncludes -c $in /Fo$out"
else
result = "-MMD -MF $out.d -c -o $out $in"
end
return ninja.wrap_cmd(exe .. " $defines $includes $flags " .. result)
end
function m.rule_cc_cxx_deps(toolset, cfg)
if toolset.getname() == "msc" then
return "msvc"
else
return "gcc"
end
end
function m.build_command_ar(toolset, cfg)
local result = ""
if toolset.getname() == "msc" then
result = "$in @$responsefile /nologo -OUT:$out"
else
result = "rcs $out $in @$responsefile"
end
return ninja.wrap_cmd(ninja.get_executable_ar(cfg) .. " " .. result)
end
function m.build_command_link(toolset, cfg)
local result = ""
if toolset.getname() == "msc" then
result = "$in $dep_libs $sys_libs @$responsefile $link_options /out:$out"
else
result = "-o $out $in $ @$responsefile"
end
return ninja.wrap_cmd("$pre_link " .. ninja.get_executable_link(cfg) .. " " .. result)
end
function m.generate(wks)
local cfg = wks.ninja.current_cfg
local toolset = ninja.get_toolset(cfg)
p.w("# rules file")
p.w("# generated with premake5 ninja")
p.w("")
p.w("ninja_required_version = 1.10")
p.w("")
p.w("# rules for " .. cfg.name .. " configuration")
p.w("")
-- Generate a cc rule.
do
p.w("rule cc")
p.w(" command = " .. m.build_command_cc_cxx(toolset, cfg, ninja.get_executable_cc(cfg)))
p.w(" description = Building c object $out")
p.w(" depfile = $out.d")
p.w(" deps = " .. m.rule_cc_cxx_deps(toolset, cfg))
p.w("")
end
-- Generate a cxx rule.
do
p.w("rule cxx")
p.w(" command = " .. m.build_command_cc_cxx(toolset, cfg, ninja.get_executable_cxx(cfg)))
p.w(" description = Building cxx object $out")
p.w(" depfile = $out.d")
p.w(" deps = " .. m.rule_cc_cxx_deps(toolset, cfg))
p.w("")
end
-- Generate an ar rule.
do
p.w("rule ar")
p.w(" command = " .. m.build_command_ar(toolset, cfg))
p.w(" description = Building an archive $out")
p.w("")
end
-- Generate a link cc rule.
do
p.w("rule link_cc")
p.w(" command = " .. m.build_command_link(toolset, cfg))
p.w(" description = Linking a cc executable $out")
p.w("")
end
-- Generate a link cxx rule.
do
p.w("rule link_cxx")
p.w(" command = " .. m.build_command_link(toolset, cfg))
p.w(" description = Linking a cxx executable $out")
p.w("")
end
end
|
function start (song)
end
function onBeatHit()
bounce = true
end
|
music = "fortress.ogg"
exceptions = {
{ 5, 7 },
}
function start()
up = Portal:new{x=5, y=7}
chest = Chest:new{x=10, y=5, anim_set="chest", milestone=MS_FORT_UNDER_CHEST_2, index=ITEM_CURE3}
end
function stop()
end
function update(step)
if (up:update()) then
change_areas("fort_start", 60, 42, DIRECTION_SOUTH)
end
check_battle(25, fort_enemies, exceptions)
end
function activate(activator, activated)
if (activated == chest.id) then
chest:activate()
end
end
function collide(id1, id2)
end
|
local M = {}
local NIL = vim.NIL
--@private
local recursive_convert_NIL
recursive_convert_NIL = function(v, tbl_processed)
if v == NIL then
return nil
elseif not tbl_processed[v] and type(v) == 'table' then
tbl_processed[v] = true
return vim.tbl_map(function(x)
return recursive_convert_NIL(x, tbl_processed)
end, v)
end
return v
end
--@private
--- Returns its argument, but converts `vim.NIL` to Lua `nil`.
--@param v (any) Argument
--@returns (any)
function M.convert_NIL(v)
return recursive_convert_NIL(v, {})
end
return M
|
object_building_kashyyyk_poi_kash_rryatt_bridge_sm_mid_s03 = object_building_kashyyyk_shared_poi_kash_rryatt_bridge_sm_mid_s03:new {
}
ObjectTemplates:addTemplate(object_building_kashyyyk_poi_kash_rryatt_bridge_sm_mid_s03, "object/building/kashyyyk/poi_kash_rryatt_bridge_sm_mid_s03.iff")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.