content stringlengths 5 1.05M |
|---|
return function()
local sort = require(script.Parent.sort)
it("should return a new table", function()
local a = {}
expect(sort(a)).never.to.equal(a)
end)
it("should not mutate the given table", function()
local a = {77, "foo", 2}
local function order(first, second)
return tostring(first) < tostring(second)
end
sort(a, order)
expect(#a).to.equal(3)
expect(a[1]).to.equal(77)
expect(a[2]).to.equal("foo")
expect(a[3]).to.equal(2)
end)
it("should contain the same elements from the given table", function()
local a = {
"Foo",
"Bar",
"Test"
}
local elementSet = {
Foo = true,
Bar = true,
Test = true
}
local b = sort(a)
expect(#b).to.equal(3)
for _, value in ipairs(b) do
expect(elementSet[value]).to.equal(true)
end
end)
it("should sort with the default table.sort when no callback is given", function()
local a = {4, 2, 5, 3, 1}
local b = sort(a)
table.sort(a)
expect(#b).to.equal(#a)
for i = 1, #a do
expect(b[i]).to.equal(a[i])
end
end)
it("should sort with the given callback", function()
local a = {1, 2, 5, 3, 4}
local function order(first, second)
return first > second
end
local b = sort(a, order)
table.sort(a, order)
expect(#b).to.equal(#a)
for i = 1, #a do
expect(b[i]).to.equal(a[i])
end
end)
it("should work with an empty table", function()
local a = sort({})
expect(#a).to.equal(0)
end)
end |
local InviteKey = {"111", "+++", "inv",}
local GuildInviteKey = {"g++", "ginv", "加公會", "加公会",}
local strlower = string.lower
local C_BattleNet_GetAccountInfoByID = C_BattleNet.GetAccountInfoByID
local InviteToGroup = C_PartyInfo.InviteUnit
-- [[ 按alt組隊邀請,ctrl公會邀請 ]] --
hooksecurefunc("ChatFrame_OnHyperlinkShow", function(frame, link, _, button)
local type, value = link:match("(%a+):(.+)")
local hide
if button == "LeftButton" and IsModifierKeyDown() then
if type == "player" then
local unit = value:match("([^:]+)")
if IsAltKeyDown() then
InviteToGroup(unit)
hide = true
elseif IsControlKeyDown() then
GuildInvite(unit)
hide = true
end
elseif type == "BNplayer" then
local _, bnID = value:match("([^:]*):([^:]*):")
if not bnID then return end
local accountInfo = C_BattleNet_GetAccountInfoByID(bnID)
if not accountInfo then return end
local gameAccountInfo = accountInfo.gameAccountInfo
local gameID = gameAccountInfo.gameAccountID
if gameID and CanCooperateWithGameAccount(accountInfo) then
if IsAltKeyDown() then
BNInviteFriend(gameID)
hide = true
elseif IsControlKeyDown() then
local charName = gameAccountInfo.characterName
local realmName = gameAccountInfo.realmName
GuildInvite(charName.."-"..realmName)
hide = true
end
end
end
else
return
end
-- 別打開輸入框
if hide then ChatEdit_ClearChat(ChatFrame1.editBox) end
end)
StaticPopupDialogs["IOWguildinvPopup"] = {
--text = "Do you want to invite %s to your guild?",
text = format(ERR_GUILD_INVITE_S, "%s"),
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = function(self, data)
GuildInvite(data)
end,
OnCancel = function()
--do nuffin
return
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
-- [[ 密語關鍵字邀請 ]] --
local WhisperInvite = CreateFrame("Frame", UIParent)
WhisperInvite:RegisterEvent("CHAT_MSG_WHISPER")
WhisperInvite:RegisterEvent("CHAT_MSG_BN_WHISPER")
-- EVENT 返回值 1密語 2角色id 12guid 13戰網好友的角色id
WhisperInvite:SetScript("OnEvent",function(self, event, msg, name, _, _, _, _, _, _, _, _, _, _, presenceID)
for _, word in pairs(InviteKey) do
if (not IsInGroup() or UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) and strlower(msg) == strlower(word) then
if event == "CHAT_MSG_BN_WHISPER" then
local accountInfo = C_BattleNet_GetAccountInfoByID(presenceID)
if accountInfo then
local gameAccountInfo = accountInfo.gameAccountInfo
local gameID = gameAccountInfo.gameAccountID
if gameID then
local charName = gameAccountInfo.characterName
local realmName = gameAccountInfo.realmName
if CanCooperateWithGameAccount(accountInfo) then
BNInviteFriend(gameID)
end
end
end
else
InviteToGroup(name)
end
end
end
for _, Gword in pairs(GuildInviteKey) do
if (not IsInGroup() or UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) and strlower(msg) == strlower(Gword) then
if event == "CHAT_MSG_BN_WHISPER" then
local accountInfo = C_BattleNet_GetAccountInfoByID(presenceID)
if accountInfo then
local gameAccountInfo = accountInfo.gameAccountInfo
local gameID = gameAccountInfo.gameAccountID
if gameID then
local charName = gameAccountInfo.characterName
local realmName = gameAccountInfo.realmName
if CanCooperateWithGameAccount(accountInfo) then
local dialog = StaticPopup_Show("IOWguildinvPopup", name)
if (dialog) then
dialog.data = charName.."-"..realmName
end
end
end
end
else
local dialog = StaticPopup_Show("IOWguildinvPopup", name)
if (dialog) then
dialog.data = name
end
end
end
end
end) |
--- The Help Modul
-- @module lib2
--
--
--require for compatibility
require"classes";
cli = require"cli";
-- loading the main framework
include("TaskTimer.class.lua");
include("TaskStack.class.lua");
---
-- Any type of var including lists
-- @type var
---
-- One or more incoming argument.
-- @type vars
-- @list <#var>
-- dummy function for compatibility
function setTextColor(...) end
-- function redirection for compatibility
getTime = time.getNow;
--- unpack function with number of arguments on the end.
-- @function[parent=#global] pack
-- @param #vars ... Args to pack
pack = table.pack;
-- function pack(...)
-- return { n = select("#", ...), ... }
-- end
--- unpack function with number of arguments on the end.
-- @function [parent=#global] unpack
-- @param #vars ... Args to unpack.
-- @return #table t the unpacked args
unpack = table.unpack;
-- function unpack(...)
-- local n = select('#', ...);
-- local t = {};
-- for i = 1,n do
-- local v = select(i, ...);
-- t[i] = v;
-- end
-- return t;
-- end
--- unpack function with number of arguments on the end.
-- @function [parent=#global] unpack2
-- @param #vars ... Args to unpack.
-- @return #table t the unpacked args
-- @return #number n Number of args.
function unpack2(...)
local n = select('#', ...);
local t = {};
for i = 1,n do
local v = select(i, ...);
t[i] = v;
end
return t, n;
end
--- Time delta in milliseconds
-- @function [parent=#global] deltaTime
-- @param #table time_a The first time table for compare
-- @param #table time_c The second time table for compare
-- @return #number diffrence in milliseconds between the two times.
function deltaTime(time_a,time_b)
return time.diff(time_a,time_b) *1000;
end
--- Convert hours to timer value
-- @function [parent=#global] hoursToTimer
-- @param #number hours The time in hours
-- @return #number The time in milliseconds
function hoursToTimer(hours)
return math.floor( hours * 3600000 );
end
--- Convert minutes to timer value
-- @function [parent=#global] minutesToTimer
-- @param #number minutes The time in minutes
-- @return #number The time in milliseconds
function minutesToTimer(minutes)
return math.floor( minutes * 60000 );
end
--- Converts seconds to timer value
-- @function [parent=#global] secondsToTimer
-- @param #number secounds The time in secounds
-- @return #number The time in milliseconds
function secondsToTimer(seconds)
return math.floor( seconds * 1000 );
end
--- Make a deep copy of a table
-- @function [parent=#global] deepcopy
-- @param #table orig The table which should be copy
-- @return #table copy Your new copy
function deepcopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[deepcopy(orig_key)] = deepcopy(orig_value)
end
setmetatable(copy, deepcopy(getmetatable(orig)))
else -- number, string, boolean, etc
copy = orig
end
return copy
end
--- Factory function for making a new task
-- @function [parent=#global] taskFactory
-- @pre The TaskStack class must have been loaded previously in the lib2.lia
-- @param #string name The label for the task
-- @param #function func The function which should be called for the task
-- @param #vars ... Any additional args for the task.
-- @post The new task has been added to the task stack.
-- @return #number STATE_PENNDING
function taskFactory(name, func,...)
taskstack:push_state(name, func );
taskstack:push_args(...)
return STATE_PENNDING;
end
--- Factory function for making a new scheduled task
-- @function [parent=#global] timerFactory
-- @pre The TaskTimer class must have been loaded previously in the lib2.lua
-- @param #string name The label for the task
-- @param #number time The interval for the task in milliseconds.
-- @param #function func The function which should be called for the task
-- @param #vars ... Any additional args for the task.
-- @return #number STATE_PENNDING
function timerFactory(name, time, func, ...)
tasktimer:registerTask(name, time, func, ...);
return STATE_PENNDING;
end
--- Wait function
-- @function [parent=#global] rest
-- @param #number msec Time in milliseconds to wait.
-- @post We have waited our time.
-- @notice The use of this function not recommend.
function rest(msec)
os.execute("sleep -m" .. tonumber(msec))
--[[ local i = 0;
while( deltaTime(getTime(), startTime) < msec ) do
i = i + 1;
end
return i;
]]--
end
--- Wait function but let scheduled tasks run if possible.
-- @function [parent=#global] yrest
-- @pre The TaskTimer class must have been loaded previously in the lib2.lu
-- @param #number msec Time in milliseconds to wait.
-- @post We have waited our time.
-- @notice The use of this function not recommend.
function yrest(msec)
if( msec == nil ) then error("yrest() cannot rest for \'nil\'.\n", 2); end;
local resttime = 10;
local startTime = getTime();
if( msec < resttime ) then
rest(msec);
return;
else
while( deltaTime(getTime(), startTime) < msec ) do
-- timedstate should be an global object.
tasktimer:timed_run(msec);
if(deltaTime(getTime(), startTime) < msec )then
rest(resttime);
end
end
end
return deltaTime(getTime(), startTime);
end
--- Create a new Task for the purpose of waiting
-- @function [parent=#global] restTask
-- @param #number msec Time in milliseconds to wait.
-- @post We have waited our time.
-- @return #number CTask#STATE_PENNDING
-- @notice This will not stop scheduled tasks from running;
function restTask(msec)
local function wait(self,start,msec)
if(deltaTime(getTime(), startTime) >= msec )then
return STATE_SUCCESS;
else
return STATE_PENNDING;
end
end
taskstack:push_state("STATE_REST_TASK",wait );
taskstack:push_args(getTime(),msec)
return STATE_PENNDING;
end
--- Create a new Task for the purpose of waiting
--
-- This function generate a task in which MM will wait and let scheduled tasks run if possible.
-- so that the scheduled tasks will have a greater priority
-- @function [parent=#global] yrestTask
-- @param #number msec Time in milliseconds to wait.
-- @post We have waited our time.
-- @return #number CTask#STATE_PENNDING
function yrestTask(msec)
local function wait(self,start,msec)
tasktimer:timed_run(msec);
if(deltaTime(getTime(), startTime) >= msec )then
return STATE_SUCCESS;
else
return STATE_PENNDING;
end
end
taskstack:push_state("STATE_YREST_TASK", wait );
taskstack:push_args(getTime(),msec)
return STATE_PENNDING;
end
|
-- clear cache so this reloads changes.
-- useful for development
--
-- package.loaded['onedark'] = nil
-- package.loaded['onedark.theme'] = nil
-- package.loaded['onedark.colors'] = nil
-- package.loaded['onedark.util'] = nil
package.loaded['onedark.config'] = nil
require('onedark').colorscheme()
|
local function FlattenTable(tbl)
local result = { }
local function flatten(tbl)
for _, v in ipairs(tbl) do
if type(v) == "table" then
flatten(v)
else
table.insert(result, v)
end
end
end
flatten(tbl)
return result
end
local function PrintIndex(k, indexMap)
if indexMap ~= nil and type(indexMap) == "table" then
local displayValue = indexMap[k]
if displayValue ~= nil then
return displayValue
end
end
if type(k) == "string" then
return '"'..k..'"'
else
return tostring(k)
end
end
---Print a value or table (recursive).
---@param o table
---@param indexMap table
---@param innerOnly boolean
---@return string
local function DumpTable(o, indexMap, innerOnly, recursionLevel)
if recursionLevel == nil then recursionLevel = 0 end
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if innerOnly == true then
if recursionLevel > 0 then
s = s .. ' ['..PrintIndex(k, indexMap)..'] = ' .. DumpTable(v, indexMap, innerOnly, recursionLevel + 1) .. ','
else
s = s .. ' ['..PrintIndex(k, nil)..'] = ' .. DumpTable(v, indexMap, innerOnly, recursionLevel + 1) .. ','
end
else
s = s .. ' ['..PrintIndex(k, indexMap)..'] = ' .. DumpTable(v, indexMap, innerOnly, recursionLevel + 1) .. ','
end
end
return s .. '} \n'
else
return tostring(o)
end
end
local function printd(msg, ...)
Ext.Print(string.format(msg, ...))
end
local function BuildPartyStructure(printDebug)
local players = FlattenTable(Osi.DB_IsPlayer:Get(nil))
local partyLeaders = {}
local highestLevel = 1
if printDebug then
Ext.Print("[LLXPSCALE:BootstrapServer.lua:BuildPartyStructure] Players: (".. DumpTable(players) ..").")
end
if #players == 1 then
local player = CharacterGetHostCharacter()
local level = CharacterGetLevel(player)
if printDebug then
Ext.Print("[LLXPSCALE:BootstrapServer.lua:BuildPartyStructure] Only one player ("..player..") at level ("..tostring(level)..")")
end
return player,level
end
local tableEmpty = true
for i,v in pairs(players) do
local level = CharacterGetLevel(v)
if level > highestLevel then highestLevel = level end
if tableEmpty then
if printDebug then
Ext.Print("[LLXPSCALE:BootstrapServer.lua:BuildPartyStructure] partyLeaders count is 0. Adding to table. ("..v..")")
end
partyLeaders[v] = {}
tableEmpty = false
else
for leader,members in pairs(partyLeaders) do
if v ~= leader then
if CharacterIsInPartyWith(leader, v) == 1 then
if printDebug then
Ext.Print("[LLXPSCALE:BootstrapServer.lua:BuildPartyStructure] (".. v ..") is in a party with ("..leader..")?")
end
members[#members+1] = v
else
if printDebug then
Ext.Print("[LLXPSCALE:BootstrapServer.lua:BuildPartyStructure] (".. v ..") is not in a party with ("..leader..")?")
end
partyLeaders[v] = {}
end
end
end
end
end
if printDebug then
Ext.Print("[LLXPSCALE:BootstrapServer.lua:BuildPartyStructure] Party leader structure: (".. DumpTable(partyLeaders) ..").")
end
return partyLeaders,highestLevel
end
---@return integer
local function GetPartyLevel()
local level = 1
for i,v in pairs(Osi.DB_IsPlayer:Get(nil)) do
local plevel = CharacterGetLevel(v[1])
if plevel and plevel > level then
level = plevel
end
end
return level
end
---@param character EsvCharacter
function GrantPartyExperience(character, printDebug)
ObjectSetFlag(character.MyGuid, "LLXPSCALE_GrantedExperience", 0)
--print("GrantPartyExperience", character.MyGuid, character.Stats.Name)
local gain = Ext.StatGetAttribute(character.Stats.Name, "Gain") or 0
if gain == "None" then
gain = 0
elseif gain ~= 0 then
gain = tonumber(gain)
end
if gain > 0 then
-- Apparently Larian subtracts the character gain by 1, so 6 (125xp) is really 5 (100xp). 1 becomes "Bone".
gain = gain - 1
end
if Mods.LeaderLib then
local settings = Mods.LeaderLib.SettingsManager.GetMod(ModuleUUID, false)
if settings then
local gainModifier = settings.Global:GetVariable("GainModifier", 1.0)
if gainModifier ~= 1.0 then
gain = Ext.Round((gain * gainModifier) + 0.25)
end
end
end
if gain > 0 then
local xpLevel = character.Stats.Level
local scaleLowerLevels = GlobalGetFlag("LLXPSCALE_AlwaysScaleToPlayerLevelEnabled") == 1
local plevel = GetPartyLevel()
if plevel < xpLevel then
xpLevel = plevel
elseif scaleLowerLevels and xpLevel < plevel then
xpLevel = plevel
end
if printDebug then
printd("[LLXPSCALE:BootstrapServer.lua:LLXPSCALE_Ext_GrantExperience] Granting experience to all players scaled by (%s) Gain at level (%s). Dying character: (%s)[%s]", gain, xpLevel, character.DisplayName, character.MyGuid)
end
--local partyStructure,highestLevel = BuildPartyStructure()
local leader = CharacterGetHostCharacter()
PartyAddExperience(leader, 1, xpLevel, gain)
else
if printDebug then
printd("[LLXPSCALE:BootstrapServer.lua:LLXPSCALE_Ext_GrantExperience] Skipping experience for %s since Gain is 0.", character.MyGuid)
end
end
return false
end
local function GetCombatID(uuid)
if uuid == nil then
return nil
end
local combatid = CombatGetIDForCharacter(uuid) or -1
if not combatid or combatid <= 0 then
local db = Osi.DB_CombatCharacters:Get(uuid, nil)
if db and #db > 0 then
combatid = db[1][2]
end
end
if not combatid or combatid <= 0 then
local db = Osi.DB_WasInCombat:Get(uuid, nil)
if db and #db > 0 then
combatid = db[1][2]
end
end
Ext.Print(uuid, combatid)
return combatid
end
---@param character EsvCharacter
local function IsInCombatWithPlayer(character, attackOwner)
if attackOwner and CharacterIsPlayer(attackOwner) == 1 then
return true
end
local combatid = GetCombatID(character.MyGuid)
if combatid > 0 then
for i,db in pairs(Osi.DB_IsPlayer:Get(nil)) do
if GetCombatID(db[1]) == combatid then
return true
end
end
end
return false
end
-- Ext.RegisterOsirisListener("CharacterStatusApplied", 3, "after", function(char, status, source)
-- if status == "SUMMONING" then
-- local character = Ext.GetCharacter(char)
-- print(character.Summon, character.Stats.IsPlayer, character.IsPlayer, CharacterIsSummon(character.MyGuid))
-- end
-- end)
---@param character EsvCharacter
local function IsHostileToPlayer(character)
local faction = GetFaction(character.MyGuid) or ""
if string.find(faction, "Evil") or GlobalGetFlag("LLXPSCALE_IgnoreEnemyAlignmentEnabled") == 1 then
return true
end
for i,db in pairs(Osi.DB_IsPlayer:Get(nil)) do
if CharacterIsEnemy(db[1], character.MyGuid) == 1 then
return true
end
end
return false
end
---@param character EsvCharacter
---@param skipAlignmentCheck boolean|nil
local function CanGrantExperience(character, skipAlignmentCheck)
if GlobalGetFlag("LLXPSCALE_DeathExperienceDisabled") == 1 or
(character.RootTemplate
and character.RootTemplate.DefaultState ~= 0 -- Dead is > 0
and not IsInCombatWithPlayer(character))
then
return false
end
return not character:HasTag("NO_RECORD") -- A corpse?
and not character:HasTag("LLXPSCALE_DisableDeathExperience")
and ObjectGetFlag(character.MyGuid, "LLXPSCALE_GrantedExperience") == 0
and not character.Resurrected
--and not character.IsPlayer
and CharacterIsPlayer(character.MyGuid) == 0
--and not character.Summon
and CharacterIsSummon(character.MyGuid) == 0
--and not character.PartyFollower
and CharacterIsPartyFollower(character.MyGuid) == 0
and not character:HasTag("LeaderLib_Dummy")
and not character:HasTag("LEADERLIB_IGNORE")
--and not string.find(character.DisplayName, "Dead")
--and not string.find(character.DisplayName, "Corpse")
and (skipAlignmentCheck == true or IsHostileToPlayer(character))
end
local isGameLevel = true
local isDebugMode = Ext.IsDeveloperMode() == true
Ext.RegisterOsirisListener("GameStarted", 2, "after", function(region, _)
isGameLevel = IsGameLevel(region) == 1
end)
Ext.RegisterOsirisListener("CharacterDied", 1, "before", function(char)
if isGameLevel and Ext.GetGameState() == "Running" then
local character = Ext.GetCharacter(char)
if character ~= nil and CanGrantExperience(character) and IsInCombatWithPlayer(character) then
local b,err = xpcall(GrantPartyExperience, debug.traceback, character, isDebugMode)
if not b then
Ext.PrintError(err)
end
elseif isDebugMode and ObjectGetFlag(char, "LLXPSCALE_GrantedExperience") == 0 then
if CombatGetIDForCharacter(CharacterGetHostCharacter()) ~= 0 then
printd("[LLXPSCALE:CharacterDied] Character (%s)[%s] can't grant experience. DefaultState(%s)", character and character.DisplayName or "", char, (character.RootTemplate and character.RootTemplate.DefaultState) or "?")
end
end
end
end)
Ext.RegisterOsirisListener("CharacterKilledBy", 3, "after", function(victim, attackOwner, attacker)
if isGameLevel and Ext.GetGameState() == "Running" then
local character = Ext.GetCharacter(victim)
if character ~= nil and CanGrantExperience(character, true) and IsInCombatWithPlayer(character, attackOwner) then
local b,err = xpcall(GrantPartyExperience, debug.traceback, character, isDebugMode)
if not b then
Ext.PrintError(err)
end
elseif isDebugMode and ObjectGetFlag(character.MyGuid, "LLXPSCALE_GrantedExperience") == 0 then
printd("[LLXPSCALE:CharacterDied] Character (%s)[%s] can't grant experience.", character and character.DisplayName or "", victim)
end
end
end) |
-- This file is part of SA MoonLoader package.
-- Licensed under the MIT License.
-- Copyright (c) 2016, BlastHack Team <blast.hk>
local keys_onfoot = {
GOLEFT_GORIGHT = 0,
GOFORWARD_GOBACK = 1,
ANSWERPHONE_FIREWEAPONALT = 4,
CYCLEWEAPONLEFT_SNIPERZOOMIN = 5,
LOCKTARGET = 6,
CYCLEWEAPONRIGHT_SNIPERZOOMOUT = 7,
GROUPCONTROLFWD = 8,
GROUPCONTROLBWD = 9,
CONVERSATIONNO = 10,
CONVERSATIONYES = 11,
CHANGECAMERAVIEW = 13,
JUMP = 14,
ENTERVEHICLE = 15,
SPRINT = 16,
FIREWEAPON = 17,
CROUCH = 18,
LOOKBEHIND = 19,
WALK = 21
}
local keys_incar = {
GOLEFT_GORIGHT = 0,
STEERUP_STEERDOWN = 1,
TURRETLEFT_TURRETRIGHT = 2,
TURRETUP_TURRETDOWN = 3,
FIREWEAPONALT = 4,
LOOKLEFT = 5,
HANDBRAKE = 6,
LOOKBEHIND_LOOKRIGHT = 7,
RADIOSTATIONUP = 8,
RADIOSTATIONDOWN = 9,
CONVERSATIONNO = 10,
CONVERSATIONYES = 11,
CHANGECAMERAVIEW = 13,
BRAKE = 14,
EXITVEHICLE = 15,
ACCELERATE = 16,
FIREWEAPON = 17,
HORN = 18,
TOGGLESUBMISSION = 19
}
return {player = keys_onfoot, vehicle = keys_incar}
|
local lspconfig = require("lspconfig")
local u = require("utils")
local ts_utils_settings = {
debug = true,
enable_import_on_completion = true,
import_all_scan_buffers = 100,
eslint_bin = "eslint_d",
eslint_enable_diagnostics = true,
eslint_opts = {
condition = function(utils)
return utils.root_has_file(".eslintrc.js") or utils.root_has_file(".eslintrc.json")
end,
diagnostics_format = "#{m} [#{c}]",
},
enable_formatting = true,
formatter = "eslint_d",
update_imports_on_move = true,
-- filter out dumb module warning
filter_out_diagnostics_by_code = { 80001 },
}
local M = {}
M.setup = function(on_attach, capabilities)
lspconfig.tsserver.setup({
capabilities = capabilities,
on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
on_attach(client, bufnr)
local ts_utils = require("nvim-lsp-ts-utils")
ts_utils.setup(ts_utils_settings)
ts_utils.setup_client(client)
u.buf_map("n", "gs", ":TSLspOrganize<CR>", nil, bufnr)
u.buf_map("n", "gI", ":TSLspRenameFile<CR>", nil, bufnr)
u.buf_map("n", "go", ":TSLspImportAll<CR>", nil, bufnr)
u.buf_map("n", "qq", ":TSLspFixCurrent<CR>", nil, bufnr)
u.buf_map("i", ".", ".<C-x><C-o>", nil, bufnr)
end,
flags = {
debounce_text_changes = 150,
},
})
end
return M
|
-- @param: region, channel begin/end
-- cache current region, channel, rxagc, rxgain
-- set scscan trigger, set region, channel, set rxagc=0, rxgain=0
-- > scan each channel
-- > print format: <rgn>,<ch>,<freq>,<noise>,<ts>
-- clean chscan trigger
-- set region, channel, rxagc, rxgain
-- by Qige @ 2017.03.24
local fmt = require 'six.fmt'
local cmd = require 'six.cmd'
local file = require 'six.file'
local abb = require 'kpi.ABB'
local gws = require 'kpi.GWS'
local _echo = fmt.echo
local _read = file.read
local _save = file.write
local SScan = {}
SScan.conf = {}
SScan.conf.r0ch_min = 14
SScan.conf.r0ch_max = 51
SScan.conf.r1ch_min = 21
SScan.conf.r1ch_max = 51
SScan.conf._trigger = '/sys/kernel/debug/ieee80211/phy0/ath9k/chanscan'
SScan.conf._start = 'echo "scan enable" > %s; gws5001app setrxagc 0; sleep 1; gws5001app setrxgain 0\n'
SScan.conf._stop = 'echo "scan disable" > %s; sleep 1; gws5001app setrxagc 1\n'
SScan.conf._SIGNAL = '/tmp/.grid_cs_signal'
SScan.conf._result = '/tmp/.grid_cs_cache'
SScan.conf._clean = 'echo -n "" > %s\n'
SScan.conf._scan = 'gws -C %d; sleep 2\n'
SScan.conf._scan_item = '%d,%d,%d,%d,%d'
SScan.conf._save = 'echo "%s" >> %s\n'
SScan.current = {}
SScan.current.rgn = -1
SScan.current.ch = -1
SScan.current.agc = -1
function SScan.load()
local _abb = abb.RAW()
local _gws = gws.RAW()
if (_gws and _gws.rgn ~= nil) then
SScan.current.rgn = fmt.n(_gws.rgn)
SScan.current.ch = fmt.n(_gws.ch)
SScan.current.agc = fmt.n(_gws.agc)
end
end
function SScan.restore()
local current = SScan.current
if (current.rgn > -1) then
if (current.rgn > 0) then
gws.Save('rgn', 1)
else
gws.Save('rgn', 0)
end
end
if (current.agc > -1) then
if (current.rgn > 0) then
gws.Save('agc', 1)
else
gws.Save('agc', 0)
end
end
if (current.ch >= SScan.conf.r0ch_min) then
gws.Save('ch', current.ch)
end
end
function SScan.init()
local _fmt = SScan.conf._start
local _f = SScan.conf._trigger
local _cmd = string.format(_fmt, _f)
cmd.exec(_cmd)
-- clean result cache
_f = SScan.conf._result
_fmt = SScan.conf._clean
_cmd = string.format(_fmt, _f)
cmd.exec(_cmd)
SScan.flag.set('azure agent up.\n')
end
function SScan.stop()
local _fmt = SScan.conf._stop
local _f = SScan.conf._trigger
local _cmd = string.format(_fmt, _f)
cmd.exec(_cmd)
SScan.flag.set('azure agent down.\n')
end
function SScan.Run(rgn, b, e)
local _f = SScan.conf._result
SScan.load()
SScan.init()
-- read noise after 1 second
-- set next channel
local _rgn = rgn or 1
local _ch = b or SScan.conf.r1ch_min
local _ech = e or SScan.conf.r1ch_max
local _freq
local _noise = -111
local _item, _cmd
local _fmt_scan = SScan.conf._scan
local _fmt_scan_item = SScan.conf._scan_item
local _fmt_save = SScan.conf._save
local _ts, i
for i = _ch, _ech do
-- check if allow to continue
if (SScan.flag._SIGNAL()) then
if (_rgn > 0) then
_freq = 474+8*(i-21)
else
_freq = 473+6*(i-14)
end
_noise = abb.raw.Noise()
_ts = os.time()
_cmd = string.format(_fmt_scan, i)
cmd.exec(_cmd)
_item = string.format(_fmt_scan_item, _rgn, i, _freq, _noise, _ts)
io.write(_item .. '\n')
_cmd = string.format(_fmt_save, _item, _f)
cmd.exec(_cmd)
else
break
end
end
SScan.stop()
SScan.restore()
end
SScan.flag = {}
function SScan.flag._SIGNAL()
local f = SScan.conf._SIGNAL
local sig = _read(f)
if (sig == 'exit' or sig == 'down' or sig == 'quit') then
_echo('(warning) QUIT signal detected.\n')
return false
else
return true
end
end
function SScan.flag.set(msg)
local f = SScan.conf._SIGNAL
_save(f, msg)
end
return SScan
|
require "lmkbuild"
local append_table = lmkbuild.append_table
local exec = lmkbuild.exec
local file_newer = lmkbuild.file_newer
local get_build_number = lmkbuild.get_build_number
local get_var = lmkbuild.get_var
local io = io
local ipairs = ipairs
local is_dir = lmkbuild.is_dir
local is_valid = lmkbuild.is_valid
local mkdir = lmkbuild.mkdir
local cp = lmkbuild.cp
local copy_file = lmkbuild.copy_file
local print = print
local resolve = lmkbuild.resolve
local rm = lmkbuild.rm
local set_local = lmkbuild.set_local
local split = lmkbuild.split_path_and_file
local system = lmkbuild.system ()
local tostring = tostring
module (...)
local data = {}
local function local_copy (src, target)
local isNewer = false
src = resolve (src)
target = resolve (target)
if is_valid (src) then
if is_dir (target) then
local path, file = split (src)
target = target .. "/" .. file
end
if file_newer (src, target) then cp (src, target); isNewer = true end
else target = nil
end
return target, isNewer
end
function set_app (file, target)
data = {}
data.app = file
data.appTarget = target
end
function set_plist (file)
data.plist = file
end
function add_icons (files)
if data.icons then append_table (data.icons, files)
else data.icons = files
end
end
function add_config (files)
if data.config then append_table (data.config, files)
else data.config = files
end
end
function add_assets (files)
if data.data then append_table (data.data, files)
else data.data = files
end
end
-- For backwards compatibility
add_data = add_assets
function add_scripts (files)
if data.scripts then append_table (data.scripts, files)
else data.scripts = files
end
end
local function main_mac (files)
local targetName = resolve ("$(lmk.binDir)" .. files[1])
local contentsTarget = targetName .. "/Contents"
local frameworksTarget = contentsTarget .. "/Frameworks"
local appTarget = contentsTarget .. "/MacOS"
local resourcesTarget = contentsTarget .. "/Resources"
local configTarget = resourcesTarget .. "/config"
local dataTarget = resourcesTarget .. "/assets"
local scriptsTarget = resourcesTarget .. "/scripts"
mkdir (frameworksTarget)
mkdir (appTarget)
mkdir (configTarget)
mkdir (dataTarget)
mkdir (scriptsTarget)
if data.appTarget then appTarget = appTarget .. "/" .. data.appTarget end
local preqs = get_var ("preqs")
if preqs then
local installPaths = get_var ("installPaths")
for index, item in ipairs (preqs) do
local src = "$(" .. item .. ".localBinTarget)"
local target = nil
local isNewer = false
if item == data.app then
target, isNewer = local_copy (src, appTarget)
if target and isNewer then exec ("chmod u+x " .. target) end
else target, isNewer = local_copy (src, frameworksTarget)
end
if target and isNewer and installPaths then
for index, paths in ipairs (installPaths) do
local arg = "install_name_tool -change " .. paths[1] .. " "
.. paths[2] .. " " .. target
exec (arg)
end
end
end
end
if data.config then
for index, item in ipairs (data.config) do
local_copy (item, configTarget)
end
end
if data.plist then
--local_copy (data.plist, contentsTarget)
local buildVersion = get_build_number ()
set_local ("buildVersion", buildVersion)
local src = resolve (data.plist)
if is_valid (src) then
local path, file = split (src)
local target = contentsTarget .. "/" .. file
local fileOut = io.open (target, "w")
if fileOut then
for line in io.lines(src) do
line = resolve (line)
fileOut:write (line .. "\r\n")
end
end
end
end
if data.icons then
for index, item in ipairs (data.icons) do
local_copy (item, resourcesTarget)
end
end
if data.data then
for index, item in ipairs (data.data) do
if not is_valid (item) then
item = resolve ("$(lmk.projectRoot)" .. item)
end
if is_valid (item) then local_copy (item, dataTarget)
else print ("ERROR: Invalid data item: " .. item)
end
end
end
if data.scripts then
for index, item in ipairs (data.scripts) do
local_copy (item, scriptsTarget)
end
end
--last line!
data = {}
end
local function main_win32 (files)
local appTarget = resolve ("$(lmk.binDir)" .. files[1])
local binTarget = appTarget .. "/bin"
local configTarget = appTarget .. "/config"
local dataTarget = appTarget .. "/assets"
local scriptsTarget = appTarget .. "/scripts"
mkdir (binTarget)
mkdir (configTarget)
mkdir (dataTarget)
mkdir (scriptsTarget)
local preqs = get_var ("preqs")
if preqs then
for index, item in ipairs (preqs) do
local src = "$(" .. item .. ".localBinTarget)"
if (item == data.app) and data.appTarget then
local_copy (src, binTarget .. "/" .. data.appTarget .. ".exe")
else
local_copy (src, binTarget)
end
end
end
if data.config then
for index, item in ipairs (data.config) do
local_copy (item, configTarget)
end
end
if data.data then
for index, item in ipairs (data.data) do
if not is_valid (item) then
item = resolve ("$(lmk.projectRoot)" .. item)
end
if is_valid (item) then local_copy (item, dataTarget)
else print ("ERROR: Invalid data item: " .. item)
end
end
end
if data.scripts then
for index, item in ipairs (data.scripts) do
local_copy (item, scriptsTarget)
end
end
--last line!
data = {}
end
function main (files)
if system == "macos" then main_mac (files)
elseif system == "win32" then main_win32 (files)
end
end
function test (files)
--last line!
data = {}
end
function clean (files)
--last line!
data = {}
end
function clobber (files)
local targetName = resolve ("$(lmk.binDir)" .. files[1])
rm (targetName)
--last line!
data = {}
end
|
local on_attach = require('lsp.on_attach')
local lsp = vim.lsp
-- config that activates keymaps and enables snippet support
local function base_config()
local capabilities = require('cmp_nvim_lsp').update_capabilities(
lsp.protocol.make_client_capabilities()
)
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = { 'documentation', 'detail', 'additionalTextEdits' },
}
return {
-- enable snippet support
capabilities = capabilities,
-- map buffer local keybindings when the language server attaches
on_attach = on_attach,
}
end
return base_config
|
slot2 = "DdzGameCcsView"
DdzGameCcsView = class(slot1)
DdzGameCcsView.onCreationComplete = function (slot0)
slot4 = BaseGameCcsView
ClassUtil.extends(slot2, slot0)
slot3 = slot0
BaseGameCcsView.onCreationComplete(slot2)
slot4 = not IS_IOS_VERIFY
slot0.layerNotice.setVisible(slot2, slot0.layerNotice)
slot5 = slot0
slot0.model.curShowingViewTypeChangedSignal.add(slot2, slot0.model.curShowingViewTypeChangedSignal, slot0.onViewTypeChanged)
slot3 = slot0
slot0.onViewTypeChanged(slot2)
end
DdzGameCcsView.onViewTypeChanged = function (slot0)
slot3 = slot0.model
if slot0.model.getCurShowingViewType(slot2) == VIEW_TYPE_DDZ_BATTLE_JD or slot1 == VIEW_TYPE_DDZ_BATTLE_BXP then
slot5 = 1022
slot0.layerNotice.setPositionX(slot3, slot0.layerNotice)
else
slot5 = 617
slot0.layerNotice.setPositionX(slot3, slot0.layerNotice)
end
end
DdzGameCcsView.onBtnClick = function (slot0, slot1, slot2)
return
end
return
|
-- @Author:pandayu
-- @Version:1.0
-- @DateTime:2018-09-09
-- @Project:pandaCardServer CardGame
-- @Contact: QQ:815099602
local config = require "game.config"
local s_sub = string.sub
local cjson = require "include.cjson"
local _M = {}
_M.data = config.template.pay
_M.month_card_count_reward = 10 --10次之后无奖励
_M.pay_type ={
nonal = 1,
month_card = 2,
high_card = 3
}
function _M:get(id)
return self.data[id]
end
function _M:is_month_card(id)
if not self.data[id] or not self.data[id].tp or self.data[id].tp ~= 2 then return false end
return true
end
function _M:is_high_card(id)
if not self.data[id] or not self.data[id].tp or self.data[id].tp ~= 3 then return false end
return true
end
function _M:month_card_reward()
return {[5] = 5}
end
function _M:high_card_reward()
return {[5] = 10}
end
function _M:get_pay_item_type(id)
if not self.data[id] or not self.data[id].tp then return 0 end
return self.data[id].tp
end
function _M:get_pay_reward(id)
if not self.data[id] or not self.data[id].mz then return 0 end
return self.data[id].mz
end
return _M |
----------------------------------------------------------------------------------
--- Total RP 3
--- Localization system
---
--- This new system is based on a meta-table.
--- The goal here is to have IDE auto-completion by directly using the table and
--- accessing its indexes in the code, but actually having the meta table call
--- the localization functions on runtime to get the localized version of the text.
---
--- ---------------------------------------------------------------------------
--- Copyright 2017 Renaud "Ellypse" Parize <ellypse@totalrp3.info> @EllypseCelwe
---
--- 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.
----------------------------------------------------------------------------------
---@type TRP3_API
local _, TRP3_API = ...;
local Ellyb = Ellyb(_);
-- WoW imports
local pairs = pairs;
local tinsert = table.insert;
local IS_FRENCH_LOCALE = GetLocale() == "frFR";
-- Bindings locale
BINDING_HEADER_TRP3 = "Total RP 3";
-- Complete locale declaration
TRP3_API.loc = {
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- GENERAL
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
GEN_WELCOME_MESSAGE = "Thank you for using Total RP 3 (v %s) ! Have fun !",
GEN_VERSION = "Version: %s (Build %s)",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- REGISTER
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
REG_PLAYER = "Character",
REG_PLAYER_CHANGE_CONFIRM = "You may have unsaved data changes.\nDo you want to change page anyway ?\n|cffff9900Any changes will be lost.",
REG_PLAYER_CARACT = "Characteristics",
REG_PLAYER_NAMESTITLES = "Names and titles",
REG_PLAYER_CHARACTERISTICS = "Characteristics",
REG_PLAYER_REGISTER = "Directory information",
REG_PLAYER_ICON = "Character's icon",
REG_PLAYER_ICON_TT = "Select a graphic representation for your character.",
REG_PLAYER_TITLE = "Title",
REG_PLAYER_TITLE_TT = "Your character's title is the title by which your character is usually called. Avoid long titles, as for those you should use the Full title attribute below.\n\nExample of |c0000ff00appropriate titles |r:\n|c0000ff00- Countess,\n- Marquis,\n- Magus,\n- Lord,\n- etc.\n|rExample of |cffff0000inappropriate titles|r:\n|cffff0000- Countess of the North Marshes,\n- Magus of the Stormwind Tower,\n- Diplomat for the Draenei Government,\n- etc.",
REG_PLAYER_FIRSTNAME = "First name",
REG_PLAYER_FIRSTNAME_TT = "This is your character's first name. This is a mandatory field, so if you don't specify a name, the default character's name (|cffffff00%s|r) will be used.\n\nYou can use a |c0000ff00nickname |r!",
REG_PLAYER_LASTNAME = "Last name",
REG_PLAYER_LASTNAME_TT = "This is your character's family name.",
REG_PLAYER_HERE = "Set position",
REG_PLAYER_HERE_TT = "|cffffff00Click|r: Set to your current position",
REG_PLAYER_HERE_HOME_TT = "|cffffff00Click|r: Use your current coordinates as your house position.\n|cffffff00Right-click|r: Discard your house position.",
REG_PLAYER_HERE_HOME_PRE_TT = "Current house map coordinates:\n|cff00ff00%s|r.",
REG_PLAYER_RESIDENCE_SHOW = "Residence coordinates",
REG_PLAYER_RESIDENCE_SHOW_TT = "|cff00ff00%s\n\n|rClick to show on map",
REG_PLAYER_COLOR_CLASS = "Class color",
REG_PLAYER_COLOR_CLASS_TT = "This will also determine the name color.\n\n",
REG_PLAYER_COLOR_TT = "|cffffff00Click:|r Select a color\n|cffffff00Right-click:|r Discard color\n|cffffff00Shift-Click:|r Use the default color picker",
REG_PLAYER_COLOR_ALWAYS_DEFAULT_TT = "|cffffff00Click:|r Select a color\n|cffffff00Right-click:|r Discard color",
REG_PLAYER_FULLTITLE = "Full title",
REG_PLAYER_FULLTITLE_TT = "Here you can write down your character's full title. It can either be a longer version of the Title or another title entirely.\n\nHowever, you may want to avoid repetitions, in case there's no additional info to mention.",
REG_PLAYER_RACE = "Race",
REG_PLAYER_RACE_TT = "Here goes your character's race. It doesn't have to be restricted to playable races. There are many Warcraft races that can assume common shapes ...",
REG_PLAYER_BKG = "Background layout",
REG_PLAYER_BKG_TT = "This represents the graphical background to use for your Characteristics layout.",
REG_PLAYER_CLASS = "Class",
REG_PLAYER_CLASS_TT = "This is your character's custom class.\n\n|cff00ff00For instance :|r\nKnight, Pyrotechnist, Necromancer, Elite shooter, Arcanist ...",
REG_PLAYER_AGE = "Age",
REG_PLAYER_AGE_TT = "Here you can indicate how old your character is.\n\nThere are several ways to do this:|c0000ff00\n- Either use years,\n- Or an adjective (Young, Mature, Adult, Venerable, etc.).",
REG_PLAYER_EYE = "Eye color",
REG_PLAYER_EYE_TT = "Here you can indicate the color of your character's eyes.\n\nKeep in mind that, even if your character's face is constantly hidden, that might still be worth mentioning, just in case.",
REG_PLAYER_HEIGHT = "Height",
REG_PLAYER_HEIGHT_TT = "This is your character's height.\nThere are several ways to do this:|c0000ff00\n- A precise number: 170 cm, 6'5\" ...\n- A qualificative: Tall, short ...",
REG_PLAYER_WEIGHT = "Body shape",
REG_PLAYER_WEIGHT_TT = "This is your character's body shape.\nFor instance they could be |c0000ff00slim, fat or muscular...|r Or they could simply be regular !",
REG_PLAYER_BIRTHPLACE = "Birthplace",
REG_PLAYER_BIRTHPLACE_TT = "Here you can indicate the birthplace of your character. This can either be a region, a zone, or even a continent. It's for you to decide how accurate you want to be.\n\n|c00ffff00You can use the button to the right to easily set your current location as Birthplace.",
REG_PLAYER_RESIDENCE = "Residence",
REG_PLAYER_RESIDENCE_TT = "Here you can indicate where your character normally lives. This could be their personal address (their home) or a place they can crash.\nNote that if your character is a wanderer or even homeless, you will need to change the information accordingly.\n\n|c00ffff00You can use the button to the right to easily set your current location as Residence.",
REG_PLAYER_MSP_MOTTO = "Motto",
REG_PLAYER_MSP_HOUSE = "House name",
REG_PLAYER_MSP_NICK = "Nickname",
REG_PLAYER_TRP2_TRAITS = "Physiognomy",
REG_PLAYER_TRP2_PIERCING = "Piercings",
REG_PLAYER_TRP2_TATTOO = "Tattoos",
REG_PLAYER_PSYCHO = "Personality traits",
REG_PLAYER_ADD_NEW = "Create new",
REG_PLAYER_HISTORY = "History",
REG_PLAYER_MORE_INFO = "Additional information",
REG_PLAYER_PHYSICAL = "Physical Description",
REG_PLAYER_NO_CHAR = "No characteristics",
REG_PLAYER_SHOWPSYCHO = "Show personality frame",
REG_PLAYER_SHOWPSYCHO_TT = "Check if you want to use the personality description.\n\nIf you don't want to indicate your character's personality this way, keep this box unchecked and the personality frame will remain totally hidden.",
REG_PLAYER_PSYCHO_ADD = "Add a personality trait",
REG_PLAYER_PSYCHO_POINT = "Add a point",
REG_PLAYER_PSYCHO_MORE = "Add a point to \"%s\"",
REG_PLAYER_PSYCHO_ATTIBUTENAME_TT = "Attribute name",
REG_PLAYER_PSYCHO_RIGHTICON_TT = "Set the right attribute icon.",
REG_PLAYER_PSYCHO_LEFTICON_TT = "Set the left attribute icon.",
REG_PLAYER_PSYCHO_SOCIAL = "Social traits",
REG_PLAYER_PSYCHO_PERSONAL = "Personal traits",
REG_PLAYER_PSYCHO_CHAOTIC = "Chaotic";
REG_PLAYER_PSYCHO_Loyal = "Lawful";
REG_PLAYER_PSYCHO_Chaste = "Chaste";
REG_PLAYER_PSYCHO_Luxurieux = "Lustful";
REG_PLAYER_PSYCHO_Indulgent = "Forgiving";
REG_PLAYER_PSYCHO_Rencunier = "Vindictive";
REG_PLAYER_PSYCHO_Genereux = "Altruistic";
REG_PLAYER_PSYCHO_Egoiste = "Selfish";
REG_PLAYER_PSYCHO_Sincere = "Truthful";
REG_PLAYER_PSYCHO_Trompeur = "Deceitful";
REG_PLAYER_PSYCHO_Misericordieux = "Gentle ";
REG_PLAYER_PSYCHO_Cruel = "Brutal";
REG_PLAYER_PSYCHO_Pieux = "Superstitious";
REG_PLAYER_PSYCHO_Pragmatique = "Renegade";
REG_PLAYER_PSYCHO_Conciliant = "Paragon";
REG_PLAYER_PSYCHO_Rationnel = "Rational";
REG_PLAYER_PSYCHO_Reflechi = "Cautious";
REG_PLAYER_PSYCHO_Impulsif = "Impulsive";
REG_PLAYER_PSYCHO_Acete = "Ascetic";
REG_PLAYER_PSYCHO_Bonvivant = "Bon vivant";
REG_PLAYER_PSYCHO_Valeureux = "Valorous";
REG_PLAYER_PSYCHO_Couard = "Spineless";
REG_PLAYER_PSYCHO_CUSTOM = "Custom trait",
REG_PLAYER_PSYCHO_CREATENEW = "Create a trait",
REG_PLAYER_PSYCHO_CUSTOMCOLOR = "Select attribute color",
REG_PLAYER_PSYCHO_CUSTOMCOLOR_LEFT_TT = "Select a color used by the bar for the left attribute.\n\n|cffffff00Click:|r Select a color\n|cffffff00Right-click:|r Discard color\n|cffffff00Shift-Click:|r Use the default color picker",
REG_PLAYER_PSYCHO_CUSTOMCOLOR_RIGHT_TT = "Select a color used by the bar for the right attribute.\n\n|cffffff00Click:|r Select a color\n|cffffff00Right-click:|r Discard color\n|cffffff00Shift-Click:|r Use the default color picker",
REG_PLAYER_LEFTTRAIT = "Left attribute",
REG_PLAYER_RIGHTTRAIT = "Right attribute",
REG_DELETE_WARNING = "Are you sure you want to delete %s's profile?\n",
REG_IGNORE_TOAST = "Character ignored",
REG_CODE_INSERTION_WARNING = [[
|TInterface\AddOns\totalRP3\resources\policegar.tga:50:50|t
Wait a minute!
We found that you have manually inserted invalid codes inside your Total RP 3 profile.
This behavior is not supported at all and we strongly discourage anyone from doing it.
It can lead to instabilities and bugs inside the add-on, data corruption/loss of profiles and it also creates incompatibility issues with other add-ons (such as MRP).
The codes you have inserted in your profile have been removed to prevent you from breaking the add-on.]],
REG_PLAYER_IGNORE = "Ignore linked characters (%s)",
REG_PLAYER_IGNORE_WARNING = "Do you want to ignore those characters ?\n\n|cffff9900%s\n\n|rYou can optionally enter the reason below. This is a personal note that will serve as reminder.",
REG_PLAYER_SHOWMISC = "Show miscellaneous frame",
REG_PLAYER_SHOWMISC_TT = "Check if you want to show custom fields for your character.\n\nIf you don't want to show custom fields, keep this box unchecked and the miscellaneous frame will remain totally hidden.",
REG_PLAYER_MISC_ADD = "Add an additional field",
REG_PLAYER_ABOUT = "About",
REG_PLAYER_ABOUTS = "About %s",
REG_PLAYER_ABOUT_NOMUSIC = "|cffff9900No theme",
REG_PLAYER_ABOUT_UNMUSIC = "|cffff9900Unknown theme",
REG_PLAYER_ABOUT_MUSIC_SELECT = "Select character theme",
REG_PLAYER_ABOUT_MUSIC_REMOVE = "Unselect theme",
REG_PLAYER_ABOUT_MUSIC_LISTEN = "Play theme",
REG_PLAYER_ABOUT_MUSIC_STOP = "Stop theme",
REG_PLAYER_ABOUT_MUSIC_SELECT2 = "Select theme",
REG_PLAYER_ABOUT_T1_YOURTEXT = "Your text here",
REG_PLAYER_ABOUT_HEADER = "Title tag",
REG_PLAYER_ABOUT_ADD_FRAME = "Add a frame",
REG_PLAYER_ABOUT_REMOVE_FRAME = "Remove this frame",
REG_PLAYER_ABOUT_P = "Paragraph tag",
REG_PLAYER_ABOUT_TAGS = "Formatting tools",
REG_PLAYER_ABOUT_SOME = "Some text ...",
REG_PLAYER_ABOUT_EMPTY = "No description",
REG_PLAYER_STYLE_RPSTYLE_SHORT = "RP style",
REG_PLAYER_STYLE_RPSTYLE = "Roleplay style",
REG_PLAYER_STYLE_HIDE = "Do not show",
REG_PLAYER_STYLE_WOWXP = "World of Warcraft experience",
REG_PLAYER_STYLE_FREQ = "In-character frequence",
REG_PLAYER_STYLE_FREQ_1 = "Full-time, no OOC",
REG_PLAYER_STYLE_FREQ_2 = "Most of the time",
REG_PLAYER_STYLE_FREQ_3 = "Mid-time",
REG_PLAYER_STYLE_FREQ_4 = "Casual",
REG_PLAYER_STYLE_FREQ_5 = "Full-time OOC, not a RP character",
REG_PLAYER_STYLE_PERMI = "With player permission",
REG_PLAYER_STYLE_ASSIST = "Roleplay assistance",
REG_PLAYER_STYLE_INJURY = "Accept character injury",
REG_PLAYER_STYLE_DEATH = "Accept character death",
REG_PLAYER_STYLE_ROMANCE = "Accept character romance",
REG_PLAYER_STYLE_BATTLE = "Roleplay battle resolution",
REG_PLAYER_STYLE_BATTLE_1 = "World of Warcraft PvP",
REG_PLAYER_STYLE_BATTLE_2 = "TRP roll battle",
REG_PLAYER_STYLE_BATTLE_3 = "/roll battle",
REG_PLAYER_STYLE_BATTLE_4 = "Emote battle",
REG_PLAYER_STYLE_EMPTY = "No roleplay attribute shared",
REG_PLAYER_STYLE_GUILD = "Guild membership",
REG_PLAYER_STYLE_GUILD_IC = "IC membership",
REG_PLAYER_STYLE_GUILD_OOC = "OOC membership",
REG_PLAYER_ALERT_HEAVY_SMALL = "|cffff0000The total size of your profile is quite big.\n|cffff9900You should reduce it.",
CO_GENERAL_HEAVY = "Heavy profile alert",
CO_GENERAL_HEAVY_TT = "Get an alert when your profile total size exceed a reasonable value.",
REG_PLAYER_PEEK = "Miscellaneous",
REG_PLAYER_CURRENT = "Currently",
REG_PLAYER_CURRENTOOC = "Currently (OOC)",
REG_PLAYER_CURRENT_OOC = "This is OOC information";
REG_PLAYER_GLANCE = "At first glance",
REG_PLAYER_GLANCE_USE = "Activate this slot",
REG_PLAYER_GLANCE_TITLE = "Attribute name",
REG_PLAYER_GLANCE_UNUSED = "Unused slot",
REG_PLAYER_GLANCE_CONFIG = "|cff00ff00\"At first glance\"|r is a set of slots you can use to define important information about this character.\n\nYou can use these actions on the slots:\n|cffffff00Click:|r configure slot\n|cffffff00Double-click:|r toggle slot activation\n|cffffff00Right-click:|r slot presets\n|cffffff00Drag & drop:|r reorder slots",
REG_PLAYER_GLANCE_EDITOR = "Glance editor : Slot %s",
REG_PLAYER_GLANCE_BAR_TARGET = "\"At first glance\" presets",
REG_PLAYER_GLANCE_BAR_LOAD_SAVE = "Group presets",
REG_PLAYER_GLANCE_BAR_SAVE = "Save group as a preset",
REG_PLAYER_GLANCE_BAR_LOAD = "Group preset",
REG_PLAYER_GLANCE_BAR_EMPTY = "The preset name can't be empty.",
REG_PLAYER_GLANCE_BAR_NAME = "Please enter the preset name.\n\n|cff00ff00Note: If the name is already used by another group preset, this other group will be replaced.",
REG_PLAYER_GLANCE_BAR_SAVED = "Group preset |cff00ff00%s|r has been created.",
REG_PLAYER_GLANCE_BAR_DELETED = "Group preset |cffff9900%s|r deleted.",
REG_PLAYER_GLANCE_PRESET = "Load a preset",
REG_PLAYER_GLANCE_PRESET_SELECT = "Select a preset",
REG_PLAYER_GLANCE_PRESET_SAVE = "Save information as a preset",
REG_PLAYER_GLANCE_PRESET_SAVE_SMALL = "Save as a preset",
REG_PLAYER_GLANCE_PRESET_CATEGORY = "Preset category",
REG_PLAYER_GLANCE_PRESET_NAME = "Preset name",
REG_PLAYER_GLANCE_PRESET_CREATE = "Create preset",
REG_PLAYER_GLANCE_PRESET_REMOVE = "Removed preset |cff00ff00%s|r.";
REG_PLAYER_GLANCE_PRESET_ADD = "Created preset |cff00ff00%s|r.";
REG_PLAYER_GLANCE_PRESET_ALERT1 = "You must enter a preset category.",
REG_PLAYER_GLANCE_PRESET_GET_CAT = "%s\n\nPlease enter the category name for this preset.",
REG_PLAYER_GLANCE_MENU_COPY = "Copy slot",
REG_PLAYER_GLANCE_MENU_PASTE = "Paste slot: %s",
REG_PLAYER_TUTO_ABOUT_COMMON = [[|cff00ff00Character theme:|r
You can choose a |cffffff00theme|r for your character. Think of it as an |cffffff00ambiance music for reading your character description|r.
|cff00ff00Background:|r
This is a |cffffff00background texture|r for your character description.
|cff00ff00Template:|r
The chosen template defines |cffffff00the general layout and writing possibilities|r for your description.
|cffff9900Only the selected template is visible by others, so you don't have to fill them all.|r
Once a template is selected, you can open this tutorial again to have more help about each template.]],
REG_PLAYER_TUTO_ABOUT_T1 = [[This template allows you to |cff00ff00freely structure your description|r.
The description doesn't have to be limited to your character's |cffff9900physical description|r. Feel free to indicate parts from their |cffff9900background|r or details about their |cffff9900personality|r.
With this template you can use the formatting tools to access several layout parameters like |cffffff00texts sizes, colors and alignments|r.
These tools also allow you to insert |cffffff00images, icons or links to external web sites|r.]],
REG_PLAYER_TUTO_ABOUT_T2 = [[This template is more structured and consist of |cff00ff00a list of independent frames|r.
Each frame is caracterized by an |cffffff00icon, a background and a text|r. Note that you can use some text tags in these frames, like the color and the icon text tags.
The description doesn't have to be limited to your character's |cffff9900physical description|r. Feel free to indicate parts from their |cffff9900background|r or details about their |cffff9900personality|r.]],
REG_PLAYER_TUTO_ABOUT_T3 = [[This template is cut in 3 sections: |cff00ff00Physical description, personality and history|r.
You don't have to fill all the frames, |cffff9900if you leave an empty frame it won't be shown on your description|r.
Each frame is caracterized by an |cffffff00icon, a background and a text|r. Note that you can use some text tags in these frames, like the color and the icon text tags.]],
REG_PLAYER_TUTO_ABOUT_MISC_1 = [[This section provides you |cffffff005 slots|r with which you can describe |cff00ff00the most important pieces of information about your character|r.
These slots will be visible on the |cffffff00"At first glance bar"|r when someone selects your character.
|cff00ff00Hint: You can drag & drop slots to reorder them.|r
It also works on the |cffffff00"At first glance" bar|r!]],
REG_PLAYER_TUTO_ABOUT_MISC_3 = [[This section contains |cffffff00a list of flags|r to answer a lot of |cffffff00common questions people could ask about you, your character and the way you want to play him/her|r.]],
REG_RELATION = "Relationship",
REG_RELATION_BUTTON_TT = "Relation: %s\n|cff00ff00%s\n\n|cffffff00Click to display possible actions",
REG_RELATION_UNFRIENDLY = "Unfriendly",
REG_RELATION_NONE = "None",
REG_RELATION_NEUTRAL = "Neutral",
REG_RELATION_BUSINESS = "Business",
REG_RELATION_FRIEND = "Friendly",
REG_RELATION_LOVE = "Love",
REG_RELATION_FAMILY = "Family",
REG_RELATION_UNFRIENDLY_TT = "%s clearly doesn't like %s.",
REG_RELATION_NONE_TT = "%s doesn't know %s.",
REG_RELATION_NEUTRAL_TT = "%s doesn't feel anything particular toward %s.",
REG_RELATION_BUSINESS_TT = "%s and %s are in a business relationship.",
REG_RELATION_FRIEND_TT = "%s considers %s a friend.",
REG_RELATION_LOVE_TT = "%s is in love with %s !",
REG_RELATION_FAMILY_TT = "%s shares blood ties with %s.",
REG_RELATION_TARGET = "|cffffff00Click: |rChange relation",
REG_TIME = "Time last seen",
REG_REGISTER = "Directory",
REG_REGISTER_CHAR_LIST = "Characters list",
REG_TRIAL_ACCOUNT = "Trial Account",
REG_TT_GUILD_IC = "IC member",
REG_TT_GUILD_OOC = "OOC member",
REG_TT_LEVEL = "Level %s %s",
REG_TT_REALM = "Realm: |cffff9900%s",
REG_TT_GUILD = "%s of |cffff9900%s",
REG_TT_TARGET = "Target: |cffff9900%s",
REG_TT_NOTIF = "Unread description",
REG_TT_IGNORED = "< Character is ignored >",
REG_TT_IGNORED_OWNER = "< Owner is ignored >",
REG_LIST_CHAR_TITLE = "Character list",
REG_LIST_CHAR_SEL = "Selected character",
REG_LIST_CHAR_TT = "Click to show page",
REG_LIST_CHAR_TT_RELATION = "Relation:\n|cff00ff00%s",
REG_LIST_CHAR_TT_CHAR = "Bound WoW character(s):",
REG_LIST_CHAR_TT_CHAR_NO = "Not bound to any character",
REG_LIST_CHAR_TT_DATE = "Last seen date: |cff00ff00%s|r\nLast seen location: |cff00ff00%s|r",
REG_LIST_CHAR_TT_GLANCE = "At first glance",
REG_LIST_CHAR_TT_NEW_ABOUT = "Unread description",
REG_LIST_CHAR_TT_IGNORE = "Ignored character(s)",
REG_LIST_CHAR_FILTER = "Characters: %s / %s",
REG_LIST_CHAR_EMPTY = "No character",
REG_LIST_CHAR_EMPTY2 = "No character matches your selection",
REG_LIST_CHAR_IGNORED = "Ignored",
REG_LIST_IGNORE_TITLE = "Ignored list",
REG_LIST_IGNORE_EMPTY = "No ignored character",
REG_LIST_IGNORE_TT = "Reason:\n|cff00ff00%s\n\n|cffffff00Click to remove from ignore list",
REG_LIST_PETS_FILTER = "Companions: %s / %s",
REG_LIST_PETS_TITLE = "Companion list",
REG_LIST_PETS_EMPTY = "No companion",
REG_LIST_PETS_EMPTY2 = "No companion matches your selection",
REG_LIST_PETS_TOOLTIP = "Has been seen on",
REG_LIST_PETS_TOOLTIP2 = "Has been seen with",
REG_LIST_PET_NAME = "Companion's name",
REG_LIST_PET_TYPE = "Companion's type",
REG_LIST_PET_MASTER = "Master's name",
REG_LIST_FILTERS = "Filters",
REG_LIST_FILTERS_TT = "|cffffff00Click:|r Apply filters\n|cffffff00Right-Click:|r Clear filters",
REG_LIST_REALMONLY = "This realm only",
REG_LIST_GUILD = "Character's guild",
REG_LIST_NAME = "Character's name",
REG_LIST_FLAGS = "Flags",
REG_LIST_ADDON = "Profile type",
REG_LIST_ACTIONS_PURGE = "Purge register",
REG_LIST_ACTIONS_PURGE_ALL = "Remove all profiles",
REG_LIST_ACTIONS_PURGE_ALL_COMP_C = "This purge will remove all companions from the directory.\n\n|cff00ff00%s companions.",
REG_LIST_ACTIONS_PURGE_ALL_C = "This purge will remove all profiles and linked characters from the directory.\n\n|cff00ff00%s characters.",
REG_LIST_ACTIONS_PURGE_TIME = "Profiles not seen for 1 month",
REG_LIST_ACTIONS_PURGE_TIME_C = "This purge will remove all profiles that have not been seen for a month.\n\n|cff00ff00%s",
REG_LIST_ACTIONS_PURGE_UNLINKED = "Profiles not bound to a character",
REG_LIST_ACTIONS_PURGE_UNLINKED_C = "This purge will remove all profiles that are not bound to a WoW character.\n\n|cff00ff00%s",
REG_LIST_ACTIONS_PURGE_IGNORE = "Profiles from ignored characters",
REG_LIST_ACTIONS_PURGE_IGNORE_C = "This purge will remove all profiles linked to an ignored WoW character.\n\n|cff00ff00%s",
REG_LIST_ACTIONS_PURGE_EMPTY = "No profile to purge.",
REG_LIST_ACTIONS_PURGE_COUNT = "%s profiles will be removed.",
REG_LIST_ACTIONS_MASS = "Action on %s selected profiles",
REG_LIST_ACTIONS_MASS_REMOVE = "Remove profiles",
REG_LIST_ACTIONS_MASS_REMOVE_C = "This action will remove |cff00ff00%s selected profile(s)|r.",
REG_LIST_ACTIONS_MASS_IGNORE = "Ignore profiles",
REG_LIST_ACTIONS_MASS_IGNORE_C = [[This action will add |cff00ff00%s character(s)|r to the ignore list.
You can optionally enter the reason below. This is a personal note, it will serve as a reminder.]],
REG_LIST_CHAR_TUTO_ACTIONS = "This column allows you to select multiple characters and perform an action on all of them.",
REG_LIST_CHAR_TUTO_LIST = [[The first column shows the character's name.
The second column shows the relation between these characters and your current character.
The last column is for various flags. (ignored ..etc.)]],
REG_LIST_CHAR_TUTO_FILTER = [[You can filter the character list.
The |cff00ff00name filter|r will perform a search on the profile full name (first name + last name) but also on any bound WoW characters.
The |cff00ff00guild filter|r will search on guild name from bound WoW characters.
The |cff00ff00realm only filter|r will show only profiles bound to a WoW character of your current realm.]],
REG_LIST_NOTIF_ADD = "New profile discovered for |cff00ff00%s",
REG_LIST_NOTIF_ADD_CONFIG = "New profile discovered",
REG_LIST_NOTIF_ADD_NOT = "This profile doesn't exist anymore.",
REG_COMPANION_LINKED = "The companion %s is now linked to the profile %s.",
REG_COMPANION = "Companion",
REG_COMPANIONS = "Companions",
REG_COMPANION_BOUNDS = "Binds",
REG_COMPANION_TARGET_NO = "Your target is not a valid pet, minion, ghoul, mage elemental or a renamed battle pet.",
REG_COMPANION_BOUND_TO = "Bound to ...",
REG_COMPANION_UNBOUND = "Unbound from ...",
REG_COMPANION_LINKED_NO = "The companion %s is no longer linked to any profile.",
REG_COMPANION_BOUND_TO_TARGET = "Target",
REG_COMPANION_BROWSER_BATTLE = "Battle pet browser",
REG_COMPANION_BROWSER_MOUNT = "Mount browser",
REG_COMPANION_PROFILES = "Companions profiles",
REG_COMPANION_TF_PROFILE = "Companion profile",
REG_COMPANION_TF_PROFILE_MOUNT = "Mount profile",
REG_COMPANION_TF_NO = "No profile",
REG_COMPANION_TF_CREATE = "Create new profile",
REG_COMPANION_TF_UNBOUND = "Unlink from profile",
REG_COMPANION_TF_BOUND_TO = "Select a profile",
REG_COMPANION_TF_OPEN = "Open page",
REG_COMPANION_TF_OWNER = "Owner: %s",
REG_COMPANION_INFO = "Information",
REG_COMPANION_NAME = "Name",
REG_COMPANION_TITLE = "Title",
REG_COMPANION_NAME_COLOR = "Name color",
REG_MSP_ALERT = [[|cffff0000WARNING
You can't have simultaneously more than one addon using the Mary Sue Protocol, as they would be in conflict.|r
Currently loaded: |cff00ff00%s
|cffff9900Therefore the MSP support for Total RP3 will be disabled.|r
If you don't want TRP3 to be your MSP addon and don't want to see this alert again, you can disable the Mary Sue Protocol module in the TRP3 Settings -> Module status.]],
REG_COMPANION_PAGE_TUTO_C_1 = "Consult",
REG_COMPANION_PAGE_TUTO_E_1 = "This is |cff00ff00your companion main information|r.\n\nAll these information will appear on |cffff9900your companion's tooltip|r.",
REG_COMPANION_PAGE_TUTO_E_2 = [[This is |cff00ff00your companion description|r.
It isn't limited to |cffff9900physical description|r. Feel free to indicate parts from their |cffff9900background|r or details about their |cffff9900personality|r.
There are a lot of ways to customize the description.
You can choose a |cffffff00background texture|r for the description. You can also use the formatting tools to access several layout parameters like |cffffff00texts sizes, colors and alignments|r.
These tools also allow you to insert |cffffff00images, icons or links to external web sites|r.]],
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- CONFIGURATION
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
CO_CONFIGURATION = "Settings",
CO_GENERAL = "General settings",
CO_GENERAL_CHANGELOCALE_ALERT = "Reload the interface in order to change the language to %s now ?\n\nIf not, the language will be changed on the next connection.",
CO_GENERAL_LOCALE = "Addon locale",
CO_GENERAL_COM = "Communication",
CO_GENERAL_MISC = "Miscellaneous",
CO_GENERAL_TT_SIZE = "Info tooltip text size",
CO_GENERAL_NEW_VERSION = "Update alert",
CO_GENERAL_NEW_VERSION_TT = "Get an alert when a new version is available.",
CO_GENERAL_UI_SOUNDS = "UI sounds",
CO_GENERAL_UI_SOUNDS_TT = "Activate the UI sounds (when opening windows, switching tabs, clicking buttons).",
CO_GENERAL_UI_ANIMATIONS = "UI animations",
CO_GENERAL_UI_ANIMATIONS_TT = "Activate the UI animations.",
CO_GENERAL_BROADCAST = "Use broadcast channel",
CO_GENERAL_BROADCAST_TT = "The broadcast channel is used by a lot of features. Disabling it will disable all the features like characters position on the map, playing local sounds, stashes and signposts access...",
CO_GENERAL_DEFAULT_COLOR_PICKER = "Default color picker",
CO_GENERAL_DEFAULT_COLOR_PICKER_TT = "Activate to always use the default color picker. Useful if you're using a color picker addon.",
CO_GENERAL_RESET_CUSTOM_COLORS = "Reset custom colors",
CO_GENERAL_RESET_CUSTOM_COLORS_TT = "Removes all custom colors saved in the color picker.",
CO_GENERAL_RESET_CUSTOM_COLORS_WARNING = "Are you sure you want to remove all custom colors saved in the color picker ?",
CO_TOOLTIP = "Tooltip settings",
CO_TOOLTIP_USE = "Use characters/companions tooltip",
CO_TOOLTIP_COMBAT = "Hide during combat",
CO_TOOLTIP_COLOR = "Show custom colors",
CO_TOOLTIP_CONTRAST = "Increase color contrast",
CO_TOOLTIP_CONTRAST_TT = "Enable this option to allow Total RP 3 to modify the custom colors to make the text more readable if the color is too dark.",
CO_TOOLTIP_CROP_TEXT = "Crop unreasonably long texts",
CO_TOOLTIP_CROP_TEXT_TT = [[Limit the number of characters that can be displayed by each field in the tooltip to prevent unreasonably long texts and possible layout issues.
|cfffff569Limit details:
Name: 100 characters
Title: 150 characters
Race: 50 characters
Class: 50 characters|r]],
CO_TOOLTIP_CHARACTER = "Characters tooltip",
CO_TOOLTIP_ANCHORED = "Anchored frame",
CO_TOOLTIP_ANCHOR = "Anchor point",
CO_TOOLTIP_HIDE_ORIGINAL = "Hide original tooltip",
CO_TOOLTIP_MAINSIZE = "Main font size",
CO_TOOLTIP_SUBSIZE = "Secondary font size",
CO_TOOLTIP_TERSIZE = "Tertiary font size",
CO_TOOLTIP_SPACING = "Show spacing",
CO_TOOLTIP_SPACING_TT = "Place spaces to lighten the tooltip, in the style of MyRoleplay tooltip.",
CO_TOOLTIP_NO_FADE_OUT = "Hide immediately instead of fading",
CO_TOOLTIP_PETS = "Companions tooltip",
CO_TOOLTIP_OWNER = "Show owner",
CO_TOOLTIP_PETS_INFO = "Show companion info",
CO_TOOLTIP_COMMON = "Common settings",
CO_TOOLTIP_ICONS = "Show icons",
CO_TOOLTIP_FT = "Show full title",
CO_TOOLTIP_RACE = "Show race, class and level",
CO_TOOLTIP_REALM = "Show realm",
CO_TOOLTIP_GUILD = "Show guild info",
CO_TOOLTIP_TARGET = "Show target",
CO_TOOLTIP_TITLE = "Show title",
CO_TOOLTIP_CLIENT = "Show client",
CO_TOOLTIP_NOTIF = "Show notifications",
CO_TOOLTIP_NOTIF_TT = "The notifications line is the line containing the client version, the unread description marker and the 'At first glance' marker.",
CO_TOOLTIP_RELATION = "Show relationship color",
CO_TOOLTIP_RELATION_TT = "Set the character tooltip border to a color representing the relation.",
CO_TOOLTIP_CURRENT = "Show \"current\" information",
CO_TOOLTIP_CURRENT_SIZE = "Max \"current\" information length",
CO_TOOLTIP_PROFILE_ONLY = "Use only if target has a profile",
CO_TOOLTIP_IN_CHARACTER_ONLY = "Hide when out of character",
CO_REGISTER = "Register settings",
CO_REGISTER_AUTO_PURGE = "Auto purge directory",
CO_REGISTER_AUTO_PURGE_TT = "Automatically remove from directory the profiles of characters you haven't crossed for a certain time. You can choose the delay before deletion.\n\n|cff00ff00Note that profiles with a relation toward one of your characters will never be purged.\n\n|cffff9900There is a bug in WoW losing all the saved data when it reaches a certain threshold. We strongly recommend to avoid disabling the purge system.",
CO_REGISTER_AUTO_PURGE_0 = "Disable purge",
CO_REGISTER_AUTO_PURGE_1 = "After %s day(s)",
CO_CURSOR_TITLE = "Cursor interactions",
CO_CURSOR_RIGHT_CLICK = "Right-click to open profile",
CO_CURSOR_RIGHT_CLICK_TT = [[Right-click on a player in the 3D world to open their profile, if they have one.
|TInterface\Cursor\WorkOrders:25|t This icon will be attached to the cursor when a player has a profile and you can right-click them.
|cffccccccNote: This feature is disabled during combat.|r]],
CO_CURSOR_DISABLE_OOC = "Disabled while OOC",
CO_CURSOR_DISABLE_OOC_TT = "Disable the cursor modifications when your roleplay status is set to |cffccccccOut Of Character|f.",
CO_CURSOR_MODIFIER_KEY = "Modifier key",
CO_CURSOR_MODIFIER_KEY_TT = "Requires a modifier key to be held down while right-clicking a player, to prevent accidental clicks.",
CO_MODULES = "Modules status",
CO_MODULES_VERSION = "Version: %s",
CO_MODULES_ID = "Module ID: %s",
CO_MODULES_STATUS = "Status: %s",
CO_MODULES_STATUS_0 = "Missing dependencies",
CO_MODULES_STATUS_1 = "Loaded",
CO_MODULES_STATUS_2 = "Disabled",
CO_MODULES_STATUS_3 = "Total RP 3 update required",
CO_MODULES_STATUS_4 = "Error on initialization",
CO_MODULES_STATUS_5 = "Error on startup",
CO_MODULES_TT_NONE = "No dependencies";
CO_MODULES_TT_DEPS = "Dependencies";
CO_MODULES_TT_TRP = "%sFor Total RP 3 build %s minimum.|r",
CO_MODULES_TT_DEP = "\n%s- %s (version %s)|r",
CO_MODULES_TT_ERROR = "\n\n|cffff0000Error:|r\n%s";
CO_MODULES_TUTO = [[A module is a independent feature that can be enabled or disabled.
Possible status:
|cff00ff00Loaded:|r The module is enabled and loaded.
|cff999999Disabled:|r The module is disabled.
|cffff9900Missing dependencies:|r Some dependencies are not loaded.
|cffff9900TRP update required:|r The module requires a more recent version of TRP3.
|cffff0000Error on init or on startup:|r The module loading sequence failed. The module will likely create errors !
|cffff9900When disabling a module, a UI reload is necessary.]],
CO_MODULES_SHOWERROR = "Show error",
CO_MODULES_DISABLE = "Disable module",
CO_MODULES_ENABLE = "Enable module",
CO_TOOLBAR = "Frames settings",
CO_TOOLBAR_CONTENT = "Toolbar settings",
CO_TOOLBAR_ICON_SIZE = "Icons size",
CO_TOOLBAR_MAX = "Max icons per line",
CO_TOOLBAR_MAX_TT = "Set to 1 if you want to display the bar vertically !",
CO_TOOLBAR_CONTENT_CAPE = "Cape switch",
CO_TOOLBAR_CONTENT_HELMET = "Helmet switch",
CO_TOOLBAR_CONTENT_STATUS = "Player status (AFK/DND)",
CO_TOOLBAR_CONTENT_RPSTATUS = "Character status (IC/OOC)",
CO_TOOLBAR_SHOW_ON_LOGIN = "Show toolbar on login",
CO_TOOLBAR_SHOW_ON_LOGIN_HELP = "If you don't want the toolbar to be displayed on login, you can disable this option.",
CO_TOOLBAR_HIDE_TITLE = "Hide Toolbar Title",
CO_TOOLBAR_HIDE_TITLE_HELP = "Hides the title shown above the toolbar.",
CO_TARGETFRAME = "Target frame settings",
CO_TARGETFRAME_USE = "Display conditions",
CO_TARGETFRAME_USE_TT = "Determines in which conditions the target frame should be shown on target selection.",
CO_TARGETFRAME_USE_1 = "Always",
CO_TARGETFRAME_USE_2 = "Only when IC",
CO_TARGETFRAME_USE_3 = "Never (Disabled)",
CO_TARGETFRAME_ICON_SIZE = "Icons size",
CO_MINIMAP_BUTTON = "Minimap button",
CO_MINIMAP_BUTTON_SHOW_TITLE = "Show minimap button",
CO_MINIMAP_BUTTON_SHOW_HELP = [[If you are using another add-on to display Total RP 3's minimap button (FuBar, Titan, Bazooka) you can remove the button from the minimap.
|cff00ff00Reminder : You can open Total RP 3 using /trp3 switch main|r]],
CO_MINIMAP_BUTTON_FRAME = "Frame to anchor",
CO_MINIMAP_BUTTON_RESET = "Reset position",
CO_MINIMAP_BUTTON_RESET_BUTTON = "Reset",
CO_MAP_BUTTON = "Map scan button",
CO_MAP_BUTTON_POS = "Scan button anchor on map",
CO_ANCHOR_TOP = "Top",
CO_ANCHOR_TOP_LEFT = "Top left",
CO_ANCHOR_TOP_RIGHT = "Top right",
CO_ANCHOR_BOTTOM = "Bottom",
CO_ANCHOR_BOTTOM_LEFT = "Bottom left",
CO_ANCHOR_BOTTOM_RIGHT = "Bottom right",
CO_ANCHOR_LEFT = "Left",
CO_ANCHOR_RIGHT = "Right",
CO_ANCHOR_CURSOR = "Show on cursor",
CO_CHAT = "Chat settings",
CO_CHAT_DISABLE_OOC = "Disable customizations when OOC",
CO_CHAT_DISABLE_OOC_TT = "Disable all of Total RP 3's chat customizations (custom names, emote detection, NPC speeches, etc.) when your character is set as Out Of Character.",
CO_CHAT_MAIN = "Chat main settings",
CO_CHAT_MAIN_NAMING = "Naming method",
CO_CHAT_MAIN_NAMING_1 = "Keep original names",
CO_CHAT_MAIN_NAMING_2 = "Use custom names",
CO_CHAT_MAIN_NAMING_3 = "First name + last name",
CO_CHAT_MAIN_NAMING_4 = "Short title + first name + last name",
CO_CHAT_REMOVE_REALM = "Remove realm from player names",
CO_CHAT_INSERT_FULL_RP_NAME = "Insert RP names on shift-click",
CO_CHAT_INSERT_FULL_RP_NAME_TT = [[Insert the complete RP name of a player when SHIFT-Clicking their name in the chat frame.
(When this option is enabled, you can ALT-SHIFT-Click on a name when you want the default behavior and insert the character name instead of the full RP name.)]],
CO_CHAT_MAIN_COLOR = "Use custom colors for names",
CO_CHAT_INCREASE_CONTRAST = "Increase color contrast",
CO_CHAT_USE_ICONS = "Show player icons",
CO_CHAT_USE = "Used chat channels",
CO_CHAT_USE_SAY = "Say channel",
CO_CHAT_MAIN_NPC = "NPC talk detection",
CO_CHAT_MAIN_NPC_USE = "Use NPC talk detection",
CO_CHAT_MAIN_NPC_PREFIX = "NPC talk detection pattern",
CO_CHAT_MAIN_NPC_PREFIX_TT = "If a chat line said in SAY, EMOTE, GROUP or RAID channel begins with this prefix, it will be interpreted as an NPC chat.\n\n|cff00ff00By default : \"|| \"\n(without the \" and with a space after the pipe)",
CO_CHAT_MAIN_EMOTE = "Emote detection",
CO_CHAT_MAIN_EMOTE_USE = "Use emote detection",
CO_CHAT_MAIN_EMOTE_PATTERN = "Emote detection pattern",
CO_CHAT_MAIN_OOC = "OOC detection",
CO_CHAT_MAIN_OOC_USE = "Use OOC detection",
CO_CHAT_MAIN_OOC_PATTERN = "OOC detection pattern",
CO_CHAT_MAIN_OOC_COLOR = "OOC color",
CO_CHAT_MAIN_EMOTE_YELL = "No yelled emote",
CO_CHAT_MAIN_EMOTE_YELL_TT = "Do not show *emote* or <emote> in yelling.",
CO_CHAT_NPCSPEECH_REPLACEMENT = "Customize companion names in NPC speeches",
CO_CHAT_NPCSPEECH_REPLACEMENT_TT = "If a companion name is in brackets in an NPC speech, it will be colored and its icon will be shown depending on your settings above.",
CO_GLANCE_MAIN = "\"At first glance\" bar",
CO_GLANCE_RESET_TT = "Reset the bar position to the bottom left of the anchored frame.",
CO_GLANCE_LOCK = "Lock bar",
CO_GLANCE_LOCK_TT = "Prevent the bar from being dragged",
CO_GLANCE_PRESET_TRP2 = "Use Total RP 2 style positions",
CO_GLANCE_PRESET_TRP2_BUTTON = "Use",
CO_GLANCE_PRESET_TRP2_HELP = "Shortcut to setup the bar in a TRP2 style : to the right of WoW target frame.",
CO_GLANCE_PRESET_TRP3 = "Use Total RP 3 style positions",
CO_GLANCE_PRESET_TRP3_HELP = "Shortcut to setup the bar in a TRP3 style : to the bottom of the TRP3 target frame.",
CO_GLANCE_TT_ANCHOR = "Tooltips anchor point",
CO_MSP = "Mary Sue Protocol",
CO_MSP_T3 = "Use template 3 only",
CO_MSP_T3_TT = "Even if you choose another \"about\" template, the template 3 will always be used for MSP compatibility.",
CO_WIM = "|cffff9900Whisper channels are disabled.",
CO_WIM_TT = "You are using |cff00ff00WIM|r, the handling for whisper channels is disabled for compatibility purposes",
CO_LOCATION = "Location settings",
CO_LOCATION_ACTIVATE = "Enable character location",
CO_LOCATION_ACTIVATE_TT = "Enable the character location system, allowing you to scan for other Total RP users on the world map and allowing them to find you.",
CO_LOCATION_DISABLE_OOC = "Disable location when OOC",
CO_LOCATION_DISABLE_OOC_TT = "You will not respond to location requests from other players when you've set your RP status to Out Of Character.",
CO_SANITIZER = "Sanitize incoming profiles",
CO_SANITIZER_TT = "Remove escaped sequences in tooltip fields from incoming profiles when TRP doesn't allow it (color, images ...).",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- TOOLBAR AND UI BUTTONS
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
TB_TOOLBAR = "Toolbar",
TB_SWITCH_TOOLBAR = "Switch toolbar",
TB_SWITCH_CAPE_ON = "Cloak: |cff00ff00Shown",
TB_SWITCH_CAPE_OFF = "Cloak: |cffff0000Hidden",
TB_SWITCH_CAPE_1 = "Show cloak",
TB_SWITCH_CAPE_2 = "Hide cloak",
TB_SWITCH_HELM_ON = "Helm: |cff00ff00Shown",
TB_SWITCH_HELM_OFF = "Helm: |cffff0000Hidden",
TB_SWITCH_HELM_1 = "Show helmet",
TB_SWITCH_HELM_2 = "Hide helmet",
TB_GO_TO_MODE = "Switch to %s mode",
TB_NORMAL_MODE = "Normal",
TB_DND_MODE = "Do not disturb",
TB_AFK_MODE = "Away",
TB_STATUS = "Player",
TB_RPSTATUS_ON = "Character: |cff00ff00In character",
TB_RPSTATUS_OFF = "Character: |cffff0000Out of character",
TB_RPSTATUS_TO_ON = "Go |cff00ff00in character",
TB_RPSTATUS_TO_OFF = "Go |cffff0000out of character",
TB_SWITCH_PROFILE = "Switch to another profile",
TF_OPEN_CHARACTER = "Show character page",
TF_OPEN_COMPANION = "Show companion page",
TF_OPEN_MOUNT = "Show mount page",
TF_PLAY_THEME = "Play character theme",
TF_PLAY_THEME_TT = "|cffffff00Click:|r Play |cff00ff00%s\n|cffffff00Right-click:|r Stop theme",
TF_IGNORE = "Ignore player",
TF_IGNORE_TT = "|cffffff00Click:|r Ignore player",
TF_IGNORE_CONFIRM = "Are you sure you want to ignore this ID ?\n\n|cffffff00%s|r\n\n|cffff7700You can optionally enter below the reason why you ignore it. This is a personal note, it won't be visible by others and will serve as a reminder.",
TF_IGNORE_NO_REASON = "No reason",
TB_LANGUAGE = "Language",
TB_LANGUAGES_TT = "Change language",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- PROFILES
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
PR_PROFILEMANAGER_TITLE = "Characters profiles",
PR_PROFILEMANAGER_DELETE_WARNING = "Are you sure you want to delete the profile %s?\nThis action cannot be undone and all TRP3 information linked to this profile (Character info, inventory, quest log, applied states ...) will be destroyed !",
PR_PROFILE = "Profile",
PR_PROFILES = "Profiles",
PR_PROFILE_CREATED = "Profile %s created.",
PR_CREATE_PROFILE = "Create profile",
PR_PROFILE_DELETED = "Profile %s deleted.",
PR_PROFILE_HELP = "A profile contains all information about a |cffffff00\"character\"|r as a |cff00ff00roleplay character|r.\n\nA real |cffffff00\"WoW character\"|r can be bound to only one profile at a time, but can switch from one to another whenever you want.\n\nYou can also bind several |cffffff00\"WoW characters\"|r to the same |cff00ff00profile|r !",
PR_PROFILE_DETAIL = "This profile is currently bound to these WoW characters",
PR_DELETE_PROFILE = "Delete profile",
PR_DUPLICATE_PROFILE = "Duplicate profile",
PR_UNUSED_PROFILE = "This profile is currently not bound to any WoW character.",
PR_PROFILE_LOADED = "The profile %s is loaded.",
PR_PROFILEMANAGER_CREATE_POPUP = "Please enter a name for the new profile.\nThe name cannot be empty.",
PR_PROFILEMANAGER_DUPP_POPUP = "Please enter a name for the new profile.\nThe name cannot be empty.\n\nThis duplication will not change the character's binds to %s.",
PR_PROFILEMANAGER_EDIT_POPUP = "Please enter a new name for this profile %s.\nThe name cannot be empty.\n\nChanging the name will not change any link between this profile and your characters.",
PR_PROFILEMANAGER_ALREADY_IN_USE = "The profile name %s is not available.",
PR_PROFILEMANAGER_COUNT = "%s WoW character(s) bound to this profile.",
PR_PROFILEMANAGER_ACTIONS = "Actions",
PR_PROFILEMANAGER_SWITCH = "Select profile",
PR_PROFILEMANAGER_RENAME = "Rename profile",
PR_PROFILEMANAGER_CURRENT = "Current profile",
PR_CO_PROFILEMANAGER_TITLE = "Companions profiles",
PR_CO_PROFILE_HELP = [[A profile contains all information about a |cffffff00"pet"|r as a |cff00ff00roleplay character|r.
A companion profile can be linked to:
- A battle pet |cffff9900(only if it has been renamed)|r
- A hunter pet
- A warlock minion
- A mage elemental
- A death knight ghoul |cffff9900(see below)|r
Just like characters profiles, a |cff00ff00companion profile|r can be linked to |cffffff00several pets|r, and a |cffffff00pet|r can switch easily from one profile to another.
|cffff9900Ghouls:|r As ghouls get a new name each time they are summoned, you will have to re-link the profile to the ghoul for all possible names.]],
PR_CO_PROFILE_HELP2 = [[Click here to create a new companion profile.
|cff00ff00To link a profile to a pet (hunter pet, warlock minion ...), just summon the pet, select it and use the target frame to link it to a existing profile (or create a new one).|r]],
PR_CO_MASTERS = "Masters",
PR_CO_EMPTY = "No companion profile",
PR_CO_NEW_PROFILE = "New companion profile",
PR_CO_COUNT = "%s pets/mounts bound to this profile.",
PR_CO_UNUSED_PROFILE = "This profile is currently not bound to any pet or mount.",
PR_CO_PROFILE_DETAIL = "This profile is currently bound to",
PR_CO_PROFILEMANAGER_DELETE_WARNING = "Are you sure you want to delete the companion profile %s?\nThis action cannot be undone and all TRP3 information linked to this profile will be destroyed !",
PR_CO_PROFILEMANAGER_DUPP_POPUP = "Please enter a name for the new profile.\nThe name cannot be empty.\n\nThis duplication will not change your pets/mounts binds to %s.",
PR_CO_PROFILEMANAGER_EDIT_POPUP = "Please enter a new name for this profile %s.\nThe name cannot be empty.\n\nChanging the name will not change any link between this profile and your pets/mounts.",
PR_CO_WARNING_RENAME = "|cffff0000Warning:|r it's strongly recommended that you rename your pet before linking it to a profile.\n\nLink it anyway ?",
PR_CO_PET = "Pet",
PR_CO_BATTLE = "Battle pet",
PR_CO_MOUNT = "Mount",
PR_IMPORT_CHAR_TAB = "Characters importer",
PR_IMPORT_PETS_TAB = "Companions importer",
PR_IMPORT_IMPORT_ALL = "Import all",
PR_IMPORT_WILL_BE_IMPORTED = "Will be imported",
PR_IMPORT_EMPTY = "No importable profile",
PR_PROFILE_MANAGEMENT_TITLE = "Profile management",
PR_EXPORT_IMPORT_TITLE = "Export/import profile",
PR_EXPORT_WARNING_TITLE = "Warning:",
PR_EXPORT_WARNING_WINDOWS = [[Please note that some advanced text editing tools like Microsoft Word or Discord will reformat special characters like quotes, altering the content of the data.
If you are planning on copying the text below inside a document, please use simpler text editing tools that do not automatically change characters, like Notepad.]],
PR_EXPORT_WARNING_MAC = [[Please note that some advanced text editing tools like Text Edit or Discord will reformat special characters like quotes, altering the content of the data.
If you are planning on copying the text below inside a document, please use simpler text editing tools that do not automatically change characters (in Text Edit go to Format > Make Plain Text before pasting)]],
PR_EXPORT_IMPORT_HELP = [[You can export and import profiles using the options in the dropdown menu.
Use the |cffffff00Export profile|r option to generate a chunk of text containing the profile serialized data. You can copy the text using Control-C (or Command-C on a Mac) and paste it somewhere else as a backup. (|cffff0000Please note that some advanced text editing tools like Microsoft Word will reformat special characters like quotes, altering the data. Use simpler text editing tools like Notepad.|r)
Use the |cffffff00Import profile|r option to paste data from a previous export inside an existing profile. The existing data in this profile will be replaced by the ones you have pasted. You cannot import data directly into your currently selected profile.]],
PR_EXPORT_PROFILE = "Export profile",
PR_IMPORT_PROFILE = "Import profile",
PR_EXPORT_NAME = "Serial for profile %s (size %0.2f kB)",
PR_EXPORT_TOO_LARGE = "This profile is too large and can't be exported.\n\nSize of profile: %0.2f kB\nMax: 20 kB",
PR_IMPORT_PROFILE_TT = "Paste a profile serial here",
PR_IMPORT = "Import",
PR_PROFILEMANAGER_IMPORT_WARNING = "Replace all the content of profile %s with this imported data?",
PR_PROFILEMANAGER_IMPORT_WARNING_2 = "Warning: this profile serial has been made from an older version of TRP3.\nThis can bring incompatibilities.\n\nReplacing all the content of profile %s with this imported data?",
PR_SLASH_SWITCH_HELP = "Switch to another profile using its name.",
PR_SLASH_EXAMPLE = "|cffffff00Command usage:|r |cffcccccc/trp3 profile Millidan Foamrage|r |cffffff00to switch to Millidan Foamrage's profile.|r",
PR_SLASH_NOT_FOUND = "|cffff0000Could not find a profile named|r |cffffff00%s|r|cffff0000.|r",
PR_SLASH_OPEN_HELP = "Open a character's profile using its in-game name, or your target's profile if no name is provided.",
PR_SLASH_OPEN_EXAMPLE = "|cffffff00Command usage:|r |cffcccccc/trp3 open|r |cffffff00to open your target's profile or |cffcccccc/trp3 open CharacterName-RealmName|r |cffffff00to open that character's profile.|r",
PR_SLASH_OPEN_WAITING = "|cffffff00Requesting profile, please wait...|r",
PR_SLASH_OPEN_ABORTING = "|cffffff00Aborted profile request.|r",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- DASHBOARD
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
DB_STATUS = "Status",
DB_STATUS_CURRENTLY_COMMON = "These statuses will be displayed on your character's tooltip. Keep it clear and brief as |cffff9900by default TRP3 players will only see the first 140 characters of them!",
DB_STATUS_CURRENTLY = "Currently (IC)",
DB_STATUS_CURRENTLY_TT = "Here you can indicate something important about your character.",
DB_STATUS_CURRENTLY_OOC = "Other information (OOC)",
DB_STATUS_CURRENTLY_OOC_TT = "Here you can indicate something important about you, as a player, or anything out of your character.",
DB_STATUS_RP = "Character status",
DB_STATUS_RP_IC = "In character",
DB_STATUS_RP_IC_TT = "That means you are currently playing your character.\nAll your actions will be interpreted as if it's your character doing them.",
DB_STATUS_RP_OOC = "Out of character",
DB_STATUS_RP_OOC_TT = "You are out of your character.\nYour actions can't be associated to him/her.",
DB_STATUS_XP = "Roleplayer status",
DB_STATUS_XP_BEGINNER = "Rookie roleplayer",
DB_STATUS_XP_BEGINNER_TT = "This selection will show an icon on your tooltip, indicating\nto others that you are a beginner roleplayer.",
DB_STATUS_RP_EXP = "Experienced roleplayer",
DB_STATUS_RP_EXP_TT = "Shows that you are an experienced roleplayer.\nIt will not show any specific icon on your tooltip.",
DB_STATUS_RP_VOLUNTEER = "Volunteer roleplayer",
DB_STATUS_RP_VOLUNTEER_TT = "This selection will show an icon on your tooltip, indicating\nto beginner roleplayers that you are willing to help them.",
DB_TUTO_1 = [[|cffffff00The character status|r indicates if you are currently playing your character's role or not.
|cffffff00The roleplayer status|r allows you to state that you are a beginner, or a veteran willing to help rookies!
|cff00ff00These information will be placed in your character's tooltip.]],
DB_NEW = "What's new?",
DB_ABOUT = "About Total RP 3",
DB_MORE = "More modules",
DB_HTML_GOTO = "Click to open",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- COMMON UI TEXTS
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
UI_BKG = "Background %s",
UI_ICON_BROWSER = "Icon browser",
UI_ICON_BROWSER_HELP = "Copy icon",
UI_ICON_BROWSER_HELP_TT = [[While this frame is open you can |cffffff00ctrl + click|r on a icon to copy its name.
This will works:|cff00ff00
- On any item in your bags
- On any icon in the spellbook|r]],
UI_COMPANION_BROWSER_HELP = "Select a battle pet",
UI_COMPANION_BROWSER_HELP_TT = "|cffffff00Warning: |rOnly renamed battle pets can be bound to a profile.\n\n|cff00ff00This section lists these battle pets only.",
UI_ICON_SELECT = "Select icon",
UI_MUSIC_BROWSER = "Music browser",
UI_MUSIC_SELECT = "Select music",
UI_COLOR_BROWSER = "Color browser",
UI_COLOR_BROWSER_SELECT = "Select color",
UI_COLOR_BROWSER_PRESETS = "Presets",
UI_COLOR_BROWSER_PRESETS_BASIC = "Basic",
UI_COLOR_BROWSER_PRESETS_CLASSES = "Class",
UI_COLOR_BROWSER_PRESETS_RESOURCES = "Resource",
UI_COLOR_BROWSER_PRESETS_ITEMS = "Item quality",
UI_COLOR_BROWSER_PRESETS_CUSTOM = "Custom",
UI_IMAGE_BROWSER = "Image browser",
UI_IMAGE_SELECT = "Select image",
UI_FILTER = "Filter",
UI_LINK_URL = "http://your.url.here",
UI_LINK_TEXT = "Your text here",
UI_LINK_SAFE = [[Here's the link URL.]],
UI_LINK_WARNING = [[Here's the link URL.
You can copy/paste it in your web browser.
|cffff0000!! Disclaimer !!|r
Total RP is not responsible for links leading to harmful content.]],
UI_TUTO_BUTTON = "Tutorial mode",
UI_TUTO_BUTTON_TT = "Click to toggle on/off the tutorial mode",
UI_CLOSE_ALL = "Close all",
NPC_TALK_SAY_PATTERN = "says:",
NPC_TALK_YELL_PATTERN = "yells:",
NPC_TALK_WHISPER_PATTERN = "whispers:",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- COMMON TEXTS
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
CM_SHOW = "Show",
CM_ACTIONS = "Actions",
CM_IC = "IC",
CM_OOC = "OOC",
CM_CLICK = "Click",
CM_R_CLICK = "Right-click",
CM_L_CLICK = "Left-click",
CM_M_CLICK = "Middle-click",
CM_ALT = "Alt",
CM_CTRL = "Ctrl",
CM_SHIFT = "Shift",
CM_DRAGDROP = "Drag & drop",
CM_DOUBLECLICK = "Double-click",
CM_LINK = "Link",
CM_SAVE = "Save",
CM_CANCEL = "Cancel",
CM_DELETE = "Delete",
CM_RESET = "Reset",
CM_NAME = "Name",
CM_VALUE = "Value",
CM_UNKNOWN = "Unknown",
CM_PLAY = "Play",
CM_STOP = "Stop",
CM_LOAD = "Load",
CM_REMOVE = "Remove",
CM_EDIT = "Edit",
CM_LEFT = "Left",
CM_CENTER = "Center",
CM_RIGHT = "Right",
CM_COLOR = "Color",
CM_ICON = "Icon",
CM_IMAGE = "Image",
CM_SELECT = "Select",
CM_OPEN = "Open",
CM_APPLY = "Apply",
CM_MOVE_UP = "Move up",
CM_MOVE_DOWN = "Move down",
CM_CLASS_WARRIOR = "Warrior",
CM_CLASS_PALADIN = "Paladin",
CM_CLASS_HUNTER = "Hunter",
CM_CLASS_ROGUE = "Rogue",
CM_CLASS_PRIEST = "Priest",
CM_CLASS_DEATHKNIGHT = "Death Knight",
CM_CLASS_SHAMAN = "Shaman",
CM_CLASS_MAGE = "Mage",
CM_CLASS_WARLOCK = "Warlock",
CM_CLASS_MONK = "Monk",
CM_CLASS_DRUID = "Druid",
CM_CLASS_UNKNOWN = "Unknown",
CM_RESIZE = "Resize",
CM_RESIZE_TT = "Drag to resize the frame.",
CM_TWEET_PROFILE = "Show profile url",
CM_TWEET = "Send a tweet",
CM_ORANGE = "Orange",
CM_WHITE = "White",
CM_YELLOW = "Yellow",
CM_CYAN = "Cyan",
CM_BLUE = "Blue",
CM_GREEN = "Green",
CM_RED = "Red",
CM_PURPLE = "Purple",
CM_PINK = "Pink",
CM_BLACK = "Black",
CM_GREY = "Grey",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- Minimap button
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
MM_SHOW_HIDE_MAIN = "Show/hide the main frame",
MM_SHOW_HIDE_SHORTCUT = "Show/hide the toolbar",
MM_SHOW_HIDE_MOVE = "Move button",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- Browsers
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
BW_COLOR_CODE = "Color code",
BW_COLOR_CODE_TT = "You can paste a 6 figures hexadecimal color code here and press Enter.",
BW_COLOR_CODE_ALERT = "Wrong hexadecimal code !",
BW_CUSTOM_NAME = "Custom color name",
BW_CUSTOM_NAME_TITLE = "Name (Optional)",
BW_CUSTOM_NAME_TT = "You can set a name for the custom color you're saving. If left empty, it will use the hexadecimal color code.",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- Databroker
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
DTBK_HELMET = "Total RP 3 - Helmet",
DTBK_CLOAK = "Total RP 3 - Cloak",
DTBK_AFK = "Total RP 3 - AFK/DND",
DTBK_RP = "Total RP 3 - IC/OOC",
DTBK_LANGUAGES = "Total RP 3 - Languages",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- Bindings
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
BINDING_NAME_TRP3_TOGGLE = "Toogle main frame";
BINDING_NAME_TRP3_TOOLBAR_TOGGLE = "Toogle toolbar";
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- About TRP3
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
ABOUT_TITLE = "About",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- MAP
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
MAP_BUTTON_TITLE = "Scan for roleplay",
MAP_BUTTON_SUBTITLE = "Click to show available scans",
MAP_BUTTON_SUBTITLE_OFFLINE = "Map scanning is unavailable right now: %s",
MAP_BUTTON_SUBTITLE_CONNECTING = "Map scanning is setting up. Please wait.",
MAP_BUTTON_NO_SCAN = "No scan available",
MAP_BUTTON_SCANNING = "Scanning",
MAP_SCAN_CHAR = "Scan for characters",
MAP_SCAN_CHAR_TITLE = "Characters",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- MATURE FILTER
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
MATURE_FILTER_TITLE = "Mature profiles filter",
MATURE_FILTER_TOOLTIP_WARNING = "Mature content",
MATURE_FILTER_TOOLTIP_WARNING_SUBTEXT = "This character profile contains mature content. Use the target bar action button to reveal the content if you really want to…",
MATURE_FILTER_OPTION = "Filter mature profiles",
MATURE_FILTER_OPTION_TT = [[Check this option to enable mature profile filtering. Total RP 3 will scan incoming profiles when they are received for specific keywords reported as being for a mature audience and flag the profile as mature if it finds such word.
A mature profile will have a muted tooltip and you will have to confirm that you want to view the profile the first time you open it.
|cffccccccNote: The mature filter dictionary is pre-populated with a list of words from a crowd sourced repository. You can edit the words using the option below.|r]],
MATURE_FILTER_STRENGTH = "Mature filter strength",
MATURE_FILTER_STRENGTH_TT = [[Set the strength of the mature filter.
|cffcccccc1 is weak (10 bad words required to flag), 10 is strong (only 1 bad word required to flag).|r]],
MATURE_FILTER_ADD_TO_WHITELIST = "Add this profile to the |cffffffffmature white list|r",
MATURE_FILTER_ADD_TO_WHITELIST_TT = "Add this profile to the |cffffffffmature white list|r and reveal the mature content found inside.",
MATURE_FILTER_ADD_TO_WHITELIST_OPTION = "Add to the |cffffffffmature white list|r",
MATURE_FILTER_ADD_TO_WHITELIST_TEXT = [[Confirm that you want to add %s to the |cffffffffmature white list|r.
The content of their profiles will no longer be hidden.]],
MATURE_FILTER_REMOVE_FROM_WHITELIST = "Remove this profile from the |cffffffffmature white list|r",
MATURE_FILTER_REMOVE_FROM_WHITELIST_TT = "Remove this profile from the |cffffffffmature white list|r and hide again the mature content found inside.",
MATURE_FILTER_REMOVE_FROM_WHITELIST_OPTION = "Remove from the |cffffffffmature white list|r",
MATURE_FILTER_REMOVE_FROM_WHITELIST_TEXT = [[Confirm that you want to remove %s from the |cffffffffmature white list|r.
The content of their profiles will be hidden again.]],
MATURE_FILTER_FLAG_PLAYER = "Flag as mature",
MATURE_FILTER_FLAG_PLAYER_TT = "Flag this profile has containing mature content. The profile content will be hidden.",
MATURE_FILTER_FLAG_PLAYER_OPTION = "Flag as mature",
MATURE_FILTER_FLAG_PLAYER_TEXT = [[Confirm that you want to flag %s's profile as containing mature content. This profile content will be hidden.
|cffffff00Optional:|r Indicate the offensive words you found in this profile (separated by a space character) to add them to the filter.]],
MATURE_FILTER_EDIT_DICTIONARY = "Edit custom dictionary",
MATURE_FILTER_EDIT_DICTIONARY_TT = "Edit the custom dictionary used to filter mature profiles.",
MATURE_FILTER_EDIT_DICTIONARY_BUTTON = "Edit",
MATURE_FILTER_EDIT_DICTIONARY_TITLE = "Custom dictionary editor",
MATURE_FILTER_EDIT_DICTIONARY_ADD_BUTTON = "Add",
MATURE_FILTER_EDIT_DICTIONARY_ADD_TEXT = "Add a new word to the dictionary",
MATURE_FILTER_EDIT_DICTIONARY_EDIT_WORD = [[Edit this word]],
MATURE_FILTER_EDIT_DICTIONARY_DELETE_WORD = [[Delete the word from the custom dictionary]],
MATURE_FILTER_EDIT_DICTIONARY_RESET_TITLE = "Reset dictionary",
MATURE_FILTER_EDIT_DICTIONARY_RESET_BUTTON = "Reset",
MATURE_FILTER_EDIT_DICTIONARY_RESET_WARNING = "Are you sure you want to reset the dictionary? This will empty the dictionary and fill it with the default words provided for your current language (if available).",
MATURE_FILTER_WARNING_TITLE = "Mature content",
MATURE_FILTER_WARNING_CONTINUE = "Continue",
MATURE_FILTER_WARNING_GO_BACK = "Go back",
MATURE_FILTER_WARNING_TEXT = [[You have Total RP 3's mature content filtering system enabled.
This profile has been flagged as containing mature content.
Are you sure you want to view this profile?]],
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- DICE ROLL
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
DICE_ROLL = "%s Rolled |cffff9900%sx d%s|r and got |cff00ff00%s|r.",
DICE_TOTAL = "%s Total of |cff00ff00%s|r for the roll.",
DICE_HELP = "A dice roll or rolls separated by spaces, example: 1d6, 2d12 3d20 ...",
DICE_ROLL_T = "%s %s rolled |cffff9900%sx d%s|r and got |cff00ff00%s|r.",
DICE_TOTAL_T = "%s %s got a total of |cff00ff00%s|r for the roll.",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- NPC Speeches
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
NPC_TALK_TITLE = "NPC speeches",
NPC_TALK_NAME = "NPC name",
NPC_TALK_NAME_TT = [[You can use standard chat tags like %t to insert your target's name or %f to insert your focus' name.
You can also leave this field empty to create emotes without an NPC name at the start.
Putting your companion name in [brackets] will allow color and icon customization.
]],
NPC_TALK_MESSAGE = "Message",
NPC_TALK_CHANNEL = "Channel: ",
NPC_TALK_SEND = "Send",
NPC_TALK_ERROR_EMPTY_MESSAGE = "The message cannot be empty.",
NPC_TALK_COMMAND_HELP = "Open the NPC speeches frame.",
NPC_TALK_BUTTON_TT = "Open the NPC speeches frame allowing you to do NPC speeches or emotes.",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- MISC
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
PATTERN_ERROR = "Error in pattern.",
PATTERN_ERROR_TAG = "Error in pattern : unclosed text tag.",
SCRIPT_UNKNOWN_EFFECT = "Script error, unknown FX",
SCRIPT_ERROR = "Error in script.",
NEW_VERSION_TITLE = "New update available",
NEW_VERSION = "|cff00ff00A new version of Total RP 3 (v %s) is available.\n\n|cffffff00We strongly encourage you to stay up-to-date.|r\n\nThis message will only appear once per session and can be disabled in the settings (General settings => Miscellaneous).",
BROADCAST_PASSWORD = "|cffff0000There is a password placed on the broadcast channel (%s).\n|cffff9900TRP3 won't try again to connect to it but you won't be able to use some features like players location on map.\n|cff00ff00You can disable or change the broadcast channel in the TRP3 general settings.",
BROADCAST_PASSWORDED = "|cffff0000The user |r%s|cffff0000 just placed a password on the broadcast channel (%s).\n|cffff9900If you don't know that password, you won't be able to use features like players location on the map.",
BROADCAST_10 = "|cffff9900You already are in 10 channels. TRP3 won't try again to connect to the broadcast channel but you won't be able to use some features like players location on map.",
BROADCAST_OFFLINE_DISABLED = "Broadcast has been disabled.",
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- CHAT LINKS
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
CL_REQUESTING_DATA = "Requesting link data from %s.",
CL_EXPIRED = "This link has expired.",
CL_PLAYER_PROFILE = "Player profile",
CL_OPEN_PROFILE = "Open profile",
CL_IMPORT_PROFILE = "Import profile",
CL_GLANCE = "At-first-glance",
CL_IMPORT_GLANCE = "Import at-first-glance",
CL_COMPANION_PROFILE = "Companion profile",
CL_IMPORT_COMPANION = "Import companion profile",
CL_OPEN_COMPANION = "Open companion profile",
CL_VERSIONS_DIFFER = [[This link has been generated using a different version of Total RP 3.
Importing content coming from a different version may cause issues in case of incompatibilities. Do you want to proceed anyway?]],
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- COMMANDS
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
COM_LIST = "List of commands:",
COM_SWITCH_USAGE = "Usage: |cff00ff00/trp3 switch main|r to switch main frame or |cff00ff00/trp3 switch toolbar|r to switch the toolbar.",
COM_RESET_USAGE = "Usage: |cff00ff00/trp3 reset frames|r to reset all frames positions.",
COM_RESET_RESET = "The frames positions have been reset!",
COM_STASH_DATA = [[|cffff0000Are you sure you want to stash away your Total RP 3 data?|r
Your profiles, companions profiles and settings will be temporarily stashed away and your UI will reload with empty data, as if your installation of Total RP 3 was brand new.
|cff00ff00Use the same command again (|cff999999/trp3 stash|cff00ff00) to restore your data.|r]],
OPTION_ENABLED_TOAST = "Option enabled",
OPTION_DISABLED_TOAST = "Option disabled",
MORE_MODULES_2 = [[{h2:c}Optional modules{/h2}
{h3}Total RP 3: Extended{/h3}
|cff9999ffTotal RP 3: Extended|r add the possibility to create new content in WoW: campaigns with quests and dialogues, items, documents (books, signs, contracts, …) and many more!
{link*http://extended.totalrp3.info*Download on Curse.com}
{h3}Kui |cff9966ffNameplates|r module{/h3}
The Kui |cff9966ffNameplates|r module adds several Total RP 3 customizations to the KuiNameplates add-on:
• See the full RP name of a character on their nameplate, instead of their default name, colored like in their tooltip.
• See customized pets names.
• Hide the names of players without an RP profile!
{link*http://mods.curse.com/addons/wow/total-rp-3-kuinameplates-module*Download on Curse.com}.
]],
THANK_YOU_1 = [[{h1:c}Total RP 3{/h1}
{p:c}{col:6eff51}Version %s (build %s){/col}{/p}
{p:c}{link*http://totalrp3.info*TotalRP3.info} — {twitter*TotalRP3*@TotalRP3} {/p}
{p:c}{link*http://discord.totalrp3.info*Join us on Discord}{/p}
{h2}{icon:INV_Eng_gizmo1:20} Created by{/h2}
%AUTHORS$s
{h2}{icon:QUEST_KHADGAR:20} The Rest of the Team{/h2}
%CONTRIBUTORS$s
{h2}{icon:THUMBUP:20} Acknowledgements{/h2}
{col:ffffff}Ellypse's {/col}{link*https://www.patreon.com/ellypse*Patreon}{col:ffffff} supporters:{/col}
%s
{col:ffffff}Logo and minimap button icon:{/col}
- {link*https://ebonfeathers.tumblr.com/*EbonFeather@Tumblr}
{col:ffffff}Our pre-alpha QA team:{/col}
%TESTERS$s
{col:ffffff}Thanks to all our friends for their support all these years:{/col}
- For Telkos: Kharess, Kathryl, Marud, Solona, Stretcher, Lisma...
- For Ellypse: The guilds Eglise du Saint Gamon, Maison Celwë'Belore, Mercenaires Atal'ai, and more particularly Erzan, Elenna, Caleb, Siana and Adaeria
{col:ffffff}For helping us creating the Total RP guild on Kirin Tor (EU):{/col}
%GUILD_MEMBERS$s
{col:ffffff}Thanks to Horionne for sending us the magazine Gamer Culte Online #14 with an article about Total RP.{/col}]],
MO_ADDON_NOT_INSTALLED = "The %s add-on is not installed, custom Total RP 3 integration disabled.",
MO_TOOLTIP_CUSTOMIZATIONS_DESCRIPTION = "Add custom compatibility for the %s add-on, so that your tooltip preferences are applied to Total RP 3's tooltips.",
MO_CHAT_CUSTOMIZATIONS_DESCRIPTION = "Add custom compatibility for the %s add-on, so that chat messages and player names are modified by Total RP 3 in that add-on.",
CO_TOOLTIP_PREFERRED_OOC_INDICATOR = "Preferred OOC indicator",
CO_TOOLTIP_PREFERRED_OOC_INDICATOR_TEXT = "Text: ",
CO_TOOLTIP_PREFERRED_OOC_INDICATOR_ICON = "Icon: ",
PR_EXPORT_WARNING_TITLE = "Warning:",
PR_EXPORT_WARNING_WINDOWS = [[Please note that some advanced text editing tools like Microsoft Word or Discord will reformat special characters like quotes, altering the content of the data.
If you are planning on copying the text below inside a document, please use simpler text editing tools that do not automatically change characters, like Notepad.]],
PR_EXPORT_WARNING_MAC = [[Please note that some advanced text editing tools like Text Edit or Discord will reformat special characters like quotes, altering the content of the data.
If you are planning on copying the text below inside a document, please use simpler text editing tools that do not automatically change characters (in Text Edit go to Format > Make Plain Text before pasting)]],
BW_COLOR_PRESET_TITLE = "Color presets",
BW_COLOR_PRESET_SAVE = "Save current color",
BW_COLOR_PRESET_RENAME = "Rename %s preset",
BW_COLOR_PRESET_DELETE = "Delete %s preset",
CL_DIRECTORY_PLAYER_PROFILE = "Directory player profile",
CL_DIRECTORY_COMPANION_PROFILE = "Directory companion profile",
CL_CONTENT_SIZE = [[Size: %s]],
THANK_YOU_ROLE_AUTHOR = "Author",
THANK_YOU_ROLE_CONTRIBUTOR = "Contributor",
THANK_YOU_ROLE_COMMUNITY_MANAGER = "Community Manager",
THANK_YOU_ROLE_TESTER = "QA Team",
THANK_YOU_ROLE_GUILD_MEMBER = "Guild Member",
CL_SENT_BY = "Link sent by: %s",
CL_TYPE = "TRP3 Link type: %s",
CL_MAKE_IMPORTABLE_SIMPLER = [[Make this %s link importable?
People will be able to copy and use the content of the link.]],
CL_MAKE_IMPORTABLE_BUTTON_TEXT = "Make importable",
CL_MAKE_NON_IMPORTABLE = "Viewable only",
CL_TOOLTIP = "Create a chat link",
CL_DOWNLOADING = "Downloading: %0.1f %%",
CL_SENDING_COMMAND = "Sending command…",
CO_UI_RELOAD_WARNING = [[The interface needs to be reloaded in order for the changes to be applied.
Would you like to reload the interface now?]],
CL_TOOLTIP = "Create a chat link",
TT_ELVUI_SKIN = "ElvUI skin",
TT_ELVUI_SKIN_ENABLE_TOOLTIPS = "Skin tooltips",
TT_ELVUI_SKIN_ENABLE_TARGET_FRAME = "Skin target frame",
MAP_BUTTON_SUBTITLE_80_DISABLED = "Scans temporarily unavailable due to 8.0 changes",
---@language Markdown
WHATS_NEW_20 = [[
# Changelog for version 1.4
|cffff8000This version requires Battle for Azeroth, patch 8.0.1.|r
## Add-on communications improvement
Total RP 3 implements the next version of the Mary Sue Protocol. This improved version bring the following improvements:
- |cffff8000Profiles are now logged on Blizzard's servers|r when sent to other players. This enables Blizzard to view the content of RP profiles in cases of abuse, such as harassment or doxxing. This means you should now treat the contents of your profile as you would public chat in /say, for example. |cffaaaaaa(Goldshire)|r.
- |cffff8000Cross server and cross faction support with Battle.net friends:|r the add-on can now use Battle.net to transfer data between two Battle.net friends, even if they are from a server that is not connected to yours or if they are from the opposite faction.
- |cffff8000Improved performance:|r thanks to looser limitations and newer compression algorithms, all data transfer should be faster (sometimes up to 8 times faster for big Extended campaigns).
|cffaaaaaaIt was not possible to make this newer protocol backward compatible with older versions (which will not work with patch 8.0 anyway) and cross add-on communications will only work between people using this newer version of the protocol.|r
## New logos
{img:Interface\AddOns\totalRP3\resources\trp3logo.blp:128:64}
Total RP 3 has a new, original logo, to replace the modified game logo (which we obviously did not own). It was commissioned to [EbonFeathers@Tumblr](https://ebonfeathers.tumblr.com/). Using the theme of classic D&D, this logo showcases that role-playing is all about picking the role you want to play.
A new minimap icon also replaces the older one and showcases a classic D&D die.
{img:Interface\AddOns\totalRP3\resources\trp3minimap.tga:25:25}
## Added
- Added a new settings category called Advanced. Changing the settings on this page may break your experience of the add-on, so a warning message will be displayed to warn you when you modify something, and a reset button will allow you to reset all advanced settings to their default values. Amongst these new advanced settings you can find the settings for the broadcast channel, NPC talk prefix, disable the option to remember the last language used between session, and more.
- Resources added to the browsers: 369 musics, 1698 icons and 178 images from the Battle for Azeroth expansion.
## Modified
- You can no longer set your residence marker inside an instanced zone.
- Fixed several issues related to patch 8.0.1.
## Fixed
- Added support for other add-ons through the Mary Sue Protocol when using `/trp3 open [playerName]` command.
## Removed
- Map features have been temporarily disabled while we keep working on fixing them for Battle for Azeroth. The entire world map UI has been re-implemented by Blizzard and it requires more or less a complete rewrite of our map code.
- We have disabled the button to show the residence location of players from the profile page while we are re-implementing the map features for patch 8.0.
- The system to upvote or downvote profiles have been removed. The system was confusing to new players and was incorrectly used by groups of people to downvote targeted people.
]],
WHATS_NEW_20_1 = [[
# Changelog for version 1.4.1
Fixed a rare Lua error that could randomly happen on login.
]],
WHATS_NEW_20_2 = [[
# Changelog for version 1.4.2
## Fixed
- Fixed another rare Lua error that could randomly happen on login (with the `getPlayerCompleteName()` function) - [Issue #159](https://github.com/Ellypse/Total-RP-3/issues/159)
]],
---@language Markdown
WHATS_NEW_20_3= [[
# Changelog for version 1.4.3
## Fixed
- Fixed an issue brought by yesterday's hotfixes that would prevent Battle.net communications from working.
- Fixed an issue where un-selecting profiles in the directory would not actually deselect them, and improved consistency when purging profiles while having some profiles already selected - [Issue #160](https://github.com/Ellypse/Total-RP-3/issues/160)
- Fixed an issue introduced with the 8.0.1 pre-patch preventing mount profiles from being displayed properly in the tooltips and on the target frame - [Issue #164](https://github.com/Ellypse/Total-RP-3/issues/164)
- Fixed a layout in the profiles UI that would prevent the Additional information parts from being rendered properly - [Issue #162](https://github.com/Ellypse/Total-RP-3/issues/162)
- Fixed an issue that would render the chat links tooltip lines in a random order, instead of the correct one.
- Fixed an issue that would render some profile informations (Additional information, Personality traits) in a random order, instead of the correct one.
]],
---@language Markdown
WHATS_NEW_20_4= [[
# Changelog for version 1.4.4
## Fixed
- Fixed XML errors from libraries when using both Storyline and Total RP 3.
- Fixed Lua error when targeting companions.
- The trial account flag is now also displayed in your own tooltip.
- Names are now correctly class colored in chat for non-customized names - [Issue #175](https://github.com/Ellypse/Total-RP-3/issues/175)
- Fixed Total RP 3's logo missing a die, and improved the minimap icon, including a transparent version for databroker add-ons.
- The target frame is now refreshed when you summon and dismiss your own mount.
- Fixed an issue when sorting the directory by last time seen when that information was missing.
- Unknown profiles are now hidden from the directory and cleaned on launch.
## Added
- Added a limitation option for line breaks in the "currently" tooltip fields (default to 5 line breaks).
## Modified
- Sorting by names in the directory now ignore quotes around names.
- The "This realm only" filter for the directory now takes into account connected realms.
]],
CL_TOOLTIP = "Create a chat link",
CO_ADVANCED_SETTINGS = "Advanced settings",
CO_ADVANCED_SETTINGS_MENU_NAME = "Advanced",
CO_ADVANCED_SETTINGS_POPUP = [[You have just modified an advanced setting.
Please keep in mind that changing those settings might alter your experience with the add-on and could prevent some features from working correctly. Use at your own risk.]],
CO_ADVANCED_SETTINGS_RESET = "Reset advanced settings",
CO_ADVANCED_SETTINGS_RESET_TT = "Reset all the advanced settings to their default value. Use this if you have issues after modifying the settings.",
CO_GENERAL_BROADCAST_C = "Broadcast channel name",
CO_ADVANCED_BROADCAST = "Add-on communications",
CO_ADVANCED_LANGUAGES = "Languages",
CO_ADVANCED_LANGUAGES_REMEMBER = "Remember last language used",
CO_ADVANCED_LANGUAGES_REMEMBER_TT = "Total RP 3 will remember what language you were using before logging off and automatically select this language back on next login.",
CO_TOOLTIP_CURRENT_LINES = "Max \"Currently\" line breaks",
REG_PLAYERS = "Players",
CO_LOCATION_DISABLE_WAR_MODE = "Disable location when in War Mode",
CO_LOCATION_DISABLE_WAR_MODE_TT = "You will not respond to location requests from other players when you have War Mode enabled and you are outside of a |cff69CCF0Sanctuary|r.\n\nThis option is particularly useful to avoid abuses of the location system to track you.",
CO_LOCATION_SHOW_DIFFERENT_WAR_MODES = "Show players in different War Mode",
CO_LOCATION_SHOW_DIFFERENT_WAR_MODES_TT = "Players who are currently in the zone but have a different War Mode status than you will be shown on the map, with a lower opacity and a special icon in the tooltip.",
REG_LOCATION_DIFFERENT_WAR_MODE = "Different War Mode",
CO_ADVANCED_BROADCAST_CHANNEL_ALWAYS_LAST = "Keep broadcast channel last",
CO_ADVANCED_BROADCAST_CHANNEL_ALWAYS_LAST_TT = "This option will make sure that the broadcast channel is always the last channel in your channels list.",
REG_PLAYER_ABOUT_MUSIC_THEME = "Character music theme",
REG_PLAYER_EDIT_MUSIC_THEME = "Music theme",
LANG_CHANGE_CAUSED_REVERT_TO_DEFAULT = "Current spoken language reverted to default %s because you no longer know the previously selected language %s.",
CO_ADVANCED_LANGUAGE_WORKAROUND = "Enable workaround against language reset",
CO_ADVANCED_LANGUAGE_WORKAROUND_TT = "Since patch 8.0.1 the game will reset the selected language to the default language for your faction during every loading screen. This workaround makes sure to restore the selected language after a loading screen.",
REG_REPORT_PLAYER_PROFILE = "Report profile to |cff449fe0Blizzard|r",
REG_REPORT_PLAYER_PROFILE_TT = [[You can report a profile that infringe on Blizzard's Terms of Service. This can include harassment, doxxing, hate speech, obscene content or other form of disruptive content.
|cffff0000Please note that this option is NOT to report RP profiles of disputable quality or griefing. Abuses of this feature are punishable!]],
REG_REPORT_PLAYER_TEMPLATE = "This player is using the RP profile addon %s to share content against the Terms of Service.",
REG_REPORT_PLAYER_TEMPLATE_DATE = "The addon data was transferred through logged addon messages on %s.",
REG_REPORT_PLAYER_TEMPLATE_TRIAL_ACCOUNT = "This player was on a trial account.",
REG_REPORT_PLAYER_OPEN_URL = [[You can only report players directly from within the game if you can target them (use TRP3's target frame button).
If you wish to report %s's profile and you cannot target them you will need to open a ticket with Blizzard's support using the link bellow.]],
---@language Markdown
WHATS_NEW_22 = [[
# Changelog version 1.5.0
## Re-implemented map scans feature
You can now once again scan for Total RP 3 users on the world map.
- Added support for War Mode. Players that are not in the same War Mode as you will not appear on the world map by default.
- In the Location settings (Register settings tab) you can enable the option to show people who are in a different War Mode, they will appear greyed out and semi-transparent on the world map, and will be grouped separately when displayed in the tooltip.
- You can opt in to not be visible to other players while you are in War Mode.
- Map scans now differentiate between levels of a same zone (like Dalaran), and setting your home to a specific level of map will now correctly show on that level when users click on the home button on your profile.
Please note: Only players with Total RP 3 version 1.5.0 and above will show up. Total RP 3: Extended's scans will be updated to working with this new system.
## Profile reporting
Since patch 8.0.1 you are able to report profiles that violates Blizzard's Terms of Services by opening a support ticket.
- Following Blizzard's guidance, you can now report a player who have a profile that goes against the [Code of Conduct](https://battle.net/support/article/42673) via a new button on Total RP 3's target frame. A standard game report window will open pre-filled with information about the player you are reporting.
- Since it is not technically possible to report a player you cannot target, we have added a button to the profile page when opening a profile that opens up a [link to a Blizzard support page on how to report add-on text](https://battle.net/support/help/product/wow/197/1501/solution).
## Added
- Added a workaround against a current game bug that will always reset the language currently selected after a loading screen. You can disable this workaround in cases of issues in the advanced settings.
- Added a workaround to make sure Total RP 3's broadcast channel (xtensionxtooltip2) is always at the bottom of the channel list. This should fix issues where it would be the first channel and move all others channels you have joined down in the list. You can disable this workaround in cases of issues in the advanced settings.
]],
------------------------------------------------------------------------------------------------
--- PLACE LOCALIZATION NOT ALREADY UPLOADED TO CURSEFORGE HERE
--- THEN MOVE IT UP ONCE IMPORTED
------------------------------------------------------------------------------------------------
};
-- Use Ellyb to generate the Localization system
TRP3_API.loc = Ellyb.Localization(TRP3_API.loc);
-- Register all locales into the localization system
-- Note the localeContent is filled by the publishing script using CurseForge's localization tool when packaging builds
-- See https://wow.curseforge.com/projects/total-rp-3/localization
---@type table<string, string>
local localeContent = {};
--@localization(locale="enUS", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("enUS", "English", localeContent);
--@localization(locale="deDE", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("deDE", "Deutsch", localeContent);
--@localization(locale="frFR", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("frFR", "Français", localeContent);
--@localization(locale="esES", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("esES", "Español", localeContent);
--@localization(locale="esMX", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("esMX", "Español (Latin American)", localeContent);
--@localization(locale="itIT", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("itIT", "Italian", localeContent);
--@localization(locale="koKR", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("koKR", "Korean", localeContent);
--@localization(locale="ptBR", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("ptBR", "Brazilian Portuguese", localeContent);
--@localization(locale="ruRU", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("ruRU", "Russian", localeContent);
--@localization(locale="zhCN", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("zhCN", "Simplified Chinese", localeContent);
--@localization(locale="zhTW", format="lua_table", table-name="localeContent", handle-unlocalized="ignore")@
TRP3_API.loc:RegisterNewLocale("zhTW", "Traditional Chinese", localeContent);
local Locale = {};
TRP3_API.Locale = Locale;
--- Initialize a locale for the addon.
function Locale.init()
-- Register config
TRP3_API.configuration.registerConfigKey("AddonLocale", GetLocale());
TRP3_API.loc:SetCurrentLocale(TRP3_API.configuration.getValue("AddonLocale"), true);
end
-- Backward compatibility with older use of Total RP 3's Locale module
Locale.getText = Ellyb.Functions.bind(TRP3_API.loc.GetText, TRP3_API.loc);
---generateFrenchDeterminerForText
---@param text string @ The text containing the |2 tag to replace with the appropriate determiner
---@param followingText string @ The text that immediately follows the determiner, used to know which determiner to use
---@return string generatedText @ Text where the |2 tag is replaced by the correct determiner for what's following
function Locale.generateFrenchDeterminerForText(text, followingText)
-- This function only applies to the French locale. If we were to call it on a different locale, do nothing
if not IS_FRENCH_LOCALE then return text end
if Ellyb.Strings.isAVowel(Ellyb.Strings.getFirstLetter(followingText)) then
text = text:gsub("|2", "de");
else
text = text:gsub("|2 ", "d'");
end
return text;
end
---Generate two string with the two possible French determiners "de" and "d'" using a string that contains the |2 tag
---used by Blizzard for this purpose.
---@param text string @ A text with a |2 tag inside it
---@return string, string textWithDe, textWidthD @ Two string, one with "de" and one with "d'"
function Locale.generateFrenchDeterminersVersions(text)
return Locale.generateFrenchDeterminerForText(text, "a"), Locale.generateFrenchDeterminerForText(text, "b");
end
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-- Companion utils
--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
local function isColorBlindModeEnabled()
return ENABLE_COLORBLIND_MODE == "1";
end
local REPLACE_PATTERN, NAME_PATTERN = "%%s", "([%%S%%-%%P]+)";
local PET_OWNER_MATCHING_LINES = {
UNITNAME_TITLE_CHARM,
UNITNAME_TITLE_CREATION,
UNITNAME_TITLE_GUARDIAN,
UNITNAME_TITLE_MINION,
UNITNAME_TITLE_PET,
}
local BATTLE_PET_OWNER_MATCHING_LINES = {
UNITNAME_TITLE_COMPANION,
}
-- Insert the search pattern inside the strings
for key, pattern in pairs(PET_OWNER_MATCHING_LINES) do
PET_OWNER_MATCHING_LINES[key] = pattern:gsub(REPLACE_PATTERN, NAME_PATTERN);
end
for key, pattern in pairs(BATTLE_PET_OWNER_MATCHING_LINES) do
BATTLE_PET_OWNER_MATCHING_LINES[key] = pattern:gsub(REPLACE_PATTERN, NAME_PATTERN);
end
-- French is a funny language.
-- The possessive attribute "de" changes to "d'" if the owner's name starts with a vowel.
-- Blizzard is using the |2 tag in the global strings (like UNITNAME_TITLE_PET) for this special replacement.
-- We need to replace that tag in the strings with the two versions possible if the user is using the French client.
if IS_FRENCH_LOCALE then
local newPetOwnerMatchingLines = {};
for _, pattern in pairs(PET_OWNER_MATCHING_LINES) do
local textWithDe, textWithD = Locale.generateFrenchDeterminersVersions(pattern);
tinsert(newPetOwnerMatchingLines, textWithDe);
tinsert(newPetOwnerMatchingLines, textWithD);
end
PET_OWNER_MATCHING_LINES = newPetOwnerMatchingLines;
local newBattlePetOwnerMatchingLines = {};
for _, pattern in pairs(BATTLE_PET_OWNER_MATCHING_LINES) do
local textWithDe, textWithD = Locale.generateFrenchDeterminersVersions(pattern);
tinsert(newBattlePetOwnerMatchingLines, textWithDe);
tinsert(newBattlePetOwnerMatchingLines, textWithD);
end
BATTLE_PET_OWNER_MATCHING_LINES = newBattlePetOwnerMatchingLines;
end
---@param tooltipLines string[] @ A table corresponding to the tooltip lines in which we should search for a pet owner
---@return string|void owner @ The name of the owner, if found
function Locale.findPetOwner(tooltipLines)
local masterLine = isColorBlindModeEnabled() and tooltipLines[3] or tooltipLines[2];
if masterLine then
local master;
for _, matchingPattern in pairs(PET_OWNER_MATCHING_LINES) do
master = masterLine:match(matchingPattern);
if master then break end
end
return master;
end
end
function Locale.findBattlePetOwner(lines)
local masterLine = isColorBlindModeEnabled() and lines[4] or lines[3];
if masterLine then
local master;
for _, matchingPattern in pairs(BATTLE_PET_OWNER_MATCHING_LINES) do
master = masterLine:match(matchingPattern);
if master then
-- Hack for "Mascotte de niveau xxx" in French ...
if IS_FRENCH_LOCALE and master:find("%s") then
master = nil;
else
break
end
end
end
return master;
end
end
-- Backward compatibility locale = Locale
TRP3_API.locale = TRP3_API.Locale;
--- Backward compatibility layer for third party mods
--- This will create a proxy meta table that third party mods can use
--- to insert new localization keys inside a locale.
function TRP3_API.locale.getLocale(localeID)
---@type Locale
local locale = TRP3_API.loc:GetLocale(localeID);
TRP3_API.utils.log.log([[DEPRECATED USAGE OF TRP3_API.locale.getLocale(localeID) TO ADD LOCALIZATION KEYS.
Please use TRP3_API.loc:GetLocale(localeID) and locale:AddText(key, value) to insert localization strings.]], TRP3_API.utils.log.level.WARNING)
return {
localeContent = setmetatable({}, {
__newindex = function(_, key, value)
locale:AddText(key, value);
end,
})
}
end
|
local db
addEventHandler("onResourceStart",resourceRoot,function()
db = dbConnect("sqlite","global/sql.db")
if db then
outputDebugString("Database baglantisi basarili. - nox")
end
end)
function getConnection()
return db
end |
local player = Game.GetLocalPlayer()
while true do
local pos = (player:GetViewWorldRotation() * Vector3.FORWARD)
CoreDebug.DrawLine(player:GetWorldPosition(), player:GetWorldPosition()+(pos*100))
Task.Wait()
end |
require('nn')
require('image')
local utils = {}
function utils.center2Corners(g, delta, N, dim_size)
local p1 = math.floor(g + (1 - N/ 2 - 0.5) * delta)
p1 = math.max(math.min(p1, dim_size), 1)
local p2 = math.ceil(g + (N / 2 - 0.5) * delta)
p2 = math.max(math.min(p2, dim_size), 1)
return p1, p2
end
function utils.toRGB(batch)
local output = torch.Tensor():typeAs(batch):resizeAs(batch)
output:copy(batch)
if #batch:size() <= 3 then
-- Batch Input
if #batch:size() > 2 then
local batch_size, height, width = table.unpack(batch:size():totable())
output = output:resize(batch_size, 1, height, width):repeatTensor(1, 3, 1, 1)
else
local height, width = table.unpack(batch:size():totable())
output = output:resize(1, height, width):repeatTensor(3, 1, 1)
end
end
return output
end
function utils.storeSeq(folder, img_seq)
for t = 1, #img_seq do
local img_name = paths.concat(folder, 'seq' .. t .. '.png')
image.save(img_name, img_seq[t])
end
end
function utils.drawReadSeq(T, N, input, att_params, line_color)
local batch = utils.toRGB(input)
if batch:type() == 'torch.CudaTensor' then
batch = batch:float()
end
local img_seq = {}
for t = 1, T do
img_seq[t] = utils.drawAttentionRect(N, batch, att_params[t], line_color)
end
return img_seq
end
function utils.drawWriteSeq(T, N, input, att_params, line_color)
local img_seq = {}
for t = 1, T do
local batch = utils.toRGB(input[t])
if batch:type() == 'torch.CudaTensor' then
batch = batch:float()
end
img_seq[t] = utils.drawAttentionRect(N, batch, att_params[t], line_color)
end
return img_seq
end
function utils.drawAttentionRect(N, input, att_params, line_color)
local batch_size, _, height, width = table.unpack(input:size():totable())
local output = torch.Tensor():typeAs(input):resizeAs(input)
output:copy(input)
local gx, gy, var, delta = table.unpack(att_params)
local rectOptions = {color = line_color, inplace = true}
for i = 1, batch_size do
local x1, x2 = utils.center2Corners(gx[i]:squeeze(), delta[i]:squeeze(), N, width)
local y1, y2 = utils.center2Corners(gy[i]:squeeze(), delta[i]:squeeze(), N, height)
image.drawRect(output[i], x1, y1, x2, y2, rectOptions)
end
return output
end
return utils
|
local qt = require "qtest"
-- @require fsu
--local fsu, xrelpathto = qt.magicload "fsu.lua"
local fsu, _fsu = qt.load("fsu.lua", {"xrelpathto"})
local nix, win = fsu.nix, fsu.win
local T = qt.tests
function T.nix_cleanpath()
local function tcp(a,b)
qt._eq(nix.cleanpath(a), b, 2)
end
tcp("a/.", "a")
tcp("/a/.", "/a")
tcp("a/..", ".")
tcp("/a/..", "/")
tcp("a/b/../..", ".")
tcp("/a/b/../..", "/")
tcp("a/../..", "..")
tcp("/a/../..", "/..")
tcp("./b", "b")
tcp("/./b", "/b")
tcp("a/./b", "a/b")
tcp("/a/./b", "/a/b")
tcp("a/./././././././b", "a/b")
tcp("a./b", "a./b")
tcp("a/.b", "a/.b")
tcp("a/..", ".")
tcp("a/b/..", "a")
tcp("../b", "../b")
tcp("a/../b", "b")
tcp("/a/../b", "/b")
tcp("b/..a", "b/..a")
tcp("b../a", "b../a")
tcp("b../..a", "b../..a")
tcp("b../..a", "b../..a")
tcp("/..", "/..")
tcp("a/b/c/d/../../..", "a")
tcp("a/b/c/d/../../e", "a/b/e")
tcp("/a/./../b", "/b")
tcp("./../b", "../b")
tcp("/a/b/./.././c", "/a/c")
tcp("a/.././.", ".")
tcp("a/.../b", "a/.../b")
tcp("../../a", "../../a")
tcp("../../../a", "../../../a")
tcp("a/../../b", "../b")
tcp("c:/..", ".")
end
function T.win_cleanpath()
local function tcp(a,b)
qt._eq(win.cleanpath(a), b, 2)
end
tcp("c:/..", "c:/..")
end
function T.nix_splitpath(p)
local function t(path, dir, file)
qt._eq( {nix.splitpath(path)}, {dir,file}, 2 )
end
t("c:\\a", ".", "c:\\a") -- not Windows
t("c:/a", "c:", "a") -- not Windows
t("/a", "/", "a")
t("/a/", "/", "a")
t("/...", "/", "...")
t("/", "/", ".")
end
function T.win_splitpath(p)
local function t(path, dir, file)
qt._eq( {win.splitpath(path)}, {dir,file}, 2 )
end
t("c:/d/e/f", "c:/d/e", "f")
t("C:\\x\\y\\z", "C:/x/y", "z" )
t("c:\\a", "c:/", "a")
t("\\a\\b", "/a", "b")
t("/a/b", "/a", "b")
t("c:/", "c:/", ".")
end
local function tr(os, a, b, result)
qt._eq(os.resolve(a,b), result, 2)
end
function T.nix_resolve()
tr(nix, "/a", "/a/b", "/a/b")
tr(nix, "/a", "c:/b", "/a/c:/b")
tr(nix, "c:/a", "/b", "/b")
tr(nix, "c:\\a", "/b", "/b")
end
function T.win_resolve()
tr(win, "c:/A", "b", "c:/A/b")
tr(win, "x:/a", "/b", "x:/b")
tr(win, "c:/a", "d:/b", "d:/b")
tr(win, "c:/a/../c", "x", "c:/c/x")
tr(win, "/a", "/b/../c", "/c")
tr(win, "/a/b", "c\\d", "/a/b/c/d")
tr(win, "/", "/c\\d", "/c/d")
end
function T.xrelpath()
local function streq(a,b) return a==b end
local function tt(src, dst, result)
qt._eq(result, _fsu.xrelpathto(src, dst, streq), 2)
qt._eq(result, _fsu.xrelpathto(src.."/", dst, streq), 2)
end
tt( "/a/b", "/a/b/c", "c" )
tt( "/a/b", "/a/b/c/d", "c/d" )
tt( "/a/b", "/a/b", "." )
tt( "/a/b/c", "/a/b", ".." )
tt( "/a/b/c", "/a/", "../.." )
tt( "/a/b", "/", "../.." )
end
function T.nix_relpathto()
local cwd = "/x/y/z"
local function tt(src, dst, result)
qt._eq(result, nix.relpathto(src, dst, cwd), 2)
qt._eq(result, nix.relpathto(src.."/", dst, cwd), 2)
end
-- abs abs (finer-grained cases covered above in xrelpath)
tt( "/a/b", "/a/b/c", "c" )
-- rel rel
tt("a/b", "../c", "../../../c")
tt("../b", "../c", "../c")
tt("b", "../c", "../../c")
-- rel abs
tt("b", "/r", "../../../../r")
-- abs rel
tt("/b", "c", "../x/y/z/c")
-- no CWD
cwd = nil
tt("a/b/c", "a/b/d", "../d")
tt("../b/c", "../b/d", "../d")
tt("/../..", "/../../d", "d")
tt("a", "/a", "/a")
tt("../..", "x", nil)
tt("/../..", "/../d", nil)
tt("/a/b", "x", nil)
end
function T.win_relpathto()
local cwd = "c:/x/y/z"
local function tt(src, dst, result)
qt._eq(result, win.relpathto(src, dst, cwd), 2)
qt._eq(result, win.relpathto(src.."/", dst, cwd), 2)
end
-- dev dev
tt("C:/a", "C:/a/b", "b")
tt("c:/x/y/z/x", "C:/b", "../../../../b")
-- dev nodev
tt("a:/a", "/b", "c:/b")
tt("C:/a", "/b", "../b")
tt("a:/a", "../b", "c:/x/y/b")
-- nodev dev
tt("x", "C:/b", "../../../../b")
tt("../b", "a:/b", "a:/b")
-- nodev nodev
tt("a/b", "../c", "../../../c")
end
return qt.runTests()
|
local zmq = require('zmq');
local core= require('core');
local utils= require('utils');
local timer= require('timer');
local encode = require('msgpack').encode;
local decode = require('msgpack').decode;
local rpc_svr = core.Emitter:extend();
-- linkaddr bind listen addr
-- dispaddr send response addr
function rpc_svr:initialize(linkaddr, dispaddr)
self._sock = zmq.bind_socket(zmq.PULL, linkaddr,
utils.bind(self._onData, self))
self._sendsock = zmq.bind_socket(zmq.PUB, dispaddr);
self._clients = {};
self._links = {};
self._cid_index = 1; --客户端ID记录
self._cnt = 0;
end
-- 请求参数
-- {ctx = {}, p = {}}
-- 其中ctx是保留信息,即请求的上下文
-- p当前调用的参数
-- ctx中的数据可能有
-- cid -- 客户端ID
-- cmd -- 调用的方法名称
-- rid -- 请求的上下文ID
function rpc_svr:_onData(d)
local cname = d[1];
local req = decode(d[2]);
self._cnt = self._cnt + 1;
if math.fmod(self._cnt, 1000) == 0 then
p(os.date(), 'call count->', self._cnt);
end
-- p(os.date(), 'call->', cname, req);
local ctx = req.ctx;
local p = req.p;
local fn = self[ctx.cmd];
local res= nil;
if fn then
local e = {
ctx = ctx;
cname = cname;
};
setfenv(fn, setmetatable(e, {__index = _G}));
local ret = {fn(self, unpack(p))};
ctx.ret = 0;
res = {
ctx = ctx;
r = ret;
};
else
ctx.ret = -1;
res = {
ctx = ctx;
};
end
if res then
self._sendsock:send({cname, encode(res)});
end
end
--连接请求
--cbaddr 回拨地址
function rpc_svr:_sys_connect(cbaddr)
p(os.date(), 'sys_connect->', cbaddr);
local cid = string.format('c_%d', self._cid_index);
self._cid_index = self._cid_index + 1;
ctx.cid = cid;
return cid;
end
exports.server = rpc_svr;
------------------ client class --------------------
local rpc_client = core.Emitter:extend();
function rpc_client:initialize(svraddr, resaddr, cname)
self._sock = zmq.socket(zmq.PUSH);
self._resock = zmq.socket(zmq.SUB);
self._resock:on('data', utils.bind(self._onData, self))
self._resock:connect(resaddr);
self._resock:setopt(zmq.SUBSCRIBE, cname)
self._sock:connect(svraddr);
self._name = cname;
self._rid = 1;
self._callback = {};
self:call('_sys_connect', function(cid)
self._cid = cid;
self:emit('connected')
end)
end
function rpc_client:close()
self._sock:close();
self._resock:close();
end
function rpc_client:_onData(d)
local cname = d[1];
if cname ~= self._name then
p(os.date(), 'is not my data->', cname);
end
local res = decode(d[2]);
local ctx = res.ctx;
local r = res.r;
--p('return ->', cname, res);
if ctx.ret == 0 then --suc
local f = self._callback[ctx.rid or 0];
if f then
f(unpack(r));
end
end
end
--远程调用
function rpc_client:call(name, ...)
local n = select('#', ...);
local arg = {...};
if type(arg[n]) == 'function' then
self._callback[self._rid] = arg[n];
table.remove(arg, n);
end
local ctx =
{
cmd = name;
rid = self._rid;
};
self._rid = self._rid + 1;
--self._sock:send({self._name, encode({ctx = ctx, p = arg})}, zmq.DONTWAIT);
self._sock:send({self._name, encode({ctx = ctx, p = arg})});
end
exports.client = rpc_client;
|
SCREEN_RESOLUTION="640x960"
SCREEN_COLOR_BITS=32
count=1
round=1
saveStars=0
protecter=0
-- 0 default, 1 blood first, 2 force first
mode=0
REGION_SIZE=2
-- purple,red,yellow,blue,green
status={};
FUZZY_NUM=98
ENHANCE_FUZZY_NUM=60
BLOOD_BTN=0xE26554
BLOOD_BTN_X=130
BLOOD_BTN_Y=260
HARD_BTN=0xE86549
HARD_BTN_X=130
HARD_BTN_Y=480
NORMAL_BTN=0xE36554
NORMAL_BTN_X=130
NORMAL_BTN_Y=700
ENHANCE_X=350
ENHANCE_Y_3=300
ENHANCE_Y_15=480
ENHANCE_Y_30=660
ENHANCE_WINDOW_X=520
ENHANCE_WINDOW_Y1=240
ENHANCE_WINDOW_Y2=360
ENHANCE_WINDOW_1=0xB08844
ENHANCE_WINDOW_2=0xE1D29D
PURPLE=0xDE5EA0
RED=0xD65733
YELLOW=0xFAD460
BLUE=0x2E9DA4
GREEN=0x25A944
TIANJI_COLOR=0x18637B
TIANJI_X=234
TIANJI_Y=258
XIAOLI_COLOR=0xE0C1A4
XIAOLI_X=234
XIAOLI_Y=258
XIAOLI_HARD_COLOR=0xE2C4A5
XIAOLI_HARD_X=234
XIAOLI_HARD_Y=480
-- HARD
YIHUA_COLOR=0x6B402B
YIHUA_X=234
YIHUA_Y=480
SHANGGUAN_COLOR=0x1D0B02
SHANGGUAN_X=234
SHANGGUAN_Y=258
SHANGGUAN_HARD_COLOR=0x1C0C04
SHANGGUAN_HARD_X=234
SHANGGUAN_HARD_Y=480
-- HARD
SHIWANG_COLOR=0x633832
SHIWANG_X=234
SHIWANG_Y=480
BOUNS_BTN=0XFFFC77
BOUNS_BTN_X=235
BOUNS_BTN_Y=512
BOUNS_BTN_CHECKER=0XD90F09
BOUNS_BTN_CHECKER_X=333
BOUNS_BTN_CHECKER_Y=512
BOUNS_BTN0_X=200
BOUNS_BTN1_Y=100
BOUNS_BTN2_Y=300
BOUNS_BTN3_Y=500
BOUNS_BTN4_Y=700
BOUNS_BTN5_Y=900
CONTINUE_BTN=0x1D8671
CONTINUE_BTN_X=32
CONTINUE_BTN_Y=600
REWARD_BTN=0x208478
REWARD_BTN_X=90
REWARD_BTN_Y=480
SKIP_BTN=0x1A7570
SKIP_BTN_X=32
SKIP_BTN_Y=480
FUWEN_BTN=0X74776B
FUWEN_BTN_X=200
FUWEN_BTN_Y=480
function run()
mSleep(3000);
loadSavedStatus();
while count < 600000 do
if finished() then
break;
end
if round >= STOP_ROUND then
break;
end
fightEvil();
end
end
function getBonus()
mSleep(1000);
click(BOUNS_BTN0_X, BOUNS_BTN1_Y, 0, 0);
mSleep(1000);
click(BOUNS_BTN0_X, BOUNS_BTN2_Y, 0, 0);
mSleep(1000);
click(BOUNS_BTN0_X, BOUNS_BTN3_Y, 0, 0);
mSleep(1000);
click(BOUNS_BTN0_X, BOUNS_BTN4_Y, 0, 0);
mSleep(1000);
click(BOUNS_BTN0_X, BOUNS_BTN5_Y, 0, 0);
end
function gamequit()
appKill('com.koramgame.dhjhchs');
appKill('com.ifun.dhjhcht');
end
function finished()
if clickBtn(FUWEN_BTN, FUWEN_BTN_X, FUWEN_BTN_Y) then
mSleep(200);
end
if findBtn(BOUNS_BTN, BOUNS_BTN_X, BOUNS_BTN_Y) and findBtn(BOUNS_BTN_CHECKER, BOUNS_BTN_CHECKER_X, BOUNS_BTN_CHECKER_Y) then
clickBtn(BOUNS_BTN, BOUNS_BTN_X, BOUNS_BTN_Y);
getBonus();
os.execute("rm " .. PID_NAME);
if CLOSE_GAME == 1 then
gamequit();
end
logStatus(1);
logDebug("finished.");
return true;
end
return false;
end
function loadSavedStatus()
file = io.open(PID_NAME);
if file ~= nil then
-- read data from file
i = 0;
for line in io.lines(PID_NAME) do
status[i] = tonumber(line);
i = i + 1;
end
-- the latest round is not save
-- +1 to revert it
round = status[5] + 1;
else
status[0] = 0;
status[1] = 0;
status[2] = 0;
status[3] = 0;
status[4] = 0;
saveStatus();
end
end
function saveStatus()
file = io.open(PID_NAME, "w");
status[5] = round;
file:write(status[0] .. "\n" .. status[1] .. "\n" .. status[2] .. "\n" .. status[3] .. "\n" .. status[4] .. "\n" .. status[5]);
file:close();
end
function logStatus(force)
if DEBUG == 1 or force == 1 then
logDebug(string.format("P: %s R: %s Y: %s B: %s G: %s on Round: %s saving: %s", status[0], status[1], status[2], status[3], status[4], round, saveStars));
end
end
function log(s)
if DEBUG == 1 then
logDebug(s);
end
end
function fightEvil()
count = count + 1;
click(20, 20, 0, 0);
mSleep(300);
clickBtn(SKIP_BTN, SKIP_BTN_X, SKIP_BTN_Y);
if clickBtn(CONTINUE_BTN, CONTINUE_BTN_X, CONTINUE_BTN_Y) and protecter == 0 then
round = round + 1;
protecter = 1;
end
clickBtn(REWARD_BTN, REWARD_BTN_X, REWARD_BTN_Y);
if round <= BLOOD_ROUND then
clickBloodBtn();
elseif round <= HARD_ROUND then
clickHardBtn();
else
clickNormalBtn();
end
-- enhance window is not open, return
if findBtn(ENHANCE_WINDOW_1, ENHANCE_WINDOW_X, ENHANCE_WINDOW_Y1) == false or findBtn(ENHANCE_WINDOW_2, ENHANCE_WINDOW_X, ENHANCE_WINDOW_Y2) == false then
return;
end
color3, color15, color30 = findEnhanceColor();
if round <= STAR_ROUND then
-- red > purple * 0.7
if round > 200 and status[0] * PURPLE_RED_RATIO_MAX < status[1] then
mode = 1;
if color30 == 'purple' then
click30(color30);
status[0] = status[0] + 30;
return;
end
if color15 == 'purple' then
click15(color15);
status[0] = status[0] + 15;
return;
end
if color30 == 'red' then
click30(color30);
status[1] = status[1] + 30;
return;
end
if color15 == 'red' then
click15(color15);
status[1] = status[1] + 15;
return;
end
elseif round > 200 and status[1] < status[0] * PURPLE_RED_RATIO_MIN then
mode = 2;
if color30 == 'red' then
click30(color30);
status[1] = status[1] + 30;
return;
end
if color15 == 'red' then
click15(color15);
status[1] = status[1] + 15;
return;
end
if color30 == 'purple' then
click30(color30);
status[0] = status[0] + 30;
return;
end
if color15 == 'purple' then
click15(color15);
status[0] = status[0] + 15;
return;
end
else
mode = 0;
if color30 == 'purple' then
click30(color30);
status[0] = status[0] + 30;
return;
end
if color30 == 'red' then
click30(color30);
status[1] = status[1] + 30;
return;
end
if color15 == 'purple' then
click15(color15);
status[0] = status[0] + 15;
return;
end
if color15 == 'red' then
click15(color15);
status[1] = status[1] + 15;
return;
end
end
if status[4] < GREEN_MAX and color30 == 'green' then
click30(color30);
status[4] = status[4] + 30;
return;
end
if status[3] < BLUE_MAX and color30 == 'blue' then
click30(color30);
status[3] = status[3] + 30;
return;
end
if status[2] < YELLOW_MAX and color30 == 'yellow' then
click30(color30);
status[2] = status[2] + 30;
return;
end
if status[4] < GREEN_MAX and color15 == 'green' then
click15(color15);
status[4] = status[4] + 15;
return;
end
if status[3] < BLUE_MAX and color15 == 'blue' then
click15(color15);
status[3] = status[3] + 15;
return;
end
if status[2] < YELLOW_MAX and color15 == 'yellow' then
click15(color15);
status[2] = status[2] + 15;
return;
end
click3Percent(color3);
return;
else
saveStars = 1;
click3Percent(color3);
return;
end
end
function click30(color)
click(ENHANCE_X, ENHANCE_Y_30, 0, 0);
log(color .. ": 30");
end
function click15(color)
click(ENHANCE_X, ENHANCE_Y_15, 0, 0);
log(color .. ": 15");
end
function click3(color)
click(ENHANCE_X, ENHANCE_Y_3, 0, 0);
log(color .. ": 3");
end
function click3Percent(color)
click3(color);
if color == 'purple' then
status[0] = status[0] + 3;
return;
elseif color == 'red' then
status[1] = status[1] + 3;
return;
elseif color == 'yellow' then
status[2] = status[2] + 3;
return;
elseif color == 'blue' then
status[3] = status[3] + 3;
return;
elseif color == 'green' then
status[4] = status[4] + 3;
return;
else
-- skip
end
end
function findEnhanceColor()
r,g,b = getColorRGB(ENHANCE_X, ENHANCE_Y_3);
color3 = getColorHuman(r, g, b);
r,g,b = getColorRGB(ENHANCE_X, ENHANCE_Y_15);
color15 = getColorHuman(r, g, b);
r,g,b = getColorRGB(ENHANCE_X, ENHANCE_Y_30);
color30 = getColorHuman(r, g, b);
log("find colors: " .. color3 .. " " .. color15 .. " " .. color30);
return color3, color15, color30;
end
function getColorHuman(r, g, b)
-- ff0000
if r > 127 and g < 127 and b < 127 then
return 'red';
end
-- 00ff00
if r < 127 and g > 127 and b < 127 then
return 'green';
end
-- 0000ff
-- exception of g
if r < 127 and g > 127 and b > 127 then
return 'blue';
end
-- ffff00
if r > 127 and g > 127 and b < 127 then
return 'yellow';
end
-- ff00ff
if r > 127 and g < 127 and b > 127 then
return 'purple';
end
return rgb2Hex(r, g, b);
end
function hex(n)
if n > 255 then
n = 255;
end
return lpad(string.format("%x", n));
end
function rgb2Hex(r, g, b)
return hex(r) .. hex(g) .. hex(b);
end
function lpad(r)
if string.len(r) == 1 then
r = "0" .. r;
end
return r;
end
function findBtn(color, x, y)
local x1, y1, x2, y2;
x1 = x - REGION_SIZE;
x2 = x + REGION_SIZE;
y1 = y - REGION_SIZE;
y2 = y + REGION_SIZE;
x, y = findColorInRegionFuzzy(color, FUZZY_NUM, x1, y1, x2, y2);
if x ~= -1 and y ~= -1 then
return true;
end
return false;
end
function clickBtn(color, x, y)
if findBtn(color, x, y) then
click(x, y, 0, 0);
mSleep(100);
return true;
end
return false;
end
function click(x, y, dx, dy)
if x ~= -1 and y ~= -1 then
touchDown(0, (x + dx), (y + dy));
touchUp(0);
return true;
end
return false;
end
function clickRound(color, x, y)
if clickBtn(color, x, y) then
saveStatus();
protecter = 0;
logStatus();
end
return true;
end
function clickBloodBtn()
if round > BLOOD_SKIP_ROUND and isInBloodIgnoreList() then
clickHardBtn();
else
clickRound(BLOOD_BTN, BLOOD_BTN_X, BLOOD_BTN_Y);
end
end
function clickHardBtn()
local x, y;
if round > HARD_SKIP_ROUND and isInHardIgnoreList() then
clickNormalBtn()
else
clickRound(HARD_BTN, HARD_BTN_X, HARD_BTN_Y)
end
end
function clickNormalBtn()
clickRound(NORMAL_BTN, NORMAL_BTN_X, NORMAL_BTN_Y)
end
function isInBloodIgnoreList()
-- 天机
if findBtn(TIANJI_COLOR, TIANJI_X, TIANJI_Y) then
return true;
end
-- 上官
if findBtn(SHANGGUAN_COLOR, SHANGGUAN_X, SHANGGUAN_Y) then
return true;
end
-- 小李
if findBtn(XIAOLI_COLOR, XIAOLI_X, XIAOLI_Y) then
return true;
end
end
function isInHardIgnoreList()
-- 移花
if findBtn(YIHUA_COLOR, YIHUA_X, YIHUA_Y) then
return true;
end
-- 狮王
if findBtn(SHIWANG_COLOR, SHIWANG_X, SHIWANG_Y) then
return true;
end
-- 小李
if findBtn(XIAOLI_HARD_COLOR, XIAOLI_HARD_X, XIAOLI_HARD_Y) then
return true;
end
-- 上官
if findBtn(SHANGGUAN_HARD_COLOR, SHANGGUAN_HARD_X, SHANGGUAN_HARD_Y) then
return true;
end
end
|
ITEM.name = "SVT 40"
ITEM.description= "A semi-automatic battle rifle that fires 7.62x54mm rounds."
ITEM.longdesc = "The SVT-40 is a Soviet semi-automatic battle rifle.\nThe SVT-40 saw widespread service during and after World War II.\nAfter the war, SVTs were mostly withdrawn from service and refurbished in arsenals, then stored.\nMany of these storages have since then been found, and black market operatives have ensured a steady influx of SVT-40's to the zone.\n\nAmmo: 7.62x54mm\nMagazine Capacity: 10"
ITEM.model = ("models/weapons/w_svt40.mdl")
ITEM.class = "cw_svt40"
ITEM.weaponCategory = "primary"
ITEM.price = 33000
ITEM.width = 6
ITEM.height = 1
ITEM.validAttachments = {"md_pso1","md_pbs1"}
ITEM.bulletweight = 0.022
ITEM.unloadedweight = 3.85
ITEM.repair_PartsComplexity = 3
ITEM.repair_PartsRarity = 2
function ITEM:GetWeight()
return self.unloadedweight + (self.bulletweight * self:GetData("ammo", 0))
end
ITEM.iconCam = {
pos = Vector(3, 200, 1.5),
ang = Angle(0, 270, 0),
fov = 12.7,
}
ITEM.pacData = {
[1] = {
["children"] = {
[1] = {
["children"] = {
[1] = {
["children"] = {
},
["self"] = {
["Angles"] = Angle(0, 0, 180),
["Position"] = Vector(3.44, -5.078, -2.039),
["Model"] = "models/weapons/w_svt40.mdl",
["ClassName"] = "model",
["EditorExpand"] = true,
["UniqueID"] = "8824425421",
["Bone"] = "spine 2",
["Name"] = "svt40",
},
},
},
["self"] = {
["AffectChildrenOnly"] = true,
["ClassName"] = "event",
["UniqueID"] = "1062346542",
["Event"] = "weapon_class",
["EditorExpand"] = true,
["Name"] = "weapon class find simple\"@@1\"",
["Arguments"] = "cw_svt40@@0",
},
},
},
["self"] = {
["ClassName"] = "group",
["UniqueID"] = "8123985183",
["EditorExpand"] = true,
},
},
} |
local Witch = {}
function Witch.set(colorscheme, variant)
Witch.setColorscheme(colorscheme, variant)
Witch.setLualineTheme(colorscheme, variant)
end
function Witch.mappings()
return {
['ayu'] = {
name = "ayu",
variants = { "mirage", "dark", "light" },
mode = "global_variable",
variable = "ayucolor"
},
['nightfox'] = {
name = "nightfox",
variants = { "nightfox", "nordfox", "palefox" },
mode = "lua_load",
variable = "fox"
},
['github-theme'] = {
name = "github-theme",
variants = { "dark", "dimmed", "light" },
mode = "lua_setup_only",
variable = "themeStyle"
},
['tokyonight'] = {
name = "tokyonight",
variants = { "night", "storm", "day" },
mode = "global_variable",
variable = "tokyonight_style"
}
}
end
function Witch.LualineMappings()
return {
['ayu'] = {
mode = "per_variant",
variants = {
["mirage"] = "ayu_mirage",
["light"] = "ayu_light",
["dark"] = "ayu_dark"
}
},
["github"] = {
mode = "only_one",
name = "github"
},
["nightfox"] = {
mode = "only_one",
name = "github"
},
["tokyonight"] = {
mode = "only_one",
name = "tokyonight"
}
}
end
function Witch.setLualineTheme(theme, variant)
local lualineExists, lualine = pcall(require, 'lualine')
if not lualineExists then
return
end
local themeFound = false
for configuredTheme, _val in pairs(Witch.LualineMappings()) do
if configuredTheme == theme then
themeFound = true
end
end
if not themeFound then
print("Lualine theme not found")
return nil
end
local lualineConfig = Witch.LualineMappings()[theme]
local lualineTheme
if (lualineConfig["mode"] == "only_one") then
lualineTheme = lualineConfig["name"]
elseif (lualineConfig["mode"] == "per_variant") then
lualineTheme = lualineConfig["variants"][variant]
end
lualine.setup { options = { theme = lualineTheme }}
end
function Witch.setColorscheme(theme, variant)
-- check theme is supported
local themeFound = false
for configuredTheme, _val in pairs(Witch.mappings()) do
if configuredTheme == theme then
themeFound = true
end
end
if not themeFound then
print("Theme not found")
return nil
end
-- check variant is supported
local variantFound = false
for _i, configuredVariant in ipairs(Witch.mappings()[theme]["variants"]) do
if configuredVariant == variant then
variantFound = true
end
end
if not variantFound then
print("Variant not found")
return nil
end
-- set colorscheme via lua
local colorDefinition = Witch.mappings()[theme]
for i, themeVariant in ipairs(colorDefinition['variants']) do
if (variant == themeVariant) then
if (colorDefinition['mode'] == "lua_setup_only") then
local themeVariable = colorDefinition['variable']
local loadedTheme = require(theme)
local options = {}
options[themeVariable] = variant
loadedTheme.setup(options)
elseif (colorDefinition['mode'] == "lua_load") then
local themeVariable = colorDefinition['variable']
require(theme).load(variant)
elseif (colorDefinition['mode'] == "global_variable") then
local variableName = colorDefinition["variable"]
vim.cmd('let ' .. variableName .. ' = "' .. variant .. '"')
vim.cmd('colorscheme ' .. theme)
end
end
end
end
return Witch
|
local Factory = require("support.factory")
Factory.define("entity", function(attributes)
return CBaseEntity(attributes)
end)
|
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
function ENT:Initialize()
self.Entity:SetMoveType(MOVETYPE_NONE)
self.Entity:SetSolid(SOLID_NONE)
self:DrawShadow(false);
//self:SetModel("models/props_wasteland/cargo_container01.mdl");
end
|
local playsession = {
{"mewmew", {1811616}},
{"nizzy", {583223}},
{"TheHarlander", {107153}},
{"JustBull", {1016282}},
{"Default_Sound", {1181988}},
{"EPO666", {927632}},
{"Digzol", {2423953}},
{"saneman", {159436}},
{"Namelesshunter", {9722}},
{"Grillzange", {1138697}},
{"Mikeymouse1", {205311}},
{"nankinanki", {402381}},
{"Klausausderkasse", {9203}},
{"HT1014", {370544}},
{"oloklir", {741586}},
{"Collider", {2556}},
{"betrayb3", {635304}},
{"Gerkiz", {137911}},
{"acoolpool", {102997}},
{"MaricTheTrader", {2517}},
{"skykittena", {1077655}},
{"Kissthisangel", {154231}},
{"gryph", {3136}},
{"joe9go", {311254}},
{"Nivek3k", {730305}},
{"badbeachboy", {35302}},
{"SLQ", {901887}},
{"OwocBomba", {59565}},
{"D0pex", {148142}},
{"14nickel", {166748}},
{"MasterCrafters", {50970}},
{"Bootloops", {106190}},
{"lucavios", {2774}},
{"doombanana", {38518}},
{"skub", {1434823}},
{"pechvogel", {6617}},
{"zwaluwstaart", {9980}},
{"Spartas72300", {81902}},
{"Julian1109", {172035}},
{"eizooz", {25258}},
{"kkai57", {194240}},
{"JC1223", {1886443}},
{"Itai795", {517782}},
{"Loner", {9430}},
{"Lisvane", {170248}},
{"adieclay", {381391}},
{"Graav", {96781}},
{"redlabel", {380883}},
{"-slug-", {13868}},
{"DevilR", {26025}},
{"20spike12", {688485}},
{"sahwn", {12917}},
{"ralphmace", {6005}},
{"hsxu", {357963}},
{"flipje2go", {363201}},
{"Kyte", {16071}},
{"totallyaswome", {9552}},
{"Pentbot", {19201}},
{"ETK03", {602750}},
{"Apolomir", {1110178}},
{"TheThane", {25520}},
{"settan", {401397}},
{"tommysilva80008", {333281}},
{"mars_precision", {135300}},
{"phischphood", {269941}},
{"Tatarr", {235047}},
{"OECEMESO", {480516}},
{"umtallguy", {821560}},
{"mario31274", {22789}},
{"Miime", {3921}},
{"skudd3r", {38774}},
{"skace", {361104}},
{"Inoram", {32203}},
{"bico", {437654}},
{"Lithidoria", {3882}},
{"sobitome", {405978}},
{"XaLpHa1989", {1028106}},
{"Monki", {276373}},
{"SuddenDeathMP", {693475}},
{"CHRISGOTGAME", {19987}},
{"BlazingFlame15", {83204}},
{"GuidoCram", {269200}},
{"raskl", {74379}},
{"StormFalcon", {200788}},
{"TomahawkCarioca", {15172}},
{"Morgan3rd", {1045689}},
{"robocol", {4157}},
{"Biker", {3933}},
{"Nick_Nitro", {10246}},
{"ichmo", {101008}},
{"DarkOrgelord", {243613}},
{"Mullacs", {5239}},
{"DuZa", {3906}},
{"Greifenstein", {7568}},
{"Progman", {4851}},
{"Cheeseftw", {9973}},
{"EsendeXenoN", {12921}},
{"PogomanD", {136148}},
{"CommanderFrog", {19168}},
{"pickles28", {5348}},
{"169p", {4633}},
{"KatanaKiwi", {34482}},
{"Bryce940", {436751}},
{"Gnabergasher", {523563}},
{"Ffin", {4803}},
{"oerbeke", {2845}},
{"TheCheckerChr", {17861}},
{"Mynt", {47387}},
{"ivanirucho", {170984}},
{"ViCticus", {266534}},
{"Kevin_Ar18", {458217}},
{"cateyez215", {4133}},
{"Unrealrules", {4718}},
{"uruburei1", {1515}},
{"mahury", {95098}},
{"matthew1206", {43072}},
{"RichardMNixon", {1107160}},
{"Matain", {201011}},
{"Rogamer123", {76707}},
{"xamxl", {185220}},
{"Dr.Flizzle", {19583}},
{"brandon1311", {79240}},
{"ultrajer", {175680}},
{"Paypul", {89942}},
{"Aronak", {179016}},
{"Dunes", {4427}},
{"BlueRock", {24197}},
{"Jaceknfs", {1182325}},
{"jessi_gaming", {3495}},
{"AiltonSilvaSC", {6953}},
{"riflex91", {17905}},
{"roadkill2k", {5471}},
{"muchbetter321", {327815}},
{"EigenMan", {11015}},
{"Kno", {1481611}},
{"papszi", {4893}},
{"gfire5103", {3720}},
{"thederpyloco", {61811}},
{"Maloy12", {600046}},
{"FIREBUNNIE", {49554}},
{"Rhyhe", {24645}},
{"mmort97", {527715}},
{"tokastar", {6335}},
{"2117882862", {10568}},
{"arsindex", {10588}},
{"jimmy1235", {167898}},
{"CrazyCrabEater", {17093}},
{"IamTzu", {751002}},
{"Thex2001", {6136}},
{"ponderer1", {690948}},
{"Factorio401", {13165}},
{"redkyleb", {9690}},
{"Hurley93", {17634}},
{"edensg", {217390}},
{"cpenguinred", {21501}},
{"Wildthing1942", {675864}},
{"IsThisNameTakenAlready", {801248}},
{"Tolip", {327117}},
{"roosterbrewster", {129545}},
{"firstandlast", {94500}},
{"spinxt", {10974}},
{"chubbins", {596127}},
{"kkkpm2580", {1850}},
{"Silver_Eagle7", {6991}},
{"LycostA", {5776}},
{"Kiza", {132265}},
{"jack9761", {51821}},
{"nateShafer", {3505}},
{"Wildpants", {11613}},
{"Giatros", {77917}},
{"Hurrock", {69066}},
{"Achskelmos", {446611}},
{"ManuelG", {17021}},
{"Drastien", {156208}},
{"megamega", {13737}},
{"zw780", {4777}},
{"ghastly_figure", {56506}},
{"urss2", {451931}},
{"coucounoir", {54872}},
{"snoetje", {5966}},
{"beranabus", {7595}},
{"vedolv", {4065}},
{"L75", {153982}},
{"nik12111", {2249}},
{"hubi123123", {3551}},
{"holdfastt1172", {7716}},
{"Tommy17", {2511}}
}
return playsession |
function draw_quad(p,tex,w,h,tra,is_map)
tra=tra or -1
is_map=is_map or false
local u1=(tex%16)*8
local v1=(tex//16)*8
local u2=(tex%16)*8+(w*8)
local v2=(tex//16)*8+(h*8)
textri( p.x1,p.y1,p.x2,p.y2,p.x3,p.y3,
u1, v1, u2, v1, u2, v2,
use_map, tra)
textri( p.x1,p.y1,p.x3,p.y3,p.x4,p.y4,
u1, v1, u2, v2, u1, v2,
use_map, tra)
end
function quad(_x1,_y1,_x2,_y2,_x3,_y3,_x4,_y4)
local p={ x1=_x1,y1=_y1,
x2=_x2,y2=_y2,
x3=_x3,y3=_y3,
x4=_x4,y4=_y4}
return p
end
function tr_skew(t,_xsk,_ysk)
t.xsk=_xsk
t.ysk=_ysk
end
function tr_ang(t,a,_deg)
if (_deg==nil)then
t.ang=a
else t.ang=math.rad(a) end
end
function tr_sc(t,_xsc,_ysc)
t.xsc=_xsc
t.ysc=_ysc
end
function tr_pers(t,_xpers,_ypers)
t.xpers=_xpers
t.ypers=_ypers
end
function tr_pos(t,_x,_y)
t.x=_x
t.y=_y
end
function spr_tbl(sp,x,y,w,h,tcol,tbl)
local ang=tbl.ang or 0
local xpers=tbl.xpers or 1
local ypers=tbl.ypers or 1
local xsc=tbl.xsc or 1
local ysc=tbl.ysc or 1
local xskew=tbl.xsk or 0
local yskew=tbl.ysk or 0
local _x=tbl.x or 0
local _y=tbl.y or 0
x=x+_x
y=y+_y
x=math.floor(x)
y=math.floor(y)
local sw=w*xsc
local sh=h*xsc
local s = math.sin(ang)
local c = math.cos(ang)
local _x1=math.floor(-(w*(sw//2)*8)/2)
local _y1=math.floor(-(h*(sh//2)*8)/2)
local _x2=math.floor((w*(sw//2)*8)/2)
local _y2=math.floor((h*(sh//2)*8)/2)
local x1=(_x1*c-_y1*s)+x-xskew
local y1=(_x1*s+_y1*c)+y-yskew
local x2=(_x2*c-_y1*s)+x-xskew
local y2=(_x2*s+_y1*c)+y+yskew
local x3=(_x2*c-_y2*s)+x+xskew
local y3=(_x2*s+_y2*c)+y+yskew
local x4=(_x1*c-_y2*s)+x+xskew
local y4=(_x1*s+_y2*c)+y-yskew
local p=quad(x1,y1,x2,y2,x3,y3,x4,y4)
draw_quad(p,sp,w,h,tc)
end |
local mod = get_mod("SpawnTweaks")
mod.invis_mut = {}
mod.invis_mut.invis_update = function()
if not mod:get(mod.SETTING_NAMES.INVISIBLE_TEAMMATES_MUTATOR) then
return
end
local reverse = mod:get(mod.SETTING_NAMES.INVISIBLE_TEAMMATES_MUTATOR_REVERSE)
local hide_distance_sq = mod:get(mod.SETTING_NAMES.INVISIBLE_TEAMMATES_MUTATOR_DISTANCE)^2
if Managers.state.network and Managers.player and Managers.player:local_player() then
local local_player_unit = Managers.player:local_player().player_unit
local position_player = nil
if local_player_unit then
position_player = Unit.world_position(local_player_unit, 0)
end
for _, player in pairs( Managers.player:human_and_bot_players() ) do
local player_unit = player.player_unit
if player_unit and player_unit ~= local_player_unit then
local scale = 1
if not local_player_unit or not mod:is_enabled() then
scale = 1
else
local position = Unit.world_position(player_unit, 0)
if position and position_player then
local dist_sq = Vector3.distance_squared(position, position_player)
if dist_sq > hide_distance_sq then
scale = reverse and 1 or 0
else
scale = reverse and 0 or 1
end
end
end
local new_scale_vector = Vector3(scale, scale, scale)
if not Vector3.equal(Unit.local_scale(player_unit, 0), new_scale_vector) then
Unit.set_local_scale(player_unit, 0, new_scale_vector)
end
end
end
end
end
mod.dispatcher:on("onModUpdate",
function()
mod.invis_mut.invis_update()
end)
|
--- 模块功能:lcddemo
-- @module lcd
-- @author Dozingfiretruck
-- @release 2021.01.25
-- LuaTools需要PROJECT和VERSION这两个信息
PROJECT = "lcddemo"
VERSION = "1.0.0"
log.info("main", PROJECT, VERSION)
-- sys库是标配
_G.sys = require("sys")
--[[
-- LCD接法示例, 以Air101开发板的SPI0为例
LCD管脚 Air101管脚
GND GND
VCC 3.3V
SCL (PB02/SPI0_SCK)
SDA (PB05/SPI0_MOSI)
RES (PB03/GPIO19)
DC (PB01/GPIO17)
CS (PB04/GPIO20)
BL (PB00/GPIO16)
提示:
1. 只使用SPI的时钟线(SCK)和数据输出线(MOSI), 其他均为GPIO脚
2. 数据输入(MISO)和片选(CS), 虽然是SPI, 但已复用为GPIO, 并非固定,是可以自由修改成其他脚
3. 因为Air101/Air103只有一个SPI控制器,若使用多个SPI设备, 那么RES/CS请选用非SPI功能脚
4. BL可以不接的, 若使用Air10x屏幕扩展板,对准排针插上即可
]]
--添加硬狗防止程序卡死
if wdt then
wdt.init(15000)--初始化watchdog设置为15s
sys.timerLoopStart(wdt.feed, 10000)--10s喂一次狗
end
-- v0006及以后版本可用pin方式, 请升级到最新固件 https://gitee.com/openLuat/LuatOS/releases
spi_lcd = spi.deviceSetup(0,pin.PB04,0,0,8,20*1000*1000,spi.MSB,1,1)
-- log.info("lcd.init",
-- lcd.init("gc9a01",{port = "device",pin_dc = pin.PB01, pin_pwr = pin.PB00,pin_rst = pin.PB03,direction = 0,w = 240,h = 320,xoffset = 0,yoffset = 0},spi_lcd))
-- log.info("lcd.init",
-- lcd.init("st7789",{port = "device",pin_dc = pin.PB01, pin_pwr = pin.PB00,pin_rst = pin.PB03,direction = 0,w = 240,h = 240,xoffset = 0,yoffset = 0},spi_lcd))
-- log.info("lcd.init",
-- lcd.init("st7789",{port = "device",pin_dc = pin.PB01, pin_pwr = pin.PB00,pin_rst = pin.PB03,direction = 3,w = 240,h = 240,xoffset = 80,yoffset = 0},spi_lcd))
-- log.info("lcd.init",
-- lcd.init("st7789",{port = "device",pin_dc = pin.PB01, pin_pwr = pin.PB00,pin_rst = pin.PB03,direction = 3,w = 320,h = 240,xoffset = 0,yoffset = 0},spi_lcd))
-- log.info("lcd.init",
-- lcd.init("st7735",{port = "device",pin_dc = pin.PB01, pin_pwr = pin.PB00,pin_rst = pin.PB03,direction = 0,w = 128,h = 160,xoffset = 2,yoffset = 1},spi_lcd))
-- log.info("lcd.init",
-- lcd.init("st7735v",{port = "device",pin_dc = pin.PB01, pin_pwr = pin.PB00,pin_rst = pin.PB03,direction = 1,w = 160,h = 80,xoffset = 0,yoffset = 24},spi_lcd))
log.info("lcd.init",
lcd.init("st7735s",{port = "device",pin_dc = pin.PB01, pin_pwr = pin.PB00,pin_rst = pin.PB03,direction = 2,w = 160,h = 80,xoffset = 1,yoffset = 26},spi_lcd))
sys.taskInit(function()
sys.wait(1000)
-- API 文档 https://wiki.luatos.com/api/lcd.html
log.info("lcd.drawLine", lcd.drawLine(20,20,150,20,0x001F))
log.info("lcd.drawRectangle", lcd.drawRectangle(20,40,120,70,0xF800))
log.info("lcd.drawCircle", lcd.drawCircle(50,50,20,0x0CE0))
-- while 1 do
-- sys.wait(500)
-- end
end)
-- 用户代码已结束---------------------------------------------
-- 结尾总是这一句
sys.run()
-- sys.run()之后后面不要加任何语句!!!!!
|
allowCountdown = false;
function onCreate()
setPropertyFromClass('GameOverSubstate', 'characterName', 'Majinbf'); --Character json file for the death animation
setPropertyFromClass('GameOverSubstate', 'deathSoundName', 'fnf_loss_sfx'); --put in mods/sounds/
setPropertyFromClass('GameOverSubstate', 'loopSoundName', ''); --put in mods/music/
setPropertyFromClass('GameOverSubstate', 'endSoundName', 'gameOverEnd'); --put in mods/music/
precacheImage('black');
precacheImage('StartScreens/CircleMajin');
precacheImage('StartScreens/TextMajin');
makeLuaSprite('black', 'black', 0, 0);
addLuaSprite('black', true);
makeLuaSprite('circle', 'StartScreens/CircleMajin', 1280, 0);
addLuaSprite('circle', true);
makeLuaSprite('text', 'StartScreens/TextMajin', -1280, 0);
addLuaSprite('text', true);
setObjectCamera('black', 'hud');
setObjectCamera('circle', 'hud');
setObjectCamera('text', 'hud');
startTime = 0.3;
runTimer('flyin', startTime);
runTimer('fadeout', startTime+2);
runTimer('beginsong', startTime+0.6);
end
function onTimerCompleted(tag, loops, loopsLeft)
if tag == 'flyin' then
doTweenX('circlefly', 'circle', 0, 1, 'linear');
doTweenX('textfly', 'text', 0, 1, 'linear');
end
if tag == 'fadeout' then
doTweenAlpha('fadeblack', 'black', 0, 2, 'sineOut');
doTweenAlpha('fadecircle', 'circle', 0, 2, 'sineOut');
doTweenAlpha('fadetext', 'text', 0, 2, 'sineOut')
end
if tag == 'beginsong' then
allowCountdown = true;
startCountdown();
end
end
function onStartCountdown()
if not allowCountdown then
return Function_Stop;
end
return Function_Continue;
end |
--
-- Copyright (c) 2018 Milos Tosic. All rights reserved.
-- License: http://www.opensource.org/licenses/BSD-2-Clause
--
-- https://github.com/bkaradzic/bimg
local params = { ... }
local BIMG_ROOT = params[1]
local ASTC_CODEC_DIR = BIMG_ROOT .. "3rdparty/astc-codec/"
local BIMG_INCLUDE = {
BIMG_ROOT .. "include",
BIMG_ROOT .. "3rdparty",
BIMG_ROOT .. "3rdparty/iqa/include",
BIMG_ROOT .. "3rdparty/astc-codec",
BIMG_ROOT .. "3rdparty/astc-codec/include",
find3rdPartyProject("bx") .. "include"
}
local BIMG_FILES = {
BIMG_ROOT .. "include/**.h",
BIMG_ROOT .. "src/**.h",
BIMG_ROOT .. "src/**.cpp",
ASTC_CODEC_DIR .. "src/decoder/astc_file.*",
ASTC_CODEC_DIR .. "src/decoder/codec.*",
ASTC_CODEC_DIR .. "src/decoder/endpoint_codec.*",
ASTC_CODEC_DIR .. "src/decoder/footprint.*",
ASTC_CODEC_DIR .. "src/decoder/integer_sequence_codec.*",
ASTC_CODEC_DIR .. "src/decoder/intermediate_astc_block.*",
ASTC_CODEC_DIR .. "src/decoder/logical_astc_block.*",
ASTC_CODEC_DIR .. "src/decoder/partition.*",
ASTC_CODEC_DIR .. "src/decoder/physical_astc_block.*",
ASTC_CODEC_DIR .. "src/decoder/quantization.*",
ASTC_CODEC_DIR .. "src/decoder/weight_infill.*",
}
function projectDependencies_bimg()
return { "bx" }
end
function projectExtraConfig_bimg()
includedirs { BIMG_INCLUDE }
end
function projectAdd_bimg()
addProject_3rdParty_lib("bimg", BIMG_FILES)
end
|
---
-- @author wesen
-- @copyright 2021 wesen <wesen-ac@web.de>
-- @release 0.1
-- @license MIT
--
--
-- Add the path to the AC-ClientOutput classes to the package path list
-- in order to be able to omit this path portion in require() calls
--
package.path = package.path .. ";../src/?.lua"
local ClientOutputFactory = require "AC-ClientOutput.ClientOutputFactory"
local clientOutputFactory = ClientOutputFactory.getInstance()
clientOutputFactory:configure({
fontConfigFileName = "FontDefault",
maximumLineWidth = 600
})
print("ClientOutputString:\n")
local clientOutputString = clientOutputFactory:getClientOutputString(
"hello world 123, 1234567890"
)
for _, row in ipairs(clientOutputString:getOutputRows()) do
print(row)
end
clientOutputFactory:configure({
maximumLineWidth = 2000
})
print("\n\nClientOutputTable:\n")
local clientOutputTable = clientOutputFactory:getClientOutputTable(
{
{
"row 1",
""
},
{
"long different text for test",
"r2f2"
},
{
"r3f1",
"long different text for test"
}
}
)
for _, row in ipairs(clientOutputTable:getOutputRows()) do
print(row)
end
|
a=Map("zerotier",translate("ZeroTier"),translate("Zerotier is an open source, cross-platform and easy to use virtual LAN"))
a:section(SimpleSection).template = "zerotier/zerotier_status"
t=a:section(NamedSection,"sample_config","zerotier")
t.anonymous=true
t.addremove=false
e=t:option(Flag,"enabled",translate("Enable"))
e.default=0
e.rmempty=false
e=t:option(DynamicList,"join",translate('ZeroTier Network ID'))
e.password=true
e.rmempty=false
e=t:option(Flag,"nat",translate("Auto NAT Clients"))
e.default=0
e.rmempty=false
e.description = translate("Allow zerotier clients access your LAN network")
e=t:option(DummyValue,"opennewwindow" ,
translate("<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Zerotier.com\" onclick=\"window.open('https://my.zerotier.com/network')\" />"))
e.description = translate("Create or manage your zerotier network, and auth clients who could access")
e=t:option(Button, "zeroinit", translate("Initialization for network"))
e.rmempty = true
e.inputstyle = "apply"
function e.write(self, section)
luci.util.exec("rm -rf /etc/zerotier /etc/config/zero >/dev/null 2>&1 &")
end
e.description = translate("When you need to join a new network, please initialize first")
return a
|
TULLARANGE_COLORS = {
}
|
local utf8 = require('utf8')
local lg = love.graphics
local concat, len, sub, offset, byte = table.concat, utf8.len, string.sub, utf8.offset, string.byte
local cos, max, min, floor = math.cos, math.max, math.min, math.floor
local intersects = require('src/utils').intersects
local textbox = {}
textbox.__index = textbox
function textbox:new(properties)
local properties = properties or {}
local tb = {
x = properties.x or 0,
y = properties.y or 0,
text = properties.text or 'Hello World!',
font = properties.font or lg:getFont(),
backgroundColor = properties.backgroundColor or {1, 1, 1, 1},
textColor = properties.textColor or {0, 0, 0, 1},
focusBorderColor = properties.focusBorderColor or {0, 0.75, 1, 0.5},
focusBorderWeight = properties.focusBorderWeight or 3,
borderColor = properties.borderColor or {0.25, 0.25, 0.25, 0.25},
borderWeight = properties.borderWeight or 3,
focus = false,
offset = 0,
maxinput = properties.maxinput or 140,
onChange = properties.onChange or function(self) return true end,
target = properties.target or nil,
}
tb.maxCharacterWidth = tb.font:getWidth('W|')
tb.fontHeight = tb.font:getHeight()
tb.width = properties.width or tb.font:getWidth(tb.text) * 2
tb.height = properties.height or tb.fontHeight * 1.4
tb.paddingTop = properties.paddingTop or (tb.height * 0.5) - (tb.fontHeight * 0.5)
tb.paddingLeft = properties.paddingLeft or 12
tb.cursor = {
x = 0,
y = tb.y + tb.paddingTop - 2,
color = properties.cursorColor or {0.25, 0.25, 0.25, 1},
alphaTimer = 0,
position = len(tb.text)
}
tb.textLen = tb.cursor.position
tb.offsetX = tb.x + tb.offset + tb.paddingLeft
return setmetatable(tb, self)
end
function textbox:update(dt)
if (not self.focus) then return end
local cursor = self.cursor
cursor.alphaTimer = cursor.alphaTimer + dt
cursor.color[4] = 1 * cos(7 * cursor.alphaTimer) + 1
if (cursor.position > 0) then
local widthBefore = self.font:getWidth(sub(self.text, 1, cursor.position))
local newSubText
if (self.x > self.offsetX + widthBefore - self.maxCharacterWidth) then
newSubText = sub(self.text, 1, cursor.position - 1)
self.offset = -self.font:getWidth(newSubText) + self.maxCharacterWidth
elseif(self.x + self.width < self.offsetX + widthBefore + self.maxCharacterWidth) then
newSubText = sub(self.text, 1, cursor.position + 1)
self.offset = self.width - self.font:getWidth(newSubText) - self.maxCharacterWidth
end
else
self.offset = 0
end
self.offsetX = self.x + self.paddingLeft + min(self.offset, 0)
cursor.x = self.offsetX + self.font:getWidth(sub(self.text, 1, cursor.position)) - 4
end
function textbox:draw()
lg.push('all')
lg.setColor(self.backgroundColor)
lg.rectangle('fill', self.x, self.y, self.width, self.height)
lg.setFont(self.font)
lg.setColor(self.textColor)
lg.setScissor(self.x, self.y, self.width, self.height)
lg.print(self.text, self.offsetX, self.y + self.paddingTop)
lg.setScissor()
if (self.focus) then
lg.setColor(self.cursor.color)
lg.print('|', self.cursor.x, self.cursor.y)
lg.setColor(self.focusBorderColor)
lg.setLineWidth(self.focusBorderWeight)
lg.rectangle('line', self.x, self.y, self.width, self.height)
else
lg.setColor(self.borderColor)
lg.setLineWidth(self.borderWeight)
lg.rectangle('line', self.x, self.y, self.width, self.height)
end
lg.pop()
end
function textbox:getInput(key)
if (not self.focus) then return end
if (self.textLen >= self.maxinput) then return end
local byteCode = byte(key)
if (byteCode > 127) then return end
local cursor = self.cursor
local textBefore = sub(self.text, 1, cursor.position)
local textAfter = sub(self.text, cursor.position + 1, self.textLen)
self.text = concat{textBefore, key, textAfter}
self.textLen = len(self.text)
cursor.position = cursor.position + 1
self:onChange()
end
local function map(x, min, max, min1, max2)
local percentRange = (x - min) / (max - min)
return (percentRange * (max2 - min1)) + min1
end
function textbox:mousepressed(x, y, button)
if (button ~= 1) then return end
local oldFocus = self.focus
self.focus = intersects(x, y, self)
if (self.focus) then
local minX = self.offsetX
local maxX = self.offsetX + self.font:getWidth(self.text)
local normalize = map(x, minX, maxX, 0, self.textLen)
self.cursor.position = max(min(floor(normalize), self.textLen), 0)
self.cursor.alphaTimer = ((not oldFocus) and 0) or self.cursor.alphaTimer
end
end
function textbox:keypressed(key)
if (not self.focus) then return end
local cursor = self.cursor
if (key == 'backspace') then
local textBefore = sub(self.text, 1, cursor.position)
local textAfter = sub(self.text, cursor.position + 1, self.textLen)
local byteoffset = offset(textBefore, -1)
if (byteoffset) then
textBefore = sub(textBefore, 1, byteoffset - 1)
self.text = concat{textBefore, textAfter}
self.textLen = len(self.text)
cursor.position = cursor.position - 1
end
self:onChange()
end
if (key == 'left') then
cursor.position = max(cursor.position - 1, 0)
elseif(key == 'right') then
cursor.position = min(cursor.position + 1, self.textLen)
end
end
function textbox:getText()
return self.text
end
return textbox |
local new = require "LuaObservable.src.new"
local isObservable = require "LuaObservable.src.is"
local subscribe = require "LuaObservable.src.subscribe"
local function defaultFilter()
return true
end
return function (observable, criteria)
criteria = isFunction(criteria) and criteria or defaultFilter
return new(_, function (next, err, complete, closed)
local beginEmission = false
local seq = 0
local cleanup
cleanup = subscribe(observable,
function (x)
if(not closed()) then
seq = seq + 1
local status, result = pcall(function ()
return criteria(x, seq, observable)
end)
if(status) then
if(not (result or beginEmission)) then
beginEmission = true
end
if(beginEmission) then
next(x)
end
end
else
cleanup()
end
end,
err,
complete
)
end)
end |
-----------------------------------------------------------------------------------------------
-- Client Lua Script for SimpleVolatility
-- Copyright (c) NCsoft. All rights reserved
-----------------------------------------------------------------------------------------------
require "Apollo"
require "GameLib"
require "Window"
require "Unit"
-------------------------------------------------------------------------------------
-- SimpleVolatility Module Definition
-----------------------------------------------------------------------------------------------
local SimpleVolatility = {}
local run = true
-----------------------------------------------------------------------------------------------
-- Initialization
-----------------------------------------------------------------------------------------------
function SimpleVolatility:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
-- initialize variables here
return o
end
function SimpleVolatility:Init()
local bHasConfigureFunction = false
local strConfigureButtonText = ""
local tDependencies = {"ClassResources"}
Apollo.RegisterAddon(self, bHasConfigureFunction, strConfigureButtonText, tDependencies)
end
-----------------------------------------------------------------------------------------------
-- SimpleVolatility OnLoad
-----------------------------------------------------------------------------------------------
function SimpleVolatility:OnLoad()
self:InitializeHooks()
end
function SimpleVolatility:InitializeHooks()
local crb = Apollo.GetAddon("ClassResources")
crb.OnEngineerUpdateTimer = self.OnEngineerUpdateTimer
end
function SimpleVolatility:OnEngineerUpdateTimer()
local unitPlayer = GameLib.GetPlayerUnit()
local bInCombat = unitPlayer:IsInCombat()
local nResourceCurrent = unitPlayer:GetResource(1)
if self.bLastInCombat == bInCombat and self.nLastCurrent == nResourceCurrent then
return
end
self.bLastInCombat = bInCombat
self.nLastCurrent = nResourceCurrent
local nResourceMax = unitPlayer:GetMaxResource(1)
local nResourcePercent = nResourceCurrent / nResourceMax
self.tWindowMap["MainResourceFrame"]:SetSprite("") -- remove background art from Resource Bar
self.tWindowMap["ProgressBar"]:SetMax(nResourceMax)
self.tWindowMap["ProgressBar"]:SetProgress(nResourceCurrent)
self.tWindowMap["ProgressText"]:SetText(String_GetWeaselString(Apollo.GetString("CRB_ProgressSimple"), nResourceCurrent, nResourceMax))
self.tWindowMap["ProgressBacker"]:Show(nResourcePercent > 0) -- change
self.tWindowMap["ProgressBacker"]:SetBGColor("UI_AlphaPercent25")
if nResourcePercent <= .05 then
self.tWindowMap["ProgressBar"]:SetStyleEx("EdgeGlow", false)
self.tWindowMap["LeftCap"]:Show(true)
self.tWindowMap["RightCap"]:Show(false)
elseif nResourcePercent > .05 and nResourcePercent < .95 then
self.tWindowMap["ProgressBar"]:SetStyleEx("EdgeGlow", true)
self.tWindowMap["LeftCap"]:Show(false)
self.tWindowMap["RightCap"]:Show(false)
elseif nResourcePercent >= .95 then
self.tWindowMap["ProgressBar"]:SetStyleEx("EdgeGlow", false)
self.tWindowMap["LeftCap"]:Show(false)
self.tWindowMap["RightCap"]:Show(true)
end
if nResourcePercent > 0 and nResourcePercent < 0.3 then
self.tWindowMap["ProgressText"]:SetTextColor("xkcdNeonBlue")
self.tWindowMap["ProgressBar"]:SetFullSprite("spr_CM_Engineer_BarFill_InCombat1")
self.tWindowMap["ProgressBar"]:SetGlowSprite("spr_CM_Engineer_BarEdgeGlow_InCombat1")
elseif nResourcePercent >= 0.3 and nResourcePercent <= 0.7 then
self.tWindowMap["ProgressText"]:SetTextColor("xkcdNeonYellow")
self.tWindowMap["ProgressBar"]:SetFullSprite("spr_CM_Engineer_BarFill_InCombat2")
self.tWindowMap["ProgressBar"]:SetGlowSprite("spr_CM_Engineer_BarEdgeGlow_InCombat2")
elseif nResourcePercent > 0.7 and nResourcePercent < 1 then
self.tWindowMap["ProgressText"]:SetTextColor("UI_TextHoloBodyHighlight")
self.tWindowMap["ProgressBar"]:SetFullSprite("spr_CM_Engineer_BarFill_InCombat1")
self.tWindowMap["ProgressBar"]:SetGlowSprite("spr_CM_Engineer_BarEdgeGlow_InCombat1")
elseif nResourcePercent == 1 then
self.tWindowMap["ProgressText"]:SetTextColor("xkcdNeonGreen")
self.tWindowMap["ProgressBar"]:SetFullSprite("spr_CM_Engineer_BarFill_InCombat3")
self.tWindowMap["ProgressBar"]:SetGlowSprite("spr_CM_Engineer_BarEdgeGlow_InCombat2")
else
self.tWindowMap["ProgressText"]:SetTextColor("UI_AlphaPercent0")
self.tWindowMap["ProgressBar"]:SetFullSprite("spr_CM_Engineer_BarFill_OutOfCombat")
self.tWindowMap["ProgressBar"]:SetGlowSprite("spr_CM_Engineer_BarEdgeGlow_OutOfCombat")
end
--if GameLib.IsCurrentInnateAbilityActive() then
--self.tWindowMap["ProgressBar"]:SetFullSprite("spr_CM_Engineer_BarFill_InCombat3")
--self.tWindowMap["MainResourceFrame"]:SetSprite("spr_CM_Engineer_Base_Innate")
--elseif bInCombat then
--self.tWindowMap["MainResourceFrame"]:SetSprite("spr_CM_Engineer_Base_InCombat")
--else
--self.tWindowMap["MainResourceFrame"]:SetSprite("spr_CM_Engineer_Base_OutOfCombat")
--end
end
-----------------------------------------------------------------------------------------------
-- SimpleVolatility Instance
-----------------------------------------------------------------------------------------------
local SimpleVolatilityInst = SimpleVolatility:new()
SimpleVolatilityInst:Init()
|
data:extend({
{
type = "item",
name = "storage-tank9",
icon = "__base__/graphics/icons/storage-tank.png",
icon_size = 64,
subgroup = "storage",
order = "b[fluid]-a[storage-tank]",
place_result = "storage-tank9",
stack_size = 50
},
})
|
-- Compiled from https://github.com/dotnet/corefx/blob/master/src/System.Runtime.Numerics/src/System/Numerics/Complex.cs
-- Generated by CSharp.lua Compiler
-- Licensed to the .NET Foundation under one or more agreements.
-- The .NET Foundation licenses this file to you under the MIT license.
-- See the LICENSE file in the project root for more information.
local System = System
local assert = assert
local type = type
local math = math
-- <summary>
-- A complex number z is a number of the form z = x + yi, where x and y
-- are real numbers, and i is the imaginary unit, with the property i2= -1.
-- </summary>
System.define("System.Numerics.Complex", (function ()
local Zero, One, ImaginaryOne, NaN, Infinity, s_sqrtRescaleThreshold, s_asinOverflowThreshold, s_log2,
getReal, getImaginary, getMagnitude, getPhase, FromPolarCoordinates, Negate, Add, Subtract,
Multiply, Divide, Abs, Hypot, Log1P, Conjugate, Reciprocal, op_Equality, EqualsObj, Equals,
GetHashCode, ToString, Sin, Sinh, Asin, Cos, Cosh, Acos,
Tan, Tanh, Atan, Asin_Internal, IsFinite, IsInfinity, IsNaN, Log,
Log10, Exp, Sqrt, Pow, Pow1, Scale, ToComplex,
class, static, __ctor__
static = function (this)
Zero = class(0.0, 0.0)
this.Zero = Zero
One = class(1.0, 0.0)
this.One = One
ImaginaryOne = class(0.0, 1.0)
this.ImaginaryOne = ImaginaryOne
NaN = class(System.Double.NaN, System.Double.NaN)
this.NaN = NaN
Infinity = class(System.Double.PositiveInfinity, System.Double.PositiveInfinity)
this.Infinity = Infinity
s_sqrtRescaleThreshold = 1.79769313486232E+308 --[[Double.MaxValue]] / (math.Sqrt(2.0) + 1.0)
s_asinOverflowThreshold = math.Sqrt(1.79769313486232E+308 --[[Double.MaxValue]]) / 2.0
s_log2 = math.Log(2.0)
end
__ctor__ = function (this, real, imaginary)
if real == nil then
return
end
this.m_real = real
this.m_imaginary = imaginary
end
getReal = function (this)
return this.m_real
end
getImaginary = function (this)
return this.m_imaginary
end
getMagnitude = function (this)
return Abs(this)
end
getPhase = function (this)
return math.Atan2(this.m_imaginary, this.m_real)
end
FromPolarCoordinates = function (magnitude, phase)
return class(magnitude * math.Cos(phase), magnitude * math.Sin(phase))
end
Negate = function (value)
return class(- value.m_real, - value.m_imaginary)
end
Add = function (left, right)
if type(left) == "number" then
return class(left + right.m_real, right.m_imaginary)
elseif type(right) == "number" then
return class(left.m_real + right, left.m_imaginary)
else
return class(left.m_real + right.m_real, left.m_imaginary + right.m_imaginary)
end
end
Subtract = function (left, right)
if type(left) == "number" then
return class(left - right.m_real, - right.m_imaginary)
elseif type(right) == "number" then
return class(left.m_real - right, left.m_imaginary)
else
return class(left.m_real - right.m_real, left.m_imaginary - right.m_imaginary)
end
end
Multiply = function (left, right)
if type(left) == "number" then
if not System.Double.IsFinite(right.m_real) then
if not System.Double.IsFinite(right.m_imaginary) then
return class(System.Double.NaN, System.Double.NaN)
end
return class(left * right.m_real, System.Double.NaN)
end
if not System.Double.IsFinite(right.m_imaginary) then
return class(System.Double.NaN, left * right.m_imaginary)
end
return class(left * right.m_real, left * right.m_imaginary)
elseif type(right) == "number" then
if not System.Double.IsFinite(left.m_real) then
if not System.Double.IsFinite(left.m_imaginary) then
return class(System.Double.NaN, System.Double.NaN)
end
return class(left.m_real * right, System.Double.NaN)
end
if not System.Double.IsFinite(left.m_imaginary) then
return class(System.Double.NaN, left.m_imaginary * right)
end
return class(left.m_real * right, left.m_imaginary * right)
else
-- Multiplication: (a + bi)(c + di) = (ac -bd) + (bc + ad)i
local result_realpart = (left.m_real * right.m_real) - (left.m_imaginary * right.m_imaginary)
local result_imaginarypart = (left.m_imaginary * right.m_real) + (left.m_real * right.m_imaginary)
return class(result_realpart, result_imaginarypart)
end
end
Divide = function (left, right)
if type(left) == "number" then
-- Division : Smith's formula.
local a = left
local c = right.m_real
local d = right.m_imaginary
-- Computing c * c + d * d will overflow even in cases where the actual result of the division does not overflow.
if math.Abs(d) < math.Abs(c) then
local doc = d / c
return class(a / (c + d * doc), (- a * doc) / (c + d * doc))
else
local cod = c / d
return class(a * cod / (d + c * cod), - a / (d + c * cod))
end
elseif type(right) == "number" then
-- IEEE prohibit optimizations which are value changing
-- so we make sure that behaviour for the simplified version exactly match
-- full version.
if right == 0 then
return class(System.Double.NaN, System.Double.NaN)
end
if not System.Double.IsFinite(left.m_real) then
if not System.Double.IsFinite(left.m_imaginary) then
return class(System.Double.NaN, System.Double.NaN)
end
return class(left.m_real / right, System.Double.NaN)
end
if not System.Double.IsFinite(left.m_imaginary) then
return class(System.Double.NaN, left.m_imaginary / right)
end
-- Here the actual optimized version of code.
return class(left.m_real / right, left.m_imaginary / right)
else
-- Division : Smith's formula.
local a = left.m_real
local b = left.m_imaginary
local c = right.m_real
local d = right.m_imaginary
-- Computing c * c + d * d will overflow even in cases where the actual result of the division does not overflow.
if math.Abs(d) < math.Abs(c) then
local doc = d / c
return class((a + b * doc) / (c + d * doc), (b - a * doc) / (c + d * doc))
else
local cod = c / d
return class((b + a * cod) / (d + c * cod), (- a + b * cod) / (d + c * cod))
end
end
end
Abs = function (value)
return Hypot(value.m_real, value.m_imaginary)
end
Hypot = function (a, b)
-- Using
-- sqrt(a^2 + b^2) = |a| * sqrt(1 + (b/a)^2)
-- we can factor out the larger component to dodge overflow even when a * a would overflow.
a = math.Abs(a)
b = math.Abs(b)
local small, large
if a < b then
small = a
large = b
else
small = b
large = a
end
if small == 0.0 then
return large
elseif System.Double.IsPositiveInfinity(large) and not System.Double.IsNaN(small) then
-- The NaN test is necessary so we don't return +inf when small=NaN and large=+inf.
-- NaN in any other place returns NaN without any special handling.
return (System.Double.PositiveInfinity)
else
local ratio = small / large
return (large * math.Sqrt(1.0 + ratio * ratio))
end
end
Log1P = function (x)
-- Compute log(1 + x) without loss of accuracy when x is small.
-- Our only use case so far is for positive values, so this isn't coded to handle negative values.
assert((x >= 0.0) or System.Double.IsNaN(x))
local xp1 = 1.0 + x
if xp1 == 1.0 then
return x
elseif x < 0.75 then
-- This is accurate to within 5 ulp with any floating-point system that uses a guard digit,
-- as proven in Theorem 4 of "What Every Computer Scientist Should Know About Floating-Point
-- Arithmetic" (https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html)
return x * math.Log(xp1) / (xp1 - 1.0)
else
return math.Log(xp1)
end
end
Conjugate = function (value)
-- Conjugate of a Complex number: the conjugate of x+i*y is x-i*y
return class(value.m_real, - value.m_imaginary)
end
Reciprocal = function (value)
-- Reciprocal of a Complex number : the reciprocal of x+i*y is 1/(x+i*y)
if value.m_real == 0 and value.m_imaginary == 0 then
return Zero
end
return One / value
end
op_Equality = function (left, right)
return left.m_real == right.m_real and left.m_imaginary == right.m_imaginary
end
EqualsObj = function (this, obj)
if not (System.is(obj, class)) then
return false
end
return Equals(this, System.cast(class, obj))
end
Equals = function (this, value)
return this.m_real:Equals(value.m_real) and this.m_imaginary:Equals(value.m_imaginary)
end
GetHashCode = function (this)
local n1 = 99999997
local realHash = System.mod(this.m_real:GetHashCode(), n1)
local imaginaryHash = this.m_imaginary:GetHashCode()
local finalHash = System.xor(realHash, imaginaryHash)
return finalHash
end
ToString = function (this)
return ("(%s, %s)"):format(this.m_real, this.m_imaginary)
end
Sin = function (value)
-- We need both sinh and cosh of imaginary part. To avoid multiple calls to Math.Exp with the same value,
-- we compute them both here from a single call to Math.Exp.
local p = math.Exp(value.m_imaginary)
local q = 1.0 / p
local sinh = (p - q) * 0.5
local cosh = (p + q) * 0.5
return class(math.Sin(value.m_real) * cosh, math.Cos(value.m_real) * sinh)
-- There is a known limitation with this algorithm: inputs that cause sinh and cosh to overflow, but for
-- which sin or cos are small enough that sin * cosh or cos * sinh are still representable, nonetheless
-- produce overflow. For example, Sin((0.01, 711.0)) should produce (~3.0E306, PositiveInfinity), but
-- instead produces (PositiveInfinity, PositiveInfinity).
end
Sinh = function (value)
-- Use sinh(z) = -i sin(iz) to compute via sin(z).
local sin = Sin(class(- value.m_imaginary, value.m_real))
return class(sin.m_imaginary, - sin.m_real)
end
Asin = function (value)
local b, bPrime, v
b, bPrime, v = Asin_Internal(math.Abs(getReal(value)), math.Abs(getImaginary(value)))
local u
if bPrime < 0.0 then
u = math.Asin(b)
else
u = math.Atan(bPrime)
end
if getReal(value) < 0.0 then
u = - u
end
if getImaginary(value) < 0.0 then
v = - v
end
return class(u, v)
end
Cos = function (value)
local p = math.Exp(value.m_imaginary)
local q = 1.0 / p
local sinh = (p - q) * 0.5
local cosh = (p + q) * 0.5
return class(math.Cos(value.m_real) * cosh, - math.Sin(value.m_real) * sinh)
end
Cosh = function (value)
-- Use cosh(z) = cos(iz) to compute via cos(z).
return Cos(class(- value.m_imaginary, value.m_real))
end
Acos = function (value)
local b, bPrime, v
b, bPrime, v = Asin_Internal(math.Abs(getReal(value)), math.Abs(getImaginary(value)))
local u
if bPrime < 0.0 then
u = math.Acos(b)
else
u = math.Atan(1.0 / bPrime)
end
if getReal(value) < 0.0 then
u = 3.14159265358979 --[[Math.PI]] - u
end
if getImaginary(value) > 0.0 then
v = - v
end
return class(u, v)
end
Tan = function (value)
-- tan z = sin z / cos z, but to avoid unnecessary repeated trig computations, use
-- tan z = (sin(2x) + i sinh(2y)) / (cos(2x) + cosh(2y))
-- (see Abramowitz & Stegun 4.3.57 or derive by hand), and compute trig functions here.
-- This approach does not work for |y| > ~355, because sinh(2y) and cosh(2y) overflow,
-- even though their ratio does not. In that case, divide through by cosh to get:
-- tan z = (sin(2x) / cosh(2y) + i \tanh(2y)) / (1 + cos(2x) / cosh(2y))
-- which correctly computes the (tiny) real part and the (normal-sized) imaginary part.
local x2 = 2.0 * value.m_real
local y2 = 2.0 * value.m_imaginary
local p = math.Exp(y2)
local q = 1.0 / p
local cosh = (p + q) * 0.5
if math.Abs(value.m_imaginary) <= 4.0 then
local sinh = (p - q) * 0.5
local D = math.Cos(x2) + cosh
return class(math.Sin(x2) / D, sinh / D)
else
local D = 1.0 + math.Cos(x2) / cosh
return class(math.Sin(x2) / cosh / D, math.Tanh(y2) / D)
end
end
Tanh = function (value)
-- Use tanh(z) = -i tan(iz) to compute via tan(z).
local tan = Tan(class(- value.m_imaginary, value.m_real))
return class(tan.m_imaginary, - tan.m_real)
end
Atan = function (value)
local two = class(2.0, 0.0)
return (ImaginaryOne / two) * (Log(One - (ImaginaryOne * value)) - Log(One + ImaginaryOne * value))
end
Asin_Internal = function (x, y, b, bPrime, v)
-- This method for the inverse complex sine (and cosine) is described in Hull, Fairgrieve,
-- and Tang, "Implementing the Complex Arcsine and Arccosine Functions Using Exception Handling",
-- ACM Transactions on Mathematical Software (1997)
-- (https://www.researchgate.net/profile/Ping_Tang3/publication/220493330_Implementing_the_Complex_Arcsine_and_Arccosine_Functions_Using_Exception_Handling/links/55b244b208ae9289a085245d.pdf)
-- First, the basics: start with sin(w) = (e^{iw} - e^{-iw}) / (2i) = z. Here z is the input
-- and w is the output. To solve for w, define t = e^{i w} and multiply through by t to
-- get the quadratic equation t^2 - 2 i z t - 1 = 0. The solution is t = i z + sqrt(1 - z^2), so
-- w = arcsin(z) = - i log( i z + sqrt(1 - z^2) )
-- Decompose z = x + i y, multiply out i z + sqrt(1 - z^2), use log(s) = |s| + i arg(s), and do a
-- bunch of algebra to get the components of w = arcsin(z) = u + i v
-- u = arcsin(beta) v = sign(y) log(alpha + sqrt(alpha^2 - 1))
-- where
-- alpha = (rho + sigma) / 2 beta = (rho - sigma) / 2
-- rho = sqrt((x + 1)^2 + y^2) sigma = sqrt((x - 1)^2 + y^2)
-- These formulas appear in DLMF section 4.23. (http://dlmf.nist.gov/4.23), along with the analogous
-- arccos(w) = arccos(beta) - i sign(y) log(alpha + sqrt(alpha^2 - 1))
-- So alpha and beta together give us arcsin(w) and arccos(w).
-- As written, alpha is not susceptible to cancelation errors, but beta is. To avoid cancelation, note
-- beta = (rho^2 - sigma^2) / (rho + sigma) / 2 = (2 x) / (rho + sigma) = x / alpha
-- which is not subject to cancelation. Note alpha >= 1 and |beta| <= 1.
-- For alpha ~ 1, the argument of the log is near unity, so we compute (alpha - 1) instead,
-- write the argument as 1 + (alpha - 1) + sqrt((alpha - 1)(alpha + 1)), and use the log1p function
-- to compute the log without loss of accuracy.
-- For beta ~ 1, arccos does not accurately resolve small angles, so we compute the tangent of the angle
-- instead.
-- Hull, Fairgrieve, and Tang derive formulas for (alpha - 1) and beta' = tan(u) that do not suffer
-- from cancelation in these cases.
-- For simplicity, we assume all positive inputs and return all positive outputs. The caller should
-- assign signs appropriate to the desired cut conventions. We return v directly since its magnitude
-- is the same for both arcsin and arccos. Instead of u, we usually return beta and sometimes beta'.
-- If beta' is not computed, it is set to -1; if it is computed, it should be used instead of beta
-- to determine u. Compute u = arcsin(beta) or u = arctan(beta') for arcsin, u = arccos(beta)
-- or arctan(1/beta') for arccos.
assert((x >= 0.0) or System.Double.IsNaN(x))
assert((y >= 0.0) or System.Double.IsNaN(y))
-- For x or y large enough to overflow alpha^2, we can simplify our formulas and avoid overflow.
if (x > s_asinOverflowThreshold) or (y > s_asinOverflowThreshold) then
b = - 1.0
bPrime = x / y
local small, big
if x < y then
small = x
big = y
else
small = y
big = x
end
local ratio = small / big
v = s_log2 + math.Log(big) + 0.5 * Log1P(ratio * ratio)
else
local r = Hypot((x + 1.0), y)
local s = Hypot((x - 1.0), y)
local a = (r + s) * 0.5
b = x / a
if b > 0.75 then
if x <= 1.0 then
local amx = (y * y / (r + (x + 1.0)) + (s + (1.0 - x))) * 0.5
bPrime = x / math.Sqrt((a + x) * amx)
else
-- In this case, amx ~ y^2. Since we take the square root of amx, we should
-- pull y out from under the square root so we don't lose its contribution
-- when y^2 underflows.
local t = (1.0 / (r + (x + 1.0)) + 1.0 / (s + (x - 1.0))) * 0.5
bPrime = x / y / math.Sqrt((a + x) * t)
end
else
bPrime = - 1.0
end
if a < 1.5 then
if x < 1.0 then
-- This is another case where our expression is proportional to y^2 and
-- we take its square root, so again we pull out a factor of y from
-- under the square root.
local t = (1.0 / (r + (x + 1.0)) + 1.0 / (s + (1.0 - x))) * 0.5
local am1 = y * y * t
v = Log1P(am1 + y * math.Sqrt(t * (a + 1.0)))
else
local am1 = (y * y / (r + (x + 1.0)) + (s + (x - 1.0))) * 0.5
v = Log1P(am1 + math.Sqrt(am1 * (a + 1.0)))
end
else
-- Because of the test above, we can be sure that a * a will not overflow.
v = math.Log(a + math.Sqrt((a - 1.0) * (a + 1.0)))
end
end
return b, bPrime, v
end
IsFinite = function (value)
return System.Double.IsFinite(value.m_real) and System.Double.IsFinite(value.m_imaginary)
end
IsInfinity = function (value)
return System.Double.IsInfinity(value.m_real) or System.Double.IsInfinity(value.m_imaginary)
end
IsNaN = function (value)
return not IsInfinity(value) and not IsFinite(value)
end
Log = function (value, baseValue)
if baseValue ~= nil then
return (Log(value) / Log(ToComplex(baseValue)))
end
return class(math.Log(Abs(value)), math.Atan2(value.m_imaginary, value.m_real))
end
Log10 = function (value)
local tempLog = Log(value)
return Scale(tempLog, 0.43429448190325 --[[Complex.InverseOfLog10]])
end
Exp = function (value)
local expReal = math.Exp(value.m_real)
local cosImaginary = expReal * math.Cos(value.m_imaginary)
local sinImaginary = expReal * math.Sin(value.m_imaginary)
return class(cosImaginary, sinImaginary)
end
Sqrt = function (value)
local m_real = value.m_real
local m_imaginary = value.m_imaginary
if m_imaginary == 0.0 then
-- Handle the trivial case quickly.
if m_real < 0.0 then
return class(0.0, math.Sqrt(- m_real))
else
return class(math.Sqrt(m_real), 0.0)
end
else
-- One way to compute Sqrt(z) is just to call Pow(z, 0.5), which coverts to polar coordinates
-- (sqrt + atan), halves the phase, and reconverts to cartesian coordinates (cos + sin).
-- Not only is this more expensive than necessary, it also fails to preserve certain expected
-- symmetries, such as that the square root of a pure negative is a pure imaginary, and that the
-- square root of a pure imaginary has exactly equal real and imaginary parts. This all goes
-- back to the fact that Math.PI is not stored with infinite precision, so taking half of Math.PI
-- does not land us on an argument with cosine exactly equal to zero.
-- To find a fast and symmetry-respecting formula for complex square root,
-- note x + i y = \sqrt{a + i b} implies x^2 + 2 i x y - y^2 = a + i b,
-- so x^2 - y^2 = a and 2 x y = b. Cross-substitute and use the quadratic formula to obtain
-- x = \sqrt{\frac{\sqrt{a^2 + b^2} + a}{2}} y = \pm \sqrt{\frac{\sqrt{a^2 + b^2} - a}{2}}
-- There is just one complication: depending on the sign on a, either x or y suffers from
-- cancelation when |b| << |a|. We can get aroud this by noting that our formulas imply
-- x^2 y^2 = b^2 / 4, so |x| |y| = |b| / 2. So after computing the one that doesn't suffer
-- from cancelation, we can compute the other with just a division. This is basically just
-- the right way to evaluate the quadratic formula without cancelation.
-- All this reduces our total cost to two sqrts and a few flops, and it respects the desired
-- symmetries. Much better than atan + cos + sin!
-- The signs are a matter of choice of branch cut, which is traditionally taken so x > 0 and sign(y) = sign(b).
-- If the components are too large, Hypot will overflow, even though the subsequent sqrt would
-- make the result representable. To avoid this, we re-scale (by exact powers of 2 for accuracy)
-- when we encounter very large components to avoid intermediate infinities.
local rescale = false
if (math.Abs(m_real) >= s_sqrtRescaleThreshold) or (math.Abs(m_imaginary) >= s_sqrtRescaleThreshold) then
if System.Double.IsInfinity(m_imaginary) and not System.Double.IsNaN(m_real) then
-- We need to handle infinite imaginary parts specially because otherwise
-- our formulas below produce inf/inf = NaN. The NaN test is necessary
-- so that we return NaN rather than (+inf,inf) for (NaN,inf).
return (class(System.Double.PositiveInfinity, m_imaginary))
else
m_real = m_real * 0.25
m_imaginary = m_imaginary * 0.25
rescale = true
end
end
-- This is the core of the algorithm. Everything else is special case handling.
local x, y
if m_real >= 0.0 then
x = math.Sqrt((Hypot(m_real, m_imaginary) + m_real) * 0.5)
y = m_imaginary / (2.0 * x)
else
y = math.Sqrt((Hypot(m_real, m_imaginary) - m_real) * 0.5)
if m_imaginary < 0.0 then
y = - y
end
x = m_imaginary / (2.0 * y)
end
if rescale then
x = x * 2.0
y = y * 2.0
end
return class(x, y)
end
end
Pow = function (value, power)
if power == Zero then
return One
end
if value == Zero then
return Zero
end
local valueReal = value.m_real
local valueImaginary = value.m_imaginary
local powerReal = power.m_real
local powerImaginary = power.m_imaginary
local rho = Abs(value)
local theta = math.Atan2(valueImaginary, valueReal)
local newRho = powerReal * theta + powerImaginary * math.Log(rho)
local t = math.Pow(rho, powerReal) * math.Pow(2.71828182845905 --[[Math.E]], - powerImaginary * theta)
return class(t * math.Cos(newRho), t * math.Sin(newRho))
end
Pow1 = function (value, power)
return Pow(value, class(power, 0))
end
Scale = function (value, factor)
local realResult = factor * value.m_real
local imaginaryResuilt = factor * value.m_imaginary
return class(realResult, imaginaryResuilt)
end
ToComplex = function (value)
return class(value, 0.0)
end
class = {
__inherits__ = function (out, T)
return {
System.IEquatable_1(T),
System.IFormattable
}
end,
m_real = 0,
m_imaginary = 0,
getReal = getReal,
getImaginary = getImaginary,
getMagnitude = getMagnitude,
getPhase = getPhase,
FromPolarCoordinates = FromPolarCoordinates,
Negate = Negate,
Add = Add,
Subtract = Subtract,
Multiply = Multiply,
Divide = Divide,
Abs = Abs,
Conjugate = Conjugate,
Reciprocal = Reciprocal,
EqualsObj = EqualsObj,
Equals = Equals,
GetHashCode = GetHashCode,
ToString = ToString,
Sin = Sin,
Sinh = Sinh,
Asin = Asin,
Cos = Cos,
Cosh = Cosh,
Acos = Acos,
Tan = Tan,
Tanh = Tanh,
Atan = Atan,
IsFinite = IsFinite,
IsInfinity = IsInfinity,
IsNaN = IsNaN,
Log = Log,
Log10 = Log10,
Exp = Exp,
Sqrt = Sqrt,
Pow = Pow,
Pow1 = Pow1,
ToComplex = ToComplex,
static = static,
__ctor__ = __ctor__,
__add = Add,
__sub = Subtract,
__mul = Multiply,
__div = Divide,
__unm = Negate,
__eq = op_Equality
}
return class
end)())
|
-- game.lua
-- metroidvanian platformer game
-- N.P.Thompson 2021 (MIT license)
-- noahpthomp@gmail.com
-- game contains all state and subroutines for updating said state
require 'list'
require 'rect'
require 'unit'
require 'room'
game = {
-- =============================================
-- state variables
entities = list(),
rooms = {},
-- =============================================
-- entities can be killed without specifying a room, but not spawned without specifying a room
kill = function(entity)
game.entities:rm(entity)
entity.where.entities:rm(entity)
return entity
end,
-- a note on how updating and testing collisions works:
-- collision testing only alerts entities to the fact that they are touching one another
-- an entity may have an action that causes it to react some kinds of entities, this is triggered during update
-- after the update, the entity 'forgets' that it was touching the other object
-- (we assume that nothing is touching unless we prove it to be so)
-- so, here's the process:
-- update everything
-- forget what was touching what
-- test to see what is touching what now
-- repeat
update = function(df)
for e in elems(game.entities) do
e:execute_actions(df)
e.grounded = {below=false,right=false,left=false}
end
end,
test_collisions = function()
for _, r in pairs(game.rooms) do
r:test_collisions()
end
end,
} -- end game table |
local tools = require "tools"
--local host = ngx.var.http_host
local host = gw_domain_name
--local uri = ngx.var.uri
local _M = {}
function _M.set(real_new_uri)
local uri = real_new_uri
-- ngx.log(ngx.ERR, "uri-------->"..uri)
if uri == '/nginx-logo.png' or uri == '/poweredby.png' then
return
end
local url_path_list = tools.split(uri, '/')
local svc_code = url_path_list[1]
local default_upstream = 'None'
if rewrite_conf[host] ~= nil then
local data = {}
local key_data = {}
for i, elem in ipairs(rewrite_conf[host]['rewrite_urls']) do
--local ret = tools.match(uri,elem['uri'])
--if ret then
local ret = tools.match('/'..svc_code,elem['uri'])
if '/'..svc_code == elem['uri'] then
data [string.len(elem['uri'])] = elem['rewrite_upstream']
end
end
if next(data) ~= nil then
for k,v in pairs(data) do
--ngx.log(ngx.ERR, "k---->"..k,v)
table.insert(key_data,k)
end
table.sort(key_data) --排序
local new_key = key_data[#key_data] --取最后一个key
default_upstream = data[new_key]
-- ngx.log(ngx.ERR, "default_upstream----> "..default_upstream)
end
end
if default_upstream ~= "None" then
ngx.var.my_upstream = default_upstream
table.remove(url_path_list,1)
local new_uri = tools.list_to_str(url_path_list,'/')
local real_url_path_list = tools.split(new_uri, '?')
local real_uri = real_url_path_list[1]
ngx.log(ngx.ERR,'real_uri-------->',real_uri)
-- ngx.log(ngx.ERR,'new_uri-------->',new_uri)
ngx.req.set_uri(real_uri, false)
else
return ngx.exit(404)
end
end
return _M |
require 'busted.runner' ( )
local talents = require 'talents'
describe ("talents releasing", function ( )
it ("should be able to discard garbage collected talents", function ( )
local emma
do
local writer = talents.talent {
name = talents.required ( ),
write = function (self)
return ("%s is writing a great book!"): format (self.name)
end,
}
emma = talents.decorate (writer, { name = "Emma Goldman", })
assert.same (emma.name, "Emma Goldman")
assert.same (emma: write ( ),
"Emma Goldman is writing a great book!")
end
collectgarbage ( )
-- Emma Goldman is tired of writing, now it's time for Revolution! --
assert.same (emma.name, "Emma Goldman")
assert.same (emma.write, nil)
end)
it ("should be able to store and persist talents", function ( )
local peter
do
local writer = talents.talent {
name = talents.required ( ),
think = function (self, thing)
return ("%s is taking some inspiration from %s..."):
format (self.name, thing)
end,
}
-- store and persist the writer talent --
peter = talents.decorate (writer, {
name = "Peter Kropotkin",
talent = writer,
})
assert.same (peter.name, "Peter Kropotkin")
assert.same (peter: think ("the nature"),
"Peter Kropotkin is taking some inspiration from the nature...")
end
collectgarbage ( )
-- Peter really likes to think a lot. --
assert.same (peter.name, "Peter Kropotkin")
assert.same (peter: think ("the cities"),
"Peter Kropotkin is taking some inspiration from the cities...")
assert.same (talents.abstract (peter), peter.talent)
end)
end)
-- END --
|
local character = CHARMAN:GetCharacter("Yuni")
local t = Def.ActorFrame{
Def.Quad{
InitCommand=cmd(Center;FullScreen;diffuse,color("#000063"));
};
Def.ActorFrame{
InitCommand=cmd(CenterX;);
--[[
LoadActor(THEME:GetPathB("ScreenSelectCharacter","overlay/_icon blank"))..{
InitCommand=cmd(y,SCREEN_CENTER_Y-80);
};
--]]
Def.Model{
Materials = character:GetModelPath(),
Meshes = character:GetModelPath(),
Bones = character:GetRestAnimationPath(),
--InitCommand=cmd(x,-4;y,SCREEN_CENTER_Y+64;zoom,10;rotationy,180;cullmode,'CullMode_None';rate,0;position,0.575);
InitCommand=cmd(y,SCREEN_CENTER_Y*2.5;zoom,32;rotationy,180;cullmode,'CullMode_None';rate,0;position,0.575;);
};
};
};
return t; |
local installations = {}
CreateThread(LoadConfigurationFile)
function GetResourceFromGithub(gitUrl, savingPath)
local git = github(gitUrl)
local lastRelease = git:getLastRelease()
if lastRelease and lastRelease.tag_name ~= resourceVersion then
local files = git:getFiles()
for i, file in pairs(files) do
printLog('\t\tDownloading', file.name, 'file', i, 'of', #files, ("[%s]"):format(file.raw))
local fileString = GetFile(file.raw)
printLog('\t\tDownloaded', file.name)
if file.name == 'fxmanifest.lua' or file.name == '__resource.lua' --[[ compatibility?? ]] then
if not fileString:find([[pmc_updates '*.*']]) then
fileString = fileString .. ("\n-- This was auto-generated by pmc-updater (github.com/pitermcflebor/pmc-updater)\npmc_updates '%s'"):format((lastRelease.tag_name ~= 'none' and 'yes' or 'no'))
if lastRelease.tag_name == 'none' then
fileString = fileString .. '-- This resource doesn\'t has any release tag, it cannot be auto-updated! Request the author to add a release.'
end
end
if not fileString:find([[pmc_github '*.*']]) then
fileString = fileString .. ("\npmc_github '%s'"):format(gitUrl)
end
if not fileString:find(("pmc_version '%s'"):format(lastRelease.tag_name)) then
fileString = fileString .. ("\npmc_version '%s'"):format(lastRelease.tag_name)
else
fileString = fileString:gsub("pmc_version '*.*'", ("pmc_version '%s'"):format(lastRelease.tag_name))
end
end
if not savingPath:endsWith('/') then savingPath = savingPath..'/' end
local path = ("%s%s%s"):format(savingPath, ("%s/"):format(git.repo_data.name), file.path:gsub(git.repo_data.name:ensure()..'/', ''))
WriteFile(path, fileString)
Wait(50) -- prevent API flood
end
installations[git.repo_data.name] = ("%s%s"):format(savingPath, ("%s/"):format(git.repo_data.name))
printLog('\tEnd cloning resource:', git.repo_data.name)
printLog('To open the extract folder type ^3git dir', git.repo_data.name)
return git.repo_data.name
else
printLog('\tis up to date!')
end
end
function UpdateResource(resource, disableStoppedLog)
if resource and GetResourceState(resource) == 'started' then -- resource started?
if GetResourceMetadata(resource, 'pmc_updates', 0) == 'yes' then -- check meta 'updates' if want updates
printLog('\tUpdating the resource:', resource)
local metaGitLink = GetResourceMetadata(resource, 'pmc_github', 0) -- get github url
local resourceVersion = GetResourceMetadata(resource, 'pmc_version', 0) -- get current version
if metaGitLink ~= nil and resourceVersion ~= nil then
local git = github(metaGitLink)
local lastRelease = git:getLastRelease()
if lastRelease and lastRelease.tag_name ~= resourceVersion then
local files = git:getFiles()
for i, file in pairs(files) do
printLog('\t\tDownloading', file.name, 'file', i, 'of', #files)
local fileString = GetFile(file.raw)
printLog('\t\tDownloaded', file.name)
if file.name == 'fxmanifest.lua' or file.name == '__resource.lua' then
if not fileString:find([[pmc_updates '*.*']]) then
fileString = fileString .. "\n\n-- This was auto-generated by pmc-updater (github.com/pitermcflebor/pmc-updater)\npmc_updates 'yes'"
end
if not fileString:find([[pmc_github '*.*']]) then
fileString = fileString .. ("\npmc_github '%s'"):format(metaGitLink)
end
if not fileString:find(("\npmc_version '*.*'"):format(lastRelease.tag_name)) then
fileString = fileString .. ("\npmc_version '%s'"):format(lastRelease.tag_name)
else
fileString = fileString:gsub("pmc_version '*.*'", ("pmc_version '%s'"):format(lastRelease.tag_name))
end
end
WriteFile(GetResourcePath(resource)..'/'..file.path:gsub(resource:ensure()..'/', ''), fileString)
end
printLog('\tEnd updating resource:', resource)
return true
else
printLog('\tis up to date!')
end
else
printWarning('Error updating resource:', resource)
printWarning('\tThe meta "github" or "version" is not set!')
end
else
if not disableStoppedLog then
printWarning('Error updating resource:', resource)
printWarning('\tThe resource is not supported with pmc-updater! Ask the author or add manually the updater')
printLog('\tIf you really want to update this script, just re-clone the resource!')
end
end
else
if not disableStoppedLog then
printWarning('Error updating resource:', resource)
printWarning('\tThe resource isn\'t started', GetResourceState(resource))
end
end
end
function CheckUpdates(waittime)
if not waittime then
Wait(5*1000)
printLog('Checking resources in 5 seconds...^7')
Wait(5--[[ seconds ]]*1000)
end
printLog('Started checking resources...')
local numResources = GetNumResources() -- get max resources
for i = 0, numResources, 1 do -- for loop resources
local resource = GetResourceByFindIndex(i) -- get resource
UpdateResource(resource, true)
end
printLog('End checking resources!')
end
if GetResourceMetadata(GetCurrentResourceName(), 'auto', 0) == 'yes' then
CreateThread(CheckUpdates)
end
RegisterCommand('clearconsole', function() print(table.concat(table.fill('\n', 30), '')) end, true)
RegisterCommand('git', function(s, args, rawArgs)
if s ~= 0 then return end
local resourcesPath = GetCurrentResourcesPath()
local params = table.build(rawArgs:split())
table.remove(params, 1)
local canUseRefresh = CanUseCommand('refresh')
local canUseEnsure = CanUseCommand('ensure')
local module = params[1]
if module == 'update' then
local resource = params[2]
if resource == nil or resource == '' or resource == '*' then
CheckUpdates(true)
else
if UpdateResource(resource) then
-- TO:DO add restart resource
end
end
elseif module == 'clone' then
local options, gitUrl, folder = {}, '', nil
if params[2]:startsWith('-') then
_, _options = table.build(params[2]:split('.'))
for _, option in pairs(_options) do options[option] = true end
gitUrl = params[3]
folder = params[4]
else
gitUrl = params[2]
folder = params[3]
end
if folder then
folder = resourcesPath..'/'..folder
end
if not gitUrl then printWarning('Missing git url')
else
printLog('Cloning "', gitUrl, '" into "', folder or resourcesPath, '"')
local resourceName = GetResourceFromGithub(gitUrl, folder or resourcesPath)
if options['r'] ~= nil and resourceName ~= nil then
if CanUseCommand('refresh') == false or CanUseCommand('ensure') == false or CanUseCommand('start') == false or CanUseCommand('stop') == false then
printWarning"Cannot use command refresh or ensure!"
if not canUseRefresh or not canUseEnsure then
printWarning"\tTo fix this type in 'git ace'!"
else
printWarning"\tIt appears that there's a bug with the ACE permissions..."
printLog("\tTo run manually the new resource type in 'refresh' and then 'ensure "..resourceName.."'")
end
else
printLog"Refreshing resources..."
ExecuteCommand("refresh")
printLog"(Re)Starting resource..."
ExecuteCommand("ensure "..resourceName)
end
end
if options['c'] ~= nil and resourceName ~= nil then
printLog"Adding resource to .cfg file"
if AddResourceToCfg(resourceName) then
printLog"\tResource added to .cfg, restart the server if needed!"
else
printWarning"\tCould not add the resource to .cfg"
end
end
end
elseif module == 'del' then
local resource = params[2]
printLog"Deleting resource folder..."
if GetResourceState(resource) == 'started' then
if CanUseCommand('stop') then
ExecuteCommand('stop '..resource)
printLog"\tResource stopped"
if DeleteFolder(GetResourcePath(resource)) and RemoveResourceFromCfg(resource) then
printLog"\tRemoved resource folder"
else
printWarning"\tCould not remove the resource correctly"
end
else
printWarning"\tCannot stop the resource, do it manually to remove the resource!"
end
elseif GetResourceState(resource) == 'stopped' then
if DeleteFolder(GetResourcePath(resource)) and RemoveResourceFromCfg(resource) then
printLog"\tRemoved resource folder"
else
printWarning"\tCould not remove the resource correctly"
end
elseif installations[resource] then
if DeleteFolder(installations[resource]) and RemoveResourceFromCfg(resource) then
printLog"\tRemoved resource folder"
else
printWarning"\tCould not remove the resource cloned"
end
else
printWarning"\tCannot find the resource or git cloned!"
end
elseif module == 'dir' then
if GetWorkingOS() ~= 'windows' then
printWarning('This command is only supported on MS-Windows!')
return
end
local resource = params[2]
if resource ~= nil and resource ~= '' then
if GetResourceState(resource) == 'started' then
OpenFolder(GetResourcePath(resource))
return
else
if installations[resource] then
OpenFolder(installations[resource])
return
end
end
printWarning('The resource is not started or not previously cloned!')
else
printWarning('Syntax error: git dir [resource-name]')
end
elseif module == 'ace' then
local autoAdd = params[2]
if not autoAdd then
if CanUseCommand('refresh') == false or CanUseCommand('ensure') == false or CanUseCommand('start') == false or CanUseCommand('stop') == false then
printWarning('Some permssions are missing!')
printLog("Use 'git ace -h' to see how to add permissions")
printLog("Use 'git ace -y' to auto set permissions into .cfg file!")
else
printLog('All permissions are OK!')
end
elseif autoAdd == '-h' then
if GetWorkingOS() == 'windows' then
os.execute('start https://github.com/pitermcflebor/pmc-updater/blob/main/README.md#tutorial')
else
printLog("Check the tutorial at https://github.com/pitermcflebor/pmc-updater/blob/main/README.md#tutorial")
end
elseif autoAdd == '-y' then
if canUseRefresh == true and canUseEnsure == true then
printLog('Permissions already satisfied!')
else
if AddAcePermission({'command.refresh', 'command.ensure', 'command.start', 'command.stop'}) == false then
printWarning("Cannot find the .cfg file! Define your custom .cfg file at '.config.lua'")
else
printLog("Permissions added!")
end
end
end
elseif module == 'help' or module == '?' then
printLog"Allowed commands:"
printLog"\tgit update [resource-name] - Updates one or all resources"
printLog"\tgit clone [options] github.com/giturl [path] - Clone the resource from github"
printLog"\t\toptions: (can be both)"
printLog"\t\t\tr - Executes 'refres' and 'ensure' when finishes the clone"
printLog"\t\t\tc - Add 'ensure' to the .cfg file when finishes the clone"
printLog"\tgit del resource-name - Delete the resource folder"
printLog"\tgit dir resource-name - (Windows only) Open the resource folder with file explorer"
printLog"\tgit ace [option] [args] - Check ACE permissions for pmc-updater"
printLog"\t\tgit ace -h - Show help for ACE permissions"
printLog"\t\tgit ace -y - Add ACE permissions to .cfg file automatic"
printLog"Need more help? Check the github repo or ask via FiveM forum post!"
else
printWarning('The command', ("'%s'"):format(rawArgs), 'doesn\'t exists!')
printWarning('Type "git help" or "git ?" to see the allowed commands!')
end
end, true)
|
-- Slingshot settings
--- Slingshot mod settings.
--
-- @module settings
--- Slingshot specific settings.
--
-- Settings unique to this mod.
--
-- @section settings_specific
--- Use old 16x16 textures.
--
-- @setting slingshot.old_textures
-- @settype bool
-- @default false
slingshot.old_textures = core.settings:get_bool("slingshot.old_textures", false)
--- Value of these items will be added to slingshot attack when thrown.
--
-- @setting slingshot.ammos
-- @settype string
-- @default default:mese_crystal=5
slingshot.ammos = core.settings:get("slingshot.ammos") or "default:mese_crystal=5"
--- General settings.
--
-- Settings commom to core & other mods.
--
-- @section settings_general
--- Enables/Disables wear when used.
--
-- @setting enable_weapon_wear
-- @settype bool
-- @default true
slingshot.enable_wear = core.settings:get_bool("enable_weapon_wear", true)
--- Log extra messages.
--
-- @setting log_mods
-- @settype bool
-- @default false
slingshot.log_mods = core.settings:get_bool("log_mods", false)
--- Log extra debug messages.
--
-- @setting enable_debug_mods
-- @settype bool
-- @default false
slingshot.debug = core.settings:get_bool("enable_debug_mods", false)
--- Determines if game is being run in creative mode.
--
-- @setting creative_mode
-- @settype bool
-- @default false
slingshot.creative = core.settings:get_bool("creative_mode", false)
--- Time in seconds for item entity (dropped items) to live.
--
-- Setting it to -1 disables the feature.
--
-- @setting item_entity_ttl
-- @settype int
-- @default 890
slingshot.thrown_duration = tonumber(core.settings:get("item_entity_ttl")) or 890
--- Determines if PVP is enabled.
--
-- @setting enable_pvp
-- @settype bool
-- @default true
slingshot.enable_pvp = core.settings:get_bool("enable_pvp", true)
|
-- blackScreen is used for fading to black and adding darkness to the screen
blackScreen = {}
blackScreen.state = 0 -- 0 is stable, 1 is getting dark, -1 is getting lighter
blackScreen.alpha = 0
blackScreen.time = 1 -- time in seconds for the blackScreen fade/unfade
-- blackScreen is also used for making the screen turn red when drowning
blackScreen.red = false
blackScreen.fullRedAlpha = 0.25
function blackScreen:update(dt)
if self.state ~= 0 then
self.alpha = self.alpha + (self.state / self.time * dt)
end
if self.alpha < 0 then
self.alpha = 0
self.state = 0
self.red = false
end
if self.alpha > 1 then
self.alpha = 1
self.state = 0
end
if self.red and self.alpha > self.fullRedAlpha then
self.alpha = self.fullRedAlpha
self.state = 0
end
end
function blackScreen:draw()
local red = 0
if self.red then
red = 1
end
love.graphics.setColor(red, 0, 0, self.alpha)
love.graphics.rectangle("fill", -20, -20, (gameWidth + 40) * scale, (gameHeight + 40) * scale)
end
function blackScreen:fadeIn(t)
self.alpha = 1
self.state = -1
self.time = t or 1
self.red = false
end
function blackScreen:fadeOut(t)
self.alpha = 0
self.state = 1
self.time = t or 1
self.red = false
end
function blackScreen:setRed()
self.alpha = 0
self.state = 1
self.time = 1
self.red = true
end
function blackScreen:removeRed()
self.state = -1
self.time = 1
self.red = true
end
|
background = Image.createEmpty(480, 272)
clockOfs = 150
clockWidth = 100
clockTextPosition = 85
clockBigMarkWidth = 7
clockSmallMarkWidth = 3
x0 = clockOfs
y0 = clockOfs - clockWidth
pi = 4*math.atan(1)
color = Color.new(0, 255, 0)
for i=0,60 do
x1 = math.sin(pi-i/60*2*pi) * clockWidth + clockOfs
y1 = math.cos(pi-i/60*2*pi) * clockWidth + clockOfs
background:drawLine(x0, y0, x1, y1, color)
xv = (x1 - clockOfs) / clockWidth
yv = (y1 - clockOfs) / clockWidth
if math.mod(i, 5) == 0 then
xt = xv * clockTextPosition + clockOfs
yt = yv * clockTextPosition + clockOfs
value = math.ceil(i / 5)
if value == 0 then
value = 12
end
background:print(xt, yt, value, color)
xv = xv * (clockWidth - clockBigMarkWidth) + clockOfs
yv = yv * (clockWidth - clockBigMarkWidth) + clockOfs
background:drawLine(x1, y1, xv, yv, color)
else
xv = xv * (clockWidth - clockSmallMarkWidth) + clockOfs
yv = yv * (clockWidth - clockSmallMarkWidth) + clockOfs
background:drawLine(x1, y1, xv, yv, color)
end
x0 = x1
y0 = y1
end
background:print(4, 4, "os.date: ", color)
background:print(4, 14, "digital: ", color)
while not Controls.read():start() do
screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)
time = os.time()
dateString = os.date("%c", time)
screen:print(84, 4, dateString, color)
dateFields = os.date("*t", time)
hour = dateFields.hour
if hour < 10 then
hour = "0" .. hour
end
min = dateFields.min
if min < 10 then
min = "0" .. min
end
sec = dateFields.sec
if sec < 10 then
sec = "0" .. sec
end
screen:print(84, 14, hour .. ":" .. min .. ":" .. sec, color)
hour = dateFields.hour
if hour > 12 then
hour = hour - 12
end
hour = hour + dateFields.min / 60 + dateFields.sec / 3600
x = math.sin(pi-hour/12*2*pi) * clockWidth / 3 * 2 + clockOfs
y = math.cos(pi-hour/12*2*pi) * clockWidth / 3 * 2 + clockOfs
screen:drawLine(clockOfs, clockOfs, x, y, color)
min = dateFields.min + dateFields.sec / 60
x = math.sin(pi-min/60*2*pi) * clockWidth + clockOfs
y = math.cos(pi-min/60*2*pi) * clockWidth + clockOfs
screen:drawLine(clockOfs, clockOfs, x, y, color)
x = math.sin(pi-dateFields.sec/60*2*pi) * clockWidth + clockOfs
y = math.cos(pi-dateFields.sec/60*2*pi) * clockWidth + clockOfs
screen:drawLine(clockOfs, clockOfs, x, y, color)
screen.waitVblankStart()
screen.flip()
end
|
local params = {...}
local Dataseries = params[1]
local argcheck = require "argcheck"
local doc = require "argcheck.doc"
doc[[
## Export functions
Here are functions are used for exporting to a different format. Generally `to_`
functions should reside here. Only exception is the `tostring`.
]]
Dataseries.to_tensor = argcheck{
doc=[[
<a name="Dataseries.to_tensor">
### Dataseries.to_tensor(@ARGP)
Returns the values in tensor format. Note that if you don't provide a replacement
for missing values and there are missing values the function will throw an error.
*Note*: boolean columns are not tensors and need to be manually converted to a
tensor. This since 0 would be a natural value for false but can cause issues as
neurons are labeled 1 to n for classification tasks. See the `Dataframe.update`
function for details or run the `boolean2tensor`.
@ARGT
_Return value_: `torch.*Tensor` of the current type
]],
{name="self", type="Dataseries"},
{name="missing_value", type="number",
doc="Set a value for the missing data",
opt=true},
{name="copy", type="boolean", default=true,
doc="Set to false if you want the original data to be returned."},
call=function(self, missing_value)
assert(self:type():match("torch.*Tensor"),
"Can only automatically retrieve columns that already are tensors")
assert(self:count_na() == 0 or missing_value,
"Missing data should be replaced with a default value before retrieving tensor")
local ret
if (copy) then
ret = self:copy()
else
ret = self
end
if (missing_value and self:count_na() > 0) then
assert(copy, "Replacing missing values is not allowed in to_tensor unless you are returning a copy")
ret:fill_na(missing_value)
end
return ret.data
end}
Dataseries.to_table = argcheck{
doc=[[
<a name="Dataseries.to_table">
### Dataseries.to_table(@ARGP)
Returns the values in table format
@ARGT
_Return value_: table
]],
{name="self", type="Dataseries"},
{name="boolean2string", type="boolean", opt=true,
doc="Convert boolean values to strings since they cause havoc with csvigo"},
call=function(self, boolean2string)
local ret = {}
for i=1,self:size() do
ret[i] = self:get(i)
end
if (boolean2string and self:type() == "tds.Vec") then
for i=1,#ret do
if (type(ret[i]) == "boolean") then
ret[i] = tostring(ret[i])
end
end
end
return ret
end}
|
local Suite = require "loop.test.Suite"
return Suite{
Wrapper = require "loop.tests.object.Wrapper",
Publisher = require "loop.tests.object.Publisher",
}
|
UMMColor = {
Header = "449fe6",
Bright = "cdeeff",
Medium = "7ab1db",
Dark = "9ec0d5",
Border = "afd0e1",
Green = "00e600";
Grey = "bbbbbb";
DarkGrey = "999999";
Cyan = "69ccf0";
Yellow = "ffe600";
White = "ffffff";
Red = "e60000";
Own = "dc886d";
}
|
player_manager.AddValidModel( "PMC4_04", "models/player/PMC_4/PMC__04.mdl" ) list.Set( "PlayerOptionsModel", "PMC4_04", "models/player/PMC_4/PMC__04.mdl" ) |
#!/usr/bin/env luajit
local io = require("io")
local os = require("os")
local dir = arg[1]
if (dir == nil) then
print("Usage: ", arg[0], " /usr/path/to/clang-c/ > ljclang_Index_h.lua")
os.exit(1)
end
local function loadandstrip(filename)
local f, errmsg = io.open(dir.."/"..filename)
if (f==nil) then
print("Error opening file: ", errmsg)
os.exit(2)
end
local str = f:read("*a")
f:close()
-- Remove...
return str:gsub("#ifdef __.-#endif\n", "") -- #ifdef __cplusplus/__have_feature ... #endif
:gsub("#define.-[^\\]\n", "") -- multi-line #defines
:gsub("/%*%*.-%*/", "") -- comments, but keep headers with license ref
:gsub("#[^\n]-\n", "") -- single-line preprocessor directives
:gsub("CINDEX_LINKAGE","")
:gsub("CINDEX_DEPRECATED","")
:gsub("time_t", "// time_t") -- clang_getFileTime declaration
:gsub(" *\n+", "\n")
end
local cxstring_h = loadandstrip("CXString.h")
local cxcompdb_h = loadandstrip("CXCompilationDatabase.h")
local index_h = loadandstrip("Index.h")
print("require('ffi').cdef[==========[\n",
cxstring_h, cxcompdb_h, index_h, "]==========]")
|
modifier_item_nullifier_custom_slow = class({})
function modifier_item_nullifier_custom_slow:DeclareFunctions()
return {
MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE,
}
end
function modifier_item_nullifier_custom_slow:GetModifierMoveSpeedBonus_Percentage()
return -self:GetAbility():GetSpecialValueFor("slow_pct")
end
function modifier_item_nullifier_custom_slow:GetEffectName()
return "particles/items4_fx/nullifier_slow.vpcf"
end
function modifier_item_nullifier_custom_slow:GetEffectAttachType()
return PATTACH_ABSORIGIN_FOLLOW
end
|
return {
COMMANDS = "/applications/%s/commands",
COMMANDS_GUILD = "/applications/%s/guilds/%s/commands",
COMMANDS_MODIFY = "/applications/%s/commands/%s",
COMMANDS_MODIFY_GUILD = "/applications/%s/guilds/%s/commands/%s",
COMMAND_PERMISSIONS = "/applications/%s/guilds/%s/commands/permissions",
COMMAND_PERMISSIONS_MODIFY = "/applications/%s/guilds/%s/commands/%s/permissions",
INTERACTION_RESPONSE = "/interactions/%s/%s/callback",
INTERACTION_RESPONSE_MODIFY = "/webhooks/%s/%s/messages/@original",
INTERACTION_FOLLOWUP_CREATE = "/webhooks/%s/%s",
INTERACTION_FOLLOWUP_MODIFY = "/webhooks/%s/%s/messages/%s"
} |
-- This file is subject to copyright - contact swampservers@gmail.com for more information.
-- INSTALL: CINEMA
sv_GetVideoInfo = sv_GetVideoInfo or {}
sv_GetVideoInfo.hls = function(self, key, ply, onSuccess, onFailure)
local streamwatch_key = string.match(key, "streamwat.ch/(%w+)/*$")
local datalink = nil
local onReceive = function(info)
http.Post("https://swamp.sv/fedorabot/gis.php", {
q = info.title
}, function(body)
info.thumb = "http://swamp.sv/s/cinema/contain.php?i=" .. body
onSuccess(info)
end, onFailure)
end
local onFetchReceive = function(body, length, headers, code)
if (headers["Access-Control-Allow-Origin"] and headers["Access-Control-Allow-Origin"] ~= "*" and headers["Access-Control-Allow-Origin"] ~= "https://swamp.sv/") then
datalink = "https://cors.oak.re/" .. (datalink or key)
end
local info = {}
local duration = 0
local timed = false
for k, v in ipairs(string.Split(body, "\n")) do
if (v:StartWith("#EXTINF:")) then
duration = duration + tonumber(string.Split(string.sub(v, 9), ",")[1]) --split because it can be 1.0000,live instead of just 1.0000,
end
if (v == "#EXT-X-ENDLIST" or v == "#EXT-X-PLAYLIST-TYPE:VOD") then
timed = true
end
end
if (string.TrimRight(string.Split(body, "\n")[1]) == "#EXTM3U") then
ply:PrintMessage(HUD_PRINTCONSOLE, "#EXTM3U") --debug
--use player to get the title
theater.GetVideoInfoClientside(self:GetClass(), datalink or key, ply, function(info)
info.duration = 0
info.data = datalink or ""
if timed then
info.duration = math.ceil(duration)
info.data = "true"
end
onSuccess(info)
end, onFailure)
else
ply:PrintMessage(HUD_PRINTCONSOLE, body) --debug
onFailure('Theater_RequestFailed')
end
end
local onFetchReceiveStreamWatch = function(body, length, headers, code)
local streamwatch_url = string.match(body, "(http.+%.m3u8)")
if streamwatch_url == nil or code == 0 then
--use player to get the hls link due to serverside http issue
theater.GetVideoInfoClientside(self:GetClass(), key, ply, function(info)
info.data = streamwatch_url
info.duration = 0
onReceive(info)
end, onFailure)
elseif streamwatch_url ~= nil then
datalink = string.Replace(streamwatch_url, "https://cors.oak.re/", "")
self:Fetch(datalink, onFetchReceive, onFailure)
else
ply:PrintMessage(HUD_PRINTCONSOLE, body) --debug
onFailure('Theater_RequestFailed')
end
end
if streamwatch_key ~= nil then
self:Fetch("http://streamwat.ch/" .. streamwatch_key .. "/player.min.js", onFetchReceiveStreamWatch, function()
--use player to get the hls link due to serverside http issue
theater.GetVideoInfoClientside(self:GetClass(), key, ply, function(info)
info.duration = 0
onSuccess(info)
end, onFailure)
end)
else
--process the first link if it's a playlist/menu
self:Fetch(key, function(body)
local newurl = string.Split(key, "/")
local urlindex = nil
for k, v in ipairs(string.Split(body, "\n")) do
if (string.find(v, ".m3u8") and not urlindex) then
urlindex = v
end
end
if (urlindex and not string.find(urlindex, "http.://")) then
local backcount = #string.Split(urlindex, "..") - 1
for _ = 1, backcount do
table.remove(newurl)
end
newurl[#newurl] = string.sub(urlindex, backcount * 3 + 1) or newurl[#newurl]
newurl = table.concat(newurl, "/")
elseif (urlindex and string.find(urlindex, "http.://")) then
newurl = urlindex
else
newurl = key
end
self:Fetch(newurl, onFetchReceive, onFailure)
end, onFailure)
end
end
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
require("lualib_bundle");
local ____exports = {}
____exports.Polygon = __TS__Class()
local Polygon = ____exports.Polygon
Polygon.name = "Polygon"
function Polygon.prototype.____constructor(self, mode, points, x, y)
if x == nil then
x = 0
end
if y == nil then
y = 0
end
self.color = {1, 1, 1}
self.border_thickness = 0
self.border_color = {1, 1, 1}
self.x = x
self.y = y
self.mode = mode
self.points = points
end
__TS__SetDescriptor(
Polygon.prototype,
"width",
{get = function(self)
local max_x = 0
for ____, index in ipairs(self.points) do
local coordinate = self.points[index + 1]
if index % 2 > 0 then
max_x = math.max(max_x, coordinate)
end
end
return max_x
end},
true
)
__TS__SetDescriptor(
Polygon.prototype,
"height",
{get = function(self)
local max_y = 0
for ____, index in ipairs(self.points) do
local coordinate = self.points[index + 1]
if index % 2 == 0 then
max_y = math.max(max_y, coordinate)
end
end
return max_y
end},
true
)
function Polygon.prototype.update(self)
end
function Polygon.prototype.draw(self)
love.graphics.push("all")
love.graphics.translate(self.x, self.y)
if self.mode == "fill" then
love.graphics.setColor(self.color)
local triangles = love.math.triangulate(self.points)
for ____, triangle in ipairs(triangles) do
love.graphics.polygon("fill", triangle)
end
end
love.graphics.setLineWidth(self.border_thickness)
love.graphics.setColor(self.border_color)
love.graphics.polygon("line", self.points)
love.graphics.pop()
end
return ____exports
|
local atlases = require("atlases")
local drawableSprite = require("structs.drawable_sprite")
local utils = require("utils")
local decals = {}
local decalsPrefix = "^decals/"
local decalFrameSuffix = "%d*$"
-- A frame should only be kept if it has no trailing number
-- Or if the trailing number is 0, 00, 000, ... etc
local function keepFrame(name)
local numberSuffix = name:match(decalFrameSuffix)
for i = 1, #numberSuffix do
if numberSuffix:sub(i, i) ~= "0" then
return false
end
end
return true
end
-- TODO - Support custom decals here
-- Might not be in atlases.gameplay because of lazy loading
function decals.getDecalNames(removeFrames)
removeFrames = removeFrames == nil or removeFrames
local res = {}
for name, sprite in pairs(atlases.gameplay) do
if name:match(decalsPrefix) then
if not removeFrames or keepFrame(name) then
table.insert(res, name)
end
end
end
return res
end
function decals.getDrawable(texture, handler, room, decal, viewport)
local meta = atlases.gameplay[texture]
local x = decal.x or 0
local y = decal.y or 0
local scaleX = decal.scaleX or 1
local scaleY = decal.scaleY or 1
if meta then
local drawable = drawableSprite.spriteFromTexture(texture, decal)
drawable:setScale(scaleX, scaleY)
drawable:setJustification(0, 0)
drawable:setOffset(0, 0)
drawable:setPosition(
x - meta.offsetX * scaleX - math.floor(meta.realWidth / 2) * scaleX,
y - meta.offsetY * scaleY - math.floor(meta.realHeight / 2) * scaleY
)
return drawable
end
end
function decals.getSelection(room, decal)
local drawable = decals.getDrawable(decal.texture, nil, room, decal, nil)
return drawable:getRectangle()
end
function decals.moveSelection(room, layer, selection, x, y)
local decal = selection.item
decal.x += x
decal.y += y
selection.x += x
selection.y += y
return true
end
function decals.deleteSelection(room, layer, selection)
local targets = decals.getRoomItems(room, layer)
local target = selection.item
for i, decal in ipairs(targets) do
if decal == target then
table.remove(targets, i)
return true
end
end
return false
end
function decals.getPlacements(layer)
local res = {}
local names = decals.getDecalNames()
for i, name in ipairs(names) do
res[i] = {
name = name,
displayName = name,
layer = layer,
placementType = "point",
itemTemplate = {
texture = name,
x = 0,
y = 0,
scaleX = 1,
scaleY = 1
}
}
end
return res
end
function decals.placeItem(room, layer, item)
local items = decals.getRoomItems(room, layer)
table.insert(items, item)
return true
end
-- Returns all decals of room
function decals.getRoomItems(room, layer)
return layer == "decalsFg" and room.decalsFg or room.decalsBg
end
return decals |
-- SHIELD MANAGER
-- Distance from enemies in meters at which to activate shields
ShieldActivationRange = 5000
-- Shield mode to use
-- 1 = Disrupt
-- 2 = Reflect
-- 3 = Laser?
-- nil = Scale strength up or down instead of changing mode
ShieldActivationMode = 2
-- Angle in degrees from a shield's forward vector at which to activate.
-- 135 is conservative, 180 is active all the time (kinda pointless, but
-- saves on ACBs). 90 is probably the sane minimum.
ShieldActivationAngle = 135
-- Delay in seconds before turning off a shield.
ShieldOffDelay = 3
|
--[[ Define the territory permission class metatable. --]]
TERRITORY_CHARTER_CLASS = TERRITORY_CHARTER_CLASS or {__index = TERRITORY_CHARTER_CLASS};
function TERRITORY_CHARTER_CLASS:__call( parameter, failSafe )
return self:Query( parameter, failSafe );
end;
function TERRITORY_CHARTER_CLASS:__tostring()
return "Territory charter ["..self("name").."]["..self("priority").."]";
end;
function TERRITORY_CHARTER_CLASS:IsValid()
return self.data != nil;
end;
function TERRITORY_CHARTER_CLASS:Query( key, failSafe )
if ( self.data and self.data[key] != nil ) then
return self.data[key];
else
return failSafe;
end;
end;
function TERRITORY_CHARTER_CLASS:GetName() return self( "name", "Unknown" ); end;
TERRITORY_CHARTER_CLASS.Name = TERRITORY_CHARTER_CLASS.GetName;
function TERRITORY_CHARTER_CLASS:StoreID() return self( "storeID", "UniqueID" ); end;
function TERRITORY_CHARTER_CLASS:GetPriority() return self( "priority", 1 ); end;
function TERRITORY_CHARTER_CLASS:GetType() return self( "type", "number" ); end;
function TERRITORY_CHARTER_CLASS:Register() return gc.plugin.stored["Territory"].CHARTER:Register( self ); end;
function TERRITORY_CHARTER_CLASS:GetPlayerSID( player )
local SID;
if ( type( player ) == "Player" and player[ self:StoreID() ] ) then
SID = player[ self:StoreID() ]( player );
else
SID = player;
end;
if ( SID != nil ) then
local _type = self:GetType();
if ( _type == "int" or _type == "number" ) then
SID = tonumber( SID );
elseif ( _type == "string" ) then
SID = tostring( SID );
end;
return SID;
end;
end;
function TERRITORY_CHARTER_CLASS:New( tMergeTable )
local object = {
data = {
name = "Unknown",
storeID = "UniqueID",
type = "number",
priority = 1
}
};
if ( tMergeTable ) then
table.Merge( object.data, tMergeTable );
end;
setmetatable( object, self );
self.__index = self;
return object;
end; |
local band = bit.band
local tinsert = table.insert
local tremove = table.remove
local next = next
local strsplit = strsplit
local strfind = strfind
local GetNetStats = GetNetStats
local k,v,_
BossSwingTimer = LibStub("AceAddon-3.0"):NewAddon("BossSwingTimer", "AceConsole-3.0", "AceEvent-3.0")
local BossSwingTimerPath = "Interface\\AddOns\\BossSwingTimer\\"
local BossSwingTimerMediaPath = "Interface\\AddOns\\BossSwingTimer\\Media\\"
local time = GetTime()
local function MergeTables(dst, src)
for k, v in pairs (src) do
if type (v) ~= "table" then
if dst[k] == nil then
dst[k] = v
end
else
if type(dst[k]) ~= "table" then
dst[k] = {}
end
MergeTables(dst[k], v)
end
end
end
local framepoints = {
["CENTER"] = "CENTER",
["TOP"] = "TOP",
["RIGHT"] = "RIGHT",
["BOTTOM"] = "BOTTOM",
["LEFT"] = "LEFT",
["TOPRIGHT"] = "TOPRIGHT",
["TOPLEFT"] = "TOPLEFT",
["BOTTOMLEFT"] = "BOTTOMLEFT",
["BOTTOMRIGHT"] = "BOTTOMRIGHT",
}
local defaults = {
profile = {
enabled = true,
hideooc = false,
showonlyintankspec = false,
frame = {
locked = false,
lag = true,
texture = " Default",
point = {
x = 0,
y = 0,
p = "CENTER",
r = "CENTER",
rf = "UIParent",
},
width = 300,
height = 32,
length = 2500,
scale = 1,
alpha = 0.8,
},
targetbar = {
locked = false,
texture = " Default",
point = {
x = 0,
y = 0,
p = "CENTER",
r = "CENTER",
rf = "UIParent",
},
width = 300,
height = 32,
length = 2.5,
scale = 1,
alpha = 0.8,
},
},
global = {
speeds = {},
},
}
local OptionsSlash = {
type = "group",
name = "Slash Command",
order = -3,
args = {
config = {
type = "execute",
name = "Configure",
desc = "Open the configuration dialog",
func = function() BossSwingTimer:ShowConfig() end,
guiHidden = true,
},
enable = {
type = "execute",
name = "Enable",
desc = "Enable BossSwingTimer",
func = function() BossSwingTimer.db.profile.enabled = true; BossSwingTimer:OnEnable() end,
},
disable = {
type = "execute",
name = "Disable",
desc = "Disable BossSwingTimer",
func = function() BossSwingTimer.db.profile.enabled = false; BossSwingTimer:OnDisable() end,
},
},
}
local tankspec = {
["DEATHKNIGHT"] = 1,
["DRUID"] = 3,
["MONK"] = 1,
["PALADIN"] = 2,
["WARRIOR"] = 3,
}
local unitclass
local function istankspec()
local currentSpec = GetSpecialization() or 0
unitClass = unitClass or select(2, UnitClass("player"))
return currentSpec == tankspec[unitClass]
end
BossSwingTimer.swings = {}
local unitList = {{id = "target", color = {r = 1, g = 0.2, b = 0.2}}, {id = "focus", color = {r = 1, g = 1, b = 0}}}
local function npcid(guid)
return tonumber(guid:sub(-10, -7), 16) -- suppose to do some bit math to get NPC id from GUID. See http://wowwiki.wikia.com/wiki/API_UnitGUID?oldid=2368080
end
local function isnpc(guid)
-- For info on 3.3.5 implementation of GUIDs visit http://wowwiki.wikia.com/wiki/API_UnitGUID?oldid=2368080
-- We need to check the mask for if it's an NPC or not
local B = tonumber(guid:sub(5,5), 16)
local maskedB = B % 8 -- x % 8 has the same effect as x & 0x7 on numbers <= 0xf
if maskedB == 3 then-- 3 is NPC
return true
end
end
local LSM_statusbars
local LSM_statusbars_optionsList
local function createLSMlist()
LSM_statusbars = LibStub:GetLibrary("LibSharedMedia-3.0",true):HashTable("statusbar")
LSM_statusbars[" Default"] = BossSwingTimerMediaPath .. "glaze.tga"
local t = {}
for k,v in pairs(LSM_statusbars) do
t[k] = k
end
LSM_statusbars_optionsList = t
end
function BossSwingTimer:GetOptions()
if not BossSwingTimer.Options then
BossSwingTimer.Options = {
type = "group",
name = "BossSwingTimer",
handler = BossSwingTimer,
set = function(info, value) db[ info[#info] ] = value end,
get = function(info) return db[ info[#info] ] end,
args = {
enabled = {
name = "Enable",
desc = "Enables / disables BossSwingTimer",
order = 0,
type = "toggle",
set = function(info,val)
self.db.profile[info[1]] = val
BossSwingTimer:ToggleEnable()
end,
get = function(info) return self.db.profile[info[1]] end
},
hideooc = {
name = "Hide out of combat",
desc = "Only show the BossSwingTimer when in combat",
order = 0,
type = "toggle",
set = function(info,val)
self.db.profile[info[1]] = val
self:UpdateVisibility()
end,
get = function(info) return self.db.profile[info[1]] end
},
showonlyintankspec = {
name = "Only show in tank spec",
desc = "Only show the BossSwingTimer when in tanking spec",
order = 0,
type = "toggle",
set = function(info,val)
self.db.profile[info[1]] = val
self:UpdateVisibility()
end,
get = function(info) return self.db.profile[info[1]] end
},
frame = {
name = "Frame",
order = 2,
type = "group",
args = {
locked = {
name = "Lock Frame",
desc = "Locks/unlocks the bar (needs to be unchecked to enable dragging/moving)",
order = 0,
type = "toggle",
width = "full",
set = function(info,val)
self.db.profile[info[1]][info[2]] = val
self.bar:EnableMouse(not val)
end,
get = function(info) return self.db.profile[info[1]][info[2]] end
},
lag = {
name = "Show Lag",
desc = "Shows/Hides the lag indicator",
order = 0,
type = "toggle",
width = "full",
set = function(info,val)
self.db.profile[info[1]][info[2]] = val
BossSwingTimer:CreateUI()
end,
get = function(info) return self.db.profile[info[1]][info[2]] end
},
texture = {
name = "Bar Texture",
desc = "The bar's texture",
type = "select",
order = 1.1,
width = "double",
values = function() return LSM_statusbars_optionsList or createLSMlist() end,
set = function(info, val)
self.db.profile[info[1]][info[2]] = val
BossSwingTimer:CreateUI()
end,
get = function(info, val)
return self.db.profile[info[1]][info[2]]
end,
},
description1 = {
name = " ",
order = 1.9,
type = "description",
width = "full",
},
header2 = {
name = "Size / Visuals",
order = 2.0,
type = "header",
width = "full",
},
width = {
name = "Width",
desc = "The bar's width (default: "..defaults.profile.frame.width..")",
order = 2.1,
type = "range",
min = 1,
max = 500,
step = 1,
set = function(info, val)
self.db.profile[info[1]][info[2]] = val;
BossSwingTimer:CreateUI()
end,
get = function(info) return self.db.profile[info[1]][info[2]] end
},
height = {
name = "Height",
desc = "The bar's height (default: "..defaults.profile.frame.height..")",
order = 2.1,
type = "range",
min = 1,
max = 500,
step = 1,
set = function(info, val)
self.db.profile[info[1]][info[2]] = val;
BossSwingTimer:CreateUI()
end,
get = function(info) return self.db.profile[info[1]][info[2]] end
},
scale = {
name = "Scale",
desc = "The bar's scale (default: "..defaults.profile.frame.scale..")",
order = 2.4,
type = "range",
min = 0.2,
max = 2,
step = 0.05,
set = function(info, val)
self.db.profile[info[1]][info[2]] = val;
BossSwingTimer:CreateUI()
end,
get = function(info) return self.db.profile[info[1]][info[2]] end
},
alpha = {
name = "Alpha",
desc = "The bar's width (default: "..defaults.profile.frame.alpha..")",
order = 2.5,
type = "range",
min = 0,
max = 1,
step = 0.05,
set = function(info, val)
self.db.profile[info[1]][info[2]] = val
BossSwingTimer:CreateUI()
end,
get = function(info) return self.db.profile[info[1]][info[2]] end
},
length = {
name = "Time frame (seconds)",
desc = "Defines the maximum duration displayed on the bar (default: "..(defaults.profile.frame.length/1000).." seconds)",
order = 2.6,
type = "range",
min = 1,
max = 5,
step = 0.1,
set = function(info, val)
self.db.profile[info[1]][info[2]] = val*1000
BossSwingTimer:CreateUI()
end,
get = function(info) return self.db.profile[info[1]][info[2]]/1000 end
},
description2 = {
name = " ",
order = 2.9,
type = "description",
width = "full",
},
point = {
type = "group",
order = 3,
name = "Position",
inline = true,
args = {
p = {
name = "Point",
desc = "",
type = "select",
order = 1.1,
values = framepoints,
set = function(info, val)
self.db.profile[info[1]][info[2]][info[3]] = val
BossSwingTimer:CreateUI()
end,
get = function(info, val)
return self.db.profile[info[1]][info[2]][info[3]]
end,
},
r = {
name = "Relative Point",
desc = "",
type = "select",
order = 1.2,
values = framepoints,
set = function(info, val)
self.db.profile[info[1]][info[2]][info[3]] = val
BossSwingTimer:CreateUI()
end,
get = function(info, val)
return self.db.profile[info[1]][info[2]][info[3]]
end,
},
rf = {
name = "Relative Frame",
desc = "",
type = "input",
order = 1.3,
width = "full",
set = function(info, val)
if not val or not _G[val] then
val = "UIParent"
end
self.db.profile[info[1]][info[2]][info[3]] = val
BossSwingTimer:CreateUI()
end,
get = function(info, val)
return self.db.profile[info[1]][info[2]][info[3]]
end,
},
description1 = {
name = " ",
order = 1.4,
type = "description",
width = "full",
},
x = {
name = "X offset",
desc = "Modifies the horizontal position",
order = 2.1,
type = "range",
min = -1000,
max = 1000,
step = 1,
set = function(info, val)
self.db.profile[info[1]][info[2]][info[3]] = val
BossSwingTimer:CreateUI()
end,
get = function(info) return self.db.profile[info[1]][info[2]][info[3]] end
},
y = {
name = "Y offset",
desc = "Modifies the vertical position",
order = 2.1,
type = "range",
min = -1000,
max = 1000,
step = 1,
set = function(info, val)
self.db.profile[info[1]][info[2]][info[3]] = val
BossSwingTimer:CreateUI()
end,
get = function(info) return self.db.profile[info[1]][info[2]][info[3]] end
},
},
},
},
},
profile = {
name = "Profile",
order = -1,
type = "group",
args = {
},
},
}
}
end
BossSwingTimer.Options.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
return BossSwingTimer.Options
end
function BossSwingTimer:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("BossSwingTimerDB", defaults, true)
BossSwingTimer:GetOptions() --create options
local LibDualSpec = LibStub("LibDualSpec-1.0")
LibDualSpec:EnhanceDatabase(self.db, "BossSwingTimer")
LibDualSpec:EnhanceOptions(self.Options.args.profile, self.db)
self.db.RegisterCallback(self, "OnProfileChanged", "ToggleEnable")
self.db.RegisterCallback(self, "OnProfileCopied", "ToggleEnable")
self.db.RegisterCallback(self, "OnProfileReset", "ToggleEnable")
LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("BossSwingTimer", BossSwingTimer:GetOptions())
LibStub("AceConfig-3.0"):RegisterOptionsTable("BossSwingTimer SlashCommand", OptionsSlash, {"bossswingtimer", "bst"})
end
function BossSwingTimer:ToggleEnable()
if self.db.profile.enabled then
self:OnEnable()
else
self:OnDisable()
end
end
function BossSwingTimer:OnEnable()
if (LSM_statusbars == nil) then
createLSMlist()
end
if not self.db.profile.enabled then return end
self:CreateUI()
self:UpdateVisibility()
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:RegisterEvent("PLAYER_FOCUS_CHANGED")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self.bar:SetScript("OnShow", function() time = GetTime() end)
end
function BossSwingTimer:UpdateVisibility()
if (self.db.profile.hideooc and not InCombatLockdown())
or (self.db.profile.showonlyintankspec and not istankspec()) then
self.bar:Hide()
else
self.bar:Show()
end
end
function BossSwingTimer:OnDisable()
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:UnregisterEvent("PLAYER_TARGET_CHANGED")
self:UnregisterEvent("PLAYER_FOCUS_CHANGED")
self:UnregisterEvent("PLAYER_REGEN_DISABLED")
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
self.bar:SetScript("OnUpdate", nil)
self.bar:Hide()
end
function BossSwingTimer:ShowConfig()
LibStub("AceConfigDialog-3.0"):Open("BossSwingTimer")
end
function BossSwingTimer:CreateUI()
local bartexture = LSM_statusbars[self.db.profile.frame.texture]
if not self.bar then
self.bar = CreateFrame("Frame", "BossSwingTimerBar", UIParent)
self.bar:EnableMouse(true)
self.bar:SetMovable(true)
self.bar:SetResizable(true)
self.bar:SetScript("OnMouseDown", function()
if not self.db.profile.frame.locked then
self.bar:StartMoving()
end
end)
self.bar:SetScript("OnMouseUp", function()
if not self.db.profile.frame.locked then
self.bar:StopMovingOrSizing()
self.db.profile.frame.point.p, _, self.db.profile.frame.point.r, self.db.profile.frame.point.x, self.db.profile.frame.point.y = self.bar:GetPoint()
LibStub("AceConfigRegistry-3.0"):NotifyChange("BossSwingTimer")
end
end)
end
if not self.bar.lag then
self.bar.lag = self.bar:CreateTexture(nil, "BACKGROUND")
self.bar.lag:SetPoint("TOPLEFT", self.bar, "TOPLEFT", 0, 0)
self.bar.lag:SetPoint("BOTTOMLEFT", self.bar, "BOTTOMLEFT", 0, 0)
end
self.bar.lag:SetWidth(1)
self.bar.lag:SetTexture(bartexture)
self.bar.lag:SetVertexColor(0.6, 0.0, 0.0)
self.bar.lag:SetAlpha(self.db.profile.frame.alpha)
if not self.bar.background then
self.bar.background = self.bar:CreateTexture(nil, "BACKGROUND")
end
self.bar.background:SetTexture(bartexture)
self.bar.background:SetVertexColor(0.4, 0.4, 0.4)
self.bar.background:SetAlpha(self.db.profile.frame.alpha)
if self.db.profile.frame.lag then
self.bar.background:ClearAllPoints()
self.bar.background:SetPoint("TOPLEFT", self.bar.lag, "TOPRIGHT", 0, 0)
self.bar.background:SetPoint("BOTTOMRIGHT", self.bar, "BOTTOMRIGHT", 0, 0)
self.bar.lag:Show()
else
self.bar.background:ClearAllPoints()
self.bar.background:SetPoint("TOPLEFT", self.bar, "TOPLEFT", 0, 0)
self.bar.background:SetPoint("BOTTOMRIGHT", self.bar, "BOTTOMRIGHT", 0, 0)
self.bar.background:SetTexCoord(0,1,0,1)
self.bar.lag:Hide()
end
if self.db.profile.frame.locked then
self.bar:EnableMouse(false)
end
self.bar:SetScript("OnUpdate", function(f,elapsed) self:OnUpdate(elapsed) end)
--[[
if not self.bar.grip then
self.bar.grip = CreateFrame("Frame", nil, self.bar)
end
if not self.bar.grip.tex then
self.bar.grip.tex = self.bar.grip:CreateTexture(nil, "OVERLAY")
self.bar.grip:SetPoint("BOTTOMRIGHT", self.bar, "BOTTOMRIGHT", 0, 0)
end
self.bar.grip:SetSize(10, 10)
self.bar.grip:EnableMouse(true)
self.bar.grip:SetScript("OnMouseDown", function()
if not self.db.profile.frame.locked then
self.bar:StartSizing("BOTTOMRIGHT")
end
end)
self.bar.grip:SetScript("OnMouseUp", function()
if not self.db.profile.frame.locked then
self.bar:StopMovingOrSizing()
self.db.profile.frame.width = self.bar:GetWidth()
self.db.profile.frame.height = self.bar:GetHeight()
end
end)
self.bar.grip.tex:SetAllPoints()
self.bar.grip.tex:SetAlpha(0)
self.bar.grip:Show()
]]
self.bar:SetSize(self.db.profile.frame.width, self.db.profile.frame.height)
self.bar:SetScale(self.db.profile.frame.scale)
self.bar:ClearAllPoints()
self.bar:SetPoint(self.db.profile.frame.point.p, self.db.profile.frame.point.rf, self.db.profile.frame.point.r, self.db.profile.frame.point.x, self.db.profile.frame.point.y)
end
function BossSwingTimer:UpdateAttackSpeeds()
for _, u in ipairs(unitList) do
local uid = UnitGUID(u.id)
if uid and isnpc(uid) then
local speed = UnitAttackSpeed(u.id)
if speed then
self.db.global.speeds[npcid(uid)] = {value = speed, api = true}
end
end
end
end
function BossSwingTimer:OnSwing(time, guid)
time = time
self:UpdateAttackSpeeds()
local id = npcid(guid)
self.swings[guid] = self.swings[guid] or {}
local prev = self.swings[guid].time
self.swings[guid].time = time
local speed = nil
if prev and (time - prev) < 5 then
speed = time - prev
end
if self.db.global.speeds[id] and self.db.global.speeds[id].api then
speed = self.db.global.speeds[id].value
elseif speed then
self.db.global.speeds[id] = {value = speed}
end
if speed then
self.swings[guid].next = time + speed
end
end
-- gui --
BossSwingTimer.texpool = {}
function BossSwingTimer:CreateTick()
if #self.texpool > 0 then
return tremove(self.texpool)
end
local result = self.bar:CreateTexture(nil, "ARTWORK")
result:SetTexture(BossSwingTimerMediaPath .. "tick.tga")
result:SetTexCoord(0.40625, 0.5625, 0, 1)
result:SetPoint("TOP", self.bar, "TOP", 0, 0)
result:SetPoint("BOTTOM", self.bar, "BOTTOM", 0, 0)
result:SetWidth(5)
return result
end
function BossSwingTimer:RecycleTick(tex)
tinsert(self.texpool, tex)
tex:Hide()
end
local special = {}
local alpha = 1
local color = {r = 0.7, g = 0.7, b = 0.7}
function BossSwingTimer:OnUpdate(elapsed)
for _, u in ipairs(unitList) do
local uid = UnitGUID(u.id)
if uid then
special[uid] = u.color
end
end
--GetNetStats only has 3 parameters in 3.3.5. Not important though. jitter is what we need but can't get that so I'm removing lag bar functionality
local lag = 0
local length = self.db.profile.frame.length / 1000
for k, v in pairs(self.swings) do
if not v.next or v.next < GetTime() then
v.next = nil
if v.tick then
self:RecycleTick(v.tick)
v.tick = nil
end
end
end
for k, v in pairs(self.swings) do
if v.next and v.next < GetTime() + length then
if not v.tick then
v.tick = self:CreateTick()
end
local c
if special[k] then
c = special[k]
else
c = color
end
v.tick:SetVertexColor(c.r, c.g, c.b, alpha)
v.tick:SetPoint("LEFT", self.bar, "LEFT", (v.next - GetTime()) / length * self.db.profile.frame.width, 0)
if special[k] then
v.tick:SetDrawLayer("ARTWORK", 2)
else
v.tick:SetDrawLayer("ARTWORK", 0)
end
v.tick:Show()
end
end
for k,v in pairs(special) do
special[k] = nil
end
end
---------
local events = {
["SWING_DAMAGE"] = true,
["SWING_MISSED"] = true,
["UNIT_DIED"] = true,
}
function BossSwingTimer:COMBAT_LOG_EVENT_UNFILTERED(mainevent, timestamp, event, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, ...)
if not events[event] then
return
end
if sourceGUID == "0x0000000000000000" or sourceGUID == nil or sourceName == nil then
return
end --check for environmental damage
if (event == "SWING_DAMAGE" or event == "SWING_MISSED") and isnpc(sourceGUID) then
self:OnSwing(GetTime(), sourceGUID)
elseif event == "UNIT_DIED" then
local v = BossSwingTimer.swings[destGUID]
if v and v.tick then
self:RecycleTick(v.tick)
v.tick = nil
end
BossSwingTimer.swings[destGUID] = nil --remove the UnitGUID from the table if the unit dies
end
end
function BossSwingTimer:PLAYER_REGEN_DISABLED()
if not (self.db.profile.showonlyintankspec and not istankspec()) then
self.bar:Show()
end
end
function BossSwingTimer:PLAYER_REGEN_ENABLED()
if self.db.profile.hideooc then
self.bar:Hide()
end
end
BossSwingTimer.PLAYER_TARGET_CHANGED = BossSwingTimer.UpdateAttackSpeeds
BossSwingTimer.PLAYER_FOCUS_CHANGED = BossSwingTimer.UpdateAttackSpeeds
|
--[[
Game World
]]
local lib
local world
world = {
screen_width = 0,
screen_height = 0,
time = 0,
shaking = false,
entities = {},
update = function(self, event)
self.camera:update(event)
self.character:update(event)
for key, entity in next, self.entities do
entity:update(event)
end
self.time = self.time + event.delta
if (not self.camera.freelook) then
self.camera.x = self.character.x
self.camera.y = self.character.y
end
end,
draw = function(self, event)
self:draw_start()
self.map_manage:draw()
self.character:draw()
for key, entity in next, self.entities do
entity:draw(event)
end
self:draw_end()
end,
keydown = function(self, event)
self.camera:keydown(event)
if (event.key == " ") then
self:interact()
end
end,
set_active = function(self, state)
self.state.update = state
self.state.draw = state
self.state.keydown = state
end,
screen_to_world = function(self, x, y)
x = x + math.floor(self.camera.x) - self.halfwidth
y = -y + math.floor(self.camera.y) + self.halfheight
return x, y
end,
world_to_grid = function(self, x, y)
local tile_drawn = self.map_manage.tile_scale * self.map_manage.tile_size
return math.ceil(x / tile_drawn), math.ceil(y / tile_drawn)
end,
grid_to_world = function(self, x, y)
local tile_drawn = self.map_manage.tile_scale * self.map_manage.tile_size
return x * tile_drawn - tile_drawn / 2, y * tile_drawn - tile_drawn / 2
end,
draw_start = function(self)
love.graphics.setColor(255, 255, 255)
love.graphics.push()
love.graphics.translate(-math.floor(self.camera.x) + self.halfwidth, math.floor(self.camera.y) + self.halfheight)
love.graphics.scale(1, -1)
if (self.shaking) then
love.graphics.rotate(math.sin(self.time * 3) * 0.02)
end
end,
draw_end = function(self)
love.graphics.pop()
love.graphics.setColor(255, 255, 255)
end,
interact = function(self)
local x, y = self.character.x, self.character.y
local direction = lib.utility.round(self.character.mr * 2 / math.pi) + 2
local x, y = self:world_to_grid(x, y)
if (direction == 0 or direction == 4) then
x = x - 1
elseif (direction == 3) then
y = y + 1
elseif (direction == 2) then
x = x + 1
elseif (direction == 1) then
y = y - 1
end
self.map_manage:do_interact(x, y)
end,
new = function(self, game)
local instance = self:_new()
instance.game = game
instance.camera = lib.game.camera:new()
instance.width = love.graphics.getWidth()
instance.height = love.graphics.getHeight()
instance.halfwidth = instance.width / 2
instance.halfheight = instance.height / 2
instance.map_manage = lib.game.map_manage:new(instance)
instance.map_manage:load_tiles()
instance.character = lib.game.character:new(instance)
return instance
end,
init = function(self, engine)
engine:lib_get("game.asset")
engine:lib_get("game.camera")
engine:lib_get("game.map_manage")
engine:lib_get("game.character")
lib = engine.lib
lib.oop:objectify(self)
end
}
return world |
object_tangible_quest_avatar_storage_case = object_tangible_quest_shared_avatar_storage_case:new {
}
ObjectTemplates:addTemplate(object_tangible_quest_avatar_storage_case, "object/tangible/quest/avatar_storage_case.iff")
|
--[[ vim.g.nvim_tree_indent_markers = 1
vim.g.nvim_tree_hide_dotfiles = 1 ]]
vim.g.nvim_tree_git_hl = 1
vim.g.nvim_tree_root_folder_modifier = ":~:."
-- vim.g.nvim_tree_ignore = { ".git", "node_modules", ".cache" }
vim.cmd("let g:nvim_tree_show_icons = {'git': 0, 'folders': 1, 'files': 1}")
vim.api.nvim_set_keymap("n", "<leader>tt", ":NvimTreeToggle<cr>", { silent = true })
vim.api.nvim_set_keymap("n", "<leader>tr", ":NvimTreeRefresh<cr>", { silent = true })
vim.api.nvim_set_keymap("n", "<leader>tn", ":NvimTreeFindFile<cr>", { silent = true })
local tree_cb = require("nvim-tree.config").nvim_tree_callback
-- default mappings
-- vim.g.nvim_tree_disable_default_keybindings = 1
require("nvim-tree").setup({
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
ignore_ft_on_setup = {},
hide_dotfiles = true,
ignore = { ".git", "node_modules", ".cache" },
auto_close = false,
open_on_tab = false,
hijack_cursor = true,
update_cwd = true,
-- lsp_diagnostics = true,
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {},
},
system_open = {
cmd = nil,
args = {},
},
filters = {
dotfiles = false,
custom = {},
},
update_focused_file = {
enable = true,
update_cwd = true,
},
view = {
auto_resize = true,
mappings = {
custom_only = false,
list = {
{ key = { "l", "<Cr>", "<2-LeftMouse>", "o" }, cb = tree_cb("edit") },
{ key = { "<2-RightMouse>", "<C-]>", "O" }, cb = tree_cb("cd") },
{ key = "<C-v>", cb = tree_cb("vsplit") },
{ key = "<C-x>", cb = tree_cb("split") },
{ key = "<C-t>", cb = tree_cb("tabnew") },
{ key = "<", cb = tree_cb("prev_sibling") },
{ key = ">", cb = tree_cb("next_sibling") },
{ key = "P", cb = tree_cb("parent_node") },
{ key = "<BS>", cb = tree_cb("close_node") },
{ key = "<S-CR>", cb = tree_cb("close_node") },
{ key = "<Tab>", cb = tree_cb("preview") },
{ key = "K", cb = tree_cb("first_sibling") },
{ key = "J", cb = tree_cb("last_sibling") },
{ key = "I", cb = tree_cb("toggle_ignored") },
{ key = "H", cb = tree_cb("toggle_dotfiles") },
{ key = "R", cb = tree_cb("refresh") },
{ key = "a", cb = tree_cb("create") },
{ key = "d", cb = tree_cb("remove") },
{ key = "r", cb = tree_cb("rename") },
{ key = "<C-r>", cb = tree_cb("full_rename") },
{ key = "x", cb = tree_cb("cut") },
{ key = "c", cb = tree_cb("copy") },
{ key = "p", cb = tree_cb("paste") },
{ key = "y", cb = tree_cb("copy_name") },
{ key = "Y", cb = tree_cb("copy_path") },
{ key = "gy", cb = tree_cb("copy_absolute_path") },
{ key = "[c", cb = tree_cb("prev_git_item") },
{ key = "]c", cb = tree_cb("next_git_item") },
{ key = "<C-[>", cb = tree_cb("dir_up") },
{ key = "q", cb = tree_cb("close") },
{ key = "g?", cb = tree_cb("toggle_help") },
},
},
},
})
|
-- pgproc module
--
-- © 2010, 2013 David J Goehrig <dave@dloh.org>
--
-- Copyright (c) 2010, 2013, David J Goehrig <dave@dloh.org>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-- following conditions are met:
--
-- Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-- disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
-- the following disclaimer in the documentation and/or other materials provided with the distribution.
--
-- Neither the name of the project nor the names of its contributors may be used to endorse or promote products derived
-- from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--
module("pgproc",package.seeall)
local pg = {}
local ffi = require('ffi')
ffi.cdef([[
typedef enum { CONNECTION_OK, CONNECTION_BAD, CONNECTION_STARTED, CONNECTION_MADE, CONNECTION_AWAITING_RESPONSE, CONNECTION_AUTH_OK, CONNECTION_SETENV, CONNECTION_SSL_STARTUP, CONNECTION_NEEDED } ConnStatusType;
typedef enum { PGRES_EMPTY_QUERY = 0, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PGRES_COPY_OUT, PGRES_COPY_IN, PGRES_BAD_RESPONSE, PGRES_NONFATAL_ERROR, PGRES_COPY_BOTH } ExecStatusType;
typedef struct pg_conn PGconn;
typedef struct pg_result PGresult;
typedef struct pg_cancel PGcancel;
typedef char pqbool;
typedef struct pgNotify { char *relname; int be_pid; char *extra; struct pgNotify *next; } PGnotify;
typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res);
typedef void (*PQnoticeProcessor) (void *arg, const char *message);
extern PGconn *PQconnectdb(const char *conninfo);
extern void PQfinish(PGconn *conn);
extern void PQclear(PGresult *res);
extern void PQfreemem(void *ptr);
extern ExecStatusType PQresultStatus(const PGresult *res);
extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
extern char *PQresultErrorMessage(const PGresult *res);
extern PGresult *PQexec(PGconn *conn, const char *query);
extern ExecStatusType PQresultStatus(const PGresult *res);
extern int PQntuples(const PGresult *res);
extern int PQnfields(const PGresult *res);
extern char *PQfname(const PGresult *res, int field_num);
extern size_t PQescapeStringConn(PGconn *conn,char *to, const char *from, size_t length, int *error);
extern ConnStatusType PQstatus(const PGconn *conn);
]])
local sql = ffi.load('libpq')
pg.ffi = ffi
pg.sql = sql
pg.connection = nil
function pg.connect(connstr)
pg.connstr = connstr or os.getenv('DB_CONNECT_STRING')
pg.connection = sql.PQconnectdb(pg.connstr)
if not sql.PQstatus(pg.connection) == sql.CONNECTION_OK then
pg.connection = nil
return nil
end
end
function pg.reset()
sql.PQclear(pg.result)
pg.result = nil
end
function pg.error()
return ffi.string(sql.PQresultErrorMessage(pg.result))
end
function pg.query(Q)
if not pg.connection then pg.connect() end
if pg.result then pg.reset() end
pg.result = sql.PQexec(pg.connection,Q)
pg.status = sql.PQresultStatus(pg.result)
if pg.status == sql.PGRES_EMPTY_QUERY or pg.status == sql.PGRES_COMMAND_OK then
pg.reset()
return 0
end
if pg.status == sql.PGRES_TUPLES_OK then
return sql.PQntuples(pg.result)
end
print(pg.error())
pg.reset()
return -1
end
function pg.fields()
if not pg.result then return 0 end
return sql.PQnfields(pg.result)
end
function pg.field(I)
if not pg.result then return nil end
return ffi.string(sql.PQfname(pg.result,I))
end
function pg.fetch(Row,Column)
if not pg.result then return nil end
return ffi.string(sql.PQgetvalue(pg.result,Row,Column))
end
function pg.close()
sql.PQfinish(pg.connection)
pg.connection = nil
pg.reset()
end
function pg.quote(S)
if not pg.connection then return nil end
local error = ffi.new('int[1]')
local buffer = ffi.new('char[?]', 2*#S)
local len = sql.PQescapeStringConn(pg.connection,buffer,S,#S,error)
if error[0] then
print("Failed to escape " .. S)
return nil
end
return ffi.string(buffer,len)
end
function pg.bind(schema)
local query = "select proc.proname::text from pg_proc proc join pg_namespace namesp on proc.pronamespace = namesp.oid where namesp.nspname = '" .. schema .. "'"
_G[schema] = {}
local rows = pg.query(query)
if rows < 0 then
print(pg.error())
return -1
end
local i = 0
while i < rows do
local proc = pg.fetch(i,0);
local F = function()
local query = "select * from " .. schema .. "." .. proc .. "('"
return function(...)
local Q = query .. table.concat({...},"','") .."')"
local rows = pg.query(Q)
local R = {}
local k,j = 0,0
while k < rows do
while j < pg.fields() do
local key = pg.field(j)
local value = pg.fetch(k,j)
R[key] = value
j = j+1
end
k = k+1
end
return R
end
end
_G[schema][proc] = F()
i = i+1
end
end
return pg
|
Config = {}
Config.DrawDistance = 100
Config.Size = {x = 1.5, y = 1.5, z = 1.5}
Config.Color = {r = 0, g = 128, b = 255}
Config.Type = 1
Config.Locale = 'en'
Config.Zones = {
Liquor = {
Items = {},
Pos = {
{x = 127.830, y = -1284.796, z = 28.280}, --StripClib
{x = -1393.409, y = -606.624, z = 29.319}, --Bahamamas
{x = -559.906, y = 287.093, z = 81.176}, --Tequilala
{x = 1986.18, y = 3054.31, z = 46.32}
}
}
}
|
local assert = require("luassert.assert")
--[[
LibWhoMock is a mock for LibWho
It has an :ExpectWho method to construct a list of expected calls and their return values
And an :Assert to assert that all expected calls were consumed
]]--
---@class LibWhoMock
local LibWhoMock = {}
LibWhoMock.__index = LibWhoMock
setmetatable(LibWhoMock, {
__call = function(cls, ...)
return cls.new(...)
end,
})
function LibWhoMock.new()
local self = setmetatable({}, LibWhoMock)
self.expectedCalls = {}
return self
end
function LibWhoMock:Who(min, max, cb)
print("LibWhoMock:Who(" .. min .. ", " .. max .. ")")
assert.is_true(#self.expectedCalls > 0, "no expected calls remaining")
local expectedCall = table.remove(self.expectedCalls, 1)
assert.equals(expectedCall.min, min, "call to who() with unexpected min")
assert.equals(expectedCall.max, max, "call to who() with unexpected max")
cb(min .. "-" .. max, expectedCall.result, expectedCall.complete)
end
function LibWhoMock:ExpectWho(min, max, complete, result)
table.insert(self.expectedCalls, {min = min, max = max, complete = complete, result = result})
end
function LibWhoMock:Assert()
assert.equals(#self.expectedCalls, 0, "not all expected calls consumed")
end
return LibWhoMock
|
return {
{
name = "2019-03-06-111650_init_rbac",
up = [[
CREATE TABLE IF NOT EXISTS rbac_resources (
"id" uuid PRIMARY KEY,
"service_id" uuid REFERENCES services (id) ON DELETE CASCADE,
"route_id" uuid REFERENCES routes (id) ON DELETE CASCADE,
"method" varchar(255),
"upstream_path" varchar(255),
"description" varchar(255),
visibility varchar(15) default('protected'),
created_at timestamp without time zone default (CURRENT_TIMESTAMP(0) at time zone 'utc'),
UNIQUE(service_id, route_id, method, upstream_path)
);
CREATE INDEX IF NOT EXISTS "rbac_resources_service_id_idx" ON "rbac_resources" ("service_id");
CREATE INDEX IF NOT EXISTS "rbac_resources_route_id_idx" ON "rbac_resources" ("route_id");
CREATE TABLE IF NOT EXISTS rbac_roles (
"id" uuid PRIMARY KEY,
consumer_id uuid REFERENCES consumers (id) ON DELETE CASCADE,
"name" varchar(50) NOT NULL UNIQUE,
"disabled" boolean NOT NULL,
"description" varchar(255),
created_at timestamp without time zone default (CURRENT_TIMESTAMP(0) at time zone 'utc')
);
CREATE TABLE IF NOT EXISTS rbac_role_resources (
"id" uuid PRIMARY KEY,
role_id uuid REFERENCES rbac_roles (id) ON DELETE CASCADE,
resource_id uuid REFERENCES rbac_resources (id) ON DELETE CASCADE,
UNIQUE(role_id, resource_id)
);
CREATE TABLE IF NOT EXISTS rbac_role_consumers (
"id" uuid PRIMARY KEY,
consumer_id uuid REFERENCES consumers (id) ON DELETE CASCADE,
role_id uuid REFERENCES rbac_roles (id) ON DELETE CASCADE,
UNIQUE(consumer_id, role_id)
);
]],
down = [[
DROP TABLE rbac_role_resources;
DROP TABLE rbac_role_consumers;
DROP TABLE rbac_resources;
DROP TABLE rbac_roles;
]]
},
{
name = "2018-05-22-182310_rbac_credentials",
up = [[
CREATE TABLE IF NOT EXISTS rbac_credentials(
id uuid,
consumer_id uuid REFERENCES consumers (id) ON DELETE CASCADE,
key text UNIQUE,
created_at timestamp without time zone default (CURRENT_TIMESTAMP(0) at time zone 'utc'),
expired_at timestamp without time zone,
PRIMARY KEY (id)
);
DO $$
BEGIN
IF (SELECT to_regclass('rbac_key_idx')) IS NULL THEN
CREATE INDEX rbac_key_idx ON rbac_credentials(key);
END IF;
IF (SELECT to_regclass('rbac_consumer_idx')) IS NULL THEN
CREATE INDEX rbac_consumer_idx ON rbac_credentials(consumer_id);
END IF;
END$$;
]],
down = [[
DROP TABLE rbac_credentials;
]]
}
}
|
-- This is a part of uJIT's testing suite.
-- Copyright (C) 2020-2021 LuaVela Authors. See Copyright Notice in COPYRIGHT
-- Copyright (C) 2015-2020 IPONWEB Ltd. See Copyright Notice in COPYRIGHT
--
-- Ensure VM state is switched correctly with fast functions
--
local aux = require('profile_aux')
assert(ujit.profile.init() == true)
-- Following call is wrapped into a fast function intentionally.
-- VM state switch should be handled correctly on return from fast functions.
-- If everything is done properly, profiler should definitely count something
-- inside TRACE or LFUNC state.
assert(ujit.profile.start(10, 'default') == true)
local sum = 0
for i = 1, 1E8 do
sum = sum + i
end
print(sum)
local counters = aux.stop_and_terminate_profiling()
if jit.status() then
assert(counters.TRACE > 0)
else
assert(counters.LFUNC > 0)
end
|
function LiveMixin:AddHealth(health, playSound, noArmor, hideEffect, healer, armorScalar)
if not armorScalar then
armorScalar = kArmorHealScalar
end
if self.OnAddHealth then self:OnAddHealth() end
-- TakeDamage should be used for negative values.
assert(health >= 0)
local total = 0
if self.GetCanBeHealed and not self:GetCanBeHealed() then
return 0
end
if self.ModifyHeal then
local healTable = { health = health }
self:ModifyHeal(healTable)
health = healTable.health
end
if healer and healer.ModifyHealingDone then
health = healer:ModifyHealingDone(health)
end
if self:AmountDamaged() > 0 then
health = self:ClampHealing( health, noArmor, healer)
-- Add health first, then armor if we're full
local healthAdded = math.min(health, self:GetMaxHealth() - self:GetHealth())
self:SetHealth(math.min(math.max(0, self:GetHealth() + healthAdded), self:GetMaxHealth()))
local healthToAddToArmor = 0
if not noArmor then
healthToAddToArmor = health - healthAdded
if healthToAddToArmor > 0 then
self:SetArmor(math.min(math.max(0, self:GetArmor() + healthToAddToArmor * armorScalar ), self:GetMaxArmor()), hideEffect)
end
end
total = healthAdded + healthToAddToArmor
if total > 0 then
if Server then
local time = Shared.GetTime()
if not hideEffect then
self.timeLastVisuallyHealed = time
end
self.timeLastHealed = time
end
end
end
if total > 0 and self.OnHealed then
self:OnHealed()
end
return total
end
|
#!/usr/bin/env texlua
-- Build script for "xcolor" files
-- Identify the bundle and module
bundle = ""
module = "xcolor"
installfiles = {"svgnam.def", "x11nam.def", "xcolor.pro", "xcolor.sty"}
sourcefiles = {"xcolor.dtx", "xcolor.ins"}
unpackfiles = {"xcolor.ins"}
-- Get the .pro files in the right place
tdslocations = {"dvips/xcolor/xcolor.pro"}
function typeset_xcolor2 (f)
typesetexe='latex'
cp('xcolor2.tex',unpackdir,'.')
tex(f)
tex(f)
runcmd('dvips xcolor2')
runcmd('ps2pdf -dALLOWPSTRANSPARENCY xcolor2.ps')
cp('xcolor2.pdf','.',ctandir .. '/xcolor')
rm('.','xcolor2.tex')
rm(ctandir .. '/xcolor','xcolor2.tex')
return 0
end
typesetfiles={"xcolor.dtx","xcolor2.tex"}
specialtypesetting={}
specialtypesetting['xcolor2.tex'] = {func = typeset_xcolor2}
textfiles= {"ChangeLog", "README"}
|
tinkering.tools = {
pick = {
description = "Pickaxe",
groups = {"cracky"},
fleshy_decrement = 1,
components = {
main = "pickaxe_head",
binding = "tool_binding",
rod = "tool_rod"
},
textures = {
main = "tinkering_pickaxe_head.png",
second = "tinkering_overlay_handle_pickaxe.png",
offset = "1,-1"
}
},
axe = {
description = "Axe",
groups = {"choppy"},
fleshy_increment = 1,
components = {
main = "axe_head",
binding = "tool_binding",
rod = "tool_rod"
},
textures = {
main = "tinkering_axe_head.png",
second = "tinkering_overlay_handle_axe.png",
offset = "1,-3"
}
},
sword = {
description = "Sword",
groups = {"snappy"},
fleshy_decrement = 0,
components = {
main = "sword_blade",
binding = "tool_binding",
rod = "tool_rod"
},
textures = {
main = "tinkering_sword_blade.png",
second = "tinkering_overlay_handle_sword.png",
offset = "0,0"
}
},
shovel = {
description = "Shovel",
groups = {"crumbly"},
fleshy_decrement = 1,
components = {
main = "shovel_head",
binding = "tool_binding",
rod = "tool_rod"
},
textures = {
main = "tinkering_shovel_head.png",
second = "tinkering_overlay_handle_shovel.png",
offset = "3,-3"
}
},
}
tinkering.components = {
pickaxe_head = {description = "%s Pickaxe Head", material_cost = 2, image = tinkering.tools.pick.textures.main},
axe_head = {description = "%s Axe Head", material_cost = 2, image = tinkering.tools.axe.textures.main},
sword_blade = {description = "%s Sword Blade", material_cost = 2, image = tinkering.tools.sword.textures.main},
shovel_head = {description = "%s Shovel Head", material_cost = 2, image = tinkering.tools.shovel.textures.main},
tool_rod = {description = "%s Tool Rod", material_cost = 1, image = "tinkering_tool_rod.png"},
tool_binding = {description = "%s Tool Binding", material_cost = 2, image = "tinkering_tool_binding.png"}
}
-- Create component for material
function tinkering.create_material_component(data)
local desc = data.description
local name = data.name
local mod = data.mod_name
local groups = {tinker_component = 1}
groups["tc_"..data.component] = 1
groups["material_"..data.metal] = 1
minetest.register_craftitem(mod..":"..name, {
description = desc,
groups = groups,
inventory_image = data.image
})
end
-- Register a tool type
--
--data = {
-- description = "Pickaxe", -- Name (description) of the tool
-- groups = {"cracky"}, -- Group caps that apply
-- mod = "tinkering", -- The mod you're registering this tool from
-- fleshy_decrement = 1, -- Amount removed from base damage group "fleshy". Negative value adds.
-- components = {
-- main = "pickaxe_head", -- Name of the primary component
-- binding = "tool_binding", -- Second component
-- rod = "tool_rod" -- Mandatory rod component
-- },
-- textures = {
-- main = "tinkering_pickaxe_head.png", -- Head (main) Texture
-- second = "tinkering_overlay_handle_pickaxe.png", -- Overlay (typically a handle)
-- offset = "1,-1" -- Head's offset on the texture
-- }
--}
--
function tinkering.register_tool_type(name, data)
tinkering.tools[name] = data
end
-- Create groups based on materials
local function apply_modifiers(materials, basegroup, dgroup)
local tags = {}
local groups = {}
local incr = 0.00
local uses = 0
local dmg = {}
-- Apply material modifiers
for m, v in pairs(materials) do
local material = tinkering.materials[v]
local mod = material.modifier
if m ~= "main" then
if mod[m] then
local mp = mod[m]
if mp.increase then
incr = incr + mp.increase
end
if mp.uses then
uses = uses + mp.uses
end
if mp.damage then
for g,mod in pairs(mp.damage) do
if dmg[g] == nil or dmg[g] < mod then
dmg[g] = mod
end
end
end
end
end
-- Apply tags
if mod.tags then
for _,t in pairs(mod.tags) do
if tags[t.name] == nil then
tags[t.name] = t.description
end
end
end
end
-- Apply modified to base groups
for grp, d in pairs(basegroup) do
groups[grp] = d
for id,val in pairs(d.times) do
groups[grp].times[id] = val + (incr / id)
end
groups[grp].uses = d.uses + uses
end
-- Apply damage group modifications
for g,l in pairs(dgroup) do
if dmg[g] == nil or dmg[g] < l then
dmg[g] = l
end
end
return groups, dmg, tags
end
-- Generate a tool texture based on tool type, main material (head) and rod material (handle).
function tinkering.compose_tool_texture(tooltype, main, rod)
local mat_main = tinkering.materials[main]
local mat_rod = tinkering.materials[rod]
local tool_data = tinkering.tools[tooltype].textures
return tinkering.combine_textures(tool_data.main, tool_data.second, mat_main.color, mat_rod.color, tool_data.offset)
end
local function quickcopy(t)
local res = {}
for i, v in pairs(t) do
res[i] = v
end
return res
end
-- Generate tool capabilities based on tool type and materials
function tinkering.get_tool_capabilities(tool_type, materials)
if not materials["main"] or not materials["rod"] then
return nil
end
-- Get main material
local main = tinkering.materials[materials.main]
if not main then return nil end
-- Tool data
local tool_data = tinkering.tools[tool_type]
-- Name of the tool
local name = tool_data.description or "Tool"
-- Group copies
local groups = {}
local dgroups = {}
-- Copy the damage groups
for g,v in pairs(main.modifier.damagegroups) do
-- Decrement/increment damage group if tool wants it
if tool_data[g.."_decrement"] then
dgroups[g] = v - tool_data[g.."_decrement"]
elseif tool_data[g.."_increment"] then
dgroups[g] = v + tool_data[g.."_increment"]
else
dgroups[g] = v
end
end
-- Type specific groups and modifiers
for _,v in pairs(tool_data.groups) do
if main.modifier[v] then
groups[v] = quickcopy(main.modifier[v])
end
end
-- Apply all modifiers
local fg, fd, tags = apply_modifiers(materials, groups, dgroups)
local tool_caps = {
full_punch_interval = 1.0,
max_drop_level = 0,
groupcaps = fg,
damage_groups = fd,
}
-- Construct the name
name = main.name.." "..name
return tool_caps, name, tags
end
-- Return tool definition
function tinkering.tool_definition(tool_type, materials)
if not materials["main"] or not materials["rod"] then
return nil
end
local capabilities, name, tags = tinkering.get_tool_capabilities(tool_type, materials)
if not capabilities then return nil end
local tool_tree = {
description = name,
tool_capabilities = capabilities,
groups = {tinker_tool = 1, ["mainly_"..materials.main] = 1, ["tinker_"..tool_type] = 1, not_in_creative_inventory = 1},
inventory_image = tinkering.compose_tool_texture(tool_type, materials.main, materials.rod)
}
return tool_tree, tags
end
-- Compare provided components to the required components of this tool
local function compare_components_required(tool_spec, materials)
local all_match = true
for i, v in pairs(tool_spec) do
if not materials[i] then
all_match = false
end
end
for i, v in pairs(materials) do
if not tool_spec[i] then
all_match = false
end
end
return all_match
end
-- Create a new tool based on parameters specified.
function tinkering.create_tool(tool_type, materials, want_tool, custom_name, overrides)
-- TODO: Add texture as metadata (https://github.com/minetest/minetest/issues/5686)
-- Not a valid tool type
if not tinkering.tools[tool_type] then return nil end
local tool_data = tinkering.tools[tool_type]
-- Check if the components are correct
if not compare_components_required(tool_data.components, materials) then return nil end
-- Get tool definition and other metadata
local tool_def, tags = tinkering.tool_definition(tool_type, materials)
if not tool_def then return nil end
local mod_name = tool_data.mod or "tinkering"
-- Apply overrides
if overrides then
for i, v in pairs(overrides) do
tool_def[i] = v
end
end
-- Use custom name
if custom_name ~= nil and custom_name ~= "" then
tool_def.description = custom_name
end
-- Create internal name
local internal_name = mod_name..":"..materials.main.."_"..tool_type
-- Register base tool if it doesnt exist already
if not minetest.registered_items[internal_name] and minetest.get_current_modname() then
minetest.register_tool(internal_name, tool_def)
end
if not want_tool then return nil end
-- Store materials to use in metadata
local mat_names = ""
local i = 1
for name, mat in pairs(materials) do
if i == 1 then
mat_names = name.."="..mat
else
mat_names = mat_names..","..name.."="..mat
end
i = i + 1
end
-- Add components to description
local description = tool_def.description
description = description.."\n"
for cmp, mat in pairs(materials) do
local mat = tinkering.materials[mat]
local comp = tool_data.components[cmp]
local desc = tinkering.components[comp].description:format(mat.name)
description = description .. "\n" .. minetest.colorize(mat.color, desc)
end
-- Add tags to description
description = description.."\n"
for _,tag in pairs(tags) do
description = description .. "\n" .. tag
end
-- Create a new tool instance and apply metadata
local tool = ItemStack(internal_name)
local meta = tool:get_meta()
meta:set_string("description", description)
meta:set_string("texture_string", tool_def.inventory_image) -- NOT IMPLEMENTED YET!
meta:set_tool_capabilities(tool_def.tool_capabilities)
meta:set_string("materials", mat_names)
if tool_def["wear"] then
tool:set_wear(tool_def.wear)
end
return tool
end
-- Register new tool material
function tinkering.register_material_tool(material)
for t,_ in pairs(tinkering.tools) do
tinkering.create_tool(t, {main=material,binding="wood",rod="wood"}, false, nil)
end
end
-- Register a new tool component
function tinkering.register_component(name, data)
local mod = data.mod_name or minetest.get_current_modname()
if not tinkering.components[name] then
tinkering.components[name] = data
end
local comp_desc = data.description:sub(4)
-- Register cast
metal_melter.set_spec(name, metal_caster.spec.cast)
metal_caster.register_cast(name, {
description = comp_desc,
mod_name = mod,
result = name,
cost = data.material_cost,
typenames = {name}
})
-- Register pattern
tinkering.register_pattern(name, {
description = comp_desc,
cost = data.material_cost,
mod_name = mod
})
-- Register components for all materials
for m, s in pairs(tinkering.materials) do
local component = m.."_"..name
tinkering.create_material_component({
name = component,
component = name,
metal = m,
mod_name = mod,
description = data.description:format(s.name),
image = tinkering.color_filter(data.image, s.color)
})
-- Make all components meltable
metal_melter.register_melt(mod..":"..component, m, name)
end
end
|
package("libsvm")
set_homepage("https://github.com/cjlin1/libsvm")
set_description("A simple, easy-to-use, and efficient software for SVM classification and regression")
add_urls("https://github.com/cjlin1/libsvm/archive/refs/tags/$(version).tar.gz",
"https://github.com/cjlin1/libsvm.git")
add_versions("v325", "1f587ec0df6fd422dfe50f942f8836ac179b0723b768fe9d2fabdfd1601a0963")
on_install(function (package)
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
target("svm")
set_kind("$(kind)")
add_files("svm.cpp")
add_headerfiles("svm.h")
if is_kind("shared") then
add_shflags("/DEF:svm.def")
end
]])
local configs = {}
if package:config("shared") then
configs.kind = "shared"
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("svm_train", {includes = "svm.h"}))
end)
|
function compile_lua(filename)
if file.open(filename .. ".lua") then
file.close()
node.compile(filename .. ".lua")
file.remove(filename .. ".lua")
return true
else
return false
end
end
function run_lc(filename)
if file.open( filename .. ".lc" ) then
file.close()
dofile( filename .. ".lc" )
return true
else
print( filename .. ".lc not found." )
return false
end
end
function run_lua(filename)
if file.open( filename .. ".lua" ) then
file.close()
dofile( filename .. ".lua" )
return true
else
print( filename .. ".lua not found." )
return false
end
end
function wifi_monitor(config)
local connected = false
local retry = 0
tmr.alarm (0, 1000, tmr.ALARM_AUTO, function ()
if wifi.sta.getip ( ) == nil then
print ("Waiting for WLAN connection to '" ..cfg.wifi.ssid.."'")
retry = retry+1
gpio.write(0,1-gpio.read(0));
if(retry > 10) then node.restart() end
if connected == true then
connected = false
node.restart()
end
else
if connected ~= true then
connected = true
gpio.write( 0,0 )
print( "WLAN - connected" )
print( "IP: " .. wifi.sta.getip() )
print( "Hostname: " .. wifi.sta.gethostname() )
print( "Channel: " .. wifi.getchannel() )
print( "Signal Strength: " .. wifi.sta.getrssi())
for _, item in ipairs(cfg.runnables.active) do
if pcall(run_lc, item) then
print("starting "..item)
else
print('Error running '..item)
end
end
end
if cfg.ntp.server and cfg.ntp.synced == false then
sntp.sync(cfg.ntp.server,
function(sec,usec,server)
tm = rtctime.epoch2cal(rtctime.get())
date =string.format("%04d-%02d-%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"])
print(string.format("ntp sync with %s ok: %s UTC/GMT", server, date))
cfg.ntp.synced = true
end,
function(err)
print('failed! '..err)
cfg.ntp.synced = false
end
)
end
end
end)
end
-- ### main part
local cfg_file = "config"
-- compile config file
compile_lua(cfg_file)
-- load config from file
if run_lc(cfg_file) == false then
print( "Config file not found. Using default values." )
cfg={}
cfg.wifi={}
cfg.wifi.ssid="home"
cfg.wifi.pwd="00000000"
cfg.wifi.save=true
cfg.hostname = "node01"
cfg.runnables = {}
cfg.runnables.sources = {}
cfg.ntp = {}
cfg.ntp.server = false
end
cfg.runnables.active = {}
cfg.ntp.synced = false
for _, item in ipairs(cfg.runnables.sources) do
print("preparing "..item)
local status, error = pcall(compile_lua, item)
if status == true then
table.insert(cfg.runnables.active, item)
else
print('Error compiling '..item..": "..error)
end
end
-- setup general configuration
wifi.sta.sethostname( cfg.hostname )
-- Connect to existing station given in config
wifi.setmode( wifi.STATION )
wifi.sta.config( cfg.wifi )
wifi.sta.connect()
sensordata = {}
sensordata.outside = {}
-- monitor wifi connection and show status via LED
wifi_monitor()
collectgarbage()
|
local function _0_(mode, x, y, dx, dy, r)
love.graphics.rotate(r)
love.graphics.ellipse(mode, x, y, dx, dy)
return love.graphics.origin() end return {ellipse = _0_}
|
local AS = unpack(AddOnSkins)
function AS:Blizzard_AzeriteUI(event, addon)
if addon ~= 'Blizzard_AzeriteUI' then return end
AS:SkinFrame(AzeriteEmpoweredItemUI)
AzeriteEmpoweredItemUI.BorderFrame.portrait:SetAlpha(0)
AzeriteEmpoweredItemUI.ClipFrame.BackgroundFrame.Bg:Hide()
AzeriteEmpoweredItemUI.ClipFrame.BackgroundFrame.KeyOverlay.Shadow:Hide()
AS:SkinCloseButton(AzeriteEmpoweredItemUICloseButton)
AS:UnregisterSkinEvent(addon, event)
end
function AS:Blizzard_AzeriteRespecUI(event, addon)
if addon ~= 'Blizzard_AzeriteRespecUI' then return end
local AzeriteRespecFrame = _G["AzeriteRespecFrame"]
AzeriteRespecFrame:SetClipsChildren(true)
AzeriteRespecFrame.Background:Hide()
AS:SkinFrame(AzeriteRespecFrame)
AS:SkinCloseButton(AzeriteRespecFrame.CloseButton)
local Lines = select(23, AzeriteRespecFrame:GetRegions())
Lines:ClearAllPoints()
Lines:SetPoint("TOPLEFT", -50, 25)
Lines:SetPoint("BOTTOMRIGHT")
Lines:SetTexture([[Interface\Transmogrify\EtherealLines]], true, true)
Lines:SetHorizTile(true)
Lines:SetVertTile(true)
Lines:SetAlpha(0.5)
local ItemSlot = AzeriteRespecFrame.ItemSlot
AS:CreateBackdrop(ItemSlot)
AS:SkinTexture(ItemSlot.Icon)
ItemSlot:SetSize(64, 64)
ItemSlot:SetPoint("CENTER", AzeriteRespecFrame)
ItemSlot.Icon:SetInside()
ItemSlot.GlowOverlay:SetAlpha(0)
ItemSlot.Backdrop:SetBackdropColor(.6, 0, .6, .5)
local ButtonFrame = AzeriteRespecFrame.ButtonFrame
ButtonFrame:GetRegions():Hide()
ButtonFrame.ButtonBorder:Hide()
ButtonFrame.ButtonBottomBorder:Hide()
ButtonFrame.MoneyFrameEdge:Hide()
ButtonFrame.MoneyFrame:ClearAllPoints()
ButtonFrame.MoneyFrame:SetPoint("BOTTOMRIGHT", ButtonFrame.MoneyFrameEdge, 7, 5)
AS:SkinButton(ButtonFrame.AzeriteRespecButton)
AS:UnregisterSkinEvent(addon, event)
end
function AS:Blizzard_IslandsPartyPoseUI(event, addon)
if addon ~= 'Blizzard_IslandsPartyPoseUI' then return end
AS:SkinBackdropFrame(IslandsPartyPoseFrame)
AS:SkinButton(IslandsPartyPoseFrame.LeaveButton)
AS:UnregisterSkinEvent(addon, event)
end
function AS:Blizzard_IslandsQueueUI(event, addon)
if addon ~= 'Blizzard_IslandsQueueUI' then return end
AS:SkinBackdropFrame(IslandsQueueFrame)
IslandsQueueFrame.ArtOverlayFrame.PortraitFrame:SetAlpha(0)
IslandsQueueFrame.ArtOverlayFrame.portrait:SetAlpha(0)
IslandsQueueFrame.portrait:Hide()
AS:SkinCloseButton(IslandsQueueFrame.CloseButton)
AS:SkinButton(IslandsQueueFrame.DifficultySelectorFrame.QueueButton)
IslandsQueueFrame.WeeklyQuest.OverlayFrame:StripTextures()
IslandsQueueFrame.WeeklyQuest.StatusBar:CreateBackdrop("Default")
--StatusBar Icon
AS:SkinTexture(IslandsQueueFrame.WeeklyQuest.QuestReward.Icon)
AS:SkinButton(IslandsQueueFrame.TutorialFrame.Leave)
AS:SkinCloseButton(IslandsQueueFrame.TutorialFrame.CloseButton)
AS:Kill(IslandsQueueFrame.HelpButton)
AS:UnregisterSkinEvent(addon, event)
end
function AS:Blizzard_ScrappingMachineUI(event, addon)
if addon ~= 'Blizzard_ScrappingMachineUI' then return end
AS:SkinBackdropFrame(ScrappingMachineFrame)
AS:SkinCloseButton(ScrappingMachineFrame.CloseButton)
AS:SkinButton(ScrappingMachineFrame.ScrapButton, true)
AS:StripTextures(ScrappingMachineFrame.ItemSlots)
for button in pairs(ScrappingMachineFrame.ItemSlots.scrapButtons.activeObjects) do
AS:SkinFrame(button)
AS:SkinTexture(button.Icon)
button.IconBorder:SetAlpha(0)
hooksecurefunc(button.IconBorder, 'SetVertexColor', function(self, r, g, b) button:SetBackdropBorderColor(r, g, b) end)
hooksecurefunc(button.IconBorder, 'Hide', function() button:SetBackdropBorderColor(unpack(AS.BorderColor)) end)
end
AS:UnregisterSkinEvent(addon, event)
end
function AS:Blizzard_WarboardUI(event, addon)
if addon ~= 'Blizzard_WarboardUI' then return end
local WarboardQuestChoiceFrame = _G["WarboardQuestChoiceFrame"]
WarboardQuestChoiceFrame:StripTextures()
WarboardQuestChoiceFrame:CreateBackdrop("Transparent")
WarboardQuestChoiceFrame.BorderFrame:Hide()
WarboardQuestChoiceFrame.BorderFrame.Header:SetAlpha(0)
WarboardQuestChoiceFrame.Background:Hide()
WarboardQuestChoiceFrame.Title:DisableDrawLayer("BACKGROUND")
for i = 1, 4 do
local option = WarboardQuestChoiceFrame["Option"..i]
for x = 1, #option.OptionButtonsContainer.Buttons do
AS:SkinButton(option.OptionButtonsContainer.Buttons[x])
end
end
AS:SkinCloseButton(WarboardQuestChoiceFrame.CloseButton)
hooksecurefunc(WarboardQuestChoiceFrame, "Update", function()
local numOptions = WarboardQuestChoiceFrame:GetNumOptions();
for i = 1, numOptions do
local option = WarboardQuestChoiceFrame.Options[i];
option.Background:Hide()
option.ArtworkBorder:Hide()
AS:CreateBackdrop(option.Artwork)
option.OptionText:SetTextColor(1, 1, 1)
if option.WidgetContainer then
AS:SkinWidgetContainer(option.WidgetContainer)
end
end
end)
AS:UnregisterSkinEvent(addon, event)
end
function AS:Blizzard_WarfrontsPartyPoseUI(event, addon)
if addon ~= 'Blizzard_WarfrontsPartyPoseUI' then return end
AS:SkinBackdropFrame(WarfrontsPartyPoseFrame)
AS:SkinBackdropFrame(WarfrontsPartyPoseFrame.ModelScene)
AS:SkinButton(WarfrontsPartyPoseFrame.LeaveButton)
AS:CreateBackdrop(WarfrontsPartyPoseFrame.RewardAnimations.RewardFrame)
WarfrontsPartyPoseFrame.RewardAnimations.RewardFrame.Backdrop:SetPoint("TOPLEFT", -5, 5)
WarfrontsPartyPoseFrame.RewardAnimations.RewardFrame.Backdrop:SetPoint("BOTTOMRIGHT", WarfrontsPartyPoseFrame.RewardAnimations.RewardFrame.NameFrame, 0, -5)
WarfrontsPartyPoseFrame.RewardAnimations.RewardFrame.NameFrame:SetAlpha(0)
WarfrontsPartyPoseFrame.RewardAnimations.RewardFrame.IconBorder:SetAlpha(0)
AS:SkinTexture(WarfrontsPartyPoseFrame.RewardAnimations.RewardFrame.Icon)
AS:UnregisterSkinEvent(addon, event)
end
AS:RegisterSkin("Blizzard_AzeriteRespecUI", AS.Blizzard_AzeriteRespecUI, 'ADDON_LOADED')
AS:RegisterSkin("Blizzard_AzeriteUI", AS.Blizzard_AzeriteUI, 'ADDON_LOADED')
AS:RegisterSkin("Blizzard_IslandsPartyPoseUI", AS.Blizzard_IslandsPartyPoseUI, 'ADDON_LOADED')
AS:RegisterSkin("Blizzard_IslandsQueueUI", AS.Blizzard_IslandsQueueUI, 'ADDON_LOADED')
AS:RegisterSkin('Blizzard_ScrappingMachineUI', AS.Blizzard_ScrappingMachineUI, 'ADDON_LOADED')
AS:RegisterSkin("Blizzard_WarboardUI", AS.Blizzard_WarboardUI, 'ADDON_LOADED')
AS:RegisterSkin("Blizzard_WarfrontsPartyPoseUI", AS.Blizzard_WarfrontsPartyPoseUI, 'ADDON_LOADED')
|
require( "iuplua" )
list_len = 1
selected = 1
list = iup.list { "Test", expand = "Yes", value = "Test" }
new_entry_text = iup.text { expand = "Yes", value = "?" }
button_add = iup.button { title = "Add list entry", expand = "Yes" }
button_del = iup.button { title = "Delete list entry", expand = "Yes" }
function list:action( item, index, sel )
if sel == 1 then
selected = index
end
return iup.DEFAULT
end
function button_add:action()
list[ list_len + 1 ] = new_entry_text.value
list_len = list_len + 1
list[ list_len + 1 ] = nil
return iup.DEFAULT
end
-- TODO: Currently, the 'selected' value jumps to the last
-- element in the list after deleting the value.
function button_del:action()
if list_len == 0 then return iup.DEFAULT end
for i = selected,list_len do
list[ i ] = list[ i + 1 ]
end
list_len = list_len - 1
list[ list_len + 1 ] = nil
return iup.DEFAULT
end
button_box = iup.hbox { button_add, button_del }
dialog_box = iup.vbox { list, new_entry_text, button_box }
dialog = iup.dialog { dialog_box;
title = "List manipulation test",
size = "QuarterxQuarter"
}
dialog:show()
iup.MainLoop()
|
lk = {}
require 'lk.Autoload'
local Autoload = lk.Autoload
lk = lk.Autoload('lk')
lk.Autoload = Autoload
-- autoload stuff in _G
lk.Autoload.global()
require 'lk.core_c'
local time_ref = lk.TimeRef()
function elapsed()
return time_ref:elapsed()
end
now = elapsed
function lk.bitTest(flags, bit)
-- flags = [ 0 1 1 0 1 ] = 13
-- bit = [ 0 0 1 0 0 ] = 4
-- 2bit = [ 0 1 0 0 0 ] = 8
-- 13 % (2*bit) => remove all bits above bit.
return flags % (2*bit) >= bit
end
local CALL_TO_NEW = {__call = function(lib, ...) return lib.new(...) end}
function class(class_name, tbl)
local lib = tbl or {}
lib.type = class_name
lib.__index = lib
local base, klass = string.match(class_name, '^(.+)%.(.+)$')
klass = klass or class_name
if base and _G[base] then
_G[base][klass] = lib
end
return setmetatable(lib, CALL_TO_NEW)
end
|
local LIBBATTLE, VERSION = "LibBattle", 1
assert(LibStub, LIBBATTLE .. " requires LibStub")
local libBattle = LibStub:NewLibrary(LIBBATTLE, VERSION)
_G[LIBBATTLE] = LibBattle
|
-- Define variables
ABsummoner = {}
ABsummoner.Raid = {}
ABsummoner.TriggerWord = "TRIGGER WORD DISABLED"
absummon_hakkar_time = ""
absummon_dire_maul_time = ""
absummon_songflower_time = ""
absummon_dragonslayer_time = ""
absummon_auto_promote = true
absummon_auto_invite = false
absummon_mark_summoner = false
function ABsummoner.MakeFrame()
ABsummoner.LootFrame = {}
ABsummoner.LootFrame = CreateFrame("frame", "ABsummonerLootFrame", UIParent)
ABsummoner.LootFrame:SetWidth(1)
ABsummoner.LootFrame:SetHeight(1)
ABsummoner.LootFrame:SetMovable(true)
ABsummoner.LootFrame:EnableMouse(true)
ABsummoner.LootFrame:SetFrameStrata("LOW")
--ABsummoner.LootFrame:Hide()
ABsummoner.LootFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0)
ABsummoner.LootFrame:SetScript("OnMouseDown", function(self, button)
if button == "LeftButton" then
ABsummoner.LootFrame:StartMoving();
ABsummoner.LootFrame.isMoving = true;
end
end)
ABsummoner.LootFrame:SetScript("OnMouseUp", function(self, button)
if button == "LeftButton" and ABsummoner.LootFrame.isMoving then
ABsummoner.LootFrame:StopMovingOrSizing();
ABsummoner.LootFrame.isMoving = false;
ABsummon1.Settings.Left = ABsummoner.LootFrame:GetLeft()
ABsummon1.Settings.Top = ABsummoner.LootFrame:GetTop() - GetScreenHeight()
ABsummoner.LootFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", ABsummon1.Settings.Left, ABsummon1.Settings.Top)
end
end)
ABsummoner.LootFrame:SetScript("OnHide", function(self)
if ( ABsummoner.LootFrame.isMoving ) then
ABsummoner.LootFrame:StopMovingOrSizing();
ABsummoner.LootFrame.isMoving = false;
ABsummon1.Settings.Left = ABsummoner.LootFrame:GetLeft()
ABsummon1.Settings.Top = ABsummoner.LootFrame:GetTop() - GetScreenHeight()
ABsummoner.LootFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", ABsummon1.Settings.Left, ABsummon1.Settings.Top)
end
end)
ABsummoner.LootFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", ABsummon1.Settings.Left, ABsummon1.Settings.Top)
ABsummoner.LootFrame["TopGuildFrame"] = CreateFrame("frame", "LootPasserTopFrame", ABsummoner.LootFrame)
ABsummoner.LootFrame["TopGuildFrame"]:SetWidth(100)
ABsummoner.LootFrame["TopGuildFrame"]:SetHeight(70)
ABsummoner.LootFrame["TopGuildFrame"]:SetPoint("TOPLEFT", ABsummoner.LootFrame, "TOPLEFT",0,0)
ABsummoner.LootFrame["TopGuildFrame"]:SetScale(1)
ABsummoner.LootFrame["TopGuildFrame"]:SetBackdrop( {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 5, edgeSize = 15, insets = { left = 1, right = 1, top = 1, bottom = 1 }
});
ABsummoner.LootFrame["TopGuildFrame"]:SetMovable(true)
ABsummoner.LootFrame["TopGuildFrame"]:EnableMouse(true)
ABsummoner.LootFrame["TopGuildFrame"]:SetScript("OnMouseDown", function(self, button)
if button == "LeftButton" then
ABsummoner.LootFrame:StartMoving();
ABsummoner.LootFrame.isMoving = true;
end
end)
ABsummoner.LootFrame["TopGuildFrame"]:SetScript("OnMouseUp", function(self, button)
if button == "LeftButton" and ABsummoner.LootFrame.isMoving then
ABsummoner.LootFrame:StopMovingOrSizing();
ABsummoner.LootFrame.isMoving = false;
ABsummon1.Settings.Left = ABsummoner.LootFrame:GetLeft()
ABsummon1.Settings.Top = ABsummoner.LootFrame:GetTop() - GetScreenHeight()
ABsummoner.LootFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", ABsummon1.Settings.Left, ABsummon1.Settings.Top)
end
end)
ABsummoner.LootFrame["TopGuildFrame"]:SetScript("OnHide", function(self)
if ( ABsummoner.LootFrame.isMoving ) then
ABsummoner.LootFrame:StopMovingOrSizing();
ABsummoner.LootFrame.isMoving = false;
ABsummon1.Settings.Left = ABsummoner.LootFrame:GetLeft()
ABsummon1.Settings.Top = ABsummoner.LootFrame:GetTop() - GetScreenHeight()
ABsummoner.LootFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", ABsummon1.Settings.Left, ABsummon1.Settings.Top)
end
end)
ABsummoner.LootFrame.TopGuildFrame.Button2 = CreateFrame("Button", "CRI_InvButtsaon2", ABsummoner.LootFrame.TopGuildFrame)
ABsummoner.LootFrame.TopGuildFrame.Button2:SetPoint("TOPRIGHT",ABsummoner.LootFrame.TopGuildFrame,"TOPRIGHT",0,10)
ABsummoner.LootFrame.TopGuildFrame.Button2:SetWidth(35)
ABsummoner.LootFrame.TopGuildFrame.Button2:SetHeight(20)
ABsummoner.LootFrame.TopGuildFrame.Button2:SetText("Clear")
ABsummoner.LootFrame.TopGuildFrame.Button2:SetParent(ABsummoner.LootFrame.TopGuildFrame)
ABsummoner.LootFrame.TopGuildFrame.Button2:SetNormalFontObject("GameFontNormal")
ABsummoner.LootFrame.TopGuildFrame.Button2ntex = ABsummoner.LootFrame.TopGuildFrame.Button2:CreateTexture()
ABsummoner.LootFrame.TopGuildFrame.Button2ntex:SetTexture("Interface/Buttons/UI-Panel-Button-Up")
ABsummoner.LootFrame.TopGuildFrame.Button2ntex:SetTexCoord(0, 0.625, 0, 0.6875)
ABsummoner.LootFrame.TopGuildFrame.Button2ntex:SetAllPoints()
ABsummoner.LootFrame.TopGuildFrame.Button2:SetNormalTexture(ABsummoner.LootFrame.TopGuildFrame.Button2ntex)
ABsummoner.LootFrame.TopGuildFrame.Button2pdis = ABsummoner.LootFrame.TopGuildFrame.Button2:CreateTexture()
ABsummoner.LootFrame.TopGuildFrame.Button2pdis:SetTexture("Interface/Buttons/UI-Panel-Button-Disabled")
ABsummoner.LootFrame.TopGuildFrame.Button2pdis:SetTexCoord(0, 0.625, 0, 0.6875)
ABsummoner.LootFrame.TopGuildFrame.Button2pdis:SetAllPoints()
ABsummoner.LootFrame.TopGuildFrame.Button2:SetDisabledTexture(ABsummoner.LootFrame.TopGuildFrame.Button2pdis)
ABsummoner.LootFrame.TopGuildFrame.Button2htex = ABsummoner.LootFrame.TopGuildFrame.Button2:CreateTexture()
ABsummoner.LootFrame.TopGuildFrame.Button2htex:SetTexture("Interface/Buttons/UI-Panel-Button-Highlight")
ABsummoner.LootFrame.TopGuildFrame.Button2htex:SetTexCoord(0, 0.625, 0, 0.6875)
ABsummoner.LootFrame.TopGuildFrame.Button2htex:SetAllPoints()
ABsummoner.LootFrame.TopGuildFrame.Button2:SetHighlightTexture(ABsummoner.LootFrame.TopGuildFrame.Button2htex)
ABsummoner.LootFrame.TopGuildFrame.Button2ptex = ABsummoner.LootFrame.TopGuildFrame.Button2:CreateTexture()
ABsummoner.LootFrame.TopGuildFrame.Button2ptex:SetTexture("Interface/Buttons/UI-Panel-Button-Down")
ABsummoner.LootFrame.TopGuildFrame.Button2ptex:SetTexCoord(0, 0.625, 0, 0.6875)
ABsummoner.LootFrame.TopGuildFrame.Button2ptex:SetAllPoints()
ABsummoner.LootFrame.TopGuildFrame.Button2:SetPushedTexture(ABsummoner.LootFrame.TopGuildFrame.Button2ptex)
ABsummoner.LootFrame.TopGuildFrame.Button2:SetScript("OnClick", function(self, arg1)
ABsummoner.whotosummon = nil
ABsummoner.CheckRaid()
end)
for h=1, 20 do
ABsummoner.LootFrame.TopGuildFrame[h] = {}
ABsummoner.LootFrame.TopGuildFrame[h].Button = CreateFrame("Button", "ABmyButtonzz"..h, ABsummoner.LootFrame.TopGuildFrame, "SecureActionButtonTemplate");
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetPoint("TOPRIGHT",ABsummoner.LootFrame.TopGuildFrame,"TOPRIGHT",-10,-((h*25)-15))
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetWidth(80)
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetHeight(25)
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetText("Zyrreal")
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetNormalFontObject("GameFontNormal")
ABsummoner.LootFrame.TopGuildFrame[h].Buttonntex = ABsummoner.LootFrame.TopGuildFrame[h].Button:CreateTexture()
ABsummoner.LootFrame.TopGuildFrame[h].Buttonntex:SetTexture("Interface/Buttons/UI-Panel-Button-Up")
ABsummoner.LootFrame.TopGuildFrame[h].Buttonntex:SetTexCoord(0, 0.625, 0, 0.6875)
ABsummoner.LootFrame.TopGuildFrame[h].Buttonntex:SetAllPoints()
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetNormalTexture(ABsummoner.LootFrame.TopGuildFrame[h].Buttonntex)
ABsummoner.LootFrame.TopGuildFrame[h].Buttonhtex = ABsummoner.LootFrame.TopGuildFrame[h].Button:CreateTexture()
ABsummoner.LootFrame.TopGuildFrame[h].Buttonhtex:SetTexture("Interface/Buttons/UI-Panel-Button-Highlight")
ABsummoner.LootFrame.TopGuildFrame[h].Buttonhtex:SetTexCoord(0, 0.625, 0, 0.6875)
ABsummoner.LootFrame.TopGuildFrame[h].Buttonhtex:SetAllPoints()
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetHighlightTexture(ABsummoner.LootFrame.TopGuildFrame[h].Buttonhtex)
ABsummoner.LootFrame.TopGuildFrame[h].Buttonptex = ABsummoner.LootFrame.TopGuildFrame[h].Button:CreateTexture()
ABsummoner.LootFrame.TopGuildFrame[h].Buttonptex:SetTexture("Interface/Buttons/UI-Panel-Button-Down")
ABsummoner.LootFrame.TopGuildFrame[h].Buttonptex:SetTexCoord(0, 0.625, 0, 0.6875)
ABsummoner.LootFrame.TopGuildFrame[h].Buttonptex:SetAllPoints()
ABsummoner.LootFrame.TopGuildFrame[h].Buttonpdis = ABsummoner.LootFrame.TopGuildFrame[h].Button:CreateTexture()
ABsummoner.LootFrame.TopGuildFrame[h].Buttonpdis:SetTexture("Interface/Buttons/UI-Panel-Button-Disabled")
ABsummoner.LootFrame.TopGuildFrame[h].Buttonpdis:SetTexCoord(0, 0.625, 0, 0.6875)
ABsummoner.LootFrame.TopGuildFrame[h].Buttonpdis:SetAllPoints()
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetDisabledTexture(ABsummoner.LootFrame.TopGuildFrame[h].Buttonpdis)
ABsummoner.LootFrame.TopGuildFrame[h].Button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetPushedTexture(ABsummoner.LootFrame.TopGuildFrame[h].Buttonptex)
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetAttribute("type1", "macro");
-- ABsummoner.LootFrame.TopGuildFrame[h].Button:SetAttribute("macrotext", "/target party1 \n/cast Ritual of Summoning")
ABsummoner.LootFrame.TopGuildFrame[h].Button:SetAttribute("macrotext", "/target party1")
ABsummoner.LootFrame["TopGuildFrame"]:SetHeight(20+h*25)
ABsummoner.LootFrame.TopGuildFrame[h].Time = CreateFrame("frame", "LootPasserTopFramett"..h, ABsummoner.LootFrame.TopGuildFrame)
ABsummoner.LootFrame.TopGuildFrame[h].Time:SetWidth(50)
ABsummoner.LootFrame.TopGuildFrame[h].Time:SetHeight(25)
ABsummoner.LootFrame.TopGuildFrame[h].Time:SetPoint("TOPLEFT", ABsummoner.LootFrame.TopGuildFrame, "TOPRIGHT",0,-((h*25)-15))
ABsummoner.LootFrame.TopGuildFrame[h].Time:SetBackdrop( {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 5, edgeSize = 15, insets = { left = 1, right = 1, top = 1, bottom = 1 }
});
ABsummoner.LootFrame.TopGuildFrame[h].Time:SetMovable(true)
ABsummoner.LootFrame.TopGuildFrame[h].Time:EnableMouse(true)
ABsummoner.LootFrame.TopGuildFrame[h].Time:SetScript("OnMouseDown", function(self, button)
if button == "LeftButton" then
ABsummoner.LootFrame:StartMoving();
ABsummoner.LootFrame.isMoving = true;
end
end)
ABsummoner.LootFrame.TopGuildFrame[h].Time:SetScript("OnMouseUp", function(self, button)
if button == "LeftButton" and ABsummoner.LootFrame.isMoving then
ABsummoner.LootFrame:StopMovingOrSizing();
ABsummoner.LootFrame.isMoving = false;
ABsummon1.Settings.Left = ABsummoner.LootFrame:GetLeft()
ABsummon1.Settings.Top = ABsummoner.LootFrame:GetTop() - GetScreenHeight()
ABsummoner.LootFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", ABsummon1.Settings.Left, ABsummon1.Settings.Top)
end
end)
ABsummoner.LootFrame.TopGuildFrame[h].Time:SetScript("OnHide", function(self)
if ( ABsummoner.LootFrame.isMoving ) then
ABsummoner.LootFrame:StopMovingOrSizing();
ABsummoner.LootFrame.isMoving = false;
ABsummon1.Settings.Left = ABsummoner.LootFrame:GetLeft()
ABsummon1.Settings.Top = ABsummoner.LootFrame:GetTop() - GetScreenHeight()
ABsummoner.LootFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", ABsummon1.Settings.Left, ABsummon1.Settings.Top)
end
end)
ABsummoner.LootFrame.TopGuildFrame[h].Time["FS"] = ABsummoner.LootFrame.TopGuildFrame[h].Time:CreateFontString("ABLootS1TGFss"..h,"ARTWORK", "ChatFontNormal")
ABsummoner.LootFrame.TopGuildFrame[h].Time["FS"]:SetParent(ABsummoner.LootFrame.TopGuildFrame[h].Time)
ABsummoner.LootFrame.TopGuildFrame[h].Time["FS"]:SetPoint("TOP",ABsummoner.LootFrame.TopGuildFrame[h].Time,"TOP",0,0)
ABsummoner.LootFrame.TopGuildFrame[h].Time["FS"]:SetWidth(150)
ABsummoner.LootFrame.TopGuildFrame[h].Time["FS"]:SetHeight(25)
ABsummoner.LootFrame.TopGuildFrame[h].Time["FS"]:SetJustifyH("CENTER")
ABsummoner.LootFrame.TopGuildFrame[h].Time["FS"]:SetFontObject("GameFontNormalSmall")
ABsummoner.LootFrame.TopGuildFrame[h].Time["FS"]:SetText("time")
end
end
function ABsummoner.CheckRange()
for AAPC_index2,AAPC_value2 in pairs(ABsummoner.whotosummon) do
if (IsSpellInRange("Unending Breath", AAPC_index2) == 1) then
ABsummoner.whotosummon[AAPC_index2] = nil
end
end
local sddssd = 0
for AAPC_index2,AAPC_value2 in pairs(ABsummoner.whotosummon) do
sddssd = 1
break
end
if (sddssd == 0) then
ABsummoner.whotosummon = nil
end
end
function ABsummoner.CheckRaid()
for h=1, 20 do
ABsummoner.LootFrame.TopGuildFrame[h].Button:Hide()
ABsummoner.LootFrame.TopGuildFrame[h].Time:Hide()
ABsummoner.LootFrame.TopGuildFrame[h].Button:Enable()
end
ABsummoner.LootFrame.TopGuildFrame.Button2:Enable()
if (ABsummoner.whotosummon) then
local derpz = 0
for AAPC_Name,AAPC_Lootz in ABsummoner.pairsByKeys(ABsummoner.whotosummon) do
derpz = derpz + 1
ABsummoner.LootFrame.TopGuildFrame[derpz].Button:SetText(AAPC_Name)
ABsummoner.LootFrame.TopGuildFrame[derpz].Button:Show()
ABsummoner.LootFrame.TopGuildFrame[derpz].Time["FS"]:SetText(string.format(SecondsToTime(AAPC_Lootz)))
local strwd = ABsummoner.LootFrame.TopGuildFrame[derpz].Time["FS"]:GetStringWidth()
ABsummoner.LootFrame.TopGuildFrame[derpz].Time:SetWidth(strwd+10)
ABsummoner.LootFrame.TopGuildFrame[derpz].Time:Show()
ABsummoner.LootFrame.TopGuildFrame[derpz].Button:SetAttribute("type1", "macro");
-- ABsummoner.LootFrame.TopGuildFrame[derpz].Button:SetAttribute("macrotext", "/target "..AAPC_Name..' \n/cast Ritual of Summoning')
ABsummoner.LootFrame.TopGuildFrame[derpz].Button:SetAttribute("macrotext", "/target "..AAPC_Name)
end
ABsummoner.LootFrame["TopGuildFrame"]:SetHeight(20+derpz*25)
ABsummoner.LootFrame:Show()
else
ABsummoner.LootFrame:Hide()
end
end
function ABsummoner.pairsByKeys (t, f)
local a = {}
for n in pairs(t) do table.insert(a, n) end
-- table.sort(a, f)
local i = 0 -- iterator variable
local iter = function () -- iterator function
i = i + 1
if a[i] == nil then return nil
else return a[i], t[a[i]]
end
end
return iter
end
ABsummoner.EventFrame = CreateFrame("Frame")
ABsummoner.EventFrame:RegisterEvent ("ADDON_LOADED")
ABsummoner.EventFrame:RegisterEvent ("CHAT_MSG_PARTY")
ABsummoner.EventFrame:RegisterEvent ("CHAT_MSG_PARTY_LEADER")
ABsummoner.EventFrame:RegisterEvent ("CHAT_MSG_RAID")
ABsummoner.EventFrame:RegisterEvent ("CHAT_MSG_RAID_LEADER")
ABsummoner.EventFrame:RegisterEvent ("CHAT_MSG_GUILD")
ABsummoner.EventFrame:RegisterEvent ("CHAT_MSG_WHISPER")
ABsummoner.EventFrame:RegisterEvent ("UNIT_SPELLCAST_START")
ABsummoner.EventFrame:SetScript("OnEvent", function(self, event, ...)
if (event=="ADDON_LOADED") then
local arg1, arg2, arg3, arg4, arg5 = ...;
if (arg1 == "Applebandit_Buff_Summons") then
local playerClass, englishClass = UnitClass("player")
if (playerClass ~= "Warlock") then
return
end
if (not ABsummon1) then
ABsummon1 = {}
end
if (not ABsummon1.Settings) then
ABsummon1.Settings = {}
ABsummon1.Settings.Left = 300
ABsummon1.Settings.Top = -200
end
ABsummoner.Timer = ABsummoner.EventFrame:CreateAnimationGroup()
ABsummoner.Timer.anim = ABsummoner.Timer:CreateAnimation()
ABsummoner.Timer.anim:SetDuration(1)
ABsummoner.Timer:SetLooping("REPEAT")
ABsummoner.Timer:SetScript("OnLoop", function(self, event, ...)
if (ABsummoner.whotosummon) then
for AAPC_index2,AAPC_value2 in pairs(ABsummoner.whotosummon) do
ABsummoner.whotosummon[AAPC_index2] = AAPC_value2 + 1
end
if (InCombatLockdown()) then
for h=1, 20 do
ABsummoner.LootFrame.TopGuildFrame[h].Button:Disable()
end
ABsummoner.LootFrame.TopGuildFrame.Button2:Disable()
else
ABsummoner.CheckRange()
ABsummoner.CheckRaid()
end
else
if (InCombatLockdown()) then
for h=1, 20 do
ABsummoner.LootFrame.TopGuildFrame[h].Button:Disable()
end
ABsummoner.LootFrame.TopGuildFrame.Button2:Disable()
else
ABsummoner.CheckRaid()
ABsummoner.Timer:Stop()
end
end
end)
ABsummoner.MakeFrame()
ABsummoner.CheckRaid()
end
elseif (event=="CHAT_MSG_RAID_LEADER" or event=="CHAT_MSG_RAID" or event=="CHAT_MSG_PARTY" or event=="CHAT_MSG_PARTY_LEADER" or event=="CHAT_MSG_GUILD" or event=="CHAT_MSG_WHISPER") then
local arg1, arg2, arg3, arg4, arg5 = ...;
-- Monitor chat message for summon trigger code
if (arg1 and ABsummoner.TriggerWord[string.lower(arg1)]) then
local playerClass, englishClass = UnitClass("player")
if (playerClass ~= "Warlock") then
return
end
local zname, zserv = strsplit("-",arg2)
if (not ABsummoner.whotosummon) then
ABsummoner.whotosummon = {}
end
-- If the player isn't in raid, get them an invite
if UnitInRaid(playerName) == nil then
-- Request an invite if you can't do it
if summonRaidRank() == "none" then
-- SendChatMessage("Please make me assist, or invite "..zname.." for summons", "RAID", nil)
-- Or invite the player yourself
else
InviteUnit(zname)
end
end
-- Add player to summon list
if (event ~= "CHAT_MSG_RAID" and event ~= "CHAT_MSG_RAID_LEADER") then
SendChatMessage("Adding you to the raid for "..GetZoneText()..". Type "..SummonCode.." in raid chat.", "WHISPER", nil, zname)
end
if (event == "CHAT_MSG_RAID" or event == "CHAT_MSG_RAID_LEADER") then
SendChatMessage("Adding you to the summoning list for "..GetZoneText(), "WHISPER", nil, zname)
end
PlaySoundFile("sound/interface/ui_bnettoast.ogg")
-- ABsummoner.whotosummon[zname] = 0
ABsummoner.Timer:Play()
-- Auto invite if whispered
elseif event == "CHAT_MSG_WHISPER" and (string.lower(arg1) == "inv" or string.lower(arg1) == "invite") then
local zname, zserv = strsplit("-",arg2)
if absummon_auto_invite == true then
InviteUnit(zname)
end
-- Auto invite for clickers
elseif (event == "CHAT_MSG_GUILD" or event=="CHAT_MSG_WHISPER") and string.lower(arg1) == "click" then
local zname, zserv = strsplit("-",arg2)
InviteUnit(zname)
end
-- Whisper players when they are being summoned
elseif event == "UNIT_SPELLCAST_START" then
local unitCasting, spellGUID, spellID = ...;
if unitCasting == "player" and spellID == 698 and UnitName("target") ~= nil then
SendChatMessage("Summoning "..UnitName("target").." to "..GetZoneText(),(UnitInRaid("player") and "RAID" or "PARTY"))
SendChatMessage("Summoning you now", "WHISPER", nil, UnitName("target"))
end
end
end)
-- Monitor for players who are in a different group
ABsummoner.InviteEventFrame = CreateFrame("Frame")
ABsummoner.InviteEventFrame:RegisterEvent ("CHAT_MSG_SYSTEM")
ABsummoner.InviteEventFrame:SetScript("OnEvent", function(self, event, ...)
local eventMsg = ...;
-- Player is already in a group
if string.find(eventMsg, string.gsub(ERR_ALREADY_IN_GROUP_S, "%%s", "%%S+")) then
local playerName = string.match(eventMsg, string.gsub(ERR_ALREADY_IN_GROUP_S, "%%s", "(%%S+)"));
-- If they are in a different group, let them know
if UnitInRaid(playerName) == nil then
-- SendChatMessage("Error: can't invite, leave group and try again", "WHISPER", nil, playerName)
-- Remove them from summon list
-- ABsummoner.whotosummon[playerName] = nil
PlaySoundFile("sound/interface/igquestfailed.ogg")
end
end
end)
-- Load Ace3 libraries and define addon
Applebandit_Buff_Summons = LibStub("AceAddon-3.0"):NewAddon("Applebandit_Buff_Summons", "AceConsole-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local AceConfigRegistry = LibStub("AceConfigRegistry-3.0")
-- Ace3 Configuration window GUI
local options = {
name = "Applebandit_Buff_Summons",
handler = Applebandit_Buff_Summons,
type = "group",
args = {
buff_heading = {
order = 1,
width = 1,
type = "header",
name = "Scheduled buff times",
},
buff_description = {
order = 1.25,
type = "description",
name = "If you're in the zone where the buff happens, these times will be included in the summon message, until the time has passed.\n\nFormat times like this: |caa91f1418:00am|caaffffff or |caa91f1415:00pm|caaffffff",
},
hakkar_time = {
order = 2,
width = 1,
type = "input",
name = "Heart of Hakkar buff time",
get = "GetValue",
set = "SetValue",
validate = function(info, value) return summonValidateTime(value) end,
},
dire_maul_time = {
order = 3,
width = 1,
type = "input",
name = "Dire Maul respawn time",
get = "GetValue",
set = "SetValue",
validate = function(info, value) return summonValidateTime(value) end,
},
songflower_time = {
order = 4,
width = 1,
type = "input",
name = "Songflower spawn time",
get = "GetValue",
set = "SetValue",
validate = function(info, value) return summonValidateTime(value) end,
},
dragonslayer_time = {
order = 5,
width = 1,
type = "input",
name = "Dragonslayer buff time",
get = "GetValue",
set = "SetValue",
validate = function(info, value) return summonValidateTime(value) end,
},
summon_status = {
order = 10,
type = "header",
name = function (info)
local white = "|caaffffff"
local red = "|caaf14141"
local green = "|caa91f141"
local yellow = "|caaffd100"
local channelName = ""
if summonMessageChannel == "SILENT" then
channelName = "no chat, "
elseif summonMessageChannel == "GUILD" then
channelName = "guild chat, "
elseif summonMessageChannel == "RAID" then
channelName = "raid chat, "
end
if summon_auto_message ~= nil and summon_auto_message._cancelled == nil then
return green.."Summoning enabled: "..yellow..channelName..SummonCode
else
return red.."Summoning disabled: "..white.."select below to start"
end
end,
},
button_summon_guild = {
disabled = function(info)
if summon_auto_message ~= nil and summon_auto_message._cancelled == nil then
return true
end
end,
order = 11,
width = 1,
type = "execute",
name = "Summon (guild chat)",
desc = "Sends a message to guild chat offering summons, and repeats it every 2 mins",
func = function (info)
initiateSummon("guild")
-- After 1 second, refresh GUI
C_Timer.After(1, function()
AceConfigRegistry:NotifyChange("Applebandit_Buff_Summons")
end)
end,
},
button_summon_raid = {
disabled = function(info)
if summon_auto_message ~= nil and summon_auto_message._cancelled == nil then
return true
end
end,
order = 12,
width = 1,
type = "execute",
name = "Summon (raid chat)",
desc = "Sends a message to raid chat offering summons, and repeats it every 2 mins",
func = function (info)
initiateSummon("raid")
-- After 1 second, refresh GUI
C_Timer.After(1, function()
AceConfigRegistry:NotifyChange("Applebandit_Buff_Summons")
end)
end,
},
button_summon_silent = {
disabled = function(info)
if summon_auto_message ~= nil and summon_auto_message._cancelled == nil then
return true
end
end,
order = 13,
width = 1,
type = "execute",
name = "Summon (no chat)",
desc = "Enable summoning, but don't send messages to any channels",
func = function (info)
initiateSummon("silent")
-- After 1 second, refresh GUI
C_Timer.After(1, function()
AceConfigRegistry:NotifyChange("Applebandit_Buff_Summons")
end)
end,
},
button_summon_stop = {
disabled = function(info)
if summon_auto_message == nil or summon_auto_message._cancelled ~= nil then
return true
end
end,
order = 14,
width = 1,
type = "execute",
name = "Stop summon message",
desc = "Stops the summon message from repeating and disables summon code",
func = function (info)
initiateSummon("stop")
-- After 1 second, refresh GUI
C_Timer.After(1, function()
AceConfigRegistry:NotifyChange("Applebandit_Buff_Summons")
end)
end,
},
options_spacer = {
order = 19.5,
width = 3,
type = "description",
name = " ",
},
options_heading = {
order = 20,
width = 1,
type = "header",
name = "Options and utilities",
},
auto_promote = {
order = 21,
width = 3,
type = "toggle",
name = "Auto promote level 20+ warlocks to raid assist",
get = "GetValue",
set = "SetValue",
},
auto_invite = {
order = 22,
width = 3,
type = "toggle",
name = "Auto invite people who whisper inv/invite",
get = "GetValue",
set = "SetValue",
},
mark_summoner = {
order = 23,
width = 3,
type = "toggle",
name = "Put a raid marker on yourself when you are summoning",
get = "GetValue",
set = "SetValue",
},
button_clean_group = {
disabled = function(info)
if summonRaidRank() == "none" then
return true
end
end,
order = 24,
width = 1,
type = "execute",
name = "Clean raid group",
desc = "Removes all players who are offline and below level 60",
func = function (info)
summonCleanGroup()
-- After 1 second, refresh GUI
C_Timer.After(1, function()
AceConfigRegistry:NotifyChange("Applebandit_Buff_Summons")
end)
end,
},
button_disband_raid = {
disabled = function(info)
if summonRaidRank() ~= "leader" then
return true
end
end,
order = 25,
width = 1,
type = "execute",
name = "Disband raid",
desc = "Removes all players from the raid",
func = function (info)
summonDisbandRaid()
-- After 1 second, refresh GUI
C_Timer.After(1, function()
AceConfigRegistry:NotifyChange("Applebandit_Buff_Summons")
end)
end,
},
}
}
-- Ace3 Methods
-- Called when the addon is loaded
function Applebandit_Buff_Summons:OnInitialize()
-- Register the options table
AceConfigRegistry:RegisterOptionsTable("Applebandit_Buff_Summons", options)
end
-- Called when the addon is enabled
function Applebandit_Buff_Summons:OnEnable()
-- self:Print("loaded. To open, type /summon")
AceConfigDialog:SelectGroup("Applebandit_Buff_Summons")
--Start automatic maintenance timer for auto promote/convert to raid
summon_auto_maintenance = C_Timer.NewTicker(5, function()
if absummon_auto_promote == true then
summonAutoPromote()
end
end)
end
-- Get/Set variables, using info parent name in dynamic variables
function Applebandit_Buff_Summons:GetValue(info)
return _G["absummon_"..info[#info] ]
end
function Applebandit_Buff_Summons:SetValue(info, value)
_G["absummon_"..info[#info] ] = value
end
-- Use chat command to open the addon window
SLASH_SUMMON1 = "/summon"
SlashCmdList["SUMMON"] = function(msg)
AceConfigDialog:SetDefaultSize("Applebandit_Buff_Summons", 390, 480)
AceConfigDialog:Open("Applebandit_Buff_Summons")
end
-- Function to send summon message
function sendSummonMessage(messageType)
-- Convert to a raid
if IsInGroup() then
ConvertToRaid()
end
-- After 1 second, refresh GUI
C_Timer.After(1, function()
AceConfigRegistry:NotifyChange("Applebandit_Buff_Summons")
end)
-- Set zone details and chat trigger
if GetZoneText() == "Blackrock Mountain" then
SummonZone = "Blackrock Mountain"
SummonCode = "BRM"
SummonTime = ""
SummonTimeMsg = ""
SummonIconId = 7 --Cross
elseif GetZoneText() == "Gates of Ahn'Qiraj" then
SummonZone = "Gates of Ahn'Qiraj"
SummonCode = "AQ"
SummonTime = ""
SummonTimeMsg = ""
SummonIconId = 2 --Circle
elseif GetZoneText() == "Eastern Plaguelands" then
SummonZone = "Naxxramas"
SummonCode = "NAXX"
SummonTime = ""
SummonTimeMsg = ""
SummonIconId = 4 --Triangle
elseif GetZoneText() == "Dire Maul" then
SummonZone = "Dire Maul buffs"
SummonCode = "DMT"
SummonTime = absummon_dire_maul_time
SummonTimeMsg = " Open until "..SummonTime.." -"
SummonIconId = 6 --Square
elseif GetZoneText() == "Felwood" then
SummonZone = "Songflower buff"
SummonCode = "SF"
SummonTime = absummon_songflower_time
SummonTimeMsg = " Next flower at "..SummonTime.." -"
SummonIconId = 1 --Star
elseif GetZoneText() == "Mulgore" or GetZoneText() == "Elwynn Forest" then
SummonZone = "Darkmoon Faire buff"
SummonCode = "DMF"
SummonTime = ""
SummonTimeMsg = ""
SummonIconId = 5 --Moon
elseif GetZoneText() == "Orgrimmar" or GetZoneText() == "Stormwind" then
SummonZone = "Dragonslayer buff"
SummonCode = "DRAG"
SummonTime = absummon_dragonslayer_time
SummonTimeMsg = " Next buff at "..SummonTime.." -"
SummonIconId = 8 --Skull
elseif GetZoneText() == "Stranglethorn Vale" then
SummonZone = "Heart of Hakkar buff"
SummonCode = "ZG"
SummonTime = absummon_hakkar_time
SummonTimeMsg = " Next buff at "..SummonTime.." -"
SummonIconId = 3 --Diamond
else
SummonZone = GetZoneText()
SummonCode = GetZoneText():gsub("(%w%w%w).*","%1"):upper()
SummonTime = ""
SummonTimeMsg = ""
SummonIconId = ""
end
-- Send the message
if messageType == "start" then
-- Enable the chat trigger
if SummonZone ~= "Gates of Ahn'Qiraj" then
ABsummoner.TriggerWord = {
[string.lower(SummonCode)] = 1,
}
else
-- Legacy support for old AQ summon code
ABsummoner.TriggerWord = {
[string.lower(SummonCode)] = 1,
["gat"] = 1,
}
end
-- Set the raid icon for message and player marker
if SummonIconId ~= "" then
SummonMsgIcon = "{rt"..SummonIconId.."} "
if absummon_mark_summoner == true and GetRaidTargetIndex("player") ~= SummonIconId then
SetRaidTarget("player",SummonIconId)
end
else
SummonMsgIcon = ""
SetRaidTarget("player",0) -- Clear any raid target
end
-- If clickers are needed, send a message asking
if summonCheckClickers() > 0 and summonMessageChannel ~= "SILENT" then
if summonParseTimes(SummonTime) then
SendChatMessage("Need "..summonCheckClickers().." clicker(s) for "..SummonZone.." summons."..SummonTimeMsg.." Whisper INV.", summonMessageChannel, nil, nil)
else
SendChatMessage("Need "..summonCheckClickers().." clicker(s) for "..SummonZone.." summons. Whisper INV.", summonMessageChannel, nil, nil)
end
-- Before starting a clicker recheck timer, cancel any existing ones
if summon_recheck_clickers ~= nil then
summon_recheck_clickers:Cancel()
end
-- Create a new timer to check clickers every 5 seconds
summon_recheck_clickers = C_Timer.NewTicker(5, function()
if summonCheckClickers() <= 0 then
Applebandit_Buff_Summons:Print("got enough clickers, restarting summon message")
-- Report summon message immediately
sendSummonMessage(messageType)
-- Cancel existing summon message timer and restart
if summon_auto_message ~= nil then
summon_auto_message:Cancel()
end
summon_auto_message = C_Timer.NewTicker(120, function()
sendSummonMessage(messageType)
end)
-- Cancel clicker recheck timers
if summon_recheck_clickers ~= nil then
summon_recheck_clickers:Cancel()
end
end
end)
-- Otherwise send summon message
elseif summonParseTimes(SummonTime) then
if summonMessageChannel ~= "SILENT" then
SendChatMessage(SummonMsgIcon.."Need a summon to "..SummonZone.."?"..SummonTimeMsg.." type "..SummonCode.." for group invite/summon", summonMessageChannel, nil, nil)
else
Applebandit_Buff_Summons:Print("summoning in silent mode, listening for "..SummonCode)
end
else
if summonMessageChannel ~= "SILENT" then
SendChatMessage(SummonMsgIcon.."Need a summon to "..SummonZone.."? Type "..SummonCode.." for group invite/summon", summonMessageChannel, nil, nil)
else
Applebandit_Buff_Summons:Print("summoning in silent mode, listening for "..SummonCode)
end
end
elseif messageType == "stop" then
-- Disable the chat trigger
ABsummoner.TriggerWord = "TRIGGER WORD DISABLED"
end
end
-- Function to initiate summoning mode
function initiateSummon(command)
if command == "guild" or command == "raid" or command == "silent" then
-- Set message channel
summonMessageChannel = string.upper(command)
-- Report summon message immediately
sendSummonMessage("start")
-- Cancel any existing summon message timers
if summon_auto_message ~= nil then
summon_auto_message:Cancel()
end
-- Start a new summon message timer for every 2 mins
if command ~= "silent" then
Applebandit_Buff_Summons:Print("repeating summon message every 2 minutes")
end
summon_auto_message = C_Timer.NewTicker(120, function()
sendSummonMessage("start")
end)
elseif command == "stop" then
-- Cancel any existing summon message timers
if summon_auto_message ~= nil and summon_auto_message._cancelled == nil then
Applebandit_Buff_Summons:Print("stopped repeating summon message")
summon_auto_message:Cancel()
sendSummonMessage("stop")
else
Applebandit_Buff_Summons:Print("no active summon messages found")
end
-- Remove any raid target from self
SetRaidTarget("player",0)
end
end
-- Function to parse time and check whether it's passed
function summonParseTimes(buffTime)
local validTime = false
if buffTime ~= "" then
-- Build a number string to represent current server time
local serverHour, serverMinute = GetGameTime()
if serverMinute < 10 then
serverMinute = "0"..tostring(serverMinute)
end
local serverTimeVal = tonumber(serverHour..serverMinute)
-- Build a number string to represent buff time
local buffHour, buffMinute, buffModifier = buffTime:match("(%d+):(%d%d)(%a%a)")
local buffTimeVal = tonumber(buffHour..buffMinute)
if string.lower(buffModifier) == "pm" then
buffTimeVal = buffTimeVal + 1200
end
-- Compare numbers to check if buff time has passed
if buffTimeVal > serverTimeVal then
validTime = true
end
-- print("Server time: "..serverTimeVal.." Buff time: "..buffTimeVal)
end
return validTime
end
-- Function to do basic validation on buff time entries
function summonValidateTime(buffTime)
-- Error if time string is longer than 7 chars, or doesn't match format
if buffTime ~= "" and (string.len(buffTime) > 7 or string.match(buffTime,"%d+:%d%d%a%a") == nil) then
PlaySoundFile("sound/interface/igquestfailed.ogg")
return "Invalid time, try again"
else
return true
end
end
-- Function to check if raid leader/assistant
function summonRaidRank()
-- Check if you are raid leader or assistant
local myRank = "none"
if IsInRaid() then
for i=1,40 do
local name, rank = GetRaidRosterInfo(i)
if name == UnitName("player") and rank ~= 0 then
-- You are a raid assist [1] or raid leader [2]
if rank == 1 then
myRank = "assist"
elseif rank == 2 then
myRank = "leader"
end
break -- stop loop
end
end
end
return myRank
end
-- Function to auto promote level 20+ warlocks to raid assist
function summonAutoPromote()
-- Promote warlocks to assist
if summonRaidRank() == "leader" then
for i=1,40 do
local name, rank, subgroup, level, class, fileName, zone, online = GetRaidRosterInfo(i)
if class == "Warlock" and online == true then
if UnitLevel(name) >= 20 then
PromoteToAssistant(name)
end
end
end
end
end
-- Function to remove offline players below level 60
function summonCleanGroup()
local cleanupCount = 0
-- Remove offline players
if summonRaidRank() == "leader" or summonRaidRank() == "assist" then
for i=1,40 do
local name, rank, subgroup, level, class, fileName, zone, online = GetRaidRosterInfo(i)
if online == false then
if UnitLevel(name) < 60 then
UninviteUnit(name)
cleanupCount = cleanupCount +1
end
end
end
end
Applebandit_Buff_Summons:Print("removed "..cleanupCount.." players from raid")
end
-- Function to disband raid
function summonDisbandRaid()
if summonRaidRank() == "leader" then
-- Tell people the raid is being disbanded (use loop as delay hack)
local raidMessageSent = false
for i=1,GetNumGroupMembers() do
if raidMessageSent == false then
SendChatMessage("This raid is being disbanded", "RAID_WARNING", nil, nil)
raidMessageSent = true
end
end
-- Actually disband the raid
for i=1,GetNumGroupMembers() do
if UnitName("raid"..i) ~= UnitName("player") then
UninviteUnit("raid"..i, "reason")
end
end
end
end
-- Function to check whether people around to to help summon
function summonCheckClickers()
local clickersNeeded = 2
if IsInRaid() then
for i=1,40 do
local name = GetRaidRosterInfo(i)
if name ~= nil and name ~= UnitName("player") and UnitInRange(name) == true and UnitIsAFK(name) == false then
clickersNeeded = clickersNeeded - 1
end
if clickersNeeded == 0 then
break -- stop loop
end
end
elseif IsInGroup() then
for i=1,4 do
local name = UnitName('party'..i)
if name ~= nil and name ~= UnitName("player") and UnitInRange(name) == true and UnitIsAFK(name) == false then
clickersNeeded = clickersNeeded - 1
end
if clickersNeeded == 0 then
break -- stop loop
end
end
end
return clickersNeeded
end
--[[
-- Use Nova world buffs database to check for songflower timers
function summonSongflower()
-- Check the timers for songflowers near bloodvenom post
local songflowerList = {
["flower5"] = {subZone = "Shatter Scar Vale"},
["flower6"] = {subZone = "Bloodvenom Post"},
["flower7"] = {subZone = "East of Jaedenar"}
Unused songflowers
["flower1"] = {subZone = "North Felpaw Village"},
["flower2"] = {subZone = "West Felpaw Village"},
["flower3"] = {subZone = "North of Irontree Woods"},
["flower4"] = {subZone = "Talonbranch Glade"},
["flower8"] = {subZone = "North of Emerald Sanctuary"},
["flower9"] = {subZone = "West of Emerald Sanctuary"},
["flower10"] = { subZone = "South of Emerald Sanctuary"},
}
for k, v in pairs(songflowerList) do
local time = (NWB.data[k] + 1500) - GetServerTime();
if (time > 0) then
local minutes = string.format("%02.f", math.floor(time / 60));
local seconds = string.format("%02.f", math.floor(time - minutes * 60));
print(v.subZone .. " " .. minutes .. "m" .. seconds .. "s")
end
end
end
]]-- |
ModifyEvent(-2, -2, -1, -1, -1, -1, -1, 2468, 2468, 2468, -2, -2, -2);--by fanyu 打开箱子,改变贴图 场景31-35
AddItem(171, 10);
AddItem(186, 2);
AddItem(97, 5);
AddEthics(-1);
do return end;
|
local VCA = Module:extend()
function VCA:init()
Module.init(self, 'VCA', {
ports = { Port('CV'), Port('In'), Port('Out')},
knobs = { Knob('Amp') }
})
end
return VCA |
object_building_kashyyyk_poi_tree_mound = object_building_kashyyyk_shared_poi_tree_mound:new {
}
ObjectTemplates:addTemplate(object_building_kashyyyk_poi_tree_mound, "object/building/kashyyyk/poi_tree_mound.iff")
|
local Pegasus = require 'pegasus'
local Camera = require 'video_streaming.camera'
local socket = require 'socket'
local Streaming = {}
function Streaming:new(params)
local obj = {}
self.__index = self
self.camera = Camera:new(params.dir or './')
self.server = Pegasus:new({
port = params.port or '9090'
})
return setmetatable(obj, self)
end
function Streaming:start()
self.server:start(function(req, rep)
local isVideo = string.find(req.path or '', '/video_streaming/') ~= nil
if not isVideo then return nil end
rep:addHeader('Content-Type', 'multipart/x-mixed-replace; boundary=frame')
local i = 1
while Camera:getFrame(i) ~= nil do
local frame = Camera:getFrame(i)
i = i + 1
local src = table.concat({
'--frame\r\n',
'Content-Type: image/jpeg\r\n\r\n' .. frame .. '\r\n'
}, '')
rep:write(src, true)
end
end)
end
return Streaming
|
-- // FileName: ChannelsBar.lua
-- // Written by: Xsitsu
-- // Description: Manages creating, destroying, and displaying ChannelTabs.
local module = {}
local PlayerGui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
--////////////////////////////// Include
--//////////////////////////////////////
local Chat = game:GetService("Chat")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local modulesFolder = script.Parent
local moduleChannelsTab = require(modulesFolder:WaitForChild("ChannelsTab"))
local MessageSender = require(modulesFolder:WaitForChild("MessageSender"))
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local CurveUtil = require(modulesFolder:WaitForChild("CurveUtil"))
--////////////////////////////// Methods
--//////////////////////////////////////
local methods = {}
methods.__index = methods
function methods:CreateGuiObjects(targetParent)
local BaseFrame = Instance.new("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 1, 0)
BaseFrame.BackgroundTransparency = 1
BaseFrame.Parent = targetParent
local ScrollingBase = Instance.new("Frame")
ScrollingBase.Selectable = false
ScrollingBase.Name = "ScrollingBase"
ScrollingBase.BackgroundTransparency = 1
ScrollingBase.ClipsDescendants = true
ScrollingBase.Size = UDim2.new(1, 0, 1, 0)
ScrollingBase.Position = UDim2.new(0, 0, 0, 0)
ScrollingBase.Parent = BaseFrame
local ScrollerSizer = Instance.new("Frame")
ScrollerSizer.Selectable = false
ScrollerSizer.Name = "ScrollerSizer"
ScrollerSizer.BackgroundTransparency = 1
ScrollerSizer.Size = UDim2.new(1, 0, 1, 0)
ScrollerSizer.Position = UDim2.new(0, 0, 0, 0)
ScrollerSizer.Parent = ScrollingBase
local ScrollerFrame = Instance.new("Frame")
ScrollerFrame.Selectable = false
ScrollerFrame.Name = "ScrollerFrame"
ScrollerFrame.BackgroundTransparency = 1
ScrollerFrame.Size = UDim2.new(1, 0, 1, 0)
ScrollerFrame.Position = UDim2.new(0, 0, 0, 0)
ScrollerFrame.Parent = ScrollerSizer
local LeaveConfirmationFrameBase = Instance.new("Frame")
LeaveConfirmationFrameBase.Selectable = false
LeaveConfirmationFrameBase.Size = UDim2.new(1, 0, 1, 0)
LeaveConfirmationFrameBase.Position = UDim2.new(0, 0, 0, 0)
LeaveConfirmationFrameBase.ClipsDescendants = true
LeaveConfirmationFrameBase.BackgroundTransparency = 1
LeaveConfirmationFrameBase.Parent = BaseFrame
local LeaveConfirmationFrame = Instance.new("Frame")
LeaveConfirmationFrame.Selectable = false
LeaveConfirmationFrame.Name = "LeaveConfirmationFrame"
LeaveConfirmationFrame.Size = UDim2.new(1, 0, 1, 0)
LeaveConfirmationFrame.Position = UDim2.new(0, 0, 1, 0)
LeaveConfirmationFrame.BackgroundTransparency = 0.6
LeaveConfirmationFrame.BorderSizePixel = 0
LeaveConfirmationFrame.BackgroundColor3 = Color3.new(0, 0, 0)
LeaveConfirmationFrame.Parent = LeaveConfirmationFrameBase
local InputBlocker = Instance.new("TextButton")
InputBlocker.Selectable = false
InputBlocker.Size = UDim2.new(1, 0, 1, 0)
InputBlocker.BackgroundTransparency = 1
InputBlocker.Text = ""
InputBlocker.Parent = LeaveConfirmationFrame
local LeaveConfirmationButtonYes = Instance.new("TextButton")
LeaveConfirmationButtonYes.Selectable = false
LeaveConfirmationButtonYes.Size = UDim2.new(0.25, 0, 1, 0)
LeaveConfirmationButtonYes.BackgroundTransparency = 1
LeaveConfirmationButtonYes.Font = ChatSettings.DefaultFont
LeaveConfirmationButtonYes.TextSize = 18
LeaveConfirmationButtonYes.TextStrokeTransparency = 0.75
LeaveConfirmationButtonYes.Position = UDim2.new(0, 0, 0, 0)
LeaveConfirmationButtonYes.TextColor3 = Color3.new(0, 1, 0)
LeaveConfirmationButtonYes.Text = "Confirm"
LeaveConfirmationButtonYes.Parent = LeaveConfirmationFrame
local LeaveConfirmationButtonNo = LeaveConfirmationButtonYes:Clone()
LeaveConfirmationButtonNo.Parent = LeaveConfirmationFrame
LeaveConfirmationButtonNo.Position = UDim2.new(0.75, 0, 0, 0)
LeaveConfirmationButtonNo.TextColor3 = Color3.new(1, 0, 0)
LeaveConfirmationButtonNo.Text = "Cancel"
local LeaveConfirmationNotice = Instance.new("TextLabel")
LeaveConfirmationNotice.Selectable = false
LeaveConfirmationNotice.Size = UDim2.new(0.5, 0, 1, 0)
LeaveConfirmationNotice.Position = UDim2.new(0.25, 0, 0, 0)
LeaveConfirmationNotice.BackgroundTransparency = 1
LeaveConfirmationNotice.TextColor3 = Color3.new(1, 1, 1)
LeaveConfirmationNotice.TextStrokeTransparency = 0.75
LeaveConfirmationNotice.Text = "Leave channel <XX>?"
LeaveConfirmationNotice.Font = ChatSettings.DefaultFont
LeaveConfirmationNotice.TextSize = 18
LeaveConfirmationNotice.Parent = LeaveConfirmationFrame
local LeaveTarget = Instance.new("StringValue")
LeaveTarget.Name = "LeaveTarget"
LeaveTarget.Parent = LeaveConfirmationFrame
local outPos = LeaveConfirmationFrame.Position
LeaveConfirmationButtonYes.MouseButton1Click:connect(function()
MessageSender:SendMessage(string.format("/leave %s", LeaveTarget.Value), nil)
LeaveConfirmationFrame:TweenPosition(outPos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
end)
LeaveConfirmationButtonNo.MouseButton1Click:connect(function()
LeaveConfirmationFrame:TweenPosition(outPos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
end)
local scale = 0.7
local scaleOther = (1 - scale) / 2
local pageButtonImage = "rbxasset://textures/ui/Chat/TabArrowBackground.png"
local pageButtonArrowImage = "rbxasset://textures/ui/Chat/TabArrow.png"
--// ToDo: Remove these lines when the assets are put into trunk.
--// These grab unchanging versions hosted on the site, and not from the content folder.
pageButtonImage = "rbxassetid://471630199"
pageButtonArrowImage = "rbxassetid://471630112"
local PageLeftButton = Instance.new("ImageButton", BaseFrame)
PageLeftButton.Selectable = ChatSettings.GamepadNavigationEnabled
PageLeftButton.Name = "PageLeftButton"
PageLeftButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
PageLeftButton.Size = UDim2.new(scale, 0, scale, 0)
PageLeftButton.BackgroundTransparency = 1
PageLeftButton.Position = UDim2.new(0, 4, scaleOther, 0)
PageLeftButton.Visible = false
PageLeftButton.Image = pageButtonImage
local ArrowLabel = Instance.new("ImageLabel", PageLeftButton)
ArrowLabel.Name = "ArrowLabel"
ArrowLabel.BackgroundTransparency = 1
ArrowLabel.Size = UDim2.new(0.4, 0, 0.4, 0)
ArrowLabel.Image = pageButtonArrowImage
local PageRightButtonPositionalHelper = Instance.new("Frame", BaseFrame)
PageRightButtonPositionalHelper.Selectable = false
PageRightButtonPositionalHelper.BackgroundTransparency = 1
PageRightButtonPositionalHelper.Name = "PositionalHelper"
PageRightButtonPositionalHelper.Size = PageLeftButton.Size
PageRightButtonPositionalHelper.SizeConstraint = PageLeftButton.SizeConstraint
PageRightButtonPositionalHelper.Position = UDim2.new(1, 0, scaleOther, 0)
local PageRightButton = PageLeftButton:Clone()
PageRightButton.Parent = PageRightButtonPositionalHelper
PageRightButton.Name = "PageRightButton"
PageRightButton.Size = UDim2.new(1, 0, 1, 0)
PageRightButton.SizeConstraint = Enum.SizeConstraint.RelativeXY
PageRightButton.Position = UDim2.new(-1, -4, 0, 0)
local positionOffset = UDim2.new(0.05, 0, 0, 0)
PageRightButton.ArrowLabel.Position = UDim2.new(0.3, 0, 0.3, 0) + positionOffset
PageLeftButton.ArrowLabel.Position = UDim2.new(0.3, 0, 0.3, 0) - positionOffset
PageLeftButton.ArrowLabel.Rotation = 180
self.GuiObject = BaseFrame
self.GuiObjects.BaseFrame = BaseFrame
self.GuiObjects.ScrollerSizer = ScrollerSizer
self.GuiObjects.ScrollerFrame = ScrollerFrame
self.GuiObjects.PageLeftButton = PageLeftButton
self.GuiObjects.PageRightButton = PageRightButton
self.GuiObjects.LeaveConfirmationFrame = LeaveConfirmationFrame
self.GuiObjects.LeaveConfirmationNotice = LeaveConfirmationNotice
self.GuiObjects.PageLeftButtonArrow = PageLeftButton.ArrowLabel
self.GuiObjects.PageRightButtonArrow = PageRightButton.ArrowLabel
self:AnimGuiObjects()
PageLeftButton.MouseButton1Click:connect(function() self:ScrollChannelsFrame(-1) end)
PageRightButton.MouseButton1Click:connect(function() self:ScrollChannelsFrame(1) end)
self:ScrollChannelsFrame(0)
end
function methods:UpdateMessagePostedInChannel(channelName)
local tab = self:GetChannelTab(channelName)
if (tab) then
tab:UpdateMessagePostedInChannel()
else
warn("ChannelsTab '" .. channelName .. "' does not exist!")
end
end
function methods:AddChannelTab(channelName)
if (self:GetChannelTab(channelName)) then
error("Channel tab '" .. channelName .. "'already exists!")
end
local tab = moduleChannelsTab.new(channelName)
tab.GuiObject.Parent = self.GuiObjects.ScrollerFrame
self.ChannelTabs[channelName:lower()] = tab
self.NumTabs = self.NumTabs + 1
self:OrganizeChannelTabs()
if (ChatSettings.RightClickToLeaveChannelEnabled) then
tab.NameTag.MouseButton2Click:connect(function()
self.LeaveConfirmationNotice.Text = string.format("Leave channel %s?", tab.ChannelName)
self.LeaveConfirmationFrame.LeaveTarget.Value = tab.ChannelName
self.LeaveConfirmationFrame:TweenPosition(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 0.2, true)
end)
end
return tab
end
function methods:RemoveChannelTab(channelName)
if (not self:GetChannelTab(channelName)) then
error("Channel tab '" .. channelName .. "'does not exist!")
end
local indexName = channelName:lower()
self.ChannelTabs[indexName]:Destroy()
self.ChannelTabs[indexName] = nil
self.NumTabs = self.NumTabs - 1
self:OrganizeChannelTabs()
end
function methods:GetChannelTab(channelName)
return self.ChannelTabs[channelName:lower()]
end
function methods:OrganizeChannelTabs()
local order = {}
table.insert(order, self:GetChannelTab(ChatSettings.GeneralChannelName))
table.insert(order, self:GetChannelTab("System"))
for tabIndexName, tab in pairs(self.ChannelTabs) do
if (tab.ChannelName ~= ChatSettings.GeneralChannelName and tab.ChannelName ~= "System") then
table.insert(order, tab)
end
end
for index, tab in pairs(order) do
tab.GuiObject.Position = UDim2.new(index - 1, 0, 0, 0)
end
--// Dynamic tab resizing
self.GuiObjects.ScrollerSizer.Size = UDim2.new(1 / math.max(1, math.min(ChatSettings.ChannelsBarFullTabSize, self.NumTabs)), 0, 1, 0)
self:ScrollChannelsFrame(0)
end
function methods:ResizeChannelTabText(textSize)
for i, tab in pairs(self.ChannelTabs) do
tab:SetTextSize(textSize)
end
end
function methods:ScrollChannelsFrame(dir)
if (self.ScrollChannelsFrameLock) then return end
self.ScrollChannelsFrameLock = true
local tabNumber = ChatSettings.ChannelsBarFullTabSize
local newPageNum = self.CurPageNum + dir
if (newPageNum < 0) then
newPageNum = 0
elseif (newPageNum > 0 and newPageNum + tabNumber > self.NumTabs) then
newPageNum = self.NumTabs - tabNumber
end
self.CurPageNum = newPageNum
local tweenTime = 0.15
local endPos = UDim2.new(-self.CurPageNum, 0, 0, 0)
self.GuiObjects.PageLeftButton.Visible = (self.CurPageNum > 0)
self.GuiObjects.PageRightButton.Visible = (self.CurPageNum + tabNumber < self.NumTabs)
if dir == 0 then
self.ScrollChannelsFrameLock = false
return
end
local function UnlockFunc()
self.ScrollChannelsFrameLock = false
end
self:WaitUntilParentedCorrectly()
self.GuiObjects.ScrollerFrame:TweenPosition(endPos, Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, tweenTime, true, UnlockFunc)
end
function methods:FadeOutBackground(duration)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:FadeOutBackground(duration)
end
self.AnimParams.Background_TargetTransparency = 1
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeInBackground(duration)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:FadeInBackground(duration)
end
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeOutText(duration)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:FadeOutText(duration)
end
end
function methods:FadeInText(duration)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:FadeInText(duration)
end
end
function methods:AnimGuiObjects()
self.GuiObjects.PageLeftButton.ImageTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.PageRightButton.ImageTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.PageLeftButtonArrow.ImageTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.PageRightButtonArrow.ImageTransparency = self.AnimParams.Background_CurrentTransparency
end
function methods:InitializeAnimParams()
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_CurrentTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(0)
end
function methods:Update(dtScale)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:Update(dtScale)
end
self.AnimParams.Background_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Background_CurrentTransparency,
self.AnimParams.Background_TargetTransparency,
self.AnimParams.Background_NormalizedExptValue,
dtScale
)
self:AnimGuiObjects()
end
--// ToDo: Move to common modules
function methods:WaitUntilParentedCorrectly()
while (not self.GuiObject:IsDescendantOf(game:GetService("Players").LocalPlayer)) do
self.GuiObject.AncestryChanged:wait()
end
end
--///////////////////////// Constructors
--//////////////////////////////////////
function module.new()
local obj = setmetatable({}, methods)
obj.GuiObject = nil
obj.GuiObjects = {}
obj.ChannelTabs = {}
obj.NumTabs = 0
obj.CurPageNum = 0
obj.ScrollChannelsFrameLock = false
obj.AnimParams = {}
obj:InitializeAnimParams()
ChatSettings.SettingsChanged:connect(function(setting, value)
if (setting == "ChatChannelsTabTextSize") then
obj:ResizeChannelTabText(value)
end
end)
return obj
end
return module
|
Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"), key, value)
end
Citizen.CreateThread(function()
-- POLICE6
AddTextEntry('0x72935408', 'hiluxpmesp') |
--New
object_tangible_dungeon_mustafar_working_droid_factory_shared_inhibitor_storage = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/dungeon/mustafar/working_droid_factory/shared_inhibitor_storage.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_dungeon_mustafar_working_droid_factory_shared_inhibitor_storage, "object/tangible/dungeon/mustafar/working_droid_factory/shared_inhibitor_storage.iff")
--**********************************************************************************************************************************
object_tangible_dungeon_mustafar_working_droid_factory_shared_radioactive_pile = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/dungeon/mustafar/working_droid_factory/shared_radioactive_pile.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_dungeon_mustafar_working_droid_factory_shared_radioactive_pile, "object/tangible/dungeon/mustafar/working_droid_factory/shared_radioactive_pile.iff")
--**********************************************************************************************************************************
object_tangible_dungeon_mustafar_working_droid_factory_shared_rapid_assembly_station = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/dungeon/mustafar/working_droid_factory/shared_rapid_assembly_station.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_dungeon_mustafar_working_droid_factory_shared_rapid_assembly_station, "object/tangible/dungeon/mustafar/working_droid_factory/shared_rapid_assembly_station.iff")
--**********************************************************************************************************************************
object_tangible_dungeon_mustafar_working_droid_factory_shared_reactive_repair_module = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/dungeon/mustafar/working_droid_factory/shared_reactive_repair_module.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_dungeon_mustafar_working_droid_factory_shared_reactive_repair_module, "object/tangible/dungeon/mustafar/working_droid_factory/shared_reactive_repair_module.iff")
--**********************************************************************************************************************************
|
mrg.basemetal("aluminium", "ingot", {
description = "Aluminium Ingot"
})
mrg.basemetal("aluminium", "diabolo", {
description = "Aluminium Diabolo"
})
mrg.basemetal("copper", "ingot", {
description = "Copper Ingot"
})
mrg.basemetal("copper", "diabolo", {
description = "Copper Diabolo"
})
mrg.basemetal("uranium", "ingot", {
description = "Uranium Ingot"
})
mrg.basemetal("uranium", "diabolo", {
description = "Uranium Diabolo"
})
mrg.basemetal("alclad", "ingot", {
description = "Alclad Aluminium Ingot"
})
mrg.basemetal("alclad", "diabolo", {
description = "Alclad Aluminium Diabolo"
})
mrg.basemetal("uranium_bronze", "ingot", {
description = "Uranium-Bronze Ingot"
})
mrg.basemetal("uranium_bronze", "diabolo", {
description = "Uranium-Bronze Diabolo"
}) |
local addonName, addon = ...
local lockouts = addon:NewModule('Lockouts', 'AceEvent-3.0')
-- GLOBALS: _G, LibStub, DataStore, EXPANSION_LEVEL
-- GLOBALS: IsAddOnLoaded, UnitLevel, GetQuestResetTime, GetRFDungeonInfo, GetNumRFDungeons, GetLFGDungeonRewardCapInfo, GetLFGDungeonNumEncounters, GetLFGDungeonRewards, GetLFDLockInfo, LFG_INSTANCE_INVALID_CODES, GetNumSavedWorldBosses, GetSavedWorldBossInfo, GetNumSavedInstances, GetSavedInstanceInfo, GetLFGDungeonEncounterInfo, GetSavedInstanceChatLink, GetSavedInstanceInfo, GetSavedInstanceEncounterInfo, RequestRaidInfo
-- GLOBALS: type, next, wipe, pairs, time, date, string, tonumber, math, strsplit, strjoin, strtrim, bit, unpack
local defaults = {
global = {
Characters = {
['*'] = { -- ["Account.Realm.Name"]
lastUpdate = nil,
LFGs = {},
WorldBosses = {},
Instances = {},
InstanceLinks = {},
}
}
}
}
local thisCharacter = DataStore:GetCharacter()
-- *** Scanning functions ***
local LFGInfos = {
-- GetNumX(), GetXInfo(index) returning same data as GetLFGDungeonInfo(dungeonID)
{ GetNumRandomDungeons, GetLFGRandomDungeonInfo },
{ GetNumRandomScenarios, GetRandomScenarioInfo },
{ GetNumRFDungeons, GetRFDungeonInfo },
{ GetNumFlexRaidDungeons, GetFlexRaidDungeonInfo },
}
local function UpdateLFGStatus()
-- TODO: group data by dungeon?
local playerLevel = UnitLevel('player')
local lfgs = lockouts.ThisCharacter.LFGs
wipe(lfgs)
for i, funcs in pairs(LFGInfos) do
local getNum, getInfo = funcs[1], funcs[2]
for index = 1, getNum() do
local dungeonID, _, _, _, minLevel, maxLevel, _, _, _, expansionLevel = getInfo(index)
local _, _, completed, available, _, _, _, _, _, _, isWeekly = GetLFGDungeonRewardCapInfo(dungeonID)
local isAvailable, isAvailableToPlayer, hideUnavailable = IsLFGDungeonJoinable(dungeonID)
local numBosses, numDefeated = GetLFGDungeonNumEncounters(dungeonID)
local doneToday = GetLFGDungeonRewards(dungeonID)
local dungeonReset = 0
if available == 1 and (numDefeated > 0 or doneToday) then
dungeonReset = isWeekly and addon.GetNextMaintenance() or (time() + GetQuestResetTime())
end
if not isAvailable and not isAvailableToPlayer or available ~= 1 then
-- dungeon not available
local _, reason, info1, info2 = GetLFDLockInfo(dungeonID, 1)
local status = string.format('%s:%s:%s', reason or '', info1 or '', info2 or '')
status = strtrim(status, ':') -- trim trailing ::
status = tonumber(status) or status
if status ~= 1 and status ~= 2 and status ~= 3 then
-- expansion and level requirements are infered using CheckDungeonRequirements
lfgs[dungeonID] = status
end
elseif completed == 0 and dungeonReset == 0 and numDefeated == 0 then
-- dungeon available but no lockout
-- lfgs[dungeonID] = 0
else
-- dungeon has lockout info
local defeatedBosses = 0
for encounterIndex = 1, numBosses do
local _, _, defeated = GetLFGDungeonEncounterInfo(dungeonID, encounterIndex)
defeatedBosses = bit.bor(defeatedBosses, defeated and 2^(encounterIndex-1) or 0)
end
-- marker so we know how many bosses there are
defeatedBosses = bit.bor(defeatedBosses, 2^numBosses)
lfgs[dungeonID] = string.format('%s|%d|%d', completed, dungeonReset, defeatedBosses)
end
end
end
lockouts.ThisCharacter.lastUpdate = time()
end
local function UpdateSavedBosses()
local bosses = lockouts.ThisCharacter.WorldBosses
wipe(bosses)
for i = 1, GetNumSavedWorldBosses() do
local name, id, reset = GetSavedWorldBossInfo(i)
bosses[id] = time() + reset
end
lockouts.ThisCharacter.lastUpdate = time()
end
local function UpdateSavedInstances()
local instances = lockouts.ThisCharacter.Instances
wipe(instances)
local instanceLinks = lockouts.ThisCharacter.InstanceLinks
wipe(instanceLinks)
for index = 1, GetNumSavedInstances() do
local lockout = GetSavedInstanceChatLink(index)
local instanceMapID = lockout:match('instancelock:[^:]+:([^:]+)') * 1
-- link format: |Hinstancelock:CHARACTER_GUID:INSTANCEMAPID:DIFFICULTYID:DEFEATEDBOSSES|h[INSTANCENAME]|h
-- * defeatedBosses is a bitmap, but boss order differs from instance encounter order
-- * instanceMapID is unique, but not found anywhere else ingame, especially not in EJ/API
-- Get the instance name: instanceName = GetRealZoneText(instanceMapID)
local instanceName, lockoutID, resetsIn, difficulty, locked, extended, instanceIDMostSig, isRaid, maxPlayers, difficultyName, numBosses, numDefeatedBosses = GetSavedInstanceInfo(index)
local reset = (locked and resetsIn > 0) and (resetsIn + time()) or 0
-- local identifier = string.format("%x%x", instanceIDMostSig, lockoutID) -- used in RaidFrame
local killedBosses = 0
for encounterIndex = 1, numBosses do
local _, _, defeated = GetSavedInstanceEncounterInfo(index, encounterIndex)
killedBosses = bit.bor(killedBosses, defeated and 2^(encounterIndex-1) or 0)
end
-- marker so we know how many bosses there are
killedBosses = bit.bor(killedBosses, 2^numBosses)
instances[lockoutID] = strjoin('|', instanceMapID, difficulty, reset, extended and 1 or 0, isRaid and 1 or 0, killedBosses)
instanceLinks[lockoutID] = lockout
end
lockouts.ThisCharacter.lastUpdate = time()
end
local encounters = {}
-- @returns <bool:encounter1Dead>, <bool:encounter2Dead>, ...
local function GetEncounters(defeatedBosses)
wipe(encounters)
local encounterIndex = 1
while defeatedBosses and defeatedBosses > 1 do -- ignore marker bit
encounters[encounterIndex] = defeatedBosses%2 == 1
encounterIndex = encounterIndex + 1
defeatedBosses = bit.rshift(defeatedBosses, 1)
end
return unpack(encounters)
end
-- locked reasons: 1 (expansion), 2/1001 (low level), 3/1002 (high level), 4 (low gear), 5 (high gear)
local function CheckDungeonRequirements(character, instanceID)
local status = nil
local _, _, _, minLevel, maxLevel, _, _, _, expansionLevel, groupID = GetLFGDungeonInfo(instanceID)
local characterKey = DataStore:GetCurrentCharacterKey()
local level = DataStore:GetCharacterLevel(characterKey)
-- TODO: only works when DataStore_Characters is enabled
if GetAccountExpansionLevel() < expansionLevel then
-- TODO: only works for default account
status = 1
elseif level and level < minLevel then
status = 2
elseif level and level > maxLevel then
status = 3
end
if status then
status = _G['INSTANCE_UNAVAILABLE_SELF_'..(LFG_INSTANCE_INVALID_CODES[lockedReason] or 'OTHER')]:format(reasonText)
end
return status
end
-- Mixins
-- Looking for Group
function lockouts.IterateLFGs(character, typeID, subTypeID)
local lfgIndex, lfgType = 0, next(LFGInfos, nil)
return function()
while true do
lfgIndex = lfgIndex + 1
if not lfgType or not LFGInfos[lfgType] then
-- invalid lfgType
return nil
end
local instanceID, instanceName, instanceType, instanceSubType = LFGInfos[lfgType][2](lfgIndex)
if not instanceID then
-- no more instances in this group, try next one
lfgType = next(LFGInfos, lfgType)
lfgIndex = 0
elseif (typeID and typeID ~= instanceType) or (subTypeID and subTypeID ~= instanceSubType) then
-- instance does not match specified types
lfgIndex = lfgIndex + 1
else
-- found a match!
return instanceID, instanceName, lockouts.GetLFGInfo(character, instanceID)
end
end
end
end
-- @return <bool:available|string:lockedReason>, <int:resetTime|nil>, <int:numDefeated|nil>, <int:numBosses|nil>
function lockouts.GetLFGInfo(character, instanceID)
local instanceInfo = character.LFGs[instanceID]
-- no data saved, let's see if this dungeon might be accessible
if not instanceInfo then return CheckDungeonRequirements(character, instanceID) end
local lockCode = tonumber(instanceInfo)
if lockCode then
-- simple locked status code, easily mixed up with <completed> flag
instanceInfo = lockCode..'::'
end
local status, reset, defeatedBosses = strsplit('|', instanceInfo)
defeatedBosses = tonumber(defeatedBosses or '') or 0
local lockedReason, arg1, arg2 = strsplit(':', status or '')
lockedReason = tonumber(lockedReason) or nil
if not arg1 and not arg2 then
-- dungeon was completed
status = lockedReason == 1 and true or false
elseif lockedReason == 1029 or lockedReason == 1030 or lockedReason == 1031 then
status = _G['INSTANCE_UNAVAILABLE_OTHER_TOO_SOON']
else
local reasonText = _G['INSTANCE_UNAVAILABLE_SELF_'..(LFG_INSTANCE_INVALID_CODES[lockedReason] or 'OTHER')]
status = string.format(reasonText, arg1, arg2)
end
local numDefeated, numBosses = 0, 0
while defeatedBosses and defeatedBosses > 1 do -- ignore marker bit
numDefeated = numDefeated + (defeatedBosses%2)
numBosses = numBosses + 1
defeatedBosses = bit.rshift(defeatedBosses, 1)
end
return status, tonumber(reset), numDefeated, numBosses
end
function lockouts.GetLFGEncounters(character, instanceID)
local instanceInfo = character.LFGs[instanceID]
if not instanceInfo then return end
instanceInfo = tostring(instanceInfo)
local _, _, defeatedBosses = strsplit('|', instanceInfo)
defeatedBosses = tonumber(defeatedBosses or '') or 0
return GetEncounters(defeatedBosses)
end
-- World Bosses
function lockouts.GetNumSavedWorldBosses(character)
return #character.WorldBosses
end
function lockouts.GetSavedWorldBosses(character)
return character.WorldBosses
end
function lockouts.IsWorldBossKilledBy(character, bossID)
local expires = character.WorldBosses[bossID]
return expires
end
-- Instance Lockouts
function lockouts.GetNumInstanceLockouts(character)
local total, locked = 0, 0
for lockoutID, lockoutData in pairs(character.Instances) do
local _, _, instanceReset = strsplit('|', lockoutData)
if instanceReset == '0' then
locked = locked + 1
end
total = total + 1
end
return total, locked
end
local sortTable = {}
function lockouts.IterateInstanceLockouts(character)
local lockoutID = nil
return function()
local lockoutLink
lockoutID, lockoutLink = next(character.InstanceLinks, lockoutID)
return lockoutID, lockoutLink
end
end
function lockouts.GetInstanceLockoutLink(character, lockoutID)
return lockoutID and character.InstanceLinks[lockoutID]
end
function lockouts.GetInstanceLockoutInfo(character, lockoutID)
local lockoutData = lockoutID and character.Instances[lockoutID]
if not lockoutData then return end
local instanceMapID, difficulty, instanceReset, extended, isRaid, defeatedBosses = strsplit('|', lockoutData)
local defeatedBosses = tonumber(defeatedBosses)
local numDefeated, numBosses = 0, 0
while defeatedBosses and defeatedBosses > 1 do -- ignore marker bit
numDefeated = numDefeated + (defeatedBosses%2)
numBosses = numBosses + 1
defeatedBosses = bit.rshift(defeatedBosses, 1)
end
return tonumber(instanceMapID), tonumber(difficulty), tonumber(instanceReset), extended == '1', isRaid == '1', numDefeated, numBosses
end
function lockouts.GetInstanceLockoutEncounters(character, lockoutID)
local lockoutData = lockoutID and character.Instances[lockoutID]
if not lockoutData then return end
local _, _, _, _, _, defeatedBosses = strsplit('|', lockoutData)
defeatedBosses = tonumber(defeatedBosses)
return GetEncounters(defeatedBosses)
end
function lockouts.IsEncounterDefeated(character, lockoutID, encounterIndex)
local lockoutData = lockoutID and character.Instances[lockoutID]
if not lockoutData or not encounterIndex then return end
local _, _, _, _, _, defeatedBosses = strsplit('|', lockoutData)
return bit.band(defeatedBosses, 2^(encounterIndex-1)) > 0
end
-- Weekly Quests
function lockouts.IsWeeklyQuestCompletedBy(character, questID)
local characterKey = type(character) == 'string' and character or DataStore:GetCurrentCharacterKey()
local _, lastUpdate = DataStore:GetQuestHistoryInfo(characterKey)
local lastMaintenance = addon.GetLastMaintenance()
if not (lastUpdate and lastMaintenance) or lastUpdate < lastMaintenance then
return false
else
return DataStore:IsQuestCompletedBy(characterKey, questID) or false
end
end
-- setup
local PublicMethods = {
-- Looking for Group
IterateLFGs = lockouts.IterateLFGs,
GetLFGInfo = lockouts.GetLFGInfo,
GetLFGEncounters = lockouts.GetLFGEncounters,
-- World Bosses
GetSavedWorldBosses = lockouts.GetSavedWorldBosses,
GetNumSavedWorldBosses = lockouts.GetNumSavedWorldBosses,
IsWorldBossKilledBy = lockouts.IsWorldBossKilledBy,
-- Instance Lockouts
IterateInstanceLockouts = lockouts.IterateInstanceLockouts,
GetNumInstanceLockouts = lockouts.GetNumInstanceLockouts,
GetInstanceLockoutInfo = lockouts.GetInstanceLockoutInfo,
GetInstanceLockoutLink = lockouts.GetInstanceLockoutLink,
GetInstanceLockoutEncounters = lockouts.GetInstanceLockoutEncounters,
IsEncounterDefeated = lockouts.IsEncounterDefeated,
-- Weeky Quests
IsWeeklyQuestCompletedBy = lockouts.IsWeeklyQuestCompletedBy, -- TODO: does not really belong here?
}
function lockouts:OnInitialize()
self.db = LibStub('AceDB-3.0'):New(self.name .. 'DB', defaults, true)
DataStore:RegisterModule(self.name, self, PublicMethods)
for methodName in pairs(PublicMethods) do
DataStore:SetCharacterBasedMethod(methodName)
end
end
function lockouts:OnEnable()
hooksecurefunc('BonusRollFrame_StartBonusRoll', function(spellID, text, duration, currencyID)
print('BonusRollFrame_StartBonusRoll', spellID, text, duration, currencyID)
-- BonusRollFrame_StartBonusRoll 178851 '' 179 994
RequestRaidInfo()
end)
self:RegisterEvent('LFG_LOCK_INFO_RECEIVED', UpdateLFGStatus)
self:RegisterEvent('UPDATE_INSTANCE_INFO', function()
UpdateSavedBosses()
UpdateSavedInstances()
end)
RequestRaidInfo()
-- TODO: apply to instance lockous as well
-- clear expired
local now = time()
for characterKey, character in pairs(self.db.global.Characters) do
for dungeonID, data in pairs(character.LFGs) do
local status, reset, numDefeated = strsplit('|', data)
reset = tonumber(reset)
if status ~= '1' and status ~= '0' then
character.LFGs[dungeonID] = strtrim(status, ':')
elseif reset and reset ~= 0 and reset < now then
-- had lockout, lockout expired, LFG is available
character.LFGs[dungeonID] = 0
end
end
for lockoutID, lockoutData in pairs(character.Instances) do
-- instances[lockoutID] =
local a, b, reset, d, e, f = strsplit('|', lockoutData)
reset = tonumber(reset)
if reset and reset ~= 0 and reset < now then
character.Instances[lockoutID] = strjoin('|', a, b, 0, d, e, f)
end
end
end
end
function lockouts:OnDisable()
self:UnregisterEvent('LFG_LOCK_INFO_RECEIVED')
self:UnregisterEvent('UPDATE_INSTANCE_INFO')
end
|
local container = script.Parent.Parent
local roactModule = container:FindFirstChild("Roact")
local Roact = nil
if not roactModule then
-- If the rbx-ts runtime is around, try loading with that
local rbxts = game:GetService("ReplicatedStorage"):FindFirstChild("rbxts_include")
if rbxts ~= nil then
local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
Roact = TS.import(script, TS.getModule(script, "roact").src)
else
error("Roact Router failed to find Roact. Did you make sure Roact is in the same folder?")
end
else
Roact = require(roactModule)
end
return Roact
|
local mod = DBM:NewMod("ArcwayTrash", "DBM-Party-Legion", 6)
local L = mod:GetLocalizedStrings()
mod:SetRevision(("$Revision: 14860 $"):sub(12, -3))
--mod:SetModelID(47785)
mod:SetZone()
mod.isTrashMod = true
mod:RegisterEvents(
"SPELL_CAST_START 211757 226206",
"SPELL_AURA_APPLIED 194006 210750 211745"
)
--TODO, for time being, not registering high cpu spell damage events for GTFOs. One warning should be enough. Will re-evalulate if it is a problem
local specWarnArgusPortal = mod:NewSpecialWarningInterrupt(211757, "HasInterrupt", nil, nil, 1, 2)
local specWarnArcaneReconstitution = mod:NewSpecialWarningInterrupt(226206, "HasInterrupt", nil, nil, 1, 2)
local specWarnOozePuddle = mod:NewSpecialWarningMove(194006, nil, nil, nil, 1, 2)
local specWarnColapsingRift = mod:NewSpecialWarningMove(210750, nil, nil, nil, 1, 2)
local specWarnFelStrike = mod:NewSpecialWarningMove(211745, nil, nil, nil, 1, 2)
function mod:SPELL_CAST_START(args)
if not self.Options.Enabled then return end
local spellId = args.spellId
if spellId == 211757 and self:CheckInterruptFilter(args.sourceGUID, false, true) then
specWarnArgusPortal:Show(args.sourceName)
specWarnArgusPortal:Play("kickcast")
elseif spellId == 226206 and self:CheckInterruptFilter(args.sourceGUID, false, true) then
specWarnArcaneReconstitution:Show(args.sourceName)
specWarnArcaneReconstitution:Play("kickcast")
end
end
function mod:SPELL_AURA_APPLIED(args)
if not self.Options.Enabled then return end
local spellId = args.spellId
if spellId == 194006 and args:IsPlayer() then
specWarnOozePuddle:Show()
specWarnOozePuddle:Play("runaway")
elseif spellId == 210750 and args:IsPlayer() then
specWarnColapsingRift:Show()
specWarnColapsingRift:Play("runaway")
elseif spellId == 211745 and args:IsPlayer() then
specWarnFelStrike:Show()
specWarnFelStrike:Play("runaway")
end
end
|
addPackage("gh:gabime/spdlog")
project "spdlog"
kind "StaticLib"
language "C++"
cppdialect "C++11"
files
{
"spdlog/src/spdlog.cpp",
"spdlog/src/stdout_sinks.cpp",
"spdlog/src/color_sinks.cpp",
"spdlog/src/file_sinks.cpp",
"spdlog/src/async.cpp",
"spdlog/src/cfg.cpp"
}
includedirs
{
"spdlog/include"
}
defines
{
"SPDLOG_COMPILED_LIB"
}
IncludeDir["spdlog"] = "%{wks.location}/example/deps/spdlog/include"
filter "system:macosx"
sysincludedirs
{
"./spdlog/include"
}
filter "configurations:Debug"
symbols "on"
filter "configurations:Release"
optimize "on" |
-----------------------------------
-- Area: Bastok Markets
-- NPC: Chat Manual
-- Type: Tutorial NPC
-- !pos -309.989 -10.004 -116.634 235
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
player:startEvent(6106)
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
|
local VisualTicker = require 'VisualTicker'
local VisualList = require 'VisualList'
local VisualTickerList = class('VisualTickerList', VisualList)
function VisualTickerList:initialize(tickers)
VisualList.initialize(self, tickers)
end
function VisualTickerList:incrementSelected()
self.items[self.selectedItem]:increment()
end
function VisualTickerList:decrementSelected()
self.items[self.selectedItem]:decrement()
end
function VisualTickerList:clearSelected()
self.items[self.selectedItem]:clear()
end
function VisualTickerList:textinput(text)
self.items[self.selectedItem]:textinput(text)
end
function VisualTickerList:backspace()
self.items[self.selectedItem]:backspace()
end
function VisualTickerList:addTicker()
self.items[#self.items + 1] = VisualTicker()
end
return VisualTickerList
|
-- requires module 'options' for build options
require("../source/build/options")
BUILD_ALL = _OPTIONS["build_all"]
BUILD_SAMPLES = BUILD_ALL or _OPTIONS["build_samples"]
BUILD_APP = BUILD_ALL or _OPTIONS["build_app"]
-- processor instruction set architecture
X64 = _OPTIONS["x64"]
X86 = _OPTIONS["x86"]
if not X64 and not X86 then
X64 = true
X86 = true
end
-- compilers
MSVC = _OPTIONS["msvc"] or _ACTION == "vs2015" or _ACTION == "vs2013" or _ACTION == "vs2010" or _ACTION == "vs2008"
GCC = _OPTIONS["gcc"] or _ACTION == "gmake"
-- target platform
WINDOWS = _OPTIONS["windows"] or MSVC
LINUX = _OPTIONS["linux"] or GCC
-- buildname
BUILD_TARGET = _ACTION
-- target types
CONSOLE_APP_KIND = "ConsoleApp"
WINDOWED_APP_KIND = "WindowedApp"
-- cpp dialect
CPP_STANDARD = 2011
-- intermediate directory
INTERMEDIATE = "../intermediate/%{cfg.buildcfg}/" ..BUILD_TARGET.. "/%{cfg.architecture}"
-- output directory
BIN_DIR = "../bin/%{cfg.buildcfg}/" ..BUILD_TARGET.. "/%{cfg.architecture}"
-- libraries
DBG_LIBS = {}
if WINDOWS then
table.insert(DBG_LIBS, "Dbghelp")
elseif LINUX then
table.insert(DBG_LIBS, "dl")
end
-- link options
DBG_LINK_OPTIONS = {}
if GCC then
table.insert(DBG_LINK_OPTIONS, "-rdynamic")
end
-- FLTK library usage
USES_FLTK = false
-- visual studio .natvis visualizer support
SUPPORTS_NATVIS = WINDOWS and (_ACTION ~= "vs2008" and _ACTION ~= "vs2010") |
-- See LICENSE for terms
-- CurrentModPath, CurrentModOptions, CurrentModDef, CurrentModId
local mod_SkipBlurbs
local mod_SkipTalks
local mod_SkipCommercials
local options
-- fired when settings are changed/init
local function ModOptions()
options = CurrentModOptions
mod_SkipBlurbs = options:GetProperty("SkipBlurbs")
mod_SkipTalks = options:GetProperty("SkipTalks")
mod_SkipCommercials = options:GetProperty("SkipCommercials")
end
-- load default/saved settings
OnMsg.ModsReloaded = ModOptions
-- fired when option is changed
function OnMsg.ApplyModOptions(id)
if id == CurrentModId then
ModOptions()
end
end
local ChoOrig_PlayTrack = PlayTrack
function PlayTrack(track_list, index, silence, ...)
-- skip the non-music track lists
local track = track_list[1]
if track then
-- can be list of string or list of table>string
local track_type = type(track)
track = track_type == "string" and track or
track_type == "table" and track[1]
if track:find("_Blurb_") and mod_SkipBlurbs or
track:find("_Talks_") and mod_SkipTalks or
track:find("_Commercials_") and mod_SkipCommercials
then
Msg("MusicTrackEnded")
return index + 1
end
end
-- It's all good
return ChoOrig_PlayTrack(track_list, index, silence, ...)
end
|
local TitleScene = Scene:extend()
TitleScene.title = "Title"
TitleScene.restart_message = false
local main_menu_screens = {
ModeSelectScene,
SettingsScene,
CreditsScene,
ExitScene,
}
local mainmenuidle = {
"Idle",
"On title screen",
"On main menu screen",
"Twiddling their thumbs",
"Admiring the main menu's BG",
"Waiting for spring to come",
"Actually not playing",
"Contemplating collecting stars",
"Preparing to put the block!!",
"Having a nap",
"In menus",
"Bottom text",
"Trying to see all the funny rpc messages (maybe)",
"Not not not playing",
"AFK",
"Preparing for their next game",
"Who are those people on that boat?",
"Welcome to Cambridge!",
"who even reads these",
"Made with love in LOVE!",
"This is probably the longest RPC string out of every possible RPC string that can be displayed."
}
function TitleScene:new()
self.main_menu_state = 1
self.frames = 0
self.snow_bg_opacity = 0
self.y_offset = 0
self.text = ""
self.text_flag = false
DiscordRPC:update({
details = "In menus",
state = mainmenuidle[love.math.random(#mainmenuidle)],
largeImageKey = "icon2",
largeImageText = version
})
end
function TitleScene:update()
if self.text_flag then
self.frames = self.frames + 1
self.snow_bg_opacity = self.snow_bg_opacity + 0.01
end
if self.frames < 125 then self.y_offset = self.frames
elseif self.frames < 185 then self.y_offset = 125
else self.y_offset = 310 - self.frames end
end
function TitleScene:render()
love.graphics.setFont(font_3x5_4)
love.graphics.setColor(1, 1, 1, 1 - self.snow_bg_opacity)
--[[
love.graphics.draw(
backgrounds["title"],
0, 0, 0,
0.5, 0.5
)
]]
love.graphics.draw(
backgrounds["title_night"],
0, 0, 0,
0.5, 0.5
)
love.graphics.draw(
misc_graphics["icon"],
460, 170, 0,
2, 2
)
love.graphics.printf("Thanks for 1 year!", 430, 280, 160, "center")
love.graphics.setFont(font_3x5_2)
love.graphics.setColor(1, 1, 1, self.snow_bg_opacity)
love.graphics.draw(
backgrounds["snow"],
0, 0, 0,
0.5, 0.5
)
love.graphics.draw(
misc_graphics["santa"],
400, -205 + self.y_offset,
0, 0.5, 0.5
)
love.graphics.print("Happy Holidays!", 320, -100 + self.y_offset)
love.graphics.setColor(1, 1, 1, 1)
love.graphics.print(self.restart_message and "Restart Cambridge..." or "", 0, 0)
love.graphics.setColor(1, 1, 1, 0.5)
love.graphics.rectangle("fill", 20, 278 + 20 * self.main_menu_state, 160, 22)
love.graphics.setColor(1, 1, 1, 1)
for i, screen in pairs(main_menu_screens) do
love.graphics.printf(screen.title, 40, 280 + 20 * i, 120, "left")
end
end
function TitleScene:changeOption(rel)
local len = table.getn(main_menu_screens)
self.main_menu_state = (self.main_menu_state + len + rel - 1) % len + 1
end
function TitleScene:onInputPress(e)
if e.input == "menu_decide" or e.scancode == "return" then
playSE("main_decide")
scene = main_menu_screens[self.main_menu_state]()
elseif e.input == "up" or e.scancode == "up" then
self:changeOption(-1)
playSE("cursor")
elseif e.input == "down" or e.scancode == "down" then
self:changeOption(1)
playSE("cursor")
elseif e.input == "menu_back" or e.scancode == "backspace" or e.scancode == "delete" then
love.event.quit()
-- no winter easter egg for now
--[[
else
self.text = self.text .. (e.scancode or "")
if self.text == "ffffff" then
self.text_flag = true
DiscordRPC:update({
largeImageKey = "snow"
})
end
]]
end
end
return TitleScene
|
local Prop = {}
Prop.Name = "Suburbs House 2"
Prop.Cat = "House"
Prop.Price = 2500
Prop.Doors = {
Vector( -10215, -516, 190 ),
Vector( -10380, -581, 190 ),
Vector( -10516, -979, 190 ),
Vector( -10215, -516, 190 ),
Vector( -9748, -557, 190 ),
Vector( -9748, -557, 350 ),
Vector( -10083, -644, 350 ),
Vector( -10173, -644, 350 ),
Vector( -12214, 2808, 21 ),
}
GM.Property:Register( Prop ) |
local Path = require("virtes.lib.path").Path
local TestResult = require("virtes.result").TestResult
local TestContext = require("virtes.context").TestContext
local M = {}
local Test = {}
Test.__index = Test
M.Test = Test
local default_dir_path = vim.fn.getcwd() .. "/spec/screenshot"
function Test.setup(opts)
vim.validate({ opts = { opts, "table", true } })
opts = opts or {}
local result_dir = Path.new(opts.result_dir or default_dir_path)
local replay_script_path = result_dir:join("replay.vim"):get()
result_dir:delete()
result_dir:mkdir()
local tbl = {
_dir = result_dir,
_replay_script_path = replay_script_path,
_scenario = opts.scenario or function() end,
_cleanup = opts.cleanup or function()
vim.cmd("silent! %bwipeout!")
end,
_screenshot = opts.screenshot or function(file_path)
vim.api.nvim_command("redraw!")
return vim.api.nvim__screenshot(file_path)
end,
}
return setmetatable(tbl, Test)
end
function Test.run(self, opts)
vim.validate({ opts = { opts, "table", true } })
opts = opts or {}
local name = opts.name or opts.hash or "HEAD"
local dir_path = self._dir:join(name)
local ctx = TestContext.create(dir_path, opts.hash, self._screenshot)
self._cleanup()
local ok, err = ctx:_run(self._scenario)
if not ok then
print(err)
vim.api.nvim_command("cquit")
end
return TestResult.new(ctx._paths, ctx._dir, self._replay_script_path)
end
return M
|
local IUiElement = require("api.gui.IUiElement")
local ILayer = require("api.gui.ILayer")
return class.interface("IDrawLayer",
{
reset = "function",
},
{ ILayer, IUiElement })
|
-- // Services
local Players = game:GetService("Players")
-- // Vars
local LocalPlayer = Players.LocalPlayer
-- // Remove duplicates from array
local function RemoveDuplicates(Array)
-- // Vars
local Sorted = {}
local ArrayB = {}
-- // Loop through A
for _, v in ipairs(Array) do
-- // Make sure it isn't in B
if (not table.find(ArrayB, v)) then
table.insert(ArrayB, v)
table.insert(Sorted, v)
end
end
-- // Return sorted
return Sorted
end
-- // Command handler class
local CommandHandler = {}
do
-- //
CommandHandler.__index = CommandHandler
-- // Constructor
function CommandHandler.new(Data)
-- // Default values
Data = Data or {}
-- // Initialise
local self = setmetatable({}, CommandHandler)
-- // Set vars
self.Members = Data.Members or {LocalPlayer}
self.MemberType = Data.MemberType or "Whitelist"
self.ArgSeperator = Data.ArgSeperator or " "
self.ChatListenerConnections = {}
self.Commands = Data.Commands or {}
self.Prefix = Data.Prefix or "!"
-- // Return
return self
end
-- // Add Command
function CommandHandler.AddCommand(self, _Command)
_Command.Handler = self
table.insert(self.Commands, _Command)
end
-- // Check if a user is whitelisted/blacklisted
function CommandHandler.CheckUser(self, User)
-- // Vars
local isInMembers = table.find(self.Members, User) ~= nil
-- // Return
return (self.MemberType == "Whitelist" and isInMembers or not isInMembers)
end
-- //
function CommandHandler.Execute(self, ExecutePlayer, Message)
-- // Prefix failsafe
if (self.Prefix ~= "") then
-- // Check if starts with prefix
if not (Message:sub(1, 1) == self.Prefix) then
return
end
-- // Trim prefix off
Message = Message:sub(2)
end
-- // Vars
local Command
local SeperatorIndex = Message:find(self.ArgSeperator) or 0
local CommandName = Message:sub(1, SeperatorIndex - 1)
-- // Loop through each command
for _, _Command in ipairs(self.Commands) do
-- // Find the command
if (table.find(_Command.Name, CommandName) and _Command.Active) then
-- // Set
Command = _Command
-- // Break
break
end
end
-- // Make sure command exists
if not (Command) then
return
end
-- // Make sure was executed by allowed player
local IsAllowedUser = self:CheckUser(ExecutePlayer) and Command:CheckUser(ExecutePlayer)
if (not IsAllowedUser) then
return
end
-- // Get arguments
local Body = SeperatorIndex == 0 and "" or Message:sub(SeperatorIndex + 1)
local Arguments = Body:split(self.ArgSeperator)
-- // Remove "ghost argument"
if (#Arguments == 1 and Arguments[1] == "") then
Arguments = {}
end
-- // Parse arguments
local MissedArguments
Arguments, MissedArguments = Command:ParseArguments(ExecutePlayer, Arguments)
-- // Ignore if missed any arguments
if (MissedArguments) then
return
end
-- // Callback
Command.Callback(ExecutePlayer, Arguments)
end
-- // Starts a chat listener to all players
function CommandHandler.StartChatListen(self)
-- // Start a listener for all current players
local Connection = Players.PlayerChatted:Connect(function(ChatType, Player, Message, TargetPlayer)
self:Execute(Player, Message)
end)
-- // Add to connections
table.insert(self.ChatListenerConnections, Connection)
end
-- // Generates a help menu
function CommandHandler.HelpMenu(self)
-- // Vars
local Output = ""
-- // Loop through each command
for i, Command in ipairs(self.Commands) do
-- // Add to output
Output = Output .. self.Prefix .. tostring(Command) .. (i == #self.Commands and "" or "\n")
end
-- // Return
return Output
end
end
-- // Command class
local CommandClass = {}
do
-- //
CommandClass.__index = CommandClass
-- //
local tostringPattern = "%s -- %s"
CommandClass.__tostring = function(t)
local Name = table.concat(t.Name, "/")
return tostringPattern:format(Name, t.Description)
end
-- // Constructor
function CommandClass.new(Data)
-- // Initialise
local self = setmetatable({}, CommandClass)
-- // Set Vars
self.Active = Data.Active or true
self.Members = Data.Members or {LocalPlayer}
self.MemberType = Data.MemberType or "Whitelist"
self.ArgParse = Data.ArgParse or {}
self.ArgSeperator = Data.ArgSeperator or ""
self.TargetSeperator = Data.TargetSeperator or nil
self.Callback = Data.Callback or function() end
self.Description = Data.Description or ""
self.Handler = nil
self.Name = Data.Name
-- // Check if handler given
if (Data.Handler) then
-- // Set and add to handler
self.Handler = Data.Handler
self.Handler:AddCommand(self)
end
-- // Convert string name into table
if (typeof(self.Name) == "string") then
self.Name = {self.Name}
end
-- // Return
return self
end
-- // Parses player type
function CommandClass.ParsePlayerType(Argument, ExecutePlayer)
-- // Yourself
if (Argument == "me") then
return {ExecutePlayer}
end
-- // Everyone
if (Argument == "all") then
return Players:GetPlayers()
end
-- // Everyone but yourself
if (Argument == "others") then
-- // Get everyone
local AllPlayers = Players:GetPlayers()
-- // Remove self
table.remove(AllPlayers, table.find(AllPlayers, ExecutePlayer))
-- //
return AllPlayers
end
-- // Any random player
if (Argument == "random") then
-- // Get everyone
local AllPlayers = Players:GetPlayers()
-- // Select random player
return {AllPlayers[math.random(1, #AllPlayers)]}
end
-- // Loop through each player
for _, Player in ipairs(Players:GetPlayers()) do
-- // See if their name matches
if (Player.Name:lower():sub(1, #Argument) == Argument) then
-- // Return
return {Player}
end
end
end
-- // Parses a type
function CommandClass.ParseType(ExecutePlayer, Argument, Type)
-- // Skip strings/any type
if (Type == "string" or Type == "any") then
return Argument
end
-- // boolean
if (Type == "boolean") then
return Argument:lower() == "true"
end
-- // tonumber
if (Type == "number") then
return tonumber(Argument)
end
-- // colorrgb
if (Type == "colorrgb") then
-- // Split into three numbers
local R = tonumber(Argument:sub(1, 3))
local G = tonumber(Argument:sub(3, 6))
local B = tonumber(Argument:sub(6, 9))
-- // Make sure we have each
if (R and G and B) then
return Color3.fromRGB(R, G, B)
else
return Color3.fromRGB(0, 0, 0)
end
end
-- // player
if (Type == "player") then
-- //
if (self.TargetSeperator) then
-- // Split to get each target
local TargetsSplit = RemoveDuplicates(Argument:split(self.TargetSeperator))
local Parsed = {}
-- // Optimisation to skip if it's all
if (table.find(TargetsSplit, "all")) then
return self.ParsePlayerType(TargetSplit, ExecutePlayer)
end
-- // Optimisation to do others
local othersI = table.find(TargetsSplit, "others")
if (othersI) then
Parsed = self.ParsePlayerType(TargetSplit, ExecutePlayer)
table.remove(Parsed, othersI)
end
-- // Loop through each target
for _, TargetSplit in ipairs(TargetsSplit) do
-- // Parse each target to a player
local ParsedTargets = self.ParsePlayerType(TargetSplit, ExecutePlayer)[1]
-- // Make sure isn't already in there
if (not table.find(Parsed, Target)) then
-- // Add it
table.insert(Parsed, Target)
-- // Optimisations to check if everyone is already in there
if (othersI and Parsed == ExecutePlayer) then
break
end
end
end
-- // Return
return Parsed
end
-- // Return
return self.ParsePlayerType(Argument, ExecutePlayer)
end
-- // Return
return Argument
end
-- // Parse Arguments
function CommandClass.ParseArguments(self, ExecutePlayer, Arguments)
-- // Vars
local ParsedArguments = Arguments
local MissedArguments = false
-- // Loop through each argument type
for i, Types in ipairs(self.ArgParse) do
-- // Vars
local Argument = Arguments[i]
-- // Convert string -> table
if (typeof(Types) == "string") then
Types = {Types}
self.ArgParse[i] = Types
end
-- // Check for missing arguments
local isOptional = table.find(Types, "optional")
if (not isOptional and not Argument) then
MissedArguments = true
ParsedArguments[i] = nil
continue
end
-- // Attempt to parse
local Parsed
for _, Type in ipairs(Types) do
-- // Parse
Parsed = self:ParseType(ExecutePlayer, Argument, Type)
-- // Stop if parsed
if (Parsed) then
continue
end
end
-- // Set
ParsedArguments[i] = Parsed
end
-- //
return ParsedArguments, MissedArguments
end
-- // Check if a user is whitelisted/blacklisted
function CommandClass.CheckUser(self, User)
-- // Vars
local isInMembers = table.find(self.Members, User) ~= nil
-- // Return
return (self.MemberType == "Whitelist" and isInMembers or not isInMembers)
end
end
-- // Return
getgenv().CommandHandler = CommandHandler
getgenv().CommandClass = CommandClass
return CommandHandler, CommandClass |
--[[
Minecart
========
Copyright (C) 2019-2021 Joachim Stolberg
MIT
See license.txt for more information
]]--
minecart.doc = {}
if not minetest.get_modpath("doc") then
return
end
local S = minecart.S
local summary_doc = table.concat({
S("Summary"),
"------------",
"",
S("1. Place your rails and build a route with two endpoints. Junctions are allowed as long as each route has its own start and endpoint."),
S("2. Place a Railway Buffer at both endpoints (buffers are always needed, they store the route and timing information)."),
S("3. Give both Railway Buffers unique station names, like Oxford and Cambridge."),
S("4. Place a Minecart at a buffer and give it a cart number (1..999)"),
S("5. Drive from buffer to buffer in both directions using the Minecart(!) to record the routes (use 'right-left' keys to control the Minecart)."),
S("6. Punch the buffers to check the connection data (e.g. 'Oxford: connected to Cambridge')."),
S("7. Optional: Configure the Minecart waiting time in both buffers. The Minecart will then start automatically after the configured time."),
S("8. Optional: Protect your rail network with the Protection Landmarks (one Landmark at least every 16 nodes/meters)."),
S("9. Place a Minecart in front of the buffer and check whether it starts after the configured time."),
S("10. Check the cart state via the chat command: /mycart <num>\n '<num>' is the cart number"),
S("11. Drop items into the Minecart and punch the cart to start it."),
S("12. Dig the cart with 'sneak+click' (as usual). The items will be drop down."),
}, "\n")
local cart_doc = S("Primary used to transport items. You can drop items into the Minecart and punch the cart to get started. Sneak+click the cart to get cart and items back")
local buffer_doc = S("Used as buffer on both rail ends. Needed to be able to record the cart routes")
local landmark_doc = S("Protect your rails with the Landmarks (one Landmark at least every 16 blocks near the rail)")
local hopper_doc = S("Used to load/unload Minecart. The Hopper can push/pull items to/from chests and drop/pickup items to/from Minecarts. To unload a Minecart place the hopper below the rail. To load the Minecart, place the hopper right next to the Minecart.")
local pusher_doc = S([[If several carts are running on one route,
it can happen that a buffer position is already occupied and one cart therefore stops earlier.
In this case, the cart pusher is used to push the cart towards the buffer again.
This block must be placed under the rail at a distance of 2 m in front of the buffer.]])
local speed_doc = S([[Limit the cart speed with speed limit signs.
As before, the speed of the carts is also influenced by power rails.
Brake rails are irrelevant, the cart does not brake here.
The maximum speed is 8 m/s. This assumes a ratio of power rails
to normal rails of 1 to 4 on a flat section of rail. A rail section is a
series of rail nodes without a change of direction. After every curve / kink,
the speed for the next section of the route is newly determined,
taking into account the swing of the cart. This means that a cart can
roll over short rail sections without power rails.
In order to additionally brake the cart at certain points
(at switches or in front of a buffer), speed limit signs can be placed
on the track. With these signs the speed can be reduced to 4, 2, or 1 m / s.
The "No speed limit" sign can be used to remove the speed limit.
The speed limit signs must be placed next to the track so that they can
be read from the cart. This allows different speeds in each direction of travel.]])
local function formspec(data)
if data.image then
local image = "image["..(doc.FORMSPEC.ENTRY_WIDTH - 3)..",0;3,2;"..data.image.."]"
local formstring = doc.widgets.text(data.text, doc.FORMSPEC.ENTRY_START_X, doc.FORMSPEC.ENTRY_START_Y+1.6, doc.FORMSPEC.ENTRY_WIDTH, doc.FORMSPEC.ENTRY_HEIGHT - 1.6)
return image..formstring
elseif data.item then
local box = "box["..(doc.FORMSPEC.ENTRY_WIDTH - 1.6)..",0;1,1.1;#BBBBBB]"
local image = "item_image["..(doc.FORMSPEC.ENTRY_WIDTH - 1.5)..",0.1;1,1;"..data.item.."]"
local formstring = doc.widgets.text(data.text, doc.FORMSPEC.ENTRY_START_X, doc.FORMSPEC.ENTRY_START_Y+0.8, doc.FORMSPEC.ENTRY_WIDTH, doc.FORMSPEC.ENTRY_HEIGHT - 0.8)
return box..image..formstring
else
return doc.entry_builders.text(data.text)
end
end
doc.add_category("minecart",
{
name = S("Minecart"),
description = S("Minecart, the lean railway transportation automation system"),
sorting = "custom",
sorting_data = {"summary", "cart"},
build_formspec = formspec,
})
doc.add_entry("minecart", "summary", {
name = S("Summary"),
data = {text=summary_doc, image="minecart_doc_image.png"},
})
doc.add_entry("minecart", "cart", {
name = S("Minecart Cart"),
data = {text=cart_doc, item="minecart:cart"},
})
doc.add_entry("minecart", "buffer", {
name = S("Minecart Railway Buffer"),
data = {text=buffer_doc, item="minecart:buffer"},
})
doc.add_entry("minecart", "landmark", {
name = S("Minecart Landmark"),
data = {text = landmark_doc, item="minecart:landmark"},
})
doc.add_entry("minecart", "speed signs", {
name = S("Minecart Speed Signs"),
data = {text = speed_doc, item="minecart:speed4"},
})
doc.add_entry("minecart", "cart pusher", {
name = S("Cart Pusher"),
data = {text = pusher_doc, item="minecart:cart_pusher"},
})
if minecart.hopper_enabled then
doc.add_entry("minecart", "hopper", {
name = S("Minecart Hopper"),
data = {text=hopper_doc, item="minecart:hopper"},
})
end
|
--************************
--name : SINGLE_AG_FA_02.lua
--ver : 0.1
--author : Kintama
--date : 2004/09/09
--lang : en
--desc : terminal mission
--npc :
--************************
--changelog:
--2004/09/09(0.1): Added description
--************************
function DIALOG()
NODE(0)
SAY("Hello, what can I do for you?")
SAY("Greetings, how can I help you?")
SAY("Yes? How can I help you?")
SAY("Do you need anything?")
ANSWER("Yeah, I applied for a vermin extermination job.",1)
ANSWER("I got a job about taking care of some pests, and the terminal said to talk to you!")
ANSWER("The terminal told me to come here for a vermin extermination job.",1)
ANSWER("Never mind. Bye.",3)
NODE(1)
SAY("%TARGET_NPCNAME(0) have been attacking people for no apparent reason. We need to try to limit the number of them. Kill at least %TARGET_VALUE(0,1) of them. Return here for payment.")
SAY("The local population of %TARGET_NPCNAME(0) has gotten out of control and we're trying to eliminate this infestation. You need to kill %TARGET_VALUE(0,1) in order to receive payment.")
SAY("High populations of %TARGET_NPCNAME(0) are limiting our expansion. We need you to kill at least %TARGET_VALUE(0,1) so our prospecting teams can do their work.")
SETNEXTDIALOGSTATE(2)
ENDDIALOG()
NODE(2)
ISMISSIONTARGETACCOMPLISHED(0)
if (result==0) then
SAY("I'd like to chat, but we both have jobs to do. Speaking of which... shouldn't you be off killing something?")
SAY("For this mission, none of the money is up front. You have to finish the job before you get paid.")
SAY("You haven't killed enough yet. Come back when you have.")
SAY("Did you take a wrong turn or something? You won't find any of those creatures in here...")
ENDDIALOG()
else
SAY("Good work. Here's your money, it should come to %REWARD_MONEY() credits. If you want any more jobs, the terminal is always a good place to find them.")
SAY("Nice job. That should keep them at bay for a little bit... %REWARD_MONEY() credits have been deposited in your account. Good luck.")
SAY("Excellent. Here's the %REWARD_MONEY() credits for the job. We could always use a few extra people like you. If you're interested in any more jobs, try the terminal.")
ACTIVATEDIALOGTRIGGER(1)
ENDDIALOG()
end
NODE(3)
SAY("Bye.")
SAY("I'm busy right now. If you aren't here for anything, find someone else to talk to.")
SAY("Come back when you know what you want. Bye")
SAY("If you don't mind, I'm waiting for someone to do some pest control. Bye.")
ENDDIALOG()
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.