content
stringlengths 5
1.05M
|
---|
-- programme pour faire des ping en permanence
print("\n make_ping.lua zf181113.1947 \n")
zLED=0
gpio.mode(zLED, gpio.OUTPUT)
ztmr_LED = tmr.create()
value = true
dofile("ping.lua")
tmr.alarm(ztmr_LED, 500, tmr.ALARM_AUTO, function ()
if value then
gpio.write(zLED, gpio.HIGH)
else
gpio.write(zLED, gpio.LOW)
Ping("192.168.0.102")
end
value = not value
end)
|
-----------------------------------------
-- ID: 6060
-- Item: Animus Minuo Schema
-- Teaches the white magic Animus Minuo
-----------------------------------------
function onItemCheck(target)
return target:canLearnSpell(309)
end
function onItemUse(target)
target:addSpell(309)
end |
--[[---------------------------------------------------------
Super Cooking Panic for Garry's Mod
by Xperidia (2020)
-----------------------------------------------------------]]
AddCSLuaFile()
-- Function to log important stuff
function GM:Log(str)
Msg("[" .. self.Name .. "] " .. (str or "This was a log message, but something went wrong") .. "\n")
self:LogFile("\t[LOG]\t" .. str)
end
-- Function to log errors
function GM:ErrorLog(str)
ErrorNoHalt("[" .. self.Name .. "] " .. (str or "This was an error message, but something went wrong") .. "\n")
self:LogFile("\t[ERROR]\t" .. str)
end
-- Debug log that would be only show in dev mode
function GM:DebugLog(str)
if not self:ConVarGetBool("dev_mode") then
return
end
Msg("[" .. self.Name .. "] " .. (str or "This was a debug message, but something went wrong") .. "\n")
self:LogFile("\t[DEBUG]\t" .. str)
end
function GM:LogFile(str)
if not self:ConVarGetBool("log_file") then
return
end
file.Append(GAMEMODE_NAME .. "/" .. Either(SERVER, "sv_", "cl_") .. "log.txt", SysTime() .. str .. "\n")
end
function GM:FormatTime(t)
if t < 0 then
return "00:00"
end
t = string.FormattedTime(t)
if t.h >= 999 then
return "∞"
elseif t.h >= 1 then
return string.format("%02i:%02i", t.h, t.m)
elseif t.m >= 1 then
return string.format("%02i:%02i", t.m, t.s)
else
return string.format("%02i.%02i", t.s, math.Clamp(t.ms, 0, 99))
end
end
function GM:FormatTimeTri(t)
if t.h > 0 then
return string.format("%02i:%02i:%02i", t.h, t.m, t.s)
end
return string.format("%02i:%02i", t.m, t.s)
end
-- This should probably only be called clientside.
function GM:FormatLangPhrase(phrase, ...)
local args = {...}
for k, v in pairs(args) do
if isstring(v) then
args[k] = self:GetPhrase(v)
end
end
return string.format(self:GetPhrase(phrase), unpack(args))
end
function GM:GetPhrase(str)
if not isstring(str) or #str < 1 or (str[1] ~= "$" and str[1] ~= "#") then
return str
end
str = string.Right(str, #str - 1)
--[[ This library/function does not seems exist on SERVER
so here is this check if it ever does ]]
if not language or not language.GetPhrase then
return str
end
return language.GetPhrase(str)
end
--[[---------------------------------------------------------
Name: gamemode:RainbowColor(float speed, min_val, max_val)
Desc: Returns a cyclic color
-----------------------------------------------------------]]
function GM:RainbowColor(speed, min_val, max_val)
local time = CurTime() * (speed or 1)
local r = 0.5 * (math.sin(time - 2) + 1)
local g = 0.5 * (math.sin(time + 2) + 1)
local b = 0.5 * (math.sin(time) + 1)
r = math.Remap(r, 0, 1, min_val or 0, max_val or 255)
g = math.Remap(g, 0, 1, min_val or 0, max_val or 255)
b = math.Remap(b, 0, 1, min_val or 0, max_val or 255)
return Color(r, g, b)
end
--[[---------------------------------------------------------
Name: GetConvPlayerTrace(ply)
Desc: Returns a tuned trace table for the player
-----------------------------------------------------------]]
function GM:GetConvPlayerTrace(ply)
local trace = {}
trace.start = ply:EyePos()
trace.endpos = trace.start + ply:GetAimVector() * self.ConvDistance
trace.filter = ply
return util.TraceLine(trace)
end
local gm_ls = "https://assets.xperidia.com/garrysmod/loading.html#auto-scookp"
--[[----------------------------------------------------------------------------
Name: GM:SetAutoLoadingScreen()
Desc: Set the Xperidia's loading screen if no other loading screen is set.
It shows more information than the current default of Garry's Mod.
------------------------------------------------------------------------------]]
function GM:SetAutoLoadingScreen()
local cur_ls = GetConVar("sv_loadingurl"):GetString()
if cur_ls ~= "" then return end
RunConsoleCommand("sv_loadingurl", gm_ls)
end
--[[---------------------------------------------------------
Name: GM:RemoveAutoLoadingScreen()
Desc: Put back the default Garry's Mod loading screen.
-----------------------------------------------------------]]
function GM:RemoveAutoLoadingScreen()
if GetConVar("sv_loadingurl"):GetString() == gm_ls then
RunConsoleCommand("sv_loadingurl", "")
end
end
|
-- table.FindNext could get removed so heres a similar thing
local function tableFindNext( tbl, cValue )
local cInd = -1
if ( cValue ) then
for k, v in ipairs( tbl ) do
if ( v == cValue ) then
if ( k == #tbl ) then
cInd = 1
return tbl[cInd]
else
cInd = k + 1
return tbl[cInd]
end
end
end
else
return tbl[1]
end
return tbl[1]
end
--[[---------------------------------------------------------
Name: gamemode:GetValidSpectatorModes( Player ply )
Desc: Gets a table of the allowed spectator modes (OBS_MODE_INEYE, etc)
Player is the player object of the spectator
---------------------------------------------------------]]
function GM:GetValidSpectatorModes( ply )
-- Note: Override this and return valid modes per player/team
return GAMEMODE.ValidSpectatorModes
end
--[[---------------------------------------------------------
Name: gamemode:GetValidSpectatorEntityNames( Player ply )
Desc: Returns a table of entities that can be spectated (player etc)
---------------------------------------------------------]]
function GM:GetValidSpectatorEntityNames( ply )
-- Note: Override this and return valid entity names per player/team
return GAMEMODE.ValidSpectatorEntities
end
--[[---------------------------------------------------------
Name: gamemode:IsValidSpectator( Player ply )
Desc: Is our player spectating - and valid?
---------------------------------------------------------]]
function GM:IsValidSpectator( pl )
if ( !IsValid( pl ) ) then return false end
if ( pl:Team() != TEAM_SPECTATOR && !pl:IsObserver() ) then return false end
return true
end
--[[---------------------------------------------------------
Name: gamemode:IsValidSpectatorTarget( Player pl, Entity ent )
Desc: Checks to make sure a spectated entity is valid.
By default, you can change GM.CanOnlySpectate own team if you want to
prevent players from spectating the other team.
---------------------------------------------------------]]
function GM:IsValidSpectatorTarget( pl, ent )
if ( !IsValid( ent ) ) then return false end
if ( ent == pl ) then return false end
--if ( !table.HasValue( GAMEMODE:GetValidSpectatorEntityNames( pl ), ent:GetClass() ) ) then return false end
if ( ent:IsPlayer() && !ent:Alive() ) then return false end
if ( ent:IsPlayer() && ent:IsObserver() ) then return false end
if ( pl:Team() != TEAM_SPECTATOR && ent:IsPlayer() && GAMEMODE.CanOnlySpectateOwnTeam && pl:Team() != ent:Team() ) then return false end
return true
end
--[[---------------------------------------------------------
Name: gamemode:GetSpectatorTargets( Player pl )
Desc: Returns a table of entities the player can spectate.
---------------------------------------------------------]]
function GM:GetSpectatorTargets( pl )
local t = {}
for k, v in ipairs( GAMEMODE:GetValidSpectatorEntityNames( pl ) ) do
t = table.Merge( t, ents.FindByClass( v ) )
end
return t
end
--[[---------------------------------------------------------
Name: gamemode:StartEntitySpectate( Player pl )
Desc: Called when we start spectating.
---------------------------------------------------------]]
function GM:StartEntitySpectate( pl )
local CurrentSpectateEntity = pl:GetObserverTarget()
if ( GAMEMODE:IsValidSpectatorTarget( pl, CurrentSpectateEntity ) ) then
pl:SpectateEntity( CurrentSpectateEntity )
return
end
local targets = GAMEMODE:GetSpectatorTargets( pl )
if ( ( #targets == 1 and table.HasValue(targets, pl) ) or #targets == 0 ) then
GAMEMODE:ChangeObserverMode( pl, OBS_MODE_ROAMING )
return
end
local randomInd = 0
local found = false
for i=1, #targets do
randomInd = math.random( 1, #targets - i - 1 )
if ( GAMEMODE:IsValidSpectatorTarget( pl, targets[randomInd] ) ) then
pl:SpectateEntity( targets[randomInd] )
found = true
return
end
table.remove( targets, randomInd )
end
if ( not found ) then
GAMEMODE:ChangeObserverMode( pl, OBS_MODE_ROAMING )
end
end
--[[---------------------------------------------------------
Name: gamemode:NextEntitySpectate( Player pl )
Desc: Called when we want to spec the next entity.
---------------------------------------------------------]]
function GM:NextEntitySpectate( pl )
local cTarget = pl:GetObserverTarget()
local targets = GAMEMODE:GetSpectatorTargets( pl )
if ( ( #targets == 1 and table.HasValue(targets, pl) ) or #targets == 0 ) then
GAMEMODE:ChangeObserverMode( pl, OBS_MODE_ROAMING )
return
end
local found = false
local cIndex = -1
for k, v in ipairs(targets) do
if ( cIndex ~= -1 and GAMEMODE:IsValidSpectatorTarget( pl, targets[k] ) ) then
pl:SpectateEntity( targets[k] )
found = true
return
end
if ( v == cTarget ) then
cIndex = k
end
end
if ( not found ) then
for i=1, cIndex do
if ( GAMEMODE:IsValidSpectatorTarget( pl, targets[i] ) ) then
pl:SpectateEntity( targets[i] )
found = true
return
end
end
end
if ( not found ) then
GAMEMODE:ChangeObserverMode( pl, OBS_MODE_ROAMING )
end
end
--[[---------------------------------------------------------
Name: gamemode:PrevEntitySpectate( Player pl )
Desc: Called when we want to spec the previous entity.
---------------------------------------------------------]]
function GM:PrevEntitySpectate( pl )
local cTarget = pl:GetObserverTarget()
local targets = GAMEMODE:GetSpectatorTargets( pl )
if ( ( #targets == 1 and table.HasValue(targets, pl) ) or #targets == 0 ) then
GAMEMODE:ChangeObserverMode( pl, OBS_MODE_ROAMING )
return
end
local found = false
local cIndex = -1
for k=#targets, 1, -1 do
if ( cIndex ~= -1 and GAMEMODE:IsValidSpectatorTarget( pl, targets[k] ) ) then
pl:SpectateEntity( targets[k] )
found = true
return
end
if ( targets[k] == cTarget ) then
cIndex = k
end
end
if ( cIndex == 1 ) then
cIndex = #targets
end
if ( not found ) then
for i=cIndex, 1, -1 do
if ( GAMEMODE:IsValidSpectatorTarget( pl, targets[i] ) ) then
pl:SpectateEntity( targets[i] )
found = true
return
end
end
end
if ( not found ) then
GAMEMODE:ChangeObserverMode( pl, OBS_MODE_ROAMING )
end
end
--[[---------------------------------------------------------
Name: gamemode:ChangeObserverMode( Player pl, Number mode )
Desc: Change the observer mode of a player.
---------------------------------------------------------]]
function GM:ChangeObserverMode( pl, mode )
local modeCl = pl:GetInfoNum( "cl_spec_mode", OBS_MODE_ROAMING )
-- If mode is -1 we will use the player's spec mode
if ( mode < 1 or mode > OBS_MODE_ROAMING or mode == nil ) then
mode = math.Clamp( modeCl, OBS_MODE_FIXED, OBS_MODE_ROAMING )
end
if ( modeCl ~= mode ) then
pl:ConCommand( "cl_spec_mode "..mode )
end
if ( mode == OBS_MODE_IN_EYE || mode == OBS_MODE_CHASE ) then
GAMEMODE:StartEntitySpectate( pl, mode )
end
pl:Spectate( mode )
pl:SpectateEntity( nil )
end
--[[---------------------------------------------------------
Name: gamemode:BecomeObserver( Player pl )
Desc: Called when we first become a spectator.
---------------------------------------------------------]]
function GM:BecomeObserver( pl )
local mode = pl:GetInfoNum( "cl_spec_mode", OBS_MODE_CHASE )
local modes = GAMEMODE:GetValidSpectatorModes( pl )
if ( !table.HasValue( modes, mode ) ) then
mode = tableFindNext( modes, mode ) -- Will get the first valid spectator mode
end
GAMEMODE:ChangeObserverMode( pl, mode )
end
local function spec_mode( pl, cmd, args )
if ( !GAMEMODE:IsValidSpectator( pl ) ) then return end
local mode = pl:GetObserverMode()
local modes = GAMEMODE:GetValidSpectatorModes( pl )
if ( !table.HasValue( modes, mode ) ) then
GAMEMODE:ChangeObserverMode( pl, -1 ) -- Return to player's chosen spec mode
return
end
local nextmode = tableFindNext( modes, mode )
GAMEMODE:ChangeObserverMode( pl, nextmode )
end
concommand.Add( "spec_mode", spec_mode )
local function spec_next( pl, cmd, args )
local mode = pl:GetObserverMode()
if ( !GAMEMODE:IsValidSpectator( pl ) ) then return end
if ( !table.HasValue( GAMEMODE:GetValidSpectatorModes( pl ), mode ) ) then
GAMEMODE:ChangeObserverMode( pl, -1 ) -- Return to player's chosen spec mode
return
end
GAMEMODE:NextEntitySpectate( pl )
end
concommand.Add( "spec_next", spec_next )
local function spec_prev( pl, cmd, args )
local mode = pl:GetObserverMode()
if ( !GAMEMODE:IsValidSpectator( pl ) ) then return end
if ( !table.HasValue( GAMEMODE:GetValidSpectatorModes( pl ), mode ) ) then
GAMEMODE:ChangeObserverMode( pl, -1 ) -- Return to player's chosen spec mode
return
end
GAMEMODE:PrevEntitySpectate( pl )
end
concommand.Add( "spec_prev", spec_prev ) |
local function VBarPaint(panel)
local vbar = panel:GetVBar()
vbar.Paint = function() end
vbar.btnUp.Paint = function() end
vbar.btnDown.Paint = function() end
vbar.btnGrip.Paint = function(panel, w, h)
if (panel.Depressed) then
draw.RoundedBox(4, 2, 1, 6, h - 2, ColorAlpha(color_white, 75))
return
end
if (panel:IsHovered()) then
draw.RoundedBox(4, 2, 1, 6, h - 2, ColorAlpha(color_white, 50))
return
end
draw.RoundedBox(4, 2, 1, 6, h - 2, ColorAlpha(color_white, 25))
end
end
local function AddButonFooter(parent, text, addictive, callback)
local btn = parent:Add("DButton")
btn:Dock(TOP)
btn:SetTextColor(color_white)
btn:DockMargin(0, 0, 0, 5)
btn:SetText(text)
btn.DoClick = callback
btn.Paint = function(t, w, h)
derma.SkinFunc("PaintButton2", t, w, h, t:IsHovered() and ix.config.Get("color"))
end
if (addictive) then
parent:SetTall(parent:GetTall() + btn:GetTall())
else
parent:SetTall(btn:GetTall())
end
return btn
end
local imgur_patterns = {
"https?://[www%.]*.?i.imgur.com/(%w+)",
"https?://[www%.]*.?imgur.com/a/(%w+)",
"https?://[www%.]*.?imgur.com/gallery/(%w+)"
}
local PANEL = {}
function PANEL:Init()
self:SetSize(ScrW() * 0.6, ScrH() * 0.7)
self:SetTitle(L"squad_menu_title")
self:Center()
self:MakePopup()
self:SetDraggable(true)
-- self:SetSkin("Default")
self.netData = {}
self.categoryPanels = {}
self.memberTags = {}
self.lblTitle:SetFont("MapFont")
self.lblTitle.UpdateColours = function(label)
return label:SetTextStyleColor(color_white)
end
self.header = self:Add("Panel")
self.header:Dock(TOP)
self.leftPanel = self:Add("DScrollPanel")
self.leftPanel:SetWide(self:GetWide() * 0.5 - 7)
self.leftPanel:Dock(LEFT)
self.leftPanel:DockMargin(0, 4, 0, 4)
self.leftPanel:SetPaintBackground(false)
VBarPaint(self.leftPanel)
self.rightPanel = self:Add("Panel")
self.rightPanel:SetWide(self:GetWide() * 0.5 - 7)
self.rightPanel:Dock(RIGHT)
self.rightPanel:DockMargin(0, 4, 0, 4)
self.logoSideLeft = self.leftPanel:Add("Panel")
self.logoSideLeft:SetTall(128)
self.logoSideLeft:Dock(TOP)
self.logoSideLeft:DockMargin(4, 4, 0, 4)
end
function PANEL:IsLeader()
return self.leader
end
function PANEL:IsOfficer()
return self.officer
end
function PANEL:SetMembers(data, bNotTnitLeftSide)
local text_rank
local localSteamID64 = LocalPlayer():SteamID64()
self:AddCategory("Leader")
self:AddCategory("Officers")
self:AddCategory("Members")
for sid, rank in pairs(data.members) do
if (IsValid(self.memberTags[sid])) then
if (self.memberTags[sid].sq_rank != rank) then
self.memberTags[sid]:Remove()
self.memberTags[sid] = nil
else
continue
end
end
text_rank = "Members"
if (rank == 2) then
text_rank = "Leader"
elseif (rank == 1) then
text_rank = "Officers"
end
if (!self.categoryPanels[text_rank]) then continue end
local nametag = self.categoryPanels[text_rank][1]:Add("ixSquadMemberTag")
nametag.name:SetFont("squadNameTag")
nametag:SetAvatar(sid)
nametag:SizeToContents()
nametag.sq_rank = rank
self.memberTags[sid] = nametag
if (sid == localSteamID64) then
if (rank == 2) then
self.leader = true
elseif (rank == 1) then
self.officer = true
end
end
end
self.data = data
if (!bNotTnitLeftSide) then
self:InitLeftSide(data)
end
end
function PANEL:InitLeftSide(data)
if (self:IsLeader()) then
self.entryName = self.header:Add("DTextEntry")
self.entryName:SetFont("ixMenuButtonFont")
self.entryName:SetPlaceholderText(L"squad_menu_holdername")
self.entryName:SetPlaceholderColor(color_white)
self.entryName:SetTall(32)
self.entryName:Dock(TOP)
self.entryName:SetUpdateOnType(true)
self.entryName.OnEnter = function(_, value)
if (#value > 0 and value != self.data.name) then
self.netData["name"] = value:Trim()
end
end
self.entryName.AllowInput = function(t, newCharacter)
if (string.len(t:GetText() .. newCharacter) > 48) then
surface.PlaySound("common/talk.wav")
return true
end
end
self.entryName.Think = function(t)
local text = t:GetText()
if (text:utf8len() > 48) then
local newText = text:utf8sub(0, 48)
t:SetText(newText)
t:SetCaretPos(newText:utf8len())
end
end
self.entryName.Paint = function(t, w, h)
surface.SetDrawColor(90, 90, 90, 255)
surface.DrawRect(0, 0, w, h)
if (t.GetPlaceholderText and t.GetPlaceholderColor and t:GetPlaceholderText() and t:GetPlaceholderText():Trim() != "" and t:GetPlaceholderColor() and ( !t:GetText() or #t:GetText() == 0 )) then
local oldText = t:GetText()
t:SetText(t:GetPlaceholderText())
t:DrawTextEntryText(color_white, ix.config.Get("color"), color_white)
t:SetText(oldText)
return
end
t:DrawTextEntryText(color_white, ix.config.Get("color"), color_white)
end
else
self.entryName = self.header:Add("DLabel")
self.entryName:SetFont("ixMenuButtonFont")
self.entryName:SetTall(32)
self.entryName:Dock(TOP)
self.entryName:SetContentAlignment(5)
end
self.entryName:SetText(data.name)
self.squad_color = self.header:Add("Panel")
self.squad_color.color = data.color or color_white
self.squad_color:Dock(TOP)
self.squad_color:DockMargin(0, 4, 0, 4)
self.squad_color:SetTall(8)
self.squad_color.Paint = function(t, w, h)
draw.RoundedBox(4, 0, 0, w, h, self.netData["color"] or t.color or color_white)
end
self.header:SetTall(self.entryName:GetTall() + self.squad_color:GetTall() + 4)
local logo_lbl = self.logoSideLeft:Add("DLabel")
logo_lbl:SetFont("ixSmallFont")
logo_lbl:SetText(L"squad_menu_text_logo")
logo_lbl:SetTextColor(color_white)
logo_lbl:Dock(TOP)
if (self:IsLeader()) then
self.squadImg = self.logoSideLeft:Add("DImageButton")
self.squadImg.DoClick = function(t)
Derma_StringRequest(
L"squad_menu_text_logo2",
L"squad_menu_holderlogo",
"",
function(text)
if (#text == 0) then
self.netData["logoID"] = "ovW4MBM"
ix.util.FetchImage("ovW4MBM", function(mat)
self.squadImg:SetMaterial(mat or Material("icon16/cross.png")) -- ix.util.GetMaterial
end)
else
for _, v in ipairs(imgur_patterns) do
local logoID = text:match(v)
if (logoID) then
self.netData["logoID"] = logoID
break
end
end
if (self.netData["logoID"]) then
ix.util.FetchImage(self.netData["logoID"], function(mat)
self.squadImg:SetMaterial(mat or Material("icon16/cross.png")) -- ix.util.GetMaterial
end)
end
end
end,
function(text) end
)
end
else
self.squadImg = self.logoSideLeft:Add("DImage")
end
self.squadImg:SetSize(128, 128)
self.squadImg:Dock(LEFT)
ix.util.FetchImage(data.logo or "ovW4MBM", function(mat) -- squad logo
self.squadImg:SetMaterial(mat or Material("icon16/cross.png"))
end)
self:InitRightSide(data)
end
function PANEL:InitRightSide(data)
local message_lbl = self.rightPanel:Add("DLabel")
message_lbl:SetFont("ixSmallFont")
message_lbl:SetText(L"squad_menu_messageday")
message_lbl:SetTextColor(color_white)
message_lbl:Dock(TOP)
self.entryMessage = self.rightPanel:Add("RichText")
self.entryMessage:Dock(FILL)
self.entryMessage.text = data.description or ""
self.entryMessage:SetText(self.entryMessage.text)
self.entryMessage.PerformLayout = function(t)
t:SetFontInternal("ixMenuButtonFontSmall")
t:SetFGColor(Color("green"))
end
-- Actions
local a1 = self.rightPanel:Add("Panel")
a1:Dock(BOTTOM)
a1:DockMargin(0, 4, 0, 4)
local actions_lbl = a1:Add("DLabel")
actions_lbl:SetFont("ixSmallFont")
actions_lbl:SetText("Actions")
actions_lbl:SetTextColor(color_white)
actions_lbl:Dock(TOP)
--[[ if (self:IsLeader()) then
AddButonFooter(a1, "Squad logs", true, function(t)
// TODO: реализовать логи
end)
end ]]
if (self:IsLeader() or self:IsOfficer()) then
AddButonFooter(a1, L"squad_menu_btn_invite", true, function(t)
local menu = DermaMenu()
for _, v in ipairs(player.GetAll()) do
if (IsValid(v) and v != LocalPlayer() and LocalPlayer():GetPos():DistToSqr(v:GetPos()) < 160*160) then
if (self.data.members[v:SteamID64()]) then continue end
menu:AddOption(v:Name(), function()
net.Start("ixSquadInvite")
net.WriteEntity(v)
net.SendToServer()
end)
end
end
menu:Open()
end)
end
if (self:IsLeader()) then
AddButonFooter(a1, L"squad_menu_btn_color", true, function(t)
local color = vgui.Create("DColorCombo")
color:SetupCloseButton(function() CloseDermaMenus() end)
color:SetColor(color_white)
color.OnValueChanged = function(_, col)
self.netData["color"] = col
end
local menu = DermaMenu()
menu:AddPanel(color)
menu:SetPaintBackground(false)
menu:Open(gui.MouseX() + 8, gui.MouseY() + 10)
end)
AddButonFooter(a1, L"squad_menu_btn_disband", true, function(t)
Derma_Query(L"squad_menu_btn_ask_disband", L"squad_menu_btn_disband", L"text_yes", function()
net.Start("ixSquadDisband")
net.SendToServer()
self:Remove()
end, L"text_no")
end)
else
AddButonFooter(a1, L"squad_menu_btn_leave", true, function(t)
net.Start("ixSquadLeave")
net.SendToServer()
self:Remove()
end)
end
a1:SetTall(a1:GetTall() + actions_lbl:GetTall())
if (self:IsLeader()) then
a1 = self.rightPanel:Add("Panel")
a1:Dock(BOTTOM)
a1:DockMargin(0, 4, 0, 4)
AddButonFooter(a1, L"squad_menu_btn_editdesc", nil, function(t)
if (IsValid(self.notepad)) then
self.notepad:Remove()
end
self.notepad = self:Add("DFrame")
self.notepad:SetSize(self.entryMessage:GetSize())
self.notepad:MakePopup()
self.notepad:SetPos(self:GetPos())
self.notepad:SetTitle(L"squad_menu_messageday")
self.descNotepad = self.notepad:Add("DTextEntry")
self.descNotepad:SetFont("ixMenuButtonFontSmall")
self.descNotepad:SetPlaceholderText(L"squad_menu_holderdesc")
self.descNotepad:SetMultiline(true)
self.descNotepad:Dock(FILL)
self.descNotepad:SetText(self.entryMessage.text)
self.descNotepad:SetUpdateOnType(true)
self.descNotepad.AllowInput = function(t, newCharacter)
if (string.len(t:GetText() .. newCharacter) > 2048) then
surface.PlaySound("common/talk.wav")
return true
end
end
self.descNotepad.Think = function(t)
local text = t:GetText()
if (text:utf8len() > 2048) then
local newText = text:utf8sub(0, 2048)
t:SetText(newText)
t:SetCaretPos(newText:utf8len())
end
end
self.descNotepad.OnValueChange = function(_, value)
self.notepad.save_desc = true
self.entryMessage.text = value
self.entryMessage:SetText(self.entryMessage.text)
end
self.descNotepad.Paint = function(t, w, h)
surface.SetDrawColor(90, 90, 90, 255)
surface.DrawRect(0, 0, w, h)
if (t.GetPlaceholderText and t.GetPlaceholderColor and t:GetPlaceholderText() and t:GetPlaceholderText():Trim() != "" and t:GetPlaceholderColor() and ( !t:GetText() or #t:GetText() == 0 )) then
local oldText = t:GetText()
t:SetText(t:GetPlaceholderText())
t:DrawTextEntryText(color_white, ix.config.Get("color"), color_white)
t:SetText(oldText)
return
end
t:DrawTextEntryText(color_white, ix.config.Get("color"), color_white)
end
self.closeNotepad = self.notepad:Add("DButton")
self.closeNotepad:Dock(BOTTOM)
self.closeNotepad:SetText(L"squad_menu_btn_save")
self.closeNotepad:SetTall(32)
self.closeNotepad.DoClick = function()
if (self.notepad.save_desc) then
self.netData["description"] = self.descNotepad:GetValue()
self.entryMessage.text = self.netData["description"]
self.entryMessage:SetText(self.netData["description"])
self.entryMessage:PerformLayout()
end
self.notepad:Remove()
end
end)
end
end
function PANEL:AddCategory(title)
if (!self.categoryPanels[title]) then
local cat = vgui.Create('DCollapsibleCategory', self.leftPanel)
cat.Paint = function() end
cat.Header:SetFont("ixSmallFont")
cat.Header:SetContentAlignment(4)
cat.Header.Paint = function(t, w, h)
derma.SkinFunc("PaintButton2", t, w, h, t:IsHovered() and ix.config.Get("color"))
end
cat:SetLabel(L2("squad_menu_text_" .. title) or title)
cat:Dock(TOP)
cat.Think = function(t)
if ((t.nextThink or 0) < CurTime()) then
t.nextThink = CurTime() + 1
else
return
end
if (t.Contents) then
if (#t.Contents:GetChildren() < 1) then
t:Remove()
self.categoryPanels[title] = nil
else
t:SetLabel(Format("%s: %d", title, #t.Contents:GetChildren()))
end
end
end
local slot = vgui.Create('DIconLayout', cat)
slot:SetSpaceX(5)
slot:SetSpaceY(5)
slot:SetBorder(5)
slot:Dock(TOP)
slot:InvalidateLayout(true)
cat:SetContents(slot)
self.categoryPanels[title] = {slot, cat}
return self.categoryPanels
end
end
function PANEL:OnRemove()
if (!table.IsEmpty(self.netData)) then
net.Start("ixSquadSettings")
net.WriteTable(self.netData)
net.SendToServer()
end
end
function PANEL:OnKeyCodeReleased(key_code)
if (input.LookupKeyBinding(key_code) == "gm_showspare2") then
self:Remove()
end
end
function PANEL:Paint(w, h)
derma.SkinFunc("PaintFrame2", self, w, h)
end
vgui.Register("ixSquadView", PANEL, "DFrame")
PANEL = {}
function PANEL:Init()
self.name = self:Add("DLabel")
self.avatar = self:Add("AvatarImage")
end
function PANEL:OnMousePressed(code)
if (code == MOUSE_RIGHT) then
local menu = DermaMenu()
menu:AddOption(L("viewProfile"), function()
gui.OpenURL("https://steamcommunity.com/profiles/" .. self.steamid)
end):SetImage("icon16/report_user.png")
if (LocalPlayer():SteamID64() != self.steamid) then
menu:AddSpacer()
menu:AddOption(L"squad_menu_opt_sendpm", function()
Derma_StringRequest(
L"squad_menu_opt_sendpm":utf8upper(),
L"squad_menu_opt_message",
"",
function(text)
if (#text > 0) then
for _, v in ipairs(player.GetAll()) do
if (IsValid(v) and v:SteamID64() == self.steamid) then
RunConsoleCommand("say", "/pm", v:Name(), text)
break
end
end
end
end,
function(text) end
)
end):SetImage("icon16/user_comment.png")
end
local squad = ix.squad.list[LocalPlayer():GetCharacter():GetSquadID()]
if (squad and squad.members[self.steamid] and LocalPlayer():SteamID64() != self.steamid) then
local rank = squad:GetRank(LocalPlayer())
if (rank and rank != 0) then
if (squad:IsLeader(LocalPlayer())) then
if (squad.members[self.steamid] == 0) then
menu:AddSpacer()
menu:AddOption(L"squad_menu_btn_raiseofficer", function()
Derma_Query(L"squad_menu_btn_ask_raiseofficer", L"squad_menu_btn_raise", L"text_yes", function()
net.Start("ixSquadRankChange")
net.WriteString(self.steamid)
net.SendToServer()
end, L"text_no")
end):SetImage("icon16/user_go.png")
else
menu:AddSpacer()
menu:AddOption(L"squad_menu_btn_demote", function()
Derma_Query(L"squad_menu_btn_ask_demote", L"squad_menu_text_demote", L"text_yes", function()
net.Start("ixSquadRankChange")
net.WriteString(self.steamid)
net.SendToServer()
end, L"text_no")
end):SetImage("icon16/user.png")
end
end
if (rank != 0 and squad.members[self.steamid] == 0) then
menu:AddSpacer()
menu:AddOption(L"squad_menu_btn_kickmember", function()
Derma_Query(L("squad_menu_text_kickmember", self.name:GetText(), squad.name), L"squad_menu_btn_kickmember", L"text_yes", function()
net.Start("ixSquadKickMember")
net.WriteString(self.steamid)
net.SendToServer()
end, L"text_no")
end):SetImage("icon16/user_delete.png")
end
end
end
menu:Open()
end
end
function PANEL:SetAvatar(steamid)
self.noname = true
self.avatar:SetSteamID(steamid, 32)
self.name:SetText(steamid)
for _, v in ipairs(player.GetAll()) do
if (IsValid(v) and v:SteamID64() == steamid) then
self.name:SetTextColor(ix.option.Get("squadTeamColor", Color(51, 153, 255)))
self.name:SetText(v:Name())
ix.steam.users[steamid] = v:Name()
self.steamName = true
self.noname = nil
break
end
end
self.steamid = steamid
self.nextSteamQuery = nil
self:UpdateNickname(steamid)
end
function PANEL:UpdateNickname(steamid)
if (ix.steam.users[steamid]) then
self.name:SetText(ix.steam.users[steamid])
self.noname = nil
elseif (!self.steamName and (self.nextSteamQuery or 0) < CurTime()) then
local name = ix.steam.GetNickName(steamid)
if name then
self.name:SetText(name)
self.noname = nil
end
end
end
function PANEL:Think()
if (self.next_think or 0) < CurTime() then
if (self.noname and self.steamid) then
self:UpdateNickname(self.steamid)
self.nextSteamQuery = CurTime() + 10
end
local panel = ix.gui.squad
if (IsValid(panel) and panel.data and !panel.data.members[self.steamid]) then
panel.memberTags[self.steamid] = nil
if (self.text_rank) then
local cat = panel.categoryPanels[self.text_rank]
if (cat and IsValid(cat[2])) then
cat[2]:SetLabel(Format("%s: %d", self.text_rank, #cat[2].Contents:GetChildren()))
end
end
self:Remove()
return
end
self.next_think = CurTime() + 1
end
end
function PANEL:Paint(w, h)
if (self:IsHovered()) then
self:SetCursor("hand")
surface.SetDrawColor(46, 46, 46, 200)
surface.DrawRect(self.avatar:GetWide(), 0, w - self.avatar:GetWide(), h)
surface.SetDrawColor(ix.config.Get("color"))
surface.DrawOutlinedRect(self.avatar:GetWide(), 0, w - self.avatar:GetWide(), h)
else
self:SetCursor("arrow")
surface.SetDrawColor(35, 35, 35)
surface.DrawRect(0, 0, w, h)
end
end
function PANEL:PerformLayout(width, height)
self.name:SetPos(width - self.name:GetWide() - 8, height / 2 - self.name:GetTall() / 2)
self.avatar:MoveLeftOf(self.name, 16 * 0.5)
end
function PANEL:SizeToContents()
self.name:SizeToContents()
local tall = self.name:GetTall()
self.avatar:SetSize(tall + 16, tall + 16)
self:SetSize(self.name:GetWide() + self.avatar:GetWide() + 32 * 0.5, self.name:GetTall() + 16)
end
vgui.Register("ixSquadMemberTag", PANEL, "Panel") |
---@type discordia
local discordia = require('discordia')
local stringx = require('utils/stringx')
local tablex = discordia.extensions.table
--- Default command handler
---@param client SuperToastClient
---@param msg Message
return function(client, msg)
local pre = client.config.prefix
if msg.author.bot then
return
end
if type(pre) == 'function' then
pre = pre(msg)
end
pre = type(pre) == 'string' and {pre} or pre
local foundPre
for _, v in pairs(pre) do
if stringx.startswith(msg.content, v) then
foundPre = v
break
end
end
if not foundPre then
return
end
local cleaned = foundPre:gsub('[%(%)%.%%%+%-%*%?%[%]%^%$]', function(c)
return '%' .. c
end)
local command = msg.content:gsub('^' .. cleaned, '')
local split = stringx.split(command, ' ')
command = split[1]
if not command or command == '' then
return
end
local args = tablex.slice(split, 2)
local found = client.commands:find(function(cmd)
return cmd.name == command or cmd.aliases:find(function(alias)
return alias == command
end)
end)
if found then
local toRun, errMsg = found:toRun(msg, args, client)
if type(toRun) == 'string' then
msg:reply(client.config.errorResolver(found, toRun, errMsg))
else
local succ, err = pcall(toRun, msg, args, client, {
prefix = foundPre
})
if not succ then
msg:reply('Something went wrong, try again later')
client:error(err)
end
end
end
end
|
-- Created By Bapes#1111 --
-- Please do not distrubute without consent --
---@diagnostic disable: undefined-global, lowercase-global
local Tinkr = ...
local Routine = Tinkr.Routine
local AceGUI = Tinkr.Util.AceGUI
local Config = Tinkr.Util.Config
local config = Config:New("demo")
local HTTP = Tinkr.Util.HTTP
local wowex = {}
local player = "player"
local target = "target"
local pet = "pet"
local authenticated = false
local name = "Demo Rotation"
local version = "v1.0-beta"
-- CROMULON --
Tinkr:require("scripts.cromulon.libs.Libdraw.Libs.LibStub.LibStub", wowex)
Tinkr:require("scripts.cromulon.libs.Libdraw.LibDraw", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.AceGUI30", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIContainer-BlizOptionsGroup", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIContainer-DropDownGroup", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIContainer-Frame", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIContainer-InlineGroup", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIContainer-ScrollFrame", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIContainer-SimpleGroup", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIContainer-TabGroup", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIContainer-TreeGroup", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIContainer-Window", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-Button", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-CheckBox", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-ColorPicker", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-DropDown", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-DropDown-Items", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-EditBox", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-Heading", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-Icon", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-InteractiveLabel", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-Keybinding", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-Label", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-MultiLineEditBox", wowex)
Tinkr:require("scripts.cromulon.libs.AceGUI30.widgets.AceGUIWidget-Slider", wowex)
Tinkr:require("scripts.cromulon.system.configs", wowex)
Tinkr:require('scripts.wowex.libs.AceAddon30.AceAddon30' , wowex)
Tinkr:require('scripts.wowex.libs.AceConsole30.AceConsole30' , wowex)
Tinkr:require('scripts.wowex.libs.AceDB30.AceDB30' , wowex)
Tinkr:require('scripts.cromulon.system.storage' , wowex)
Tinkr:require("scripts.cromulon.libs.libCh0tFqRg.libCh0tFqRg", wowex)
Tinkr:require("scripts.cromulon.libs.libNekSv2Ip.libNekSv2Ip", wowex)
Tinkr:require("scripts.cromulon.libs.CallbackHandler10.CallbackHandler10", wowex)
Tinkr:require("scripts.cromulon.libs.HereBeDragons.HereBeDragons-20", wowex)
Tinkr:require("scripts.cromulon.libs.HereBeDragons.HereBeDragons-pins-20", wowex)
Tinkr:require("scripts.cromulon.interface.uibuilder", wowex)
Tinkr:require("scripts.cromulon.interface.buttons", wowex)
Tinkr:require("scripts.cromulon.interface.panels", wowex)
Tinkr:require('scripts.cromulon.interface.minimap' , wowex)
mybuttons.On = false
mybuttons.Cooldowns = false
mybuttons.MultiTarget = false
mybuttons.Interupts = false
mybuttons.Settings = false
|
--- GENERATED CODE - DO NOT MODIFY
-- AmazonMQ (mq-2017-11-27)
local M = {}
M.metadata = {
api_version = "2017-11-27",
json_version = "1.1",
protocol = "rest-json",
checksum_format = "",
endpoint_prefix = "mq",
service_abbreviation = "",
service_full_name = "AmazonMQ",
signature_version = "v4",
target_prefix = "",
timestamp_format = "",
global_endpoint = "",
uid = "mq-2017-11-27",
}
local keys = {}
local asserts = {}
keys.UpdateUserRequest = { ["ConsoleAccess"] = true, ["Username"] = true, ["Password"] = true, ["BrokerId"] = true, ["Groups"] = true, nil }
function asserts.AssertUpdateUserRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected UpdateUserRequest to be of type 'table'")
assert(struct["Username"], "Expected key Username to exist in table")
assert(struct["BrokerId"], "Expected key BrokerId to exist in table")
if struct["ConsoleAccess"] then asserts.Assert__boolean(struct["ConsoleAccess"]) end
if struct["Username"] then asserts.Assert__string(struct["Username"]) end
if struct["Password"] then asserts.Assert__string(struct["Password"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
if struct["Groups"] then asserts.Assert__listOf__string(struct["Groups"]) end
for k,_ in pairs(struct) do
assert(keys.UpdateUserRequest[k], "UpdateUserRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type UpdateUserRequest
-- Updates the information for an ActiveMQ user.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConsoleAccess [__boolean] Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
-- * Username [__string] Required. The username of the ActiveMQ user. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- * Password [__string] The password of the user. This value must be at least 12 characters long, must contain at least 4 unique characters, and must not contain commas.
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- * Groups [__listOf__string] The list of groups (20 maximum) to which the ActiveMQ user belongs. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- Required key: Username
-- Required key: BrokerId
-- @return UpdateUserRequest structure as a key-value pair table
function M.UpdateUserRequest(args)
assert(args, "You must provide an argument table when creating UpdateUserRequest")
local query_args = {
}
local uri_args = {
["{username}"] = args["Username"],
["{broker-id}"] = args["BrokerId"],
}
local header_args = {
}
local all_args = {
["ConsoleAccess"] = args["ConsoleAccess"],
["Username"] = args["Username"],
["Password"] = args["Password"],
["BrokerId"] = args["BrokerId"],
["Groups"] = args["Groups"],
}
asserts.AssertUpdateUserRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.LogsSummary = { ["Audit"] = true, ["GeneralLogGroup"] = true, ["General"] = true, ["Pending"] = true, ["AuditLogGroup"] = true, nil }
function asserts.AssertLogsSummary(struct)
assert(struct)
assert(type(struct) == "table", "Expected LogsSummary to be of type 'table'")
if struct["Audit"] then asserts.Assert__boolean(struct["Audit"]) end
if struct["GeneralLogGroup"] then asserts.Assert__string(struct["GeneralLogGroup"]) end
if struct["General"] then asserts.Assert__boolean(struct["General"]) end
if struct["Pending"] then asserts.AssertPendingLogs(struct["Pending"]) end
if struct["AuditLogGroup"] then asserts.Assert__string(struct["AuditLogGroup"]) end
for k,_ in pairs(struct) do
assert(keys.LogsSummary[k], "LogsSummary contains unknown key " .. tostring(k))
end
end
--- Create a structure of type LogsSummary
-- The list of information about logs currently enabled and pending to be deployed for the specified broker.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Audit [__boolean] Enables audit logging. Every user management action made using JMX or the ActiveMQ Web Console is logged.
-- * GeneralLogGroup [__string] The location of the CloudWatch Logs log group where general logs are sent.
-- * General [__boolean] Enables general logging.
-- * Pending [PendingLogs] The list of information about logs pending to be deployed for the specified broker.
-- * AuditLogGroup [__string] The location of the CloudWatch Logs log group where audit logs are sent.
-- @return LogsSummary structure as a key-value pair table
function M.LogsSummary(args)
assert(args, "You must provide an argument table when creating LogsSummary")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["Audit"] = args["Audit"],
["GeneralLogGroup"] = args["GeneralLogGroup"],
["General"] = args["General"],
["Pending"] = args["Pending"],
["AuditLogGroup"] = args["AuditLogGroup"],
}
asserts.AssertLogsSummary(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.CreateBrokerRequest = { ["Logs"] = true, ["PubliclyAccessible"] = true, ["HostInstanceType"] = true, ["SubnetIds"] = true, ["CreatorRequestId"] = true, ["MaintenanceWindowStartTime"] = true, ["AutoMinorVersionUpgrade"] = true, ["BrokerName"] = true, ["EngineVersion"] = true, ["SecurityGroups"] = true, ["Configuration"] = true, ["EngineType"] = true, ["DeploymentMode"] = true, ["Users"] = true, nil }
function asserts.AssertCreateBrokerRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected CreateBrokerRequest to be of type 'table'")
if struct["Logs"] then asserts.AssertLogs(struct["Logs"]) end
if struct["PubliclyAccessible"] then asserts.Assert__boolean(struct["PubliclyAccessible"]) end
if struct["HostInstanceType"] then asserts.Assert__string(struct["HostInstanceType"]) end
if struct["SubnetIds"] then asserts.Assert__listOf__string(struct["SubnetIds"]) end
if struct["CreatorRequestId"] then asserts.Assert__string(struct["CreatorRequestId"]) end
if struct["MaintenanceWindowStartTime"] then asserts.AssertWeeklyStartTime(struct["MaintenanceWindowStartTime"]) end
if struct["AutoMinorVersionUpgrade"] then asserts.Assert__boolean(struct["AutoMinorVersionUpgrade"]) end
if struct["BrokerName"] then asserts.Assert__string(struct["BrokerName"]) end
if struct["EngineVersion"] then asserts.Assert__string(struct["EngineVersion"]) end
if struct["SecurityGroups"] then asserts.Assert__listOf__string(struct["SecurityGroups"]) end
if struct["Configuration"] then asserts.AssertConfigurationId(struct["Configuration"]) end
if struct["EngineType"] then asserts.AssertEngineType(struct["EngineType"]) end
if struct["DeploymentMode"] then asserts.AssertDeploymentMode(struct["DeploymentMode"]) end
if struct["Users"] then asserts.Assert__listOfUser(struct["Users"]) end
for k,_ in pairs(struct) do
assert(keys.CreateBrokerRequest[k], "CreateBrokerRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type CreateBrokerRequest
-- Creates a broker using the specified properties.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Logs [Logs] Enables Amazon CloudWatch logging for brokers.
-- * PubliclyAccessible [__boolean] Required. Enables connections from applications outside of the VPC that hosts the broker's subnets.
-- * HostInstanceType [__string] Required. The broker's instance type.
-- * SubnetIds [__listOf__string] The list of groups (2 maximum) that define which subnets and IP ranges the broker can use from different Availability Zones. A SINGLE_INSTANCE deployment requires one subnet (for example, the default subnet). An ACTIVE_STANDBY_MULTI_AZ deployment requires two subnets.
-- * CreatorRequestId [__string] The unique ID that the requester receives for the created broker. Amazon MQ passes your ID with the API action. Note: We recommend using a Universally Unique Identifier (UUID) for the creatorRequestId. You may omit the creatorRequestId if your application doesn't require idempotency.
-- * MaintenanceWindowStartTime [WeeklyStartTime] The parameters that determine the WeeklyStartTime.
-- * AutoMinorVersionUpgrade [__boolean] Required. Enables automatic upgrades to new minor versions for brokers, as Apache releases the versions. The automatic upgrades occur during the maintenance window of the broker or after a manual broker reboot.
-- * BrokerName [__string] Required. The name of the broker. This value must be unique in your AWS account, 1-50 characters long, must contain only letters, numbers, dashes, and underscores, and must not contain whitespaces, brackets, wildcard characters, or special characters.
-- * EngineVersion [__string] Required. The version of the broker engine. Note: Currently, Amazon MQ supports only 5.15.6 and 5.15.0.
-- * SecurityGroups [__listOf__string] The list of rules (1 minimum, 125 maximum) that authorize connections to brokers.
-- * Configuration [ConfigurationId] A list of information about the configuration.
-- * EngineType [EngineType] Required. The type of broker engine. Note: Currently, Amazon MQ supports only ACTIVEMQ.
-- * DeploymentMode [DeploymentMode] Required. The deployment mode of the broker.
-- * Users [__listOfUser] Required. The list of ActiveMQ users (persons or applications) who can access queues and topics. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- @return CreateBrokerRequest structure as a key-value pair table
function M.CreateBrokerRequest(args)
assert(args, "You must provide an argument table when creating CreateBrokerRequest")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["Logs"] = args["Logs"],
["PubliclyAccessible"] = args["PubliclyAccessible"],
["HostInstanceType"] = args["HostInstanceType"],
["SubnetIds"] = args["SubnetIds"],
["CreatorRequestId"] = args["CreatorRequestId"],
["MaintenanceWindowStartTime"] = args["MaintenanceWindowStartTime"],
["AutoMinorVersionUpgrade"] = args["AutoMinorVersionUpgrade"],
["BrokerName"] = args["BrokerName"],
["EngineVersion"] = args["EngineVersion"],
["SecurityGroups"] = args["SecurityGroups"],
["Configuration"] = args["Configuration"],
["EngineType"] = args["EngineType"],
["DeploymentMode"] = args["DeploymentMode"],
["Users"] = args["Users"],
}
asserts.AssertCreateBrokerRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DeleteBrokerResponse = { ["BrokerId"] = true, nil }
function asserts.AssertDeleteBrokerResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected DeleteBrokerResponse to be of type 'table'")
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
for k,_ in pairs(struct) do
assert(keys.DeleteBrokerResponse[k], "DeleteBrokerResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DeleteBrokerResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- @return DeleteBrokerResponse structure as a key-value pair table
function M.DeleteBrokerResponse(args)
assert(args, "You must provide an argument table when creating DeleteBrokerResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["BrokerId"] = args["BrokerId"],
}
asserts.AssertDeleteBrokerResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.BrokerSummary = { ["Created"] = true, ["HostInstanceType"] = true, ["BrokerState"] = true, ["BrokerArn"] = true, ["BrokerId"] = true, ["BrokerName"] = true, ["DeploymentMode"] = true, nil }
function asserts.AssertBrokerSummary(struct)
assert(struct)
assert(type(struct) == "table", "Expected BrokerSummary to be of type 'table'")
if struct["Created"] then asserts.Assert__timestampIso8601(struct["Created"]) end
if struct["HostInstanceType"] then asserts.Assert__string(struct["HostInstanceType"]) end
if struct["BrokerState"] then asserts.AssertBrokerState(struct["BrokerState"]) end
if struct["BrokerArn"] then asserts.Assert__string(struct["BrokerArn"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
if struct["BrokerName"] then asserts.Assert__string(struct["BrokerName"]) end
if struct["DeploymentMode"] then asserts.AssertDeploymentMode(struct["DeploymentMode"]) end
for k,_ in pairs(struct) do
assert(keys.BrokerSummary[k], "BrokerSummary contains unknown key " .. tostring(k))
end
end
--- Create a structure of type BrokerSummary
-- The Amazon Resource Name (ARN) of the broker.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Created [__timestampIso8601] The time when the broker was created.
-- * HostInstanceType [__string] The broker's instance type.
-- * BrokerState [BrokerState] The status of the broker.
-- * BrokerArn [__string] The Amazon Resource Name (ARN) of the broker.
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- * BrokerName [__string] The name of the broker. This value must be unique in your AWS account, 1-50 characters long, must contain only letters, numbers, dashes, and underscores, and must not contain whitespaces, brackets, wildcard characters, or special characters.
-- * DeploymentMode [DeploymentMode] Required. The deployment mode of the broker.
-- @return BrokerSummary structure as a key-value pair table
function M.BrokerSummary(args)
assert(args, "You must provide an argument table when creating BrokerSummary")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["Created"] = args["Created"],
["HostInstanceType"] = args["HostInstanceType"],
["BrokerState"] = args["BrokerState"],
["BrokerArn"] = args["BrokerArn"],
["BrokerId"] = args["BrokerId"],
["BrokerName"] = args["BrokerName"],
["DeploymentMode"] = args["DeploymentMode"],
}
asserts.AssertBrokerSummary(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DescribeUserRequest = { ["Username"] = true, ["BrokerId"] = true, nil }
function asserts.AssertDescribeUserRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected DescribeUserRequest to be of type 'table'")
assert(struct["Username"], "Expected key Username to exist in table")
assert(struct["BrokerId"], "Expected key BrokerId to exist in table")
if struct["Username"] then asserts.Assert__string(struct["Username"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
for k,_ in pairs(struct) do
assert(keys.DescribeUserRequest[k], "DescribeUserRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DescribeUserRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Username [__string] The username of the ActiveMQ user. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- Required key: Username
-- Required key: BrokerId
-- @return DescribeUserRequest structure as a key-value pair table
function M.DescribeUserRequest(args)
assert(args, "You must provide an argument table when creating DescribeUserRequest")
local query_args = {
}
local uri_args = {
["{username}"] = args["Username"],
["{broker-id}"] = args["BrokerId"],
}
local header_args = {
}
local all_args = {
["Username"] = args["Username"],
["BrokerId"] = args["BrokerId"],
}
asserts.AssertDescribeUserRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DescribeBrokerResponse = { ["PendingEngineVersion"] = true, ["Logs"] = true, ["PubliclyAccessible"] = true, ["Created"] = true, ["SubnetIds"] = true, ["HostInstanceType"] = true, ["BrokerState"] = true, ["MaintenanceWindowStartTime"] = true, ["AutoMinorVersionUpgrade"] = true, ["BrokerArn"] = true, ["BrokerInstances"] = true, ["BrokerId"] = true, ["Users"] = true, ["EngineVersion"] = true, ["BrokerName"] = true, ["SecurityGroups"] = true, ["EngineType"] = true, ["DeploymentMode"] = true, ["Configurations"] = true, nil }
function asserts.AssertDescribeBrokerResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected DescribeBrokerResponse to be of type 'table'")
if struct["PendingEngineVersion"] then asserts.Assert__string(struct["PendingEngineVersion"]) end
if struct["Logs"] then asserts.AssertLogsSummary(struct["Logs"]) end
if struct["PubliclyAccessible"] then asserts.Assert__boolean(struct["PubliclyAccessible"]) end
if struct["Created"] then asserts.Assert__timestampIso8601(struct["Created"]) end
if struct["SubnetIds"] then asserts.Assert__listOf__string(struct["SubnetIds"]) end
if struct["HostInstanceType"] then asserts.Assert__string(struct["HostInstanceType"]) end
if struct["BrokerState"] then asserts.AssertBrokerState(struct["BrokerState"]) end
if struct["MaintenanceWindowStartTime"] then asserts.AssertWeeklyStartTime(struct["MaintenanceWindowStartTime"]) end
if struct["AutoMinorVersionUpgrade"] then asserts.Assert__boolean(struct["AutoMinorVersionUpgrade"]) end
if struct["BrokerArn"] then asserts.Assert__string(struct["BrokerArn"]) end
if struct["BrokerInstances"] then asserts.Assert__listOfBrokerInstance(struct["BrokerInstances"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
if struct["Users"] then asserts.Assert__listOfUserSummary(struct["Users"]) end
if struct["EngineVersion"] then asserts.Assert__string(struct["EngineVersion"]) end
if struct["BrokerName"] then asserts.Assert__string(struct["BrokerName"]) end
if struct["SecurityGroups"] then asserts.Assert__listOf__string(struct["SecurityGroups"]) end
if struct["EngineType"] then asserts.AssertEngineType(struct["EngineType"]) end
if struct["DeploymentMode"] then asserts.AssertDeploymentMode(struct["DeploymentMode"]) end
if struct["Configurations"] then asserts.AssertConfigurations(struct["Configurations"]) end
for k,_ in pairs(struct) do
assert(keys.DescribeBrokerResponse[k], "DescribeBrokerResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DescribeBrokerResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * PendingEngineVersion [__string] The version of the broker engine to upgrade to.
-- * Logs [LogsSummary] The list of information about logs currently enabled and pending to be deployed for the specified broker.
-- * PubliclyAccessible [__boolean] Required. Enables connections from applications outside of the VPC that hosts the broker's subnets.
-- * Created [__timestampIso8601] The time when the broker was created.
-- * SubnetIds [__listOf__string] The list of groups (2 maximum) that define which subnets and IP ranges the broker can use from different Availability Zones. A SINGLE_INSTANCE deployment requires one subnet (for example, the default subnet). An ACTIVE_STANDBY_MULTI_AZ deployment requires two subnets.
-- * HostInstanceType [__string] The broker's instance type.
-- * BrokerState [BrokerState] The status of the broker.
-- * MaintenanceWindowStartTime [WeeklyStartTime] The parameters that determine the WeeklyStartTime.
-- * AutoMinorVersionUpgrade [__boolean] Required. Enables automatic upgrades to new minor versions for brokers, as Apache releases the versions. The automatic upgrades occur during the maintenance window of the broker or after a manual broker reboot.
-- * BrokerArn [__string] The Amazon Resource Name (ARN) of the broker.
-- * BrokerInstances [__listOfBrokerInstance] A list of information about allocated brokers.
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- * Users [__listOfUserSummary] The list of all ActiveMQ usernames for the specified broker.
-- * EngineVersion [__string] The version of the broker engine. Note: Currently, Amazon MQ supports only 5.15.6 and 5.15.0.
-- * BrokerName [__string] The name of the broker. This value must be unique in your AWS account, 1-50 characters long, must contain only letters, numbers, dashes, and underscores, and must not contain whitespaces, brackets, wildcard characters, or special characters.
-- * SecurityGroups [__listOf__string] Required. The list of rules (1 minimum, 125 maximum) that authorize connections to brokers.
-- * EngineType [EngineType] Required. The type of broker engine. Note: Currently, Amazon MQ supports only ACTIVEMQ.
-- * DeploymentMode [DeploymentMode] Required. The deployment mode of the broker.
-- * Configurations [Configurations] The list of all revisions for the specified configuration.
-- @return DescribeBrokerResponse structure as a key-value pair table
function M.DescribeBrokerResponse(args)
assert(args, "You must provide an argument table when creating DescribeBrokerResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["PendingEngineVersion"] = args["PendingEngineVersion"],
["Logs"] = args["Logs"],
["PubliclyAccessible"] = args["PubliclyAccessible"],
["Created"] = args["Created"],
["SubnetIds"] = args["SubnetIds"],
["HostInstanceType"] = args["HostInstanceType"],
["BrokerState"] = args["BrokerState"],
["MaintenanceWindowStartTime"] = args["MaintenanceWindowStartTime"],
["AutoMinorVersionUpgrade"] = args["AutoMinorVersionUpgrade"],
["BrokerArn"] = args["BrokerArn"],
["BrokerInstances"] = args["BrokerInstances"],
["BrokerId"] = args["BrokerId"],
["Users"] = args["Users"],
["EngineVersion"] = args["EngineVersion"],
["BrokerName"] = args["BrokerName"],
["SecurityGroups"] = args["SecurityGroups"],
["EngineType"] = args["EngineType"],
["DeploymentMode"] = args["DeploymentMode"],
["Configurations"] = args["Configurations"],
}
asserts.AssertDescribeBrokerResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.CreateConfigurationResponse = { ["LatestRevision"] = true, ["Name"] = true, ["Id"] = true, ["Arn"] = true, ["Created"] = true, nil }
function asserts.AssertCreateConfigurationResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected CreateConfigurationResponse to be of type 'table'")
if struct["LatestRevision"] then asserts.AssertConfigurationRevision(struct["LatestRevision"]) end
if struct["Name"] then asserts.Assert__string(struct["Name"]) end
if struct["Id"] then asserts.Assert__string(struct["Id"]) end
if struct["Arn"] then asserts.Assert__string(struct["Arn"]) end
if struct["Created"] then asserts.Assert__timestampIso8601(struct["Created"]) end
for k,_ in pairs(struct) do
assert(keys.CreateConfigurationResponse[k], "CreateConfigurationResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type CreateConfigurationResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * LatestRevision [ConfigurationRevision] The latest revision of the configuration.
-- * Name [__string] Required. The name of the configuration. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 1-150 characters long.
-- * Id [__string] Required. The unique ID that Amazon MQ generates for the configuration.
-- * Arn [__string] Required. The Amazon Resource Name (ARN) of the configuration.
-- * Created [__timestampIso8601] Required. The date and time of the configuration.
-- @return CreateConfigurationResponse structure as a key-value pair table
function M.CreateConfigurationResponse(args)
assert(args, "You must provide an argument table when creating CreateConfigurationResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["LatestRevision"] = args["LatestRevision"],
["Name"] = args["Name"],
["Id"] = args["Id"],
["Arn"] = args["Arn"],
["Created"] = args["Created"],
}
asserts.AssertCreateConfigurationResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DeleteUserRequest = { ["Username"] = true, ["BrokerId"] = true, nil }
function asserts.AssertDeleteUserRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected DeleteUserRequest to be of type 'table'")
assert(struct["Username"], "Expected key Username to exist in table")
assert(struct["BrokerId"], "Expected key BrokerId to exist in table")
if struct["Username"] then asserts.Assert__string(struct["Username"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
for k,_ in pairs(struct) do
assert(keys.DeleteUserRequest[k], "DeleteUserRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DeleteUserRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Username [__string] The username of the ActiveMQ user. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- Required key: Username
-- Required key: BrokerId
-- @return DeleteUserRequest structure as a key-value pair table
function M.DeleteUserRequest(args)
assert(args, "You must provide an argument table when creating DeleteUserRequest")
local query_args = {
}
local uri_args = {
["{username}"] = args["Username"],
["{broker-id}"] = args["BrokerId"],
}
local header_args = {
}
local all_args = {
["Username"] = args["Username"],
["BrokerId"] = args["BrokerId"],
}
asserts.AssertDeleteUserRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ListConfigurationsRequest = { ["NextToken"] = true, ["MaxResults"] = true, nil }
function asserts.AssertListConfigurationsRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected ListConfigurationsRequest to be of type 'table'")
if struct["NextToken"] then asserts.Assert__string(struct["NextToken"]) end
if struct["MaxResults"] then asserts.AssertMaxResults(struct["MaxResults"]) end
for k,_ in pairs(struct) do
assert(keys.ListConfigurationsRequest[k], "ListConfigurationsRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ListConfigurationsRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * NextToken [__string] The token that specifies the next page of results Amazon MQ should return. To request the first page, leave nextToken empty.
-- * MaxResults [MaxResults] The maximum number of configurations that Amazon MQ can return per page (20 by default). This value must be an integer from 5 to 100.
-- @return ListConfigurationsRequest structure as a key-value pair table
function M.ListConfigurationsRequest(args)
assert(args, "You must provide an argument table when creating ListConfigurationsRequest")
local query_args = {
["nextToken"] = args["NextToken"],
["maxResults"] = args["MaxResults"],
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["NextToken"] = args["NextToken"],
["MaxResults"] = args["MaxResults"],
}
asserts.AssertListConfigurationsRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DescribeConfigurationRequest = { ["ConfigurationId"] = true, nil }
function asserts.AssertDescribeConfigurationRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected DescribeConfigurationRequest to be of type 'table'")
assert(struct["ConfigurationId"], "Expected key ConfigurationId to exist in table")
if struct["ConfigurationId"] then asserts.Assert__string(struct["ConfigurationId"]) end
for k,_ in pairs(struct) do
assert(keys.DescribeConfigurationRequest[k], "DescribeConfigurationRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DescribeConfigurationRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConfigurationId [__string] The unique ID that Amazon MQ generates for the configuration.
-- Required key: ConfigurationId
-- @return DescribeConfigurationRequest structure as a key-value pair table
function M.DescribeConfigurationRequest(args)
assert(args, "You must provide an argument table when creating DescribeConfigurationRequest")
local query_args = {
}
local uri_args = {
["{configuration-id}"] = args["ConfigurationId"],
}
local header_args = {
}
local all_args = {
["ConfigurationId"] = args["ConfigurationId"],
}
asserts.AssertDescribeConfigurationRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.UpdateBrokerRequest = { ["EngineVersion"] = true, ["Configuration"] = true, ["BrokerId"] = true, ["Logs"] = true, ["AutoMinorVersionUpgrade"] = true, nil }
function asserts.AssertUpdateBrokerRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected UpdateBrokerRequest to be of type 'table'")
assert(struct["BrokerId"], "Expected key BrokerId to exist in table")
if struct["EngineVersion"] then asserts.Assert__string(struct["EngineVersion"]) end
if struct["Configuration"] then asserts.AssertConfigurationId(struct["Configuration"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
if struct["Logs"] then asserts.AssertLogs(struct["Logs"]) end
if struct["AutoMinorVersionUpgrade"] then asserts.Assert__boolean(struct["AutoMinorVersionUpgrade"]) end
for k,_ in pairs(struct) do
assert(keys.UpdateBrokerRequest[k], "UpdateBrokerRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type UpdateBrokerRequest
-- Updates the broker using the specified properties.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * EngineVersion [__string] The version of the broker engine. Note: Currently, Amazon MQ supports only 5.15.6 and 5.15.0.
-- * Configuration [ConfigurationId] A list of information about the configuration.
-- * BrokerId [__string] The name of the broker. This value must be unique in your AWS account, 1-50 characters long, must contain only letters, numbers, dashes, and underscores, and must not contain whitespaces, brackets, wildcard characters, or special characters.
-- * Logs [Logs] Enables Amazon CloudWatch logging for brokers.
-- * AutoMinorVersionUpgrade [__boolean] Enables automatic upgrades to new minor versions for brokers, as Apache releases the versions. The automatic upgrades occur during the maintenance window of the broker or after a manual broker reboot.
-- Required key: BrokerId
-- @return UpdateBrokerRequest structure as a key-value pair table
function M.UpdateBrokerRequest(args)
assert(args, "You must provide an argument table when creating UpdateBrokerRequest")
local query_args = {
}
local uri_args = {
["{broker-id}"] = args["BrokerId"],
}
local header_args = {
}
local all_args = {
["EngineVersion"] = args["EngineVersion"],
["Configuration"] = args["Configuration"],
["BrokerId"] = args["BrokerId"],
["Logs"] = args["Logs"],
["AutoMinorVersionUpgrade"] = args["AutoMinorVersionUpgrade"],
}
asserts.AssertUpdateBrokerRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.PendingLogs = { ["Audit"] = true, ["General"] = true, nil }
function asserts.AssertPendingLogs(struct)
assert(struct)
assert(type(struct) == "table", "Expected PendingLogs to be of type 'table'")
if struct["Audit"] then asserts.Assert__boolean(struct["Audit"]) end
if struct["General"] then asserts.Assert__boolean(struct["General"]) end
for k,_ in pairs(struct) do
assert(keys.PendingLogs[k], "PendingLogs contains unknown key " .. tostring(k))
end
end
--- Create a structure of type PendingLogs
-- The list of information about logs to be enabled for the specified broker.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Audit [__boolean] Enables audit logging. Every user management action made using JMX or the ActiveMQ Web Console is logged.
-- * General [__boolean] Enables general logging.
-- @return PendingLogs structure as a key-value pair table
function M.PendingLogs(args)
assert(args, "You must provide an argument table when creating PendingLogs")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["Audit"] = args["Audit"],
["General"] = args["General"],
}
asserts.AssertPendingLogs(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ListConfigurationRevisionsRequest = { ["ConfigurationId"] = true, ["NextToken"] = true, ["MaxResults"] = true, nil }
function asserts.AssertListConfigurationRevisionsRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected ListConfigurationRevisionsRequest to be of type 'table'")
assert(struct["ConfigurationId"], "Expected key ConfigurationId to exist in table")
if struct["ConfigurationId"] then asserts.Assert__string(struct["ConfigurationId"]) end
if struct["NextToken"] then asserts.Assert__string(struct["NextToken"]) end
if struct["MaxResults"] then asserts.AssertMaxResults(struct["MaxResults"]) end
for k,_ in pairs(struct) do
assert(keys.ListConfigurationRevisionsRequest[k], "ListConfigurationRevisionsRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ListConfigurationRevisionsRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConfigurationId [__string] The unique ID that Amazon MQ generates for the configuration.
-- * NextToken [__string] The token that specifies the next page of results Amazon MQ should return. To request the first page, leave nextToken empty.
-- * MaxResults [MaxResults] The maximum number of configurations that Amazon MQ can return per page (20 by default). This value must be an integer from 5 to 100.
-- Required key: ConfigurationId
-- @return ListConfigurationRevisionsRequest structure as a key-value pair table
function M.ListConfigurationRevisionsRequest(args)
assert(args, "You must provide an argument table when creating ListConfigurationRevisionsRequest")
local query_args = {
["nextToken"] = args["NextToken"],
["maxResults"] = args["MaxResults"],
}
local uri_args = {
["{configuration-id}"] = args["ConfigurationId"],
}
local header_args = {
}
local all_args = {
["ConfigurationId"] = args["ConfigurationId"],
["NextToken"] = args["NextToken"],
["MaxResults"] = args["MaxResults"],
}
asserts.AssertListConfigurationRevisionsRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.CreateConfigurationRequest = { ["EngineType"] = true, ["Name"] = true, ["EngineVersion"] = true, nil }
function asserts.AssertCreateConfigurationRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected CreateConfigurationRequest to be of type 'table'")
if struct["EngineType"] then asserts.AssertEngineType(struct["EngineType"]) end
if struct["Name"] then asserts.Assert__string(struct["Name"]) end
if struct["EngineVersion"] then asserts.Assert__string(struct["EngineVersion"]) end
for k,_ in pairs(struct) do
assert(keys.CreateConfigurationRequest[k], "CreateConfigurationRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type CreateConfigurationRequest
-- Creates a new configuration for the specified configuration name. Amazon MQ uses the default configuration (the engine type and version).
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * EngineType [EngineType] Required. The type of broker engine. Note: Currently, Amazon MQ supports only ACTIVEMQ.
-- * Name [__string] Required. The name of the configuration. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 1-150 characters long.
-- * EngineVersion [__string] Required. The version of the broker engine. Note: Currently, Amazon MQ supports only 5.15.6 and 5.15.0.
-- @return CreateConfigurationRequest structure as a key-value pair table
function M.CreateConfigurationRequest(args)
assert(args, "You must provide an argument table when creating CreateConfigurationRequest")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["EngineType"] = args["EngineType"],
["Name"] = args["Name"],
["EngineVersion"] = args["EngineVersion"],
}
asserts.AssertCreateConfigurationRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DeleteUserResponse = { nil }
function asserts.AssertDeleteUserResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected DeleteUserResponse to be of type 'table'")
for k,_ in pairs(struct) do
assert(keys.DeleteUserResponse[k], "DeleteUserResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DeleteUserResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- @return DeleteUserResponse structure as a key-value pair table
function M.DeleteUserResponse(args)
assert(args, "You must provide an argument table when creating DeleteUserResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
}
asserts.AssertDeleteUserResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.RebootBrokerResponse = { nil }
function asserts.AssertRebootBrokerResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected RebootBrokerResponse to be of type 'table'")
for k,_ in pairs(struct) do
assert(keys.RebootBrokerResponse[k], "RebootBrokerResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type RebootBrokerResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- @return RebootBrokerResponse structure as a key-value pair table
function M.RebootBrokerResponse(args)
assert(args, "You must provide an argument table when creating RebootBrokerResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
}
asserts.AssertRebootBrokerResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.BrokerInstance = { ["IpAddress"] = true, ["Endpoints"] = true, ["ConsoleURL"] = true, nil }
function asserts.AssertBrokerInstance(struct)
assert(struct)
assert(type(struct) == "table", "Expected BrokerInstance to be of type 'table'")
if struct["IpAddress"] then asserts.Assert__string(struct["IpAddress"]) end
if struct["Endpoints"] then asserts.Assert__listOf__string(struct["Endpoints"]) end
if struct["ConsoleURL"] then asserts.Assert__string(struct["ConsoleURL"]) end
for k,_ in pairs(struct) do
assert(keys.BrokerInstance[k], "BrokerInstance contains unknown key " .. tostring(k))
end
end
--- Create a structure of type BrokerInstance
-- Returns information about all brokers.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * IpAddress [__string] The IP address of the Elastic Network Interface (ENI) attached to the broker.
-- * Endpoints [__listOf__string] The broker's wire-level protocol endpoints.
-- * ConsoleURL [__string] The URL of the broker's ActiveMQ Web Console.
-- @return BrokerInstance structure as a key-value pair table
function M.BrokerInstance(args)
assert(args, "You must provide an argument table when creating BrokerInstance")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["IpAddress"] = args["IpAddress"],
["Endpoints"] = args["Endpoints"],
["ConsoleURL"] = args["ConsoleURL"],
}
asserts.AssertBrokerInstance(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.CreateUserResponse = { nil }
function asserts.AssertCreateUserResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected CreateUserResponse to be of type 'table'")
for k,_ in pairs(struct) do
assert(keys.CreateUserResponse[k], "CreateUserResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type CreateUserResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- @return CreateUserResponse structure as a key-value pair table
function M.CreateUserResponse(args)
assert(args, "You must provide an argument table when creating CreateUserResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
}
asserts.AssertCreateUserResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.UserSummary = { ["PendingChange"] = true, ["Username"] = true, nil }
function asserts.AssertUserSummary(struct)
assert(struct)
assert(type(struct) == "table", "Expected UserSummary to be of type 'table'")
if struct["PendingChange"] then asserts.AssertChangeType(struct["PendingChange"]) end
if struct["Username"] then asserts.Assert__string(struct["Username"]) end
for k,_ in pairs(struct) do
assert(keys.UserSummary[k], "UserSummary contains unknown key " .. tostring(k))
end
end
--- Create a structure of type UserSummary
-- Returns a list of all ActiveMQ users.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * PendingChange [ChangeType] The type of change pending for the ActiveMQ user.
-- * Username [__string] Required. The username of the ActiveMQ user. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- @return UserSummary structure as a key-value pair table
function M.UserSummary(args)
assert(args, "You must provide an argument table when creating UserSummary")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["PendingChange"] = args["PendingChange"],
["Username"] = args["Username"],
}
asserts.AssertUserSummary(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.Configuration = { ["LatestRevision"] = true, ["Description"] = true, ["Created"] = true, ["EngineVersion"] = true, ["EngineType"] = true, ["Id"] = true, ["Arn"] = true, ["Name"] = true, nil }
function asserts.AssertConfiguration(struct)
assert(struct)
assert(type(struct) == "table", "Expected Configuration to be of type 'table'")
if struct["LatestRevision"] then asserts.AssertConfigurationRevision(struct["LatestRevision"]) end
if struct["Description"] then asserts.Assert__string(struct["Description"]) end
if struct["Created"] then asserts.Assert__timestampIso8601(struct["Created"]) end
if struct["EngineVersion"] then asserts.Assert__string(struct["EngineVersion"]) end
if struct["EngineType"] then asserts.AssertEngineType(struct["EngineType"]) end
if struct["Id"] then asserts.Assert__string(struct["Id"]) end
if struct["Arn"] then asserts.Assert__string(struct["Arn"]) end
if struct["Name"] then asserts.Assert__string(struct["Name"]) end
for k,_ in pairs(struct) do
assert(keys.Configuration[k], "Configuration contains unknown key " .. tostring(k))
end
end
--- Create a structure of type Configuration
-- Returns information about all configurations.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * LatestRevision [ConfigurationRevision] Required. The latest revision of the configuration.
-- * Description [__string] Required. The description of the configuration.
-- * Created [__timestampIso8601] Required. The date and time of the configuration revision.
-- * EngineVersion [__string] Required. The version of the broker engine.
-- * EngineType [EngineType] Required. The type of broker engine. Note: Currently, Amazon MQ supports only ACTIVEMQ.
-- * Id [__string] Required. The unique ID that Amazon MQ generates for the configuration.
-- * Arn [__string] Required. The ARN of the configuration.
-- * Name [__string] Required. The name of the configuration. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 1-150 characters long.
-- @return Configuration structure as a key-value pair table
function M.Configuration(args)
assert(args, "You must provide an argument table when creating Configuration")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["LatestRevision"] = args["LatestRevision"],
["Description"] = args["Description"],
["Created"] = args["Created"],
["EngineVersion"] = args["EngineVersion"],
["EngineType"] = args["EngineType"],
["Id"] = args["Id"],
["Arn"] = args["Arn"],
["Name"] = args["Name"],
}
asserts.AssertConfiguration(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ListUsersResponse = { ["NextToken"] = true, ["BrokerId"] = true, ["Users"] = true, ["MaxResults"] = true, nil }
function asserts.AssertListUsersResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected ListUsersResponse to be of type 'table'")
if struct["NextToken"] then asserts.Assert__string(struct["NextToken"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
if struct["Users"] then asserts.Assert__listOfUserSummary(struct["Users"]) end
if struct["MaxResults"] then asserts.Assert__integerMin5Max100(struct["MaxResults"]) end
for k,_ in pairs(struct) do
assert(keys.ListUsersResponse[k], "ListUsersResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ListUsersResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * NextToken [__string] The token that specifies the next page of results Amazon MQ should return. To request the first page, leave nextToken empty.
-- * BrokerId [__string] Required. The unique ID that Amazon MQ generates for the broker.
-- * Users [__listOfUserSummary] Required. The list of all ActiveMQ usernames for the specified broker.
-- * MaxResults [__integerMin5Max100] Required. The maximum number of ActiveMQ users that can be returned per page (20 by default). This value must be an integer from 5 to 100.
-- @return ListUsersResponse structure as a key-value pair table
function M.ListUsersResponse(args)
assert(args, "You must provide an argument table when creating ListUsersResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["NextToken"] = args["NextToken"],
["BrokerId"] = args["BrokerId"],
["Users"] = args["Users"],
["MaxResults"] = args["MaxResults"],
}
asserts.AssertListUsersResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.User = { ["ConsoleAccess"] = true, ["Username"] = true, ["Password"] = true, ["Groups"] = true, nil }
function asserts.AssertUser(struct)
assert(struct)
assert(type(struct) == "table", "Expected User to be of type 'table'")
if struct["ConsoleAccess"] then asserts.Assert__boolean(struct["ConsoleAccess"]) end
if struct["Username"] then asserts.Assert__string(struct["Username"]) end
if struct["Password"] then asserts.Assert__string(struct["Password"]) end
if struct["Groups"] then asserts.Assert__listOf__string(struct["Groups"]) end
for k,_ in pairs(struct) do
assert(keys.User[k], "User contains unknown key " .. tostring(k))
end
end
--- Create a structure of type User
-- An ActiveMQ user associated with the broker.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConsoleAccess [__boolean] Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
-- * Username [__string] Required. The username of the ActiveMQ user. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- * Password [__string] Required. The password of the ActiveMQ user. This value must be at least 12 characters long, must contain at least 4 unique characters, and must not contain commas.
-- * Groups [__listOf__string] The list of groups (20 maximum) to which the ActiveMQ user belongs. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- @return User structure as a key-value pair table
function M.User(args)
assert(args, "You must provide an argument table when creating User")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["ConsoleAccess"] = args["ConsoleAccess"],
["Username"] = args["Username"],
["Password"] = args["Password"],
["Groups"] = args["Groups"],
}
asserts.AssertUser(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DescribeConfigurationResponse = { ["LatestRevision"] = true, ["Description"] = true, ["Created"] = true, ["EngineVersion"] = true, ["EngineType"] = true, ["Id"] = true, ["Arn"] = true, ["Name"] = true, nil }
function asserts.AssertDescribeConfigurationResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected DescribeConfigurationResponse to be of type 'table'")
if struct["LatestRevision"] then asserts.AssertConfigurationRevision(struct["LatestRevision"]) end
if struct["Description"] then asserts.Assert__string(struct["Description"]) end
if struct["Created"] then asserts.Assert__timestampIso8601(struct["Created"]) end
if struct["EngineVersion"] then asserts.Assert__string(struct["EngineVersion"]) end
if struct["EngineType"] then asserts.AssertEngineType(struct["EngineType"]) end
if struct["Id"] then asserts.Assert__string(struct["Id"]) end
if struct["Arn"] then asserts.Assert__string(struct["Arn"]) end
if struct["Name"] then asserts.Assert__string(struct["Name"]) end
for k,_ in pairs(struct) do
assert(keys.DescribeConfigurationResponse[k], "DescribeConfigurationResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DescribeConfigurationResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * LatestRevision [ConfigurationRevision] Required. The latest revision of the configuration.
-- * Description [__string] Required. The description of the configuration.
-- * Created [__timestampIso8601] Required. The date and time of the configuration revision.
-- * EngineVersion [__string] Required. The version of the broker engine.
-- * EngineType [EngineType] Required. The type of broker engine. Note: Currently, Amazon MQ supports only ACTIVEMQ.
-- * Id [__string] Required. The unique ID that Amazon MQ generates for the configuration.
-- * Arn [__string] Required. The ARN of the configuration.
-- * Name [__string] Required. The name of the configuration. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 1-150 characters long.
-- @return DescribeConfigurationResponse structure as a key-value pair table
function M.DescribeConfigurationResponse(args)
assert(args, "You must provide an argument table when creating DescribeConfigurationResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["LatestRevision"] = args["LatestRevision"],
["Description"] = args["Description"],
["Created"] = args["Created"],
["EngineVersion"] = args["EngineVersion"],
["EngineType"] = args["EngineType"],
["Id"] = args["Id"],
["Arn"] = args["Arn"],
["Name"] = args["Name"],
}
asserts.AssertDescribeConfigurationResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.UserPendingChanges = { ["ConsoleAccess"] = true, ["PendingChange"] = true, ["Groups"] = true, nil }
function asserts.AssertUserPendingChanges(struct)
assert(struct)
assert(type(struct) == "table", "Expected UserPendingChanges to be of type 'table'")
if struct["ConsoleAccess"] then asserts.Assert__boolean(struct["ConsoleAccess"]) end
if struct["PendingChange"] then asserts.AssertChangeType(struct["PendingChange"]) end
if struct["Groups"] then asserts.Assert__listOf__string(struct["Groups"]) end
for k,_ in pairs(struct) do
assert(keys.UserPendingChanges[k], "UserPendingChanges contains unknown key " .. tostring(k))
end
end
--- Create a structure of type UserPendingChanges
-- Returns information about the status of the changes pending for the ActiveMQ user.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConsoleAccess [__boolean] Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
-- * PendingChange [ChangeType] Required. The type of change pending for the ActiveMQ user.
-- * Groups [__listOf__string] The list of groups (20 maximum) to which the ActiveMQ user belongs. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- @return UserPendingChanges structure as a key-value pair table
function M.UserPendingChanges(args)
assert(args, "You must provide an argument table when creating UserPendingChanges")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["ConsoleAccess"] = args["ConsoleAccess"],
["PendingChange"] = args["PendingChange"],
["Groups"] = args["Groups"],
}
asserts.AssertUserPendingChanges(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.UpdateBrokerResponse = { ["EngineVersion"] = true, ["Configuration"] = true, ["BrokerId"] = true, ["Logs"] = true, ["AutoMinorVersionUpgrade"] = true, nil }
function asserts.AssertUpdateBrokerResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected UpdateBrokerResponse to be of type 'table'")
if struct["EngineVersion"] then asserts.Assert__string(struct["EngineVersion"]) end
if struct["Configuration"] then asserts.AssertConfigurationId(struct["Configuration"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
if struct["Logs"] then asserts.AssertLogs(struct["Logs"]) end
if struct["AutoMinorVersionUpgrade"] then asserts.Assert__boolean(struct["AutoMinorVersionUpgrade"]) end
for k,_ in pairs(struct) do
assert(keys.UpdateBrokerResponse[k], "UpdateBrokerResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type UpdateBrokerResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * EngineVersion [__string] The version of the broker engine to upgrade to.
-- * Configuration [ConfigurationId] The ID of the updated configuration.
-- * BrokerId [__string] Required. The unique ID that Amazon MQ generates for the broker.
-- * Logs [Logs] The list of information about logs to be enabled for the specified broker.
-- * AutoMinorVersionUpgrade [__boolean] The new value of automatic upgrades to new minor version for brokers.
-- @return UpdateBrokerResponse structure as a key-value pair table
function M.UpdateBrokerResponse(args)
assert(args, "You must provide an argument table when creating UpdateBrokerResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["EngineVersion"] = args["EngineVersion"],
["Configuration"] = args["Configuration"],
["BrokerId"] = args["BrokerId"],
["Logs"] = args["Logs"],
["AutoMinorVersionUpgrade"] = args["AutoMinorVersionUpgrade"],
}
asserts.AssertUpdateBrokerResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ListUsersRequest = { ["NextToken"] = true, ["BrokerId"] = true, ["MaxResults"] = true, nil }
function asserts.AssertListUsersRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected ListUsersRequest to be of type 'table'")
assert(struct["BrokerId"], "Expected key BrokerId to exist in table")
if struct["NextToken"] then asserts.Assert__string(struct["NextToken"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
if struct["MaxResults"] then asserts.AssertMaxResults(struct["MaxResults"]) end
for k,_ in pairs(struct) do
assert(keys.ListUsersRequest[k], "ListUsersRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ListUsersRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * NextToken [__string] The token that specifies the next page of results Amazon MQ should return. To request the first page, leave nextToken empty.
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- * MaxResults [MaxResults] The maximum number of ActiveMQ users that can be returned per page (20 by default). This value must be an integer from 5 to 100.
-- Required key: BrokerId
-- @return ListUsersRequest structure as a key-value pair table
function M.ListUsersRequest(args)
assert(args, "You must provide an argument table when creating ListUsersRequest")
local query_args = {
["nextToken"] = args["NextToken"],
["maxResults"] = args["MaxResults"],
}
local uri_args = {
["{broker-id}"] = args["BrokerId"],
}
local header_args = {
}
local all_args = {
["NextToken"] = args["NextToken"],
["BrokerId"] = args["BrokerId"],
["MaxResults"] = args["MaxResults"],
}
asserts.AssertListUsersRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.UpdateConfigurationRequest = { ["ConfigurationId"] = true, ["Data"] = true, ["Description"] = true, nil }
function asserts.AssertUpdateConfigurationRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected UpdateConfigurationRequest to be of type 'table'")
assert(struct["ConfigurationId"], "Expected key ConfigurationId to exist in table")
if struct["ConfigurationId"] then asserts.Assert__string(struct["ConfigurationId"]) end
if struct["Data"] then asserts.Assert__string(struct["Data"]) end
if struct["Description"] then asserts.Assert__string(struct["Description"]) end
for k,_ in pairs(struct) do
assert(keys.UpdateConfigurationRequest[k], "UpdateConfigurationRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type UpdateConfigurationRequest
-- Updates the specified configuration.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConfigurationId [__string] The unique ID that Amazon MQ generates for the configuration.
-- * Data [__string] Required. The base64-encoded XML configuration.
-- * Description [__string] The description of the configuration.
-- Required key: ConfigurationId
-- @return UpdateConfigurationRequest structure as a key-value pair table
function M.UpdateConfigurationRequest(args)
assert(args, "You must provide an argument table when creating UpdateConfigurationRequest")
local query_args = {
}
local uri_args = {
["{configuration-id}"] = args["ConfigurationId"],
}
local header_args = {
}
local all_args = {
["ConfigurationId"] = args["ConfigurationId"],
["Data"] = args["Data"],
["Description"] = args["Description"],
}
asserts.AssertUpdateConfigurationRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.SanitizationWarning = { ["ElementName"] = true, ["AttributeName"] = true, ["Reason"] = true, nil }
function asserts.AssertSanitizationWarning(struct)
assert(struct)
assert(type(struct) == "table", "Expected SanitizationWarning to be of type 'table'")
if struct["ElementName"] then asserts.Assert__string(struct["ElementName"]) end
if struct["AttributeName"] then asserts.Assert__string(struct["AttributeName"]) end
if struct["Reason"] then asserts.AssertSanitizationWarningReason(struct["Reason"]) end
for k,_ in pairs(struct) do
assert(keys.SanitizationWarning[k], "SanitizationWarning contains unknown key " .. tostring(k))
end
end
--- Create a structure of type SanitizationWarning
-- Returns information about the XML element or attribute that was sanitized in the configuration.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ElementName [__string] The name of the XML element that has been sanitized.
-- * AttributeName [__string] The name of the XML attribute that has been sanitized.
-- * Reason [SanitizationWarningReason] Required. The reason for which the XML elements or attributes were sanitized.
-- @return SanitizationWarning structure as a key-value pair table
function M.SanitizationWarning(args)
assert(args, "You must provide an argument table when creating SanitizationWarning")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["ElementName"] = args["ElementName"],
["AttributeName"] = args["AttributeName"],
["Reason"] = args["Reason"],
}
asserts.AssertSanitizationWarning(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ListConfigurationRevisionsResponse = { ["ConfigurationId"] = true, ["NextToken"] = true, ["MaxResults"] = true, ["Revisions"] = true, nil }
function asserts.AssertListConfigurationRevisionsResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected ListConfigurationRevisionsResponse to be of type 'table'")
if struct["ConfigurationId"] then asserts.Assert__string(struct["ConfigurationId"]) end
if struct["NextToken"] then asserts.Assert__string(struct["NextToken"]) end
if struct["MaxResults"] then asserts.Assert__integer(struct["MaxResults"]) end
if struct["Revisions"] then asserts.Assert__listOfConfigurationRevision(struct["Revisions"]) end
for k,_ in pairs(struct) do
assert(keys.ListConfigurationRevisionsResponse[k], "ListConfigurationRevisionsResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ListConfigurationRevisionsResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConfigurationId [__string] The unique ID that Amazon MQ generates for the configuration.
-- * NextToken [__string] The token that specifies the next page of results Amazon MQ should return. To request the first page, leave nextToken empty.
-- * MaxResults [__integer] The maximum number of configuration revisions that can be returned per page (20 by default). This value must be an integer from 5 to 100.
-- * Revisions [__listOfConfigurationRevision] The list of all revisions for the specified configuration.
-- @return ListConfigurationRevisionsResponse structure as a key-value pair table
function M.ListConfigurationRevisionsResponse(args)
assert(args, "You must provide an argument table when creating ListConfigurationRevisionsResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["ConfigurationId"] = args["ConfigurationId"],
["NextToken"] = args["NextToken"],
["MaxResults"] = args["MaxResults"],
["Revisions"] = args["Revisions"],
}
asserts.AssertListConfigurationRevisionsResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ListBrokersResponse = { ["BrokerSummaries"] = true, ["NextToken"] = true, nil }
function asserts.AssertListBrokersResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected ListBrokersResponse to be of type 'table'")
if struct["BrokerSummaries"] then asserts.Assert__listOfBrokerSummary(struct["BrokerSummaries"]) end
if struct["NextToken"] then asserts.Assert__string(struct["NextToken"]) end
for k,_ in pairs(struct) do
assert(keys.ListBrokersResponse[k], "ListBrokersResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ListBrokersResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * BrokerSummaries [__listOfBrokerSummary] A list of information about all brokers.
-- * NextToken [__string] The token that specifies the next page of results Amazon MQ should return. To request the first page, leave nextToken empty.
-- @return ListBrokersResponse structure as a key-value pair table
function M.ListBrokersResponse(args)
assert(args, "You must provide an argument table when creating ListBrokersResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["BrokerSummaries"] = args["BrokerSummaries"],
["NextToken"] = args["NextToken"],
}
asserts.AssertListBrokersResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.CreateUserRequest = { ["ConsoleAccess"] = true, ["Username"] = true, ["Password"] = true, ["BrokerId"] = true, ["Groups"] = true, nil }
function asserts.AssertCreateUserRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected CreateUserRequest to be of type 'table'")
assert(struct["Username"], "Expected key Username to exist in table")
assert(struct["BrokerId"], "Expected key BrokerId to exist in table")
if struct["ConsoleAccess"] then asserts.Assert__boolean(struct["ConsoleAccess"]) end
if struct["Username"] then asserts.Assert__string(struct["Username"]) end
if struct["Password"] then asserts.Assert__string(struct["Password"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
if struct["Groups"] then asserts.Assert__listOf__string(struct["Groups"]) end
for k,_ in pairs(struct) do
assert(keys.CreateUserRequest[k], "CreateUserRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type CreateUserRequest
-- Creates a new ActiveMQ user.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConsoleAccess [__boolean] Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
-- * Username [__string] The username of the ActiveMQ user. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- * Password [__string] Required. The password of the user. This value must be at least 12 characters long, must contain at least 4 unique characters, and must not contain commas.
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- * Groups [__listOf__string] The list of groups (20 maximum) to which the ActiveMQ user belongs. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- Required key: Username
-- Required key: BrokerId
-- @return CreateUserRequest structure as a key-value pair table
function M.CreateUserRequest(args)
assert(args, "You must provide an argument table when creating CreateUserRequest")
local query_args = {
}
local uri_args = {
["{username}"] = args["Username"],
["{broker-id}"] = args["BrokerId"],
}
local header_args = {
}
local all_args = {
["ConsoleAccess"] = args["ConsoleAccess"],
["Username"] = args["Username"],
["Password"] = args["Password"],
["BrokerId"] = args["BrokerId"],
["Groups"] = args["Groups"],
}
asserts.AssertCreateUserRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DeleteBrokerRequest = { ["BrokerId"] = true, nil }
function asserts.AssertDeleteBrokerRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected DeleteBrokerRequest to be of type 'table'")
assert(struct["BrokerId"], "Expected key BrokerId to exist in table")
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
for k,_ in pairs(struct) do
assert(keys.DeleteBrokerRequest[k], "DeleteBrokerRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DeleteBrokerRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * BrokerId [__string] The name of the broker. This value must be unique in your AWS account, 1-50 characters long, must contain only letters, numbers, dashes, and underscores, and must not contain whitespaces, brackets, wildcard characters, or special characters.
-- Required key: BrokerId
-- @return DeleteBrokerRequest structure as a key-value pair table
function M.DeleteBrokerRequest(args)
assert(args, "You must provide an argument table when creating DeleteBrokerRequest")
local query_args = {
}
local uri_args = {
["{broker-id}"] = args["BrokerId"],
}
local header_args = {
}
local all_args = {
["BrokerId"] = args["BrokerId"],
}
asserts.AssertDeleteBrokerRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.Configurations = { ["Current"] = true, ["Pending"] = true, ["History"] = true, nil }
function asserts.AssertConfigurations(struct)
assert(struct)
assert(type(struct) == "table", "Expected Configurations to be of type 'table'")
if struct["Current"] then asserts.AssertConfigurationId(struct["Current"]) end
if struct["Pending"] then asserts.AssertConfigurationId(struct["Pending"]) end
if struct["History"] then asserts.Assert__listOfConfigurationId(struct["History"]) end
for k,_ in pairs(struct) do
assert(keys.Configurations[k], "Configurations contains unknown key " .. tostring(k))
end
end
--- Create a structure of type Configurations
-- Broker configuration information
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Current [ConfigurationId] The current configuration of the broker.
-- * Pending [ConfigurationId] The pending configuration of the broker.
-- * History [__listOfConfigurationId] The history of configurations applied to the broker.
-- @return Configurations structure as a key-value pair table
function M.Configurations(args)
assert(args, "You must provide an argument table when creating Configurations")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["Current"] = args["Current"],
["Pending"] = args["Pending"],
["History"] = args["History"],
}
asserts.AssertConfigurations(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ListBrokersRequest = { ["NextToken"] = true, ["MaxResults"] = true, nil }
function asserts.AssertListBrokersRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected ListBrokersRequest to be of type 'table'")
if struct["NextToken"] then asserts.Assert__string(struct["NextToken"]) end
if struct["MaxResults"] then asserts.AssertMaxResults(struct["MaxResults"]) end
for k,_ in pairs(struct) do
assert(keys.ListBrokersRequest[k], "ListBrokersRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ListBrokersRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * NextToken [__string] The token that specifies the next page of results Amazon MQ should return. To request the first page, leave nextToken empty.
-- * MaxResults [MaxResults] The maximum number of brokers that Amazon MQ can return per page (20 by default). This value must be an integer from 5 to 100.
-- @return ListBrokersRequest structure as a key-value pair table
function M.ListBrokersRequest(args)
assert(args, "You must provide an argument table when creating ListBrokersRequest")
local query_args = {
["nextToken"] = args["NextToken"],
["maxResults"] = args["MaxResults"],
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["NextToken"] = args["NextToken"],
["MaxResults"] = args["MaxResults"],
}
asserts.AssertListBrokersRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.Logs = { ["Audit"] = true, ["General"] = true, nil }
function asserts.AssertLogs(struct)
assert(struct)
assert(type(struct) == "table", "Expected Logs to be of type 'table'")
if struct["Audit"] then asserts.Assert__boolean(struct["Audit"]) end
if struct["General"] then asserts.Assert__boolean(struct["General"]) end
for k,_ in pairs(struct) do
assert(keys.Logs[k], "Logs contains unknown key " .. tostring(k))
end
end
--- Create a structure of type Logs
-- The list of information about logs to be enabled for the specified broker.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Audit [__boolean] Enables audit logging. Every user management action made using JMX or the ActiveMQ Web Console is logged.
-- * General [__boolean] Enables general logging.
-- @return Logs structure as a key-value pair table
function M.Logs(args)
assert(args, "You must provide an argument table when creating Logs")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["Audit"] = args["Audit"],
["General"] = args["General"],
}
asserts.AssertLogs(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.RebootBrokerRequest = { ["BrokerId"] = true, nil }
function asserts.AssertRebootBrokerRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected RebootBrokerRequest to be of type 'table'")
assert(struct["BrokerId"], "Expected key BrokerId to exist in table")
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
for k,_ in pairs(struct) do
assert(keys.RebootBrokerRequest[k], "RebootBrokerRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type RebootBrokerRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- Required key: BrokerId
-- @return RebootBrokerRequest structure as a key-value pair table
function M.RebootBrokerRequest(args)
assert(args, "You must provide an argument table when creating RebootBrokerRequest")
local query_args = {
}
local uri_args = {
["{broker-id}"] = args["BrokerId"],
}
local header_args = {
}
local all_args = {
["BrokerId"] = args["BrokerId"],
}
asserts.AssertRebootBrokerRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.UpdateConfigurationResponse = { ["LatestRevision"] = true, ["Name"] = true, ["Warnings"] = true, ["Created"] = true, ["Id"] = true, ["Arn"] = true, nil }
function asserts.AssertUpdateConfigurationResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected UpdateConfigurationResponse to be of type 'table'")
if struct["LatestRevision"] then asserts.AssertConfigurationRevision(struct["LatestRevision"]) end
if struct["Name"] then asserts.Assert__string(struct["Name"]) end
if struct["Warnings"] then asserts.Assert__listOfSanitizationWarning(struct["Warnings"]) end
if struct["Created"] then asserts.Assert__timestampIso8601(struct["Created"]) end
if struct["Id"] then asserts.Assert__string(struct["Id"]) end
if struct["Arn"] then asserts.Assert__string(struct["Arn"]) end
for k,_ in pairs(struct) do
assert(keys.UpdateConfigurationResponse[k], "UpdateConfigurationResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type UpdateConfigurationResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * LatestRevision [ConfigurationRevision] The latest revision of the configuration.
-- * Name [__string] Required. The name of the configuration. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 1-150 characters long.
-- * Warnings [__listOfSanitizationWarning] The list of the first 20 warnings about the configuration XML elements or attributes that were sanitized.
-- * Created [__timestampIso8601] Required. The date and time of the configuration.
-- * Id [__string] Required. The unique ID that Amazon MQ generates for the configuration.
-- * Arn [__string] Required. The Amazon Resource Name (ARN) of the configuration.
-- @return UpdateConfigurationResponse structure as a key-value pair table
function M.UpdateConfigurationResponse(args)
assert(args, "You must provide an argument table when creating UpdateConfigurationResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["LatestRevision"] = args["LatestRevision"],
["Name"] = args["Name"],
["Warnings"] = args["Warnings"],
["Created"] = args["Created"],
["Id"] = args["Id"],
["Arn"] = args["Arn"],
}
asserts.AssertUpdateConfigurationResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ConfigurationId = { ["Id"] = true, ["Revision"] = true, nil }
function asserts.AssertConfigurationId(struct)
assert(struct)
assert(type(struct) == "table", "Expected ConfigurationId to be of type 'table'")
if struct["Id"] then asserts.Assert__string(struct["Id"]) end
if struct["Revision"] then asserts.Assert__integer(struct["Revision"]) end
for k,_ in pairs(struct) do
assert(keys.ConfigurationId[k], "ConfigurationId contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ConfigurationId
-- A list of information about the configuration.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Id [__string] Required. The unique ID that Amazon MQ generates for the configuration.
-- * Revision [__integer] The revision number of the configuration.
-- @return ConfigurationId structure as a key-value pair table
function M.ConfigurationId(args)
assert(args, "You must provide an argument table when creating ConfigurationId")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["Id"] = args["Id"],
["Revision"] = args["Revision"],
}
asserts.AssertConfigurationId(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ConfigurationRevision = { ["Revision"] = true, ["Description"] = true, ["Created"] = true, nil }
function asserts.AssertConfigurationRevision(struct)
assert(struct)
assert(type(struct) == "table", "Expected ConfigurationRevision to be of type 'table'")
if struct["Revision"] then asserts.Assert__integer(struct["Revision"]) end
if struct["Description"] then asserts.Assert__string(struct["Description"]) end
if struct["Created"] then asserts.Assert__timestampIso8601(struct["Created"]) end
for k,_ in pairs(struct) do
assert(keys.ConfigurationRevision[k], "ConfigurationRevision contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ConfigurationRevision
-- Returns information about the specified configuration revision.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * Revision [__integer] Required. The revision number of the configuration.
-- * Description [__string] The description of the configuration revision.
-- * Created [__timestampIso8601] Required. The date and time of the configuration revision.
-- @return ConfigurationRevision structure as a key-value pair table
function M.ConfigurationRevision(args)
assert(args, "You must provide an argument table when creating ConfigurationRevision")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["Revision"] = args["Revision"],
["Description"] = args["Description"],
["Created"] = args["Created"],
}
asserts.AssertConfigurationRevision(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.ListConfigurationsResponse = { ["NextToken"] = true, ["MaxResults"] = true, ["Configurations"] = true, nil }
function asserts.AssertListConfigurationsResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected ListConfigurationsResponse to be of type 'table'")
if struct["NextToken"] then asserts.Assert__string(struct["NextToken"]) end
if struct["MaxResults"] then asserts.Assert__integer(struct["MaxResults"]) end
if struct["Configurations"] then asserts.Assert__listOfConfiguration(struct["Configurations"]) end
for k,_ in pairs(struct) do
assert(keys.ListConfigurationsResponse[k], "ListConfigurationsResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type ListConfigurationsResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * NextToken [__string] The token that specifies the next page of results Amazon MQ should return. To request the first page, leave nextToken empty.
-- * MaxResults [__integer] The maximum number of configurations that Amazon MQ can return per page (20 by default). This value must be an integer from 5 to 100.
-- * Configurations [__listOfConfiguration] The list of all revisions for the specified configuration.
-- @return ListConfigurationsResponse structure as a key-value pair table
function M.ListConfigurationsResponse(args)
assert(args, "You must provide an argument table when creating ListConfigurationsResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["NextToken"] = args["NextToken"],
["MaxResults"] = args["MaxResults"],
["Configurations"] = args["Configurations"],
}
asserts.AssertListConfigurationsResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DescribeConfigurationRevisionRequest = { ["ConfigurationId"] = true, ["ConfigurationRevision"] = true, nil }
function asserts.AssertDescribeConfigurationRevisionRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected DescribeConfigurationRevisionRequest to be of type 'table'")
assert(struct["ConfigurationRevision"], "Expected key ConfigurationRevision to exist in table")
assert(struct["ConfigurationId"], "Expected key ConfigurationId to exist in table")
if struct["ConfigurationId"] then asserts.Assert__string(struct["ConfigurationId"]) end
if struct["ConfigurationRevision"] then asserts.Assert__string(struct["ConfigurationRevision"]) end
for k,_ in pairs(struct) do
assert(keys.DescribeConfigurationRevisionRequest[k], "DescribeConfigurationRevisionRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DescribeConfigurationRevisionRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConfigurationId [__string] The unique ID that Amazon MQ generates for the configuration.
-- * ConfigurationRevision [__string] The revision of the configuration.
-- Required key: ConfigurationRevision
-- Required key: ConfigurationId
-- @return DescribeConfigurationRevisionRequest structure as a key-value pair table
function M.DescribeConfigurationRevisionRequest(args)
assert(args, "You must provide an argument table when creating DescribeConfigurationRevisionRequest")
local query_args = {
}
local uri_args = {
["{configuration-id}"] = args["ConfigurationId"],
["{configuration-revision}"] = args["ConfigurationRevision"],
}
local header_args = {
}
local all_args = {
["ConfigurationId"] = args["ConfigurationId"],
["ConfigurationRevision"] = args["ConfigurationRevision"],
}
asserts.AssertDescribeConfigurationRevisionRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DescribeBrokerRequest = { ["BrokerId"] = true, nil }
function asserts.AssertDescribeBrokerRequest(struct)
assert(struct)
assert(type(struct) == "table", "Expected DescribeBrokerRequest to be of type 'table'")
assert(struct["BrokerId"], "Expected key BrokerId to exist in table")
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
for k,_ in pairs(struct) do
assert(keys.DescribeBrokerRequest[k], "DescribeBrokerRequest contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DescribeBrokerRequest
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * BrokerId [__string] The name of the broker. This value must be unique in your AWS account, 1-50 characters long, must contain only letters, numbers, dashes, and underscores, and must not contain whitespaces, brackets, wildcard characters, or special characters.
-- Required key: BrokerId
-- @return DescribeBrokerRequest structure as a key-value pair table
function M.DescribeBrokerRequest(args)
assert(args, "You must provide an argument table when creating DescribeBrokerRequest")
local query_args = {
}
local uri_args = {
["{broker-id}"] = args["BrokerId"],
}
local header_args = {
}
local all_args = {
["BrokerId"] = args["BrokerId"],
}
asserts.AssertDescribeBrokerRequest(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DescribeUserResponse = { ["ConsoleAccess"] = true, ["Username"] = true, ["BrokerId"] = true, ["Pending"] = true, ["Groups"] = true, nil }
function asserts.AssertDescribeUserResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected DescribeUserResponse to be of type 'table'")
if struct["ConsoleAccess"] then asserts.Assert__boolean(struct["ConsoleAccess"]) end
if struct["Username"] then asserts.Assert__string(struct["Username"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
if struct["Pending"] then asserts.AssertUserPendingChanges(struct["Pending"]) end
if struct["Groups"] then asserts.Assert__listOf__string(struct["Groups"]) end
for k,_ in pairs(struct) do
assert(keys.DescribeUserResponse[k], "DescribeUserResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DescribeUserResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConsoleAccess [__boolean] Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
-- * Username [__string] Required. The username of the ActiveMQ user. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- * BrokerId [__string] Required. The unique ID that Amazon MQ generates for the broker.
-- * Pending [UserPendingChanges] The status of the changes pending for the ActiveMQ user.
-- * Groups [__listOf__string] The list of groups (20 maximum) to which the ActiveMQ user belongs. This value can contain only alphanumeric characters, dashes, periods, underscores, and tildes (- . _ ~). This value must be 2-100 characters long.
-- @return DescribeUserResponse structure as a key-value pair table
function M.DescribeUserResponse(args)
assert(args, "You must provide an argument table when creating DescribeUserResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["ConsoleAccess"] = args["ConsoleAccess"],
["Username"] = args["Username"],
["BrokerId"] = args["BrokerId"],
["Pending"] = args["Pending"],
["Groups"] = args["Groups"],
}
asserts.AssertDescribeUserResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.DescribeConfigurationRevisionResponse = { ["ConfigurationId"] = true, ["Data"] = true, ["Description"] = true, ["Created"] = true, nil }
function asserts.AssertDescribeConfigurationRevisionResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected DescribeConfigurationRevisionResponse to be of type 'table'")
if struct["ConfigurationId"] then asserts.Assert__string(struct["ConfigurationId"]) end
if struct["Data"] then asserts.Assert__string(struct["Data"]) end
if struct["Description"] then asserts.Assert__string(struct["Description"]) end
if struct["Created"] then asserts.Assert__timestampIso8601(struct["Created"]) end
for k,_ in pairs(struct) do
assert(keys.DescribeConfigurationRevisionResponse[k], "DescribeConfigurationRevisionResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type DescribeConfigurationRevisionResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * ConfigurationId [__string] Required. The unique ID that Amazon MQ generates for the configuration.
-- * Data [__string] Required. The base64-encoded XML configuration.
-- * Description [__string] The description of the configuration.
-- * Created [__timestampIso8601] Required. The date and time of the configuration.
-- @return DescribeConfigurationRevisionResponse structure as a key-value pair table
function M.DescribeConfigurationRevisionResponse(args)
assert(args, "You must provide an argument table when creating DescribeConfigurationRevisionResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["ConfigurationId"] = args["ConfigurationId"],
["Data"] = args["Data"],
["Description"] = args["Description"],
["Created"] = args["Created"],
}
asserts.AssertDescribeConfigurationRevisionResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.UpdateUserResponse = { nil }
function asserts.AssertUpdateUserResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected UpdateUserResponse to be of type 'table'")
for k,_ in pairs(struct) do
assert(keys.UpdateUserResponse[k], "UpdateUserResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type UpdateUserResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- @return UpdateUserResponse structure as a key-value pair table
function M.UpdateUserResponse(args)
assert(args, "You must provide an argument table when creating UpdateUserResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
}
asserts.AssertUpdateUserResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.CreateBrokerResponse = { ["BrokerArn"] = true, ["BrokerId"] = true, nil }
function asserts.AssertCreateBrokerResponse(struct)
assert(struct)
assert(type(struct) == "table", "Expected CreateBrokerResponse to be of type 'table'")
if struct["BrokerArn"] then asserts.Assert__string(struct["BrokerArn"]) end
if struct["BrokerId"] then asserts.Assert__string(struct["BrokerId"]) end
for k,_ in pairs(struct) do
assert(keys.CreateBrokerResponse[k], "CreateBrokerResponse contains unknown key " .. tostring(k))
end
end
--- Create a structure of type CreateBrokerResponse
--
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * BrokerArn [__string] The Amazon Resource Name (ARN) of the broker.
-- * BrokerId [__string] The unique ID that Amazon MQ generates for the broker.
-- @return CreateBrokerResponse structure as a key-value pair table
function M.CreateBrokerResponse(args)
assert(args, "You must provide an argument table when creating CreateBrokerResponse")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["BrokerArn"] = args["BrokerArn"],
["BrokerId"] = args["BrokerId"],
}
asserts.AssertCreateBrokerResponse(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
keys.WeeklyStartTime = { ["DayOfWeek"] = true, ["TimeZone"] = true, ["TimeOfDay"] = true, nil }
function asserts.AssertWeeklyStartTime(struct)
assert(struct)
assert(type(struct) == "table", "Expected WeeklyStartTime to be of type 'table'")
if struct["DayOfWeek"] then asserts.AssertDayOfWeek(struct["DayOfWeek"]) end
if struct["TimeZone"] then asserts.Assert__string(struct["TimeZone"]) end
if struct["TimeOfDay"] then asserts.Assert__string(struct["TimeOfDay"]) end
for k,_ in pairs(struct) do
assert(keys.WeeklyStartTime[k], "WeeklyStartTime contains unknown key " .. tostring(k))
end
end
--- Create a structure of type WeeklyStartTime
-- The scheduled time period relative to UTC during which Amazon MQ begins to apply pending updates or patches to the broker.
-- @param args Table with arguments in key-value form.
-- Valid keys:
-- * DayOfWeek [DayOfWeek] Required. The day of the week.
-- * TimeZone [__string] The time zone, UTC by default, in either the Country/City format, or the UTC offset format.
-- * TimeOfDay [__string] Required. The time, in 24-hour format.
-- @return WeeklyStartTime structure as a key-value pair table
function M.WeeklyStartTime(args)
assert(args, "You must provide an argument table when creating WeeklyStartTime")
local query_args = {
}
local uri_args = {
}
local header_args = {
}
local all_args = {
["DayOfWeek"] = args["DayOfWeek"],
["TimeZone"] = args["TimeZone"],
["TimeOfDay"] = args["TimeOfDay"],
}
asserts.AssertWeeklyStartTime(all_args)
return {
all = all_args,
query = query_args,
uri = uri_args,
headers = header_args,
}
end
function asserts.AssertEngineType(str)
assert(str)
assert(type(str) == "string", "Expected EngineType to be of type 'string'")
end
-- The type of broker engine. Note: Currently, Amazon MQ supports only ActiveMQ.
function M.EngineType(str)
asserts.AssertEngineType(str)
return str
end
function asserts.AssertDeploymentMode(str)
assert(str)
assert(type(str) == "string", "Expected DeploymentMode to be of type 'string'")
end
-- The deployment mode of the broker.
function M.DeploymentMode(str)
asserts.AssertDeploymentMode(str)
return str
end
function asserts.AssertDayOfWeek(str)
assert(str)
assert(type(str) == "string", "Expected DayOfWeek to be of type 'string'")
end
--
function M.DayOfWeek(str)
asserts.AssertDayOfWeek(str)
return str
end
function asserts.Assert__string(str)
assert(str)
assert(type(str) == "string", "Expected __string to be of type 'string'")
end
--
function M.__string(str)
asserts.Assert__string(str)
return str
end
function asserts.AssertBrokerState(str)
assert(str)
assert(type(str) == "string", "Expected BrokerState to be of type 'string'")
end
-- The status of the broker.
function M.BrokerState(str)
asserts.AssertBrokerState(str)
return str
end
function asserts.AssertSanitizationWarningReason(str)
assert(str)
assert(type(str) == "string", "Expected SanitizationWarningReason to be of type 'string'")
end
-- The reason for which the XML elements or attributes were sanitized.
function M.SanitizationWarningReason(str)
asserts.AssertSanitizationWarningReason(str)
return str
end
function asserts.AssertChangeType(str)
assert(str)
assert(type(str) == "string", "Expected ChangeType to be of type 'string'")
end
-- The type of change pending for the ActiveMQ user.
function M.ChangeType(str)
asserts.AssertChangeType(str)
return str
end
function asserts.Assert__integer(integer)
assert(integer)
assert(type(integer) == "number", "Expected __integer to be of type 'number'")
assert(integer % 1 == 0, "Expected a while integer number")
end
function M.__integer(integer)
asserts.Assert__integer(integer)
return integer
end
function asserts.Assert__integerMin5Max100(integer)
assert(integer)
assert(type(integer) == "number", "Expected __integerMin5Max100 to be of type 'number'")
assert(integer % 1 == 0, "Expected a while integer number")
assert(integer <= 100, "Expected integer to be max 100")
assert(integer >= 5, "Expected integer to be min 5")
end
function M.__integerMin5Max100(integer)
asserts.Assert__integerMin5Max100(integer)
return integer
end
function asserts.AssertMaxResults(integer)
assert(integer)
assert(type(integer) == "number", "Expected MaxResults to be of type 'number'")
assert(integer % 1 == 0, "Expected a while integer number")
assert(integer <= 100, "Expected integer to be max 100")
assert(integer >= 1, "Expected integer to be min 1")
end
function M.MaxResults(integer)
asserts.AssertMaxResults(integer)
return integer
end
function asserts.Assert__boolean(boolean)
assert(boolean)
assert(type(boolean) == "boolean", "Expected __boolean to be of type 'boolean'")
end
function M.__boolean(boolean)
asserts.Assert__boolean(boolean)
return boolean
end
function asserts.Assert__timestampIso8601(timestamp)
assert(timestamp)
assert(type(timestamp) == "string", "Expected __timestampIso8601 to be of type 'string'")
end
function M.__timestampIso8601(timestamp)
asserts.Assert__timestampIso8601(timestamp)
return timestamp
end
function asserts.Assert__listOfBrokerSummary(list)
assert(list)
assert(type(list) == "table", "Expected __listOfBrokerSummary to be of type ''table")
for _,v in ipairs(list) do
asserts.AssertBrokerSummary(v)
end
end
--
-- List of BrokerSummary objects
function M.__listOfBrokerSummary(list)
asserts.Assert__listOfBrokerSummary(list)
return list
end
function asserts.Assert__listOfConfigurationId(list)
assert(list)
assert(type(list) == "table", "Expected __listOfConfigurationId to be of type ''table")
for _,v in ipairs(list) do
asserts.AssertConfigurationId(v)
end
end
--
-- List of ConfigurationId objects
function M.__listOfConfigurationId(list)
asserts.Assert__listOfConfigurationId(list)
return list
end
function asserts.Assert__listOf__string(list)
assert(list)
assert(type(list) == "table", "Expected __listOf__string to be of type ''table")
for _,v in ipairs(list) do
asserts.Assert__string(v)
end
end
--
-- List of __string objects
function M.__listOf__string(list)
asserts.Assert__listOf__string(list)
return list
end
function asserts.Assert__listOfUser(list)
assert(list)
assert(type(list) == "table", "Expected __listOfUser to be of type ''table")
for _,v in ipairs(list) do
asserts.AssertUser(v)
end
end
--
-- List of User objects
function M.__listOfUser(list)
asserts.Assert__listOfUser(list)
return list
end
function asserts.Assert__listOfSanitizationWarning(list)
assert(list)
assert(type(list) == "table", "Expected __listOfSanitizationWarning to be of type ''table")
for _,v in ipairs(list) do
asserts.AssertSanitizationWarning(v)
end
end
--
-- List of SanitizationWarning objects
function M.__listOfSanitizationWarning(list)
asserts.Assert__listOfSanitizationWarning(list)
return list
end
function asserts.Assert__listOfConfigurationRevision(list)
assert(list)
assert(type(list) == "table", "Expected __listOfConfigurationRevision to be of type ''table")
for _,v in ipairs(list) do
asserts.AssertConfigurationRevision(v)
end
end
--
-- List of ConfigurationRevision objects
function M.__listOfConfigurationRevision(list)
asserts.Assert__listOfConfigurationRevision(list)
return list
end
function asserts.Assert__listOfConfiguration(list)
assert(list)
assert(type(list) == "table", "Expected __listOfConfiguration to be of type ''table")
for _,v in ipairs(list) do
asserts.AssertConfiguration(v)
end
end
--
-- List of Configuration objects
function M.__listOfConfiguration(list)
asserts.Assert__listOfConfiguration(list)
return list
end
function asserts.Assert__listOfUserSummary(list)
assert(list)
assert(type(list) == "table", "Expected __listOfUserSummary to be of type ''table")
for _,v in ipairs(list) do
asserts.AssertUserSummary(v)
end
end
--
-- List of UserSummary objects
function M.__listOfUserSummary(list)
asserts.Assert__listOfUserSummary(list)
return list
end
function asserts.Assert__listOfBrokerInstance(list)
assert(list)
assert(type(list) == "table", "Expected __listOfBrokerInstance to be of type ''table")
for _,v in ipairs(list) do
asserts.AssertBrokerInstance(v)
end
end
--
-- List of BrokerInstance objects
function M.__listOfBrokerInstance(list)
asserts.Assert__listOfBrokerInstance(list)
return list
end
local content_type = require "aws-sdk.core.content_type"
local request_headers = require "aws-sdk.core.request_headers"
local request_handlers = require "aws-sdk.core.request_handlers"
local settings = {}
local function endpoint_for_region(region, use_dualstack)
if not use_dualstack then
if region == "us-east-1" then
return "mq.amazonaws.com"
end
end
local ss = { "mq" }
if use_dualstack then
ss[#ss + 1] = "dualstack"
end
ss[#ss + 1] = region
ss[#ss + 1] = "amazonaws.com"
if region == "cn-north-1" then
ss[#ss + 1] = "cn"
end
return table.concat(ss, ".")
end
function M.init(config)
assert(config, "You must provide a config table")
assert(config.region, "You must provide a region in the config table")
settings.service = M.metadata.endpoint_prefix
settings.protocol = M.metadata.protocol
settings.region = config.region
settings.endpoint = config.endpoint_override or endpoint_for_region(config.region, config.use_dualstack)
settings.signature_version = M.metadata.signature_version
settings.uri = (config.scheme or "https") .. "://" .. settings.endpoint
end
--
-- OPERATIONS
--
--- Call UpdateUser asynchronously, invoking a callback when done
-- @param UpdateUserRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.UpdateUserAsync(UpdateUserRequest, cb)
assert(UpdateUserRequest, "You must provide a UpdateUserRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".UpdateUser",
}
for header,value in pairs(UpdateUserRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "PUT")
if request_handler then
request_handler(settings.uri, "/v1/brokers/{broker-id}/users/{username}", UpdateUserRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call UpdateUser synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param UpdateUserRequest
-- @return response
-- @return error_type
-- @return error_message
function M.UpdateUserSync(UpdateUserRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.UpdateUserAsync(UpdateUserRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call ListBrokers asynchronously, invoking a callback when done
-- @param ListBrokersRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.ListBrokersAsync(ListBrokersRequest, cb)
assert(ListBrokersRequest, "You must provide a ListBrokersRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".ListBrokers",
}
for header,value in pairs(ListBrokersRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "GET")
if request_handler then
request_handler(settings.uri, "/v1/brokers", ListBrokersRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call ListBrokers synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param ListBrokersRequest
-- @return response
-- @return error_type
-- @return error_message
function M.ListBrokersSync(ListBrokersRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.ListBrokersAsync(ListBrokersRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call DeleteUser asynchronously, invoking a callback when done
-- @param DeleteUserRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.DeleteUserAsync(DeleteUserRequest, cb)
assert(DeleteUserRequest, "You must provide a DeleteUserRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".DeleteUser",
}
for header,value in pairs(DeleteUserRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "DELETE")
if request_handler then
request_handler(settings.uri, "/v1/brokers/{broker-id}/users/{username}", DeleteUserRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call DeleteUser synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param DeleteUserRequest
-- @return response
-- @return error_type
-- @return error_message
function M.DeleteUserSync(DeleteUserRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.DeleteUserAsync(DeleteUserRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call DescribeBroker asynchronously, invoking a callback when done
-- @param DescribeBrokerRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.DescribeBrokerAsync(DescribeBrokerRequest, cb)
assert(DescribeBrokerRequest, "You must provide a DescribeBrokerRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".DescribeBroker",
}
for header,value in pairs(DescribeBrokerRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "GET")
if request_handler then
request_handler(settings.uri, "/v1/brokers/{broker-id}", DescribeBrokerRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call DescribeBroker synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param DescribeBrokerRequest
-- @return response
-- @return error_type
-- @return error_message
function M.DescribeBrokerSync(DescribeBrokerRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.DescribeBrokerAsync(DescribeBrokerRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call UpdateBroker asynchronously, invoking a callback when done
-- @param UpdateBrokerRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.UpdateBrokerAsync(UpdateBrokerRequest, cb)
assert(UpdateBrokerRequest, "You must provide a UpdateBrokerRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".UpdateBroker",
}
for header,value in pairs(UpdateBrokerRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "PUT")
if request_handler then
request_handler(settings.uri, "/v1/brokers/{broker-id}", UpdateBrokerRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call UpdateBroker synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param UpdateBrokerRequest
-- @return response
-- @return error_type
-- @return error_message
function M.UpdateBrokerSync(UpdateBrokerRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.UpdateBrokerAsync(UpdateBrokerRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call ListConfigurations asynchronously, invoking a callback when done
-- @param ListConfigurationsRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.ListConfigurationsAsync(ListConfigurationsRequest, cb)
assert(ListConfigurationsRequest, "You must provide a ListConfigurationsRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".ListConfigurations",
}
for header,value in pairs(ListConfigurationsRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "GET")
if request_handler then
request_handler(settings.uri, "/v1/configurations", ListConfigurationsRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call ListConfigurations synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param ListConfigurationsRequest
-- @return response
-- @return error_type
-- @return error_message
function M.ListConfigurationsSync(ListConfigurationsRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.ListConfigurationsAsync(ListConfigurationsRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call UpdateConfiguration asynchronously, invoking a callback when done
-- @param UpdateConfigurationRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.UpdateConfigurationAsync(UpdateConfigurationRequest, cb)
assert(UpdateConfigurationRequest, "You must provide a UpdateConfigurationRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".UpdateConfiguration",
}
for header,value in pairs(UpdateConfigurationRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "PUT")
if request_handler then
request_handler(settings.uri, "/v1/configurations/{configuration-id}", UpdateConfigurationRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call UpdateConfiguration synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param UpdateConfigurationRequest
-- @return response
-- @return error_type
-- @return error_message
function M.UpdateConfigurationSync(UpdateConfigurationRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.UpdateConfigurationAsync(UpdateConfigurationRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call DescribeUser asynchronously, invoking a callback when done
-- @param DescribeUserRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.DescribeUserAsync(DescribeUserRequest, cb)
assert(DescribeUserRequest, "You must provide a DescribeUserRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".DescribeUser",
}
for header,value in pairs(DescribeUserRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "GET")
if request_handler then
request_handler(settings.uri, "/v1/brokers/{broker-id}/users/{username}", DescribeUserRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call DescribeUser synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param DescribeUserRequest
-- @return response
-- @return error_type
-- @return error_message
function M.DescribeUserSync(DescribeUserRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.DescribeUserAsync(DescribeUserRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call ListUsers asynchronously, invoking a callback when done
-- @param ListUsersRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.ListUsersAsync(ListUsersRequest, cb)
assert(ListUsersRequest, "You must provide a ListUsersRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".ListUsers",
}
for header,value in pairs(ListUsersRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "GET")
if request_handler then
request_handler(settings.uri, "/v1/brokers/{broker-id}/users", ListUsersRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call ListUsers synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param ListUsersRequest
-- @return response
-- @return error_type
-- @return error_message
function M.ListUsersSync(ListUsersRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.ListUsersAsync(ListUsersRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call DescribeConfiguration asynchronously, invoking a callback when done
-- @param DescribeConfigurationRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.DescribeConfigurationAsync(DescribeConfigurationRequest, cb)
assert(DescribeConfigurationRequest, "You must provide a DescribeConfigurationRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".DescribeConfiguration",
}
for header,value in pairs(DescribeConfigurationRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "GET")
if request_handler then
request_handler(settings.uri, "/v1/configurations/{configuration-id}", DescribeConfigurationRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call DescribeConfiguration synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param DescribeConfigurationRequest
-- @return response
-- @return error_type
-- @return error_message
function M.DescribeConfigurationSync(DescribeConfigurationRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.DescribeConfigurationAsync(DescribeConfigurationRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call DescribeConfigurationRevision asynchronously, invoking a callback when done
-- @param DescribeConfigurationRevisionRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.DescribeConfigurationRevisionAsync(DescribeConfigurationRevisionRequest, cb)
assert(DescribeConfigurationRevisionRequest, "You must provide a DescribeConfigurationRevisionRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".DescribeConfigurationRevision",
}
for header,value in pairs(DescribeConfigurationRevisionRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "GET")
if request_handler then
request_handler(settings.uri, "/v1/configurations/{configuration-id}/revisions/{configuration-revision}", DescribeConfigurationRevisionRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call DescribeConfigurationRevision synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param DescribeConfigurationRevisionRequest
-- @return response
-- @return error_type
-- @return error_message
function M.DescribeConfigurationRevisionSync(DescribeConfigurationRevisionRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.DescribeConfigurationRevisionAsync(DescribeConfigurationRevisionRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call CreateUser asynchronously, invoking a callback when done
-- @param CreateUserRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.CreateUserAsync(CreateUserRequest, cb)
assert(CreateUserRequest, "You must provide a CreateUserRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".CreateUser",
}
for header,value in pairs(CreateUserRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "POST")
if request_handler then
request_handler(settings.uri, "/v1/brokers/{broker-id}/users/{username}", CreateUserRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call CreateUser synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param CreateUserRequest
-- @return response
-- @return error_type
-- @return error_message
function M.CreateUserSync(CreateUserRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.CreateUserAsync(CreateUserRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call CreateConfiguration asynchronously, invoking a callback when done
-- @param CreateConfigurationRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.CreateConfigurationAsync(CreateConfigurationRequest, cb)
assert(CreateConfigurationRequest, "You must provide a CreateConfigurationRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".CreateConfiguration",
}
for header,value in pairs(CreateConfigurationRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "POST")
if request_handler then
request_handler(settings.uri, "/v1/configurations", CreateConfigurationRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call CreateConfiguration synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param CreateConfigurationRequest
-- @return response
-- @return error_type
-- @return error_message
function M.CreateConfigurationSync(CreateConfigurationRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.CreateConfigurationAsync(CreateConfigurationRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call ListConfigurationRevisions asynchronously, invoking a callback when done
-- @param ListConfigurationRevisionsRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.ListConfigurationRevisionsAsync(ListConfigurationRevisionsRequest, cb)
assert(ListConfigurationRevisionsRequest, "You must provide a ListConfigurationRevisionsRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".ListConfigurationRevisions",
}
for header,value in pairs(ListConfigurationRevisionsRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "GET")
if request_handler then
request_handler(settings.uri, "/v1/configurations/{configuration-id}/revisions", ListConfigurationRevisionsRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call ListConfigurationRevisions synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param ListConfigurationRevisionsRequest
-- @return response
-- @return error_type
-- @return error_message
function M.ListConfigurationRevisionsSync(ListConfigurationRevisionsRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.ListConfigurationRevisionsAsync(ListConfigurationRevisionsRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call CreateBroker asynchronously, invoking a callback when done
-- @param CreateBrokerRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.CreateBrokerAsync(CreateBrokerRequest, cb)
assert(CreateBrokerRequest, "You must provide a CreateBrokerRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".CreateBroker",
}
for header,value in pairs(CreateBrokerRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "POST")
if request_handler then
request_handler(settings.uri, "/v1/brokers", CreateBrokerRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call CreateBroker synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param CreateBrokerRequest
-- @return response
-- @return error_type
-- @return error_message
function M.CreateBrokerSync(CreateBrokerRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.CreateBrokerAsync(CreateBrokerRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call RebootBroker asynchronously, invoking a callback when done
-- @param RebootBrokerRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.RebootBrokerAsync(RebootBrokerRequest, cb)
assert(RebootBrokerRequest, "You must provide a RebootBrokerRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".RebootBroker",
}
for header,value in pairs(RebootBrokerRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "POST")
if request_handler then
request_handler(settings.uri, "/v1/brokers/{broker-id}/reboot", RebootBrokerRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call RebootBroker synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param RebootBrokerRequest
-- @return response
-- @return error_type
-- @return error_message
function M.RebootBrokerSync(RebootBrokerRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.RebootBrokerAsync(RebootBrokerRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
--- Call DeleteBroker asynchronously, invoking a callback when done
-- @param DeleteBrokerRequest
-- @param cb Callback function accepting three args: response, error_type, error_message
function M.DeleteBrokerAsync(DeleteBrokerRequest, cb)
assert(DeleteBrokerRequest, "You must provide a DeleteBrokerRequest")
local headers = {
[request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version),
[request_headers.AMZ_TARGET_HEADER] = ".DeleteBroker",
}
for header,value in pairs(DeleteBrokerRequest.headers) do
headers[header] = value
end
local request_handler, err = request_handlers.from_protocol_and_method("rest-json", "DELETE")
if request_handler then
request_handler(settings.uri, "/v1/brokers/{broker-id}", DeleteBrokerRequest, headers, settings, cb)
else
cb(false, err)
end
end
--- Call DeleteBroker synchronously, returning when done
-- This assumes that the function is called from within a coroutine
-- @param DeleteBrokerRequest
-- @return response
-- @return error_type
-- @return error_message
function M.DeleteBrokerSync(DeleteBrokerRequest, ...)
local co = coroutine.running()
assert(co, "You must call this function from within a coroutine")
M.DeleteBrokerAsync(DeleteBrokerRequest, function(response, error_type, error_message)
assert(coroutine.resume(co, response, error_type, error_message))
end)
return coroutine.yield()
end
return M
|
QznnbCcsView = class("QznnbCcsView")
QznnbCcsView.onCreationComplete = function (slot0)
ClassUtil.extends(slot0, BaseGameCcsView)
BaseGameCcsView.onCreationComplete(slot0, true)
slot0.model.roomKindChangedSignal:add(slot0.onRoomKindChanged, slot0)
Hero.pNickNameChangedSignal:add(slot0.onNickNameChanged, slot0)
slot0:onRoomKindChanged()
slot0:onUserScoreChanged()
slot0:onNickNameChanged()
slot0.controller:adjustSlimWidth(slot0.btnBack, UIConfig.ALIGN_LEFT, 80)
slot0.controller:adjustSlimWidth(slot0.btnHelp, UIConfig.ALIGN_LEFT, 80)
slot0.controller:adjustSlimWidth(slot0.layerPlayerInfo, UIConfig.ALIGN_LEFT, 80)
slot0.controller:adjustSlimWidth(slot0.layerScore.layerScore, UIConfig.ALIGN_LEFT, 80)
slot0.controller:adjustSlimWidth(slot0.spLogo, UIConfig.ALIGN_RIGHT, -80)
slot0.controller:adjustSlimWidth(slot0.layerRoomTxt, UIConfig.ALIGN_RIGHT, -80)
slot0.controller:adjustSlimWidth(slot0.layerQuickStart, UIConfig.ALIGN_RIGHT, -80)
slot0:bindPaneShowing(slot0.btnBack, "isShowingBtnBack", cc.p(-106, 99), 0, nil, 0, nil, nil, true)
slot0:bindPaneShowing(slot0.btnHelp, "isShowingBtnHelp", cc.p(0, 103), 0, nil, 0, nil, nil, true)
slot0:bindPaneShowing(slot0.spLogo, "isShowingLogo", cc.p(247.5, 24), 0, nil, nil, nil, nil, true)
slot0:bindPaneShowing(slot0.layerPlayerInfo, "isShowingPlayerInfo", cc.p(-95.26, -66.15), 0, nil, nil, nil, nil, true)
slot0:bindPaneShowing(slot0.layerScore, "isShowingMainScore", cc.p(0, -58.21), 0, nil, nil, nil, nil, true)
slot0:bindPaneShowing(slot0.layerQuickStart, "isShowingQuickStart", cc.p(57.44, -44.39), 0, 0.5, nil, Back.easeOut, nil, true)
slot0:bindPaneShowing(slot0.layerRoomTxt, "isShowingRoomTxt", cc.p(0, 70), 0, nil, nil, nil, nil, true)
slot0.spineTbl = {}
slot1 = slot0.controller:createSpineWithEvent("chongzhimenu", nil, false, true)
slot1:setPosition(cc.p(0, 0))
slot0.layerScore.layerScore.btnAdd.spine:addChild(slot1)
table.insert(slot0.spineTbl, slot1)
slot0.controller:createSpineWithEvent("start", nil, false, true).setPosition(slot1, cc.p(165, 0))
slot0.layerQuickStart.btnKSKS:addChild(slot1)
table.insert(slot0.spineTbl, slot1)
slot0.layerPlayerInfo.head:setIsMine(true)
end
QznnbCcsView.onBtnClick = function (slot0, slot1, slot2)
if slot1 == slot0.btnBack then
slot0.controller:onBtnBackClick()
elseif slot1 == slot0.btnHelp then
slot0.model:setIsShowingRule(true)
elseif slot1 == slot0.layerQuickStart.btnKSKS then
slot0.controller:quickStartGame()
end
end
QznnbCcsView.onRootViewHide = function (slot0)
BaseGameCcsView.onRootViewHide(slot0)
Hero.userScoreChangedSignal:remove(slot0.onUserScoreChanged, slot0)
end
QznnbCcsView.onRootViewShow = function (slot0)
BaseGameCcsView.onRootViewShow(slot0)
Hero.userScoreChangedSignal:add(slot0.onUserScoreChanged, slot0)
slot0:onUserScoreChanged()
end
QznnbCcsView.playSpine = function (slot0)
slot1 = ipairs
slot2 = slot0.spineTbl or {}
for slot4, slot5 in slot1(slot2) do
slot5:setAnimation(0, "animation", true)
end
end
QznnbCcsView.pauseSpine = function (slot0)
slot1 = ipairs
slot2 = slot0.spineTbl or {}
for slot4, slot5 in slot1(slot2) do
slot5:clearTracks()
end
end
QznnbCcsView.cacheSpines = function (slot0)
slot1 = ipairs
slot2 = slot0.spineTbl or {}
for slot4, slot5 in slot1(slot2) do
spPoolMgr:put(slot5)
end
slot0.spineTbl = nil
end
QznnbCcsView.onRoomKindChanged = function (slot0)
if not slot0.model:getRoomKind() or slot1 <= 0 then
return
end
slot0.layerRoomTxt.roomName_tf:setIsAssetVCenter(true)
slot0.layerRoomTxt.roomName_tf:setHtmlText(HtmlUtil.createImg(slot2) .. HtmlUtil.createArtNumEx(gameMgr:getCurRoomNum(), "#qznnb_room_index_%s.png", 2) .. HtmlUtil.createImg(slot3))
end
QznnbCcsView.onNickNameChanged = function (slot0)
slot0.layerPlayerInfo.txtName:setString(StringUtil.truncate(Hero:getPNickName(), 10, nil, 2))
end
QznnbCcsView.onUserScoreChanged = function (slot0)
slot0.layerScore.layerScore:setStrBaseWidth(145)
slot0.layerScore.layerScore:setStrTxt(HtmlUtil.createArtNumDot(parseInt(Hero:getUserScore()), "#qznnb_score_num_%s.png"))
end
return
|
function dprint(msg)
if (enDebug) then
print(msg)
end
end
-- create Quaternion table --
function newQ(x,y,z,w)
local q={}
q.x=x
q.y=y
q.z=z
q.w=w
return q
end
-- create Eular table --
function newE(x,y,z)
local e={}
e.x=x
e.y=y
e.z=z
return e
end
-- Convert Quaternion to Eular angles --
function quatToEular(q)
local e={} -- Eular angles
local n = q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w
n = 1 / math.sqrt(n)
local x = q.x * n
local y = q.y * n
local z = q.z * n
local w = q.w * n
local check = 2 * (-y * z + w * x)
local rad2Deg=math.rad2Deg
local atan2=math.atan2
local asin=math.asin
if check < -0.999999 then
e.x=-90
e.y=-atan2(2 * (x * z - w * y), 1 - 2 * (y * y + z * z)) * rad2Deg
e.z=0
elseif (check > 0.999999) then
e.x=90
e.y=-atan2(2 * (x * z - w * y), 1 - 2 * (y * y + z * z)) * rad2Deg
e.z=0
else
e.x=asin(check) * rad2Deg
e.y=atan2(2 * (x * z + w * y), 1 - 2 * (x * x + y * y)) * rad2Deg
e.z=atan2(2 * (x * y + w * z), 1 - 2 * (x * x + z * z)) * rad2Deg
end
return e
end
-- Convert Eular angles to Quaternion --
function eulerToQuat(e)
local q = {}
e.x = e.x * 0.5 * math.deg2Rad
e.y = e.y * 0.5 * math.deg2Rad
e.z = e.z * 0.5 * math.deg2Rad
local sinX = math.sin(e.x)
local cosX = math.cos(e.x)
local sinY = math.sin(e.y)
local cosY = math.cos(e.y)
local sinZ = math.sin(e.z)
local cosZ = math.cos(e.z)
q.w = cosY * cosX * cosZ + sinY * sinX * sinZ
q.x = cosY * sinX * cosZ + sinY * cosX * sinZ
q.y = sinY * cosX * cosZ - cosY * sinX * sinZ
q.z = cosY * cosX * sinZ - sinY * sinX * cosZ
return q
end
-- Calculate angles of baseOffsets --
function getEularBase()
local eular=quatToEular(newQ(mBaseRot.x ,mBaseRot.y, mBaseRot.z, mBaseRot.w))
return eular
end
function getEularParent()
local eular=quatToEular(newQ(readFloat(mapParentRotXAddr), readFloat(mapParentRotYAddr), readFloat(mapParentRotZAddr), readFloat(mapParentRotWAddr)))
return eular
end
-- Calculate angles of libOVR --
function getEularOvr()
local eular=quatToEular(newQ(0,readDouble(rotQyAddr),0,readDouble(rotQwAddr)))
return eular
end
-- Calculate angles of libOVR reseting view --
function getEularOvrRst() -- Orientation of the reset view
local eular=quatToEular(newQ(0,readDouble(rotQyRstAddr),0,readDouble(rotQwRstAddr)))
return eular
end
function getWorldScale()
local ws=readFloat(WorldToMetersScaleWhileInFrameAddr)
if (ws == nil) then
ws = worldScale
end
return ws
end
function vectorRotate2D(x, z, angle)
local rad=math.rad(angle)
local sin=math.sin
local cos=math.cos
local d={}
d.x = x*cos(rad)-z*sin(rad)
d.z = x*sin(rad)+z*cos(rad)
return d
end
function rotateWithParentY(inAngle)
return (inAngle-eularParent.y)%360
end
-- Convert liner to exp curve
-- percentage must be 0~1
function expPercent(percentage, exp)
return percentage^(1/exp)
end
function anaPercent(anaVal)
if ((not checkXbcReady()) or math.abs(anaVal) < anaDeadZone) then
return 0
end
-- anaVal=-32767~0~+32767
-- anaDeadZone ~=~ 3000~3500
-- Minimal push stick ~=~ 10000
local anaMax = 32767
local anaMin = anaDeadZone
local positive = 1
local anaValAbs=math.abs(anaVal)
if (anaValAbs ~= anaVal) then
positive = -1
end
local anaPercentAbs = (anaValAbs-anaMin)/(anaMax-anaMin)
local anaPercentVal = positive*expPercent(anaPercentAbs, anaSensitivityExp)
return anaPercentVal
end
-- New method using Origin/BaseOffsets
-- XZY Movement: Left/Right, Forward/Back, Up/Down
-- Y Rotate
function anaAdvTransfrom(anaValX, anaValZ, anaValY, anaValRY)
local anaPercentX=anaPercent(anaValX)
local anaPercentZ=anaPercent(anaValZ)
local anaPercentY=anaPercent(anaValY)
local anaPercentRY=anaPercent(anaValRY)
local abs=math.abs
-- any axis movement
if (abs(anaPercentX)+abs(anaPercentY)+abs(anaPercentZ)+abs(anaPercentRY) == 0) then
return
end
eularBase=getEularBase()
if (camMode==CAM_MODE_FREE) then
anaAdvMovePlane(anaPercentX*anaMoveFactor, anaPercentZ*anaMoveFactor)
anaAdvMoveElev(anaPercentY*anaMoveFactor)
anaAdvRotate(anaPercentRY*anaRotateFactor)
elseif (camMode==CAM_MODE_FOLLOW) then
-- Slowly rotate Cam when charactor walk/aim to left or right
anaAdvRotate(anaPercentRY*anaRotateFactor*followCamModeRotateFactor)
end
end
-- Old method using LibOVR
-- XZY Movement: Left/Right, Forward/Back, Up/Down
-- Y Rotate
function anaTransfrom(anaValX, anaValZ, anaValY, anaValRY)
local anaPercentX=anaPercent(anaValX)
local anaPercentZ=anaPercent(anaValZ)
local anaPercentY=anaPercent(anaValY)
local anaPercentRY=anaPercent(anaValRY)
local abs=math.abs
-- any axis movement
if (abs(anaPercentX)+abs(anaPercentY)+abs(anaPercentZ)+abs(anaPercentRY) == 0) then
return
end
eularOvr=getEularOvr()
anaMovePlane(anaPercentX*anaMoveFactor, anaPercentZ*anaMoveFactor)
anaMoveElev(anaPercentY*anaMoveFactor)
anaRotate(anaPercentRY*anaRotateFactor)
end
-- New method using Origin/BaseOffsets
function anaAdvMovePlane(moveX, moveZ)
-- Word X: rigt=+, back=-
-- Word Z: forwad=-, back=+
if (moveX == 0) and (moveZ == 0) then return end
if (camMode==CAM_MODE_FREE) then
-- Map corrdinate always changed by reseting the view
-- The orign offset is the same with Map coordinate
-- Just Need to calculate vectors from the base angle
local angle=rotateWithParentY(eularBase.y)
local d=vectorRotate2D(moveX, moveZ, angle)
-- changes Offset Origin to move
local targetX, targetZ
targetX = readFloat(offOrgXAddr) + d.x *worldScale
targetZ = readFloat(offOrgZAddr) + d.z *worldScale
writeFloat(offOrgXAddr, targetX)
writeFloat(offOrgZAddr, targetZ)
end
end
-- Old method using LibOVR
function anaMovePlane(moveX, moveZ)
-- Word X: rigt=+, back=-
-- Word Z: forwad=-, back=+
if (moveX == 0) and (moveZ == 0) then return end
-- Map corrdinate always changed by reseting the view
-- So the OVR reset(calibration) angle should by remove to get the correct related angle
local eularRst = getEularOvrRst()
local d=vectorRotate2D(moveX, moveZ, eularOvr.y-eularRst.y)
local targetX = readDouble(posXAddr) + d.x
local targetZ = readDouble(posZAddr) + d.z
writeDouble(posXAddr, targetX)
writeDouble(posZAddr, targetZ)
end
function anaAdvMoveElev(move)
-- Word Y: up+, down-
if (move == 0) then return end
mBasePos.y=mBasePos.y-move
writeFloat(basePosYAddr, mBasePos.y)
end
function anaMoveElev(move)
-- Word Y: up+, down-
if (move == 0) then return end
writeDouble(posYAddr, readDouble(posYAddr)-move)
end
-- New method using Origin/BaseOffsets
-- Y Rotate
function anaAdvRotate(rotAngle)
if (rotAngle == 0) then return end
local ez = eularBase.z
local ey = (eularBase.y-rotAngle) % 360
local ex = eularBase.x
mBaseRot=eulerToQuat(newE(ez,ey,ex))
writeFloat(baseRotZAddr, mBaseRot.z)
writeFloat(baseRotYAddr, mBaseRot.y)
writeFloat(baseRotXAddr, mBaseRot.x)
writeFloat(baseRotWAddr, mBaseRot.w)
end
-- Old method using LibOVR
-- Y Rotate
function anaRotate(rotAngle)
-- Rest Vew: In Game=Oculus Rest View, Changes World XYZ. Front = 0 degree angle
-- rotQy: Changes virtual screen viewing direction (BOTH VR and Monitor), doesnot change World XYZ. HMD angle clockwise
-- rotQyHMD: Changes VR HEAD direction to follow viewing change, doesnot change World XYZ. HMD angle anticlockwise. (opposite with rotQy)
-- compare to the value of rotQy--
-- Turn the Headset to the right and reset, rotQy is +90, and world turns.
-- Increase rotQy by 90=180, the World XYZ doesnot reset.
-- The Heaset doesnot really changed its direction, but the game think we are turning head to the right
-- So the Virtual window turn to Left and shows the 'LEFT side'
-- rotQyHMD turns the virtual window back to in front of the face, but this doesnot changes the view in virtual window.
-- So the rotQy value for HEAD set is clockwise, for virtual window view is anticlockwise.
if (rotAngle == 0) then return end
local ey = (eularOvr.y-rotAngle) % 360
local q=eulerToQuat(newE(0,ey,0))
-- Monitor and HMD use differnt rotation addresses --
writeDouble(rotQyAddr, q.y)
writeDouble(rotQyHMDAddr, -q.y)
writeDouble(rotQwAddr, q.w)
writeDouble(rotQwHMDAddr, q.w)
-- fix rotation center
-- There some left/rigt drift with the rotaion,
-- accourding to the HMD distance to the Oculus reset point
-- No proper method to fix this.
--anaMovePlane(-rotAngle/1000*1, -rotAngle/1000*1)
end
function followCharacter()
local mapChaZ=readFloat(mapChaZAddr)
local mapChaX=readFloat(mapChaXAddr)
local mapChaY=readFloat(mapChaYAddr)
if (mapChaZ == nil) then
resetCamMode()
return
end
-- move offset origin to charatoer location
local newOffOrgX=mapChaX-readFloat(mapParentXAddr)+followCamOriginFix.x
local newOffOrgZ=mapChaZ-readFloat(mapParentZAddr)+followCamOriginFix.z
-- There is no OffOrgY property, only XZ
writeFloat(offOrgXAddr, newOffOrgX)
writeFloat(offOrgZAddr, newOffOrgZ)
-- Question: Let followCharacter() update height?
end
function distance3D(dx, dz, dy)
local xzDist = math.sqrt(dx^2+dz^2)
return math.sqrt(xzDist^2+dz^2)
end
function followCamAcitve()
-- set basePos (the offset distance from cam to charactor)
-- calculate the distance between character to current position
local d={}
local abs=math.abs
d.x = readFloat(mapParentXAddr)+readFloat(offOrgXAddr)-readFloat(mapChaXAddr)
d.z = readFloat(mapParentZAddr)+readFloat(offOrgZAddr)-readFloat(mapChaZAddr)
d.y = readFloat(mapParentYAddr)-mBasePos.y*worldScale-readFloat(mapChaYAddr)
if (not followCamReset) then
local angle=rotateWithParentY(eularBase.y)
local r=vectorRotate2D(d.x, d.z, -angle)
--dprint("followCAM switch: d.x:"..d.x..", d.z:"..d.z..", r.x:"..r.x..", r.z"..r.z)
mBasePos.x = -r.x/worldScale
mBasePos.z = -r.z/worldScale
writeFloat(basePosXAddr, mBasePos.x)
writeFloat(basePosZAddr, mBasePos.z)
else
--dprint("followCAM reset")
-- When cam position is too far
-- Reset followCAM to default distance
mBasePos.x = 0/worldScale
mBasePos.z = followCamResetDistanceXZ/worldScale
-- basePosY is calulated from parent origin
mBasePos.y = -(readFloat(mapChaYAddr)-readFloat(mapParentYAddr)+followCamResetHeight)/worldScale
followCamReset=false
writeFloat(basePosXAddr, mBasePos.x)
writeFloat(basePosZAddr, mBasePos.z)
writeFloat(basePosYAddr, mBasePos.y)
-- Question: keep view angle?
end
-- Move the offset origin to the character , This is also updated by timer repeatedly
followCharacter()
end
function followCamDeactive()
-- move the origin from charactor back to free cam pos
-- reset basePos
local d={}
d.x=mBasePos.x
d.z=mBasePos.z
local angle=rotateWithParentY(eularBase.y)
local r=vectorRotate2D(d.x, d.z, angle)
local newOffOrgX=readFloat(offOrgXAddr)-followCamOriginFix.x-r.x*worldScale
local newOffOrgZ=readFloat(offOrgZAddr)-followCamOriginFix.z-r.z*worldScale
--dprint("deactive: dx:"..d.x..", dz:"..d.z..", rx:"..r.x..", .z"..r.z)
mBasePos.x=0
mBasePos.z=0
-- no need to reset Y position, it always use basePos to move in both mode
writeFloat(offOrgXAddr, newOffOrgX)
writeFloat(offOrgZAddr, newOffOrgZ)
writeFloat(basePosXAddr, mBasePos.x)
writeFloat(basePosZAddr, mBasePos.z)
end
function freeCamActive()
xinputBlockToggle(true)
end
function freeCamDeactive()
xinputBlockToggle(false)
end
function switchCamMode(newMode)
if (not checkGameReady()) then
return
end
updateWorldData()
eularBase=getEularBase()
if (newMode==CAM_MODE_FREE) then
-- check last mode
if (camMode==CAM_MODE_FREE) then
newMode=CAM_MODE_NONE
freeCamDeactive()
elseif (camMode == CAM_MODE_FOLLOW) then
followCamDeactive()
freeCamActive()
else
freeCamActive()
end
elseif (newMode==CAM_MODE_FOLLOW) then
if (not checkCharacterReady()) then
newMode=camMode --don't switch if no character
else
if (camMode==CAM_MODE_FREE) then
freeCamDeactive()
followCamAcitve()
elseif (camMode == CAM_MODE_FOLLOW and (not followCamReset)) then
newMode=CAM_MODE_NONE
followCamDeactive()
else
followCamAcitve()
end
end
else
if (camMode==CAM_MODE_FREE) then
freeCamActive()
elseif (camMode == CAM_MODE_FOLLOW) then
followCamAcitve()
end
end
camMode=newMode
end
function resetCamMode()
-- Reset position when the game excuting Re-calibrate
writeFloat(offOrgXAddr, 0)
writeFloat(offOrgZAddr, 0)
mBasePos.x=0
mBasePos.z=0
mBasePos.y=0
mBaseRot.x=0
mBaseRot.z=0
mBaseRot.y=0
mBaseRot.w=1
writeFloat(basePosXAddr, mBasePos.x)
writeFloat(basePosZAddr, mBasePos.z)
writeFloat(basePosYAddr, mBasePos.y)
writeFloat(baseRotZAddr, mBaseRot.z)
writeFloat(baseRotYAddr, mBaseRot.y)
writeFloat(baseRotXAddr, mBaseRot.x)
writeFloat(baseRotWAddr, mBaseRot.w)
if (camMode==CAM_MODE_FREE) then
freeCamDeactive()
end
camMode=CAM_MODE_NONE
end
function setSpeed()
if (worldScale == 100) then
anaMoveFactor = anaMoveFactorsHanger[anaFactorSel]
anaRotateFactor = anaRotateFactorsHanger[anaFactorSel]
else
anaMoveFactor = anaMoveFactors[anaFactorSel]
anaRotateFactor = anaRotateFactors[anaFactorSel]
end
end
function increaseSpeed()
-- Increase speed
anaFactorSel = anaFactorSel + 1
if (anaFactorSel > #anaMoveFactors) then
anaFactorSel = #anaMoveFactors
end
setSpeed()
end
function decreaseSpeed()
-- Decrease speed
anaFactorSel = anaFactorSel - 1
if (anaFactorSel < 1) then
anaFactorSel = 1
end
setSpeed()
end
function on_GAMEPAD_LEFT_SHOULDER_released(btn)
decreaseSpeed()
end
function on_GAMEPAD_RIGHT_SHOULDER_released(btn)
increaseSpeed()
end
function on_GAMEPAD_DPAD_UP_released(btn)
end
function on_GAMEPAD_DPAD_DOWN_released(btn)
end
function on_GAMEPAD_DPAD_LEFT_released(btn)
end
function on_GAMEPAD_DPAD_RIGHT_released(btn)
end
function on_GAMEPAD_BACK_released(btn)
resetCamMode()
end
function on_GAMEPAD_LEFT_THUMB_released(btn)
switchCamMode(CAM_MODE_FOLLOW)
end
function on_GAMEPAD_LEFT_THUMB_hold(btn)
followCamReset=true
switchCamMode(CAM_MODE_FOLLOW)
end
function on_GAMEPAD_RIGHT_THUMB_released(btn)
switchCamMode(CAM_MODE_FREE)
end
function xbcCheckButtons()
local idx, btn
-- check button status
for btn, pressed in pairs(xbc) do
-- Only checks buttons, skip analog stick and other info
local btnInitialStr="GAMEPAD_"
if (string.sub(btn, 0,string.len(btnInitialStr))==btnInitialStr) and (pressed) then
-- button pressed
-- Register a botton state
if (xbcButtonStat[btn]==nil or xbcButtonStat[btn]==0) then
--dprint("> "..btn.." DOWN")
xbcButtonStat[btn]=1
else
--button hold
if (xbcButtonStat[btn] ~= -1) then
xbcButtonStat[btn]=xbcButtonStat[btn]+1
if (xbcButtonStat[btn] >= buttonHoldThreshold) then
--dprint("> "..btn.." HOLD")
xbcButtonStat[btn]=-1
-- Call button function if exist
local btnFuncName= "on_"..btn.."_hold"
if (_G[btnFuncName] ~= nil) then
_G[btnFuncName](btn)
else
btnFuncName= "on_"..btn.."_released"
if (_G[btnFuncName] ~= nil) then
_G[btnFuncName](btn)
end
end
end
end
end
else
-- BTN released, do something
if (xbcButtonStat[btn] and xbcButtonStat[btn]>0) then
-- UnRegister a botton state
--dprint("> "..btn.." UP")
-- Call button function if exist
local btnFuncName= "on_"..btn.."_released"
if (_G[btnFuncName] ~= nil) then
_G[btnFuncName](btn)
end
end
xbcButtonStat[btn]=0
end
end
end
-- Timer updates --
function xbcGetState()
-- Read Xbox Controller state
xbc = getXBox360ControllerState();
if (not (checkXbcReady() and checkGameReady())) then
return
end
-- stop vibration --
if (vibStart>0) and (os.clock()-vibStart > vibDuration) then
vibStart=0
setXBox360ControllerVibration(xbc.ControllerID, 0, 0)
end
xbcCheckButtons()
--Move and Rotate with Analog Sticks
-- parameters analog axis for: Move X, Move Z, Move Y, Roate Y (Y is up/down)
-- XZY Movement: Left/Right, Forward/Back, Up/Down
-- Rotate: Left/Right
-- Original method: Use libOvr calibration data
-- New method: Use Origin/BaseOffest in Settings
if (controlStyle == 1) then --CS style
--anaTransfrom(xbc.ThumbLeftX, xbc.ThumbLeftY, xbc.ThumbRightY, xbc.ThumbRightX)
anaAdvTransfrom(xbc.ThumbLeftX, xbc.ThumbLeftY, xbc.ThumbRightY, xbc.ThumbRightX)
elseif (controlStyle == 2) then --Racing style
--anaTransfrom(xbc.ThumbRightX, xbc.ThumbRightY, xbc.ThumbLeftY, xbc.ThumbLeftX)
anaAdvTransfrom(xbc.ThumbRightX, xbc.ThumbRightY, xbc.ThumbLeftY, xbc.ThumbLeftX)
else -- Space Fighter Style
--anaTransfrom(xbc.ThumbLeftX, xbc.ThumbRightY, xbc.ThumbLeftY, xbc.ThumbRightX)
anaAdvTransfrom(xbc.ThumbLeftX, xbc.ThumbRightY, xbc.ThumbLeftY, xbc.ThumbRightX)
end
end
function uiEnHackClicked(sender)
hackToggle(sender.checked)
end
function uiEnCheatClicked(sender)
cheatToggle(sender.checked)
end
function uiEnHelpClicked(sender)
helpToggle(sender.checked)
end
function uiEnDebugClicked(sender)
debugToggle(sender.checked)
end
function uiFormClose(sender)
hackStop()
if (enDebug) then
return caHide --Possible options: caHide, caFree, caMinimize, caNone
else
closeCE()
return caFree --Possible options: caHide, caFree, caMinimize, caNone
end
end
function hackToggle(en)
enHack=en
updataHackButtonCaption()
if (en) then
hackStart()
else
hackStop()
end
end
function updataHackButtonCaption()
local str
if (enHack) then
if (status.gameExe) then
str="Running"
else
str="Waiting"
end
else
str="Suspended"
end
f.enHack.caption=str
end
function uiToggle(mode)
if (mode=="help") then
f.enDebug.checked = false
f.p_debugInfo.visible = false
f.p_help.visible = true
f.height = 530
elseif (mode=="debug") then
f.enHelp.checked = false
f.p_help.visible = false
f.p_debugInfo.visible = true
f.height = 700
else
f.height = 200
f.p_debugInfo.visible = false
f.p_help.visible = false
end
end
function helpToggle(en)
if (en) then
uiToggle("help")
else
uiToggle("normal")
end
end
function debugToggle(en)
enDebug=en
if (en) then
uiToggle("debug")
else
uiToggle("normal")
end
end
function xinputBlockToggle(en)
mrXinputAxisBlock.Active=en
end
function cheatToggle(en)
enCheat=en
cheatAAToggle(en)
end
function cheatAAToggle(en)
if (not enCheat) then
en=false
end
--mrHealth.Active=en
--mrSP.Active=en
end
function cheatUpdate()
if (not (enCheat and checkCheatUpdateReady())) then
return
end
cheatUpdateNum("Health", "Float", 3000)
cheatUpdateNum("SPTimer", "Float", -200)
cheatUpdateNum("Grenade", "Bytes", 3)
end
function cheatUpdateNum(cheatName, type, value)
local addr="cheat"..cheatName.."Addr"
_G["write"..type](_G[addr], value)
end
function initHotkey()
if (enDebug) then
createHotkey(hackStart, VK_SCROLL)
createHotkey(hackStop, VK_PAUSE)
end
end
function hackStart()
timerStart()
cheatAAToggle(true)
end
function hackStop()
xinputBlockToggle(false)
cheatAAToggle(false)
timerStop()
resetUI()
end
function timerStart()
--t1=createTimer(getMainForm(), true) --message output
timerRunning=true
t1=createTimer(f, true) --message output
t2=createTimer(f, true) -- fast timer
t3=createTimer(f, true) -- form update
t4=createTimer(f, true) -- cheat value update
timer_setInterval(t1, 1000)
timer_setInterval(t2, t2_interval)
timer_setInterval(t3, 100)
timer_setInterval(t4, 500)
timer_onTimer(t1, timer1_tick)
timer_onTimer(t2, timer2_tick)
timer_onTimer(t3, timer3_tick)
timer_onTimer(t4, timer4_tick)
-- timer_setEnabled(t1,true)
-- timer_setEnabled(t2,true)
-- timer_setEnabled(t3,true)
-- timer_setEnabled(t4,true)
dprint("Started")
end
function timerStop()
timerRunning=false
dprint("Stopped")
end
function timer1_tick(timer) -- 1 second timer
updateDebugData()
timerCheckDestroy(timer)
end
function timer2_tick(timer) --fastest timer
xbcGetState()
if (camMode==CAM_MODE_FOLLOW) then
followCharacter()
end
timerCheckDestroy(timer)
end
function timer3_tick(timer) -- 0.1 second timer
updateUI()
timerCheckDestroy(timer)
end
function timer4_tick(timer) -- 0.5 second timer
updateStatus()
updateWorldData()
setSpeed()
cheatUpdate()
timerCheckDestroy(timer)
end
function timerCheckDestroy(timer)
if (not timerRunning) then
dprint("Timer "..tostring(timer).." destroyed.")
timer.destroy()
end
end
function checkGameReady()
return status.gameExe and checkSceneReady()
end
function checkGameExe()
if (not enHack) then
status.gameExe=false
return status.gameExe
end
-- getProcessIDFromProcessName(PROCESS_NAME) causes high CPU loading
-- Check game scence first
if (checkSceneReady()) then -- Process already opened, no need to check process id
status.gameExe=true
else
gameExeDectectionSec=gameExeDectectionSec+1
if (gameExeDectectionSec>=3*1000/500) then --slowdown the check interval when game not running
gameExeDectectionSec=0
if (getProcessIDFromProcessName(PROCESS_NAME) ~= nil) then
if (not status.gameExe) then -- prevent process opened but scence not loaded yet
openProcess(PROCESS_NAME)
end
status.gameExe=true
else
status.gameExe=false
end
end
end
return status.gameExe
end
function checkSceneReady()
-- check Scence loaded
return readDouble(basePosZAddr) ~= nil
end
function checkXbcReady()
return xbc ~= nil
end
function checkCharacterReady()
return readFloat(mapChaXAddr) ~= nil
end
function checkCheatUpdateReady()
return readFloat(cheatHealthAddr) ~= nil
end
function updateWorldData()
local ws
if(checkGameReady()) then
ws=getWorldScale()
if (ws~=worldScale) then
worldScale=getWorldScale()
resetCamMode()
end
eularParent=getEularParent()
end
end
-- slowly update status
function updateStatus()
if (enHack) then
status.gameExe = checkGameExe()
status.scence = checkSceneReady()
status.xbc = checkXbcReady()
status.character = checkCharacterReady()
end
end
function initUI()
f.caption = hackName.." ( v"..version.." )"
f.enHack.checked=enHack
f.enCheat.checked=enCheat
f.enDebug.checked=enDebug
f.enDebug.visible=enDebug
debugToggle(enDebug)
end
function resetUI()
status.gameExe = false
status.scence = false
status.xbc = false
status.character = false
updateUI()
end
function updateUI()
-- Status
f.statusGameExe.checked=status.gameExe
updataHackButtonCaption()
f.statusXbc.checked = status.xbc
f.statusScene.checked=status.scence
if (not status.scence) then
f.statusScene.caption = "No Scence"
else
if (worldScale>100) then
f.statusScene.caption = "Map"
else
f.statusScene.caption = "Hanger"
end
end
f.statusCharacter.checked=status.character
if (not status.character) then
f.statusCharacter.caption="No Character"
else
f.statusCharacter.caption="Character"
end
-- Info
f.infoCamMode.text = camModeNames[camMode]
f.infoSpeed.text = "Speed: "..anaFactorSel.." / "..#anaMoveFactors --.." ("..anaMoveFactor.." )"
end
function updateDebugData()
local o
if (not enDebug) or (not checkGameReady()) then return end
local e=eularBase
local ep=eularParent
o="o1"
f[o].caption = "Qw"
f[o..'a'].text = ""
f[o..'b'].text = ""
f[o..'c'].text = readFloat(baseRotWAddr)
o="o2"
f[o].caption = "Qxzy"
f[o..'a'].text = readFloat(baseRotXAddr)
f[o..'b'].text = readFloat(baseRotZAddr)
f[o..'c'].text = readFloat(baseRotYddr)
o="o3"
f[o].caption = "Angle"
f[o..'a'].text = e.x
f[o..'b'].text = e.z
f[o..'c'].text = e.y
o="o4"
f[o].caption = "pAngle"
f[o..'a'].text = ep.x
f[o..'b'].text = ep.z
f[o..'c'].text = ep.y
o="p1"
f[o].caption ="Parent"
f[o..'a'].text = readFloat(mapParentXAddr)
f[o..'b'].text = readFloat(mapParentZAddr)
f[o..'c'].text = readFloat(mapParentYAddr)
o="p2"
f[o].caption ="Origin off"
f[o..'a'].text = readFloat(offOrgXAddr)
f[o..'b'].text = readFloat(offOrgZAddr)
f[o..'c'].text = ""
o="p3"
f[o].caption ="Origin map"
f[o..'a'].text = readFloat(mapParentXAddr)+readFloat(offOrgXAddr)
f[o..'b'].text = readFloat(mapParentZAddr)+readFloat(offOrgZAddr)
f[o..'c'].text = ""
o="p4"
f[o].caption ="Cam map"
f[o..'a'].text = readFloat(mapCamXAddr)
f[o..'b'].text = readFloat(mapCamZAddr)
f[o..'c'].text = readFloat(mapCamYAddr)
if (checkCharacterReady()) then
o="p5"
f[o].caption ="Cha diff"
f[o..'a'].text = readFloat(mapParentXAddr)+readFloat(offOrgXAddr)-readFloat(mapChaXAddr)
f[o..'b'].text = readFloat(mapParentZAddr)+readFloat(offOrgZAddr)-readFloat(mapChaZAddr)
f[o..'c'].text = readFloat(mapParentYAddr)-readFloat(basePosYAddr)*worldScale-readFloat(mapChaYAddr)
end
o="p6"
f[o].caption ="RbasePos *ws"
local r=vectorRotate2D(readFloat(basePosXAddr), readFloat(basePosZAddr), e.y)
f[o..'a'].text = r.x *worldScale
f[o..'b'].text = r.z *worldScale
o="p7"
f[o].caption ="basePos *ws"
f[o..'a'].text = readFloat(basePosXAddr)*worldScale
f[o..'b'].text = readFloat(basePosZAddr)*worldScale
f[o..'c'].text = readFloat(basePosYAddr)*worldScale
o="p8"
f[o].caption ="World Scale"
f[o..'a'].text = worldScale
end
-- Follow mode: Compare camera Relative to match character's Relative
-- newRelative = new Delta OvrPos *worldScale + origin Fix
-- origin fix = relative -(deltaOvrPos*worldScale)
function relOriginFix(currDtOvrPos, currRelative)
return currRelative-(currDtOvrPos*worldScale)
end
function getRelative (currOvrPos, newOvrPos, currRelative)
--newMapPos = newDtOvrPos*worldScale+relOriginFix(currRelative, currDtOvrPos)
--newMapPos = newDtOvrPos*worldScale+currRelative-(currDtOvrPos*worldScale)
--newMapPos = (newDtOvrPos-currDtOvrPos)*worldScale+currRelative
newRelative = (newOvrPos-currOvrPos)*worldScale+currRelative
return newMapPos
end
function getOvrPos(currOvrPos, currRelative, newRelative)
local newOvrPos = currOvrPos+(newRelative-currRelative)/worldScale
return newOvrPos
end
-- definations --
math.deg2Rad = math.pi / 180
math.rad2Deg = 180 / math.pi
nl="\r\n"
f=UDF1
camModeNames={"Default Camera", "Free Camera", "Follow Camera"}
CAM_MODE_NONE=1
CAM_MODE_FREE=2
CAM_MODE_FOLLOW=3
camMode=CAM_MODE_NONE -- Need to be defined at first time for camera switching
-- Settings --
PROCESS_NAME = 'LandfallClient-Win64-Shipping.exe'
-- (timer is inaccure)
-- real trigger per second:
-- 100ms :9.1/10
-- 50ms :16.3/20
-- 20ms :32.2/50
-- 10ms :63.7/100
-- 5ms :65.1/2000
t2_interval = 10 -- input timer
-- Control Style (not used now)
-- 1: CS style: Left hand walk/strafe, right hand turn/elev
-- 2: Racing style: Left hand turn/elev, right hand drift/gas
-- 3: Space Fighter Style: Left hand 3D strafe, right hand turn/throttle
controlStyle =1
-- move/rotate speed
anaMoveFactors = {0.002, 0.006, 0.018, 0.054, 0.152}
anaRotateFactors = {0.8, 1.2, 1.8, 2.5, 3}
-- move/rotate speed in hanger
anaMoveFactorsHanger = {0.01, 0.03, 0.2, 1.2, 10}
anaRotateFactorsHanger = {1, 2, 3, 4, 5}
-- default speed selection
anaFactorSel = 2
-- follow mode rotation multiplier
followCamModeRotateFactor=1
-- input
anaSensitivityExp = 1/3
anaDeadZone = 3000
vibDuration = 0.2 --secs
-- button hold seconds --
buttonHoldThreshold=0.3*(1000/t2_interval)
-- Position fix
followCamOriginFix = {}
followCamOriginFix.x = 0 -- Monitor displays left eye position, shout check this in HMD
followCamOriginFix.z = 0
-- Default follow cam distance
followCamResetDistanceXZ = 1800
followCamResetHeight = 1800
-- enable/disable --
enHack = true
--enDebug = true
enDebug = false
if (enDebug) then
enCheat = true
else
enCheat = false
end
-- software info
hackName= "Landfall Camera hack"
version = "1.0"
---- Globals ----
xbc = nil
xbcButtonStat={}
eularBase = {["x"]=0,["y"]=0,["z"]=0}
eularParent={["x"]=0,["y"]=0,["z"]=0}
eularOvr = {["x"]=0,["y"]=0,["z"]=0}
anaMoveFactor=0
anaRotateFactor=0
worldScale = 100
followCamReset=false
vibStart = 0 -- os.clock time
timerRunning = false
gameExeDectectionSec=0
-- Game view reset will clear all base data
-- Remember them will be useful if we don't want reset view changes current position
mBasePos={}
mBasePos.x=0
mBasePos.z=0
mBasePos.y=0
mBaseRot={}
mBaseRot.x=0
mBaseRot.z=0
mBaseRot.y=0
mBaseRot.w=1
-- Non-realtime status
status = {}
status.gameExe = false
status.xbc = false
status.scence = false
status.character = false
---- Memory Records ----
-- PositionOffset (offOrg):
-- Offset distance to HMD Origin,
-- The coodinate system is alway the same with Map, not effected by rotation.
-- The scale is also the same with the Map. (but counting from HMD Origin.)
-- This changes the HMD position, and also the rotation center of the 'BaseOrientation'
-- This doesnot effect the 'ComponentToWorld.Trans' / 'Relative' in CamComponent Object
-- Only 2 axis X & Z are provided, no Y axis.
-- BaseOffset: This also moves the HMD position, and the coodinate system follows 'BaseOrientation'
-- But too bad this does not move the rotation center together.
-- BaseOrientation: This Rotaion feels much better than the quaternion in libOVR, true rotaion around center point.
-- And this also provides 3 axis rotation.
-- LibOVR Orientation: The rotation center always follows HMD, not effectd by PositionOffset or BaseOffset
-- But the rotaion feels strange,
-- and it is affected by the distance of HMD and the Oculus initial calibration origin.
-- Direction
-- BaseOffset.Z (FW- BK+) / BaseOffset.X (L+ R-) / BaseOffset.Y (Up- Dn+)
-- BaseOrientation.Z (-CW) / BaseOrientation.X (-Dn) / BaseOrientation.Y (L+ R-) / BaseOrientation
-- LibOVR
posXAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+660"
posYAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+668"
posZAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+670"
rotQyAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+648" -- View rotation (both Monitor and HMD)
rotQwAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+658"
rotQyHMDAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+680" -- HMD Rotation
rotQwHMDAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+690"
posXRstAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+5f0"
posYRstAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+5f8"
posZRstAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+600"
rotQyRstAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+5d8" -- Forward direction (only affected by reset view)
rotQwRstAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+620"
currHeadposXAdrr="[[[[[\"LandfallClient-Win64-Shipping.exe\"+02FDA368]+0]+38]+650]+150]+720"
-- Map postion --
-- the old one, not sure belong to which object
mapPosZAddr = "[[[\"LandfallClient-Win64-Shipping.exe\"+02E00EC0]+0]+C8] +0"
mapPosXAddr = "[[[\"LandfallClient-Win64-Shipping.exe\"+02E00EC0]+0]+C8] +4"
mapPosYAddr = "[[[\"LandfallClient-Win64-Shipping.exe\"+02E00EC0]+0]+C8] +8"
-- CameraComponent Object
mapCamZAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02DFF670]+8]+278]+58]+390] +1A0"
mapCamXAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02DFF670]+8]+278]+58]+390] +1A4"
mapCamYAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02DFF670]+8]+278]+58]+390] +1A8"
mapRelZAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02DFF670]+8]+278]+58]+390] +1E0"
mapRelXAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02DFF670]+8]+278]+58]+390] +1E4"
mapRelYAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+02DFF670]+8]+278]+58]+390] +1E8"
-- Character CameraComponent Object
mapChaZAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+03091A50]+30]+400]+3E8] +1A0"
mapChaXAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+03091A50]+30]+400]+3E8] +1A4"
mapChaYAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+03091A50]+30]+400]+3E8] +1A8"
-- FOculusHMD Object
FOculusHMDObjBase= "[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8] +0"
mapParentRotZAddr= "[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8] +40"
mapParentRotXAddr= "[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8] +44"
mapParentRotYAddr= "[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8] +48"
mapParentRotWAddr= "[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8] +4C"
mapParentZAddr= "[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8] +50"
mapParentXAddr= "[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8] +54"
mapParentYAddr= "[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8] +58"
-- FOculusHMD Settings
FOculusHMDObjSettingsBase= "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+0"
basePosZAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+70"
basePosXAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+74"
basePosYAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+78"
baseRotZAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+80"
baseRotXAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+84"
baseRotYAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+88"
baseRotWAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+8C"
-- Camera origin offset to the parent
offOrgZAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+D0"
offOrgXAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+A8]+D4"
FOculusHMDObjFrameBase= "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+B8]+0"
WorldToMetersScaleWhileInFrameAddr= "[[[[\"LandfallClient-Win64-Shipping.exe\"+02DD70D8]+8]+8]+B8]+B8"
-- Cheat ptrs --
cheatHealthAddr = "[[[[\"LandfallClient-Win64-Shipping.exe\"+03091A50]+30]+390]+7C8]+178"
cheatSPTimerAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+03091A50]+30]+390]+310]+90]+F8"
cheatGrenadeAddr = "[[[[[\"LandfallClient-Win64-Shipping.exe\"+03091A50]+30]+3A8]+658]+78]+AE1"
-- AA --
mrXinputAxisBlock=getAddressList().getMemoryRecordByDescription('Xinput Axis Block')
mrHealth=getAddressList().getMemoryRecordByDescription('Health AA')
mrSP=getAddressList().getMemoryRecordByDescription('SP timer AA')
initHotkey()
initUI()
f.show()
updateUI()
updateDebugData()
hackToggle(enHack)
dprint("------")
dprint("Press ScrLk to Start, Pause to stop")
|
--data.lua
require("prototypes.solar-construction-robot")
require("prototypes.solar-logistic-robot")
|
local new_fifo = require "fifo"
describe("Everything works.", function()
it("doesn't let you set a field", function()
local f = new_fifo()
assert.errors(function() f.foo = "bar" end)
end)
it("peek works", function()
local f = new_fifo()
f:push("foo")
assert.same("foo", (f:peek()))
f:push("bar")
assert.same("foo", (f:peek()))
assert.same("bar", (f:peek(2)))
f:pop()
assert.same("bar", (f:peek()))
assert.same({nil, false}, {f:peek(20)})
end)
it("length works", function()
local f = new_fifo("foo", "bar")
assert.same(2, f:length())
f:push("baz")
assert.same(3, f:length())
f:pop()
f:pop()
f:pop()
assert.same(0, f:length())
end)
if _VERSION > "Lua 5.1" then
it("length operator works", load([[
local new_fifo = require "fifo"
local f = new_fifo("foo", "bar")
assert.same(2, #f)
f:push("baz")
assert.same(3, #f)
f:pop()
f:pop()
f:pop()
assert.same(0, #f)
]], nil, "t", _ENV))
end
it("insert works", function()
local f = new_fifo("foo")
f:insert(1, "baz")
f:insert(f:length()+1, "bar")
f:insert(f:length(), "corge") -- 2nd from end
assert.same("baz", f:pop())
assert.same("foo", f:pop())
assert.same("corge", f:pop())
assert.same("bar", f:pop())
assert.errors(function() f:pop() end)
f:insert(1, "qux")
assert.same("qux", f:pop())
assert.errors(function() f:insert(2, "too far") end)
assert.errors(function() f:insert(0) end)
end)
it("remove works", function()
local f = new_fifo()
assert.errors(function() f:remove(1) end)
f:setempty(function() return "EMPTY" end)
assert.same("EMPTY", f:remove(1))
f:push("foo")
f:push("bar")
f:push("baz")
f:push("qux")
f:push("corge")
assert.same("baz", f:remove(3))
assert.same("corge", f:remove(4))
assert.same("foo", f:remove(1))
assert.same("qux", f:remove(2))
assert.same("bar", f:remove(1))
assert.same(0, f:length())
assert.errors(function() f:remove(50.5) end)
end)
end)
|
--天种-虚种
local m=14090016
local cm=_G["c"..m]
function cm.initial_effect(c)
aux.EnableDualAttribute(c)
--lvchange
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCategory(CATEGORY_LVCHANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(aux.IsDualState)
e1:SetTarget(cm.lvtg)
e1:SetOperation(cm.lvop)
c:RegisterEffect(e1)
--SpecialSummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(aux.IsDualState)
e2:SetCost(cm.spcost)
e2:SetTarget(cm.sptg)
e2:SetOperation(cm.spop)
c:RegisterEffect(e2)
--SpecialSummon
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetCode(EFFECT_DUAL_STATUS)
e3:SetCondition(cm.dscon)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,2))
e4:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_BE_MATERIAL)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCondition(cm.bmcon)
e4:SetTarget(cm.bmtg)
e4:SetOperation(cm.bmop)
c:RegisterEffect(e4)
end
function cm.lvfilter(c)
return c:IsFaceup() and c:IsRace(RACE_PLANT) and c:GetLevel()>0
end
function cm.lvtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.lvfilter,tp,LOCATION_MZONE,0,1,nil) end
end
function cm.lvop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetMatchingGroup(cm.lvfilter,tp,LOCATION_MZONE,0,nil)
local tc=tg:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD)
tc:RegisterEffect(e1)
tc=tg:GetNext()
end
end
function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
e:SetLabel(e:GetHandler():GetLevel())
Duel.Release(e:GetHandler(),REASON_COST)
end
function cm.spfilter(c,e,tp,lv)
return c:IsLevelBelow(lv-1) and c:IsRace(RACE_PLANT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local lv=e:GetHandler():GetLevel()
if chk==0 then return lv>1 and Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp,lv) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local lv=e:GetLabel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp,lv)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function cm.dscon(e)
return e:GetHandler():IsLevelAbove(2)
end
function cm.bmcon(e,tp,eg,ep,ev,re,r,rp)
return (e:GetHandler():IsLocation(LOCATION_GRAVE) or e:GetHandler():IsLocation(LOCATION_REMOVED)) and (r==REASON_FUSION or e:GetHandler():IsReason(REASON_FUSION)) and e:GetHandler():GetPreviousLevelOnField()>=2 and bit.band(TYPE_EFFECT,e:GetHandler():GetPreviousTypeOnField())~=0
end
function cm.ffilter(c)
return c:IsCode(24094653) and c:IsAbleToHand()
end
function cm.bmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.ffilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function cm.bmop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.ffilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end |
--[[
Update job progress
Input:
KEYS[1] Job id key
KEYS[2] event stream key
ARGV[1] id
ARGV[2] progress
Event:
progress(jobId, progress)
]]
redis.call("HSET", KEYS[1], "progress", ARGV[2])
redis.call("XADD", KEYS[2], "*", "event", "progress", "jobId", ARGV[1], "data", ARGV[2]);
|
local _, private = ...
--[[ Lua Globals ]]
-- luacheck: globals
--[[ Core ]]
local Aurora = private.Aurora
local Skin = Aurora.Skin
--do --[[ FrameXML\SocialToast.lua ]]
--end
do --[[ FrameXML\SocialToast.xml ]]
function Skin.SocialToastTemplate(ContainedAlertFrame)
end
end
--function private.FrameXML.SocialToast()
--end
|
-- Copyright (C) 2020 Jacob Shtabnoy <[email protected]>
-- Licensed under the terms of the ISC License, see LICENSE
-- Defines each as a global
WebhookForm = require("lefthook.WebhookForm");
Webhook = require("lefthook.Webhook");
Embed = require("lefthook.Embed");
WebhookBatch = require("lefthook.WebhookBatch");
|
DEFINE_BASECLASS( "base_gmodentity" )
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.Author = "Radon"
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Spawnable = false
ENT.AdminSpawnable = false
function ENT:Error ( msg, traceback )
if type( msg ) == "table" then
if msg.message then
local line= msg.line
local file = msg.file
msg = ( file and ( file .. ":" ) or "" ) .. ( line and ( line .. ": " ) or "" ) .. msg.message
end
end
msg = tostring( msg )
if SERVER then
ErrorNoHalt( "Processor of " .. self.owner:Nick() .. " errored: " .. msg .. "\n" )
end
SF.AddNotify( self.owner, msg, NOTIFY_ERROR, 7, NOTIFYSOUND_ERROR1 )
if self.instance then
self.instance:deinitialize()
self.instance = nil
end
if traceback then
if SERVER then
SF.Print( self.owner, traceback )
else
print( traceback )
end
end
return msg
end
|
talked_to_captain = false
music = "dockknocking.ogg"
started = false
first_added = false
second_added = false
fleer_gone = false
faelon_gone = false
rider_gone = false
function end_captain_walk()
captain_moved = true
descriptifyPlayer()
end
function fan_out()
-- hack
setObjectDirection(0, DIRECTION_SOUTH)
first_added = true
local px, py = getObjectPosition(0)
local rider2 = Object:new{x=px, y=py, anim_set="Rider", person=true}
local faelon2 = Object:new{x=px, y=py, anim_set="Faelon", person=true}
setObjectSolid(rider2.id, false)
setObjectSolid(faelon2.id, false)
for k, v in pairs(rider2) do
rider[k] = v
end
for k, v in pairs(faelon2) do
faelon[k] = v
end
rider.scripted_events = {
{ event_type=EVENT_WALK, dest_x=px-1, dest_y=py },
{ event_type=EVENT_LOOK, direction=DIRECTION_SOUTH },
{ event_type=EVENT_SYNC, who=eny, number=8 },
{ event_type=EVENT_SYNC, who=faelon, number=6 },
{ event_type=EVENT_WALK, dest_x=24, dest_y=16 },
{ event_type=EVENT_WALK, dest_x=24, dest_y=17 },
{ event_type=EVENT_CUSTOM, callback=remove_rider },
{ event_type=EVENT_SYNC, who=eny, number=13 },
}
faelon.scripted_events = {
{ event_type=EVENT_WALK, dest_x=px, dest_y=py-1 },
{ event_type=EVENT_LOOK, direction=DIRECTION_SOUTH },
{ event_type=EVENT_SYNC, who=eny, number=8 },
{ event_type=EVENT_SYNC, who=fleer, number=6 },
{ event_type=EVENT_WALK, dest_x=24, dest_y=17 },
{ event_type=EVENT_CUSTOM, callback=remove_faelon },
{ event_type=EVENT_SYNC, who=eny, number=13 },
}
setObjectSubAnimation(sub.id, "with_gunnar")
end
function add_mel()
second_added = true
setObjectPosition(fleer.id, 48, 16)
px, py = getObjectPosition(0)
fleer.scripted_events = {
{ event_type=EVENT_WALK, dest_x=px+1, dest_y=py },
{ event_type=EVENT_LOOK, direction=DIRECTION_WEST },
{ event_type=EVENT_SYNC, who=eny, number=11 },
{ event_type=EVENT_WALK, dest_x=24, dest_y=16 },
{ event_type=EVENT_WALK, dest_x=24, dest_y=17 },
{ event_type=EVENT_CUSTOM, callback=remove_fleer },
{ event_type=EVENT_SYNC, who=eny, number=13 },
}
end
function bye_gunnar()
setObjectSubAnimation(sub.id, "bob")
end
function remove_eny()
setObjectHidden(0, true)
end
function remove_fleer()
removeObject(fleer.id)
fleer_gone = true
addPartyMember("Mel");
end
function remove_faelon()
removeObject(faelon.id)
faelon_gone = true
end
function remove_rider()
removeObject(rider.id)
rider_gone = true
end
function end_sub_scene()
prepareForScreenGrab1()
drawArea()
drawBufferToScreen()
prepareForScreenGrab2()
local result = prompt("Skip", "this mini game?", 0, 0)
if (result == true) then
bonusPoints()
setObjectHidden(0, false)
setObjectSolid(0, true)
change_areas("fort_start", 36, 47, DIRECTION_SOUTH)
else
dpad_off()
prepareForScreenGrab1()
drawArea()
drawBufferToScreen()
prepareForScreenGrab2()
dpad_on()
fadeOut(0, 0, 0)
setObjectHidden(0, false)
setObjectSolid(0, true)
setMilestone(MS_DOCK_TO_FORT, true)
if (doShooter(true)) then
change_areas("fort_start", 36, 47, DIRECTION_SOUTH)
else
gameOverNoFade()
end
end
end
function start()
-- work around a bug where you'd get stranded on top of
-- submarine and couldn't get back to land
local bug_x, bug_y = getObjectPosition(0)
if (bug_x == 24 and bug_y == 17) then
setObjectPosition(0, 24, 15)
end
captain = Object:new{x=18, y=14, anim_set="Captain", person=true}
mate = Object:new{x=17, y=14, anim_set="Mate", person=true}
setMilestone(MS_LEFT_EAST_BY_BOAT, false)
setMilestone(MS_LEFT_SEASIDE_BY_BOAT, false)
setMilestone(MS_FORT_TO_DOCK, false)
setMilestone(MS_DOCK_TO_FORT, false)
if (getMilestone(MS_SUB_SCENE_DONE)) then
sub = Object:new{x=22, y=19, anim_set="sub"}
setObjectLow(sub.id, true)
gunnar = Object:new{x=24, y=16, anim_set="Gunnar", person=true}
setObjectDirection(gunnar.id, DIRECTION_NORTH)
elseif (getMilestone(MS_GUNNAR_LEFT) and not getMilestone(MS_SUB_SCENE_DONE)) then
sub = Object:new{x=22, y=19, anim_set="sub"}
setObjectLow(sub.id, true)
fleer = Object:new{x=42, y=14, anim_set="fleer", person=true}
setObjectDirection(fleer.id, DIRECTION_SOUTH)
elseif (not getMilestone(MS_SUB_SCENE_DONE)) then
fleer = Object:new{x=42, y=16, anim_set="fleer", person=true, move_type=MOVE_WANDER}
end
end
function stop()
end
function update(step)
if (not getMilestone(MS_GUNNAR_LEFT)) then
fleer:move(step)
end
if (not getMilestone(MS_SAILORS_WORD)) then
doDialogue("Captain: We'll be here for you mate, if you need our services again.\n")
setMilestone(MS_SAILORS_WORD, true)
end
px, py = getObjectPosition(0)
if (px >= 50) then
stopObject(0)
doMap("eastern_dock")
end
if (talked_to_captain and not captain_moved) then
captain:update(step)
mate:update(step)
end
if (getMilestone(MS_GUNNAR_LEFT) and not getMilestone(MS_SUB_SCENE_DONE)) then
if (not started) then
px, py = getObjectPosition(0)
if (px < 32) then
started = true
scriptifyPlayer()
eny = Object:new{id=0, x=px, y=py}
setObjectSolid(eny.id, false)
setObjectSolid(fleer.id, false)
rider = Object:new{}
faelon = Object:new{}
eny.scripted_events = {
{ event_type=EVENT_WALK, dest_x=24, dest_y=16 },
{ event_type=EVENT_CUSTOM, callback=fan_out },
{ event_type=EVENT_SPEAK, text="Gunnar: So, what do you think?\nRider: Is that thing seaworthy?!\nGunnar: Absolutely...\nEny: Well if it can get us to the floating fortress it will have done it's job.\nFaelon: Gunnar, are you equipped for battle?\nGunnar: No, I will have to stay with the sub, or there's no getting off of that fortress...\nFaelon: Hmm, then we need some one else...\n" },
{ event_type=EVENT_WAIT_FOR_SPEECH },
{ event_type=EVENT_CUSTOM, callback=add_mel },
{ event_type=EVENT_SYNC, who=fleer, number=2 },
{ event_type=EVENT_SPEAK, text="Mel: I hear you're looking for help...\nRider: What help could you be?\nMel: I happen to be very skilled with magic!\nEny: You're a young girl, shouldn't you be home with your parents?\nMel: I don't have parents... I have no family at all...\nEny: Oh my... What happened?\nMel: Monsters got them...\nEny: So you think you have a score to settle then?\nMel: Yes. \\ Eny: Alright then, you can come.\nEny: Let's go straight away, we have no time to lose!\nGunnar: All aboard!\n" },
{ event_type=EVENT_WAIT_FOR_SPEECH },
{ event_type=EVENT_CUSTOM, callback=bye_gunnar },
{ event_type=EVENT_WALK, dest_x=24, dest_y=17 },
{ event_type=EVENT_CUSTOM, callback=remove_eny },
{ event_type=EVENT_SYNC, who=rider, number=7 },
{ event_type=EVENT_CUSTOM, callback=end_sub_scene },
}
end
end
if (started) then
eny:update(step)
if (not getMilestone(MS_SUB_SCENE_DONE)) then
if (first_added) then
if (not rider_gone) then
rider:update(step)
end
if (not faelon_gone) then
faelon:update(step)
end
end
if (second_added) then
if (not fleer_gone) then
fleer:update(step)
end
end
end
end
end
px, py = getObjectPosition(0)
if ((px == 17 and py == 14) or (px == 18 and py == 14)) then
setGlobalCanSave(false)
elseif ((px == 17 and py == 15) or (px == 18 and py == 15)) then
setGlobalCanSave(true)
end
end
function activate(activator, activated)
if (activated == captain.id) then
if (not talked_to_captain) then
scriptifyPlayer()
doDialogue("Captain: You want to board the ship? Aye, we set sail as soon as you're ready!\n", true, false, true)
captain.scripted_events = {
{event_type=EVENT_WALK, dest_x=18, dest_y=12},
{event_type=EVENT_WALK, dest_x=24, dest_y=12},
{event_type=EVENT_WALK, dest_x=24, dest_y=9},
{event_type=EVENT_LOOK, direction=DIRECTION_WEST},
}
mate.scripted_events = {
{event_type=EVENT_SYNC, who=captain, number=1},
{event_type=EVENT_WALK, dest_x=17, dest_y=12},
{event_type=EVENT_WALK, dest_x=24, dest_y=12},
{event_type=EVENT_WALK, dest_x=24, dest_y=10},
{event_type=EVENT_LOOK, direction=DIRECTION_SOUTH},
{event_type=EVENT_CUSTOM, callback=end_captain_walk},
}
talked_to_captain = true
elseif (captain_moved) then
setMilestone(MS_LEFT_EAST_BY_BOAT, true)
doDialogue("Captain: Alright then, off we go!\n", true)
setGlobalCanSave(true)
doMap("eastern_dock")
end
elseif (activated == mate.id) then
doDialogue("Mate: G'day! ...\n")
elseif (fleer and activated == fleer.id) then
if (getMilestone(MS_GUNNAR_LEFT)) then
local _d = getObjectDirection(fleer.id)
setObjectDirection(fleer.id, player_dir(fleer))
doDialogue("Girl: Sure Flowey is safer now... but how long will it last?\n", true)
setObjectDirection(fleer.id, _d)
else
setObjectDirection(fleer.id, player_dir(fleer))
doDialogue("Girl: There are monsters attacking people in the area near Flowey.\nGirl: The King will not believe that monsters have risen again!\nGirl: The people of Flowey cannot hold the city much longer!\n")
end
elseif (gunnar and activated == gunnar.id) then
local _d = getObjectDirection(gunnar.id)
setObjectDirection(gunnar.id, player_dir(gunnar))
if (getMilestone(MS_BEAT_TODE)) then
doDialogue("Gunnar: Wow! What a feat of engineering!\n", true)
elseif (getMilestone(MS_BEAT_GIRL_DRAGON)) then
doDialogue("Gunnar: No, I've never built a space craft... but I know someone who has.\nGunnar: Odd thing is he's a simple farmer!\n", true);
end
prepareForScreenGrab1()
drawArea()
drawBufferToScreen()
prepareForScreenGrab2()
local choice = triple_prompt(
"Would you like to go through",
"the trench again, or take the",
"longer, safer route?",
"Trench", "Safe", "Cancel", 2)
setObjectDirection(gunnar.id, _d)
if (choice == 0) then
if (doShooter(false)) then
change_areas("fort_start", 36, 47, DIRECTION_SOUTH)
else
gameOver();
end
elseif (choice == 1) then
setMilestone(MS_FORT_TO_DOCK, false)
setMilestone(MS_DOCK_TO_FORT, true)
doMap("eastern_dock")
end
end
end
function collide(id1, id2)
end
|
local ninja = require 'BUILD.lib.ninja_syntax'
local asset_map = require 'resources.asset_map'
local ignore = shallowcopy(ignore_patterns)
setmetatable(ignore, wildcard_pattern.aggregate)
ignore:extend("engine/DEBUG", "engine/BUILD", "*.md")
local iswindows = love.system.getOS() == 'Windows'
local default_rules = {
['.lua'] = 'lua',
}
function generate(output_file)
local writer = ninja.Writer.new(output_file or 'build.ninja')
if iswindows then
writer:include('engine/BUILD/windows.ninja')
else
writer:include('engine/BUILD/unix.ninja')
end
writer:include('engine/BUILD/common.ninja'):newline()
writer:variable('builddir', 'build'):newline()
local files = {}
local build_files = {}
local source = love.filesystem.getSource()
for filename, path in iter_file_tree('', ignore) do
if love.filesystem.getRealDirectory(path):startswith(source) then
table.insert(files, path)
table.insert(build_files, 'build/' .. path)
local basename, ext = asset_map.split_extension(path)
local rule = default_rules[ext] or 'copy'
writer:build('build/' .. path, rule, path)
end
end
local identity = love.filesystem.getIdentity() or 'game'
local love_file = string.format('build/%s.love', identity)
writer:build(love_file, 'love', build_files)
writer:default(love_file):newline()
local love_version = '11.3' -- TODO: use love.getVersion
local win32_love = string.format('love-%s-win32', love_version)
local win32_exe = string.format('build/%s_win32.zip', identity)
writer:build(win32_exe, 'win32_exe', { 'build/exe/' .. win32_love, love_file }, 'engine/BUILD/patch_windows_exe.sh')
writer:build('win32', 'phony', win32_exe):newline()
writer:build('all', 'phony', { 'win32' })
writer:close()
end
return generate
|
require "util"
local Persistence = require "util.persistence"
local Consts = require "consts"
local TimeController = require "timecontroller"
local MidiSignals = require "midisignals"
local MidiInput = require "midiinput"
local MidiState = require "midistate"
-- user config
local _userConfig
-- local instances
local _timeController
local _midiInput
local _midiState
local _streamingAudio
-- local rendering values
local _waveData = {}
local _waveHeight = 127
local _waveDepth = 480
-- local debugging keyboard keys for playing notes
local _keyboardKeys = { q = 0, w = 2, e = 4, r = 5, t = 7, y = 9, u = 11, i = 12, o = 14, p = 16 }
-- local routines
local function _getMidiEvents()
local midiEvents = _midiInput:getEvents()
local currentTime = love.timer.getTime()
for _, midiEvent in ipairs(midiEvents) do
local status, note, speed = table.unpack(midiEvent.info)
local noteStatus = math.floor(status / 16)
if noteStatus == MidiSignals.NOTE_ON then
_midiState:playNote(note, speed, currentTime)
elseif noteStatus == MidiSignals.NOTE_OFF then
_midiState:stopNote(note, speed, currentTime)
end
end
end
local function _supplyBuffersToStream()
local currentTime = love.timer.getTime()
local nextBuffers = _midiState:generateSamples(currentTime)
if _streamingAudio:getFreeBufferCount() > 0 then
_waveData = {}
for _, soundData in ipairs(nextBuffers) do
-- Length is in BYTES, better let LÖVE calculate it automatically
_streamingAudio:queue(soundData)
if #_waveData < 4 then
table.insert(_waveData, soundData)
end
end
if not _streamingAudio:isPlaying() then
_streamingAudio:play()
end
end
end
-- local rendering routines
local function _renderText(graphics)
graphics.printf(string.format("FPS %.2f", love.timer.getFPS()), 12, 12, 256)
graphics.printf(string.format("FREE BUFFER COUNT: %d", _streamingAudio:getFreeBufferCount()),
12, 36, 256)
end
local function _renderWave(graphics)
local windowWidth, windowHeight = love.window.getMode()
local y = windowHeight / 2
local left = 0
local right = windowWidth
local waveWidth = right - left
local lineWidth = math.ceil(waveWidth / _waveDepth)
graphics.setLineWidth(2)
local points = {}
local sampleCount = #_waveData * Consts.BUFFER_SIZE
for bufferIndex, soundData in ipairs(_waveData) do
local sampleOffset = (bufferIndex - 1) * Consts.BUFFER_SIZE
for i = 0, Consts.BUFFER_SIZE - 1 do
local x = waveWidth * (sampleOffset + i) / sampleCount
local sampleValue = soundData:getSample(i)
table.insert(points, x + left)
table.insert(points, y + sampleValue * _waveHeight)
x = x + 1
end
end
return #points > 1 and graphics.line(points)
end
local function _render(graphics)
graphics.clear(0.2, 0.2, 0.2)
graphics.setColor(1, 1, 1)
_renderWave(graphics)
_renderText(graphics)
end
-- main love callbacks
function love.load()
-- initialization
_userConfig = Persistence:new("userconfig")
_timeController = TimeController:new(Consts.FPS)
_midiInput = MidiInput:new()
_midiState = MidiState:new()
_streamingAudio = love.audio.newQueueableSource(Consts.SAMPLE_RATE, 16, 1, 64)
end
local _count = 0
function love.update(dt)
_timeController:startFrame()
_count = _count + 1
if _count > Consts.FPS then
_count = 0
collectgarbage()
end
_getMidiEvents()
_supplyBuffersToStream()
_midiState:cleanMuteNotes()
end
function love.draw()
_render(love.graphics)
_timeController:endFrame()
end
function love.keypressed(key)
if key == "f8" then
love.event.quit()
end
if key == "f2" then
_timeController:reportAll()
end
if key == "f5" then
love.quit(true)
love.load()
end
if _keyboardKeys[key] then
_midiState:playNote(60 + _keyboardKeys[key], 0x40, love.timer.getTime())
end
end
function love.keyreleased(key)
if _keyboardKeys[key] then
_midiState:stopNote(60 + _keyboardKeys[key], 0x40, love.timer.getTime())
end
end
function love.quit(confirm)
_timeController:reportAll()
_userConfig:save()
_midiInput:destroy()
collectgarbage()
return confirm
end
|
-- include useful files
u_execScript("utils.lua")
u_execScript("common.lua")
u_execScript("commonpatterns.lua")
u_execScript("nextpatterns.lua")
u_execScript("evolutionpatterns.lua")
u_execScript("ctpatterns.lua")
math.random()
-- this function adds a pattern to the timeline based on a key
function addPattern(mKey)
if mKey == 0 then wallHMCurve(getRandomSide(), 1.0)
elseif mKey == 1 then cWall(getRandomSide())
end
end
-- shuffle the keys, and then call them to add all the patterns
-- shuffling is better than randomizing - it guarantees all the patterns will be called
keys = {0, 1, 1}
keys = shuffle(keys)
index = 0
swoosh = 0
-- onInit is an hardcoded function that is called when the level is first loaded
function onInit()
l_setSpeedMult(1.4)
l_setSpeedInc(0.05)
l_setRotationSpeed(0.1)
l_setRotationSpeedMax(0.2)
l_setRotationSpeedInc(0.0)
l_setDelayMult(1.0)
l_setDelayInc(0.00)
l_setFastSpin(50.0)
l_setSides(12)
l_setSidesMin(12)
l_setSidesMax(12)
l_setIncTime(10)
l_setPulseMin(70)
l_setPulseMax(120)
l_setPulseSpeed(2.2)
l_setPulseSpeedR(1)
l_setPulseDelayMax(12.9)
l_setBeatPulseMax(17)
l_setBeatPulseDelayMax(24.8)
l_setSwapEnabled(false)
l_setRadiusMin(30)
l_setWallSkewLeft(10)
l_setWallSkewRight(10)
size = 30
end
-- onLoad is an hardcoded function that is called when the level is started/restarted
function onLoad()
end
-- onStep is an hardcoded function that is called when the level timeline is empty
-- onStep should contain your pattern spawning logic
function onStep()
addPattern(keys[index])
index = index + 1
if index - 1 == #keys then
index = 0
end
t_wait(15)
end
-- onIncrement is an hardcoded function that is called when the level difficulty is incremented
function onIncrement()
size = size + 50
if size >= 330 then size = 330 end
l_setRadiusMin(size)
t_wait(5)
end
-- onUnload is an hardcoded function that is called when the level is closed/restarted
function onUnload()
end
-- onUpdate is an hardcoded function that is called every frame
function onUpdate(mFrameTime)
end |
require 'spec_helper'
describe["_.range"] = function()
describe["when only passing a length"] = function()
it["should iterate from 1 to the length"] = function()
result = _.range(3):to_array()
expect(result).should_equal {1,2,3}
end
end
describe["when only passing a start and end value"] = function()
it["should iterate from start to the end inclusively"] = function()
result = _.range(2,4):to_array()
expect(result).should_equal {2,3,4}
end
end
describe["when passing a start and end value and a step"] = function()
describe["when step is positive"] = function()
it["should iterate from start to the end inclusively incremented by step"] = function()
result = _.range(2,6,2):to_array()
expect(result).should_equal {2,4,6}
end
end
describe["when step is negative"] = function()
it["should iterate from start to the end inclusively decremented by step"] = function()
result = _.range(6,2,-2):to_array()
expect(result).should_equal {6,4,2}
end
end
end
end
spec:report(true)
|
---
--- Generated by MLN Team (http://www.immomo.com)
--- Created by MLN Team.
--- DateTime: 2019-09-05 12:05
---
local _class = {
_name = "DiscoverCell",
_version = "1.0"
}
---@public
function _class:new()
local o = {}
setmetatable(o, { __index = self })
return o
end
---@public
function _class:setupCellSubviews(width)
self.baseLayout = LinearLayout(LinearType.VERTICAL)
self.baseLayout:width(width):height(MeasurementType.MATCH_PARENT)
--图片
local imageView = ImageView():width(width):height(width)
imageView:contentMode(ContentMode.SCALE_ASPECT_FIT)
imageView:lazyLoad(false)
--imageView:addCornerMask(8,ColorConstants.White,RectCorner.ALL_CORNERS)
self.imageView = imageView
--布局图片上的小图标
local imageViewLayout = LinearLayout(LinearType.HORIZONTAL)
imageViewLayout:marginTop(-30):width(width):height(25):setGravity(Gravity.CENTER)
self.imageViewLayout = imageViewLayout
--标题
local titleLabel = Label()
titleLabel:marginTop(5):width(width):height(30)
titleLabel:textColor(ColorConstants.Black):fontSize(14):setTextFontStyle(FontStyle.BOLD)
self.titleLabel = titleLabel
--更新内容提示
local iconHeight = 15
local updateLayout = LinearLayout(LinearType.HORIZONTAL)
updateLayout:width(width):height(iconHeight)
local imagesLayout = View():width(MeasurementType.WRAP_CONTENT):height(iconHeight)
self.updateLayout = updateLayout
self.iconViews = {}
local iconView1 = ImageView()
iconView1:width(iconHeight):height(iconHeight)
:gone(true):lazyLoad(false):addCornerMask(iconHeight / 2, ColorConstants.White, RectCorner.ALL_CORNERS)
table.insert(self.iconViews, iconView1)
imagesLayout:addView(iconView1)
local iconView2 = ImageView()
iconView2:marginLeft(5):width(iconHeight):height(iconHeight)
:gone(true):lazyLoad(false)
table.insert(self.iconViews, iconView2)
imagesLayout:addView(iconView2)
local iconView3 = ImageView()
iconView3:marginLeft(10):width(iconHeight):height(iconHeight)
:gone(true):lazyLoad(false)
table.insert(self.iconViews, iconView3)
imagesLayout:addView(iconView3)
local iconLabel = Label()
iconLabel:marginLeft(5):width(MeasurementType.WRAP_CONTENT):height(iconHeight):fontSize(11)
self.iconLabel = iconLabel
updateLayout:addView(imagesLayout)
updateLayout:addView(iconLabel)
--添加显示
self.baseLayout:addView(imageView):addView(imageViewLayout):addView(titleLabel):addView(updateLayout)
end
---@public
---@param count string
function _class:updateContentCountText(count)
if not count then
return
end
self.iconLabel:text(string.format("更新了%s篇内容", count))
end
---@public
---@vararg string 图标urlString
function _class:updateContentIcons(url)
local iconView = self.iconViews[1]
if url then
iconView:gone(false)
iconView:image(url)
else
iconView:gone(true)
end
end
return _class |
local msg = "Hello, world!"
return msg
|
local widget = require("widget")
local json = require("json")
local competitionHistory = {}
local properties = {}
local getCompetitionHistoryList, downloadPhotos, renderSlider, buttonTouchHandlers
local showBlur, closeBlur, changeText, scrollView
function competitionHistory:render(params)
local background = display.newImage( "images/mainBackGround.jpg")
background.x = backgroundX
background.y = backgroundY
table.insert(properties, background)
local pageTitleBackground = display.newImage("images/titleBackGround.png")
pageTitleBackground.x = pageTitleBackgroundX
pageTitleBackground.y = pageTitleBackgroundY
table.insert(properties, pageTitleBackground)
local pageTitle = display.newText(texts.home.pageTitle, pageTitleX, pageTitleY, fonts.lalezar, fonts.pageTitleSize)
table.insert(properties, pageTitle)
local cheetah = display.newImage("images/cheetah.png")
cheetah.x = cheetahX
cheetah.y = cheetahY
table.insert(properties, cheetah)
local backButton = display.newImageRect( "images/back.png", 125, 125)
backButton.x = backButtonX
backButton.y = backButtonY
backButton.name = "back"
table.insert(properties, backButton)
local picture = display.newImageRect( "images/pic.png", 132, 152)
picture.x = display.contentCenterX - 480
picture.y = display.contentHeight - 680
picture.name = "picture"
table.insert(properties, picture)
local pictureInner = display.newImage(appConfig:getAvatarAddress())
pictureInner.x = picture.x
pictureInner.y = picture.y
pictureInner.width = picture.width * .9
pictureInner.height = picture.height * .9
table.insert(properties, pictureInner)
picture:addEventListener("touch", buttonTouchHandlers)
backButton:addEventListener("touch", buttonTouchHandlers)
getCompetitionHistoryList()
renderSoundButton()
end
------------------------------------------------------------------------------
-- Functions
------------------------------------------------------------------------------
renderSlider = function(photoList)
closeBlur()
scrollView = widget.newScrollView
{
width = 900,
height = 320,
verticalScrollDisabled = true,
hideBackground = true
}
scrollView.x = display.contentCenterX
scrollView.y = display.contentCenterY
local currentX = 193
local width = 340
local height = 300
local y = 100
local margin = 15
for i = 1, #photoList do
images[i] = display.newRect(currentX, y, width, height)
images[i]:setStrokeColor(58 / 255, 202 / 255, 190 / 255)
local paint = {
type = "image",
filename = photoList[i].main,
baseDir = photoList[i].baseDir
}
images[i].fill = paint
print(photoList[i].status)
local options = {
text = photoList[i].status,
width = images[i].width,
height = 50,
font = fonts.lalezar,
fontSize = 30,
x = images[i].x,
y = images[i].y + images[i].height / 2 + 40,
align = "center"
}
images[i].text = display.newText(options)
images[i].text:setFillColor(80 / 255, 80 / 255, 80 / 255, 1)
currentX = currentX + images[i].width + margin
scrollView:insert(images[i])
scrollView:insert(images[i].text)
end
end
------------------------------------------------------------------------------
------------------------------------------------------------------------------
showTextOnBlur = function(newText)
if text then
display.remove(text)
text = nil
end
text = display.newText({
text = newText,
x = centerX,
y = centerY,
font = fonts.lalezar,
fontSize = 46,
})
text:setFillColor(1, 1, 1, 1)
end
------------------------------------------------------------------------------
------------------------------------------------------------------------------
closeBlur = function()
local function removeGroup(cb1)
display.remove(text)
display.remove(blur)
blur = nil
text = nil
end
transition.to(blur, { alpha = 0, onComplete = removeGroup})
return true
end
------------------------------------------------------------------------------
------------------------------------------------------------------------------
showBlur = function()
if blur then
return
end
blur = display.captureScreen()
blur.x, blur.y = centerX, centerY
blur:setFillColor(.1, .1, .1)
blur.fill.effect = "filter.blur"
blur.alpha = 0
transition.to(blur, {alpha = 1})
blur:addEventListener("tap", function() return true end)
blur:addEventListener("touch", function() return true end)
end
------------------------------------------------------------------------------
------------------------------------------------------------------------------
getCompetitionHistoryList = function()
local function networkListener( event )
if event.status == 200 then
downloadPhotos(json.decode(event.response))
elseif event.status == 204 then
showTextOnBlur(texts.competitionHistory.noHistory)
timer.performWithDelay( 1500, closeBlur )
else
showTextOnBlur(texts.competitionHistory.problemInDownloadingCompetition)
timer.performWithDelay( 1500, closeBlur )
end
end
local parent = appConfig:getParent()
local headers = {}
headers["Content-Type"] = "application/json"
headers["user_code"] = parent.user_code
local params = {}
params.headers = headers
showBlur()
showTextOnBlur(texts.competitionHistory.pleaseWait)
network.request( urls.getCompetitionHistoryList, "GET", networkListener, params )
end
------------------------------------------------------------------------------
------------------------------------------------------------------------------
downloadPhotos = function(photoList)
local photos = {}
local allFilesDownloaded = false
local problemFound = false
----------------------------------------------------
local function checkForFile()
local finishFlag = true
for i = 1, #photos do
if not photos[i].isDownloaded then
finishFlag = false
end
end
if finishFlag then
closeBlur()
print("all files are downloaded")
renderSlider(photos)
end
end
----------------------------------------------------
local function networkListener( event, id )
if problemFound then
return
end
if event.status == 200 then
for i = 1, #photos do
if photos[i].id == id then
photos[i].isDownloaded = true
end
end
checkForFile()
else
showTextOnBlur(texts.competitionHistory.problemInDownloadingCompetition)
timer.performWithDelay( 1500, closeBlur )
problemFound = true
end
end
local pictureList = photoList
for i = 1, #pictureList do
local tempObject = {}
tempObject["id"] = pictureList[i].id
tempObject["isDownloaded"] = false
if pictureList[i].conditionType == nil then
pictureList[i].conditionType = 0
end
local lastStatus = "status"..pictureList[i].conditionType
tempObject["status"] = texts.statusPaint[lastStatus]
tempObject["main"] = "getCompetitionHistoryList"..pictureList[i].id..".png"
tempObject["baseDir"] = system.TemporaryDirectory
table.insert(photos, tempObject)
local params = {}
params.timeout = 15
network.download(
pictureList[i]["url"],
"GET",
function(event)
networkListener(event, pictureList[i].id)
end,
params,
"getCompetitionHistoryList"..pictureList[i].id..".png",
system.TemporaryDirectory
)
end
end
------------------------------------------------------------------------------
-- Event Handler
------------------------------------------------------------------------------
buttonTouchHandlers = function(event)
if event.phase == "began" then
audio.stop(clickSoundCannel)
audio.play(clickSound, clickPlayOptions)
event.target.width = event.target.width * clickResizeFactor
event.target.height = event.target.height * clickResizeFactor
if event.target.name == "picture" then
pictureInner.width = pictureInner.width * clickResizeFactor
pictureInner.height = pictureInner.height * clickResizeFactor
end
display.getCurrentStage():setFocus( event.target )
event.target.isFocus = true
end
if not event.target.isFocus then
return false
end
if event.phase == "ended" then
event.target.width = event.target.width / clickResizeFactor
event.target.height = event.target.height / clickResizeFactor
if event.target.name == "picture" then
pictureInner.width = pictureInner.width / clickResizeFactor
pictureInner.height = pictureInner.height / clickResizeFactor
navigate("users")
elseif event.target.name == "back" then
back()
end
event.target.isFocus = false
display.getCurrentStage():setFocus(nil)
end
end
function competitionHistory:close()
closeSoundButton()
if #properties > 0 then
for n = #properties, 1, - 1 do
display.remove(properties[n])
properties[n] = nil
end
end
display.remove(scrollView)
scrollView = nil
end
return competitionHistory
|
--[[
© CloudSixteen.com do not share, re-distribute or modify
without permission of its author ([email protected]).
--]]
local ITEM = Clockwork.item:New("weapon_base");
ITEM.name = "ItemMP7";
ITEM.cost = 200;
ITEM.model = "models/weapons/w_smg1.mdl";
ITEM.weight = 2.5;
ITEM.access = "V";
ITEM.classes = {CLASS_EMP, CLASS_EOW};
ITEM.uniqueID = "weapon_smg1";
ITEM.business = true;
ITEM.description = "ItemMP7Desc";
ITEM.isAttachment = true;
ITEM.hasFlashlight = true;
ITEM.loweredOrigin = Vector(3, 0, -4);
ITEM.loweredAngles = Angle(0, 45, 0);
ITEM.attachmentBone = "ValveBiped.Bip01_Spine";
ITEM.attachmentOffsetAngles = Angle(0, 0, 0);
ITEM.attachmentOffsetVector = Vector(-2, 5, 4);
ITEM:Register(); |
-- SpriteSheet constants
SNAKE_HEAD_UP = 1
SNAKE_HEAD_RIGHT = 2
SNAKE_HEAD_DOWN = 3
SNAKE_HEAD_LEFT = 4
SNAKE_TAIL_DOWN = 5
SNAKE_TAIL_LEFT = 6
SNAKE_TAIL_UP = 7
SNAKE_TAIL_RIGHT = 8
SNAKE_TURN_1 = 11
SNAKE_TURN_2 = 12
SNAKE_TURN_3 = 9
SNAKE_TURN_4 = 10
SNAKE_BODY_VERTICAL = 13
SNAKE_BODY_HORIZONTAL = 14
TILE_RABBIT = 15
TILE_EMPTY = 16
-- takes a texture, width, and height of tiles and splits it into quads
-- that can be individually drawn
function generateQuads(atlas, tilewidth, tileheight)
local sheetWidth = atlas:getWidth() / tilewidth
local sheetHeight = atlas:getHeight() / tileheight
local sheetCounter = 1
local quads = {}
for y = 0, sheetHeight - 1 do
for x = 0, sheetWidth - 1 do
-- this quad represents a square cutout of our atlas that we can
-- individually draw instead of the whole atlas
quads[sheetCounter] =
love.graphics.newQuad(x * tilewidth, y * tileheight, tilewidth,
tileheight, atlas:getDimensions())
sheetCounter = sheetCounter + 1
end
end
return quads
end
|
local parent, ns = ...
local Compat = ns.Compat
local error = error
local format = string.format
local max = math.max
local next = next
local setmetatable = setmetatable
local tinsert = table.insert
local tremove = table.remove
local type = type
local C_Timer = {}
local TickerPrototype = {}
local TickerMetatable = {__index = TickerPrototype}
local WaitTable = {}
local new, del
do
local timerPool = {cache = {}, trash = {}}
setmetatable(timerPool.cache, {__mode = "v"})
function new()
return tremove(timerPool.cache) or {}
end
function del(t)
if t then
setmetatable(t, nil)
for k, _ in pairs(t) do
t[k] = nil
end
t[true] = true
t[true] = nil
tinsert(timerPool.cache, 1, t)
-- 20 recyclable timers should be enough.
while #timerPool.cache > 20 do
tinsert(timerPool.trash, 1, tremove(timerPool.cache))
end
end
end
end
local function WaitFunc(self, elapsed)
local total = #WaitTable
local i = 1
while i <= total do
local ticker = WaitTable[i]
if ticker._cancelled then
del(tremove(WaitTable, i))
total = total - 1
elseif ticker._delay > elapsed then
ticker._delay = ticker._delay - elapsed
i = i + 1
else
ticker._callback(ticker)
if ticker._iterations == -1 then
ticker._delay = ticker._duration
i = i + 1
elseif ticker._iterations > 1 then
ticker._iterations = ticker._iterations - 1
ticker._delay = ticker._duration
i = i + 1
elseif ticker._iterations == 1 then
del(tremove(WaitTable, i))
total = total - 1
end
end
end
if #WaitTable == 0 then
self:Hide()
end
end
local WaitFrame = _G[parent .. "_WaitFrame"] or CreateFrame("Frame", parent .. "_WaitFrame", UIParent)
WaitFrame:SetScript("OnUpdate", WaitFunc)
local function AddDelayedCall(ticker, oldTicker)
ticker = (oldTicker and type(oldTicker) == "table") and oldTicker or ticker
tinsert(WaitTable, ticker)
WaitFrame:Show()
end
local function ValidateArguments(duration, callback, callFunc)
if type(duration) ~= "number" then
error(format(
"Bad argument #1 to '" .. callFunc .. "' (number expected, got %s)",
duration ~= nil and type(duration) or "no value"
), 2)
elseif type(callback) ~= "function" then
error(format(
"Bad argument #2 to '" .. callFunc .. "' (function expected, got %s)",
callback ~= nil and type(callback) or "no value"
), 2)
end
end
function C_Timer.After(duration, callback)
ValidateArguments(duration, callback, "After")
local ticker = new()
ticker._iterations = 1
ticker._delay = max(0.01, duration)
ticker._callback = callback
AddDelayedCall(ticker)
end
local function CreateTicker(duration, callback, iterations)
local ticker = new()
setmetatable(ticker, TickerMetatable)
ticker._iterations = iterations or -1
ticker._delay = max(0.01, duration)
ticker._duration = ticker._delay
ticker._callback = callback
AddDelayedCall(ticker)
return ticker
end
function C_Timer.NewTicker(duration, callback, iterations)
ValidateArguments(duration, callback, "NewTicker")
return CreateTicker(duration, callback, iterations)
end
function C_Timer.NewTimer(duration, callback)
ValidateArguments(duration, callback, "NewTimer")
return CreateTicker(duration, callback, 1)
end
function C_Timer.CancelTimer(ticker)
if ticker and ticker.Cancel then
ticker:Cancel()
end
return nil
end
function TickerPrototype:Cancel()
self._cancelled = true
end
function TickerPrototype:IsCancelled()
return self._cancelled
end
Compat.C_Timer = C_Timer |
require('kanagawa').setup({
commentStyle = "NONE",
keywordStyle = "bold",
statementStyle = "bold",
variablebuiltinStyle = "bold",
specialReturn = false,
specialException = false,
})
vim.cmd [[colorscheme kanagawa]]
|
vehicleUpgrades = { names = { }, prices = { } }
function loadItems( )
local file_root = xmlLoadFile( "moditems.xml" )
local sub_node = xmlFindChild( file_root, "item", 0 )
local i = 1
while sub_node do
vehicleUpgrades.names[ i ] = xmlNodeGetAttribute( sub_node, "name" )
vehicleUpgrades.prices[ i ] = xmlNodeGetAttribute( sub_node, "price" )
sub_node = xmlFindChild( file_root, "item", i )
i = i + 1
end
end
|
local KUI, E, L, V, P, G = unpack(select(2, ...))
local KS = KUI:GetModule("KuiSkins")
local S = E:GetModule("Skins")
-- Cache global variables
-- Lua functions
local _G = _G
-- WoW API
-- Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS:
local function styleInspect()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.inspect ~= true or E.private.KlixUI.skins.blizzard.inspect ~= true then return end
InspectModelFrame:DisableDrawLayer("OVERLAY")
InspectPaperDollFrame:Styling()
InspectTalentFrame:GetRegions():Hide()
select(2, InspectTalentFrame:GetRegions()):Hide()
InspectGuildFrameBG:Hide()
if InspectModelFrame.backdrop then
InspectModelFrame.backdrop:Hide()
end
for i = 1, 5 do
select(i, InspectModelFrame:GetRegions()):Hide()
end
KS:Reskin(InspectPaperDollFrame.ViewButton)
InspectPaperDollFrame.ViewButton:ClearAllPoints()
InspectPaperDollFrame.ViewButton:SetPoint("TOP", InspectFrame, 0, -45)
-- Character
select(11, InspectMainHandSlot:GetRegions()):Hide()
local slots = {
"Head", "Neck", "Shoulder", "Shirt", "Chest", "Waist", "Legs", "Feet", "Wrist",
"Hands", "Finger0", "Finger1", "Trinket0", "Trinket1", "Back", "MainHand",
"SecondaryHand", "Tabard",
}
for i = 1, #slots do
local slot = _G["Inspect"..slots[i].."Slot"]
local border = slot.IconBorder
_G["Inspect"..slots[i].."SlotFrame"]:Hide()
slot:SetNormalTexture("")
slot:SetPushedTexture("")
slot.icon:SetTexCoord(unpack(E.TexCoords))
border:SetDrawLayer("BACKGROUND")
end
hooksecurefunc("InspectPaperDollItemSlotButton_Update", function(button)
button.IconBorder:SetTexture(E["media"].normTex)
button.icon:SetShown(button.hasItem)
end)
-- Talents
local inspectSpec = InspectTalentFrame.InspectSpec
inspectSpec.ring:Hide()
for i = 1, 7 do
local row = InspectTalentFrame.InspectTalents["tier"..i]
for j = 1, 3 do
local bu = row["talent"..j]
bu.Slot:Hide()
bu.border:SetTexture("")
bu.icon:SetDrawLayer("ARTWORK")
bu.icon:SetTexCoord(unpack(E.TexCoords))
KS:CreateBG(bu.icon)
end
end
inspectSpec.specIcon:SetTexCoord(unpack(E.TexCoords))
KS:CreateBG(inspectSpec.specIcon)
local function updateIcon(self)
local spec = nil
if INSPECTED_UNIT ~= nil then
spec = GetInspectSpecialization(INSPECTED_UNIT)
end
if spec ~= nil and spec > 0 then
local role1 = GetSpecializationRoleByID(spec)
if role1 ~= nil then
local _, _, _, icon = GetSpecializationInfoByID(spec)
self.specIcon:SetTexture(icon)
end
end
end
inspectSpec:HookScript("OnShow", updateIcon)
InspectTalentFrame:HookScript("OnEvent", function(self, event, unit)
if not InspectFrame:IsShown() then return end
if event == "INSPECT_READY" and InspectFrame.unit and UnitGUID(InspectFrame.unit) == unit then
updateIcon(self.InspectSpec)
end
end)
local roleIcon = inspectSpec.roleIcon
roleIcon:SetTexture(E["media"].roleIcons)
local bg = KS:CreateBDFrame(roleIcon, 1)
bg:SetPoint("TOPLEFT", roleIcon, 2, -1)
bg:SetPoint("BOTTOMRIGHT", roleIcon, -1, 2)
for i = 1, 4 do
local tab = _G["InspectFrameTab"..i]
KS:ReskinTab(tab)
if i ~= 1 then
tab:SetPoint("LEFT", _G["InspectFrameTab"..i-1], "RIGHT", -15, 0)
end
end
end
S:AddCallbackForAddon("Blizzard_InspectUI", "KuiInspect", styleInspect) |
---@class Equip_Equip
local Equip_Equip = DClass("Equip_Equip", BaseComponent)
_G.Equip_Equip = Equip_Equip
function Equip_Equip:ctor()
self.messager = Messager.new(self)
end
function Equip_Equip:addListener()
self.messager:addListener(Msg.EQUIP_CHANGEPLACE_PLACE, self.onClickPlace)
self.messager:addListener(Msg.EQUIP_UPDATE_EQUIPDATAS, self.updateAllEquipedEquips)
end
function Equip_Equip:onDispose()
self.messager:dispose()
end
function Equip_Equip:onStart()
self:addListener()
self.curSelectPlace = 0
self.listPlacesData = {}
self:onInit()
end
function Equip_Equip:onInit()
self:addEventHandler(self.nodes.btnDischarge.onClick, self.onDischargeClick)
self:addEventHandler(self.nodes.btnPlan.onClick, self.onPlanClick)
self:addEventHandler(self.nodes.btnDetails.onClick, self.onOpenDetails)
self:refreshSelectHero()
self:initPlaces()
self:onInitUI()
end
function Equip_Equip:onOpenDetails()
UIManager.openWindow("EquipInfoPopupWindow", nil, Equip_PopupDetail.TYPESHOW.SUITDETAILS, nil)
end
function Equip_Equip:initPlaces()
self.equipedEquips = EquipMgr:getEquipingEquips()
for i = 1, 5 do
self:setEquipEquip(i)
end
end
function Equip_Equip:onDischargeClick()
local data = {}
data.title = ""
data.content = Lang(GL_Equip_Equip_QueRenXieSuoYou) --"确认卸下所有当前装备质点吗?"
data.buttonNames = {Lang(51030031),Lang(51030030)}--{"取消", "确认"}
data.buttonTypes = {1, 2}
data.callback = function(sort)
if sort == 2 then
EquipMgr:sendPutDownAllEquips(EquipMgr:getCurSelectHero().id) -- 发送卸下所有装备
end
end
MsgCenter.sendMessage(Msg.NOTIFY, data)
end
function Equip_Equip:onPlanClick()
UIManager.openWindow("EquipSuitWindow")
end
function Equip_Equip:refreshSelectHero()
local cfg = Config.Hero[EquipMgr:getCurSelectHero().id]
local model_info = EquipMgr:getCurSelectHero().config.model_info
self.nodes.model:LoadModel("Model/Angle/" .. cfg.weapon_model, model_info.height)
end
function Equip_Equip:onInitUI()
end
---设置装备的质点信息
function Equip_Equip:setEquipEquip(place)
local nameNode = string.format("place%d", place)
local nodePlace = self.nodes[nameNode]
local nodeShow = nodePlace.transform:Find("NodeShow")
local nodeEquip = nodePlace.transform:Find("NodeEquip")
local btnAdd = nodePlace.transform:Find("Button_Add"):GetComponent(typeof(Button))
local select = btnAdd.transform:Find("Image_Select")
local nodeEquipInfo = nodeEquip.transform:Find("EquipInfoCell")
select.gameObject:SetActive(place == self.curSelectPlace)
self:addEventHandler(
btnAdd.onClick,
function()
local data = {}
self:onClickPlace(place, true)
end
)
local cpt_place = self:createComponent(nodeEquipInfo.gameObject, Equip_EquipedCell)
cpt_place:onUpdateUI(self.equipedEquips[place])
local item = {}
item.place = place
item.select = select
item.cpt = cpt_place
self.listPlacesData[place] = item
end
---点击装备质点框
function Equip_Equip:onClickPlace(place, isClickEquip)
if not isClickEquip then
if self.curSelectPlace == place then
return
end
end
self.curSelectPlace = place
for index, value in ipairs(self.listPlacesData) do
value.select.gameObject:SetActive(value.place == place)
end
MsgCenter.sendMessage(Msg.EQUIP_CHANGEPLACE_PLACE, place)
self.equipedEquips = EquipMgr:getEquipingEquips()
if isClickEquip and self.equipedEquips[place] then
local data = self.equipedEquips[place]
if data then
UIManager.openWindow("EquipInfoPopupWindow", nil, Equip_PopupDetail.TYPESHOW.DISCHARGE, data)
end
end
end
---刷新卸下按钮状态
function Equip_Equip:onUpdateDischargeBtn()
self.equipedEquips = EquipMgr:getEquipingEquips()
if self.equipedEquips[self.curSelectPlace] then
self.nodes.btnDischarge.gameObject:SetActive(true)
else
self.nodes.btnDischarge.gameObject:SetActive(false)
end
end
---装备的质点数据更改 刷新装备的UI
function Equip_Equip:updateAllEquipedEquips()
local equipedEquipDatas = EquipMgr:getEquipingEquips()
for i = 1, 5 do
self.listPlacesData[i].cpt:onUpdateUI(equipedEquipDatas[i])
end
end
|
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ==========
PlaceObj('XTemplate', {
group = "Infopanel Sections",
id = "customShuttleHub",
PlaceObj('XTemplateGroup', {
'__context_of_kind', "ShuttleHub",
}, {
PlaceObj('XTemplateTemplate', {
'comment', "make shuttles",
'__template', "InfopanelButton",
'RolloverTitle', T{821612835210, --[[XTemplate customShuttleHub RolloverTitle]] "Construct a Shuttle"},
'RolloverHint', T{860716957818, --[[XTemplate customShuttleHub RolloverHint]] "<left_click> Construct a new Shuttle<newline><right_click> Cancel a Shuttle construction"},
'RolloverHintGamepad', T{655064239120, --[[XTemplate customShuttleHub RolloverHintGamepad]] "<ButtonA> Construct a new Shuttle<newline><ButtonX> Cancel a Shuttle construction"},
'OnContextUpdate', function (self, context, ...)
local can_construct = context.max_shuttles - (#context.shuttle_infos + context.queued_shuttles_for_construction) > 0
if can_construct then
self:SetRolloverText(T{324514950847, "The construction of a new Shuttle costs:<newline><SingleShuttleCostStr>"})
else
self:SetRolloverText(T{174054841334, "No more shuttles can be constructed."})
end
end,
'OnPressParam', "QueueConstructShuttle",
'AltPress', true,
'Icon', "UI/Icons/IPButtons/shuttle.tga",
}),
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelSection",
'OnContextUpdate', function (self, context, ...)
self:SetVisible(context.queued_shuttles_for_construction ~= 0)
end,
'Title', T{726161435938, --[[XTemplate customShuttleHub Title]] "Shuttle construction<right><queued_shuttles_for_construction>"},
'Icon', "UI/Icons/Sections/shuttle_2.tga",
'TitleHAlign', "stretch",
}, {
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelProgress",
'BindTo', "ShuttleConstructionProgress",
}),
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelText",
'Text', T{106779987443, --[[XTemplate customShuttleHub Text]] "<ShuttleConstructionCostsStr>"},
}),
}),
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelSection",
'RolloverText', T{8723, --[[XTemplate customShuttleHub RolloverText]] "<UIRolloverText>"},
'RolloverTitle', T{933065747298, --[[XTemplate customShuttleHub RolloverTitle]] "Shuttles"},
'Title', T{766548374853, --[[XTemplate customShuttleHub Title]] "Shuttles<right><count(shuttle_infos)>/<max_shuttles>"},
'Icon', "UI/Icons/Sections/shuttle_1.tga",
}, {
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelText",
'Text', T{398, --[[XTemplate customShuttleHub Text]] "In flight<right><FlyingShuttles>"},
}),
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelText",
'Text', T{8700, --[[XTemplate customShuttleHub Text]] "Refueling<right><RefuelingShuttles>"},
}),
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelText",
'Text', T{717110331584, --[[XTemplate customShuttleHub Text]] "Idle<right><IdleShuttles>"},
}),
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelText",
'Text', T{8701, --[[XTemplate customShuttleHub Text]] "Global load <right><GlobalLoadText>"},
}),
}),
}),
})
|
-- Licensed to the public under the GNU General Public License v3.
local m, s, o
local shadowsocksr = "shadowsocksr"
local uci = luci.model.uci.cursor()
local server_count = 0
uci:foreach("shadowsocksr", "servers", function(s)
server_count = server_count + 1
end)
local fs = require "nixio.fs"
local sys = require "luci.sys"
m = Map(shadowsocksr, translate("Servers subscription and manage"))
-- Server Subscribe
s = m:section(TypedSection, "server_subscribe")
s.anonymous = true
o = s:option(Flag, "auto_update", translate("Auto Update"))
o.rmempty = false
o.description = translate("Auto Update Server subscription, GFW list and CHN route")
o = s:option(ListValue, "auto_update_time", translate("Update time (every day)"))
for t = 0,23 do
o:value(t, t..":00")
end
o.default=2
o.rmempty = false
o = s:option(DynamicList, "subscribe_url", translate("Subscribe URL"))
o.rmempty = true
o = s:option(Button,"update_Sub",translate("Update Subscribe List"))
o.inputstyle = "reload"
o.description = translate("Update subscribe url list first")
o.write = function()
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
end
o = s:option(Flag, "proxy", translate("Through proxy update"))
o.rmempty = false
o.description = translate("Through proxy update list, Not Recommended ")
o = s:option(Button,"update",translate("Update All Subscribe Severs"))
o.inputstyle = "apply"
o.write = function()
luci.sys.exec("bash /usr/share/shadowsocksr/subscribe.sh >>/tmp/ssrplus.log 2>&1")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
end
o = s:option(Button,"delete",translate("Delete all severs"))
o.inputstyle = "reset"
o.description = string.format(translate("Server Count") .. ": %d", server_count)
o.write = function()
uci:delete_all("shadowsocksr", "servers", function(s) return true end)
uci:save("shadowsocksr")
luci.sys.call("uci commit shadowsocksr && /etc/init.d/shadowsocksr stop")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
return
end
-- [[ Servers Manage ]]--
s = m:section(TypedSection, "servers")
s.anonymous = true
s.addremove = false
s.sortable = false
s.template = "cbi/tblsection"
-- s.extedit = luci.dispatcher.build_url("admin/services/shadowsocksr/servers/%s")
function s.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(s.extedit % sid)
return
end
end
o = s:option(DummyValue, "alias", translate("Alias"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "server", translate("Server Address"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or "?"
end
o = s:option(DummyValue, "server_port", translate("Server Port"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or "?"
end
if nixio.fs.access("/usr/bin/kcptun-client") then
o = s:option(DummyValue, "kcp_enable", translate("KcpTun"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or "?"
end
end
o = s:option(DummyValue, "switch_enable", translate("Auto Switch"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or "0"
end
o = s:option(DummyValue,"server",translate("Ping Latency"))
o.template="shadowsocksr/ping"
o.width="10%"
m:append(Template("shadowsocksr/server_list"))
return m
|
local memory = require('memory')
local bit = require('bit')
local array = memory.entities
local by_id
do
local bit_band = bit.band
by_id = function(id, min, max)
if bit_band(id, 0xFF000000) ~= 0 then
local sub_mask = bit_band(id, 0x7FF)
local index = sub_mask + (bit_band(id, 0x800) ~= 0 and 0x700 or 0)
if index < min or index > max then
return nil
end
local entity = array[index]
if entity == nil or entity.id ~= id then
return nil
end
return entity
end
for i = min, max - 1 do
local entity = array[i]
if entity ~= nil and entity.id == id then
return entity
end
end
return nil
end
end
local by_name = function(name, min, max)
for i = min, max - 1 do
local entity = array[i]
if entity ~= nil and entity.name == name then
return entity
end
end
return nil
end
local index = function(key, min, max)
if type(key) ~= 'number' or key < min or key > max - 1 then
return nil
end
local entity = array[key]
return entity ~= nil and entity or nil
end
local iterator = function(min, max)
return function(t, k)
k = k + 1
if k > max - 1 then
return nil, nil
end
local entity = t[k]
return k, entity ~= nil and entity or nil
end, array, min - 1
end
local build_table = function(min, max, t)
t = t or {}
t.by_id = function(_, id)
return by_id(id, min, max)
end
t.by_name = function(_, name)
return by_name(name, min, max)
end
return setmetatable(t, {
__index = function(_, k)
return index(k, min, max)
end,
__pairs = function(_)
return iterator(min, max)
end,
__ipairs = pairs,
__newindex = error,
__metatable = false,
})
end
return build_table(0x000, 0x900, {
npcs = build_table(0x000, 0x400),
pcs = build_table(0x400, 0x700),
allies = build_table(0x700, 0x900),
})
--[[
Copyright © 2018, Windower Dev Team
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 Windower Dev Team 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 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE WINDOWER DEV TEAM BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
|
object_tangible_loot_creature_loot_collections_aurebesh_tile_osk = object_tangible_loot_creature_loot_collections_shared_aurebesh_tile_osk:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_aurebesh_tile_osk, "object/tangible/loot/creature/loot/collections/aurebesh_tile_osk.iff")
|
local mod = DBM:NewMod(1737, "DBM-Nighthold", nil, 786)
local L = mod:GetLocalizedStrings()
mod:SetRevision(("$Revision: 17551 $"):sub(12, -3))
mod:SetCreatureID(104154)--The Demon Within (111022)
mod:SetEncounterID(1866)
mod:SetZone()
mod:SetUsedIcons(1, 2, 3, 4, 5, 6)
mod:SetHotfixNoticeRev(16172)
mod.respawnTime = 29
mod:RegisterCombat("combat")
mod:SetWipeTime(30)
mod:RegisterEventsInCombat(
"SPELL_CAST_START 206219 206220 206514 206675 206840 207938 104534 208545 209270 211152 208672 206744 206883 206221 206222 221783 211439 220957 227008 221408 221486",
"SPELL_CAST_SUCCESS 206222 206221 221783 212258 227008 221336 221486",
"SPELL_AURA_APPLIED 206219 206220 209011 206354 206384 209086 208903 211162 221891 208802 221606 221603 221785 221784 212686 227427 206516 206847 206983 206458 227009 206310",
"SPELL_AURA_APPLIED_DOSE 211162 208802",
"SPELL_AURA_REMOVED 209011 206354 206384 209086 221603 221785 221784 212686 221606 206847 206458 206310",
-- "SPELL_DAMAGE",
-- "SPELL_MISSED",
"UNIT_DIED",
"UNIT_SPELLCAST_SUCCEEDED boss1 boss2 boss3 boss4 boss5"
)
mod:RegisterEvents(
"CHAT_MSG_MONSTER_YELL"
)
--[[
(ability.id = 206219 or ability.id = 206220 or ability.id = 206514 or ability.id = 206675 or ability.id = 206840 or ability.id = 207938 or ability.id = 206883 or ability.id = 208545 or ability.id = 209270 or ability.id = 211152 or ability.id = 208672 or ability.id = 167819 or ability.id = 206939 or ability.id = 206744) and type = "begincast"
or (ability.id = 206222 or ability.id = 206221 or ability.id = 221783 or ability.id = 212258) and type = "cast"
or (ability.id = 227427 or ability.id = 206516) and type = "applybuff"
or (ability.id = 227427 or ability.id = 206516) and type = "removebuff"
--]]
local Kurazmal = DBM:EJ_GetSectionInfo(13121)
local Vethriz = DBM:EJ_GetSectionInfo(13124)
local Dzorykx = DBM:EJ_GetSectionInfo(13129)
--Stage One: The Council of Elders
----Gul'dan
local warnLiquidHellfire = mod:NewCastAnnounce(206219, 3)
----Inquisitor Vethriz
local warnGazeofVethriz = mod:NewSpellAnnounce(206840, 3)
local warnShadowblink = mod:NewSpellAnnounce(207938, 2)
----D'zorykx the Trapper
local warnSoulVortex = mod:NewTargetAnnounce(206883, 3)
local warnAnguishedSpirits = mod:NewSpellAnnounce(208545, 2)
--Stage Two: The Ritual of Aman'thul
local warnPhase2 = mod:NewPhaseAnnounce(2, 2, nil, nil, nil, nil, nil, 2)
local warnBondsofFel = mod:NewTargetAnnounce(206222, 3)
local warnEmpBondsofFel = mod:NewTargetAnnounce(209086, 4)
--Stage Three: The Master's Power
local warnPhase3Soon = mod:NewPrePhaseAnnounce(3, 2)
local warnPhase3 = mod:NewPhaseAnnounce(3, 2, nil, nil, nil, nil, nil, 2)
local warnSoulSiphon = mod:NewTargetAnnounce(221891, 3, nil, "Healer")
local warnFlamesofSargeras = mod:NewTargetAnnounce(221606, 4)
--Mythic Only
local warnParasiticWound = mod:NewTargetAnnounce(206847, 3)
local warnShadowyGaze = mod:NewTargetAnnounce(206983, 3)
local warnWounded = mod:NewSpellAnnounce(227009, 1)
--Stage One: The Council of Elders
----Gul'dan
local specWarnLiquidHellfire = mod:NewSpecialWarningDodge(206219, nil, nil, nil, 1, 2)
local specWarnFelEfflux = mod:NewSpecialWarningDodge(206514, nil, nil, nil, 1, 2)
----Fel Lord Kuraz'mal
local specWarnShatterEssence = mod:NewSpecialWarningDefensive(206675, nil, nil, nil, 3, 2)
local specWarnFelObelisk = mod:NewSpecialWarningDodge(229945, nil, nil, nil, 1, 2)
----D'zorykx the Trapper
local specWarnSoulVortex = mod:NewSpecialWarningSpell(206883, nil, nil, nil, 2, 2)
local yellSoulVortex = mod:NewYell(206883)
--Stage Two: The Ritual of Aman'thul
local specWarnBondsofFel = mod:NewSpecialWarningYou(206222, nil, nil, nil, 1, 2)
local specWarnBondsofFelTank = mod:NewSpecialWarningTaunt(206222, nil, nil, nil, 1, 2)
local yellBondsofFel = mod:NewPosYell(206222)
local specWarnHandofGuldan = mod:NewSpecialWarningSwitch(212258, "-Healer", nil, nil, 1, 2)
local specWarnEyeofGuldan = mod:NewSpecialWarningSwitchCount(209270, "Dps", nil, nil, 1, 2)
local specWarnCarrionWave = mod:NewSpecialWarningInterrupt(208672, "HasInterrupt", nil, nil, 1, 2)
--Stage Three: The Master's Power
local specWarnStormOfDestroyer = mod:NewSpecialWarningDodge(161121, nil, nil, nil, 2, 2)
local specWarnSoulCorrosion = mod:NewSpecialWarningStack(208802, nil, 5, nil, nil, 1, 6)--stack guessed
local specWarnBlackHarvest = mod:NewSpecialWarningCount(206744, nil, nil, nil, 2, 2)
local specWarnFlamesOfSargeras = mod:NewSpecialWarningMoveAway(221606, nil, nil, nil, 3, 2)
local yellFlamesofSargeras = mod:NewPosYell(221606, 15643)
local specWarnFlamesOfSargerasTank = mod:NewSpecialWarningTaunt(221606, nil, nil, nil, 1, 2)
--Mythic Only
local specWarnWilloftheDemonWithin = mod:NewSpecialWarningSpell(211439, nil, nil, nil, 1, 2)
local specWarnParasiticWound = mod:NewSpecialWarningMoveAway(206847, nil, nil, nil, 3, 2)
local yellParasiticWound = mod:NewYell(206847, 36469)
local yellParasiticWoundFades = mod:NewFadesYell(206847, 36469)
--local specWarnShearedSoul = mod:NewSpecialWarningYou(206458, nil, nil, nil, 1)
local specWarnSoulsever = mod:NewSpecialWarningCount(220957, nil, nil, nil, 3, 2)--Needs voice, but what?
local specWarnVisionsofDarkTitan = mod:NewSpecialWarningMoveTo(227008, nil, nil, nil, 3, 7)
local specWarnSummonNightorb = mod:NewSpecialWarningCount(227283, "Dps", nil, nil, 1, 2)
--Shard
local specWarnManifestAzzinoth = mod:NewSpecialWarningSwitchCount(221149, "-Healer", nil, nil, 1, 2)
local specWarnBulwarkofAzzinoth = mod:NewSpecialWarningSpell(221408, nil, nil, nil, 1)--Needs voice, but what?
local specWarnPurifiedEssence = mod:NewSpecialWarningMoveTo(221486, nil, nil, nil, 3, 7)
--Stage One: The Council of Elders
----Gul'dan
local timerRP = mod:NewRPTimer(78)
mod:AddTimerLine(SCENARIO_STAGE:format(1))
local timerLiquidHellfireCD = mod:NewNextCountTimer(25, 206219, nil, nil, nil, 3)
local timerFelEffluxCD = mod:NewCDCountTimer(10.7, 206514, nil, nil, nil, 3)--10.7-13.5 (14-15 on normal)
----Fel Lord Kuraz'mal
mod:AddTimerLine(Kurazmal)
local timerFelLordKurazCD = mod:NewCastTimer(16, "ej13121", nil, nil, nil, 1, 212258)
local timerShatterEssenceCD = mod:NewCDTimer(54, 206675, nil, "Tank", nil, 5, nil, DBM_CORE_DEADLY_ICON..DBM_CORE_TANK_ICON)
local timerFelObeliskCD = mod:NewCDTimer(16, 206841, nil, nil, nil, 3)
----Inquisitor Vethriz
mod:AddTimerLine(Vethriz)
local timerVethrizCD = mod:NewCastTimer(25, "ej13124", nil, nil, nil, 1, 212258)
local timerGazeofVethrizCD = mod:NewCDTimer(4.7, 206840, nil, nil, nil, 3)
----D'zorykx the Trapper
mod:AddTimerLine(Dzorykx)
local timerDzorykxCD = mod:NewCastTimer(35, "ej13129", nil, nil, nil, 1, 212258)
local timerSoulVortexCD = mod:NewCDTimer(21, 206883, nil, nil, nil, 3)--34-36
--Stage Two: The Ritual of Aman'thul
mod:AddTimerLine(SCENARIO_STAGE:format(2))
local timerTransition = mod:NewPhaseTimer(19)
local timerHandofGuldanCD = mod:NewNextCountTimer(58.5, 212258, nil, nil, nil, 1)
local timerBondsofFelCD = mod:NewNextCountTimer(50, 206222, nil, nil, nil, 3)
local timerEyeofGuldanCD = mod:NewNextCountTimer(60, 209270, nil, nil, nil, 1)
--Stage Three: The Master's Power
mod:AddTimerLine(SCENARIO_STAGE:format(3))
local timerFlamesofSargerasCD = mod:NewNextCountTimer("d58.5", 221783, 15643, nil, nil, 3)
local timerStormOfDestroyerCD = mod:NewNextCountTimer(16, 161121, 196871, nil, nil, 3)
local timerWellOfSouls = mod:NewCastTimer(16, 206939, nil, nil, nil, 5)
local timerBlackHarvestCD = mod:NewNextCountTimer(83, 206744, nil, nil, nil, 2)
--Mythic Only
mod:AddTimerLine(ENCOUNTER_JOURNAL_SECTION_FLAG12)
local timerWindsCD = mod:NewCDCountTimer(39, 199446, nil, nil, nil, 2)
local timerWilloftheDemonWithin = mod:NewCastTimer(43, 211439, nil, nil, nil, 2)
local timerParasiticWoundCD = mod:NewCDTimer(36, 206847, nil, nil, nil, 3)
local timerWounded = mod:NewBuffActiveTimer(36, 227009, nil, nil, nil, 6)
local timerSoulSeverCD = mod:NewCDCountTimer(36, 220957, nil, nil, nil, 5, nil, DBM_CORE_TANK_ICON)
local timerVisionsofDarkTitan = mod:NewCastTimer(9, 227008, nil, nil, nil, 2)
local timerVisionsofDarkTitanCD = mod:NewCDCountTimer(9, 227008, nil, nil, nil, 2)
local timerFlameCrashCD = mod:NewCDCountTimer(20, 227071, nil, nil, nil, 3)
local timerSummonNightorbCD = mod:NewCDCountTimer(10.9, 227283, nil, nil, nil, 1, 225133)
--Shard
mod:AddTimerLine(DBM_ADDS)
local timerManifestAzzinothCD = mod:NewCDCountTimer(10.9, 221149, nil, nil, nil, 1, 236237)
local timerChaosSeedCD = mod:NewCDTimer(10.9, 221336, nil, nil, nil, 3)
local timerBulwarkofAzzinothCD = mod:NewCDTimer(10.9, 221408, nil, nil, nil, 6)
local timerPurifiedEssence = mod:NewCastTimer(4, 221486, nil, nil, nil, 2)
--Non Mythic
local countdownBondsOfFel = mod:NewCountdown(50, 206222)
local countdownEyeofGuldan = mod:NewCountdown("Alt50", 209270, "-Tank")
local countdownHandofGuldan = mod:NewCountdown("Alt50", 212258, "Tank")
local countdownLiquidHellfire = mod:NewCountdown("AltTwo50", 206219, "Ranged")
local countdownBlackHarvest = mod:NewCountdown("AltTwo50", 206744)
--mythic
local countdownVisions = mod:NewCountdown(50, 227008, nil, nil, 6)
local countdownSoulSever = mod:NewCountdown("Alt36", 220957, "Tank", nil, 6)
local countdownFlameCrash = mod:NewCountdown("AltTwo36", 227071, "Tank", nil, 6)
mod:AddRangeFrameOption(8, 221606)
mod:AddSetIconOption("SetIconOnBondsOfFlames", 221783, true)
mod:AddSetIconOption("SetIconOnBondsOfFel", 206222, true)
mod:AddInfoFrameOption(206310)
mod.vb.phase = 1
mod.vb.addsDied = 0
mod.vb.liquidHellfireCast = 0
mod.vb.felEffluxCast = 0
mod.vb.handofGuldanCast = 0
mod.vb.stormCast = 0
mod.vb.blackHarvestCast = 0
mod.vb.eyeCast = 0
mod.vb.flamesSargCast = 0
mod.vb.flamesTargets = 0
mod.vb.bondsofFelCast = 0
--Mythic only Phase
mod.vb.obeliskCastCount = 0
mod.vb.severCastCount = 0
mod.vb.crashCastCount = 0
mod.vb.orbCastCount = 0
mod.vb.visionCastCount = 0
mod.vb.azzCount = 0
--Mythic only Phase end
local felEffluxTimers = {11.0, 14.0, 18.5, 12.0, 12.2, 12.0}
local felEffluxTimersEasy = {11.0, 14.0, 19.9, 15.6, 16.8, 15.9, 15.8}
local handofGuldanTimers = {14.5, 48.9, 138.8}
--local mythicHandofGuldanTimers = {17, 165, 0, 0, 0}
local stormTimersEasy = {94, 78.6, 70.0, 87}
local stormTimers = {84.1, 68.7, 61.3, 76.5}
local stormTimersMythic = {72.6, 57.9, 51.6, 64.7, 57.4}--Credit to JustWait
local blackHarvestTimersEasy = {63, 82.9, 100.0}
local blackHarvestTimers = {64.1, 72.5, 87.5}
local blackHarvestTimersMythic = {55.7, 61.0, 75.3, 86.8}--Credit to JustWait
--local phase2Eyes = {29, 53.3, 53.4, 53.3, 53.3, 53.3, 66}--Not used, not needed if only 1 is different. need longer pulls to see what happens after 66
--local p1EyesMythic = {26, 48, 48}
local p3EmpoweredEyeTimersEasy = {42.5, 71.5, 71.4, 28.6, 114}--114 is guessed on the 1/8th formula
local p3EmpoweredEyeTimers = {39.1, 62.5, 62.5, 25, 100}--100 is confirmed
local p3EmpoweredEyeTimersMythic = {35.1, 52.6, 53.3, 20.4, 84.2, 52.6}--Credit to JustWait
local bondsIcons = {}
local flamesIcons = {}
local timeStopBuff, parasiteName = DBM:GetSpellInfo(206310), DBM:GetSpellInfo(206847)
local function upValueCapsAreStupid(self)
self.vb.phase = 3
timerWindsCD:Stop()
self:SetBossHPInfoToHighest()
specWarnWilloftheDemonWithin:Show()
specWarnWilloftheDemonWithin:Play("carefly")
timerWilloftheDemonWithin:Update(39, 43)
self.vb.severCastCount = 0
self.vb.crashCastCount = 0
self.vb.orbCastCount = 0
self.vb.visionCastCount = 0
self.vb.azzCount = 0
timerParasiticWoundCD:Start(8.3)
timerSoulSeverCD:Start(19.3, 1)
countdownSoulSever:Start(19.3)
timerManifestAzzinothCD:Start(26.3, 1)
timerFlameCrashCD:Start(29.3, 1)
countdownFlameCrash:Start(29.3)
timerSummonNightorbCD:Start(39.3, 1)
timerVisionsofDarkTitanCD:Start(95.1, 1)
countdownVisions:Start(95.1)
end
function mod:OnCombatStart(delay)
self.vb.phase = 1
self.vb.addsDied = 0
self.vb.liquidHellfireCast = 0
self.vb.felEffluxCast = 0
self.vb.handofGuldanCast = 0
self.vb.stormCast = 0
self.vb.blackHarvestCast = 0
self.vb.eyeCast = 0
self.vb.flamesSargCast = 0
self.vb.flamesTargets = 0
self.vb.bondsofFelCast = 0
self.vb.obeliskCastCount = 0
table.wipe(bondsIcons)
table.wipe(flamesIcons)
if self:IsMythic() then
self:SetCreatureID(104154, 111022)
timerBondsofFelCD:Start(self:IsTank() and 6.4 or 8.4, 1)
countdownBondsOfFel:Start(self:IsTank() and 6.4 or 8.4)
timerDzorykxCD:Start(17-delay)
countdownHandofGuldan:Start(17)
timerEyeofGuldanCD:Start(26.1-delay, 1)
countdownEyeofGuldan:Start(26.1)
timerLiquidHellfireCD:Start(36-delay, 1)
countdownLiquidHellfire:Start(36)
else
self:SetCreatureID(104154)
timerLiquidHellfireCD:Start(2-delay, 1)
timerFelEffluxCD:Start(11-delay, 1)
timerFelLordKurazCD:Start(11-delay)
countdownHandofGuldan:Start(11)
timerVethrizCD:Start(25-delay)
timerDzorykxCD:Start(35-delay)
self:SetCreatureID(104154)
end
end
function mod:OnCombatEnd()
if self.Options.RangeFrame then
DBM.RangeCheck:Hide()
end
if self.Options.InfoFrame then
DBM.InfoFrame:Hide()
end
end
function mod:OnTimerRecovery()
if self:IsMythic() then
self:SetCreatureID(104154, 111022)
else
self:SetCreatureID(104154)
end
end
function mod:SPELL_CAST_START(args)
local spellId = args.spellId
if spellId == 206219 or spellId == 206220 then
self.vb.liquidHellfireCast = self.vb.liquidHellfireCast + 1
specWarnLiquidHellfire:Show()
specWarnLiquidHellfire:Play("watchstep")
if self:IsMythic() or self.vb.phase >= 2 then
local longTimer, shortTimer, mediumTimer
if self:IsMythic() then
longTimer, shortTimer, mediumTimer = 66, 28.9, 33
elseif self:IsHeroic() then
longTimer, shortTimer, mediumTimer = 74, 31.6, 36
elseif self:IsNormal() then--Normal
longTimer, shortTimer, mediumTimer = 84, 36, 41
else
longTimer, shortTimer, mediumTimer = 88, 38.6, 44
end
if self.vb.liquidHellfireCast == 4 or self.vb.liquidHellfireCast == 6 then
timerLiquidHellfireCD:Start(longTimer, self.vb.liquidHellfireCast+1)
countdownLiquidHellfire:Start(longTimer)
elseif self.vb.liquidHellfireCast == 7 then--TODO, if a longer phase 2 than 7 casts, and continue to see diff timers than 36, build a table
timerLiquidHellfireCD:Start(shortTimer, self.vb.liquidHellfireCast+1)
countdownLiquidHellfire:Start(shortTimer)
else
timerLiquidHellfireCD:Start(mediumTimer, self.vb.liquidHellfireCast+1)
countdownLiquidHellfire:Start(mediumTimer)
end
elseif self.vb.phase == 1.5 then
if self.vb.liquidHellfireCast == 2 or self:IsHeroic() then
timerLiquidHellfireCD:Start(23.8, self.vb.liquidHellfireCast+1)
countdownLiquidHellfire:Start(23.8)
else--On LFR/Normal the rest are 32 in phase 1.5
timerLiquidHellfireCD:Start(32.5, self.vb.liquidHellfireCast+1)
countdownLiquidHellfire:Start(32.5)
end
else--Phase 1
timerLiquidHellfireCD:Start(15, self.vb.liquidHellfireCast+1)
countdownLiquidHellfire:Start(15)
end
elseif spellId == 206514 then
self.vb.felEffluxCast = self.vb.felEffluxCast + 1
specWarnFelEfflux:Show()
specWarnFelEfflux:Play("159202")
local timer = self:IsEasy() and felEffluxTimersEasy[self.vb.felEffluxCast+1] or felEffluxTimers[self.vb.felEffluxCast+1] or 12
timerFelEffluxCD:Start(timer, self.vb.felEffluxCast+1)
elseif spellId == 206675 then
if self:IsMythic() then
timerShatterEssenceCD:Start(21)
else
timerShatterEssenceCD:Start()
end
local targetName, uId, bossuid = self:GetBossTarget(104537)--Add true if it has a boss unitID
if self:IsTanking("player", bossuid, nil, true) then--Player is current target
specWarnShatterEssence:Show()
specWarnShatterEssence:Play("defensive")
end
elseif spellId == 206840 then
warnGazeofVethriz:Show()
timerGazeofVethrizCD:Start()
elseif spellId == 207938 then
warnShadowblink:Show()
--timerShadowBlinkCD:Start()
elseif spellId == 206883 then
if self:IsMythic() then--On mythic it's just tossed into center of room, not at tank
specWarnSoulVortex:Show()
specWarnSoulVortex:Play("watchstep")
timerSoulVortexCD:Start(21)
else
local targetName, uId, bossuid = self:GetBossTarget(104534, true)
if self:IsTanking("player", bossuid, nil, true) then--Player is current target
specWarnSoulVortex:Show()
specWarnSoulVortex:Play("runout")
yellSoulVortex:Yell()
elseif targetName then
warnSoulVortex:Show(targetName)
end
end
elseif spellId == 208545 then
warnAnguishedSpirits:Show()
elseif spellId == 209270 or spellId == 211152 then
self.vb.eyeCast = self.vb.eyeCast + 1
specWarnEyeofGuldan:Show(self.vb.eyeCast)
specWarnEyeofGuldan:Play("killmob")
if self:IsMythic() and self.vb.phase == 2 or self.vb.phase == 3 then
local timer = self:IsMythic() and p3EmpoweredEyeTimersMythic[self.vb.eyeCast+1] or self:IsEasy() and p3EmpoweredEyeTimersEasy[self.vb.eyeCast+1] or p3EmpoweredEyeTimers[self.vb.eyeCast+1]
if timer then
timerEyeofGuldanCD:Start(timer, self.vb.eyeCast+1)
countdownEyeofGuldan:Start(timer)
end
else
local longTimer, shortTimer
if self:IsMythic() then
longTimer, shortTimer = 80, 48
elseif self:IsHeroic() then
longTimer, shortTimer = 66, 53
elseif self:IsNormal() then--Normal
longTimer, shortTimer = 75, 60
else--LFR
longTimer, shortTimer = 80, 64
end
if self.vb.eyeCast == 6 then
timerEyeofGuldanCD:Start(longTimer, self.vb.eyeCast+1)--An oddball cast
countdownEyeofGuldan:Start(longTimer)
else
timerEyeofGuldanCD:Start(shortTimer, self.vb.eyeCast+1)
countdownEyeofGuldan:Start(shortTimer)
end
end
elseif spellId == 208672 then
if self:CheckInterruptFilter(args.sourceGUID, false, true) then
specWarnCarrionWave:Show(args.sourceName)
specWarnCarrionWave:Play("kickcast")
end
elseif spellId == 206744 then
self.vb.blackHarvestCast = self.vb.blackHarvestCast + 1
specWarnBlackHarvest:Show(self.vb.blackHarvestCast)
specWarnBlackHarvest:Play("aesoon")
local timer = self:IsMythic() and blackHarvestTimersMythic[self.vb.blackHarvestCast+1] or self:IsEasy() and blackHarvestTimersEasy[self.vb.blackHarvestCast+1] or blackHarvestTimers[self.vb.blackHarvestCast+1]
if timer then
timerBlackHarvestCD:Start(timer, self.vb.blackHarvestCast+1)
countdownBlackHarvest:Start(timer)
end
if self:IsMythic() then
if self.vb.blackHarvestCast == 2 then
timerWindsCD:Start(67, 3)
elseif self.vb.blackHarvestCast == 3 then
timerWindsCD:Start(75, 4)
end
end
elseif spellId == 206222 or spellId == 206221 then
table.wipe(bondsIcons)
if self:IsTanking("player", "boss1", nil, true) then
if spellId == 206221 then
specWarnBondsofFel:Play("carefly")
end
else
local targetName = UnitName("boss1target") or DBM_CORE_UNKNOWN
if not UnitIsUnit("player", "boss1target") then--the very first bonds of fel, threat is broken and not available yet, so we need an additional filter
if self:AntiSpam(5, targetName) then
specWarnBondsofFelTank:Show(targetName)
specWarnBondsofFelTank:Play("tauntboss")
end
end
end
elseif spellId == 221783 then
table.wipe(flamesIcons)
self.vb.flamesTargets = 0
--Begin Mythic Only Stuff
elseif spellId == 211439 then--Will of the Demon Within
upValueCapsAreStupid(self)
elseif spellId == 220957 then
self.vb.severCastCount = self.vb.severCastCount + 1
local _, _, bossuid = self:GetBossTarget(111022, true)
if self:IsTanking("player", bossuid, nil, true) then
specWarnSoulsever:Show(self.vb.severCastCount)
specWarnSoulsever:Play("defensive")
end
if self.vb.severCastCount == 4 or self.vb.severCastCount == 7 then
timerSoulSeverCD:Start(50, self.vb.severCastCount+1)
countdownSoulSever:Start(50)
else
timerSoulSeverCD:Start(20, self.vb.severCastCount+1)
countdownSoulSever:Start(20)
end
elseif spellId == 227008 then
self.vb.visionCastCount = self.vb.visionCastCount+1
specWarnVisionsofDarkTitan:Show(timeStopBuff)
specWarnVisionsofDarkTitan:Play("movetimebubble")
timerVisionsofDarkTitan:Start()
if self.vb.visionCastCount ~= 3 then
if self.vb.visionCastCount == 2 then
timerVisionsofDarkTitanCD:Start(150)
countdownVisions:Start(150)
else
timerVisionsofDarkTitanCD:Start(90)
countdownVisions:Start(90)
end
end
if self.Options.InfoFrame then
DBM.InfoFrame:SetHeader(DBM_NO_DEBUFF:format(timeStopBuff))
DBM.InfoFrame:Show(10, "playergooddebuff", timeStopBuff)
end
elseif spellId == 221408 then
specWarnBulwarkofAzzinoth:Show()
elseif spellId == 221486 and self:AntiSpam(5, 4) then
specWarnPurifiedEssence:Show(timeStopBuff)
specWarnPurifiedEssence:Play("movetimebubble")
timerPurifiedEssence:Start()
if self.Options.InfoFrame then
DBM.InfoFrame:SetHeader(DBM_NO_DEBUFF:format(timeStopBuff))
DBM.InfoFrame:Show(10, "playergooddebuff", timeStopBuff)
end
end
end
function mod:SPELL_CAST_SUCCESS(args)
local spellId = args.spellId
if spellId == 206222 or spellId == 206221 then
self.vb.bondsofFelCast = self.vb.bondsofFelCast + 1
if self:IsMythic() then
local timer = self:IsTank() and 38 or 40
timerBondsofFelCD:Start(timer, self.vb.bondsofFelCast+1)
countdownBondsOfFel:Start(timer)
elseif self:IsHeroic() then
local timer = self:IsTank() and 42.4 or 44.4
timerBondsofFelCD:Start(timer, self.vb.bondsofFelCast+1)
countdownBondsOfFel:Start(timer)
elseif self:IsNormal() then
local timer = self:IsTank() and 48 or 50
timerBondsofFelCD:Start(timer, self.vb.bondsofFelCast+1)
countdownBondsOfFel:Start(timer)
else
local timer = self:IsTank() and 51 or 53
timerBondsofFelCD:Start(timer, self.vb.bondsofFelCast+1)
countdownBondsOfFel:Start(timer)
end
elseif spellId == 221783 and self:AntiSpam(35, 1) then
self.vb.flamesSargCast = self.vb.flamesSargCast + 1
if self:IsMythic() then
timerFlamesofSargerasCD:Start(6.3, (self.vb.flamesSargCast).."-"..2)
timerFlamesofSargerasCD:Start(13.6, (self.vb.flamesSargCast).."-"..3)
timerFlamesofSargerasCD:Start(45, (self.vb.flamesSargCast+1).."-"..1)
if self.vb.flamesSargCast == 2 then
timerWindsCD:Start(31, 2)
end
elseif self:IsHeroic() then
timerFlamesofSargerasCD:Start(7.7, (self.vb.flamesSargCast).."-"..2)
timerFlamesofSargerasCD:Start(16.4, (self.vb.flamesSargCast).."-"..3)
timerFlamesofSargerasCD:Start(50, (self.vb.flamesSargCast+1).."-"..1)--5-6 is 50, 1-5 is 51. For time being using a simple 50 timer
else--Normal, LFR?
timerFlamesofSargerasCD:Start(18.9, (self.vb.flamesSargCast).."-"..2)
timerFlamesofSargerasCD:Start(58.5, (self.vb.flamesSargCast+1).."-"..1)
end
elseif spellId == 212258 and (self:IsMythic() or self.vb.phase > 1.5) then--Ignore phase 1 adds with this cast
self.vb.handofGuldanCast = self.vb.handofGuldanCast + 1
specWarnHandofGuldan:Show()
specWarnHandofGuldan:Play("bigmob")
if self:IsMythic() then
if self.vb.handofGuldanCast == 1 then
timerFelLordKurazCD:Start(165)
countdownHandofGuldan:Start(165)
end
else
local timer = handofGuldanTimers[self.vb.handofGuldanCast+1]
if timer then
timerHandofGuldanCD:Start(timer, self.vb.handofGuldanCast+1)
countdownHandofGuldan:Start(timer)
end
end
elseif spellId == 227008 then
if self.Options.InfoFrame then
DBM.InfoFrame:Hide()
end
elseif spellId == 221486 then
if self.Options.InfoFrame then
DBM.InfoFrame:Hide()
end
elseif spellId == 221336 then
timerChaosSeedCD:Start(10.5, args.sourceGUID)
end
end
function mod:SPELL_AURA_APPLIED(args)
local spellId = args.spellId
if spellId == 209011 or spellId == 206354 or spellId == 206384 or spellId == 209086 then--206354/206366 unconfirmed on normal/heroic. LFR/Mythic?
local isPlayer = args:IsPlayer()
local name = args.destName
if not tContains(bondsIcons, name) then
bondsIcons[#bondsIcons+1] = name
end
local count = #bondsIcons
if spellId == 206384 or spellId == 209086 then
warnEmpBondsofFel:CombinedShow(0.5, name)
else
warnBondsofFel:CombinedShow(0.5, name)
end
if isPlayer then
specWarnBondsofFel:Show()
specWarnBondsofFel:Play("targetyou")
yellBondsofFel:Yell(count, count, count)
else
local uId = DBM:GetRaidUnitId(name)
if self:IsTank() and not self:IsTanking("player", "boss1", nil, true) then
--secondary warning, in case first one didn't go through
if self:AntiSpam(5, name) then
specWarnBondsofFelTank:Show(name)
specWarnBondsofFelTank:Play("tauntboss")
end
end
end
if self.Options.SetIconOnBondsOfFel then
self:SetIcon(name, count)
end
elseif spellId == 221891 then
warnSoulSiphon:CombinedShow(0.3, args.destName)
elseif spellId == 208802 then
local amount = args.amount or 1
if args:IsPlayer() and amount >= 5 then
specWarnSoulCorrosion:Show(amount)
specWarnSoulCorrosion:Play("stackhigh")
end
elseif spellId == 221606 then--Looks like the 3 second pre targeting debuff for flames of sargeras
if self:AntiSpam(35, 1) then
self.vb.flamesSargCast = self.vb.flamesSargCast + 1
if self:IsMythic() then
timerFlamesofSargerasCD:Start(6.3, (self.vb.flamesSargCast).."-"..2)
timerFlamesofSargerasCD:Start(13.6, (self.vb.flamesSargCast).."-"..3)
timerFlamesofSargerasCD:Start(45, (self.vb.flamesSargCast+1).."-"..1)
if self.vb.flamesSargCast == 2 then
timerWindsCD:Start(31, 2)
end
elseif self:IsHeroic() then
timerFlamesofSargerasCD:Start(7.7, (self.vb.flamesSargCast).."-"..2)
timerFlamesofSargerasCD:Start(16.4, (self.vb.flamesSargCast).."-"..3)
timerFlamesofSargerasCD:Start(50, (self.vb.flamesSargCast+1).."-"..1)--5-6 is 50, 1-5 is 51. For time being using a simple 50 timer
else--Normal, LFR
timerFlamesofSargerasCD:Start(18.9, (self.vb.flamesSargCast).."-"..2)
timerFlamesofSargerasCD:Start(58.5, (self.vb.flamesSargCast+1).."-"..1)
end
end
local name = args.destName
self.vb.flamesTargets = self.vb.flamesTargets + 1
if not tContains(flamesIcons, name) then
flamesIcons[#flamesIcons+1] = name
end
local count = #flamesIcons+3
warnFlamesofSargeras:CombinedShow(0.3, name)
if args:IsPlayer() then
specWarnFlamesOfSargeras:Show()
specWarnFlamesOfSargeras:Play("runout")
yellFlamesofSargeras:Yell(count, count, count)
else
local uId = DBM:GetRaidUnitId(name)
if self:IsTanking(uId, "boss1") then
specWarnFlamesOfSargerasTank:Show(name)
specWarnFlamesOfSargerasTank:Play("tauntboss")
end
end
if self.Options.SetIconOnBondsOfFlames and count < 9 then
self:SetIcon(name, count)--Should start at icon 4 and go up from there (because icons 1-3 are used by bonds of fel)
end
elseif spellId == 221603 or spellId == 221785 or spellId == 221784 or spellId == 212686 then--4 different duration versions of Flames of sargeras?
if args:IsPlayer() then
if self.Options.RangeFrame then
DBM.RangeCheck:Show(8)
end
end
elseif spellId == 206516 then--The Eye of Aman'Thul (phase 1 buff)
self.vb.phase = 1.5
timerLiquidHellfireCD:Stop()
countdownLiquidHellfire:Cancel()
timerFelEffluxCD:Stop()
timerLiquidHellfireCD:Start(5, self.vb.liquidHellfireCast+1)
countdownLiquidHellfire:Start(5)
timerFelEffluxCD:Start(10, self.vb.felEffluxCast+1)
elseif spellId == 227427 then--The Eye of Aman'Thul (phase 3 transition buff)
timerBondsofFelCD:Stop()
countdownBondsOfFel:Cancel()
timerLiquidHellfireCD:Stop()
countdownLiquidHellfire:Cancel()
timerEyeofGuldanCD:Stop()
countdownEyeofGuldan:Cancel()
timerHandofGuldanCD:Stop()
countdownHandofGuldan:Cancel()
timerWindsCD:Start(12, 1)
timerWellOfSouls:Start(15)
self.vb.eyeCast = 0
if self:IsMythic() then
self.vb.phase = 2
warnPhase2:Show()
warnPhase2:Play("ptwo")
timerDzorykxCD:Stop()
timerFelLordKurazCD:Stop()
timerFlamesofSargerasCD:Start(24.5, "1-1")
timerEyeofGuldanCD:Start(34.3, 1)
countdownEyeofGuldan:Start(34.3)
timerBlackHarvestCD:Start(55.7, 1)
countdownBlackHarvest:Start(55.7)
timerStormOfDestroyerCD:Start(72.6, 1)
else
self.vb.phase = 3
warnPhase3:Show()
warnPhase3:Play("pthree")
timerBlackHarvestCD:Start(self:IsLFR() and 73 or 63, 1)
countdownBlackHarvest:Start(self:IsLFR() and 73 or 63)
if self:IsEasy() then
timerFlamesofSargerasCD:Start(29, 1)
timerEyeofGuldanCD:Start(42.5, 1)
countdownEyeofGuldan:Start(42.5)
timerStormOfDestroyerCD:Start(94, 1)
else
timerFlamesofSargerasCD:Start(27.5, "1-1")
timerEyeofGuldanCD:Start(39, 1)
countdownEyeofGuldan:Start(39)
timerStormOfDestroyerCD:Start(84, 1)
end
end
elseif spellId == 206847 then
warnParasiticWound:CombinedShow(0.3, args.destName)
if args:IsPlayer() then
local _, _, _, _, _, _, expires = UnitDebuff(args.destName, args.spellName)
local remaining = expires-GetTime()
specWarnParasiticWound:Show()
specWarnParasiticWound:Play("scatter")
yellParasiticWound:Yell()
yellParasiticWoundFades:Countdown(remaining)
end
elseif spellId == 206983 and self:AntiSpam(2, args.destName) then
warnShadowyGaze:CombinedShow(0.3, args.destName)
elseif spellId == 206458 then
if args:IsPlayer() then
--specWarnShearedSoul:Show()
--specWarnShearedSoul:Play("defensive")
end
elseif spellId == 227009 then
warnWounded:Show()
timerWounded:Start()
timerVisionsofDarkTitan:Stop()
elseif spellId == 206310 and args:IsPlayer() then
yellParasiticWoundFades:Cancel()
end
end
mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIED
function mod:SPELL_AURA_REMOVED(args)
local spellId = args.spellId
if spellId == 209011 or spellId == 206354 then
if self.Options.SetIconOnBondsOfFel then
self:SetIcon(args.destName, 0)
end
elseif spellId == 206384 or spellId == 209086 then--(206366: stunned version mythic?)
if self.Options.SetIconOnBondsOfFel then
self:SetIcon(args.destName, 0)
end
elseif spellId == 221606 then
self.vb.flamesTargets = self.vb.flamesTargets - 1
if self.vb.flamesTargets == 0 then
table.wipe(flamesIcons)
end
elseif spellId == 221603 or spellId == 221785 or spellId == 221784 or spellId == 212686 then--4 different duration versions of Flames of sargeras?
if args:IsPlayer() then
if self.Options.RangeFrame then
DBM.RangeCheck:Hide()
end
end
if self.Options.SetIconOnBondsOfFlames then
self:SetIcon(args.destName, 0)
end
elseif spellId == 206847 then
if args:IsPlayer() then
yellParasiticWoundFades:Cancel()
end
elseif spellId == 206310 and args:IsPlayer() then
if UnitDebuff("player", parasiteName) then
local _, _, _, _, _, _, expires = UnitDebuff("player", parasiteName)
local remaining = expires-GetTime()
yellParasiticWoundFades:Countdown(remaining)
end
end
end
--[[
function mod:SPELL_PERIODIC_DAMAGE(_, _, _, _, destGUID, _, _, _, spellId)
if spellId == 205611 and destGUID == UnitGUID("player") and self:AntiSpam(2, 2) then
-- specWarnMiasma:Show()
-- specWarnMiasma:Play("runaway")
end
end
mod.SPELL_PERIODIC_MISSED = mod.SPELL_PERIODIC_DAMAGE
--]]
function mod:UNIT_DIED(args)
local cid = self:GetCIDFromGUID(args.destGUID)
if cid == 111070 then--Azzinoth
timerChaosSeedCD:Stop(args.destGUID)
elseif cid == 104154 and self:IsMythic() then--Gul'dan
self.vb.bossLeft = self.vb.bossLeft - 1
timerFlamesofSargerasCD:Stop()
timerEyeofGuldanCD:Stop()
countdownEyeofGuldan:Cancel()
timerBlackHarvestCD:Stop()
countdownBlackHarvest:Cancel()
timerStormOfDestroyerCD:Stop()
timerWindsCD:Stop()
end
end
function mod:CHAT_MSG_MONSTER_YELL(msg)
if (msg == L.prePullRP or msg:find(L.prePullRP)) and self:LatencyCheck() then
self:SendSync("GuldanRP")
elseif ( msg == L.mythicPhase3 or msg:find(L.mythicPhase3)) and self:IsMythic() then
self:SendSync("mythicPhase3")
end
end
function mod:UNIT_SPELLCAST_SUCCEEDED(uId, _, _, spellGUID)
local spellId = tonumber(select(5, strsplit("-", spellGUID)), 10)
if spellId == 161121 then--Assumed this is a script like felseeker
self.vb.stormCast = self.vb.stormCast + 1
specWarnStormOfDestroyer:Show()
specWarnStormOfDestroyer:Play("watchstep")
local timer = self:IsMythic() and stormTimersMythic[self.vb.stormCast+1] or self:IsEasy() and stormTimersEasy[self.vb.stormCast+1] or stormTimers[self.vb.stormCast+1]
if timer then
timerStormOfDestroyerCD:Start(timer, self.vb.stormCast+1)
end
elseif spellId == 215736 then--Hand of Guldan (Fel Lord Kuraz'mal)
if self:IsMythic() then
timerShatterEssenceCD:Start(21)
else
timerShatterEssenceCD:Start(19)--Same on normal and heroic. mythic/LFR need vetting.
end
elseif spellId == 215738 then--Hand of Guldan (Inquisitor Vethriz)
if self:IsEasy() then
--Unknown, died before casting either one
else
--timerShadowBlinkCD:Start(27.8)
timerGazeofVethrizCD:Start(27.8)--Basically starts casting it right after blink, then every 5 seconds
end
elseif spellId == 215739 then--Hand of Guldan (D'zorykx the Trapper)
if self:IsMythic() then
timerSoulVortexCD:Start(3)
end
--[[if self:IsEasy() then
timerSoulVortexCD:Start(52)--Normal verified, LFR assumed
else
timerSoulVortexCD:Start(35)--Heroic Jan 21
end--]]
elseif spellId == 210273 then--Fel Obelisk
self.vb.obeliskCastCount = self.vb.obeliskCastCount + 1
specWarnFelObelisk:Show()
specWarnFelObelisk:Play("watchstep")
if self:IsMythic() then
if self.vb.obeliskCastCount % 2 == 0 then
timerFelObeliskCD:Start(16)
else
timerFelObeliskCD:Start(5)
end
else
timerFelObeliskCD:Start(23)
end
elseif spellId == 209601 or spellId == 209637 or spellId == 208831 then--Fel Lord, Inquisitor, Jailer (they cast these on death, more reliable than UNIT_DIED which often doesn't fire for inquisitor)
local cid = self:GetUnitCreatureId(uId)
if cid == 104537 or cid == 104536 or cid == 104534 then
self.vb.addsDied = self.vb.addsDied + 1
if cid == 104537 then--Fel Lord Kuraz'mal
timerShatterEssenceCD:Stop()
timerFelObeliskCD:Stop()
elseif cid == 104536 then--Inquisitor Vethriz
timerGazeofVethrizCD:Stop()
--timerShadowBlinkCD:Stop()
elseif cid == 104534 then--D'zorykx the Trapper
timerSoulVortexCD:Stop()
end
if self.vb.addsDied == 3 and not self:IsMythic() then
--This probably needs refactoring for mythic since phase 1 and 2 happen at same time
self.vb.phase = 2
self.vb.liquidHellfireCast = 0
warnPhase2:Show()
warnPhase2:Play("ptwo")
timerLiquidHellfireCD:Stop()
countdownLiquidHellfire:Cancel()
timerFelEffluxCD:Stop()
timerTransition:Start(19)
local timer =
timerBondsofFelCD:Start(self:IsTank() and 25.5 or 27.6, 1)
countdownBondsOfFel:Start(self:IsTank() and 25.5 or 27.6)
if self:IsLFR() then
timerEyeofGuldanCD:Start(54, 1)
countdownEyeofGuldan:Start(54)
timerLiquidHellfireCD:Start(67, 1)
countdownLiquidHellfire:Start(67)
elseif self:IsNormal() then
timerEyeofGuldanCD:Start(50.6, 1)
countdownEyeofGuldan:Start(50.6)
timerLiquidHellfireCD:Start(63.1, 1)
countdownLiquidHellfire:Start(63.1)
else--Heroic
timerHandofGuldanCD:Start(33, 1)
countdownHandofGuldan:Start(33)
timerEyeofGuldanCD:Start(48, 1)
countdownEyeofGuldan:Start(48)
timerLiquidHellfireCD:Start(59, 1)
countdownLiquidHellfire:Start(59)
end
end
end
elseif spellId == 227035 then -- Parasitic Wound
timerParasiticWoundCD:Start()
elseif spellId == 221149 or spellId == 227277 then -- Manifest Azzinoth
self.vb.azzCount = self.vb.azzCount + 1
local count = self.vb.azzCount
specWarnManifestAzzinoth:Show(count)
specWarnManifestAzzinoth:Play("bigmob")
specWarnManifestAzzinoth:ScheduleVoice(1.2, nil, "Interface\\AddOns\\DBM-VP"..DBM.Options.ChosenVoicePack.."\\count\\"..count..".ogg")
timerBulwarkofAzzinothCD:Start(15)
timerManifestAzzinothCD:Start(40, count+1)
elseif spellId == 227071 then -- Flame Crash
self.vb.crashCastCount = self.vb.crashCastCount + 1
if self.vb.crashCastCount == 4 or self.vb.crashCastCount == 7 then
timerFlameCrashCD:Start(50, self.vb.crashCastCount+1)
countdownFlameCrash:Start(50)
else
timerFlameCrashCD:Start(20, self.vb.crashCastCount+1)
countdownFlameCrash:Start(20)
end
elseif spellId == 227283 then -- Nightorb
self.vb.orbCastCount = self.vb.orbCastCount + 1
specWarnSummonNightorb:Show(self.vb.orbCastCount)
specWarnSummonNightorb:Play("mobsoon")
if self.vb.orbCastCount ~= 4 then
if self.vb.orbCastCount == 2 then
timerSummonNightorbCD:Start(60, self.vb.orbCastCount+1)
elseif self.vb.orbCastCount == 3 then
timerSummonNightorbCD:Start(40, self.vb.orbCastCount+1)
else
timerSummonNightorbCD:Start(45, self.vb.orbCastCount+1)
end
end
end
end
function mod:OnSync(msg)
if msg == "GuldanRP" and self:AntiSpam(10, 3) then
timerRP:Start()
end
if not self:IsInCombat() then return end
if msg == "mythicPhase3" and self:IsMythic() then
warnPhase3Soon:Show()
timerWilloftheDemonWithin:Start(43)
end
end |
local levels = require "scenes.levellogic"
local tutorial = {}
function tutorial:draw()
end
function tutorial:keyreleased(key, code)
-- if --player reaches endbox
Gamestate.switch(levels)
--end
end
return tutorial |
local path = (...):sub(1, #(...) - #(".physics.PhysicsRig"))
local Luaoop = require(path..".3p.Luaoop")
local nvec = require(path..".3p.nvec") ---@type NVec
---@class L2DF.PhysicsRig
---@field public settings L2DF.PhysicsSubRig[]
---@field public inputs L2DF.PhysicsInput[]
---@field public outputs L2DF.PhysicsOutput[]
---@field public particles L2DF.PhysicsParticle[]
---@field public gravity NVec
---@field public wind NVec
local PhysicsRig = Luaoop.class("L2DF.PhysicsRig")
function PhysicsRig:__construct()
self.settings = {}
self.inputs = {}
self.outputs = {}
self.particles = {}
self.gravity = nvec()
self.wind = nvec()
end
return PhysicsRig
|
---@class ServerOptions.StringServerOption : zombie.network.ServerOptions.StringServerOption
ServerOptions_StringServerOption = {}
---@public
---@return String
function ServerOptions_StringServerOption:getTooltip() end
---@public
---@return ConfigOption
function ServerOptions_StringServerOption:asConfigOption() end
|
modifier_drow_ranger_frost_arrows_lua = class({})
--------------------------------------------------------------------------------
-- Classifications
function modifier_drow_ranger_frost_arrows_lua:IsHidden()
return false
end
function modifier_drow_ranger_frost_arrows_lua:IsDebuff()
return true
end
function modifier_drow_ranger_frost_arrows_lua:IsStunDebuff()
return false
end
function modifier_drow_ranger_frost_arrows_lua:IsPurgable()
return true
end
--------------------------------------------------------------------------------
-- Initializations
function modifier_drow_ranger_frost_arrows_lua:OnCreated( kv )
-- references
self.slow = self:GetAbility():GetSpecialValueFor( "frost_arrows_movement_speed" )
end
function modifier_drow_ranger_frost_arrows_lua:OnRefresh( kv )
-- references
self.slow = self:GetAbility():GetSpecialValueFor( "frost_arrows_movement_speed" )
end
function modifier_drow_ranger_frost_arrows_lua:OnDestroy( kv )
end
--------------------------------------------------------------------------------
-- Modifier Effects
function modifier_drow_ranger_frost_arrows_lua:DeclareFunctions()
local funcs = {
MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE,
}
return funcs
end
function modifier_drow_ranger_frost_arrows_lua:GetModifierMoveSpeedBonus_Percentage()
return self.slow
end
--------------------------------------------------------------------------------
-- Graphics & Animations
function modifier_drow_ranger_frost_arrows_lua:GetEffectName()
return "particles/generic_gameplay/generic_slowed_cold.vpcf"
end
function modifier_drow_ranger_frost_arrows_lua:GetEffectAttachType()
return PATTACH_ABSORIGIN_FOLLOW
end |
require "lib.DotEnvHelper"
local dotEnv = DotEnvHelper(config.laravel.SETTINGS_FILE)
local function commmentDBLine(line)
local key = getKey(line)
if key == "DB_DATABASE" then
line = commentLine(line)
end
return line
end
local function uncommentTargetDBLine(targetDB) --<<<<< TODO: Uniformizar
return function(line)
local value = getValue(line)
if value == targetDB then
line = uncommentLine(line)
end
return line
end
end
local target = {}
function target.getDatabases()
local dotEnvLines = dotEnv:getLines()
local dbLines = filter(partial(lineKeyMatches, "DB_DATABASE"), dotEnvLines)
local pairLines = map(getPair, dbLines)
local databases = map(compose(DatabaseInfo.fromRawKeyValue, unpack), pairLines)
return databases
end
function target.getDatabaseName()
return dotEnv:get("DB_DATABASE")
end
function target.changeDatabase(newDatabaseName)
local lines = dotEnv:getLines()
lines = map(compose(uncommentTargetDBLine(newDatabaseName), commmentDBLine), lines)
dotEnv:setLines(lines)
return true
end
return target
|
local mod = get_mod("rwaon_talents")
------------------------------------------------------------------------------
-- ██╗ ██╗██╗ ████████╗██╗███╗ ███╗ █████╗ ████████╗███████╗███████╗
-- ██║ ██║██║ ╚══██╔══╝██║████╗ ████║██╔══██╗╚══██╔══╝██╔════╝██╔════╝
-- ██║ ██║██║ ██║ ██║██╔████╔██║███████║ ██║ █████╗ ███████╗
-- ██║ ██║██║ ██║ ██║██║╚██╔╝██║██╔══██║ ██║ ██╔══╝ ╚════██║
-- ╚██████╔╝███████╗██║ ██║██║ ╚═╝ ██║██║ ██║ ██║ ███████╗███████║
-- ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- ████████╗ █████╗ ██╗ ███████╗███╗ ██╗████████╗███████╗
-- ╚══██╔══╝██╔══██╗██║ ██╔════╝████╗ ██║╚══██╔══╝██╔════╝
-- ██║ ███████║██║ █████╗ ██╔██╗ ██║ ██║ ███████╗
-- ██║ ██╔══██║██║ ██╔══╝ ██║╚██╗██║ ██║ ╚════██║
-- ██║ ██║ ██║███████╗███████╗██║ ╚████║ ██║ ███████║
-- ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- ██████╗ █████╗ ███████╗███████╗██╗██╗ ██╗███████╗███████╗
-- ██╔══██╗██╔══██╗██╔════╝██╔════╝██║██║ ██║██╔════╝██╔════╝
-- ██████╔╝███████║███████╗███████╗██║██║ ██║█████╗ ███████╗
-- ██╔═══╝ ██╔══██║╚════██║╚════██║██║╚██╗ ██╔╝██╔══╝ ╚════██║
-- ██║ ██║ ██║███████║███████║██║ ╚████╔╝ ███████╗███████║
-- ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═══╝ ╚══════╝╚══════╝
------------------------------------------------------------------------------
-- Zealot
mod:dofile("scripts/mods/rwaon_talents/scripts/settings/profiles/career_settings/wh_1")
-- Bountyhunter
mod:dofile("scripts/mods/rwaon_talents/scripts/settings/profiles/career_settings/wh_2")
-- Witchhunter
mod:dofile("scripts/mods/rwaon_talents/scripts/settings/profiles/career_settings/wh_3")
|
cc = cc or {}
---TableView object
---@class TableView : ScrollView
local TableView = {}
cc.TableView = TableView
--------------------------------
---Updates the content of the cell at a given index.<br>
---param idx index to find a cell
---@param idx int
---@return TableView
function TableView:updateCellAtIndex(idx) end
--------------------------------
---determines how cell is ordered and filled in the view.
---@param order int
---@return TableView
function TableView:setVerticalFillOrder(order) end
--------------------------------
--
---@param view ScrollView
---@return TableView
function TableView:scrollViewDidZoom(view) end
--------------------------------
--
---@return TableView
function TableView:_updateContentSize() end
--------------------------------
--
---@return int
function TableView:getVerticalFillOrder() end
--------------------------------
---Removes a cell at a given index<br>
---param idx index to find a cell
---@param idx int
---@return TableView
function TableView:removeCellAtIndex(idx) end
--------------------------------
--
---@param size
---@param container Node
---@return bool
function TableView:initWithViewSize(size, container) end
--------------------------------
--
---@param view ScrollView
---@return TableView
function TableView:scrollViewDidScroll(view) end
--------------------------------
---reloads data from data source. the view will be refreshed.
---@return TableView
function TableView:reloadData() end
--------------------------------
---Inserts a new cell at a given index<br>
---param idx location to insert
---@param idx int
---@return TableView
function TableView:insertCellAtIndex(idx) end
--------------------------------
---Returns an existing cell at a given index. Returns nil if a cell is nonexistent at the moment of query.<br>
---param idx index<br>
---return a cell at a given index
---@param idx int
---@return TableViewCell
function TableView:cellAtIndex(idx) end
--------------------------------
---Dequeues a free cell if available. nil if not.<br>
---return free cell
---@return TableViewCell
function TableView:dequeueCell() end
--------------------------------
--
---@param pTouch Touch
---@param pEvent Event
---@return TableView
function TableView:onTouchMoved(pTouch, pEvent) end
--------------------------------
--
---@param pTouch Touch
---@param pEvent Event
---@return TableView
function TableView:onTouchEnded(pTouch, pEvent) end
--------------------------------
--
---@param pTouch Touch
---@param pEvent Event
---@return TableView
function TableView:onTouchCancelled(pTouch, pEvent) end
--------------------------------
--
---@param pTouch Touch
---@param pEvent Event
---@return bool
function TableView:onTouchBegan(pTouch, pEvent) end
--------------------------------
---js ctor<br>
---lua new
---@return TableView
function TableView:TableView() end
return TableView |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Network = require(ReplicatedStorage.Network)
return Network.register({
testEvent = Network.Event,
testFunction = Network.Function,
})
|
--[[
MobHealth3: Blizzard Frames!
"I don't need no flashy unit frame mods!" "Sage isn't flashy!" "Shhh, you!"
By Neronix of Hellscream EU
Some code by KamuiGT
Based on code from MobHealth2
--]]
if not MobHealth3 then error("<MH3 Blizzard Frames> MobHealth3 isn't loaded! Are you SURE you have MobHealth3 installed?"); return; end
MH3Blizz = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0")
--[[
File-scope local vars
--]]
local htext, ptext
--[[
Init/Enable methods
--]]
function MH3Blizz:OnInitialize()
MH3BlizzConfig = MH3BlizzConfig or {
healthX = 0,
healthY = 0,
powerX = 0,
powerY = 0,
healthAbs = true,
healthPerc = true,
powerAbs = true,
powerPerc = true,
}
-- Create frame and fontstrings
local frame = CreateFrame("frame", "MobHealth3BlizzardFrame", TargetFrame)
htext = frame:CreateFontString("MobHealth3BlizzardHealthText", "ARTWORK")
htext:SetFontObject(GameFontNormalSmall)
htext:SetTextColor(1, 1, 1, 1)
ptext = frame:CreateFontString("MobHealth3BlizzardPowerText", "ARTWORK")
ptext:SetFontObject(GameFontNormalSmall)
ptext:SetTextColor(1, 1, 1, 1)
self:RegisterChatCommand({"/mh3b", "/mh3blizz"}, {
type = "group",
args = {
abshealth = {
name = "Show absolute health",
desc = "Toggles showing absolute health on the target frame",
type = "toggle",
get = function() return MH3BlizzConfig.healthAbs end,
set = function(val)
MH3BlizzConfig.healthAbs = val
self:HealthUpdate()
end,
},
perchealth = {
name = "Show health percentage",
desc = "Toggles showing percentage health on the target frame",
type = "toggle",
get = function() return MH3BlizzConfig.healthPerc end,
set = function(val)
MH3BlizzConfig.healthPerc = val
self:HealthUpdate()
end,
},
abspower = {
name = "Show absolute power",
desc = "Toggles showing absolute mana/energy/rage on the target frame",
type = "toggle",
get = function() return MH3BlizzConfig.powerAbs end,
set = function(val)
MH3BlizzConfig.powerAbs = val
self:PowerUpdate()
end,
},
percpower = {
name = "Show power percentage",
desc = "Toggles showing percentage mana/energy/rage on the target frame",
type = "toggle",
get = function() return MH3BlizzConfig.powerPerc end,
set = function(val)
MH3BlizzConfig.powerPerc = val
self:PowerUpdate()
end,
},
healthx = {
name = "Health X offset",
desc = "Adjusts the X offset of the health text",
type = "text",
usage = "<number>",
get = function() return MH3BlizzConfig.healthX end,
set = function(val)
MH3BlizzConfig.healthX = tonumber(val)
htext:SetPoint("TOP", TargetFrameHealthBar, "BOTTOM", MH3BlizzConfig.healthX-2, MH3BlizzConfig.healthY+22)
end,
},
healthy = {
name = "Health Y offset",
desc = "Adjusts the Y offset of the health text",
type = "text",
usage = "<number>",
get = function() return MH3BlizzConfig.healthY end,
set = function(val)
MH3BlizzConfig.healthY = tonumber(val)
htext:SetPoint("TOP", TargetFrameHealthBar, "BOTTOM", MH3BlizzConfig.healthX-2, MH3BlizzConfig.healthY+22)
end,
},
powerx = {
name = "Power X offset",
desc = "Adjusts the X offset of the power text",
type = "text",
usage = "<number>",
get = function() return MH3BlizzConfig.powerX end,
set = function(val)
MH3BlizzConfig.powerX = tonumber(val)
ptext:SetPoint("TOP", TargetFrameManaBar, "BOTTOM", MH3BlizzConfig.powerX-2, MH3BlizzConfig.powerY+22)
end,
},
powery = {
name = "Power Y offset",
desc = "Adjusts the Y offset of the power text",
type = "text",
usage = "<number>",
get = function() return MH3BlizzConfig.powerY end,
set = function(val)
MH3BlizzConfig.powerY = tonumber(val)
ptext:SetPoint("TOP", TargetFrameManaBar, "BOTTOM", MH3BlizzConfig.powerX-2, MH3BlizzConfig.powerY+22)
end,
},
},
})
-- WARNING WARNING WARNING
-- BIG DIRTY HACK AHEAD
TargetDeadText:SetText()
-- Ok, it wasn't even big, nor was it actually a hack
end
function MH3Blizz:OnEnable()
self:RegisterEvent("UNIT_HEALTH")
self:RegisterEvent("UNIT_MANA")
self:RegisterEvent("PLAYER_TARGET_CHANGED")
end
--[[
Event handlers
--]]
function MH3Blizz:UNIT_HEALTH()
if arg1 == "target" then self:HealthUpdate() end
end
function MH3Blizz:UNIT_MANA()
if arg1 == "target" then self:PowerUpdate() end
end
function MH3Blizz:PLAYER_TARGET_CHANGED()
if UnitExists("target") then
self:HealthUpdate()
self:PowerUpdate()
end
end
--[[
Updaters
--]]
function MH3Blizz_Update_TextPos()
if GetCVar'ufiCompactMode' == '1' then
-- COMPACT SETTINGS
htext:SetPoint("TOP", TargetFrameHealthBar, "BOTTOM", MH3BlizzConfig.healthX-2, MH3BlizzConfig.healthY+13)
ptext:SetPoint("TOP", TargetFrameManaBar, "BOTTOM", MH3BlizzConfig.powerX-2, MH3BlizzConfig.powerY+12)
else
-- EXTENDED SETTINGS
htext:SetPoint("TOP", TargetFrameHealthBar, "BOTTOM", MH3BlizzConfig.healthX-2, MH3BlizzConfig.healthY+11)
ptext:SetPoint("TOP", TargetFrameManaBar, "BOTTOM", MH3BlizzConfig.powerX-2, MH3BlizzConfig.powerY+10)
end
end
function MH3Blizz:HealthUpdate()
local cur, max = MobHealth3:GetUnitHealth("target", UnitHealth("target"), UnitHealthMax("target"))
local absText, percText = "", ""
-- Set absolute text
if MH3BlizzConfig.healthAbs then
if max == 100 then
-- Do nothing!
elseif max > 999999 then
-- Display numbers in K notation
absText = string.format("%dK/%dK", cur/1000, max/1000)
else
absText = string.format("%d/%d", cur, max)
end
end
-- Set percentage text
if MH3BlizzConfig.healthPerc then
percText = string.format("(%d%%)", max == 100 and cur or math.floor(cur/max*100 + 0.5))
end
htext:SetText(absText.." "..percText)
end
function MH3Blizz:PowerUpdate()
local cur, max = UnitMana("target"), UnitManaMax("target")
-- No power? No text!
if max == 0 then ptext:SetText(); return; end
local absText, percText = "", ""
-- Set absolute text
if MH3BlizzConfig.powerAbs then
if max > 999999 then
-- Display numbers in K notation
absText = string.format("%dK/%dK", cur/1000, max/1000)
else
absText = string.format("%d/%d", cur, max)
end
end
-- Set percentage text
if MH3BlizzConfig.powerPerc then
percText = string.format("(%d%%)", max == 100 and cur or math.floor(cur/max*100 + 0.5))
end
ptext:SetText(absText.." "..percText)
end
local f = CreateFrame'Frame'
--f:RegisterEvent'PLAYER_ENTERING_WORLD'
f:RegisterEvent'ADDON_LOADED'
f:SetScript('OnEvent', function()
if arg1 == "UnitFramesImproved_Vanilla" then
MH3Blizz_Update_TextPos();
end
end) |
-----------------------------------
-- Area: Metalworks
-- NPC: Udine A.M.A.N
-- Type: Mentor Recruiter
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
local var = 0
if (player:getMentor() == 0) then
if (player:getMainLvl() >= 30 and player:getPlaytime() >= 648000) then
var = 1
end
elseif (player:getMentor() >= 1) then
var = 2
end
player:startEvent(826, var)
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
if (csid == 826 and option == 0) then
player:setMentor(1)
end
end
|
local classic = require 'classic'
local ffi=require 'ffi'
ffi.cdef([[
void* init(uint16_t);
double pseudoCount(void*, void*);
void finish(void*);
]]);
local C = ffi.load(package.searchpath('libpseudocount', package.cpath))
local PseudoCount = classic.class('PseudoCount')
function PseudoCount:_init(dim)
self.tree = C.init(dim)
classic.strict(self)
end
function PseudoCount:pseudoCount(screen)
return tonumber(C.pseudoCount(self.tree, screen:data()))
end
function PseudoCount:finish()
C.finish(self.tree)
end
return PseudoCount; |
local gtk = require('beautiful.gtk')
local assets = require('beautiful.theme_assets')
local dpi = require('beautiful.xresources').apply_dpi
local gears = require('gears')
local gfs = gears.filesystem
local themes_path = gfs.get_themes_dir()
local debug = gears.debug
local shape = gears.shape
local icons = require('theme.icons')
local render = require('utils.common').svg.new_from_str
local colors = require('utils.common').colors
-- Load default theme
local theme = dofile(themes_path..'default/theme.lua')
-- Load GTK variables
theme.gtk = gtk.get_theme_variables()
if not theme.gtk then
debug.print_warning("Can't load GTK+3 theme. You're going to have a bad time.")
return theme
end
-- Map GTK to beautiful
theme.fg_normal = theme.gtk.fg_color
theme.bg_normal = theme.gtk.bg_color
theme.fg_focus = theme.gtk.selected_fg_color
theme.bg_focus = theme.gtk.selected_bg_color
theme.fg_urgent = theme.gtk.warning_fg_color
theme.bg_urgent = theme.gtk.warning_bg_color
theme.fg_minimize = theme.gtk.text_color
theme.bg_minimize = theme.gtk.base_color
theme.fg_success = theme.gtk.success_fg_color
theme.bg_success = theme.gtk.success_bg_color
theme.fg_warning = theme.gtk.warning_fg_color
theme.bg_warning = theme.gtk.warning_bg_color
theme.fg_error = theme.gtk.error_fg_color
theme.bg_error = theme.gtk.error_bg_color
theme.base_fg = theme.gtk.text_color
theme.base_bg = theme.gtk.base_color
theme.wibar_fg = theme.gtk.menubar_fg_color
theme.wibar_bg = theme.gtk.menubar_bg_color
theme.menubar_fg = theme.gtk.menubar_fg_color
theme.menubar_bg = theme.gtk.menubar_bg_color
-- Icon theme
theme.icon_theme = _G.xsettings['Net/IconThemeName']
-- Fonts
theme.font = theme.gtk.font_family..' '..theme.gtk.font_size
theme.font_bold = theme.gtk.font_family..' Bold '..theme.gtk.font_size
theme.font_italic = theme.gtk.font_family..' Italic '..theme.gtk.font_size
-- Misc
theme.useless_gap = dpi(4)
theme.opacity = 1.0
theme.transparent = '#00000000'
-- Widgets
local button_shape = function(cr, w, h)
shape.rounded_rect(cr, w, h, theme.border_radius)
end
-- Buttons
theme.button_fg = theme.gtk.button_fg_color
theme.button_bg = theme.gtk.button_bg_color
theme.button_border_color = theme.gtk.button_border_color
theme.button_border_width = dpi(theme.gtk.button_border_width or 1)
theme.button_border_radius = dpi(theme.gtk.button_border_radius or 0)
theme.button_shape = button_shape
theme.button_fg_hover = theme.fg_normal
theme.button_bg_hover = theme.button_bg
theme.button_border_color_hover = colors.mix(theme.bg_focus, theme.base_fg, 0.8)
theme.button_fg_pressed = theme.fg_focus
theme.button_bg_pressed = theme.bg_focus
theme.button_border_color_pressed = colors.mix(theme.bg_focus, theme.base_fg, 0.8)
-- Header buttons
theme.header_fg = theme.gtk.header_button_fg_color
theme.header_bg = theme.gtk.header_button_bg_color
theme.header_border_color = theme.gtk.header_button_border_color
theme.header_fg_hover = theme.header_fg
theme.header_bg_hover = theme.header_bg
theme.header_border_color_hover = colors.mix(theme.bg_focus, theme.base_fg, 0.8)
theme.header_fg_pressed = theme.fg_focus
theme.header_bg_pressed = theme.bg_focus
theme.header_border_color_pressed = colors.mix(theme.bg_focus, theme.base_fg, 0.8)
-- OSD (notifications)
theme.osd_fg = theme.gtk.osd_fg_color
theme.osd_bg = theme.gtk.osd_bg_color
theme.osd_border_color = theme.gtk.osd_border_color
-- Borders
theme.border_color = theme.gtk.wm_bg_color
theme.border_color_normal = theme.gtk.wm_bg_color
theme.border_color_active = theme.gtk.wm_border_focused_color
theme.border_color_marked = theme.gtk.warning_color
theme.border_width = dpi(theme.gtk.button_border_width or 0)
theme.border_radius = dpi(theme.gtk.button_border_radius or 0)
-- Wibar
theme.wibar_height = dpi(24)
-- Titlebar
theme.titlebar_fg_normal = theme.menubar_fg
theme.titlebar_bg_normal = theme.menubar_bg
theme.titlebar_font_normal = theme.font_bold
theme.titlebar_fg_focus = theme.menubar_fg
theme.titlebar_bg_focus = theme.menubar_bg
theme.titlebar_font_focus = theme.font_bold
theme.titlebar_fg_urgent = theme.fg_success
theme.titlebar_bg_urgent = theme.menubar_bg
theme.titlebar_font_urgent = theme.font_bold
theme.titlebar_height = dpi(20)
theme.titlebar_shape = button_shape
-- Ontop button
theme.titlebar_ontop_button_focus_active = render(icons.titlebar.ontop_alt, theme.wibar_fg)
theme.titlebar_ontop_button_focus_active_hover = render(icons.titlebar.ontop_alt, theme.bg_warning)
theme.titlebar_ontop_button_focus_active_press = render(icons.titlebar.ontop_alt, theme.bg_focus)
theme.titlebar_ontop_button_focus_inactive = render(icons.titlebar.ontop, theme.wibar_fg)
theme.titlebar_ontop_button_focus_inactive_hover = render(icons.titlebar.ontop, theme.bg_warning)
theme.titlebar_ontop_button_focus_inactive_press = render(icons.titlebar.ontop, theme.bg_focus)
theme.titlebar_ontop_button_normal_active = render(icons.titlebar.ontop_alt, theme.wibar_fg)
theme.titlebar_ontop_button_normal_active_hover = render(icons.titlebar.ontop_alt, theme.bg_warning)
theme.titlebar_ontop_button_normal_active_press = render(icons.titlebar.ontop_alt, theme.bg_focus)
theme.titlebar_ontop_button_normal_inactive = render(icons.titlebar.ontop, theme.wibar_fg)
theme.titlebar_ontop_button_normal_inactive_hover = render(icons.titlebar.ontop, theme.bg_warning)
theme.titlebar_ontop_button_normal_inactive_press = render(icons.titlebar.ontop, theme.bg_focus)
-- Sticky button
theme.titlebar_sticky_button_focus_active = render(icons.titlebar.sticky_alt, theme.titlebar_fg_normal)
theme.titlebar_sticky_button_focus_active_hover = render(icons.titlebar.sticky_alt, theme.bg_success)
theme.titlebar_sticky_button_focus_active_press = render(icons.titlebar.sticky_alt, theme.bg_focus)
theme.titlebar_sticky_button_focus_inactive = render(icons.titlebar.sticky, theme.titlebar_fg_normal)
theme.titlebar_sticky_button_focus_inactive_hover = render(icons.titlebar.sticky, theme.bg_success)
theme.titlebar_sticky_button_focus_inactive_press = render(icons.titlebar.sticky, theme.bg_focus)
theme.titlebar_sticky_button_normal_active = render(icons.titlebar.sticky_alt, theme.titlebar_fg_normal)
theme.titlebar_sticky_button_normal_active_hover = render(icons.titlebar.sticky_alt, theme.bg_success)
theme.titlebar_sticky_button_normal_active_press = render(icons.titlebar.sticky_alt, theme.bg_focus)
theme.titlebar_sticky_button_normal_inactive = render(icons.titlebar.sticky, theme.titlebar_fg_normal)
theme.titlebar_sticky_button_normal_inactive_hover = render(icons.titlebar.sticky, theme.bg_success)
theme.titlebar_sticky_button_normal_inactive_press = render(icons.titlebar.sticky, theme.bg_focus)
-- Minimize button
theme.titlebar_minimize_button_normal = render(icons.titlebar.minimize, theme.titlebar_fg_normal)
theme.titlebar_minimize_button_normal_hover = render(icons.titlebar.minimize, theme.bg_warning)
theme.titlebar_minimize_button_focus = render(icons.titlebar.minimize, theme.titlebar_fg_normal)
theme.titlebar_minimize_button_focus_hover = render(icons.titlebar.minimize, theme.bg_warning)
theme.titlebar_minimize_button_focus_press = render(icons.titlebar.minimize, theme.bg_focus)
-- Maximize button
theme.titlebar_maximized_button_focus_active = render(icons.titlebar.maximize_alt, theme.titlebar_fg_normal)
theme.titlebar_maximized_button_focus_active_hover = render(icons.titlebar.maximize_alt, theme.bg_success)
theme.titlebar_maximized_button_focus_active_press = render(icons.titlebar.maximize_alt, theme.bg_focus)
theme.titlebar_maximized_button_focus_inactive = render(icons.titlebar.maximize, theme.titlebar_fg_normal)
theme.titlebar_maximized_button_focus_inactive_hover = render(icons.titlebar.maximize, theme.bg_success)
theme.titlebar_maximized_button_focus_inactive_press = render(icons.titlebar.maximize, theme.bg_focus)
theme.titlebar_maximized_button_normal_active = render(icons.titlebar.maximize_alt, theme.titlebar_fg_normal)
theme.titlebar_maximized_button_normal_active_hover = render(icons.titlebar.maximize_alt, theme.bg_success)
theme.titlebar_maximized_button_normal_active_press = render(icons.titlebar.maximize_alt, theme.bg_focus)
theme.titlebar_maximized_button_normal_inactive = render(icons.titlebar.maximize, theme.titlebar_fg_normal)
theme.titlebar_maximized_button_normal_inactive_hover = render(icons.titlebar.maximize, theme.bg_success)
theme.titlebar_maximized_button_normal_inactive_press = render(icons.titlebar.maximize, theme.bg_focus)
-- Close button
theme.titlebar_close_button_normal = render(icons.titlebar.close, theme.titlebar_fg_normal)
theme.titlebar_close_button_normal_hover = render(icons.titlebar.close_alt, theme.bg_error)
theme.titlebar_close_button_focus = render(icons.titlebar.close, theme.bg_error)
theme.titlebar_close_button_focus_hover = render(icons.titlebar.close_alt, theme.bg_error)
theme.titlebar_close_button_focus_press = render(icons.titlebar.close_alt, theme.bg_focus)
-- Launcher widget
theme.menu_button_icon = render(icons.wibars.main_menu, theme.wibar_fg, nil, 24)
-- Taglist widget
theme.taglist_fg_empty = theme.header_border_color
theme.taglist_bg_empty = theme.transparent
theme.taglist_fg_occupied = theme.header_fg
theme.taglist_bg_occupied = theme.transparent
theme.taglist_fg_focus = theme.header_fg
theme.taglist_bg_focus = theme.bg_focus
theme.taglist_fg_urgent = theme.header_fg
theme.taglist_bg_urgent = theme.bg_success
theme.taglist_bg_container = theme.transparent
theme.taglist_shape = button_shape
theme.taglist_squares_sel = nil
theme.taglist_squares_unsel = nil
-- Layout widget
theme.layout_cornerne = render(icons.layouts.cornerne, theme.wibar_fg, nil, 24)
theme.layout_cornernw = render(icons.layouts.cornernw, theme.wibar_fg, nil, 24)
theme.layout_cornerse = render(icons.layouts.cornerse, theme.wibar_fg, nil, 24)
theme.layout_cornersw = render(icons.layouts.cornersw, theme.wibar_fg, nil, 24)
theme.layout_dwindle = render(icons.layouts.dwindle, theme.wibar_fg, nil, 24)
theme.layout_fairh = render(icons.layouts.fairh, theme.wibar_fg, nil, 24)
theme.layout_fairv = render(icons.layouts.fairv, theme.wibar_fg, nil, 24)
theme.layout_floating = render(icons.layouts.floating, theme.wibar_fg, nil, 24)
theme.layout_fullscreen = render(icons.layouts.fullscreen, theme.wibar_fg, nil, 24)
theme.layout_magnifier = render(icons.layouts.magnifier, theme.wibar_fg, nil, 24)
theme.layout_max = render(icons.layouts.max, theme.wibar_fg, nil, 24)
theme.layout_spiral = render(icons.layouts.spiral, theme.wibar_fg, nil, 24)
theme.layout_tile = render(icons.layouts.tile, theme.wibar_fg, nil, 24)
theme.layout_tilebottom = render(icons.layouts.tilebottom, theme.wibar_fg, nil, 24)
theme.layout_tileleft = render(icons.layouts.tileleft, theme.wibar_fg, nil, 24)
theme.layout_tiletop = render(icons.layouts.tiletop, theme.wibar_fg, nil, 24)
-- Tasklist widget
theme.tasklist_fg_normal = theme.header_fg
theme.tasklist_bg_normal = theme.transparent
theme.tasklist_fg_focus = theme.header_fg
theme.tasklist_bg_focus = theme.bg_focus
theme.tasklist_fg_urgent = theme.header_fg
theme.tasklist_bg_urgent = theme.bg_success
theme.tasklist_fg_minimize = theme.header_border_color
theme.tasklist_bg_minimize = theme.transparent
theme.tasklist_sticky = ' '
theme.tasklist_ontop = ' '
theme.tasklist_above = ' '
theme.tasklist_below = ' '
theme.tasklist_floating = ' '
theme.tasklist_minimized = ' '
theme.tasklist_maximized = ' '
theme.tasklist_maximized_horizontal = ' '
theme.tasklist_maximized_vertical = ' '
theme.tasklist_button_width = dpi(200)
theme.tasklist_menu_width = dpi(160)
-- Systray widget
theme.bg_systray = theme.wibar_bg
theme.systray_icon_spacing = dpi(2)
theme.systray_visible_icon = render(icons.wibars.systray_visible, theme.wibar_fg, nil, 24)
theme.systray_hidden_icon = render(icons.wibars.systray_hidden, theme.wibar_fg, nil, 24)
-- Keyboard layout widget
theme.keyboard_layout_icon = render(icons.wibars.keyboard_layout, theme.wibar_fg, nil, 24)
-- Clock widget
theme.calendar_style = {
fg_color = theme.fg_color,
bg_color = theme.bg_color,
shape = button_shape,
padding = dpi(2),
border_color = theme.base_bg,
border_width = theme.border_width,
opacity = theme.opacity,
}
theme.calendar_normal_fg_color = theme.button_fg
theme.calendar_normal_bg_color = theme.button_bg
theme.calendar_normal_border_color = theme.button_border_color
theme.calendar_focus_fg_color = theme.fg_focus
theme.calendar_focus_bg_color = theme.bg_focus
theme.calendar_header_fg_color = theme.header_fg
theme.calendar_header_bg_color = theme.header_bg
theme.calendar_header_border_color = theme.header_border_color
theme.calendar_weekday_fg_color = theme.border_color_active
theme.calendar_weekday_bg_color = theme.button_bg
theme.calendar_weekday_border_color = theme.button_bg
-- Session widget
theme.session_button_icon = render(icons.wibars.session_menu, theme.wibar_fg, nil, 24)
theme.session_confirm_icon = render(icons.session.confirm, theme.fg_normal, nil, 24)
theme.session_cancel_icon = render(icons.session.cancel, theme.fg_normal, nil, 24)
-- Menus
theme.menu_button_width = dpi(32)
theme.menu_button_text = nil
theme.menu_fg_normal = theme.menubar_fg
theme.menu_bg_normal = theme.menubar_bg
theme.menu_border_width = theme.button_border_width
theme.menu_border_color = colors.mix(theme.menubar_fg, theme.menubar_bg, 0.15)
theme.menu_width = dpi(160)
theme.menu_height = dpi(24)
theme.menu_submenu = render(icons.menus.submenu, theme.wibar_fg, nil, 24)
theme.menu_submenu_icon = render(icons.menus.submenu, theme.wibar_fg, nil, 24)
-- Hotkeys popup
theme.hotkeys_fg = theme.fg_normal
theme.hotkeys_bg = theme.bg_normal
theme.hotkeys_label_fg = theme.fg_focus
theme.hotkeys_label_bg = theme.button_bg
theme.hotkeys_modifiers_fg = theme.bg_warning
theme.hotkeys_font = theme.font_bold
theme.hotkeys_description_font = theme.font
theme.hotkeys_border_color = theme.base_bg
theme.hotkeys_border_width = theme.border_width
theme.hotkeys_shape = button_shape
theme.hotkeys_group_margin = dpi(2)
-- Notifications
theme.notification_position = 'top_right'
theme.notification_width = dpi(320)
theme.notification_height = dpi(30)
theme.notification_icon_size = dpi(48)
theme.notification_font = theme.font
theme.notification_fg = theme.fg_normal
theme.notification_bg = theme.bg_normal
theme.notification_header_color = theme.wibar_bg
theme.notification_border_color = nil
theme.notification_border_width = dpi(0)
theme.notification_shape = button_shape
theme.notification_opacity = theme.opacity
theme.notification_padding = theme.useless_gap
theme.notification_spacing = theme.useless_gap
-- Tooltips
theme.tooltip_fg = theme.gtk.tooltip_fg_color
theme.tooltip_bg = theme.gtk.tooltip_bg_color
theme.tooltip_border_color = theme.base_bg
theme.tooltip_border_width = dpi(1)
theme.tooltip_font = theme.font
theme.tooltip_opacity = theme.opacity
theme.tooltip_gaps = dpi(2)
theme.tooltip_align = 'left'
-- Window snapping
theme.snapper_gap = theme.useless_gap
theme.snap_bg = theme.base_bg
theme.snap_border_width = theme.border_width
theme.snap_shape = button_shape
theme.default_icon = 'preferences-activities'
-- Awesome icon
theme.awesome_icon = assets.awesome_icon(theme.menu_height, theme.bg_focus, theme.fg_focus)
-- Main menu
theme.awesome_menu_icon = 'preferences-desktop'
-- Awesome menu
theme.awesome_about_icon = 'help-info'
theme.awesome_config_icon = 'systemsettings'
theme.awesome_manual_icon = 'system-help'
theme.awesome_hotkeys_icon = 'key_bindings'
theme.awesome_restart_icon = 'system-restart'
theme.awesome_exit_icon = 'system-log-out'
-- Session menu
theme.session_lock_icon = 'xfce-system-lock'
theme.session_exit_icon = 'xfsm-logout'
theme.session_reboot_icon = 'xfsm-reboot'
theme.session_suspend_icon = 'xfsm-suspend'
theme.session_poweroff_icon = 'xfsm-shutdown'
-- Wallpaper
theme.wallpaper = nil
--theme.wallpaper = '/usr/share/backgrounds/archlinux/landscape.jpg'
theme.wallpaper_fg = theme.fg_focus
theme.wallpaper_bg = colors.mix(theme.bg_focus, theme.fg_focus, 0.5)
--theme.wallpaper_markup = awesome.hostname
--theme.wallpaper_font = 'Monospace 64'
--theme.wallpaper_icon = nil
--theme.wallpaper_icon_size = dpi(128)
--theme.wallpaper_placement = 'centered'
--theme.wallpaper_margin = dpi(20)
-- Rofi
theme.rofi_fg = theme.fg_normal
theme.rofi_bg = theme.bg_normal
theme.rofi_focus = theme.bg_focus
theme.rofi_width = theme.menu_width*2
theme.rofi_radius = theme.border_radius
theme.rofi_font = theme.font
return theme
|
local mgn = mgn
mgn.AlarmLocations = {}
mgn.LightLocations = {}
if LMVector == nil then
return
end
local alarms = 0
local alarms_failed = {}
local function AddAlarmLocation(data)
alarms = alarms + 1
if not data.Position then
table.insert(alarms_failed, alarms)
return
end
data.Position = data.Position:pos()
table.insert(mgn.AlarmLocations, data)
end
-- Lobby
AddAlarmLocation({Position = LMVector(-606, 114, 258, "lobby_3", true), Normal = Vector (1, 0, 0)})
AddAlarmLocation({Position = LMVector(1172, -76, 106, "lobby_3", true), Normal = Vector (0, -1, 0)})
AddAlarmLocation({Position = LMVector(-267, 545, 883, "AutoInstance0sauna", true), Normal = Vector (0, 1, 0)})
AddAlarmLocation({Position = LMVector(-268, 730, 352, "bookstore", true), Normal = Vector (1, 0, 0)})
AddAlarmLocation({Position = LMVector(363, -136, 151, "shops", true), Normal = Vector (0, -1, 0)})
AddAlarmLocation({Position = LMVector(-316, -565, 163, "bookstore", true), Normal = Vector (1, 0, 0)})
AddAlarmLocation({Position = LMVector(-282, 870, -61, "bookstore", true), Normal = Vector (-0.73, 0.68, 0)})
AddAlarmLocation({Position = LMVector(884, -28, -195, "bookstore", true), Normal = Vector (1, 0, 0)})
AddAlarmLocation({Position = LMVector(-852, -568, -25, "cinm", true), Normal = Vector (-1, 0, 0)})
AddAlarmLocation({Position = LMVector(218, 712, 70, "hole", true), Normal = Vector (0, 1, 0)})
AddAlarmLocation({Position = LMVector(325, 252, -349, "shops", true), Normal = Vector (0, -1, 0)})
AddAlarmLocation({Position = LMVector(-760, 132, 75, "dond_entrance", true), Normal = Vector (0, -1, 0)})
AddAlarmLocation({Position = LMVector(-184, -99, 168, "cre", true), Normal = Vector (1, 0, 0)})
-- RP
AddAlarmLocation({Position = LMVector(1139, 845, -41, "land_rp", true), Normal = Vector(0, -1, 0)})
-- Fishing
AddAlarmLocation({Position = LMVector(-228, -1566, 75, "land_fish1", true), Normal = Vector(0, -1, 0)})
AddAlarmLocation({Position = LMVector(-77, -296, 205, "land_fish2", true), Normal = Vector(0, 1, 0)})
-- Soccer
AddAlarmLocation({Position = LMVector(-33, 174, 120, "soccer", true), Normal = Vector(0, -1, 0)})
-- Build
AddAlarmLocation({Position = LMVector(-74, -916, 2764, "land_vphys", true), Normal = Vector(1, 0, 0)})
AddAlarmLocation({Position = LMVector(-2195, 352, 2205, "Smooth", true), Normal = Vector(0, 1, 0)})
AddAlarmLocation({Position = LMVector(-10, 2704, 736, "Silo", true), Normal = Vector(0, 1, 0)})
AddAlarmLocation({Position = LMVector(-701, 0, 2160, "land_caves", true), Normal = Vector(-1, 0, 0)})
AddAlarmLocation({Position = LMVector(101, 482, 68, "bunker", true), Normal = Vector(0, 1, 0)})
AddAlarmLocation({Position = LMVector(-4498, -5020, 75, "land_rp", true), Normal = Vector(1, 0, 0)})
AddAlarmLocation({Position = LMVector(213, -3226, -11171, "AutoInstance0flood", true), Normal = Vector(0, 1, 0)})
-- Build basement
AddAlarmLocation({Position = LMVector(-964, -1068, 13, "classroom", true), Normal = Vector(0, 1, 0)})
-- Build caves
AddAlarmLocation({Position = LMVector(-3, -1840, -25, "Smooth", true), Normal = Vector (0, -1, 0)})
if #alarms_failed ~= 0 then
print("[MGN] Failed to add entries to list of alarm locations: " .. table.concat(alarms_failed, ", "))
end
local lights = 0
local lights_failed = {}
local function AddLightLocation(data)
lights = lights + 1
if not data.Position then
table.insert(lights_failed, lights)
return
end
data.Position = data.Position:pos()
table.insert(mgn.LightLocations, data)
end
-- Lobby
-- AddLightLocation({Position = LMVector(-663, -124, 322, "armory", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 150, Depth = 3000, SpriteSize = 32, LightCount = 30})
-- AddLightLocation({Position = LMVector(-667, -480, -4, "minigame", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 300, SpriteSize = 32, LightCount = 6})
-- AddLightLocation({Position = LMVector(-1349, 72, -4, "lobby", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 800, SpriteSize = 32, LightCount = 10})
-- AddLightLocation({Position = LMVector(-1808, -9, -4, "minigame", true), Angles = Angle(0, 0, 0), DoubleStriped = true, Width = 200, Depth = 3000, SpriteSize = 32, LightCount = 30})
-- AddLightLocation({Position = LMVector(-1911, 1268, -4, "lobby", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 200, Depth = 3000, SpriteSize = 32, LightCount = 30})
-- AddLightLocation({Position = LMVector(-329, -59, -4, "lobby", true), Angles = Angle(0, 180, 0), DoubleStriped = true, Width = 150, Depth = 3000, SpriteSize = 32, LightCount = 30})
-- AddLightLocation({Position = LMVector(-625, -302, -308, "land_theater", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 2200, SpriteSize = 32, LightCount = 30})
-- AddLightLocation({Position = LMVector(323, 327, -104, "land_theater", true), Angles = Angle(25, -180, 0), DoubleStriped = true, Width = 80, Depth = 500, SpriteSize = 32, LightCount = 10})
-- AddLightLocation({Position = LMVector(-44, 325, -223, "land_theater", true), Angles = Angle(25, 180, 0), DoubleStriped = true, Width = 80, Depth = 500, SpriteSize = 32, LightCount = 10})
-- AddLightLocation({Position = LMVector(-1, -72, -28, "club", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 1000, SpriteSize = 32, LightCount = 15})
-- AddLightLocation({Position = LMVector(-460, 4, -4, "sauna", true), Angles = Angle(0, 180, 0), DoubleStriped = true, Width = 50, Depth = 1000, SpriteSize = 32, LightCount = 15})
-- AddLightLocation({Position = LMVector(-500, 444, -51, "land_theater", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 1000, SpriteSize = 32, LightCount = 15})
-- AddLightLocation({Position = LMVector(-258, 1269, -37, "ccal", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 1000, SpriteSize = 32, LightCount = 15})
-- AddLightLocation({Position = LMVector(-2, -849, -576, "reactor", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 250, Depth = 500, SpriteSize = 32, LightCount = 6})
-- AddLightLocation({Position = LMVector(-4, -1820, -576, "reactor", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 70, Depth = 1000, SpriteSize = 32, LightCount = 10})
-- AddLightLocation({Position = LMVector(-314, 0, -4, "minigame", true), Angles = Angle(0, -180, 0), DoubleStriped = true, Width = 200, Depth = 1900, SpriteSize = 32, LightCount = 15})
-- AddLightLocation({Position = LMVector(-694, 719, 317, "armory", true), Angles = Angle(0, 0, 0), DoubleStriped = true, Width = 200, Depth = 500, SpriteSize = 32, LightCount = 6})
-- AddLightLocation({Position = LMVector(-1580, 1524, 4, "lobby", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 500, SpriteSize = 32, LightCount = 6})
-- AddLightLocation({Position = LMVector(-782, 1038, 4, "lobby", true), Angles = Angle(0, 180, 0), DoubleStriped = false, Width = 0, Depth = 1000, SpriteSize = 32, LightCount = 10})
-- AddLightLocation({Position = LMVector(-1148, 585, 4, "lobby", true), Angles = Angle(0, -90, 0), DoubleStriped = false, Width = 0, Depth = 2000, SpriteSize = 32, LightCount = 15})
-- Build
AddLightLocation({Position = LMVector(-1729, 1991, -206, "land_build", true), Angles = Angle(0, 180, 0), DoubleStriped = true, Width = 100, Depth = 2000, SpriteSize = 128, LightCount = 15})
AddLightLocation({Position = LMVector(-823, -109, 2156, "land_vphys", true), Angles = Angle(0, 180, 0), DoubleStriped = true, Width = 100, Depth = 2000, SpriteSize = 32, LightCount = 15})
AddLightLocation({Position = LMVector(-504, -1920, 1985, "classroom", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 500, SpriteSize = 32, LightCount = 6})
-- RP
AddLightLocation({Position = LMVector(1140, 521, -183, "land_rp", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 1000, SpriteSize = 64, LightCount = 10})
AddLightLocation({Position = LMVector(-1410, 331, -185, "land_rp", true), Angles = Angle(0, 0, 0), DoubleStriped = true, Width = 300, Depth = 10000, SpriteSize = 64, LightCount = 30})
AddLightLocation({Position = LMVector(3747, 328, -185, "land_rp", true), Angles = Angle(0, 180, 0), DoubleStriped = true, Width = 300, Depth = 10000, SpriteSize = 64, LightCount = 30})
-- Build basement
AddLightLocation({Position = LMVector(-422, -21, -55, "classroom", true), Angles = Angle(0, 180, 0), DoubleStriped = true, Width = 200, Depth = 1000, SpriteSize = 32, LightCount = 10})
AddLightLocation({Position = LMVector(-878, -348, -55, "classroom", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 200, Depth = 2000, SpriteSize = 32, LightCount = 15})
AddLightLocation({Position = LMVector(-202, -913, -55, "classroom", true), Angles = Angle(0, 0, 0), DoubleStriped = true, Width = 200, Depth = 2000, SpriteSize = 32, LightCount = 15})
AddLightLocation({Position = LMVector(-615, -46, -3, "land_vphys", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 100, Depth = 500, SpriteSize = 32, LightCount = 6})
AddLightLocation({Position = LMVector(419, -7, -4, "land_vphys", true), Angles = Angle(0, 180, 0), DoubleStriped = true, Width = 200, Depth = 1000, SpriteSize = 32, LightCount = 10})
-- Build
AddLightLocation({Position = LMVector(-7388, -1129, -112, "Beach", true), Angles = Angle(0, 0, 0), DoubleStriped = true, Width = 300, Depth = 10000, SpriteSize = 64, LightCount = 30})
AddLightLocation({Position = LMVector(-2141, -2138, -111, "Beach", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 300, Depth = 1000, SpriteSize = 64, LightCount = 10})
AddLightLocation({Position = LMVector(-2328, 3703, 2493, "classroom", true), Angles = Angle(0, 180, 0), DoubleStriped = true, Width = 300, Depth = 10000, SpriteSize = 64, LightCount = 30})
AddLightLocation({Position = LMVector(-4001, -7940, -179, "land_rp", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 300, Depth = 10000, SpriteSize = 64, LightCount = 30})
AddLightLocation({Position = LMVector(-5811, -2430, 2493, "classroom", true), Angles = Angle(0, 0, 0), DoubleStriped = true, Width = 300, Depth = 10000, SpriteSize = 64, LightCount = 30})
AddLightLocation({Position = LMVector(3440, 1350, -8, "bunker", true), Angles = Angle(0, 180, 0), DoubleStriped = true, Width = 300, Depth = 10000, SpriteSize = 64, LightCount = 30})
-- Fishing
AddLightLocation({Position = LMVector(182, -1306, 0, "land_fish1", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 1000, SpriteSize = 32, LightCount = 10})
AddLightLocation({Position = LMVector(-92, 13, -61, "land_fish2", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 100, Depth = 1000, SpriteSize = 32, LightCount = 10})
AddLightLocation({Position = LMVector(617, -847, 3, "land_fish2", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 500, SpriteSize = 32, LightCount = 6})
AddLightLocation({Position = LMVector(-77, -679, -61, "land_fish2", true), Angles = Angle(0, 0, 0), DoubleStriped = true, Width = 100, Depth = 500, SpriteSize = 32, LightCount = 6})
AddLightLocation({Position = LMVector(-2429, -800, -61, "land_fish2", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 200, Depth = 2000, SpriteSize = 32, LightCount = 15})
AddLightLocation({Position = LMVector(-2438, 550, -61, "land_fish2", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 200, Depth = 800, SpriteSize = 32, LightCount = 10})
AddLightLocation({Position = LMVector(25, -1635, -1, "land_fish1", true), Angles = Angle(0, 90, 0), DoubleStriped = true, Width = 100, Depth = 200, SpriteSize = 64, LightCount = 4})
AddLightLocation({Position = LMVector(-131, -686, 4, "land_fish1", true), Angles = Angle(0, -90, 0), DoubleStriped = true, Width = 100, Depth = 400, SpriteSize = 64, LightCount = 5})
if #lights_failed ~= 0 then
print("[MGN] Failed to add entries to list of lights locations: " .. table.concat(lights_failed, ", "))
end
|
-- Incremental live completion
vim.o.inccommand = "nosplit"
-- Set completeopt to have a better completion experience
vim.o.completeopt = "menuone,noselect"
-- Enable highlight on search
vim.o.hlsearch = true
-- highlight match while typing search pattern
vim.o.incsearch = true
-- Make line numbers default
vim.wo.number = true
-- Do not save when switching buffers
vim.o.hidden = true
-- Enable break indent
vim.o.breakindent = true
-- Use swapfiles
vim.o.swapfile = true
-- Save undo history
vim.o.undofile = true
vim.o.undolevels = 1000
-- Faster scrolling
vim.o.lazyredraw = true
-- Case insensitive searching UNLESS /C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Decrease update time
vim.o.updatetime = 250
vim.wo.signcolumn = "yes"
-- Decrease redraw time
vim.o.redrawtime = 100
-- Set true colors
vim.o.termguicolors = true
-- Disable intro message
vim.opt.shortmess:append("I")
-- Disable ins-completion-menu messages
vim.opt.shortmess:append("c")
-- Do not source the default filetype.vim
vim.g.did_load_filetypes = 1
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
vim.opt.whichwrap:append("<>hl")
-- Take indent for new line from previous line
vim.o.autoindent = true
vim.o.smartindent = true
-- GUI: Name(s) of font(s) to be used
vim.o.guifont = "Roboto Mono:h27"
-- Neovide config
vim.g.neovide_cursor_animation_length = 0.0
vim.g.neovide_cursor_trail_length = 0.0
-- Number of command-lines that are remembered
vim.o.history = 10000
-- Use menu for command line completion
vim.o.wildmenu = true
-- Enable wrap
vim.o.wrap = true
-- Wrap long lines at a blank
vim.o.linebreak = true
-- Highlight the current line
vim.o.cursorline = true
-- Autom. read file when changed outside of Vim
vim.o.autoread = true
-- Autom. save file before some action
vim.o.autowrite = true
-- Keep backup file after overwriting a file
vim.o.backup = true
-- Make a backup before overwriting a file
vim.o.writebackup = false
-- For opening splits on right or bottom.
vim.o.splitbelow = true
vim.o.splitright = true
-- Show cursor line and column in the status line
vim.o.ruler = true
-- Briefly jump to matching bracket if insert one
vim.o.showmatch = true
-- Use filetype.lua instead
vim.g.do_filetype_lua = 1
vim.g.did_load_filetypes = 0
-- Hide show current mode on status line
vim.o.showmode = false
-- Show absolute line number in front of each line
vim.o.relativenumber = false
-- Maximum height of the popup menu
vim.o.pumheight = 15
-- Minimum nr. of lines above and below cursor
vim.o.scrolloff = 5 -- could be 1
vim.o.sidescrolloff = 5
-- vim.o.display = 'lastline'
-- Ignore case when completing file names and directories.
vim.o.wildignorecase = true
-- Timeout on leaderkey
vim.o.ttimeout = true
vim.o.ttimeoutlen = 5
-- Timeout on mapped sequences
vim.o.timeout = true
vim.o.timeoutlen = 300
-- Show (partial) command in status line
vim.o.showcmd = false
-- Folding
vim.o.foldenable = false
vim.o.foldmethod = "expr"
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
-- Asyncrun automatically open quickfix window
vim.g.asyncrun_open = 6
-- Set directories for backup/swap/undo files and create them if necessary
local Path = require("plenary.path")
local swapdir = Path:new(Path.path.home .. "/.cache/nvim/swap/")
if not swapdir:exists() then
swapdir:mkdir()
end
vim.o.directory = tostring(swapdir)
local backupdir = Path:new(Path.path.home .. "/.cache/nvim/backup/")
if not backupdir:exists() then
backupdir:mkdir()
end
vim.o.backupdir = tostring(backupdir)
local undodir = Path:new(Path.path.home .. "/.cache/nvim/undo/")
if not undodir:exists() then
undodir:mkdir()
end
vim.o.undodir = tostring(undodir)
-- Disable some builtin providers
vim.g.loaded_python_provider = 0
vim.g.loaded_ruby_provider = 0
vim.g.loaded_perl_provider = 0
vim.g.loaded_node_provider = 0
-- Disable some builtin vim plugins
local disabled_built_ins = {
"2html_plugin",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
}
for _, plugin in pairs(disabled_built_ins) do
vim.g["loaded_" .. plugin] = 1
end
|
local opts = {
settings = {
Lua = {
diagnostics = {
globals = { "vim", "nvim" },
},
workspace = {
library = {
[require("utils").join_paths(get_runtime_dir(), "nvim", "lua")] = true,
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
}
return opts
|
-- Redis Cache module: Transparent subrequest-based caching layout for arbitrary nginx locations.
-- Auth: huangjingkai#foxmail.com
-- Date: 1398241561
-- [Configuration Start]
g_cache = {}
--[[
g_cache.err_return_page, There are several types of pages returned after failure:
1] connects to the redis server [error] to prevent the large flow impact on the back end and return to the page directly.
2] connects to the redis server [normal], but gets the key value [exception] and returns directly to the area.
3) Connect to the redis server [normal], but loop g_cache. search_count times, get the key value [nil] and return to the page directly.
4] to the backend request page, return the code is not 200 OK (currently only caching the page returning to 200ok).
]]
g_cache.err_return_page = "/503.html"
-- Sets the timeout (in ms) protection for subsequent operations, including the connect method.
g_cache.redis_timeout = 2000
--[[
Puts the current Redis connection immediately into the ngx_lua cosocket connection pool.
You can specify the max idle timeout (in ms) when the connection is in the pool and the maximal size of the pool every nginx worker process.
]]
g_cache.redis_max_idle_timeout = 60000
g_cache.redis_pool_size = 100
--[[
g_cache.search_count: Connect to the redis server, if the key value does not exist, and is not the first time the key value is queried, the number of loops obtained.
g_cache.search_sleep: Connect to the redis server. If the key value does not exist and is not the first time the key value is queried, the wait time for each loop is required.
g_cache.search_dict_exptime: Gets the key value for the first time, at least after that value, before the next query.
]]
g_cache.search_count = 5
g_cache.search_sleep = 0.4
g_cache.search_dict_exptime = 1
-- The default URI timeout time is used if the configuration file is not set.
g_cache.uri_default_exptime = 600
-- The header domain of the request to be deleted.
g_cache.req_header={
["Accept-Encoding"]=1,
}
-- The response header field contains the following, deletes if it belongs to delete, and does not cache if it belongs to no-cache.
g_cache.resp_header={
["ETag"]="delete",
["Content-Length"]="delete",
["Transfer-Encoding"]="no-cache",
["Set-Cookie"]="delete",
["Cookie"]="delete",
["Date"]="delete",
["Vary"]="delete",
["X-CACHE-S"]="no-cache"
}
-- The expiration time of redundant cache, default 3600s
g_cache.stale_cache_expire_time = 3600
-- Internally fixed string used to cache dynamically replace special content.
g_cache.internal_replace_str="<INTERNAL_REPLACE_STRING>"
-- redis Cache log level
g_cache.log_level=ngx.NOTICE
-- [Configuration End]
function errs(a,b,c)
ngx.log(ngx.WARN,a," ",b," ",c)
end
function redis_string_split(src, sub)
if src == nil or sub == nil then return; end
local output = {}
local i,j = string.find(src,sub)
if i == nil then return; end
return string.sub(src, 1, i-1), string.sub(src, j+1, -1)
end
function redis_get_stale_key(key)
if key == nil then return; end
local key_stale=key .. "_stale"
return key_stale
end
function redis_string_replace(src,repl_old,repl_new)
if src ~= nil and repl_old ~=nil and repl_new ~= nil then
local str_len=string.len(src)
local i,j=string.find(src,repl_old)
if i ~= nil then
if i == 1 then
return repl_new .. string.sub(src,j+1,-1)
elseif j == str_len then
return string.sub(src,1,i-1) .. repl_new
else
return string.sub(src,1,i-1) .. repl_new .. string.sub(src,j+1,-1)
end
else
ngx.log(g_cache.log_level,"[X-DCS]cant find repl_old=",repl_old,",repl_new=",repl_new)
end
end
return src;
--return string.gsub(src,repl_old,repl_new);
end
--[[
Description : try to find cache from redis and assemble HTTP response
Input Parameter : redis_inst,redis instance
key,specify cache key
expire, User expected expiration time
is_stale_cache, Does the user expect to make history caching?
status,specify ngx.header['X-DCS-STATUS']
Return Value : nil
Date : 1407227161
Author : lvguanglin
]]
function try_to_get_resp_from_redis(redis_inst,keys,expire,is_stale_cache,status)
-- calculates the difference between the maximum time of historical caching and the expected expiration time of users.
local stale_time = 0
if is_stale_cache and expire < g_cache.stale_cache_expire_time then
stale_time = g_cache.stale_cache_expire_time - expire
end
--BEGIN: Modified By lvguanglin, If the expiration time is stored as the historical cache expiration time, the Lua script is executed on Redis using the eval command to check whether the specified record has exceeded the user's expected expiration time. 1407227161
local res
local err
if stale_time > 0 then
res, err = redis_inst:eval("local left_t=redis.call('ttl',KEYS[1]) if left_t > 0 and left_t > tonumber(KEYS[2]) then return redis.call('get',KEYS[1]) else return nil end",2,keys,stale_time)
else
res, err = redis_inst:get(keys)
end
if not res then
ngx.log(ngx.ERR, "[X-DCS] failed to get keys: ", keys,",err:",err)
return false
end
--END
if res ~= ngx.null and type(res) == "string" then
local values = res
local headers, body = redis_string_split(values, '\n\n')
if headers ~= nil and body ~= nil then
local rt= {}
string.gsub(headers, '[^'..'\n'..']+', function(w) table.insert(rt, w) end )
for k,v in pairs(rt) do
local header_name, header_value = redis_string_split(v, ':')
ngx.header[header_name] = header_value
end
--BEGIN: Added by lvguanglin, When the cache hits, it determines whether cache replacement is necessary. 1407227161
local callback_val = ngx.var.callback_val
if callback_val ~= nil and callback_val ~= ngx.null and 0 < string.len(callback_val) then
ngx.log(g_cache.log_level,"[X-DCS]Redis Hit,need to replace before give body to user,callback_val=",callback_val)
body=redis_string_replace(body,g_cache.internal_replace_str,callback_val)
end
--END
local ok, err = redis_inst:set_keepalive(g_cache.redis_max_idle_timeout, g_cache.redis_pool_size)
if not ok then
ngx.log(ngx.ERR, "[X-DCS] failed to set keepalive", err )
end
ngx.header['X-DCS-STATUS'] = status
ngx.header["pragma"]="no-cache"
ngx.header["cache-control"]="no-cache, no-store, max-age=0"
ngx.print(body)
ngx.exit(ngx.HTTP_OK)
end
end
return true
end
--[[
Description : try to find history cache from redis
Input Parameter : redis_inst, redis instance
key,specify cache key
status,specify ngx.header['X-DCS-STATUS']
Return Value : nil
Date : 1407227161
Author : lvguanglin
]]
function try_to_get_stale_resp_from_redis(redis_inst,key,status)
-- Here we want to read the history buffer, so the expired time passes the expiration time of the historical cache.
return try_to_get_resp_from_redis(redis_inst,key,g_cache.stale_cache_expire_time,true,status)
end
ngx.log(ngx.WARN, '[X-DCS] nginx redis script start.')
|
-------------------
-- Warrior class --
-------------------
--
-- See https://github.com/Ombridride/minetest-minetestforfun-server/issues/113
--
pclasses.api.register_class("warrior", {
on_assigned = function(pname, inform)
if inform then
minetest.sound_play("pclasses_full_warrior", {to_player=pname, gain=1})
minetest.chat_send_player(pname, "You are now a warrior")
end
sprint.set_maxstamina(pname, 20)
minetest.log("action", "[PClasses] Player " .. pname .. " becomes a warrior")
end,
on_unassigned = function(pname)
sprint.set_default_maxstamina(pname)
end,
switch_params = {
color = {r = 06, g = 06, b = 30},
tile = "default_steel_block.png",
holo_item = "default:dungeon_master_s_blood_sword"
},
informations = pclasses.api.textify("'Warriors' is a class of players designed to improve fighting parameters of players who" ..
"chose to belong to it. You become a big tank, of human shape. Not only can you wear" ..
"stronger protections (like the Black Mithril armor's pieces, because Black Mithril is a thing" ..
"here), and use more powerful hand-to-hand weapons (such as the Dungeon Master's" ..
"blood sword, because yes, you are going to fight Dungeon Masters and drain their blood)," ..
"but your stamina bar is boosted up to 20! Trust us, running away is an important part" ..
"of fighting a Dungeon Master. Being a warrior, you regenerate health faster, which is," ..
"again, quite handy, at the cost of needing to eat more frequently (less handy). The" ..
"pedestal tied to the Warriors' includes the strongest sword, available only to Warriors :" ..
"the Dungeon Master's Blood Sword. It just looks like what you imagine, just" ..
"more pixel-ish.") .. "image[2.4,5.6;6,4;pclasses_showcase_warrior.png]"
})
pclasses.api.reserve_item("warrior", "default:sword_mithril")
pclasses.api.reserve_item("warrior", "default:dungeon_master_s_blood_sword")
for _, i in pairs({"helmet", "chestplate", "boots", "leggings"}) do
pclasses.api.reserve_item("warrior", "3d_armor:" .. i .. "_blackmithril")
pclasses.api.reserve_item("warrior", "3d_armor:" .. i .. "_mithril")
end
pclasses.api.reserve_item("warrior", "shields:shield_mithril")
pclasses.api.reserve_item("warrior", "shields:shield_blackmithril")
|
if GetLocale() ~= "deDE" then return end
local _, addon = ...
local L = addon.L |
local partitionstatus = [[
{
"id": "partyvoice23922.partitionStatus",
"version": 1,
"status": "proposed",
"name": "Partition Status",
"attributes": {
"partStatus": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 16
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setPartStatus",
"enumCommands": []
}
},
"commands": {
"setPartStatus": {
"name": "setPartStatus",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string",
"maxLength": 16
}
}
]
}
}
}
]]
local dscdashswitch = [[
{
"id": "partyvoice23922.dscdashswitch",
"version": 1,
"status": "proposed",
"name": "dscdashswitch",
"attributes": {
"switch": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setSwitch",
"enumCommands": []
}
},
"commands": {
"setSwitch": {
"name": "setSwitch",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string"
}
}
]
}
}
}
]]
local ledstatus = [[
{
"id": "partyvoice23922.ledStatus",
"version": 1,
"status": "proposed",
"name": "LED Status",
"attributes": {
"ledStatus": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 30
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setledStatus",
"enumCommands": []
}
},
"commands": {
"setledStatus": {
"name": "setledStatus",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string",
"maxLength": 30
}
}
]
}
}
}
]]
local dscstayswitch = [[
{
"id": "partyvoice23922.dscstayswitch",
"version": 1,
"status": "proposed",
"name": "dscstayswitch",
"attributes": {
"switch": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setSwitch",
"enumCommands": []
}
},
"commands": {
"setSwitch": {
"name": "setSwitch",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string"
}
}
]
}
}
}
]]
local dscawayswitch = [[
{
"id": "partyvoice23922.dscawayswitch",
"version": 1,
"status": "proposed",
"name": "dscawayswitch",
"attributes": {
"switch": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setSwitch",
"enumCommands": []
}
},
"commands": {
"setSwitch": {
"name": "setSwitch",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string"
}
}
]
}
}
}
]]
local partitioncommand = [[
{
"id": "partyvoice23922.partitioncommand",
"version": 1,
"status": "proposed",
"name": "partitionCommand",
"attributes": {
"partitionCommand": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 16
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setPartitionCommand",
"enumCommands": []
}
},
"commands": {
"setPartitionCommand": {
"name": "setPartitionCommand",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string",
"maxLength": 16
}
}
]
}
}
}
]]
local dscselectswitch = [[
{
"id": "partyvoice23922.dscselectswitch",
"version": 1,
"status": "proposed",
"name": "dscselectswitch",
"attributes": {
"switch": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setSwitch",
"enumCommands": []
}
},
"commands": {
"setSwitch": {
"name": "setSwitch",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string"
}
}
]
}
}
}
]]
local contactstatus = [[
{
"id": "partyvoice23922.contactstatus",
"version": 1,
"status": "proposed",
"name": "contactStatus",
"attributes": {
"contactStatus": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 16
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setContactStatus",
"enumCommands": []
}
},
"commands": {
"setContactStatus": {
"name": "setContactStatus",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string",
"maxLength": 16
}
}
]
}
}
}
]]
local motionstatus = [[
{
"id": "partyvoice23922.motionstatus",
"version": 1,
"status": "proposed",
"name": "motionStatus",
"attributes": {
"motionStatus": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 16
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setMotionStatus",
"enumCommands": []
}
},
"commands": {
"setMotionStatus": {
"name": "setMotionStatus",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string",
"maxLength": 16
}
}
]
}
}
}
]]
local smokestatus = [[
{
"id": "partyvoice23922.smokestatus",
"version": 1,
"status": "proposed",
"name": "smokestatus",
"attributes": {
"smokeStatus": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 16
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"enumCommands": []
}
},
"commands": {}
}
]]
local costatus = [[
{
"id": "partyvoice23922.costatus",
"version": 1,
"status": "proposed",
"name": "costatus",
"attributes": {
"coStatus": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 16
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"enumCommands": []
}
},
"commands": {}
}
]]
local waterstatus = [[
{
"id": "partyvoice23922.waterstatus",
"version": 1,
"status": "proposed",
"name": "waterstatus",
"attributes": {
"waterStatus": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 16
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"enumCommands": []
}
},
"commands": {}
}
]]
local zonebypass = [[
{
"id": "partyvoice23922.zonebypass",
"version": 1,
"status": "proposed",
"name": "zoneBypass",
"attributes": {
"zoneBypass": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"maxLength": 16
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setZoneBypass",
"enumCommands": []
}
},
"commands": {
"setZoneBypass": {
"name": "setZoneBypass",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string",
"maxLength": 16
}
}
]
}
}
}
]]
return {
partitionstatus = partitionstatus,
dscdashswitch = dscdashswitch,
ledstatus = ledstatus,
dscstayswitch = dscstayswitch,
dscawayswitch = dscawayswitch,
partitioncommand = partitioncommand,
dscselectswitch = dscselectswitch,
contactstatus = contactstatus,
motionstatus = motionstatus,
smokestatus = smokestatus,
costatus = costatus,
waterstatus = waterstatus,
zonebypass = zonebypass,
}
|
-- MTE "CASTLE DEMO" ----------------------------------------------------------
display.setStatusBar( display.HiddenStatusBar )
local composer = require("composer")
local myData = require("mydata")
myData.prevMap = nil
myData.nextMap = "map1"
--SETUP D-PAD ------------------------------------------------------------
myData.controlGroup = display.newGroup()
myData.DpadBack = display.newImageRect(myData.controlGroup, "Dpad.png", 100, 100)
myData.DpadBack.x = 70
myData.DpadBack.y = display.viewableContentHeight - 70
myData.DpadUp = display.newRect(myData.controlGroup, myData.DpadBack.x - 0, myData.DpadBack.y - 31, 33, 33)
myData.DpadDown = display.newRect(myData.controlGroup, myData.DpadBack.x - 0, myData.DpadBack.y + 31, 33, 33)
myData.DpadLeft = display.newRect(myData.controlGroup, myData.DpadBack.x - 31, myData.DpadBack.y - 0, 33, 33)
myData.DpadRight = display.newRect(myData.controlGroup, myData.DpadBack.x + 31, myData.DpadBack.y - 0, 33, 33)
myData.DpadBack:toFront()
composer.gotoScene("scene")
|
--[--[--------------------]--]--
-- Project: Pong --
-- File: timer.lua --
-- --
-- Author: Gabyfle --
-- License: Apache 2.0 --
--]--]--------------------[--[--
local timer = {
_timers = {}
}
--- Waits sec seconds
-- took from Lua wiki http://lua-users.org/wiki/SleepFunction
-- @param number sec: seconds to sleep
local function sleep(sec)
local to = os.time() + sec
repeat until os.time() > to
end
local function delayer(wait)
local now = os.time()
local delay = os.difftime(os.time(), now)
while delay < wait do
coroutine.yield(delay)
delay = os.difftime(os.time(), now)
end
end
--- Waits "delay" seconds before calling "callback"
-- @param string name: name of the coroutine
-- @param number delay: delay to wait before calling "callback"
-- @param function callback: function that has to be called right after the timer has ended
function timer:create(name, delay, callback, ...)
if self._timers[name] then
error('A timer with name ' .. name .. ' has already been created')
end
self._timers[name] = coroutine.create(delayer)
coroutine.resume(self._timers[name], delay)
while coroutine.status(self._timers[name]) ~= 'dead' do
if coroutine.status(self._timers[name]) == 'suspended' then
coroutine.resume(self._timers[name])
sleep(1)
end
end
-- launch the callback
callback(...)
end
--- Completely stops a timer
function timer:stop(name)
if not self._timers[name] then return end
self._timers[name] = nil
end
--- Repeats a "callback" call "repeatitions" times every "delay" seconds
-- @param string name: name of the timer
-- @param number repeatitions: number of times to repeat the process
-- @param number delay: delay between each repeatition
-- @param function callback: callback function to call right after a repeatition ended
function timer:regular(name, repeatitions, delay, callback, ...)
if self._timers[name] then return end
self._timers[name] = {
repeats = repeatitions,
thread = coroutine.create(delayer)
}
while self._timers[name].repeats do
coroutine.resume(self._timers[name].thread, delay)
while coroutine.status(self._timers[name].thread) ~= 'dead' do
if coroutine.status(self._timers[name].thread) == 'suspended' then
coroutine.resume(self._timers[name].thread)
sleep(0.01)
end
end
--- we give to callback the number of left repeatitions
self._timers[name].repeats = self._timers[name].repeats - 1
callback(self._timers[name].repeats, ...)
end
end
--- Returns whether or not a timer does exist
-- @param string name: name of the timer
-- @return bool
function timer:exists(name)
if self._timers[name] then
return true
else
return false
end
end
return timer
|
local tasks = require("tasks")
print("Active Processes:")
print("Uptime: " .. computer.uptime() .. " seconds")
coroutine.yield() -- let time to update metrics
local total = 0
for _, pid in pairs(tasks.getPIDs()) do
local m = tasks.getProcessMetrics(pid)
print("\t" .. m.name .. " - PID = " .. pid .. " - CPU time: " .. m.cpuTime .. "ms - CPU load: " .. tostring(m.cpuLoadPercentage):sub(1,5) .. "%" .. " - Status: " .. m.status:upper())
total = total + m.cpuLoadPercentage
end
print("Total CPU load: " .. tostring(total):sub(1,5) .. "%")
|
local main = require(game.Nanoblox)
local UserStore = require(main.shared.Packages.UserStore)
local PlayerStore = UserStore.new("Nanoblox 0001")
return PlayerStore |
-- Port of https://github.com/rhysbrettbowen/promise_impl/blob/master/promise.js
-- and https://github.com/rhysbrettbowen/Aplus
--
local pack = table.pack or _G.pack
local queue = {}
local State = {
PENDING = 'pending',
FULFILLED = 'fulfilled',
REJECTED = 'rejected',
}
local passthrough = function(x) return x end
local errorthrough = function(x) error(x) end
local function callable_table(callback)
local mt = getmetatable(callback)
return type(mt) == 'table' and type(mt.__call) == 'function'
end
local function is_callable(value)
local t = type(value)
return t == 'function' or (t == 'table' and callable_table(value))
end
local transition, resolve, run
local Promise = {}
local prototype = {
is_promise = true,
state = State.PENDING
}
local mt = { __index = prototype }
local do_async = function(callback)
if Promise.async then
Promise.async(callback)
else
table.insert(queue, callback)
end
end
local reject = function(promise, reason)
transition(promise, State.REJECTED, reason)
end
local fulfill = function(promise, value)
transition(promise, State.FULFILLED, value)
end
transition = function(promise, state, value)
if promise.state == state
or promise.state ~= State.PENDING
or ( state ~= State.FULFILLED and state ~= State.REJECTED )
then
return
end
promise.state = state
promise.value = value
run(promise)
end
function prototype:next(on_fulfilled, on_rejected)
local promise = Promise.new()
table.insert(self.queue, {
fulfill = is_callable(on_fulfilled) and on_fulfilled or nil,
reject = is_callable(on_rejected) and on_rejected or nil,
promise = promise
})
run(self)
return promise
end
resolve = function(promise, x)
if promise == x then
reject(promise, 'TypeError: cannot resolve a promise with itself')
return
end
local x_type = type(x)
if x_type ~= 'table' then
fulfill(promise, x)
return
end
-- x is a promise in the current implementation
if Promise.is_promise(x) then
-- 2.3.2.1 if x is pending, resolve or reject this promise after completion
if x.state == State.PENDING then
x:next(
function(value)
resolve(promise, value)
end,
function(reason)
reject(promise, reason)
end
)
return
end
-- if x is not pending, transition promise to x's state and value
transition(promise, x.state, x.value)
return
end
local called = false
-- 2.3.3.1. Catches errors thrown by __index metatable
local success, reason = pcall(function()
local next = x.next
if is_callable(next) then
next(
x,
function(y)
if not called then
resolve(promise, y)
called = true
end
end,
function(r)
if not called then
reject(promise, r)
called = true
end
end
)
else
fulfill(promise, x)
end
end)
if not success then
if not called then
reject(promise, reason)
end
end
end
run = function(promise)
if promise.state == State.PENDING then return end
do_async(function()
-- drain promise.queue while allowing pushes from within callbacks
local q = promise.queue
local i = 0
while i < #q do
i = i + 1
local obj = q[i]
local success, result = pcall(function()
local success = obj.fulfill or passthrough
local failure = obj.reject or errorthrough
local callback = promise.state == State.FULFILLED and success or failure
return callback(promise.value)
end)
if not success then
reject(obj.promise, result)
else
resolve(obj.promise, result)
end
end
for j = 1, i do
q[j] = nil
end
end)
end
function prototype:catch(callback)
return self:next(nil, callback)
end
function prototype:resolve(value)
fulfill(self, value)
end
function prototype:reject(reason)
reject(self, reason)
end
function Promise.new(callback)
local instance = {
queue = {}
}
setmetatable(instance, mt)
if callback then
callback(
function(value)
resolve(instance, value)
end,
function(reason)
reject(instance, reason)
end
)
end
return instance
end
function Promise.is_promise(value)
if type(value) ~= "table" then return end
return value.is_promise
end
function Promise.resolve(value)
return Promise.new(function(resolve, reject)
resove(value)
end)
end
function Promise.reject(reason)
return Promise.new(function(resolve, reject)
reject(reason)
end)
end
function Promise.update()
while true do
local async = table.remove(queue, 1)
if not async then
break
end
async()
end
end
local function get_promises(...)
local args = pack(...)
if args.n == 1 and type(args[1]) == "table" and not Promise.is_promise(args[1]) then
return args[1]
end
return args
end
-- resolve when all promises complete
-- see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
function Promise.all(...)
local promises = get_promises(...)
local results = {}
local state = State.FULFILLED
local n = promises.n or #promises
local remaining = n
local promise = Promise.new()
local check_finished = function()
if remaining > 0 then
return
end
transition(promise, state, results)
end
for i = 1, n do
local p = promises[i]
if Promise.is_promise(p) then
p:next(
function(value)
results[i] = value
remaining = remaining - 1
check_finished()
end,
function(reason)
reject(promise, reason)
end
)
else
results[i] = p
remaining = remaining - 1
end
end
check_finished()
return promise
end
-- resolves after all of the given promises have either fulfilled or rejected,
-- with an array of objects that each describes the outcome of each promise.
-- see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled
function Promise.all_settled(...)
local promises = get_promises(...)
local results = {}
local n = promises.n or #promises
local remaining = n
local promise = Promise.new()
if remaining <= 0 then
fulfill(promise, results)
return promise
end
local check_finished = function()
if remaining > 0 then
return
end
fulfill(promise, results)
end
for i = 1, n do
local p = promises[i]
if Promise.is_promise(p) then
p:next(
function(value)
results[i] = { status = State.FULFILLED, value = value }
remaining = remaining - 1
check_finished()
end,
function(reason)
results[i] = { status = State.REJECTED, reason = reason }
remaining = remaining - 1
check_finished()
end
)
else
results[i] = { status = State.FULFILLED, value = p }
remaining = remaining - 1
end
end
check_finished()
return promise
end
-- resolve when any promises complete, reject when all promises are rejected
-- see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any
function Promise.any(...)
local promises = get_promises(...)
local state = State.FULFILLED
local n = promises.n or #promises
local remaining = n
local promise = Promise.new()
for i = 1, n do
local p = promises[i]
if Promise.is_promise(p) then
p:next(
function(value)
fulfill(promise, value)
end,
function(reason)
remaining = remaining - 1
if remaining <= 0 then
reject(promise, "AggregateError: All promises were rejected")
end
end
)
else
-- resolve immediately if a non-promise provided
fulfill(promise, p)
break
end
end
return promise
end
-- returns a promise that fulfills or rejects as soon as one of the promises in an iterable fulfills or rejects,
-- with the value or reason from that promise
-- see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/race
function Promise.race(...)
local promises = get_promises(...)
local promise = Promise.new()
local n = promises.n or #promises
local success = function(value)
promise:resolve(value)
end
local fail = function(reason)
promise:reject(reason)
end
for i = 1, n do
local p = promises[i]
if Promise.is_promise(p) then
p:next(success, fail)
else
-- resolve immediately if a non-promise provided
promise:resolve(p)
break
end
end
return promise
end
return Promise
|
-- local ObjcharacterReference = require "objects.ObjcharacterReference"
-- local Objcharacter = require "objects.Objcharacter"
local ObjWorldManager = Class.create("ObjWorldManager", Entity)
local STI = require "libs.sti"
function ObjWorldManager:create()
Game.worldManager = self
self.roomNodes = {}
self.characters = {}
self.timeEvents = {}
self.totalTime = 0
self.timeInRoom = 0
self.worldMapCreated = false
self.roomObjects = {}
self.map = self.map or {}
self.spawnZones = {}
-- local permanentObjects = require("")
-- for i,v in ipairs(permanentObjects) do
-- print(i,v)
-- end
end
function ObjWorldManager:onRoomLoad( roomName, prevRoomName )
-- lume.trace(self.worldMapCreated)
self.timeInRoom = 0
self.currentRoom = roomName
self.spawnZones[roomName] = {}
-- lume.trace(roomName, prevRoomName)
if not self.worldMapCreated then
self:createWorldMap(roomName)
end
for i,v in ipairs(self.characters) do
if v.currentRoom ~= roomName then
v.offScreen = true
else
v.offScreen = false
end
end
end
function ObjWorldManager:roombegin()
self:recreateAllChars()
end
function ObjWorldManager:recreateAllChars()
-- lume.trace(self.currentRoom)
if self.roomObjects[self.currentRoom] then
for _,object in ipairs(self.roomObjects[self.currentRoom]) do
self:recreateCharacter(object)
end
end
end
function ObjWorldManager:recreateCharacter( character )
if not Game.entities[character] and not character:hasModule("ModControllable") then
local class = require("objects." .. character.type)
local inst = class()
inst.name, inst.x, inst.y = character.name, character.x, character.y
inst.width, inst.height = 0,0
inst.offScreen = false
if inst.moving and self.spawnZones then
end
Game:add(inst)
inst:onReturnScreen()
util.deleteFromTable(self.roomObjects[self.currentRoom], character)
table.insert(self.roomObjects[self.currentRoom],inst)
end
end
function ObjWorldManager:nearestSpawnPoint( character,room )
-- body
end
function ObjWorldManager:createWorldMap( startingRoom )
self.map = {}
self.worldMapCreated = true
-- lume.trace(startingRoom)
-- self:processRoom(startingRoom)
end
function ObjWorldManager:processRoom( roomName )
if not self.map[roomName] then
local roomInfo = {}
roomInfo.connectedRooms = {}
roomInfo.exits = {}
lume.trace(roomName)
local newMap = STI.new(roomName)
self.map[roomName] = roomInfo
for _,layer in ipairs(newMap.layers) do
if layer.type == "objectgroup" then
for _,object in pairs(layer.objects) do
if object.type == "ObjRoomChanger" then
local props = object.properties
local newExit = {}
newExit.pos = {x=object.x,y=object.y}
local newRoomName = "assets/rooms/".. props.nextRoom .. (props.nextZone or "")
roomInfo.connectedRooms[newRoomName] = true
local exName = "R:"..newRoomName.."X:"..newExit.pos.x.."Y:"..newExit.pos.y
if not self.map[newRoomName] then
self:processRoom(newRoomName)
end
newExit.nextRoom = newRoomName
newExit.nextPos = {x=props.nextX * 32 + 16,y=props.nextY * 32}
newExit.intConns = {}
for k,v in pairs(roomInfo.exits) do
local otherRoom = v.nextRoom
if otherRoom ~= newRoomName and v.zone == newExit.zone then
if not v.intConns[newRoomName] then
v.intConns[newRoomName] = {}
v.intConns[newRoomName].dist = 999999
end
if not newExit.intConns[otherRoom] then
newExit.intConns[otherRoom] = {}
newExit.intConns[otherRoom].dist = 999999
end
local dist = xl.distance(newExit.pos.x,newExit.pos.y,exit.pos.x,exit.pos.y)
if dist < v.intConns[newRoomName].dist then
v.intConns[newRoomName].dist = dist
v.intConns[newRoomName].exit = exName
end
if dist < nextRoom.intConns[otherRoom].dist then
newExit.intConns[otherRoom].dist = dist
newExit.intConns[otherRoom].exit = k
end
end
end
roomInfo.exits[exName] = newExit
end
end
end
end
end
end
function ObjWorldManager:pathToPoint( startingRoom, startPos, goalRoom )
lume.trace("initializing A star Room search")
goalRoom = "assets/rooms/"..goalRoom
lume.trace(goalRoom)
-- The set of nodes already evaluated.
local closedSet = {}
local openSet = {}
local cameFrom = {}
local start = {}
start = self:nearest(self.map[startingRoom].exits,{x=startPos.x,y=startPos.y})
start.room = startingRoom
start.gScore = 0
start.fScore = self:heuristicAstar(startingRoom,goalRoom)
start.cameFrom = nil
table.insert(openSet,start)
local newIteration = 0
while (table.getn(openSet) > 0) do
local minI = 0
local minVal = 999999
for i,v in ipairs(openSet) do
local newScore = v.fScore
if newScore < minVal then
minI = i
minVal = newScore
end
end
local current = openSet[minI]
if current.nextRoom == goalRoom then
return xl.reconstructPath(current)
end
table.remove(openSet,minI)
table.insert(closedSet,current)
local neighbors = self:getNeighbors(current)
for i,room in ipairs(neighbors) do
if not self:hasRoom(closedSet,room) then
local tentative_gScore = current.gScore + room.dist
if not self:hasRoom(openSet,room) then
table.insert(openSet, room)
v.cameFrom = current
local newValue = {}
v.gScore = tentative_gScore
v.fScore = v.gScore + self:heuristicAstar(startingRoom, goalRoom)
end
end
end
newIteration = newIteration + 1
if newIteration > 500 then
lume.trace()
break
end
end
return false
end
function ObjWorldManager:nearest( set, point )
local curNearest = nil
local curMinDist = 999999
for k,v in pairs(set) do
if xl.distance(point.x,point.y,v.pos.x,v.pos.y) < curMinDist then
curMinDist = xl.distance(point.x,point.y,v.pos.x,v.pos.y)
curNearest = v
end
end
return curNearest
end
function ObjWorldManager:getNeighbors( curExit )
--local curExit = self:nearest(curRoom.exits,position)
local neighbors = {}
local nextExit = self.nearest(self.map[curExit.nextRoom],curExit.nextPos)
nextExit.dist = 0
table.insert(neighbors,nextExit)
--lume.trace(#curExit.intConns)
for k,v in pairs(curExit.intConns) do
lume.trace(k)
local newRoom = v --{room=k, dist=curRoom.intConns[k].dist, exit=curRoom.intConns[k].exit}
newRoom.room = k
table.insert(neighbors,newRoom)
end
return neighbors
end
function ObjWorldManager:hasRoom( set, node )
for i,v in ipairs(set) do
if v.room == node.room and node.pos.x == v.pos.x and node.pos.x == v.pos.x then
return true
end
end
return false
end
function ObjWorldManager:heuristicAstar( startNode,endNode )
return 1
end
function ObjWorldManager:addCharacter( character , roomName)
character.currentRoom = roomName or Game.roomName
character.timeStartedInRoom = self.totalTime
if roomName ~= self.currentRoom then
self.offScreen = true
else
self.offScreen = false
end
self.characters[character.name] = character
if not self.roomObjects[roomName] then self.roomObjects[roomName] = {} end
table.insert(self.roomObjects[roomName], character)
end
function ObjWorldManager:moveCharacter( character, newRoom )
for k,v in pairs(self.roomObjects) do
print(k,v)
end
-- character:respondToEvent("roomChange",{room=newRoom})
if self.roomObjects[character.currentRoom] then
util.deleteFromTable(self.roomObjects[character.currentRoom],character)
end
if character.currentRoom == self.currentRoom and character ~= Game.player then
self.offScreen = true
Game:del(character)
character.currentRoom = newRoom
character:onExitScreen()
end
character.currentRoom = newRoom
if character.currentRoom == self.currentRoom then
self:recreateCharacter(character)
end
character.timeStartedInRoom = self.totalTime
if not self.roomObjects[newRoom] then
self.roomObjects[newRoom] = {}
end
table.insert(self.roomObjects[newRoom],character)
end
function ObjWorldManager:tick( dt )
self.timeInRoom = self.timeInRoom + dt
self.totalTime = self.totalTime + dt
for k,v in pairs(self.characters) do
if v.offScreen == true then
v:offScreenTick(dt)
end
end
local timeKey = "T:"..math.floor(self.totalTime)
if self.timeEvents[timeKey] then
for i,v in ipairs(self.timeEvents[timeKey]) do
v()
end
self.timeEvents[timeKey] = nil
end
end
function ObjWorldManager:getTime()
return self.totalTime
end
function ObjWorldManager:addEvent( time, events, relative )
local eventTime = math.floor(time)
if relative then eventTime = math.floor(self.totalTime) + eventTime end
local timeKey = "T:"..eventTime
self.timeEvents[timeKey] = self.timeEvents[timeKey] or {}
if type(events) == "function" then
table.insert(self.timeEvents[timeKey],events)
else
for i,v in ipairs(events) do
table.insert(self.timeEvents[timeKey],v)
end
end
return timeKey
end
function ObjWorldManager:cancelEvent( timeKey,events )
local eventTime = self.timeEvents[timeKey]
if not eventTime then
else
if type(events) == "function" then
util.deleteFromTable(eventTime,events)
else
for i,v in ipairs(events) do
util.deleteFromTable(eventTime,v)
end
end
end
end
function ObjWorldManager:getCharacters()
local entities = Game:findObjects()
end
function ObjWorldManager:setWorldGen( worldgen )
self.worldGen = worldgen
end
function ObjWorldManager:respawnFromDeath(character)
-- character.body:setLinearVelocity(0, 400)
-- local x = Game.savedata["last_X"]
-- local y = Game.savedata["last_Y"]
-- -- lume.trace(Game.savedata["last_room"])
-- self:loadRoom(Game.savedata["last_room"])
-- character:setPosition(x,y)
-- local function respawn( player, count )
-- player:changeAnimation("crouch")
-- player.invincibleTime = 2
-- player:setSprColor(255,255,255,count * 2)
-- player.body:setLinearVelocity(0,1)
-- if count >= 80 then
-- player:setSprColor(255,255,255,255)
-- player.exit = true
-- end
-- end
-- character.health = character.max_health
-- character:setSpecialState(respawn,false,true)
end
function ObjWorldManager:loadRoom( name , dir, prevX, prevY,newX,newY)
-- local function loadRoom( player, count )
-- player.invincibleTime = 2
-- player.body:setLinearVelocity(0,0)
-- if count >= 128 then
-- if self.worldGen then
-- self.worldGen:loadRoom(name , dir, prevX, prevY,newX,newY)
-- else
-- Game:loadRoom(name)
-- end
-- end
-- end
-- Game.player:setSpecialState(loadRoom)
--self:fade(1)
--self:flash(1)
if self.worldGen then
lume.trace(name)
self.worldGen:loadRoom(name , dir, prevX, prevY,newX,newY)
else
Game:loadRoom(name)
end
end
return ObjWorldManager |
--[[--------------------------------------------------
GUI Editor
client
titlebar_button.lua
adds titlebar buttons to gui windows
(ie: hover buttons that sit within the title bar of a window, aligned to the left or right)
--]]--------------------------------------------------
gWindowTitlebarButtons = {
defaultColour = {160, 160, 160},
defaultDivider = "|",
}
function guiWindowTitlebarButtonAdd(window, text, alignment, onClick, ...)
local offset = getElementData(window, "guieditor:titlebarButton_"..alignment) or 5
local w = guiGetSize(window, false)
-- don't add a divider before the first item
if offset > 10 then
local width = dxGetTextWidth(gWindowTitlebarButtons.defaultDivider, 1, "default")
local label = guiCreateLabel(alignment == "left" and offset or w - offset - width, 2, width, 15, gWindowTitlebarButtons.defaultDivider, false, window)
guiLabelSetColor(label, unpack(gWindowTitlebarButtons.defaultColour))
guiLabelSetHorizontalAlign(label, "center", false)
guiSetProperty(label, "ClippedByParent", "False")
guiSetProperty(label, "AlwaysOnTop", "True")
if alignment == "right" then
setElementData(label, "guiSnapTo", {[gGUISides.right] = offset})
end
offset = offset + width + 5
end
local width = dxGetTextWidth(text, 1, "default")
local label = guiCreateLabel(alignment == "left" and offset or w - offset - width, 2, width, 15, text, false, window)
guiLabelSetColor(label, unpack(gWindowTitlebarButtons.defaultColour))
guiLabelSetHorizontalAlign(label, "center", false)
guiSetProperty(label, "ClippedByParent", "False")
guiSetProperty(label, "AlwaysOnTop", "True")
if alignment == "right" then
setElementData(label, "guiSnapTo", {[gGUISides.right] = offset})
end
offset = offset + width + 5
local args = {...}
for i,v in ipairs(args) do
if v == "__self" then
args[i] = label
end
end
addEventHandler("onClientGUIClick", label,
function(button, state)
if button == "left" and state == "up" then
if onClick then
onClick(unpack(args or {}))
end
end
end,
false)
setRolloverColour(label, gColours.primary, gWindowTitlebarButtons.defaultColour)
--addEventHandler("onClientMouseEnter", label, function() guiLabelSetColor(label, unpack(gColours.primary)) end, false)
--addEventHandler("onClientMouseLeave", label, function() guiLabelSetColor(label, unpack(gWindowTitlebarButtons.defaultColour)) end, false)
setElementData(window, "guieditor:titlebarButton_" .. alignment, offset)
end
|
if shared.DACon then
shared.DACon:Disconnect()
end
if shared.OwnerShip then
shared.OwnerShip:Disconnect()
end
local Players=game:service'Players'
local RunService=game:service'RunService'
local HB=RunService.Heartbeat
local Stepped=RunService.Stepped
local LocalPlayer=Players.LocalPlayer
local Char=LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Owned={}
local function CheckOwnership(Obj)
if Obj and Obj.Parent and Obj:IsA'BasePart' and (not Obj.Anchored) and isnetworkowner(Obj) and (not Obj:IsDescendantOf(Char)) then
return true
end
end
setscriptable(LocalPlayer, 'SimulationRadius', true)
shared.OwnerShip=HB:Connect(function()
local Physics=settings().Physics
Physics.AllowSleep=false
Physics.ThrottleAdjustTime=0/0
LocalPlayer.SimulationRadius=9e9
setsimulationradius(9e9, 9e9)
Stepped:Wait()
end)
shared.DACon=workspace.DescendantAdded:Connect(function(Obj)
if CheckOwnership(Obj) then
table.insert(Owned,Obj)
end
end)
coroutine.wrap(function()
for i,v in ipairs(workspace:GetDescendants()) do
if CheckOwnership(v) then
table.insert(Owned,v)
end
end
end)()
local UI=Ulisse.UI:Main()
local Tab=UI:Tab'P To Toggle'
local Section=Tab:Section'Section'
Section:Item('button', 'Bring Unanchored',function()
for i,v in ipairs(Owned) do
v.CFrame=Char.PrimaryPart.CFrame+Vector3.new(0,10,0)
end
end)
Section:Item('button', 'ReScan',function(v)
Owned={}
for i,v in ipairs(workspace:GetDescendants()) do
if CheckOwnership(v) then
table.insert(Owned,v)
end
end
Ulisse.UI.Warn('Unanchored Count', string.format('#[%i]', #Owned))
end)
--[[
Section:Item('toggle', 'Fly Part', function(v)
local Camera=workspace.CurrentCamera
if v then
else
if LocalPlayer.Character and LocalPlayer.Character.PrimaryPart then
Camera.CameraSubject=LocalPlayer.Character.PrimaryPart
end
end
end)]] |
local util = require 'xlua.util'--需要引用xlua的工具包,不可删除
ICardLogic = { --创建你的技能 这个不是技能名称 不能改动
myCardLogic, --你的技能逻辑本体 不能改动
--初始化事件,这个技能初始化时触发的逻辑
--参数:self 可用于获得技能逻辑本身 下同
Init = function(self)
--todo
end,
--显示事件 鼠标悬浮在卡片上时,会调用该卡片身上所有技能的此事件
OnShowTips = function(self)
--设置该技能的名字
self.myCardLogic.displayName = "武圣"
--设置该技能的描述
self.myCardLogic.Desc = "自己攻击前,同列每有一个生命值大于自己的敌人,便于此回合+" .. math.ceil(self.myCardLogic.Layers * 10) .. "%暴击率"
--设置该技能的颜色 只有卡片站在在对应颜色的格子上才会触发此技能
self.myCardLogic.Color = CS.CardLogicColor.yellow
end,
--攻击前触发事件 战斗时,自己或其他单位普通攻击产生效果前触发此事件
--参数:self player:攻击发起者 target:攻击直接目标的卡槽
OnBeforeAttack = function(self, player, target)
return util.cs_generator(function()
--XLUA调用协程的方式 不能改动
--方法体正式内容-----------------------------------------
if (player == self.myCardLogic.CardData)--判断攻击者是否是自己
then
local targets = self.myCardLogic:GetAllCurrentMonsters()--找到当前存在的所有怪物
if (targets.Count <= 0)--若怪物数量不大于0则技能无效 因为战斗应结束了
then
coroutine.yield(nil)
end
self.myCardLogic:ShowMe()--触发技能时,在卡片上显示出技能名
local count = 0--定义一个暴击概率增加的计数器
for i = 0, targets.Count - 1 --遍历所有怪物
do
--判断怪物是否与自己同列且生命值大于自己
if (targets[i].CurrentCardSlotData:GetAttr("Col") == self.myCardLogic.CardData.CurrentCardSlotData:GetAttr("Col") and
targets[i].HP > self.myCardLogic.CardData.HP)
then
--若满足条件则叠加暴击概率计数器
count = count + 10 * self.myCardLogic.Layers
end
end
if (count > 0)
then
--将计数器上的值赋给卡片本身的临时暴击率属性
self.myCardLogic.CardData.wCRIT = self.myCardLogic.CardData.wCRIT + count
end
end
--协程未返回 在此处返回。若已返回则不需要这一句
coroutine.yield(nil)
--方法体正式内容-----------------------------------------
end)
end,
--战斗开始事件 会在每场战斗开始时触发
OnBattleStart = function(self)
return util.cs_generator(function()
--todo
end)
end,
--回合开始事件 玩家和怪物都行动过后,开启新的回合时触发
OnTurnStart = function(self)
return util.cs_generator(function()
--todo
end)
end,
--回合结束事件 每个回合(无论玩家或怪物)结束后都会触发
--参数:isPlayerTurn:是否为玩家回合结束
OnEndTurn = function(self, isPlayerTurn)
return util.cs_generator(function()
--todo
end)
end,
--战斗结束事件
OnBattleEnd = function(self)
return util.cs_generator(function()
--todo
end)
end,
--是否开启自定义攻击 默认为否 若要编写下面的CustomAttack 将此属性改为true
IsCustomAttack = false,
--自定义攻击事件 普通攻击触发 会覆盖掉默认的普通攻击 若开启了却不实现 普通攻击将无效果
--参数:target:默认攻击目标的卡槽
CustomAttack = function(self, target)
return util.cs_generator(function()
--todo
end)
end,
--攻击后触发事件 战斗时,自己或其他单位普通攻击产生效果后触发此事件 此事件在OnFinishAttack事件之前
--参数:self player:攻击发起者 target:攻击的直接目标
OnAfterAttack = function(self, player, target)
return util.cs_generator(function()
--todo
end)
end,
--攻击结束触发事件 战斗时,自己或其他单位普通攻击结束后触发的事件
--参数:self player:攻击发起者 target:攻击的直接目标
OnFinishAttack = function(self, player, target)
return util.cs_generator(function()
--todo
end)
end,
--生命值改变前事件 任何单位生命值将发生改变前,触发此事件
--参数:self player:生命值改变的发起者 value:生命值改变的数值 from:造成改变的来源 可能为空
OnBeforeHpChange = function(self, player, value, from)
return util.cs_generator(function()
--todo
end)
end,
--生命值改变前事件 任何单位生命值发生改变时,触发此事件 触发此事件时,生命值改变已经完成。
--参数:self player:生命值改变的发起者 changedValue:生命值改变的数值 from:造成改变的来源 可能为空
OnHpChange = function(self, player, changedValue, from)
return util.cs_generator(function()
--todo
end)
end,
--击杀事件 任何单位被击杀都会触发
--参数:self target:死亡的单位 value:死亡时受到的伤害 from:造成死亡的单位
OnKill = function(self, target, value, from)
return util.cs_generator(function()
--todo
end)
end,
--击杀后事件 任何单位被击杀且结算后都会触发
--参数:self cardSlot:死亡的单位临死前所处的卡槽 originCardData:造成死亡的单位
OnAfterKill = function(self, cardSlot, originCardData)
return util.cs_generator(function()
--todo
end)
end,
--销毁事件 此技能被移除或销毁时触发的事件
Terminate = function(self)
return util.cs_generator(function()
--todo
end)
end,
--使用主动技能前事件 自己或其他单位使用主动技能前触发
--参数:self user:使用技能者 origin:使用的技能
OnCardBeforeUseSkill = function(self, user, origin)
return util.cs_generator(function()
--todo
end)
end,
--使用主动技能事件 自己使用此技能时触发
OnUseSkill = function(self)
return util.cs_generator(function()
--todo
end)
end,
--使用主动技能后事件 自己或其他单位使用主动技能后触发
--参数:self user:使用技能者 origin:使用的技能
OnCardAfterUseSkill = function(self, user, origin)
return util.cs_generator(function()
--todo
end)
end,
--融合事件 卡片吃下食物或被吃下 与其他卡片融合时触发的事件
--参数:self mergeBy:被合成的卡片
OnMerge = function(self, mergeBy)
--todo
end,
--ACT结束时触发 打开商店 关闭宝箱 结束战斗 都算作结束ACT 都会触发此事件
OnActEnd = function(self)
--todo
end,
--左键单击卡片触发
OnLeftClick = function(self, res)
--todo
end,
--右键单击卡片触发
OnRightClick = function(self, res)
--todo
end,
--退出场景时触发
OnPlayerExitArea = function(self)
--todo
end,
--金币改变时触发
--参数:self value:金币改变的值
OnMoneyChanged = function(self, value)
return util.cs_generator(function()
--todo
end)
end,
--在地图上移动时触发
OnMoveOnMap = function(self)
return util.cs_generator(function()
--todo
end)
end,
--事件开始前触发
BeforeFact = function(self)
return util.cs_generator(function()
--todo
end)
end,
--攻击特效开始时触发 暂不需使用
OnAttackEffect = function(self, origin, target)
return util.cs_generator(function()
--todo
end)
end,
--进入新场景时触发
--参数:self areaID:进入的场景ID
OnEnterArea = function(self, areaID)
return util.cs_generator(function()
--todo
end)
end,
}
|
local _ = {name = "air", param1 = 0}
local T = {name = "ethereal:banana_trunk", param1 = 255}
local L = {name = "ethereal:bananaleaves", param1 = 255}
local l = {name = "ethereal:bananaleaves", param1 = 180}
local B = {name = "ethereal:banana", param1 = 255}
local b = {name = "ethereal:banana", param1 = 070}
ethereal.bananatree = {
size = {x = 7, y = 8, z = 7},
yslice_prob = {
{ypos = 0, prob = 127},
{ypos = 1, prob = 127},
{ypos = 2, prob = 127}
},
data = {
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,l,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,l,_,_,_,
_,_,_,L,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,b,_,_,_,
_,_,_,B,_,_,_,
_,_,_,L,_,_,_,
_,_,_,_,_,_,_,
_,_,_,T,_,_,_,
_,_,_,T,_,_,_,
_,_,_,T,_,_,_,
_,_,_,T,_,_,_,
_,_,b,T,b,_,_,
_,_,B,T,B,_,_,
_,L,L,L,L,L,_,
l,l,_,L,_,l,l,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,b,_,_,_,
_,_,_,B,_,_,_,
_,_,_,L,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,L,_,_,_,
_,_,_,l,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,_,_,_,_,
_,_,_,l,_,_,_,
}
}
|
require "lunit"
module("tests.movement", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.ships.storms", "0")
conf = [[{
"races": {
"human" : {
"speed" : 1,
"weight" : 1000,
"capacity" : 1500,
"flags" : [ "walk" ]
},
"troll" : {}
},
"items" : {
"horse" : {
"capacity" : 7000,
"weight" : 5000,
"flags" : [ "big", "animal" ]
}
},
"terrains" : {
"ocean": { "flags" : [ "sea", "sail" ] },
"plain": { "flags" : [ "land", "walk", "sail" ] },
"glacier": { "flags" : [ "land", "walk" ] }
},
"directions" : {
"de" : {
"east" : "OSTEN",
"west" : "WESTEN"
}
},
"keywords" : {
"de" : {
"move" : "NACH"
}
}
}]]
eressea.config.reset()
eressea.config.parse(conf)
end
function test_walk_to_land()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain")
local f = faction.create("[email protected]", "human", "de")
local u = unit.create(f, r1, 1)
u:add_order("NACH O")
process_orders()
assert_equal(r2, u.region)
end
function test_walk_into_ocean_fails()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "ocean")
local f = faction.create("[email protected]", "human", "de")
local u = unit.create(f, r1, 1)
u:add_order("NACH O")
process_orders()
assert_equal(r1, u.region)
end
function test_walk_distance()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain")
region.create(2, 0, "plain")
local f = faction.create("[email protected]", "human", "de")
local u = unit.create(f, r1, 1)
u:add_order("NACH O O")
process_orders()
assert_equal(r2, u.region)
end
function test_ride_max_distance()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(2, 0, "plain")
region.create(1, 0, "plain")
region.create(3, 0, "plain")
local f = faction.create("[email protected]", "human", "de")
local u = unit.create(f, r1, 1)
u:add_item("horse", 1)
u:set_skill("riding", 2)
u:add_order("NACH O O O")
process_orders()
assert_equal(r2, u.region, "should ride exactly two hexes")
end
function test_ride_over_capacity_leads_horse()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain")
region.create(2, 0, "plain")
local f = faction.create("[email protected]", "human", "de")
local u = unit.create(f, r1, 3)
u:add_item("horse", 1)
u:set_skill("riding", 2)
u:add_order("NACH O O")
process_orders()
assert_equal(r2, u.region)
end
function test_ride_no_skill_leads_horse()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain")
region.create(2, 0, "plain")
local f = faction.create("[email protected]", "human", "de")
local u = unit.create(f, r1, 1)
u:add_item("horse", 1)
u:add_order("NACH O O")
process_orders()
assert_equal(r2, u.region)
end
|
--------------------------------------------------------------------------------
-- DS18B20 one wire module for NODEMCU
-- NODEMCU TEAM
-- LICENCE: http://opensource.org/licenses/MIT
-- @voborsky, @devsaurus, TerryE 26 Mar 2017
----------------------------------------------------------------------------------------------------------------------------------------------------------------
local modname = ...
-- Used modules and functions
local table, string, ow, tmr, print, type, tostring, pcall, ipairs =
table, string, ow, tmr, print, type, tostring, pcall, ipairs
-- Local functions
local ow_setup, ow_search, ow_select, ow_read, ow_read_bytes, ow_write, ow_crc8, ow_reset, ow_reset_search, ow_skip, ow_depower =
ow.setup, ow.search, ow.select, ow.read, ow.read_bytes, ow.write, ow.crc8, ow.reset, ow.reset_search, ow.skip, ow.depower
local node_task_post, node_task_LOW_PRIORITY = node.task.post, node.task.LOW_PRIORITY
local string_char, string_dump = string.char, string.dump
local now, tmr_create, tmr_ALARM_SINGLE = tmr.now, tmr.create, tmr.ALARM_SINGLE
local table_sort, table_concat = table.sort, table.concat
local math_floor = math.floor
local file_open = file.open
table, string, tmr, ow = nil, nil, nil, nil
local DS18B20FAMILY = 0x28
local DS1920FAMILY = 0x10 -- and DS18S20 series
local CONVERT_T = 0x44
local READ_SCRATCHPAD = 0xBE
local READ_POWERSUPPLY= 0xB4
local MODE = 1
local pin, cb, unit = 3
local status = {}
local debugPrint = function() return end
--------------------------------------------------------------------------------
-- Implementation
--------------------------------------------------------------------------------
local function enable_debug()
debugPrint = function (...) print(now(),' ', ...) end
end
local function to_string(addr, esc)
if type(addr) == 'string' and #addr == 8 then
return ( esc == true and
'"\\%u\\%u\\%u\\%u\\%u\\%u\\%u\\%u"' or
'%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X '):format(addr:byte(1,8))
else
return tostring(addr)
end
end
local function readout(self)
local next = false
local sens = self.sens
local temp = self.temp
for i, s in ipairs(sens) do
if status[i] == 1 then
ow_reset(pin)
local addr = s:sub(1,8)
ow_select(pin, addr) -- select the sensor
ow_write(pin, READ_SCRATCHPAD, MODE)
data = ow_read_bytes(pin, 9)
local t=(data:byte(1)+data:byte(2)*256)
-- t is actually signed so process the sign bit and adjust for fractional bits
-- the DS18B20 family has 4 fractional bits and the DS18S20s, 1 fractional bit
t = ((t <= 32767) and t or t - 65536) *
((addr:byte(1) == DS18B20FAMILY) and 625 or 5000)
if 1/2 == 0 then
-- integer version
if unit == 'F' then
t = (t * 18)/10 + 320000
elseif unit == 'K' then
t = t + 2731500
end
local sgn = t<0 and -1 or 1
local tA = sgn*t
local tH=tA/10000
local tL=(tA%10000)/1000 + ((tA%1000)/100 >= 5 and 1 or 0)
if tH and (t~=850000) then
temp[addr]=(sgn<0 and "-" or "")..tH.."."..tL
debugPrint(to_string(addr),(sgn<0 and "-" or "")..tH.."."..tL)
status[i] = 2
end
-- end integer version
else
-- float version
if t and (math_floor(t/10000)~=85) then
t = t / 10000
if unit == 'F' then
t = t * 18/10 + 32
elseif unit == 'K' then
t = t + 27315/100
end
self.temp[addr]=t
debugPrint(to_string(addr), t)
status[i] = 2
end
-- end float version
end
end
next = next or status[i] == 0
end
if next then
node_task_post(node_task_LOW_PRIORITY, function() return conversion(self) end)
else
--sens = {}
if cb then
node_task_post(node_task_LOW_PRIORITY, function() return cb(temp) end)
end
end
end
local function conversion(self)
local sens = self.sens
local powered_only = true
for _, s in ipairs(sens) do powered_only = powered_only and s:byte(9) ~= 1 end
if powered_only then
debugPrint("starting conversion: all sensors")
ow_reset(pin)
ow_skip(pin) -- select the sensor
ow_write(pin, CONVERT_T, MODE) -- and start conversion
for i, s in ipairs(sens) do status[i] = 1 end
else
for i, s in ipairs(sens) do
if status[i] == 0 then
local addr, parasite = s:sub(1,8), s:byte(9)
debugPrint("starting conversion:", to_string(addr), parasite == 1 and "parasite" or " ")
ow_reset(pin)
ow_select(pin, addr) -- select the sensor
ow_write(pin, CONVERT_T, MODE) -- and start conversion
status[i] = 1
if parasite == 1 then break end -- parasite sensor blocks bus during conversion
end
end
end
tmr_create():alarm(750, tmr_ALARM_SINGLE, function() return readout(self) end)
end
local function _search(self, lcb, lpin, search, save)
self.temp = {}
if search then self.sens = {}; status = {} end
local temp = self.temp
local sens = self.sens
pin = lpin or pin
local addr
if not search and #sens == 0 then
-- load addreses if available
debugPrint ("geting addreses from flash")
local s,check,a = pcall(dofile, "ds18b20_save.lc")
if s and check == "ds18b20" then
for i = 1, #a do sens[i] = a[i] end
end
debugPrint (#sens, "addreses found")
end
ow_setup(pin)
if search or #sens == 0 then
ow_reset_search(pin)
-- ow_target_search(pin,0x28)
-- search the first device
addr = ow_search(pin)
else
for i, s in ipairs(sens) do status[i] = 0 end
end
local function cycle()
debugPrint("cycle")
if addr then
local crc=ow_crc8(addr:sub(1,7))
if (crc==addr:byte(8)) and ((addr:byte(1)==DS1920FAMILY) or (addr:byte(1)==DS18B20FAMILY)) then
ow_reset(pin)
ow_select(pin, addr)
ow_write(pin, READ_POWERSUPPLY, MODE)
local parasite = (ow_read(pin)==0 and 1 or 0)
sens[#sens+1]= addr..string_char(parasite) -- {addr=addr, parasite=parasite, status=0}
debugPrint("contact: ", to_string(addr), parasite == 1 and "parasite" or " ")
end
addr = ow_search(pin)
node_task_post(node_task_LOW_PRIORITY, cycle)
else
ow_depower(pin)
-- place powered sensors first
table_sort(sens, function(a, b) return a:byte(9)<b:byte(9) end) -- parasite
-- save sensor addreses
if save then
debugPrint ("saving addreses to flash")
local addr_list = {}
for i =1, #sens do
local s = sens[i]
addr_list[i] = to_string(s:sub(1,8), true)..('.."\\%u"'):format(s:byte(9))
end
local save_statement = 'return "ds18b20", {' .. table_concat(addr_list, ',') .. '}'
debugPrint (save_statement)
local save_file = file_open("ds18b20_save.lc","w")
save_file:write(string_dump(loadstring(save_statement)))
save_file:close()
end
-- end save sensor addreses
if lcb then node_task_post(node_task_LOW_PRIORITY, lcb) end
end
end
cycle()
end
local function read_temp(self, lcb, lpin, lunit, force_search, save_search)
cb, unit = lcb, lunit or unit
_search(self, function() return conversion(self) end, lpin, force_search, save_search)
end
-- Set module name as parameter of require and return module table
local M = {
sens = {},
temp = {},
C = 'C', F = 'F', K = 'K',
read_temp = read_temp, enable_debug = enable_debug
}
_G[modname or 'ds18b20'] = M
return M
|
io.stdout:setvbuf("no")
--
local Stage = Class:extend()
function Stage:new(opts)
--We need to access the object in the Stage class because it also acts as an interface.
requireFiles(objectFiles)
self.director = Director(self)
--The "self." modifier is here so we can use the Stage class across multipla gemes/apps.
--the self in "Area(self)" is a callback to this Stage class
self.area = Area(self)
--As I will use this system across multipme implementations, we don't want to always have a physics world atttached.
self.sound = mainThemeAlternate
mainThemeAlternate:play()
self.area:addPhysicsWorld()
--adding collision classes
self.area.world:addCollisionClass("Player")
self.area.world:addCollisionClass("Enemy")
self.area.world:addCollisionClass("Collectable")
self.screenW, self.screenH = 320, 240
if opts ~= nil then
for k,v in pairs(opts) do self[k] = v end
end
self.mainCanvas = love.graphics.newCanvas(self.screenW,self.screenH)
self.mainCanvas:setFilter("nearest","nearest")
love.graphics.setLineStyle("rough")
--[[
The addGameObject returns a reference to the created
game object which we can store in order to manipulate and track
the player from inside the room.
--]]
self.player = self.area:addGameObject("Player",self.screenW/2,self.screenH/2)
end
function Stage:update(dt)
self.director:update(dt)
self.area:update(dt)
--Following the player based on its x and y.
--camera:follow(self.player.x*3, self.player.y*3)
end
function Stage:draw()
love.graphics.setCanvas(self.mainCanvas)
love.graphics.clear()
self.area:draw()
love.graphics.print("Wave:"..self.director.waveNumber,self.screenW-40,0)
--love.graphics.circle("fill", self.screenW/2, self.screenH/2, 5)
love.graphics.setCanvas()
camera:attach(0,0,self.screenW,self.screenH)
love.graphics.draw(self.mainCanvas, 0, 0, 0, 3, 3)
camera:detach()
end
return Stage
|
-- See LICENSE for terms
local mod_EnableMod
-- fired when settings are changed/init
local function ModOptions()
mod_EnableMod = CurrentModOptions:GetProperty("EnableMod")
end
-- load default/saved settings
OnMsg.ModsReloaded = ModOptions
-- fired when Mod Options>Apply button is clicked
function OnMsg.ApplyModOptions(id)
if id == CurrentModId then
ModOptions()
end
end
local function StartupCode()
if not mod_EnableMod then
return
end
local defs = ResupplyItemDefinitions
for i = #defs, 1, -1 do
local def = defs[i]
if not def.pack then
print("Fix Resupply Menu Not Opening Borked cargo:", def.id)
table.remove(defs, i)
end
end
end
OnMsg.CityStart = StartupCode
OnMsg.LoadGame = StartupCode
|
local params = {...}
local Dataseries = params[1]
local argcheck = require "argcheck"
local doc = require "argcheck.doc"
doc[[
## Single element functions
Here are functions are mainly used for manipulating a single element.
]]
-- TODO : Remove assert_is_index because it could slow down processing.
-- its utilisation should be up to the user outside this method
Dataseries.get = argcheck{
doc=[[
<a name="Dataseries.get">
### Dataseries.get(@ARGP)
Gets a single or a set of elements.
@ARGT
_Return value_: number|string|boolean
]],
{name="self", type="Dataseries"},
{name="index", type="number", doc="The index to set the value to"},
{name="as_raw", type="boolean", default=false,
doc="Set to true if you want categorical values to be returned as their raw numeric representation"},
call=function(self, index, as_raw)
self:assert_is_index(index)
local ret
if (self.missing[index]) then
ret = 0/0
else
ret = self.data[index]
end
-- Convert categorical values to strings unless directly asked not to
if (not as_raw and self:is_categorical()) then
ret = self:to_categorical(ret)
end
return ret
end}
Dataseries.get = argcheck{
doc=[[
If you provide a Df_Array you get back a Dataseries of elements
@ARGT
_Return value_: Dataseries
]],
{name="self", type="Dataseries"},
{name="index", type="Df_Array", doc="Indexes of wanted elements"},
overload=Dataseries.get,
call=function(self, index)
indexes = index.data
-- Init new dataseries object (to return) with the number of indexes
-- asked size and current type
local ret = Dataseries.new(#indexes, self:get_variable_type())
-- foreach indexes asked
for ret_idx,org_idx in ipairs(indexes) do
ret:set(ret_idx, self:get(org_idx, true))
end
ret.categorical = self.categorical
return ret
end}
Dataseries.set = argcheck{
doc=[[
<a name="Dataseries.set">
### Dataseries.set(@ARGP)
Sets a single element
@ARGT
_Return value_: self
]],
{name="self", type="Dataseries"},
{name="index", type="number", doc="The index to set the value to"},
{name="value", type="*", doc="The data to set"},
call=function(self, index, value)
-- plus_one option ensure the index is within the dataseries OR
-- it is the next new index
self:assert_is_index{index = index, plus_one = true}
-- if the added index is the next new element
if (index == self:size() + 1) then
return self:append(value)
end
-- if the new value is a NaN or NIL value
if (isnan(value) or value == nil) then
self.missing[index] = true
else
if (self:is_categorical()) then
local new_value = self:from_categorical(value)
if (isnan(new_value)) then
value = self:add_cat_key(value)
else
value = new_value
end
end
self.missing[index] = nil
self.data[index] = value
end
return self
end}
Dataseries.mutate = argcheck{
doc=[[
<a name="Dataseries.mutate">
### Dataseries.mutate(@ARGP)
Modifies a dataseries. Takes a function where that each element is applied to.
@ARGT
_Return value_: self
]],
{name="self", type="Dataseries"},
{name="mutation", type="function", doc="The function to apply to each value"},
{name="type", type="string", doc="The return type of the data if other than the current", opt=true},
call=function(self, mutation, type)
if (not type) then
type = self:type()
end
local data = self.data
-- If the new type is different from the current type, it is updated
if (type ~= self:type()) then
data = self.new_storage{
size = self:size(),
type = type
}
end
for i=1,self:size() do
-- If the current value is not a missing values
if (not self.missing[i]) then
data[i] = mutation(self.data[i])
end
end
-- Finish the mutation
self.data = data
self._variable_type = type
return self
end}
Dataseries.append = argcheck{
doc=[[
<a name="Dataseries.append">
### Dataseries.append(@ARGP)
Appends a single element to series. This function resizes the tensor to +1
and then calls the `set` function so if possible try to directly size the
series to apropriate length before setting elements as this alternative is
slow and should only be used with a few values at the time.
@ARGT
_Return value_: self
]],
{name="self", type="Dataseries"},
{name="value", type="*", doc="The data to set"},
call=function(self, value)
local new_size = self:size() + 1
self:resize(new_size)
return self:set(new_size, value)
end}
Dataseries.remove = argcheck{
doc=[[
<a name="Dataseries.remove">
### Dataseries.remove(@ARGP)
Removes a single element
@ARGT
_Return value_: self
]],
{name="self", type="Dataseries"},
{name="index", type="number", doc="The index to remove"},
call=function(self, index)
self:assert_is_index(index)
-- Update missing positions
self.missing[index] = nil
for i=(index + 1),self:size() do
if (self.missing[i]) then
self.missing[i - 1] = true
self.missing[i] = nil
end
end
if (self:type():match("^tds.Vec")) then
self.data:remove(index)
elseif (self:size() == 1) then
self.data:resize(0)
elseif (index == self:size()) then
self.data = self.data[{{1,index - 1}}]
elseif (index == 1) then
self.data = self.data[{{index + 1, self:size()}}]
else
self.data = torch.cat(
self.data[{{1,index - 1}}],
self.data[{{index + 1, self:size()}}],
1)
end
return self
end}
Dataseries.insert = argcheck{
doc=[[
<a name="Dataseries.insert">
### Dataseries.insert(@ARGP)
Inserts a single element
@ARGT
_Return value_: self
]],
{name="self", type="Dataseries"},
{name="index", type="number", doc="The index to insert at"},
{name="value", type="!table", doc="The value to insert"},
call=function(self, index, value)
self:assert_is_index{index = index, plus_one = true}
if (index > self:size()) then
return self:append(value)
end
-- Shift the missing one step to the right
for i=0,(self:size() - index) do
local pos = self:size() - i
if (self.missing[pos]) then
self.missing[pos + 1] = true
self.missing[pos] = nil
end
end
-- Insert an element that we later on can set with the value
if (self:type():match("^tds.Vec")) then
self.data:insert(index, 0)
else
sngl_elmnt = torch.Tensor(1):type(self:type()):fill(-1)
if (index == 1) then
self.data = torch.cat(sngl_elmnt, self.data, 1)
else
local tmp = torch.cat(
self.data[{{1,index-1}}],
sngl_elmnt,
1)
self.data = torch.cat(
tmp,
self.data[{{index, self:size()}}],
1)
end
end
self:set(index, value)
return self
end}
|
function cacheByTimeDelay (func, delay)
func.lastTime = -(delay) * 2
return function (...)
if (Global.time - func.lastTime) >= delay then
func.lastCachedvalue = func(...)
func.lastTime = Global.time
end
return func.lastCachedValue
end
end
__entitiesStore = {}
__entitiesStoreByClass = {}
function getEntity (uniqueId)
log(INFO, "getEntity " .. tostring(uniqueId))
local ret = __entitiesStore[uniqueId]
if ret then
log(INFO, string.format("getEntity found entity %i (%i)", uniqueId, ret.uniqueId))
return ret
else
log(INFO, string.format("getEntity could not find entity %s", tostring(uniqueId)))
return null
end
end
function getEntitiesByTag (withTag)
local ret = {}
local _values = table.values(__entitiesStore)
for i = 1, #_values do
if _values[i]:hasTag(withTag) then
table.insert(ret, _values[i])
end
end
return ret
end
function getEntityByTag (withTag)
local ret = getEntitiesByTag(withTag)
if #ret == 1 then
return ret[1]
elseif #ret > 1 then
log(WARNING, string.format("Attempting to get a single entity with tag '%s', but several exist", withTag))
return null
else
log(WARNING, string.format("Attempting to get a single entity with tag '%s', but no such entity exists", withTag))
return null
end
end
function getEntitiesByClass (_class)
if type(_class) == "table" then
_class = tostring(_class)
end
if __entitiesStoreByClass[_class] then
return __entitiesStoreByClass[_class]
else
return {}
end
end
function getClientEntities ()
return getEntitiesByClass("Player")
end
function getClientNumbers ()
return table.map(getClientEntities(), function (client) return client.clientNumber end)
end
function isPlayerEditing (player)
if Global.CLIENT then
player = defaultValue(player, getPlayerEntity())
end
return (player and player.clientState == CLIENTSTATE.EDITING)
end
function getCloseEntities (origin, maxDistance, _class, withTag, unsorted)
local ret = {}
local entities = _class and getEntitiesByClass(_class) or table.values(__entitiesStore)
for i = 1, #entities do
local otherEntity = entities[i]
if not (withTag and not entity:hasTag(withTag)) or otherEntity.position then
local distance = origin:subNew(otherEntity.position):magnitude()
if distance <= maxDistance then
table.insert(ret, {otherEntity, distance})
end
end
end
if not unsorted then
table.sort(ret, function (a, b) return (a[2] < b[2]) end)
end
return ret
end
function addEntity (_className, uniqueId, kwargs, _new)
uniqueId = defaultValue(uniqueId, 1331)
log(DEBUG, string.format("Adding new Scripting LogicEntity of type %s with uniqueId %i", _className, uniqueId))
log(DEBUG, string.format(" with arguments: %s, %s", JSON.encode(kwargs), tostring(_new)))
assert(getEntity(uniqueId) == null)
local _class = getEntityClass(_className)
local ret = _class()
if Global.CLIENT then
ret.uniqueId = uniqueId
else
if _new then
ret:init(uniqueId, kwargs)
else
ret.uniqueId = uniqueId
end
end
__entitiesStore[ret.uniqueId] = ret
assert(getEntity(uniqueId) == ret)
for k,v in pairs(_logicEntityClasses) do
local className = k
local classClass = v[1]
if classof(ret) == classClass then
if not __entitiesStoreByClass[className] then
__entitiesStoreByClass[className] = {}
end
table.insert(__entitiesStoreByClass[className], ret)
end
end
log(DEBUG, "Activating")
if Global.CLIENT then
ret:clientActivate(kwargs)
else
ret:activate(kwargs)
end
return ret
end
function removeEntity (uniqueId)
uniqueId = tonumber(uniqueId)
log(DEBUG, string.format("Removing Scripting LogicEntity: %i", uniqueId))
if not __entitiesStore[uniqueId] then
log(WARNING, string.format("Cannot remove entity %i as it does not exist", uniqueId))
return nil
end
__entitiesStore[uniqueId]:emit("preDeactivate")
if Global.CLIENT then
__entitiesStore[uniqueId]:clientDeactivate()
else
__entitiesStore[uniqueId]:deactivate()
end
local entity = __entitiesStore[uniqueId]
for k,v in pairs(_logicEntityClasses) do
local className = k
local classClass = v[1]
if classof(entity) == classClass then
table.remove(__entitiesStoreByClass[className],
table.find(__entitiesStoreByClass[className], entity))
end
end
__entitiesStore[uniqueId] = nil
end
function removeAllEntities ()
log(DEBUG, "Clearing up logic entities")
local _keys = table.keys(__entitiesStore)
for i = 1, #_keys do
removeEntity(_keys[i])
end
end
currTimestamp = 0
Global.currTimestamp = currTimestamp
function startFrame ()
currTimestamp = currTimestamp + 1
Global.currTimestamp = currTimestamp
end
Global.time = 0
Global.currTimeDelta = 1.0
Global.lastmillis = 0
Global.profiling = null
Global.queuedActions = {}
function manageActions (seconds, lastmillis)
log(INFO, "manageActions: queued")
local currentActions = Global.queuedActions
Global.queuedActions = {}
for i = 1, #currentActions do
currentActions[i]()
end
Global.time = Global.time + seconds
Global.currTimeDelta = seconds
Global.lastmillis = lastmillis
log(INFO, string.format("manageActions: %i", seconds))
if Global.profiling then
if not Global.profiling.counter then
Global.profiling.data = {}
Global.profiling.counter = seconds
else
Global.profiling.counter = Global.profiling.counter + seconds
if Global.profiling.interval and Global.profiling.counter >= Global.profiling.interval then
Global.profiling.counter = 0
end
end
end
local ltime
local entities = table.values(__entitiesStore)
for i = 1, #entities do
local entity = entities[i]
if not entity.deactivated and entity.shouldAct == true and
(entity.shouldAct ~= true and (
(Global.CLIENT and not entity.shouldAct.client) or
(Global.SERVER and not entity.shouldAct.server)
))
then
if Global.profiling then
ltime = CAPI.currTime()
end
if Global.CLIENT then
entity:clientAct(seconds)
else
entity:act(seconds)
end
if Global.profiling then
ltime = CAPI.currTime() - ltime
if not Global.profiling.data[tostring(entity)] then Global.profiling.data[tostring(entity)] = 0 end
Global.profiling.data[tostring(entity)] = Global.profiling.data[tostring(entity)] + ltime
end
end
end
if Global.profiling and Global.profiling.counter == 0 then
log(ERROR, "---------------profiling (time per second)---------------")
local sortedKeys = table.keys(Global.profiling.data)
table.sort(sortedKeys, function (a, b) return (Global.profiling.data[b] < Global.profiling.data[a]) end)
for i = 1, #sortedKeys do
log(ERROR, string.format("profiling: %s: %i", sortedKeys[i], (Global.profiling.data[ sortedKeys[i] ] / (1000 * Global.profiling.interval))))
end
log(ERROR, "---------------profiling (time per second)---------------")
end
end
manageTriggeringCollisions = cacheByTimeDelay(tocalltable(function ()
local ltime
if Global.profiling and Global.profiling.data then
ltime = CAPI.currTime()
end
local entities = getEntitiesByClass("AreaTrigger")
local _clientents = getClientEntities()
for i = 1, #_clientents do
if isPlayerEditing(_clientents[i]) then return nil end
for j = 1, #entities do
local entity = entities[j]
if World.isPlayerCollidingEntity(_clientents[i], entity) then
if Global.CLIENT then
entity:clientOnCollision(_clientents[i])
else
entity:onCollision(_clientents[i])
end
end
end
end
if Global.profiling and Global.profiling.data then
local _class = "__TriggeringCollisions__"
ltime = CAPI.currTime() - ltime
if not Global.profiling.data[_class] then Global.profiling.data[_class] = 0 end
Global.profiling.data[_class] = Global.profiling.data[_class] + ltime
end
end), defaultValue(Global.triggeringCollisionsDelay, 1 / 10))
function renderDynamic (thirdperson)
log(INFO, "renderDynamic")
local ltime
local continue = false
local player = getPlayerEntity()
if not player then return nil end
local entities = table.values(__entitiesStore)
for i = 1, #entities do
local entity = entities[i]
log(INFO, string.format("renderDynamic for: %i", entity.uniqueId))
if entity.deactivated or entity.renderDynamic == null then continue = true end
if not continue then
if Global.profiling and Global.profiling.data then
ltime = CAPI.currTime()
end
if entity.useRenderDynamicTest then
if not entity.renderDynamicTest then
Rendering.setupDynamicTest(entity)
end
if not entity:renderDynamicTest() then continue = true end
end
if not continue then
entity:renderDynamic(false, (not thirdperson) and entity == player)
if Global.profiling and Global.profiling.data then
local _class = tostring(entity) .. "::renderDynamic"
ltime = CAPI.currTime() - ltime
if not Global.profiling.data[_class] then Global.profiling.data[_class] = 0 end
Global.profiling.data[_class] = Global.profiling.data[_class] + ltime
end
end
end
end
end
function renderHUDModels ()
local player = getPlayerEntity()
if player.HUDModelName and player.clientState ~= CLIENTSTATE.EDITING then
player:renderDynamic(true, true)
end
end
if Global.CLIENT then
playerLogicEntity = null
function setPlayerUniqueId (uniqueId)
log(DEBUG, string.format("Setting player unique ID to %i", uniqueId))
if uniqueId ~= null then
playerLogicEntity = getEntity(uniqueId)
playerLogicEntity._controlledHere = true
assert(uniqueId == null or playerLogicEntity ~= null)
else
playerLogicEntity = null
end
end
function getPlayerEntity ()
return playerLogicEntity
end
function setStateDatum (uniqueId, keyProtocolId, value)
entity = getEntity(uniqueId)
if entity ~= null then
local key = MessageSystem.fromProtocolId(tostring(entity), tonumber(keyProtocolId))
log(DEBUG, string.format("setStateDatum: %i, %i, %s", uniqueId, keyProtocolId, key))
entity:_setStateDatum(key, value)
end
end
function testScenarioStarted ()
log(INFO, "Testing whether the scenario started")
if getPlayerEntity() == null then
log(INFO, "...no, player logic entity not created yet")
return false
end
log(INFO, "...player entity created")
if playerLogicEntity.uniqueId < 0 then
log(INFO, "...no, player not unique ID-ed")
return false
end
log(INFO, "...player entity unique ID-ed")
local _values = table.values(__entitiesStore)
for i = 1, #_values do
if not _values[i].initialized then
log(INFO, string.format("...no, %i is not initialized", _values[i].uniqueId))
return false
end
end
log(INFO, "...yes")
return true
end
end
if Global.SERVER then
function getNewUniqueId ()
local ret = 0
local _keys = table.keys(__entitiesStore)
for i = 1, #_keys do
ret = math.max(ret, _keys[i])
end
ret = ret + 1
log(DEBUG, string.format("Generating new unique ID: %i", ret))
return ret
end
function newEntity (_className, kwargs, forceUniqueId, returnUniqueId)
log(DEBUG, string.format("New logic entity: %i", forceUniqueId))
if not forceUniqueId then
forceUniqueId = getNewUniqueId()
end
local ret = addEntity(_className, forceUniqueId, kwargs, true)
if returnUniqueId then
return ret.uniqueId
else
return ret
end
end
function newNPC (_className)
local npc = CAPI.addNPC(_className)
if npc then
npc._controlledHere = true
return npc
else
return nil
end
end
function sendEntities (clientNumber)
log(DEBUG, string.format("Sending active logic entities to %i", clientNumber))
local numEntities = #__entitiesStore
MessageSystem.send(clientNumber, CAPI.NotifyNumEntities, numEntities)
for k, v in pairs(__entitiesStore) do
v:sendCompleteNotification(clientNumber)
end
end
function setStateDatum (uniqueId, keyProtocolId, value, actorUniqueId)
local entity = getEntity(uniqueId)
if entity ~= null then
local key = MessageSystem.fromProtocolId(tostring(entity), tonumber(keyProtocolId))
entity:_setStateDatum(key, value, actorUniqueId)
end
end
function loadEntities (serializedEntities)
log(DEBUG, string.format("Loading entities... %s %s", tostring(serializedEntities), type(serializedEntities)))
local entities = JSON.decode(serializedEntities)
for i = 1, #entities do
log(DEBUG, string.format("loadEntities: %s", JSON.encode(entities[i])))
local uniqueId = entities[i][1]
local _class = entities[i][2]
local stateData = entities[i][3]
log(DEBUG, string.format("loadEntities: %i,%s,%s", uniqueId, _class, tostring(stateData)))
if _class == "PlayerStart" then _class = "WorldMarker" end
log(DEBUG, tostring(CAPI.getMapversion()))
if CAPI.getMapversion() <= 30 and stateData.attr1 then
if not (_class == "Light" or _class == "FlickeringLight" or _class == "ParticleEffect" or _class == "Envmap") then
stateData.attr1 = (tonumber(stateData.attr1) + 180) % 360
end
end
addEntity(_class, uniqueId, { stateData = JSON.encode(stateData) })
end
log(DEBUG, "Loading entities complete")
end
end
function saveEntities ()
local ret = {}
log(DEBUG, "Saving entities...:")
local _values = table.values(__entitiesStore)
for i = 1, #_values do
if _values[i].persistent then
log(DEBUG, string.format("Saving entity %i", _values[i].uniqueId))
local uniqueId = _values[i].uniqueId
local _class = tostring(_values[i])
local stateData = _values[i]:createStateDataDict()
table.insert(ret, JSON.encode({uniqueId, _class, stateData}))
end
end
log(DEBUG, "Saving entities complete")
return "[\n" .. table.concat(ret, ",\n") .. "\n]\n\n"
end
function cacheByGlobalTimestamp (func)
return function (...)
if func.lastTimestamp ~= Global.currTimestamp then
func.lastCachedValue = func(...)
func.lastTimestamp = Global.currTimestamp
end
return func.lastCachedValue
end
end
CAPI.getTargetPosition = cacheByGlobalTimestamp(tocalltable(CAPI.getTargetPosition))
CAPI.getTargetEntity = cacheByGlobalTimestamp(tocalltable(CAPI.getTargetEntity))
Rendering = {
setupDynamicTest = function (entity)
local currEntity = entity
entity.renderDynamicTest = cacheByTimeDelay(tocalltable(function(self)
local playerCenter = getPlayerEntity().center
if currEntity.position:subNew(playerCenter):magnitude() > 256 then
if not hasLineOfSight(playerCenter, currEntity.position) then return false end
end
return true
end), 1/3)
end,
}
|
local TEST_ENV = "test"
local normalize_headers
do
local _obj_0 = require("lapis.spec.request")
normalize_headers = _obj_0.normalize_headers
end
local ltn12 = require("ltn12")
local json = require("cjson")
local server_loaded = 0
local current_server = nil
local load_test_server
load_test_server = function()
server_loaded = server_loaded + 1
if not (server_loaded == 1) then
return
end
local attach_server
do
local _obj_0 = require("lapis.cmd.nginx")
attach_server = _obj_0.attach_server
end
local get_free_port
do
local _obj_0 = require("lapis.cmd.util")
get_free_port = _obj_0.get_free_port
end
local port = get_free_port()
current_server = attach_server(TEST_ENV, {
port = port
})
current_server.app_port = port
return current_server
end
local close_test_server
close_test_server = function()
server_loaded = server_loaded - 1
if not (server_loaded == 0) then
return
end
current_server:detach()
current_server = nil
end
local request
request = function(path, opts)
if path == nil then
path = ""
end
if opts == nil then
opts = { }
end
if not (server_loaded > 0) then
error("The test server is not loaded!")
end
local http = require("socket.http")
local headers = { }
local method = opts.method
local source
do
local data = opts.post or opts.data
if data then
if opts.post then
method = method or "POST"
end
if type(data) == "table" then
local encode_query_string
do
local _obj_0 = require("lapis.util")
encode_query_string = _obj_0.encode_query_string
end
headers["Content-type"] = "application/x-www-form-urlencoded"
data = encode_query_string(data)
end
headers["Content-length"] = #data
source = ltn12.source.string(data)
end
end
local url_host, url_path = path:match("^https?://([^/]+)(.*)$")
if url_host then
headers.Host = url_host
path = url_path
end
path = path:gsub("^/", "")
if opts.headers then
for k, v in pairs(opts.headers) do
headers[k] = v
end
end
local buffer = { }
local res, status
res, status, headers = http.request({
url = "http://127.0.0.1:" .. tostring(current_server.app_port) .. "/" .. tostring(path),
redirect = false,
sink = ltn12.sink.table(buffer),
headers = headers,
method = method,
source = source
})
assert(res, status)
local body = table.concat(buffer)
if opts.expect == "json" then
json = require("cjson")
if not (pcall(function()
body = json.decode(body)
end)) then
error("expected to get json from " .. tostring(path))
end
end
return status, body, normalize_headers(headers)
end
return {
load_test_server = load_test_server,
close_test_server = close_test_server,
request = request,
run_on_server = run_on_server
}
|
--===================================================
--= Niklas Frykholm
-- basically if user tries to create global variable
-- the system will not let them!!
-- call GLOBAL_lock(_G)
-- Downloaded from: http://lua-users.org/wiki/DetectingUndefinedVariables
--
--===================================================
function GLOBAL_lock(t)
local mt = getmetatable(t) or {}
mt.__newindex = lock_new_index
setmetatable(t, mt)
end
--===================================================
-- call GLOBAL_unlock(_G)
-- to change things back to normal.
--===================================================
function GLOBAL_unlock(t)
local mt = getmetatable(t) or {}
mt.__newindex = unlock_new_index
setmetatable(t, mt)
end
function lock_new_index(t, k, v)
if (k~="_" and string.sub(k,1,2) ~= "__") then
GLOBAL_unlock(_G)
error("GLOBALS are locked -- " .. k ..
" must be declared local or prefix with '__' for globals.", 2)
else
rawset(t, k, v)
end
end
function unlock_new_index(t, k, v)
rawset(t, k, v)
end
local public = {}
public.lock = GLOBAL_lock
public.unlock = GLOBAL_unlock
----------------------------------------------------------------------
-- Attach To SSK and return
----------------------------------------------------------------------
if( not _G.ssk ) then
_G.ssk = { }
end
_G.ssk.globals = public
return public |
#!lua
workspace "TauUtils"
configurations {
"Debug",
"Release",
}
platforms { "Win64" }
cdialect "C11"
cppdialect "C++17"
floatingpoint "Fast"
floatingpointexceptions "off"
rtti "off"
clr "off"
functionlevellinking "on"
intrinsics "on"
largeaddressaware "on"
vectorextensions "AVX2"
stringpooling "on"
staticruntime "on"
flags { "LinkTimeOptimization" }
filter { "platforms:Win64" }
system "Windows"
architecture "x86_64"
_arch = "x64"
defines {
"_CRT_SECURE_NO_WARNINGS",
"_HAS_EXCEPTIONS=0"
}
characterset "MBCS"
filter "configurations:Debug"
optimize "Debug"
inlining "Explicit"
runtime "Debug"
filter "configurations:Release"
optimize "Speed"
inlining "Auto"
runtime "Release"
filter {}
targetdir "%{wks.location}/bin/%{cfg.shortname}-%{_arch}"
project "TauUtils"
kind "StaticLib"
language "C++"
toolset "clang"
location "TauUtils"
files {
"%{prj.location}/**.h",
"%{prj.location}/**.hpp",
"%{prj.location}/**.inl",
"%{prj.location}/src/**.c",
"%{prj.location}/src/**.cpp"
}
includedirs {
"%{prj.location}/include"
}
project "Testing"
kind "ConsoleApp"
language "C++"
toolset "clang"
location "Testing"
files {
"%{prj.location}/**.h",
"%{prj.location}/**.hpp",
"%{prj.location}/src/**.c",
"%{prj.location}/src/**.cpp"
}
includedirs {
"%{prj.location}/include",
"%{wks.location}/TauUtils/include"
}
libdirs {
"%{cfg.outdir}"
}
links {
"TauUtils.lib"
}
|
local image = require("Image")
------------------------------------------------------
local workspace, window, menu = select(1, ...), select(2, ...), select(3, ...)
local tool = {}
tool.shortcut = "Mov"
tool.keyCode = 47
tool.about = "Move tool allows you to move image as you wish. But be careful: large images will take a time to shift and redraw"
local xOld, yOld
tool.eventHandler = function(workspace, object, e1, e2, e3, e4)
if e1 == "touch" then
xOld, yOld = e3, e4
elseif e1 == "drag" and xOld and yOld then
window.image.setPosition(
window.image.localX + (e3 - xOld),
window.image.localY + (e4 - yOld)
)
xOld, yOld = e3, e4
workspace:draw()
elseif e1 == "drop" then
xOld, yOld = nil, nil
end
end
------------------------------------------------------
return tool |
--[[
TheNexusAvenger
Tests the UserdataSerializier class.
--]]
local NexusUnitTesting = require("NexusUnitTesting")
local NexusGit = require(game:GetService("ServerStorage"):WaitForChild("NexusGit"))
local UserdataSerializier = NexusGit:GetResource("Serialization.UserdataSerializier")
--[[
Tests the Serialize method.
--]]
NexusUnitTesting:RegisterUnitTest("Serialize",function(UnitTest)
UnitTest:AssertEquals(UserdataSerializier:Serialize(Axes.new(Enum.Axis.X,Enum.Axis.Z)),{Type="Axes",Value={"X","Z"}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(true),{Type="Bool",Value=true},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(false),{Type="Bool",Value=false},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(BrickColor.new("Bright green")),{Type="BrickColor",Value="Bright green"},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(CFrame.new(1,2,3,4,5,6,7,8,9,10,11,12)),{Type="CFrame",Value={1,2,3,4,5,6,7,8,9,10,11,12}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Color3.new(0.25,0.5,0.75)),{Type="Color3",Value={0.25,0.5,0.75}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(ColorSequence.new({ColorSequenceKeypoint.new(0,Color3.new(0.25,0.5,0.75)),ColorSequenceKeypoint.new(0.5,Color3.new(0.75,0.25,0.5)),ColorSequenceKeypoint.new(1,Color3.new(0.5,0.75,0.25))})),{Type="ColorSequence",Value={0,0.25,0.5,0.75,0,0.5,0.75,0.25,0.5,0,1,0.5,0.75,0.25,0}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Enum.ActionType.Draw),{Type="Enum",Value={"ActionType","Draw"}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Faces.new(Enum.NormalId.Back,Enum.NormalId.Right)),{Type="Faces",Value={"Right","Back"}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(3.14),{Type="Float",Value=3.14},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(NumberRange.new(1,5)),{Type="NumberRange",Value={1,5}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(NumberSequence.new({NumberSequenceKeypoint.new(0,0,0),NumberSequenceKeypoint.new(0.5,0.5,0.5),NumberSequenceKeypoint.new(1,1,0)})),{Type="NumberSequence",Value={0,0,0,0.5,0.5,0.5,1,1,0}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(PhysicalProperties.new(0.5,0.5,0.5,0.5,0.5)),{Type="PhysicalProperties",Value={0.5,0.5,0.5,0.5,0.5}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Ray.new(Vector3.new(1,2,3),Vector3.new(4,5,6))),{Type="Ray",Value={1,2,3,4,5,6}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Rect.new(1,2,3,4)),{Type="Rect",Value={1,2,3,4}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Region3.new(Vector3.new(-2,-2,-2),Vector3.new(2,2,2))),{Type="Region3",Value={0,0,0,1,0,0,0,1,0,0,0,1,4,4,4}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Region3int16.new(Vector3int16.new(1,2,3),Vector3int16.new(4,5,6))),{Type="Region3int16",Value={1,2,3,4,5,6}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize("Test string"),{Type="String",Value="Test string"},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(UDim.new(1,2)),{Type="UDim",Value={1,2}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(UDim2.new(1,2,3,4)),{Type="UDim2",Value={1,2,3,4}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Vector2.new(1,2)),{Type="Vector2",Value={1,2}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Vector3.new(1,2,3)),{Type="Vector3",Value={1,2,3}},"Serialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Serialize(Vector3int16.new(1,2,3)),{Type="Vector3int16",Value={1,2,3}},"Serialization is correct.")
end)
--[[
Tests the Deserialize method.
--]]
NexusUnitTesting:RegisterUnitTest("Deserialize",function(UnitTest)
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Axes",Value={"Y","Z"}}),Axes.new(Enum.Axis.Y,Enum.Axis.Z),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Bool",Value=true}),true,"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Bool",Value=false}),false,"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="BrickColor",Value="Bright green"}),BrickColor.new("Bright green"),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="CFrame",Value={1,2,3,4,5,6,7,8,9,10,11,12}}),CFrame.new(1,2,3,4,5,6,7,8,9,10,11,12),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Color3",Value={0.25,0.5,0.75}}),Color3.new(0.25,0.5,0.75),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="ColorSequence",Value={0,0.25,0.5,0.75,0,0.5,0.75,0.25,0.5,0,1,0.5,0.75,0.25,0}}),ColorSequence.new({ColorSequenceKeypoint.new(0,Color3.new(0.25,0.5,0.75)),ColorSequenceKeypoint.new(0.5,Color3.new(0.75,0.25,0.5)),ColorSequenceKeypoint.new(1,Color3.new(0.5,0.75,0.25))}),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Enum",Value={"Material","Ice"}}),Enum.Material.Ice,"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Faces",Value={"Top","Right"}}),Faces.new(Enum.NormalId.Top,Enum.NormalId.Right),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Float",Value=3.14}),3.14,"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="NumberRange",Value={1,5}}),NumberRange.new(1,5),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="NumberSequence",Value={0,0,0,0.5,0.5,0.5,1,1,0}}),NumberSequence.new({NumberSequenceKeypoint.new(0,0,0),NumberSequenceKeypoint.new(0.5,0.5,0.5),NumberSequenceKeypoint.new(1,1,0)}),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="PhysicalProperties",Value={0.1,0.2,0.3,0.4,0.5}}),PhysicalProperties.new(0.1,0.2,0.3,0.4,0.5),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Ray",Value={1,2,3,4,5,6}}),Ray.new(Vector3.new(1,2,3),Vector3.new(4,5,6)),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Rect",Value={1,2,3,4}}),Rect.new(1,2,3,4),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Region3",Value={0,0,0,1,0,0,0,1,0,0,0,1,4,4,4}}),Region3.new(Vector3.new(-2,-2,-2),Vector3.new(2,2,2)),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Region3int16",Value={1,2,3,4,5,6}}),Region3int16.new(Vector3int16.new(1,2,3),Vector3int16.new(4,5,6)),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="String",Value="Test string"}),"Test string","Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="UDim",Value={1,2}}),UDim.new(1,2),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="UDim2",Value={1,2,3,4}}),UDim2.new(1,2,3,4),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Vector2",Value={1,2}}),Vector2.new(1,2),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Vector3",Value={1,2,3}}),Vector3.new(1,2,3),"Deserialization is correct.")
UnitTest:AssertEquals(UserdataSerializier:Deserialize({Type="Vector3int16",Value={1,2,3}}),Vector3int16.new(1,2,3),"Deserialization is correct.")
end)
return true |
local Log = require "log.logger"
local Env = require "env"
local server_mgr = require "server.server_mgr"
local cerberus = require "cerberus"
require "gate_svr.net_event_handler"
require "gate_svr.msg_handler"
require "gate_svr.rpc_handler"
cerberus.start(function()
Log.info("gate_svr main_entry")
server_mgr:create_mesh()
local UserMgr = require "gate_svr.user_mgr"
Env.user_mgr = UserMgr.new()
local CommonHandler = require "gate_svr.common_handler"
Env.common_handler = CommonHandler.new()
end)
|
return {
-- Nomes e Descrições
--heist_crojob2 = "The Bomb: Forest",--The Bomb: Forest
--heist_crojob3_hl = "The Bomb: Forest",--The Bomb: Forest
heist_crojob2_crimenet = "Uma quantidade considerável de explosivos termobáricos serão levados para um trem seguro, e depois a uma planta onde será desativado. Eu vou precisar de uma equipe experiente para conseguir esses explosivos. Mandem um recado a eles. Façam do nosso jeito.$NL;$NL;» Encontre o Vagão Correto$NL;» Encha o Vagão de Água$NL;» Encontre os Explosivos e use-os para Abrir o Vagão$NL;» Pegue a Bomba e Fuja!",--A large amount of thermobaric explosive is due to be taken by a secure train, to a plant where it will be decommissioned. I require a skilled team to recover these explosives. Send a message. Do it loud.$NL;$NL;» Find the correct wagon$NL;» Fill the wagon with water$NL;» Find C4 and use it to open the wagon$NL;» Take the bomb and escape
heist_crojob3_briefing = "Esses explosivos termobáricos foram carregados em um trem de carga essa manhã. Com destino a Norfolk. Talvez serão vendidos, talvez descomissionados - não importa, por que nunca vai chegar lá. Um trem em movimento é difícil de parar, então faremos isso no melhor estilo do Velho Oeste. Exploda uma parte da ponte e tudo vai por água abaixo. Será bem barulhento e desleixado, porém efetivo. Os vagões vão se espalhar por toda a parte. Um deles tem um cofre onde estarão os nossos explosivos - Procure por cada um deles até encontrarem.",--Those thermobaric explosives were loaded onto a freight train this morning. It's heading down to Norfolk. Maybe to be sold on, maybe to be decommissioned - it doesn't matter, because it won't reach there. A moving train is tough to stop, so we're doing this Old West style. Blow a section of bridge and the whole thing comes tumbling down. It's loud and messy, but effective. The wagons will be scattered to hell. One of them has a vault where our explosives are - search each of 'em til you find it.
-- Legendas
pln_cr3_intro_01_01 = "Oh... Nossa. Espero que os vagões tenham sobrevivido.",--Oh... Wow. Hope those wagons survived.
pln_cr3_29_02 = "Procurem as caixas. Devem ter explosivos em alguma delas.",--Search those crates. Should be some C4 in one of them.
pln_cr3_32_01 = "Posicionem os explosivos dentro do cofre! Deixe-os já prontos.",--Deploy C4 inside the vault! Then get ready.
pln_cr3_34_01 = "Eles estão bloqueando a estrada com vans! E... hã... Unidades fortemente armadas se aproximando!",--They're blocking the road with vans! And... Uh... Heavy units approaching!
pln_cr3_44_01 = "Touch down! Agora encham o caminhão com o loot!",--Touch down! Now load the plane with loot!
pln_cr3_03_01 = "Vagão errado. Droga! Continuem procurando!",--Wrong wagon. Crap! Keep looking!
pln_cr3_28_01 = "Preparem-se. O Bile está quase de volta. Conectem a mangueira!",--Get ready. Bile's almost back. Connect the hose!
pln_cr3_06_02 = "Certo, agora conectem essa mangueira no cofre.",--Alright, now hook that hose to the vault.
pln_cr3_31_02 = "Ótimo. Podemos achar uma utilidade para esses explosivos mais tarde.",--Great. Sure we can find a use for a little C4 later.
pln_cr3_54_01 = "Bombeamento pronto! O cofre está cheio e pronto para a ação!",--Pump's done! Vault is full and ready for blasting!
pln_cr3_45_02 = "O helicóptero está quase chegando. Aguentem mais um pouco!",--Chopper's nearly there. Just hold on!
pln_cr3_15_01 = "Esse é o vagão! Agora plantem a thermite lá no topo. Vamos abrir esse desgraçado!",--That's the wagon! Now plant the thermite on the top. We'll open that sucker up!
pln_cr3_23_01 = "Ótimo. A mangueira está pronta. Vamos aumentar a pressão. Iniciem o bombeamento.",--Good. Hose is OK. Let's get that pressure back. Start the pump.
pln_cr3_17_01 = "Deixem a thermite queimar. Não vai demorar para derreter tudo.",--Let the thermite burn through. Won't take long to eat through.
pln_cr3_21_01 = "A thermite fez o seu trabalho. Podemos usar a bomba de água por perto para encher os vagões. Conectem a mangueira ao cofre.",--Thermite's done. We can use water pump nearby to fill the wagons. Connect that hose to the vault.
pln_cr3_52_01 = "Estamos quase lá, galera. Está enchendo direitinho! Continuem assim por mais um tempinho. Quando estiver cheio, nós explodimos e desfrutamos do show!",--We're almost there, gang. It's filling up nicely! Just keep things going a little more. Once it's full, we rig it and enjoy the show!
pln_cr3_03_04 = "Não era esse. Continuem procurando. O cofre está por aqui em algum lugar.",--Wasn't this one. Keep going. Vault is here somewhere.
pln_cr3_20_02 = "O melhor jeito para o cofre é a quebra de água. Nós enchemos de água, detonamos e boom! A pressão abre a porta à força. É o único jeito de acabar não ativando os explosivos.",--Best way in to this vault is water-cracking. We fill it with water, detonate it and, boom! Pressure busts the door open. Only way to insure we don't ignite those explosives.
pln_cr3_24_02 = "Ali está o helicóptero! Bile, abaixe a mangueira. Galera, preparem-se.",--There's the chopper! Bile, lower the hose. Gang, get ready.
pln_cr3_25_02 = "OK, estamos bombeando! Deixem encher o cofre.",--OK, we're pumping! Let it fill the vault.
pln_cr3_36_02 = "Tem um barco no lago. Uma tirolesa poderia ajudar a atravessar.",--There's a boat on the lake. A zip-line can get you across.
pln_cr3_18_03 = "Os vagões estão por todo o caminho. Devem ter loot dentro deles. Talvez uns explosivos. Se tiver, pegue-os. Vocês vão precisar.",--The wagons are all over the place. Could be loot in 'em. Might also be C4. If there is, grab it. You're gonna need it.
pln_cr3_30_03 = "Fiquei sabendo que tem explosivos em um dos vagões. Vão procurar!",--I know there's C4 in one of the wagons. Check 'em out!
pln_cr3_37_01 = "Ótimo. Agora vão até a tirolesa e o trabalho estará feito.",--Great. Now get to the zip-line and you're job is done.
pln_cr3_05_02 = "Pegue a thermite. Não temos tempo para uma furadeira, então vamos derreter o vagão.",--Grab the thermite. No time to drill so we're burning through the wagon itself.
pln_cr3_18_02 = "A explosão espalhou os vagões para todos os lados. Devem ter loot em alguns deles. Procurem também por explosivos. Vocês vão precisar.",--Blast blew wagons everywhere. Might be loot in some of 'em. And check 'em for any C4. You'll need it soon.
pln_cr3_02_01 = "Procurem em volta por uma escada. Vocês irão precisar dela para subir nos vagões.",--Search around for a ladder. You'll need it for the wagons.
pln_cr3_35_01 = "Eles estão bloqueando a estrada! Merda, não sei se o avião vai conseguir pousar.",--They are cutting off the road! Shit, not sure if the plane is gonna be able to land.
pln_cr3_53_02 = "A mangueira não vai se consertar sozinha. Algum de vocês palhaços precisam fazer isso!",--The hose won't fix itself. One of you clowns get it done!
pln_cr3_34_02 = "Eles posicionaram um bloqueio de estrada. E reforço pesado a caminho também.",--They set up a roadblock. And heavy reinforcements are on the way too.
pln_cr3_51_02 = "Peguem os explosivos aí dentro, e fiquem preparados!",--Get the C4 in there, and get ready!
pln_cr3_44_02 = "O avião está no chão. Agora levem o loot para ele.",--Plane is on the ground. Now get the loot into it.
pln_cr3_52_02 = "Está enchendo rápido, grupo. Continuem assim. Quando estiver cheio, plantem a carga e desfrutem do show.",--It's filling up fast, crew. Just keep it going. When it's full, plant the charge and enjoy the show.
pln_cr3_52_03 = "Continue com o bombeamento de água, gangue. Só mais um pouco. Aí é só explodir, e deixar a hidrodinâmica fazer seu trabalho.",--Keep the water flowing, gang. Just a little more. Then just rig it, and let hydrodynamics do its job.
pln_cr3_09_02 = "Boa. Agora levem isso para o local de entrega de loot.",--Nice. Now get it back to the loot drop.
pln_cr3_41_02 = "Abram caminho. Cortem as árvores!",--Clear the path. Clear the trees!
pln_cr3_30_01 = "Devem ter explosivos em um dos vagões. Procurem por eles!",--There's gotta be explosives in one of the wagons. Search for them!
pln_cr3_04_01 = "A thermite está pronta. A Água está fluindo. Quando o helicóptero chegar, vocês devem conectá-lo ao cofre.",--Thermite's done. Water's on its way. When the chopper arrives, you need to connect it to the vault.
pln_cr3_43_02 = "Boa. A carona está pousando.",--Good. Your ride is coming down now.
pln_cr3_03_03 = "O cofre não está aqui. OK, continuem procurando.",--Vault's not here. OK, keep searching.
pln_cr3_19_02 = "Certeza que deve ter loot nos vagões. Procurem neles. E qualquer explosivo que vocês acharem, peguem também.",--Sure there's gotta be loot in the wagons. Search 'em. And any C4 you can scrounge too.
pln_cr3_19_01 = "Procurem nos outros vagões para um loot extra. E explosivos. Procurem por isso também.",--Check other wagons for extra loot. And C4. Look for that too.
pln_cr3_30_02 = "Esses vagões estão destinados à descomissão militar. Um deles deve ter explosivos.",--Those wagons are bound for military decommissioning. One of 'em's gotta have C4.
pln_cr3_10_02 = "A escada e a thermite estão bem ali. Não se esqueçam.",--The ladder and thermite are right there. Don't forget them.
pln_cr3_21_02 = "A thermite fez seu trabalho. Agora conectem a bomba de água no cofre.",--Thermite's done its job. Now hook that water pump up to the vault.
pln_cr3_53_01 = "Qual é a da demora? Reconectem a mangueira logo!",--What's the hold-up?! Get that hose re-attached already!
pln_cr3_46_02 = "O helicóptero está bem em cima de vocês. Conseguem ver?",--Chopper's right on top of you. Can you see it?
pln_cr3_40_03 = "Fantástico! Não há tempo a perder. Liguem e comecem a derrubar as árvores.",--Fantastic! No time to lose, though. Fire it up and get felling those trees.
pln_cr3_09_01 = "Levem isso de volta para o local.",--Get that back to the drop.
pln_cr3_25_01 = "Olhos abertos nessa mangueira. Deixe-a encher o cofre.",--Keep an eye on that hose. Let it fill the vault.
pln_cr3_02_02 = "Os vagões devem ter uma escada. Procurem por ela.",--The wagons would have had a ladder. Look for it.
pln_cr3_40_01 = "Vocês encontraram! Hora de derrubar umas árvores!",--You found it! Time to bring some trees down!
pln_cr3_33_01 = "OK. A qualquer... segundo...",--OK. Any... Second...
pln_cr3_11_01 = "Vocês vão precisar de thermite para abrir o vagão.",--You're gonna need the thermite to pop the wagon open. Get back and grab it.
pln_cr3_22_01 = "A mangueira parece segura. Comecem a bombear a água.",--Hose looks secure. Start the pump.
pln_cr3_41_01 = "Derrubem essas árvores!",--Bring those trees down!
pln_cr3_24_01 = "O helicóptero já está em cena! Bile, derrube essa mangueira para a gangue.",--Chopper's on the scene! Bile, get that hose down to the gang.
pln_cr3_55_01 = "O vagão não vai se abrir sozinho. Enfiem esses explosivos lá!",--Wagon's not gonna crack itself open. Dip that C4 in!
pln_cr3_01_01 = "Os policiais vão invadir a qualquer segundo! Mais rápido! Procurem nos vagões pelo cofre.",--Cops are gonna be swarming through here any second! Move fast! Check the wagons for the vault.
pln_cr3_26_01 = "A mangueira se soltou. Reconecte-a!",--The hose has come loose. Reconnect it!
pln_cr3_39_03 = "Olhem só pra toda essa madeira. Deve ter alguma serra por aqui em algum lugar - continuem procurando.",--Look at all this timber. There's got to be a saw somewhere - keep looking.
pln_cr3_39_02 = "Deve ter uma serra aqui perto. Procurem pelas toras de madeira.",--Got to be a saw here somewhere. Check the timber logs.
pln_cr3_45_01 = "O helicóptero está a caminho. Aguentem, pessoal.",--The chopper is en-route. Hold on, guys.
pln_cr3_22_02 = "OK, tudo ótimo com a mangueira. Agora comecem a bombear essa água.",--OK, hose looks good. Now get the pump started.
pln_cr3_13_01 = "Lembrem-se, a escada irá ajudar a subir nos vagões.",--Remember, the ladder will let you get up onto the wagons.
pln_cr3_36_01 = "O barco está esperando por vocês no lago. Atravessem pela tirolesa.",--The boat's waiting for you at the lake. You can zip-line aboard.
pln_cr3_54_03 = "A bomba de água terminou. O vagão está cheio e preparado! Muito bem!",--Pump's finished. That wagon is bloated and ready! Nicely done.
pln_cr3_54_02 = "E o bombeamento de água está pronto. Bom trabalho!",--That's the pump done. Great work!.
pln_cr3_03_02 = "Não, sem cofre. Continuem a busca!",--Nope, no vault. Move on, keep looking!
pln_cr3_01_02 = "Comecem a procurar os vagões. Esperem por uma resposta rápida da polícia. Lembrem-se, vocês estarão procurando por um vagão com o cofre!",--Get searching the wagons. You can expect a fast response from the cops. Remember, you're looking for the wagon with the vault!
pln_cr3_47_02 = "O helicóptero está aí, pessoal. Assegurem o loot e vão embora!",--The chopper's there, guys. Stow the loot and bug out!
pln_cr3_38_03 = "O Bile está a caminho para vocês, mas ele não pode pousar com essas árvores no caminho. Encontrem uma serra, abram caminho para ele, e marquem com sinalizadores.",--Bile's on his way to you, but he can't land with those trees in the way. Find a saw, and clear a way for him, then mark it with flares.
pln_cr3_38_01 = "Tem um avião a caminho para extrair vocês, mas ele não poderá pousar com essas árvores bloqueando o caminho. Encontrem uma serra, cortem as árvores e marquem o pouso com sinalizadores. Não se preocupem, a CIA faz isso há muito tempo.",--Got a plane en route to pick you up, but it can't land with trees blocking it's path. Find a saw, clear the trees and mark the landing with flares. Don't worry, CIA been doing this for years.
pln_cr3_48_01 = "Um deles contém um cofre. Encontrem-no.",--One of 'em contains the vault. Find it.
pln_cr3_55_02 = "Vamos lá, assistimos ao show e vocês já sabem o que precisa ser feito. Posicionem os explosivos!",--Come on, we watched the show and you know how to do it. Set the C4!
pln_cr3_46_01 = "Quase lá. Vocês vão conseguir ouvir.",--Almost there. You should be able to hear it.
pln_cr3_29_01 = "Procurem os outros vagões pelo explosivo! Deve estar em uma das caixas.",--Search the other wagons for C4! It should be inside one of the crates.
pln_cr3_35_02 = "Eles estão bloqueando a estrada. Droga. Ainda tem espaço para o avião?",--They're blocking the road. Damn. Is there still room for the plane?
pln_cr3_31_01 = "Bom achado. Isso vai ser bastante útil.",--Nice find. This'll come in handy later.
pln_cr3_07_01 = "Droga, esse cofre é grande. Precisa de mais água ainda. Esperem o helicóptero reabastecer. Aguentem mais um pouco!",--Damn, that vault is big. Need more water. Let the chopper refill. Hold tight!
pln_cr3_42_02 = "O avião está quase chegando. Ativem os sinalizadores e marquem o local de pouso.",--Plane's nearly there. Pop the flares and mark the strip.
pln_cr3_32_02 = "Levem esses explosivos para o cofre. E mantenham a distância!",--Get that C4 into the vault. And stand back!
pln_cr3_18_01 = "Vocês vão querer procurar os vagões por loot extra. E olhos abertos para os explosivos. Vocês com certeza vão precisar. Devem estar em uma das caixas.",--You might wanna scout the wagons for some extra loot. And keep your eyes open for C4. You're gonna need it later. Should be in one of the crates.
pln_cr3_47_01 = "O helicóptero pousou. Levem o loot, e vão embora!",--Chopper is down. Get the loot in, and get out!
pln_cr3_33_02 = "Explosivos acionados. E...",--Explosive's in. And...
pln_cr3_23_02 = "OK, a mangueira parece segura. Agora vamos começar a bombear a água de novo.",--OK, hose looks secure. Now let's get that pump pumping again!
pln_cr3_17_02 = "Esses vagões são da pesada, mas a thermite vai derretê-los facilmente.",--These cars are tough stuff, but the thermite will melt through easy.
pln_cr3_11_02 = "Vocês só vão poder derreter o vagão com a thermite, então é melhor voltar e pegá-la.",--You can only melt through that wagon with the thermite, so you better head back and fetch it.
pln_cr3_27_02 = "Os policiais ferraram com a mangueira. Consertem!",--Cops pulled the hose. Get it back on!
pln_cr3_19_03 = "Aposto que tem loot nesses vagões. Chequem-no. Olhos abertos para explosivos também.",--I bet those wagons have loot. Check 'em out. Keep an eye open for C4 too.
pln_cr3_20_01 = "Vamos abrir o cofre com água, pessoal. Encha-o com bastante água, e detone-o. Vai explodir a porta sem danificar o conteúdo do vagão.",--We're going to water crack this vault, guys. Fill it with water, and detonate it. It'll blow the door right off without damaging the contents.
pln_cr3_16_02 = "Procurem em volta por uma escada. Vocês vão precisar dela para procurar os vagões. Talvez ainda esteja conectada a eles.",--Look around for a ladder. You need it to search the wagons. Maybe it's still attached to one of them.
pln_cr3_39_01 = "Encontrem a serra! Deve estar em algum lugar. Procurem em volta pelas toras de madeira.",--Find that saw! It has to be around here somewhere. Try looking around timber logs.
pln_cr3_08_01 = "Agora!",--Now!
pln_cr3_38_02 = "Enviando um pequeno avião para te buscar. Mas o piloto não pode pousar com essas árvores no caminho. Vocês precisam achar uma serra, cortar algumas árvores e marcar a zona de pouso para ele.",--Sending a small plane to pick you up. Pilot can't land with those trees though. You gotta find a saw, clear a few and then mark the strip for him.
pln_cr3_07_02 = "Precisamos de mais água! O helicóptero vai reabastecer o tanque. Guardem o cofre!",--We need more water! Chopper's going to fill her tank. Hold the vault!
pln_cr3_14_02 = "Continuem procurando pelo vagão. Lembrem-se, estamos procurando pelo vagão com um cofre.",--Keep looking for the wagon. Remember, we're looking for the one with the vault.
pln_cr3_05_01 = "Peguem aquela thermite, acreditem em mim, você vão precisar dela.",--Pick up that thermite, trust me, you're going to need it.
pln_cr3_53_03 = "Vocês precisam reconectar a mangueira, pessoal. Vamos!",--You need to get that hose reconnected, guys. Come on!
pln_cr3_14_01 = "Pessoal, vocês precisam achar aquele vagão - o que tem um cofre dentro.",--Guys, you need to find that wagon - the one with the vault.
pln_cr3_37_02 = "Agora vão para aquela mesma tirolesa para dar o fora daí.",--Now get to that same zip-line to get your good selves out of there.
pln_cr3_40_02 = "Ótimo! Agora comecem a cortar essas árvores!",--Great! Now get it working on those trees!
pln_cr3_04_02 = "OK, a thermite derreteu. Um helicóptero está trazendo a água. Conectem a mangueira quando ele chegar.",--OK, thermite's through. A chopper is bringing the water. Connect it when it arrives.
pln_cr3_06_01 = "Ali está a mangueira! Conectem no cofre.",--There's the hose! Connect it to the vault.
pln_cr3_08_02 = "Boom!",--Boom!
pln_cr3_10_01 = "Ali está a escada e a thermite. Peguem-nos. Vocês vão precisar depois.",--There's the ladder and thermite. Grab 'em. You'll need them later.
pln_cr3_12_01 = "Aqui está a escada. Vocês podem usá-la para subir nos vagões.",--Here's the ladder. You can use it to get on top of the wagons.
pln_cr3_12_02 = "Ótimo! Vocês podem usar essa escada para subir nos vagões.",--Great! You can use this ladder to get up on the wagons.
pln_cr3_13_02 = "Usem aquela escada para subir nos vagões.",--Use that ladder to climb onto the wagons.
pln_cr3_15_02 = "Ali está o cofre! Ótimo! Agora usem a thermite no topo do vagão e derreta-o para entrar.",--There's the vault! Great! Now use the thermite on the top and burn your way through.
pln_cr3_16_01 = "Encontrem uma escada. E Então vocês poderão subir nesses vagões.",--Find a ladder. Then you can climb the wagons.
pln_cr3_26_02 = "Reconectem aquela mangueira!",--Get that hose re-attached!
pln_cr3_27_01 = "Os policiais desconectaram a mangueira. Reconecte-a!",--The cops have disconnected the hose. Reconnect it!
pln_cr3_27_03 = "Droga! Eles ferraram com a mangueira. Voltem lá, e consertem essa merda!",--Dammit! They yanked the hose. Get there, get it back on.
pln_cr3_28_02 = "OK, o helicóptero está de volta. Comecem a bombear a água!",--OK, chopper is back. Get pumping again!
pln_cr3_37_03 = "Aquela tirolesa é o caminho de fuga de vocês - vão direto para lá!",--That zip-line is your way out - get there!
pln_cr3_42_01 = "O avião está próximo. Marquem a zona de pouso com alguns sinalizadores.",--The plane is close. Mark the landing strip with flares.
pln_cr3_43_01 = "Ótimo! Avião se aproximando...",--Great! Plane on approach now..
pln_cr3_49_01 = "Uma pasta com thermite de alta temperatura vai estar esperando por vocês ali.",--Briefcase with high-temperature thermite paste will be waiting for you here.
pln_cr3_50_01 = "Bomba de água industrial, de alta pressão usada pela madeireira. Se estivermos com sorte, e o vagão certo cair perto dela, podemos usar para encher o cofre.",--Industrial, high-pressure water pump used by nearby timber mill. If we're lucky, and the right wagon lands near it, we can use it to fill the vault.
pln_cr3_51_01 = "Agora posicionem essa carga e mantenha a distância!",--Now dip that charge in and stand back!
pln_cr3_55_03 = "Todo esse vagão está esperando por um pouquinho de explosivos. Vão logo!",--All that wagon is waiting for is a nice bit of C4. Get to it!
-- Legendas do Capanga
pt1_cr3_01_03 = "Igual o padre disse à freira, estou mandando a mangueira.",--Like the priest said to the nun, I'm droppin' you a hose.
pt1_cr3_01_01 = "Os palhaços estão prontos? A mangueira está descendo.",--You clowns ready? Hose is coming down.
pt1_cr3_02_03 = "Preciso reabastecer. Volto daqui a pouco.",--Need a refill. Be back shortly.
pt1_cr3_02_01 = "Acabou a água. Vou reabastecer.",--Tank's dry. Going to refill.
pt1_cr3_01_02 = "Estão prontos? Vou enviar a mangueira.",--You ready for it? I'm dropping the hose.
pt1_cr3_03_03 = "Acabou a água, vou dar o fora daqui.",--I'm dry, and I'm outta here.
pt1_cr3_02_02 = "Vou reabastecer o tanque. Já volto.",--Going to refill the tank. Back soon.
pt1_cr3_03_01 = "Meu trabalho aqui está feito! Vou vazar.",--My job's done here! I'm out.
pt1_cr3_03_02 = "Isso é tudo que eu tenho. Vou dar o fora daqui.",--That's all I got. I'm outta here!
-- Objetivos
hud_heist_crojob2_mission15 = "O barco de fuga estará no lago esperando por você em alguns minutos.",--The escape boat will be waiting for you at the lake in a couple of minutes.
hud_heist_crojob2_mission16 = "A van de fuga estará esperando por você na estrada principal em alguns minutos. Fique vivo até lá!",--The escape van will be waiting for you at the main road in a couple of minutes. Stay alive until then!
hud_heist_crojob2_mission13_hl = "Espere pelo Helicóptero",--Wait for the helicopter
hud_heist_crojob2_mission3_hl = "Conecte a Mangueira ao Vagão",--Connect hose with the wagon
hud_heist_crojob2_mission17_hl = "Pegue o Loot",--Take the loot
hud_heist_crojob2_mission15_hl = "Espere pelo Barco",--Wait for the boat
hud_heist_crojob2_mission18_hl = "Fuga Disponível",--Escape available
hud_heist_crojob2_mission3 = "Para começar a encher o vagão com água, você precisa conectar a mangueira ao vagão.",--In order to start filling up the wagon with water, you need to connect the hose with a wagon.
hud_heist_crojob2_mission21 = "Uma bomba de água próxima vai encher facilmente o vagão. Primeiro conecte a mangueira com a bomba e então continue esticando até alcançar o vagão!",--Water pump nearby will easily fill the wagon. Connect the hose with pump first and then keep extending it until you reach the wagon!
hud_heist_crojob2_mission25_hl = "Reinicie o Gerador",--Restart the generator
hud_heist_crojob2_mission18 = "A fuga está disponível agora. Você poderá sair ou ficar por mais loot.",--Escape is now available. You can leave or stay for more loot.
hud_heist_crojob2_mission23_hl = "Espere a Água encher o Vagão",--Wait for the water to fill the wagon
hud_heist_crojob2_mission28 = "Afaste-se e aproveite o show!",--Stand back and enjoy the show!
hud_heist_crojob2_mission20 = "Deixe a pasta de thermite fazer sua mágica. Está corroendo o aço, mas não vai demorar muito.",--Let the thermite paste do its magic. It's chewing through thick metal but it shouldn't take too long.
hud_heist_crojob2_mission24 = "A mangueira se soltou, reconecte-a para voltar a bombear.",--The hose has come loose, reconnect it to start pumping again.
hud_heist_crojob2_mission23 = "Paciência é uma virtude! Vai levar alguns minutos para encher, então prepare-se e fique vivo.",--Patience is a virtue! It's gonna take a couple of minutes to fill it up so dig in and stay alive.
hud_heist_crojob2_mission14_hl = "Espere pelo Helicóptero",--Wait for the helicopter
hud_heist_crojob2_mission22 = "Ligue o gerador para começar a bombear água.",--Start the generator to start pumping the water.
hud_heist_crojob2_mission12_hl = "Espere pelo Avião",--Wait for plane
hud_heist_crojob2_mission8 = "O avião está esperando por você na estrada.",--The plane is waiting for you on the road.
hud_heist_crojob2_mission7a = "Para que o avião pouse na estrada, você precisa cortar as árvores que estão ao redor.",--In order for a plane to land on the road, you need to cut the surrounding trees down.
hud_heist_crojob2_mission14 = "O helicóptero de fuga deve chegar em alguns minutos. Prepare-se e fique vivo até lá!",--The escape helicopter should arrive in a couple of minutes. Dig in and stay alive until then!
hud_heist_crojob2_mission28_hl = "Afaste-se",--Stand back
hud_heist_crojob2_mission6 = "O helicóptero estará esperando por você na vigia.",--The helicopter will be waiting for you at the lookout.
hud_heist_crojob2_mission20_hl = "Espere a Pasta de Thermite queimar",--Wait for thermite paste to burn through
hud_heist_crojob2_mission8_hl = "Leve o loot para o Avião",--Carry the loot to the plane
hud_heist_crojob2_mission7b_hl = "Corte as Árvores que Restaram",--Cut the remaining trees
hud_heist_crojob2_mission21_hl = "Conecte a Mangueira ao Vagão",--Connect the hose to the wagon
hud_heist_crojob2_mission25 = "O gerador parou devido à perda de pressão, vá até lá e o reinicie-o!",--Generator stopped due to loss of pressure, get there and restart it!
hud_heist_crojob2_mission4_hl = "Proteja o Helicóptero",--Protect the helicopter
hud_heist_crojob2_mission17 = "Pegue o loot e levo-o na fuga.",--Pick up the loot and take it to the escape.
hud_heist_crojob2_mission19 = "O helicóptero está enchendo o vagão com água. Vai levar alguns minutos até o helicóptero esvaziar o reservatório de água.",--The helicopter is filling the wagon with water. It's gonna take a couple of minutes until the helicopter empties its water container.
hud_heist_crojob2_mission1_hl = "Encontre o Vagão-Cofre",--Find the vault wagon
hud_heist_crojob2_mission7b = "Para o avião pousar na estrada, você precisará cortar as árvores que sobraram.",--In order for a plane to land on the road, you need to cut the remaining trees down.
hud_heist_crojob2_mission9_hl = "Leve o loot para o Barco",--Carry the loot to the boat
hud_heist_crojob2_mission2 = "Esse é o vagão que estávamos procurando. Use a pasta de thermite para abrir um buraco em cima dele. Assim o helicóptero poderá enchê-lo com água.",--That is the wagon we were looking for. Use thermite paste to burn a hole on top of it so that the helicopter can fill it up with water.
hud_heist_crojob2_mission12 = "O avião deve chegar em alguns minutos. Espere até ele pousar.",--The plane should be here in a couple of minutes. Wait for it until it lands.
hud_heist_crojob2_mission5_hl = "Leve o loot para a Van",--Carry the loot to the van
hud_heist_crojob2_mission6_hl = "Leve o loot para o Helicóptero",--Carry the loot to the helicopter
hud_heist_crojob2_mission24_hl = "Reconecte a Mangueira",--Reconnect the hose
hud_heist_crojob2_mission13 = "O helicóptero deve pousar a qualquer momento. Ele carrega uma mangueira que precisa ser conectada ao vagão.",--The helicopter should arrive in a few moments. It carries a hose which needs to be connected with a wagon.
hud_heist_crojob2_mission29_hl = "Encontre uma Motosserra",--Find chainsaw
hud_heist_crojob2_mission10 = "O helicóptero precisa reabastecer, ele deve voltar em alguns minutos. Aguente firme até ele voltar.",--The helicopter needs to refill, it should come back in a couple of minutes. Stand your ground until it comes back.
hud_heist_crojob2_mission2_hl = "Abra um Buraco no Vagão",--Burn a hole into the wagon
hud_heist_crojob2_mission10_hl = "Espere pelo Helicóptero",--Wait for the helicopter
hud_heist_crojob2_mission9 = "Tem uma tirolesa na beira do lago que você pode usar para levar o loot até o barco.",--There is a zip-line just by the lake which you can use to get the loot on the boat.
hud_heist_crojob2_mission22_hl = "Ligue o Gerador",--Start the generator
hud_heist_crojob2_mission27 = "Um dos vagões está transportando explosivos, procure a caixa com explosivos.",--One of the wagons was transporting C4, look for the crate with explosives.
hud_heist_crojob2_mission11_hl = "Marque a Estrada com Sinalizadores",--Mark the road with signal flares
hud_heist_crojob2_mission11 = "Faça uma pista improvisada para um avião marcando a estrada com sinalizadores.",--Make an improvised runway for a plane by marking the road with signal flares.
hud_heist_crojob2_mission16_hl = "Espere pela Van",--Wait for the van
hud_heist_crojob2_mission26_hl = "Plante a Carga Explosiva",--Deploy the explosive charge
hud_heist_crojob2_mission1 = "A explosão espalhou os vagões por toda a floresta. Entre na floresta e procure pelo vagão-cofre, você terá que abrir as portas de cada vagão para encontrar o que contém o cofre.",--Explosion has scattered the wagons all around the forest. Move into the forest and look for the vault wagon, you will have to open the doors on each one of them until you find the one with the vault.
hud_heist_crojob2_mission5 = "A van estará esperando por você na estrada principal.",--The van will be waiting for you just by the main road.
hud_heist_crojob2_mission29 = "Tem uma motosserra por aqui, encontre-a!",--There's a chainsaw somewhere around, find it!
hud_heist_crojob2_mission27_hl = "Encontre os Explosivos",--Find the explosives
hud_heist_crojob2_mission19_hl = "Espere até o Helicóptero encher o Vagão com Água",--Wait until the helicopter fills the wagon with water
hud_heist_crojob2_mission26 = "Jogue o explosivo e aproveite o show! Melhor se afastar um pouco.",--Dip the explosive in and enjoy the show! You might want stand back a bit though.
hud_heist_crojob2_mission4 = "Proteja o piloto e o helicóptero dos tiros inimigos enquanto o vagão é enchido com água.",--Protect the pilot and the helicopter from incoming enemy fire while it fills the vault with water.
hud_heist_crojob2_mission7a_hl = "Corte as Árvores",--Cut the trees
} |
#!/usr/bin/env luajit
local L = require 'linenoise'
local function completion (c, s)
if s:sub(1, 1) == 'h' then
L.addcompletion(c, 'hello')
L.addcompletion(c, 'hello there')
end
end
L.setcompletion(completion)
local history = 'history.txt'
L.historyload(history)
for line in L.lines( 'hello> ') do
if line ~= '' then
if line:sub(1, 1) == '/' then
local len = line:match'/historylen%s+(%d+)'
if len then
L.historysetmaxlen(len)
else
print("Unreconized command: " .. line)
end
else
print("echo: '" .. line .. "'")
L.historyadd(line)
L.historysave(history)
end
end
end
|
local Action = require(script.Parent.Action)
return Action("StampObjectOrientationSet", function(guid, custom)
return {
guid = guid,
custom = custom
}
end) |
artifact_time_anomaly = class({})
function artifact_time_anomaly:OnCreated( data )
-- ### VALUES START ### --
self.cooldown_reduction = 30
self.mana_cost_reduction = 40
self.cast_time_reduction = 20
self.spell_damage = 30
self.duration = 4
self.cooldown = 45.0
-- ### VALUES END ### --
if not IsServer() then return end
self.perkname = data.perkName
self.perkID = data.perkID
self.level = data.level
self.perkEffectiveness = data.perkEffectiveness
Change_PerkEffectivenessStats(self, true)
self:StartIntervalThink(0.1)
end
function artifact_time_anomaly:OnRemoved()
if not IsServer() then return end
Change_PerkEffectivenessStats(self, false)
end
function artifact_time_anomaly:DeclareFunctions()
local funcs = {
MODIFIER_PROPERTY_COOLDOWN_PERCENTAGE,
MODIFIER_PROPERTY_MANACOST_PERCENTAGE_STACKING,
MODIFIER_PROPERTY_CASTTIME_PERCENTAGE,
MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE
}
return funcs
end
function artifact_time_anomaly:OnIntervalThink()
if not IsServer() then return end
if not self.activated then return end
self.activated = false
self:SetStackCount( 10000 * self.perkEffectiveness )
local caster = self:GetParent()
local caster_loc = caster:GetAbsOrigin()
local team = caster:GetTeamNumber()
--Cast Range UI
--local castRangeUI = self.radius * ( self:GetStackCount() / 10000 )
--caster:SetModifierStackCount("castrange_modifier_ability", caster, castRangeUI)
--Cooldown UI
local cooldownUI = self.cooldown * ( self:GetStackCount() / 10000 )
caster:SetModifierStackCount("cooldown_modifier_ability", caster, cooldownUI)
local duration = self.duration * ( self:GetStackCount() / 10000 )
for i=0,9 do
local ability = caster:GetAbilityByIndex(i)
if ability ~= nil then
if ability:GetCooldownTimeRemaining() > 0 and ability:GetAbilityName() ~= "artifact_ability" then
ability:EndCooldown()
end
end
end
-- Sound --
caster:EmitSound("Hero_FacelessVoid.TimeWalk")
-- Particle --
local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_lone_druid/lone_druid_true_form_runes.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
ParticleManager:SetParticleControl( particle, 3, caster:GetAbsOrigin() )
ParticleManager:ReleaseParticleIndex( particle )
particle = nil
Timers:CreateTimer(duration, function()
self:SetStackCount(0)
if particle ~= nil then
ParticleManager:DestroyParticle( particle, false )
ParticleManager:ReleaseParticleIndex( particle )
particle = nil
end
end)
end
function artifact_time_anomaly:GetModifierPercentageCooldown( params )
return self.cooldown_reduction
end
function artifact_time_anomaly:GetModifierPercentageManacostStacking( params )
return self.mana_cost_reduction * ( self:GetStackCount() / 10000 )
end
function artifact_time_anomaly:GetModifierPercentageCasttime( params )
return self.cast_time_reduction * ( self:GetStackCount() / 10000 )
end
function artifact_time_anomaly:GetModifierSpellAmplify_Percentage( params )
return self.spell_damage * ( self:GetStackCount() / 10000 )
end
function artifact_time_anomaly:GetAttributes()
return MODIFIER_ATTRIBUTE_PERMANENT + MODIFIER_ATTRIBUTE_IGNORE_INVULNERABLE + MODIFIER_ATTRIBUTE_MULTIPLE
end
function artifact_time_anomaly:IsHidden()
return true
end
function artifact_time_anomaly:IsPurgable()
return false
end
function artifact_time_anomaly:IsPurgeException()
return false
end
function artifact_time_anomaly:IsStunDebuff()
return false
end
function artifact_time_anomaly:IsDebuff()
return false
end
|
-- bar indicator options
local Grid2Options = Grid2Options
local L = Grid2Options.L
Grid2Options:RegisterIndicatorOptions("multibar", true, function(self, indicator)
local layout, bars = {}, {}
self:MakeIndicatorTypeLevelOptions(indicator,layout)
self:MakeIndicatorLocationOptions(indicator,layout)
self:MakeIndicatorMultiBarAppearanceOptions(indicator,layout)
self:MakeIndicatorMultiBarMiscOptions(indicator,layout)
self:MakeIndicatorMultiBarTexturesOptions(indicator,bars)
local options = Grid2Options.indicatorsOptions[indicator.name].args; wipe(options)
options["bars"] = { type = "group", order = 10, name = L["Bars"], args = bars }
options["layout"] = { type = "group", order = 30, name = L["Layout"], args = layout }
if indicator.dbx.textureColor==nil then
local colors = {}
self:MakeIndicatorStatusOptions(indicator.sideKick, colors)
options["colors"] = { type = "group", order = 20, name = L["Main Bar Color"], args = colors }
end
end)
-- Grid2Options:MakeIndicatorBarDisplayOptions()
function Grid2Options:MakeIndicatorMultiBarAppearanceOptions(indicator,options)
self:MakeHeaderOptions( options, "Appearance" )
options.orientation = {
type = "select",
order = 15,
name = L["Orientation of the Bar"],
desc = L["Set status bar orientation."],
get = function ()
return indicator.dbx.orientation or "DEFAULT"
end,
set = function (_, v)
if v=="DEFAULT" then v= nil end
indicator:SetOrientation(v)
self:RefreshIndicator(indicator, "Layout")
end,
values={ ["DEFAULT"]= L["DEFAULT"], ["VERTICAL"] = L["VERTICAL"], ["HORIZONTAL"] = L["HORIZONTAL"]}
}
options.barWidth= {
type = "range",
order = 30,
name = L["Bar Width"],
desc = L["Choose zero to set the bar to the same width as parent frame"],
min = 0,
softMax = 75,
step = 1,
get = function ()
return indicator.dbx.width
end,
set = function (_, v)
if v==0 then v= nil end
indicator.dbx.width = v
self:RefreshIndicator(indicator, "Layout")
end,
}
options.barHeight= {
type = "range",
order = 40,
name = L["Bar Height"],
desc = L["Choose zero to set the bar to the same height as parent frame"],
min = 0,
softMax = 75,
step = 1,
get = function ()
return indicator.dbx.height
end,
set = function (_, v)
if v==0 then v= nil end
indicator.dbx.height = v
self:RefreshIndicator(indicator, "Layout")
end,
}
options.reverseFill= {
type = "toggle",
name = L["Reverse Fill"],
desc = L["Fill the bar in reverse."],
order = 55,
tristate = false,
get = function () return indicator.dbx.reverseFill end,
set = function (_, v)
indicator.dbx.reverseFill = v or nil
self:RefreshIndicator(indicator, "Layout")
end,
}
end
-- Grid2Options:MakeIndicatorBarMiscOptions()
function Grid2Options:MakeIndicatorMultiBarMiscOptions(indicator, options)
options.barOpacity = {
type = "range",
order = 43,
name = L["Opacity"],
desc = L["Set the opacity."],
min = 0,
max = 1,
step = 0.01,
bigStep = 0.05,
get = function () return indicator.dbx.opacity or 1 end,
set = function (_, v)
indicator.dbx.opacity = v
self:RefreshIndicator(indicator, "Layout")
end,
}
options.inverColor= {
type = "toggle",
name = L["Invert Bar Color"],
desc = L["Swap foreground/background colors on bars."],
order = 49,
tristate = false,
get = function () return indicator.dbx.invertColor end,
set = function (_, v)
indicator.dbx.invertColor = v or nil
self:RefreshIndicator(indicator.sideKick, "Update")
end,
}
end
-- Grid2Options:MakeIndicatorMultiBarTextures()
do
local ANCHOR_VALUES = { L["Previous Bar"], L["Topmost Bar"], L["Previous Bar & Reverse"] }
local DIRECTION_VALUES = { L['Normal'], L['Reverse'] }
local function GetBarValue(indicator, index, key)
local bar = indicator.dbx["bar"..index]
if bar then return bar[key] end
end
local function SetBarValue(indicator, index, key, value)
local bar = indicator.dbx["bar"..index]
if value then
if not bar then
bar = {}
indicator.dbx["bar"..index] = bar
end
bar[key] = value
else
bar[key] = nil
if not next(bar) then
indicator.dbx["bar"..index] = nil
end
end
end
local function RegisterIndicatorStatus(indicator, status, index)
if status then
Grid2:DbSetMap(indicator.name, status.name, index)
indicator:RegisterStatus(status, index)
end
end
local function UnregisterIndicatorStatus(indicator, status)
if status then
Grid2:DbSetMap(indicator.name, status.name, nil)
indicator:UnregisterStatus(status)
end
end
local function SetIndicatorStatusPriority(indicator, status, priority)
Grid2:DbSetMap( indicator.name, status.name, priority)
indicator:SetStatusPriority(status, priority)
end
local function UnregisterAllStatuses(indicator)
local statuses = indicator.statuses
while #statuses>0 do
UnregisterIndicatorStatus(indicator,statuses[#statuses])
end
end
local function SetIndicatorStatus(info, statusKey)
local indicator = info.arg.indicator
local index = info.arg.index
local newStatus = Grid2:GetStatusByName(statusKey)
local oldStatus = indicator.statuses[index]
local oldIndex = indicator.priorities[newStatus]
if oldStatus and oldIndex then
SetIndicatorStatusPriority(indicator, oldStatus, oldIndex)
SetIndicatorStatusPriority(indicator, newStatus, index)
else
UnregisterIndicatorStatus(indicator, oldStatus)
RegisterIndicatorStatus(indicator, newStatus , index)
end
Grid2Options:RefreshIndicator(indicator, "Layout")
end
local function GetAvailableStatusValues(info)
local indicator = info.arg.indicator
local index = info.arg.index
local list = {}
for statusKey, status in Grid2:IterateStatuses() do
if Grid2Options:IsCompatiblePair(indicator, status) and status.name~="test" and
( (not indicator.priorities[status]) or indicator.statuses[index] ) then
list[statusKey] = Grid2Options.LocalizeStatus(status)
end
end
return list
end
function Grid2Options:MakeIndicatorMultiBarTexturesOptions(indicator, options)
options.barSep = { type = "header", order = 50, name = L["Main Bar"] }
options.barMainStatus = {
type = "select",
order = 50.5,
name = L["Status"],
desc = function()
local status = indicator.statuses[1]
return status and self.LocalizeStatus(status)
end,
get = function ()
local status = indicator.statuses[1]
return status and status.name or nil
end,
set = SetIndicatorStatus,
values = GetAvailableStatusValues,
arg = { indicator = indicator, index = 1 }
}
options.barMainTexture = {
type = "select", dialogControl = "LSM30_Statusbar",
order = 51,
width = "half",
name = L["Texture"],
desc = L["Select bar texture."],
get = function (info) return indicator.dbx.texture or self.MEDIA_VALUE_DEFAULT end,
set = function (info, v)
indicator.dbx.texture = v~=self.MEDIA_VALUE_DEFAULT and v or nil
self:RefreshIndicator(indicator, "Layout")
end,
values = self.GetStatusBarValues,
hidden = function() return indicator.dbx.reverseMainBar end
}
options.barMainTextureColor = {
type = "color",
order = 52,
width = "half",
name = L["Color"],
desc = L["Bar Color"],
hasAlpha = true,
get = function()
local c = indicator.dbx.textureColor
if c then
return c.r, c.g, c.b, c.a
else
return 0,0,0,1
end
end,
set = function(info,r,g,b,a)
local c = indicator.dbx.textureColor
if not c then c = {}; indicator.dbx.textureColor = c end
c.r, c.g, c.b, c.a = r, g, b, a
self:RefreshIndicator(indicator, "Layout")
end,
hasAlpha = true,
hidden = function() return (indicator.dbx.textureColor == nil) or indicator.dbx.reverseMainBar end
}
options.barMainDirection = {
type = "select",
name = L["Direction"],
desc = L["Select the direction of the main bar."],
order = 50.7,
get = function ()
return indicator.dbx.reverseMainBar and 2 or 1
end,
set = function (_, v)
indicator.dbx.reverseMainBar = (v==2) or nil
self:RefreshIndicator(indicator, "Layout" )
end,
values = DIRECTION_VALUES,
hidden = function() return indicator.dbx.textureColor == nil end,
}
--[[
options.barMainReverse = {
type = "toggle",
name = L["Reverse"],
desc = L["Fill bar in reverse"],
width = "half",
order = 53,
tristate = false,
get = function () return indicator.dbx.reverseMainBar end,
set = function (_, v)
indicator.dbx.reverseMainBar = v or nil
self:RefreshIndicator(indicator, "Layout" )
end,
hidden = function() return indicator.dbx.textureColor == nil end,
}--]]
options.barStatusesColorize = {
type = "toggle",
name = L["Status Color"],
desc = L["Specify a list of statuses to Colorize the bar"],
width = "normal",
order = 54,
tristate = false,
get = function () return indicator.dbx.textureColor == nil end,
set = function (_, v)
if v then
indicator.dbx.textureColor = nil
indicator.dbx.reverseMainBar = nil
else
UnregisterAllStatuses(indicator.sideKick)
indicator.dbx.textureColor = { r=0,g=0,b=0,a=1 }
end
self:RefreshIndicator(indicator, "Layout" )
self:MakeIndicatorOptions(indicator)
end,
hidden = function() return indicator.dbx.reverseMainBar end
}
for i=1,(indicator.dbx.barCount or 0) do
options["barSep"..i] = { type = "header", order = 50+i*5, name = L["Extra Bar"] .. " "..i }
options["Status"..i] = {
type = "select",
order = 50+i*5+1,
name = L["Status"],
desc = function()
local status = indicator.statuses[i+1]
return status and self.LocalizeStatus(status)
end,
get = function ()
local status = indicator.statuses[i+1]
return status and status.name or nil
end,
set = SetIndicatorStatus,
values = GetAvailableStatusValues,
disabled = function() return not indicator.statuses[i] end,
arg = { indicator = indicator, index = i+1},
}
options["barAnchorTo"..i] = {
type = "select",
name = L["Anchor & Direction"],
desc = L["Select where to anchor the bar and optional you can reverse the grow direction."],
order = 50+i*5+2,
get = function () return (GetBarValue(indicator, i, "reverse") and 3) or (GetBarValue(indicator, i, "noOverlap") and 2) or 1 end,
set = function (_, v)
SetBarValue(indicator,i,"reverse", (v==3) or nil )
SetBarValue(indicator,i,"noOverlap", (v==2) or nil )
self:RefreshIndicator(indicator, "Layout")
end,
values = ANCHOR_VALUES,
}
options["barTexture"..i] = {
type = "select", dialogControl = "LSM30_Statusbar",
order = 50+i*5+3,
width = "half",
name = L["Texture"],
desc = L["Select bar texture."],
get = function (info) return GetBarValue(indicator, i, "texture") or indicator.dbx.texture or self.MEDIA_VALUE_DEFAULT end,
set = function (info, v)
SetBarValue(indicator, i, "texture", (v~=indicator.dbx.texture and v~=self.MEDIA_VALUE_DEFAULT) and v or nil)
self:RefreshIndicator(indicator, "Layout")
end,
values = self.GetStatusBarValues,
}
options["barTextureColor"..i] = {
type = "color",
order = 50+i*5+4,
name = L["Color"],
desc = L["Select bar color"],
width = "half",
get = function()
local c = GetBarValue(indicator, i, "color")
if c then return c.r, c.g, c.b, c.a end
end,
set = function( info, r,g,b,a )
local c = GetBarValue(indicator, i, "color")
if c then
c.r, c.g, c.b, c.a = r, g, b, a
else
SetBarValue(indicator, i, "color", {r=r, g=g, b=b, a=a} )
end
self:RefreshIndicator(indicator, "Layout")
end,
hasAlpha = true,
}
end
if indicator.dbx.backColor then
options.barSepBack = { type = "header", order = 100, name = L["Background"] }
options.backTexture = {
type = "select", dialogControl = "LSM30_Statusbar",
order = 101,
width = "half",
name = L["Texture"],
desc = L["Adjust the background texture."],
get = function (info) return indicator.dbx.backTexture or indicator.dbx.texture or self.MEDIA_VALUE_DEFAULT end,
set = function (info, v)
indicator.dbx.backTexture = v~=self.MEDIA_VALUE_DEFAULT and v or nil
self:RefreshIndicator(indicator, "Layout")
end,
values = self.GetStatusBarValues,
hidden = function() return not indicator.dbx.backColor end
}
options.backColor = {
type = "color",
order = 102,
width = "half",
name = L["Color"],
desc = L["Background Color"],
hasAlpha = true,
get = function()
local c = indicator.dbx.backColor
if c then
return c.r, c.g, c.b, c.a
else
return 0,0,0,1
end
end,
set = function(info,r,g,b,a)
local c = indicator.dbx.backColor
if not c then c = {}; indicator.dbx.backColor = c end
c.r, c.g, c.b, c.a = r, g, b, a
self:RefreshIndicator(indicator, "Layout")
end,
hidden = function() return not indicator.dbx.backColor end
}
options.backMainAnchor= {
type = "toggle",
name = L["Anchor to MainBar"],
desc = L["Anchor the background bar to the Main Bar instead of the last bar."],
--width = "double",
order = 103,
tristate = false,
get = function () return indicator.dbx.backMainAnchor end,
set = function (_, v)
indicator.dbx.backMainAnchor = v or nil
self:RefreshIndicator(indicator, "Layout")
end,
}
end
options.changeBarSep = { type = "header", order = 150, name = "" }
options.addBar = {
type = "execute",
order = 151,
name = L["Add"],
width = "half",
desc = L["Add a new bar"],
func = function(info)
indicator.dbx.barCount = (indicator.dbx.barCount or 0) + 1
self:RefreshIndicator(indicator, "Layout")
self:MakeIndicatorOptions(indicator)
end,
disabled = function() return (indicator.dbx.barCount or 0)>=5 end
}
options.delBar = {
type = "execute",
order = 152,
name = L["Delete"],
width = "half",
desc = L["Delete last bar"],
func = function(info)
local index = indicator.dbx.barCount or 0
UnregisterIndicatorStatus(indicator, indicator.statuses[index+1])
if index>0 then
indicator.dbx["bar"..index] = nil
indicator.dbx.barCount = index>1 and index - 1 or nil
end
self:RefreshIndicator(indicator, "Layout")
self:MakeIndicatorOptions(indicator)
end,
disabled = function() return (not indicator.dbx.barCount) and indicator.statuses[1]==nil end
}
options.enableBack = {
type = "toggle",
name = L["Enable Background"],
desc = L["Enable Background"],
order = 153,
get = function () return indicator.dbx.backColor~=nil end,
set = function (_, v)
if v then
indicator.dbx.backColor = { r=0,g=0,b=0,a=1 }
else
indicator.dbx.backColor = nil
end
self:RefreshIndicator(indicator, "Layout")
self:MakeIndicatorOptions(indicator)
end,
}
end
end
|
local pmtable=require("puremake.table")
for n,v in pairs(pmtable) do table[n]=v end
|
local json = require("dkjson")
math = require("math")
pipeline_depth = 16
math.randomseed(os.time())
request = function()
local r = {}
wrk.scheme = "http"
wrk.headers["Accept"] = "*/*"
wrk.headers["User-Agent"] = "HTTPie/0.8.0"
wrk.method = "GET"
for i=1,pipeline_depth do
r[i] = wrk.format(nil, "/" .. tostring(math.random(1, 10000)) .. "/")
end
return table.concat(r)
end
|
local local0 = 0.5
local local1 = 1
function OnIf_262030(arg0, arg1, arg2)
if arg2 == 0 then
Crowd_Wheelchair_FlameThrower262030_ActAfter_RealTime(arg0, arg1)
end
return
end
local0 = local1
function Crowd_Wheelchair_FlameThrower262030Battle_Activate(arg0, arg1)
local local0 = {}
local local1 = {}
local local2 = {}
Common_Clear_Param(local0, local1, local2)
local local3 = arg0:GetDist(TARGET_ENE_0)
local local4 = arg0:GetEventRequest()
local local5 = arg0:GetRandam_Int(1, 100)
local local6 = arg0:GetHpRate(TARGET_SELF)
if not not arg0:HasSpecialEffectId(TARGET_SELF, 5618) or arg0:HasSpecialEffectId(TARGET_SELF, 5619) then
local local7 = 0
SETUPVAL 9 0 0
end
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_B, 180) then
local0[10] = 100
elseif arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_F, 60) then
if local3 <= 5 then
local0[1] = 40
local0[2] = 60
else
local0[1] = 80
local0[2] = 20
end
elseif local3 <= 5 then
local0[1] = 0
local0[2] = 100
else
local0[1] = 60
local0[2] = 40
end
local1[1] = REGIST_FUNC(arg0, arg1, Crowd_Wheelchair_FlameThrower262030_Act01)
local1[2] = REGIST_FUNC(arg0, arg1, Crowd_Wheelchair_FlameThrower262030_Act02)
local1[10] = REGIST_FUNC(arg0, arg1, Crowd_Wheelchair_FlameThrower262030_Act10)
Common_Battle_Activate(arg0, arg1, local0, local1, REGIST_FUNC(arg0, arg1, Crowd_Wheelchair_FlameThrower262030_ActAfter_AdjustSpace), local2)
return
end
local0 = 5.7 - local0
local0 = 1.5 - local0
local0 = local1
function Crowd_Wheelchair_FlameThrower262030_Act01(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = arg0:GetRandam_Int(1, 100)
local local2 = UPVAL0 + 0.5
local local3 = UPVAL0
if arg0:HasSpecialEffectId(TARGET_SELF, 5618) then
local2 = DIST_None
local3 = 9999
end
if UPVAL2 == 0 and arg0:HasSpecialEffectId(TARGET_SELF, 5619) and local3 <= local0 then
arg1:AddSubGoal(GOAL_COMMON_Wait, 1, TARGET_ENE_0, 0, 0, 0)
elseif arg0:HasSpecialEffectId(TARGET_SELF, 5618) == false and arg0:HasSpecialEffectId(TARGET_SELF, 5619) == false then
if local0 <= UPVAL1 then
arg1:AddSubGoal(GOAL_COMMON_LeaveTarget, 3, TARGET_ENE_0, 1.5, TARGET_ENE_0, true, -1)
else
Approach_Act(arg0, arg1, local3, 0, 0, 3)
end
end
if arg0:GetNpcThinkParamID() <= 262899 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3016, TARGET_ENE_0, local2, 0, 0)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3018, TARGET_ENE_0, local2, 0, 0)
end
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 5.7 - local0
local0 = 1.5 - local0
local0 = local1
function Crowd_Wheelchair_FlameThrower262030_Act02(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = arg0:GetRandam_Int(1, 100)
local local2 = UPVAL0 + 0.5
local local3 = UPVAL0
if arg0:HasSpecialEffectId(TARGET_SELF, 5618) then
local2 = DIST_None
local3 = 9999
end
if UPVAL2 == 0 and arg0:HasSpecialEffectId(TARGET_SELF, 5619) and local3 <= local0 then
arg1:AddSubGoal(GOAL_COMMON_Wait, 1, TARGET_ENE_0, 0, 0, 0)
elseif arg0:HasSpecialEffectId(TARGET_SELF, 5618) == false and arg0:HasSpecialEffectId(TARGET_SELF, 5619) == false then
if local0 <= UPVAL1 then
arg1:AddSubGoal(GOAL_COMMON_LeaveTarget, 3, TARGET_ENE_0, 1.5, TARGET_ENE_0, true, -1)
else
Approach_Act(arg0, arg1, local3, 0, 0, 3)
end
end
if arg0:GetNpcThinkParamID() <= 262899 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3017, TARGET_ENE_0, local2, 0, 0)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3019, TARGET_ENE_0, local2, 0, 0)
end
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
function Crowd_Wheelchair_FlameThrower262030_Act10(arg0, arg1, arg2)
if arg0:GetDist(TARGET_ENE_0) <= 3 then
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_B, 180) then
arg1:AddSubGoal(GOAL_COMMON_Turn, 3, TARGET_ENE_0, 15, 0, 0)
else
arg1:AddSubGoal(GOAL_COMMON_LeaveTarget, 3, TARGET_ENE_0, 3, TARGET_ENE_0, true, -1)
end
else
arg1:AddSubGoal(GOAL_COMMON_Turn, 3, TARGET_ENE_0, 15, 0, 0)
end
GetWellSpace_Odds = 0
return GetWellSpace_Odds
end
function Crowd_Wheelchair_FlameThrower262030_ActAfter_AdjustSpace(arg0, arg1, arg2)
arg1:AddSubGoal(GOAL_COMMON_If, 10, 0)
return
end
function Crowd_Wheelchair_FlameThrower262030_ActAfter_RealTime(arg0, arg1)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = arg0:GetRandam_Int(1, 100)
local local2 = arg0:GetRandam_Float(1.5, 2.5)
local local3 = arg0:GetRandam_Float(2.5, 3.5)
if local0 <= 3 then
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_F, 120) then
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_B, 180) then
arg1:AddSubGoal(GOAL_COMMON_Turn, 3, TARGET_ENE_0, 15, 0, 0)
else
arg1:AddSubGoal(GOAL_COMMON_LeaveTarget, 3, TARGET_ENE_0, 3, TARGET_ENE_0, true, -1)
end
end
elseif local0 <= 8 then
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_F, 120) then
arg1:AddSubGoal(GOAL_COMMON_Wait, arg0:GetRandam_Float(0.5, 1.5), TARGET_ENE_0, 0, 0, 0)
else
arg1:AddSubGoal(GOAL_COMMON_Turn, 3, TARGET_ENE_0, 15, 0, 0)
end
elseif arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_F, 120) then
arg1:AddSubGoal(GOAL_COMMON_Wait, arg0:GetRandam_Float(1.5, 3), TARGET_ENE_0, 0, 0, 0)
else
arg1:AddSubGoal(GOAL_COMMON_Turn, 3, TARGET_ENE_0, 15, 0, 0)
end
return
end
function Crowd_Wheelchair_FlameThrower262030Battle_Update(arg0, arg1)
return GOAL_RESULT_Continue
end
function Crowd_Wheelchair_FlameThrower262030Battle_Terminate(arg0, arg1)
return
end
function Crowd_Wheelchair_FlameThrower262030Battle_Interupt(arg0, arg1)
if arg0:IsLadderAct(TARGET_SELF) then
return false
else
return false
end
end
return
|
if SERVER then
AddCSLuaFile()
end
SWEP.PrintName = "Welding Torch"
SWEP.Author = "Ultra"
SWEP.Instructions = "Aim at a car and hold left click to repair it."
SWEP.Base = "weapon_sck_base"
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
SWEP.ViewModelFOV = 70
SWEP.Spawnable = false
SWEP.Slot = 5
SWEP.UseHands = false
SWEP.HoldType = "pistol"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.ShowWorldModel = false
SWEP.ShowViewModel = false
SWEP.VElements = {
["vm_weld"] = { type = "Model", model = "models/props_silo/welding_torch.mdl", bone = "ValveBiped.muzzle", rel = "", pos = Vector(-18.713, 3.181, -0.009), angle = Angle(-0.311, -96.331, 34.599), size = Vector(1.261, 1.261, 1.261), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["wm_weld"] = { type = "Model", model = "models/props_silo/welding_torch.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(-0.921, 1.781, 1.427), angle = Angle(92.996, -69.224, 11.053), size = Vector(1.016, 1.016, 1.016), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
function SWEP:SetupDataTables()
self:NetworkVar( "Bool", 0, "Welding" )
end
function SWEP:PrimaryAttack()
if self.m_intNextWeldTrace then return end
self.m_intNextWeldTrace = CurTime() +1
end
function SWEP:SecondaryAttack()
end
function SWEP:WeldTrace()
if (self.m_intWeldFX or 0) > CurTime() then return end
self.m_intWeldFX = CurTime() +0.1
local tr = util.TraceLine{
start = self.Owner:GetShootPos(),
endpos = self.Owner:GetShootPos() +self.Owner:GetAimVector() *64,
filter = { self, self.Owner }
}
if not IsValid( tr.Entity ) then return end
local effectData = EffectData()
effectData:SetOrigin( tr.HitPos )
effectData:SetNormal( tr.HitNormal )
util.Effect( "StunstickImpact", effectData )
if not self.m_intNextWeldTrace then return end
if self.m_intNextWeldTrace > CurTime() then return end
self.m_intNextWeldTrace = CurTime() +1
if not IsValid( tr.Entity ) or not tr.Entity:IsVehicle() or not tr.Entity.UID then return end
local cur, max = GAMEMODE.Cars:GetCarHealth( tr.Entity ), GAMEMODE.Cars:GetCarMaxHealth( tr.Entity )
if cur >= max *0.33 then return end
GAMEMODE.Cars:SetCarHealth( tr.Entity, math.min(cur +math.Round(max *0.01), max *0.33) )
end
function SWEP:Think()
if SERVER then
if not IsValid( self.Owner ) then return end
if self.Owner:KeyDown( IN_ATTACK ) and not self.Owner:InVehicle() then
if GAMEMODE.Util:VectorInRange( self.Owner:GetPos(),
GAMEMODE.Config.TowWelderZone.Min,
GAMEMODE.Config.TowWelderZone.Max ) then
if not self:GetWelding() then
self:SetWelding( true )
end
self:WeldTrace()
else
if not self.m_bHintedGarageZone then
self.Owner:AddNote( "You must be inside the tow garage to use this tool." )
self.m_bHintedGarageZone = true
end
if self:GetWelding() then
self:SetWelding( false )
end
end
else
self.m_bHintedGarageZone = nil
if self:GetWelding() then
self:SetWelding( false )
end
end
else
if self:GetWelding() and IsValid( self.Owner ) and not self.Owner:InVehicle() then
if not self.m_sndWelding or not self.m_sndWelding:IsPlaying() then
self.m_sndWelding = self.m_sndWelding or CreateSound( self, "ambient/levels/outland/ol11_welding_loop.wav" )
self.m_sndWelding:Play()
end
if CurTime() >(self.m_intLastFx or 0) then
self.m_intLastFx = CurTime() +0.1
--local effectData = EffectData()
--effectData:SetOrigin( self.Owner:GetShootPos() +(self.Owner:GetAimVector() *24) )
--util.Effect( "ManhackSparks", effectData )
end
else
if self.m_sndWelding and self.m_sndWelding:IsPlaying() then
self.m_sndWelding:Stop()
end
if self.m_intLastFx then self.m_intLastFx = nil end
end
end
end
local MAT_HEALTH_ICON = Material( "icon16/heart.png" )
local colGreen = Color( 50, 255, 50, 255 )
local colRed = Color( 255, 50, 50, 255 )
local iconSize = 16
hook.Add( "HUDPaint", "DrawWelderHud", function()
if not IsValid( LocalPlayer() ) or not IsValid( LocalPlayer():GetActiveWeapon() ) then return end
if LocalPlayer():GetActiveWeapon():GetClass() ~= "weapon_vehicle_welder" then return end
if LocalPlayer():InVehicle() then return end
local ent = LocalPlayer():GetEyeTrace().Entity
if not IsValid( ent ) or not ent:IsVehicle() then return end
if ent:GetPos():DistToSqr( LocalPlayer():GetPos() ) > 36000 then return end
local pos = ent:LocalToWorld( ent:OBBCenter() ):ToScreen()
local cur, max = GAMEMODE.Cars:GetCarHealth( ent ), GAMEMODE.Cars:GetCarMaxHealth( ent )
draw.SimpleText(
math.max( math.floor(cur), 0 ).. "/".. max,
"Trebuchet24",
pos.x,
pos.y,
cur >= max *0.33 and colGreen or colRed,
TEXT_ALIGN_CENTER,
TEXT_ALIGN_TOP
)
surface.SetMaterial( MAT_HEALTH_ICON )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( pos.x -(iconSize /2), pos.y -iconSize, iconSize, iconSize )
end ) |
local tablex = require "pl.tablex"
-------------------------------------------------------------------------------------
local State = {}
State.__index = State
State.__type = "class"
State.__class = "State"
State.__is_state_class = true
-------------------------------------------------------------------------------------
function State:AfterReload() end
--------------------------------------------------------------------------
function State:OnTimer() end
function State:LocallyOwned() return false end
function State:Settable() return false end
function State:Status()
return self:IsReady(), self:GetValue()
end
-------------------------------------------------------------------------------------
function State:GetDescription() return tablex.copy(self.description or {}) end
function State:GetSourceDependencyDescription()
return nil -- "[updates]"
end
function State:SetValue(v) error(self:LogTag() .. "abstract method called") end
function State:GetValue() error(self:LogTag() .. "abstract method called") end
function State:GetName() return self.name end
function State:IsReady() return false end
function State:LogTag()
if not self.log_tag then
self.log_tag = string.format("%s(%s): ", self.__class, self.global_id)
end
return self.log_tag
end
function State:Update() return self:IsReady() end
function State:RetireValue() end
-------------------------------------------------------------------------------------
function State:AddSourceDependency(dependant_state, source_id)
print(self:LogTag(), "Added dependency " .. dependant_state.global_id ..
" to " .. self.global_id)
self.source_dependencies[dependant_state.global_id] = table.weak_values {
target = dependant_state,
source_id = source_id,
}
dependant_state:AddSinkDependency(self, nil)
self:RetireValue()
end
function State:GetSourceDependencyList()
return self:GetDependencyList(self.source_dependencies)
end
function State:HasSourceDependencies()
for _, v in pairs(self.source_dependencies) do return true end
return false
end
function State:GetDependantValues()
local dependant_values = {}
for id, dep in pairs(self.source_dependencies) do
if (not dep.target) or (not dep.target:IsReady()) then
print(self:LogTag(), "Dependency " .. id .. " is not yet ready")
return nil
end
local value
SafeCall(function()
value = dep.target:GetValue()
end)
if value == nil then
print(self:LogTag(), "Dependency " .. id .. " has no value")
return nil
end
table.insert(dependant_values,
{value=value, id = id, source_id = dep.source_id})
end
return dependant_values
end
-------------------------------------------------------------------------------------
function State:AddSinkDependency(listener, virtual)
print(self:LogTag(), "Added listener " .. listener.global_id)
self.sink_dependencies[listener.global_id] = table.weak_values {
target = listener,
virtual = virtual
}
if self:IsReady() and not virtual then
SafeCall(function() listener:SourceChanged(self, self:GetValue()) end)
end
end
function State:CallSinkListeners(result_value)
for id, dep in pairs(self.sink_dependencies) do
-- print(self:LogTag(), "Calling listener " .. v.global_id)
if not dep.target then
print(self:LogTag(), "Dependency " .. id .. " is expired")
elseif dep.virtual then
print(self:LogTag(), "Dependency " .. id .. " is virtual")
else
SafeCall(function()
dep.target:SourceChanged(self, result_value)
end)
end
end
end
function State:GetSinkDependencyList()
return self:GetDependencyList(self.sink_dependencies)
end
function State:HasSinkDependencies()
for _, v in pairs(self.sink_dependencies) do return true end
return false
end
function State:SourceChanged(source, source_value)
if self:IsReady() then
self:Update()
end
end
-------------------------------------------------------------------------------------
function State:SetError(...)
local message = string.format(...)
print(self, message)
end
function State:GetDependencyList(list)
local r = {}
for id, v in pairs(list or {}) do
table.insert(r, {id = id, virtual = v.virtual, expired = v.target == nil})
end
return r
end
function State:Create(config)
assert(self.global_id)
self.name = config.name
if type(config.description) ~= "table" then
self.description = {config.description}
else
self.description = config.description
end
self.sink_dependencies = {}
self.source_dependencies = {}
for k, v in pairs(config.source_dependencies or {}) do
self:AddSourceDependency(v, type(k) == "string" and k or nil)
end
for _, v in ipairs(config.sink_dependencies or {}) do
self:AddSinkDependency(v)
end
end
-------------------------------------------------------------------------------------
return {
Class = State,
-- BaseClass = nil,
__deps = {
class_reg = "state-class-reg",
},
Init = function(instance)
end
}
|
-- This file is under copyright, and is bound to the agreement stated in the EULA.
-- Any 3rd party content has been used as either public domain or with permission.
-- © Copyright 2016-2017 Aritz Beobide-Cardinal All rights reserved.
local APP = ARCPhone.NewServerAppObject()
APP.Number = "0000000001" -- Boring, I know. I guess 0000000 to 0000099 is reserved for me, then
function APP:OnText(num,data)
MsgN("CONTACTS APP GOT TEXT FROM "..num)
if data == "f" then
local ply = ARCPhone.GetPlayerFromPhoneNumber(num)
if IsValid(ply) then
local pos = ply:GetPos()
local people = player.GetHumans()
local numbers = {}
table.sort( people, function( a, b ) return a:GetPos():DistToSqr(pos) < b:GetPos():DistToSqr(pos) end )
for i,v in ipairs(people) do
if v != ply then
table.insert(numbers,ARCPhone.GetPhoneNumber(v))
end
end
self:SendText(num,table.concat(numbers, " "))
end
end
end
ARCPhone.RegisterServerApp(APP) |
local id = require "util.id";
local http_formdecode = require "net.http".formdecode;
local usermanager = require "core.usermanager";
local nodeprep = require "util.encodings".stringprep.nodeprep;
local st = require "util.stanza";
local url_escape = require "util.http".urlencode;
local render_html_template = require"util.interpolation".new("%b{}", st.xml_escape, {
urlescape = url_escape;
});
local site_name = module:get_option_string("site_name", module.host);
module:depends("http");
module:depends("easy_invite");
local invites = module:depends("invites");
local invites_page = module:depends("invites_page");
function serve_register_page(event)
local register_page_template = assert(module:load_resource("html/register.html")):read("*a");
local invite = invites.get(event.request.url.query);
if not invite then
return {
status_code = 303;
headers = {
["Location"] = invites.module:http_url().."?"..event.request.url.query;
};
};
end
local invite_page = render_html_template(register_page_template, {
site_name = site_name;
token = invite.token;
domain = module.host;
uri = invite.uri;
type = invite.type;
jid = invite.jid;
});
return invite_page;
end
function handle_register_form(event)
local request, response = event.request, event.response;
local form_data = http_formdecode(request.body);
local user, password, token = form_data["user"], form_data["password"], form_data["token"];
local register_page_template = assert(module:load_resource("html/register.html")):read("*a");
local error_template = assert(module:load_resource("html/register_error.html")):read("*a");
local success_template = assert(module:load_resource("html/register_success.html")):read("*a");
local invite = invites.get(token);
if not invite then
return {
status_code = 303;
headers = {
["Location"] = invites_page.module:http_url().."?"..event.request.url.query;
};
};
end
response.headers.content_type = "text/html; charset=utf-8";
if not user or #user == 0 or not password or #password == 0 or not token then
return render_html_template(register_page_template, {
site_name = site_name;
token = invite.token;
domain = module.host;
uri = invite.uri;
type = invite.type;
jid = invite.jid;
msg_class = "alert-warning";
message = "Please fill in all fields.";
});
end
-- Shamelessly copied from mod_register_web.
local prepped_username = nodeprep(user);
if not prepped_username or #prepped_username == 0 then
return render_html_template(register_page_template, {
site_name = site_name;
token = invite.token;
domain = module.host;
uri = invite.uri;
type = invite.type;
jid = invite.jid;
msg_class = "alert-warning";
message = "This username contains invalid characters.";
});
end
if usermanager.user_exists(prepped_username, module.host) then
return render_html_template(register_page_template, {
site_name = site_name;
token = invite.token;
domain = module.host;
uri = invite.uri;
type = invite.type;
jid = invite.jid;
msg_class = "alert-warning";
message = "This username is already in use.";
});
end
local registering = {
validated_invite = invite;
username = prepped_username;
host = module.host;
allowed = true;
};
module:fire_event("user-registering", registering);
if not registering.allowed then
return render_html_template(error_template, {
site_name = site_name;
msg_class = "alert-danger";
message = registering.reason or "Registration is not allowed.";
});
end
local ok, err = usermanager.create_user(prepped_username, password, module.host);
if ok then
module:fire_event("user-registered", {
username = prepped_username;
host = module.host;
source = "mod_"..module.name;
validated_invite = invite;
});
return render_html_template(success_template, {
site_name = site_name;
username = prepped_username;
domain = module.host;
password = password;
});
else
local err_id = id.short();
module:log("warn", "Registration failed (%s): %s", err_id, tostring(err));
return render_html_template(error_template, {
site_name = site_name;
msg_class = "alert-danger";
message = ("An unknown error has occurred (%s)"):format(err_id);
});
end
end
module:provides("http", {
route = {
["GET"] = serve_register_page;
["POST"] = handle_register_form;
};
});
|
-- Copyright (c) 2021 Kirazy
-- Part of Artisanal Reskins: Bob's Mods
--
-- See LICENSE in the project directory for license information.
-- Core functions
require("prototypes.functions.functions")
require("prototypes.functions.circuit-sprites")
----------------------------------------------------------------------------------------------------
-- ENTITIES
----------------------------------------------------------------------------------------------------
-- Bob's Assembly
require("prototypes.entity.assembly.centrifuge")
require("prototypes.entity.assembly.distillery")
require("prototypes.entity.assembly.electrolyser")
require("prototypes.entity.assembly.electric-furnace")
require("prototypes.entity.assembly.steel-furnace")
require("prototypes.entity.assembly.stone-furnace")
-- Bob's Logistics
require("prototypes.entity.logistics.cargo-wagon")
require("prototypes.entity.logistics.chest")
require("prototypes.entity.logistics.construction-robots")
require("prototypes.entity.logistics.fluid-wagon")
require("prototypes.entity.logistics.inserter")
require("prototypes.entity.logistics.inserter-overhaul")
require("prototypes.entity.logistics.locomotive")
require("prototypes.entity.logistics.logistic-robots")
require("prototypes.entity.logistics.logistic-zone-expander")
require("prototypes.entity.logistics.logistic-zone-interface")
require("prototypes.entity.logistics.pipe")
require("prototypes.entity.logistics.pump")
require("prototypes.entity.logistics.robo-charge-port")
require("prototypes.entity.logistics.robochest")
require("prototypes.entity.logistics.roboport")
require("prototypes.entity.logistics.storage-tank-all-corners")
require("prototypes.entity.logistics.storage-tank")
require("prototypes.entity.logistics.valve")
-- Bob's Mining
require("prototypes.entity.mining.mining-drill")
require("prototypes.entity.mining.pumpjack")
-- Bob's Modules
require("prototypes.entity.modules.beacon-module-slots")
require("prototypes.entity.modules.beacon")
-- Bob's Metals, Chemicals, and Intermediates
require("prototypes.entity.plates.air-and-water-pump")
require("prototypes.entity.plates.small-storage-tank")
-- require("prototypes.entity.plates.void-pump")
-- Bob's Ores
require("prototypes.entity.ores.ores")
require("prototypes.entity.ores.fluids")
-- Bob's Power
require("prototypes.entity.power.accumulator")
require("prototypes.entity.power.big-electric-pole")
require("prototypes.entity.power.boiler")
require("prototypes.entity.power.burner-electric-generator")
require("prototypes.entity.power.generator")
require("prototypes.entity.power.heat-exchanger")
require("prototypes.entity.power.heat-pipe")
require("prototypes.entity.power.heat-source")
require("prototypes.entity.power.medium-electric-pole")
require("prototypes.entity.power.solar-panel")
require("prototypes.entity.power.steam-engine")
require("prototypes.entity.power.steam-turbine")
require("prototypes.entity.power.substation")
-- Bob's Technology
-- require("prototypes.entity.technology.lab") -- Partially implemented, not functional in normal resolution
-- Bob's Warfare
require("prototypes.entity.warfare.artillery-turret")
require("prototypes.entity.warfare.artillery-wagon")
require("prototypes.entity.warfare.beam")
require("prototypes.entity.warfare.gun-turret")
require("prototypes.entity.warfare.land-mines")
require("prototypes.entity.warfare.laser-turret")
require("prototypes.entity.warfare.plasma-turret")
require("prototypes.entity.warfare.radar")
require("prototypes.entity.warfare.sniper-turret")
require("prototypes.entity.warfare.tank")
require("prototypes.entity.warfare.wall")
require("prototypes.entity.warfare.gate")
----------------------------------------------------------------------------------------------------
-- EQUIPMENT
----------------------------------------------------------------------------------------------------
-- Bob's Personal Equipment
require("prototypes.equipment.equipment.battery")
require("prototypes.equipment.equipment.energy-shield")
require("prototypes.equipment.equipment.exoskeleton")
require("prototypes.equipment.equipment.fusion-reactor")
require("prototypes.equipment.equipment.laser-defense")
require("prototypes.equipment.equipment.night-vision")
require("prototypes.equipment.equipment.personal-roboport")
require("prototypes.equipment.equipment.roboport-parts")
require("prototypes.equipment.equipment.solar-panel")
-- Bob's Vehicle Equipment
require("prototypes.equipment.vehicle-equipment.vehicle-battery")
require("prototypes.equipment.vehicle-equipment.vehicle-belt-immunity")
require("prototypes.equipment.vehicle-equipment.vehicle-energy-shield")
require("prototypes.equipment.vehicle-equipment.vehicle-fusion-cell")
require("prototypes.equipment.vehicle-equipment.vehicle-fusion-reactor")
require("prototypes.equipment.vehicle-equipment.vehicle-laser-defense")
require("prototypes.equipment.vehicle-equipment.vehicle-mobility")
require("prototypes.equipment.vehicle-equipment.vehicle-plasma-turret")
require("prototypes.equipment.vehicle-equipment.vehicle-roboport")
require("prototypes.equipment.vehicle-equipment.vehicle-roboport-parts")
require("prototypes.equipment.vehicle-equipment.vehicle-solar-panel")
----------------------------------------------------------------------------------------------------
-- ITEMS
----------------------------------------------------------------------------------------------------
require("prototypes.item.electronics")
require("prototypes.item.enemies")
require("prototypes.item.greenhouse")
require("prototypes.item.logistics")
require("prototypes.item.modules")
require("prototypes.item.ores")
require("prototypes.item.plates")
require("prototypes.item.revamp")
require("prototypes.item.technology")
require("prototypes.item.warfare")
----------------------------------------------------------------------------------------------------
-- TECHNOLOGIES
----------------------------------------------------------------------------------------------------
require("prototypes.technology.assembly")
-- require("prototypes.technology.classes")
require("prototypes.technology.electronics")
require("prototypes.technology.greenhouse")
-- require("prototypes.technology.inserters")
require("prototypes.technology.logistics")
require("prototypes.technology.mining")
require("prototypes.technology.module-permutations")
require("prototypes.technology.module")
require("prototypes.technology.personal-equipment")
require("prototypes.technology.plates")
require("prototypes.technology.power")
-- require("prototypes.technology.revamp")
require("prototypes.technology.technology")
require("prototypes.technology.vehicle-equipment")
require("prototypes.technology.warfare") |
return {
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64421
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64431
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64441
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64422
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64432
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64442
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64423
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64433
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64443
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64424
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64434
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64444
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64425
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64435
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64445
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64426
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64436
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64446
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64427
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64437
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64447
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64428
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64438
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64448
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64429
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64439
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64449
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64430
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmRandomByWeight",
targetAniEffect = "",
arg_list = {
weapon_id = 64440
}
},
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetNil",
targetAniEffect = "",
arg_list = {
weapon_id = 64450
}
}
}
},
uiEffect = "",
name = "马可波罗-弹幕",
cd = 0,
painting = 1,
id = 19490,
picture = "0",
castCV = "skill",
desc = "马可波罗-弹幕",
aniEffect = {
effect = "jineng",
offset = {
0,
-2,
0
}
},
effect_list = {}
}
|
skynet = require "skynet"
skynet.register_protocol { --注册system消息
name = "system",
id = skynet.PTYPE_SYSTEM,
--pack = skynet.pack,
--unpack = skynet.unpack
}
skynet.start(function()
local othermsg = skynet.localname(".othermsg")
local r = skynet.unpack(skynet.rawcall(othermsg, "system", skynet.pack(1, "nengzhong", true)))
--使用skynet.call的时候必须要在skynet.register_protocol指定pack与unpack
--local r = skynet.call(othermsg, "system", 1, "nengzhong", true)
skynet.error("skynet.call return value:", r)
end)
|
local M = {}
--- generate highlights table
-- @param colors color (theme) color table created by require("leaf.colors").setup()
-- @param config config options (optional)
function M.setup(colors, config)
config = vim.tbl_extend("force", require("leaf").config, config or {})
local hlgroups = {
Comment = { fg = colors.fg_comment, style = config.commentStyle },
ColorColumn = { fg = colors.bg_dim, bg = colors.bg_normal },
Conceal = { fg = colors.bg_dim, bg = "NONE", style = "bold" },
Cursor = { fg = colors.bg_normal, bg = colors.fg_normal },
lCursor = { link = "Cursor" },
CursorIM = { link = "Cursor" },
CursorLine = { bg = colors.bg_dim },
CursorColumn = { link = "CursorLine" },
Directory = { fg = colors.blue_hard },
DiffAdd = { fg = colors.fg_normal, bg = colors.green_soft },
DiffChange = { fg = colors.fg_normal, bg = colors.blue_soft },
DiffDelete = { fg = colors.fg_normal, bg = colors.red_soft, style = "none" },
DiffText = { fg = colors.fg_normal, bg = colors.yellow_soft },
EndOfBuffer = { fg = colors.bg_normal },
-- TermCursor = {},
-- TermCursorNC = {},
ErrorMsg = { fg = colors.red_hard, bg = "NONE" },
VertSplit = { fg = colors.bg_dim, bg = colors.bg_normal, style = "NONE" },
WinSeparator = { link = "VertSplit" },
Folded = { fg = colors.bg_dim, bg = colors.bg_soft },
FoldColumn = { fg = colors.bg_dim, bg = "NONE" },
SignColumn = { fg = colors.bg_dim, bg = "NONE" },
SignColumnSB = { link = "SignColumn" },
Substitute = { fg = colors.fg_normal, bg = colors.green_hard },
LineNr = { fg = colors.fg_comment },
CursorLineNr = { fg = colors.green_hard, bg = "NONE", style = "bold" },
MatchParen = { fg = colors.yellow_hard, bg = "NONE", style = "bold" },
ModeMsg = { fg = colors.yellow_hard, style = "bold", bg = "NONE" },
MsgArea = { fg = colors.fg_dim, bg = "NONE" },
-- MsgSeparator = {},
MoreMsg = { fg = colors.green_hard, bg = colors.bg_normal, style = "NONE" },
NonText = { fg = colors.bg_dim },
Normal = {
fg = colors.fg_normal,
bg = not config.transparent and colors.bg_normal or "NONE",
},
NormalNC = { link = "Normal" },
NormalSB = { link = "Normal" },
NormalFloat = { fg = colors.fg_normal, bg = colors.bg_normal },
FloatBorder = { fg = colors.bg_dimmer, bg = colors.bg_normal },
Pmenu = { fg = colors.fg_normal, bg = colors.bg_dim },
PmenuSel = { fg = "NONE", bg = colors.bg_dimmer },
PmenuSbar = { link = "Pmenu" },
PmenuThumb = { fg = colors.bg_normal, bg = colors.green_hard },
Question = { link = "MoreMsg" },
QuickFixLine = { link = "CursorLine" },
Search = { fg = colors.bg_normal, bg = colors.green_hard },
IncSearch = { fg = colors.fg_colored_bg, bg = colors.yellow_hard, style = "NONE" },
SpecialKey = { link = "NonText" },
SpellBad = { style = "undercurl", guisp = colors.red_hard },
SpellCap = { style = "undercurl", guisp = colors.yellow_hard },
SpellLocal = { style = "undercurl", guisp = colors.yellow_hard },
SpellRare = { style = "undercurl", guisp = colors.yellow_hard },
StatusLine = { fg = colors.fg_dim, bg = colors.bg_dimmer, style = "NONE" },
StatusLineNC = { fg = colors.bg_dimmer, bg = colors.bg_dim, style = "NONE" },
TabLine = { bg = colors.bg_dim, fg = colors.fg_dim, style = "NONE" },
TabLineFill = { bg = colors.bg_normal, style = "NONE" },
TabLineSel = { fg = colors.fg_normal, bg = colors.bg_dimmer, style = "NONE" },
Title = { fg = colors.green_hard, style = "bold" },
Visual = { bg = colors.bg_dimmer },
VisualNOS = { link = "Visual" },
WarningMsg = { fg = colors.yellow_hard, bg = "NONE" },
Whitespace = { fg = colors.bg_dim },
WildMenu = { link = "Pmenu" },
Constant = { fg = colors.yellow_hard },
String = { fg = colors.green_hard },
Character = { link = "String" },
Number = { fg = colors.red_hard },
Boolean = { fg = colors.yellow_hard, style = "bold" },
Float = { link = "Number" },
Identifier = { fg = colors.yellow_hard },
Function = { fg = colors.blue_hard, style = config.functionStyle },
Method = { link = "Function" },
Statement = { fg = colors.purple_hard, style = config.statementStyle },
-- Conditional = {},
-- Repeat = {},
-- Label = {},
Operator = { fg = colors.yellow_hard },
Keyword = { fg = colors.purple_hard, style = config.keywordStyle },
Exception = { fg = colors.teal_hard },
PreProc = { fg = colors.yellow_hard },
-- Include = {},
-- Define = {},
-- Macro = {},
-- PreCondit = {},
Type = { fg = colors.teal_hard, style = config.typeStyle },
Struct = { link = "Type" },
-- StorageClass = {},
-- Structure = {},
-- Typedef = {},
Special = { fg = colors.teal_hard },
-- SpecialChar = {},
-- Tag = {},
-- Delimiter = {},
-- SpecialComment = {},
-- Debug = {},
Underlined = { fg = colors.teal_hard, style = "underline" },
Bold = { style = "bold" },
Italic = { style = "italic" },
Ignore = { link = "NonText" },
Error = { fg = colors.red_hard, bg = "NONE" },
Todo = { fg = colors.fg_colored_bg, bg = colors.blue_hard, style = "bold" },
qfLineNr = { link = "lineNr" },
qfFileName = { link = "Directory" },
-- htmlH1 = {},
-- htmlH2 = {},
-- mkdHeading = {},
-- mkdCode = {},
-- mkdCodeDelimiter = {},
-- mkdCodeStart = {},
-- mkdCodeEnd = {},
-- mkdLink = {},
-- markdownHeadingDelimiter = {},
-- markdownCode = {},
-- markdownCodeBlock = {},
-- markdownH1 = {},
-- markdownH2 = {},
-- markdownLinkText = {},
debugPC = { link = "CursorLine" },
debugBreakpoint = { fg = colors.teal_hard },
LspReferenceText = { fg = colors.fg_colored_bg, bg = colors.yellow_soft },
LspReferenceRead = { link = "LspReferenceText" },
LspReferenceWrite = { link = "LspReferenceText" },
DiagnosticError = { fg = colors.red_hard },
DiagnosticWarn = { fg = colors.yellow_hard },
DiagnosticInfo = { fg = colors.blue_hard },
DiagnosticHint = { fg = colors.teal_hard },
DiagnosticSignError = { link = "DiagnosticError" },
DiagnosticSignWarn = { link = "DiagnosticWarn" },
DiagnosticSignInfo = { link = "DiagnosticInfo" },
DiagnosticSignHint = { link = "DiagnosticHint" },
DiagnosticVirtualTextError = { link = "DiagnosticError" },
DiagnosticVirtualTextWarn = { link = "DiagnosticWarn" },
DiagnosticVirtualTextInfo = { link = "DiagnosticInfo" },
DiagnosticVirtualTextHint = { link = "DiagnosticHint" },
DiagnosticUnderlineError = { style = "undercurl", guisp = colors.red_hard },
DiagnosticUnderlineWarn = { style = "undercurl", guisp = colors.yellow_hard },
DiagnosticUnderlineInfo = { style = "undercurl", guisp = colors.blue_hard },
DiagnosticUnderlineHint = { style = "undercurl", guisp = colors.teal_hard },
LspSignatureActiveParameter = { fg = colors.yellow_hard },
LspCodeLens = { fg = colors.bg_dimmer },
-- ALEErrorSign = {},
-- ALEWarningSign = {},
-- TSAnnotation = {},
TSAttribute = { link = "Constant" },
-- TSBoolean = {},
-- TSCharacter = {},
-- TSComment = {},
-- TSNote = {}, -- links to SpecialComment -> Special
TSWarning = { link = "Todo" }, --default
TSDanger = { link = "WarningMsg" }, --default
TSConstructor = { fg = colors.purple_hard }, -- Function/Special/Statement/Keyword
-- TSConditional = {},
-- TSConstant = {},
-- TSConstBuiltin = {},
-- TSConstMacro = {},
TSError = { fg = colors.red_hard },
-- TSException = { link = 'Exception' }, -- default, -> statement
TSException = { fg = colors.teal_hard, style = config.statementStyle },
TSField = { link = "Identifier" }, -- default
-- TSField = { link = 'Variable'},
-- TSFloat = {},
-- TSFunction = {},
-- TSFuncBuiltin = {link = "Function" },
-- TSFuncMacro = {},
-- TSInclude = {},
TSKeyword = { link = "Keyword" },
-- TSKeywordFunction = { link = "Keyword" }, -- default
-- TSKeywordFunction = { link = "Function" },
TSKeywordReturn = { fg = colors.teal_hard, style = config.keywordStyle },
TSLabel = { link = "Label" },
TSMethod = { link = "Function" },
-- TSNamespace = {},
-- TSNone = {},
-- TSNumber = {},
TSOperator = { link = "Operator" },
TSKeywordOperator = { fg = colors.yellow_hard, style = "bold" },
TSParameter = { link = "Identifier" }, -- default
-- TSParameterReference = {},
TSProperty = { link = "Identifier" }, -- default
-- TSPunctDelimiter = {},
TSPunctDelimiter = { fg = colors.purple_soft },
TSPunctBracket = { fg = colors.purple_soft },
TSPunctSpecial = { fg = colors.purple_soft },
-- TSRepeat = {},
-- TSString = {},
TSStringRegex = { fg = colors.yellow_hard },
TSStringEscape = { fg = colors.yellow_hard, style = "bold" },
-- TSSymbol = {},
-- TSType = {},
-- TSTypeBuiltin = {},
TSVariable = { fg = "NONE" },
TSVariableBuiltin = { fg = colors.teal_hard, style = config.variablebuiltinStyle },
-- TSTag = {},
-- TSTagDelimiter = {},
-- TSText = {},
-- TSTextReference = {},
-- TSEmphasis = {},
-- TSUnderline = {},
-- TSStrike = {},
-- TSTitle = {},
-- TSLiteral = {},
-- TSURI = {},
-- Lua
-- luaTSProperty = {},
-- LspTrouble
-- LspTroubleText = {},
-- LspTroubleCount = {},
-- LspTroubleNormal = {},
-- Illuminate
-- illuminatedWord = {},
-- illuminatedCurWord = {},
-- Git
diffAdded = { fg = colors.green_soft },
diffRemoved = { fg = colors.red_soft },
diffDeleted = { fg = colors.red_soft },
diffChanged = { fg = colors.blue_soft },
diffOldFile = { fg = colors.red_soft },
diffNewFile = { fg = colors.green_soft },
-- diffFile = {},
-- diffLine = {},
-- diffIndexLine = { link = 'Identifier' },
-- Neogit
-- NeogitBranch = {},
-- NeogitRemote = {},
-- NeogitHunkHeader = {},
-- NeogitHunkHeaderHighlight = {},
-- NeogitDiffContextHighlight = {},
-- NeogitDiffDeleteHighlight = {},
-- NeogitDiffAddHighlight = {},
-- GitGutter
-- GitGutterAdd = {},
-- GitGutterChange = {},
-- GitGutterDelete = {},
-- GitSigns
GitSignsAdd = { link = "diffAdded" },
GitSignsChange = { link = "diffChanged" },
GitSignsDelete = { link = "diffDeleted" },
GitSignsDeleteLn = { fg = "NONE", bg = colors.red_soft },
-- Telescope = {},
TelescopeBorder = { fg = colors.bg_dimmer, bg = colors.bg_normal },
TelescopeResultsClass = { link = "TSType" },
TelescopeResultsStruct = { link = "TSType" },
TelescopeResultsVariable = { link = "TSVariable" },
-- NvimTree = {},
NvimTreeNormal = { link = "Normal" },
NvimTreeNormalNC = { link = "NormalNC" },
NvimTreeRootFolder = { fg = colors.yellow_hard, style = "bold" },
NvimTreeGitDirty = { fg = colors.blue_soft },
NvimTreeGitNew = { fg = colors.green_soft },
NvimTreeGitDeleted = { fg = colors.red_soft },
NvimTreeSpecialFile = { fg = colors.teal_hard },
-- NvimTreeIndentMarker = {},
NvimTreeImageFile = { fg = colors.teal_hard },
NvimTreeSymlink = { link = "Type" },
NvimTreeFolderName = { link = "Directory" },
NvimTreeExecFile = { fg = colors.green_hard, style = "bold" },
NvimTreeGitStaged = { fg = colors.green_soft },
NvimTreeOpenedFile = { fg = colors.teal_hard, style = "italic" },
-- Fern
-- FernBranchText = {},
-- glyph palette = {},
-- GlyphPalette1 = {},
-- GlyphPalette2 = {},
-- GlyphPalette3 = {},
-- GlyphPalette4 = {},
-- GlyphPalette6 = {},
-- GlyphPalette7 = {},
-- GlyphPalette9 = {},
-- Dashboard
DashboardShortCut = { fg = colors.green_hard },
DashboardHeader = { fg = colors.red_soft },
DashboardCenter = { fg = colors.yellow_hard },
DashboardFooter = { fg = colors.teal_hard },
-- WhichKey = {},
-- WhichKeyGroup = {},
-- WhichKeyDesc = {},
-- WhichKeySeperator = {},
-- WhichKeySeparator = {},
-- WhichKeyFloat = {},
-- WhichKeyValue = {},
-- LspSaga
-- DiagnosticWarning = {},
-- DiagnosticInformation = {},
-- LspFloatWinNormal = {},
-- LspFloatWinBorder = {},
-- LspSagaBorderTitle = {},
-- LspSagaHoverBorder = {},
-- LspSagaRenameBorder = {},
-- LspSagaDefPreviewBorder = {},
-- LspSagaCodeActionBorder = {},
-- LspSagaFinderSelection = {},
-- LspSagaCodeActionTitle = {},
-- LspSagaCodeActionContent = {},
-- LspSagaSignatureHelpBorder = {},
-- ReferencesCount = {},
-- DefinitionCount = {},
-- DefinitionIcon = {},
-- ReferencesIcon = {},
-- TargetWord = {},
-- Floaterm
FloatermBorder = { fg = colors.bg_dimmer, bg = colors.bg_normal },
-- NeoVim = {},
healthError = { fg = colors.red_hard },
healthSuccess = { fg = colors.green_hard },
healthWarning = { fg = colors.yellow_hard },
-- BufferLine
-- BufferLineIndicatorSelected = {},
-- BufferLineFill = {},
-- Barbar
BufferCurrent = { fg = colors.green_hard, bg = colors.bg_normal, style = "bold" },
BufferCurrentIndex = { link = "BufferCurrent" },
BufferCurrentMod = { fg = colors.yellow_hard, bg = colors.bg_normal, style = "bold" },
BufferCurrentSign = { link = "BufferCurrent" },
BufferCurrentTarget = { fg = colors.green_hard, bg = colors.bg_normal, style = "bold" },
BufferVisible = { fg = colors.fg_normal, bg = colors.bg_normal },
BufferVisibleIndex = { link = "BufferVisible" },
BufferVisibleMod = { fg = colors.yellow_soft, bg = colors.bg_normal },
BufferVisibleSign = { link = "BufferVisible" },
BufferVisibleTarget = { fg = colors.fg_normal, bg = colors.bg_normal, style = "bold" },
BufferInactive = { fg = colors.fg_dimmer, bg = colors.bg_dim },
BufferInactiveIndex = { link = "BufferInactive" },
BufferInactiveMod = { fg = colors.yellow_soft, bg = colors.bg_dim },
BufferInactiveSign = { fg = colors.bg_dimmer, bg = colors.bg_dim },
BufferInactiveTarget = { fg = colors.fg_dimmer, bg = colors.bg_dim, style = "bold" },
BufferTabpages = { fg = colors.green_hard, bg = colors.bg_normal },
BufferTabpageFill = { fg = colors.fg_dimmer, bg = colors.bg_normal },
-- Sneak
-- Sneak = {},
-- SneakScope = {},
-- Hop
-- HopNextKey = {},
-- HopNextKey1 = {},
-- HopNextKey2 = {},
-- HopUnmatched = {},
-- LightspeedGreyWash = {},
-- Cmp
CmpDocumentation = { fg = colors.fg_dim, bg = colors.bg_dim },
CmpDocumentationBorder = { fg = colors.bg_dimmer, bg = colors.bg_normal },
CmpItemAbbr = { fg = colors.fg_normal, bg = "NONE" },
CmpItemAbbrDeprecated = { fg = colors.bg_dimmer, bg = "NONE", style = "strikethrough" },
CmpItemAbbrMatch = { fg = colors.green_hard, bg = "NONE" },
CmpItemAbbrMatchFuzzy = { link = "CmpItemAbbrMatch" },
CmpItemKindDefault = { fg = colors.bg_dimmer, bg = "NONE" },
CmpItemMenu = { fg = colors.bg_dimmer, bg = "NONE" },
CmpItemKindVariable = { fg = colors.fg_dim, bg = "NONE" },
CmpItemKindFunction = { link = "Function" },
CmpItemKindMethod = { link = "Function" },
CmpItemKindConstructor = { link = "TSConstructor" },
CmpItemKindClass = { link = "Type" },
CmpItemKindInterface = { link = "Type" },
CmpItemKindStruct = { link = "Type" },
CmpItemKindProperty = { link = "TSProperty" },
CmpItemKindField = { link = "TSField" },
CmpItemKindEnum = { link = "Identifier" },
CmpItemKindSnippet = { fg = colors.teal_hard, bg = "NONE" },
CmpItemKindText = { link = "TSText" },
CmpItemKindModule = { link = "TSInclude" },
CmpItemKindFile = { link = "Directory" },
CmpItemKindFolder = { link = "Directory" },
CmpItemKindKeyword = { link = "TSKeyword" },
CmpItemKindTypeParameter = { link = "Identifier" },
CmpItemKindConstant = { link = "Constant" },
CmpItemKindOperator = { link = "Operator" },
CmpItemKindReference = { link = "TSParameterReference" },
CmpItemKindEnumMember = { link = "TSField" },
CmpItemKindValue = { link = "String" },
CmpItemKindUnit = {},
CmpItemKindEvent = {},
CmpItemKindColor = {},
-- IndentBlankline
IndentBlanklineChar = { fg = colors.bg_dim },
IndentBlanklineSpaceChar = { fg = colors.bg_dim },
IndentBlanklineSpaceCharBlankline = { fg = colors.bg_dim },
IndentBlanklineContextChar = { fg = colors.bg_dim },
IndentBlanklineContextStart = { guisp = colors.bg_dim, style = "underline" },
}
for hl, specs in pairs(config.overrides) do
if hlgroups[hl] and not vim.tbl_isempty(specs) then
hlgroups[hl].link = nil
end
hlgroups[hl] = vim.tbl_extend("force", hlgroups[hl] or {}, specs)
end
return hlgroups
end
return M
|
--[[
@author Sebastian "CrosRoad95" Jura <[email protected]>
@copyright 2011-2021 Sebastian Jura <[email protected]>
@license MIT
]]--
local code = "Autobusy"
local districtsBus
local districtsBus = {
{-1727.62,935.07,24.15},
{-1711.17,951.17,24.14},
{-1711.03,976.94,28.69},
{-1710.86,1006.16,40.56},
{-1710.91,1038.41,44.46},
{-1711.16,1079.42,44.56},
{-1711.16,1116.64,44.63},
{-1711.23,1151.86,32.44},
{-1711.28,1181.36,24.36},
{-1695.82,1184.44,23.55},
{-1675.30,1183.48,15.96},
{-1637.70,1182.96,6.51},
{-1615.32,1183.51,6.49},
{-1607.32,1160.86,6.43},
{-1607.70,1123.66,6.43},
{-1607.83,1070.63,6.43},
{-1605.66,1022.98,6.43},
{-1585.66,981.63,6.44},
{-1563.06,909.39,6.44},
{-1562.28,867.49,6.43},
{-1562.52,821.05,6.43},
{-1562.14,759.96,6.43},
{-1562.42,695.14,6.43},
{-1562.62,624.48,6.43},
{-1562.32,563.26,6.42},
{-1584.83,472.79,6.42},
{-1656.85,400.83,6.42},
{-1706.35,351.18,6.42},
{-1735.28,322.16,6.42},
{-1778.69,343.38,12.19},
{-1809.35,374.24,16.40},
{-1841.44,406.10,16.40},
{-1846.65,425.57,16.39},
{-1830.92,443.59,17.19},
{-1815.35,472.12,21.88},
{-1819.95,508.81,28.65},
{-1864.96,543.26,33.58},
{-1890.10,569.64,34.34},
{-1926.69,608.04,34.43},
{-1957.03,609.20,34.41},
{-1984.87,608.50,34.41},
{-2008.10,557.30,34.41},
{-2007.41,487.03,34.40},
{-2006.87,437.52,34.40},
{-2007.40,378.95,34.41},
{-2007.64,314.24,34.41},
{-2008.68,256.57,29.94},
{-2008.97,186.81,26.93},
{-2009.32,105.44,26.93},
{-2008.99,64.93,28.58},
{-2008.86,37.24,32.17},
{-2032.06,32.53,33.97},
{-2063.33,31.27,34.56},
{-2093.92,31.37,34.56},
{-2105.97,58.89,34.56},
{-2105.47,90.80,34.56},
{-2121.61,112.22,34.58},
{-2143.36,111.21,34.56},
{-2149.57,129.31,34.57},
{-2145.71,154.21,34.57},
{-2145.17,196.85,34.59},
{-2145.05,223.74,34.56},
{-2144.68,296.84,34.56},
{-2144.87,340.68,34.57},
{-2143.17,423.11,34.39},
{-2138.50,485.05,34.41},
{-2120.68,502.87,34.41},
{-2071.94,502.37,34.41},
{-2023.46,502.36,34.41},
{-2000.34,524.52,34.40},
{-2000.90,570.10,34.41},
{-2000.95,630.53,36.35},
{-2000.53,697.26,44.56},
{-2000.86,745.99,44.68},
{-2000.94,812.60,44.87},
{-2001.39,859.43,44.68},
{-1991.39,915.41,44.69},
{-1945.04,917.97,40.16},
{-1879.71,917.07,34.40},
{-1795.44,917.88,24.13},
{-1773.84,944.30,24.14},
{-1766.77,951.57,24.13},
}
local districtsBus2 = {
{-1733.64,917.26,24.13},
{-1717.35,902.06,24.13},
{-1716.75,878.72,24.14},
{-1717.41,830.37,24.13},
{-1717.47,786.37,24.12},
{-1717.43,741.62,24.12},
{-1717.38,691.34,24.12},
{-1717.34,648.67,24.13},
{-1723.84,620.53,24.11},
{-1770.04,608.13,28.08},
{-1825.25,609.15,34.42},
{-1881.57,609.40,34.42},
{-1932.01,608.53,34.40},
{-1977.80,608.80,34.41},
{-2007.15,599.02,34.42},
{-2023.33,567.90,34.41},
{-2052.18,569.21,34.41},
{-2085.86,568.99,34.41},
{-2132.67,569.11,34.41},
{-2174.05,569.43,34.41},
{-2218.92,568.64,34.41},
{-2277.60,568.97,34.41},
{-2329.60,569.45,28.56},
{-2375.52,569.00,24.13},
{-2413.49,568.38,24.13},
{-2474.61,569.06,17.55},
{-2512.59,568.66,13.86},
{-2543.88,569.20,13.85},
{-2577.43,569.59,13.85},
{-2629.37,569.21,13.85},
{-2671.04,569.10,13.85},
{-2715.22,569.60,13.84},
{-2752.82,563.57,13.79},
{-2751.64,545.81,13.06},
{-2736.01,522.49,9.71},
{-2720.33,504.31,7.09},
{-2710.42,485.10,4.31},
{-2740.27,468.78,4.00},
{-2763.52,469.26,4.61},
{-2798.67,468.53,4.70},
{-2833.81,467.81,3.72},
{-2845.27,492.66,3.76},
{-2835.62,519.56,4.18},
{-2825.65,549.01,4.64},
{-2821.80,590.02,4.84},
{-2821.10,633.40,8.66},
{-2823.69,670.01,16.88},
{-2837.40,703.23,24.65},
{-2856.88,731.12,29.18},
{-2865.87,756.10,31.04},
{-2861.96,787.09,34.76},
{-2839.06,825.29,40.88},
{-2821.37,871.03,43.29},
{-2822.38,919.53,43.29},
{-2829.40,967.64,43.30},
{-2857.41,997.74,40.37},
{-2872.41,1019.86,36.50},
{-2879.43,1072.54,30.36},
{-2879.97,1114.63,24.55},
{-2877.83,1178.42,8.92},
{-2858.63,1220.62,4.89},
{-2830.04,1251.23,4.83},
{-2802.22,1276.16,4.84},
{-2764.39,1286.32,5.58},
{-2714.45,1285.23,6.44},
{-2674.51,1286.02,6.43},
{-2630.76,1299.50,6.44},
{-2600.75,1326.56,6.42},
{-2559.79,1361.81,6.41},
{-2518.40,1373.48,6.42},
{-2455.80,1373.60,6.43},
{-2383.63,1374.22,6.49},
{-2341.50,1369.91,6.40},
{-2294.28,1341.39,6.46},
{-2223.52,1328.67,6.43},
{-2165.92,1328.90,6.43},
{-2114.89,1328.45,6.42},
{-2058.65,1306.03,6.54},
{-1992.40,1283.75,6.42},
{-1941.70,1284.51,6.42},
{-1895.99,1304.01,6.44},
{-1857.67,1338.59,6.42},
{-1821.30,1355.64,6.42},
{-1782.14,1349.96,6.42},
{-1735.06,1313.87,6.42},
{-1697.87,1276.01,6.43},
{-1638.32,1216.39,6.43},
{-1611.72,1174.45,6.48},
{-1607.77,1111.91,6.42},
{-1607.40,1042.99,6.43},
{-1598.30,1001.27,6.43},
{-1566.49,954.96,6.43},
{-1588.64,933.22,6.93},
{-1628.99,933.46,10.93},
{-1677.41,932.17,24.14},
{-1743.14,934.15,24.13},
{-1776.26,942.53,24.12},
{-1767.85,951.71,24.13},
}
local districtsBus3 = {
{-1741.67,934.68,24.12},
{-1776.24,934.18,24.14},
{-1818.83,933.44,24.33},
{-1881.43,934.08,34.92},
{-1928.69,934.18,37.21},
{-1962.81,933.64,43.36},
{-1988.44,933.25,44.69},
{-2002.15,950.19,44.69},
{-2000.05,994.57,49.15},
{-2000.52,1030.92,55.08},
{-2010.83,1078.30,54.98},
{-2037.33,1080.04,54.96},
{-2074.07,1080.18,54.95},
{-2113.32,1079.78,54.96},
{-2162.82,1080.10,54.97},
{-2218.84,1080.06,54.97},
{-2281.42,1080.02,54.97},
{-2327.41,1083.40,54.95},
{-2383.02,1102.79,54.98},
{-2432.29,1115.87,54.98},
{-2487.41,1117.84,54.97},
{-2540.04,1121.23,54.96},
{-2584.04,1122.59,54.91},
{-2590.74,1098.62,55.51},
{-2600.32,1080.72,59.67},
{-2605.00,1058.50,65.72},
{-2607.52,1034.10,72.46},
{-2608.03,1016.94,77.03},
{-2594.01,1002.63,77.52},
{-2572.20,1003.03,77.53},
{-2545.96,1002.95,77.53},
{-2527.97,992.58,77.51},
{-2528.54,964.40,72.05},
{-2528.13,937.40,64.26},
{-2527.84,915.50,64.22},
{-2503.45,906.40,64.14},
{-2476.48,906.38,62.53},
{-2440.79,906.71,53.47},
{-2411.21,906.94,44.84},
{-2390.30,896.12,44.68},
{-2389.65,859.31,41.54},
{-2390.52,817.22,34.28},
{-2390.07,777.38,34.41},
{-2389.86,735.78,34.41},
{-2389.76,697.76,34.41},
{-2389.96,652.51,34.41},
{-2390.16,609.97,29.50},
{-2388.19,554.78,24.13},
{-2375.47,507.93,28.46},
{-2353.86,469.19,30.33},
{-2334.90,444.72,33.30},
{-2327.23,404.25,34.41},
{-2348.62,383.39,34.40},
{-2373.60,356.71,34.41},
{-2398.87,321.69,34.41},
{-2413.57,291.35,34.37},
{-2418.09,251.65,34.41},
{-2418.80,205.45,34.40},
{-2421.74,162.00,34.41},
{-2423.41,105.28,34.41},
{-2423.21,57.51,34.41},
{-2422.96,-0.52,34.56},
{-2423.74,-46.45,34.56},
{-2400.95,-72.96,34.57},
{-2360.30,-72.24,34.56},
{-2313.09,-72.50,34.56},
{-2270.53,-72.24,34.55},
{-2227.31,-72.29,34.56},
{-2183.45,-72.25,34.56},
{-2169.03,-93.14,34.57},
{-2169.24,-134.80,34.56},
{-2195.69,-187.55,34.55},
{-2247.36,-187.26,34.56},
{-2251.67,-162.38,34.58},
{-2251.43,-127.83,34.56},
{-2251.52,-89.59,34.57},
{-2251.83,-57.39,34.57},
{-2251.33,-23.44,34.56},
{-2251.37,7.06,34.56},
{-2250.77,52.32,34.57},
{-2250.28,99.65,34.56},
{-2249.49,147.61,34.56},
{-2249.82,199.64,34.57},
{-2249.71,254.18,34.55},
{-2271.55,384.06,33.75},
{-2262.46,408.58,34.41},
{-2235.89,440.27,34.41},
{-2225.05,469.27,34.41},
{-2224.75,522.26,34.41},
{-2225.12,557.41,34.40},
{-2186.97,562.98,34.41},
{-2124.51,563.37,34.41},
{-2050.84,562.27,34.41},
{-2001.11,563.20,34.43},
{-2001.75,584.94,34.40},
{-2000.95,631.02,36.43},
{-2001.34,689.85,44.69},
{-2001.18,742.93,44.67},
{-2001.17,800.62,44.72},
{-2001.17,854.02,44.69},
{-2001.17,895.99,44.69},
{-1988.86,917.81,44.69},
{-1955.85,916.91,42.08},
{-1921.11,916.48,35.84},
{-1880.52,917.25,34.40},
{-1830.54,917.31,27.70},
{-1805.92,918.44,24.13},
{-1769.96,948.74,24.13},
}
local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus
function finishJob()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
end
if jobTarget and isElement(jobTarget) then
destroyElement(jobTarget)
jobTarget = nil
jobTarget = 0
end
if getElementData(localPlayer,"player:job") == code then
setElementData(localPlayer,"player:job",false)
end
triggerServerEvent("destroyVeh", localPlayer)
end
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(),finishJob)
addEvent("finishJob",true)
addEventHandler("finishJob",root,function(plr)
if plr ~= localPlayer then return end
finishJob()
end)
function busDriver(el, md)
if el ~= localPlayer or not md then return end
if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
if jobTarget == #districtsBus then
finishJob()
playSoundFrontEnd(2)
--outputChatBox("#ffffff[#41E0FFInformacja#ffffff]#41E0FF Zakończyłeś/aś pracę.",255,255,255,true)
addEventHandler("onClientRender",root,render3)
setTimer(renderstop3,2000,1)
else
kasa = math.random(100,175)
showMarker()
playSoundFrontEnd(12)
if getElementData(el,"player:premium") then
--outputChatBox("* Zidentyfikowałeś(aś) punkt i otrzymujesz 100 PLN.")
triggerServerEvent("givePlayerMoney", el, kasa*1.3, 0)
setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
addEventHandler("onClientRender",root,render2)
setTimer(renderstop2,1000,1)
else
--outputChatBox("* Zidentyfikowałeś(aś) punkt i otrzymujesz 75 PLN.")
triggerServerEvent("givePlayerMoney", el, kasa, 0)
setElementData(el,"player:srp", getElementData(el,"player:srp")+math.random(0,1))
addEventHandler("onClientRender",root,render2)
setTimer(renderstop2,1000,1)
end
end
end
function showMarker()
if jobMarker and isElement(jobMarker) then
destroyElement(jobMarker)
jobMarker = nil
end
jobTarget = jobTarget + 1
jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 0, 255, 255)
if districtsBus[jobTarget+1] then
ile = districtsBus[jobTarget+1]
setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
end
addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end
addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
trasa = math.random(1,3)
if trasa==1 then
districtsBus = districtsBus
elseif trasa==2 then
districtsBus = districtsBus2
elseif trasa==3 then
districtsBus = districtsBus3
end
maxTarget = #districtsBus
addEventHandler("onClientRender",root,render1)
setTimer(renderstop1,4000,1)
--outputChatBox("* Rozpocząłeś/aś pracę StreetView.")
--outputChatBox("* Jeździj po punktach i uzupełniaj mapę.")
jobVehicle = veh
jobTarget = 0
showMarker()
end)
addEventHandler("onClientResourceStop", resourceRoot, function()
if jobVehicle and getElementData(localPlayer, "player:job") then
setElementData(localPlayer, "player:job", false)
end
end)
addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
if seat == 0 then
if plr == localPlayer then
finishJob()
--outputChatBox("#ffffff[#41E0FFInformacja#ffffff]#41E0FF Zakończyłeś pracę",255,255,255,true)
addEventHandler("onClientRender",root,render3)
setTimer(renderstop3,2000,1)
end
end
end)
local screenW, screenH = guiGetScreenSize()
function render1()
dxDrawText("Rozpocząłeś pracę Kierowcy PKS jedź po ludzi. \n Przydzielono ci linię nr:"..trasa, screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end
function render2()
dxDrawText("Zabrałeś pasażerów za bilety dostajesz "..kasa.."PLN", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end
function render3()
dxDrawText("Zakończyłeś pracę kierowcy PKS'u.", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end
function render4()
dxDrawText("Zakończyłeś prace kierowcy PKS'u.", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end
function render5()
dxDrawText("Posiadasz już aktywną pracę.", screenW * 0.3656, screenH * 1.3553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center", false, false, false, false, false)
end
function renderstop1()
removeEventHandler("onClientRender",root,render1)
end
function renderstop2()
removeEventHandler("onClientRender",root,render2)
end
function renderstop3()
removeEventHandler("onClientRender",root,render3)
end
function renderstop4()
removeEventHandler("onClientRender",root,render4)
end
function renderstop5()
removeEventHandler("onClientRender",root,render5)
end |
ITEM.name = "Superglue"
ITEM.description = "A small plastic container with glue."
ITEM.longdesc = ""
ITEM.model = "models/lostsignalproject/items/repair/glue_e.mdl"
ITEM.width = 1
ITEM.height = 1
ITEM.price = 180
ITEM.flatweight = 0.003
ITEM.exRender = true
ITEM.iconCam = {
pos = Vector(-200, 0, 3),
ang = Angle(0, -0, 0),
fov = 2.6411764705882,
} |
local issue
local area
local rev_tk_content = jwt.decode(param.get("rev_tk"))
local desc_tk_content = jwt.decode(param.get("desc_tk"))
local issue_id = param.get("issue_id", atom.integer)
if issue_id then
issue = Issue:new_selector():add_where{"id=?",issue_id}:for_share():single_object_mode():exec()
if issue.closed then
slot.put_into("error", _"This issue is already closed.")
return false
elseif issue.fully_frozen then
slot.put_into("error", _"Voting for this issue has already begun.")
return false
elseif issue.phase_finished then
slot.put_into("error", _"Current phase is already closed.")
return false
end
-- TODO: validate that rev_tk_content modified sections == same as issue
area = issue.area
else
local area_id = param.get("area_id", atom.integer)
area = Area:new_selector():add_where{"id=?",area_id}:single_object_mode():exec()
if not area.active then
slot.put_into("error", "Invalid area.")
return false
end
end
if not app.session.member:has_voting_right_for_unit_id(area.unit_id) then
error("access denied")
end
local policy_id = param.get("policy_id", atom.integer)
local policy
if policy_id then
policy = Policy:by_id(policy_id)
end
if not issue then
if policy_id == -1 then
slot.put_into("error", _"Please choose a policy")
return false
end
if not policy.active then
slot.put_into("error", "Invalid policy.")
return false
end
if policy.polling and not app.session.member:has_polling_right_for_unit_id(area.unit_id) then
error("no polling right for this unit")
end
if not area:get_reference_selector("allowed_policies")
:add_where{ "policy.id = ?", policy_id }
:optional_object_mode()
:exec()
then
error("policy not allowed")
end
end
local is_polling = (issue and param.get("polling", atom.boolean)) or (policy and policy.polling) or false
local tmp = db:query({ "SELECT text_entries_left, initiatives_left FROM member_contingent_left WHERE member_id = ? AND polling = ?", app.session.member.id, is_polling }, "opt_object")
if not tmp or tmp.initiatives_left < 1 then
slot.put_into("error", _"Sorry, your contingent for creating initiatives has been used up. Please try again later.")
return false
end
if tmp and tmp.text_entries_left < 1 then
slot.put_into("error", _"Sorry, you have reached your personal flood limit. Please be slower...")
return false
end
local name = param.get("name")
local name = util.trim(name)
if #name < 3 then
slot.put_into("error", _"Please enter a meaningful title for your initiative!")
return false
end
if #name > 140 then
slot.put_into("error", _"This title is too long!")
return false
end
-- TODO(ddc) remove
local formatting_engine
if config.enforce_formatting_engine then
formatting_engine = config.enforce_formatting_engine
else
formatting_engine = param.get("formatting_engine")
local formatting_engine_valid = false
for i, fe in ipairs(config.formatting_engines) do
if formatting_engine == fe.id then
formatting_engine_valid = true
end
end
if not formatting_engine_valid then
error("invalid formatting engine!")
end
end
local timing
if not issue and policy.free_timeable then
local free_timing_string = util.trim(param.get("free_timing"))
if not free_timing_string or #free_timing_string < 1 then
slot.put_into("error", _"Choose timing")
return false
end
local available_timings
if config.free_timing and config.free_timing.available_func then
available_timings = config.free_timing.available_func(policy)
if available_timings == false then
error("error in free timing config")
end
end
if available_timings then
local timing_available = false
for i, available_timing in ipairs(available_timings) do
if available_timing.id == free_timing_string then
timing_available = true
end
end
if not timing_available then
slot.put_into("error", _"Invalid timing")
return false
end
end
timing = config.free_timing.calculate_func(policy, free_timing_string)
if not timing then
error("error in free timing config")
end
end
-- TODO: preview funcitonality is removed, but there's probably a
-- bunch of cruft here from it. I also don't know how edit works here, so
-- work that out
-- if param.get("preview") or param.get("edit") then
if param.get("edit") then
return
end
local initiative = Initiative:new()
if not issue then
issue = Issue:new()
issue.area_id = area.id
issue.policy_id = policy_id
if policy.polling then
issue.accepted = 'now'
issue.state = 'discussion'
initiative.polling = true
if policy.free_timeable then
issue.discussion_time = timing.discussion
issue.verification_time = timing.verification
issue.voting_time = timing.voting
end
end
-- check that there are no conflicting sections
for k, open_section in ipairs(area.open_admitted_sections) do
for k, new_section_id in pairs(rev_tk_content.claims.modified_section_ids) do
if new_section_id == open_section.external_reference then
-- TODO: link to conflicting issue
slot.put_into("error", _"This initiative is trying to modify a section that is already under discussion in issue #" .. open_section.issue_id)
return false
end
end
end
issue:save()
for k, v in pairs(rev_tk_content.claims.modified_section_ids) do
local issue_section = IssueSection:new()
issue_section.issue_id = issue.id
issue_section.external_reference = v
issue_section:save()
end
if config.etherpad then
local result = net.curl(
config.etherpad.api_base
.. "api/1/createGroupPad?apikey=" .. config.etherpad.api_key
.. "&groupID=" .. config.etherpad.group_id
.. "&padName=Issue" .. tostring(issue.id)
.. "&text=" .. request.get_absolute_baseurl() .. "issue/show/" .. tostring(issue.id) .. ".html"
)
end
end
-- TODO: check that only sections for the issue are in the rev_tk_content.Claims.ModifiedSectionIDs
if param.get("polling", atom.boolean) and app.session.member:has_polling_right_for_unit_id(area.unit_id) then
initiative.polling = true
end
initiative.issue_id = issue.id
initiative.name = name
initiative:save()
local draft = Draft:new()
draft.initiative_id = initiative.id
draft.formatting_engine = formatting_engine
draft.content = "" -- TODO(ddc) remove
draft.author_id = app.session.member.id
draft.external_reference = rev_tk_content.claims.sha
draft.base_external_reference = rev_tk_content.claims.base_sha
draft.description_external_reference = desc_tk_content.claims.sha
draft:save()
local initiator = Initiator:new()
initiator.initiative_id = initiative.id
initiator.member_id = app.session.member.id
initiator.accepted = true
initiator:save()
if not is_polling then
local supporter = Supporter:new()
supporter.initiative_id = initiative.id
supporter.member_id = app.session.member.id
supporter.draft_id = draft.id
supporter:save()
end
slot.put_into("notice", _"Initiative successfully created")
request.redirect{
module = "initiative",
view = "show",
id = initiative.id
}
|
local local_require = require('util').get_local_require("wubi98")
local basic = local_require('lib/basic')
local map = basic.map
local index = basic.index
local utf8chars = basic.utf8chars
local matchstr = basic.matchstr
local function commit_text_processor(key, env)
local engine = env.engine
local context = engine.context
local composition = context.composition
local segment = composition:back()
local input_text = context.input
local schema_name=env.engine.schema.schema_name or ""
local page_size = env.engine.schema.page_size
local schema_id=env.engine.schema.schema_id or ""
local candidate_count =0
local keyrepr = key:repr()
if input_text:find("^%p*(%a+%d*)$") then
if context:has_menu() then
candidate_count = segment.menu:candidate_count()
end
env.last_1th_text=context:get_commit_text() or ""
env.last_2th_text={text="",type=""}
env.last_3th_text={text="",type=""}
if candidate_count>1 then
env.last_2th_text=segment:get_candidate_at(1)
if candidate_count>2 then
env.last_3th_text=segment:get_candidate_at(2)
end
end
end
-- `引导精准造词记录保存
-- 0x20空格,0x31大键盘数字1
if input_text:find("^%`*(%l+%`%l+)") then
local commit_text=context:get_commit_text() or ""
if commit_text~="" and not commit_text:find("(%a)") and utf8.len(commit_text)>1 then
env.userphrase=commit_text
if segment.prompt:find('(%a+)') then
env.inputtext=segment.prompt:gsub('[^%a]','')
else
env.inputtext=input_text
end
end
else
if key.keycode==0x20 or key.keycode>0x30 and key.keycode<0x39 then
if env.userphrase~="" and env.userphrase~=nil and userphrasepath~="" then
-- engine:commit_text(env.userphrase..env.inputtext.."\r")
fileappendtext(userphrasepath,env.userphrase,env.inputtext,schema_name)
env.userphrase=""
env.inputtext=""
end
end
end
-- Control+Delete&Shift+Delete同步删除
if context:has_menu() and keyrepr=="Control+Delete" or context:has_menu() and keyrepr=="Shift+Delete" then
local selected_candidate=segment:get_selected_candidate() or ""
if selected_candidate.text~="" and selected_candidate.text~=nil then
-- engine:commit_text(selected_candidate.text..input_text.."\r")
DeleteUserphrase(userphrasepath,selected_candidate.text,input_text,schema_name)
end
end
if key.keycode==0x27 and context:is_composing() and env.last_3th_text.text~="" then
if env.last_3th_text.type=="reverse_lookup" or env.last_3th_text.type=="table" then
context:clear()
engine:commit_text(env.last_3th_text.text)
return 1
end
end
local m,n=input_text:find("^(%a+%d*)([%[%/%]\\])")
if n~=nil and m~=nil then
if (context:is_composing()) then
-- local focus_text = context:get_commit_text()
-- engine:commit_text(focus_text)
context:clear()
if input_text:find("^%u+%l*%d*") then -- 大写字母引导的日期反查与转换功能,[ 和 ] 分别对应二选三选
if input_text:find("%[") then
engine:commit_text(env.last_2th_text.text)
elseif input_text:find("%]") then
engine:commit_text(env.last_3th_text.text)
end
else
engine:commit_text(env.last_1th_text..CandidateText[1]) -- 第1个候选标点符号
end
return 1
end
end
return 2
end
-- 记录自造词、文件路径userphrasepath在rime.lua中定义
function fileappendtext(filepath,context,input,schemaname)
if not context:find('%a') then
input=splitinput(input,utf8.len(context))
context=context.."\t"..input.."\t〔"..schemaname.."〕"
local f=io.open(filepath,"a+")
local usertext=f:read("*a")
if not usertext:find("[\r\n]*"..context) then
f:write(context.."\r")
end
f:close()
usertext=nil
end
end
-- 同步删除用户词条
function DeleteUserphrase(filepath,context,input,schemaname)
if filepath~="" and context~="" and input~="" and schemaname~="" then
context=context.."\t"..input.."\t〔"..schemaname.."〕"
local usertext=readUserphrase(filepath)
if usertext~="" and usertext~=nil and usertext:find(context) then
usertext="\r"..usertext:gsub('^[\r]*','')
usertext=usertext:gsub('\r'..context,'')
local f=io.open(filepath,"w+")
f:write(usertext:gsub('^[\r]*',''),'')
f:close()
end
usertext=nil
end
end
-- 读取词条文件内容
function readUserphrase(file)
local f = io.open(file,"rb")
local content = f:read("*all")
f:close()
return content
end
-- 格式化五笔组合编码
function splitinput(input,len)
input="`"..input:gsub("%`*$","")
if len==2 and input:find("(%`%l%l+%`%l%l+)") then
input=input:gsub('(%`%l%l)%l*(%`%l%l)%l*', '%1%2')
return input:gsub('%`', '')
elseif len==3 and input:find("(%`%l%l+%`%l%l+%`%l%l+)") then
input=input:gsub('(%`%l)%l+(%`%l)%l+(%`%l%l)%l*', '%1%2%3')
return input:gsub('%`', '')
elseif len>3 and input:find("(%`%l%l+%`%l%l+%`%l%l+.*%`%l%l+)$") then
input=input:gsub('(%`%l)%l+(%`%l)%l+(%`%l).*(%`%l)%l+$', '%1%2%3%4')
return input:gsub('`', '')
else
return input:gsub('^%`*', '')
end
end
return commit_text_processor
|
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
local spd, ent
function ENT:Initialize()
self:SetModel("models/Items/AR2_Grenade.mdl")
self:PhysicsInit(SOLID_NONE)
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_NONE)
self:SetCollisionGroup(COLLISION_GROUP_NONE)
timer.Simple(self.SmokeDuration, function()
SafeRemoveEntity(self)
end)
end
function ENT:CreateParticles()
self:GetParent():EmitSound("fas2/m18/smoke.wav", 90, 100, 1, CHAN_AUTO)
ParticleEffectAttach( "smoke_grenade_smoke", PATTACH_ABSORIGIN_FOLLOW, self:GetParent(), 0 )
end
function ENT:Use(activator, caller)
return false
end
function ENT:OnRemove()
self:StopParticles()
return false
end |
lang.en = {
police = 'Cop',
sale = 'For sale',
close = 'Close',
soon = 'Soon!',
house = 'House',
yes = 'Yes',
no = 'No',
thief = 'Thief',
House1 = 'Classic House',
House2 = 'Family House',
House3 = 'Haunted House',
goTo = 'Enter\n',
fisher = 'Fisher',
furniture = 'Furniture',
hospital = 'Hospital',
open = 'Open',
use = 'Use',
using = 'Using',
error = 'Error',
submit = 'Submit',
cancel = 'Cancel',
fishWarning = "You can't fish here.",
fishingError = 'You aren\'t fishing anymore.',
closed_market = 'The supermarket is closed. Come back later!',
closed_police = 'The police station is closed. Come back later!',
timeOut = 'Unavailable place.',
password = 'Password',
passwordError = 'Min. 1 Letter',
incorrect = 'Incorrect',
buy = 'Buy',
alreadyLand = 'Some player has already acquired this land.',
moneyError = 'You don\'t have enough money.',
copAlerted = 'The cops have been alerted.',
looseMgs = 'You\'ll be loose in %s seconds.',
runAway = 'Run away in %s seconds.',
alert = 'Alert!',
copError = 'You must wait 10 seconds to hold again.',
closed_dealership = 'The dealership is closed. Come back later!',
miner = 'Miner',
pickaxeError = 'You have to buy a pickaxe.',
pickaxes = 'Pickaxes',
closed_buildshop = 'The build shop is closed. Come back later!',
energy = 'Energy',
sleep = 'Sleep',
leisure = 'Leisure',
hunger = 'Hunger',
elevator = 'Elevator',
healing = 'You\'ll be healed in %s seconds',
pizzaMaker = 'Pizza Maker',
noEnergy = 'You need more energy to work again.',
use = 'Use',
remove = 'Remove',
items = 'Items:',
bagError = 'Insufficient space in the bag.',
item_pickaxe = 'Pickaxe',
item_energyDrink_Basic = 'Sprite',
item_energyDrink_Mega = 'Fanta',
item_energyDrink_Ultra = 'Coca-Cola',
item_clock = 'Clock',
boats = 'Boats',
vehicles = 'Vehicles',
error_boatInIsland = 'You can\'t use a boat far from the sea.',
item_milk = 'Milk bottle',
mine5error = 'The mine collapsed.',
vehicle_5 = 'Boat',
quests = {
[1] = {
name = 'Quest 01: Building a boat',
[0] = {
dialog = 'Hey! How are you? Recently, some people discovered a small island after the sea. There are many trees and some buildings too.\nAs you know, there isn\'t an airport in the city. The only way to get there at the moment is through a boat.\nI can build one for you, but I\'ll need some help first.\nOn my next adventure, I\'d like to find out what\'s at the other side of the mine. I have some theories and I need to confirm them.\nI think it\'ll be a long expedition, so I\'m going to need a lot of food.\nCan you fish 5 fishes for me?',
_add = 'Talk with Kane',
},
[1] = {
_add = 'Fish %s fishes',
},
[2] = {
dialog = 'Wow! Thank you for these fishes! I can\'t wait to eat them in my expedition.\nNow, you\'ll have to bring to me 3 Coca-Cola. You can buy them in the market.',
_add = 'Talk with Kane',
},
[3] = {
_add = 'Buy %s Coca-Cola',
},
[4] = {
dialog = 'Thank you for bringing me the foodstuff! Now, it\'s my turn to return the favor.\nBut in order to do that I\'ll need some wooden planks so I can build you a boat.\nRecently I\'ve seen Chrystian chopping trees and gathering wood. Ask him if he can give you some wooden planks.',
_add = 'Talk with Kane',
},
[5] = {
dialog = 'So you want wooden planks? I can give you some, but you\'ll need to bring to me a corn flake.\nCould you do this?',
_add = 'Talk with Chrystian',
},
[6] = {
_add = 'Buy a corn flake',
},
[7] = {
dialog = 'Thank you for helping me! Here is the wooden planks you have asked me. Make good use of them!',
_add = 'Talk with Chrystian',
},
[8] = {
dialog = 'You took too long... I thought you had forgotten to get the wooden planks...\nBy the way, now I can build your boat...\nHere\'s your boat! Have fun on the new island and don\'t forget to be careful!',
_add = 'Talk with Kane',
},
},
[2] = {
name = 'Quest 02: The lost keys',
[0] = {
_add = 'Go to the island.',
},
[1] = {
dialog = 'Hey! Who\'re you? I\'ve never seen you before...\nMy name is Indy! I live in this island for a long time. There\'re great places to meet here.\nI\'m the owner of the potions store. I could call you to meet a store, but I have one big problem: I lost my store keys!\nI must have lost them in the mine while I was mining. Can you help me?',
_add = 'Talk with Indy',
},
[2] = {
_add = 'Go to the mine.',
},
[3] = {
_add = 'Find Indy\'s keys.',
},
[4] = {
dialog = 'Thank you! Now I can get back to business!\nWait a second...\n1 key is missing: the key of the store! Did you look hard?',
_add = 'Bring the keys to Indy.',
},
[5] = {
_add = 'Go back to the mine.',
},
[6] = {
_add = 'Find the last key.',
},
[7] = {
dialog = 'Finally! You should pay more attention, I could have watched a movie while I was waiting for you.\nDo you still want to meet the store? I\'m going there!',
_add = 'Bring the key to Indy.',
},
},
[3] = {
name = 'Quest 03: Theft',
[0] = {
_add = 'Go to the police station.',
},
[1] = {
dialog = 'Hi. We lack police officers in our city and I need your help, but nothing too hard.\nThere was a mysterious robbery in the bank, so far no suspect has been found...\nI suppose there\'s some clue in the bank.\nColt should know more about how this happened. Talk to him.',
_add = 'Talk with Sherlock',
},
[2] = {
_add = 'Go to the bank.',
},
[3] = {
dialog = 'WHAT? Sherlock sent you here? I told him I\'m taking care of this case.\nTell him I don\'t need help. I can handle it myself.',
_add = 'Talk with Colt.',
},
[4] = {
_add = 'Go back to the police station.',
},
[5] = {
dialog = 'I knew he wouldn\'t want to help us...\nWe\'ll have to look for clues without him.\nWe need to go to the bank when Colt is gone, you can do this, right?',
_add = 'Talk with Sherlock.',
},
[6] = {
_add = 'Enter in the bank while it\'s being robbed.',
},
[7] = {
_add = 'Look for some clue in the bank.',
},
[8] = {
_add = 'Go to the police station.',
},
[9] = {
dialog = 'Very well! This cloth can help us to find the suspect.\nTalk with Indy. He will help us.',
_add = 'Talk with Sherlock.',
},
[10] = {
dialog = 'So... You\'ll need my help in this investigation?\nHmm... Let me see this cloth...\nI\'ve seen this cloth somewhere. It\'s used in the hospital! Take a look there!',
_add = 'Talk with Indy.',
},
[11] = {
_add = 'Go to the hospital.',
},
[12] = {
_add = 'Search for something suspicious in the hospital.',
},
[13] = {
_add = 'Go to the mine.',
},
[14] = {
_add = 'Find the suspect and arrest him.',
},
[15] = {
_add = 'Go to the police station.',
},
[16] = {
dialog = 'Well done! You are really good on it.\nI know a great place to recover your energies after this long investigation: the coffee shop!',
_add = 'Talk with Sherlock.',
},
},
[4] = {
name = 'Quest 04: The sauce is gone!',
[0] = {
dialog = 'Hi! Do you want to eat some pizza?\nWell... I have bad news for you.\nToday earlier I\'ve started making some pizzas, but I noticed that all the sauce had gone.\nI tried to buy some tomatoes in the market but aparently they don\'t sell it.\nI started to live in this town a few weeks ago, and I don\'t know anyone that can help me.\nSo please, can you help me? I just need the sauce to open my pizzeria.',
_add = 'Talk with Kariina.',
},
[1] = {
_add = 'Go to the island.',
},
[2] = {
_add = 'Go to the seed store.',
},
[3] = {
_add = 'Buy a seed.',
},
[4] = {
_add = 'Go to your house.',
},
[5] = {
_add = 'Plant a seed in your house. (You\'ll need to use a garden!)',
},
[6] = {
_add = 'Harvest a tomato plant.',
},
[7] = {
_add = 'Go to the seed store.',
},
[8] = {
_add = 'Buy a water bucket.',
},
[9] = {
_add = 'Go to the market.',
},
[10] = {
_add = 'Buy some salt.',
},
[11] = {
_add = 'Cook a sauce. (You\'ll need to use an oven!)',
},
[12] = {
dialog = 'Wow! Thank you! Now I just need a spicy sauce. Could you make one?',
_add = 'Give the sauce to Kariina.',
},
[13] = {
_add = 'Plant a seed in your house.',
},
[14] = {
_add = 'Harvest a pepper plant',
},
[15] = {
_add = 'Cook a spicy sauce.',
},
[16] = {
dialog = 'OMG! You did it! Thank you!\nWhile you were gone, I realized that I need more wheat to make more dough... Could you bring me some wheat?',
_add = 'Give the spicy sauce to Kariina.',
},
[17] = {
_add = 'Plant a seed in your house.',
},
[18] = {
_add = 'Harvest wheat.',
},
[19] = {
dialog = 'Wow! Thank you! You could work with me when I need a new employee.\nThank you for helping me. Now I can finish those pizzas!',
_add = 'Give the wheat to Kariina.',
},
},
[5] = {
name = 'Quest 05: Kitchen Nightmares!',
[0] = {
_add = 'Go to the island.',
},
[1] = {
_add = 'Go to the restaurant.',
},
[2] = {
dialog = 'Hi. I need your help to fix a big trouble...\nWe are unable to manage and deliver orders due to the high demand in the restaurant.\nCould you help me to place orders properly?\nGreat! As we sell a lot of dishes, you will need to learn the recipes of some dishes first. Ok?',
_add = 'Talk with Remi.',
},
[3] = {
_add = 'Make a Loaf of Bread.',
},
[4] = {
_add = 'Make a Salad.',
},
[5] = {
_add = 'Make a Chocolate Cake.',
},
[6] = {
_add = 'Make a Frogwich.', -- "Frog Sandwich"
},
[7] = {
_add = 'Make some Fries.',
},
[8] = {
_add = 'Make a Pudding.',
},
[9] = {
_add = 'Make a Garlic Bread.',
},
[10] = {
_add = 'Make a Fish Stew.',
},
[11] = {
_add = 'Make a Grilled Cheese.',
},
[12] = {
_add = 'Make a Fish Burger.',
},
[13] = {
_add = 'Make a Bruschetta.',
},
[14] = {
_add = 'Make a Lemonade.',
},
[15] = {
_add = 'Make some Pierogies.',
},
[16] = {
dialog = 'You took too long...\nAnyway, now that you have learned the ingredients of each recipe, I will need you to deliver the orders that will be shown in this order board.',
_add = 'Talk with Remi.',
},
[17] = {
_add = 'Deliver %s orders.',
},
[18] = {
dialog = 'I am very grateful for your help! The customers are happy and I even more!\nAs a thank you, I left a little surprise at your house: A freezer!\nYou will be able to store even more items in your home!\nHope to see you soon!',
_add = 'Talk with Remi.',
},
},
[6] = {
name = 'Quest 06: ????',
[0] = {},
},
},
noMissions = 'There are no missions available.',
questsName = 'Quests',
completedQuest = 'Quest Finished',
receiveQuestReward = 'Claim Reward',
rewardNotFound = 'Reward not found.',
npc_mine6msg = 'This can collapse at any moment, but no one listens to me.',
item_goldNugget = 'Gold',
goldAdded = 'The gold nugget that you have collected was added to your bag.',
sellGold = 'Sell %s Gold Nugget(s) for <vp>%s</vp>',
settings_gameHour = 'Game Hour',
settings_gamePlaces = 'Places',
settingsText_availablePlaces = 'Available places: <vp>%s</vp>',
settingsText_placeWithMorePlayers = 'Place with more players: <vp>%s</vp> <r>(%s)</r>',
settingsText_hour = 'Current Time: <vp>%s</vp>',
item_dynamite = 'Dynamite',
placeDynamite = 'Place dynamite',
energyInfo = '<v>%s</v> of energy',
hungerInfo = '<v>%s</v> of food',
itemDesc_clock = 'A simple clock that can be used once',
itemDesc_dynamite = 'Boom!',
minerpack = 'Miner Pack %s',
itemDesc_minerpack = 'Containing %s pickaxe(s).',
itemDesc_pickaxe = 'Break rocks',
hey = 'Hey! Stop!',
robberyInProgress = 'Robbery in progress',
closed_bank = 'The bank is closed. Come back later!',
bankRobAlert = 'The bank is being robbed. Defend it!',
runAwayCoinInfo = 'You\'ll receive %s after completing the robbery.',
atmMachine = 'ATM',
codeInfo = 'Insert a valid code and click in submit to get your reward.\nYou can get new codes by joining in our Discord server.\n<a href="event:getDiscordLink"><v>(Click here to receive a invitation link)</v></a>',
item_shrinkPotion = 'Shrink Potion',
itemDesc_shrinkPotion = 'Use this potion to shrink for %s seconds!',
mouseSizeError = 'You are too small to do this.',
enterQuestPlace = 'Unlock this place after finishing <vp>%s</vp>.',
closed_potionShop = 'The potion shop is closed. Come back later!',
bag = 'Bag',
ranking_coins = 'Accumulated Coins',
ranking_spentCoins = 'Spent Coins',
item_growthPotion = 'Growth Potion',
itemDesc_growthPotion = 'Use this potion to growth for %s seconds!',
codeAlreadyReceived = 'Code already used.',
codeReceived = 'Your reward: %s.',
codeNotAvailable = 'Code Unavailable',
quest = 'Quest',
job = 'Job',
chooseOption = 'Choose an option',
newUpdate = 'New update!',
itemDesc_goldNugget = 'Shiny and expensive.',
shop = 'Shop',
item_coffee = 'Coffee',
item_hotChocolate = 'Hot Chocolate',
item_milkShake = 'Milkshake',
speed = 'Speed: %s',
price = 'Price: %s',
owned = 'Owned',
updateWarning = '<font size="10"><rose><p align="center">Warning!</p></rose>\nNew update in %smin %ss',
waitUntilUpdate = '<rose>Please wait.</rose>',
playerBannedFromRoom = '%s has been banned from this room.',
playerUnbannedFromRoom = '%s has been unbanned.',
harvest = 'Harvest',
item_bag = 'Bag',
itemDesc_bag = '+ %s bag capacity',
item_seed = 'Seed',
itemDesc_seed = 'A random seed.',
item_tomato = 'Tomato',
item_fertilizer = 'Fertilizer',
itemDesc_fertilizer = 'Make seeds grow faster!',
error_maxStorage = 'Maximum amount purchased.',
drop = 'Drop',
item_lemon = 'Lemon',
item_lemonSeed = 'Lemon seed',
item_tomatoSeed = 'Tomato seed',
item_oregano = 'Oregano',
item_oreganoSeed = 'Oregano seed',
item_water = 'Water bucket',
itemDesc_water = 'Make seeds grow faster!',
houses = 'Houses',
expansion = 'Expansions',
furnitures = 'Furnitures',
settings = 'Settings',
furniture_oven = 'Oven',
expansion_pool = 'Pool',
expansion_garden = 'Garden',
expansion_grass = 'Grass',
chooseExpansion = 'Select an expansion',
item_pepper = 'Pepper',
item_luckyFlower = 'Lucky Flower',
item_pepperSeed = 'Pepper seed',
item_luckyFlowerSeed = 'Lucky Flower seed',
closed_seedStore = 'The seed store is closed. Come back later!',
item_salt = 'Salt',
item_sauce = 'Tomato Sauce',
item_hotsauce = 'Hot Sauce',
item_dough = 'Dough',
item_wheat = 'Wheat',
item_wheatSeed = 'Wheat seed',
item_pizza = 'Pizza',
recipes = 'Recipes',
cook = 'Cook',
closed_furnitureStore = 'The furniture store is closed. Come back later!',
maxFurnitureStorage = 'You can only have %s furnitures in your home.',
furniture_kitchenCabinet = 'Kitchen Cabinet',
sell = 'Sell',
item_cornFlakes = 'Corn Flakes',
furniture_flowerVase = 'Flower Vase',
createdBy = 'Created by %s',
furniture_painting = 'Painting',
furniture_sofa = 'Sofa',
furniture_chest = 'Chest',
furniture_tv = 'Tv',
transferedItem = 'The item %s was transfered to your bag.',
passToBag = 'Transfer to bag',
seeItems = 'Check Items',
furnitureRewarded = 'Furniture Unlocked: %s',
itemAddedToChest = 'The item %s was added in the chest.',
farmer = 'Farmer',
seedSold = 'You sold %s for %s.',
item_pumpkin = 'Pumpkin',
item_pumpkinSeed = 'Pumpkin seed',
waitingForPlayers = 'Waiting for players...',
_2ndquest = 'Side quest',
sideQuests = {
[1] = 'Plant %s seeds in Oliver\'s garden.',
[2] = 'Fertilize %s plants in Oliver\'s garden.',
[3] = 'Get %s coins.',
[4] = 'Arrest a thief %s times.',
[5] = 'Use %s items.',
[6] = 'Spend %s coins.',
[7] = 'Fish %s times.',
[8] = 'Mine %s gold nuggets.',
[9] = 'Rob the bank.',
[10] = 'Complete %s robberies.',
[11] = 'Cook %s times.',
[12] = 'Get %s xp.',
[13] = 'Fish %s frogs.',
[14] = 'Fish %s lion fishes.',
[15] = 'Deliver %s orders.',
[16] = 'Deliver %s orders.', -- it's a different quest
[17] = 'Make a pizza.',
[18] = 'Make a bruschetta.',
[19] = 'Make a lemonade.',
[20] = 'Make a frogwich.',
},
profile_coins = 'Coins',
profile_spentCoins = 'Spent Coins',
profile_completedQuests = 'Quests',
profile_completedSideQuests = 'Side Quests',
profile_purchasedHouses = 'Purchased Houses',
profile_purchasedCars = 'Purchased Vehicles',
profile_basicStats = 'General Data',
profile_questCoins = 'Quest points',
levelUp = '%s reached level %s!',
sidequestCompleted = 'You have completed a side quest!\nYour reward:',
chestIsFull = 'The chest is full.',
code = 'type a code',
profile_jobs = 'Jobs',
profile_arrestedPlayers = 'Arrested Players',
profile_robbery = 'Robberies',
profile_fishes = 'Fished',
profile_gold = 'Collected Gold',
profile_seedsPlanted = 'Crops',
profile_seedsSold = 'Sales',
level = 'Level %s',
furniture_hay = 'Hay',
furniture_shelf = 'Shelf',
item_superFertilizer = 'Super Fertilizer',
itemDesc_superFertilizer = 'It is 2x more effective than a fertilizer.',
profile_badges = 'Badges',
daysLeft = '%sd left.', -- d: abbreviation of days
daysLeft2 = '%sd', -- d: abbreviation of days
collectorItem = 'Collector\'s item',
House4 = 'Barn',
House5 = 'Haunted Mansion',
houseSetting_storeFurnitures = 'Store all furnitures in the inventory',
ghostbuster = 'Ghostbuster',
furniture_rip = 'RIP',
furniture_cross = 'Cross',
furniture_pumpkin = 'Pumpkin',
furniture_spiderweb = 'Spider Web',
furniture_candle = 'Candle',
furniture_cauldron = 'Cauldron',
event_halloween2019 = 'Halloween 2019',
ghost = 'Ghost',
maxFurnitureDepot = 'Your furniture depot is full.',
unlockedBadge = 'You have unlocked a new badge!',
reward = 'Reward',
badgeDesc_0 = 'Halloween 2019',
badgeDesc_1 = 'Meet #mycity\'s creator',
badgeDesc_3 = 'Mined 1000 gold nuggets',
badgeDesc_2 = 'Fished 500 fishes',
badgeDesc_4 = 'Harvested 500 plants',
item_sugar = 'Sugar',
item_chocolate = 'Chocolate',
item_cookies = 'Cookies',
furniture_christmasWreath = 'Christmas Wreath',
furniture_christmasSocks = 'Christmas Sock',
House6 = 'Christmas House',
item_blueberries = 'Blueberries',
item_blueberriesSeed = 'Blueberry seed',
furniture_christmasFireplace = 'Fireplace',
furniture_christmasSnowman = 'Snowman',
furniture_christmasGift = 'Gift Box',
vehicle_9 = 'Sleigh',
badgeDesc_5 = 'Completed 500 thefts',
badgeDesc_6 = 'Christmas 2019',
badgeDesc_7 = 'Bought the sleigh',
frozenLake = 'The lake is frozen. Wait for the end of winter to use a boat.',
codeLevelError = 'You must reach the level %s to redeem this code.',
furniture_christmasCarnivorousPlant = 'Carnivorous Plant',
furniture_christmasCandyBowl = 'Candy Bowl',
settingsText_grounds = 'Generated grounds: %s/509',
locked_quest = 'Quest %s',
furniture_apiary = 'Bee Box',
item_cheese = 'Cheese',
itemDesc_cheese = 'Use this item to get +1 cheese in Transformice shop!',
item_fish_SmoltFry = 'Smolt Fry',
item_fish_Lionfish = 'Lion Fish',
item_fish_Dogfish = 'Dog Fish',
item_fish_Catfish = 'Cat Fish',
item_fish_RuntyGuppy = 'Runty Guppy',
item_fish_Lobster = 'Lobster',
item_fish_Goldenmare = 'Goldenmare',
item_fish_Frog = 'Frog',
emergencyMode_pause = '<cep><b>[Warning!]</b> <r>The module has reached it\'s critical limit and is being paused.',
emergencyMode_resume = '<r>The module has been resumed.',
emergencyMode_able = "<r>Initiating emergency shutdown, no new players allowed. Please go to another #mycity room.",
settingsText_currentRuntime = 'Runtime: <r>%s</r>/60ms',
settingsText_createdAt = 'Room created <vp>%s</vp> minutes ago.',
limitedItemBlock = 'You must wait %s seconds to use this item.',
eatItem = 'Eat',
ranking_Season = 'Season %s',
settings_help = 'Help',
settings_settings = 'Settings',
settings_credits = 'Credits',
settings_donate = 'Donate',
settings_creditsText = '<j>#Mycity</j> was created by <v>%s</v>, using arts from <v>%s</v> and translated by:',
settings_creditsText2 = 'Special thanks to <v>%s</v> for helping with important resources for the module.',
settings_donateText = '<j>#Mycity</j> is a project started in <b><cep>2014</cep></b>, but with another gameplay: <v>build a city</v>! However, this project did not go forward and it was canceled months later.\n In <b><cep>2017</cep></b>, I decided to redo it with a new objective: <v>live in a city</v>!\n\n The most part of the available functions were made by me for a <v>long and tiring</v> time.\n\n If you could and you are able to help me, make a donation. This encourages me to bring new updates!',
wordSeparator = ' and ', -- a text separator. example: {1, 2, 3, AND 4}, {'apple, banana AND lemon'}
settings_config_lang = 'Language',
settings_config_mirror = 'Mirrored Text',
settings_helpText = 'Welcome to <j>#Mycity</j>!\n If you want to know how to play, press the button below:',
settings_helpText2 = 'Available Commands:',
command_profile = '<g>!profile</g> <v>[playerName]</v>\n Shows <i>playerName\'s</i> profile.',
saveChanges = 'Save Changes',
House7 = 'Treehouse',
item_lemonade = 'Lemonade',
item_lobsterBisque = 'Lobster Bisque',
item_bread = 'Loaf of Bread',
item_bruschetta = 'Bruschetta',
item_waffles = 'Waffles',
item_egg = 'Egg',
item_honey = 'Honey',
item_grilledLobster = 'Grilled Lobster',
item_frogSandwich = 'Frogwich',
item_chocolateCake = 'Chocolate Cake',
item_wheatFlour = 'Wheat Flour',
item_salad = 'Salad',
item_lettuce = 'Lettuce',
item_pierogies = 'Pierogies',
item_potato = 'Potato',
item_frenchFries = 'Fries',
item_pudding = 'Pudding',
item_garlicBread = 'Garlic Bread',
item_garlic = 'Garlic',
vehicle_11 = 'Yacht',
vehicle_6 = 'Fishing Boat',
vehicle_8 = 'Patrol Boat',
npcDialog_Kapo = 'I always come here to check Dave\'s daily offers.\nSometimes I get rare items that only him owns!',
npcDialog_Santih = 'There are a lot of people that still dare to fish in this pond.',
npcDialog_Louis = 'I told her to not put olives...',
npcDialog_Heinrich = 'Huh... So you want to be a miner? If so, you must be careful. When I was a little mouse, I used to get lost in this labyrinth.',
npcDialog_Davi = 'I\'m sorry but I can\'t let you go that way.',
npcDialog_Alexa = 'Hey. What\'s new?',
npcDialog_Sebastian = 'Hey dude.\n...\nI\'m not Colt.',
captured = '<g>The thief <v>%s</v> was arrested!',
arrestedPlayer = 'You arrested <v>%s</v>!',
confirmButton_Work = 'Work!',
chef = 'Chef',
percentageFormat = '%s%%',
rewardText = 'You have received an incredible reward!',
confirmButton_Great = 'Great!',
questCompleted = 'You have completed the quest %s!\nYour reward:',
newLevelMessage = 'Congratulations! You have leveled up!',
newLevel = 'New level!',
experiencePoints = 'Experience points',
newQuestSoon = 'The %sth quest is not available yet :/\n<font size="11">Development stage: %s%%',
badgeDesc_9 = 'Fulfilled 500 orders',
badgeDesc_10 = 'Arrested 500 thieves',
multiTextFormating = '{0}: {1}', -- EX: "{0}: {1}" will return "Coins: 10" while "{1} : {0}" will return "10 : Coins"
profile_fulfilledOrders = 'Fulfilled orders',
profile_cookedDishes = 'Cooked dishes',
profile_capturedGhosts = 'Captured ghosts',
npcDialog_Marie = 'I looooooove cheese *-*',
npcDialog_Rupe = 'Definitely a pickaxe made of stone is not a good choice for breaking stones.',
npcDialog_Paulo = 'This box is really heavy...\nIt would be so nice if we had a forklift around here.',
npcDialog_Lauren = 'She loves cheese.',
npcDialog_Julie = 'Be careful. This supermarket is very dangerous.',
npcDialog_Cassy = 'Have a good day!',
npcDialog_Natasha = 'Hi!',
itemInfo_Seed = 'Growing time: <vp>%smin</vp>\nPrice per seed: <vp>$%s</vp>',
confirmButton_Select = 'Select',
confirmButton_Buy = 'Buy for %s',
confirmButton_Buy2 = 'Buy %s\nfor %s',
newBadge = 'New badge',
landVehicles = 'Land',
waterVehicles = 'Water',
houseDescription_1 = 'A small house.',
houseDescription_2 = 'A big house for big families with big problems.',
houseDescription_3 = 'Only the most braves can live in this house. Ooooo!',
houseDescription_4 = 'Tired of living in a city? We have what you need.',
houseDescription_5 = 'The real home of ghosts. Be careful!',
houseDescription_6 = 'This cozy house will bring you comfort even in the coldest days.',
houseDescription_7 = 'A house for those who love waking up closer to nature!',
houseSettings = 'House Settings',
houseSettings_permissions = 'Permissions',
houseSettings_buildMode = 'Build Mode',
houseSettings_finish = 'Finish!',
error_houseUnderEdit = '%s is editing the house.',
sellFurniture = 'Sell Furniture',
sellFurnitureWarning = 'Do you really want to sell this furniture?\n<r>This action can not be undone!</r>',
confirmButton_Sell = 'Sell for %s',
houseSettings_placeFurniture = 'Place',
speed_knots = 'Knots',
speed_km = 'Km/h',
npcDialog_Blank = 'Do you need something from me?',
vehicle_12 = 'Bugatti',
orderCompleted = 'You have delivered the order of %s and received %s!',
houseSettings_changeExpansion = 'Change Expansion',
furniture_derp = 'Pigeon',
furniture_testTubes = 'Test Tubes',
furniture_bed = 'Bed',
furniture_scarecrow = 'Scarecrow',
furniture_fence = 'Fence',
furniture_hayWagon = 'Hay Wagon',
furniture_diningTable = 'Dining Table',
furniture_bookcase = 'Bookcase',
syncingGame = '<r>Syncing game data. The game will stop for a few seconds.',
item_crystal_yellow = 'Yellow Crystal',
item_crystal_blue = 'Blue Crystal',
item_crystal_purple = 'Purple Crystal',
item_crystal_green = 'Green Crystal',
item_crystal_red = 'Red Crystal',
closed_fishShop = 'The fish shop is closed. Come back later!',
npcDialog_Jason = 'Hey... My store is not working for sales yet.\nPlease, come back soon!',
houseSettings_lockHouse = 'Lock House',
houseSettings_unlockHouse = 'Unlock House',
houseSettings_reset = 'Reset',
error_blockedFromHouse = 'You have been blocked from entering %s\'s house.',
permissions_blocked = 'Blocked',
permissions_guest = 'Guest',
permissions_roommate = 'Roommate',
permissions_coowner = 'Co-owner',
permissions_owner = 'Owner',
setPermission = 'Make %s',
error_houseClosed = '%s closed this house.',
itemAmount = 'Items: %s',
vehicleError = 'You can\'t use this vehicle in this place.',
confirmButton_tip = 'Tip',
tip_vehicle = 'Click on the star next to your vehicle icon to make it your preferred vehicle. Press F or G on your keyboard to use your preferred car or boat respectively.',
npcDialog_Billy = 'I can\'t wait to rob the bank tonight!',
npcDialog_Derek = 'Psst.. We\'re going to score something big tonight: We\'ll rob the bank.\nIf you want to join us then you better talk to our boss Pablo.',
npcDialog_Pablo = 'So, you want to be a thief? I have a feeling that you\'re an undercover cop...\nOh, you\'re not? Fine, I\'ll believe you then.\nYou\'re now a thief and have the ability to rob characters with a pink name by pressing SPACE. Remember to stay away from the cops!',
npcDialog_Goldie = 'Do you want to sell a crystal? Drop it next to me so I can estimate its price.',
npcDialog_Weth = 'Pudding *-*',
itemInfo_miningPower = 'Rock damage: %s',
daveOffers = 'Today\'s offers',
placedFurnitures = 'Placed furnitures: %s',
npcDialog_Bill = 'Heyo! Do you want to check your current fishing lucky?\nHmmm... Lemme see...\nYou have %s chance for getting a common fish, %s for a rare fish and %s for a mythical fish.\nYou also have %s chance for getting a legendary fish!',
furniture_nightstand = 'Nightstand',
furniture_bush = 'Bush',
furniture_armchair = 'Armchair',
furniture_books = 'Books',
furniture_mirror = 'Mirror',
furniture_broom = 'Broom',
furniture_piggy = 'Piggy',
furniture_sink = 'Sink',
badgeDesc_11 = 'Top 10 of season %s',
caught_goldenmare = '<v>%s</v> <j>fished a Goldenmare!</j>',
newCar = 'New Car',
unlockedCar = 'Congrats! You have unlocked a new car!',
seasonReward = 'Season Reward',
furniture_inflatableDuck = 'Inflatable Duck',
furniture_lifesaverChair = 'Lifesaver Chair',
furniture_coolBox = 'Cool Box',
furniture_bbqGrill = 'Barbecue Grill',
furniture_shower = 'Shower',
furniture_flamingo = 'Flamingo',
item_bananaSeed = 'Banana Seedling',
item_banana = 'Banana',
item_moqueca = 'Fish Stew',
badgeDesc_12 = 'Top 10 of season 2',
item_grilledCheese = 'Grilled Cheese',
item_fishBurger = 'Fish Burger',
item_sushi = 'Sashimi', -- I thought it was called sushi lol
furniture_freezer = 'Freezer',
confirmButton_skipQuest = 'Skip Quest!',
skipQuest = 'Skip Quest',
skipQuestTxt = 'Are you sure do you want to skip this quest? <r>You can only do this once a day.</r>',
item_bananaCake = 'Banana Cake',
item_croquettes = 'Potato Croquettes',
itemInfo_sellingPrice = 'Selling price: %s',
--- V3.1.1
House8 = 'Modern House',
houseDescription_8 = 'It is not a mansion, but it is big as one.',
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.