content
stringlengths
5
1.05M
--[[ Created by Grid2 original authors, modified by Michael --]] local Range = Grid2.statusPrototype:new("range") local Grid2 = Grid2 local tonumber = tonumber local tostring = tostring local UnitIsUnit = UnitIsUnit local UnitInRange = UnitInRange local IsSpellInRange = IsSpellInRange local UnitIsDeadOrGhost = UnitIsDeadOrGhost local CheckInteractDistance = CheckInteractDistance local UnitPhaseReason = UnitPhaseReason or Grid2.Dummy local timer local cache = {} local Ranges= { ["10"] = function(unit) return CheckInteractDistance(unit,3) end, ["28"] = function(unit) return CheckInteractDistance(unit,4) end, ["38"] = UnitInRange, ["99"] = UnitIsVisible, } local UnitRangeCheck local UnitIsInRange local playerClass = select(2, UnitClass("player")) local rangeSpell local rangeSpellID if Grid2.isClassic then rangeSpellID = ({PALADIN=19750,SHAMAN=25357,DRUID=774,PRIEST=2050})[playerClass] else rangeSpellID = ({PALADIN=19750,SHAMAN=77472,DRUID=774,PRIEST=73325,MONK=115450})[playerClass] end if rangeSpellID then rangeSpell = GetSpellInfo(rangeSpellID) Ranges[ rangeSpell ] = function(unit) return IsSpellInRange(rangeSpell, unit) == 1 end end local rezSpell = ({DRUID=20484,PRIEST=2006,PALADIN=7328,SHAMAN=2008,MONK=115178,DEATHKNIGHT=61999,WARLOCK=20707})[playerClass] if rezSpell then rezSpell = GetSpellInfo(rezSpell) UnitIsInRange = function(unit) if UnitPhaseReason(unit) then return elseif UnitIsDeadOrGhost(unit) then return UnitIsUnit(unit,"player") or IsSpellInRange(rezSpell,unit) == 1 else return UnitRangeCheck(unit) end end end -- Roster ranges update function local function Update() for unit in Grid2:IterateRosterUnits() do local value = UnitIsInRange(unit) and 1 or false if value ~= cache[unit] then cache[unit] = value Range:UpdateIndicators(unit) end end end -- Range status function Range:OnEnable() self:UpdateDB() self:RegisterMessage("Grid_UnitUpdated") self:RegisterMessage("Grid_UnitLeft") self:RegisterMessage("Grid_GroupTypeChanged") self:RegisterMessage("Grid_PlayerSpecChanged") timer:Play() end function Range:OnDisable() self:UnregisterMessage("Grid_UnitUpdated") self:UnregisterMessage("Grid_UnitLeft") self:UnregisterMessage("Grid_GroupTypeChanged") self:UnregisterMessage("Grid_PlayerSpecChanged") timer:Stop() end -- {{ Workaround for WoW 5.0.4 UnitInRange() bug (returns false for player&pet while solo or in arena) local Ranges38 = { solo = function() return true end, arena = function(unit) return UnitIsUnit(unit,"player") or UnitInRange(unit) end } function Range:Grid_GroupTypeChanged(_, groupType) if self.range == "38" then self:UpdateDB() end end -- }} -- If the range configured is a Heal Spell, when changing spec the heal spell could not be available -- in this case we fall back to the standard 38 yards range. function Range:Grid_PlayerSpecChanged() if not tonumber(self.dbx.range) then -- If is not a number -> Using RangeSpell for the player class if available self:UpdateDB() end end function Range:Grid_UnitUpdated(_, unit) cache[unit] = UnitIsInRange(unit) and 1 or false end function Range:Grid_UnitLeft(_, unit) cache[unit] = nil end -- Due to ancient code, configuration can store a heal spell name in status.dbx.range (Rejuv, Healing wave, etc), but this prevents -- to use the same profile for different healer classes, because the heal spell is different for each class: -- So we check if status.dbx.range stores a heal spell name (the value is not a number), and in this case the code loads the correct -- heal spell for the class (precalculated in rangeSpell variable) instead of the heal spell stored in config. function Range:UpdateDB() Ranges["38"] = Ranges38[ Grid2:GetGroupType() ] or UnitInRange self.defaultAlpha = self.dbx.default or 0.25 self.range = tonumber(self.dbx.range) and tostring(self.dbx.range) or (rangeSpellID and IsSpellKnown(rangeSpellID) and rangeSpell) UnitRangeCheck = Ranges[self.range] if not UnitRangeCheck then self.range = "38" UnitRangeCheck = Ranges["38"] end if not rezSpell then UnitIsInRange = UnitRangeCheck end timer = timer or Grid2:CreateTimer( Update ) timer:SetDuration(self.dbx.elapsed or 0.25) end function Range:GetPercent(unit) return cache[unit] or self.defaultAlpha end function Range:GetRanges() return Ranges, rangeSpell end function Range:IsActive(unit) return not cache[unit] end Range.GetColor = Grid2.statusLibrary.GetColor local function Create(baseKey, dbx) Grid2:RegisterStatus(Range, {"percent", "color"}, baseKey, dbx) return Range end Grid2.setupFunc["range"] = Create Grid2:DbSetStatusDefaultValue( "range", {type = "range", color1 = {r=1, g=0, b=0, a=1}, range= 38, default = 0.25, elapsed = 0.5})
local GUI = require("GUI") -------------------------------------------------------------------------------- local workspace = GUI.workspace() workspace:addChild(GUI.panel(1, 1, workspace.width, workspace.height, 0x262626)) local filesystemChooser = workspace:addChild(GUI.filesystemChooser(2, 2, 30, 3, 0xE1E1E1, 0x888888, 0x3C3C3C, 0x888888, nil, "Open", "Cancel", "Choose", "/")) filesystemChooser:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE) filesystemChooser.onSubmit = function(path) GUI.alert("File \"" .. path .. "\" was selected") end -------------------------------------------------------------------------------- workspace:draw() workspace:start()
local mod = DBM:NewMod(1713, "DBM-Nighthold", nil, 786) local L = mod:GetLocalizedStrings() mod:SetRevision(("$Revision: 15140 $"):sub(12, -3)) mod:SetCreatureID(101002) mod:SetEncounterID(1842) mod:SetZone() --mod:SetUsedIcons(8, 7, 6, 3, 2, 1) mod:SetHotfixNoticeRev(15020) mod.respawnTime = 25--or 30 mod:RegisterCombat("combat") mod:RegisterEventsInCombat( "SPELL_CAST_START 205368 205370 205420 209017 206352 205862 205361", "SPELL_AURA_APPLIED 206677 205344", "SPELL_AURA_APPLIED_DOSE 206677", "SPELL_AURA_REMOVED 205344", "UNIT_DIED" ) --(ability.id = 205368 or ability.id = 205370 or ability.id = 205420 or ability.id = 205361) and type = "begincast" --TODO, improve info frame to show active mob count on top of burning pitch on player true/false? instead of just being burning pitch list for entire raid? local warnExpelOrbDestro = mod:NewTargetCountAnnounce(205344, 4) local warnSlam = mod:NewCountAnnounce(205862, 2)--Regular slams don't need special warn, only bridge smashing ones local specWarnSearingBrand = mod:NewSpecialWarningStack(206677, nil, 10, nil, 1, 2)--Lets go with 10 for now local specWarnSearingBrandOther = mod:NewSpecialWarningTaunt(206677, nil, nil, nil, 1, 2) local specWarnFelBeam = mod:NewSpecialWarningDodge(205368, nil, nil, nil, 2, 2) local specWarnOrbDestro = mod:NewSpecialWarningMoveAway(205344, nil, nil, nil, 3, 2) local yellOrbDestro = mod:NewFadesYell(205344) local specWarnBurningPitch = mod:NewSpecialWarningCount(205420, nil, nil, nil, 2, 6) local specWarnSlam = mod:NewSpecialWarningDodge(205862, nil, nil, nil, 3, 2)--every 3rd slam level 3 special warning local specWarnFelBlast = mod:NewSpecialWarningInterrupt(209017, "HasInterrupt", nil, nil, 1, 2) local specWarnFelBurst = mod:NewSpecialWarningInterrupt(206352, "HasInterrupt", nil, nil, 1, 2) local timerSearingBrand = mod:NewTargetTimer(20, 206677, nil, "Tank", nil, 5) local timerFelBeamCD = mod:NewNextCountTimer(16, 205368, nil, nil, nil, 3) local timerOrbDestroCD = mod:NewNextCountTimer(16, 205344, nil, nil, nil, 3, nil, DBM_CORE_DEADLY_ICON)--Not that deadly on non mythic but on mythic it is local timerBurningPitchCD = mod:NewNextCountTimer(16, 205420, nil, "-Tank", nil, 5) local timerSlamCD = mod:NewNextCountTimer(30, 205862, nil, nil, nil, 3, nil, DBM_CORE_DEADLY_ICON) local berserkTimer = mod:NewBerserkTimer(360)--technically not a berserk, but raid instantly wipes during final bridge smash, at 6 minutes. local countdownBigSlam = mod:NewCountdown(90, 205862) local countdownOrbDestro = mod:NewCountdownFades("AltTwo5", 205344) local voiceSearingBrand = mod:NewVoice(206677)--tauntboss local voiceFelBeam = mod:NewVoice(205368)--moveleft/moveright local voiceOrbDestro = mod:NewVoice(205344)--runout local voiceBurningPitch = mod:NewVoice(205420)--watchstep/helpsoak(new) local voiceSlam = mod:NewVoice(205862)--justrun local voiceFelBlast = mod:NewVoice(209017, "HasInterrupt")--kickcast local voiceFelBurst = mod:NewVoice(206352, "HasInterrupt")--kickcast mod:AddRangeFrameOption(5, 206352) --mod:AddSetIconOption("SetIconOnMC", 163472, false) mod:AddInfoFrameOption(215944, false) mod:AddArrowOption("ArrowOnBeam", 205368, true) local burningPitchDebuff = GetSpellInfo(215944) local mobGUIDs = {} --Beams (205370/205368 Combined) local lolBeamTimers = {5, 15, 30, 30, 23, 27, 30, 44, 14, 16, 14, 16, 22, 60}--LFR & Normal local heroicBeamTimers = {7, 29, 30, 42, 16, 16, 14, 16, 28, 54, 26, 5, 5, 16, 5, 12, 12, 5, 13}--Complete up to berserk local mythicBeamTimers = {6, 16, 16, 16, 14, 16, 27, 55, 26, 5, 21.3, 4.7, 12.2, 12, 4.8, 13.2, 19, 4.8, 25.2, 4.8}--(up to 5:18, missing 42 seconds) --Orbs local lolOrbTimers = {70.0, 40.0, 60.0, 25.0, 60.0, 37.0, 15.0, 15.0, 30.0}--LFR and Normal local heroicOrbTimers = {19.9, 60.0, 23.0, 62.0, 27.0, 25.0, 15.0, 15.4, 14.6, 30, 55}--Complete up to berserk local mythicOrbTimers = {13, 62, 27, 25, 14.9, 15, 15, 30, 55.1, 38}--(up to 5:18, missing 42 seconds) --Pitch local lolBurningPitchTimers = {38.0, 102.0, 85.0, 90.0}--LFR and Normal local heroicBurningPitchTimers = {49.8, 85.0, 90.0, 94} local mythicBurningPitchTimers = {45.0, 90, 93.9, 78}--38.0, 102.0, 85.0, 90.0 (OLD) mod.vb.burningEmbers = 0 mod.vb.slamCount = 0 mod.vb.beamCount = 0 mod.vb.orbCount = 0 mod.vb.pitchCount = 0 function mod:OnCombatStart(delay) table.wipe(mobGUIDs) self.vb.burningEmbers = 0 self.vb.slamCount = 0 self.vb.beamCount = 0 self.vb.orbCount = 0 self.vb.pitchCount = 0 if self:IsMythic() then timerFelBeamCD:Start(6-delay, 1) timerOrbDestroCD:Start(13-delay, 1) timerBurningPitchCD:Start(52-delay, 1) timerSlamCD:Start(-delay, 1) countdownBigSlam:Start(-delay) berserkTimer:Start(-delay) elseif self:IsHeroic() then timerFelBeamCD:Start(5-delay, 1) timerOrbDestroCD:Start(22-delay, 1) timerBurningPitchCD:Start(52-delay, 1) timerSlamCD:Start(-delay, 1) countdownBigSlam:Start(-delay) berserkTimer:Start(-delay) else timerFelBeamCD:Start(5-delay, 1) timerSlamCD:Start(-delay, 1) timerBurningPitchCD:Start(38-delay, 1) timerOrbDestroCD:Start(70-delay, 1) countdownBigSlam:Start(-delay) berserkTimer:Start(-delay) end if self.Options.InfoFrame then DBM.InfoFrame:SetHeader(burningPitchDebuff) DBM.InfoFrame:Show(5, "reverseplayerbaddebuff", burningPitchDebuff) end end function mod:OnCombatEnd() if self.Options.InfoFrame then DBM.InfoFrame:Hide() end if self.Options.RangeFrame then DBM.RangeCheck:Hide() end if self.Options.ArrowOnBeam then DBM.Arrow:Hide() end end function mod:SPELL_CAST_START(args) local spellId = args.spellId if spellId == 205368 or spellId == 205370 then--205370 left, 205368 right self.vb.beamCount = self.vb.beamCount + 1 specWarnFelBeam:Show(self.vb.beamCount) local nextCount = self.vb.beamCount + 1 local timers = self:IsMythic() and mythicBeamTimers[nextCount] or self:IsHeroic() and heroicBeamTimers[nextCount] or lolBeamTimers[nextCount] if timers then timerFelBeamCD:Start(timers, nextCount) end if spellId == 205368 then--Coming from right voiceFelBeam:Play("moveleft") if self.Options.ArrowOnBeam then DBM.Arrow:ShowStatic(90, 4) end else--coming from left voiceFelBeam:Play("moveright") if self.Options.ArrowOnBeam then DBM.Arrow:ShowStatic(270, 4) end end elseif spellId == 205420 then self.vb.pitchCount = self.vb.pitchCount+ 1 specWarnBurningPitch:Show(self.vb.pitchCount) if UnitDebuff("player", burningPitchDebuff) then voiceBurningPitch:Play("watchstep") else voiceBurningPitch:Play("helpsoak") end local nextCount = self.vb.pitchCount + 1 local timers = self:IsMythic() and mythicBurningPitchTimers[nextCount] or self:IsHeroic() and heroicBurningPitchTimers[nextCount] or lolBurningPitchTimers[nextCount] if timers then timerBurningPitchCD:Start(nil, nextCount) end elseif spellId == 209017 and self:CheckInterruptFilter(args.sourceGUID) then specWarnFelBlast:Show(args.sourceName) voiceFelBlast:Play("kickcast") elseif spellId == 206352 then if not mobGUIDs[args.sourceGUID] then mobGUIDs[args.sourceGUID] = true self.vb.burningEmbers = self.vb.burningEmbers + 1 if self.Options.RangeFrame and not DBM.RangeCheck:IsShown() then DBM.RangeCheck:Show(5) end end if self:CheckInterruptFilter(args.sourceGUID) then specWarnFelBurst:Show(args.sourceName) voiceFelBurst:Play("kickcast") end elseif spellId == 205862 then self.vb.slamCount = self.vb.slamCount + 1 timerSlamCD:Start(nil, self.vb.slamCount+1) if self.vb.slamCount % 3 == 0 then specWarnSlam:Show() voiceSlam:Play("justrun") countdownBigSlam:Start() else warnSlam:Show(self.vb.slamCount) end elseif spellId == 205361 then self.vb.orbCount = self.vb.orbCount + 1 local nextCount = self.vb.orbCount+1 local timers = self:IsMythic() and mythicOrbTimers[nextCount] or self:IsHeroic() and heroicOrbTimers[nextCount] or lolOrbTimers[nextCount] if timers then timerOrbDestroCD:Start(timers, nextCount) end end end function mod:SPELL_AURA_APPLIED(args) local spellId = args.spellId if spellId == 206677 then local amount = args.amount or 1 timerSearingBrand:Start(args.destName) if amount >= 10 then if args:IsPlayer() then specWarnSearingBrand:Show(amount) voiceSearingBrand:Play("changemt") else if not UnitDebuff("player", args.spellName) and not UnitIsDeadOrGhost("player") then specWarnSearingBrandOther:Show(args.destName) voiceSearingBrand:Play("tauntboss") end end end elseif spellId == 205344 then if args:IsPlayer() then--Still do yell and range frame here, in case DK specWarnOrbDestro:Show() voiceOrbDestro:Play("runout") yellOrbDestro:Yell(5) yellOrbDestro:Schedule(4, 1) yellOrbDestro:Schedule(3, 2) yellOrbDestro:Schedule(2, 3) countdownOrbDestro:Start() else warnExpelOrbDestro:Show(self.vb.orbCount, args.destName) end end end mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIED function mod:SPELL_AURA_REMOVED(args) local spellId = args.spellId if spellId == 205344 then if args:IsPlayer() then yellOrbDestro:Cancel() countdownOrbDestro:Cancel() end end end function mod:UNIT_DIED(args) local cid = self:GetCIDFromGUID(args.destGUID) if cid == 104262 then--Burning Ember self.vb.burningEmbers = self.vb.burningEmbers - 1 mobGUIDs[args.destGUID] = nil if self.Options.RangeFrame and self.vb.burningEmbers == 0 then DBM.RangeCheck:Hide() end end end
-- Bartender4 Locale -- Please use the Localization App on WoWAce to Update this -- http://www.wowace.com/projects/bartender4/localization/ ;¶ local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "esES") or LibStub("AceLocale-3.0"):NewLocale("Bartender4", "esMX") if not L then return end L[ [=["None" as modifier means its always active, and no modifier is required. Remember to enable Mouse-Over Casting for the individual bars, on the "State Configuration" tab, if you want it to be active for a specific bar.]=] ] = [=["Ninguno" significa que la función está siempre activa, y no se requiere ningún modificador. Tienes que activar a lanzar al raton para cada barra individual que deseas, en la pestaña "Configuración de estado" en las opciones para esa barra.]=] L["|cffff0000WARNING|cffffffff: Pressing the button will reset your complete profile! If you're not sure about this, create a new profile and use that to experiment."] = "¡Apretando el botón restablecerá por completo su perfil! Si no está seguro sobre eso, crea un nuevo perfil y use para probarlo." L["|cffffff00Click|r to toggle bar lock"] = "|cffffff00Clic|r para fijar/liberar las barras" L["|cffffff00Right-click|r to open the options menu"] = "|cffffff00Clic derecho|r para abrir el menú de opciones" L["ActionBar Paging"] = "Paginación de barras de acción" L["Alpha"] = "Transparencia" L["ALT"] = "Alt" L["Alternatively, you can also find us on |cffffff78irc://irc.freenode.org/wowace|r"] = "De manera alternativa, puedes encontrarnos en irc://irc.freenode.org/wowace" L["Always Hide"] = "Ocultar siempre" L["Anchor"] = "Anclar" L["Apply Preset"] = "Usar preestablecidos." L["Auto-Assist Casting"] = "Asistente automático" L["Bag Bar"] = "Barra de bolsas" L["Bar %s"] = "Barra %s" L["Bar Options"] = "Opciones de barra" L["Bar Paging"] = "Paginación de barra" L["Bar Snapping"] = "Ajuste de barras" L["Bar Style & Layout"] = "Estilo y disposición de barras" L["Bars"] = "Barras" L["Bars unlocked. Move them now and click Lock when you are done."] = "Barras desbloqueadas. Desplácelas ahora y haga clic en bloquear cuando haya terminado." L["Bartender4"] = "Bartender4" L["Bartender4 only converts the bindings of Bar1 to be directly usable, all other Bars will have to be re-bound to the Bartender4 keys. A direct indicator if your key-bindings are setup correctly is the hotkey display on the buttons. If the key-bindings shows correctly on your button, everything should work fine as well."] = "Bartender solo convierte las asociaciones de teclas de la barra 1 para ser usadas directamente, todas las otras barras tendrán que volver a asociarse usando el configurador de Bartender4. Un indicador de que las asociaciones han sido correctas es el indicador de tecla rápida en los botones. Si las asociaciones se ven correctamente en los botones, es indicio de que todo funciona correctamente." L["Bartender4 was written by Nevcairiel of EU-Antonidas. He will accept cookies as compensation for his hard work!"] = "Bartender fue creado por Nevcairiel de EU-Antonidas. ¡¡Aceptará galletas como compensación por su duro trabajo!!" L["Blizzard Art"] = "Gráficos Blizzard" L["Blizzard Art Bar"] = "Barra de gráficos Blizzard" L["Blizzard interface"] = "Interfaz de Blizzard" L["Button %s"] = "Botón %s" L["Button Grid"] = "Panel de botones" L["Button Lock"] = "Bloquear botones" L["Button Look"] = "Aspecto de los botones" L["Button Tooltip"] = "Ventanas emergentes de los botones" L["Buttons"] = "Botones" L["Cannot access options during combat."] = "No se puede acceder a las opciones durante el combate" L["Center Horizontally"] = "Centrado horizontalmente" L["Center Vertically"] = "Centrado verticalmente" L["Centers the bar horizontally on screen."] = "Centra la barra horizontalmente en la pantalla." L["Centers the bar vertically on screen."] = "Centra la barra verticalmente en la pantalla." L["Change the current anchor point of the bar."] = "Cambia el punto de anclaje actual de la barra." L["Choose between the classic WoW layout and two variations"] = "Elija entre la disposición del WoW clásico y dos variaciones" L["Choose the ending to the left"] = "Elija el acabado a la izquierda" L["Choose the ending to the right"] = "Elija el acabado a la derecha" L["Classic"] = "Clásico" L["Click-Through"] = "Pulsar a través" L["Colors"] = "Colores" L["Configure the Stance Bar"] = "Configurar la barra de estados" L["Configure actionbar paging when the %s key is down."] = "Configurar la paginación de la barra de acciones cuando se pulse la tecla %s" L["Configure all of Bartender to preset defaults"] = "Configure todo Bartender a los valores preestablecidos como predeterminados" L["Configure Bar %s"] = "Configurar barra %s" L["Configure how the Out of Range Indicator should display on the buttons."] = "Configurar cómo se debe mostrar el indicador de sin rabia en los botones." L["Configure the alpha of the bar."] = "Configurar la transparencia de la barra." L["Configure the Bag Bar"] = "Configurar la barra de bolsas." L["Configure the Blizzard Art Bar"] = "Configure la barra artística de Blizzard" L["Configure the Button Tooltip."] = "Configurar ventana emergente de los botones." L["Configure the Extra Action Bar"] = "Configura la barra de acción extra" L["Configure the Fade Out Alpha"] = "Configurar la transparencia del desvanecimiento." L["Configure the Fade Out Delay"] = "Configurar el retraso del desvanecimiento." L["Configure the Micro Menu"] = "Configurar el micro menú." L["Configure the padding of the buttons."] = "Configurar la separación entre botones." L["Configure the Pet Bar"] = "Configurar la barra de mascotas." L["Configure the Reputation Bar"] = "Configurar la barra de reputación" L["Configure the scale of the bar."] = "Configurar la escala de la barra." L["Configure the Status Tracking Bar"] = "Configurar la barra de seguimiento de estado" L["Configure the VehicleBar"] = "Configurar la barra de vehículos." L["Configure the XP Bar"] = "Configurar la barra de XP" L["Configure the Zone Ability Bar"] = "Configurar la barra de habilidad de zona" L["Copy Conditionals"] = "Copiar condiciones" L["Create a copy of the auto-generated conditionals in the custom configuration as a base template."] = "Crear una copia de las condiciones generadas automáticamente en la configuración personalizada como plantilla." L["CTRL"] = "Ctrl" L["Custom Conditionals"] = "Condiciones personalizadas" L["Default Bar State"] = "Estado por defecto de las barras" L["Direction of the button flyouts on this bar (eg. summon demon/pet)"] = "Dirección de botones desplegables en esta barra (Por ejemplo: Invocar demonio, Llamar a mascota)." L["Disable any reaction to mouse events on this bar, making the bar click-through."] = "Deshabilitar cualquier reacción a eventos del ratón en esta barra, haciendo que se pueda pulsar a través de ella." L["Disabled"] = "Deshabilitar" L["Disabled in Combat"] = "Deshabilitar en combate" L["Don't Page"] = "No paginar" L["Down"] = "Abajo" L["Empty button background"] = "Botón de fondo vacío" L[ [=[Enable Auto-Assist for this bar. Auto-Assist will automatically try to cast on your target's target if your target is no valid target for the selected spell.]=] ] = [=[Permitir asistente automático para esta barra. Asistente automático tratará de lanzar automáticamente la habilidad en el objetivo de tu objetivo, si éste no es un objetivo válido para la habilidad seleccionada.]=] L[ [=[Enable Bar Switching based on the actionbar controls provided by the game. See Blizzard Key Bindings for assignments - Usually Shift-Mouse Wheel and Shift+1 - Shift+6.]=] ] = [=[Permitir intercambio de barras basado en los controles de barras de acciones proporcionados por el juego. Vea asignación de teclas de Blizzard para referencia - Generalmente "Shift-Rueda del ratón" y "Shift+1" - "Shift+6".]=] L[ [=[Enable Mouse-Over Casting for this bar. Mouse-Over Casting will automatically cast onto the unit under your mouse without targeting it, if possible.]=] ] = [=[Permitir a lanzar al razon para esta barra. Con este función, tus hechizos se lanzan automáticamente en la unidad bajo del raton sin seleccionarla, si es posible.]=] L["Enable State-based Button Swaping"] = "Permitir intercambio de botones basado en el estado" L["Enable the Bag Bar"] = "Habilitar la barra de bolsas" L["Enable the Blizzard Art Bar"] = "Habilite la barra artística de Blizzard" L["Enable the Extra Action Bar"] = "Activa la barra de acción extra" L["Enable the FadeOut mode"] = "Habilitar el modo desvanecer" L["Enable the Micro Menu"] = "Habilitar el micro menú" L["Enable the PetBar"] = "Habilitar la barra de mascotas" L["Enable the Reputation Bar"] = "Activar la barra de reputación" L["Enable the StanceBar"] = "Habilitar la barra de estados" L["Enable the Status Tracking Bar"] = "Activar la barra de seguimiento de estado" L["Enable the use of a custom condition, disabling all of the above."] = "Habilitar el uso de una condición personalizada, deshabilitando todas la anteriores." L["Enable the use of the Blizzard Vehicle UI, hiding any Bartender4 bars in the meantime."] = "Habilitar el uso de la interfaz de vehículos de Blizzard, ocultando cualquier barra de Bartender4 mientras tanto (configurable en cada barra)." L["Enable the Vehicle Bar"] = "Habilitar la barra de vehículos" L["Enable the XP Bar"] = "Activar la barra de XP" L["Enable the Zone Ability Bar"] = "Activar la barra de habilidad de zona" L["Enable/Disable the bar."] = "Habilitar/deshabilitar la barra." L["Enabled"] = "Habilitada" L["Extra Action Bar"] = "Barra de acción extra" L["Fade Out"] = "Desvanecer" L["Fade Out Alpha"] = "Transparencia de desvanecimiento" L["Fade Out Delay"] = "Retraso hasta desvanecerse" L["FAQ"] = "FAQ" L["Flyout Direction"] = "Dirección de desplegables" L["Focus-Cast by modifier"] = "Lanzamiento al foco según modificador" L["Focus-Cast Modifier"] = "Modificador para lanzamiento al foco" L["Frequently Asked Questions"] = "Preguntas frecuentes" L["Full Button Mode"] = "Modo todos los botones" L["Full reset"] = "Restablecer por completo" L["General Settings"] = "Opciones generales" L["Griffin"] = "Grifo" L["Hide Equipped Border"] = "Ocultar borde equipado" L["Hide Hotkey"] = "Ocultar tecla de acceso rápido" L["Hide in Combat"] = "Ocultar en combate" L["Hide in Stance/Form"] = "Ocultar en estado/forma" L["Hide Macro Text"] = "Ocultar texto de macro" L["Hide on Vehicle"] = "Ocultar en vehículo" L["Hide out of Combat"] = "Ocultar fuera de combate" L["Hide the Hotkey on the buttons of this bar."] = "Ocultar las teclas de acceso rápido de los botones de esta barra." L["Hide the inner border indicating the equipped status on the buttons of this bar."] = "Ocultar el borde interior indicando el estado de equipamiento en los botones de esta barra." L["Hide the Macro Text on the buttons of this bar."] = "Ocultar el texto de macros de los botones de esta barra." L["Hide this bar in a specific Stance or Form."] = "Ocultar esta barra en un estado o forma específico." L["Hide this bar when a override bar is active."] = "Oculta esta barra cuando una barra predominante está activa." L["Hide this bar when the game wants to show a vehicle UI."] = "Ocultar esta barra cuando el juego quiera mostrar una interfaz de usuario de vehículo." L["Hide this bar when you are possessing a NPC."] = "Ocultar esta barra cuando se posea un PNJ." L["Hide this bar when you are riding on a vehicle."] = "Ocultar esta barra cuando se monte en un vehículo." L["Hide this bar when you have a pet."] = "Ocultar esta barra cuando se tenga una mascota." L["Hide this bar when you have no pet."] = "Ocultar esta barra cuando no se tenga una mascota." L["Hide when Possessing"] = "Ocultar en posesión" L["Hide with Override Bar"] = "Ocultar con barra predominante" L["Hide with pet"] = "Ocultar con mascota" L["Hide with Vehicle UI"] = "Ocultar con la interfaz de usuario del vehículo" L["Hide without pet"] = "Ocultar sin mascota" L["Horizontal Growth"] = "Crecimiento horizontal" L["Horizontal growth direction for this bar."] = "Dirección de crecimiento horizontal para esta barra" L["Hotkey Mode"] = "Modo de acceso rápido" L["How do I change the Bartender4 Keybindings then?"] = "¿Entonces cómo cambio las asociaciones de teclas de Bartender4?" L["I just installed Bartender4, but my keybindings do not show up on the buttons/do not work."] = "Acabo de instalar Bartender4, pero mis asociaciones no se muestran en los botones o no funcionan." L["I've found a bug! Where do I report it?"] = "¡¡He encontrado un error!! ¿Dónde puedo reportarlo?" L["Key Bindings"] = "Asignación de teclas" L["Layout"] = "Disposición" L["Left"] = "Izquierda" L["Left ending"] = "Terminado a la izquierda" L["Lion"] = "León" L["Lock"] = "Bloquear" L["Lock all bars."] = "Bloquear todas las barras" L["Lock the buttons."] = "Bloquear los botones" L["Micro Menu"] = "Micro menú" L["Minimap Icon"] = "Icono del Minimapa" L["Modifier Based Switching"] = "Intercambio basado en modificadores" L["Mouse-Over Casting"] = "Lanzar al raton" L["Mouse-Over casting can be limited to be only active when a modifier key is being held down. You can configure the modifier in the global \"Bar\" Options."] = "Lanzar al raton puede ser limitada para activar sólo mientras se pulsa una tecla modificadora. El modificador se puede configurar en las opciones globales \"Barra\"." L["Mouse-Over Casting Modifier"] = "Modificador para lanzar al raton" L["No Display"] = "No mostrar" L["No Stance/Form"] = "Sin estado/forma" L["None"] = "Nada" L["Note: Enabling Custom Conditionals will disable all of the above settings!"] = "Nota: ¡Habilitar las condiciones personalizadas deshabilitará todas las opciones anteriores!" L["Number of buttons."] = "Número de botones" L["Number of rows."] = "Número de filas" L["Offset in X direction (horizontal) from the given anchor point."] = "Desplazado en la dirección X (horizontal) desde el punto de anclaje dado." L["Offset in Y direction (vertical) from the given anchor point."] = "Desplazado en la dirección Y (vertical) desde el punto de anclaje dado." L["Once open, simply hover the button you want to bind, and press the key you want to be bound to that button. The keyBound tooltip and on-screen status will inform you about already existing bindings to that button, and the success of your binding attempt."] = "Una vez abierto, simplemente pasa el ratón por encima del botón que quieres asociar, y presiona la tecla a la que quieres asociarlo. La ventana emergente y la información en pantalla te dirán si ya existe una tecla asociada a ese botón, y si has asociado con éxito la tecla." L["One action bar only"] = "Una única barra" L["One Bag"] = "Una bolsa" L["Only show one Bag Button in the BagBar."] = "Mostrar sólo un botón de bolsa en la barra de bolsas" L["Out of Mana Indicator"] = "Indicador sin maná" L["Out of Range Indicator"] = "Indicador de fuera de rango" L["Padding"] = "Espaciado" L["Page %2d"] = "Página %2d" L["Pet Bar"] = "Barra de mascotas" L["Positioning"] = "Posicionamiento" L["Possess Bar"] = "Barra de posesión" L["Presets"] = "Preprogramado" L["Reputation Bar"] = "Barra de reputación" L["Reset Position"] = "Restablecer posición" L["Reset the position of this bar completly if it ended up off-screen and you cannot reach it anymore."] = "Restablecer la posición de esta barra completamente si terminó fuera de la pantalla y no puede acceder a ella." L["Right"] = "Derecha" L["Right ending"] = "Terminado a la derecha" L["Right-click Self-Cast"] = "Autolanzarse con el botón derecho" L["Rows"] = "Filas" L["Scale"] = "Escala" L["Select a modifier for Mouse-Over Casting"] = "Selecciona un modificador para lanzar al raton" L["Select the Focus-Cast Modifier"] = "Seleccione el modificador de lanzamiento al foco" L["Select the Self-Cast Modifier"] = "Seleccione el modificador de lanzamiento sobre sí mismo" L["Self-Cast by modifier"] = "Lanzar sobre sí mismo según modificador" L["Self-Cast Modifier"] = "Modificador de lanzamiento sobre sí mismo" L["SHIFT"] = "Shift" L["Show a Icon to open the config at the Minimap"] = "Mostrar un icono para abrir la configuración en el Minimapa" L["Smart Target selection"] = "Selección intelligente de objetivo" L["Specify the Color of the Out of Mana Indicator"] = "Especificar el color del indicador sin maná" L["Specify the Color of the Out of Range Indicator"] = "Especificar el color del indicador de fuera de alcance" L["Stance Bar"] = "Barra de estados" L["Stance Configuration"] = "Configuración de estados" L["State Configuration"] = "Configuración de estado" L["Status Tracking Bar"] = "Barra de seguimiento de estado" L["Status Tracking Bar (XP/Rep/...)"] = "Barra de seguimiento de estado (XP/Rep/...)" L["Switch this bar to the Possess Bar when possessing a npc (eg. Mind Control)"] = "Cambia esta barra a la barra de posesión cuando se posea un PNJ (Ej: Control mental)" L["Switch to key-binding mode"] = "Cambiar al modo asignación de tecla" L["The background of button places where no buttons are placed"] = "El fondo de los huecos de los botones cuando no hay botones puestos" L["The bar default is to be visible all the time, you can configure conditions here to control when the bar should be hidden."] = "Por defecto la barra es visible todo el tiempo, aquí se pueden configurar condiciones para controlar cuando se desea ocultar la barra." L["The default behaviour of this bar when no state-based paging option affects it."] = "Comportamiento por defecto de esta barra cuando no le afectan opciones de paginación basadas en el estado." L["The Positioning options here will allow you to position the bar to your liking and with an absolute precision."] = "Las opciones de posicionamiento le permitirá posicionar la barra a su gusto y con una precisión absoluta." L["These options can automatically select a different target for your spell, based on macro conditions. Note however that they will overrule any target changes from normal macros."] = "Estas opciones pueden seleccionar un objectivo different para tu hechizo mediante condiciones de macros. Sin embargo, estas condiciones ignorarán cualquier cambio de objectivo por los macros normales." L["This bar will be hidden once you enter combat."] = "Esta barra se ocultará estando en combate." L["This bar will be hidden whenever you are not in combat."] = "Esta barra se ocultará siempre que no esté en combate." L["Three bars stacked"] = "Tres barras apiladas" L["Toggle actions on key press instead of release"] = "Realizar las acciones cuando se presionen las teclas en vez de cuando las sueltes." L[ [=[Toggle Button Zoom For more style options you need to install Masque]=] ] = [=[Activar/desactivar botón Zoom Para más opciones de estilo se debe instalar ButtonFacade]=] L["Toggle the button grid."] = "Alinear los botones a la cuadrícula" L["Toggle the use of the modifier-based focus-cast functionality."] = "Alternar el uso de la funcionalidad de lanzamiento al foco basado en modificadores." L["Toggle the use of the modifier-based self-cast functionality."] = "Alternar el uso de la funcionalidad de lanzamiento sobre uno mismo basado en modificadores." L["Toggle the use of the right-click self-cast functionality."] = "Alternar el uso de la funcionalidad de lanzamiento sobre uno mismo con el botón derecho." L["Toggles actions immediately when you press the key, and not only on release. Note that draging actions will cause them to be cast in this mode."] = "Realizar las acciones inmediatamente cuando presionas la tecla, y no solo cuando la sueltas. Ten en cuenta que arrastrar un botón ocasionara que lances la habilidad usando este método." L["Two action bars"] = "Dos barras de acción" L["Two bars wide"] = "Dos barras amplias" L["Up"] = "Arriba" L["Use Blizzard Vehicle UI"] = "Usar la interfaz de vehículos de Blizzard" L["Use Custom Condition"] = "Usar condiciones personalizadas" L["Vehicle Bar"] = "Barra de vehículos" L["VehicleBar"] = "Barra de vehículos" L["Vertical Growth"] = "Crecimiento vertical" L["Vertical growth direction for this bar."] = "Dirección de crecimiento vertical para esta barra" L["Visibility"] = "Visibilidad" L["When reporting a bug, make sure you include the |cffffff78steps on how to reproduce the bug|r, supply any |cffffff78error messages|r with stack traces if possible, give the |cffffff78revision number|r of Bartender4 the problem occured in and state whether you are using an |cffffff78English client or otherwise|r."] = "Cuando reportes un error, asegúrate de que incluyes lo pasos que te llevaron a ese error, acompáñalo con una transcripción del error si es posible, proporciona la versión y revisión de Bartender4 que ha provocado ese error y el idioma del cliente que uses." L["Who wrote this cool addon?"] = "¿Quién creó este simpático Addon?" L["X Offset"] = "Desplazamiento X" L["XP Bar"] = "Barra de XP" L["Y Offset"] = "Desplazamiento Y" L["You can either click the KeyBound button in the options, or use the |cffffff78/kb|r chat command to open the keyBound control. Alternatively, you can also use the Blizzard Keybinding Interface."] = [=[Puedes hacer clic en el botón para asociar un botón en las opciones, o usar el comando de Chat para abrir el control de asociación de teclas. De manera alternativa, también puedes usar la interfaz para asociar teclas de Blizzard.]=] L["You can report bugs or give suggestions at the discussion forums at |cffffff78http://forums.wowace.com/showthread.php?t=12513|r or check the project page at |cffffff78http://www.wowace.com/addons/bartender4/|r"] = "Puedes reportar errores o hacer sugerencias en los foros de discusión en http://forums.wowace.com/showthread.php?t=12513 o visitar la página del proyecto en http://www.wowace.com/addons/bartender4/" L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = "Si solo desea acceder a una barra mediante las teclas asignadas, puede mantenerla siempre oculta." L[ [=[You can use any macro conditionals in the custom string, using "show" and "hide" as values. Example: [combat]hide;show]=] ] = [=[Puede emplear cualquier condición de macro en el texto personalizado, empleando "show" (Mostrar) y "hide"(Ocultar) como valores. Ejemplo: [combat]hide;show]=] L[ [=[You can use any macro conditionals in the custom string, using the number of the bar as target value. Example: [form:1]9;0]=] ] = [=[Puede emplear cualquier condición de macro en el texto personalizado, empleando el número de la barra como valor de destino. Ejemplo: [form:1]9,0]=] L["You can use the preset defaults as a starting point for setting up your interface. Just choose your preferences here and click the button below to reset your profile to the preset default. Note that not all defaults show all bars."] = "Puedes usar los valores preestablecidos como un punto de comienzo para configurar tu interfaz. Solo elige tus preferencias aquí y haz clic en el botón de más abajo para reiniciar tu perfil al perfil preestablecido. Ten en cuenta que no todos los valores preestablecidos muestran todas las barras." L["You have to exit the vehicle in order to be able to change the Vehicle UI settings."] = "Tienes que salir del vehículo a fin de poder cambiar la configuración de la interfaz de usuario del vehículo." L["Zone Ability Bar"] = "Barra de habilidad de zona" L["Zoom"] = "Zoom"
local Hamming = {} function Hamming.compute(a,b) if #a ~= #b then return -1 end local d = 0 for i=1,#a do if a:sub(i,i) ~= b:sub(i,i) then d = d + 1 end end return d end return Hamming
CSR = Mat.new( "CSR" ) -- eof
/******************************* Dynamic Memory Gate for Wiremod (C) Sebastian J. ********************************/ include('shared.lua') ENT.Spawnable = false ENT.AdminSpawnable = false ENT.RenderGroup = RENDERGROUP_BOTH function ENT:Initialize() end function ENT:OnRemove() end function ENT:Draw() self:DrawModel() Wire_Render(self) end function ENT:IsTranslucent() return false end function ENT:Think() end function ENT:GetOverlayText() return "Dynamic Memory (".. self:GetNWString("size") ..")" end
local class = require("libs/middleclass/middleclass") Beam = class("Beam") function Beam:initialize(charge_time) if charge_time >= 3 then charge_time = 10 end self.charge = charge_time * 10 self.alive_time = 0 self.max_alive_time = charge_time / 2 end function Beam:draw() local rc = table.getn(player_santa.reindeer) local reindeer = player_santa.reindeer[rc] local xx = reindeer.x + reindeer.width - 8 local yy = reindeer.y + 14 local x, y = player_santa.screen_space_x, player_santa.screen_space_y local x1, y1 = xx + self.charge, yy - self.charge local x2, y2 = xx + self.charge, yy + self.charge love.graphics.setColor(255, 100, 100, 255 * (self.alive_time / self.max_alive_time)) love.graphics.polygon("fill", xx, yy, x1, y1, x2, y2) love.graphics.rectangle("fill", x1, y1, screen_width, self.charge * 2) end function Beam:update(dt) self.alive_time = self.alive_time + dt if self.alive_time >= self.max_alive_time then self.charge = 0 self.delete = true end -- print(self.alive_time / self.max_alive_time) -- -- self.charge = self.charge * (self.alive_time / self.max_alive_time) end
--[[ Panluna test suite for pandoc interation Copyright (c) 2017 Albert Krewinkel Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ]] package.path = package.path .. ";../src/?.lua" local panluna = require "panluna" local json = require "lunajson" local Pandoc = {} function Pandoc:new(input_file, input_format) local t = { input_file = input_file, input_format = input_format, } setmetatable(t, self) self.__index = self return t end function Pandoc:convert_to(outformat) local cmdArgs = { "pandoc", "--standalone", "--from", self.input_format, "--to", outformat, self.input_file, } local handle = io.popen(table.concat(cmdArgs, " "), "r") local content = handle:read() handle:close() return content end function Pandoc:convert_to_json() return self:convert_to("json") end function test_json_parsing(test_name) it("allows to read " .. test_name:gsub("-", " "), function () local pandoc = Pandoc:new("tests/data/" .. test_name .. ".native", "native") local json_string = pandoc:convert_to_json() local json_structure = json.decode(json_string) local panluna_structure = dofile("tests/data/" .. test_name .. ".lua") assert.is.same( panluna_structure, panluna.Doc:from_json_structure(json_structure) ) end) end describe("Pandoc interaction", function() test_json_parsing("simple-doc") end)
local customParamSetViewScore= { name="customParamSetViewScore",type=0,typeName="View",time=0,x=0,y=0,width=1280,height=720,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTopLeft, { name="timesView",type=0,typeName="View",time=0,x=0,y=0,width=1280,height=86,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignTop, { name="title",type=4,typeName="Text",time=52972960,report=0,x=25,y=0,width=160,height=39,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,fontSize=32,textAlign=kAlignLeft,colorRed=118,colorGreen=72,colorBlue=18,string=[[最高倍数:]],colorA=1 }, { name="group",type=0,typeName="RadioButtonGroup",time=80134791,report=0,x=185,y=0,width=710,height=75,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft, { name="item",type=0,typeName="RadioButton",time=104092116,x=0,y=0,width=50,height=50,nodeAlign=kAlignLeft,visible=1,fillParentWidth=0,fillParentHeight=0, { name="title",type=4,typeName="Text",time=106769435,report=0,x=55,y=0,width=84,height=37,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,fontSize=28,textAlign=kAlignLeft,colorRed=118,colorGreen=72,colorBlue=18,string=[[自定义]],colorA=1 }, { name="editorBg",type=1,typeName="Image",time=80135337,report=0,x=145,y=0,width=160,height=65,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,file="hall/common/input_bg_l25_r25_t25_b25.png",gridLeft=25,gridRight=25,gridTop=25,gridBottom=25, { name="editor",type=6,typeName="EditText",time=80135338,report=0,x=0,y=0,width=130,height=65,visible=1,fillParentWidth=0,fillParentHeight=1,nodeAlign=kAlignCenter,fontSize=26,textAlign=kAlignCenter,colorRed=215,colorGreen=171,colorBlue=127,colorA=1 } } } } }, { name="roundsView",type=0,typeName="View",time=0,x=0,y=86,width=1280,height=86,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignTop, { name="title",type=4,typeName="Text",time=52972960,report=0,x=25,y=0,width=160,height=39,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,fontSize=32,textAlign=kAlignLeft,colorRed=118,colorGreen=72,colorBlue=18,string=[[选择局数:]],colorA=1 }, { name="group",type=0,typeName="RadioButtonGroup",time=80134791,report=0,x=185,y=0,width=710,height=75,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,stageW=0, { name="item",type=0,typeName="RadioButton",time=104092116,x=0,y=0,width=50,height=50,nodeAlign=kAlignLeft,visible=1,fillParentWidth=0,fillParentHeight=0, { name="title",type=4,typeName="Text",time=106769435,report=0,x=55,y=0,width=84,height=37,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,fontSize=28,textAlign=kAlignLeft,colorRed=118,colorGreen=72,colorBlue=18,string=[[自定义]] }, { name="editorBg",type=1,typeName="Image",time=80135337,report=0,x=145,y=0,width=160,height=65,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,file="hall/common/input_bg_l25_r25_t25_b25.png",gridLeft=25,gridRight=25,gridTop=25,gridBottom=25, { name="editor",type=6,typeName="EditText",time=80135338,report=0,x=0,y=0,width=130,height=65,visible=1,fillParentWidth=0,fillParentHeight=1,nodeAlign=kAlignCenter,fontSize=26,textAlign=kAlignCenter,colorRed=215,colorGreen=171,colorBlue=127,colorA=1 } } } } }, { name="baseChipView",type=0,typeName="View",time=0,x=0,y=172,width=1280,height=86,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignTop, { name="title",type=4,typeName="Text",time=52972960,report=0,x=25,y=0,width=160,height=39,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,fontSize=32,textAlign=kAlignLeft,colorRed=118,colorGreen=72,colorBlue=18,string=[[游戏底注:]],colorA=1 }, { name="view",type=0,typeName="View",time=0,x=185,y=0,width=200,height=86,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft, { name="baseChip",type=4,typeName="Text",time=52972960,report=0,x=50,y=0,width=160,height=39,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,fontSize=32,textAlign=kAlignLeft,colorRed=234,colorGreen=72,colorBlue=40,colorA=1 }, { name="icon",type=1,typeName="Image",time=0,x=0,y=0,width=45,height=45,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,file="isolater/jifen.png" } } } } return customParamSetViewScore;
-------------------------------------------------------------------------------- -- Turn the network's prediction into either even (0) or odd (1) by -- rounding the prediction values up or down. Then count how many are correct. -------------------------------------------------------------------------------- require 'torch' local Evaluate = {} Evaluate.errorRate = function (predictions, targets) local error = 0 local totalError = 0 for i = 1, predictions:size(1) do error = targets[i][1]==0 and predictions[i][1]< 0.5 and 0.0 or targets[i][1]==1 and predictions[i][1]>=0.5 and 0.0 or 1.0 totalError = totalError + error end return totalError / predictions:size(1) end return Evaluate
local packages = script.Parent.Parent.Parent local synthetic = require(script.Parent.Parent) local util = require(script.Parent.Parent:WaitForChild("Util")) local fusion = util.initFusion(require(packages:WaitForChild('fusion'))) local maidConstructor = require(packages:WaitForChild('maid')) local enums = require(script.Parent.Parent:WaitForChild("Enums")) local effects = require(script.Parent.Parent:WaitForChild("Effects")) local constructor = {} function constructor.new(params) --public states local public = { Transparency = util.import(params.Transparency) or fusion.State(0.2), Color = util.import(params.Color) or fusion.State(Color3.new(0.5,0.5,0.5)), Size = util.import(params.Size) or fusion.State(UDim.new(0,60)), Position = util.import(params.Position) or fusion.State(UDim.new(0,60)), SynthClassName = fusion.Computed(function() return script.Name end), } local tweenParams = { Duration = 0.8, EasingStyle = Enum.EasingStyle.Cubic, EasingDirection = Enum.EasingDirection.Out, } --construct return util.set(fusion.New "Frame", public, params, { AnchorPoint = Vector2.new(0.5,0.5), Size = util.tween(fusion.Computed(function() return UDim2.new(public.Size:get(), public.Size:get()) end), tweenParams), BackgroundColor3 = util.tween(public.Color, tweenParams), BackgroundTransparency = util.tween(public.Transparency, tweenParams), Position = public.Position, [fusion.Children] = { fusion.New "UICorner" { CornerRadius = UDim.new(0.5,0), } } }) end return constructor
function envoy_on_request(request_handle) request_handle:headers():add("X-Company", "FDJ") end function envoy_on_response(response_handle) body_size = response_handle:body():length() response_handle:headers():add("response-body-size", tostring(body_size)) end
--[[ -- All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -- its licensors. -- -- For complete copyright and license terms please see the LICENSE at the root of this -- distribution (the "License"). All use of this software is governed by the License, -- or, if provided, by the license below or the license accompanying this file. Do not -- remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --]] local simpleparticletrigger = { Properties = { EventPlay = { default = "PlayEffect", description = "The name of the event that will enable the particle effect.", }, }, } function simpleparticletrigger:OnActivate() self.playEventId = GameplayNotificationId(self.entityId, self.Properties.EventPlay, "float"); self.playHandler = GameplayNotificationBus.Connect(self, self.playEventId); end function simpleparticletrigger:OnDeactivate() self.playHandler:Disconnect(); self.playHandler = nil; end function simpleparticletrigger:OnEventBegin(value) if (GameplayNotificationBus.GetCurrentBusId() == self.playEventId) then ParticleComponentRequestBus.Event.SetVisibility(self.entityId, true); ParticleComponentRequestBus.Event.Enable(self.entityId, true); end end return simpleparticletrigger;
ENT.Type = "anim" ENT.Base = "base_anim" ENT.PrintName = "Red Razor Anomaly" ENT.Author = "" ENT.Contact = "" ENT.Purpose = "Cuts people who walk in it" ENT.Category = "Anomalies" ENT.Spawnable = true ENT.AdminSpawnable = true function ENT:OnRemove() end function ENT:PhysicsUpdate() end function ENT:PhysicsCollide(data,phys) end
-- THESE CAN BE CHANGED triggerKey = "tab" -- default button to open/close scoreboard settingsKey = "F7" -- default button to open the settings window drawOverGUI = true -- draw scoreboard over gui? seperationSpace = 80 -- the space between top/bottom screen and scoreboard top/bottom in pixels -- BUT DON'T TOUCH THESE scoreboardToggled = false scoreboardForced = false scoreboardDrawn = false forceScoreboardUpdate = false useAnimation = true scoreboardIsToggleable = false showServerInfo = false showGamemodeInfo = false showTeams = true useColors = true drawSpeed = 1 scoreboardScale = 1 teamHeaderFont = "clear" contentFont = "default-bold" columnFont = "default-bold" serverInfoFont = "default" rmbFont = "clear" cBlack = tocolor(0, 0, 0) cWhite = tocolor(255, 255, 255) cSettingsBox = tocolor(255, 255, 255, 150) MAX_PRIRORITY_SLOT = 500 scoreboardColumns = {} resourceColumns = {} scoreboardDimensions = { ["width"] = 0, ["height"] = 0, ["phase"] = 1, ["lastSeconds"] = 0 } scoreboardTicks = { ["lastUpdate"] = 0, ["updateInterval"] = 500 } scoreboardContent = {} firstVisibleIndex = 1 sortBy = { ["what"] = "__NONE__", ["dir"] = -1 } -- -1 = dec, 1 = asc sbOutOffset, sbInOffset = 1, 1 sbFont = "clear" sbFontScale = 0.68 serverInfo = {} fontScale = { -- To make all fonts be equal in height ["default"] = 1.0, ["default-bold"] = 1.0, ["clear"] = 1.0, ["arial"] = 1.0, ["sans"] = 1.0, ["pricedown"] = 0.5, ["bankgothic"] = 0.5, ["diploma"] = 0.5, ["beckett"] = 0.5 } selectedRows = {} addEvent("onClientPlayerScoreboardClick") addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function (resource) cScoreboardBackground = tocolor(defaultSettings.bg_color.r, defaultSettings.bg_color.g, defaultSettings.bg_color.b, defaultSettings.bg_color.a) cSelection = tocolor(defaultSettings.selection_color.r, defaultSettings.selection_color.g, defaultSettings.selection_color.b, defaultSettings.selection_color.a) cHighlight = tocolor(defaultSettings.highlight_color.r, defaultSettings.highlight_color.g, defaultSettings.highlight_color.b, defaultSettings.highlight_color.a) cHeader = tocolor(defaultSettings.header_color.r, defaultSettings.header_color.g, defaultSettings.header_color.b, defaultSettings.header_color.a) cTeam = tocolor(defaultSettings.team_color.r, defaultSettings.team_color.g, defaultSettings.team_color.b, defaultSettings.team_color.a) cBorder = tocolor(defaultSettings.border_color.r, defaultSettings.border_color.g, defaultSettings.border_color.b, defaultSettings.border_color.a) cServerInfo = tocolor(defaultSettings.serverinfo_color.r, defaultSettings.serverinfo_color.g, defaultSettings.serverinfo_color.b, defaultSettings.serverinfo_color.a) cContent = tocolor(defaultSettings.content_color.r, defaultSettings.content_color.g, defaultSettings.content_color.b, defaultSettings.content_color.a) bindKey(triggerKey, "down", "Toggle scoreboard", "1") bindKey(triggerKey, "up", "Toggle scoreboard", "0") bindKey(settingsKey, "down", "Open scoreboard settings", "1") addEventHandler("onClientRender", getRootElement(), drawScoreboard) triggerServerEvent("onClientDXScoreboardResourceStart", getRootElement()) readScoreboardSettings() triggerServerEvent("requestServerInfo", getRootElement()) colorPicker.constructor() end ) addEventHandler("onClientPlayerQuit", getRootElement(), function() selectedRows[source] = nil end ) function sendServerInfo(output) serverInfo = output end addEvent("sendServerInfo", true) addEventHandler("sendServerInfo", getResourceRootElement(getThisResource()), sendServerInfo) function toggleScoreboard(_, state) state = iif(state == "1", true, false) if scoreboardIsToggleable and state then scoreboardToggled = not scoreboardToggled elseif not scoreboardIsToggleable then scoreboardToggled = state end end addCommandHandler("Toggle scoreboard", toggleScoreboard) function openSettingsWindow() if scoreboardDrawn then local sX, sY = guiGetScreenSize() if not (windowSettings and isElement(windowSettings) and guiGetVisible(windowSettings)) then createScoreboardSettingsWindow(sX-323, sY-350) showCursor(true) elseif isElement(windowSettings) then destroyScoreboardSettingsWindow() end end end addCommandHandler("Open scoreboard settings", openSettingsWindow) addCommandHandler("scoreboard", function () scoreboardToggled = not scoreboardToggled end ) function iif(cond, arg1, arg2) if cond then return arg1 end return arg2 end function doDrawScoreboard(rtPass, onlyAnim, sX, sY) if #scoreboardColumns ~= 0 then -- -- In/out animation -- local currentSeconds = getTickCount() / 1000 local deltaSeconds = currentSeconds - scoreboardDimensions.lastSeconds scoreboardDimensions.lastSeconds = currentSeconds deltaSeconds = math.clamp(0, deltaSeconds, 1/25) if scoreboardToggled or scoreboardForced then local phases = { [1] = { ["width"] = s(10), ["height"] = s(5), ["incToWidth"] = s(10), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(40), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(10), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(), ["height"] = s(30), ["incToWidth"] = calculateWidth(), ["incToHeight"] = calculateHeight(), ["decToWidth"] = calculateWidth(), ["decToHeight"] = s(5) } } if not useAnimation then scoreboardDimensions.width = calculateWidth() scoreboardDimensions.height = calculateHeight() scoreboardDimensions.phase = #phases end local maxChange = deltaSeconds * 30*drawSpeed local maxWidthDiff = math.clamp(-maxChange, phases[scoreboardDimensions.phase].incToWidth - scoreboardDimensions.width, maxChange) local maxHeightDiff = math.clamp(-maxChange, phases[scoreboardDimensions.phase].incToHeight - scoreboardDimensions.height, maxChange) if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = scoreboardDimensions.width + maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end elseif scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth and not scoreboardDrawn then scoreboardDimensions.width = scoreboardDimensions.width - maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end end if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = scoreboardDimensions.height + maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end elseif scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight and not scoreboardDrawn then scoreboardDimensions.height = scoreboardDimensions.height - maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end end if scoreboardDimensions.width == phases[scoreboardDimensions.phase].incToWidth and scoreboardDimensions.height == phases[scoreboardDimensions.phase].incToHeight then if phases[scoreboardDimensions.phase + 1] then scoreboardDimensions.phase = scoreboardDimensions.phase + 1 else if not scoreboardDrawn then bindKey("mouse2", "both", showTheCursor) bindKey("mouse_wheel_up", "down", scrollScoreboard, -1) bindKey("mouse_wheel_down", "down", scrollScoreboard, 1) addEventHandler("onClientClick", getRootElement(), scoreboardClickHandler) if not (windowSettings and isElement(windowSettings)) then showCursor(false) end triggerServerEvent("requestServerInfo", getRootElement()) end scoreboardDrawn = true end end elseif scoreboardDimensions.width ~= 0 and scoreboardDimensions.height ~= 0 then local phases = { [1] = { ["width"] = s(10), ["height"] = s(5), ["incToWidth"] = s(10), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(40), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(10), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(), ["height"] = s(30), ["incToWidth"] = calculateWidth(), ["incToHeight"] = calculateHeight(), ["decToWidth"] = calculateWidth(), ["decToHeight"] = s(5) } } if scoreboardDrawn then unbindKey("mouse2", "both", showTheCursor) unbindKey("mouse_wheel_up", "down", scrollScoreboard, -1) unbindKey("mouse_wheel_down", "down", scrollScoreboard, 1) removeEventHandler("onClientClick", getRootElement(), scoreboardClickHandler) if not (windowSettings and isElement(windowSettings)) then showCursor(false) end end scoreboardDrawn = false if not useAnimation then scoreboardDimensions.width = 0 scoreboardDimensions.height = 0 scoreboardDimensions.phase = 1 end local maxChange = deltaSeconds * 30*drawSpeed local maxWidthDiff = math.clamp(-maxChange, scoreboardDimensions.width - phases[scoreboardDimensions.phase].decToWidth, maxChange) local maxHeightDiff = math.clamp(-maxChange, scoreboardDimensions.height - phases[scoreboardDimensions.phase].decToHeight, maxChange) if scoreboardDimensions.width > phases[scoreboardDimensions.phase].decToWidth then scoreboardDimensions.width = scoreboardDimensions.width - maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width < phases[scoreboardDimensions.phase].decToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].decToWidth end elseif scoreboardDimensions.width < phases[scoreboardDimensions.phase].decToWidth then scoreboardDimensions.width = scoreboardDimensions.width - maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width > phases[scoreboardDimensions.phase].decToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].decToWidth end end if scoreboardDimensions.height > phases[scoreboardDimensions.phase].decToHeight then scoreboardDimensions.height = scoreboardDimensions.height - maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height < phases[scoreboardDimensions.phase].decToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].decToHeight end elseif scoreboardDimensions.height < phases[scoreboardDimensions.phase].decToHeight then scoreboardDimensions.height = scoreboardDimensions.height - maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height > phases[scoreboardDimensions.phase].decToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].decToHeight end end if scoreboardDimensions.width == phases[scoreboardDimensions.phase].decToWidth and scoreboardDimensions.height == phases[scoreboardDimensions.phase].decToHeight and scoreboardDimensions.width ~= 0 and scoreboardDimensions.height ~= 0 then scoreboardDimensions.phase = scoreboardDimensions.phase - 1 if scoreboardDimensions.phase < 1 then scoreboardDimensions.phase = 1 end end end -- -- Draw scoreboard background -- if (not rtPass or onlyAnim) and scoreboardDimensions.width ~= 0 and scoreboardDimensions.height ~= 0 then dxDrawRectangle((sX/2)-(scoreboardDimensions.width/2), (sY/2)-(scoreboardDimensions.height/2), scoreboardDimensions.width, scoreboardDimensions.height, cScoreboardBackground, drawOverGUI) end -- Check if anything else to do if not scoreboardDrawn or onlyAnim then return end -- -- Update the scoreboard content -- local currentTick = getTickCount() if (currentTick - scoreboardTicks.lastUpdate > scoreboardTicks.updateInterval and (scoreboardToggled or scoreboardForced)) or forceScoreboardUpdate then forceScoreboardUpdate = false scoreboardContent = {} local index = 1 local sortTableIndex = 1 local sortTable = {} local players = getElementsByType("player") for key, player in ipairs(players) do if not getPlayerTeam(player) or not (showTeams or (serverInfo.forceshowteams and not serverInfo.forcehideteams)) or serverInfo.forcehideteams then sortTable[sortTableIndex] = {} for key, column in ipairs(scoreboardColumns) do local content if column.name == "name" then local playerName = getPlayerName(player) if serverInfo.allowcolorcodes then if string.find(playerName, "#%x%x%x%x%x%x") then local colorCodes = {} while(string.find(playerName, "#%x%x%x%x%x%x")) do local startPos, endPos = string.find(playerName, "#%x%x%x%x%x%x") if startPos then colorCode = string.sub(playerName, startPos, endPos) table.insert(colorCodes, { { getColorFromString(colorCode) }, startPos }) playerName = string.gsub(playerName, "#%x%x%x%x%x%x", "", 1) end end content = { playerName, colorCodes } else content = playerName end else content = playerName end elseif column.name == "ping" then content = getPlayerPing(player) else content = getElementData(player, column.name) end content = iif(content and column.name ~= "name" and type(content) ~= "table", tostring(content), content) if column.textFunction then if content and column.name == "name" and type(content) == "table" then content[1] = column.textFunction(content[1], player) else content = column.textFunction(content, player) end end sortTable[sortTableIndex][column.name] = content sortTable[sortTableIndex]["__SCOREBOARDELEMENT__"] = player end sortTableIndex = sortTableIndex + 1 end end if sortBy.what ~= "__NONE__" then table.sort(sortTable, scoreboardSortFunction) end for key, value in ipairs(sortTable) do scoreboardContent[index] = value index = index + 1 end if (showTeams or (serverInfo.forceshowteams and not serverInfo.forcehideteams)) and not serverInfo.forcehideteams then -- And then the teams local teamSortTableIndex = 1 local teamSortTable = {} sortTableIndex = 1 sortTable = {} local teams = getElementsByType("team") for key, team in ipairs(teams) do -- Add teams to sorting table first teamSortTable[teamSortTableIndex] = {} for key, column in ipairs(scoreboardColumns) do local content if column.name == "name" then local teamName = getTeamName(team) local teamMemberCount = #getPlayersInTeam(team) teamName = iif(teamName, tostring(teamName), "-") teamMemberCount = iif(teamMemberCount, tostring(teamMemberCount), "0") teamName = teamName .. " (" .. teamMemberCount .. " player" .. iif(teamMemberCount == "1", "", "s") .. ")" if serverInfo.allowcolorcodes then if string.find(teamName, "#%x%x%x%x%x%x") then local colorCodes = {} while(string.find(teamName, "#%x%x%x%x%x%x")) do local startPos, endPos = string.find(teamName, "#%x%x%x%x%x%x") if startPos then colorCode = string.sub(teamName, startPos, endPos) table.insert(colorCodes, { { getColorFromString(colorCode) }, startPos }) teamName = string.gsub(teamName, "#%x%x%x%x%x%x", "", 1) end end content = { teamName, colorCodes } else content = teamName end else content = teamName end else content = getElementData(team, column.name) end content = iif(content and column.name ~= "name" and type(content) ~= "table", tostring(content), content) if column.textFunction then if content and column.name == "name" and type(content) == "table" then content[1] = column.textFunction(content[1], team) else content = column.textFunction(content, team) end end teamSortTable[teamSortTableIndex][column.name] = content teamSortTable[teamSortTableIndex]["__SCOREBOARDELEMENT__"] = team end teamSortTableIndex = teamSortTableIndex + 1 -- and then the players sortTableIndex = 1 sortTable[team] = {} local players = getPlayersInTeam(team) for key, player in ipairs(players) do sortTable[team][sortTableIndex] = {} for key, column in ipairs(scoreboardColumns) do local content if column.name == "name" then local playerName = getPlayerName(player) if serverInfo.allowcolorcodes then if string.find(playerName, "#%x%x%x%x%x%x") then local colorCodes = {} while(string.find(playerName, "#%x%x%x%x%x%x")) do local startPos, endPos = string.find(playerName, "#%x%x%x%x%x%x") if startPos then colorCode = string.sub(playerName, startPos, endPos) table.insert(colorCodes, { { getColorFromString(colorCode) }, startPos }) playerName = string.gsub(playerName, "#%x%x%x%x%x%x", "", 1) end end content = { playerName, colorCodes } else content = playerName end else content = playerName end elseif column.name == "ping" then content = getPlayerPing(player) else content = getElementData(player, column.name) end content = iif(content and column.name ~= "name" and type(content) ~= "table", tostring(content), content) if column.textFunction then if content and column.name == "name" and type(content) == "table" then content[1] = column.textFunction(content[1], player) else content = column.textFunction(content, player) end end sortTable[team][sortTableIndex][column.name] = content sortTable[team][sortTableIndex]["__SCOREBOARDELEMENT__"] = player end sortTableIndex = sortTableIndex + 1 end if sortBy.what ~= "__NONE__" then table.sort(sortTable[team], scoreboardSortFunction) end end if sortBy.what ~= "__NONE__" then table.sort(teamSortTable, scoreboardSortFunction) end for key, content in ipairs(teamSortTable) do local team = content["__SCOREBOARDELEMENT__"] scoreboardContent[index] = content index = index + 1 for key, value in ipairs(sortTable[team]) do scoreboardContent[index] = value index = index + 1 end end end scoreboardTicks.lastUpdate = currentTick end -- -- Draw scoreboard content -- if scoreboardDrawn then scoreboardDimensions.height = calculateHeight() scoreboardDimensions.width = calculateWidth() local topX, topY = (sX/2)-(calculateWidth()/2), (sY/2)-(calculateHeight()/2) local index = firstVisibleIndex local maxPerWindow = getMaxPerWindow() if firstVisibleIndex > #scoreboardContent-maxPerWindow+1 then firstVisibleIndex = 1 end if firstVisibleIndex > 1 then dxDrawImage(sX/2-8, topY-15, 17, 11, "arrow.png", 0, 0, 0, cWhite, drawOverGUI) end if firstVisibleIndex+maxPerWindow <= #scoreboardContent and #scoreboardContent > maxPerWindow then dxDrawImage(sX/2-8, topY+scoreboardDimensions.height+4, 17, 11, "arrow.png", 180, 0, 0, cWhite, drawOverGUI) end local y = topY+s(5) if serverInfo.server and showServerInfo then dxDrawText("Server: " .. serverInfo.server, topX+s(5), y, topX+scoreboardDimensions.width-s(10), y+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont), cServerInfo, fontscale(serverInfoFont, s(0.75)), serverInfoFont, "left", "top", false, false, drawOverGUI) end if serverInfo.players and showServerInfo then local players = getElementsByType("player") local text = "Players: " .. tostring(#players) .. "/" .. serverInfo.players local textWidth = dxGetTextWidth(text, fontscale(serverInfoFont, s(0.75)), serverInfoFont) dxDrawText(text, topX+scoreboardDimensions.width-s(5)-textWidth, y, topX+scoreboardDimensions.width-s(5), y+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont), cServerInfo, fontscale(serverInfoFont, s(0.75)), serverInfoFont, "left", "top", false, false, drawOverGUI) end if (serverInfo.server or serverInfo.players) and showServerInfo then y = y+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end if serverInfo.gamemode and showGamemodeInfo then dxDrawText("Gamemode: " .. serverInfo.gamemode, topX+s(5), y, topX+scoreboardDimensions.width-s(10), y+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont), cServerInfo, fontscale(serverInfoFont, s(0.75)), serverInfoFont, "left", "top", false, false, drawOverGUI) end if serverInfo.map and showGamemodeInfo then local text = "Map: " .. serverInfo.map local textWidth = dxGetTextWidth(text, fontscale(serverInfoFont, s(0.75)), serverInfoFont) dxDrawText(text, topX+scoreboardDimensions.width-s(5)-textWidth, y, topX+scoreboardDimensions.width-s(5), y+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont), cServerInfo, fontscale(serverInfoFont, s(0.75)), serverInfoFont, "left", "top", false, false, drawOverGUI) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then y = y+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end y = y+s(3) local textLength = dxGetTextWidth("Hold RMB to enable scrolling/sorting", fontscale(rmbFont, s(0.75)), rmbFont) local textHeight = dxGetFontHeight(fontscale(rmbFont, s(0.75)), rmbFont) dxDrawText("Hold RMB to enable scrolling/sorting", sX/2-(textLength/2), topY+scoreboardDimensions.height-textHeight-s(2), sX/2+(textLength/2), topY+scoreboardDimensions.height-s(2), cWhite, fontscale(serverInfoFont, s(0.75)), rmbFont, "left", "top", false, false, drawOverGUI) local bottomX, bottomY = topX+scoreboardDimensions.width, topY+scoreboardDimensions.height textLength = dxGetTextWidth("settings...", fontscale(sbFont, s(sbFontScale)), sbFont) textHeight = dxGetFontHeight(fontscale(sbFont, s(sbFontScale)), sbFont) dxDrawText("settings...", bottomX-s(sbOutOffset+1+sbInOffset)-textLength, bottomY-s(sbOutOffset+1+sbInOffset)-textHeight, bottomX-s(sbOutOffset+1+sbInOffset), bottomY-s(sbOutOffset+1+sbInOffset), cSettingsBox, fontscale(sbFont, s(sbFontScale)), sbFont, "left", "top", false, false, drawOverGUI) dxDrawLine(bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength, bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight, bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength, bottomY-s(sbOutOffset+1), cSettingsBox, 1, drawOverGUI) dxDrawLine(bottomX-s(sbOutOffset+1), bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight, bottomX-s(sbOutOffset+1), bottomY-s(sbOutOffset+1), cSettingsBox, 1, drawOverGUI) dxDrawLine(bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength, bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight, bottomX-s(sbOutOffset+1), bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight, cSettingsBox, 1, drawOverGUI) dxDrawLine(bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength, bottomY-s(sbOutOffset+1), bottomX-s(sbOutOffset+1), bottomY-s(sbOutOffset+1), cSettingsBox, 1, drawOverGUI) local x = s(10) for key, column in ipairs(scoreboardColumns) do if x ~= s(10) then local height = s(5) if (serverInfo.server or serverInfo.players) and showServerInfo then height = height+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then height = height+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end height = height+s(3) dxDrawLine(topX+x-s(5), y+s(1), topX+x-s(5), y+scoreboardDimensions.height-height-s(2)-textHeight-s(5), cBorder, s(1), drawOverGUI) end if sortBy.what == column.name then local _, _, _, a = fromcolor(cHeader) dxDrawText(column.friendlyName or "-", topX+x+s(1+9), y+s(1), topX+x+s(1+column.width), y+s(1)+dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont), tocolor(0, 0, 0, a), fontscale(columnFont, s(1)), columnFont, "left", "top", true, false, drawOverGUI) dxDrawText(column.friendlyName or "-", topX+x+s(9), y, topX+x+s(column.width), y+dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont), cHeader, fontscale(columnFont, s(1)), columnFont, "left", "top", true, false, drawOverGUI) dxDrawRectangle(topX+x, iif(sortBy.dir == 1, y+s(8), y+s(6)), s(5), s(1), cWhite, drawOverGUI) dxDrawRectangle(topX+x+s(1), y+s(7), s(3), s(1), cWhite, drawOverGUI) dxDrawRectangle(topX+x+s(2), iif(sortBy.dir == 1, y+s(6), y+s(8)), s(1), s(1), cWhite, drawOverGUI) else local _, _, _, a = fromcolor(cHeader) dxDrawText(column.friendlyName or "-", topX+x+s(1), y+s(1), topX+x+s(1+column.width), y+s(1)+dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont), tocolor(0, 0, 0, a), fontscale(columnFont, s(1)), columnFont, "left", "top", true, false, drawOverGUI) dxDrawText(column.friendlyName or "-", topX+x, y, topX+x+s(column.width), y+dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont), cHeader, fontscale(columnFont, s(1)), columnFont, "left", "top", true, false, drawOverGUI) end x = x + s(column.width + 10) end dxDrawLine(topX+s(5), y+s(1)+dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont), topX+scoreboardDimensions.width-s(5), y+s(1)+dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont), cBorder, s(1), drawOverGUI) y = y+s(5)+dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont) while (index < firstVisibleIndex+maxPerWindow and scoreboardContent[index]) do local x = s(10) local element = scoreboardContent[index]["__SCOREBOARDELEMENT__"] local team, player if element and isElement(element) and getElementType(element) == "team" then dxDrawRectangle(topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont), cTeam, drawOverGUI) -- Highlight the the row on which the cursor lies on if checkCursorOverRow(rtPass, topX+s(5), topX+scoreboardDimensions.width-s(5), y, y+dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont)) then dxDrawRectangle(topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont), cHighlight, drawOverGUI) end -- Highlight selected row if selectedRows[element] then dxDrawRectangle(topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont), cHighlight, drawOverGUI) end for key, column in ipairs(scoreboardColumns) do local r, g, b, a = fromcolor(cContent) if not useColors then r, g, b = 255, 255, 255 end local theX = x local content = scoreboardContent[index][column.name] if content and column.name == "name" then if useColors then r, g, b = getTeamColor(element) end theX = x - s(3) end if content then if serverInfo.allowcolorcodes and type(content) == "table" and column.name == "name" then local playerName = content[1] local colorCodes = content[2] local xPos = topX+theX for k, v in ipairs(colorCodes) do local firstCodePos = v[2] local secondCodePos = colorCodes[k+1] and colorCodes[k+1][2]-1 or #playerName if firstCodePos ~= 1 and k == 1 then local secondPos = firstCodePos-1 local firstPos = 1 local partOfName = string.sub(playerName, firstPos, secondPos) local textLength = dxGetTextWidth(partOfName, fontscale(contentFont, s(1)), contentFont) dxDrawText(partOfName, xPos+s(1), y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont), tocolor(0, 0, 0, a or 255), fontscale(teamHeaderFont, s(1)), teamHeaderFont, "left", "top", true, false, drawOverGUI) dxDrawText(partOfName, xPos, y, topX+x+s(column.width), y+dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont), tocolor(r or 255, g or 255, b or 255, a or 255), fontscale(teamHeaderFont, s(1)), teamHeaderFont, "left", "top", true, false, drawOverGUI) xPos = xPos + textLength end if useColors then r, g, b = v[1][1], v[1][2], v[1][3] end local partOfName = string.sub(playerName, firstCodePos, secondCodePos) local textLength = dxGetTextWidth(partOfName, fontscale(contentFont, s(1)), contentFont) dxDrawText(partOfName, xPos+s(1), y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont), tocolor(0, 0, 0, a or 255), fontscale(teamHeaderFont, s(1)), teamHeaderFont, "left", "top", true, false, drawOverGUI) dxDrawText(partOfName, xPos, y, topX+x+s(column.width), y+dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont), tocolor(r or 255, g or 255, b or 255, a or 255), fontscale(teamHeaderFont, s(1)), teamHeaderFont, "left", "top", true, false, drawOverGUI) xPos = xPos + textLength end elseif type(content) == "table" and column.name ~= "name" then if content.type == "image" and content.src then local itemHeight = dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont) content.height = content.height or itemHeight content.width = content.width or itemHeight local itemWidth = content.height/itemHeight * content.width content.color = content.color or tocolor(255,255,255,255) content.rot = content.rot or 0 content.rotOffX = content.rotOffX or 0 content.rotOffY = content.rotOffY or 0 dxDrawImage (topX+theX, y, itemWidth, itemHeight, content.src, content.rot, content.rotOffX, content.rotOffY, content.color, drawOverGUI) end else dxDrawText(content, topX+theX+s(1), y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont), tocolor(0, 0, 0, a or 255), fontscale(teamHeaderFont, s(1)), teamHeaderFont, "left", "top", true, false, drawOverGUI) dxDrawText(content, topX+theX, y, topX+x+s(column.width), y+dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont), tocolor(r or 255, g or 255, b or 255, a or 255), fontscale(teamHeaderFont, s(1)), teamHeaderFont, "left", "top", true, false, drawOverGUI) end end x = x + s(column.width + 10) end elseif element and isElement(element) and getElementType(element) == "player" then -- Highlight local player's name if element == getLocalPlayer() then dxDrawRectangle(topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), cSelection, drawOverGUI) end -- Highlight the the row on which the cursor lies on if checkCursorOverRow(rtPass, topX+s(5), topX+scoreboardDimensions.width-s(5), y, y+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont)) then dxDrawRectangle(topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), cHighlight, drawOverGUI) end -- Highlight selected row if selectedRows[element] then dxDrawRectangle(topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), cHighlight, drawOverGUI) end for key, column in ipairs(scoreboardColumns) do local r, g, b, a = fromcolor(cContent) if not useColors then r, g, b = 255, 255, 255 end local theX = x local content = scoreboardContent[index][column.name] if content and column.name == "name" then if useColors then r, g, b = getPlayerNametagColor(element) end if getPlayerTeam(element) and (showTeams or (serverInfo.forceshowteams and not serverInfo.forcehideteams)) and not serverInfo.forcehideteams then theX = x + s(12) end end if content then if serverInfo.allowcolorcodes and type(content) == "table" and column.name == "name" then local playerName = content[1] local colorCodes = content[2] local xPos = topX+theX for k, v in ipairs(colorCodes) do local firstCodePos = v[2] local secondCodePos = colorCodes[k+1] and colorCodes[k+1][2]-1 or #playerName if firstCodePos ~= 1 and k == 1 then local secondPos = firstCodePos-1 local firstPos = 1 local partOfName = string.sub(playerName, firstPos, secondPos) local textLength = dxGetTextWidth(partOfName, fontscale(contentFont, s(1)), contentFont) dxDrawText(partOfName, xPos+s(1), y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), tocolor(0, 0, 0, a or 255), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI) dxDrawText(partOfName, xPos, y, topX+x+s(column.width), y+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), tocolor(r or 255, g or 255, b or 255, a or 255), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI) xPos = xPos + textLength end if useColors then r, g, b = v[1][1], v[1][2], v[1][3] end local partOfName = string.sub(playerName, firstCodePos, secondCodePos) local textLength = dxGetTextWidth(partOfName, fontscale(contentFont, s(1)), contentFont) dxDrawText(partOfName, xPos+s(1), y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), tocolor(0, 0, 0, a or 255), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI) dxDrawText(partOfName, xPos, y, topX+x+s(column.width), y+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), tocolor(r or 255, g or 255, b or 255, a or 255), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI) xPos = xPos + textLength end elseif type(content) == "table" and column.name ~= "name" then if content.type == "image" and content.src then local itemHeight = dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont) content.height = content.height or itemHeight content.width = content.width or itemHeight local itemWidth = itemHeight/content.height * content.width content.color = content.color or tocolor(255,255,255,255) content.rot = content.rot or 0 content.rotOffX = content.rotOffX or 0 content.rotOffY = content.rotOffY or 0 dxDrawImage (topX+theX, y, itemWidth, itemHeight, content.src, content.rot, content.rotOffX, content.rotOffY, content.color, drawOverGUI) end elseif column.name == "dxscoreboard_loc" and content ~= "N/A" then -- outputDebugString(content) if (gettok(content, 2, " ")) then local flag = gettok(content, 1, " ") local country = gettok(content, 2, " ") dxDrawImage(topX+ theX, y+s(1)+1, 16, 11, flag, 0, 0, 0, cWhite, drawOverGUI) dxDrawText(country, topX+theX+s(1) + 20, y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), tocolor(0, 0, 0, a or 255), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI) dxDrawText(country, topX+theX + 20, y, topX+x+s(column.width), y+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), tocolor(r or 255, g or 255, b or 255, a or 255), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI) else -- outputDebugString("fuck") end else dxDrawText(content, topX+theX+s(1), y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), tocolor(0, 0, 0, a or 255), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI) dxDrawText(content, topX+theX, y, topX+x+s(column.width), y+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont), tocolor(r or 255, g or 255, b or 255, a or 255), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI) end end x = x + s(column.width + 10) end end local font = iif(element and isElement(element) and getElementType(element) == "team", teamHeaderFont, contentFont) y = y + dxGetFontHeight(fontscale(font, scoreboardScale), font) index = index + 1 end index = 1 end end end -- FUNCTIONS -- addColumn function scoreboardAddColumn(name, width, friendlyName, priority, textFunction, fromResource) if type(name) == "string" then width = width or 70 friendlyName = friendlyName or name priority = tonumber(priority) or getNextFreePrioritySlot(scoreboardGetColumnPriority("name")) fixPrioritySlot(priority) textFunction = textFunction or nil fromResource = sourceResource or fromResource or nil if not (priority > MAX_PRIRORITY_SLOT or priority < 1) then for key, value in ipairs(scoreboardColumns) do if name == value.name then return false end end table.insert(scoreboardColumns, { ["name"] = name, ["width"] = width, ["friendlyName"] = friendlyName, ["priority"] = priority, ["textFunction"] = textFunction }) table.sort(scoreboardColumns, function (a, b) return a.priority < b.priority end) if fromResource then if not resourceColumns[fromResource] then resourceColumns[fromResource] = {} end table.insert (resourceColumns[fromResource], name) end return true end end return false end addEvent("doScoreboardAddColumn", true) addEventHandler("doScoreboardAddColumn", getResourceRootElement(), function (name, width, friendlyName, priority, fromResource) scoreboardAddColumn(name, width, friendlyName, priority, nil, fromResource) end ) -- removeColumn function scoreboardRemoveColumn(name) if type(name) == "string" then for key, value in ipairs(scoreboardColumns) do if name == value.name then table.remove(scoreboardColumns, key) for resource, content in pairs(resourceColumns) do table.removevalue(content, name) end return true end end end return false end addEvent("doScoreboardRemoveColumn", true) addEventHandler("doScoreboardRemoveColumn", getResourceRootElement(), function (name) scoreboardRemoveColumn(name) end ) -- clearColumns function scoreboardClearColumns() while (scoreboardColumns[1]) do table.remove(scoreboardColumns, 1) resourceColumns = {} end return true end addEvent("doScoreboardClearColumns", true) addEventHandler("doScoreboardClearColumns", getResourceRootElement(), function () scoreboardClearColumns() end ) -- resetColumns function scoreboardResetColumns(fromServer) while (scoreboardColumns[1]) do table.remove(scoreboardColumns, 1) resourceColumns = {} end if not fromServer then scoreboardAddColumn("name", 170, "Name") scoreboardAddColumn("ping", 35, "Ping") end return true end addEvent("doScoreboardResetColumns", true) addEventHandler("doScoreboardResetColumns", getResourceRootElement(), function (fromServer) scoreboardResetColumns(iif(fromServer == nil, true, fromServer)) end ) -- setForced function scoreboardSetForced(forced) scoreboardForced = forced end addEvent("doScoreboardSetForced", true) addEventHandler("doScoreboardSetForced", getResourceRootElement(), function (forced) scoreboardSetForced(forced) end ) --Compability setScoreboardForced = scoreboardSetForced --setSortBy function scoreboardSetSortBy(name, desc) if name then if type(name) == "string" then local exists = false for key, value in ipairs(scoreboardColumns) do if name == value.name then exists = true end end if exists then desc = iif(type(desc) == "boolean" and not desc, 1, -1) sortBy.what = name sortBy.dir = desc end end return false else sortBy.what = "__NONE__" sortBy.dir = -1 return true end end addEvent("doScoreboardSetSortBy", true) addEventHandler("doScoreboardSetSortBy", getResourceRootElement(), function (name, desc) scoreboardSetSortBy(name, desc) end ) --getColumnPriority function scoreboardGetColumnPriority(name) if type(name) == "string" then for key, value in ipairs(scoreboardColumns) do if name == value.name then return value.priority end end end return false end --setColumnPriority function scoreboardSetColumnPriority(name, priority) if type(name) == "string" and type(priority) == "number" then if not (priority > MAX_PRIRORITY_SLOT or priority < 1) then local columnIndex = false for key, value in ipairs(scoreboardColumns) do if name == value.name then columnIndex = key end end if columnIndex then scoreboardColumns[columnIndex].priority = -1 -- To empty out the current priority fixPrioritySlot(priority) scoreboardColumns[columnIndex].priority = priority table.sort(scoreboardColumns, function (a, b) return a.priority < b.priority end) return true end end end return false end addEvent("doScoreboardSetColumnPriority", true) addEventHandler("doScoreboardSetColumnPriority", getResourceRootElement(), function (name, priority) scoreboardSetColumnPriority(name, priority) end ) --getColumnCount function scoreboardGetColumnCount() return #scoreboardColumns end --setColumnTextFunction function scoreboardSetColumnTextFunction(name, func) if type(name) == "string" then for key, value in ipairs(scoreboardColumns) do if name == value.name then scoreboardColumns[key].textFunction = func return true end end end return false end function scoreboardGetTopCornerPosition() if scoreboardDrawn then local sX, sY = guiGetScreenSize() local topX, topY = (sX/2)-(calculateWidth()/2), (sY/2)-(calculateHeight()/2) topY = topY - 15 -- Extra 15 pixels for the scroll up button return math.floor(topX), math.floor(topY+1) end return false end function scoreboardGetSize() if scoreboardDrawn then local width, height = calculateWidth(), calculateHeight() return width, height end return false end function scoreboardGetSelectedRows() local rows = {} for k, v in pairs(selectedRows) do table.insert(rows, k) end return rows end -- Other function calculateWidth() local width = 0 for key, value in ipairs(scoreboardColumns) do width = width + s(value.width + 10) end return width + s(10) end function calculateHeight() local sX, sY = guiGetScreenSize() local maxPerWindow = getMaxPerWindow() local index = firstVisibleIndex local height = s(5) if (serverInfo.server or serverInfo.players) and showServerInfo then height = height+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then height = height+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end height = height+s(3) height = height+s(5)+dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont) height = height+s(5)+dxGetFontHeight(fontscale(rmbFont, s(0.75)), rmbFont) height = height+s(2) while (index < firstVisibleIndex+maxPerWindow and scoreboardContent[index]) do local element = scoreboardContent[index]["__SCOREBOARDELEMENT__"] if element and isElement(element) and getElementType(element) == "team" then height = height + dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont) else height = height + dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont) end index = index + 1 end return height end function showTheCursor(_, state) if state == "down" then showCursor(true) else if not (windowSettings and isElement(windowSettings)) then showCursor(false) end end end function scrollScoreboard(_, _, upOrDown) if isCursorShowing() then local index = firstVisibleIndex local maxPerWindow = getMaxPerWindow() local highestIndex = #scoreboardContent - maxPerWindow + 1 if index >= 1 and index <= highestIndex then local newIndex = math.max(1,math.min(index + upOrDown * serverInfo.scrollStep,highestIndex)) if index ~= newIndex then firstVisibleIndex = newIndex bForceUpdate = true end end end end function math.clamp(low, value, high) return math.max(low, math.min(value, high)) end function fromcolor(color) -- Propably not the most efficient way, but only way it works local colorCode = string.format("%x", color) local a = string.sub(colorCode, 1, 2) or "FF" local r = string.sub(colorCode, 3, 4) or "FF" local g = string.sub(colorCode, 5, 6) or "FF" local b = string.sub(colorCode, 7, 8) or "FF" a = tonumber("0x" .. a) r = tonumber("0x" .. r) g = tonumber("0x" .. g) b = tonumber("0x" .. b) return r, g, b, a end function scale(value) return value*scoreboardScale end s = scale function fontscale(font, value) return value*fontScale[font] end function scoreboardSortFunction(a, b) local firstContent, secondContent local sortByA if a[sortBy.what] and type(a[sortBy.what]) == "table" and sortBy.what == "name" then sortByA = a[sortBy.what][1] else sortByA = a[sortBy.what] end local sortByB if b[sortBy.what] and type(b[sortBy.what]) == "table" and sortBy.what == "name" then sortByB = b[sortBy.what][1] else sortByB = b[sortBy.what] end if tonumber(sortByA) then firstContent = tonumber(sortByA) else if sortByA then firstContent = string.lower(tostring(sortByA)) else firstContent = "" end end if tonumber(sortByB) then secondContent = tonumber(sortByB) else if sortByB then secondContent = string.lower(tostring(sortByB)) else secondContent = "" end end if type(sortBy.dir) == "number" then if type(firstContent) == type(secondContent) then else firstContent = string.lower(tostring(firstContent)) secondContent = string.lower(tostring(secondContent)) end return iif(sortBy.dir == 1, firstContent > secondContent, firstContent < secondContent) end return false end function getMaxPerWindow() local sX, sY = guiGetScreenSize() local availableHeight = sY-(seperationSpace*2)-s(5) if (serverInfo.server or serverInfo.players) and showServerInfo then availableHeight = availableHeight-dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then availableHeight = availableHeight-dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end availableHeight = availableHeight-s(3) availableHeight = availableHeight-s(5)-dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont) availableHeight = availableHeight-s(5)-dxGetFontHeight(fontscale(rmbFont, s(0.75)), rmbFont) availableHeight = availableHeight-s(2) local index = firstVisibleIndex local count = 0 local height = 0 while (scoreboardContent[index]) do local element = scoreboardContent[index]["__SCOREBOARDELEMENT__"] if element and isElement(element) and getElementType(element) == "team" then height = height + dxGetFontHeight(fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont) else height = height + dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont) end if height >= availableHeight then return count end index = index + 1 count = count + 1 end return count end function scoreboardClickHandler(button, state, cX, cY) if scoreboardDrawn and button == "left" and state == "down" then local sX, sY = guiGetScreenSize() local topX, topY = (sX/2)-(calculateWidth()/2), (sY/2)-(calculateHeight()/2) local xMin, xMax, yMin, yMax = topX, topX+calculateWidth(), topY, topY+calculateHeight() local maxPerWindow = getMaxPerWindow() local clickedColumn = false --This var is used if we clicked *anywhere* in the column if cX >= xMin and cX <= xMax and cY >= yMin and cY <= yMax then local clickedOnColumnHeader = false --This var is used if we clicked on the column header itself local x = s(10) local y = s(5)+s(3) if (serverInfo.server or serverInfo.players) and showServerInfo then y = y + dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then y = y + dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end for key, column in ipairs(scoreboardColumns) do if cX >= topX+x and cX <= topX+x+s(column.width) then clickedColumn = column.name if cY >= topY+y and cY <= topY+y+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont) then clickedOnColumnHeader = column.name end end x = x + s(column.width + 10) end if clickedOnColumnHeader then if sortBy.what == clickedOnColumnHeader then -- last click was this column sortBy.dir = sortBy.dir + 2 if sortBy.dir > 1 then sortBy.what = "__NONE__" sortBy.dir = -1 end else sortBy.what = clickedOnColumnHeader sortBy.dir = -1 end forceScoreboardUpdate = true end -- Settings button local bottomX, bottomY = topX+calculateWidth(), topY+calculateHeight() textLength = dxGetTextWidth("settings...", fontscale(sbFont, s(sbFontScale)), sbFont) textHeight = dxGetFontHeight(fontscale(sbFont, s(sbFontScale)), sbFont) if cX >= bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength and cX <= bottomX-s(sbOutOffset+1) and cY >= bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight and cY <= bottomY-s(sbOutOffset+1) then if not (windowSettings and isElement(windowSettings) and guiGetVisible(windowSettings)) then createScoreboardSettingsWindow(sX-323, sY-350) elseif isElement(windowSettings) then destroyScoreboardSettingsWindow() end end end -- Scroll buttons if firstVisibleIndex > 1 then if cX >= sX/2-8 and cX <= sX/2-8+17 and cY >= topY-15 and cY <= topY-15+11 then scrollScoreboard(nil, nil, -1) end end if firstVisibleIndex+maxPerWindow <= #scoreboardContent and #scoreboardContent > maxPerWindow then if cX >= sX/2-8 and cX <= sX/2-8+17 and cY >= topY+calculateHeight()+4 and cY <= topY+calculateHeight()+4+11 then scrollScoreboard(nil, nil, 1) end end -- Player/team click local y = topY+s(5) if (serverInfo.server or serverInfo.players) and showServerInfo then y = y+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then y = y+dxGetFontHeight(fontscale(serverInfoFont, scoreboardScale), serverInfoFont) end y = y+s(3) y = y+s(5)+dxGetFontHeight(fontscale(columnFont, scoreboardScale), columnFont) if cY >= y and cX then local index = firstVisibleIndex local maxPerWindow = getMaxPerWindow() local topX, topY = (sX/2)-(calculateWidth()/2), (sY/2)-(calculateHeight()/2) local width = calculateWidth() while (index < firstVisibleIndex+maxPerWindow and scoreboardContent[index]) do local element = scoreboardContent[index]["__SCOREBOARDELEMENT__"] local font = iif(element and isElement(element) and getElementType(element) == "team", teamHeaderFont, contentFont) if cX >= topX+s(5) and cX <= topX+width-s(5) and cY >= y and cY <= y+dxGetFontHeight(fontscale(font, scoreboardScale), font) then local selected = (not selectedRows[element]) == true local triggered = triggerEvent("onClientPlayerScoreboardClick", element, selected, cX, cY, clickedColumn) if triggered then selectedRows[element] = not selectedRows[element] end end y = y + dxGetFontHeight(fontscale(font, scoreboardScale), font) index = index + 1 end end end end function removeResourceScoreboardColumns(resource) if resourceColumns[resource] then while resourceColumns[resource][1] do local success = scoreboardRemoveColumn(resourceColumns[resource][1]) if not success then break end end resourceColumns[resource] = nil end end addEventHandler("onClientResourceStop", getRootElement(), removeResourceScoreboardColumns) function scoreboardForceUpdate () bForceUpdate = true return true end
local M = {} local fontname = "FiraCode NF" local fontsize = 10 local nvui_install_path = "d:\\Program Files\\nvui" function M.adjust_fontsize(amount) fontsize = fontsize + (amount or 0) vim.opt.guifont = fontname .. ":h" .. fontsize end function M.setup() vim.cmd("source " .. nvui_install_path .. "\\vim\\plugin\\nvui.vim") vim.cmd [[ NvuiCursorFrametime 0 NvuiCmdFontFamily FiraCode NF function! NvuiGetTitle() return "neovim" endfunction ]] M.adjust_fontsize() vim.keymap.set({ "n", "i" }, "<C-ScrollWheelUp>", function() require("config.gui.nvui").adjust_fontsize(1) end, { silent = true, desc = "Adjust fontsize +1" }) vim.keymap.set({ "n", "i" }, "<C-ScrollWheelDown>", function() require("config.gui.nvui").adjust_fontsize(-1) end, { silent = true, desc = "Adjust fontsize -1" }) vim.keymap.set("n", "<F7>", function() require("config.gui.nvui").adjust_fontsize(1) end, { silent = true, desc = "Adjust fontsize +1" }) vim.keymap.set("n", "<S-F7>", function() require("config.gui.nvui").adjust_fontsize(-1) end, { silent = true, desc = "Adjust fontsize -1" }) vim.keymap.set("n", "<F11>", "<Cmd>NvuiToggleFullscreen<CR>", { silent = true }) end return M
XPSYS = {} XPSYS.XP = 0 XPSYS.level = 1 XPSYS.XPOfNextLevel = 1 --[[--------------------------------------------------------- Name: XPSYS.Update() Desc: Updates all the data on the client. -----------------------------------------------------------]] function XPSYS.Update(len) XPSYS.XP = net.ReadInt(32) XPSYS.level = net.ReadInt(32) XPSYS.XPOfNextLevel = net.ReadInt(32) end net.Receive("UpdateClient",XPSYS.Update) function XPSYS.XPBarDraw() draw.RoundedBox( 8, ScrW()/4, ScrH()/40 + 7, ScrW()/2, 20, Color(100,0,100,200) ) local ratio = XPSYS.XP / XPSYS.XPOfNextLevel if ratio <= 0.01 then ratio = 0.01 end if ratio <= 0.98 then draw.RoundedBoxEx( 5,ScrW()/4, ScrH()/40 + 7 , (ScrW()/2) * ratio, 20, Color(0,255,255,200),true,false,true,false) else draw.RoundedBox( 5,ScrW()/4, ScrH()/40 + 7 , (ScrW()/2) * ratio, 20, Color(255,255,255,100)) end draw.DrawText( "XP Bar " , "Trebuchet24",ScrW()/2 - 10 , ScrH()/40 - 18, Color( 0, 255, 255, 255 ), TEXT_ALIGN_CENTER ) end hook.Add( "HUDPaint", "Experience Bar", XPSYS.XPBarDraw )
ESX = nil TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) -- [ Pizza Event ] -- RegisterNetEvent('bdl:signpizza') AddEventHandler('bdl:signpizza',function() local src = source local xPlayer = ESX.GetPlayerFromId(source) xPlayer.showNotification('Complimenti , hai ottenuto un nuovo lavoro!') xPlayer.setJob('Pizza', 0) end) -- [ FedEx Event ] -- RegisterNetEvent('bdl:signfedex') AddEventHandler('bdl:signfedex',function() local src = source local xPlayer = ESX.GetPlayerFromId(source) xPlayer.showNotification('Complimenti , hai ottenuto un nuovo lavoro!') xPlayer.setJob('Fedex', 0) end) -- [ Bus Event ] -- RegisterNetEvent('bdl:signonibus') AddEventHandler('bdl:signonibus',function() local src = source local xPlayer = ESX.GetPlayerFromId(source) xPlayer.showNotification('Complimenti , hai ottenuto un nuovo lavoro!') xPlayer.setJob('Bus', 0) end) -- [ Uber Event ] -- RegisterNetEvent('bdl:signuber') AddEventHandler('bdl:signuber',function() local src = source local xPlayer = ESX.GetPlayerFromId(source) xPlayer.showNotification('Complimenti , hai ottenuto un nuovo lavoro!') xPlayer.setJob('uber', 0) end)
local Batchnorm, parent = torch.class("nn.BatchNorm", "nn.Module") function Batchnorm:__init(s) parent.__init(self) self.running_mean = s.running_mean self.running_std = s.running_var:clone():sqrt() self.weight = s.weight self.bias = s.bias self.eps = 1e-5 assert (self.running_mean ~= nil) assert (self.running_std ~= nil) assert (self.weight ~= nil) assert (self.bias ~= nil) self._parameters,self._gradParameters = s:parameters() end function Batchnorm:parameters() return self._parameters, self._gradParameters end --function Batchnorm:accGradParameters(input, gradOutput, scale) -- return --end function Batchnorm:updateOutput(input) local batch_size = input:size(1) self.output = self.output or input.new() self.output:resizeAs(input) self.output:copy(input) self.output:add(-1, self.running_mean:view(1, -1, 1, 1):expandAs(input)) self.output:cdiv(self.running_std:view(1, -1, 1, 1):expandAs(input)) self.output:cmul(self.weight:view(1, -1, 1, 1):expandAs(input)) self.output:add(1, self.bias:view(1, -1, 1, 1):expandAs(input)) return self.output end function Batchnorm:updateGradInput(input, gradOutput) self.gradInput = input or input.new() self.gradInput:resizeAs(gradOutput) self.gradInput:copy(gradOutput) self.gradInput:cmul(self.weight:view(1,-1,1,1):expandAs(input)) self.gradInput:cdiv(self.running_std:view(1,-1,1,1):expandAs(input)) for i = 1,#self._gradParameters do self._gradParameters[i]:zero() end return self.gradInput end
require("scripts/globals/common") require("scripts/globals/status") require("scripts/globals/msg") function getSummoningSkillOverCap(avatar) local summoner = avatar:getMaster() local summoningSkill = summoner:getSkillLevel(tpz.skill.SUMMONING_MAGIC) local maxSkill = summoner:getMaxSkillLevel(avatar:getMainLvl(), tpz.job.SMN, tpz.skill.SUMMONING_MAGIC) return math.max(summoningSkill - maxSkill, 0) end function AvatarPhysicalMove(avatar,target,skill,numberofhits,accmod,dmgmod,dmgmodsubsequent,tpeffect,mtp100,mtp200,mtp300) local returninfo = {} local acc = avatar:getACC() + utils.clamp(getSummoningSkillOverCap(avatar), 0, 200) local eva = target:getEVA() local dmg = avatar:getWeaponDmg() local minFstr, maxFstr = avatarFSTR(avatar:getStat(tpz.mod.STR), target:getStat(tpz.mod.VIT)) local ratio = avatar:getStat(tpz.mod.ATT) / target:getStat(tpz.mod.DEF) -- Note: Avatars do not have any level correction. This is why they are so good on Wyrms! // https://kegsay.livejournal.com/tag/smn! local hitrate = utils.clamp(acc - eva, 20, 95) -- add on native crit hit rate (guesstimated, it actually follows an exponential curve) local critrate = (avatar:getStat(tpz.mod.DEX) - target:getStat(tpz.mod.AGI)) * 0.005 -- assumes +0.5% crit rate per 1 dDEX critrate = critrate + avatar:getMod(tpz.mod.CRITHITRATE) / 100 critrate = utils.clamp(critrate, 0.05, 0.2) -- Applying pDIF if ratio <= 1 then maxRatio = 1 minRatio = 1/3 elseif ratio < 1.6 then maxRatio = (2 * ratio + 1) / 3 minRatio = (7 * ratio - 4) / 9 elseif ratio <= 1.8 then maxRatio = 1.8 minRatio = 1 elseif ratio < 3.6 then maxRatio = 2.4 * ratio - 2.52 minRatio = 5 * ratio / 3 - 2 else maxRatio = 4.2 minRatio = 4 end -- start the hits local hitsdone = 1 local hitslanded = 0 local hitdmg = 0 local finaldmg = 0 if math.random() < hitrate then hitdmg = avatarHitDmg(dmg, minRatio, maxRatio, minFstr, maxFstr, critrate) finaldmg = finaldmg + hitdmg * dmgmod hitslanded = hitslanded + 1 end while hitsdone < numberofhits do if math.random() < hitrate then hitdmg = avatarHitDmg(dmg, minRatio, maxRatio, minFstr, maxFstr, critrate) finaldmg = finaldmg + hitdmg * dmgmodsubsequent hitslanded = hitslanded + 1 end hitsdone = hitsdone + 1 end -- all hits missed if hitslanded == 0 or finaldmg == 0 then finaldmg = 0 hitslanded = 0 skill:setMsg(tpz.msg.basic.SKILL_MISS) -- some hits hit else target:wakeUp() end -- apply ftp bonus if tpeffect == TP_DMG_BONUS then finaldmg = finaldmg * avatarFTP(skill:getTP(), mtp100, mtp200, mtp300) end returninfo.dmg = finaldmg returninfo.hitslanded = hitslanded return returninfo end -- minFstr = dSTR/4 + 0.5 -- maxFstr = dSTR/4 + 0.25 function avatarFSTR(att_str, def_vit) local dSTR = att_str - def_vit return math.floor(dSTR / 4 + 0.5), math.floor(dSTR / 4 + 0.25) end function avatarHitDmg(dmg, pdifMin, pdifMax, fstrMin, fstrMax, critrate) local fstr = math.random(fstrMin, fstrMax) local pdif = math.random(pdifMin * 1000, pdifMax * 1000) / 1000 if math.random() < critrate then pdif = math.min(pdif + 1, 4.2) end return (dmg + fstr) * pdif end function AvatarFinalAdjustments(dmg,mob,skill,target,skilltype,skillparam,shadowbehav) -- physical attack missed, skip rest if skilltype == tpz.attackType.PHYSICAL and dmg == 0 then return 0 end -- set message to damage -- this is for AoE because its only set once skill:setMsg(tpz.msg.basic.DAMAGE) --Handle shadows depending on shadow behaviour / skilltype if shadowbehav < 5 and shadowbehav ~= MOBPARAM_IGNORE_SHADOWS then --remove 'shadowbehav' shadows. targShadows = target:getMod(tpz.mod.UTSUSEMI) shadowType = tpz.mod.UTSUSEMI if targShadows == 0 then --try blink, as utsusemi always overwrites blink this is okay targShadows = target:getMod(tpz.mod.BLINK) shadowType = tpz.mod.BLINK end if targShadows > 0 then -- Blink has a VERY high chance of blocking tp moves, so im assuming its 100% because its easier! if targShadows >= shadowbehav then --no damage, just suck the shadows skill:setMsg(tpz.msg.basic.SHADOW_ABSORB) target:setMod(shadowType, targShadows - shadowbehav) if shadowType == tpz.mod.UTSUSEMI then --update icon effect = target:getStatusEffect(tpz.effect.COPY_IMAGE) if effect ~= nil then if targShadows - shadowbehav == 0 then target:delStatusEffect(tpz.effect.COPY_IMAGE) target:delStatusEffect(tpz.effect.BLINK) elseif targShadows - shadowbehav == 1 then effect:setIcon(tpz.effect.COPY_IMAGE) elseif targShadows - shadowbehav == 2 then effect:setIcon(tpz.effect.COPY_IMAGE_2) elseif targShadows - shadowbehav == 3 then effect:setIcon(tpz.effect.COPY_IMAGE_3) end end end return shadowbehav else -- less shadows than this move will take, remove all and factor damage down dmg = dmg * (shadowbehav - targShadows) / shadowbehav target:setMod(tpz.mod.UTSUSEMI, 0) target:setMod(tpz.mod.BLINK, 0) target:delStatusEffect(tpz.effect.COPY_IMAGE) target:delStatusEffect(tpz.effect.BLINK) end end elseif shadowbehav == MOBPARAM_WIPE_SHADOWS then --take em all! target:setMod(tpz.mod.UTSUSEMI, 0) target:setMod(tpz.mod.BLINK, 0) target:delStatusEffect(tpz.effect.COPY_IMAGE) target:delStatusEffect(tpz.effect.BLINK) end -- handle Third Eye using shadowbehav as a guide teye = target:getStatusEffect(tpz.effect.THIRD_EYE) if teye ~= nil and skilltype == tpz.attackType.PHYSICAL then --T.Eye only procs when active with PHYSICAL stuff if shadowbehav == MOBPARAM_WIPE_SHADOWS then --e.g. aoe moves target:delStatusEffect(tpz.effect.THIRD_EYE) elseif shadowbehav ~= MOBPARAM_IGNORE_SHADOWS then --it can be absorbed by shadows --third eye doesnt care how many shadows, so attempt to anticipate, but reduce --chance of anticipate based on previous successful anticipates. prevAnt = teye:getPower() if prevAnt == 0 then --100% proc teye:setPower(1) skill:setMsg(tpz.msg.basic.ANTICIPATE) return 0 end if math.random() * 10 < 8 - prevAnt then --anticipated! teye:setPower(prevAnt+1) skill:setMsg(tpz.msg.basic.ANTICIPATE) return 0 end target:delStatusEffect(tpz.effect.THIRD_EYE) end end --TODO: Handle anything else (e.g. if you have Magic Shield and its a Magic skill, then do 0 damage. if skilltype == tpz.attackType.PHYSICAL and target:hasStatusEffect(tpz.effect.PHYSICAL_SHIELD) then return 0 end if skilltype == tpz.attackType.RANGED and target:hasStatusEffect(tpz.effect.ARROW_SHIELD) then return 0 end -- handle elemental resistence if skilltype == tpz.attackType.MAGICAL and target:hasStatusEffect(tpz.effect.MAGIC_SHIELD) then return 0 end -- handling phalanx dmg = dmg - target:getMod(tpz.mod.PHALANX) if dmg < 0 then return 0 end --handle invincible if target:hasStatusEffect(tpz.effect.INVINCIBLE) and skilltype == tpz.attackType.PHYSICAL then return 0 end -- handle pd if target:hasStatusEffect(tpz.effect.PERFECT_DODGE) or target:hasStatusEffect(tpz.effect.TOO_HIGH) and skilltype == tpz.attackType.PHYSICAL then return 0 end -- Calculate Blood Pact Damage before stoneskin dmg = dmg + dmg * mob:getMod(tpz.mod.BP_DAMAGE) / 100 -- handling stoneskin dmg = utils.stoneskin(target, dmg) return dmg end -- returns true if mob attack hit -- used to stop tp move status effects function AvatarPhysicalHit(skill, dmg) -- if message is not the default. Then there was a miss, shadow taken etc return skill:getMsg() == tpz.msg.basic.DAMAGE end function avatarFTP(tp,ftp1,ftp2,ftp3) if tp < 1000 then tp = 1000 end if tp >= 1000 and tp < 2000 then return ftp1 + (ftp2 - ftp1) / 100 * (tp - 1000) elseif tp >= 2000 and tp <= 3000 then -- generate a straight line between ftp2 and ftp3 and find point @ tp return ftp2 + (ftp3 - ftp2) / 100 * (tp - 2000) end return 1 -- no ftp mod end -- Checks if the summoner is in a Trial Size Avatar Mini Fight (used to restrict summoning while in bcnm) function avatarMiniFightCheck(caster) local result = 0 local bcnmid if caster:hasStatusEffect(tpz.effect.BATTLEFIELD) then bcnmid = caster:getStatusEffect(tpz.effect.BATTLEFIELD):getPower() if bcnmid == 418 or bcnmid == 609 or bcnmid == 450 or bcnmid == 482 or bcnmid == 545 or bcnmid == 578 then -- Mini Avatar Fights result = 40 -- Cannot use <spell> in this area. end end return result end
local fmt = string.format local md5 = ngx.md5 local _M = {} local EMPTY = {} local function keys(t) local res = {} for k, _ in pairs(t) do res[#res+1] = k end return res end -- Return a string with the format "key=value(:key=value)*" of the -- actual keys and values in args that are in vary_fields. -- -- The elements are sorted so we get consistent cache actual_keys no matter -- the order in which params came in the request local function generate_key_from(args, vary_fields) local cache_key = {} for _, field in pairs(vary_fields or {}) do local arg = args[field] if arg then if type(arg) == "table" then table.sort(arg) table.insert(cache_key, field .. "=" .. table.concat(arg, ",")) else table.insert(cache_key, field .. "=" .. arg) end end end return table.concat(cache_key, ":") end -- Return the component of cache_key for vary_query_params in params -- -- If no vary_query_params are configured in the plugin, return -- all of them. local function params_key(params, plugin_config) if not (plugin_config.vary_query_params or EMPTY)[1] then local actual_keys = keys(params) table.sort(actual_keys) return generate_key_from(params, actual_keys) end return generate_key_from(params, plugin_config.vary_query_params) end _M.params_key = params_key -- Return the component of cache_key for vary_headers in params -- -- If no vary_query_params are configured in the plugin, return -- the empty string. local function headers_key(headers, plugin_config) if not (plugin_config.vary_headers or EMPTY)[1] then return "" end return generate_key_from(headers, plugin_config.vary_headers) end _M.headers_key = headers_key local function prefix_uuid(consumer_id, api_id, route_id) -- authenticated api if consumer_id and api_id then return fmt("%s:%s", consumer_id, api_id) end -- authenticated route if consumer_id and route_id then return fmt("%s:%s", consumer_id, route_id) end -- unauthenticated api if api_id then return api_id end -- unauthenticated route if route_id then return route_id end -- global default return "default" end _M.prefix_uuid = prefix_uuid function _M.build_cache_key(consumer_id, api_id, route_id, method, uri, params_table, headers_table, conf) -- obtain cache key components local prefix_digest = prefix_uuid(consumer_id, api_id, route_id) local params_digest = params_key(params_table, conf) local headers_digest = headers_key(headers_table, conf) return md5(fmt("%s|%s|%s|%s|%s", prefix_digest, method, uri, params_digest, headers_digest)) end return _M
return { "000_base_rate_limiting", "001_14_to_15", "002_15_to_10", }
function IncludeDetouring() IncludePackage("detouring") local directory = _GARRYSMOD_COMMON_DIRECTORY .. "/include/detouring" local _project = project() local _workspace = _project.workspace local _project_directory = _GARRYSMOD_COMMON_DIRECTORY .. "/projects/" .. os.target() .. "/" .. _ACTION -- This first include directory is deprecated and might be removed in the future. sysincludedirs(directory) sysincludedirs(_GARRYSMOD_COMMON_DIRECTORY .. "/include") links("detouring") filter("system:macosx") links("CoreServices.framework") project("detouring") kind("StaticLib") language("C++") cppdialect("C++11") location(_project_directory) sysincludedirs(directory) files({ directory .. "/*.hpp", directory .. "/*.h", directory .. "/*.cpp", directory .. "/hde/include/*.h", directory .. "/hde/src/hde.c", directory .. "/minhook/include/*.h", directory .. "/minhook/src/*.h", directory .. "/minhook/src/*.c" }) vpaths({ ["Header files"] = { directory .. "/*.hpp", directory .. "/*.h" }, ["Header files/hde"] = directory .. "/hde/include/*.h", ["Header files/minhook"] = { directory .. "/minhook/include/*.h", directory .. "/minhook/src/*.h" }, ["Source files"] = directory .. "/*.cpp", ["Source files/hde"] = directory .. "/hde/src/hde.c", ["Source files/minhook"] = directory .. "/minhook/src/*.c" }) filter("files:**.c") language("C") filter("configurations:Release") objdir(_project_directory .. "/intermediate") targetdir(_project_directory .. "/release") if not _workspace.abi_compatible then filter("configurations:Debug") objdir(_project_directory .. "/intermediate") targetdir(_project_directory .. "/debug") end project(_project.name) end
require 'imgui.components.webview' local imguiInterface = require 'imgui.base' local lm = require 'lib.locales' local async = require 'lib.async' local projectManager = require 'editor.projectManager' local fs = require 'lib.filesystem' -- project creation wisard view ProjectWizard = class(ImguiWindow, function(self, textureID, title, open) ImguiWindow.init(self, title, false, open) local state = editor:getGlobalState() self.fileDialogState = state.fileDialogState or {} local dialogFolder = self.fileDialogState.folder or fs.path.homedir() local recent = projectManager:getRecentProjects(5) self.data = { wizard = core.settings.projectWizard, hasRecentProjects = #recent > 0, recent = recent } self.homepage = "client:/projectWizard/index.html.template" self.webview = WebView(textureID, self.homepage, self.data) self.textureID = textureID self.flags = ImGuiWindowFlags_NoTitleBar + ImGuiWindowFlags_NoResize + ImGuiWindowFlags_NoMove + ImGuiWindowFlags_NoScrollbar cef:addMessageHandler("resetWizard", function() self:goHome() end) cef:addMessageHandler("selectProjectIcon", function() local window = game:getWindowManager() local files = window:openDialog(Window.FILE_DIALOG_OPEN, "", dialogFolder, {"png", "jpg"}) end) cef:addMessageHandler("pickFolder", function() local window = game:getWindowManager() if dialogFolder[#dialogFolder] ~= "/" then dialogFolder = dialogFolder .. "/" end local files = window:openDialog(Window.FILE_DIALOG_OPEN_FOLDER, lm("wizard.create.project_folder"), dialogFolder, {}) if #files > 0 then self:updateProjectsFolder(files[1]) return files[1] end end) cef:addMessageHandler("createProject", function(settings) self.webview:openPage("client:/projectWizard/create.progress.html.template", {settings=settings}, function() projectManager:create(settings, function(progress) local jsCode = [[updateProgress(]] .. tostring(math.floor(progress.percent)) .. [[, 100,"]] .. (progress.msg or '') .. [[", "]] .. tostring(progress.color or "#FFFFFF") .. [[", ]] .. tostring(progress.fatalError or false) .. [[)]] self.webview:executeJavascript(jsCode) end, function(success) if success then local success, err = pcall(projectManager.open, projectManager, fs.path.join(settings.projectPath, settings.projectName)) self:updateProjectsFolder(settings.projectPath) if not success then log.error("Failed to open project " .. err) end end end) end) end) cef:addMessageHandler("browseProjects", function() projectManager:browseProjects() end) cef:addMessageHandler("openProject", function(path) projectManager:open(path) end) end) function ProjectWizard:updateProjectsFolder(folder) self.fileDialogState.folder = folder editor:putToGlobalState("fileDialogState", self.fileDialogState) editor:saveGlobalState() end function ProjectWizard:goHome() local recent = projectManager:getRecentProjects(5) self.data = { wizard = core.settings.projectWizard, hasRecentProjects = #recent > 0, recent = recent } self.webview:openPage(self.homepage, self.data) end -- render wisard function ProjectWizard:__call() if not self.open then return end local sx, sy = imgui.Scale() imgui.SetNextWindowPos(90 * sx, 35 * sy) local width, height = imgui.DisplaySize() imgui.SetNextWindowSize(width - 95 * sx, height - 40 * sy) imgui.PushStyleVar_2(ImGuiStyleVar_WindowPadding, 3.0 * sx, 3.0 * sy) local drawing = self:imguiBegin() imgui.PopStyleVar(ImGuiStyleVar_WindowPadding) self.webview.visible = drawing if not drawing then return end imguiInterface:captureMouse(not imgui.IsWindowHovered()) local w, h = imgui.GetContentRegionAvail() local x, y = imgui.GetCursorScreenPos() self.webview:render(w, h) self:imguiEnd() end -- start project creation flow function ProjectWizard:runCreationFlow(project) local pageData = {} local projectType = nil if type(project) == "string" then projectType = project local renderInfo = core:render().info or {} local version = "v1" if renderInfo.type == "ogre" and renderInfo.version >= 0x020100 then version = "v2" end local s, loaded = data:loadTemplate(fs.path.join("editor", "projectTemplates", projectType .. ".json"), {version = version}) if not loaded then error("No template found for project type " .. projectType) end local template = json.loads(s) local state = editor:getGlobalState() local fileDialogState = state.fileDialogState or {} local plugins = {} -- loading all plugins information local pluginFileData = require "editor.plugins" local info = pluginFileData.pluginsInfo local enabledPlugins = {} for _, name in ipairs(template.plugins) do enabledPlugins[name] = true end for key, value in pairs(info) do local available = game:getFullPluginPath(key) ~= "" plugins[#plugins + 1] = { name = key, description = lm("plugins.description." .. key), details = value, enabled = enabledPlugins[key] == true and available, available = available } end pageData.settings = { projectPath = fileDialogState.folder or fs.path.homedir(), projectName = projectType .. " project", projectType = projectType, resources = template.resources, plugins = plugins, systems = pluginFileData.coreSystems, selectedSystems = template.systems or {}, selectedManagers = template.managers or {} } elseif type(project) == "table" then pageData.settings = project projectType = project.projectType else error("Failed to run creation flow: incorrect parameter " .. tostring(project)) end pageData.projectTemplateName = lm("wizard.projects." .. projectType .. ".name") self.webview:openPage("client:/projectWizard/create.html.template", pageData) end -- activate webview when added to scene function ProjectWizard:added() self.webview:enable() end -- cleanup resources function ProjectWizard:destroy() self.webview:disable() end
LinkLuaModifier("modifier_item_scythe_of_the_ancients_passive", "items/item_scythe_of_the_ancients.lua", LUA_MODIFIER_MOTION_NONE) LinkLuaModifier("modifier_item_scythe_of_the_ancients_stun", "items/item_scythe_of_the_ancients.lua", LUA_MODIFIER_MOTION_NONE) item_scythe_of_the_ancients = class({ GetIntrinsicModifierName = function() return "modifier_item_scythe_of_the_ancients_passive" end, }) if IsServer() then function item_scythe_of_the_ancients:OnSpellStart() local caster = self:GetCaster() local target = self:GetCursorTarget() if not target:TriggerSpellAbsorb(self) then target:TriggerSpellReflect(self) local particle = ParticleManager:CreateParticle("particles/econ/events/ti4/dagon_beam_black_ti4.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster) ParticleManager:SetParticleControlEnt(particle, 1, target, PATTACH_POINT_FOLLOW, "attach_hitloc", target:GetAbsOrigin(), false) ParticleManager:SetParticleControl(particle, 1, Vector(800)) caster:EmitSound("DOTA_Item.Dagon.Activate") target:EmitSound("DOTA_Item.Dagon5.Target") caster:EmitSound("Hero_Necrolyte.ReapersScythe.Cast") target:EmitSound("Hero_Necrolyte.ReapersScythe.Target") ApplyDamage({ attacker = caster, victim = target, damage = self:GetSpecialValueFor("cast_damage") + (self:GetSpecialValueFor("cast_damage_pct") * target:GetHealth() * 0.01), damage_type = self:GetAbilityDamageType(), damage_flags = DOTA_DAMAGE_FLAG_NO_SPELL_AMPLIFICATION, ability = self }) target:AddNewModifier(caster, self, "modifier_item_scythe_of_the_ancients_stun", {duration = self:GetSpecialValueFor("stun_duration")}) end end end modifier_item_scythe_of_the_ancients_passive = class({ RemoveOnDeath = function() return false end, IsHidden = function() return true end, GetAttributes = function() return MODIFIER_ATTRIBUTE_MULTIPLE end, IsPurgable = function() return false end, }) function modifier_item_scythe_of_the_ancients_passive:DeclareFunctions() return { MODIFIER_EVENT_ON_TAKEDAMAGE, MODIFIER_PROPERTY_IS_SCEPTER, MODIFIER_PROPERTY_STATS_STRENGTH_BONUS, MODIFIER_PROPERTY_STATS_AGILITY_BONUS, MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, MODIFIER_PROPERTY_HEALTH_BONUS, MODIFIER_PROPERTY_MANA_BONUS, MODIFIER_PROPERTY_HEALTH_REGEN_CONSTANT, MODIFIER_PROPERTY_MANA_REGEN_CONSTANT, MODIFIER_PROPERTY_CAST_RANGE_BONUS, MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE, MODIFIER_PROPERTY_TOTALDAMAGEOUTGOING_PERCENTAGE } end function modifier_item_scythe_of_the_ancients_passive:GetModifierScepter() return 1 end function modifier_item_scythe_of_the_ancients_passive:GetModifierBonusStats_Strength() return self:GetAbility():GetSpecialValueFor("bonus_strength") end function modifier_item_scythe_of_the_ancients_passive:GetModifierBonusStats_Agility() return self:GetAbility():GetSpecialValueFor("bonus_agility") end function modifier_item_scythe_of_the_ancients_passive:GetModifierBonusStats_Intellect() return self:GetAbility():GetSpecialValueFor("bonus_intellect") end function modifier_item_scythe_of_the_ancients_passive:GetModifierSpellAmplify_Percentage() return self:GetAbility():GetSpecialValueFor("spell_amp_pct") end function modifier_item_scythe_of_the_ancients_passive:GetModifierConstantHealthRegen() return self:GetAbility():GetSpecialValueFor("bonus_health_regen") end function modifier_item_scythe_of_the_ancients_passive:GetModifierHealthBonus() return self:GetAbility():GetSpecialValueFor("bonus_health") end function modifier_item_scythe_of_the_ancients_passive:GetModifierManaBonus() return self:GetAbility():GetSpecialValueFor("bonus_mana") end function modifier_item_scythe_of_the_ancients_passive:GetModifierConstantManaRegen() return self:GetAbility():GetSpecialValueFor("bonus_mana_regen") end function modifier_item_scythe_of_the_ancients_passive:GetModifierCastRangeBonus() return self:GetAbility():GetSpecialValueFor("cast_range_bonus") end function modifier_item_scythe_of_the_ancients_passive:GetModifierTotalDamageOutgoing_Percentage() return self:GetAbility():GetSpecialValueFor("all_damage_bonus_pct") end if IsServer() then function modifier_item_scythe_of_the_ancients_passive:OnCreated() local parent = self:GetParent() for i = 0, parent:GetAbilityCount() - 1 do local ability = parent:GetAbilityByIndex(i) if ability and ability:GetKeyValue("IsGrantedByScepter") == 1 then if ability:GetKeyValue("ScepterGrantedLevel") ~= 0 then ability:SetLevel(1) end ability:SetHidden(false) end end end function modifier_item_scythe_of_the_ancients_passive:OnDestroy() local parent = self:GetParent() if not parent:HasScepter() then for i = 0, parent:GetAbilityCount() - 1 do local ability = parent:GetAbilityByIndex(i) if ability and ability:GetKeyValue("IsGrantedByScepter") == 1 then if ability:GetKeyValue("ScepterGrantedLevel") ~= 0 then ability:SetLevel(0) end ability:SetHidden(true) end end end end function modifier_item_scythe_of_the_ancients_passive:OnTakeDamage(keys) local parent = self:GetParent() local damage = keys.original_damage local ability = self:GetAbility() if keys.attacker == parent and not keys.unit:IsMagicImmune() and keys.damage_type == 2 and not (keys.inflictor and keys.inflictor:GetAbilityName() == "batrider_sticky_napalm") then ability.originalInflictor = keys.inflictor ApplyDamage({ attacker = parent, victim = keys.unit, damage = keys.original_damage * ability:GetSpecialValueFor("magic_damage_to_pure_pct") * 0.01, damage_type = ability:GetAbilityDamageType(), damage_flags = DOTA_DAMAGE_FLAG_NO_SPELL_AMPLIFICATION, ability = ability }) end end end modifier_item_scythe_of_the_ancients_stun = class({ IsHidden = function() return false end, IsPurgable = function() return false end, }) if IsServer() then function modifier_item_scythe_of_the_ancients_stun:OnCreated() local parent = self:GetParent() self.particle = ParticleManager:CreateParticle("particles/arena/items_fx/scythe_of_the_ancients_start.vpcf", PATTACH_ABSORIGIN_FOLLOW, parent) ParticleManager:SetParticleControlEnt(self.particle, 1, self:GetParent(), PATTACH_POINT_FOLLOW, "attach_hitloc", parent:GetAbsOrigin(), true) end function modifier_item_scythe_of_the_ancients_stun:OnDestroy() local ability = self:GetAbility() local caster = self:GetCaster() local target = self:GetParent() local team = caster:GetTeamNumber() ParticleManager:DestroyParticle(self.particle, false) local damage = (target:GetMaxHealth() - target:GetHealth()) * ability:GetSpecialValueFor("delayed_damage_per_health") ApplyDamage({ attacker = caster, victim = target, damage = damage, damage_type = ability:GetAbilityDamageType(), damage_flags = DOTA_DAMAGE_FLAG_NO_SPELL_AMPLIFICATION, ability = ability }) end end function modifier_item_scythe_of_the_ancients_stun:CheckState() return { [ MODIFIER_STATE_STUNNED ] = true, [ MODIFIER_STATE_PROVIDES_VISION ] = true, } end
return {[1]={stats={[1]="blood_offering_%_of_life_to_lose",[2]="blood_offering_%_of_lost_life_to_regenerate_as_life_per_second"},name="blood_offering_life_loss",lang={English={[1]={limit={[1]={[1]="#",[2]="#"},[2]={[1]="#",[2]="#"}},text="Sacrifices %1%%% of your Life\nMinions Regenerate %2%%% of Sacrificed Life per second"}}}},[2]={stats={[1]="blood_offering_life_regenerated_+%_final_per_corpse"},name="blood_offering_life_regen_multi",lang={English={[1]={limit={[1]={[1]=1,[2]="#"}},text="%1%%% more Life Regeneration granted to Minions per Corpse consumed"},[2]={limit={[1]={[1]="#",[2]=-1}},text="%1%%% less Life Regeneration granted to Minions per Corpse consumed"}}}},[3]={stats={[1]="attack_speed_+%_granted_from_skill"},name="attack_speed_incr_skill_granted",lang={English={[1]={limit={[1]={[1]=1,[2]="#"}},text="Grants Minions %1%%% increased Attack Speed"},[2]={[1]={k="negate",v=1},text="Grants Minions %1%%% reduced Attack Speed",limit={[1]={[1]="#",[2]=-1}}}}}},[4]={stats={[1]="damage_+%"},name="damage_incr",lang={English={[1]={limit={[1]={[1]=1,[2]="#"}},text="Grants Minions %1%%% increased Damage"},[2]={[1]={k="negate",v=1},text="Grants Minions %1%%% reduced Damage",limit={[1]={[1]="#",[2]=-1}}}}}},[5]={stats={[1]="cast_speed_+%_granted_from_skill"},name="cast_speed_incr_skill_granted",lang={English={[1]={limit={[1]={[1]=1,[2]="#"}},text="Grants Minions %1%%% increased Cast Speed"},[2]={[1]={k="negate",v=1},text="Grants Minions %1%%% reduced Cast Speed",limit={[1]={[1]="#",[2]=-1}}}}}},[6]={stats={[1]="base_movement_velocity_+%"},name="movement_speed_incr",lang={English={[1]={limit={[1]={[1]=1,[2]="#"}},text="Grants Minions %1%%% increased Movement Speed"},[2]={[1]={k="negate",v=1},text="Grants Minions %1%%% reduced Movement Speed",limit={[1]={[1]="#",[2]=-1}}}}}},[7]={stats={[1]="monster_base_block_%"},name="base_block",lang={English={[1]={limit={[1]={[1]="#",[2]="#"}},text="Grants Minions %1$+d%% Chance to Block Attack Damage"}}}},[8]={stats={[1]="base_spell_block_%"},name="base_spell_block",lang={English={[1]={limit={[1]={[1]="#",[2]="#"}},text="Grants Minions %1$+d%% Chance to Block Spell Damage"}}}},[9]={stats={[1]="recover_X_life_on_block"},name="recover_life_on_block",lang={English={[1]={limit={[1]={[1]="#",[2]="#"}},text="Minions recover %1% Life when they Block"}}}},[10]={stats={[1]="physical_damage_%_to_add_as_chaos"},name="physical_damage_to_add_as_chaos",lang={English={[1]={limit={[1]={[1]=1,[2]="#"}},text="Minions gain %1%%% of their Physical Damage as Extra Chaos Damage"}}}},[11]={stats={[1]="spirit_offering_life_%_added_as_base_maximum_energy_shield_per_corpse_consumed"},name="spirit_offering_life_as_es_per_corpse",lang={English={[1]={limit={[1]={[1]="#",[2]="#"}},text="Minions gain %1%%% of their Maximum Life as\nExtra Maximum Energy Shield for each corpse consumed"}}}},[12]={stats={[1]="base_resist_all_elements_%"},name="elemental_resist",lang={English={[1]={limit={[1]={[1]="#",[2]="#"}},text="Minions gain %1$+d%% to all Elemental Resistances"}}}},["recover_X_life_on_block"]=9,["cast_speed_+%_granted_from_skill"]=5,["blood_offering_life_regenerated_+%_final_per_corpse"]=2,["damage_+%"]=4,parent="skill_stat_descriptions",["base_movement_velocity_+%"]=6,["base_resist_all_elements_%"]=12,["monster_base_block_%"]=7,["blood_offering_%_of_lost_life_to_regenerate_as_life_per_second"]=1,["attack_speed_+%_granted_from_skill"]=3,["blood_offering_%_of_life_to_lose"]=1,["base_spell_block_%"]=8,["spirit_offering_life_%_added_as_base_maximum_energy_shield_per_corpse_consumed"]=11,["physical_damage_%_to_add_as_chaos"]=10}
require 'text_util' local class = require '30log' local json = require 'json' local Slide = require 'slide' -- local white_block = resource.load_image('white.png') local EventListSlide = Slide:extend("EventListSlide") local EventListItem = require 'event_list_item' function EventListSlide:init(x, y, width, height, data_filename) self.super:init() self.x, self.y = x, y self.items_start = 150 self.width, self.height = width, height self.items = {} self.pages = {} self:reset() util.file_watch(data_filename, function(content) local event_list = json.decode(content) self.font = resource.load_font(event_list.font) self.title = event_list.title self.events = event_list.events self.duration = event_list.duration self.items = {} self.pages = {} for i, event in ipairs(self.events) do self.items[i] = EventListItem(WIDTH, 90, event.name, event.start, event.location, self.font) end self.pages = self:group_items() self:reset() end) end function EventListSlide:group_items() local pages = {} local current_end = self.items_start local current_page = {} for i, item in ipairs(self.items) do if (current_end + item:get_height() < self.height) then table.insert(current_page, item) current_end = current_end + item:get_height() else table.insert(pages, current_page) current_page = {} table.insert(current_page, item) current_end = self.items_start + item:get_height() end end table.insert(pages, current_page) return pages end function EventListSlide:draw() self.super:tick() write_centered(self.title, 50, self.width / 2, 50, 1, 1, 1, 1) local page_num = math.floor(self.super.active_time / self.duration) + 1 -- Handle edge case where you can get one frame past the available pages page_num = math.min(page_num, #self.pages) local page_time = self.super.active_time - self.duration * (page_num - 1) local item_fade = 0.15 local page_clear_start_time = self.duration - #(self.pages[page_num]) * item_fade local clearing_page = (page_time > page_clear_start_time) local y = self.items_start for i, item in ipairs(self.pages[page_num]) do local offset = i - 1 local alpha if clearing_page then local clearing_time = page_time - page_clear_start_time alpha = 1 - (clearing_time / item_fade - offset) else alpha = page_time / item_fade - offset end alpha = math.min(math.max(alpha, 0), 1) item:draw(50, y, alpha) y = y + item:get_height() end end function EventListSlide:reset() self.super:reset() self.x = -self.width end function EventListSlide:is_done() return (self.super.active_time > self.duration * #self.pages) end return EventListSlide
local fan = require "fan" require "compat53" local scheme_map = {} scheme_map["tcp"] = require "fan.connector.tcp" scheme_map["udp"] = require "fan.connector.udp" scheme_map["fifo"] = require "fan.connector.fifo" local function extract_url(url) if not url then return end local _, _, scheme, twoslash, others = string.find(url, "^(%w+):([/]?[/]?)(.*)") local path, server, host, port if twoslash and #(twoslash) == 2 then _, _, server, path = string.find(others, "([^/]*)(.*)") if #(server) > 0 then _, _, host, port = string.find(server, "^([^:]+):(%d+)$") end else path = twoslash .. others end return scheme, host, port, path end local function connect(url, args) local scheme, host, port, path = extract_url(url) if not scheme then return end local connector = scheme_map[scheme:lower()] if not connector then return end return connector.connect(host, port, path, args) end local function bind(url, args) local scheme, host, port, path = extract_url(url) if not scheme then return end local connector = scheme_map[scheme:lower()] if not connector then return end return connector.bind(host, port, path, args) end local function tmpfifoname() local fifoname = os.tmpname() print(fifoname) os.remove(fifoname) return fifoname end return { connect = connect, bind = bind, tmpfifoname = tmpfifoname }
-- DON'T use local lfm = lfm here because it brakes sumneko. local config = lfm.config package.path = string.gsub(package.path, "./%?.lua;", "") package.path = package.path .. ";" .. config.luadir .. "/?.lua" package.path = package.path .. ";".. config.configdir .. "/lua/?.lua" local fm = lfm.fm local log = lfm.log local ui = lfm.ui local cmd = lfm.cmd local nop = function() end -- enhance logging functions for k, f in pairs(log) do log[k] = function(...) local t = {...} for i, e in pairs(t) do t[i] = tostring(e) end f(table.concat(t, " ")) end end function print(...) local t = {...} for i, e in pairs(t) do t[i] = tostring(e) end lfm.echo(table.concat(t, " ")) end ---@return table selection The currently selected files or the file at the current cursor position function lfm.sel_or_cur() local sel = fm.selection_get() return #sel > 0 and sel or {fm.current_file()} end ---Executes line. If the first whitespace delimited token is a registered ---command it is executed with the following text as arguments. Otherwise line ---is assumed to be lua code and is executed. Example: ---``` --- --- lfm.eval("cd /home") -- expression is not lua as "cd" is a registered command --- lfm.eval('print(2+2)') -- executed as lua code --- ---``` ---@param line string function lfm.eval(line) local cmd, args = lfm.fn.tokenize(line) if not cmd then return end local command = lfm.commands[cmd] if command then if command.tokenize then command.f(unpack(args)) else local arg = string.gsub(line, "^[^ ]*%s*", "") command.f(arg) end else log.debug("loadstring: " .. line) local bc, err = loadstring(line) if bc then bc() else lfm.error("loadstring: "..err) end end end -- Hooks local hooks = { LfmEnter = {}, ExitPre = {}, ChdirPre = {}, ChdirPost = {}, SelectionChanged = {}, Resized = {}, } ---Register a function to hook into events. Curruntly supported hooks are ---``` --- LfmEnter lfm has started and read all configuration --- ExitPre lfm is about to exit --- ChdirPre emitted before changing directories --- ChdirPost emitted after changin directories --- SelectionChanged the selection changed --- Resized the window was resized --- ---``` ---@param name string ---@param f function function lfm.register_hook(name, f) if hooks[name] then table.insert(hooks[name], f) end end ---Execute all functions registered to a hook. ---@param name string function lfm.run_hook(name) log.debug("running hook: " .. name) if hooks[name] then for _, f in pairs(hooks[name]) do f() end end end -- Commands lfm.commands = {} ---Register a function as a lfm command or unregister a command. Supported options ---``` --- tokenize: tokenize the argument by whitespace and pass them as a table (default: false) --- ---``` ---@param name string Command name, can not contain whitespace. ---@param f function The function to execute or `nil` to unregister ---@param t table Additional options. function lfm.register_command(name, f, t) if (f) then t = t or {} t.f = f t.tokenize = t.tokenize == nil and true or t.tokenize lfm.commands[name] = t else lfm.commands[name] = nil end end lfm.modes = {} local modes = lfm.modes ---Register a mode to lfm. A mode is given by a table t that should contain the following fields: ---``` --- t.prefix The prefix, a string, shown in the command line and used to distinguish modes. --- t.on_enter A function that is executed when pressing enter while the mode is active. --- t.on_esc A function that is executed when pressing esc while the mode is active. --- t.on_change A function that is executed when the command line changes, e.g. keys are typed/deleted. --- ---``` ---@param t table function lfm.register_mode(t) t = t or {} assert(t.prefix ~= nil, "no prefix given") modes[t.prefix] = t end -- Set up modules local compl = require("compl") lfm.compl = compl local shell = require("shell") lfm.shell = shell lfm.register_command("shell", function(arg) shell.bash(arg, {files=shell.ARRAY})() end, {tokenize=false, compl=compl.files}) lfm.register_command("shell-bg", function(arg) shell.bash(arg, {files=shell.ARRAY, fork=true})() end, {tokenize=false, compl=compl.files}) require("jumplist").setup() lfm.register_command("quit", lfm.quit) lfm.register_command("q", lfm.quit) lfm.register_command("rename", require("functions").rename, {tokenize=false, compl=compl.limit(1, compl.files)}) ---Function for <enter> in command mode. Clears the command line and calls `mode.enter`. local function cmdenter() local line = cmd.line_get() local prefix = cmd.prefix_get() cmd.clear() local mode = modes[prefix] -- TODO: allow line to be "" ? (on 2021-07-23) if line ~= "" and mode then local mode_enter = mode.on_enter if mode_enter then mode_enter(line) end end end ---Function for <esc> in command mode. Clears the command line and calls `mode.esc`. local function cmdesc() local mode = modes[cmd.prefix_get()] if mode then local on_esc = mode.on_esc if on_esc then on_esc() end end cmd.clear() end lfm.register_command("cd", fm.chdir, {tokenize=true, compl=compl.dirs}) local handle_key = lfm.handle_key ---Feed keys into the key handler. ---@vararg string keys function lfm.feedkeys(...) for _, seq in pairs({...}) do handle_key(seq) end end ---Fill command line with the previous history item. local function history_prev() if cmd.prefix_get() ~= ":" then return end local line = ui.history_prev() if line then cmd.line_set(line) end end ---Fill command line with the next history item. local function history_next() if cmd.prefix_get() ~= ":" then return end local line = ui.history_next() if line then cmd.line_set(line) end end -- Modes -- TODO: make functions to easily enter a mode (on 2021-07-23) local mode_filter = { prefix = "filter: ", on_enter = fm.filter, on_esc = function() fm.filter("") end, on_change = function() fm.filter(cmd.line_get()) end, } local mode_cmd = { prefix = ":", on_enter = function(line) ui.history_append(line) lfm.eval(line) end, on_esc = nop, on_change = compl.reset, } local mode_find = { prefix = "find: ", on_enter = function() lfm.find_clear() lfm.eval("open") end, on_esc = lfm.find_clear, on_change = function() if lfm.find(cmd.line_get()) then cmd.clear() lfm.timeout(250) lfm.commands.open.f() end end, } local mode_travel = { prefix = "travel: ", on_enter = nop, on_esc = nop, on_change = function() if lfm.find(cmd.line_get()) then lfm.timeout(250) cmd.line_set("") if lfm.commands.open.f() then cmd.clear() end end end, } local mode_delete = { prefix = "delete [y/N]: ", on_enter = lfm.cmd.clear, on_esc = lfm.cmd.clear, on_change = function() local line = lfm.cmd.line_get() lfm.cmd.clear() if line == "y" then lfm.spawn({"trash-put", "--", unpack(lfm.sel_or_cur())}) fm.selection_set() end end, } lfm.register_mode(require("search").mode_search) lfm.register_mode(require("search").mode_search_back) lfm.register_mode(mode_delete) lfm.register_mode(mode_cmd) lfm.register_mode(mode_filter) lfm.register_mode(mode_find) lfm.register_mode(mode_travel) -- Colors local palette = require("colors").palette require("colors").set({ broken = {fg = palette.red}, patterns = { { color = {fg = palette.magenta}, ext = { ".mp3", ".m4a", ".ogg", ".flac", ".mka", ".MP3", ".M4A", ".OGG", ".FLAC", ".MKA", ".mp4", ".mkv", ".m4v", ".webm", ".avi", ".flv", ".wmv", ".mov", ".mpg", ".mpeg", ".3gp", ".MP4", ".MKV", ".M4V", ".WEBM", ".AVI", ".FLV", ".WMV", ".MOV", ".MPG", ".MPEG", ".3GP", }, }, { color = {fg = palette.bright_red}, ext = { ".tar", ".zst", ".xz", ".gz", ".zip", ".rar", ".7z", ".bz2", ".TAR", ".ZST", ".XZ", ".GZ", ".ZIP", ".RAR", ".7Z", ".BZ2", }, }, { color = {fg = palette.yellow}, ext = { ".jpg", ".jpeg", ".png", ".bmp", ".webp", ".gif", ".JPG", ".JPEG", ".PNG", ".BMP", ".WEBP", ".GIF", }, }, } }) lfm.rifle = require("rifle") -- Opener: xdg-open. Registering a new "open" command overrides. lfm.register_command("open", function() local file = lfm.fm.open() if file then local files = lfm.fm.selection_get() if #files == 0 then files = {file} end lfm.execute({"xdg-open", unpack(files)}) end end) local function open() lfm.eval("open") end -- Keymaps local function wrap_mode_change(f) return function() f() local mode = modes[cmd.prefix_get()] if mode then local on_change = mode.on_change() if on_change then on_change() end end end end local cmap = lfm.cmap cmap("<Enter>", cmdenter, {desc="Enter"}) cmap("<Insert>", cmd.toggle_overwrite, {desc="Toggle insert/overwrite"}) cmap("<Esc>", cmdesc, {desc="Esc"}) cmap("<Left>", cmd.left, {desc="Left"}) cmap("<Right>", cmd.right, {desc="Right"}) cmap("<Up>", history_prev, {desc="previous history item"}) cmap("<Down>", history_next, {desc="next history item"}) cmap("<Home>", cmd.home, {desc="Home"}) cmap("<End>", cmd._end, {desc="End"}) cmap("<c-Left>", cmd.word_left, {desc="jump word left"}) cmap("<c-Right>", cmd.word_right, {desc="jump word right"}) cmap("<Delete>", wrap_mode_change(cmd.delete_right), {desc="delete right"}) cmap("<Backspace>", wrap_mode_change(cmd.delete), {desc="delete left"}) cmap("<c-h>", wrap_mode_change(cmd.delete), {desc="delete left"}) cmap("<c-w>", wrap_mode_change(cmd.delete_word), {desc="delete word left"}) cmap("<c-Backspace>", wrap_mode_change(cmd.delete_word), {desc="delete word left"}) cmap("<c-u>", wrap_mode_change(cmd.delete_line_left), {desc="delete line left"}) cmap("<Tab>", compl.next, {desc="next completion item"}) cmap("<s-Tab>", compl.prev, {desc="previous completion item"}) local c = require("util").c local a = require("util").a local map = lfm.map map("q", lfm.quit, {desc="quit"}) map("ZZ", lfm.quit, {desc="quit"}) -- maybe don't write selection/lastdir when exiting with ZQ/:q! map("ZQ", lfm.quit, {desc="quit"}) map("<c-q>", lfm.quit, {desc="quit"}) map("<c-c>", function() print("Type :q <Enter> or <Ctrl>q to exit") end, {desc="ctrl-c"}) map("<c-l>", ui.clear, {desc="clear screen and redraw"}) map("<a-r>", fm.drop_cache, {desc="drop direcory/preview caches"}) map("cd", a(lfm.feedkeys, ":cd "), {desc=":cd "}) map("<a-c>", fm.check, {desc="check directories and reload"}) map(":", a(cmd.prefix_set, ":"), {desc=":"}) map("&", a(lfm.feedkeys, ":shell-bg "), {desc=":shell-bg "}) map("s", a(lfm.feedkeys, ":shell "), {desc=":shell "}) map("S", a(lfm.execute, {"sh", "-c", "LFM_LEVEL=1 " .. os.getenv("SHELL")}), {desc="open shell"}) -- Visual/selection map("<Space>", c(fm.selection_toggle, fm.down), {desc="select current file"}) map("v", fm.selection_reverse, {desc="reverse selection"}) map("V", fm.visual_toggle, {desc="toggle visual selection mode"}) map("uv", c(fm.paste_buffer_set, fm.selection_set), {desc="selection-clear"}) -- Navigation map("<Enter>", open, "open") map("<Left>", fm.updir, {desc="go to parent directory"}) map("<Right>", open, {desc="open file/directory"}) map("j", fm.down, {desc="move cursor down"}) map("k", fm.up, {desc="move cursor up"}) map("h", fm.updir, {desc="go to parent directory"}) map("l", open, {desc="open file/directory"}) map("L", require("functions").follow_link) map("H", a(lfm.feedkeys, "''")) -- complementary to "L" map("gg", fm.top, {desc="go to top"}) map("G", fm.bottom, {desc="go to bottom"}) map("''", a(fm.mark_load, "'"), {desc="jump to previous directory"}) map("cd", a(lfm.feedkeys, ":cd "), {desc=":cd "}) map("<Up>", fm.up, {desc="move cursor up"}) map("<Down>", fm.down, {desc="move cursor down"}) map("<c-y>", fm.scroll_up, {desc="scroll directory up"}) map("<c-e>", fm.scroll_down, {desc="scroll directory down"}) map("<c-u>", function() fm.up(fm.get_height()/2) end, {desc="move cursor half a page up"}) map("<c-d>", function() fm.down(fm.get_height()/2) end, {desc="move cursor half a page down"}) map("<c-b>", function() fm.up(fm.get_height()) end, {desc="move cursor half a page up"}) map("<c-f>", function() fm.down(fm.get_height()) end, {desc="move cursor half a page down"}) map("<PageUp>", function() fm.up(fm.get_height()) end, {desc="move cursor half a page up"}) map("<PageDown>", function() fm.down(fm.get_height()) end, {desc="move cursor half a page down"}) map("<Home>", fm.top, {desc="go to top"}) map("<End>", fm.bottom, {desc="go to bottom"}) -- map("F", a(cmd.prefix_set, "travel: "), {desc="travel"}) map("zf", function() cmd.prefix_set(mode_filter.prefix) cmd.line_set(fm.getfilter()) end, {desc="filter:"}) map("zF", a(lfm.feedkeys, "zf<esc>"), {desc="remove current filter"}) map("zh", function() config.hidden = not config.hidden end, {desc="toggle hidden files"}) -- Flatten lfm.register_command("flatten", require("flatten").flatten, {tokenize=true}) map("<a-+>", require("flatten").flatten_inc, {desc="increase flatten level"}) map("<a-->", require("flatten").flatten_dec, {desc="decrease flatten level"}) -- Find/hinting map("f", a(cmd.prefix_set, mode_find.prefix), {desc="find:"}) -- These two only make sense in find: mode. Maybe think about actually providing -- a way to set keybinds for modes. cmap("<c-n>", lfm.find_next, {desc="go to next find match"}) cmap("<c-p>", lfm.find_prev, {desc="go to previous find match"}) -- Search map("/", require("search").enter_mode, {desc="search:"}) map("?", require("search").enter_mode_back, {desc="search: (backwards)"}) map("n", lfm.search_next, {desc="go to next search result"}) map("N", lfm.search_prev, {desc="go to previous search result"}) -- Copy/pasting map("yn", require("functions").yank_name, {desc="yank name"}) map("yp", require("functions").yank_path, {desc="yank path"}) map("yy", fm.copy, {desc="copy"}) map("dd", fm.cut, {desc="cut"}) map("ud", fm.paste_buffer_clear, {desc="load-clear"}) map("pp", require("functions").paste, {desc="paste-overwrite"}) map("pt", require("functions").paste_toggle, {desc="toggle paste mode"}) map("po", require("functions").paste_overwrite, {desc="paste-overwrite"}) map("pl", require("functions").symlink, {desc="symlink"}) map("pL", require("functions").symlink_relative, {desc="symlink-relative"}) map("df", a(lfm.cmd.prefix_set, mode_delete.prefix), {desc="trash-put"}) map("dD", a(lfm.cmd.prefix_set, mode_delete.prefix), {desc="delete"}) -- Renaming map("cW", a(lfm.feedkeys, ":rename "), {desc="rename"}) map("cc", a(lfm.feedkeys, ":rename "), {desc="rename"}) map("cw", require("functions").rename_until_ext, {desc="rename-until-ext"}) map("a", require("functions").rename_before_ext, {desc="rename-before-ext"}) map("A", require("functions").rename_after, {desc="rename-after"}) map("I", require("functions").rename_before, {desc="rename-before"}) map("on", a(fm.sortby, "natural", "noreverse"), {desc="sort: natural, noreverse"}) map("oN", a(fm.sortby, "natural", "reverse"), {desc="sort: natural, reverse"}) map("os", a(fm.sortby, "size", "reverse"), {desc="sort: size, noreverse"}) map("oS", a(fm.sortby, "size", "noreverse"), {desc="sort: size, reverse"}) map("oc", a(fm.sortby, "ctime", "noreverse"), {desc="sort: ctime, noreverse"}) map("oC", a(fm.sortby, "ctime", "reverse"), {desc="sort: ctime, reverse"}) map("od", a(fm.sortby, "dirfirst"), {desc="sort: dirfirst"}) map("oD", a(fm.sortby, "nodirfirst"), {desc="sort: nodirfirst"}) map("or", a(fm.sortby, "random"), {desc="sort: random"}) lfm.register_mode(require("glob").mode_glob_select) map("*", a(lfm.cmd.prefix_set, require("glob").mode_glob_select.prefix), {desc="glob-select"}) lfm.register_command("glob-select", require("glob").glob_select, {tokenize=false}) lfm.register_command("glob-select-rec", require("glob").glob_select_recursive, {tokenize=false}) lfm.register_command("mark-save", require("quickmarks").mark_save) lfm.register_mode(require("quickmarks").mode_mark_save) lfm.map("m", a(lfm.cmd.prefix_set, require("quickmarks").mode_mark_save.prefix), {desc="save quickmark"}) local function gmap(key, location) map("g"..key, function() fm.chdir(location) end, {desc="cd "..location}) end gmap("/", "/") gmap("e", "/etc") gmap("h", os.getenv("HOME")) gmap("m", "/mnt") gmap("n", "~/Downloads") gmap("o", "/opt") gmap("p", "/tmp") gmap("r", "/") gmap("s", "/srv") gmap("u", "/usr") local cfg = loadfile(config.configpath) if cfg then cfg() end
-- Copyright 2010 by Renée Ahrens, Olof Frahm, Jens Kluttig, Matthias Schulz, Stephan Schuster -- Copyright 2011 by Jannis Pohlmann -- Copyright 2012 by Till Tantau -- -- This file may be distributed an/or modified -- -- 1. under the LaTeX Project Public License and/or -- 2. under the GNU Public License -- -- See the file doc/generic/pgf/licenses/LICENSE for more information -- @release $Header: /cvsroot/pgf/pgf/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Graph.lua,v 1.1 2012/11/27 17:24:25 tantau Exp $ --- The Graph class -- -- local Graph = {} Graph.__index = Graph -- Namespace -- Imports local Edge = require "pgf.gd.deprecated.Edge" local lib = require "pgf.gd.lib" --- Creates a new graph. -- -- @param values Values to override default graph settings. -- The following parameters can be set:\par -- |nodes|: The nodes of the graph.\par -- |edges|: The edges of the graph.\par -- |clusters|: The node clusters of the graph.\par -- |options|: A table of node options passed over from \tikzname. -- |events|: A sequence of events signaled during the graph specification. -- -- @return A newly-allocated graph. -- function Graph.new(values) local defaults = { nodes = {}, edges = {}, clusters = {}, options = {}, events = {}, } setmetatable(defaults, Graph) if values then for k,v in pairs(values) do defaults[k] = v end end return defaults end --- Prepares a graph for an algorithm. -- -- This method causes self, all its nodes, and all its edges to get -- a new empty table for the key algorithm. This allows an algorithm to -- store stuff with nodes and edges without them interfering with information -- stored by other algorithms. -- -- @param An algorithm object. function Graph:registerAlgorithm(algorithm) self[algorithm] = self[algorithm] or {} -- Add an algorithm field to all nodes, all edges, and the graph: for _,n in pairs(self.nodes) do n[algorithm] = n[algorithm] or {} end for _,e in pairs(self.edges) do e[algorithm] = e[algorithm] or {} end end --- Sets the graph option \meta{name} to \meta{value}. -- -- @param name Name of the option to be changed. -- @param value New value for the graph option \meta{name}. -- function Graph:setOption(name, value) self.options[name] = value end --- Returns the value of the graph option \meta{name}. -- -- @param name Name of the option. -- -- @return The value of the graph option \meta{name} or |nil|. -- function Graph:getOption(name) return self.options[name] end --- Creates a shallow copy of a graph. -- -- The nodes and edges of the original graph are not preserved in the copy. -- -- @return A shallow copy of the graph. -- function Graph:copy () return Graph.new({options = self.options, events = self.events}) end --- Adds a node to the graph. -- -- @param node The node to be added. -- function Graph:addNode(node) -- only add the node if it's not included in the graph yet if not self:findNode(node.name) then -- Does the node have an index, yet? if not node.index then node.index = #self.nodes + 1 end table.insert(self.nodes, node) end end --- If possible, removes a node from the graph and returns it. -- -- @param node The node to remove. -- -- @return The removed node or |nil| if it was not found in the graph. -- function Graph:removeNode(node) local _, index = lib.find(self.nodes, function (other) return other.name == node.name end) if index then table.remove(self.nodes, index) return node else return nil end end --- If possible, looks up the node with the given name in the graph. -- -- @param name Name of the node to look up. -- -- @return The node with the given name or |nil| if it was not found in the graph. -- function Graph:findNode(name) return self:findNodeIf(function (node) return node.name == name end) end --- Looks up the first node for which the function \meta{test} returns |true|. -- -- @param test A function that takes one parameter (a |Node|) and returns -- |true| or |false|. -- -- @return The first node for which \meta{test} returns |true|. -- function Graph:findNodeIf(test) return lib.find(self.nodes, test) end --- Like removeNode, but also deletes all adjacent edges of the removed node. -- -- This function also removes the deleted adjacent edges from all neighbours -- of the removed node. -- -- @param node The node to be deleted together with its adjacent edges. -- -- @return The removed node or |nil| if the node was not found in the graph. -- function Graph:deleteNode(node) local node = self:removeNode(node) if node then for _,edge in ipairs(node.edges) do self:removeEdge(edge) for _,other_node in ipairs(edge.nodes) do if other_node.name ~= node.name then other_node:removeEdge(edge) end end end node.edges = {} end return node end -- Checks whether the edge already exists in the graph and returns it if possible. -- -- @param edge Edge to search for. -- -- @return The edge if it was found in the graph, |nil| otherwise. -- function Graph:findEdge(edge) return lib.find(self.edges, function (other) return other == edge end) end --- Adds an edge to the graph. -- -- @param edge The edge to be added. -- function Graph:addEdge(edge) if not edge.index then edge.index = #self.edges + 1 end table.insert(self.edges, edge) end --- If possible, removes an edge from the graph and returns it. -- -- @param edge The edge to be removed. -- -- @return The removed edge or |nil| if it was not found in the graph. -- function Graph:removeEdge(edge) local _, index = lib.find(self.edges, function (other) return other == edge end) if index then table.remove(self.edges, index) return edge else return nil end end --- Like removeEdge, but also removes the edge from its adjacent nodes. -- -- @param edge The edge to be deleted. -- -- @return The removed edge or |nil| if it was not found in the graph. -- function Graph:deleteEdge(edge) local edge = self:removeEdge(edge) if edge then for _,node in ipairs(edge.nodes) do node:removeEdge(edge) end end return edge end --- Removes an edge between two nodes and also removes it from these nodes. -- -- @param from Start node of the edge. -- @param to End node of the edge. -- -- @return The deleted edge. -- function Graph:deleteEdgeBetweenNodes(from, to) -- try to find the edge local edge = lib.find(self.edges, function (edge) return edge.nodes[1] == from and edge.nodes[2] == to end) -- delete and return the edge if edge then return self:deleteEdge(edge) else return nil end end --- Creates and adds a new edge to the graph. -- -- @param first_node The first node of the new edge. -- @param second_node The second node of the new edge. -- @param direction The direction of the new edge. Possible values are -- \begin{itemize} -- \item |Edge.UNDIRECTED|, -- \item |Edge.LEFT|, -- \item |Edge.RIGHT|, -- \item |Edge.BOTH| and -- \item |Edge.NONE| (for invisible edges). -- \end{itemize} -- @param edge_nodes A string of \tikzname\ edge nodes that needs to be passed -- back to the \TeX layer unmodified. -- @param options The options of the new edge. -- @param tikz_options A table of \tikzname\ options to be used by graph drawing -- algorithms to treat the edge in special ways. -- -- @return The newly created edge. -- function Graph:createEdge(first_node, second_node, direction, edge_nodes, options, tikz_options) local edge = Edge.new{ direction = direction, edge_nodes = edge_nodes, options = options, tikz_options = tikz_options } edge:addNode(first_node) edge:addNode(second_node) self:addEdge(edge) return edge end --- Returns the cluster with the given name or |nil| if no such cluster exists. -- -- @param name Name of the node cluster to look up. -- -- @return The cluster with the given name or |nil| if no such cluster is defined. -- function Graph:findClusterByName(name) return lib.find(self.clusters, function (cluster) return cluster.name == name end) end --- Tries to add a cluster to the graph. Returns whether or not this was successful. -- -- Clusters are supposed to have unique names. This function will add the given -- cluster only if there is no cluster with this name already. It returns |true| -- if the cluster was added and |false| otherwise. -- -- @param cluster Cluster to add to the graph. -- -- @return |true| if the cluster was added successfully, |false| otherwise. -- function Graph:addCluster(cluster) if not self:findClusterByName(cluster.name) then table.insert(self.clusters, cluster) end end --- Returns a string representation of this graph including all nodes and edges. -- -- @ignore This should not appear in the documentation. -- -- @return Graph as string. -- function Graph:__tostring() local tmp = Graph.__tostring Graph.__tostring = nil local result = "Graph<" .. tostring(self) .. ">((" Graph.__tostring = tmp local first = true for _,node in ipairs(self.nodes) do if first then first = false else result = result .. ", " end result = result .. tostring(node) end result = result .. "), (" first = true for _,edge in ipairs(self.edges) do if first then first = false else result = result .. ", " end result = result .. tostring(edge) end return result .. "))" end -- Done return Graph
-- Visions2D -- Dependencies: SDL2, SDL2 TTF, GLEW (TODO: dynamically link? I don't know!) -- Header Only dependencies: spdlog, dearimgui, stbimage, glm, rapidjsson workspace "visions2D" architecture "x64" configurations { "Debug" } startproject "sandbox" outputdir = "%{cfg.buildcfg}-%{cfg.system}.%{cfg.architecture}" include "v2d_standalone.lua" include "premake_sandbox.lua" group "tools" include "premake_lucidrenderer.lua" include "resources_manager.lua" include "cli_projectcreator.lua"
--[[ This software is in the public domain. Where that dedication is not recognized, you are granted a perpetual, irrevokable license to copy and modify this file as you see fit. ]] -- Opens the game's save directory (or a subfolder wthin it) in the system's -- file browser. Written for LÖVE 0.9.0+. -- LÖVE 0.9.1 includes love.system.openURL which can accomplish this as well. function OpenSaveFolder(subfolder) subfolder = subfolder or "" -- If we have LÖVE 0.9.1+, we use love.system.openURL. It works better. if love.system and love.system.openURL then local url = "file://"..love.filesystem.getSaveDirectory().."/"..subfolder return love.system.openURL(url) end local osname = love.system.getOS() local path = love.filesystem.getSaveDirectory().."/"..subfolder local cmdstr if osname == "Windows" then cmdstr = "Explorer %s" subfolder = subfolder:gsub("/", "\\") --hardcoded to fix ISO characters in usernames and made sure release mode doesn't mess anything up -saso if love.filesystem.isFused() then path = "%appdata%\\" else path = "%appdata%\\LOVE\\" end path = path..love.filesystem.getIdentity().."\\"..subfolder elseif osname == "OS X" then cmdstr = "open -R \"%s\"" elseif osname == "Linux" then cmdstr = "xdg-open \"%s\"" end if cmdstr then os.execute(cmdstr:format(path)) end end
--ServerSync Resource made by Wyste for Fivem-- --Repository: https://github.com/Wyste/ServerSync -- name 'ServerSync' description 'Syncronizes Time/Weather/Wind and more.' author 'Wyste (https://github.com/Wyste) | (https://discordapp.com/invite/byNc6wA)' version 'v1.0' url 'https://github.com/Wyste/ServerSync' resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' client_scripts { 'ss_shared_functions.lua', 'config/Keybinds.lua', 'config/ServerSync.lua', 'ss_cli_indicators.lua', 'ss_cli_windows.lua', 'ss_cli_traffic_crowd.lua', 'ss_cli_weather.lua', 'ss_cli_time.lua' } server_scripts { 'ss_shared_functions.lua', 'config/ServerSync.lua', 'ss_srv_indicators.lua', 'ss_srv_windows.lua', 'ss_srv_weather.lua', 'ss_srv_time.lua' }
local _2afile_2a = "fnl/conjure/config.fnl" local _1_ do local name_4_auto = "conjure.config" local module_5_auto do local x_6_auto = _G.package.loaded[name_4_auto] if ("table" == type(x_6_auto)) then module_5_auto = x_6_auto else module_5_auto = {} end end module_5_auto["aniseed/module"] = name_4_auto module_5_auto["aniseed/locals"] = ((module_5_auto)["aniseed/locals"] or {}) do end (module_5_auto)["aniseed/local-fns"] = ((module_5_auto)["aniseed/local-fns"] or {}) do end (_G.package.loaded)[name_4_auto] = module_5_auto _1_ = module_5_auto end local autoload local function _3_(...) return (require("conjure.aniseed.autoload")).autoload(...) end autoload = _3_ local function _6_(...) local ok_3f_21_auto, val_22_auto = nil, nil local function _5_() return {autoload("conjure.aniseed.core"), autoload("conjure.aniseed.nvim"), autoload("conjure.aniseed.string")} end ok_3f_21_auto, val_22_auto = pcall(_5_) if ok_3f_21_auto then _1_["aniseed/local-fns"] = {autoload = {a = "conjure.aniseed.core", nvim = "conjure.aniseed.nvim", str = "conjure.aniseed.string"}} return val_22_auto else return print(val_22_auto) end end local _local_4_ = _6_(...) local a = _local_4_[1] local nvim = _local_4_[2] local str = _local_4_[3] local _2amodule_2a = _1_ local _2amodule_name_2a = "conjure.config" do local _ = ({nil, _1_, nil, {{}, nil, nil, nil}})[2] end local ks__3evar do local v_23_auto local function ks__3evar0(ks) return ("conjure#" .. str.join("#", ks)) end v_23_auto = ks__3evar0 local t_24_auto = (_1_)["aniseed/locals"] t_24_auto["ks->var"] = v_23_auto ks__3evar = v_23_auto end local get_in do local v_23_auto do local v_25_auto local function get_in0(ks) local v = a.get(nvim.g, ks__3evar(ks)) if (a["table?"](v) and a.get(v, vim.type_idx) and a.get(v, vim.val_idx)) then return a.get(v, vim.val_idx) else return v end end v_25_auto = get_in0 _1_["get-in"] = v_25_auto v_23_auto = v_25_auto end local t_24_auto = (_1_)["aniseed/locals"] t_24_auto["get-in"] = v_23_auto get_in = v_23_auto end local filetypes do local v_23_auto do local v_25_auto local function filetypes0() return get_in({"filetypes"}) end v_25_auto = filetypes0 _1_["filetypes"] = v_25_auto v_23_auto = v_25_auto end local t_24_auto = (_1_)["aniseed/locals"] t_24_auto["filetypes"] = v_23_auto filetypes = v_23_auto end local get_in_fn do local v_23_auto do local v_25_auto local function get_in_fn0(prefix_ks) local function _9_(ks) return get_in(a.concat(prefix_ks, ks)) end return _9_ end v_25_auto = get_in_fn0 _1_["get-in-fn"] = v_25_auto v_23_auto = v_25_auto end local t_24_auto = (_1_)["aniseed/locals"] t_24_auto["get-in-fn"] = v_23_auto get_in_fn = v_23_auto end local assoc_in do local v_23_auto do local v_25_auto local function assoc_in0(ks, v) a.assoc(nvim.g, ks__3evar(ks), v) return v end v_25_auto = assoc_in0 _1_["assoc-in"] = v_25_auto v_23_auto = v_25_auto end local t_24_auto = (_1_)["aniseed/locals"] t_24_auto["assoc-in"] = v_23_auto assoc_in = v_23_auto end local merge do local v_23_auto do local v_25_auto local function merge0(tbl, opts, ks) local ks0 = (ks or {}) local opts0 = (opts or {}) local function _12_(_10_) local _arg_11_ = _10_ local k = _arg_11_[1] local v = _arg_11_[2] local ks1 = a.concat(ks0, {k}) local current = get_in(ks1) if (a["table?"](v) and not a.get(v, 1)) then return merge0(v, opts0, ks1) else if (a["nil?"](current) or opts0["overwrite?"]) then return assoc_in(ks1, v) end end end a["run!"](_12_, a["kv-pairs"](tbl)) return nil end v_25_auto = merge0 _1_["merge"] = v_25_auto v_23_auto = v_25_auto end local t_24_auto = (_1_)["aniseed/locals"] t_24_auto["merge"] = v_23_auto merge = v_23_auto end return merge({completion = {fallback = "syntaxcomplete#Complete", omnifunc = "ConjureOmnifunc"}, debug = false, eval = {comment_prefix = nil, gsubs = {}, inline_results = true, result_register = "c"}, extract = {context_header_lines = 24, form_pairs = {{"(", ")"}, {"{", "}"}, {"[", "]", true}}, tree_sitter = {enabled = false}}, filetype = {clojure = "conjure.client.clojure.nrepl", fennel = "conjure.client.fennel.aniseed", hy = "conjure.client.hy.stdio", janet = "conjure.client.janet.netrepl", racket = "conjure.client.racket.stdio", scheme = "conjure.client.scheme.stdio"}, filetype_suffixes = {racket = {"rkt"}, scheme = {"scm"}}, filetypes = {"clojure", "fennel", "janet", "hy", "racket", "scheme"}, highlight = {enabled = false, group = "IncSearch", timeout = 500}, log = {botright = false, break_length = 80, fold = {enabled = false, lines = 10, marker = {["end"] = "}%~~~", start = "~~~%{"}}, hud = {anchor = "NE", border = "single", enabled = true, height = 0.3, overlap_padding = 0.1, passive_close_delay = 0, width = 0.42}, strip_ansi_escape_sequences_line_limit = 1000, trim = {at = 10000, to = 6000}, wrap = false}, mapping = {def_word = "gd", doc_word = {"K"}, eval_buf = "eb", eval_comment_current_form = "ece", eval_comment_root_form = "ecr", eval_comment_word = "ecw", eval_current_form = "ee", eval_file = "ef", eval_marked_form = "em", eval_motion = "E", eval_replace_form = "e!", eval_root_form = "er", eval_visual = "E", eval_word = "ew", log_close_visible = "lq", log_reset_hard = "lR", log_reset_soft = "lr", log_split = "ls", log_tab = "lt", log_vsplit = "lv", prefix = "<localleader>"}, path_subs = nil, preview = {sample_limit = 0.3}, relative_file_root = nil})
--海竜神-リバイアサン -- --Script by Trishula9 function c100426017.initial_effect(c) aux.AddCodeList(c,22702055) --to hand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,100426017) e1:SetTarget(c100426017.thtg) e1:SetOperation(c100426017.thop) c:RegisterEffect(e1) --adjust local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetCode(EVENT_ADJUST) e2:SetRange(LOCATION_MZONE) e2:SetCondition(c100426017.condition) e2:SetOperation(c100426017.adjustop) c:RegisterEffect(e2) --cannot summon,spsummon,flipsummon local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCondition(c100426017.condition) e3:SetTargetRange(1,1) e3:SetTarget(c100426017.sumlimit) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_CANNOT_SUMMON) c:RegisterEffect(e4) local e5=e3:Clone() e5:SetCode(EFFECT_CANNOT_FLIP_SUMMON) c:RegisterEffect(e5) end c100426017[0]=0 c100426017[1]=0 function c100426017.thfilter(c) return (c:IsCode(22702055) or c:IsSetCard(0x275,0x276) and c:IsType(TYPE_SPELL+TYPE_TRAP)) and c:IsAbleToHand() end function c100426017.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c100426017.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c100426017.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c100426017.thfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function c100426017.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsEnvironment(22702055) end function c100426017.sumlimit(e,c,sump,sumtype,sumpos,targetp) if sumpos and bit.band(sumpos,POS_FACEDOWN)>0 then return false end return not c:IsAttribute(ATTRIBUTE_WATER) and c100426017[targetp or sump]==1 end function c100426017.wtfilter(c) return not c:IsAttribute(ATTRIBUTE_WATER) and c:IsFaceup() end function c100426017.rmfilter(c,at) return c:GetAttribute()==at end function c100426017.tgselect(sg,g) return #(g-sg)==1 and not sg:IsExists(c100426017.rmfilter,1,nil,ATTRIBUTE_WATER) end function c100426017.adjustop(e,tp,eg,ep,ev,re,r,rp) local phase=Duel.GetCurrentPhase() if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL then return end local g1=Duel.GetMatchingGroup(c100426017.wtfilter,tp,LOCATION_MZONE,0,nil) local g2=Duel.GetMatchingGroup(c100426017.wtfilter,tp,0,LOCATION_MZONE,nil) local c=e:GetHandler() if g1:GetCount()==0 then c100426017[tp]=0 else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sg=g1:SelectSubGroup(tp,c100426017.tgselect,false,#g1-1,#g1-1,g1) if sg then g1:Sub(g1-sg) else g1:Sub(g1) end c100426017[tp]=1 end if g2:GetCount()==0 then c100426017[1-tp]=0 else Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE) local sg=g2:SelectSubGroup(1-tp,c100426017.tgselect,false,#g2-1,#g2-1,g2) if sg then g2:Sub(g2-sg) else g2:Sub(g2) end c100426017[1-tp]=1 end g1:Merge(g2) if g1:GetCount()>0 then Duel.SendtoGrave(g1,REASON_RULE) Duel.Readjust() end end
ENTITY.IsNetworked = false ENTITY.Properties = { { Name = "size", Type = PropertyType.FloatSize }, { Name = "target", Type = PropertyType.Entity }, } function ENTITY:Initialize() local size = self:GetProperty("size") local colliderSize = size / 2 self:SetCollider(Rect(-colliderSize, colliderSize), true) self:EnableCollisionCallbacks(true) if (EDITOR) then self:AddSprite({ Color = { r = 0, g = 0, b = 0, a = 180 }, RenderOrder = 2000, Size = self:GetProperty("size"), }) end end function ENTITY:OnCollisionStart(other) local targetEntity = self:GetProperty("target") if (targetEntity == NoEntity) then return false end local targetLayer = targetEntity:GetLayerIndex() local targetPosition = targetEntity:GetPosition() if (other.Name == "burger") then local playerOwner = other:GetOwner() other:SetPosition(targetPosition) playerOwner:MoveToLayer(targetLayer) end return false end
vars.cflags = { "$(CFLAGS)" } vars.ackcflags = { "-O6" } vars.ackldflags = {} vars.plats = { "cpm", "linux386", "linux68k", "linuxppc", "linuxmips", "msdos86", "osx386", "osxppc", "pc86", "rpi", "pdpv7", "em22", } vars.plats_with_tests = { "cpm", "linux68k", "linux386", "linuxppc", "linuxmips", "pc86", } installable { name = "ack-common", map = { "lang/basic/src+pkg", "lang/cem/cemcom.ansi+pkg", "lang/m2/comp+pkg", "lang/pc/comp+pkg", "lang/b/compiler+pkg", "util/ack+pkg", "util/amisc+pkg", "util/arch+pkg", "util/ass+pkg", "util/ego+pkg", "util/int+pkg", "util/led+pkg", "util/misc+pkg", "util/opt+pkg", }, } local plat_packages = {} local test_packages = {} for _, p in ipairs(vars.plats) do local pkg = "plat/"..p.."+pkg" plat_packages[#plat_packages+1] = pkg installable { name = "ack-"..p, map = { "+ack-common", pkg, }, } end for _, p in ipairs(vars.plats_with_tests) do test_packages[#test_packages+1] = "plat/"..p.."/tests+tests" end installable { name = "ack", map = { "+ack-common", "examples+pkg", plat_packages }, } normalrule { name = "tests", ins = { "first/testsummary.sh", test_packages }, outleaves = { "stamp" }, commands = { "%{ins}" } }
require("map") require("guard") require("target") require("abilities") ROT = require("rotLove/rotLove/rotLove") Camera = require "hump.camera" debug = false random = love.math.newRandomGenerator() function love.load(arg) title_font = love.graphics.newFont("assets/kenpixel.ttf", 70) main_font = love.graphics.newFont("assets/kenpixel.ttf", 20) gamestate = 'menu' real_time_since_item_get = 5 ability_just_found = 'none' player_image = love.graphics.newImage("assets/player.png") guard_image = love.graphics.newImage("assets/guard.png") guard_alert_image = love.graphics.newImage("assets/guard_alert.png") guard_dead_image = love.graphics.newImage("assets/guard_dead.png") bullet_image = love.graphics.newImage("assets/bullet.png") target_image = love.graphics.newImage("assets/target.png") target_dead_image = love.graphics.newImage("assets/target_dead.png") item_image = love.graphics.newImage("assets/item.png") end function distance(x1, y1, x2, y2) return math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2)) end Player = { x = 100, y = 100, height = 32, width = 32, xmove = 0, ymove = 0, speed = 200, abilities = {}, abilities_by_name = {}, } function Player:new(o) o = o or {} setmetatable(o, self) self.__index = self -- don't want to modify the tables of the class itself! self.abilities = {} self.abilities_by_name = {} return o end function Player:get_center() return self.x + self.width / 2, self.y + self.height / 2 end function Player:check_collision() local x, y = self:get_center() x, y = pixel_to_map_coords(x, y) return map.grid[x][y] == tiles.wall end function Player:has_ability(name) return self.abilities_by_name[name] end function Player:has_active_ability(name) return self:has_ability(name) and self.abilities_by_name[name].active end function start_level(num) level = num if num == 1 then player = Player:new() end guards = {} bullets = {} items = {} generate_map(num) player.x = map.spawn[1] * tile_w player.y = map.spawn[2] * tile_h camera = Camera(player.x, player.y) camera:zoomTo(get_scale()) spawn_guards() spawn_target() spawn_items() gamestate = 'playing' end function point_in_player(x, y) -- whether we are inside the player's enclosing rectangle return player.x < x and x < player.x + player.width and player.y < y and y < player.y + player.height end function path_callback(x, y) return map.grid[x][y] ~= tiles.wall end function get_path(from_x, from_y, to_x, to_y) path = {} astar = ROT.Path.AStar(to_x, to_y, path_callback, {topology=4}) function callback(x, y) table.insert(path, {x = x, y = y}) end astar:compute(from_x, from_y, callback) return path end function love.update(dt) action = handle_player_keys(dt) if gamestate == 'playing' then update_camera(dt) real_time_since_item_get = real_time_since_item_get + dt if action then update_items(dt) update_target(dt) update_guards(dt) update_bullets(dt) update_abilities(dt) if target.dead then local x, y = player:get_center() x, y = pixel_to_map_coords(x, y) local sx, sy = map.spawn[1], map.spawn[2] if x == sx and y == sy then -- player wins level if level < 5 then gamestate = 'win' else gamestate = 'victory' end end end end end end function update_guards(dt) -- iterate back-to-front to avoid skipping for i = #guards, 1, -1 do local guard = guards[i] if not guard.dead then local x, y = guard:get_center() local px, py = player:get_center() if distance(x, y, px, py) < (player.width + guard.width) / 2 then guard.dead = true elseif not player:has_active_ability('freeze time') then guard:update(dt) end else -- guard is dead! alert any guards who see him for j, guard2 in ipairs(guards) do local x, y = guard:get_center() if guard2:is_in_fov(x, y) then guard2.alert = true end end end end end function update_abilities(dt) for i, ability in ipairs(player.abilities) do if ability.active then ability.charge = ability.charge - dt * 100 if ability.charge <= 0 then ability.charge = 0 ability.active = false end elseif ability.charge < ability.max_charge then ability.charge = ability.charge + dt * 10 if ability.charge > ability.max_charge then ability.charge = ability.max_charge end end end end function update_bullets(dt) -- iterate back-to-front to avoid skipping for i = #bullets, 1, -1 do local bullet = bullets[i] if not player:has_active_ability('freeze time') then bullet:update(dt) end if not debug and point_in_player(bullet.x, bullet.y) then gamestate = 'gameover' elseif bullet:collides_with_wall() then table.remove(bullets, i) end end end function update_target(dt) local x, y = target:get_center() local px, py = player:get_center() if distance(x, y, px, py) < (target.width + player.width) / 2 then target.dead = true end end function update_items(dt) for i, item in ipairs(items) do local x, y = item.x + item.width / 2, item.y + item.height / 2 local px, py = player:get_center() if distance(x, y, px, py) < (item.width + player.width) / 2 then -- player picks up item ability = Ability:new() ability.name = item.ability if ability.name == 'sneakiness' then ability.max_charge = 200 ability.charge = 200 end table.insert(player.abilities, ability) player.abilities_by_name[ability.name] = ability real_time_since_item_get = 0 ability_just_found = ability.name table.remove(items, i) return end end end function spawn_guards() for i, pos in ipairs(map.guard_spawns) do guard = Guard:new() guard.x = pos.x guard.y = pos.y table.insert(guards, guard) end end function spawn_target() -- just spawn him in the upper left of the map x = 1 y = 1 while map.grid[x][y] == tiles.wall do x = x + 1 if x >= map.width then y = y + 1 x = 1 end end target = Target:new() target.x = x * tile_w target.y = y * tile_h end function spawn_items() if #player.abilities == #abilities then -- player already has all abilities return end -- spawn an item on a random floor tile local x = math.floor(random:random(map.width - 1)) local y = math.floor(random:random(map.height - 1)) -- keep selecting random floor tiles until we get one away from the -- player local px, py = pixel_to_map_coords(player.x, player.y) while not (map.grid[x][y] == tiles.floor and distance(x, y, px, py) > 10) do x = math.floor(random:random(map.width - 1)) y = math.floor(random:random(map.height - 1)) px, py = pixel_to_map_coords(player.x, player.y) end -- spawn an item local item = Item:new() item.x = x * tile_w + (tile_w - item.width) / 2 item.y = y * tile_h + (tile_h - item.height) / 2 -- keep randomly picking an ability until we have one the player does not -- have item.ability = abilities[ math.floor(random:random(#abilities))] while player:has_ability(item.ability) do item.ability = abilities[ math.floor(random:random(#abilities))] end table.insert(items, item) end function update_camera(dt) local dx, dy = player.x - camera.x, player.y - camera.y camera:move(dx/20, dy/20) end function love.keypressed(key, code) if key == 'return' then if gamestate == 'menu' then start_instructions() elseif gamestate == 'instructions' then start_level(1) elseif gamestate == 'gameover' then gamestate = 'menu' elseif gamestate == 'win' then start_level(level + 1) elseif gamestate == 'victory' then gamestate = 'menu' end elseif gamestate == 'playing' then for i, ability in ipairs(player.abilities) do if key == ability_keys[i] then ability:toggle() end end end end function start_instructions() gamestate = 'instructions' end function handle_player_keys(dt) -- returns action, if any taken if gamestate == 'playing' then player.ymove = 0 player.xmove = 0 -- find out how the player wants to move if love.keyboard.isDown(".") then return true -- no action, but advance time end if love.keyboard.isDown("up") then player.ymove = player.ymove - 1 end if love.keyboard.isDown("down") then player.ymove = player.ymove + 1 end if love.keyboard.isDown("left") then player.xmove = player.xmove - 1 end if love.keyboard.isDown("right") then player.xmove = player.xmove + 1 end if player.xmove ~= 0 or player.ymove ~= 0 then -- do the movements, and undo them if the player bumpts into a wall old_x = player.x old_y = player.y local speed = player.speed if player:has_ability('quickness') then if player.abilities_by_name['quickness'].active then speed = speed * 2 end end player.x = player.x + player.xmove * speed * dt if player:check_collision() then player.x = old_x end player.y = player.y + player.ymove * speed * dt if player:check_collision() then player.y = old_y end return true else return false end end end function love.resize(w, h) if gamestate == 'playing' or gamestate == 'gameover' or gamestate == 'win' or gamestate == 'victory' then camera:zoomTo(get_scale()) end end function get_scale() local map_height = tile_h * 20 return math.max(love.graphics.getHeight() / map_height, love.graphics.getHeight() / 768 / 4) end function get_camera_edges() -- returns (x1, y1, x2, y2) scale = get_scale() x, y = camera:pos() w, h = love.graphics.getDimensions() w = w / scale h = h / scale return x - w / 2, y - h / 2, x + w / 2, y + h / 2 end function draw_guards() for i, guard in ipairs(guards) do local image if guard.dead then image = guard_dead_image elseif guard.alert then image = guard_alert_image else image = guard_image end love.graphics.draw(image, guard.x, guard.y) end end function draw_bullets() for i, bullet in ipairs(bullets) do love.graphics.draw(bullet_image, bullet.x, bullet.y) end end function draw_items() for i, item in ipairs(items) do love.graphics.draw(item_image, item.x, item.y) end end function draw_target() if target.dead then love.graphics.draw(target_dead_image, target.x, target.y) else love.graphics.draw(target_image, target.x, target.y) end end function draw_player() if player:has_active_ability('invisibility') then love.graphics.setColor(100, 100, 255, 100) end love.graphics.draw(player_image, player.x , player.y) love.graphics.setColor(255, 255, 255, 255) end function love.draw() if gamestate == 'menu' then love.graphics.setFont(title_font) love.graphics.printf("Sneak", 25, 25, love.graphics.getWidth() - 50, "center") love.graphics.setFont(main_font) love.graphics.printf("A roguelike made in 7 days\nby Matthew Pfeiffer", 25, 200, love.graphics.getWidth() - 50, "center") love.graphics.printf("Press enter to start", 25, love.graphics.getHeight() - 50, love.graphics.getWidth() - 50, "center") elseif gamestate == 'playing' or gamestate == 'gameover' or gamestate == 'win' or gamestate == 'victory' then camera:attach() draw_map(camera) for i, guard in ipairs(guards) do if not guard.dead then if guard:player_is_in_sight() then love.graphics.setColor(255, 0, 0, 100/255) else love.graphics.setColor(255, 255, 0, 100/255) end local gx, gy = guard:get_center() local angle1 = guard.direction - guard.fov_range local angle2 = guard.direction + guard.fov_range for j, t in ipairs(get_fov(gx, gy, angle1, angle2, guard:get_view_dist())) do love.graphics.polygon('fill', t) end end end love.graphics.setColor(255, 255, 255, 255) draw_player() draw_guards() draw_target() draw_bullets() draw_items() camera:detach() if real_time_since_item_get < 5 then love.graphics.setFont(main_font) love.graphics.setColor(0, 255, 0, 255) love.graphics.printf("You found an item!\n\nNew ability: " .. ability_just_found, 50, 50, love.graphics.getWidth() - 50, "center") love.graphics.setColor(255, 255, 255, 255) end for i, ability in ipairs(player.abilities) do love.graphics.setFont(main_font) local x = love.graphics.getWidth() - 200 local y = love.graphics.getHeight() - 300 + 50 * i if ability.active then love.graphics.setColor(255, 0, 0, 255) else love.graphics.setColor(255, 255, 255, 255) end love.graphics.print("["..ability_keys[i].."] "..ability.name, x, y) local charge = ability.charge love.graphics.setColor(255, 0, 0, 200) love.graphics.rectangle('fill', x, y + 30, charge, 10) love.graphics.setColor(255, 255, 255, 200) love.graphics.rectangle('fill', x + charge, y + 30, ability.max_charge - charge, 10) love.graphics.setColor(255, 255, 255, 255) end if debug then love.graphics.setFont(main_font) love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10) end if gamestate == 'gameover' then love.graphics.setColor(255, 0, 0, 255) love.graphics.printf("YOU DIED!\n Press enter to return to the main menu.", 50, 50, love.graphics.getWidth() - 50, "center") elseif gamestate == 'win' then love.graphics.setColor(0, 255, 0, 255) love.graphics.printf("YOU WIN!\n Press enter to continue to the next level.", 50, 50, love.graphics.getWidth() - 50, "center") elseif gamestate == 'victory' then love.graphics.setColor(255, 255, 255, 255) love.graphics.printf("YOU SUCCEEDED IN KILLING ALL THE TARGETS AND ESCAPING THE HIDEOUT!\n\n".. "YOU WIN THE GAME!\n\nCongratulations!\n\n".. "Press enter to return to the main menu.", 50, 50, love.graphics.getWidth() - 50, "center") end elseif gamestate == 'instructions' then love.graphics.setColor(0, 255, 0, 255) love.graphics.printf("NEW MISSION\n\n".. "We have discovered the enemy's hideout.\n".. "You are to go in and eliminate the targets.\n".. "Beware: Their guards will shoot you on sight. ".. "You can try knocking them out, but ".. "getting in range might be tricky...\n".. "We have reports that they have some experimental ".. "technology lying around. Feel free to nab anything you see.\n".. "Escape the way you came from. That's it. Good luck!\n".. "<Arrow keys to move, period key to wait>", 50, 50, love.graphics.getWidth() - 100, "center") end end
return {'eulink','eulderink'}
-- Functions from transforming a parsed token stream into a song structure and then an event stream function update_timing(song) -- Update the base note length (in seconds), given the current L and Q settings -- Returns a timing state update event to be inserted into the output stream local rate = 0 local note_length = song.context.note_length or song.context.default_note_length local timing = song.context.timing rate = get_bpm_from_tempo(song.context.tempo) timing.base_note_length = rate / note_length timing.grace_note_length = rate / (song.context.grace_length.den/song.context.grace_length.num) -- deal with unmetered time; one "bar" becomes one whole note if song.context.meter.num==0 then timing.bar_length = rate*1e6 else timing.bar_length = compute_bar_length(song) end table.insert(song.opus, {event='timing_change', timing={base_note_length=timing.base_note_length*1e6, bar_length=timing.bar_length, beats_in_bar = song.context.meter.num, note_length=note_length, beat_length = timing.bar_length/song.context.meter.num}}) end function is_compound_time(song) -- return true if the meter is 6/8, 9/8 or 12/8 -- and false otherwise local meter = song.context.meter if meter then if meter.den==8 and (meter.num==6 or meter.num==9 or meter.num==12) then return true end end return false end function apply_repeats(song, bar) -- clear any existing material if bar.type=='start_repeat' then add_section(song, 1) end -- append any repeats, and variant endings if bar.type=='mid_repeat' or bar.type=='end_repeat' or bar.type=='double' or bar.type=='thickthin' or bar.type=='thinthick' then add_section(song, bar.end_reps+1) -- mark that we will now go into a variant mode if bar.variant_range then -- only allows first element in range to be used (e.g. can't do |1,3 within a repeat) song.context.in_variant = bar.variant_range[1] else song.context.in_variant = nil end end end function apply_key(song, key) -- apply transpose / octave to the song state if key.clef then if key.clef.octave then song.context.global_transpose = 12 * key.clef.octave -- octave shift else song.context.global_transpose = 0 end if key.clef.transpose then song.context.global_transpose = song.context.global_transpose + key.clef.transpose end end -- update key map song.context.key_mapping = create_key_structure(key) end function finalise_song(song) -- Finalise a song's event stream -- Composes the parts, repeats into a single stream -- Inserts absolute times into the events -- Inserts the lyrics into the song compose_parts(song) -- clear temporary data song.opus = nil -- time the stream and add lyrics song.stream = insert_lyrics(song.stream) time_stream(song.stream) end function apply_voice_specifiers(song) -- apply the voice specifiers. this sets the voice transpose if need be song.context.voice_transpose = 0 -- compute transpose local transpose = song.context.voice_specifiers.transpose or song.context.voice_specifiers.t or 0 local octaves = (song.context.voice_specifiers.octave) or 0 -- look for '+8' or '-8' at the end of a clef (e.g. treble+8) if song.context.voice_specifiers.clef then local clef = song.context.voice_specifiers.clef if string.len(clef)>2 and string.sub(clef,-2)=='+8' then octaves=octaves+1 end if string.len(clef)>2 and string.sub(clef,-2)=='-8' then octaves=octaves-1 end end song.context.voice_transpose = 12*octaves + transpose end function reset_timing(song) -- reset the timing state of the song song.context.timing = {} local timing = song.context.timing timing.triplet_state = {} timing.triplet_compress = 1 timing.prev_broken_note = 1 timing.bar_time = 0 update_timing(song) end function reset_bar_time(v, song) -- if warnings are enabled, mark underfull and overfull bars if song.context.bar_warnings or song.context.strict then if song.context.timing.bar_time>1 then warn('Overfull bar', v) end if song.context.timing.bar_time<1 then warn('Underfull bar', v) end end song.context.timing.bar_time = 0 end function start_new_voice(song, voice, specifiers) -- compose old voice into parts if song.context and song.context.voice then finalise_song(song) song.voices[song.context.voice] = {stream=song.stream, context=song.context} end song.context.voice_specifiers = {} -- merge in voice specifiers from heder and from this definition line if song.voice_specifiers[voice] then for i,v in pairs(song.voice_specifiers[voice]) do song.context.voice_specifiers[v.lhs] = v.rhs end end if specifiers then for i,v in pairs(specifiers) do song.context.voice_specifiers[v.lhs] = v.rhs end end apply_voice_specifiers(song) -- reset song state -- set up context state song.context.current_part = 'default' song.context.part_map = {} song.context.pattern_map = {} song.context.voice = voice song.opus = {} reset_timing(song) end function precompile_token_stream(token_stream, context, merge) -- run through a token stream, giving duration and pitches to all notes -- splitting off chord symbols. Does not expand repeats/parts/voices/etc. -- One-to-one mapping of original token stream (no tokens added or removed) -- If merge is true, then symbol lines and lyrics are merged into the notes -- (which changes the tokens); this is disabled by default. local song = {context=context or get_default_context(), opus={}} reset_timing(song) merge_lyrics(token_stream) -- merge in lyrics and symbol lines if merge then merge_symbol_line(token_stream) end for i=1,#token_stream do local v = token_stream[i] -- notes if v.token=='note' then compile_note(v.note, song) end -- deal with triplet definitions if v.token=='triplet' then -- update the context tuplet state so that timing is correct for the next notes apply_triplet(song, v.triplet) end -- deal with bars and repeat symbols if v.token=='bar' then reset_bar_time(v, song) song.context.accidental = {} -- clear any lingering accidentals end if v.token=='note_length' then song.context.note_length = v.note_length update_timing(song) end if v.token=='tempo' then song.context.tempo = v.tempo update_timing(song) end if v.token=='meter' then song.context.meter = v.meter update_timing(song) end if v.token=='chord' then v.chord.notes = get_chord_notes(v.chord, {}, song.context.key) end -- update key if v.token=='key' then song.context.key = v.key apply_key(song, song.context.key) end end end function expand_token_stream(song) -- expand a token_stream into a song structure local v local token local context = song.context local insert_note = insert_note local opus = song.opus local token_stream = copy_array(song.token_stream) -- merge in lyrics and symbol lines merge_symbol_line(token_stream) merge_lyrics(token_stream) local abc for i=1,#token_stream do v = token_stream[i] token = v.token if context.write_abc_events then -- write in the ABC notation event as a string abc = abc_element(v) end local event -- copy in standard events that don't change the context state if token == 'note' then insert_note(v.note, song, i, abc) else event = copy_table(v) event.event = event.token event.token = nil event.token_index = i event.abc = abc song.opus[#song.opus+1] = event if token=='chord' then v.chord.notes = get_chord_notes(v.chord, {}, context.key) -- deal with triplet definitions elseif token=='triplet' then -- update the context tuplet state so that timing is correct for the next notes apply_triplet(song, v.triplet) -- deal with bars and repeat symbols elseif token=='bar' then reset_bar_time(v, song) apply_repeats(song, v.bar) context.accidental = {} -- clear any lingering accidentals elseif token=='variant' then -- part variant; if we see this we go into a new part start_variant_part(song, v.variant) -- text fields elseif token=='field_text' then if song.metadata[v.name] then table.insert(song.metadata[v.name], v.content) else song.metadata[v.name] = {v.content} end -- append fields elseif token=='append_field_text' then local last if song.metadata[v.name] then last = song.metadata[v.name][#song.metadata[v.name]] last = last..' '..v.content song.metadata[v.name][#song.metadata[v.name]] = last else if song.context.strict then warn("Continuing a field with +: that doesn't exist.") end end -- new voice elseif token=='voice_change' then start_new_voice(song, v.voice.id, v.voice.specifiers) elseif token=='voice_def' then -- store any voice specific settings for later song.voice_specifiers[v.voice.id] = v.voice.specifiers elseif token=='instruction' then if v.directive then apply_directive(song, v.directive.directive, v.directive.arguments) end elseif token=='note_length' then context.note_length = v.note_length update_timing(song) elseif token=='tempo' then context.tempo = v.tempo update_timing(song) -- store tempo string in metadata song.metadata.tempo = string.sub(abc_tempo(v.tempo),3) elseif token=='parts' then context.part_structure = v.parts context.part_sequence = expand_parts(context.part_structure) elseif token=='new_part' then -- can only start a new part if the parts have been defined. if context.part_structure then song.in_variant_part = nil -- clear the variant flag start_new_part(song, v.part) end elseif token=='meter' then context.meter = v.meter update_timing(song) -- store key string in metadata song.metadata.meter = string.sub(abc_meter(v.meter),3) --set the default note length -- if meter.num/meter.den > 0.75 then 1/8 -- else 1/16 local ratio = song.context.meter.num / song.context.meter.num if ratio>=0.75 then context.default_note_length = 8 else context.default_note_length = 16 end -- update key elseif token=='key' then context.key = v.key apply_key(song, context.key) -- store key string in metadata song.metadata.key = string.sub(abc_key(v.key),3) -- store the header metadata if this is the first key in the file if not song.header_metadata then song.header_metadata = deepcopy(song.metadata) song.header_context = deepcopy(context) end end end end end function compile_token_stream(song, context, metadata) -- Convert a token_stream into a full -- a song datastructure. -- -- song.metadata contains header data about title, reference number, key etc. -- stored as plain text -- The song contains a table of voices -- each voice contains: -- voice.stream: a series of events (e.g. note on, note off) -- indexed by microseconds, -- voice.context contains all of the parsed song data -- copy any inherited data from the file header song.default_context = context or get_default_context() song.context = song.default_context song.voices = {} song.voice_specifiers = {} song.metadata = metadata or {} start_new_voice(song, 'default') expand_token_stream(song) -- finalise the voice start_new_voice(song, nil) -- clean up song.stream = nil end
local function getAdorneeBasePart(adornee: Instance) if adornee:IsA("BasePart") then return adornee :: BasePart elseif adornee:IsA("Model") then local primaryPart: BasePart? = adornee.PrimaryPart if primaryPart then return primaryPart :: BasePart else local part = adornee:FindFirstChildWhichIsA("BasePart") return if part then part :: BasePart else nil end elseif adornee:IsA("Attachment") then local part: Instance? = adornee.Parent return if part and part:IsA("BasePart") then part :: BasePart else nil elseif adornee:IsA("Humanoid") then local rootPart: BasePart? = adornee.RootPart return if rootPart then rootPart :: BasePart else nil elseif adornee:IsA("Accessory") or adornee:IsA("Clothing") then local part: BasePart? = adornee:FindFirstChildWhichIsA("BasePart") return if part then part :: BasePart else nil elseif adornee:IsA("Tool") then local handle: Instance? = adornee:FindFirstChild("Handle") return if handle and handle:IsA("BasePart") then handle :: BasePart else nil else return nil end end return getAdorneeBasePart
local PANEL = {}; function PANEL:Init ( ) self.DialogButtons = {}; self.DialogLabels = {}; self:SetSkin("ugperp") self.TextHolder = vgui.Create("DPanelList", self); self.TextHolder:EnableHorizontal(false) self.TextHolder:EnableVerticalScrollbar(true) self.TextHolder:SetPadding(0); self.TextHolder:SetSpacing(-5); self.DialogHolder = vgui.Create("DPanelList", self); self.DialogHolder:EnableHorizontal(false) self.DialogHolder:EnableVerticalScrollbar(true) self.DialogHolder:SetPadding(5); self.DialogHolder:SetSpacing(5); self.FaceBackground = vgui.Create("DPanelList", self); self.ModelPanel = vgui.Create('DModelPanel', self); self.ModelPanel:SetFOV(70); self.ModelPanel:SetCamPos(Vector(14, 0, 60)); function self.ModelPanel:LayoutEntity( Entity ) end self:SetAlpha(GAMEMODE.GetGUIAlpha()); end function PANEL:PerformLayout ( ) surface.SetFont("default"); _, self.TextHeight = surface.GetTextSize("blabla"); local MaxW, MaxH = ScrW() * .4, ScrH() * .2; self:SetPos(ScrW() * .5 - MaxW * .5, ScrH() - MaxH * 1.5); self:SetSize(MaxW, MaxH); self.FaceBackground:SetPos(3, 3); self.FaceBackground:SetSize(MaxH - 6, MaxH - 6); self.ModelPanel:SetPos(3, 3); self.ModelPanel:SetSize(MaxH - 6, MaxH - 6); self.DialogHolder:StretchToParent(MaxH, 6 + self.TextHeight * 4, 3, 3); self.TextHolder:SetPos(MaxH, 3); self.TextHolder:SetSize(self:GetWide() - 3 - MaxH, self.TextHeight * 4); for k, v in pairs(self.DialogLabels) do self.TextHolder:RemoveItem(v); v:Remove(); end self.DialogLabels = {}; if (self.Dialog) then local explodedResults = string.Explode("\n", self.Dialog); for k, v in pairs(explodedResults) do local splitResults = cutLength(v, self.TextHolder:GetWide() + 15, "Default"); for _, txt in pairs(splitResults) do local newLabel = vgui.Create("DLabel", self.TextHolder); newLabel:SetText(" " .. txt); self.TextHolder:AddItem(newLabel); table.insert(self.DialogLabels, newLabel); end end end end function PANEL:Paint ( ) SKIN:PaintFrame(self, true); end function PANEL:ClearDialog ( ) for k, v in pairs(self.DialogButtons) do self.DialogHolder:RemoveItem(v); v:Remove(); end self.DialogButtons = {}; end function PANEL:AddDialog ( Text, DoAction ) local newButton = vgui.Create("DButton", self); if DoAction == LEAVE_DIALOG then newButton:SetText(Text .. " <Leave>"); else newButton:SetText(Text); end function newButton.DoClick ( ) self:ClearDialog(); DoAction(); end self.DialogHolder:AddItem(newButton); table.insert(self.DialogButtons, newButton); end function PANEL:AddPaintOption ( Text, Col, DoAction, Arg ) local newButton = vgui.Create("perp2_vehicle_paint", self); newButton:DoSetup(Text, Col, DoAction, Arg) self.DialogHolder:AddItem(newButton); table.insert(self.DialogButtons, newButton); end function PANEL:SetDialog ( Text ) self.Dialog = Text; self:InvalidateLayout(); end function PANEL:Show ( ) self.ModelPanel:SetLookAt(CAM_LOOK_AT[LocalPlayer():GetSex()]); self.ModelPanel:SetModel(LocalPlayer():GetModel()); self:SetVisible(true); self:MakePopup(); end function PANEL:Hide ( ) self:SetVisible(false); LocalPlayer():ClearForcedEyeAngles(); self:ClearDialog(); end vgui.Register("perp2_dialog", PANEL);
local Players = game:GetService("Players") local Modules = Players.LocalPlayer.PlayerGui.AvatarEditorInGame.Modules local Symbol = require(Modules.Common.Symbol) return { Hidden = Symbol.named("Hidden"), Closed = Symbol.named("Closed"), Brief = Symbol.named("Brief"), Full = Symbol.named("Full"), Extended = Symbol.named("Extended"), }
Skada:AddLoadableModule("Dispels", nil, function(Skada, L) if Skada.db.profile.modulesBlocked.Dispels then return end local mod = Skada:NewModule(L["Dispels"]) local function log_dispell(set, dispell) local player = Skada:get_player(set, dispell.playerid, dispell.playername) if player then -- Add to player dispels. player.dispells = player.dispells + 1 -- Also add to set total dispels. set.dispells = set.dispells + 1 end end local function log_interrupt(set, interrupt) local player = Skada:get_player(set, interrupt.playerid, interrupt.playername) if player then -- Add to player interrupts. player.interrupts = player.interrupts + 1 -- Also add to set total interrupts. set.interrupts = set.interrupts + 1 end end local dispell = {} local function SpellDispel(timestamp, eventtype, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...) -- Dispells local spellId, spellName, spellSchool, sextraSpellId, sextraSpellName, sextraSchool, auraType = ... dispell.playerid = srcGUID dispell.playername = srcName dispell.spellid = spellId dispell.spellname = spellName dispell.extraspellid = sextraSpellId dispell.extraspellname = sextraSpellName log_dispell(Skada.current, dispell) log_dispell(Skada.total, dispell) end local function SpellInterrupt(timestamp, eventtype, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...) -- Interrupts local spellId, spellName, spellSchool, sextraSpellId, sextraSpellName, sextraSchool = ... dispell.playerid = srcGUID dispell.playername = srcName dispell.spellid = spellId dispell.spellname = spellName dispell.extraspellid = sextraSpellId dispell.extraspellname = sextraSpellName Skada:FixPets(dispell) log_interrupt(Skada.current, dispell) log_interrupt(Skada.total, dispell) end function mod:Update(win, set) local max = 0 local nr = 1 for i, player in ipairs(set.players) do if player.dispells > 0 then local d = win.dataset[nr] or {} win.dataset[nr] = d d.value = player.dispells d.label = player.name d.class = player.class d.role = player.role d.id = player.id d.valuetext = tostring(player.dispells) if player.dispells > max then max = player.dispells end nr = nr + 1 end end win.metadata.maxvalue = max end function mod:OnEnable() mod.metadata = {showspots = true, icon = "Interface\\Icons\\Ability_priest_focusedwill"} Skada:RegisterForCL(SpellDispel, 'SPELL_STOLEN', {src_is_interesting = true}) Skada:RegisterForCL(SpellDispel, 'SPELL_DISPEL', {src_is_interesting = true}) Skada:RegisterForCL(SpellInterrupt, 'SPELL_INTERRUPT', {src_is_interesting = true}) Skada:AddMode(self) end function mod:OnDisable() Skada:RemoveMode(self) end function mod:AddToTooltip(set, tooltip) GameTooltip:AddDoubleLine(L["Dispels"], set.dispells, 1,1,1) end -- Called by Skada when a new player is added to a set. function mod:AddPlayerAttributes(player) if not player.dispells then player.dispells = 0 end if not player.interrupts then player.interrupts = 0 end end -- Called by Skada when a new set is created. function mod:AddSetAttributes(set) if not set.dispells then set.dispells = 0 end if not set.interrupts then set.interrupts = 0 end end function mod:GetSetSummary(set) return set.dispells end end)
--[[----------------------------------------------------------------------------- EditBox Widget -------------------------------------------------------------------------------]] local Type, Version = "EditBox", 27 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end -- Lua APIs local tostring, pairs = tostring, pairs -- WoW APIs local PlaySound = PlaySound local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo local CreateFrame, UIParent = CreateFrame, UIParent local _G = _G -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded -- List them here for Mikk's FindGlobals script -- GLOBALS: AceGUIEditBoxInsertLink, ChatFontNormal, OKAY --[[----------------------------------------------------------------------------- Support functions -------------------------------------------------------------------------------]] if not AceGUIEditBoxInsertLink then -- upgradeable hook hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end) end function _G.AceGUIEditBoxInsertLink(text) for i = 1, AceGUI:GetWidgetCount(Type) do local editbox = _G["AceGUI-3.0EditBox"..i] if editbox and editbox:IsVisible() and editbox:HasFocus() then editbox:Insert(text) return true end end end local function ShowButton(self) if not self.disablebutton then self.button:Show() self.editbox:SetTextInsets(0, 20, 3, 3) end end local function HideButton(self) self.button:Hide() self.editbox:SetTextInsets(0, 0, 3, 3) end --[[----------------------------------------------------------------------------- Scripts -------------------------------------------------------------------------------]] local function Control_OnEnter(frame) frame.obj:Fire("OnEnter") end local function Control_OnLeave(frame) frame.obj:Fire("OnLeave") end local function Frame_OnShowFocus(frame) frame.obj.editbox:SetFocus() frame:SetScript("OnShow", nil) end local function EditBox_OnEscapePressed(frame) AceGUI:ClearFocus() end local function EditBox_OnEnterPressed(frame) local self = frame.obj local value = frame:GetText() local cancel = self:Fire("OnEnterPressed", value) if not cancel then PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON HideButton(self) end end local function EditBox_OnReceiveDrag(frame) local self = frame.obj local type, id, info = GetCursorInfo() if type == "item" then self:SetText(info) self:Fire("OnEnterPressed", info) ClearCursor() elseif type == "spell" then local name = GetSpellInfo(id, info) self:SetText(name) self:Fire("OnEnterPressed", name) ClearCursor() elseif type == "macro" then local name = GetMacroInfo(id) self:SetText(name) self:Fire("OnEnterPressed", name) ClearCursor() end HideButton(self) AceGUI:ClearFocus() end local function EditBox_OnTextChanged(frame) local self = frame.obj local value = frame:GetText() if tostring(value) ~= tostring(self.lasttext) then self:Fire("OnTextChanged", value) self.lasttext = value ShowButton(self) end end local function EditBox_OnFocusGained(frame) AceGUI:SetFocus(frame.obj) end local function Button_OnClick(frame) local editbox = frame.obj.editbox editbox:ClearFocus() EditBox_OnEnterPressed(editbox) end --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) -- height is controlled by SetLabel self:SetWidth(200) self:SetDisabled(false) self:SetLabel() self:SetText() self:DisableButton(false) self:SetMaxLetters(0) end, ["OnRelease"] = function(self) self:ClearFocus() end, ["SetDisabled"] = function(self, disabled) self.disabled = disabled if disabled then self.editbox:EnableMouse(false) self.editbox:ClearFocus() self.editbox:SetTextColor(0.5,0.5,0.5) self.label:SetTextColor(0.5,0.5,0.5) else self.editbox:EnableMouse(true) self.editbox:SetTextColor(1,1,1) self.label:SetTextColor(1,.82,0) end end, ["SetText"] = function(self, text) self.lasttext = text or "" self.editbox:SetText(text or "") self.editbox:SetCursorPosition(0) HideButton(self) end, ["GetText"] = function(self, text) return self.editbox:GetText() end, ["SetLabel"] = function(self, text) if text and text ~= "" then self.label:SetText(text) self.label:Show() self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,-18) self:SetHeight(44) self.alignoffset = 30 else self.label:SetText("") self.label:Hide() self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,0) self:SetHeight(26) self.alignoffset = 12 end end, ["DisableButton"] = function(self, disabled) self.disablebutton = disabled if disabled then HideButton(self) end end, ["SetMaxLetters"] = function (self, num) self.editbox:SetMaxLetters(num or 0) end, ["ClearFocus"] = function(self) self.editbox:ClearFocus() self.frame:SetScript("OnShow", nil) end, ["SetFocus"] = function(self) self.editbox:SetFocus() if not self.frame:IsShown() then self.frame:SetScript("OnShow", Frame_OnShowFocus) end end, ["HighlightText"] = function(self, from, to) self.editbox:HighlightText(from, to) end } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] local function Constructor() local num = AceGUI:GetNextWidgetNum(Type) local frame = CreateFrame("Frame", nil, UIParent) frame:Hide() local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "InputBoxTemplate") editbox:SetAutoFocus(false) editbox:SetFontObject(ChatFontNormal) editbox:SetScript("OnEnter", Control_OnEnter) editbox:SetScript("OnLeave", Control_OnLeave) editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed) editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed) editbox:SetScript("OnTextChanged", EditBox_OnTextChanged) editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag) editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag) editbox:SetScript("OnEditFocusGained", EditBox_OnFocusGained) editbox:SetTextInsets(0, 0, 3, 3) editbox:SetMaxLetters(256) editbox:SetPoint("BOTTOMLEFT", 6, 0) editbox:SetPoint("BOTTOMRIGHT") editbox:SetHeight(19) local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") label:SetPoint("TOPLEFT", 0, -2) label:SetPoint("TOPRIGHT", 0, -2) label:SetJustifyH("LEFT") label:SetHeight(18) local button = CreateFrame("Button", nil, editbox, "UIPanelButtonTemplate") button:SetWidth(40) button:SetHeight(20) button:SetPoint("RIGHT", -2, 0) button:SetText(OKAY) button:SetScript("OnClick", Button_OnClick) button:Hide() local widget = { alignoffset = 30, editbox = editbox, label = label, button = button, frame = frame, type = Type } for method, func in pairs(methods) do widget[method] = func end editbox.obj, button.obj = widget, widget return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version)
local t = require( "taptest" ) local kebabcase = require( "kebabcase" ) t( kebabcase{ "Wiki", "Word", "BUMPY", "caPS" }, "wiki-word-bumpy-caps" ) t()
--- WEdit Actions (https://github.com/Silverfeelin/Starbound-WEdit) -- -- Script used by controller.lua. Keeps all WEdit actions centralized in one place. -- This script can not be used by itself, as it relies on data defined in or adjusted by wedit.lua and/or controller.lua. require "/interface/wedit/dyePicker/dyePickerUtil.lua" require "/interface/wedit/huePicker/huePickerUtil.lua" require "/interface/wedit/randomPicker/randomPickerUtil.lua" wedit.actions = wedit.actions or {} local controller = wedit.controller --- Function that appears to lack functionality, yet mysteriously accomplishes just about everything. -- @see controller.update function wedit.actions.WE_AllInOne() if not status.statusProperty("wedit.compact.open") then controller.info("^shadow;^orange;WEdit: All in One") controller.info("^shadow;^yellow;Primary Fire: Open Compact Interface.", {0,-1}) local c = controller if not c.fireLocked and (c.primaryFire or c.altFire) then c.fireLock() world.sendEntityMessage(entity.id(), "interact", "ScriptPane", "/interface/wedit/compact/compact.config") end end end --- Sets or updates the selection area. function wedit.actions.WE_Select() controller.info("^shadow;^orange;WEdit: Selection Tool") if controller.validSelection() then controller.info("^shadow;^yellow;Alt Fire: Remove selection.", {0,-2}) local w, h = controller.selection[2][1] - controller.selection[1][1], controller.selection[2][2] - controller.selection[1][2] controller.info(string.format("^shadow;^yellow;Current Selection: ^red;(%sx%s)^yellow;.", w, h), {0,-3}) end -- RMB resets selection entirely if not controller.fireLocked and controller.altFire then controller.fireLock() controller.selectStage = 0 controller.selection = {{},{}} return end if controller.selectStage == 0 then -- Select stage 0: Not selecting. controller.info("^shadow;^yellow;Primary Fire: Select area.", {0,-1}) if controller.primaryFire and not controller.fireLocked then -- Start selection; set first point. controller.selectStage = 1 controller.rawSelection[1] = tech.aimPosition() end elseif controller.selectStage == 1 then controller.info("^shadow;^yellow;Drag mouse and let go to select an area.", {0,-1}) -- Select stage 1: Selection started. if controller.primaryFire then -- Dragging selection; update second point. controller.rawSelection[2] = tech.aimPosition() -- Update converted coördinates. -- Compare X (1 is smallest): controller.selection[1][1] = math.floor((controller.rawSelection[1][1] < controller.rawSelection[2][1]) and controller.rawSelection[1][1] or controller.rawSelection[2][1]) controller.selection[2][1] = math.ceil((controller.rawSelection[1][1] < controller.rawSelection[2][1]) and controller.rawSelection[2][1] or controller.rawSelection[1][1]) -- Compare Y (1 is smallest): controller.selection[1][2] = math.floor((controller.rawSelection[1][2] < controller.rawSelection[2][2]) and controller.rawSelection[1][2] or controller.rawSelection[2][2]) controller.selection[2][2] = math.ceil((controller.rawSelection[1][2] < controller.rawSelection[2][2]) and controller.rawSelection[2][2] or controller.rawSelection[1][2]) else -- Selection ended; reset stage. controller.selectStage = 0 -- We can forget about the raw coördinates now. controller.rawSelection = {} end else -- Select stage is not valid; reset it. controller.selectStage = 0 end end --- Function to erase all blocks in the current selection. function wedit.actions.WE_Erase() controller.info("^shadow;^orange;WEdit: Eraser") controller.info("^shadow;^yellow;Erase all blocks in the current selection.", {0,-1}) controller.info("^shadow;^yellow;Primary Fire: foreground.", {0,-2}) controller.info("^shadow;^yellow;Alt Fire: background.", {0,-3}) if not controller.fireLocked and controller.validSelection() then if controller.primaryFire then -- Remove Foreground controller.fireLock() local backup = wedit.breakBlocks(controller.selection[1], controller.selection[2], "foreground") if backup then table.insert(controller.backup, backup) end elseif controller.altFire then -- Remove Background controller.fireLock() local backup = wedit.breakBlocks(controller.selection[1], controller.selection[2], "background") if backup then table.insert(controller.backup, backup) end end end end --- Function to undo the previous Fill or Erase action. -- LMB Undoes the last remembered action. RMB removes the last remembered action, allowing for multiple undo steps. function wedit.actions.WE_Undo() local backupSize = #controller.backup controller.info("^shadow;^orange;WEdit: Undo Tool (EXPERIMENTAL)") controller.info("^shadow;^yellow;Undoes previous action (Fill, Break, Paste, Replace).", {0,-1}) controller.info("^shadow;^yellow;Primary Fire: Undo last action.", {0,-2}) controller.info("^shadow;^yellow;Alt Fire: Forget last undo (go back a step).", {0,-3}) controller.info("^shadow;^yellow;Undo Count: " .. backupSize .. ".", {0,-4}) -- Show undo area. if backupSize > 0 then local backup = controller.backup[backupSize] local top = backup.origin[2] + backup.size[2] if controller.validSelection() and math.ceil(controller.selection[2][2]) == math.ceil(top) then top = top + 1 end wedit.debugRenderer:drawText("^shadow;WEdit Undo Position", {backup.origin[1], top}, "#FFBF87") wedit.debugRenderer:drawRectangle(backup.origin, {backup.origin[1] + backup.size[1], backup.origin[2] + backup.size[2]}, "#FFBF87") end -- Actions if not controller.fireLocked then if controller.primaryFire then -- Undo controller.fireLock() if backupSize > 0 then wedit.paste(controller.backup[backupSize], controller.backup[backupSize].origin) end elseif controller.altFire then -- Remove Undo controller.fireLock() if backupSize > 0 then table.remove(controller.backup, backupSize) end end end end --- Function to select a block to be used by tools such as the Pencil or the Paint Bucket. function wedit.actions.WE_ColorPicker() controller.info("^shadow;^orange;WEdit: Color Picker") controller.info("^shadow;^yellow;Select a block for certain tools.", {0,-1}) controller.info("^shadow;^yellow;Primary Fire: foreground.", {0,-2}) controller.info("^shadow;^yellow;Alt Fire: background.", {0,-3}) controller.info("^shadow;^yellow;Shift + Fire: Open material picker.", {0,-4}) controller.info("^shadow;^yellow;Current Block: ^red;" .. controller.selectedBlockToString() .. "^yellow;.", {0,-5}) wedit.debugRenderer:drawBlock(tech.aimPosition()) if controller.shiftHeld then if not controller.shiftFireLocked and (controller.primaryFire or controller.altFire) then require "/interface/wedit/materialPicker/materialPickerLoader.lua" materialPickerLoader.initializeConfig() world.sendEntityMessage(entity.id(), "interact", "ScriptPane", materialPickerLoader.config) controller.shiftFireLock() end elseif not controller.shiftFireLocked then if controller.primaryFire then controller.fireLock() controller.updateColor("foreground") elseif controller.altFire then controller.fireLock() controller.updateColor("background") end end end --- Function to fill the crurent selection with the selected block. function wedit.actions.WE_Fill() controller.info("^shadow;^orange;WEdit: Paint Bucket") controller.info("^shadow;^yellow;Fills air in the current selection with the selected block.", {0,-1}) controller.info("^shadow;^yellow;Primary Fire: foreground.", {0,-2}) controller.info("^shadow;^yellow;Alt Fire: background.", {0,-3}) controller.info("^shadow;^yellow;Current Block: ^red;" .. controller.selectedBlockToString() .. "^yellow;.", {0,-4}) if not controller.fireLocked and controller.validSelection() then if controller.primaryFire then controller.fireLock() local backup = wedit.fillBlocks(controller.selection[1], controller.selection[2], "foreground", controller.selectedBlock) if backup then table.insert(controller.backup, backup) end elseif controller.altFire then controller.fireLock() local backup = wedit.fillBlocks(controller.selection[1], controller.selection[2], "background", controller.selectedBlock) if backup then table.insert(controller.backup, backup) end end end end --- Function to draw the selected block under the cursor. Existing blocks will be replaced. -- Uses the configured brush type and pencil brush size. function wedit.actions.WE_Pencil() controller.info("^shadow;^orange;WEdit: Pencil") controller.info("^shadow;^yellow;Primary Fire: Draw on foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Draw on background.", {0,-2}) controller.info("^shadow;^yellow;Shift + Fire: Erase on layer.", {0,-3}) controller.info("^shadow;^yellow;Current Block: ^red;" .. controller.selectedBlockToString() .. "^yellow;.", {0,-4}) local debugCallback = function(pos) wedit.debugRenderer:drawBlock(pos) end local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil local block = controller.selectedBlock if controller.shiftHeld then block = false end local callback if controller.selectedBlock ~= nil and layer then callback = function(pos) debugCallback(pos) wedit.pencil(pos, layer, block) end else callback = debugCallback end if wedit.getUserConfigData("brushShape") == "square" then wedit.rectangle(tech.aimPosition(), wedit.getUserConfigData("pencilSize"), nil, callback) elseif wedit.getUserConfigData("brushShape") == "circle" then wedit.circle(tech.aimPosition(), wedit.getUserConfigData("pencilSize"), callback) end end --- Function to spawn a tool similar to the Pencil, dedicated to a single selected block. function wedit.actions.WE_BlockPinner() controller.info("^shadow;^orange;WEdit: Block Pinner") controller.info("^shadow;^yellow;Primary Fire: Pin foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Pin background.", {0,-2}) local aimPos = tech.aimPosition() wedit.debugRenderer:drawBlock(aimPos) local fg, bg = world.material(aimPos, "foreground"), world.material(aimPos, "background") local fgh, bgh = world.materialHueShift(aimPos, "foreground") or 0, world.materialHueShift(aimPos, "background") or 0 if fg then controller.info("^shadow;^yellow;Foreground Block: ^red;" .. fg .. "^yellow;.", {0,-3}) else controller.info("^shadow;^yellow;Foreground Block: ^red;None^yellow;.", {0,-3}) end if bg then controller.info("^shadow;^yellow;Background Block: ^red;" .. bg .. "^yellow;.", {0,-4}) else controller.info("^shadow;^yellow;Background Block: ^red;None^yellow;.", {0,-4}) end if not controller.fireLocked then if controller.primaryFire or controller.altFire then controller.fireLock() local block = controller.primaryFire and fg or controller.altFire and bg local hueshift = controller.primaryFire and fgh or controller.altFire and bgh if type(block) == "nil" then return end if type(block) ~= "boolean" then local tileCfg = root.materialConfig(block) if not tileCfg.config.itemDrop then wedit.logger:logError("Couldn't determine what item %s should give you.", block) else local itemCfg = root.itemConfig(tileCfg.config.itemDrop) icon = controller.fixImagePath(itemCfg.directory, itemCfg.config.inventoryIcon) .. "?hueshift=" .. math.floor(hueshift * 360 / 255) sb.logInfo("Block hueshift: %s", hueshift) sb.logInfo("Icon: %s", icon) local params = controller.spawnOreParameters("WE_Block", "^yellow;Primary Fire: Place foreground.\nAlt Fire: Place background.", string.format("^orange;WEdit: %s (hue:%s)", block, math.floor(hueshift)), icon, "essential") params.wedit = { block = block, hueshift = hueshift } world.spawnItem("triangliumore", mcontroller.position(), 1, params) end else -- Air local params = controller.spawnOreParameters("WE_Block", "^yellow;Primary Fire: Remove foreground.\nAlt Fire: Remove background.", "^orange;WEdit: Air", "/assetMissing.png?replace;00000000=ffffff;ffffff00=ffffff?setcolor=ffffff?scalenearest=1?crop=0;0;16;16?blendmult=/objects/outpost/customsign/signplaceholder.png;0;0?replace;01000101=00000000;01000201=0000000A;01000301=5E00009D;01000401=950000CC;01000501=9E0000CC;01000601=A60000CC;01000701=AE0000CC;01000801=B40000CC;02000101=00000000;02000201=00000017;02000301=7A0000CC;02000401=DC1E2FFF;02000501=DE1C2DFF;02000601=E42536FF;02000701=EC2D3EFF;02000801=F23546FF;03000101=00000000;03000201=0000001A;03000301=7A0000CC;03000401=D81325FF;03000501=D50015FF;03000601=DB0019FF;03000701=E3001CFF;03000801=E90020FF;04000101=00000000;04000201=0000001A;04000301=7A0000CC;04000401=D81325FF;04000501=D50015FF;04000601=DB0019FF;04000701=E3001CFF;04000801=E90020FF;05000101=00000000;05000201=0000001A;05000301=7A0000CC;05000401=D81325FF;05000501=D50015FF;05000601=DB0019FF;05000701=E3001CFF;05000801=E90020FF;06000101=00000000;06000201=0000001A;06000301=7A0000CC;06000401=D81325FF;06000501=D50015FF;06000601=DB0019FF;06000701=E3001CFF;06000801=E90020FF;07000101=00000000;07000201=00000027;07000301=7A0000CC;07000401=D81325FF;07000501=D50015FF;07000601=DB0019FF;07000701=E3001CFF;07000801=E90020FF;08000101=0000001A;08000201=0E4200A6;08000301=533B00CC;08000401=654100CC;08000501=6D4600CC;08000601=754A00CC;08000701=7C4E00CC;08000801=825200CC;09000101=0000001A;09000201=105500CC;09000301=79BD35FF;09000401=7BBF37FF;09000501=7FC33BFF;09000601=82C63EFF;09000701=86CA42FF;09000801=88CC44FF;10000101=0000001A;10000201=105500CC;10000301=87CB43FF;10000401=86CA42FF;10000501=8CCF48FF;10000601=91D54DFF;10000701=95D951FF;10000801=A9ED65FF;11000101=0000001A;11000201=105500CC;11000301=82C63EFF;11000401=7BBF37FF;11000501=7FC33BFF;11000601=82C63EFF;11000701=86CA42FF;11000801=A9ED65FF;12000101=0000001A;12000201=105500CC;12000301=82C63EFF;12000401=7BBF37FF;12000501=7FC33BFF;12000601=82C63EFF;12000701=86CA42FF;12000801=A9ED65FF;13000101=0000001A;13000201=105500CC;13000301=82C63EFF;13000401=7BBF37FF;13000501=7FC33BFF;13000601=82C63EFF;13000701=86CA42FF;13000801=A9ED65FF;14000101=00000017;14000201=105500CC;14000301=87CB43FF;14000401=86CA42FF;14000501=8CCF48FF;14000601=91D54DFF;14000701=95D951FF;14000801=89D341ED;15000101=0000000A;15000201=0E42009D;15000301=2B7500CC;15000401=348100CC;15000501=3C8B00CC;15000601=449400CC;15000701=4A9C00CC;15000801=50A400AE;16000101=00000000;16000201=0C2F0000;16000301=2B750000;16000401=34810000;16000501=3C8B0000;16000601=44940000;16000701=4A9C0000;16000801=50A40000?blendmult=/objects/outpost/customsign/signplaceholder.png;0;-8?replace;01000101=BA0000AE;01000201=BE000048;01000301=BF000000;01000401=BF000000;01000501=BF000000;01000601=60405D00;01000701=0184BF00;01000801=0188C200;02000101=E64B4CED;02000201=BE0000CC;02000301=BF000000;02000401=BF000000;02000501=901E2D00;02000601=017EB900;02000701=0184BF00;02000801=0188C200;03000101=FE7576FF;03000201=BE0000CC;03000301=BF000000;03000401=901C2B00;03000501=0176B100;03000601=017EB900;03000701=0184BF00;03000801=0188C200;04000101=FE7576FF;04000201=BE0000CC;04000301=901A2900;04000401=016EA900;04000501=0176B100;04000601=017EB900;04000701=0184BF00;04000801=0188C200;05000101=A36279FF;05000201=5A3050E6;05000301=0165A1D7;05000401=016EA9D9;05000501=0176B1DB;05000601=017EB9DC;05000701=0184BFBC;05000801=0189C34E;06000101=55507BFF;06000201=32A9DCFF;06000301=32A9DCFF;06000401=38AEE1FF;06000501=3DB4E7FF;06000601=41B8EBFF;06000701=36B2E7F3;06000801=0189C3DE;07000101=55507BFF;07000201=2DA4D7FF;07000301=279ED1FF;07000401=2CA3D6FF;07000501=30A7DAFF;07000601=33AADDFF;07000701=54CBFEFF;07000801=0189C3DE;08000101=284559EF;08000201=2DA4D7FF;08000301=279ED1FF;08000401=2CA3D6FF;08000501=30A7DAFF;08000601=33AADDFF;08000701=54CBFEFF;08000801=0189C3DE;09000101=195D59EF;09000201=2DA4D7FF;09000301=279ED1FF;09000401=2CA3D6FF;09000501=30A7DAFF;09000601=33AADDFF;09000701=54CBFEFF;09000801=0189C3DE;10000101=195D59EF;10000201=32A9DCFF;10000301=32A9DCFF;10000401=624358FF;10000501=86242FFF;10000601=7B475CFF;10000701=36B2E7F3;10000801=0189C3DE;11000101=2B743FE5;11000201=015A97D5;11000301=0165A1D7;11000401=6A131EF7;11000501=F75E5EFF;11000601=8A1621F8;11000701=0184BFBC;11000801=0189C34E;12000101=54A900CC;12000201=40972700;12000301=5A192800;12000401=800000CC;12000501=F75E5EFF;12000601=A70000CC;12000701=80223000;12000801=2C679200;13000101=54A900CC;13000201=55AA0000;13000301=77000000;13000401=800000CC;13000501=F75E5EFF;13000601=A70000CC;13000701=AA000000;13000801=AA000000;14000101=54A900CC;14000201=55AA0000;14000301=77000000;14000401=800000CC;14000501=F75E5EFF;14000601=A70000CC;14000701=AA000000;14000801=AA000000;15000101=54A90048;15000201=55AA0000;15000301=77000000;15000401=800000CC;15000501=F75E5EFF;15000601=A70000CC;15000701=AA000000;15000801=AA000000;16000101=53A80000;16000201=6B550000;16000301=80000000;16000401=84000099;16000501=980000CC;16000601=A6000099;16000701=A7000000;16000801=A7000000", "essential") params.wedit = { block = false } world.spawnItem("triangliumore", mcontroller.position(), 1, params) end end end end --- Function to draw the block of the item under the cursor like the Pencil tool. -- Uses the configured brush type and block brush size. -- Existing blocks will be replaced. function wedit.actions.WE_Block() controller.info("^shadow;^orange;WEdit: Material Placer") controller.info("^shadow;^yellow;Primary Fire: Place in foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Place in background.", {0,-2}) local itemData = controller.itemData if itemData and itemData.block then controller.info("^shadow;^yellow;Material: ^red;" .. itemData.block .. "^yellow;.", {0,-3}) else controller.info("^shadow;^yellow;Material: ^red;None^yellow;.", {0,-3}) end local debugCallback = function(pos) wedit.debugRenderer:drawBlock(pos) end local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil local callback if controller.selectedBlock ~= nil and layer then callback = function(pos) debugCallback(pos) wedit.pencil(pos, layer, itemData.block, itemData.hueshift) end else callback = debugCallback end if wedit.getUserConfigData("brushShape") == "square" then wedit.rectangle(tech.aimPosition(), wedit.getUserConfigData("blockSize"), nil, callback) elseif wedit.getUserConfigData("brushShape") == "circle" then wedit.circle(tech.aimPosition(), wedit.getUserConfigData("blockSize"), callback) end end --- Function to copy and paste a selection elsewhere. function wedit.actions.WE_Stamp() controller.info("^shadow;^orange;WEdit: Stamp Tool") controller.info("^shadow;^yellow;Primary Fire: Copy selection.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Paste selection.", {0,-2}) controller.info("^shadow;^yellow;Shift + Primary Fire: Forget copy.", {0,-3}) controller.info("^shadow;^yellow;Paste area is defined by the bottom left point.", {0,-4}) if controller.validSelection() then controller.showSelection() end if not controller.shiftFireLocked then if not controller.shiftHeld then if controller.primaryFire then -- Store copy storage.weditCopy = wedit.copy(controller.selection[1], controller.selection[2], nil, true) controller.shiftFireLock() elseif controller.altFire then if storage.weditCopy then -- Start paste local position = {controller.selection[1][1], controller.selection[1][2]} local backup = wedit.paste(storage.weditCopy, position) if backup then table.insert(controller.backup, backup) end end controller.shiftFireLock() end elseif controller.primaryFire then storage.weditCopy = nil controller.shiftFireLock() end end end --- Function to flip the current copy horizontally or vertically. -- Vertical flips may cause issues with objects, matmods and liquids. -- Does not work with Schematics. function wedit.actions.WE_Flip() controller.info("^shadow;^orange;WEdit: Flip Tool") controller.info("^shadow;^yellow;Primary Fire: Flip copy horizontally.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Flip copy vertically.", {0,-2}) controller.info("^shadow;^yellow;Flipping copies may cause issues with objects, matmods and liquids.", {0,-3}) local c = storage.weditCopy if c then local msg = "^shadow;^yellow;Flipped: ^red;" local dir = c.flipX and c.flipY and "Horizontally and Vertically" or c.flipX and "Horizontally" or c.flipY and "Vertically" or "None" controller.info(msg .. dir, {0,-4}) end if not controller.fireLocked and controller.primaryFire then controller.fireLock() if c then storage.weditCopy = wedit.flip(storage.weditCopy, "horizontal") end elseif not controller.fireLocked and controller.altFire then controller.fireLock() if c then storage.weditCopy = wedit.flip(storage.weditCopy, "vertical") end end end function wedit.actions.WE_Rotate() controller.info("^shadow;^orange;WEdit: Rotate Tool") controller.info("^shadow;^yellow;Primary Fire: Rotate copy left.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Rotate copy right.", {0,-2}) controller.info("^shadow;^yellow;Rotating copies may cause issues with objects, matmods and liquids.", {0,-3}) local c = storage.weditCopy if c then local msg = "^shadow;^yellow;Rotated: ^red;" .. (c.rotate or 0) controller.info(msg, {0,-4}) end if not controller.fireLocked and controller.primaryFire then controller.fireLock() if c then wedit.rotate(c, -1) end elseif not controller.fireLocked and controller.altFire then controller.fireLock() if c then wedit.rotate(c, 1) end end end --- Function to create a schematic item for the given selection, which allows you to paste the selection later. function wedit.actions.WE_SchematicMaker() controller.info("^shadow;^orange;WEdit: Schematic Maker") controller.info("^shadow;^yellow;Primary Fire: Create Schematic.", {0,-1}) if not controller.fireLocked and controller.primaryFire and controller.validSelection() then controller.fireLock() local copy = wedit.copy(controller.selection[1], controller.selection[2], nil, true) local icon = "/assetMissing.png?replace;00000000=ffffff;ffffff00=ffffff?setcolor=ffffff?scalenearest=1?crop=0;0;16;15?blendmult=/objects/outpost/customsign/signplaceholder.png;0;0?replace;01000101=FFFFFF00;01000201=FFFFFF00;01000301=090A0BFF;01000401=090A0BFF;01000501=090A0BFF;01000601=090A0BFF;01000701=090A0BFF;01000801=090A0BFF;02000101=FFFFFF00;02000201=090A0BFF;02000301=1B63ABFF;02000401=5796D5FF;02000501=5796D5FF;02000601=5796D5FF;02000701=5796D5FF;02000801=5796D5FF;03000101=FFFFFF00;03000201=090A0BFF;03000301=5796D5FF;03000401=77B9EAFF;03000501=9ED1F7FF;03000601=77B9EAFF;03000701=77B9EAFF;03000801=9ED1F7FF;04000101=FFFFFF00;04000201=090A0BFF;04000301=5796D5FF;04000401=77B9EAFF;04000501=5796D5FF;04000601=77B9EAFF;04000701=090A0BFF;04000801=090A0BFF;05000101=FFFFFF00;05000201=090A0BFF;05000301=5796D5FF;05000401=77B9EAFF;05000501=9ED1F7FF;05000601=090A0BFF;05000701=B1B1B1FF;05000801=B1B1B1FF;06000101=FFFFFF00;06000201=090A0BFF;06000301=5796D5FF;06000401=77B9EAFF;06000501=090A0BFF;06000601=B1B1B1FF;06000701=566EB1FF;06000801=749FC7FF;07000101=FFFFFF00;07000201=090A0BFF;07000301=5796D5FF;07000401=090A0BFF;07000501=B1B1B1FF;07000601=566EB1FF;07000701=CBECF4FF;07000801=CBECF4FF;08000101=FFFFFF00;08000201=090A0BFF;08000301=5796D5FF;08000401=090A0BFF;08000501=B1B1B1FF;08000601=749FC7FF;08000701=CBECF4FF;08000801=CBECF4FF;09000101=FFFFFF00;09000201=090A0BFF;09000301=5796D5FF;09000401=090A0BFF;09000501=B1B1B1FF;09000601=749FC7FF;09000701=9DD7E6FF;09000801=9DD7E6FF;10000101=FFFFFF00;10000201=090A0BFF;10000301=5796D5FF;10000401=090A0BFF;10000501=B1B1B1FF;10000601=566EB1FF;10000701=9DD7E6FF;10000801=9DD7E6FF;11000101=FFFFFF00;11000201=090A0BFF;11000301=5796D5FF;11000401=090A0BFF;11000501=743D23FF;11000601=B1B1B1FF;11000701=566EB1FF;11000801=749FC7FF;12000101=FFFFFF00;12000201=090A0BFF;12000301=090A0BFF;12000401=743D23FF;12000501=8D5834FF;12000601=BD8549FF;12000701=B1B1B1FF;12000801=B1B1B1FF;13000101=FFFFFF00;13000201=090A0BFF;13000301=743D23FF;13000401=8D5834FF;13000501=BD8549FF;13000601=090A0BFF;13000701=090A0BFF;13000801=090A0BFF;14000101=090A0BFF;14000201=743D23FF;14000301=8D5834FF;14000401=BD8549FF;14000501=090A0BFF;14000601=5796D5FF;14000701=5796D5FF;14000801=5796D5FF;15000101=090A0BFF;15000201=743D23FF;15000301=BD8549FF;15000401=090A0BFF;15000501=090A0BFF;15000601=090A0BFF;15000701=090A0BFF;15000801=090A0BFF;16000101=FFFFFF00;16000201=090A0BFF;16000301=090A0BFF;16000401=FFFFFF00;16000501=FFFFFF00;16000601=FFFFFF00;16000701=FFFFFF00;16000801=FFFFFF00?blendmult=/objects/outpost/customsign/signplaceholder.png;0;-8?replace;01000101=090A0BFF;01000201=090A0BFF;01000301=090A0BFF;01000401=090A0BFF;01000501=090A0BFF;01000601=090A0BFF;01000701=FFFFFF00;02000101=5796D5FF;02000201=5796D5FF;02000301=5796D5FF;02000401=5796D5FF;02000501=5796D5FF;02000601=1B63ABFF;02000701=090A0BFF;03000101=77B9EAFF;03000201=9ED1F7FF;03000301=77B9EAFF;03000401=9ED1F7FF;03000501=77B9EAFF;03000601=5796D5FF;03000701=090A0BFF;04000101=090A0BFF;04000201=090A0BFF;04000301=77B9EAFF;04000401=9ED1F7FF;04000501=77B9EAFF;04000601=5796D5FF;04000701=090A0BFF;05000101=B1B1B1FF;05000201=B1B1B1FF;05000301=090A0BFF;05000401=9ED1F7FF;05000501=77B9EAFF;05000601=5796D5FF;05000701=090A0BFF;06000101=749FC7FF;06000201=566EB1FF;06000301=B1B1B1FF;06000401=090A0BFF;06000501=77B9EAFF;06000601=5796D5FF;06000701=090A0BFF;07000101=9DD7E6FF;07000201=9DD7E6FF;07000301=566EB1FF;07000401=B1B1B1FF;07000501=090A0BFF;07000601=5796D5FF;07000701=090A0BFF;08000101=9DD7E6FF;08000201=9DD7E6FF;08000301=749FC7FF;08000401=B1B1B1FF;08000501=090A0BFF;08000601=5796D5FF;08000701=090A0BFF;09000101=9DD7E6FF;09000201=9DD7E6FF;09000301=749FC7FF;09000401=B1B1B1FF;09000501=090A0BFF;09000601=5796D5FF;09000701=090A0BFF;10000101=9DD7E6FF;10000201=9DD7E6FF;10000301=566EB1FF;10000401=B1B1B1FF;10000501=090A0BFF;10000601=5796D5FF;10000701=090A0BFF;11000101=749FC7FF;11000201=566EB1FF;11000301=B1B1B1FF;11000401=090A0BFF;11000501=77B9EAFF;11000601=5796D5FF;11000701=090A0BFF;12000101=B1B1B1FF;12000201=B1B1B1FF;12000301=090A0BFF;12000401=9ED1F7FF;12000501=77B9EAFF;12000601=5796D5FF;12000701=090A0BFF;13000101=090A0BFF;13000201=090A0BFF;13000301=77B9EAFF;13000401=77B9EAFF;13000501=77B9EAFF;13000601=5796D5FF;13000701=090A0BFF;14000101=5796D5FF;14000201=5796D5FF;14000301=5796D5FF;14000401=5796D5FF;14000501=5796D5FF;14000601=1B63ABFF;14000701=090A0BFF;15000101=090A0BFF;15000201=090A0BFF;15000301=090A0BFF;15000401=090A0BFF;15000501=090A0BFF;15000601=090A0BFF;15000701=FFFFFF00;16000101=FFFFFF00;16000201=FFFFFF00;16000301=FFFFFF00;16000401=FFFFFF00;16000501=FFFFFF00;16000601=FFFFFF00;16000701=FFFFFF00" local schematicID = storage.weditNextID or 1 storage.weditNextID = schematicID + 1 if not storage.weditSchematics then storage.weditSchematics = {} end storage.weditSchematics[schematicID] = { id = schematicID, copy = copy } local params = controller.spawnOreParameters("WE_Schematic", "^yellow;Primary Fire: Paste Schematic.", "^orange;WEdit: Schematic " .. schematicID, icon, "essential") params.wedit = { schematicID = schematicID } world.spawnItem("triangliumore", mcontroller.position(), 1, params) end end --- Function to paste the schematic tied to this schematic item. -- The link is made through a schematicID, since storing the copy in the actual item causes massive lag. function wedit.actions.WE_Schematic() controller.info("^shadow;^orange;WEdit: Schematic") controller.info("^shadow;^yellow;Primary Fire: Paste Schematic.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: DELETE Schematic.", {0,-2}) controller.info("^shadow;^yellow;The paste area is defined by the bottom left point of your selection.", {0,-3}) if not storage.weditSchematics then return end local schematicID = controller.itemData and controller.itemData.schematicID local schematic local storageSchematicKey for i,v in pairs(storage.weditSchematics) do if v.id == schematicID then schematic = v.copy storageSchematicKey = i goto brk end end ::brk:: if controller.validSelection() and schematicID and schematic then local top = controller.selection[1][2] + schematic.size[2] wedit.debugRenderer:drawRectangle(controller.selection[1], {controller.selection[1][1] + schematic.size[1], top}, "cyan") if top == controller.selection[2][2] then top = controller.selection[2][2] + 1 end wedit.debugRenderer:drawText("^shadow;WEdit Schematic Paste Area", {controller.selection[1][1], top}, "cyan") else controller.info("^shadow;^yellow;No schematic found! Did you delete it?", {0,-4}) end if controller.primaryFire and controller.validSelection() and not controller.fireLocked and schematic then controller.fireLock() local position = {controller.selection[1][1], controller.selection[1][2]} local backup = wedit.paste(schematic, position) if backup then table.insert(controller.backup, backup) end elseif controller.altFire and not controller.fireLocked and schematic then storage.weditSchematics[storageSchematicKey] = nil end end --- Function to replace blocks within the selection with another one. -- Two actions; one to replace all existing blocks and one to replace the block type aimed at. function wedit.actions.WE_Replace() local fgTile, bgTile = world.material(tech.aimPosition(), "foreground"), world.material(tech.aimPosition(), "background") controller.info("^shadow;^orange;WEdit: Replace Tool") controller.info("^shadow;^yellow;Primary Fire: Replace in foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Replace in background.", {0,-2}) controller.info("^shadow;^yellow;Shift + Fire: Replace ALL blocks in layer.", {0,-3}) controller.info("^shadow;^yellow;Replace Block: ^red;" .. controller.blockToString(fgTile) .. "^yellow; / ^red;" .. controller.blockToString(bgTile), {0,-4}) controller.info("^shadow;^yellow;Replace With: ^red;" .. controller.selectedBlockToString() .. "^yellow;.", {0,-5}) if not controller.shiftFireLocked and controller.validSelection() then local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil local tile = layer == "foreground" and fgTile or layer == "background" and bgTile or nil if not tile and not controller.shiftHeld then return end -- To replace air, use fill tool. if layer then controller.shiftFireLock() local backup = wedit.replace(controller.selection[1], controller.selection[2], layer, controller.selectedBlock, not controller.shiftHeld and tile) if backup then table.insert(controller.backup, backup) end end end end --- Function to add modifications to terrain (matmods). function wedit.actions.WE_Modifier() controller.info("^shadow;^orange;WEdit: Modifier") controller.info("^shadow;^yellow;Primary Fire: Modify foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Modify background.", {0,-2}) controller.info("^shadow;^yellow;Shift + Fire: Select mod.", {0,-3}) controller.info("^shadow;^yellow;Current Mod: ^red;" .. controller.getSelectedMod() .. "^yellow;.", {0,-4}) local debugCallback = function(pos) wedit.debugRenderer:drawBlock(pos) end if controller.shiftHeld then if not controller.shiftFireLocked and (controller.primaryFire or controller.altFire) then require "/interface/wedit/matmodPicker/matmodPickerLoader.lua" matmodPickerLoader.initializeConfig() world.sendEntityMessage(entity.id(), "interact", "ScriptPane", matmodPickerLoader.config) controller.shiftFireLock() end elseif not controller.shiftFireLocked then local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil local callback if layer then callback = function(pos) debugCallback(pos) wedit.placeMod(pos, layer, controller.getSelectedMod()) end else callback = debugCallback end if wedit.getUserConfigData("brushShape") == "square" then wedit.rectangle(tech.aimPosition(), wedit.getUserConfigData("matmodSize"), nil, callback) elseif wedit.getUserConfigData("brushShape") == "circle" then wedit.circle(tech.aimPosition(), wedit.getUserConfigData("matmodSize"), callback) end end end --- Function to remove modifications from terrain (matmods). function wedit.actions.WE_ModRemover() controller.info("^shadow;^orange;WEdit: MatMod Remover") controller.info("^shadow;^yellow;Primary Fire: Remove from foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Remove from background.", {0,-2}) local debugCallback = function(pos) wedit.debugRenderer:drawBlock(pos) end local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil local callback if layer then callback = function(pos) debugCallback(pos) wedit.removeMod(pos, layer) end else callback = debugCallback end wedit.debugRenderer:drawBlock(tech.aimPosition()) if not controller.fireLocked then if wedit.getUserConfigData("brushShape") == "square" then wedit.rectangle(tech.aimPosition(), wedit.getUserConfigData("matmodSize"), nil, callback) elseif wedit.getUserConfigData("brushShape") == "circle" then wedit.circle(tech.aimPosition(), wedit.getUserConfigData("matmodSize"), callback) end end end --- Function to spawn a tool similar to the Modifier, dedicated to a single selected material mod. function wedit.actions.WE_ModPinner() controller.info("^shadow;^orange;WEdit: MatMod Pinner") controller.info("^shadow;^yellow;Primary Fire: Pin foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Pin background.", {0,-2}) wedit.debugRenderer:drawBlock(tech.aimPosition()) local fg, bg = world.mod(tech.aimPosition(), "foreground"), world.mod(tech.aimPosition(), "background") if fg then controller.info("^shadow;^yellow;Foreground Mod: ^red;" .. fg .. "^yellow;.", {0,-3}) else controller.info("^shadow;^yellow;Foreground Mod: ^red;None^yellow;.", {0,-3}) end if bg then controller.info("^shadow;^yellow;Background Mod: ^red;" .. bg .. "^yellow;.", {0,-4}) else controller.info("^shadow;^yellow;Background Mod: ^red;None^yellow;.", {0,-4}) end if not controller.fireLocked then if controller.primaryFire or controller.altFire then controller.fireLock() local mod = controller.primaryFire and fg or controller.altFire and bg if not mod then return end local path = "/tiles/mods/" local icon = root.assetJson(path .. mod .. ".matmod").renderParameters.texture .. "?crop=0;0;16;16" icon = controller.fixImagePath(path, icon) local params = controller.spawnOreParameters("WE_Mod", "^yellow;Primary Fire: Modify foreground.\nAlt Fire: Modify background.", "^orange;WEdit: " .. mod .. " MatMod", icon, "essential") params.wedit = { mod = mod } world.spawnItem("triangliumore", mcontroller.position(), 1, params) end end end --- Function to add the material modification of the item under the cursor like the Modifier tool. -- Uses the configured brush type and matmod brush size. function wedit.actions.WE_Mod() controller.info("^shadow;^orange;WEdit: Modifier") controller.info("^shadow;^yellow;Primary Fire: Modify foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Modify background.", {0,-2}) local itemData = controller.itemData if itemData and itemData.mod then controller.info("^shadow;^yellow;Mat Mod: ^red;" .. itemData.mod .. "^yellow;.", {0,-3}) else controller.info("^shadow;^yellow;Mat Mod: ^red;None^yellow;.", {0,-3}) end local debugCallback = function(pos) wedit.debugRenderer:drawBlock(pos) end local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil local callback if controller.selectedBlock ~= nil and layer then callback = function(pos) debugCallback(pos) wedit.placeMod(pos, layer, itemData.mod) end else callback = debugCallback end if wedit.getUserConfigData("brushShape") == "square" then wedit.rectangle(tech.aimPosition(), wedit.getUserConfigData("matmodSize"), nil, callback) elseif wedit.getUserConfigData("brushShape") == "circle" then wedit.circle(tech.aimPosition(), wedit.getUserConfigData("matmodSize"), callback) end end wedit.ruler = {} --- Function to draw a line of blocks between two selected points function wedit.actions.WE_Ruler() controller.info("^shadow;^orange;WEdit: Ruler") controller.info("^shadow;^yellow;Primary Fire: Fill foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Fill background.", {0,-2}) controller.info("^shadow;^yellow;Shift + Primary Fire: Create line.", {0,-3}) controller.info("^shadow;^yellow;Shift + Alt Fire: Clear line.", {0,-4}) controller.info("^shadow;^yellow;Current Block: ^red;" .. controller.selectedBlockToString() .. "^yellow;.", {0,-5}) local line = controller.lineSelection -- Draw line if not wedit.ruler.selecting and controller.shiftHeld and controller.primaryFire and not controller.shiftFireLocked then controller.shiftFireLock() -- Set first point line[1] = tech.aimPosition() line[2] = {} -- Start selecting second point wedit.ruler.selecting = true wedit.ruler.bindA = Bind.create("primaryFire", function() -- Dragging selection; update second point. line[2] = tech.aimPosition() -- Round each value down. line[1][1] = math.floor(line[1][1]) line[2][1] = math.floor(line[2][1]) line[1][2] = math.floor(line[1][2]) line[2][2] = math.floor(line[2][2]) end, true) wedit.ruler.bindB = Bind.create("primaryFire=false", function() wedit.ruler.bindA:unbind() wedit.ruler.bindA = nil wedit.ruler.bindB:unbind() wedit.ruler.bindB = nil wedit.ruler.selecting = false end) end -- Fill / Clear line if not controller.shiftFireLocked and not wedit.ruler.selecting then if controller.shiftHeld and controller.altFire then -- Clear line controller.shiftFireLock() controller.lineSelection = {{},{}} elseif not controller.shiftHeld then -- Fill line local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil if layer and controller.validLine() then controller.shiftFireLock() wedit.line(line[1], line[2], controller.primaryFire and "foreground" or "background", controller.selectedBlockToString()) end end end -- Draw information if controller.validLine() then -- Draw boxes around every block in the current selection. wedit.bresenham(line[1], line[2], function(x, y) world.debugLine({x, y}, {x + 1, y}, "green") world.debugLine({x, y + 1}, {x + 1, y + 1}, "green") world.debugLine({x, y}, {x, y + 1}, "green") world.debugLine({x + 1, y}, {x + 1, y + 1}, "green") end) -- Calculate line length for display local w, h = math.abs(line[1][1] - line[2][1]) + 1, math.abs(line[1][2] - line[2][2]) + 1 local length = w > h and w or h controller.info("^shadow;^yellow;Current Length: ^red;" .. length .. " ^yellow;blocks ^red;(" .. w .. "x" .. h .. ")^yellow;.", {0,-6}) end end --- Function to remove all liquid(s) in the selection. function wedit.actions.WE_Dehydrator() controller.info("^shadow;^orange;WEdit: Dehydrator") controller.info("^shadow;^yellow;Primary Fire: Dehydrate selection.", {0,-1}) if not controller.fireLocked and controller.primaryFire and controller.validSelection() then controller.fireLock() wedit.drain(controller.selection[1], controller.selection[2]) end end --- Function to fill the selection with a liquid. function wedit.actions.WE_Hydrator() controller.info("^shadow;^orange;WEdit: Hydrator") controller.info("^shadow;^yellow;Primary Fire: Fill selection.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Select liquid.", {0,-2}) controller.info("^shadow;^yellow;Current Liquid: ^red;" .. controller.liquid.name .. "^yellow;.", {0,-3}) if not controller.fireLocked then if controller.primaryFire and controller.validSelection() then wedit.hydrate(controller.selection[1], controller.selection[2], controller.liquid.liquidId) controller.fireLock() elseif controller.altFire then require "/interface/wedit/liquidPicker/liquidPickerLoader.lua" liquidPickerLoader.initializeConfig() world.sendEntityMessage(entity.id(), "interact", "ScriptPane", liquidPickerLoader.config) controller.fireLock() end end end --- Function to obtain all WEdit Tools. -- Uses controller.colors to color the names and descriptions of the tools. function wedit.actions.WE_ItemBox() controller.info("^shadow;^orange;WEdit: Item Box") controller.info("^shadow;^yellow;Primary Fire: Spawn Tools.", {0,-1}) if not controller.fireLocked and controller.primaryFire then controller.fireLock() local items = root.assetJson("/wedit/items.json") for i=1,#items do local item = items[i] if item.parameters.category then item.parameters.category = item.parameters.category:gsub("%^orange;", controller.colors[1]) end if item.parameters.description then item.parameters.description = item.parameters.description:gsub("%^yellow;", controller.colors[2]) end world.spawnItem(item, mcontroller.position()) end end end --- Function used to dye materials. function wedit.actions.WE_Dye() controller.info("^shadow;^orange;WEdit: Dye Tool") controller.info("^shadow;^yellow;Primary Fire: Dye foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Dye background.", {0,-2}) controller.info("^shadow;^yellow;Shift + Fire: Open Dye Picker.", {0,-3}) local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil local colorIndex = dyePickerUtil.getColorIndex(dyePickerUtil.getSerializedColor()) or 0 if controller.shiftHeld then if not controller.shiftFireLocked and (controller.primaryFire or controller.altFire) then world.sendEntityMessage(entity.id(), "interact", "ScriptPane", "/interface/wedit/dyePicker/dyePicker.config") controller.shiftFireLock() end elseif not controller.shiftFireLocked then local callback = function(pos) wedit.debugRenderer:drawBlock(pos) if layer then wedit.dye(pos, layer, colorIndex) end end if wedit.getUserConfigData("brushShape") == "square" then wedit.rectangle(tech.aimPosition(), wedit.getUserConfigData("pencilSize"), nil, callback) elseif wedit.getUserConfigData("brushShape") == "circle" then wedit.circle(tech.aimPosition(), wedit.getUserConfigData("pencilSize"), callback) end end end function wedit.actions.WE_Hue() controller.info("^shadow;^orange;WEdit: Hue") controller.info("^shadow;^yellow;Primary Fire: Dye foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Dye background.", {0,-2}) controller.info("^shadow;^yellow;Shift + Primary: Copy foreground.", {0,-3}) controller.info("^shadow;^yellow;Shift + Alt: Open interface.", {0,-4}) local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil local hue = huePickerUtil.getSerializedHue() or 0 controller.info("^shadow;^yellow;Current hue: ^red;" .. hue .. "^yellow;.", {0,-5}) if controller.shiftHeld then if not controller.shiftFireLocked and controller.altFire then world.sendEntityMessage(entity.id(), "interact", "ScriptPane", "/interface/wedit/huePicker/huePicker.config") controller.shiftFireLock() elseif controller.primaryFire then local hue = world.materialHueShift(tech.aimPosition(), "foreground") if hue then huePickerUtil.serializeHue(hue) world.sendEntityMessage(entity.id(), "wedit_hueChanged") end end elseif not controller.shiftFireLocked then local callback = function(pos) wedit.debugRenderer:drawBlock(pos) if layer then local block = world.material(pos, layer) local blockHue = world.materialHueShift(pos, layer) if block and hue ~= blockHue then wedit.pencil(pos, layer, block, hue, true) end end end if wedit.getUserConfigData("brushShape") == "square" then wedit.rectangle(tech.aimPosition(), wedit.getUserConfigData("pencilSize"), nil, callback) elseif wedit.getUserConfigData("brushShape") == "circle" then wedit.circle(tech.aimPosition(), wedit.getUserConfigData("pencilSize"), callback) end end end function wedit.actions.WE_RandomFill() controller.info("^shadow;^orange;WEdit: Random fill") controller.info("^shadow;^yellow;Primary Fire: Fill foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Fill background.", {0,-2}) controller.info("^shadow;^yellow;Shift + Fire: Open interface.", {0,-3}) local perc = randomPickerUtil.getSerializedPercentage() or 0 local hue = huePickerUtil.getSerializedHue() or 0 controller.info("^shadow;^yellow;Current percentage: ^red;" .. perc .. "^yellow;.", {0,-4}) controller.info("^shadow;^yellow;Current block: ^red;" .. controller.selectedBlockToString() .. "^yellow;.", {0,-5}) controller.info("^shadow;^yellow;Current hue: ^red;" .. hue .. "^yellow;.", {0,-6}) local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil if controller.shiftHeld then if not controller.shiftFireLocked and (controller.primaryFire or controller.altFire) then world.sendEntityMessage(entity.id(), "interact", "ScriptPane", "/interface/wedit/randomPicker/randomPicker.config") controller.shiftFireLock() end elseif not controller.shiftFireLocked and layer and controller.validSelection() then controller.shiftFireLock() if layer then wedit.random(controller.selection[1], controller.selection[2], perc, function(pos) if (not not controller.selectedBlock) ~= (not not world.material(pos, layer)) then wedit.pencil(pos, layer, controller.selectedBlock, hue, true) end end) end end end function wedit.actions.WE_RandomPencil() controller.info("^shadow;^orange;WEdit: Random pencil") controller.info("^shadow;^yellow;Primary Fire: Draw on foreground.", {0,-1}) controller.info("^shadow;^yellow;Alt Fire: Draw on background.", {0,-2}) controller.info("^shadow;^yellow;Shift + Fire: Open interface.", {0,-3}) local perc = randomPickerUtil.getSerializedPercentage() or 0 local hue = huePickerUtil.getSerializedHue() or 0 controller.info("^shadow;^yellow;Current percentage: ^red;" .. perc .. "^yellow;.", {0,-4}) controller.info("^shadow;^yellow;Current block: ^red;" .. controller.selectedBlockToString() .. "^yellow;.", {0,-5}) controller.info("^shadow;^yellow;Current hue: ^red;" .. hue .. "^yellow;.", {0,-6}) local layer = controller.primaryFire and "foreground" or controller.altFire and "background" or nil if controller.shiftHeld then if not controller.shiftFireLocked and (controller.primaryFire or controller.altFire) then world.sendEntityMessage(entity.id(), "interact", "ScriptPane", "/interface/wedit/randomPicker/randomPicker.config") controller.shiftFireLock() end elseif not controller.shiftFireLocked then if layer then controller.shiftFireLock() end local callback = function(pos) wedit.debugRenderer:drawBlock(pos) if layer then local n = math.random(1, 100) if n <= perc then local mat = world.material(pos, layer) if not mat or not controller.selectedBlock then sb.logInfo("n %s perc %s", n, perc) wedit.pencil(pos, layer, controller.selectedBlock, hue, true) end end end end if wedit.getUserConfigData("brushShape") == "square" then wedit.rectangle(tech.aimPosition(), wedit.getUserConfigData("pencilSize"), nil, callback) elseif wedit.getUserConfigData("brushShape") == "circle" then wedit.circle(tech.aimPosition(), wedit.getUserConfigData("pencilSize"), callback) end end end function wedit.actions.WE_Calibrate() controller.info("^shadow;^orange;WEdit: Calibrator") controller.info("^shadow;^yellow;Primary Fire: Calibrate delay.", {0,-1}) controller.info("^shadow;^yellow;Make sure the highlighted block is", {0,-2}) controller.info("^shadow;^yellow;empty and has a background block.", {0,-3}) local aimPos = tech.aimPosition() wedit.debugRenderer:drawBlock(aimPos, "green") if not controller.fireLocked and controller.primaryFire then controller.fireLock() wedit.calibrate(aimPos) end end
---@class CovenantPreview C_CovenantPreview = {} function C_CovenantPreview.CloseFromUI() end ---@param playerChoiceResponseID number ---@return CovenantPreviewInfo previewInfo function C_CovenantPreview.GetCovenantInfoForPlayerChoiceResponseID(playerChoiceResponseID) end ---@class CovenantAbilityType local CovenantAbilityType = {} CovenantAbilityType.Class = 0 CovenantAbilityType.Signature = 1 CovenantAbilityType.Soulbind = 2 ---@class CovenantAbilityInfo ---@field spellID number ---@field type CovenantAbilityType local CovenantAbilityInfo = {} ---@class CovenantFeatureInfo ---@field name string ---@field description string ---@field texture number local CovenantFeatureInfo = {} ---@class CovenantPreviewInfo ---@field textureKit string ---@field transmogSetID number ---@field mountID number ---@field covenantName string ---@field covenantZone string ---@field description string ---@field covenantCrest string ---@field covenantAbilities table ---@field fromPlayerChoice bool ---@field covenantSoulbinds table ---@field featureInfo CovenantFeatureInfo local CovenantPreviewInfo = {} ---@class CovenantSoulbindInfo ---@field spellID number ---@field uiTextureKit string ---@field name string ---@field description string ---@field sortOrder number local CovenantSoulbindInfo = {}
dirt = {} dirt.blocks = {} -- todo: add breakability to breakable blocks function dirt:load() dirt.spr = love.graphics.newImage("/assets/dirt.png") dirt:new(-2, -2) dirt:new(4, 4) dirt:new(-5, -10) dirt:new(5, -9) dirt:new(-3, 9) dirt:new(12, 3) dirt:new(4,2,0) end function dirt:new(x, y) x = x * 16 y = y * 16 w = 16 h = 16 local structure = {} structure.body = love.physics.newBody(world.world, x, y) structure.shape = love.physics.newRectangleShape(w, h) structure.fixture = love.physics.newFixture(structure.body, structure.shape) structure.y = y structure.x = x structure.w = w structure.h = h structure.fixture:setUserData("dirt") table.insert(self.blocks, structure) end function dirt:update(dt) end function dirt:draw() for i in ipairs(self.blocks) do love.graphics.polygon("fill", self.blocks[i].body:getWorldPoints(self.blocks[i].shape:getPoints())) local xStart = self.blocks[i].x - (self.blocks[i].w / 2) local yStart = self.blocks[i].y - (self.blocks[i].h / 2) love.graphics.draw(self.spr, xStart, yStart, 0, 1, 1) end end
------------------------------------------------------------------------------------------------------------------------ -- Proposal: -- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0192-button_subscription_response_from_hmi.md ------------------------------------------------------------------------------------------------------------------------ -- Description: Check that SDL responds with resultCode "UNSUPPORTED_RESOURCE" to SubscribeButton request -- if <button> is not supported by HMI ------------------------------------------------------------------------------------------------------------------------ -- In case: -- 1. <button> is not present in capabilities -- 2. Mobile app requests SubscribeButton(<button>) -- SDL does: -- - not transfer `Buttons.SubscribeButton` request to HMI -- - respond SubscribeButton(UNSUPPORTED_RESOURCE) to mobile app -- - not send OnHashChange with updated hashId to mobile app -- In case: -- 3. HMI sends OnButtonEvent and OnButtonPress notifications for <button> -- SDL does: -- - not transfer OnButtonEvent and OnButtonPress to App ------------------------------------------------------------------------------------------------------------------------ --[[ Required Shared libraries ]] local common = require('test_scripts/API/ButtonSubscription/commonButtonSubscription') --[[ Local Variables ]] local appSessionId1 = 1 local errorCode = "UNSUPPORTED_RESOURCE" --[[ Scenario ]] for _, buttonName in common.spairs(common.buttons) do common.runner.Title("ButtonName parameter: " .. buttonName) common.runner.Title("Preconditions") common.runner.Step("Clean environment", common.preconditions) common.runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { common.removeButtonFromCapabilities(buttonName) }) common.runner.Step("App registration", common.registerAppWOPTU) common.runner.Step("App activation", common.activateApp) common.runner.Title("Test") common.runner.Step("SubscribeButton without capabilities on " .. buttonName, common.rpcUnsuccess, { appSessionId1, "SubscribeButton", buttonName, errorCode }) common.runner.Step("Button ".. buttonName .. " wasn't Subscribed", common.buttonPress, { appSessionId1, buttonName, common.isNotExpected }) common.runner.Title("Postconditions") common.runner.Step("Stop SDL", common.postconditions) end
return function(gravity) return function(scene, dt) for entity in pairs(scene:entities_with('has_mass', 'velocity')) do entity.velocity.y = entity.velocity.y + gravity * dt end end end
solution "sdl2-tetris" location "../build" configurations { "Debug", "Dev", "Release" } platforms { "native", "x32", "x64" } project "sdl2-tetris" location "../build" kind "ConsoleApp" language "C++" files { "../src/**.h", "../src/**.cpp" } flags { "ExtraWarnings", "FatalWarnings" } links { "SDL2_ttf" } -- not in the string returned by `sdl2-config --links` debugdir "../data" -- debugger working directory. Not implemented for Xcode so use must set manually. configuration "Debug" defines { "DEBUG" } flags { "Symbols" } targetdir "../bin/debug" configuration "Dev" flags { "Optimize", "Symbols" } targetdir "../bin/dev" configuration "Release" defines { "NDEBUG", "RELEASE" } flags { "Optimize" } targetdir "../bin/release" configuration "windows" -- There is a single SDLmain.lib that is built against the Multi-threaded DLL (/MD) i.e. there is no debug lib built against Multi-threaded Debug DLL (/MD flags { "ReleaseRuntime" } includedirs { "../3rdparty/SDL2-2.0.3/include" } includedirs { "../3rdparty/SDL2_ttf-2.0.12/include" } links { "SDL2", "SDL2main" } -- Disable compiler warnings. These end up in the Project Settings -> C/C++ -> Command Line -> Additional Options, rather than C/C++ -> Advanced -> Disable Specific Warnings buildoptions { "/wd4127" } -- conditional expression is constant buildoptions { "/wd4505" } -- unreferenced local function has been removed configuration { "windows", "not x64" } libdirs { "../3rdparty/SDL2-2.0.3/lib/x86" } libdirs { "../3rdparty/SDL2_ttf-2.0.12/lib/x86" } postbuildcommands { "copy ..\\3rdparty\\SDL2-2.0.3\\lib\\x86\\*.dll ..\\bin\\$(ConfigurationName)", "copy ..\\3rdparty\\SDL2_ttf-2.0.12\\lib\\x86\\*.dll ..\\bin\\$(ConfigurationName)" } configuration { "windows", "x64" } libdirs { "../3rdparty/SDL2-2.0.3/lib/x64" } libdirs { "../3rdparty/SDL2_ttf-2.0.12/lib/x64" } postbuildcommands { "copy ..\\3rdparty\\SDL2-2.0.3\\lib\\x64\\*.dll ..\\bin\\$(ConfigurationName)", "copy ..\\3rdparty\\SDL2_ttf-2.0.12\\lib\\x64\\*.dll ..\\bin\\$(ConfigurationName)" } configuration "linux" buildoptions { "-std=c++0x" } buildoptions { "-Wno-switch" } buildoptions { "-Wno-unused-function" } buildoptions { "-Wno-missing-field-initializers" } buildoptions { "-Wno-missing-braces" } buildoptions { "`sdl2-config --cflags`" } -- magic quotes are shell-dependent linkoptions { "`sdl2-config --libs`" } -- magic quotes are shell-dependent libdirs { "/opt/vc/lib" } -- really just Raspberry Pi only (VideoCore) links { "EGL", "GLESv2" } configuration "macosx" buildoptions { "-std=c++11" } buildoptions { "-Wno-unused-function" } buildoptions { "-Wno-missing-braces" } configuration { "macosx", "xcode*" } if os.get() == "macosx" then buildoptions { os.outputof("sdl2-config --cflags") } -- magic quotes are no good for Xcode so can't use `sdl2-config --cflags` linkoptions { os.outputof("sdl2-config --libs") } end configuration { "macosx", "not xcode*" } buildoptions { "`sdl2-config --cflags`" } -- magic quotes are no good for Xcode linkoptions { "`sdl2-config --libs`" } newaction { trigger = "clean", shortname = "clean", description = "Removes generated files." } if _ACTION == "clean" then os.rmdir("../bin") if os.get() == "windows" then os.outputof("rmdir ..\\build\\.vs /s /q") -- remove the hidden .vs directory end if os.get() == "macosx" then os.outputof("rm -rf build") -- remove the build folder, including hidden .DS_Store file end os.rmdir("../build") end
local c = require "hive.core" local system_cell = assert(package.searchpath("hive.system", package.path),"system cell was not found") local hive = {} function hive.start(t) local main = assert(package.searchpath(t.main, package.path), "main cell was not found") return c.start(t, system_cell, main) end return hive
object_mobile_tusken_m_greeter = object_mobile_shared_tusken_m_greeter:new { } ObjectTemplates:addTemplate(object_mobile_tusken_m_greeter, "object/mobile/tusken_m_greeter.iff")
--[[ =============================================================================== ** SceneTitle v1.0 ** By Lysferd (C) 2014 Summary: Manages the title screen. Features: - ... ToDos: - ... =============================================================================== --]] require( 'lua.map.menu' ) SceneTitle = { } SceneTitle.__index = SceneTitle function SceneTitle.new() local obj = setmetatable( { }, SceneTitle ) obj.name = 'title' obj.font = love.graphics.newFont( 24 ) return obj end function SceneTitle:update() end function SceneTitle:draw() end function SceneTitle:terminate() -- body end function SceneTitle:keypressed( ... ) end function SceneTitle:mousepressed( ... ) end
function GetCargoColonistSpecializationItems() local items = {} for id, entry in pairs(const.ColonistSpecialization) do items[#items+1] = {id = id, sort_key = entry.sort_key, name = entry.display_name_plural} end table.sortby_field(items, "sort_key") return items end DefineClass.CargoItem = { __parents = { "InitDone" }, type = CargoType.Unknown, id = false, name = false, } function CargoItem:__tostring() return self.id and self.id end DefineClass.CargoRequestItem = { __parents = { "CargoItem" }, submenu = false, destination_requested = 0, destination_available = 0, origin_requested = 0, origin_available = 0, predicted_request = 0, } DefineClass.CargoRequest = { __parents = { "InitDone" }, submenu_rollovers = { prefabs = { title = T(1110, "Prefab Buildings"), descr = T(1111, "Prefabricated parts needed for the construction of certain buildings on Mars."), hint = T(1112, "<left_click> Browse Prefab Buildings"), gamepad_hint = T(1113, "<ButtonA> Browse Prefab Buildings"), }, vehicles = { title = T(13676, "RC Vehicles"), descr = T(13677, "Remote Controlled vehicles that have been designed to perform various tasks."), hint = T(13678, "<left_click> Browse RC Vehicles"), gamepad_hint = T(13679, "<ButtonA> Browse RC Vehicles"), }, colonists = { title = T(547, "Colonists"), descr = T(13680, "Inhabitants of the Mars colony. Specialized in a variety of fields."), hint = T(13681, "<left_click> Browse Colonists"), gamepad_hint = T(13682, "<ButtonA> Browse Colonists"), } }, transporter = false, cargo_items = false, cargo_type_items = false, cargo_type_totals = false, top_level_items = false, cargo_weight_limit = 0, passenger_limit = 0, destination_weight_requested = 0, auto_mode = false, } function CargoRequest:IsTwoWayRequest() return false end function CargoRequest:HasAutoMode() return self.has_auto_mode end function CargoRequest:GetAutoMode() return self.auto_mode end function CargoRequest:SetAutoMode(mode) if self.auto_mode ~= mode then self.auto_mode = mode self:ClearRequests(true) self:RetrieveRequests(self.auto_mode) ObjModified(self) end end function CargoRequest:GetCargoWeightCapacityLimit() return self.cargo_weight_limit end function CargoRequest:GetCargoWeightCapacityRequested() return self.destination_weight_requested end function CargoRequest:GetPassengersRequested() local colonists = self.cargo_type_totals[CargoType.Colonist] return colonists and colonists.destination_requested or 0 end function CargoRequest:GetPassengersLimit() return self.passenger_limit end function CargoRequest:GetTransportableCargo(transporter) local cargo_items = {} local cargo_type_items = {} if transporter:CanTransportCargoType(CargoType.Prefab) then cargo_type_items[CargoType.Prefab] = {} local prefab_items = cargo_type_items[CargoType.Prefab] local prefabs = transporter:GetTransportablePrefabs() table.sort(prefabs, PresetSortLessCb) for _, prefab in ipairs(prefabs) do local cargo_item = CargoRequestItem:new{ type=CargoType.Prefab, id=prefab.id, name=prefab.name } cargo_items[prefab.id] = cargo_item prefab_items[#prefab_items+1] = cargo_item end end if transporter:CanTransportCargoType(CargoType.Colonist) then cargo_type_items[CargoType.Colonist] = {} local colonists_items = cargo_type_items[CargoType.Colonist] local colonists = GetCargoColonistSpecializationItems() for _, colonist in ipairs(colonists) do local cargo_item = CargoRequestItem:new{ type=CargoType.Colonist, id=colonist.id, name=colonist.name } cargo_items[colonist.id] = cargo_item colonists_items[#colonists_items+1] = cargo_item end end if transporter:CanTransportCargoType(CargoType.Rover) then cargo_type_items[CargoType.Rover] = {} local rover_items = cargo_type_items[CargoType.Rover] local vehicles = transporter:GetTransportableVehicles() table.sort(vehicles, PresetSortLessCb) for _, vehicle in ipairs(vehicles) do local cargo_item = CargoRequestItem:new{ type=CargoType.Rover, id=vehicle.id, name=vehicle.name } cargo_items[vehicle.id] = cargo_item rover_items[#rover_items+1] = cargo_item end end if transporter:CanTransportCargoType(CargoType.Drone) then local drone_item = CargoRequestItem:new{ type=CargoType.Drone, id="Drone", name=T(517, "Drones") } cargo_items[drone_item.id] = drone_item cargo_type_items[CargoType.Drone] = { drone_item } end if transporter:CanTransportCargoType(CargoType.Resource) then cargo_type_items[CargoType.Resource] = {} local resource_items = cargo_type_items[CargoType.Resource] for k, item in ipairs(ResupplyItemDefinitions) do if (not item.filter or item.filter()) and IsResupplyItemAvailable(item.id) then local id = item.id local cargo_type = GetCargoType(id) if cargo_type == CargoType.Resource then local cargo_item = CargoRequestItem:new{ type=cargo_type, id=item.id, name=item.name } cargo_items[item.id] = cargo_item resource_items[#resource_items+1] = cargo_item end end end end return cargo_items, cargo_type_items end function CargoRequest:Init() assert(self.transporter) local transporter = self.transporter self.cargo_weight_limit = transporter:GetCargoWeightCapacity() self.passenger_limit = transporter:GetPassengerCapacity() self.has_auto_mode = transporter:HasAutoMode() self.auto_mode = transporter:IsAutoModeEnabled() self.cargo_items, self.cargo_type_items = self:GetTransportableCargo(transporter) self.cargo_type_totals = {} local cargo_type_totals = self.cargo_type_totals cargo_type_totals[CargoType.Prefab] = CargoRequestItem:new{type=CargoType.Prefab, id = "prefabs", name=T(1109, "Prefab Buildings"), submenu = true,} cargo_type_totals[CargoType.Colonist] = CargoRequestItem:new{type=CargoType.Colonist, id = "colonists", name=T(547, "Colonists"), submenu = true,} cargo_type_totals[CargoType.Rover] = CargoRequestItem:new{type=CargoType.Rover, id = "vehicles", name=T(13676, "RC Vehicles"), submenu = true,} cargo_type_totals[CargoType.Drone] = self.cargo_items["Drone"] cargo_type_totals[CargoType.Resource] = CargoRequestItem:new{type=CargoType.Resource, id = "Resource", name=T(692, "Resources")} self:RetrieveCargoInfo() self:RetrieveRequests(self:GetAutoMode()) self:InitTopLevelItems() end function CargoRequest:InitTopLevelItems() self.top_level_items = {} local top_level_items = self.top_level_items local cargo_type_items = self.cargo_type_items local cargo_type_totals = self.cargo_type_totals if cargo_type_items[CargoType.Prefab] then top_level_items[#top_level_items+1] = cargo_type_totals[CargoType.Prefab] end if cargo_type_items[CargoType.Colonist] then top_level_items[#top_level_items+1] = cargo_type_totals[CargoType.Colonist] end if cargo_type_items[CargoType.Rover] then top_level_items[#top_level_items+1] = cargo_type_totals[CargoType.Rover] end if cargo_type_items[CargoType.Drone] then top_level_items[#top_level_items+1] = cargo_type_totals[CargoType.Drone] end if cargo_type_items[CargoType.Resource] then local resources = cargo_type_items[CargoType.Resource] for _, resource in ipairs(resources) do top_level_items[#top_level_items+1] = resource end end end function CargoRequest:RetrieveRequests(is_automode) local destination_requests = self.transporter.cargo or empty_table for id, request in pairs(destination_requests) do self:SetDestinationRequest(id, request.requested, true) end end function CargoRequest:RetrieveCargoInfo() local origin_map_id = self.transporter:GetCargoOriginMapID() local origin_city = Cities[origin_map_id] local destination_map_id = self.transporter:GetCargoDestinationMapID() local destination_city = Cities[destination_map_id] for cargo_type, cargo_items in pairs(self.cargo_type_items) do local destination_total = 0 local origin_total = 0 for _, cargo_item in pairs(cargo_items) do local origin_available = origin_city and GetTotalCargoAvailable(origin_city, cargo_item.type, cargo_item.id) or 0 local destination_available = destination_city and GetTotalCargoAvailable(destination_city, cargo_item.type, cargo_item.id) or 0 origin_total = origin_total + origin_available destination_total = destination_total + destination_available cargo_item.origin_available = origin_available cargo_item.destination_available = destination_available end local type_total = self.cargo_type_totals[cargo_type] if type_total then type_total.origin_available = origin_total type_total.destination_available = destination_total end end end function CargoRequest:ClearRequests(silent) for id, item in pairs(self.cargo_items) do item.destination_requested = 0 item.origin_requested = 0 item.predicted_request = 0 end for id, item in pairs(self.cargo_type_totals) do item.destination_requested = 0 item.origin_requested = 0 item.predicted_request = 0 end self.destination_weight_requested = 0 if not silent then ObjModified(self) end end function CargoRequest:GetDestinationRequest(id, fallback) local cargo_item = self.cargo_items[id] return cargo_item and cargo_item.destination_requested or (fallback or 0) end function CargoRequest:SetDestinationRequest(id, amount, silent) local cargo_item = self.cargo_items[id] -- assert(cargo_item) if not cargo_item then return end local delta = amount - cargo_item.destination_requested if delta ~= 0 then cargo_item.destination_requested = amount local cargo_type_totals = self.cargo_type_totals[cargo_item.type] if cargo_item ~= cargo_type_totals then cargo_type_totals.destination_requested = cargo_type_totals.destination_requested + delta end if cargo_item.type ~= CargoType.Colonist and self.cargo_weight_limit > 0 then local supply_item = GetResupplyItem(id) local item_weight = GetResupplyItemWeight(supply_item) local delta_weight = item_weight * delta self.destination_weight_requested = self.destination_weight_requested + delta_weight end if not silent then ObjModified(self) end return true end return false end function CargoRequest:GetDestinationRequests(cargo_type) local items = self.cargo_type_items[cargo_type] or empty_table local total = #items local counted = {} for _, item in ipairs(items) do counted[item.destination_requested] = (counted[item.destination_requested] or 0) + 1 end return counted, total end function CargoRequest:SetDestinationRequestsWithAmount(cargo_type, with_amount, amount, silent) if with_amount == amount then return false end local items = self.cargo_type_items[cargo_type] or empty_table local changed = false for _, item in ipairs(items) do if not with_amount or item.destination_requested == with_amount then changed = self:SetDestinationRequest(item.id, amount, true) or changed end end if changed and not silent then ObjModified(self) end return changed end function CargoRequest:SetOriginRequest(id, amount, silent) local cargo_item = self.cargo_items[id] -- assert(cargo_item) if not cargo_item then return end local delta = amount - cargo_item.origin_requested if delta ~= 0 then cargo_item.origin_requested = amount local cargo_type_totals = self.cargo_type_totals[cargo_item.type] if cargo_item ~= cargo_type_totals then cargo_type_totals.origin_requested = cargo_type_totals.origin_requested + delta end if not silent then ObjModified(self) end end end function CargoRequest:GetCargoTopLevelItems() return self.top_level_items end function CargoRequest:GetCargoTypeItems(cargo_type) return self.cargo_type_items[cargo_type] or empty_table end function CargoRequest:GetDestinationCargoList() local cargo = {} for id, item in pairs(self.cargo_items) do if item.destination_requested ~= 0 then cargo[id] = { type=item.type, class=id, amount=item.destination_requested } end end return cargo end function CargoRequest:GetOriginCargoList() local cargo = {} for id, item in pairs(self.cargo_items) do if item.origin_requested ~= 0 then cargo[id] = { type=item.type, class=id, amount=item.origin_requested } end end return cargo end function CargoRequest:Cancel() end function CargoRequest:Apply() self.transporter:SetAutoMode(self:GetAutoMode()) self.transporter:UISetCargoRequest(self) end function CargoRequest:CanDestinationRequest(item) if item.type ~= CargoType.Colonist and self.cargo_weight_limit > 0 then local supply_item = GetResupplyItem(item.id) local item_weight = GetResupplyItemWeight(supply_item) local predicted_weight = self.destination_weight_requested + item_weight return predicted_weight <= self.cargo_weight_limit elseif item.type == CargoType.Colonist and self.passenger_limit > 0 then local passengers_requested = self:GetPassengersRequested() return passengers_requested < self.passenger_limit end return true end function CargoRequest:CanOriginRequest(item) return true end function CargoRequest:GetDestinationRequestRemaining(item) if self:GetAutoMode() then return Max(0, item.destination_requested - item.destination_available) else return item.destination_requested end end function CargoRequest:GetOriginRequestRemaining(item) if self:GetAutoMode() then return Max(0, item.origin_requested - item.origin_available) else return item.origin_requested end end function CargoRequest:GetDestinationTransferable(item) return item.destination_available end function CargoRequest:GetOriginTransferable(item) return item.origin_available end function CargoRequest:GetDestinationRequestStatus(item) local status = AvailabilityStatus.Loaded if item.destination_requested > 0 then local origin_map_id = self.transporter:GetCargoOriginMapID() local origin_city = Cities[origin_map_id] local origin_total_pending = GetTotalCargoPending(origin_city, item.id) local origin_transferable = self:GetOriginTransferable(item) local destination_remaining = self:GetDestinationRequestRemaining(item) status = GetAvailabilityStatus(destination_remaining, origin_total_pending, item.origin_available, origin_transferable) end return status end function CargoRequest:GetOriginRequestStatus(item) local status = AvailabilityStatus.Loaded if item.origin_requested > 0 then local destination_map_id = self.transporter:GetCargoDestinationMapID() local destination_city = Cities[destination_map_id] local destination_total_pending = GetTotalCargoPending(destination_city, item.id) local destination_transferable = self:GetDestinationTransferable(item) local origin_remaining = self:GetOriginRequestRemaining(item) status = GetAvailabilityStatus(origin_remaining, destination_total_pending, item.destination_available, destination_transferable) end return status end function CargoRequest:GetRollover(id) if self.prop_meta.submenu then return self.submenu_rollovers[id] end custom_pack_multiplier = custom_pack_multiplier or 1 local item = GetResupplyItem(id) if not item then assert(false, "No such cargo item!") return end local display_name, description = item.name, item.description if not display_name or display_name == "" then display_name, description = ResolveDisplayName(id) end description = (description and description ~= "" and description .. "<newline><newline>") or "" local icon = item.icon and Untranslated("<image "..item.icon.." 2000><newline><newline>") or "" description = icon..description .. T{1114, "Weight: <value> kg<newline>Cost: <funding(cost)>", value = GetResupplyItemWeight(item), cost = GetResupplyItemPrice(item)} return { title = display_name, descr = description, gamepad_hint = T(7580, "<DPadLeft> Change value <DPadRight>"), } end
-- ioctls, filling in as needed -- note there are some architecture dependent values local bit = require "bit" local band = bit.band local function bor(...) local r = bit.bor(...) if r < 0 then r = r + 4294967296LL end return r end local lshift = bit.lshift local rshift = bit.rshift -- include types to get sizes local t = require "syscall.types" local s = t.s local h = require "syscall.helpers" local stringflag = h.stringflag local ffi = require "ffi" local ok, arch = pcall(require, "syscall." .. ffi.arch .. ".ioctl") -- architecture specific definitions if not ok then arch = {} end local ioctl = {} local IOC_NRBITS = 8 local IOC_TYPEBITS = 8 -- Let any architecture override either of the following local IOC_SIZEBITS = arch.IOC_SIZEBITS or 14 local IOC_DIRBITS = arch.IOC_DIRBITS or 2 local IOC_NRMASK = lshift(1, IOC_NRBITS) - 1 local IOC_TYPEMASK = lshift(1, IOC_TYPEBITS) - 1 local IOC_SIZEMASK = lshift(1, IOC_SIZEBITS) - 1 local IOC_DIRMASK = lshift(1, IOC_DIRBITS) - 1 local IOC_NRSHIFT = 0 local IOC_TYPESHIFT = IOC_NRSHIFT + IOC_NRBITS local IOC_SIZESHIFT = IOC_TYPESHIFT + IOC_TYPEBITS local IOC_DIRSHIFT = IOC_SIZESHIFT + IOC_SIZEBITS -- Direction bits, which any architecture can choose to override local IOC_NONE = arch.IOC_NONE or 0 local IOC_WRITE = arch.IOC_WRITE or 1 local IOC_READ = arch.IOC_READ or 2 local IOC_READWRITE = IOC_READ + IOC_WRITE local function _IOC(dir, tp, nr, size) if type(tp) == "string" then tp = tp:byte() end return bor(lshift(dir, IOC_DIRSHIFT), lshift(tp, IOC_TYPESHIFT), lshift(nr, IOC_NRSHIFT), lshift(size, IOC_SIZESHIFT)) end -- used to create numbers local _IO = function(tp, nr) return _IOC(IOC_NONE, tp, nr, 0) end local _IOR = function(tp, nr, size) return _IOC(IOC_READ, tp, nr, size) end local _IOW = function(tp, nr, size) return _IOC(IOC_WRITE, tp, nr, size) end local _IOWR = function(tp, nr, size) return _IOC(IOC_READWRITE, tp, nr, size) end -- used to decode ioctl numbers.. local _IOC_DIR = function(nr) return band(rshift(nr, IOC_DIRSHIFT), IOC_DIRMASK) end local _IOC_TYPE = function(nr) return band(rshift(nr, IOC_TYPESHIFT), IOC_TYPEMASK) end local _IOC_NR = function(nr) return band(rshift(nr, IOC_NRSHIFT), IOC_NRMASK) end local _IOC_SIZE = function(nr) return band(rshift(nr, IOC_SIZESHIFT), IOC_SIZEMASK) end -- ...and for the drivers/sound files... local IOC_IN = lshift(IOC_WRITE, IOC_DIRSHIFT) local IOC_OUT = lshift(IOC_READ, IOC_DIRSHIFT) local IOC_INOUT = lshift(bor(IOC_WRITE, IOC_READ), IOC_DIRSHIFT) local IOCSIZE_MASK = lshift(IOC_SIZEMASK, IOC_SIZESHIFT) local IOCSIZE_SHIFT = IOC_SIZESHIFT local mapname = { _IO = _IO, _IOR = _IOR, _IOW = _IOW, _IOWR = _IOWR, } ioctl.IOCTL = setmetatable({ -- termios, non standard values generally 0x54 = 'T' TCGETS = 0x5401, TCSETS = 0x5402, TCSETSW = 0x5403, TCSETSF = 0x5404, TCGETA = 0x5405, TCSETA = 0x5406, TCSETAW = 0x5407, TCSETAF = 0x5408, TCSBRK = 0x5409, TCXONC = 0x540A, TCFLSH = 0x540B, TIOCEXCL = 0x540C, TIOCNXCL = 0x540D, TIOCSCTTY = 0x540E, TIOCGPGRP = 0x540F, TIOCSPGRP = 0x5410, TIOCOUTQ = 0x5411, TIOCSTI = 0x5412, TIOCGWINSZ = 0x5413, TIOCSWINSZ = 0x5414, TIOCMGET = 0x5415, TIOCMBIS = 0x5416, TIOCMBIC = 0x5417, TIOCMSET = 0x5418, TIOCGSOFTCAR = 0x5419, TIOCSSOFTCAR = 0x541A, FIONREAD = 0x541B, TIOCLINUX = 0x541C, TIOCCONS = 0x541D, TIOCGSERIAL = 0x541E, TIOCSSERIAL = 0x541F, TIOCPKT = 0x5420, FIONBIO = 0x5421, TIOCNOTTY = 0x5422, TIOCSETD = 0x5423, TIOCGETD = 0x5424, TCSBRKP = 0x5425, TIOCSBRK = 0x5427, TIOCCBRK = 0x5428, TIOCGSID = 0x5429, TCGETS2 = _IOR('T', 0x2A, s.termios2), TCSETS2 = _IOW('T', 0x2B, s.termios2), TCSETSW2 = _IOW('T', 0x2C, s.termios2), TCSETSF2 = _IOW('T', 0x2D, s.termios2), TIOCGRS485 = 0x542E, TIOCSRS485 = 0x542F, TIOCGPTN = _IOR('T', 0x30, s.uint), TIOCSPTLCK = _IOW('T', 0x31, s.int), TIOCGDEV = _IOR('T', 0x32, s.uint), TCGETX = 0x5432, TCSETX = 0x5433, TCSETXF = 0x5434, TCSETXW = 0x5435, TIOCSIG = _IOW('T', 0x36, s.int), TIOCVHANGUP = 0x5437, FIONCLEX = 0x5450, FIOCLEX = 0x5451, FIOASYNC = 0x5452, TIOCSERCONFIG = 0x5453, TIOCSERGWILD = 0x5454, TIOCSERSWILD = 0x5455, TIOCGLCKTRMIOS = 0x5456, TIOCSLCKTRMIOS = 0x5457, TIOCSERGSTRUCT = 0x5458, TIOCSERGETLSR = 0x5459, TIOCSERGETMULTI = 0x545A, TIOCSERSETMULTI = 0x545B, TIOCMIWAIT = 0x545C, TIOCGICOUNT = 0x545D, FIOQSIZE = 0x5460, -- network ioctls (from the pre-netlink tools) from linux/sockios.h SIOCGIFINDEX = 0x8933, SIOCBRADDBR = 0x89a0, SIOCBRDELBR = 0x89a1, SIOCBRADDIF = 0x89a2, SIOCBRDELIF = 0x89a3, -- event system EVIOCGVERSION = _IOR('E', 0x01, s.int), EVIOCGID = _IOR('E', 0x02, s.input_id), EVIOCGREP = _IOR('E', 0x03, s.uint2), EVIOCSREP = _IOW('E', 0x03, s.uint2), EVIOCGKEYCODE = _IOR('E', 0x04, s.uint2), EVIOCGKEYCODE_V2 = _IOR('E', 0x04, s.input_keymap_entry), EVIOCSKEYCODE = _IOW('E', 0x04, s.uint2), EVIOCSKEYCODE_V2 = _IOW('E', 0x04, s.input_keymap_entry), EVIOCGNAME = function(len) return _IOC(IOC_READ, 'E', 0x06, len) end, EVIOCGPHYS = function(len) return _IOC(IOC_READ, 'E', 0x07, len) end, EVIOCGUNIQ = function(len) return _IOC(IOC_READ, 'E', 0x08, len) end, EVIOCGPROP = function(len) return _IOC(IOC_READ, 'E', 0x09, len) end, EVIOCGKEY = function(len) return _IOC(IOC_READ, 'E', 0x18, len) end, EVIOCGLED = function(len) return _IOC(IOC_READ, 'E', 0x19, len) end, EVIOCGSND = function(len) return _IOC(IOC_READ, 'E', 0x1a, len) end, EVIOCGSW = function(len) return _IOC(IOC_READ, 'E', 0x1b, len) end, EVIOCGBIT = function(ev, len) return _IOC(IOC_READ, 'E', 0x20 + ev, len) end, EVIOCGABS = function(abs) return _IOR('E', 0x40 + abs, s.input_absinfo) end, EVIOCSABS = function(abs) return _IOW('E', 0xc0 + abs, s.input_absinfo) end, EVIOCSFF = _IOC(IOC_WRITE, 'E', 0x80, s.ff_effect), EVIOCRMFF = _IOW('E', 0x81, s.int), EVIOCGEFFECTS = _IOR('E', 0x84, s.int), EVIOCGRAB = _IOW('E', 0x90, s.int), }, stringflag) for k, v in pairs(arch) do -- arch overrides if type(v) == "table" then v = mapname[v[1]](v[2], v[3], s[v[4]]) end -- some of the ioctls are functions if string.sub(k, 1, 4) ~= "IOC_" then ioctl.IOCTL[k] = v end end -- alternate names ioctl.IOCTL.TIOCINQ = ioctl.IOCTL.FIONREAD -- TODO should we export more functions? return ioctl
-- Input file for advection with auxiliary variables -- polynomial order polyOrder = 1 -- cfl number to use cfl = 0.2/2 -- grid on which equations are to be solved grid = Grid.RectCart2D { lower = {0, 0}, upper = {1.0, 1.0}, cells = {32, 32}, } -- create FEM nodal basis basis = NodalFiniteElement2D.Serendipity { -- grid on which elements should be constructured onGrid = grid, -- polynomial order in each cell. One of 1, or 2. Corresponding -- number of nodes are 4 and 8. polyOrder = polyOrder, } -- number of nodes per cell for CG field numCgNodesPerCell = basis:numExclusiveNodes() -- number of nodes per cell for DG field numDgNodesPerCell = basis:numNodes() -- vorticity chi = DataStruct.Field2D { onGrid = grid, numComponents = 1*numDgNodesPerCell, ghost = {1, 1}, } -- clear out contents chi:clear(0.0) -- extra fields for performing RK update chiNew = DataStruct.Field2D { onGrid = grid, numComponents = 1*numDgNodesPerCell, ghost = {1, 1}, } chi1 = DataStruct.Field2D { onGrid = grid, numComponents = 1*numDgNodesPerCell, ghost = {1, 1}, } -- velocity field flowField = DataStruct.Field2D { onGrid = grid, numComponents = 2*numDgNodesPerCell, -- [ux, uy] ghost = {2, 2}, } -- create updater to initialize potential initFlowField = Updater.EvalOnNodes2D { onGrid = grid, -- basis functions to use basis = basis, -- are common nodes shared? shareCommonNodes = false, -- function to use for initialization evaluate = function (x,y,z,t) return -y+0.5, x-0.5 end } initFlowField:setOut( {flowField} ) -- initialize potential initFlowField:advance(0.0) -- time is irrelevant -- write it out flowField:write("flowField_0.h5") -- create updater to initialize vorticity initChi = Updater.EvalOnNodes2D { onGrid = grid, -- basis functions to use basis = basis, -- are common nodes shared? shareCommonNodes = false, -- In DG, common nodes are not shared -- function to use for initialization evaluate = function (x,y,z,t) local x0, y0, r0 = 0.25, 0.5, 0.15 local r = math.min(math.sqrt((x-x0)^2+(y-y0)^2), r0)/r0 return 0.25*(1+math.cos(Lucee.Pi*r)) end } initChi:setOut( {chi} ) -- initialize potential initChi:advance(0.0) -- time is irrelevant -- write initial value chi:write("chi_0.h5") -- define equation to solve advectionEqn = HyperEquation.AuxAdvection2D { } -- updater to solve hyperbolic equations advectSlvr = Updater.NodalDgHyper2D { onGrid = grid, -- basis functions to use basis = basis, -- equation system to solver equation = advectionEqn, -- CFL number cfl = cfl, } -- function to apply boundary conditions function applyBc(fld) fld:applyCopyBc(0, "lower") fld:applyCopyBc(0, "upper") fld:applyCopyBc(1, "lower") fld:applyCopyBc(1, "upper") end -- apply BCs to initial conditions applyBc(chi) chiNew:copy(chi) function solveAdvection(curr, dt, chiIn, flowIn, chiOut) advectSlvr:setCurrTime(curr) advectSlvr:setIn( {chiIn, flowIn} ) -- flow-field is specified advectSlvr:setOut( {chiOut} ) return advectSlvr:advance(curr+dt) end -- function to take a time-step using SSP-RK3 time-stepping scheme function rk3(tCurr, myDt) local status, dtSuggested -- RK stage 1 (chi1 <- chi + L(chi)) status, dtSuggested = solveAdvection(tCurr, myDt, chi, flowField, chi1) -- check if step failed and return immediately if it did if (status == false) then return status, dtSuggested end -- apply BCs applyBc(chi1) -- RK stage 2 status, dtSuggested = solveAdvection(tCurr, myDt, chi1, flowField, chiNew) -- check if step failed and return immediately if it did if (status == false) then return status, dtSuggested end chi1:combine(3.0/4.0, chi, 1.0/4.0, chiNew) -- apply BCs applyBc(chi1) -- RK stage 3 status, dtSuggested = solveAdvection(tCurr, myDt, chi1, flowField, chiNew) -- check if step failed and return immediately if it did if (status == false) then return status, dtSuggested end chi1:combine(1.0/3.0, chi, 2.0/3.0, chiNew) -- apply BCs applyBc(chi1) -- copy over solution chi:copy(chi1) return status, dtSuggested end -- make a duplicate in case we need it chiDup = chi:duplicate() -- function to advance solution from tStart to tEnd function advanceFrame(tStart, tEnd, initDt) -- declare local variables local step = 1 local tCurr = tStart local myDt = initDt local status, dtSuggested -- main loop while tCurr<=tEnd do -- copy chi over chiDup:copy(chi) -- if needed adjust dt to hit tEnd exactly if (tCurr+myDt > tEnd) then myDt = tEnd-tCurr end print (string.format("Taking step %d at time %g with dt %g", step, tCurr, myDt)) -- take a time-step status, dtSuggested = rk3(tCurr, myDt) if (status == false) then -- time-step too large print (string.format("** Time step %g too large! Will retake with dt %g", myDt, dtSuggested)) -- copy in case current solutions were messed up chi:copy(chiDup) myDt = dtSuggested else tCurr = tCurr + myDt myDt = dtSuggested step = step + 1 -- check if done if (tCurr >= tEnd) then break end end end return dtSuggested end -- parameters to control time-stepping tStart = 0.0 tEnd = 2*Lucee.Pi dtSuggested = 0.1*tEnd -- initial time-step to use (will be adjusted) nFrames = 1 tFrame = (tEnd-tStart)/nFrames -- time between frames tCurr = tStart for frame = 1, nFrames do Lucee.logInfo (string.format("-- Advancing solution from %g to %g", tCurr, tCurr+tFrame)) -- advance solution between frames dtSuggested = advanceFrame(tCurr, tCurr+tFrame, dtSuggested) -- write out data chi:write( string.format("chi_%d.h5", frame) ) tCurr = tCurr+tFrame Lucee.logInfo ("") end
local o = WardrobeHelper if o.customCategories == nil then o.customCategories = {} end local c = o.customCategories --------------------------------------------------------------- -- Tier 6 - Normal --------------------------------------------------------------- c["Tier 6"] = {} c["Tier 6"]["#allSources"] = true c["Tier 6"]["Normal"] = {} c["Tier 6"]["Normal"][LOCALIZED_CLASS_NAMES_MALE["DRUID"]] = { { id = 31040, visualID = 8087, }, { id = 31049, visualID = 8091, }, { id = 31043, visualID = 8088, }, { id = 34446, visualID = 8962, }, { id = 31035, visualID = 8086, }, { id = 34555, visualID = 9000, }, { id = 31046, visualID = 8089, }, { id = 34572, visualID = 9009, }, } c["Tier 6"]["Normal"][LOCALIZED_CLASS_NAMES_MALE["HUNTER"]] = { { id = 31003, visualID = 8070, }, { id = 31006, visualID = 8073, }, { id = 31004, visualID = 8071, }, { id = 34443, visualID = 8961, }, { id = 31001, visualID = 8069, }, { id = 34549, visualID = 8997, }, { id = 31005, visualID = 8072, }, { id = 34570, visualID = 9008, }, } c["Tier 6"]["Normal"][LOCALIZED_CLASS_NAMES_MALE["MAGE"]] = { { id = 31056, visualID = 8098, }, { id = 31059, visualID = 8101, }, { id = 31057, visualID = 8099, }, { id = 34447, visualID = 8963, }, { id = 31055, visualID = 8097, }, { id = 34557, visualID = 9001, }, { id = 31058, visualID = 8100, }, { id = 34574, visualID = 9010, }, } c["Tier 6"]["Normal"][LOCALIZED_CLASS_NAMES_MALE["PALADIN"]] = { { id = 30988, visualID = 8064, }, { id = 30996, visualID = 8067, }, { id = 30992, visualID = 8065, }, { id = 34432, visualID = 8956, }, { id = 30983, visualID = 8063, }, { id = 34487, visualID = 8975, }, { id = 30994, visualID = 8066, }, { id = 34559, visualID = 9003, }, } c["Tier 6"]["Normal"][LOCALIZED_CLASS_NAMES_MALE["PRIEST"]] = { { id = 31063, visualID = 8104, }, { id = 31069, visualID = 8107, }, { id = 31066, visualID = 8105, }, { id = 34435, visualID = 8957, }, { id = 31060, visualID = 8102, }, { id = 34527, visualID = 8989, }, { id = 31068, visualID = 8106, }, { id = 34562, visualID = 9004, }, } c["Tier 6"]["Normal"][LOCALIZED_CLASS_NAMES_MALE["ROGUE"]] = { { id = 31027, visualID = 8082, }, { id = 31030, visualID = 8085, }, { id = 31028, visualID = 8083, }, { id = 34448, visualID = 8964, }, { id = 31026, visualID = 8081, }, { id = 34558, visualID = 9002, }, { id = 31029, visualID = 8084, }, { id = 34575, visualID = 9011, }, } c["Tier 6"]["Normal"][LOCALIZED_CLASS_NAMES_MALE["SHAMAN"]] = { { id = 31014, visualID = 8076, }, { id = 31023, visualID = 8080, }, { id = 31017, visualID = 8078, }, { id = 34437, visualID = 8959, }, { id = 31008, visualID = 8074, }, { id = 34542, visualID = 8995, }, { id = 31020, visualID = 8079, }, { id = 34566, visualID = 9006, }, } c["Tier 6"]["Normal"][LOCALIZED_CLASS_NAMES_MALE["WARLOCK"]] = { { id = 31051, visualID = 8093, }, { id = 31054, visualID = 8096, }, { id = 31052, visualID = 8094, }, { id = 34436, visualID = 8958, }, { id = 31050, visualID = 8092, }, { id = 34541, visualID = 8994, }, { id = 31053, visualID = 8095, }, { id = 34564, visualID = 9005, }, } c["Tier 6"]["Normal"][LOCALIZED_CLASS_NAMES_MALE["WARRIOR"]] = { { id = 30972, visualID = 8059, }, { id = 30979, visualID = 8062, }, { id = 30975, visualID = 8060, }, { id = 34441, visualID = 8960, }, { id = 30969, visualID = 8058, }, { id = 34546, visualID = 8996, }, { id = 30977, visualID = 8061, }, { id = 34569, visualID = 9007, }, }
-- Main logic taken from Valve's Slitbreaker dungeon files -- Reformatted for DotA IMBA by: -- AltiV - March 15th, 2019 ---------------------------- -- WAND OF THE BRINE FILE -- ---------------------------- item_imba_wand_of_the_brine = class({}) LinkLuaModifier( "modifier_item_imba_wand_of_the_brine", "components/items/item_wand_of_the_brine", LUA_MODIFIER_MOTION_NONE ) LinkLuaModifier( "modifier_item_imba_wand_of_the_brine_bubble", "components/items/item_wand_of_the_brine", LUA_MODIFIER_MOTION_NONE ) -------------------------------------------------------------------------------- function item_imba_wand_of_the_brine:OnSpellStart() if IsServer() then self.bubble_duration = self:GetSpecialValueFor( "bubble_duration" ) local hTarget = self:GetCursorTarget() hTarget:Purge(false, true, false, true, true) hTarget:AddNewModifier( self:GetCaster(), self, "modifier_item_imba_wand_of_the_brine_bubble", { duration = self.bubble_duration } ) EmitSoundOn( "DOTA_Item.GhostScepter.Activate", self:GetCaster() ) end end -------------------------------------------------------------------------------- function item_imba_wand_of_the_brine:GetIntrinsicModifierName() return "modifier_item_imba_wand_of_the_brine" end -------------------------------------------------------------------------------- -- function item_imba_wand_of_the_brine:Spawn() -- self.required_level = self:GetSpecialValueFor( "required_level" ) -- end -------------------------------------------------------------------------------- -- function item_imba_wand_of_the_brine:OnHeroLevelUp() -- if IsServer() then -- if self:GetCaster():GetLevel() == self.required_level and self:IsInBackpack() == false then -- self:OnUnequip() -- self:OnEquip() -- end -- end -- end -------------------------------------------------------------------------------- -- function item_imba_wand_of_the_brine:IsMuted() -- if self.required_level > self:GetCaster():GetLevel() then -- return true -- end -- if not self:GetCaster():IsHero() then -- return true -- end -- return self.BaseClass.IsMuted( self ) -- end --------------------------------------- -- WAND OF THE BRINE BUBBLE MODIFIER -- --------------------------------------- modifier_item_imba_wand_of_the_brine_bubble = class({}) -------------------------------------------------------------------------------- function modifier_item_imba_wand_of_the_brine_bubble:OnCreated( kv ) if IsServer() then self.bubble_heal_per_tick = self:GetAbility():GetSpecialValueFor( "bubble_heal_per_tick" ) self.heal_tick_interval = self:GetAbility():GetSpecialValueFor( "heal_tick_interval" ) self.nFXIndex = ParticleManager:CreateParticle( "particles/item/wand_of_the_brine/wand_of_the_brine_bubble.vpcf", PATTACH_CUSTOMORIGIN, nil ) ParticleManager:SetParticleControlEnt( self.nFXIndex, 0, self:GetParent(), PATTACH_POINT_FOLLOW, "attach_hitloc", self:GetParent():GetOrigin(), true ) ParticleManager:SetParticleControl( self.nFXIndex, 1, Vector( 2.5, 2.5, 2.5 ) ) -- target model scale --ParticleManager:SetParticleControlEnt( self.nFXIndex, 2, self:GetParent(), PATTACH_POINT_FOLLOW, "attach_attack1", self:GetParent():GetOrigin(), true ) --ParticleManager:SetParticleControlEnt( self.nFXIndex, 3, self:GetParent(), PATTACH_POINT_FOLLOW, "attach_attack2", self:GetParent():GetOrigin(), true ) --ParticleManager:SetParticleControlEnt( self.nFXIndex, 4, self:GetParent(), PATTACH_ABSORIGIN_FOLLOW, nil, self:GetParent():GetOrigin(), true ) self:StartIntervalThink( self.heal_tick_interval ) end end -------------------------------------------------------------------------------- function modifier_item_imba_wand_of_the_brine_bubble:OnIntervalThink() if IsServer() then self:GetParent():Heal( self.bubble_heal_per_tick, self:GetAbility() ) SendOverheadEventMessage(nil, OVERHEAD_ALERT_HEAL, self:GetParent(), self.bubble_heal_per_tick, nil); end end -------------------------------------------------------------------------------- function modifier_item_imba_wand_of_the_brine_bubble:CheckState() local state = {} if IsServer() then state[ MODIFIER_STATE_STUNNED] = true state[ MODIFIER_STATE_ROOTED ] = true state[ MODIFIER_STATE_DISARMED] = true state[ MODIFIER_STATE_OUT_OF_GAME ] = true state[ MODIFIER_STATE_MAGIC_IMMUNE ] = true state[ MODIFIER_STATE_INVULNERABLE ] = true state[ MODIFIER_STATE_OUT_OF_GAME ] = true state[ MODIFIER_STATE_UNSELECTABLE ] = true state[ MODIFIER_STATE_NO_HEALTH_BAR ] = true -- This is extraneuous but seems appropriate end return state end -------------------------------------------------------------------------------- function modifier_item_imba_wand_of_the_brine_bubble:OnDestroy() if IsServer() then ParticleManager:DestroyParticle( self.nFXIndex, false ) end end -------------------------------------------------------------------------------- -------------------------------- -- WAND OF THE BRINE MODIFIER -- -------------------------------- modifier_item_imba_wand_of_the_brine = class({}) -------------------------------------------------------------------------------- function modifier_item_imba_wand_of_the_brine:IsHidden() return true end -------------------------------------------------------------------------------- function modifier_item_imba_wand_of_the_brine:IsPurgable() return false end -------------------------------------------------------------------------------- function modifier_item_imba_wand_of_the_brine:OnCreated( kv ) self.bonus_intelligence = self:GetAbility():GetSpecialValueFor( "bonus_intelligence" ) self.bonus_mana_regen_pct = self:GetAbility():GetSpecialValueFor( "bonus_mana_regen_pct" ) end -------------------------------------------------------------------------------- function modifier_item_imba_wand_of_the_brine:DeclareFunctions() local funcs = { MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, --MODIFIER_PROPERTY_MANA_REGEN_PERCENTAGE, MODIFIER_PROPERTY_MANA_REGEN_TOTAL_PERCENTAGE } return funcs end -------------------------------------------------------------------------------- function modifier_item_imba_wand_of_the_brine:GetModifierBonusStats_Intellect( params ) return self.bonus_intelligence end -------------------------------------------------------------------------------- --function modifier_item_imba_wand_of_the_brine:GetModifierPercentageManaRegen( params ) function modifier_item_imba_wand_of_the_brine:GetModifierTotalPercentageManaRegen( params ) return (self.bonus_mana_regen_pct - 100) / 100 end --------------------------------------------------------------------------------
-------------------------------------------------------------------------------- -- Module declaration -- local mod, CL = BigWigs:NewBoss("Amanitar", 619, 583) if not mod then return end mod:RegisterEnableMob(30258) -------------------------------------------------------------------------------- -- Initialization -- function mod:GetOptions() return { 57055, -- Mini } end function mod:OnBossEnable() self:Log("SPELL_CAST_START", "Mini", 57055) self:Death("Win", 30258) end -------------------------------------------------------------------------------- -- Event Handlers -- function mod:Mini(args) self:Message(args.spellId, "yellow", "Info", CL.casting:format(args.spellName)) end
-- $Id: savetable.lua 3171 2008-11-06 09:06:29Z det $ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- file: savetable.lua -- brief: a human friendly table writer -- author: Dave Rodgers -- -- Copyright (C) 2007. -- Licensed under the terms of the GNU GPL, v2 or later. -- -- 2 Sept 2008, quantum: added table.show and table.print -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --if (table.echo) then -- return --end local indentString = ' ' local savedTables = {} -- setup a lua keyword map local keyWords = { "and", "break", "do", "else", "elseif", "end", "false", "for", "function", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while" } local keyWordSet = {} for _,w in ipairs(keyWords) do keyWordSet[w] = true end keyWords = nil -- don't need the array anymore -------------------------------------------------------------------------------- local function encloseStr(s) return string.format('%q', s) end local function encloseKey(s) local wrap = not (string.find(s, '^%a[_%a%d]*$')) if (not wrap) then if (string.len(s) <= 0) then wrap = true end end if (not wrap) then if (keyWordSet[s]) then wrap = true end end if (wrap) then return string.format('[%q]', s) else return s end end local keyTypes = { ['string'] = true, ['number'] = true, ['boolean'] = true, } local valueTypes = { ['string'] = true, ['number'] = true, ['boolean'] = true, ['table'] = true, } local function CompareKeys(kv1, kv2) local k1, v1 = kv1[1], kv1[2] local k2, v2 = kv2[1], kv2[2] local ktype1 = type(k1) local ktype2 = type(k2) if (ktype1 ~= ktype2) then return (ktype1 > ktype2) end local vtype1 = type(v1) local vtype2 = type(v2) if ((vtype1 == 'table') and (vtype2 ~= 'table')) then return false end if ((vtype1 ~= 'table') and (vtype2 == 'table')) then return true end return (k1 < k2) end local function MakeSortedTable(t) local st = {} for k,v in pairs(t) do if (keyTypes[type(k)] and valueTypes[type(v)]) then table.insert(st, { k, v }) end end table.sort(st, CompareKeys) return st end local function isarray(t) local i = 0 for _ in pairs(t) do i = i + 1 if t[i] == nil then return false end end return true end local function SaveTable(t, file, indent) file:write('{\n') indent = indent .. indentString local st = MakeSortedTable(t) local isArray = isarray(t) for _,kv in ipairs(st) do local k, v = kv[1], kv[2] local ktype = type(k) local vtype = type(v) -- output the key file:write(indent) if not isArray then if ktype == 'string' then file:write(encloseKey(k)..' = ') else file:write('['..tostring(k)..'] = ') end end -- output the value if (vtype == 'string') then file:write(encloseStr(v)..',\n') elseif (vtype == 'number') then file:write(tostring(v)..',\n') elseif (vtype == 'boolean') then file:write(tostring(v)..',\n') elseif (vtype == 'table') then if (savedTables[v]) then error("table.save() does not support recursive tables") end if (next(v)) then savedTables[t] = true SaveTable(v, file, indent) file:write(indent..'},\n') savedTables[t] = nil else file:write('{},\n') -- empty table end end end end function ShowTable(t, indent) local strings = {} strings[#strings+1] = '{\n' indent = indent .. indentString local st = MakeSortedTable(t) local isArray = isarray(t) for _,kv in ipairs(st) do local k, v = kv[1], kv[2] local ktype = type(k) local vtype = type(v) -- output the key strings[#strings+1] = indent if not isArray then if ktype == 'string' then strings[#strings+1] = encloseKey(k) .. ' = ' else strings[#strings+1] = '[' .. tostring(k)..'] = ' end end -- output the value if (vtype == 'string') then strings[#strings+1] = (encloseStr(v)..',\n') elseif (vtype == 'number') then strings[#strings+1] = (tostring(v)..',\n') elseif (vtype == 'boolean') then strings[#strings+1] = (tostring(v)..',\n') elseif (vtype == 'table') then if (savedTables[v]) then error("table.save() does not support recursive tables") end if (next(v)) then savedTables[t] = true strings[#strings+1] = ShowTable(v, indent) strings[#strings+1] = (indent..'},\n') savedTables[t] = nil else strings[#strings+1] = ('{},\n') -- empty table end end end return table.concat(strings) end function table.show(t, header) local strings = {} if (header) then strings[#strings+1] = (header..'\n') end strings[#strings+1] = 'return ' strings[#strings+1] = ShowTable(t, '') strings[#strings+1] = '}\n' for k,v in pairs(savedTables) do savedTables[k] = nil end return table.concat(strings) end function table.print(t, header) print(table.show(t, header)) end function table.echo(t, header) Spring.Echo(table.show(t, header)) end function table.save(t, filename, header) if (not filename) then error("Error while saving.") return end local file, errMsg = io.open(filename, 'w') if (not file) then error(errMsg .. "\nFile not saved.") return end if (header) then file:write(header..'\n') end file:write('return ') SaveTable(t, file, '') file:write('}\n') file:close() for k,v in pairs(savedTables) do savedTables[k] = nil end end
object_tangible_furniture_decorative_wod_floating_stones = object_tangible_furniture_decorative_shared_wod_floating_stones:new { } ObjectTemplates:addTemplate(object_tangible_furniture_decorative_wod_floating_stones, "object/tangible/furniture/decorative/wod_floating_stones.iff")
print("hello world!") TestFunc(5, "this string is called from lua!!!", 3) TestFunc1(5, "this string is called from lua from func 1!!!", 3)
-- love.graphics.captureScreenshot( filename ) -- Save data stuff igmenu = top:newFrame(0,0,0,0,0,0,.3,.8) igmenu.Visible = false igmenu.Visibility = 0 igmenu:center() igmenu.resume = igmenu:newTextLabel("Resume",0,0,0,0,0,0,1,1/5) igmenu.save = igmenu:newTextLabel("Save",0,0,0,0,0,(1/5),1,1/5) igmenu.load = igmenu:newTextLabel("Load",0,0,0,0,0,(2/5),1,1/5) igmenu.setting = igmenu:newTextLabel("Settings",0,0,0,0,0,(3/5),1,1/5) igmenu.quit = igmenu:newTextLabel("Quit",0,0,0,0,0,(4/5),1,1/5) igmenu.resume:OnReleased(function() igmenu.Visible = false multi:newAlarm(.1):OnRing(function(alarm) alarm:Destroy() menuready = true end) top:removeDominance() end) igmenu.save:OnReleased(function() local date = os.date("%m.%d.%y_%I.%M.%S",os.time()) love.filesystem.createDirectory("SavedData/"..date) local state = test:extractState() local statedat = bin.new() state.variables["gui"]=nil state.variables["menu"]=nil statedat:addBlock(state) statedat:addBlock(currentBG,128) test.mainENV["gui"]=workspace test.mainENV["menu"]=top statedat:tofileS("SavedData/"..date.."/savedata.dat") igmenu.Visible = false multi:newThread("Saving-Thread",function() thread.sleep(.1) love.graphics.newScreenshot():encode("png","SavedData/"..date.."/screen.png") print("Saving image!") igmenu.Visible = true end) print("data saved") end) igmenu.load:OnReleased(function() core.menu.load:setParent(core.igmenu) core.menu.load.Visible = true core.igmenu.Visible = true core.igmenu:addDominance() core.menu.load:setDualDim(0,0,0,0,0,0,1,1) loadSaves() multi:newEvent(function() return core.menu.load.Visible==false end):OnEvent(function(evnt) core.menu.load:setParent(core.menu) core.igmenu.Visible = false core.igmenu:removeDominance() core.menu.load:setDualDim(0,0,0,0,1/3,0,2/3,1) evnt:Destroy() end) end) igmenu.setting:OnReleased(function() core.menu.settings:setParent(core.igmenu) core.menu.settings.Visible = true core.igmenu.Visible = true core.igmenu:addDominance() core.menu.settings:setDualDim(0,0,0,0,0,0,1,1) multi:newEvent(function() return core.menu.settings.Visible==false end):OnEvent(function(evnt) core.menu.settings:setParent(core.menu) core.igmenu.Visible = false core.igmenu:removeDominance() core.menu.settings:setDualDim(0,0,0,0,1/3,0,2/3,1) evnt:Destroy() end) end) igmenu.quit:OnReleased(function() core.menu.quit.Visible = true core.menu.quit:addDominance() end) gui.massMutate(MenuRef,igmenu.quit,igmenu.setting,igmenu.load,igmenu.save,igmenu.resume) menu_sound=audio:new("audio/menu.wav") menu_BG=audio:new("audio/Menu.mp3") menu_BG:setLooping(true) core.menu.Visible = false local options = core.menu:newFrame(0,0,0,0,0,0,1/3,1) local lowerBg = core.menu:newImageLabel("images/school.png",0,0,0,0,1/3,0,2/3,1) local bg = core.menu:newImageLabel("images/2 KIDS1.png",0,0,0,0,1/3,0,2/3,1) local upperBg = core.menu:newFrame(0,0,0,0,1/3,0,2/3,1) upperBg.Color = Color.Black play = options:newTextLabel("Play",0,0,0,0,0,0,1,1/4) load = options:newTextLabel("Load",0,0,0,0,0,1/4,1,1/4) load:OnReleased(function(b,self) core.menu.settings.Visible = false core.menu.load.Visible = true loadSaves() end) local settings = options:newTextLabel("Settings",0,0,0,0,0,2/4,1,1/4) settings:OnReleased(function(b,self) core.menu.load.Visible = false core.menu.settings.Visible = true end) local quit = options:newTextLabel("Quit",0,0,0,0,0,3/4,1,1/4) quit:OnReleased(function(b,self) core.menu.quit.Visible = true core.menu.quit:addDominance() end) core.menu.load = core.menu:newImageLabel("images/chalkboard.jpg",0,0,0,0,1/3,0,2/3,1) core.igmenu = gui:newFrame(0,0,0,0,0,0,1,1) core.igmenu.Color = Color.Black core.igmenu.Visible = false core.menu.load.games = core.menu.load:newFrame(0,0,0,0,0,0,1,1) core.menu.load.games.Visibility = 0 local Bbar = core.menu.load:newImageLabel("images/wood.png",0,-90,0,90,0,1,1) local Tbar = core.menu.load:newImageLabel("images/wood.png",0,0,0,90,0,0,1) Bbar.Color = Color.new(116,99,150) Tbar.Color = Color.new(116,99,150) core.menu.load.Visible = false core.menu.load.Color=Color.new(116,99,150) core.menu.load.dragFrame=core.menu.load:newImageLabel(nil,0,0,0,0,0,0,1,1) core.menu.load.down = core.menu.load:newImageButton("images/DownArrow.png",0,-70,100,60,0,1) core.menu.load.down:centerX() core.menu.load.down.Color=Color.Darken(Color.Yellow,.15) core.menu.load.up = core.menu.load:newImageButton("images/UpArrow.png",0,10,100,60) core.menu.load.up.Visible = false core.menu.load.up:centerX() core.menu.load.up.Color=Color.Darken(Color.Yellow,.15) core.menu.load.back = core.menu.load:newTextLabel("Back",20,-70,100,50,0,1) core.menu.load.back:setRoundness(5,5,360) core.menu.load.back:OnEnter(function(self) self:addDominance() end) core.menu.load.back:OnExit(function(self) self:removeDominance() end) core.menu.load.back:OnReleased(function(b,self) core.menu.load.Visible = false self:removeDominance() end) play:OnReleased(function(b,self) multi:newThread("FadeOut",function() for i=100,0,-1 do thread.sleep(.01) menu_BG:setVolume(i/100) end menu_BG:stop() core.menu.Visible = false end) end) core.menu.load.down:OnReleased(function(b,self) local c = core.menu.load.games:getChildren() if #c==0 then return end core.menu.load.games:setDualDim(nil,core.menu.load.games.offset.pos.y-100) core.menu.load.up.Visible = true if c[#c].y+200<=680 then self.Visible = false love.mouse.setCursor(_GuiPro.CursorN) end end) core.menu.load.up:OnReleased(function(b,self) local c = core.menu.load.games:getChildren() core.menu.load.games:setDualDim(nil,core.menu.load.games.offset.pos.y+100) core.menu.load.down.Visible = true if core.menu.load.games.offset.pos.y>=0 then core.menu.load.games:setDualDim(nil,0) self.Visible = false love.mouse.setCursor(_GuiPro.CursorN) end end) gui.massMutate({--fonts/PWRectangular.ttf [[setNewFont(76,"fonts/Angeline.ttf")]], [[OnEnter(function(self) self.TextColor=Color.Darken(self.TextColor,.35) menu_sound:play() end)]], [[OnExit(function(self) self.TextColor=self.DefualtColor end)]], Tween = -70, TextColor = Color.Lighten(Color.Yellow,.05), DefualtColor = Color.Lighten(Color.Yellow,.05), Color = Color.Black, },play,settings,load,quit) core.menu.load.back:setNewFont(36,"fonts/PWRectangular.ttf") core.menu.load.back.Tween=-4 crossRef = {} localMax = 0 localcount = 0 jQueue.OnJobCompleted(function(JOBID,n) print(JOBID,n) crossRef[JOBID].ImageHolder:SetImage(n,JOBID) localcount=localcount+1 if localcount==localMax then crossRef = {} localMax = 0 localcount = 0 end end) function loadSaves() local files = love.filesystem.getDirectoryItems("savedData") core.menu.load.games.Children={} localMax = #files for i=#files,1,-1 do local temp = core.menu.load.games:newFrame(0,0,300,200) temp.ImageHolder = temp:newImageLabel(nil,0,0,0,0,0,0,1,1) local jobid = jQueue:pushJob("LoadImage","savedData/"..files[i].."/screen.png") crossRef[jobid]=temp local txt = temp:newTextLabel(files[i],0,0,0,30,0,0,1) txt.Color = Color.Black txt.TextColor = Color.White local data = bin.load("savedData/"..files[i].."/savedata.dat") temp.state = data:getBlock("t") if temp.state.variables.user then txt.text = temp.state.variables.user..": "..txt.text end temp.state.pos = temp.state.pos-1 print(files[i]) temp.BG = (data:getBlock("s",128) or ""):match("(.+)\0") temp:OnReleased(function(b,self) menu_BG:stop() test:injectState(self.state) local name = self.state.name BGStop() if name == "LOBBY" then class_BG:play() elseif name == "HOUSE" then house_BG:play() elseif name == "SCHOOL" then school_BG:play() elseif name == "PARK" then park_BG:play() elseif name == "AQUARIUM" then aqua_BG:play() elseif name == "STORE" then store_BG:play() elseif name == "END" then credits_BG:play() end core:SetImage(self.BG) core.menu.Visible = false if igmenu.Visible then multi:newThread("StateLoading-Thread",function() thread.sleep(.1) igmenu.Visible = false _inputvar = "" multi:newAlarm(.1):OnRing(function(alarm) alarm:Destroy() menuready = true end) core.menu.load:setParent(core.menu) core.igmenu.Visible = false core.igmenu:removeDominance() core.menu.load:setDualDim(0,0,0,0,1/3,0,2/3,1) top:removeDominance() end) end end) end end local loadgame = Tbar:newTextLabel("Load",20,20,100,50) local deletegame = loadgame:newTextLabel("Delete",20,0,150,50,1) core.menu.load.games:OnUpdate(function(self) local c = self:getChildren() for i=1,#c do local x,y = InGridX(i,core.menu.load.width,200,350,240) c[i]:setDualDim(x+75,y+100) end end) lowerBg.Visibility=0 core.menu.settings = core.menu:newImageLabel("images/chalkboard.jpg",0,0,0,0,1/3,0,2/3,1) core.menu.settings.Color=Color.new(116,99,150) core.menu.settings.Visible = false core.menu.settings.back = core.menu.settings:newTextLabel("Back",20,-70,100,50,0,1) core.menu.settings.back:setRoundness(5,5,360) core.menu.settings.back:OnReleased(function(self) core.menu.settings.Visible = false end) core.menu.quit = gui:newFrame(0,0,0,0,0,0,1,1) core.menu.quit.Visible = false core.menu.quit.Visibility = 0 local qu = core.menu.quit:newFrame(0,0,300,200) qu:centerX() qu:centerY() qu:setRoundness(15,15,360) qu.Color=Color.Black qu.BorderColor = Color.Lighten(Color.Yellow,.05) local msg = qu:newTextLabel("Are You Sure",20,20,-40,60,0,0,1) local yes = qu:newTextLabel("Yes",20,-80,100,60,0,1) local no = qu:newTextLabel("No",-120,-80,100,60,1,1) msg.TextColor = Color.Lighten(Color.Yellow,.05), msg:setNewFont(48,"fonts/Angeline.ttf") msg.Visibility = 0 msg.Tween = -68 gui.massMutate({ [[OnEnter(function(self) self.TextColor=Color.Darken(self.TextColor,.35) menu_sound:play() end)]], [[OnExit(function(self) self.TextColor=self.DefualtColor end)]], TextColor = Color.Lighten(Color.Yellow,.05), [[setNewFont(32,"fonts/Angeline.ttf")]], DefualtColor = Color.Lighten(Color.Yellow,.05), Visibility = 0, Tween = -38 },yes,no,core.menu.load.back,core.menu.settings.back,loadgame,deletegame) loadgame.Visibility = 1 loadgame.Color = Color.Black loadgame:setRoundness(5,5,360) deletegame.Visibility = 1 deletegame.Color = Color.Black deletegame:setRoundness(5,5,360) core.menu.load.back.Visibility = 1 core.menu.load.back.Color = Color.Black core.menu.settings.back.Visibility = 1 core.menu.settings.back.Color = Color.Black yes:OnReleased(function(self) love.event.quit() end) no:OnReleased(function(self) core.menu.quit.Visible = false core.menu.quit:removeDominance() end) multi:newThread("Menu-Background",function() local count = 1 while true do thread.hold(function() return core.menu.Visible==true and (core.menu.load.Visible==false) end) -- if the menu is active do this if not wait till it is lowerBg:SetImage("images/"..({"Park","aqua","home","store","classroomafterhours"})[count]..".png") for i = 1,1000 do thread.sleep(.001) -- hehe a bit of a hack upperBg.Visibility = (1000-i)/1000 end for i = 1000,1,-1 do thread.sleep(.001) -- hehe a bit of a hack upperBg.Visibility = (1000-i)/1000 end count = count + 1 if count > 5 then count=1 end end end) --------------------------------- --~ settings evntA = multi:newEvent(function() return core.menu.settings.Visible==true end) evntA:OnEvent(function() evntB:Reset() end) evntB = multi:newEvent(function() return core.menu.settings.Visible==false end) evntB:Pause() evntB:OnEvent(function() print("Saving settings!") local set = bin.new() set:addBlock(Settings.Volume,1) set:addBlock(Settings.mute,1) set:addBlock(Settings.auto_save,1) set:addBlock(Settings.auto_progress,1) set:addBlock(Settings.Text_speed,1) set:addBlock(Settings.Font_Size,1) set:tofileS("Settings.dat") evntA:Reset() end) local title = core.menu.settings:newTextLabel("Settings",0,0,0,100,0,0,1) title:setNewFont(72,"fonts/Angeline.ttf") title.Tween = -72 title.Visibility = 0 title.TextColor = Color.Darken(Color.White,.15) local Volume=core.menu.settings:newFrame(0,0,400,130) local vol = Volume:newTextLabel("Volume",0,0,200,60) local mute = Volume:newTextLabel("Mute",0,60,200,60) local vv = vol.Font:getWidth("Volume") local slidebar = Volume:newFrame(-200,10,200,60,1) Volume.Visibility = 0 slidebar.Visibility=0 slidebar.display=slidebar:newTextLabel("100%",0,0,40,20) slidebar.display:centerX() slidebar.display.Tween=-3 slidebar.display.Visibility = 0 slidebar.display.TextColor = Color.Darken(Color.White,.15) slidebar:setNewFont(20,"fonts/Angeline.ttf") slidebar.left=slidebar:newFrame(0,0,10,0,0,0,0,1) slidebar.bar=slidebar:newFrame(10,0,-20,10,0,0,1) slidebar.bar:centerY() slidebar.bar:OnClicked(function(b,self,x,y,xx,yy) slidebar.move:setDualDim(x-10) if slidebar.move.offset.pos.x<0 then slidebar.move:setDualDim(0) elseif slidebar.move.offset.pos.x>160 then slidebar.move:setDualDim(160) end love.mouse.setY(slidebar.move.y+10) end) slidebar.right=slidebar:newFrame(-10,0,10,0,1,0,0,1) slidebar.move=slidebar.bar:newFrame(80,0,20,20,0,0,0) slidebar.move:centerY() slidebar.move:OnUpdate(function() slidebar.display.text=math.ceil((slidebar.move.offset.pos.x/160)*100) .."%" Settings.Volume=math.ceil((slidebar.move.offset.pos.x/160)*100) love.audio.setVolume(Settings.Volume/100) end) Volume.muter=Volume:newImageLabel("images/unchecked.png",-190,80,40,40,1) Volume.muter:OnReleased(function(b,self) if Settings.mute then self:SetImage("images/unchecked.png") Settings.mute = false love.audio.resume() else self:SetImage("images/checked.png") Settings.mute = true love.audio.pause() end end) gui.massMutate({ [[setRoundness(5,5,60)]], Color=Color.Saddle_brown },slidebar.move,slidebar.right,slidebar.left) slidebar.move.Color = Color.Lighten(Color.Saddle_brown,.20) slidebar.bar.Color=Color.Saddle_brown local asave=Volume:newTextLabel("Autosave",0,0,200,60,0,1) asaveC=asave:newImageLabel("images/checked.png",10,15,40,40,1) asaveC:OnReleased(function(b,self) if Settings.auto_save then self:SetImage("images/unchecked.png") Settings.auto_save = false else self:SetImage("images/checked.png") Settings.auto_save = true end end) local aprogress=asave:newTextLabel("Auto Progress",0,0,300,60,0,1) aprogressC=aprogress:newImageLabel("images/unchecked.png",10,20,40,40,1) aprogressC:OnReleased(function(b,self) if Settings.auto_progress then self:SetImage("images/unchecked.png") Settings.auto_progress = false else self:SetImage("images/checked.png") Settings.auto_progress = true end end) local tspeed=aprogress:newTextLabel("Text Speed",0,10,200,60,0,1) speed = tspeed:newFrame(0,0,500,60,1) speed.Visibility = 0 S_slow = speed:newTextLabel("Slow",0,0,0,0,0,0,1/3,1) S_Med = speed:newTextLabel("Meduim",0,0,0,0,1/3,0,1/3,1) S_Fast = speed:newTextLabel("Fast",0,0,0,0,2/3,0,1/3,1) S_slow:OnReleased(function(b,self) Settings.Text_speed = 1 self.Visibility = 1 S_Med.Visibility = 0 S_Fast.Visibility = 0 end) S_Med:OnReleased(function(b,self) Settings.Text_speed = 2 self.Visibility = 1 S_slow.Visibility = 0 S_Fast.Visibility = 0 end) S_Fast:OnReleased(function(b,self) Settings.Text_speed = 3 self.Visibility = 1 S_Med.Visibility = 0 S_slow.Visibility = 0 end) local fontsize=tspeed:newTextLabel("Font Size",0,10,200,60,0,1) fonts = fontsize:newFrame(0,0,500,60,1) fonts.Visibility = 0 S_slow2 = fonts:newTextLabel("Small",0,0,0,0,0,0,1/3,1) S_Med2 = fonts:newTextLabel("Meduim",0,0,0,0,1/3,0,1/3,1) S_Fast2 = fonts:newTextLabel("Large",0,0,0,0,2/3,0,1/3,1) S_slow2:OnReleased(function(b,self) Settings.Font_Size = 1 self.Visibility = 1 S_Med2.Visibility = 0 S_Fast2.Visibility = 0 core.chatFrame.textHolder:setNewFont(16) end) S_Med2:OnReleased(function(b,self) Settings.Font_Size = 2 self.Visibility = 1 S_slow2.Visibility = 0 S_Fast2.Visibility = 0 core.chatFrame.textHolder:setNewFont(20) end) S_Fast2:OnReleased(function(b,self) Settings.Font_Size = 3 self.Visibility = 1 S_Med2.Visibility = 0 S_slow2.Visibility = 0 core.chatFrame.textHolder:setNewFont(28) end) gui.massMutate({ TextColor = Color.Darken(Color.White,.15), Visibility = 0, [[setNewFont(48,"fonts/Angeline.ttf")]], Tween = -60 },vol,mute,asave,aprogress,tspeed,fontsize) gui.massMutate({ [[OnEnter(function(self) self.TextColor=Color.Darken(self.TextColor,.35) menu_sound:play() end)]], [[OnExit(function(self) self.TextColor=self.DefualtColor end)]], [[setRoundness(10,10,360)]], TextColor = Color.Darken(Color.White,.15), Visibility = 0, Color=Color.Saddle_brown, DefualtColor = Color.Darken(Color.White,.15), [[setNewFont(24,"fonts/Angeline.ttf")]], Tween = -15 },S_slow,S_Med,S_Fast,S_slow2,S_Med2,S_Fast2) S_Med.Visibility = 1 S_Med2.Visibility = 1 loadgame.Visibility = 1 if bin.fileExists("Settings.dat") then local set = bin.loadS("Settings.dat") Settings={} local function LoadSettings() print("Loading Settings...") Settings.Volume = set:getBlock("n",1) Settings.mute = set:getBlock("b") Settings.auto_save = set:getBlock("b") Settings.auto_progress = set:getBlock("b") Settings.Text_speed = set:getBlock("n",1) Settings.Font_Size = set:getBlock("n",1) if Settings.Text_speed==1 then S_slow.Visibility = 1 S_Med.Visibility = 0 elseif Settings.Text_speed==3 then S_Fast.Visibility = 1 S_Med.Visibility = 0 end if Settings.Font_Size==1 then S_slow2.Visibility = 1 S_Med2.Visibility = 0 core.chatFrame.textHolder:setNewFont(16,"fonts/zekton rg.ttf") elseif Settings.Font_Size==3 then S_Fast2.Visibility = 1 S_Med2.Visibility = 0 core.chatFrame.textHolder:setNewFont(28,"fonts/zekton rg.ttf") end if Settings.auto_progress then aprogressC:SetImage("images/checked.png") end if not Settings.auto_save then asaveC:SetImage("images/unchecked.png") end if Settings.mute then Volume.muter:SetImage("images/checked.png") end slidebar.move:setDualDim((Settings.Volume/100)*160) love.audio.setVolume(Settings.Volume/100) print("Success!") end status, err = pcall(LoadSettings) if not status then Settings={} print("Setting data is currupt! Restoring defualts!") local set = bin.new() set:addBlock(Settings.Volume,1) set:addBlock(Settings.mute,1) set:addBlock(Settings.auto_save,1) set:addBlock(Settings.auto_progress,1) set:addBlock(Settings.Text_speed,1) set:addBlock(Settings.Font_Size,1) set:tofileS("Settings.dat") end else -- Settings={ Volume = 50, mute = false, auto_save = true, auto_progress = false, Text_speed = 2, Font_Size = 2 } local set = bin.new() set:addBlock(Settings.Volume,1) set:addBlock(Settings.mute,1) set:addBlock(Settings.auto_save,1) set:addBlock(Settings.auto_progress,1) set:addBlock(Settings.Text_speed,1) set:addBlock(Settings.Font_Size,1) set:tofileS("Settings.dat") end local x,y = Volume:getFullSize() Volume:setDualDim(nil,-y,nil,nil,nil,.35)
local createEnum = import("../createEnum") return createEnum("HorizontalAlignment", { Center = 0, Left = 1, Right = 2, })
-- luacheck: globals gViewer gLoadConfig gOnNewImage gRecord gFolder gSendImageToFTP gViewer = View.create() -- Will show in 3D viewer gViewer:setID('viewer3D') ------------------------------------- -- Load previously saved config ----- ------------------------------------- --@gLoadConfig(jobPath:string) function gLoadConfig(jobPath) -- Check if file exists if not File.exists(jobPath) then print('Error: File not found: ' .. jobPath) return end -- Try to load config local loadedConfig = Object.load(jobPath) if loadedConfig == nil then print('Error: Failed loading configuration') return end return loadedConfig end ------------------------------------- -- Image Callback ------------------- ------------------------------------- --@gOnNewImage(images:Image, sensorData:SensorData) function gOnNewImage(images, sensorData) if #images == 2 then -- Only 3D images local heightMap = images[1] local intensityMap = images[2] local _sensorData = sensorData local name = 'image_' .. _sensorData:getFrameNumber() -- Add to 3D viewer gViewer:addHeightmap({heightMap, intensityMap}) -- If recording is on if gRecord then gSendImageToFTP(heightMap, intensityMap, _sensorData, gFolder, name) end gViewer:present() end end
-- This is the module file for GPAW environment local version = '1.4.0' help([[ GPAW environment ]] .. version .. [[ ]]) depends_on('gcc/9.1.0', 'mpich/3.3.1', 'hdf5/1.10.4', 'intel-mkl/2019.0.4') local base = '/appl/soft/phys/gpaw/' .. version local py_base = '/appl/soft/phys/gpaw/python/2.7.13' local bundle = '2018-03' setenv('LIBXCDIR', '/appl/soft/phys/libxc/3.0.0') setenv('GPAW_SETUP_PATH', pathJoin('/appl/soft/phys/gpaw-setups', '0.9.20000')) setenv('PYTHONHOME', py_base) prepend_path('PYTHONPATH', pathJoin(py_base, 'lib')) prepend_path('PATH', pathJoin(py_base, 'bin')) prepend_path('PATH', pathJoin(py_base, 'bundle', bundle, 'bin')) prepend_path('LD_LIBRARY_PATH', pathJoin(py_base, 'lib')) setenv('PYTHONUSERBASE', pathJoin(py_base, 'bundle', bundle)) prepend_path('PYTHONPATH', pathJoin(base, 'lib/python2.7/site-packages')) prepend_path('PATH', pathJoin(base, 'bin')) setenv('GPAW_PYTHON', pathJoin(base, 'bin/gpaw-python'))
local tab = {} tab.name = "TAB_ATTACHMENT_ADJUSTMENT" tab.id = 4 tab.text = "ATTACHMENT ADJUSTMENT" tab.switchToKey = "gm_showspare2" tab.selectedAttachment = nil if CLIENT then function tab:processKey(key, isPressed) if not isPressed then return nil end if not CustomizableWeaponry.sightAdjustment:getCurrentAttachment() then -- attempt to select a category of sights to adjust in case we haven't selected one yet local category = nil if key:find("slot") then -- if it starts with 'slot', that means we're pressing 1-9 keys, therefore strip it of the 'slot' part and turn it into a number category = tonumber(string.Right(key, 1)) else -- otherwise just use the key as the category category = key end -- attempt to find an attachment category with this name return CustomizableWeaponry.sightAdjustment:attemptSetAttachment(self, category) else if key == "+reload" then CustomizableWeaponry.sightAdjustment:setDefaultOffset(self) return true elseif key == "+attack2" then -- deselect category CustomizableWeaponry.sightAdjustment:setCurrentAttachment(nil, nil) return true end end end function tab:callback() -- when we open the tab, we deselect the current category CustomizableWeaponry.sightAdjustment:setCurrentAttachment(nil, nil) end function tab:drawFunc() CustomizableWeaponry.sightAdjustment:draw(self) end end CustomizableWeaponry.interactionMenu:addTab(tab)
local http = require('http') local options = { host = "luvit.io", port = 80, path = "/" } local req = http.request(options, function (res) res:on('data', function (chunk) p("ondata", {chunk=chunk}) end) end) req:done()
-- +attack return { id = "copperBoots", name = "Copper Boots", equipmentType = "feet", tier = 1, spriteSheet = "armor", spriteCoords = Vector2.new(2,2), onlyOne = true, recipe = { ingotCopper = 10, }, stats = { defense = 20, moveSpeed = 5, }, tags = { "armor", }, }
-- -- volume.lua -- volume daemon -- Dependencies: -- pulseaudio -- -- Signals: -- daemon::volume::percentage -- percentage (integer) -- -- daemon::volume::muted -- local awful = require("awful") local helpers = require("helpers") -- ======================================== -- Config -- ======================================== -- script to monitor volume events -- Sleeps until pactl detects an event (volume up/down/toggle mute) local monitor_script = [[ pactl subscribe 2> /dev/null | grep --line-buffered "Event 'change' on sink #" ]] -- script to get volume sinks -- Gets volume info of the currently active sink -- The currently active sink has a star `*` in front of its index -- In the output of `pacmd list-sinks`, lines +7 and +11 after "* index:" -- contain the volume level and muted state respectively -- This is why we are using `awk` to print them. local sinks_script = "pacmd list-sinks | awk '/\\* index: /{nr[NR+7];nr[NR+11]}; NR in nr'" -- ======================================== -- Logic -- ======================================== local volume_old = -1 local muted_old = -1 -- Main script local check_volume = function () awful.spawn.easy_async_with_shell(sinks_script, function(stdout) local volume = stdout:match("(%d+)%% /") local muted = stdout:match("muted:%s+yes") if volume == nil then return end local muted_int = muted and 1 or 0 local volume_int = tonumber(volume) -- Only send signal if there was a change -- We need this since we use `pactl subscribe` to detect -- volume events. These are not only triggered when the -- user adjusts the volume through a keybind, but also -- through `pavucontrol` or even without user intervention, -- when a media file starts playing. if volume_int ~= volume_old or (muted_int ~= muted_old and muted_int == 0) then awesome.emit_signal("daemon::volume::percentage", volume_int) volume_old = volume_int muted_old = muted_int end if muted_int ~= muted_old and muted_int == 1 then awesome.emit_signal("daemon::volume::muted") muted_old = muted_int end end) end -- ======================================== -- Initialization -- ======================================== -- Run once to initialize widgets check_volume() -- Start monitoring process helpers.start_monitor( monitor_script, { stdout = check_volume } )
local configs = require 'lspconfig/configs' local util = require 'lspconfig/util' local server_name = "denols" configs[server_name] = { default_config = { cmd = {"deno", "lsp"}; filetypes = {"javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx"}; root_dir = util.root_pattern("package.json", "tsconfig.json", ".git"); init_options = { enable = true; lint = false; unstable = false; }; }; docs = { description = [[ https://github.com/denoland/deno Deno's built-in language server ]]; default_config = { root_dir = [[root_pattern("package.json", "tsconfig.json", ".git")]]; }; }; } -- vim:et ts=2 sw=2
--ワン・バイ・ワン --One by One --Scripted by Kohana Sonogami function c101104078.initial_effect(c) --to hand local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,101104078+EFFECT_COUNT_CODE_OATH) e1:SetCost(c101104078.cost) e1:SetTarget(c101104078.target) e1:SetOperation(c101104078.operation) c:RegisterEffect(e1) end function c101104078.cfilter(c) return c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost() end function c101104078.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c101104078.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c101104078.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) e:SetLabelObject(g:GetFirst()) end function c101104078.thfilter(c) return c:IsLevel(1) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsAbleToHand() end function c101104078.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and chkc:IsControler(tp) and c101104078.thfilter(chkc) and chkc~=e:GetLabelObject() end if chk==0 then return Duel.IsExistingTarget(c101104078.thfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,c101104078.thfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,e:GetLabelObject()) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c101104078.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
local CONSTANTS_API = require(script:GetCustomProperty("MetaAbilityProgressionConstants_API")) local UTIL_API = require(script:GetCustomProperty("MetaAbilityProgressionUTIL_API")) local _Constants_API = require(script:GetCustomProperty("Constants_API")) local EventsAPI = require(script:GetCustomProperty("META_EventsAPI")) local CURRENCY = _Constants_API:WaitForConstant("Currency") local TANKS = _Constants_API:WaitForConstant("Tanks") local XP = _Constants_API:WaitForConstant("XP") local RANK_API = _Constants_API:WaitForConstant("Ranks") local TankAPI = _Constants_API:WaitForConstant("Tanks") local LEADERBOARDS = script:GetCustomProperty("Leaderboards"):WaitForObject() local MTD_LEADERBOARD = LEADERBOARDS:GetCustomProperty("MatchDestroyed") local MDD_LEADERBOARD = LEADERBOARDS:GetCustomProperty("MatchDamage") local LTTD_LEADERBOARD = LEADERBOARDS:GetCustomProperty("TotalDestroyed") local LTDD_LEADERBOARD = LEADERBOARDS:GetCustomProperty("TotalDamage") local LTWR_LEADERBOARD = LEADERBOARDS:GetCustomProperty("TotalWinRate") local STORAGE_LEADERBOARD = _Constants_API:WaitForConstant("Storage_Keys").Leaderboards local mainGameStateManager = script:GetCustomProperty("GAMESTATE_MainGameStateManagerServer"):WaitForObject() local victoryComponent = script:GetCustomProperty("GAMESTATE_VictoryComponent"):WaitForObject() local victoryMaxDuration = mainGameStateManager:GetCustomProperty("VictoryMaxDuration") local victoryXPValue = victoryComponent:GetCustomProperty("VictoryXPValue") local victoryCurrencyValue = victoryComponent:GetCustomProperty("VictoryCurrencyValue") local lossXPValue = victoryComponent:GetCustomProperty("LossXPValue") local lossCurrencyValue = victoryComponent:GetCustomProperty("LossCurrencyValue") local drawXPValue = victoryComponent:GetCustomProperty("DrawXPValue") local drawCurrencyValue = victoryComponent:GetCustomProperty("DrawCurrencyValue") local killXPValue = victoryComponent:GetCustomProperty("KillXPValue") local killCurrencyValue = victoryComponent:GetCustomProperty("KillCurrencyValue") local survivalXPValue = victoryComponent:GetCustomProperty("SurvivalXPValue") local survivalCurrencyValue = victoryComponent:GetCustomProperty("SurvivalCurrencyValue") local EVENT_SILVER_MODIFIER = 3 local EVENT_PARTS_MODIFIER = 2 local PLAYER_JOINED_XP_AMOUNT = 50 local VICTORY_XP_PER_PLAYER_AMOUNT = 75 --150 local VICTORY_TP_PER_PLAYER_AMOUNT = 150 --300 local KILL_XP_AMOUNT = 100 local SURVIVAL_SILVER_BONUS = 150 local VICTORY_SILVER_PER_PLAYER_AMOUNT = 800 local KILL_SILVER_AMOUNT = 150 local SPOTTING_REWARDS_CAP = 250 local TIER_BONUS_DIVIDER = 5 local winner = -1 local startingPlayerCount = 0 local playerParticipation = {} local playerStartingXP = {} local playerStartingSilver = {} function TrackDailyChallenge(player, type, amount) for i = 1, 3 do if player.serverUserData.CHALLENGE[i].challengeType == type then if player.serverUserData.CHALLENGE[i].target > player.serverUserData.CHALLENGE[i].progress and player.serverUserData.CHALLENGE[i].progress >= 0 then player.serverUserData.CHALLENGE[i].progress = player.serverUserData.CHALLENGE[i].progress + amount Events.Broadcast("PACK_DAILY_CHALLENGES", player) end break end end end --[[ function CalculateTotalXP(player) local baseXP = 0 if winner == player.team then baseXP = victoryXPValue elseif winner > 0 then baseXP = lossXPValue else baseXP = drawXPValue end local survivalBonus = math.floor(survivalXPValue * (player:GetResource("MatchEndHP") / player.maxHitPoints)) local damageBounus = player:GetResource("DamageTracker") local spotBonus = player:GetResource("SpottingTracker") local modifier = 1 if (UTIL_API.UsingPremiumTank(tonumber(player.serverUserData.currentTankData.id))) then modifier = 2 end return (baseXP + survivalBonus + damageBounus + spotBonus + (player.kills * killXPValue)) * modifier end ]] --[[ function CalculateTotalCurrency(player) local baseCurrency = 0 if winner == player.team then baseCurrency = victoryCurrencyValue elseif winner > 0 then baseCurrency = lossCurrencyValue else baseCurrency = drawCurrencyValue end local survivalBonus = math.floor(survivalCurrencyValue * (player:GetResource("MatchEndHP") / player.maxHitPoints)) local damageBounus = player:GetResource("DamageTracker") local spotBonus = player:GetResource("SpottingTracker") local modifier = 1 if (UTIL_API.UsingPremiumTank(player.serverUserData.currentTankData.id)) then modifier = 2 end return (baseCurrency + survivalBonus + damageBounus + spotBonus + (player.kills * killXPValue)) * modifier end ]] function AdvancePlayerLevel(player) local levelXPRequirement = RANK_API.GetXPInLevel(player:GetResource(CONSTANTS_API.XP_SYSTEM.LVL)) local currentXP = player:GetResource(CONSTANTS_API.XP) if currentXP >= levelXPRequirement then player:AddResource(CONSTANTS_API.XP_SYSTEM.LVL, 1) local rewardedXP = currentXP - levelXPRequirement if rewardedXP < 0 then rewardedXP = 0 end player:SetResource(CONSTANTS_API.XP, rewardedXP) AdvancePlayerLevel(player) end end function CalculateNewLevelAndRank(player) AdvancePlayerLevel(player) --[[ local levelValue = player:GetResource(CONSTANTS_API.XP_SYSTEM.LVL) warn("Level Value: " .. tostring(levelValue)) local newRank = RANK_API.GetRankFromLevel(levelValue)["RankNumber"] warn("rank Number: " .. tostring(newRank.rankNumber), " Rank Number " .. tostring(newRank.RankNumber) ) print(tostring(player.id) .. " level:" .. tostring(levelValue) .. " rank:" .. tostring(newRank)) player:SetResource(CONSTANTS_API.RANK_NAME, newRank) print(player.name .. " is now level " .. tostring(player:GetResource(CONSTANTS_API.XP_SYSTEM.LVL))) print(" rank: " .. tostring(player:GetResource(CONSTANTS_API.RANK_NAME))) print(" current XP: " .. tostring(player:GetResource(CONSTANTS_API.XP)))]]-- end function SetWinner(winningTeam) winner = winningTeam end function StateSTART(manager, propertyName) if propertyName ~= "GameState" then return end if mainGameStateManager:GetCustomProperty("GameState") == "MATCH_STATE" then local currentPlayers = Game.GetPlayers() startingPlayerCount = #currentPlayers for _, p in ipairs(currentPlayers) do if Object.IsValid(p) and p:IsA("Player") and p.serverUserData.MID_MATCH_DATA then p.serverUserData.MID_MATCH_DATA.PARTICIPATION = startingPlayerCount * PLAYER_JOINED_XP_AMOUNT p:AddResource(CONSTANTS_API.XP, p.serverUserData.MID_MATCH_DATA.PARTICIPATION) end end elseif mainGameStateManager:GetCustomProperty("GameState") == "VICTORY_STATE" then --print("Waiting for winner...") while winner < 0 do Task.Wait() end --print("got winner...") SaveStatistics() end end function SubmitScores(player) local currentKills = player:GetResource("MatchKills") local recordedKills = player:GetResource("MatchTanksDestroyed") if currentKills > recordedKills then player:SetResource("MatchDamageDealt", currentKills) Leaderboards.SubmitPlayerScore(MTD_LEADERBOARD, player, currentKills) end local lifetimeKills = player:GetResource("LifetimeTanksDestroyed") Leaderboards.SubmitPlayerScore(LTTD_LEADERBOARD, player, lifetimeKills) local currentMatchDamage = player:GetResource("TankDamage") local recordedMatchDamage = player:GetResource("MatchDamageDealt") if currentMatchDamage > recordedMatchDamage then player:SetResource("MatchDamageDealt", currentMatchDamage) Leaderboards.SubmitPlayerScore(MDD_LEADERBOARD, player, currentMatchDamage) end local lifetimeDamage = player:GetResource("LifetimeDamageDealt") Leaderboards.SubmitPlayerScore(LTDD_LEADERBOARD, player, lifetimeDamage) end function SaveStatistics() _G["BONUS"] = {} local activeEventPartsMod = 0 local activeEventSilverMod = 0 if EventsAPI.IsEventKeyActive("2TP") then activeEventPartsMod = EVENT_PARTS_MODIFIER end if EventsAPI.IsEventKeyActive("3SL") then activeEventSilverMod = EVENT_SILVER_MODIFIER end for x, p in pairs(Game.GetPlayers()) do local tempTbl = {} local survivalBonus = 0 local tankRPString = UTIL_API.GetTankRPString(p:GetResource(TankAPI.EquipResource)) local baseXP = 0 local baseCurrency = 0 local baseTP = 0 SubmitScores(p) if p:GetResource("MatchEndHP") > 0 then survivalBonus = survivalCurrencyValue end local silverWin = CoreMath.Round(VICTORY_SILVER_PER_PLAYER_AMOUNT * 2 + (VICTORY_SILVER_PER_PLAYER_AMOUNT * CoreMath.Round(((math.cos(math.pi * (startingPlayerCount/16)) - 1 ) /2) * -1,5)),-2) local partWin = CoreMath.Round(VICTORY_TP_PER_PLAYER_AMOUNT * 2 + (VICTORY_TP_PER_PLAYER_AMOUNT * CoreMath.Round(((math.cos(math.pi * (startingPlayerCount/16)) - 1 ) /2) * -1,5)),-2) if p.team == winner then --print(p.name .. " won, adding to Total Wins") p:AddResource(CONSTANTS_API.COMBAT_STATS.TOTAL_WINS, 1) TrackDailyChallenge(p, "Wins", 1) baseXP = startingPlayerCount * VICTORY_XP_PER_PLAYER_AMOUNT baseTP = partWin baseCurrency = silverWin tempTbl["Winner"] = true Events.Broadcast("SetDailyWin", p) elseif winner > 0 then --print(p.name .. " lost, adding to Total Losses") p:AddResource(CONSTANTS_API.COMBAT_STATS.TOTAL_LOSSES, 1) else --print(p.name .. " had a draw") baseXP = startingPlayerCount * VICTORY_XP_PER_PLAYER_AMOUNT/2 baseTP = CoreMath.Round(partWin/2) baseCurrency = CoreMath.Round(silverWin/2) end p:AddResource(CONSTANTS_API.COMBAT_STATS.GAMES_PLAYED_RES, 1) p:SetResource( CONSTANTS_API.COMBAT_STATS.AVERAGE_DAMAGE, math.ceil( p:GetResource(CONSTANTS_API.COMBAT_STATS.TOTAL_DAMAGE_RES) / p:GetResource(CONSTANTS_API.COMBAT_STATS.GAMES_PLAYED_RES) ) ) -- add bonuses from win/loss and surivial bonus p:AddResource(tankRPString, math.floor(baseTP + survivalBonus)) p:AddResource(CONSTANTS_API.XP, math.floor(baseXP + survivalBonus)) p:AddResource(CONSTANTS_API.SILVER, math.floor(baseCurrency + survivalBonus)) local totalTP = p:GetResource(tankRPString) - playerStartingXP[p.id] local totalCurrency = p:GetResource(CONSTANTS_API.SILVER) - playerStartingSilver[p.id] local modifier = 1 local partsGain = p.serverUserData.currentTankData.additionalPartsGain local silverGain = p.serverUserData.currentTankData.additionalSilverGain local usedPremium = 0 local dailyBonus = 0 Task.Wait() if partsGain then p:AddResource(tankRPString, RoundValue(totalTP * partsGain)) p:AddResource(CONSTANTS_API.XP, RoundValue(totalTP * partsGain)) else partsGain = 0 end if silverGain then p:AddResource(CONSTANTS_API.SILVER, totalCurrency * silverGain) else silverGain = 0 end if _G["BONUS"][p.id] then print("Daily bonus applied") modifier = modifier + 1 dailyBonus = 1 p:AddResource(tankRPString, totalTP) p:AddResource(CONSTANTS_API.XP, totalTP) p:AddResource(CONSTANTS_API.SILVER, totalCurrency) end if (UTIL_API.UsingPremiumTank(p:GetResource(TankAPI.EquipResource))) then print("Premium bonus applied") modifier = modifier + 1 usedPremium = 1 p:AddResource(tankRPString, totalTP) p:AddResource(CONSTANTS_API.XP, totalTP) p:AddResource(CONSTANTS_API.SILVER, totalCurrency) end if activeEventPartsMod > 0 then p:AddResource(tankRPString, totalTP * activeEventPartsMod) p:AddResource(CONSTANTS_API.XP, totalTP * activeEventPartsMod) end if activeEventSilverMod > 0 then p:AddResource(CONSTANTS_API.SILVER, totalCurrency * activeEventSilverMod) end if p:IsA("Player") and not p:IsA("AIPlayer") then CalculateNewLevelAndRank(p) end tempTbl["TP"] = totalTP * (modifier + partsGain + activeEventPartsMod) tempTbl["BaseTP"] = baseTP * (modifier + partsGain + activeEventPartsMod) tempTbl["Silver"] = totalCurrency * (modifier + silverGain + activeEventSilverMod) tempTbl["BaseSilver"] = baseCurrency * (modifier + silverGain + activeEventSilverMod) tempTbl["SurvivalBonus"] = survivalBonus * (modifier + partsGain + activeEventPartsMod) tempTbl["SilverSurvivalBonus"] = survivalBonus * (modifier + silverGain + activeEventSilverMod) tempTbl["DamageTracker"] = p:GetResource("DamageTracker") * (modifier + partsGain + activeEventPartsMod) tempTbl["SilverDamageTracker"] = p:GetResource("SilverDamageTracker") * (modifier + silverGain + activeEventSilverMod) tempTbl["SpottingTracker"] = p:GetResource("SpottingTracker") * (modifier + partsGain + activeEventPartsMod) tempTbl["SilverSpottingTracker"] = p:GetResource("SpottingTracker") * (modifier + silverGain + activeEventSilverMod) tempTbl["KillTracker"] = p:GetResource("KillTracker") * (modifier + partsGain + activeEventPartsMod) tempTbl["SilverKillTracker"] = p:GetResource("SilverKillTracker") * (modifier + silverGain + activeEventSilverMod) tempTbl["UsedPremium"] = usedPremium tempTbl["DailyBonus"] = dailyBonus -- DEBUG print("EARNINGS FOR: " .. p.name) for k, v in pairs(tempTbl) do print( k ..";" .. tostring(v)) end local storageData = Storage.GetSharedPlayerData(STORAGE_LEADERBOARD, p) storageData.ROUND = tempTbl Storage.SetSharedPlayerData(STORAGE_LEADERBOARD, p, storageData) --ResourceCheck(p) Task.Wait(0.1) end end function OnDamagedRecord(player, damage) if damage then if damage.sourcePlayer then damage.sourcePlayer:AddResource("TankDamage", damage.amount) damage.sourcePlayer:AddResource("LifetimeDamageDealt", damage.amount) damage.sourcePlayer:AddResource(CONSTANTS_API.COMBAT_STATS.TOTAL_DAMAGE_RES, damage.amount) local damageDealtPercentage = damage.amount / player.maxHitPoints local tankId = player.serverUserData.currentTankData.id local tankXPValue = UTIL_API.GetTankXPValueFromId(tankId) local tankSliverValue = UTIL_API.GetTankSilverValueFromId(tankId) local xpRewarded = math.floor(damageDealtPercentage * tankXPValue) local silverRewarded = math.floor(damageDealtPercentage * tankSliverValue) -- Calculate bonus based on your tier vs enemy local sourceTankId = damage.sourcePlayer.serverUserData.currentTankData.id local sourcePlayerTier = UTIL_API.GetTierFromId(sourceTankId) local targetPlayerTier = UTIL_API.GetTierFromId(tankId) local bonus = 1 + ((targetPlayerTier - sourcePlayerTier) / TIER_BONUS_DIVIDER) --print("BONUS: " .. tostring(bonus)) xpRewarded = xpRewarded * bonus silverRewarded = silverRewarded * bonus --[[ if (UTIL_API.UsingPremiumTank(tonumber(sourceTankId))) then xpRewarded = xpRewarded * 2 silverRewarded = silverRewarded * 2 end ]] if player:IsA("AIPlayer") then xpRewarded = xpRewarded / 2 silverRewarded = silverRewarded / 2 end xpRewarded = math.ceil(xpRewarded) silverRewarded = math.ceil(silverRewarded) Events.BroadcastToPlayer( damage.sourcePlayer, "GainXP", { reason = "DAMAGE_DEALT", amount = xpRewarded, premium = UTIL_API.UsingPremiumTank(tonumber(sourceTankId)) } ) --print("XP rewarded for dealing damage: " .. tostring(xpRewarded)) damage.sourcePlayer:AddResource("DamageTracker", xpRewarded) damage.sourcePlayer:AddResource("SilverDamageTracker", silverRewarded) damage.sourcePlayer:AddResource( UTIL_API.GetTankRPString(damage.sourcePlayer:GetResource(TankAPI.EquipResource)), xpRewarded ) damage.sourcePlayer:AddResource(CONSTANTS_API.SILVER, silverRewarded) damage.sourcePlayer:AddResource(CONSTANTS_API.XP, xpRewarded) if not player.serverUserData.assistedInDeath then player.serverUserData.assistedInDeath = {} end player.serverUserData.assistedInDeath[damage.sourcePlayer.id] = damage.sourcePlayer TrackDailyChallenge(damage.sourcePlayer, "Damage", damage.amount) end end end function OnDiedRecord(player, damage) if damage then player:AddResource(CONSTANTS_API.COMBAT_STATS.TOTAL_DEATHS, 1) if damage.sourcePlayer then damage.sourcePlayer:AddResource(CONSTANTS_API.COMBAT_STATS.TOTAL_KILLS, 1) damage.sourcePlayer:AddResource("LifetimeTanksDestroyed", 1) damage.sourcePlayer:AddResource("MatchKills", 1) if damage.sourcePlayer:GetResource(CONSTANTS_API.COMBAT_STATS.MOST_TANKS_DESTROYED) < damage.sourcePlayer.kills then damage.sourcePlayer:SetResource(CONSTANTS_API.COMBAT_STATS.MOST_TANKS_DESTROYED, damage.sourcePlayer.kills) end TrackDailyChallenge(damage.sourcePlayer, "Kills", 1) local tankId = player.serverUserData.currentTankData.id local sourceTankId = damage.sourcePlayer.serverUserData.currentTankData.id local xpRewarded = KILL_XP_AMOUNT local silverRewarded = KILL_SILVER_AMOUNT local sourcePlayerTier = UTIL_API.GetTierFromId(sourceTankId) local targetPlayerTier = UTIL_API.GetTierFromId(tankId) local bonus = 1 + ((targetPlayerTier - sourcePlayerTier) / TIER_BONUS_DIVIDER) --print("BONUS: " .. tostring(bonus)) local xpRewarded = KILL_XP_AMOUNT * bonus local silverRewarded = KILL_SILVER_AMOUNT * bonus damage.sourcePlayer:AddResource("KillTracker", xpRewarded) damage.sourcePlayer:AddResource("SilverKillTracker", silverRewarded) --print("KILL REWARDS: " .. tostring(damage.sourcePlayer:GetResource("KillTracker")) .. " " .. tostring(damage.sourcePlayer:GetResource("SilverKillTracker"))) damage.sourcePlayer:AddResource( UTIL_API.GetTankRPString(damage.sourcePlayer:GetResource(TankAPI.EquipResource)), xpRewarded ) damage.sourcePlayer:AddResource(CONSTANTS_API.SILVER, silverRewarded) damage.sourcePlayer:AddResource(CONSTANTS_API.XP, xpRewarded) end if player.serverUserData.assistedInDeath then for x, p in pairs(player.serverUserData.assistedInDeath) do if p ~= damage.sourcePlayer then p:AddResource(CONSTANTS_API.COMBAT_STATS.TOTAL_ASSISTS, 1) end player.serverUserData.assistedInDeath[x] = nil end end player.serverUserData.assistedInDeath = {} end end function OnSpotRecord(player, spottingAmount) local currentEarnings = player:GetResource("SpottingTracker") local rewardedAmount = spottingAmount if currentEarnings < SPOTTING_REWARDS_CAP then if currentEarnings + spottingAmount > SPOTTING_REWARDS_CAP then rewardedAmount = SPOTTING_REWARDS_CAP - currentEarnings end player:AddResource("SpottingTracker", rewardedAmount) player:AddResource(CONSTANTS_API.XP, rewardedAmount) player:AddResource(CONSTANTS_API.SILVER, rewardedAmount) player:AddResource(UTIL_API.GetTankRPString(player:GetResource(TANKS.EquipResource)), rewardedAmount) end end function ResourceCheck(player) --print(player.name .. " resource check:") --print("Kills: " .. tostring(player:GetResource(CONSTANTS_API.COMBAT_STATS.TOTAL_KILLS))) --print("Most Kills in a Match: " .. tostring(player:GetResource(CONSTANTS_API.COMBAT_STATS.MOST_TANKS_DESTROYED))) --print("Deaths: " .. tostring(player:GetResource(CONSTANTS_API.COMBAT_STATS.TOTAL_DEATHS))) --print("Assists: " .. tostring(player:GetResource(CONSTANTS_API.COMBAT_STATS.TOTAL_ASSISTS))) --print("Total Damage: " .. tostring(player:GetResource(CONSTANTS_API.COMBAT_STATS.TOTAL_DAMAGE_RES))) --print("Average Damage: " .. tostring(player:GetResource(CONSTANTS_API.COMBAT_STATS.AVERAGE_DAMAGE))) --print("Wins: " .. tostring(player:GetResource(CONSTANTS_API.COMBAT_STATS.TOTAL_WINS))) --print("Losses: " .. tostring(player:GetResource(CONSTANTS_API.COMBAT_STATS.TOTAL_LOSSES))) --print("Total Games: " .. tostring(player:GetResource(CONSTANTS_API.COMBAT_STATS.GAMES_PLAYED_RES))) --print("TankDamage Resource: " .. tostring(player:GetResource("TankDamage"))) --print("Rank: " .. tostring(player:GetResource(CONSTANTS_API.RANK_NAME))) --print("XP: " .. tostring(player:GetResource(CONSTANTS_API.XP)) .. " / " .. tostring(UTIL_API.GetXPToNextRank(player))) --print("===============================================") end function OnResourceChanged(player, resource, value) --print("RESOURCE CHANGED: " .. resource .. " : " .. tostring(value)) if (resource == "XP") then local tnl = UTIL_API.GetXPToNextRank(player) if (value >= tnl) then player:AddResource(CONSTANTS_API.RANK_NAME, 1) player:RemoveResource(CONSTANTS_API.XP, value - tnl) end end end function OnJoined(player) player.damagedEvent:Connect(OnDamagedRecord) player.diedEvent:Connect(OnDiedRecord) player.resourceChangedEvent:Connect(OnResourceChanged) player:SetResource("MatchEndHP", 0) player:SetResource("TankDamage", 0) player:SetResource("MatchKills", 0) player:SetResource("DamageTracker", 0) player:SetResource("SilverDamageTracker", 0) player:SetResource("KillTracker", 0) player:SetResource("SilverKillTracker", 0) player:SetResource("SpottingTracker", 0) playerStartingXP[player.id] = player:GetResource(UTIL_API.GetTankRPString(player:GetResource(TankAPI.EquipResource))) playerStartingSilver[player.id] = player:GetResource(CONSTANTS_API.SILVER) Task.Wait(1) player.serverUserData.MID_MATCH_DATA = {} player.serverUserData.MID_MATCH_DATA.PARTICIPATION = 0 player.serverUserData.MID_MATCH_DATA.DAMAGE = 0 player.serverUserData.MID_MATCH_DATA.RESULT = 0 player.serverUserData.MID_MATCH_DATA.RESULT_REASON = "" --Task.Wait(20) --ResourceCheck(player) end Game.playerJoinedEvent:Connect(OnJoined) Events.Connect("WINNER", SetWinner) Events.Connect("PlayerSpotted", OnSpotRecord) Events.Connect("AIDamaged", OnDamagedRecord) Events.Connect("AIKilled", OnDiedRecord) mainGameStateManager.networkedPropertyChangedEvent:Connect(StateSTART)
--[[========================================= _ _ _ | | | | | | /\ /\ | | | | | | / \ _ __ _ __ / \ _ __ ___ | | | | | |/ /\ \ | '_ \| '_ \ / /\ \ | '__/ __| | |___| |__| / ____ \| |_) | |_) / ____ \| | | (__ |______\____/_/ \_\ .__/| .__/_/ \_\_| \___| Scripting Project | | | | Improved LUA Engine |_| |_| SVN: http://svn.burning-azzinoth.de/LUAppArc LOG: http://luapparc.burning-azzinoth.de/trac/timeline TRAC: http://luapparc.burning-azzinoth.de/trac ---------------------- Original Code by DARKI Version 1 ========================================]]-- --Gurubashi Axe Thrower function AxeThrower_Throw(pUnit, event) pUnit:FullCastSpellOnTarget(22887, pUnit:GetRandomPlayer(0)) end function AxeThrower_AxeFlurry(pUnit, event) pUnit:FullCastSpell(24018) pUnit:RegisterEvent("AxeThrower_AxeFlurry", math.random(14000, 20000), 1) pUnit:RegisterEvent("AxeThrower_Throw", 2000, 4) end function AxeThrower_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("AxeThrower_AxeFlurry", math.random(14000, 20000), 1) end RegisterUnitEvent(11350, 1, "AxeThrower_OnEnterCombat") function AxeThrower_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11350, 2, "AxeThrower_OnWipe") --Gurubashi Bat Rider function BatRider_Bite(pUnit, event) pUnit:FullCastSpellOnTarget(16128, pUnit:GetMainTank()) pUnit:RegisterEvent("BatRider_Bite", math.random(13000, 20000), 1) end function BatRider_Explode(pUnit, event) if pUnit:GetHealthPct() <= 40 then pUnit:CastSpell(24024) pUnit:Kill(pUnit) pUnit:RemoveEvents() end end function BatRider_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("BatRider_Bite", math.random(13000, 20000), 1) pUnit:RegisterEvent("BatRider_Explode", 1000, 0) end RegisterUnitEvent(14750, 1, "BatRider_OnEnterCombat") function BatRider_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(14750, 2, "BatRider_OnWipe") --Gurubashi Berserker function Berserker_Enrage(pUnit, event) if pUnit:GetHealthPct() <= 50 and enrage == nil then enrage=1; pUnit:CastSpell(8269) end end function Berserker_Thunderclap(pUnit, event) pUnit:FullCastSpell(15588) end function Berserker_KnockAway(pUnit, event) local maintank=pUnit:GetMainTank(); pUnit:FullCastSpellOnTarget(11130, maintank) --local threatcalc=pUnit:GetThreat(maintank) / (4); --local playerthreat=threatcalc * (3); --pUnit:ModThreat(maintank, playerthreat) end function Berserker_Fear(pUnit, event) local tbl = pUnit:GetInRangePlayers() for k,v in pairs(tbl) do if pUnit:GetDistance(v) <= 10 then pUnit:FullCastSpell(30584) pUnit:ModThreat(v, 0) pUnit:ModThreat(pUnit:GetRandomPlayer(0), 100) end end end function Berserker_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("Berserker_Enrage", 2000, 0) pUnit:RegisterEvent("Berserker_Thunderclap", 17000, 0) pUnit:RegisterEvent("Berserker_KnockAway", 21000, 0) pUnit:RegisterEvent("Berserker_Fear", 24000, 0) end RegisterUnitEvent(11352, 1, "Berserker_OnEnterCombat") function Berserker_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11352, 2, "Berserker_OnWipe") --Gurubashi Blooddrinker function Blooddrinker_BloodLeech(pUnit, event) pUnit:FullCastSpell(24437) pUnit:RegisterEvent("Blooddrinker_BloodLeech", math.random(16000, 19000), 1) end function Blooddrinker_DrainLife(pUnit, event) pUnit:FullCastSpellOnTarget(24435, pUnit:GetRandomPlayer(0)) end function Blooddrinker_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("Blooddrinker_BloodLeech", math.random(16000, 19000), 1) pUnit:RegisterEvent("Blooddrinker_DrainLife", 25000, 0) end RegisterUnitEvent(11353, 1, "Blooddrinker_BloodLeech") --Gurubashi Headhunter function Headhunter_Impale(pUnit, event) pUnit:FullCastSpellOnTarget(24049, pUnit:GetRandomPlayer(0)) pUnit:RegisterEvent("Headhunter_Impale", math.random(14000, 17000), 1) end function Headhunter_MortalStrike(pUnit, event) pUnit:FullCastSpellOnTarget(15708, pUnit:GetMainTank()) pUnit:RegisterEvent("Headhunter_MortalStrike", math.random(18000, 22000), 1) end function Headhunter_WhirlingTrip(pUnit, event) pUnit:FullCastSpell(24048) pUnit:RegisterEvent("Headhunter_WhirlingTrip", math.random(9000, 14000), 1) end function Headhunter_OnEnterCombat(pUnit, event) pUnit:SendChatMessage(12, 0, "My weapon be thirsty!") pUnit:RegisterEvent("Headhunter_Impale", math.random(14000, 17000), 1) pUnit:RegisterEvent("Headhunter_MortalStrike", math.random(18000, 22000), 1) pUnit:RegisterEvent("Headhunter_WhirlingTrip", math.random(9000, 14000), 1) end RegisterUnitEvent(11351, 1, "Headhunter_OnEnterCombat") function Headhunter_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11351, 2, "Headhunter_OnWipe") --Hakkari Blood Priest function BloodPriest_DrainLife(pUnit, event) pUnit:FullCastSpellOnTarget(24618, pUnit:GetRandomPlayer(0)) end function BloodPriest_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("BloodPriest_DrainLife", 17000, 0) end RegisterUnitEvent(11340, 1, "BloodPriest_OnEnterCombat") function BloodPriest_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11340, 2, "BloodPriest_OnWipe") --Hakkari Priest function HakkariPriest_Heal(pUnit, event) local tbl=pUnit:GetInRangeFriends(); for k,v in pairs(tbl) do mobs={} table.insert(mobs, v) local mob=math.random(1, table.getn(mobs)) pUnit:FullCastSpellOnTarget(22883, mobs[mob]) end end function HakkariPriest_AntiMagicShield(pUnit, event) pUnit:CastSpell(24021) end function HakkariPriest_Fear(pUnit, event) pUnit:FullCastSpell(13704) end function HakkariPriest_OnEnterCombat(pUnit, event) pUnit:SendChatMessage(12, 0, "Your skull gonna decorate our ritual altars!") pUnit:RegisterEvent("HakkariPriest_Heal", 7000, 0) pUnit:RegisterEvent("HakkariPriest_AntiMagicShield", 18000, 0) pUnit:RegisterEvent("HakkariPriest_Fear", 22000, 0) end RegisterUnitEvent(11830, 1, "HakkariPriest_OnEnterCombat") function HakkariPriest_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11830, 2, "HakkariPriest_OnWipe") --Hakkari Shadowcaster function Shadowcaster_ShadowBolt(pUnit, event) if math.random(1, 2) == 1 then pUnit:FullCastSpellOnTarget(15232, pUnit:GetRandomPlayer(0)) else pUnit:FullCastSpell(20741) end end function Shadowcaster_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("Shadowcaster_ShadowBolt", math.random(6000, 10000), 0) end RegisterUnitEvent(11338, 1, "Shadowcaster_OnEnterCombat") function Shadowcaster_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11338, 2, "Shadowcaster_OnWipe") --Hakkari Witch Doctor function WitchDoctor_Hex(pUnit, event) pUnit:FullCastSpellOnTarget(24053, pUnit:GetRandomPlayer(0)) pUnit:RegisterEvent("WitchDoctor_Hex", math.random(14000, 18000), 1) end function WitchDoctor_ShadowShock(pUnit, event) pUnit:FullCastSpellOnTarget(17289, pUnit:GetRandomPlayer(0)) pUnit:RegisterEvent("WitchDoctor_ShadowShock", math.random(10000, 13000), 1) end function WitchDoctor_Shrink(pUnit, event) pUnit:FullCastSpell(24054) end function WitchDoctor_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("WitchDoctor_Hex", math.random(14000, 18000), 1) pUnit:RegisterEvent("WitchDoctor_ShadowShock", math.random(10000, 13000), 1) pUnit:RegisterEvent("WitchDoctor_Shrink", 21000, 0) end RegisterUnitEvent(11831, 1, "WitchDoctor_OnEnterCombat") function WitchDoctor_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11831, 2, "WitchDoctor_OnWipe") --Razzashi Adder function Adder_VenomSpit(pUnit, event) pUnit:FullCastSpellOnTarget(24011, pUnit:GetMainTank()) pUnit:RegisterEvent("Adder_VenomSpit", math.random(16000, 20000), 1) end function Adder_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("Adder_VenomSpit", math.random(16000, 20000), 1) end RegisterUnitEvent(11372, 1, "Adder_OnEnterCombat") function Adder_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11372, 2, "Adder_OnWipe") --Razzashi Cobra function Cobra_Poison(pUnit, event) pUnit:FullCastSpellOnTarget(24097, pUnit:GetMainTank()) pUnit:RegisterEvent("Cobra_Poison", math.random(8000, 12000), 1) end function Cobra_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("Cobra_Poison", math.random(8000, 12000), 1) end RegisterUnitEvent(11373, 1, "Cobra_OnEnterCombat") function Cobra_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11373, 2, "Cobra_OnWipe") --Mad Servant function MadServant_Fireball(pUnit, event) pUnit:FullCastSpellOnTarget(24611, pUnit:GetRandomPlayer(0)) pUnit:RegisterEvent("MadServant_Fireball", math.random(9000, 12000), 1) end function MadServant_Flamestrike(pUnit, event) local player=pUnit:GetRandomPlayer(0); pUnit:CastSpellAoF(24612, player:GetX(), player:GetY(), player:GetZ()) pUnit:RegisterEvent("MadServant_Flamestrike", math.random(14000, 16000), 1) end function MadServant_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("MadServant_Fireball", math.random(9000, 12000), 1) pUnit:RegisterEvent("MadServant_Flamestrike", math.random(14000, 16000), 1) end RegisterUnitEvent(15111, 1, "MadServant_OnEnterCombat") function MadServant_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(15111, 2, "MadServant_OnWipe") --Voodo Slave function Slave_LightningBlast(pUnit, event) pUnit:FullCastSpellOnTarget(43996, pUnit:GetMainTank()) pUnit:RegisterEvent("Slave_LightningBlast", math.random(6000, 8000), 1) end function Slave_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("Slave_LightningBlast", math.random(6000, 8000), 1) end RegisterUnitEvent(14883, 1, "Slave_OnEnterCombat") function Slave_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(14883, 2, "Slave_OnWipe") --Soulflayer function Soulflayer_SoulTap(pUnit, event) pUnit:FullCastSpellOnTarget(24619, pUnit:GetRandomPlayer(7)) pUnit:RegisterEvent("Soulflayer_SoulTap", math.random(18000, 22000), 1) end function Soulflayer_Fear(pUnit, event) pUnit:FullCastSpellOnTarget(22678, pUnit:GetRandomPlayer(0)) pUnit:RegisterEvent("Soulflayer_Fear", math.random(12000, 15000), 1) end function Soulflayer_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("Soulflayer_SoulTap", math.random(18000, 22000), 1) pUnit:RegisterEvent("Soulflayer_Fear", math.random(12000, 15000), 1) end RegisterUnitEvent(11359, 1, "Soulflayer_OnEnterCombat") function Soulflayer_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11359, 2, "Soulflayer_OnWipe") --Son of Hakkar function SonOfHakkar_Knockdown(pUnit, event) pUnit:FullCastSpellOnTarget(16790, pUnit:GetMainTank()) pUnit:RegisterEvent("SonOfHakkar_Knockdown", math.random(8000, 10000), 1) end function SonOfHakkar_OnEnterCombat(pUnit, event) pUnit:RegisterEvent("SonOfHakkar_Knockdown", math.random(8000, 10000), 1) end RegisterUnitEvent(11357, 1, "SonOfHakkar_OnEnterCombat") function SonOfHakkar_OnWipe(pUnit, event) pUnit:RemoveEvents() end RegisterUnitEvent(11357, 2, "SonOfHakkar_OnWipe") function SonOfHakkar_OnDie(pUnit, event) pUnit:RemoveEvents() pUnit:CastSpell(24321) end RegisterUnitEvent(11357, 4, "SonOfHakkar_OnDie")
local defaultOptions = { } ShopButton = nil local optionsWindow local optionsTabBar local options = {} local zBless = nil function init() ShopButton = modules.client_topmenu.addRightGameToggleButton('ZShop', tr('Z Shop').. '', '/images/zshop/zpoints', toggle) -- ShopButton:setOn(false) for k,v in pairs(defaultOptions) do g_settings.setDefault(k, v) options[k] = v end connect(g_game, { onGameStart = online, onGameEnd = offline, }) optionsWindow = g_ui.displayUI('options') -- optionsWindow:hide() changeClanWindow = g_ui.displayUI('Clans') -- changeClanWindow:hide() confirmationWindow = g_ui.displayUI('confirmation') optionsTabBar = optionsWindow:getChildById('optionsTabBar') optionsTabBar:setContentWidget(optionsWindow:getChildById('optionsTabContent')) marketPanel = g_ui.loadUI('market') optionsTabBar:addTab(tr(''), marketPanel, '/images/zshop/marketButton') outfitsPanel = g_ui.loadUI('outfits') optionsTabBar:addTab(tr(''), outfitsPanel, '/images/zshop/outfitsButton') addonsPanel = g_ui.loadUI('addons') optionsTabBar:addTab(tr(''), addonsPanel, '/images/zshop/addonsButton') itemsPanel = g_ui.loadUI('items') optionsTabBar:addTab(tr(''), itemsPanel, '/images/zshop/itemsButton') -- clansPanel = g_ui.loadUI('clans') --optionsTabBar:addTab(tr(''), clansPanel, '/images/ui/shop/8') -- ShopButton:setVisible(false) -- ShopButton:setWidth(32) -- ShopButton:setOpacity(0.5) ProtocolGame.registerExtendedOpcode(66, function(protocol, opcode, buffer) local strings = string.explode(buffer, '-') zPoints = tonumber(strings[1]) dds = tonumber(strings[2]) reload(zPoints,dds) --local buffer = buffer --show(buffer) end) hide() -- local widget = g_ui.createWidget('LocalesButtons', optionsWindow) -- widget:setImageSource('/game_shop/img/shop_logo') end function terminate() disconnect(g_game, { onGameStart = online, onGameEnd = offline, }) ProtocolGame.unregisterExtendedOpcode(66) end function online() ShopButton:setVisible(true) end function offline() hide() ShopButton:setVisible(false) end function setup() setupGraphicsEngines() for k,v in pairs(defaultOptions) do if type(v) == 'boolean' then setOption(k, g_settings.getBoolean(k), true) elseif type(v) == 'number' then setOption(k, g_settings.getNumber(k), true) end end end function toggle() if ShopButton:isOn() then hide() else show() ShopButton:setOn(true) end end function show(buffer) g_game.talk('/reloadShop') if not zPoints then return true end optionsWindow:show() optionsWindow:raise() optionsWindow:focus() if zPoints < 10 then optionsWindow:getChildById('count1'):setMarginRight(35) elseif zPoints < 100 and zPoints >= 10 then optionsWindow:getChildById('count1'):setMarginRight(30) elseif zPoints < 1000 and zPoints >= 100 then optionsWindow:getChildById('count1'):setMarginRight(25) elseif zPoints < 10000 and zPoints >= 1000 then optionsWindow:getChildById('count1'):setMarginRight(20) else optionsWindow:getChildById('count1'):setMarginRight(15) end if dds < 10 then optionsWindow:getChildById('count2'):setMarginRight(113) elseif dds < 100 and dds >= 10 then optionsWindow:getChildById('count2'):setMarginRight(108) elseif dds < 1000 and dds >= 100 then optionsWindow:getChildById('count2'):setMarginRight(103) elseif dds < 10000 and dds >= 1000 then optionsWindow:getChildById('count2'):setMarginRight(98) else optionsWindow:getChildById('count2'):setMarginRight(93) end optionsWindow:getChildById('count1'):setText(zPoints) optionsWindow:getChildById('count2'):setText(dds) -- ShopButton:setOpacity(1.0) optionsWindow:getChildById('diamond'):setItemId(3028) --volcanic = changeClanWindow:getChildById("volcanic") end function hide() optionsWindow:hide() --ShopButton:setOpacity(0.5) hideChangeClan() hideConfirmationWindow() ShopButton:setOn(false) end function buydd() if zPoints > 0 then g_ui.displayUI('buydd'):setVisible(true) else g_game.talk('/buyddfail') end end function reload(zps,dds) if optionsWindow then if optionsWindow:getChildById('count1') then optionsWindow:getChildById('count1'):setText(zps) end if optionsWindow:getChildById('count2') then optionsWindow:getChildById('count2'):setText(dds) end end end function toggleOption(key) setOption(key, not getOption(key)) end function setOption(key, value, force) if not force and options[key] == value then return end g_settings.set(key, value) options[key] = value end function getOption(key) return options[key] end function showMiniWindow() miniWindow = g_ui.displayUI('miniWindow') miniWindow:setVisible(true) end function hideMiniWindow() miniWindow:setVisible(false) end function showMiniWindowDone() miniWindow = g_ui.displayUI('miniWindowDone') miniWindow:setVisible(true) end function openChangeClan() changeClanWindow:show() changeClanWindow:raise() changeClanWindow:focus() costValue = changeClanWindow:getChildById("costValue") clans = changeClanWindow:getChildById("clans") ranks = changeClanWindow:getChildById("ranks") local priceByRank = {["rank1"] = 12, ["rank2"] = 25, ["rank3"] = 37, ["rank4"] = 50} costValue:setText(ranks:getFocusedChild() and priceByRank[ranks:getFocusedChild():getId()] or 99) ranks.onChildFocusChange = function(self, focusedChild) local value = 12 if focusedChild == nil then return end if priceByRank[focusedChild:getId()] then value = priceByRank[focusedChild:getId()] else value = "?" end costValue:setText(value) end return true end function hideChangeClan() changeClanWindow:hide() return true end function changeClanButton() local rankNumber = ranks:getFocusedChild():getId():match("rank(.*)") --match(""..isSpecialType.."(.*)") local clanName = clans:getFocusedChild():getId() --print(clanName..""..rankNumber) local it = clanName..","..rankNumber local str = doCorrectString(clanName).." rank "..rankNumber sendConfirmationWindow(it, "Clan", str, costValue:getText()) return true end function sendConfirmationWindow(item, type, string, value) if not optionsWindow:isVisible() then return true elseif not confirmationWindow:isVisible() then addEvent(function() g_effects.fadeIn(confirmationWindow, 250) end) end confirmationWindow:setVisible(true) confirmationWindow:show() confirmationWindow:raise() confirmationWindow:focus() if type == "Clan" or item == "ChangeGender" then confirmationWindow:getChildById('buyButton'):setText("Change") else confirmationWindow:getChildById('buyButton'):setText("Buy") end if type ~= "Clan" then msg = "Do you want "..(string ~= "Change Gender" and "buy " or "")..""..string.." with "..value.." diamond"..(tonumber(value) > 1 and "s" or "")..""..(item == "sditto" and " and Ditto +50" or "").." ?" confirmationWindow:setText("ZShop Confirmation") confirmationWindow:getChildById('buyItemText'):setText(msg) confirmationWindow.onEnter = function() g_game.talk("/"..type..""..item) hideConfirmationWindow() end confirmationWindow:getChildById('buyButton').onClick = function() g_game.talk("/"..type..""..item) hideConfirmationWindow() end --g_game.talk("/"..type..""..item) else confirmationWindow:setText("Change Clan Confirmation") msg = "Do you want change your clan to "..string.." with "..value.." diamonds ?" confirmationWindow:getChildById('buyItemText'):setText(msg) confirmationWindow.onEnter = function() g_game.talk("/ZSchangeclan "..item) hideConfirmationWindow() end confirmationWindow:getChildById('buyButton').onClick = function() g_game.talk("/ZSchangeclan "..item) hideConfirmationWindow() end end return true end function hideConfirmationWindow() addEvent(function() g_effects.fadeOut(confirmationWindow, 250) end) scheduleEvent(function() confirmationWindow:hide() end, 250) return true end function doChangeClan() return true end function hideMiniWindowDone() miniWindow:setVisible(false) end
local i18n = require("core.i18n") i18n.add { common = { nothing_happens = "何もおきない… ", something_is_put_on_the_ground = "何かが足元に転がってきた。", you_put_in_your_backpack = "{itemname($1, 1)}をバックパックに入れた。", it_is_impossible = "それは無理だ。", }, }
slot0 = class("GuildMissionBattleView") slot1 = Vector3(40, -3, 40) slot2 = 10 slot3 = 1028 slot4 = Vector3(80, -3, 40) function slot5(slot0) slot1 = {} slot2 = {} for slot6, slot7 in ipairs(ys.Battle.BattleConst.FXContainerIndex) do slot2[slot6] = Vector3(slot0[slot6][1], slot0[slot6][2], slot0[slot6][3]) end slot1._FXOffset = slot2 slot1._FXAttachPoint = GameObject() slot1.GetFXOffsets = function (slot0, slot1) return slot0._FXOffset[slot1 or 1] end slot1.GetAttachPoint = function (slot0) return slot0._FXAttachPoint end slot1.GetGO = function (slot0) return slot0._go end slot1.SetGo = function (slot0, slot1) slot0._go = slot1 slot0._FXAttachPoint.transform.SetParent(slot2, slot1.transform, false) slot0._FXAttachPoint.transform.localPosition = Vector3.zero slot0._FXAttachPoint.transform.localEulerAngles = Vector3(330, 0, 0) end slot1.GetSpecificFXScale = function (slot0) return {} end return slot1 end slot0.Ctor = function (slot0, slot1) slot0.rawImage = slot1 setActive(slot0.rawImage, false) slot0.seaCameraGO = GameObject.Find("BarrageCamera") slot0.seaCameraGO.tag = "MainCamera" slot0.seaCamera = slot0.seaCameraGO:GetComponent(typeof(Camera)) slot0.seaCamera.targetTexture = slot0.rawImage.texture slot0.seaCamera.enabled = true slot0.mainCameraGO = pg.UIMgr.GetInstance():GetMainCamera() end slot0.configUI = function (slot0, slot1, slot2) slot0.nameTF = slot2 slot0.healTF = slot1 setActive(slot0.healTF, false) slot0.healTF:GetComponent("DftAniEvent"):SetEndEvent(function () setActive(slot0.healTF, false) setText(slot0.healTF:Find("text"), "") end) end slot0.load = function (slot0, slot1, slot2) ys.Battle.BattleVariable.Init() slot3 = ys.Battle.BattleResourceManager.GetInstance() slot3:Init() slot3:AddPreloadResource(slot3.GetMapResource(slot1)) slot3.StartPreload(slot3, function () pg.UIMgr.GetInstance():LoadingOff() pg.UIMgr.GetInstance().LoadingOff.seaView = ys.Battle.BattleMap.New(ys.Battle.BattleMap.New) setActive(slot0.rawImage, true) GameObject.Find("scenes").transform.position = Vector3(0, -26, 0) Vector3(0, -26, 0):Clear() if 0 then onNextTick(slot3) end end, nil) pg.UIMgr.GetInstance():LoadingOn() end slot0.LoadShip = function (slot0, slot1, slot2, slot3, slot4) if not slot1 then slot4() return end if slot0.shipVO then slot4() return end slot0.unitList = {} slot0.bulletUnitList = {} slot0.shipVO = slot1 slot0.equipSkinId = 0 slot0.weaponIds = slot2 ys.Battle.BattleFXPool.GetInstance():Init() slot0._cldSystem = ys.Battle.BattleCldSystem.New(slot0) slot5 = ys.Battle.BattleResourceManager.GetInstance() slot5:Init() slot5:AddPreloadResource(slot5.GetDisplayCommonResource()) if slot0.equipSkinId > 0 then slot5:AddPreloadResource(slot5.GetEquipSkinPreviewRes(slot0.equipSkinId)) end slot5:AddPreloadResource(slot5.GetCharacterPath(pg.enemy_data_statistics[slot0].prefab), false) slot5:AddPreloadResource(slot5.GetCharacterPath(pg.enemy_data_statistics[slot1].prefab), false) slot5:AddPreloadResource(slot5.GetShipResource(slot1.configId, slot1.skinId), false) if slot1:getShipType() ~= ShipType.WeiXiu then for slot11, slot12 in ipairs(slot2) do if slot12 ~= 0 then for slot17, slot18 in ipairs(slot13) do slot5:AddPreloadResource(slot5.GetWeaponResource(slot18)) end end end end slot5.StartPreload(slot5, function () function slot0(slot0) slot0.seaCharacter = slot0 slot0.transform.localScale = Vector3(slot0:getConfig("scale") / 50 - 0.4, slot1, slot1) slot0.transform.localPosition = slot0:GetCharacterOffset() slot0.transform.localEulerAngles = Vector3(30, 0, 0) slot0.seaAnimator = slot0.transform:GetComponent("SpineAnim") slot0.characterAction = ys.Battle.BattleConst.ActionName.MOVE slot0.seaAnimator:SetAction(slot0.characterAction, 0, true) slot2 = cloneTplTo(slot0.nameTF, slot0) slot2.localPosition = Vector3(0, -0.35, -1) setText(slot2:Find("Text"), slot2) slot4 = slot3(pg.ship_skin_template[slot1.skinId].fx_container) slot4:SetGo(slot0) slot5 = ys.Battle.BattleFXPool.GetInstance() pg.EffectMgr.GetInstance():PlayBattleEffect(slot5:GetCharacterFX("movewave", slot4), Vector3(0, 0, 0), true) slot0.seaFXPool = slot5 if slot1:getShipType() ~= ShipType.WeiXiu then slot0.boneList = {} for slot11, slot12 in pairs(pg.ship_skin_template[slot1.skinId].bound_bone) do slot13 = {} for slot17, slot18 in ipairs(slot12) do if type(slot18) == "table" then slot13[#slot13 + 1] = Vector3(slot18[1], slot18[2], slot18[3]) else slot13[#slot13 + 1] = Vector3.zero end end slot0.boneList[slot11] = slot13[1] end end LeanTween.value(slot0, -20, 0, 2):setOnUpdate(System.Action_float(function (slot0) slot0.transform.position = Vector3(slot0, slot0.transform.position.y, slot0.transform.position.z) end)) end seriesAsync({ function (slot0) slot0:InstCharacter(slot1:getPrefab(), function (slot0) slot0(slot0) slot0() end) end, function (slot0) slot0:CreateMonster(slot0) end, function (slot0) slot0:CreateItemBox(slot0) end }, function () slot0.loaded = true pg.TimeMgr.GetInstance():ResumeBattleTimer() if pg.TimeMgr.GetInstance():getShipType() ~= ShipType.WeiXiu then slot0:onWeaponUpdate() slot0.onWeaponUpdate:SeaUpdate() end if slot2 then slot2() end end) end, nil) end slot0.StartMoveOtherShips = function (slot0, slot1) function slot2(slot0, slot1) LeanTween.value(slot0, slot0.transform.localPosition.x, 80, math.random(5, 8)):setOnUpdate(System.Action_float(function (slot0) slot0.transform.localPosition = Vector3(slot0, slot1.y, slot1.z) end)).setOnComplete(slot5, System.Action(slot1)):setDelay(math.random(0, 5)) end slot3 = {} for slot7, slot8 in ipairs(slot0.otherShipGos) do table.insert(slot3, function (slot0) slot0(slot0, slot0) end) end parallelAsync(slot3, slot1) end slot0.PlayOtherShipAnim = function (slot0, slot1, slot2) if not slot0.loaded then return end slot0.otherShipGos = {} slot3 = ys.Battle.BattleResourceManager.GetInstance() slot3:Init() slot3:AddPreloadResource(slot3.GetDisplayCommonResource()) function slot4(slot0, slot1, slot2) slot2.transform.localScale = Vector3(pg.ship_data_statistics[slot0.id].scale / 50 - 0.4, slot4, slot4) slot2.transform.localPosition = Vector3(-20, 0, slot1) slot2.transform.localEulerAngles = Vector3(30, 0, 0) slot2.transform:GetComponent("SpineAnim").SetAction(slot5, ys.Battle.BattleConst.ActionName.MOVE, 0, true) slot6 = cloneTplTo(slot0.nameTF, slot2) slot6.localPosition = Vector3(0, -0.35, -1) setText(slot6:Find("Text"), slot0.name) slot8 = slot1(pg.ship_skin_template[slot0.skin].fx_container) slot8:SetGo(slot2) pg.EffectMgr.GetInstance():PlayBattleEffect(slot10, Vector3(0, 0, 0), true) table.insert(slot0.otherShipGos, slot2) end slot5 = {} slot6 = { math.random(43, 48), math.random(49, 53) } for slot10, slot11 in ipairs(slot1) do slot3:AddPreloadResource(slot3.GetShipResource(slot11.id, slot11.skin), false) table.insert(slot5, function (slot0) slot1:InstCharacter(pg.ship_skin_template[slot0.skin].prefab, function (slot0) slot0(slot0, slot2[], slot0) slot0() end) end) end function slot7() for slot3, slot4 in ipairs(slot0.otherShipGos) do Destroy(slot4) end slot0.otherShipGos = nil nil() end slot3.StartPreload(slot3, function () seriesAsync(seriesAsync, function () slot0:StartMoveOtherShips(slot0) end) end, nil) end slot0.PlayAttackAnim = function (slot0) slot0.isFinish = nil function slot1() if not slot0.animTimer then return end slot0.animTimer:Stop() slot0.animTimer.Stop.animTimer = nil end seriesAsync({ function (slot0) slot0() slot0.seaEmenyAnimator:SetAction("move", 0, true) slot1.seaEmeny.transform.localPosition = slot0.seaEmenyAnimator + Vector3(40, 0, 0) setActive(slot1.seaEmeny, true) slot1.animTimer = Timer.New(function () slot0.localPosition = Vector3.Lerp(slot0.localPosition, Vector3.Lerp, Time.deltaTime * 3) if Vector3.Distance(Vector3.Lerp(slot0.localPosition, Vector3.Lerp, Time.deltaTime * 3), slot0.localPosition) <= 1 then slot2() end end, 0.033, -1) slot1.animTimer.Start(slot3) end, function (slot0) slot0() if slot0.shipVO:getShipType() ~= ShipType.WeiXiu then slot1:SeaFire() end slot1.animTimer = Timer.New(slot0, 3, 1) slot1.animTimer:Start() end, function (slot0) slot0() if not slot0.isFinish then slot1:HandleBulletHit(nil, slot1.unitList[1]) end slot1.seaAnimator:SetActionCallBack(function (slot0) if slot0 == "finish" then slot0.seaAnimator:SetAction("move", 0, true) slot0.seaAnimator:SetActionCallBack(nil) slot0.seaAnimator.SetActionCallBack() end end) slot1.seaAnimator.SetActionCallBack.seaAnimator.SetAction(slot1, "victory", 0, true) end }) end slot0.PlayItemAnim = function (slot0) function slot1() if not slot0.animTimer then return end slot0.animTimer:Stop() slot0.animTimer.Stop.animTimer = nil end slot1() seriesAsync({ function (slot0) slot0.seaItemBoxAnimator:SetAction("move", 0, true) setActive(slot0.seaItemBox, true) slot0.seaItemBox.transform.localPosition = slot1 slot0.animTimer = Timer.New(function () slot0.localPosition = Vector3.Lerp(slot0.localPosition, Vector3.Lerp, Time.deltaTime * 3) if Vector3.Distance(Vector3.Lerp(slot0.localPosition, Vector3.Lerp, Time.deltaTime * 3), slot0.localPosition) <= 1 then slot2() end end, 0.033, -1) slot0.animTimer.Start(slot2) end, function (slot0) slot0() slot0.seaAnimator:SetActionCallBack(function (slot0) if slot0 == "finish" then slot0.seaAnimator:SetAction("move", 0, true) slot0.seaAnimator:SetActionCallBack(nil) slot0.seaAnimator.SetActionCallBack() end end) slot0.seaAnimator.SetActionCallBack.seaAnimator.SetAction(slot1, "victory", 0, true) end }) end slot0.CreateMonster = function (slot0, slot1) slot3 = ys.Battle.BattleDataFunction.CreateBattleUnitData(slot2, ys.Battle.BattleConst.UnitType.ENEMY_UNIT, -1, slot0, nil, {}, nil, nil, false, 1, 1, nil, nil, 1) slot3:SetPosition(slot1) slot3:ActiveCldBox() slot0._cldSystem:InitShipCld(slot3) slot4 = slot2(slot3:GetTemplate().fx_container) ys.Battle.BattleResourceManager.GetInstance():InstCharacter(slot3:GetTemplate().prefab, function (slot0) slot0:SetGo(slot0) slot0.transform.localScale = Vector3(slot1, slot1, slot1) slot0.transform.localPosition = slot0.transform slot0.transform.localEulerAngles = Vector3(30, 0, 0) slot3 = ys.Battle.BattleFXPool.GetInstance() pg.EffectMgr.GetInstance():PlayBattleEffect(slot4, Vector3(0, 0, 0), true) slot3.seaEmeny = slot0 slot3.seaEmenyAnimator = slot0.transform:GetComponent("SpineAnim") setActive(slot0, false) slot3:GetCharacterFX(slot2, slot0)() end) slot0.unitList[1] = slot3 end slot0.CreateItemBox = function (slot0, slot1) ys.Battle.BattleResourceManager.GetInstance():InstCharacter(pg.enemy_data_statistics[slot0].prefab, function (slot0) slot0.transform.localScale = Vector3(slot1, slot1, slot1) slot0.transform.localPosition = slot1 slot0.transform.localEulerAngles = Vector3(30, 0, 0) slot0.transform.seaItemBox = slot0 slot0.transform.seaItemBoxAnimator = slot0.transform:GetComponent("SpineAnim") setActive(slot0, false) slot0() end) end slot0.playShipAnims = function (slot0) if slot0.loaded and slot0.seaAnimator then slot1 = { "attack", "victory", "dead" } function slot2(slot0) if slot0.seaAnimator then slot0.seaAnimator:SetActionCallBack(nil) end slot0.seaAnimator:SetAction(slot1[slot0], 0, false) slot0.seaAnimator:SetActionCallBack(function (slot0) if slot0 == "finish" then slot0.seaAnimator:SetActionCallBack(nil) slot0.seaAnimator:SetAction("stand", 0, false) end end) end if slot0.palyAnimTimer then slot0.palyAnimTimer.Stop(slot3) slot0.palyAnimTimer = nil end slot0.palyAnimTimer = Timer.New(function () slot0(math.random(1, #slot1)) end, 5, -1) slot0.palyAnimTimer.Start(slot3) slot0.palyAnimTimer.func() end end slot0.onWeaponUpdate = function (slot0) if slot0.loaded and slot0.weaponIds then if slot0.seaAnimator then slot0.seaAnimator:SetActionCallBack(nil) end function slot1() slot1 = slot0.weaponList or {} for slot3, slot4 in slot0(slot1) do slot5 = pairs slot6 = slot4.emitterList or {} for slot8, slot9 in slot5(slot6) do slot9:Destroy() end end slot1 = slot0.bulletList or {} for slot3, slot4 in slot0(slot1) do Object.Destroy(slot4._go) end slot1 = slot0.aircraftList or {} for slot3, slot4 in slot0(slot1) do Object.Destroy(slot4.obj) end slot0.bulletList = {} slot0.aircraftList = {} end if #slot0.weaponIds == 0 and slot0.playRandomAnims then if slot0._fireTimer then slot0._fireTimer.Stop(slot2) end if slot0._delayTimer then slot0._delayTimer:Stop() end if slot0.shipVO:getShipType() ~= ShipType.WeiXiu then slot1() elseif slot0.buffTimer then pg.TimeMgr.GetInstance():RemoveBattleTimer(slot0.buffTimer) slot0.buffTimer = nil end slot0:playShipAnims() elseif slot0.shipVO:getShipType() ~= ShipType.WeiXiu then slot1() slot0:MakeWeapon(slot0.weaponIds) elseif slot0.weaponIds[1] then slot0:MakeBuff(pg.equip_data_statistics[slot2].skill_id[1]) end end end slot0.SeaFire = function (slot0) slot1 = 1 slot2 = nil function slot2() if slot0.weaponList[slot1] then function slot1() slot1 = 0 for slot5, slot6 in ipairs(slot0.emitterList) do slot6:Ready() end for slot5, slot6 in ipairs(slot0.emitterList) do slot6:Fire(nil, slot0, slot1) end slot1 = slot1 + 1 end if slot0.tmpData.action_index ~= "" then slot0.characterAction = slot0.tmpData.action_index slot0.seaAnimator.SetAction(slot2, slot0.characterAction, 0, false) slot0.seaAnimator:SetActionCallBack(function (slot0) if slot0 == "action" then slot0() end end) else slot1() end if slot0.tmpData.type == ys.Battle.BattleConst.EquipmentType.PREVIEW_ARICRAFT then slot0.timer = Timer.New(slot0, 1.5, 1) slot0.timer:Start() end return end if slot0.characterAction ~= ys.Battle.BattleConst.ActionName.MOVE then slot0.characterAction = ys.Battle.BattleConst.ActionName.MOVE slot0.seaAnimator:SetAction(slot0.characterAction, 0, true) slot1 = 1 end end slot2() end slot0.MakeBuff = function (slot0, slot1) slot4 = getSkillConfig(slot1).effect_list[1].arg_list.time slot5 = require("GameCfg.skill.skill_" .. getSkillConfig(slot1).effect_list[1].arg_list.skill_id) if slot0.buffTimer then pg.TimeMgr.GetInstance():RemoveBattleTimer(slot0.buffTimer) slot0.buffTimer = nil end slot0.buffTimer = pg.TimeMgr.GetInstance():AddBattleTimer("buffTimer", -1, slot4, function () setActive(slot0.healTF, true) setText(slot0.healTF:Find("text"), slot1.effect_list[1].arg_list.number) end) end slot0.MakeWeapon = function (slot0, slot1) slot0.weaponList = {} slot0.bulletList = {} slot0.aircraftList = {} slot2 = 0 slot3 = ys.Battle.BattleConst for slot7, slot8 in ipairs(slot1) do for slot13, slot14 in ipairs(slot9) do if slot14 <= 0 then break end slot2 = slot2 + 1 if ys.Battle.BattleDataFunction.GetWeaponPropertyDataFromID(slot14).type == slot3.EquipmentType.MAIN_CANNON or slot15.type == slot3.EquipmentType.SUB_CANNON or slot15.type == slot3.EquipmentType.TORPEDO or slot15.type == slot3.EquipmentType.MANUAL_TORPEDO or slot15.type == slot3.EquipmentType.POINT_HIT_AND_LOCK then if type(slot15.barrage_ID) == "table" then slot0.weaponList[slot2] = { tmpData = slot15, emitterList = {} } for slot19, slot20 in ipairs(slot15.barrage_ID) do slot0.weaponList[slot2].emitterList[slot19] = slot0:createEmitterCannon(slot20, slot15.bullet_ID[slot19], slot15.spawn_bound) end end elseif slot15.type == slot3.EquipmentType.PREVIEW_ARICRAFT and type(slot15.barrage_ID) == "table" then slot0.weaponList[slot2] = { tmpData = slot15, emitterList = {} } for slot19, slot20 in ipairs(slot15.barrage_ID) do slot0.weaponList[slot2].emitterList[slot19] = slot0:createEmitterAir(slot20, slot15.bullet_ID[slot19], slot15.spawn_bound) end end end end end slot0.createEmitterCannon = function (slot0, slot1, slot2, slot3) function slot4(slot0, slot1, slot2, slot3, slot4) slot5 = ys.Battle.BattlePlayerUnit.New(1, ys.Battle.BattleConfig.FRIENDLY_CODE) slot5:SetSkinId(slot0.shipVO.skinId) slot5:SetTemplate(slot0.shipVO.configId, slot6) slot9, slot10 = ys.Battle.BattleDataFunction.CreateBattleBulletData(slot1, slot1, slot5, nil, slot0:GetCharacterOffset() + Vector3(40, 0, 0)) if slot10 then slot0._cldSystem:InitBulletCld(slot9) end slot9:SetOffsetPriority(slot3) slot9:SetShiftInfo(slot0, slot1) slot9:SetRotateInfo(nil, 0, slot2) if slot0.equipSkinId > 0 then slot11 = pg.equip_skin_template[slot0.equipSkinId] slot12, slot13, slot14, slot15 = ys.Battle.BattleDataFunction.GetEquipSkin(slot0.equipSkinId) slot18 = nil if slot9:GetType() == ys.Battle.BattleConst.BulletType.CANNON or slot16 == slot17.BOMB then if _.any({ EquipType.CannonQuZhu, EquipType.CannonQingXun, EquipType.CannonZhongXun, EquipType.CannonZhanlie, EquipType.CannonZhongXun2 }, function (slot0) return table.contains(slot0.equip_type, slot0) end) then slot9.SetModleID(slot9, slot12) elseif slot13 and #slot13 > 0 then slot9:SetModleID(slot13) elseif slot15 and #slot15 > 0 then slot9:SetModleID(slot15) end elseif slot16 == slot17.TORPEDO then if table.contains(slot11.equip_type, EquipType.Torpedo) then slot9:SetModleID(slot12) elseif slot14 and #slot14 > 0 then slot9:SetModleID(slot14) end end end slot13 = nil (slot9:GetType() ~= ys.Battle.BattleConst.BulletType.CANNON or ys.Battle.BattleCannonBullet.New()) and (slot11 ~= slot12.BOMB or ys.Battle.BattleBombBullet.New()) and (slot11 ~= slot12.TORPEDO or ys.Battle.BattleTorpedoBullet.New()) and ys.Battle.BattleBullet.New():SetBulletData(slot9) table.insert(slot0.bulletUnitList, slot9) function slot14(slot0) slot0:SetGO(slot0) slot0:AddRotateScript() if tf(slot0).parent then tf(slot0).parent = nil end slot0:SetSpawn(slot1.boneList[slot2] or Vector3.zero:GetCharacterOffset() + (slot1.boneList[slot2] or Vector3.zero)) if slot1.boneList[slot2] or Vector3.zero.bulletList then table.insert(slot1.bulletList, slot0) end end ys.Battle.BattleResourceManager.GetInstance().InstBullet(slot15, (slot9.GetType() ~= ys.Battle.BattleConst.BulletType.CANNON or ys.Battle.BattleCannonBullet.New()) and (slot11 ~= slot12.BOMB or ys.Battle.BattleBombBullet.New()) and (slot11 ~= slot12.TORPEDO or ys.Battle.BattleTorpedoBullet.New()) and ys.Battle.BattleBullet.New():GetModleID(), function (slot0) slot0(slot0) end) end return ys.Battle.BattleBulletEmitter.New(slot4, function () return end, slot1) end slot0.createEmitterAir = function (slot0, slot1, slot2, slot3) function slot4(slot0, slot1, slot2, slot3, slot4) slot5 = { id = slot0, tmpData = pg.aircraft_template[slot0] } slot8 = Vector3(math.cos(slot7), 0, math.sin(slot7)) function slot9(slot0) slot1 = slot0:GetCharacterOffset() slot0.transform.localPosition = slot1 + Vector3(slot1.position_offset[1] + slot2, slot1.position_offset[2], slot1.position_offset[3] + slot1.position_offset[1] + slot2) slot4 = Vector3(0.1, 0.1, 0.1) slot0.transform.localScale = slot4 slot4.obj = slot0 slot4.tf = slot0.transform slot4.pos = slot1 + Vector3(slot1.position_offset[1] + slot2, slot1.position_offset[2], slot1.position_offset[3] + slot1.position_offset[1] + slot2) slot0.transform.baseVelocity = ys.Battle.BattleFormulas.ConvertAircraftSpeed(slot4.tmpData.speed) ys.Battle.BattleFormulas.ConvertAircraftSpeed(slot4.tmpData.speed).speed = slot4.tmpData.speed * slot4.baseVelocity slot4.tmpData.speed * slot4.baseVelocity.speedZ = (math.random() - 0.5) * 0.5 (math.random() - 0.5) * 0.5.targetZ = slot1.z if slot0.aircraftList then table.insert(slot0.aircraftList, ) end end slot10 = pg.aircraft_template[slot0].model_ID if slot1.equipSkinId > 0 and table.contains(pg.equip_skin_template[slot1.equipSkinId].equip_type, ({ EquipType.FighterAircraft, EquipType.TorpedoAircraft, EquipType.BomberAircraft })[slot6.type]) then slot13 = ys.Battle.BattleDataFunction.GetEquipSkin(slot1.equipSkinId) slot10 = slot13 end ys.Battle.BattleResourceManager.GetInstance():InstAirCharacter(slot10, function (slot0) slot0(slot0) end) end return ys.Battle.BattleBulletEmitter.New(slot4, function () return end, slot1) end slot0.RemoveBullet = function (slot0, slot1, slot2) table.remove(slot0.bulletUnitList, slot1) Object.Destroy(slot0.bulletList[slot1]._go) table.remove(slot0.bulletList, slot1) if slot2 and slot3:GetMissFXID() and slot4 ~= "" then slot9, slot6 = slot0.seaFXPool:GetFX(slot4) pg.EffectMgr.GetInstance():PlayBattleEffect(slot5, slot3:GetPosition() + slot6, true) end end slot0.SeaUpdate = function (slot0) if not slot0.bulletList then return end slot1 = 0 slot2 = -20 slot3 = 60 slot4 = 0 slot5 = 60 slot6 = ys.Battle.BattleConfig slot7 = ys.Battle.BattleConst pg.TimeMgr.GetInstance().AddBattleTimer(slot9, "barrageUpdateTimer", -1, 0.033, function () for slot3 = #slot0.bulletUnitList, 1, -1 do slot0._cldSystem:UpdateBulletCld(slot0.bulletUnitList[slot3]) end for slot3 = #slot0.bulletList, 1, -1 do slot5 = slot0.bulletList[slot3]._bulletData:GetSpeed()() if (slot1 < slot0.bulletList[slot3].GetPosition(slot4).x and slot5.x > 0) or (slot6.z < slot2 and slot5.z < 0) then slot0:RemoveBullet(slot3, false) elseif slot6.x < slot3 and slot5.x < 0 and slot4:GetType() ~= slot4.BulletType.BOMB then slot0:RemoveBullet(slot3, false) else slot4._bulletData:Update(slot7) slot4:Update(slot5) if (slot6 < slot6.z and slot5.z > 0) or slot4._bulletData:IsOutRange(slot5) then slot0:RemoveBullet(slot3, true) end end end for slot3, slot4 in ipairs(slot0.aircraftList) do if slot4.pos + slot4.speed.y < slot7.AircraftHeight + 5 then slot4.speed.y = math.max(0.4, 1 - slot5.y / slot7.AircraftHeight) slot6 = math.min(1, slot5.y / slot7.AircraftHeight) slot4.tf.localScale = Vector3(slot6, slot6, slot6) end slot4.speed.z = slot4.baseVelocity * slot4.speedZ if slot4.baseVelocity < slot4.targetZ - slot5.z then slot4.speed.z = slot4.baseVelocity * 0.5 elseif slot6 < -slot4.baseVelocity then slot4.speed.z = -slot4.baseVelocity * 0.5 else slot4.targetZ = slot0:GetCharacterOffset().z + slot0.GetCharacterOffset().z * (math.random() - 0.5) * 0.6 end if slot1 < slot5.x or slot5.x < slot3 then Object.Destroy(slot4.obj) table.remove(slot0.aircraftList, slot3) else slot4.tf.localPosition = slot5 slot4.pos = slot5 end end slot5 = slot5 + 1 end) end slot0.GetCharacterOffset = function (slot0) return Vector3(0, -3, 40) end slot0.GetTotalBounds = function (slot0) return ({ -70, 20, 90, 70 })[2] + ()[4], ()[2], ()[1], ()[1] + ()[3] end slot0.HandleShipCrashDecelerate = function (slot0) return end slot0.HandleShipCrashDecelerate = function (slot0) return end slot0.HandleShipCrashDamageList = function (slot0) return end slot0.HandleBulletHit = function (slot0, slot1, slot2) for slot6 = #slot0.bulletUnitList, 1, -1 do if slot0.bulletUnitList[slot6] == slot1 then slot0:RemoveBullet(slot6, true) end end if not slot0.isFinish then slot0.isFinish = true setActive(slot0.seaEmeny, false) slot7, slot9 = ys.Battle.BattleFXPool.GetInstance():GetFX("Bomb") pg.EffectMgr.GetInstance():PlayBattleEffect(slot3, slot4:Add(slot2:GetPosition()), true) end end slot0.HandleWallHitByBullet = function (slot0) return end slot0.GetUnitList = function (slot0) return slot0.unitList end slot0.GetAircraftList = function (slot0) return {} end slot0.GetBulletList = function (slot0) return slot0.bulletUnitList end slot0.GetAOEList = function (slot0) return {} end slot0.GetFriendlyCode = function (slot0) return 1 end slot0.GetFoeCode = function (slot0) return -1 end slot0.clear = function (slot0) if slot0.animTimer then slot0.animTimer:Stop() slot0.animTimer = nil end if slot0._cldSystem then slot0._cldSystem:Dispose() end if slot0.timer then slot0.timer:Stop() slot0.timer = nil end pg.TimeMgr.GetInstance():RemoveAllBattleTimer() if slot0.seaCharacter then Destroy(slot0.seaCharacter) slot0.seaCharacter = nil end if slot0.otherShipGos then for slot4, slot5 in ipairs(slot0.otherShipGos) do Destroy(slot5) end slot0.otherShipGos = nil end if slot0.aircraftList then for slot4, slot5 in ipairs(slot0.aircraftList) do Destroy(slot5.obj) end slot0.aircraftList = nil end if slot0.seaView then slot0.seaView:Dispose() slot0.seaView = nil end if slot0.weaponList then for slot4, slot5 in ipairs(slot0.weaponList) do for slot9, slot10 in ipairs(slot5.emitterList) do slot10:Destroy() end end slot0.weaponList = nil end if slot0.bulletList then for slot4, slot5 in ipairs(slot0.bulletList) do Destroy(slot5._go) end slot0.bulletList = nil end if slot0.seaFXPool then slot0.seaFXPool:Clear() slot0.seaFXPool = nil end if slot0.seaEmeny then Destroy(slot0.seaEmeny) slot0.seaEmeny = nil end if slot0.seaItemBox then Destroy(slot0.seaItemBox) slot0.seaItemBox = nil end if slot0.seaFXContainersPool then slot0.seaFXContainersPool:Clear() slot0.seaFXContainersPool = nil end ys.Battle.BattleResourceManager.GetInstance().Clear(slot1) slot0.seaCameraGO.tag = "Untagged" slot0.seaCameraGO = nil slot0.seaCamera = nil slot0.mainCameraGO:SetActive(true) slot0.mainCameraGO = nil slot0.loaded = false if slot0.palyAnimTimer then slot0.palyAnimTimer:Stop() slot0.palyAnimTimer = nil end end return slot0
local libraryUtil = require( 'libraryUtil' ) local VariablesLua = {} local php function VariablesLua.var( name, default ) libraryUtil.checkTypeMulti( 'var', 1, name, { 'string', 'number' } ) libraryUtil.checkTypeMulti( 'var', 2, default, { 'string', 'number', 'nil' } ) name = tostring( name ) default = tostring( default or '' ) return php.var( name, default ) end function VariablesLua.var_final( name, default ) libraryUtil.checkTypeMulti( 'var_final', 1, name, { 'string', 'number' } ) libraryUtil.checkTypeMulti( 'var_final', 2, default, { 'string', 'number', 'nil' } ) name = tostring( name ) default = tostring( default or '' ) return php.var_final( name, default ) end function VariablesLua.vardefine( name, value ) libraryUtil.checkTypeMulti( 'vardefine', 1, name, { 'string', 'number' } ) libraryUtil.checkTypeMulti( 'vardefine', 2, value, { 'string', 'number', 'nil' } ) name = tostring( name ) value = tostring( value or '' ) return php.vardefine( name, value ) end function VariablesLua.vardefineecho( name, value ) libraryUtil.checkTypeMulti( 'vardefineecho', 1, name, { 'string', 'number' } ) libraryUtil.checkTypeMulti( 'vardefineecho', 2, value, { 'string', 'number', 'nil' } ) name = tostring( name ) value = tostring( value or '' ) return php.vardefineecho( name, value ) end function VariablesLua.varexists( name ) libraryUtil.checkTypeMulti( 'varexists', 1, name, { 'string', 'number' } ) name = tostring( name ) return php.varexists( name ) end function VariablesLua.setupInterface( options ) -- Boilerplate VariablesLua.setupInterface = nil php = mw_interface mw_interface = nil -- Register this library in the "mw" global mw = mw or {} mw.ext = mw.ext or {} mw.ext.VariablesLua = VariablesLua package.loaded['mw.ext.VariablesLua'] = VariablesLua end return VariablesLua
pg = pg or {} pg.enemy_data_statistics_6 = { [182] = { cannon = 0, name = "罗利", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 182, bubble_fx = "", dodge_growth = 0, icon = "luoli", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 15, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "luoli", cannon_growth = 0, pilot_ai_template_id = 20001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 1, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 0.6, 0.6, 0 } }, vicegun = { { -0.38, 0.6, 0 } }, torpedo = { { 0, 0, 0 } } }, smoke = { { 70, { { "smoke", { -0.472, 0.233, 0.467 } } } }, { 40, { { "smoke", { 0.42, 1.7, 2.07 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = {}, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [183] = { cannon = 0, name = "阿瑞托莎", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 183, bubble_fx = "", dodge_growth = 0, icon = "aruituosha", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 20, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "aruituosha", cannon_growth = 0, pilot_ai_template_id = 10001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 2, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 0.567, 0.265, 0 } }, vicegun = { { 0.567, 0.265, 0 } }, torpedo = { { 0.567, 0.265, 0 } }, antiaircraft = { { 0.567, 0.265, 0 } } }, smoke = { { 70, { { "smoke", { -0.271, 0.412, 0 } } } }, { 30, { { "smoke", { 0.165, 0.925, 0 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [184] = { cannon = 0, name = "加拉蒂亚", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 184, bubble_fx = "", dodge_growth = 0, icon = "jialadiya", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 20, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "jialadiya", cannon_growth = 0, pilot_ai_template_id = 10001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 2, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 0.121, 0.56, 0 } }, vicegun = { { 0.121, 0.56, 0 } }, torpedo = { { -0.431, 0.53, 0 } }, antiaircraft = { { 0.121, 0.56, 0 } } }, smoke = { { 70, { { "smoke", { -0.227, 0.997, 0 } } } }, { 30, { { "smoke", { -0.271, 0.371, 0 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [185] = { cannon = 0, name = "夕张", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 185, bubble_fx = "", dodge_growth = 0, icon = "xizhang", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 25, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "xizhang", cannon_growth = 0, pilot_ai_template_id = 10001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 3, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 0.2, 0.75, 0 } }, vicegun = { { 0.2, 0.75, 0 } }, torpedo = { { 0.47, 0.14, 0 } }, antiaircraft = { { 0.2, 0.75, 0 } } }, smoke = { { 70, { { "smoke", { -0.39, 0.58, -0.16 } } } }, { 30, { { "smoke", { 0.56, 2.57, -0.58 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [186] = { cannon = 0, name = "长良", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 186, bubble_fx = "", dodge_growth = 0, icon = "changliang", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 25, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "changliang", cannon_growth = 0, pilot_ai_template_id = 75004, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 3, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 0.09, 0.8, 0 } }, vicegun = { { 0.09, 0.8, 0 } }, torpedo = { { 0.19, 0.09, 0 } }, antiaircraft = { { 0.09, 0.8, 0 } } }, smoke = { { 50, { { "smoke", { -0.25, 2.31, 0 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [187] = { cannon = 0, name = "五十铃", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 187, bubble_fx = "", dodge_growth = 0, icon = "wushiling", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 15, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "wushiling", cannon_growth = 0, pilot_ai_template_id = 20001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 3, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 13, 7.5, 8 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 0.71, 0.806, 0.268 } }, antiaircraft = { { 0.71, 0.806, 0.268 } }, torpedo = { { 0, 0, 0 } } }, smoke = { { 70, { { "smoke", { -0.26, 0.686, -0.081 } } } }, { 40, { { "smoke", { -0.46, 0.486, -0.481 } }, { "smoke", { 0.54, 0.486, -0.481 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [188] = { cannon = 0, name = "阿武隈", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 188, bubble_fx = "", dodge_growth = 0, icon = "awuwei", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 15, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "awuwei", cannon_growth = 0, pilot_ai_template_id = 20001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 3, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { -0.5, 0.69, 0 } }, torpedo = { { 0, 0, 0 } } }, smoke = { { 70, { { "smoke", { -0.56, 0.56, 0.1 } } } }, { 40, { { "smoke", { 0.44, 1.851, 2.013 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = {}, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [189] = { cannon = 0, name = "川内", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 189, bubble_fx = "", dodge_growth = 0, icon = "chuannei", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 31, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "chuannei", cannon_growth = 0, pilot_ai_template_id = 70034, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 3, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 8 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 0.08, 0.88, 0 } }, vicegun = { { 0.08, 0.88, 0 } }, torpedo = { { 0.08, 0.19, 0 } }, antiaircraft = { { 0.08, 0.88, 0 } } }, smoke = { { 50, { { "smoke", { -0.28, 2.67, 0 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "bossguangxiao", "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [190] = { cannon = 0, name = "神通", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 190, bubble_fx = "", dodge_growth = 0, icon = "shentong", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 28, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "shentong", cannon_growth = 0, pilot_ai_template_id = 70017, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 3, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 8 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 1.16, 0.66, 0 } }, vicegun = { { 1.16, 0.66, 0 } }, torpedo = { { 0.12, 0.02, 0 } }, antiaircraft = { { 1.16, 0.66, 0 } } }, smoke = { { 50, { { "smoke", { -0.54, 2.43, 0 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "bossguangxiao", "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [191] = { cannon = 0, name = "阿贺野", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 191, bubble_fx = "", dodge_growth = 0, icon = "aheye", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 25, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "aheye", cannon_growth = 0, pilot_ai_template_id = 70033, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 3, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 8 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 1.13, 0.7, 0 } }, vicegun = { { 1.13, 0.7, 0 } }, torpedo = { { 0.1, 0.22, 0 } }, antiaircraft = { { 1.13, 0.7, 0 } } }, smoke = { { 50, { { "smoke", { -0.4, 2.51, 0 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "bossguangxiao", "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [192] = { cannon = 0, name = "柯尼斯堡", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 192, bubble_fx = "", dodge_growth = 0, icon = "kenisibao", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 25, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "kenisibao", cannon_growth = 0, pilot_ai_template_id = 10001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 4, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { -0.425, 0.786, 0 } }, vicegun = { { -0.425, 0.786, 0 } }, torpedo = { { 0.369, 0.232, 0 } }, antiaircraft = { { -0.425, 0.786, 0 } } }, smoke = { { 70, { { "smoke", { -0.531, 0.427, 0 } } } }, { 30, { { "smoke", { 0.24, 2.74, -0.46 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [193] = { cannon = 0, name = "卡尔斯鲁厄", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 193, bubble_fx = "", dodge_growth = 0, icon = "kaersilue", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 25, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "kaersilue", cannon_growth = 0, pilot_ai_template_id = 10001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 4, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { -0.36, 0.73, 0 } }, vicegun = { { -0.36, 0.73, 0 } }, torpedo = { { 0.16, 0.17, 0 } }, antiaircraft = { { -0.35, 0.73, 0 } } }, smoke = { { 70, { { "smoke", { -0.82, 0.86, -0.31 } } } }, { 30, { { "smoke", { 0.6, 2.59, -0.38 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [194] = { cannon = 0, name = "科隆", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 194, bubble_fx = "", dodge_growth = 0, icon = "kelong", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 25, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "kelong", cannon_growth = 0, pilot_ai_template_id = 10001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 4, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 0.92, 0.75, 0 } }, vicegun = { { 0.92, 0.75, 0 } }, torpedo = { { 0.23, 0.23, 0 } }, antiaircraft = { { -0.44, 0.94, 0 } } }, smoke = { { 70, { { "smoke", { 0.57, 0.81, -0.568 } } } }, { 30, { { "smoke", { -0.64, 2.606, -0.472 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [195] = { cannon = 0, name = "莱比锡", type = 2, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 195, bubble_fx = "", dodge_growth = 0, icon = "laibixi", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 2, armor_growth = 0, torpedo_growth = 0, speed = 25, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "laibixi", cannon_growth = 0, pilot_ai_template_id = 10001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 4, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 1, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 1.19, 1.2, 0 } }, vicegun = { { 1.19, 1.2, 0 } }, torpedo = { { -0.13, 0.37, 0 } }, antiaircraft = { { 1.19, 1.2, 0 } } }, smoke = { { 70, { { "smoke", { 0.57, 0.81, -0.568 } } } }, { 30, { { "smoke", { -0.64, 2.606, -0.472 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [196] = { cannon = 0, name = "什罗普郡", type = 3, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 196, bubble_fx = "", dodge_growth = 0, icon = "shiluopujun", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 3, armor_growth = 0, torpedo_growth = 0, speed = 18, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "shiluopujun", cannon_growth = 0, pilot_ai_template_id = 10001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 2, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 2, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 0.96, 0.66, 0 } }, vicegun = { { 0.96, 0.66, 0 } }, torpedo = { { 0.47, 0.24, 0 } }, antiaircraft = { { 0.96, 0.66, 0 } } }, smoke = { { 70, { { "smoke", { -0.559, 0.272, 0 } } } }, { 30, { { "smoke", { 0.293, 2.52, -0.98 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} }, [197] = { cannon = 0, name = "肯特", type = 3, speed_growth = 0, battle_unit_type = 49, air = 0, air_growth = 0, durability = 99999, friendly_cld = 0, armor = 0, id = 197, bubble_fx = "", dodge_growth = 0, icon = "kente", star = 0, torpedo = 0, antisub_growth = 0, rarity = 0, luck_growth = 0, hit_growth = 0, icon_type = 3, armor_growth = 0, torpedo_growth = 0, speed = 18, luck = 0, antisub = 0, scale = 150, wave_fx = "movewave", prefab = "kente", cannon_growth = 0, pilot_ai_template_id = 10001, reload = 150, dodge = 0, reload_growth = 0, hit = 0, nationality = 2, durability_growth = 0, antiaircraft = 0, antiaircraft_growth = 0, armor_type = 2, world_enhancement = { 0, 0, 0, 0, 0, 0, 0 }, cld_box = { 5.5, 7.5, 10 }, cld_offset = { 0, 0, 0 }, aim_offset = { 0, 0, 0 }, bound_bone = { cannon = { { 1.281, 1.004, 0 } }, vicegun = { { 1.281, 1.004, 0 } }, torpedo = { { 0.212, 0.311, 0 } } }, smoke = { { 70, { { "smoke", { 0.25, 0.89, -0.34 } } } }, { 30, { { "smoke", { -0.47, 2.68, -0.09 } } } } }, fx_container = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, specific_fx_scale = {}, appear_fx = { "appearQ" }, position_offset = { 0, 0, 0 }, hp_bar = { 150, 4 }, equipment_list = {}, random_equipment_list = {}, random_nub = {}, buff_list = {} } } return
--[[ Element: Class Icons Toggles the visibility of icons depending on the player's class and specialization. Widget ClassIcons - An array consisting of as many UI Textures as the theoretical maximum return of `UnitPowerMax`. Notes Monk - Chi Orbs Paladin - Holy Power Priest - Shadow Orbs Warlock - Soul Shards Examples local ClassIcons = {} for index = 1, 6 do local Icon = self:CreateTexture(nil, 'BACKGROUND') -- Position and size. Icon:SetSize(16, 16) Icon:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', index * Icon:GetWidth(), 0) ClassIcons[index] = Icon end -- Register with oUF self.ClassIcons = ClassIcons Hooks OverrideVisibility(self) - Used to completely override the internal visibility function. Removing the table key entry will make the element fall-back to its internal function again. Override(self) - Used to completely override the internal update function. Removing the table key entry will make the element fall-back to its internal function again. UpdateTexture(element) - Used to completely override the internal function for updating the power icon textures. Removing the table key entry will make the element fall-back to its internal function again. ]] local parent, ns = ... local oUF = ns.oUF local _, PlayerClass = UnitClass'player' -- Holds the class specific stuff. local ClassPowerID, ClassPowerType local ClassPowerEnable, ClassPowerDisable local RequireSpec, RequireSpell local UpdateTexture = function(element) local red, green, blue, desaturated if(PlayerClass == 'MONK') then red, green, blue = 0, 1, .59 desaturated = true elseif(PlayerClass == 'WARLOCK') then red, green, blue = 1, .5, 1 desaturated = true elseif(PlayerClass == 'PRIEST') then red, green, blue = 1, 1, 1 elseif(PlayerClass == 'PALADIN') then red, green, blue = 1, .96, .41 desaturated = true end for i = 1, #element do local icon = element[i] if(icon.SetDesaturated) then icon:SetDesaturated(desaturated) end icon:SetVertexColor(red, green, blue) end end local Update = function(self, event, unit, powerType) if(unit ~= 'player' or powerType ~= ClassPowerType) then return end local element = self.ClassIcons --[[ :PreUpdate() Called before the element has been updated Arguments self - The ClassIcons element event - The event, that the update is being triggered for ]] if(element.PreUpdate) then element:PreUpdate(event) end local cur, max, oldMax if(event ~= 'ClassPowerDisable') then cur = UnitPower('player', ClassPowerID) max = UnitPowerMax('player', ClassPowerID) for i = 1, max do if(i <= cur) then element[i]:Show() else element[i]:Hide() end end oldMax = element.__max if(max ~= oldMax) then if(max < oldMax) then for i = max + 1, oldMax do element[i]:Hide() end end element.__max = max end end --[[ :PostUpdate(cur, max, hasMaxChanged, event) Called after the element has been updated Arguments self - The ClassIcons element cur - The current amount of power max - The maximum amount of power hasMaxChanged - Shows if the maximum amount has changed since the last update event - The event, which the update happened for ]] if(element.PostUpdate) then return element:PostUpdate(cur, max, oldMax ~= max, event) end end local function Visibility(self, event, unit) local element = self.ClassIcons local shouldEnable if(not UnitHasVehicleUI('player')) then if(not RequireSpec or RequireSpec == GetSpecialization()) then if(not RequireSpell or IsPlayerSpell(RequireSpell)) then self:UnregisterEvent('SPELLS_CHANGED', Visibility) shouldEnable = true else self:RegisterEvent('SPELLS_CHANGED', Visibility, true) end end end local isEnabled = element.isEnabled if(shouldEnable and not isEnabled) then ClassPowerEnable(self) elseif(not shouldEnable and (isEnabled or isEnabled == nil)) then ClassPowerDisable(self) end end local Path = function(self, ...) return (self.ClassIcons.Override or Update) (self, ...) end local VisibilityPath = function(self, ...) return (self.ClassIcons.OverrideVisibility or Visibility) (self, ...) end local ForceUpdate = function(element) return VisibilityPath(element.__owner, 'ForceUpdate', element.__owner.unit) end do ClassPowerEnable = function(self) self:RegisterEvent('UNIT_DISPLAYPOWER', Path) self:RegisterEvent('UNIT_POWER_FREQUENT', Path) Path(self, 'ClassPowerEnable', 'player', ClassPowerType) self.ClassIcons.isEnabled = true end ClassPowerDisable = function(self) self:UnregisterEvent('UNIT_DISPLAYPOWER', Path) self:UnregisterEvent('UNIT_POWER_FREQUENT', Path) local element = self.ClassIcons for i = 1, #element do element[i]:Hide() end Path(self, 'ClassPowerDisable', 'player', ClassPowerType) self.ClassIcons.isEnabled = false end if(PlayerClass == 'MONK') then ClassPowerID = SPELL_POWER_CHI ClassPowerType = "CHI" elseif(PlayerClass == 'PALADIN') then ClassPowerID = SPELL_POWER_HOLY_POWER ClassPowerType = "HOLY_POWER" RequireSpell = 85673 -- Word of Glory elseif(PlayerClass == 'PRIEST') then ClassPowerID = SPELL_POWER_SHADOW_ORBS ClassPowerType = "SHADOW_ORBS" RequireSpec = SPEC_PRIEST_SHADOW RequireSpell = 95740 -- Shadow Orbs elseif(PlayerClass == 'WARLOCK') then ClassPowerID = SPELL_POWER_SOUL_SHARDS ClassPowerType = "SOUL_SHARDS" RequireSpec = SPEC_WARLOCK_AFFLICTION RequireSpell = WARLOCK_SOULBURN end end local Enable = function(self, unit) if(unit ~= 'player' or not ClassPowerID) then return end local element = self.ClassIcons if(not element) then return end element.__owner = self element.__max = #element element.ForceUpdate = ForceUpdate if(RequireSpec) then self:RegisterEvent('PLAYER_TALENT_UPDATE', VisibilityPath, true) end element.ClassPowerEnable = ClassPowerEnable element.ClassPowerDisable = ClassPowerDisable for i = 1, #element do local icon = element[i] if(icon:IsObjectType'Texture' and not icon:GetTexture()) then icon:SetTexCoord(0.45703125, 0.60546875, 0.44531250, 0.73437500) icon:SetTexture([[Interface\PlayerFrame\Priest-ShadowUI]]) end end (element.UpdateTexture or UpdateTexture) (element) return true end local Disable = function(self) local element = self.ClassIcons if(not element) then return end ClassPowerDisable(self) end oUF:AddElement('ClassIcons', VisibilityPath, Enable, Disable)
---- -- Tests for the xlsxwriter.lua relationships class. -- -- Copyright 2014-2015, John McNamara, jmcnamara@cpan.org -- require "Test.More" require "Test.LongString" plan(1) ---- -- Tests setup. -- local expected local got local caption local Relationships = require "xlsxwriter.relationships" local relationships -- Remove extra whitespace in the formatted XML strings. function _clean_xml_string(s) return (string.gsub(s, ">%s+<", "><")) end ---- -- Test the Relationships _assemble_xml_file() method. -- caption = " \tRelationships: Relationships: _assemble_xml_file()" expected = _clean_xml_string([[ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/> <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/> <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/> <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/> <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain" Target="calcChain.xml"/> </Relationships>]]) relationships = Relationships:new() relationships:_set_filehandle(io.tmpfile()) relationships:_add_document_relationship('/worksheet', 'worksheets/sheet1.xml') relationships:_add_document_relationship('/theme', 'theme/theme1.xml') relationships:_add_document_relationship('/styles', 'styles.xml') relationships:_add_document_relationship('/sharedStrings', 'sharedStrings.xml') relationships:_add_document_relationship('/calcChain', 'calcChain.xml') relationships:_assemble_xml_file() got = _clean_xml_string(relationships:_get_data()) is_string(got, expected, caption)
--===========================================================================-- -- -- -- System.Web.HttpSession -- -- -- --===========================================================================-- --===========================================================================-- -- Author : kurapica125@outlook.com -- -- URL : http://github.com/kurapica/PLoop -- -- Create Date : 2016/03/11 -- -- Update Date : 2019/11/16 -- -- Version : 1.2.1 -- --===========================================================================-- PLoop(function(_ENV) namespace "System.Web" --- Represents the interface of session id manager __Sealed__() interface "ISessionIDManager" (function (_ENV) extend "IHttpContextHandler" export { ISessionIDManager } ----------------------------------------------------------------------- -- inherit property -- ----------------------------------------------------------------------- property "ProcessPhase" { set = false, default = IHttpContextHandler.ProcessPhase.Head } property "AsGlobalHandler" { set = false, default = true } ----------------------------------------------------------------------- -- static property -- ----------------------------------------------------------------------- -- the unique id manager __Static__() property "Default" { type = ISessionIDManager, handler = function(self, new, old) if old then old:Dispose() end end } ----------------------------------------------------------------------- -- property -- ----------------------------------------------------------------------- --- The minute count before session time out. property "TimeoutMinutes" { type = NaturalNumber, default = 30 } --- Whether update the time out of the session when accessed property "KeepAlive" { type = Boolean } ----------------------------------------------------------------------- -- inherit method -- ----------------------------------------------------------------------- function Process(self, context) if context.IsInnerRequest then return end local session = context.Session if session.Canceled then return self:RemoveSessionID(context) elseif session.IsNewSession or session.TimeoutChanged then return self:SaveSessionID(context, session) end end ----------------------------------------------------------------------- -- method -- ----------------------------------------------------------------------- --- Gets the session identifier from the context of the current HTTP request. __Abstract__() function GetSessionID(self, context) end --- Creates a unique session identifier. __Abstract__() function CreateSessionID(self, context) end --- Deletes the session identifier in the current HTTP response. __Abstract__() function RemoveSessionID(self, context) end --- Saves a newly created session identifier to the HTTP response. __Abstract__() function SaveSessionID(self, context, session) end --- Validate the session id __Abstract__() function ValidateSessionID(self, id) end ----------------------------------------------------------------------- -- initializer -- ----------------------------------------------------------------------- function __init(self) if self.Application then self.Application[ISessionIDManager] = self else ISessionIDManager.Default = self end end end) --- Represents the interface of sessio1n storage provider __Sealed__() interface "ISessionStorageProvider" (function (_ENV) extend "IHttpContextHandler" "System.Context.ISessionStorageProvider" export { ISessionStorageProvider } ----------------------------------------------------------------------- -- inherit property -- ----------------------------------------------------------------------- property "ProcessPhase" { set = false, default = IHttpContextHandler.ProcessPhase.Head } property "AsGlobalHandler" { set = false, default = true } property "Priority" { set = false, default = IHttpContextHandler.HandlerPriority.Lower } ----------------------------------------------------------------------- -- static property -- ----------------------------------------------------------------------- -- the unique storage provider __Static__() property "Default" { type = ISessionStorageProvider, handler = function(self, new, old) if old then old:Dispose() end end } ----------------------------------------------------------------------- -- inherit method -- ----------------------------------------------------------------------- function Process(self, context) if context.IsInnerRequest then return end return context.Session:SaveSessionItems() end ----------------------------------------------------------------------- -- initializer -- ----------------------------------------------------------------------- function __init(self) if self.Application then self.Application[ISessionStorageProvider] = self else ISessionStorageProvider.Default = self end end end) --- the http session __Sealed__() class "HttpSession" (function (_ENV) inherit "System.Context.Session" export { System.Web.ISessionIDManager, System.Web.ISessionStorageProvider, System.Date, HttpSession, "rawset" } ----------------------------------------------------------------------- -- static property -- ----------------------------------------------------------------------- --- The field of the temporary flag in session items __Static__() property "TemporaryField" { type = String, default = "_PL_TEMP_SESSION" } ----------------------------------------------------------------------- -- property -- ----------------------------------------------------------------------- --- Whether the session is temporary property "IsTemporary" { type = Boolean, default = function(self) return self.Items[HttpSession.TemporaryField] and true or false end, handler = function(self, val) self.Items[HttpSession.TemporaryField] = val and 1 or nil if not val then self:RefreshTimeout() end end } --- The http context property "Context" { type = HttpContext } --- The Session Storage Provider property "SessionStorageProvider" { set = false, default = function(self) return self.Context.Application[ISessionStorageProvider] or ISessionStorageProvider.Default end } ----------------------------------------------------------------------- -- method -- ----------------------------------------------------------------------- function RefreshTimeout(self) local man = self.Context.Application[ISessionIDManager] or ISessionIDManager.Default self.Timeout = Date.Now:AddMinutes(man.TimeoutMinutes) end ----------------------------------------------------------------------- -- constructor -- ----------------------------------------------------------------------- --- Get or generate the session for a http context __Arguments__{ System.Web.HttpContext } function __ctor(self, context) self.Context = context -- Build Session local manager = context.Application[ISessionIDManager] or ISessionIDManager.Default local provider = context.Application[ISessionStorageProvider] or ISessionStorageProvider.Default if not manager then throw("No SessionIDManager Installed") end if not provider then throw("No SessionStorageProvider Installed") end local id = manager:GetSessionID(context) local item = id and provider:GetItems(id) if item then self.SessionID = id self.RawItems = item if manager.KeepAlive then self.Timeout= Date.Now:AddMinutes(manager.TimeoutMinutes) end else id, item = nil, {} while not (id and provider:TrySetItems(id, item)) do id = manager:CreateSessionID(context) end self.SessionID = id self.RawItems = item self.IsNewSession = true self.Timeout = Date.Now:AddMinutes(manager.TimeoutMinutes) end end end) --- A test session storage provider __Sealed__() class "System.Web.TableSessionStorageProvider" { System.Context.TableSessionStorageProvider, System.Web.ISessionStorageProvider } end)
require("Utilities") function Server_StartGame(game, standing) if (Mod.Settings.Version ~= 1)then return end; --TODO we can move stuff here around better so we don't call unneeded things publicGameData = Mod.PublicGameData playerGameData = Mod.PlayerGameData; --Call playerGameDataSetup if we havn't done it already for _,pid in pairs(game.ServerGame.Game.Players)do if(pid.IsAI == false)then if (playerGameData[pid.ID] == nil )then print('Doing playerGameDataSetup') playerGameDataSetup(game, standing); end; end end; if (Mod.Settings.ModBetterCitiesEnabled)then StartGameBetterCities(game, standing) end; if (Mod.Settings.ModWinningConditionsEnabled)then StartGameWinCon(game, standing) end; Mod.PublicGameData = publicGameData; Mod.PlayerGameData = playerGameData; end function playerGameDataSetup(game, standing) --Set the mod boolean flag to be enabled publicGameData.GameFinalized = false; publicGameData.Diplo = {}; publicGameData.Chat = {}; broadCastGroupSetup(game); for _,pid in pairs(game.ServerGame.Game.Players)do if(pid.IsAI == false)then playerGameData[pid.ID] = {}; playerGameData[pid.ID].Chat = {}; -- For the chat function playerGameData[pid.ID].Diplo = {}; -- For the diplo function --TODO more diplo stuff playerGameData[pid.ID].Diplo.PendingProposals = {} playerGameData[pid.ID].WinCon = {}; --For WinCon mod playerGameData[pid.ID].WinCon.HoldTerritories = {}; end end end function broadCastGroupSetup(game) publicGameData.Chat.BroadcastGroup = {}; publicGameData.Chat.BroadcastGroup[1] = "When a game ends, all chat messages can be made public. Also, check out settings and tweek it to your liking." publicGameData.Chat.BroadcastGroup[2] = "Note that messages to the server is rate-limited to 5 calls every 30 seconds per client. Therefore, do not spam chat or group changes: it won't work!" publicGameData.Chat.BroadcastGroup[3] = "BETA! Please report any bugs and feedback to TBest. Not everything has been tested yet, so I aplogize for any issues you may run into" publicGameData.Chat.BroadcastGroup.NumChat = 3 end function StartGameWinCon(game, standing) for _,pid in pairs(game.ServerGame.Game.Players)do if(pid.IsAI == false)then Dump(playerGameData) playerGameData[pid.ID].WinCon = {}; playerGameData[pid.ID].WinCon.Capturedterritories = 0; playerGameData[pid.ID].WinCon.Lostterritories = 0; playerGameData[pid.ID].WinCon.Ownedterritories = 0; playerGameData[pid.ID].WinCon.Capturedbonuses = 0; playerGameData[pid.ID].WinCon.Lostbonuses = 0; playerGameData[pid.ID].WinCon.Ownedbonuses = 0; playerGameData[pid.ID].WinCon.Killedarmies = 0; playerGameData[pid.ID].WinCon.Lostarmies = 0; playerGameData[pid.ID].WinCon.Ownedarmies = 0; playerGameData[pid.ID].WinCon.Eleminateais = 0; playerGameData[pid.ID].WinCon.Eleminateplayers = 0; playerGameData[pid.ID].WinCon.Eleminateaisandplayers = 0; end end for _,terr in pairs(standing.Territories)do if(terr.OwnerPlayerID ~= WL.PlayerID.Neutral)then if(game.ServerGame.Game.PlayingPlayers[terr.OwnerPlayerID].IsAI == false)then playerGameData[terr.OwnerPlayerID].WinCon.Ownedterritories = playerGameData[terr.OwnerPlayerID].WinCon.Ownedterritories+1; playerGameData[terr.OwnerPlayerID].WinCon.Ownedarmies = playerGameData[terr.OwnerPlayerID].WinCon.Ownedarmies+terr.NumArmies.NumArmies; end end end for _,boni in pairs(game.Map.Bonuses)do local Match = true; for _,terrid in pairs(boni.Territories)do if(pid == nil)then pid = standing.Territories[terrid].OwnerPlayerID; end if(pid ~= standing.Territories[terrid].OwnerPlayerID)then Match = false; end end if(Match == true)then if(pid ~= WL.PlayerID.Neutral and game.ServerGame.Game.PlayingPlayers[pid].IsAI == false)then playerGameData[pid].WinCon.Ownedbonuses = playerGameData[pid].WinCon.Ownedbonuses+1; end end pid = nil; end Mod.PlayerGameData = playerGameData; end function StartGameBetterCities( game, standing ) --If we are not doing anything, return if (Mod.Settings.StartingCitiesActive == false and Mod.Settings.WastlandCities == false and Mod.Settings.CustomSenarioCapitals == false)then return; end --Make a city on all starting territories local structure = {} Cities = WL.StructureType.City structure[Cities] = Mod.Settings.NumberOfStartingCities; for _, territory in pairs(standing.Territories) do if (territory.IsNeutral == false and Mod.Settings.StartingCitiesActive == true) then --Players starts with a city territory.Structures = structure elseif (territory.NumArmies.NumArmies == game.Settings.WastelandSize and Mod.Settings.WastlandCities == true and territory.IsNeutral == true) then --Wastelands starts with a city. structure[Cities] = 1; territory.Structures = structure structure[Cities] = Mod.Settings.NumberOfStartingCities; end --Capitals results in bigger city --Useful for Custom scenario, where players can start with a lot of territories if (territory.NumArmies.NumArmies == Mod.Settings.CustomSenarioCapitals and territory.IsNeutral == false) then structure[Cities] = Mod.Settings.CapitalExtraStartingCities; territory.Structures = structure; --Reset to 1, as we loop back to the next territory. structure[Cities] = Mod.Settings.NumberOfStartingCities; end end end
local errors = require('errors') errors.deprecate( "Module `cartridge.graphql.execute` is deprecated." .. " Use `require('graphql.execute')` instead." ) return require('graphql.execute')
--[[ Name: sh_unconscious.lua For: santosrp By: Maw, Unknown? past devs, Rustic7 ]]-- GM.Uncon = {} if gspeak then function gspeak:player_alive( pPlayer ) if not pPlayer:Alive() then return false end return not pPlayer:IsUncon() end end local pmeta = debug.getregistry().Player function pmeta:IsUncon() return self:GetNWBool( "Uncon", false ) end function pmeta:GetRagdoll() return self:GetNWEntity( "pl_ragdoll" ) end function pmeta:IsRagdolled() return IsValid( self:GetRagdoll() ) end --HACK!! This should maybe get gspeak to play nice g_OldPlayerGetPos = g_OldPlayerGetPos or debug.getregistry().Entity.GetPos debug.getregistry().Player.GetPos = function( pPlayer, ... ) if pPlayer:IsRagdolled() then return pPlayer:GetRagdoll():GetPos() end return g_OldPlayerGetPos( pPlayer, ... ) end if SERVER then function pmeta:BecomeRagdoll( intDuration, bNoWakeOnMotion ) if IsValid( self:GetNWEntity("pl_ragdoll") ) then self:GetNWEntity( "pl_ragdoll" ):Remove() end local ragdoll = ents.Create( "prop_ragdoll" ) ragdoll.RagdollPlayer = self ragdoll:SetPos( self:GetPos() +(vector_up *6)) ragdoll:SetAngles( self:GetAngles() ) ragdoll:SetModel( self:GetModel() ) ragdoll:SetSkin( self:GetSkin() ) ragdoll:Spawn() ragdoll:Activate() ragdoll:SetCollisionGroup( COLLISION_GROUP_VEHICLE ) ragdoll.AdminPhysGun = true self:SetParent( ragdoll ) -- So their player will match up (position-wise) with where their ragdoll is. self:DeleteOnRemove( ragdoll ) -- Copy bodygroups for k, v in pairs( self:GetBodyGroups() ) do ragdoll:SetBodygroup( v.id, self:GetBodygroup(v.id) ) end -- Set velocity for each peice of the ragdoll local velocity = self:GetVelocity() velocity = Vector( math.Clamp( velocity.x, -5000, 5000 ), math.Clamp( velocity.y, -5000, 5000 ), math.Clamp( velocity.z, -5000, 5000 ) ) local idx = 1 while true do local phys_obj = ragdoll:GetPhysicsObjectNum( idx ) idx = idx +1 if IsValid( phys_obj ) then phys_obj:SetVelocity( velocity ) else break end end hook.Call( "GamemodeOnPlayerRagdolled", GAMEMODE, self, ragdoll ) self.m_intLastHealth = self:Health() self:Spectate( OBS_MODE_CHASE ) self:SpectateEntity( ragdoll ) self:StripWeapons() self:SetNWEntity( "pl_ragdoll", ragdoll ) if intDuration and intDuration > 0 then timer.Simple( intDuration, function() if IsValid( self ) and not self:Alive() then return end if IsValid( ragdoll ) and bNoWakeOnMotion and ragdoll:GetVelocity():Length() > 50 then local timerID = "CheckForRagdollMotion".. self:EntIndex() timer.Create( timerID, intDuration, 0, function() if not IsValid( self ) or not IsValid( ragdoll ) or not self:Alive() then timer.Destroy( timerID ) return end if ragdoll:GetVelocity():Length() <= 50 then timer.Destroy( timerID ) self:UnRagdoll() end end ) elseif IsValid( self ) and IsValid( ragdoll ) then self:UnRagdoll() end end ) end return ragdoll end function pmeta:UnRagdoll( bNoSpawn, bIgnoreHealth ) local health = self:Health() local ragdoll = self:GetNWEntity( "pl_ragdoll" ) self:SetParent() self:UnSpectate() if not IsValid( ragdoll ) then if not bNoSpawn then self:Spawn() end else local pos = ragdoll:GetPos() +Vector( 0, 0, 1 ) if not bNoSpawn then self:Spawn() end local yaw = ragdoll:GetAngles().yaw self:SetAngles( Angle(0, yaw, 0) ) self:SetPos( pos ) self:SetVelocity( ragdoll:GetVelocity() ) ragdoll:Remove() GAMEMODE.Util:UnstuckPlayer( self ) end if not bIgnoreHealth then self:SetHealth( math.max(1, health) )-- math.max(1, self.m_intLastHealth) ) end hook.Call( "GamemodeOnPlayerUnRagdolled", GAMEMODE, self ) end function pmeta:GoUncon( bDontRagdoll, bPlayerDead ) --if self:IsUncon() then return end hook.Call( "GamemodePrePlayerGoUncon", {}, self ) self:SendLua( [[GAMEMODE:OnSpawnMenuClose()]] ) self.m_intOldHealth = self:Health() self:SetNWBool( "Uncon", true ) if not bDontRagdoll then self:BecomeRagdoll( nil, true ).IsUncon = true end local noMedics = GAMEMODE.Jobs:GetNumPlayers( JOB_EMS ) <= 0 if bPlayerDead then self:SetNWFloat( "StartDie", CurTime() -(7 *60) ) else self:SetNWFloat( "StartDie", CurTime() -(noMedics and 3 *60 or 0) ) end hook.Call( "GamemodePlayerGoUncon", {}, self ) local index = self:EntIndex() timer.Create( "Moan".. index, 15, 0, function() if IsValid( self ) and self:IsUncon() then self:EmitSound( "vo/npc/male01/moan0".. math.random(1, 5), 85 ) else timer.Destroy( "Moan".. index ) end end ) self.NextBeat = CurTime() end function pmeta:WakeUp( bNoSpawn, bKeepVars, bIgnoreHealth ) if self:IsUncon() then local health = self:Health() self.m_bKeepUnconOnSpawn = true self:UnRagdoll( bNoSpawn, bIgnoreHealth ) if not bKeepVars then self:SetNWBool( "Uncon", false ) self:SetNWFloat( "StartDie", 0 ) self.NextBeat = nil self:EmitSound( "vo/npc/male01/moan04.wav", 90, 90, 1, CHAN_VOICE ) timer.Destroy( "Moan".. self:EntIndex() ) if not bIgnoreHealth then self:SetHealth( math.max(1, health) ) --self.m_intLastHealth or 0) ) end end if self:InVehicle() and self:GetVehicle().IsStretcher then self:ExitVehicle() end end end function GM.Uncon:HealthOverTime( int ) --x = health, y = time. Quadratic health loss system. return ( -(int *int) /(600 *12) ) +50 end function GM.Uncon:BeatsPerSecond( int ) --x = beats, y = time. Heart slows down before death. return ( ((-int *int) /(600 *12)) +110 ) /60 end function GM.Uncon:Tick() for k, v in pairs( player.GetAll() ) do if not v:IsUncon() then continue end if v:InVehicle() then if not v:GetVehicle().IsStretcher then v:ExitVehicle() return end v:SetNWFloat( "StartDie", CurTime() ) end local startdie = v:GetNWFloat( "StartDie" ) v:SetHealth( math.Round(self:HealthOverTime(CurTime() -startdie)) ) if v:Health() < 1 then --On Death. local rag = v:GetNWEntity( "pl_ragdoll" ) local positions = {} if IsValid( rag ) then for i = 0, rag:GetBoneCount() -1 do positions[i] = rag:GetBonePosition( i ) end end v:WakeUp( nil, nil, true ) v.m_bSkipDeathWait = true hook.Call( "GamemodeOnCharacterDeath", GAMEMODE, v ) v:Kill() local deathrag = v:GetRagdollEntity() if IsValid( deathrag ) then for k, v in pairs( positions ) do if not deathrag.SetBonePosition then continue end --wtf is with that error? deathrag:SetBonePosition( k, v ) end end end if v.NextBeat and CurTime() >= v.NextBeat then v.NextBeat = CurTime() +self:BeatsPerSecond( CurTime() -startdie ) if IsValid( v:GetRagdoll() ) then --v:GetRagdoll():EmitSound( "santosrp/heartbeat.wav", 60, 100, 1, CHAN_AUTO ) end end end end function GM.Uncon:PlayerSpawn( pPlayer ) if pPlayer:IsUncon() then if pPlayer.m_bKeepUnconOnSpawn then pPlayer.m_bKeepUnconOnSpawn = nil return end pPlayer:WakeUp( true ) elseif pPlayer:IsRagdolled() then pPlayer:UnRagdoll( true ) end end function GM.Uncon:EntityTakeDamage( eEnt, pDamageInfo ) if eEnt:IsPlayer() then if pDamageInfo:GetDamage() >= eEnt:Health() then eEnt:GoUncon() return true end end --if eEnt:IsPlayer() then -- if not eEnt:IsUncon() then -- if pDamageInfo:GetDamageType() == 17 then -- pDamageInfo:ScaleDamage( 0.5 ) -- end -- -- if pDamageInfo:GetDamage() <= 80 and pDamageInfo:GetDamage() >= eEnt:Health() then -- eEnt:GoUncon() -- return true -- end -- else -- --Finish him faster if it's intentional. -- if pDamageInfo:GetAttacker():IsPlayer() then -- pDamageInfo:ScaleDamage( 1.5 ) -- end -- end --end if eEnt:IsRagdoll() then if IsValid( eEnt.RagdollPlayer ) then --and eEnt.RagdollPlayer:IsUncon() then if eEnt.RagdollPlayer:Alive() then pDamageInfo:ScaleDamage( 0.33 ) eEnt.RagdollPlayer:TakeDamageInfo( pDamageInfo ) if eEnt:GetBonePosition(eEnt:LookupBone('ValveBiped.Bip01_Head1')):Distance(pDamageInfo:GetDamagePosition()) <10 then eEnt.RagdollPlayer:WakeUp( nil, nil, true ) eEnt.RagdollPlayer.m_bSkipDeathWait = true hook.Call( "GamemodeOnCharacterDeath", GAMEMODE, eEnt.RagdollPlayer ) eEnt.RagdollPlayer:Kill() end end return true end end end function GM.Uncon:PlayerDeath( pPlayer ) -- end function GM:CreateEntityRagdoll( eEnt, entRagdoll ) if eEnt:IsPlayer() and entRagdoll then entRagdoll:Remove() end end function GM.Uncon:CanPlayerEnterVehicle( pPlayer, entCar ) if pPlayer:IsUncon() and not entCar.IsStretcher then return false end end function GM.Uncon:DoPlayerDeath( pPlayer, pAttacker, pDamageInfo ) if pPlayer:IsUncon() then pPlayer:WakeUp() end if not pPlayer:IsRagdolled() then pPlayer:BecomeRagdoll( 0 ) end end concommand.Add( "srp_dev_unrag", function( pPlayer ) if not DEV_SERVER then if not pPlayer:IsSuperAdmin() then return end end if pPlayer:IsUncon() then pPlayer:WakeUp() elseif pPlayer:IsRagdolled() then pPlayer:UnRagdoll() end end ) else local mat = Material( "nomad/vignette_death.png", "unlitgeneric ignorez" ) function GM.Uncon:PaintUnconOverlay() local ply = LocalPlayer() if ply:IsUncon() then DrawMotionBlur( 0.055, 1, 0.001 ) surface.SetMaterial( mat ) surface.SetDrawColor( Color(255, 255, 255, 255) ) surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() ) draw.NoTexture() surface.SetDrawColor( Color(0, 0, 0, (math.abs(math.cos(RealTime() *0.2)) +.2) *255) ) surface.DrawRect( 0, 0, ScrW(), ScrH() ) if not ply:InVehicle() then local timeelapsed = CurTime() -ply:GetNWFloat( "StartDie" ) local text = string.ToMinutesSeconds( 600 -timeelapsed ) draw.SimpleText( text, "Trebuchet24", ScrW() /2, 200, Color(255, 0, 0), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( text, "Trebuchet24", ScrW() /2 +2, 200 +2, Color(0, 0, 0), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) else local text = "Stabilized" draw.SimpleText( text, "Trebuchet24", ScrW() /2, 200, Color(0, 200, 0), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( text, "Trebuchet24", ScrW() /2 +2, 200+2, Color(0, 0, 0), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) end end end end
local insertionSort = require("modules/InsertionSort") local shellSort = require("modules/ShellSort") function main() print("Lua Start") -- insertionSort.Sort() shellSort.Sort() end main()
Scaleform = {} local scaleform = {} scaleform = setmetatable({}, scaleform) scaleform.__call = function() return true end scaleform.__index = scaleform function Scaleform.Request(Name) local ScaleformHandle = RequestScaleformMovie(Name) local data = {name = Name, handle = ScaleformHandle} return setmetatable(data, scaleform) end function scaleform:CallFunction(theFunction, returndata, ...) BeginScaleformMovieMethod(self.handle, theFunction) local arg = {...} if arg ~= nil then for i=1,#arg do local sType = type(arg[i]) if sType == "boolean" then PushScaleformMovieMethodParameterBool(arg[i]) elseif sType == "number" then if math.type(arg[i]) == "integer" then PushScaleformMovieMethodParameterInt(arg[i]) else PushScaleformMovieMethodParameterFloat(arg[i]) end elseif sType == "string" then if arg[i]:find("^desc_{") ~= nil or arg[i]:find("^menu_lobby_desc_{") ~= nil then BeginTextCommandScaleformString(arg[i]) EndTextCommandScaleformString_2() elseif arg[i]:find("^PauseMenu_") ~= nil then BeginTextCommandScaleformString(arg[i]) EndTextCommandScaleformString_2() else PushScaleformMovieMethodParameterString(arg[i]) end end end end if not returndata then EndScaleformMovieMethod() else return EndScaleformMovieMethodReturnValue() end end function scaleform:Render2D() DrawScaleformMovieFullscreen(self.handle, 255, 255, 255, 255) end function scaleform:Render2DNormal(x, y, width, height) DrawScaleformMovie(self.handle, x, y, width, height, 255, 255, 255, 255) end function scaleform:Render2DScreenSpace(locx, locy, sizex, sizey) local Width, Height = GetScreenResolution() local x = locy / Width local y = locx / Height local width = sizex / Width local height = sizey / Height DrawScaleformMovie(self.handle, x + (width / 2.0), y + (height / 2.0), width, height, 255, 255, 255, 255) end function scaleform:Render3D(x, y, z, rx, ry, rz, scalex, scaley, scalez) DrawScaleformMovie_3dNonAdditive(self.handle, x, y, z, rx, ry, rz, 2.0, 2.0, 1.0, scalex, scaley, scalez, 2) end function scaleform:Render3DAdditive(x, y, z, rx, ry, rz, scalex, scaley, scalez) DrawScaleformMovie_3d(self.handle, x, y, z, rx, ry, rz, 2.0, 2.0, 1.0, scalex, scaley, scalez, 2) end function scaleform:Dispose() SetScaleformMovieAsNoLongerNeeded(self.handle) self = nil end function scaleform:IsValid() return self and true or false end function scaleform:IsLoaded() return HasScaleformMovieLoaded(self.handle) end
--lua端的全局事件号以10000起始,c#的是1~9999 local GlobalEvents = BaseClass(CS.UnityMMO.GlobalEvents) GlobalEvents.GameStart = 10000 return GlobalEvents
slot0 = class("MiniGameProxy", import(".NetProxy")) slot0.ON_HUB_DATA_UPDATE = "on hub data update" slot0.ON_MINI_GAME_DATA_UPDATE = "on_mini_game_data_update" slot0.register = function (slot0) slot0.miniGameHubDataDic = {} slot0.miniGameDataDic = {} end slot0.CheckHasHub = function (slot0, slot1) return slot0.miniGameHubDataDic[slot1] ~= nil end slot0.GetMiniGameData = function (slot0, slot1) if slot0.miniGameDataDic[slot1] == nil then slot0.miniGameDataDic[slot1] = MiniGameData.New({ id = slot1 }) end return slot0.miniGameDataDic[slot1] end slot0.GetHubByHubId = function (slot0, slot1) if slot0.miniGameHubDataDic[slot1] == nil then slot0.miniGameHubDataDic[slot1] = MiniGameHubData.New({ id = slot1 }) end return slot0.miniGameHubDataDic[slot1] end slot0.GetHubByGameId = function (slot0, slot1) if slot0.miniGameHubDataDic[slot0:GetMiniGameData(slot1).getConfig(slot2, "hub_id")] == nil then slot0.miniGameHubDataDic[slot3] = MiniGameHubData.New({ id = slot3 }) end return slot0.miniGameHubDataDic[slot3] end slot0.UpdataHubData = function (slot0, slot1) slot3 = slot0:GetHubByHubId(slot2) slot3:UpdateData(slot1) slot0.facade:sendNotification(slot0.ON_HUB_DATA_UPDATE, slot3) end slot0.RequestInitData = function (slot0, slot1, slot2) slot4 = slot0:GetMiniGameData(slot1):getConfig("request_data") == 1 if slot2 and not slot4 then return end if slot3:CheckInTime() then slot5 = slot0:GetHubByGameId(slot1) if (slot3:getConfig("type") == MiniGameConst.MG_TYPE_2 or slot6 == MiniGameConst.MG_TYPE_3) and not slot3:GetRuntimeData("fetchData") then slot0:sendNotification(GAME.SEND_MINI_GAME_OP, { hubid = slot5.id, cmd = MiniGameOPCommand.CMD_SPECIAL_GAME, args1 = { slot3.id, 1 } }) slot3:SetRuntimeData("fetchData", true) end end end slot0.remove = function (slot0) return end return slot0
--[[ MyGame.OtherNameSpace.Unused Automatically generated by the FlatBuffers compiler, do not modify. Or modify. I'm a message, not a cop. flatc version: 2.0.5 Declared by : //include_test/sub/include_test2.fbs Rooting type : MyGame.Example.Monster (//monster_test.fbs) --]] local flatbuffers = require('flatbuffers') local Unused = {} local mt = {} function Unused.New() local o = {} setmetatable(o, {__index = mt}) return o end function mt:Init(buf, pos) self.view = flatbuffers.view.New(buf, pos) end function mt:A() return self.view:Get(flatbuffers.N.Int32, self.view.pos + 0) end function Unused.CreateUnused(builder, a) builder:Prep(4, 4) builder:PrependInt32(a) return builder:Offset() end return Unused
local skynet = require "skynet" local logger = require "logger" local json = require "cjson" local futil = require "futil" local clustermc = require "clustermc" local function boot() skynet.newservice("logservice") skynet.newservice("clustermgr") skynet.timeout(200, function() --调用远程服务要在服务名前加'@'符号 local v = clustermc.call(1, "@sdb", "GET", "a") logger.info("get a :%s", v) clustermc.send(1, "@sdb", "SET", "a", "setfromcluster2") local v = clustermc.call(1, "@sdb", "GET", "a") logger.info("get a :%s", v) local v = clustermc.call(1, "@sdb", "GET", "b") logger.info("get b :%s", v) end) end skynet.start(function() local ok, res = xpcall(boot, futil.handle_err) if not ok then skynet.error(string.format("boot fail::%s", tostring(res))) else skynet.error("boot success !") end end)
setenv("PYTHON_VERSION", myModuleVersion()) setenv("LEVEL","MPI")
local ADDON_NAME, ADDON = ... local bankFrame = {} bankFrame.__index = bankFrame function DJBagsRegisterBankFrame(self, bags) for k, v in pairs(bankFrame) do self[k] = v end ADDON.eventManager:Add('BANKFRAME_OPENED', self) ADDON.eventManager:Add('BANKFRAME_CLOSED', self) table.insert(UISpecialFrames, self:GetName()) self:RegisterForDrag("LeftButton") self:SetScript("OnDragStart", function(self, ...) self:StartMoving() end) self:SetScript("OnDragStop", function(self, ...) self:StopMovingOrSizing(...) end) self:SetUserPlaced(true) end function DJBagsBankTab_OnClick(tab) PanelTemplates_SetTab(DJBagsBankBar, tab.tab) if tab.tab == 1 then DJBagsBank:Show() DJBagsReagents:Hide() BankFrame.selectedTab = 1 BankFrame.activeTabIndex = 1 else DJBagsBank:Hide() DJBagsReagents:Show() BankFrame.selectedTab = 2 BankFrame.activeTabIndex = 2 end end function bankFrame:BANKFRAME_OPENED() self:Show() DJBagsBag:Show() end function bankFrame:BANKFRAME_CLOSED() self:Hide() end
STRING_PEDS = { "a_c_alligator_01", "a_c_alligator_02", "a_c_alligator_03", "a_c_armadillo_01", "a_c_badger_01", "a_c_bat_01", "a_c_bear_01", "a_c_bearblack_01", "a_c_beaver_01", "a_c_bighornram_01", "a_c_bluejay_01", "a_c_boar_01", "a_c_boarlegendary_01", "a_c_buck_01", "a_c_buffalo_01", "a_c_buffalo_tatanka_01", "a_c_bull_01", "a_c_californiacondor_01", "a_c_cardinal_01", "a_c_carolinaparakeet_01", "a_c_cat_01", "a_c_cedarwaxwing_01", "a_c_chicken_01", "a_c_chipmunk_01", "a_c_cormorant_01", "a_c_cougar_01", "a_c_cow", "a_c_coyote_01", "a_c_crab_01", "a_c_cranewhooping_01", "a_c_crawfish_01", "a_c_crow_01", "a_c_deer_01", "a_c_dogamericanfoxhound_01", "a_c_dogaustraliansheperd_01", "a_c_dogbluetickcoonhound_01", "a_c_dogcatahoulacur_01", "a_c_dogchesbayretriever_01", "a_c_dogcollie_01", "a_c_doghobo_01", "a_c_doghound_01", "a_c_doghusky_01", "a_c_doglab_01", "a_c_doglion_01", "a_c_dogpoodle_01", "a_c_dogrufus_01", "a_c_dogstreet_01", "a_c_donkey_01", "a_c_duck_01", "a_c_eagle_01", "a_c_egret_01", "a_c_elk_01", "a_c_fishbluegil_01_ms", "a_c_fishbluegil_01_sm", "a_c_fishbullheadcat_01_ms", "a_c_fishbullheadcat_01_sm", "a_c_fishchainpickerel_01_ms", "a_c_fishchainpickerel_01_sm", "a_c_fishchannelcatfish_01_lg", "a_c_fishchannelcatfish_01_xl", "a_c_fishlakesturgeon_01_lg", "a_c_fishlargemouthbass_01_lg", "a_c_fishlargemouthbass_01_ms", "a_c_fishlongnosegar_01_lg", "a_c_fishmuskie_01_lg", "a_c_fishnorthernpike_01_lg", "a_c_fishperch_01_ms", "a_c_fishperch_01_sm", "a_c_fishrainbowtrout_01_lg", "a_c_fishrainbowtrout_01_ms", "a_c_fishredfinpickerel_01_ms", "a_c_fishredfinpickerel_01_sm", "a_c_fishrockbass_01_ms", "a_c_fishrockbass_01_sm", "a_c_fishsalmonsockeye_01_lg", "a_c_fishsalmonsockeye_01_ml", "a_c_fishsalmonsockeye_01_ms", "a_c_fishsmallmouthbass_01_lg", "a_c_fishsmallmouthbass_01_ms", "a_c_fox_01", "a_c_frogbull_01", "a_c_gilamonster_01", "a_c_goat_01", "a_c_goosecanada_01", "a_c_hawk_01", "a_c_heron_01", "a_c_horse_americanpaint_greyovero", "a_c_horse_americanpaint_overo", "a_c_horse_americanpaint_splashedwhite", "a_c_horse_americanpaint_tobiano", "a_c_horse_americanstandardbred_black", "a_c_horse_americanstandardbred_buckskin", "a_c_horse_americanstandardbred_lightbuckskin", "a_c_horse_americanstandardbred_palominodapple", "a_c_horse_americanstandardbred_silvertailbuckskin", "a_c_horse_andalusian_darkbay", "a_c_horse_andalusian_perlino", "a_c_horse_andalusian_rosegray", "a_c_horse_appaloosa_blacksnowflake", "a_c_horse_appaloosa_blanket", "a_c_horse_appaloosa_brownleopard", "a_c_horse_appaloosa_fewspotted_pc", "a_c_horse_appaloosa_leopard", "a_c_horse_appaloosa_leopardblanket", "a_c_horse_arabian_black", "a_c_horse_arabian_grey", "a_c_horse_arabian_redchestnut_pc", "a_c_horse_arabian_redchestnut", "a_c_horse_arabian_rosegreybay", "a_c_horse_arabian_warpedbrindle_pc", "a_c_horse_arabian_white", "a_c_horse_ardennes_bayroan", "a_c_horse_ardennes_irongreyroan", "a_c_horse_ardennes_strawberryroan", "a_c_horse_belgian_blondchestnut", "a_c_horse_belgian_mealychestnut", "a_c_horse_breton_grullodun", "a_c_horse_breton_mealydapplebay", "a_c_horse_breton_redroan", "a_c_horse_breton_sealbrown", "a_c_horse_breton_sorrel", "a_c_horse_breton_steelgrey", "a_c_horse_buell_warvets", "a_c_horse_criollo_baybrindle", "a_c_horse_criollo_bayframeovero", "a_c_horse_criollo_blueroanovero", "a_c_horse_criollo_dun", "a_c_horse_criollo_marblesabino", "a_c_horse_criollo_sorrelovero", "a_c_horse_dutchwarmblood_chocolateroan", "a_c_horse_dutchwarmblood_sealbrown", "a_c_horse_dutchwarmblood_sootybuckskin", "a_c_horse_eagleflies", "a_c_horse_gang_bill", "a_c_horse_gang_charles_endlesssummer", "a_c_horse_gang_charles", "a_c_horse_gang_dutch", "a_c_horse_gang_hosea", "a_c_horse_gang_javier", "a_c_horse_gang_john", "a_c_horse_gang_karen", "a_c_horse_gang_kieran", "a_c_horse_gang_lenny", "a_c_horse_gang_micah", "a_c_horse_gang_sadie_endlesssummer", "a_c_horse_gang_sadie", "a_c_horse_gang_sean", "a_c_horse_gang_trelawney", "a_c_horse_gang_uncle_endlesssummer", "a_c_horse_gang_uncle", "a_c_horse_hungarianhalfbred_darkdapplegrey", "a_c_horse_hungarianhalfbred_flaxenchestnut", "a_c_horse_hungarianhalfbred_liverchestnut", "a_c_horse_hungarianhalfbred_piebaldtobiano", "a_c_horse_john_endlesssummer", "a_c_horse_kentuckysaddle_black", "a_c_horse_kentuckysaddle_buttermilkbuckskin_pc", "a_c_horse_kentuckysaddle_chestnutpinto", "a_c_horse_kentuckysaddle_grey", "a_c_horse_kentuckysaddle_silverbay", "a_c_horse_kladruber_black", "a_c_horse_kladruber_cremello", "a_c_horse_kladruber_dapplerosegrey", "a_c_horse_kladruber_grey", "a_c_horse_kladruber_silver", "a_c_horse_kladruber_white", "a_c_horse_missourifoxtrotter_amberchampagne", "a_c_horse_missourifoxtrotter_sablechampagne", "a_c_horse_missourifoxtrotter_silverdapplepinto", "a_c_horse_morgan_bay", "a_c_horse_morgan_bayroan", "a_c_horse_morgan_flaxenchestnut", "a_c_horse_morgan_liverchestnut_pc", "a_c_horse_morgan_palomino", "a_c_horse_mp_mangy_backup", "a_c_horse_murfreebrood_mange_01", "a_c_horse_murfreebrood_mange_02", "a_c_horse_murfreebrood_mange_03", "a_c_horse_mustang_goldendun", "a_c_horse_mustang_grullodun", "a_c_horse_mustang_tigerstripedbay", "a_c_horse_mustang_wildbay", "a_c_horse_nokota_blueroan", "a_c_horse_nokota_reversedappleroan", "a_c_horse_nokota_whiteroan", "a_c_horse_shire_darkbay", "a_c_horse_shire_lightgrey", "a_c_horse_shire_ravenblack", "a_c_horse_suffolkpunch_redchestnut", "a_c_horse_suffolkpunch_sorrel", "a_c_horse_tennesseewalker_blackrabicano", "a_c_horse_tennesseewalker_chestnut", "a_c_horse_tennesseewalker_dapplebay", "a_c_horse_tennesseewalker_flaxenroan", "a_c_horse_tennesseewalker_goldpalomino_pc", "a_c_horse_tennesseewalker_mahoganybay", "a_c_horse_tennesseewalker_redroan", "a_c_horse_thoroughbred_blackchestnut", "a_c_horse_thoroughbred_bloodbay", "a_c_horse_thoroughbred_brindle", "a_c_horse_thoroughbred_dapplegrey", "a_c_horse_thoroughbred_reversedappleblack", "a_c_horse_turkoman_darkbay", "a_c_horse_turkoman_gold", "a_c_horse_turkoman_silver", "a_c_horse_winter02_01", "a_c_horsemule_01", "a_c_horsemulepainted_01", "a_c_iguana_01", "a_c_iguanadesert_01", "a_c_javelina_01", "a_c_legendarypanther_01", "a_c_lionmangy_01", "a_c_loon_01", "a_c_moose_01", "a_c_muskrat_01", "a_c_oriole_01", "a_c_owl_01", "a_c_ox_01", "a_c_panther_01", "a_c_panthercde_01", "a_c_pantherlegendaryr_01", "a_c_parrot_01", "a_c_pelican_01", "a_c_pheasant_01", "a_c_pig_01", "a_c_pigeon", "a_c_possum_01", "a_c_prairiechicken_01", "a_c_pronghorn_01", "a_c_quail_01", "a_c_rabbit_01", "a_c_raccoon_01", "a_c_rat_01", "a_c_raven_01", "a_c_redfootedbooby_01", "a_c_robin_01", "a_c_rooster_01", "a_c_roseatespoonbill_01", "a_c_seagull_01", "a_c_sharkhammerhead_01", "a_c_sharktiger", "a_c_sheep_01", "a_c_skunk_01", "a_c_snake_01", "a_c_snake_pelt_01", "a_c_snakeblacktailrattle_01", "a_c_snakeblacktailrattle_pelt_01", "a_c_snakeferdelance_01", "a_c_snakeferdelance_pelt_01", "a_c_snakeredboa_01", "a_c_snakeredboa_pelt_01", "a_c_snakeredboa10ft_01", "a_c_snakewater_01", "a_c_snakewater_pelt_01", "a_c_songbird_01", "a_c_sparrow_01", "a_c_squirrel_01", "a_c_toad_01", "a_c_turkey_01", "a_c_turkey_02", "a_c_turkeywild_01", "a_c_turtlesea_01", "a_c_turtlesnapping_01", "a_c_vulture_01", "a_c_wolf_medium", "a_c_wolf_small", "a_c_wolf", "a_c_woodpecker_01", "a_c_woodpecker_02", "a_f_m_armcholeracorpse_01", "a_f_m_armtownfolk_01", "a_f_m_armtownfolk_02", "a_f_m_asbtownfolk_01", "a_f_m_bivfancytravellers_01", "a_f_m_blwtownfolk_01", "a_f_m_blwtownfolk_02", "a_f_m_blwupperclass_01", "a_f_m_btchillbilly_01", "a_f_m_btcobesewomen_01", "a_f_m_bynfancytravellers_01", "a_f_m_familytravelers_cool_01", "a_f_m_familytravelers_warm_01", "a_f_m_gamhighsociety_01", "a_f_m_grifancytravellers_01", "a_f_m_guatownfolk_01", "a_f_m_htlfancytravellers_01", "a_f_m_lagtownfolk_01", "a_f_m_lowersdtownfolk_01", "a_f_m_lowersdtownfolk_02", "a_f_m_lowersdtownfolk_03", "a_f_m_lowertrainpassengers_01", "a_f_m_middlesdtownfolk_01", "a_f_m_middlesdtownfolk_02", "a_f_m_middlesdtownfolk_03", "a_f_m_middletrainpassengers_01", "a_f_m_nbxslums_01", "a_f_m_nbxupperclass_01", "a_f_m_nbxwhore_01", "a_f_m_rhdprostitute_01", "a_f_m_rhdtownfolk_01", "a_f_m_rhdtownfolk_02", "a_f_m_rhdupperclass_01", "a_f_m_rkrfancytravellers_01", "a_f_m_roughtravellers_01", "a_f_m_sclfancytravellers_01", "a_f_m_sdchinatown_01", "a_f_m_sdfancywhore_01", "a_f_m_sdobesewomen_01", "a_f_m_sdserversformal_01", "a_f_m_sdslums_02", "a_f_m_skpprisononline_01", "a_f_m_strtownfolk_01", "a_f_m_tumtownfolk_01", "a_f_m_tumtownfolk_02", "a_f_m_unicorpse_01", "a_f_m_uppertrainpassengers_01", "a_f_m_valprostitute_01", "a_f_m_valtownfolk_01", "a_f_m_vhtprostitute_01", "a_f_m_vhttownfolk_01", "a_f_m_waptownfolk_01", "a_f_o_blwupperclass_01", "a_f_o_btchillbilly_01", "a_f_o_guatownfolk_01", "a_f_o_lagtownfolk_01", "a_f_o_sdchinatown_01", "a_f_o_sdupperclass_01", "a_f_o_waptownfolk_01", "a_m_m_armcholeracorpse_01", "a_m_m_armdeputyresident_01", "a_m_m_armtownfolk_01", "a_m_m_armtownfolk_02", "a_m_m_asbboatcrew_01", "a_m_m_asbdeputyresident_01", "a_m_m_asbminer_01", "a_m_m_asbminer_02", "a_m_m_asbminer_03", "a_m_m_asbminer_04", "a_m_m_asbtownfolk_01_laborer", "a_m_m_asbtownfolk_01", "a_m_m_bivfancydrivers_01", "a_m_m_bivfancytravellers_01", "a_m_m_bivroughtravellers_01", "a_m_m_bivworker_01", "a_m_m_blwforeman_01", "a_m_m_blwlaborer_01", "a_m_m_blwlaborer_02", "a_m_m_blwobesemen_01", "a_m_m_blwtownfolk_01", "a_m_m_blwupperclass_01", "a_m_m_btchillbilly_01", "a_m_m_btcobesemen_01", "a_m_m_bynfancydrivers_01", "a_m_m_bynfancytravellers_01", "a_m_m_bynroughtravellers_01", "a_m_m_bynsurvivalist_01", "a_m_m_cardgameplayers_01", "a_m_m_chelonian_01", "a_m_m_deliverytravelers_cool_01", "a_m_m_deliverytravelers_warm_01", "a_m_m_dominoesplayers_01", "a_m_m_emrfarmhand_01", "a_m_m_familytravelers_cool_01", "a_m_m_familytravelers_warm_01", "a_m_m_farmtravelers_cool_01", "a_m_m_farmtravelers_warm_01", "a_m_m_fivefingerfilletplayers_01", "a_m_m_foreman", "a_m_m_gamhighsociety_01", "a_m_m_grifancydrivers_01", "a_m_m_grifancytravellers_01", "a_m_m_griroughtravellers_01", "a_m_m_grisurvivalist_01", "a_m_m_guatownfolk_01", "a_m_m_htlfancydrivers_01", "a_m_m_htlfancytravellers_01", "a_m_m_htlroughtravellers_01", "a_m_m_htlsurvivalist_01", "a_m_m_huntertravelers_cool_01", "a_m_m_huntertravelers_warm_01", "a_m_m_jamesonguard_01", "a_m_m_lagtownfolk_01", "a_m_m_lowersdtownfolk_01", "a_m_m_lowersdtownfolk_02", "a_m_m_lowertrainpassengers_01", "a_m_m_middlesdtownfolk_01", "a_m_m_middlesdtownfolk_02", "a_m_m_middlesdtownfolk_03", "a_m_m_middletrainpassengers_01", "a_m_m_moonshiners_01", "a_m_m_nbxdockworkers_01", "a_m_m_nbxlaborers_01", "a_m_m_nbxslums_01", "a_m_m_nbxupperclass_01", "a_m_m_nearoughtravellers_01", "a_m_m_rancher_01", "a_m_m_ranchertravelers_cool_01", "a_m_m_ranchertravelers_warm_01", "a_m_m_rhddeputyresident_01", "a_m_m_rhdforeman_01", "a_m_m_rhdobesemen_01", "a_m_m_rhdtownfolk_01_laborer", "a_m_m_rhdtownfolk_01", "a_m_m_rhdtownfolk_02", "a_m_m_rhdupperclass_01", "a_m_m_rkrfancydrivers_01", "a_m_m_rkrfancytravellers_01", "a_m_m_rkrroughtravellers_01", "a_m_m_rkrsurvivalist_01", "a_m_m_sclfancydrivers_01", "a_m_m_sclfancytravellers_01", "a_m_m_sclroughtravellers_01", "a_m_m_sdchinatown_01", "a_m_m_sddockforeman_01", "a_m_m_sddockworkers_02", "a_m_m_sdfancytravellers_01", "a_m_m_sdlaborers_02", "a_m_m_sdobesemen_01", "a_m_m_sdroughtravellers_01", "a_m_m_sdserversformal_01", "a_m_m_sdslums_02", "a_m_m_skpprisoner_01", "a_m_m_skpprisonline_01", "a_m_m_smhthug_01", "a_m_m_strdeputyresident_01", "a_m_m_strfancytourist_01", "a_m_m_strlaborer_01", "a_m_m_strtownfolk_01", "a_m_m_tumtownfolk_01", "a_m_m_tumtownfolk_02", "a_m_m_uniboatcrew_01", "a_m_m_unicoachguards_01", "a_m_m_unicorpse_01", "a_m_m_unigunslinger_01", "a_m_m_uppertrainpassengers_01", "a_m_m_valcriminals_01", "a_m_m_valdeputyresident_01", "a_m_m_valfarmer_01", "a_m_m_vallaborer_01", "a_m_m_valtownfolk_01", "a_m_m_valtownfolk_02", "a_m_m_vhtboatcrew_01", "a_m_m_vhtthug_01", "a_m_m_vhttownfolk_01", "a_m_m_wapwarriors_01", "a_m_o_blwupperclass_01", "a_m_o_btchillbilly_01", "a_m_o_guatownfolk_01", "a_m_o_lagtownfolk_01", "a_m_o_sdchinatown_01", "a_m_o_sdupperclass_01", "a_m_o_waptownfolk_01", "a_m_y_asbminer_01", "a_m_y_asbminer_02", "a_m_y_asbminer_03", "a_m_y_asbminer_04", "a_m_y_nbxstreetkids_01", "a_m_y_nbxstreetkids_slums_01", "a_m_y_sdstreetkids_slums_02", "a_m_y_unicorpse_01", "am_valentinedoctors_females_01", "amsp_robsdgunsmith_males_01", "casp_coachrobbery_lenny_males_01", "casp_coachrobbery_micah_males_01", "casp_hunting02_males_01", "charro_saddle_01", "cr_strawberry_males_01", "cs_abe", "cs_aberdeenpigfarmer", "cs_aberdeensister", "cs_abigailroberts", "cs_acrobat", "cs_adamgray", "cs_agnesdowd", "cs_albertcakeesquire", "cs_albertmason", "cs_andershelgerson", "cs_angel", "cs_angryhusband", "cs_angusgeddes", "cs_ansel_atherton", "cs_antonyforemen", "cs_archerfordham", "cs_archibaldjameson", "cs_archiedown", "cs_artappraiser", "cs_asbdeputy_01", "cs_ashton", "cs_balloonoperator", "cs_bandbassist", "cs_banddrummer", "cs_bandpianist", "cs_bandsinger", "cs_baptiste", "cs_bartholomewbraithwaite", "cs_bathingladies_01", "cs_beatenupcaptain", "cs_beaugray", "cs_billwilliamson", "cs_bivcoachdriver", "cs_blwphotographer", "cs_blwwitness", "cs_braithwaitebutler", "cs_braithwaitemaid", "cs_braithwaiteservant", "cs_brendacrawley", "cs_bronte", "cs_brontesbutler", "cs_brotherdorkins", "cs_brynntildon", "cs_bubba", "cs_cabaretmc", "cs_cajun", "cs_cancan_01", "cs_cancan_02", "cs_cancan_03", "cs_cancan_04", "cs_cancanman_01", "cs_captainmonroe", "cs_cassidy", "cs_catherinebraithwaite", "cs_cattlerustler", "cs_cavehermit", "cs_chainprisoner_01", "cs_chainprisoner_02", "cs_charlessmith", "cs_chelonianmaster", "cs_cigcardguy", "cs_clay", "cs_cleet", "cs_clive", "cs_colfavours", "cs_colmodriscoll", "cs_cooper", "cs_cornwalltrainconductor", "cs_crackpotinventor", "cs_crackpotrobot", "cs_creepyoldlady", "cs_creolecaptain", "cs_creoledoctor", "cs_creoleguy", "cs_dalemaroney", "cs_daveycallender", "cs_davidgeddes", "cs_desmond", "cs_didsbury", "cs_dinoboneslady", "cs_disguisedduster_01", "cs_disguisedduster_02", "cs_disguisedduster_03", "cs_doroetheawicklow", "cs_drhiggins", "cs_drmalcolmmacintosh", "cs_duncangeddes", "cs_dusterinformant_01", "cs_dutch", "cs_eagleflies", "cs_edgarross", "cs_edith_john", "cs_edithdown", "cs_edmundlowry", "cs_escapeartist", "cs_escapeartistassistant", "cs_evelynmiller", "cs_exconfedinformant", "cs_exconfedsleader_01", "cs_exoticcollector", "cs_famousgunslinger_01", "cs_famousgunslinger_02", "cs_famousgunslinger_03", "cs_famousgunslinger_04", "cs_famousgunslinger_05", "cs_famousgunslinger_06", "cs_featherstonchambers", "cs_featsofstrength", "cs_fightref", "cs_fire_breather", "cs_fishcollector", "cs_forgivenhusband_01", "cs_forgivenwife_01", "cs_formyartbigwoman", "cs_francis_sinclair", "cs_frenchartist", "cs_frenchman_01", "cs_fussar", "cs_garethbraithwaite", "cs_gavin", "cs_genstoryfemale", "cs_genstorymale", "cs_geraldbraithwaite", "cs_germandaughter", "cs_germanfather", "cs_germanmother", "cs_germanson", "cs_gilbertknightly", "cs_gloria", "cs_grizzledjon", "cs_guidomartelli", "cs_hamish", "cs_hectorfellowes", "cs_henrilemiux", "cs_herbalist", "cs_hercule", "cs_hestonjameson", "cs_hobartcrawley", "cs_hoseamatthews", "cs_iangray", "cs_jackmarston_teen", "cs_jackmarston", "cs_jamie", "cs_janson", "cs_javierescuella", "cs_jeb", "cs_jimcalloway", "cs_jockgray", "cs_joe", "cs_joebutler", "cs_johnmarston", "cs_johnthebaptisingmadman", "cs_johnweathers", "cs_josiahtrelawny", "cs_jules", "cs_karen", "cs_karensjohn_01", "cs_kieran", "cs_laramie", "cs_leighgray", "cs_lemiuxassistant", "cs_lenny", "cs_leon", "cs_leostrauss", "cs_levisimon", "cs_leviticuscornwall", "cs_lillianpowell", "cs_lillymillet", "cs_londonderryson", "cs_lucanapoli", "cs_magnifico", "cs_mamawatson", "cs_marshall_thurwell", "cs_marybeth", "cs_marylinton", "cs_meditatingmonk", "cs_meredith", "cs_meredithsmother", "cs_micahbell", "cs_micahsnemesis", "cs_mickey", "cs_miltonandrews", "cs_missmarjorie", "cs_mixedracekid", "cs_moira", "cs_mollyoshea", "cs_mp_alfredo_montez", "cs_mp_allison", "cs_mp_amos_lansing", "cs_mp_bonnie", "cs_mp_bountyhunter", "cs_mp_camp_cook", "cs_mp_cliff", "cs_mp_cripps_b", "cs_mp_cripps", "cs_mp_grace_lancing", "cs_mp_hans", "cs_mp_henchman", "cs_mp_horley", "cs_mp_jeremiah_shaw", "cs_mp_jessica", "cs_mp_jorge_montez", "cs_mp_langston", "cs_mp_lee", "cs_mp_mabel", "cs_mp_marshall_davies", "cs_mp_moonshiner", "cs_mp_mradler", "cs_mp_oldman_jones", "cs_mp_revenge_marshall", "cs_mp_samson_finch", "cs_mp_shaky", "cs_mp_sherifffreeman", "cs_mp_teddybrown", "cs_mp_terrance", "cs_mp_the_boy", "cs_mp_travellingsaleswoman", "cs_mp_went", "cs_mradler", "cs_mrdevon", "cs_mrlinton", "cs_mrpearson", "cs_mrs_calhoun", "cs_mrs_sinclair", "cs_mrsadler", "cs_mrsfellows", "cs_mrsgeddes", "cs_mrslondonderry", "cs_mrsweathers", "cs_mrwayne", "cs_mud2bigguy", "cs_mysteriousstranger", "cs_nbxdrunk", "cs_nbxexecuted", "cs_nbxpolicechiefformal", "cs_nbxreceptionist_01", "cs_nial_whelan", "cs_nicholastimmins", "cs_nils", "cs_norrisforsythe", "cs_obediahhinton", "cs_oddfellowspinhead", "cs_odprostitute", "cs_operasinger", "cs_paytah", "cs_penelopebraithwaite", "cs_pinkertongoon", "cs_poisonwellshaman", "cs_poorjoe", "cs_priest_wedding", "cs_princessisabeau", "cs_professorbell", "cs_rainsfall", "cs_ramon_cortez", "cs_reverendfortheringham", "cs_revswanson", "cs_rhodeputy_01", "cs_rhodeputy_02", "cs_rhodesassistant", "cs_rhodeskidnapvictim", "cs_rhodessaloonbouncer", "cs_ringmaster", "cs_rockyseven_widow", "cs_samaritan", "cs_scottgray", "cs_sd_streetkid_01", "cs_sd_streetkid_01a", "cs_sd_streetkid_01b", "cs_sd_streetkid_02", "cs_sddoctor_01", "cs_sdpriest", "cs_sdsaloondrunk_01", "cs_sdstreetkidthief", "cs_sean", "cs_sherifffreeman", "cs_sheriffowens", "cs_sistercalderon", "cs_slavecatcher", "cs_soothsayer", "cs_strawberryoutlaw_01", "cs_strawberryoutlaw_02", "cs_strdeputy_01", "cs_strdeputy_02", "cs_strsheriff_01", "cs_sunworshipper", "cs_susangrimshaw", "cs_swampfreak", "cs_swampweirdosonny", "cs_sworddancer", "cs_tavishgray", "cs_taxidermist", "cs_theodorelevin", "cs_thomasdown", "cs_tigerhandler", "cs_tilly", "cs_timothydonahue", "cs_tinyhermit", "cs_tomdickens", "cs_towncrier", "cs_treasurehunter", "cs_twinbrother_01", "cs_twinbrother_02", "cs_twingroupie_01", "cs_twingroupie_02", "cs_uncle", "cs_unidusterjail_01", "cs_valauctionboss_01", "cs_valdeputy_01", "cs_valprayingman", "cs_valprostitute_01", "cs_valprostitute_02", "cs_valsheriff", "cs_vampire", "cs_vht_bathgirl", "cs_wapitiboy", "cs_warvet", "cs_watson_01", "cs_watson_02", "cs_watson_03", "cs_welshfighter", "cs_wintonholmes", "cs_wrobel", "female_skeleton", "g_f_m_uniduster_01", "g_m_m_bountyhunters_01", "g_m_m_uniafricanamericangang_01", "g_m_m_unibanditos_01", "g_m_m_unibraithwaites_01", "g_m_m_unibrontegoons_01", "g_m_m_unicornwallgoons_01", "g_m_m_unicriminals_01", "g_m_m_unicriminals_02", "g_m_m_uniduster_01", "g_m_m_uniduster_02", "g_m_m_uniduster_03", "g_m_m_uniduster_04", "g_m_m_uniduster_05", "g_m_m_unigrays_01", "g_m_m_unigrays_02", "g_m_m_uniinbred_01", "g_m_m_unilangstonboys_01", "g_m_m_unimicahgoons_01", "g_m_m_unimountainmen_01", "g_m_m_uniranchers_01", "g_m_m_uniswamp_01", "g_m_o_uniexconfeds_01", "g_m_y_uniexconfeds_01", "g_m_y_uniexconfeds_02", "gc_lemoynecaptive_males_01", "gc_skinnertorture_males_01", "ge_delloboparty_females_01", "legendarypanther", "loansharking_asbminer_males_01", "loansharking_horsechase1_males_01", "loansharking_undertaker_females_01", "loansharking_undertaker_males_01", "male_skeleton", "mbh_rhodesrancher_females_01", "mbh_rhodesrancher_teens_01", "mbh_skinnersearch_males_01", "mcclellan_saddle_01", "mes_abigail2_males_01", "mes_finale2_females_01", "mes_finale2_males_01", "mes_finale3_males_01", "mes_marston1_males_01", "mes_marston2_males_01", "mes_marston5_2_males_01", "mes_marston6_females_01", "mes_marston6_males_01", "mes_marston6_teens_01", "mes_sadie4_males_01", "mes_sadie5_males_01", "motherhubbard_saddle_01", "mp_a_c_horsecorpse_01", "mp_a_f_m_cardgameplayers_01", "mp_a_f_m_unicorpse_01", "mp_a_m_m_laboruprisers_01", "mp_a_m_m_unicorpse_01", "mp_asn_benedictpoint_females_01", "mp_asn_benedictpoint_males_01", "mp_asn_blackwater_males_01", "mp_asn_braithwaitemanor_males_01", "mp_asn_braithwaitemanor_males_02", "mp_asn_braithwaitemanor_males_03", "mp_asn_civilwarfort_males_01", "mp_asn_gaptoothbreach_males_01", "mp_asn_pikesbasin_males_01", "mp_asn_sdpolicestation_males_01", "mp_asn_sdwedding_females_01", "mp_asn_sdwedding_males_01", "mp_asn_shadybelle_females_01", "mp_asn_stillwater_males_01", "mp_asntrk_elysianpool_males_01", "mp_asntrk_grizzlieswest_males_01", "mp_asntrk_hagenorchard_males_01", "mp_asntrk_isabella_males_01", "mp_asntrk_talltrees_males_01", "mp_campdef_bluewater_females_01", "mp_campdef_bluewater_males_01", "mp_campdef_chollasprings_females_01", "mp_campdef_chollasprings_males_01", "mp_campdef_eastnewhanover_females_01", "mp_campdef_eastnewhanover_males_01", "mp_campdef_gaptoothbreach_females_01", "mp_campdef_gaptoothbreach_males_01", "mp_campdef_gaptoothridge_females_01", "mp_campdef_gaptoothridge_males_01", "mp_campdef_greatplains_males_01", "mp_campdef_grizzlies_males_01", "mp_campdef_heartlands1_males_01", "mp_campdef_heartlands2_females_01", "mp_campdef_heartlands2_males_01", "mp_campdef_hennigans_females_01", "mp_campdef_hennigans_males_01", "mp_campdef_littlecreek_females_01", "mp_campdef_littlecreek_males_01", "mp_campdef_radleyspasture_females_01", "mp_campdef_radleyspasture_males_01", "mp_campdef_riobravo_females_01", "mp_campdef_riobravo_males_01", "mp_campdef_roanoke_females_01", "mp_campdef_roanoke_males_01", "mp_campdef_talltrees_females_01", "mp_campdef_talltrees_males_01", "mp_campdef_tworocks_females_01", "mp_chu_kid_armadillo_males_01", "mp_chu_kid_diabloridge_males_01", "mp_chu_kid_emrstation_males_01", "mp_chu_kid_greatplains_males_01", "mp_chu_kid_greatplains2_males_01", "mp_chu_kid_heartlands_males_01", "mp_chu_kid_lagras_males_01", "mp_chu_kid_lemoyne_females_01", "mp_chu_kid_lemoyne_males_01", "mp_chu_kid_recipient_males_01", "mp_chu_kid_rhodes_males_01", "mp_chu_kid_saintdenis_females_01", "mp_chu_kid_saintdenis_males_01", "mp_chu_kid_scarlettmeadows_males_01", "mp_chu_kid_tumbleweed_males_01", "mp_chu_kid_valentine_males_01", "mp_chu_rob_ambarino_males_01", "mp_chu_rob_annesburg_males_01", "mp_chu_rob_benedictpoint_females_01", "mp_chu_rob_benedictpoint_males_01", "mp_chu_rob_blackwater_males_01", "mp_chu_rob_caligahall_males_01", "mp_chu_rob_coronado_males_01", "mp_chu_rob_cumberland_males_01", "mp_chu_rob_fortmercer_females_01", "mp_chu_rob_fortmercer_males_01", "mp_chu_rob_greenhollow_males_01", "mp_chu_rob_macfarlanes_females_01", "mp_chu_rob_macfarlanes_males_01", "mp_chu_rob_macleans_males_01", "mp_chu_rob_millesani_males_01", "mp_chu_rob_montanariver_males_01", "mp_chu_rob_paintedsky_males_01", "mp_chu_rob_rathskeller_males_01", "mp_chu_rob_recipient_males_01", "mp_chu_rob_rhodes_males_01", "mp_chu_rob_strawberry_males_01", "mp_clay", "mp_convoy_recipient_females_01", "mp_convoy_recipient_males_01", "mp_de_u_f_m_bigvalley_01", "mp_de_u_f_m_bluewatermarsh_01", "mp_de_u_f_m_braithwaite_01", "mp_de_u_f_m_doverhill_01", "mp_de_u_f_m_greatplains_01", "mp_de_u_f_m_hangingrock_01", "mp_de_u_f_m_heartlands_01", "mp_de_u_f_m_hennigansstead_01", "mp_de_u_f_m_silentstead_01", "mp_de_u_m_m_aurorabasin_01", "mp_de_u_m_m_barrowlagoon_01", "mp_de_u_m_m_bigvalleygraves_01", "mp_de_u_m_m_centralunionrr_01", "mp_de_u_m_m_pleasance_01", "mp_de_u_m_m_rileyscharge_01", "mp_de_u_m_m_vanhorn_01", "mp_de_u_m_m_westernhomestead_01", "mp_dr_u_f_m_bayougatorfood_01", "mp_dr_u_f_m_bigvalleycave_01", "mp_dr_u_f_m_bigvalleycliff_01", "mp_dr_u_f_m_bluewaterkidnap_01", "mp_dr_u_f_m_colterbandits_01", "mp_dr_u_f_m_colterbandits_02", "mp_dr_u_f_m_missingfisherman_01", "mp_dr_u_f_m_missingfisherman_02", "mp_dr_u_f_m_mistakenbounties_01", "mp_dr_u_f_m_plaguetown_01", "mp_dr_u_f_m_quakerscove_01", "mp_dr_u_f_m_quakerscove_02", "mp_dr_u_f_m_sdgraveyard_01", "mp_dr_u_m_m_bigvalleycave_01", "mp_dr_u_m_m_bigvalleycliff_01", "mp_dr_u_m_m_bluewaterkidnap_01", "mp_dr_u_m_m_canoeescape_01", "mp_dr_u_m_m_hwyrobbery_01", "mp_dr_u_m_m_mistakenbounties_01", "mp_dr_u_m_m_pikesbasin_01", "mp_dr_u_m_m_pikesbasin_02", "mp_dr_u_m_m_plaguetown_01", "mp_dr_u_m_m_roanokestandoff_01", "mp_dr_u_m_m_sdgraveyard_01", "mp_dr_u_m_m_sdmugging_01", "mp_dr_u_m_m_sdmugging_02", "mp_female", "mp_freeroam_tut_females_01", "mp_freeroam_tut_males_01", "mp_g_f_m_laperlegang_01", "mp_g_f_m_laperlevips_01", "mp_g_f_m_owlhootfamily_01", "mp_g_m_m_armoredjuggernauts_01", "mp_g_m_m_bountyhunters_01", "mp_g_m_m_owlhootfamily_01", "mp_g_m_m_redbengang_01", "mp_g_m_m_uniafricanamericangang_01", "mp_g_m_m_unibanditos_01", "mp_g_m_m_unibraithwaites_01", "mp_g_m_m_unibrontegoons_01", "mp_g_m_m_unicornwallgoons_01", "mp_g_m_m_unicriminals_01", "mp_g_m_m_unicriminals_02", "mp_g_m_m_uniduster_01", "mp_g_m_m_uniduster_02", "mp_g_m_m_uniduster_03", "mp_g_m_m_unigrays_01", "mp_g_m_m_uniinbred_01", "mp_g_m_m_unilangstonboys_01", "mp_g_m_m_unimountainmen_01", "mp_g_m_m_uniranchers_01", "mp_g_m_m_uniswamp_01", "mp_g_m_o_uniexconfeds_01", "mp_g_m_y_uniexconfeds_01", "mp_gunvoutd2_males_01", "mp_gunvoutd3_bht_01", "mp_gunvoutd3_males_01", "mp_horse_owlhootvictim_01", "mp_intercept_recipient_females_01", "mp_intercept_recipient_males_01", "mp_intro_females_01", "mp_intro_males_01", "mp_jailbreak_males_01", "mp_jailbreak_recipient_males_01", "mp_lbt_m3_males_01", "mp_lbt_m6_females_01", "mp_lbt_m6_males_01", "mp_lbt_m7_males_01", "mp_male", "mp_oth_recipient_males_01", "mp_outlaw1_males_01", "mp_outlaw2_males_01", "mp_post_multipackage_females_01", "mp_post_multipackage_males_01", "mp_post_multirelay_females_01", "mp_post_multirelay_males_01", "mp_post_relay_females_01", "mp_post_relay_males_01", "mp_predator", "mp_prsn_asn_males_01", "mp_re_animalattack_females_01", "mp_re_animalattack_males_01", "mp_re_duel_females_01", "mp_re_duel_males_01", "mp_re_graverobber_females_01", "mp_re_graverobber_males_01", "mp_re_hobodog_females_01", "mp_re_hobodog_males_01", "mp_re_kidnapped_females_01", "mp_re_kidnapped_males_01", "mp_re_photography_females_01", "mp_re_photography_females_02", "mp_re_photography_males_01", "mp_re_rivalcollector_males_01", "mp_re_runawaywagon_females_01", "mp_re_runawaywagon_males_01", "mp_re_treasurehunter_females_01", "mp_re_treasurehunter_males_01", "mp_re_wildman_males_01", "mp_recover_recipient_females_01", "mp_recover_recipient_males_01", "mp_repo_recipient_females_01", "mp_repo_recipient_males_01", "mp_repoboat_recipient_females_01", "mp_repoboat_recipient_males_01", "mp_rescue_bottletree_females_01", "mp_rescue_bottletree_males_01", "mp_rescue_colter_males_01", "mp_rescue_cratersacrifice_males_01", "mp_rescue_heartlands_males_01", "mp_rescue_loftkidnap_males_01", "mp_rescue_lonniesshack_males_01", "mp_rescue_moonstone_males_01", "mp_rescue_mtnmanshack_males_01", "mp_rescue_recipient_females_01", "mp_rescue_recipient_males_01", "mp_rescue_rivalshack_males_01", "mp_rescue_scarlettmeadows_males_01", "mp_rescue_sddogfight_females_01", "mp_rescue_sddogfight_males_01", "mp_resupply_recipient_females_01", "mp_resupply_recipient_males_01", "mp_revenge1_males_01", "mp_s_m_m_cornwallguard_01", "mp_s_m_m_pinlaw_01", "mp_stealboat_recipient_males_01", "mp_stealhorse_recipient_males_01", "mp_stealwagon_recipient_males_01", "mp_tattoo_female", "mp_tattoo_male", "mp_u_f_m_bountytarget_001", "mp_u_f_m_bountytarget_002", "mp_u_f_m_bountytarget_003", "mp_u_f_m_bountytarget_004", "mp_u_f_m_bountytarget_005", "mp_u_f_m_bountytarget_006", "mp_u_f_m_bountytarget_007", "mp_u_f_m_bountytarget_008", "mp_u_f_m_bountytarget_009", "mp_u_f_m_bountytarget_010", "mp_u_f_m_bountytarget_011", "mp_u_f_m_bountytarget_012", "mp_u_f_m_bountytarget_013", "mp_u_f_m_bountytarget_014", "mp_u_f_m_gunslinger3_rifleman_02", "mp_u_f_m_gunslinger3_sharpshooter_01", "mp_u_f_m_laperlevipmasked_01", "mp_u_f_m_laperlevipmasked_02", "mp_u_f_m_laperlevipmasked_03", "mp_u_f_m_laperlevipmasked_04", "mp_u_f_m_laperlevipunmasked_01", "mp_u_f_m_laperlevipunmasked_02", "mp_u_f_m_laperlevipunmasked_03", "mp_u_f_m_laperlevipunmasked_04", "mp_u_f_m_lbt_owlhootvictim_01", "mp_u_f_m_legendarybounty_001", "mp_u_f_m_legendarybounty_002", "mp_u_f_m_outlaw3_warner_01", "mp_u_f_m_outlaw3_warner_02", "mp_u_f_m_revenge2_passerby_01", "mp_u_m_m_armsheriff_01", "mp_u_m_m_bountyinjuredman_01", "mp_u_m_m_bountytarget_001", "mp_u_m_m_bountytarget_002", "mp_u_m_m_bountytarget_003", "mp_u_m_m_bountytarget_005", "mp_u_m_m_bountytarget_008", "mp_u_m_m_bountytarget_009", "mp_u_m_m_bountytarget_010", "mp_u_m_m_bountytarget_011", "mp_u_m_m_bountytarget_012", "mp_u_m_m_bountytarget_013", "mp_u_m_m_bountytarget_014", "mp_u_m_m_bountytarget_015", "mp_u_m_m_bountytarget_016", "mp_u_m_m_bountytarget_017", "mp_u_m_m_bountytarget_018", "mp_u_m_m_bountytarget_019", "mp_u_m_m_bountytarget_020", "mp_u_m_m_bountytarget_021", "mp_u_m_m_bountytarget_022", "mp_u_m_m_bountytarget_023", "mp_u_m_m_bountytarget_024", "mp_u_m_m_bountytarget_025", "mp_u_m_m_bountytarget_026", "mp_u_m_m_bountytarget_027", "mp_u_m_m_bountytarget_028", "mp_u_m_m_bountytarget_029", "mp_u_m_m_bountytarget_030", "mp_u_m_m_bountytarget_031", "mp_u_m_m_bountytarget_032", "mp_u_m_m_bountytarget_033", "mp_u_m_m_bountytarget_034", "mp_u_m_m_bountytarget_035", "mp_u_m_m_bountytarget_036", "mp_u_m_m_bountytarget_037", "mp_u_m_m_bountytarget_038", "mp_u_m_m_bountytarget_039", "mp_u_m_m_bountytarget_044", "mp_u_m_m_bountytarget_045", "mp_u_m_m_bountytarget_046", "mp_u_m_m_bountytarget_047", "mp_u_m_m_bountytarget_048", "mp_u_m_m_bountytarget_049", "mp_u_m_m_bountytarget_050", "mp_u_m_m_bountytarget_051", "mp_u_m_m_bountytarget_052", "mp_u_m_m_bountytarget_053", "mp_u_m_m_bountytarget_054", "mp_u_m_m_bountytarget_055", "mp_u_m_m_gunforhireclerk_01", "mp_u_m_m_gunslinger3_rifleman_01", "mp_u_m_m_gunslinger3_sharpshooter_02", "mp_u_m_m_gunslinger3_shotgunner_01", "mp_u_m_m_gunslinger3_shotgunner_02", "mp_u_m_m_gunslinger4_warner_01", "mp_u_m_m_lbt_accomplice_01", "mp_u_m_m_lbt_barbsvictim_01", "mp_u_m_m_lbt_bribeinformant_01", "mp_u_m_m_lbt_coachdriver_01", "mp_u_m_m_lbt_hostagemarshal_01", "mp_u_m_m_lbt_owlhootvictim_01", "mp_u_m_m_lbt_owlhootvictim_02", "mp_u_m_m_lbt_philipsvictim_01", "mp_u_m_m_legendarybounty_001", "mp_u_m_m_legendarybounty_002", "mp_u_m_m_legendarybounty_003", "mp_u_m_m_legendarybounty_004", "mp_u_m_m_legendarybounty_005", "mp_u_m_m_legendarybounty_006", "mp_u_m_m_legendarybounty_007", "mp_u_m_m_outlaw3_prisoner_01", "mp_u_m_m_outlaw3_prisoner_02", "mp_u_m_m_outlaw3_warner_01", "mp_u_m_m_outlaw3_warner_02", "mp_u_m_m_prisonwagon_01", "mp_u_m_m_prisonwagon_02", "mp_u_m_m_prisonwagon_03", "mp_u_m_m_prisonwagon_04", "mp_u_m_m_prisonwagon_05", "mp_u_m_m_prisonwagon_06", "mp_u_m_m_revenge2_handshaker_01", "mp_u_m_m_revenge2_passerby_01", "mp_u_m_m_trader_01", "mp_u_m_m_traderintroclerk_01", "mp_u_m_m_tvlfence_01", "mp_u_m_o_blwpolicechief_01", "mp_wgnbrkout_recipient_males_01", "mp_wgnthief_recipient_males_01", "msp_bountyhunter1_females_01", "msp_braithwaites1_males_01", "msp_feud1_males_01", "msp_fussar2_males_01", "msp_gang2_males_01", "msp_gang3_males_01", "msp_grays1_males_01", "msp_grays2_males_01", "msp_guarma2_males_01", "msp_industry1_females_01", "msp_industry1_males_01", "msp_industry3_females_01", "msp_industry3_males_01", "msp_mary1_females_01", "msp_mary1_males_01", "msp_mary3_males_01", "msp_mob0_males_01", "msp_mob1_females_01", "msp_mob1_males_01", "msp_mob1_teens_01", "msp_mob3_females_01", "msp_mob3_males_01", "msp_mudtown3_males_01", "msp_mudtown3b_females_01", "msp_mudtown3b_males_01", "msp_mudtown5_males_01", "msp_native1_males_01", "msp_reverend1_males_01", "msp_saintdenis1_females_01", "msp_saintdenis1_males_01", "msp_saloon1_females_01", "msp_saloon1_males_01", "msp_smuggler2_males_01", "msp_trainrobbery2_males_01", "msp_trelawny1_males_01", "msp_utopia1_males_01", "msp_winter4_males_01", "p_c_horse_01", "player_three", "player_zero", "rces_abigail3_females_01", "rces_abigail3_males_01", "rces_beechers1_males_01", "rces_evelynmiller_males_01", "rcsp_beauandpenelope_males_01", "rcsp_beauandpenelope1_females_01", "rcsp_calderon_males_01", "rcsp_calderonstage2_males_01", "rcsp_calderonstage2_teens_01", "rcsp_calloway_males_01", "rcsp_coachrobbery_males_01", "rcsp_crackpot_females_01", "rcsp_crackpot_males_01", "rcsp_creole_males_01", "rcsp_dutch1_males_01", "rcsp_dutch3_males_01", "rcsp_edithdownes2_males_01", "rcsp_formyart_females_01", "rcsp_formyart_males_01", "rcsp_gunslingerduel4_males_01", "rcsp_herekittykitty_males_0", "rcsp_herekittykitty_males_01", "rcsp_hunting1_males_01", "rcsp_mrmayor_males_01", "rcsp_native_americanfathers_males_01", "rcsp_native1s2_males_01", "rcsp_oddfellows_males_01", "rcsp_odriscolls2_females_01", "rcsp_poisonedwell_females_01", "rcsp_poisonedwell_males_01", "rcsp_poisonedwell_teens_01", "rcsp_ridethelightning_females_01", "rcsp_ridethelightning_males_01", "rcsp_sadie1_males_01", "rcsp_slavecatcher_males_01", "re_animalattack_females_01", "re_animalattack_males_01", "re_animalmauling_males_01", "re_approach_males_01", "re_beartrap_males_01", "re_boatattack_males_01", "re_burningbodies_males_01", "re_checkpoint_males_01", "re_coachrobbery_females_01", "re_coachrobbery_males_01", "re_consequence_males_01", "re_corpsecart_females_01", "re_corpsecart_males_01", "re_crashedwagon_males_01", "re_darkalleyambush_males_01", "re_darkalleybum_males_01", "re_darkalleystabbing_males_01", "re_deadbodies_males_01", "re_deadjohn_females_01", "re_deadjohn_males_01", "re_disabledbeggar_males_01", "re_domesticdispute_females_01", "re_domesticdispute_males_01", "re_drownmurder_females_01", "re_drownmurder_males_01", "re_drunkcamp_males_01", "re_drunkdueler_males_01", "re_duelboaster_males_01", "re_duelwinner_females_01", "re_duelwinner_males_01", "re_escort_females_01", "re_executions_males_01", "re_fleeingfamily_females_01", "re_fleeingfamily_males_01", "re_footrobbery_males_01", "re_friendlyoutdoorsman_males_01", "re_frozentodeath_females_01", "re_frozentodeath_males_01", "re_fundraiser_females_01", "re_fussarchase_males_01", "re_goldpanner_males_01", "re_horserace_females_01", "re_horserace_males_01", "re_hostagerescue_females_01", "re_hostagerescue_males_01", "re_inbredkidnap_females_01", "re_inbredkidnap_males_01", "re_injuredrider_males_01", "re_kidnappedvictim_females_01", "re_laramiegangrustling_males_01", "re_loneprisoner_males_01", "re_lostdog_dogs_01", "re_lostdog_teens_01", "re_lostdrunk_females_01", "re_lostdrunk_males_01", "re_lostfriend_males_01", "re_lostman_males_01", "re_moonshinecamp_males_01", "re_murdercamp_males_01", "re_murdersuicide_females_01", "re_murdersuicide_males_01", "re_nakedswimmer_males_01", "re_ontherun_males_01", "re_outlawlooter_males_01", "re_parlorambush_males_01", "re_peepingtom_females_01", "re_peepingtom_males_01", "re_pickpocket_males_01", "re_pisspot_females_01", "re_pisspot_males_01", "re_playercampstrangers_females_01", "re_playercampstrangers_males_01", "re_poisoned_males_01", "re_policechase_males_01", "re_prisonwagon_females_01", "re_prisonwagon_males_01", "re_publichanging_females_01", "re_publichanging_males_01", "re_publichanging_teens_01", "re_rally_males_01", "re_rallydispute_males_01", "re_rallysetup_males_01", "re_ratinfestation_males_01", "re_rowdydrunks_males_01", "re_savageaftermath_females_01", "re_savageaftermath_males_01", "re_savagefight_females_01", "re_savagefight_males_01", "re_savagewagon_females_01", "re_savagewagon_males_01", "re_savagewarning_males_01", "re_sharpshooter_males_01", "re_showoff_males_01", "re_skippingstones_males_01", "re_skippingstones_teens_01", "re_slumambush_females_01", "re_snakebite_males_01", "re_stalkinghunter_males_01", "re_strandedrider_males_01", "re_street_fight_males_01", "re_taunting_01", "re_taunting_males_01", "re_torturingcaptive_males_01", "re_townburial_males_01", "re_townconfrontation_females_01", "re_townconfrontation_males_01", "re_townrobbery_males_01", "re_townwidow_females_01", "re_trainholdup_females_01", "re_trainholdup_males_01", "re_trappedwoman_females_01", "re_treasurehunter_males_01", "re_voice_females_01", "re_wagonthreat_females_01", "re_wagonthreat_males_01", "re_washedashore_males_01", "re_wealthycouple_females_01", "re_wealthycouple_males_01", "re_wildman_01", "s_f_m_bwmworker_01", "s_f_m_cghworker_01", "s_f_m_mapworker_01", "s_m_m_ambientblwpolice_01", "s_m_m_ambientlawrural_01", "s_m_m_ambientsdpolice_01", "s_m_m_army_01", "s_m_m_asbcowpoke_01", "s_m_m_asbdealer_01", "s_m_m_bankclerk_01", "s_m_m_barber_01", "s_m_m_blwcowpoke_01", "s_m_m_blwdealer_01", "s_m_m_bwmworker_01", "s_m_m_cghworker_01", "s_m_m_cktworker_01", "s_m_m_coachtaxidriver_01", "s_m_m_cornwallguard_01", "s_m_m_dispatchlawrural_01", "s_m_m_dispatchleaderpolice_01", "s_m_m_dispatchleaderrural_01", "s_m_m_dispatchpolice_01", "s_m_m_fussarhenchman_01", "s_m_m_genconductor_01", "s_m_m_hofguard_01", "s_m_m_liveryworker_01", "s_m_m_magiclantern_01", "s_m_m_mapworker_01", "s_m_m_marketvendor_01", "s_m_m_marshallsrural_01", "s_m_m_micguard_01", "s_m_m_nbxriverboatdealers_01", "s_m_m_nbxriverboatguards_01", "s_m_m_orpguard_01", "s_m_m_pinlaw_01", "s_m_m_racrailguards_01", "s_m_m_racrailworker_01", "s_m_m_rhdcowpoke_01", "s_m_m_rhddealer_01", "s_m_m_sdcowpoke_01", "s_m_m_sddealer_01", "s_m_m_sdticketseller_01", "s_m_m_skpguard_01", "s_m_m_stgsailor_01", "s_m_m_strcowpoke_01", "s_m_m_strdealer_01", "s_m_m_strlumberjack_01", "s_m_m_tailor_01", "s_m_m_trainstationworker_01", "s_m_m_tumdeputies_01", "s_m_m_unibutchers_01", "s_m_m_unitrainengineer_01", "s_m_m_unitrainguards_01", "s_m_m_valbankguards_01", "s_m_m_valcowpoke_01", "s_m_m_valdealer_01", "s_m_m_valdeputy_01", "s_m_m_vhtdealer_01", "s_m_o_cktworker_01", "s_m_y_army_01", "s_m_y_newspaperboy_01", "s_m_y_racrailworker_01", "shack_missinghusband_males_01", "shack_ontherun_males_01", "u_f_m_bht_wife", "u_f_m_circuswagon_01", "u_f_m_emrdaughter_01", "u_f_m_fussar1lady_01", "u_f_m_htlwife_01", "u_f_m_lagmother_01", "u_f_m_nbxresident_01", "u_f_m_rhdnudewoman_01", "u_f_m_rkshomesteadtenant_01", "u_f_m_story_blackbelle_01", "u_f_m_story_nightfolk_01", "u_f_m_tljbartender_01", "u_f_m_tumgeneralstoreowner_01", "u_f_m_valtownfolk_01", "u_f_m_valtownfolk_02", "u_f_m_vhtbartender_01", "u_f_o_hermit_woman_01", "u_f_o_wtctownfolk_01", "u_f_y_braithwaitessecret_01", "u_f_y_czphomesteaddaughter_01", "u_m_m_announcer_01", "u_m_m_apfdeadman_01", "u_m_m_armgeneralstoreowner_01", "u_m_m_armtrainstationworker_01", "u_m_m_armundertaker_01", "u_m_m_armytrn4_01", "u_m_m_asbgunsmith_01", "u_m_m_asbprisoner_01", "u_m_m_asbprisoner_02", "u_m_m_bht_banditomine", "u_m_m_bht_banditoshack", "u_m_m_bht_benedictallbright", "u_m_m_bht_blackwaterhunt", "u_m_m_bht_exconfedcampreturn", "u_m_m_bht_laramiesleeping", "u_m_m_bht_lover", "u_m_m_bht_mineforeman", "u_m_m_bht_nathankirk", "u_m_m_bht_odriscolldrunk", "u_m_m_bht_odriscollmauled", "u_m_m_bht_odriscollsleeping", "u_m_m_bht_oldman", "u_m_m_bht_outlawmauled", "u_m_m_bht_saintdenissaloon", "u_m_m_bht_shackescape", "u_m_m_bht_skinnerbrother", "u_m_m_bht_skinnersearch", "u_m_m_bht_strawberryduel", "u_m_m_bivforeman_01", "u_m_m_blwtrainstationworker_01", "u_m_m_bulletcatchvolunteer_01", "u_m_m_bwmstablehand_01", "u_m_m_cabaretfirehat_01", "u_m_m_cajhomestead_01", "u_m_m_chelonianjumper_01", "u_m_m_chelonianjumper_02", "u_m_m_chelonianjumper_03", "u_m_m_chelonianjumper_04", "u_m_m_circuswagon_01", "u_m_m_cktmanager_01", "u_m_m_cornwalldriver_01", "u_m_m_crdhomesteadtenant_01", "u_m_m_crdhomesteadtenant_02", "u_m_m_crdwitness_01", "u_m_m_creolecaptain_01", "u_m_m_czphomesteadfather_01", "u_m_m_dorhomesteadhusband_01", "u_m_m_emrfarmhand_03", "u_m_m_emrfather_01", "u_m_m_executioner_01", "u_m_m_fatduster_01", "u_m_m_finale2_aa_upperclass_01", "u_m_m_galastringquartet_01", "u_m_m_galastringquartet_02", "u_m_m_galastringquartet_03", "u_m_m_galastringquartet_04", "u_m_m_gamdoorman_01", "u_m_m_hhrrancher_01", "u_m_m_htlforeman_01", "u_m_m_htlhusband_01", "u_m_m_htlrancherbounty_01", "u_m_m_islbum_01", "u_m_m_lnsoutlaw_01", "u_m_m_lnsoutlaw_02", "u_m_m_lnsoutlaw_03", "u_m_m_lnsoutlaw_04", "u_m_m_lnsworker_01", "u_m_m_lnsworker_02", "u_m_m_lnsworker_03", "u_m_m_lnsworker_04", "u_m_m_lrshomesteadtenant_01", "u_m_m_mfrrancher_01", "u_m_m_mud3pimp_01", "u_m_m_nbxbankerbounty_01", "u_m_m_nbxbartender_01", "u_m_m_nbxbartender_02", "u_m_m_nbxboatticketseller_01", "u_m_m_nbxbronteasc_01", "u_m_m_nbxbrontegoon_01", "u_m_m_nbxbrontesecform_01", "u_m_m_nbxgeneralstoreowner_01", "u_m_m_nbxgraverobber_01", "u_m_m_nbxgraverobber_02", "u_m_m_nbxgraverobber_03", "u_m_m_nbxgraverobber_04", "u_m_m_nbxgraverobber_05", "u_m_m_nbxgunsmith_01", "u_m_m_nbxliveryworker_01", "u_m_m_nbxmusician_01", "u_m_m_nbxpriest_01", "u_m_m_nbxresident_01", "u_m_m_nbxresident_02", "u_m_m_nbxresident_03", "u_m_m_nbxresident_04", "u_m_m_nbxriverboatpitboss_01", "u_m_m_nbxriverboattarget_01", "u_m_m_nbxshadydealer_01", "u_m_m_nbxskiffdriver_01", "u_m_m_oddfellowparticipant_01", "u_m_m_odriscollbrawler_01", "u_m_m_orpguard_01", "u_m_m_racforeman_01", "u_m_m_racquartermaster_01", "u_m_m_rhdbackupdeputy_01", "u_m_m_rhdbackupdeputy_02", "u_m_m_rhdbartender_01", "u_m_m_rhddoctor_01", "u_m_m_rhdfiddleplayer_01", "u_m_m_rhdgenstoreowner_01", "u_m_m_rhdgenstoreowner_02", "u_m_m_rhdgunsmith_01", "u_m_m_rhdpreacher_01", "u_m_m_rhdsheriff_01", "u_m_m_rhdtrainstationworker_01", "u_m_m_rhdundertaker_01", "u_m_m_riodonkeyrider_01", "u_m_m_rkfrancher_01", "u_m_m_rkrdonkeyrider_01", "u_m_m_rwfrancher_01", "u_m_m_sdbankguard_01", "u_m_m_sdcustomvendor_01", "u_m_m_sdexoticsshopkeeper_01", "u_m_m_sdphotographer_01", "u_m_m_sdpolicechief_01", "u_m_m_sdstrongwomanassistant_01", "u_m_m_sdtrapper_01", "u_m_m_sdwealthytraveller_01", "u_m_m_shackserialkiller_01", "u_m_m_shacktwin_01", "u_m_m_shacktwin_02", "u_m_m_skinnyoldguy_01", "u_m_m_story_armadillo_01", "u_m_m_story_cannibal_01", "u_m_m_story_chelonian_01", "u_m_m_story_copperhead_01", "u_m_m_story_creeper_01", "u_m_m_story_emeraldranch_01", "u_m_m_story_hunter_01", "u_m_m_story_manzanita_01", "u_m_m_story_murfee_01", "u_m_m_story_pigfarm_01", "u_m_m_story_princess_01", "u_m_m_story_redharlow_01", "u_m_m_story_rhodes_01", "u_m_m_story_sdstatue_01", "u_m_m_story_spectre_01", "u_m_m_story_treasure_01", "u_m_m_story_tumbleweed_01", "u_m_m_story_valentine_01", "u_m_m_strfreightstationowner_01", "u_m_m_strgenstoreowner_01", "u_m_m_strsherriff_01", "u_m_m_strwelcomecenter_01", "u_m_m_tumbartender_01", "u_m_m_tumbutcher_01", "u_m_m_tumgunsmith_01", "u_m_m_tumtrainstationworker_01", "u_m_m_unibountyhunter_01", "u_m_m_unibountyhunter_02", "u_m_m_unidusterhenchman_01", "u_m_m_unidusterhenchman_02", "u_m_m_unidusterhenchman_03", "u_m_m_unidusterleader_01", "u_m_m_uniexconfedsbounty_01", "u_m_m_unionleader_01", "u_m_m_unionleader_02", "u_m_m_unipeepingtom_01", "u_m_m_valauctionforman_01", "u_m_m_valauctionforman_02", "u_m_m_valbarber_01", "u_m_m_valbartender_01", "u_m_m_valbeartrap_01", "u_m_m_valbutcher_01", "u_m_m_valdoctor_01", "u_m_m_valgenstoreowner_01", "u_m_m_valgunsmith_01", "u_m_m_valhotelowner_01", "u_m_m_valpokerplayer_01", "u_m_m_valpokerplayer_02", "u_m_m_valpoopingman_01", "u_m_m_valsheriff_01", "u_m_m_valtheman_01", "u_m_m_valtownfolk_01", "u_m_m_valtownfolk_02", "u_m_m_vhtstationclerk_01", "u_m_m_walgeneralstoreowner_01", "u_m_m_wapofficial_01", "u_m_m_wtccowboy_04", "u_m_o_armbartender_01", "u_m_o_asbsheriff_01", "u_m_o_bht_docwormwood", "u_m_o_blwbartender_01", "u_m_o_blwgeneralstoreowner_01", "u_m_o_blwphotographer_01", "u_m_o_blwpolicechief_01", "u_m_o_cajhomestead_01", "u_m_o_cmrcivilwarcommando_01", "u_m_o_mapwiseoldman_01", "u_m_o_oldcajun_01", "u_m_o_pshrancher_01", "u_m_o_rigtrainstationworker_01", "u_m_o_valbartender_01", "u_m_o_vhtexoticshopkeeper_01", "u_m_y_cajhomestead_01", "u_m_y_czphomesteadson_01", "u_m_y_czphomesteadson_02", "u_m_y_czphomesteadson_03", "u_m_y_czphomesteadson_04", "u_m_y_czphomesteadson_05", "u_m_y_duellistbounty_01", "u_m_y_emrson_01", "u_m_y_htlworker_01", "u_m_y_htlworker_02", "u_m_y_shackstarvingkid_01", "western_saddle_01", "western_saddle_02", "western_saddle_03", "western_saddle_04", } HASH_PEDS = {} for k, v in pairs(STRING_PEDS) do HASH_PEDS[GetHashKey(v)] = v end
MSD.Icons48 = { cross = Material("msd/icons/cross.png", "smooth"), cog = Material("msd/icons/cog.png", "smooth"), layers = Material("msd/icons/layers.png", "smooth"), layers_plus = Material("msd/icons/layers-plus.png", "smooth"), layers_remove = Material("msd/icons/layers-remove.png", "smooth"), account = Material("msd/icons/account.png", "smooth"), account_plus = Material("msd/icons/account-plus.png", "smooth"), account_edit = Material("msd/icons/account-edit.png", "smooth"), account_multiple = Material("msd/icons/account-multiple.png", "smooth"), account_convert = Material("msd/icons/account-convert.png", "smooth"), folder_open = Material("msd/icons/folder-open.png", "smooth"), file_document = Material("msd/icons/file-document.png", "smooth"), menu = Material("msd/icons/menu.png", "smooth"), dot = Material("msd/icons/dot.png", "smooth"), pencil = Material("msd/icons/pencil.png", "smooth"), play = Material("msd/icons/play.png", "smooth"), plus = Material("msd/icons/plus.png", "smooth"), back = Material("msd/icons/back.png", "smooth"), calendar_check = Material("msd/icons/calendar-check.png", "smooth"), playlist_edit = Material("msd/icons/playlist-edit.png", "smooth"), seal = Material("msd/icons/seal.png", "smooth"), save = Material("msd/icons/content-save.png", "smooth"), copy = Material("msd/icons/content-copy.png", "smooth"), submit = Material("msd/icons/check-decagram.png", "smooth"), alert = Material("msd/icons/alert-circle.png", "smooth"), arrow_down_color = Material("msd/icons/arrow_down_color.png", "smooth"), face_agent = Material("msd/icons/face-agent.png", "smooth"), swap = Material("msd/icons/swap.png", "smooth") } MSD.Materials = { vignette = Material("msd/vignette.png", "smooth"), gradient = Material("gui/gradient", "smooth"), gradient_right = Material("msd/gradient_right.png", "smooth"), } MSD.PinPoints = { [0] = Material("mqs/icons/pin.png", "smooth"), } local files = file.Find("materials/mqs/map_markers/*", "GAME") for k, v in pairs(files) do MSD.PinPoints[k] = Material("mqs/map_markers/" .. v, "smooth") end MSD.ColorPresets = {Color(255, 20, 20), Color(255, 115, 0), Color(210, 255, 0), Color(0, 170, 25), Color(0, 155, 255), Color(0, 100, 200), Color(135, 0, 255), Color(255, 0, 100),} MSD.Theme = { ["d"] = Color(0, 5, 10, 165), ["m"] = Color(0, 5, 10, 120), ["l"] = Color(0, 5, 10, 85), } MSD.Text = { ["n"] = Color(150, 150, 150), ["d"] = Color(220, 220, 220), ["s"] = Color(235, 235, 235), ["m"] = Color(245, 245, 245), ["l"] = Color(255, 255, 255), } local NewFont = surface.CreateFont for i = 0, 20 do NewFont("MSDFont." .. 16 + i, { font = "AdihausDIN", extended = true, size = 16 + i, weight = 500 }) end NewFont("MSDFont.Big", { font = "AdihausDIN", extended = true, size = 45, weight = 500 }) NewFont("MSDFont.Biger", { font = "AdihausDIN", extended = true, size = 55, weight = 500 }) function MSD.DrawTexturedRect(x, y, w, h, mat, color) if isstring(mat) then mat = Material(mat) end surface.SetDrawColor(color) surface.SetMaterial(mat) surface.DrawTexturedRect(x, y, w, h) end function MSD.DrawTexturedRectRotated(rot, x, y, w, h, mat, color) if isstring(mat) then mat = Material(mat) end surface.SetDrawColor(color) surface.SetMaterial(mat) surface.DrawTexturedRectRotated(x, y, w, h, rot) end function MSD.ColorAlpha(cl, al) local new_cl = table.Copy(cl) new_cl.a = al return new_cl end local blur = Material("pp/blurscreen") function MSD.Blur(panel, inn, density, alpha, back_alpha, w, h) local x, y = panel:LocalToScreen(0, 0) surface.SetDrawColor(255, 255, 255, alpha) surface.SetMaterial(blur) for i = 1, 3 do blur:SetFloat("$blur", (i / inn) * density) blur:Recompute() render.UpdateScreenEffectTexture() if w and h then render.SetScissorRect(-x, -y, x + w, y + h, true) surface.DrawTexturedRect(-x, -y, ScrW(), ScrH()) render.SetScissorRect(0, 0, 0, 0, false) else surface.DrawTexturedRect(-x, -y, ScrW(), ScrH()) end end if back_alpha and back_alpha > 0 then draw.RoundedBox(0, 0, 0, w, h, Color(10, 10, 10, back_alpha)) end end -- Same used in DarkRP, used it here so we can use it with any gamemodes local function CharWrap(t, w) local a = 0 t = t:gsub(".", function(c) a = a + surface.GetTextSize(c) if a >= w then a = 0 return "\n" .. c end return c end) return t, a end function MSD.TextWrap(text, font, w) local total = 0 surface.SetFont(font) local spaceSize = surface.GetTextSize(' ') text = text:gsub("(%s?[%S]+)", function(word) local char = string.sub(word, 1, 1) if char == "\n" or char == "\t" then total = 0 end local wordlen = surface.GetTextSize(word) total = total + wordlen if wordlen >= w then local splitWord, splitPoint = CharWrap(word, w - (total - wordlen)) total = splitPoint return splitWord elseif total < w then return word end if char == ' ' then total = wordlen - spaceSize return '\n' .. string.sub(word, 2) end total = wordlen return '\n' .. word end) local w_end, h_end = surface.GetTextSize(text) return text, w_end, h_end end MSD.ImgLib = {} MSD.ImgLib.Images = {} MSD.ImgLib.PreCacheStarted = {} MSD.ImgLib.NoMaterial = Material("msd/icons/file-hidden.png", "smooth noclamp") function MSD.ImgLib.GetMaterial(url) local crc = util.CRC(url) .. ".png" if MSD.ImgLib.Images[crc] then return MSD.ImgLib.Images[crc] end if (file.Exists("msd_imgs/" .. crc, "DATA")) then MSD.ImgLib.Images[crc] = Material("data/msd_imgs/" .. crc, "smooth noclamp") return MSD.ImgLib.Images[crc] else return MSD.ImgLib.PreCacheMaterial(url, crc) end end function MSD.ImgLib.PreCacheMaterial(url, crc) if not crc then crc = util.CRC(url) .. ".png" end if not file.Exists("msd_imgs", "DATA") then file.CreateDir("msd_imgs") end if not MSD.ImgLib.PreCacheStarted[crc] then MSD.ImgLib.PreCacheStarted[crc] = true http.Fetch(url, function(body, size, headers, code) if (body:find("^.PNG")) then file.Write("msd_imgs/" .. crc, body) MSD.ImgLib.Images[crc] = Material("data/msd_imgs/" .. crc, "smooth noclamp") return MSD.ImgLib.Images[crc] else print("Image is not a PNG, url - " .. url) end end, function() print("Failed to get image, url - " .. url) end) end return MSD.ImgLib.NoMaterial end
remote = require 'net.box' fiber = require 'fiber' log = require 'log' msgpack = require 'msgpack' env = require('test_run') test_run = env.new() test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '") test_run:cmd("setopt delimiter ';'") function x_select(cn, space_id, index_id, iterator, offset, limit, key, opts) local ret = cn:_request('select', opts, nil, space_id, index_id, iterator, offset, limit, key) return ret end function x_fatal(cn) cn._transport.perform_request(nil, nil, false, 'inject', nil, nil, nil, '\x80') end test_run:cmd("setopt delimiter ''"); LISTEN = require('uri').parse(box.cfg.listen) space = box.schema.space.create('net_box_test_space') index = space:create_index('primary', { type = 'tree' }) -- low level connection log.info("create connection") cn = remote.connect(LISTEN.host, LISTEN.service) log.info("state is %s", cn.state) cn:ping() log.info("ping is done") cn:ping() log.info("ping is done") cn:ping() -- check permissions cn:call('unexists_procedure') function test_foo(a,b,c) return { {{ [a] = 1 }}, {{ [b] = 2 }}, c } end cn:call('test_foo', {'a', 'b', 'c'}) cn:eval('return 2+2') cn:close() -- connect and call without usage access box.schema.user.grant('guest','execute','universe') box.schema.user.revoke('guest','usage','universe') box.session.su("guest") cn = remote.connect(LISTEN.host, LISTEN.service) cn:call('test_foo', {'a', 'b', 'c'}) box.session.su("admin") box.schema.user.grant('guest','usage','universe') cn:close() cn = remote.connect(box.cfg.listen) cn:call('unexists_procedure') cn:call('test_foo', {'a', 'b', 'c'}) cn:call(nil, {'a', 'b', 'c'}) cn:eval('return 2+2') cn:eval('return 1, 2, 3') cn:eval('return ...', {1, 2, 3}) cn:eval('return { k = "v1" }, true, { xx = 10, yy = 15 }, nil') cn:eval('return nil') cn:eval('return') cn:eval('error("exception")') cn:eval('box.error(0)') cn:eval('!invalid expression') -- box.commit() missing at return of CALL/EVAL function no_commit() box.begin() fiber.sleep(0.001) end cn:call('no_commit') cn:eval('no_commit()') remote.self:eval('return 1+1, 2+2') remote.self:eval('return') remote.self:eval('error("exception")') remote.self:eval('box.error(0)') remote.self:eval('!invalid expression') box.schema.user.revoke('guest', 'execute', 'universe') -- -- gh-822: net.box.call should roll back local transaction on error -- _ = box.schema.space.create('gh822') _ = box.space.gh822:create_index('primary') test_run:cmd("setopt delimiter ';'") -- rollback on invalid function function rollback_on_invalid_function() box.begin() box.space.gh822:insert{1, "netbox_test"} pcall(remote.self.call, remote.self, 'invalid_function') return box.space.gh822:get(1) == nil end; rollback_on_invalid_function(); -- rollback on call error function test_error() error('Some error') end; function rollback_on_call_error() box.begin() box.space.gh822:insert{1, "netbox_test"} pcall(remote.self.call, remote.self, 'test_error') return box.space.gh822:get(1) == nil end; rollback_on_call_error(); -- rollback on eval function rollback_on_eval_error() box.begin() box.space.gh822:insert{1, "netbox_test"} pcall(remote.self.eval, remote.self, "error('Some error')") return box.space.gh822:get(1) == nil end; rollback_on_eval_error(); test_run:cmd("setopt delimiter ''"); box.space.gh822:drop() box.schema.user.grant('guest', 'read,write', 'space', 'net_box_test_space') box.schema.user.grant('guest', 'execute', 'universe') cn:close() cn = remote.connect(box.cfg.listen) x_select(cn, space.id, space.index.primary.id, box.index.EQ, 0, 0xFFFFFFFF, 123) space:insert{123, 345} x_select(cn, space.id, space.index.primary.id, box.index.EQ, 0, 0, 123) x_select(cn, space.id, space.index.primary.id, box.index.EQ, 0, 1, 123) x_select(cn, space.id, space.index.primary.id, box.index.EQ, 1, 1, 123) cn.space[space.id] ~= nil cn.space.net_box_test_space ~= nil cn.space.net_box_test_space ~= nil cn.space.net_box_test_space.index ~= nil cn.space.net_box_test_space.index.primary ~= nil cn.space.net_box_test_space.index[space.index.primary.id] ~= nil cn.space.net_box_test_space.index.primary:select(123) cn.space.net_box_test_space.index.primary:select(123, { limit = 0 }) cn.space.net_box_test_space.index.primary:select(nil, { limit = 1, }) cn.space.net_box_test_space:insert{234, 1,2,3} cn.space.net_box_test_space:insert{234, 1,2,3} cn.space.net_box_test_space.insert{234, 1,2,3} cn.space.net_box_test_space:replace{354, 1,2,3} cn.space.net_box_test_space:replace{354, 1,2,4} cn.space.net_box_test_space:select{123} space:select({123}, { iterator = 'GE' }) cn.space.net_box_test_space:select({123}, { iterator = 'GE' }) cn.space.net_box_test_space:select({123}, { iterator = 'GT' }) cn.space.net_box_test_space:select({123}, { iterator = 'GT', limit = 1 }) cn.space.net_box_test_space:select({123}, { iterator = 'GT', limit = 1, offset = 1 }) cn.space.net_box_test_space:select{123} cn.space.net_box_test_space:update({123}, { { '+', 2, 1 } }) cn.space.net_box_test_space:update(123, { { '+', 2, 1 } }) cn.space.net_box_test_space:select{123} cn.space.net_box_test_space:insert(cn.space.net_box_test_space:get{123}:update{ { '=', 1, 2 } }) cn.space.net_box_test_space:delete{123} cn.space.net_box_test_space:select{2} cn.space.net_box_test_space:select({234}, { iterator = 'LT' }) cn.space.net_box_test_space:update({1}, { { '+', 2, 2 } }) cn.space.net_box_test_space:delete{1} cn.space.net_box_test_space:delete{2} cn.space.net_box_test_space:delete{2} -- test one-based indexing in splice operation (see update.test.lua) cn.space.net_box_test_space:replace({10, 'abcde'}) cn.space.net_box_test_space:update(10, {{':', 2, 0, 0, '!'}}) cn.space.net_box_test_space:update(10, {{':', 2, 1, 0, '('}}) cn.space.net_box_test_space:update(10, {{':', 2, 2, 0, '({'}}) cn.space.net_box_test_space:update(10, {{':', 2, -1, 0, ')'}}) cn.space.net_box_test_space:update(10, {{':', 2, -2, 0, '})'}}) cn.space.net_box_test_space:delete{10} cn.space.net_box_test_space:select({}, { iterator = 'ALL' }) -- gh-841: net.box uses incorrect iterator type for select with no arguments cn.space.net_box_test_space:select() cn.space.net_box_test_space.index.primary:min() cn.space.net_box_test_space.index.primary:min(354) cn.space.net_box_test_space.index.primary:max() cn.space.net_box_test_space.index.primary:max(234) cn.space.net_box_test_space.index.primary:count() cn.space.net_box_test_space.index.primary:count(354) cn.space.net_box_test_space:get(354) -- reconnects after errors box.schema.user.revoke('guest', 'execute', 'universe') box.schema.func.create('test_foo') box.schema.user.grant('guest', 'execute', 'function', 'test_foo') -- -- 1. no reconnect x_fatal(cn) cn.state cn:ping() cn:call('test_foo') cn:wait_state('active') -- -- 2 reconnect cn = remote.connect(LISTEN.host, LISTEN.service, { reconnect_after = .1 }) cn.space ~= nil cn.space.net_box_test_space:select({}, { iterator = 'ALL' }) x_fatal(cn) cn:wait_connected() cn:wait_state('active') cn:wait_state({active=true}) cn:ping() cn.state cn.space.net_box_test_space:select({}, { iterator = 'ALL' }) x_fatal(cn) x_select(cn, space.id, 0, box.index.ALL, 0, 0xFFFFFFFF, {}) cn.state cn:ping() -- -- dot-new-method cn1 = remote.new(LISTEN.host, LISTEN.service) x_select(cn1, space.id, 0, box.index.ALL, 0, 0xFFFFFFF, {}) cn1:close() -- -- error while waiting for response type(fiber.create(function() fiber.sleep(.5) x_fatal(cn) end)) function pause() fiber.sleep(10) return true end box.schema.func.create('pause') box.schema.user.grant('guest', 'execute', 'function', 'pause') cn:call('pause') cn:call('test_foo', {'a', 'b', 'c'}) box.schema.func.drop('pause') -- call remote.self:call('test_foo', {'a', 'b', 'c'}) cn:call('test_foo', {'a', 'b', 'c'}) box.schema.func.drop('test_foo') box.schema.func.create('long_rep') box.schema.user.grant('guest', 'execute', 'function', 'long_rep') -- long replies function long_rep() return { 1, string.rep('a', 5000) } end res = cn:call('long_rep') res[1] == 1 res[2] == string.rep('a', 5000) function long_rep() return { 1, string.rep('a', 50000) } end res = cn:call('long_rep') res[1] == 1 res[2] == string.rep('a', 50000) box.schema.func.drop('long_rep') -- a.b.c.d u = '84F7BCFA-079C-46CC-98B4-F0C821BE833E' X = {} X.X = X function X.fn(x,y) return y or x end box.schema.user.grant('guest', 'execute', 'universe') cn:close() cn = remote.connect(LISTEN.host, LISTEN.service) cn:call('X.fn', {u}) cn:call('X.X.X.X.X.X.X.fn', {u}) cn:call('X.X.X.X:fn', {u}) box.schema.user.revoke('guest', 'execute', 'universe') cn:close() -- auth cn = remote.connect(LISTEN.host, LISTEN.service, { user = 'netbox', password = '123', wait_connected = true }) cn:is_connected() cn.error cn.state box.schema.user.create('netbox', { password = 'test' }) box.schema.user.grant('netbox', 'read,write', 'space', 'net_box_test_space') box.schema.user.grant('netbox', 'execute', 'universe') cn = remote.connect(LISTEN.host, LISTEN.service, { user = 'netbox', password = 'test' }) cn.state cn.error cn:ping() function ret_after(to) fiber.sleep(to) return {{to}} end cn:ping({timeout = 1.00}) cn:ping({timeout = 1e-9}) cn:ping() remote_space = cn.space.net_box_test_space remote_pk = remote_space.index.primary remote_space:insert({0}, { timeout = 1.00 }) remote_space:insert({1}, { timeout = 1e-9 }) remote_space:insert({2}) remote_space:replace({0}, { timeout = 1e-9 }) remote_space:replace({1}) remote_space:replace({2}, { timeout = 1.00 }) remote_space:upsert({3}, {}, { timeout = 1e-9 }) remote_space:upsert({4}, {}) remote_space:upsert({5}, {}, { timeout = 1.00 }) remote_space:upsert({3}, {}) remote_space:update({3}, {}, { timeout = 1e-9 }) remote_space:update({4}, {}) remote_space:update({5}, {}, { timeout = 1.00 }) remote_space:update({3}, {}) remote_pk:update({5}, {}, { timeout = 1e-9 }) remote_pk:update({4}, {}) remote_pk:update({3}, {}, { timeout = 1.00 }) remote_pk:update({5}, {}) remote_space:get({0}) remote_space:get({1}, { timeout = 1.00 }) remote_space:get({2}, { timeout = 1e-9 }) remote_pk:get({3}, { timeout = 1e-9 }) remote_pk:get({4}) remote_pk:get({5}, { timeout = 1.00 }) remote_space:select({2}, { timeout = 1e-9 }) remote_space:select({2}, { timeout = 1.00 }) remote_space:select({2}) remote_pk:select({2}, { timeout = 1.00 }) remote_pk:select({2}, { timeout = 1e-9 }) remote_pk:select({2}) remote_space:select({5}, { timeout = 1.00, iterator = 'LE', limit = 5 }) remote_space:select({5}, { iterator = 'LE', limit = 5}) remote_space:select({5}, { timeout = 1e-9, iterator = 'LE', limit = 5 }) remote_pk:select({2}, { timeout = 1.00, iterator = 'LE', limit = 5 }) remote_pk:select({2}, { iterator = 'LE', limit = 5}) remote_pk:select({2}, { timeout = 1e-9, iterator = 'LE', limit = 5 }) remote_pk:count({2}, { timeout = 1.00}) remote_pk:count({2}, { timeout = 1e-9}) remote_pk:count({2}) remote_pk:count({2}, { timeout = 1.00, iterator = 'LE' }) remote_pk:count({2}, { iterator = 'LE'}) remote_pk:count({2}, { timeout = 1e-9, iterator = 'LE' }) remote_pk:min(nil, { timeout = 1.00 }) remote_pk:min(nil, { timeout = 1e-9 }) remote_pk:min(nil) remote_pk:min({0}, { timeout = 1e-9 }) remote_pk:min({1}) remote_pk:min({2}, { timeout = 1.00 }) remote_pk:max(nil) remote_pk:max(nil, { timeout = 1e-9 }) remote_pk:max(nil, { timeout = 1.00 }) remote_pk:max({0}, { timeout = 1.00 }) remote_pk:max({1}, { timeout = 1e-9 }) remote_pk:max({2}) -- -- gh-3262: index:count() inconsistent results -- test_run:cmd("setopt delimiter ';'") function do_count_test(min, it) local r1 = remote_pk:count(min, {iterator = it} ) local r2 = box.space.net_box_test_space.index.primary:count(min, {iterator = it} ) local r3 = remote.self.space.net_box_test_space.index.primary:count(min, {iterator = it} ) return r1 == r2 and r2 == r3 end; data = remote_pk:select(); for _, v in pairs(data) do local itrs = {'GE', 'GT', 'LE', 'LT' } for _, it in pairs(itrs) do assert(do_count_test(v[0], it) == true) end end; test_run:cmd("setopt delimiter ''"); _ = remote_space:delete({0}, { timeout = 1e-9 }) _ = remote_pk:delete({0}, { timeout = 1.00 }) _ = remote_space:delete({1}, { timeout = 1.00 }) _ = remote_pk:delete({1}, { timeout = 1e-9 }) _ = remote_space:delete({2}, { timeout = 1e-9 }) _ = remote_pk:delete({2}) _ = remote_pk:delete({3}) _ = remote_pk:delete({4}) _ = remote_pk:delete({5}) remote_space:get(0) remote_space:get(1) remote_space:get(2) remote_space = nil cn:call('ret_after', {0.01}, { timeout = 1.00 }) cn:call('ret_after', {1.00}, { timeout = 1e-9 }) cn:eval('return ret_after(...)', {0.01}, { timeout = 1.00 }) cn:eval('return ret_after(...)', {1.00}, { timeout = 1e-9 }) -- -- :timeout() -- @deprecated since 1.7.4 -- cn:timeout(1).space.net_box_test_space.index.primary:select{234} cn:call('ret_after', {.01}) cn:timeout(1):call('ret_after', {.01}) cn:timeout(.01):call('ret_after', {1}) cn = remote:timeout(0.0000000001):connect(LISTEN.host, LISTEN.service, { user = 'netbox', password = '123' }) cn:close() cn = remote:timeout(1):connect(LISTEN.host, LISTEN.service, { user = 'netbox', password = '123' }) remote.self:ping() remote.self.space.net_box_test_space:select{234} remote.self:timeout(123).space.net_box_test_space:select{234} remote.self:is_connected() remote.self:wait_connected() cn:close() -- cleanup database after tests space:drop() -- #1545 empty password cn = remote.connect(LISTEN.host, LISTEN.service, { user = 'test' }) cn ~= nil cn:close() cn = remote.connect(LISTEN.host, LISTEN.service, { password = 'test' }) cn ~= nil cn:close() -- #544 usage for remote[point]method cn = remote.connect(LISTEN.host, LISTEN.service) box.schema.user.grant('guest', 'execute', 'universe') cn:close() cn = remote.connect(LISTEN.host, LISTEN.service) cn:eval('return true') cn.eval('return true') cn.ping() cn:close() remote.self:eval('return true') remote.self.eval('return true') box.schema.user.revoke('guest', 'execute', 'universe') -- uri as the first argument uri = string.format('%s:%s@%s:%s', 'netbox', 'test', LISTEN.host, LISTEN.service) cn = remote.new(uri) cn:ping() cn:close() uri = string.format('%s@%s:%s', 'netbox', LISTEN.host, LISTEN.service) cn = remote.new(uri) cn ~= nil, cn.state, cn.error cn:close() -- don't merge creds from uri & opts remote.new(uri, { password = 'test' }) cn = remote.new(uri, { user = 'netbox', password = 'test' }) cn:ping() cn:close() box.schema.user.drop('netbox') -- #594: bad argument #1 to 'setmetatable' (table expected, got number) box.schema.func.create('dostring') box.schema.user.grant('guest', 'execute', 'function', 'dostring') test_run:cmd("setopt delimiter ';'") function gh594() local cn = remote.connect(box.cfg.listen) local ping = fiber.create(function() cn:ping() end) cn:call('dostring', {'return 2 + 2'}) cn:close() end; test_run:cmd("setopt delimiter ''"); gh594() box.schema.func.drop('dostring') -- #636: Reload schema on demand sp = box.schema.space.create('test_old') _ = sp:create_index('primary') sp:insert{1, 2, 3} box.schema.user.grant('guest', 'read', 'space', 'test_old') con = remote.new(box.cfg.listen) con:ping() con.space.test_old:select{} con.space.test == nil sp = box.schema.space.create('test') _ = sp:create_index('primary') sp:insert{2, 3, 4} box.schema.user.grant('guest', 'read', 'space', 'test') con.space.test == nil con:reload_schema() con.space.test:select{} box.space.test:drop() box.space.test_old:drop() con:close() name = string.match(arg[0], "([^,]+)%.lua") file_log = require('fio').open(name .. '.log', {'O_RDONLY', 'O_NONBLOCK'}) file_log:seek(0, 'SEEK_END') ~= 0 box.schema.user.grant('guest', 'execute', 'universe') test_run:cmd("setopt delimiter ';'") _ = fiber.create( function() local conn = require('net.box').new(box.cfg.listen) conn:call('no_such_function', {}) conn:close() end ); test_run:cmd("setopt delimiter ''"); test_run:wait_log('default', 'ER_NO_SUCH_PROC', nil, 10) box.schema.user.revoke('guest', 'execute', 'universe') -- -- gh-3900: tarantool can be crashed by sending gibberish to a -- binary socket -- socket = require("socket") sock = socket.tcp_connect(LISTEN.host, LISTEN.service) data = string.fromhex("6783000000000000000000000000000000000000000000800000C8000000000000000000000000000000000000000000FFFF210100373208000000FFFF000055AAEB66486472530D02000000000010A0350001008000001000000000000000000000000000D05700") sock:write(data) test_run:wait_log('default', 'ER_INVALID_MSGPACK: Invalid MsgPack %- packet body', nil, 10) sock:close() -- gh-983 selecting a lot of data crashes the server or hangs the -- connection -- gh-983 test case: iproto connection selecting a lot of data _ = box.schema.space.create('test', { temporary = true }) _ = box.space.test:create_index('primary', {type = 'TREE', parts = {1,'unsigned'}}) data1k = "aaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhhaaaabbbbccccddddeeeeffffgggghhhh" for i = 0,10000 do box.space.test:insert{i, data1k} end box.schema.user.grant('guest', 'read', 'space', 'test') net = require('net.box') c = net:connect(box.cfg.listen) r = c.space.test:select(nil, {limit=5000}) box.space.test:drop() -- gh-970 gh-971 UPSERT over network _ = box.schema.space.create('test') _ = box.space.test:create_index('primary', {type = 'TREE', parts = {1,'unsigned'}}) _ = box.space.test:create_index('covering', {type = 'TREE', parts = {1,'unsigned',3,'string',2,'unsigned'}}) _ = box.space.test:insert{1, 2, "string"} box.schema.user.grant('guest', 'read,write', 'space', 'test') c = net:connect(box.cfg.listen) c.space.test:select{} c.space.test:upsert({1, 2, 'nothing'}, {{'+', 2, 1}}) -- common update c.space.test:select{} c.space.test:upsert({2, 4, 'something'}, {{'+', 2, 1}}) -- insert c.space.test:select{} c.space.test:upsert({2, 4, 'nothing'}, {{'+', 3, 100500}}) -- wrong operation c.space.test:select{} -- gh-1729 net.box index metadata incompatible with local metadata c.space.test.index.primary.parts c.space.test.index.covering.parts box.space.test:drop() -- CALL vs CALL_16 in connect options function echo(...) return ... end box.schema.user.grant('guest', 'execute', 'universe') c = net.connect(box.cfg.listen) c:call('echo', {42}) c:eval('return echo(...)', {42}) -- invalid arguments c:call('echo', 42) c:eval('return echo(...)', 42) c:close() c = net.connect(box.cfg.listen, {call_16 = true}) c:call('echo', 42) c:eval('return echo(...)', 42) c:close() box.schema.user.revoke('guest', 'execute', 'universe') -- -- gh-2195 export pure msgpack from net.box -- space = box.schema.space.create('test') _ = box.space.test:create_index('primary') box.schema.user.grant('guest', 'read,write', 'space', 'test') box.schema.user.grant('guest', 'execute', 'universe') c = net.connect(box.cfg.listen) ibuf = require('buffer').ibuf() c:ping() c.space.test ~= nil c.space.test:replace({1, 'hello'}) -- replace c.space.test:replace({2}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- replace + skip_header c.space.test:replace({2}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- insert c.space.test:insert({3}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- insert + skip_header _ = space:delete({3}) c.space.test:insert({3}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- update c.space.test:update({3}, {}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c.space.test.index.primary:update({3}, {}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- update + skip_header c.space.test:update({3}, {}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c.space.test.index.primary:update({3}, {}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- upsert c.space.test:upsert({4}, {}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- upsert + skip_header c.space.test:upsert({4}, {}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- delete c.space.test:upsert({4}, {}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- delete + skip_header c.space.test:upsert({4}, {}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- select c.space.test.index.primary:select({3}, {iterator = 'LE', buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- select + skip_header c.space.test.index.primary:select({3}, {iterator = 'LE', buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- select len = c.space.test:select({}, {buffer = ibuf}) ibuf.rpos + len == ibuf.wpos result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) ibuf.rpos == ibuf.wpos len result -- select + skip_header len = c.space.test:select({}, {buffer = ibuf, skip_header = true}) ibuf.rpos + len == ibuf.wpos result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) ibuf.rpos == ibuf.wpos len result -- call c:call("echo", {1, 2, 3}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c:call("echo", {}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c:call("echo", nil, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- call + skip_header c:call("echo", {1, 2, 3}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c:call("echo", {}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c:call("echo", nil, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- eval c:eval("echo(...)", {1, 2, 3}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c:eval("echo(...)", {}, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c:eval("echo(...)", nil, {buffer = ibuf}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- eval + skip_header c:eval("echo(...)", {1, 2, 3}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c:eval("echo(...)", {}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result c:eval("echo(...)", nil, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- make several request into a buffer with skip_header, then read -- results c:call("echo", {1, 2, 3}, {buffer = ibuf, skip_header = true}) c:call("echo", {1, 2, 3}, {buffer = ibuf, skip_header = true}) c:call("echo", {1, 2, 3}, {buffer = ibuf, skip_header = true}) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result -- unsupported methods c.space.test:get({1}, { buffer = ibuf}) c.space.test.index.primary:min({}, { buffer = ibuf}) c.space.test.index.primary:max({}, { buffer = ibuf}) c.space.test.index.primary:count({}, { buffer = ibuf}) c.space.test.index.primary:get({1}, { buffer = ibuf}) -- error handling rpos, wpos = ibuf.rpos, ibuf.wpos c.space.test:insert({1}, {buffer = ibuf}) ibuf.rpos == rpos, ibuf.wpos == wpos ibuf = nil c:close() space:drop() box.schema.user.revoke('guest', 'execute', 'universe') -- gh-1904 net.box hangs in :close() if a fiber was cancelled -- while blocked in :_wait_state() in :_request() options = {user = 'netbox', password = 'badpass', wait_connected = false, reconnect_after = 0.01} c = net:new(box.cfg.listen, options) f = fiber.create(function() c:call("") end) fiber.sleep(0.01) f:cancel(); c:close() box.schema.user.grant('guest', 'read', 'space', '_schema') -- check for on_schema_reload callback test_run:cmd("setopt delimiter ';'") do local a = 0 function osr_cb() a = a + 1 end local con = net.new(box.cfg.listen, { wait_connected = false }) con:on_schema_reload(osr_cb) con:wait_connected() con.space._schema:select{} box.schema.space.create('misisipi') box.space.misisipi:drop() con.space._schema:select{} con:close() con = nil return a end; do local a = 0 function osr_cb() a = a + 1 end local con = net.new(box.cfg.listen, { wait_connected = true }) con:on_schema_reload(osr_cb) con.space._schema:select{} box.schema.space.create('misisipi') box.space.misisipi:drop() con.space._schema:select{} con:close() con = nil return a end; test_run:cmd("setopt delimiter ''"); box.schema.user.revoke('guest', 'read', 'space', '_schema') -- Tarantool < 1.7.1 compatibility (gh-1533) c = net.new(box.cfg.listen) c:ping() c:close() -- Test for connect_timeout > 0 in netbox connect test_run:cmd("setopt delimiter ';'"); need_stop = false; greeting = "Tarantool 1.7.3 (Lua console)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" .. "type 'help' for interactive help~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; socket = require('socket'); srv = socket.tcp_server('localhost', 0, { handler = function(fd) local fiber = require('fiber') while not need_stop do fiber.sleep(0.01) end fd:write(greeting) end }); port = srv:name().port -- we must get timeout nb = net.new('localhost:' .. port, { wait_connected = true, console = true, connect_timeout = 0.1 }); nb.error:find('timed out') ~= nil; need_stop = true nb:close(); -- we must get peer closed nb = net.new('localhost:' .. port, { wait_connected = true, console = true, connect_timeout = 0.2 }); nb.error ~= "Timeout exceeded"; nb:close(); test_run:cmd("setopt delimiter ''"); srv:close() test_run:cmd("clear filter") -- -- gh-2402 net.box doesn't support space:format() -- space = box.schema.space.create('test', {format={{name="id", type="unsigned"}}}) space ~= nil _ = box.space.test:create_index('primary') box.schema.user.grant('guest', 'read', 'space', 'test') c = net.connect(box.cfg.listen) c:ping() c.space.test ~= nil format = c.space.test:format() format[1] ~= nil format[1].name == "id" format[1].type == "unsigned" c.space.test:format({}) -- -- gh-4091: index unique flag is always false. -- c.space.test.index.primary.unique c:close() space:drop() -- -- Check that it's possible to get connection object form net.box space -- space = box.schema.space.create('test', {format={{name="id", type="unsigned"}}}) space ~= nil _ = box.space.test:create_index('primary') box.schema.user.grant('guest','read,write,execute','space', 'test') c = net.connect(box.cfg.listen) c:ping() c.space.test ~= nil c.space.test.connection == c box.schema.user.revoke('guest','read,write,execute','space', 'test') c:close() -- -- gh-2642: box.session.type() -- box.schema.user.grant('guest','execute','universe') c = net.connect(box.cfg.listen) c:call("box.session.type") c:close() box.schema.user.revoke('guest', 'execute', 'universe') -- -- On_connect/disconnect triggers. -- test_run:cmd('create server connecter with script = "box/proxy.lua"') test_run:cmd('start server connecter') test_run:cmd("set variable connect_to to 'connecter.listen'") conn = net.connect(connect_to, { reconnect_after = 0.1 }) conn.state connected_cnt = 0 disconnected_cnt = 0 function on_connect() connected_cnt = connected_cnt + 1 end function on_disconnect() disconnected_cnt = disconnected_cnt + 1 end conn:on_connect(on_connect) conn:on_disconnect(on_disconnect) test_run:cmd('stop server connecter') test_run:cmd('start server connecter') while conn.state ~= 'active' do fiber.sleep(0.1) end connected_cnt old_disconnected_cnt = disconnected_cnt disconnected_cnt >= 1 conn:close() disconnected_cnt == old_disconnected_cnt + 1 test_run:cmd('stop server connecter') -- -- gh-2401 update pseudo objects not replace them -- space:drop() space = box.schema.space.create('test') box.schema.user.grant('guest', 'read', 'space', 'test') c = net.connect(box.cfg.listen) cspace = c.space.test space.index.test_index == nil cspace.index.test_index == nil _ = space:create_index("test_index", {parts={1, 'string'}}) c:reload_schema() space.index.test_index ~= nil cspace.index.test_index ~= nil c.space.test.index.test_index ~= nil -- cleanup space:drop() -- -- gh-946: long polling CALL blocks input -- box.schema.func.create('fast_call') box.schema.func.create('long_call') box.schema.func.create('wait_signal') box.schema.user.grant('guest', 'execute', 'function', 'fast_call') box.schema.user.grant('guest', 'execute', 'function', 'long_call') box.schema.user.grant('guest', 'execute', 'function', 'wait_signal') c = net.connect(box.cfg.listen) N = 100 pad = string.rep('x', 1024) long_call_cond = fiber.cond() long_call_channel = fiber.channel() fast_call_channel = fiber.channel() function fast_call(x) return x end function long_call(x) long_call_cond:wait() return x * 2 end test_run:cmd("setopt delimiter ';'") for i = 1, N do fiber.create(function() fast_call_channel:put(c:call('fast_call', {i, pad})) end) fiber.create(function() long_call_channel:put(c:call('long_call', {i, pad})) end) end test_run:cmd("setopt delimiter ''"); x = 0 for i = 1, N do x = x + fast_call_channel:get() end x long_call_cond:broadcast() x = 0 for i = 1, N do x = x + long_call_channel:get() end x -- -- Check that a connection does not leak if there is -- a long CALL in progress when it is closed. -- disconnected = false function on_disconnect() disconnected = true end -- Make sure all dangling connections are collected so -- that on_disconnect trigger isn't called spuriously. collectgarbage('collect') fiber.sleep(0) box.session.on_disconnect(on_disconnect) == on_disconnect -- -- gh-3859: on_disconnect is called only after all requests are -- processed, but should be called right after disconnect and -- only once. -- ch1 = fiber.channel(1) ch2 = fiber.channel(1) function wait_signal() ch1:put(true) ch2:get() end _ = fiber.create(function() c:call('wait_signal') end) ch1:get() c:close() fiber.sleep(0) while disconnected == false do fiber.sleep(0.01) end disconnected -- true disconnected = nil ch2:put(true) fiber.sleep(0) disconnected -- nil, on_disconnect is not called second time. box.session.on_disconnect(nil, on_disconnect) box.schema.func.drop('long_call') box.schema.func.drop('fast_call') box.schema.func.drop('wait_signal') -- -- gh-2666: check that netbox.call is not repeated on schema -- change. -- box.schema.user.grant('guest', 'write', 'space', '_space') box.schema.user.grant('guest', 'write', 'space', '_schema') box.schema.user.grant('guest', 'create', 'universe') count = 0 function create_space(name) count = count + 1 box.schema.create_space(name) return true end box.schema.func.create('create_space') box.schema.user.grant('guest', 'execute', 'function', 'create_space') c = net.connect(box.cfg.listen) c:call('create_space', {'test1'}) count c:call('create_space', {'test2'}) count c:call('create_space', {'test3'}) count box.space.test1:drop() box.space.test2:drop() box.space.test3:drop() box.schema.user.revoke('guest', 'write', 'space', '_space') box.schema.user.revoke('guest', 'write', 'space', '_schema') box.schema.user.revoke('guest', 'create', 'universe') c:close() box.schema.func.drop('create_space') -- -- gh-3164: netbox connection is not closed and garbage collected -- ever, if reconnect_after is set. -- test_run:cmd('start server connecter') test_run:cmd("set variable connect_to to 'connecter.listen'") weak = setmetatable({}, {__mode = 'v'}) -- Create strong and weak reference. Weak is valid until strong -- is valid too. strong = net.connect(connect_to, {reconnect_after = 0.1}) weak.c = strong weak.c:ping() test_run:cmd('stop server connecter') test_run:cmd('cleanup server connecter') -- Check the connection tries to reconnect at least two times. -- 'Cannot assign requested address' is the crutch for running the -- tests in a docker. This error emits instead of -- 'Connection refused' inside a docker. old_log_level = box.cfg.log_level box.cfg{log_level = 6} log.info(string.rep('a', 1000)) test_run:cmd("setopt delimiter ';'") while test_run:grep_log('default', 'Network is unreachable', 1000) == nil and test_run:grep_log('default', 'Connection refused', 1000) == nil and test_run:grep_log('default', 'Cannot assign requested address', 1000) == nil do fiber.sleep(0.1) end; log.info(string.rep('a', 1000)); while test_run:grep_log('default', 'Network is unreachable', 1000) == nil and test_run:grep_log('default', 'Connection refused', 1000) == nil and test_run:grep_log('default', 'Cannot assign requested address', 1000) == nil do fiber.sleep(0.1) end; test_run:cmd("setopt delimiter ''"); box.cfg{log_level = old_log_level} collectgarbage('collect') strong.state strong == weak.c -- Remove single strong reference. Now connection must be garbage -- collected. strong = nil collectgarbage('collect') -- Now weak.c is null, because it was weak reference, and the -- connection is deleted by 'collect'. weak.c -- -- gh-2677: netbox supports console connections, that complicates -- both console and netbox. It was necessary because before a -- connection is established, a console does not known is it -- binary or text protocol, and netbox could not be created from -- existing socket. -- box.schema.user.grant('guest', 'execute', 'universe') urilib = require('uri') uri = urilib.parse(tostring(box.cfg.listen)) s, greeting = net.establish_connection(uri.host, uri.service) c = net.wrap(s, greeting, uri.host, uri.service, {reconnect_after = 0.01}) c.state a = 100 function kek(args) return {1, 2, 3, args} end c:eval('a = 200') a c:call('kek', {300}) s = box.schema.create_space('test') box.schema.user.grant('guest', 'read,write', 'space', 'test') pk = s:create_index('pk') c:reload_schema() c.space.test:replace{1} c.space.test:get{1} c.space.test:delete{1} -- -- Break a connection to test reconnect_after. -- _ = c._transport.perform_request(nil, nil, false, 'inject', nil, nil, nil, '\x80') while not c:is_connected() do fiber.sleep(0.01) end c:ping() s:drop() c:close() -- -- Test a case, when netbox can not connect first time, but -- reconnect_after is set. -- c = net.connect('localhost:33333', {reconnect_after = 0.1, wait_connected = false}) while c.state ~= 'error_reconnect' do fiber.sleep(0.01) end c:close() box.schema.user.revoke('guest', 'execute', 'universe') c.state c = nil -- -- gh-3256 net.box is_nullable and collation options output -- space = box.schema.create_space('test') box.schema.user.grant('guest', 'read', 'space', 'test') _ = space:create_index('pk') _ = space:create_index('sk', {parts = {{2, 'unsigned', is_nullable = true}}}) c = net:connect(box.cfg.listen) c.space.test.index.sk.parts space:drop() space = box.schema.create_space('test') c:close() box.schema.user.grant('guest', 'read', 'space', 'test') c = net:connect(box.cfg.listen) box.internal.collation.create('test', 'ICU', 'ru-RU') collation_id = box.internal.collation.id_by_name('test') _ = space:create_index('sk', { type = 'tree', parts = {{1, 'str', collation = 'test'}}, unique = true }) c:reload_schema() parts = c.space.test.index.sk.parts #parts == 1 parts[1].fieldno == 1 parts[1].type == 'string' parts[1].is_nullable == false if _TARANTOOL >= '2.2.1' then \ return parts[1].collation == 'test' \ else \ return parts[1].collation_id == collation_id \ end c:close() box.internal.collation.drop('test') space:drop() c.state c = nil -- -- gh-3107: fiber-async netbox. -- cond = nil box.schema.func.create('long_function') box.schema.user.grant('guest', 'execute', 'function', 'long_function') function long_function(...) cond = fiber.cond() cond:wait() return ... end function finalize_long() while not cond do fiber.sleep(0.01) end cond:signal() cond = nil end s = box.schema.create_space('test') pk = s:create_index('pk') s:replace{1} s:replace{2} s:replace{3} s:replace{4} c = net:connect(box.cfg.listen) -- -- Check long connections, multiple wait_result(). -- future = c:call('long_function', {1, 2, 3}, {is_async = true}) future:result() future:is_ready() future:wait_result(0.01) -- Must fail on timeout. finalize_long() ret = future:wait_result(100) future:is_ready() -- Any timeout is ok - response is received already. future:wait_result(0) future:wait_result(0.01) ret _, err = pcall(future.wait_result, future, true) err:find('Usage') ~= nil _, err = pcall(future.wait_result, future, '100') err:find('Usage') ~= nil -- -- Check infinity timeout. -- ret = nil _ = fiber.create(function() ret = c:call('long_function', {1, 2, 3}, {is_async = true}):wait_result() end) finalize_long() while not ret do fiber.sleep(0.01) end ret c:close() box.schema.user.grant('guest', 'execute', 'universe') c = net:connect(box.cfg.listen) future = c:eval('return long_function(...)', {1, 2, 3}, {is_async = true}) future:result() future:wait_result(0.01) -- Must fail on timeout. finalize_long() future:wait_result(100) c:close() -- -- Check that is_async does not work on a closed connection. -- c:call('any_func', {}, {is_async = true}) box.schema.user.revoke('guest', 'execute', 'universe') c = net:connect(box.cfg.listen) -- -- Ensure the request is garbage collected both if is not used and -- if is. -- gc_test = setmetatable({}, {__mode = 'v'}) gc_test.future = c:call('long_function', {1, 2, 3}, {is_async = true}) gc_test.future ~= nil collectgarbage() gc_test finalize_long() future = c:call('long_function', {1, 2, 3}, {is_async = true}) collectgarbage() future ~= nil finalize_long() future:wait_result(1000) collectgarbage() future ~= nil gc_test.future = future future = nil collectgarbage() gc_test -- -- Ensure a request can be finalized from non-caller fibers. -- future = c:call('long_function', {1, 2, 3}, {is_async = true}) ret = {} count = 0 for i = 1, 10 do fiber.create(function() ret[i] = future:wait_result(1000) count = count + 1 end) end future:wait_result(0.01) -- Must fail on timeout. finalize_long() while count ~= 10 do fiber.sleep(0.1) end ret -- -- Test space methods. -- c:close() box.schema.user.grant('guest', 'read,write', 'space', 'test') c = net:connect(box.cfg.listen) future = c.space.test:select({1}, {is_async = true}) ret = future:wait_result(100) ret type(ret[1]) future = c.space.test:insert({5}, {is_async = true}) future:wait_result(100) s:get{5} future = c.space.test:replace({6}, {is_async = true}) future:wait_result(100) s:get{6} future = c.space.test:delete({6}, {is_async = true}) future:wait_result(100) s:get{6} future = c.space.test:update({5}, {{'=', 2, 5}}, {is_async = true}) future:wait_result(100) s:get{5} future = c.space.test:upsert({5}, {{'=', 2, 6}}, {is_async = true}) future:wait_result(100) s:get{5} future = c.space.test:get({5}, {is_async = true}) future:wait_result(100) -- -- Test index methods. -- future = c.space.test.index.pk:select({1}, {is_async = true}) future:wait_result(100) future = c.space.test.index.pk:get({2}, {is_async = true}) future:wait_result(100) future = c.space.test.index.pk:min({}, {is_async = true}) future:wait_result(100) future = c.space.test.index.pk:max({}, {is_async = true}) future:wait_result(100) c:close() box.schema.user.grant('guest', 'execute', 'universe') c = net:connect(box.cfg.listen) future = c.space.test.index.pk:count({3}, {is_async = true}) future:wait_result(100) c:close() box.schema.user.revoke('guest', 'execute', 'universe') c = net:connect(box.cfg.listen) future = c.space.test.index.pk:delete({3}, {is_async = true}) future:wait_result(100) s:get{3} future = c.space.test.index.pk:update({4}, {{'=', 2, 6}}, {is_async = true}) future:wait_result(100) s:get{4} -- -- Test async errors. -- future = c.space.test:insert({1}, {is_async = true}) future:wait_result() future:result() -- -- Test discard. -- future = c:call('long_function', {1, 2, 3}, {is_async = true}) future:discard() finalize_long() future:result() future:wait_result(100) -- -- Test closed connection. -- future = c:call('long_function', {1, 2, 3}, {is_async = true}) finalize_long() future:wait_result(100) future2 = c:call('long_function', {1, 2, 3}, {is_async = true}) c:close() future2:wait_result(100) future2:result() future2:discard() -- Already successful result must be available. future:wait_result(100) future:result() future:is_ready() finalize_long() -- -- Test reconnect. -- c = net:connect(box.cfg.listen, {reconnect_after = 0.01}) future = c:call('long_function', {1, 2, 3}, {is_async = true}) _ = c._transport.perform_request(nil, nil, false, 'inject', nil, nil, nil, '\x80') while not c:is_connected() do fiber.sleep(0.01) end finalize_long() future:wait_result(100) future:result() future = c:call('long_function', {1, 2, 3}, {is_async = true}) finalize_long() future:wait_result(100) -- -- Test raw response getting. -- ibuf = require('buffer').ibuf() future = c:call('long_function', {1, 2, 3}, {is_async = true, buffer = ibuf}) finalize_long() future:wait_result(100) result, ibuf.rpos = msgpack.decode_unchecked(ibuf.rpos) result box.schema.func.drop('long_function') -- -- Test async schema version change. -- function change_schema(i) local tmp = box.schema.create_space('test'..i) return 'ok' end box.schema.func.create('change_schema') box.schema.user.grant('guest', 'execute', 'function', 'change_schema') box.schema.user.grant('guest', 'write', 'space', '_schema') box.schema.user.grant('guest', 'read,write', 'space', '_space') box.schema.user.grant('guest', 'create', 'space') future1 = c:call('change_schema', {'1'}, {is_async = true}) future2 = c:call('change_schema', {'2'}, {is_async = true}) future3 = c:call('change_schema', {'3'}, {is_async = true}) future1:wait_result() future2:wait_result() future3:wait_result() c:close() s:drop() box.space.test1:drop() box.space.test2:drop() box.space.test3:drop() box.schema.func.drop('change_schema') -- -- gh-2978: field names for tuples received from netbox. -- _ = box.schema.create_space("named", {format = {{name = "id"}, {name="abc"}}}) _ = box.space.named:create_index('id', {parts = {{1, 'unsigned'}}}) box.space.named:insert({1, 1}) box.schema.user.grant('guest', 'read, write, execute', 'space') cn = net.connect(box.cfg.listen) s = cn.space.named s:get{1}.id s:get{1}:tomap() s:insert{2,3}:tomap() s:replace{2,14}:tomap() s:update(1, {{'+', 2, 10}}):tomap() s:select()[1]:tomap() s:delete({2}):tomap() -- Check that formats changes after reload. box.space.named:format({{name = "id2"}, {name="abc2"}}) s:select()[1]:tomap() cn:reload_schema() s:select()[1]:tomap() cn:close() box.space.named:drop() box.schema.user.revoke('guest', 'read, write, execute', 'space') -- -- gh-3400: long-poll input discard must not touch event loop of -- a closed connection. -- function long() fiber.yield() return 100 end c = net.connect(box.cfg.listen) c:ping() -- Create batch of two requests. First request is sent to TX -- thread, second one terminates connection. The preceeding -- request discards input, and this operation must not trigger -- new attempts to read any data - the connection is closed -- already. -- f = fiber.create(c._transport.perform_request, nil, nil, false, 'call_17', nil, nil, nil, 'long', {}) c._transport.perform_request(nil, nil, false, 'inject', nil, nil, nil, '\x80') while f:status() ~= 'dead' do fiber.sleep(0.01) end c:close() -- -- gh-3464: iproto hangs in 100% CPU when too big packet size -- is received due to size_t overflow. -- c = net:connect(box.cfg.listen) data = msgpack.encode(18400000000000000000)..'aaaaaaa' c._transport.perform_request(nil, nil, false, 'inject', nil, nil, nil, data) c:close() test_run:grep_log('default', 'too big packet size in the header') ~= nil -- -- gh-3629: netbox leaks when a connection is closed deliberately -- and it has non-finished requests. -- ready = false ok = nil err = nil c = net:connect(box.cfg.listen) function do_long() while not ready do fiber.sleep(0.01) end end box.schema.func.create('do_long') box.schema.user.grant('guest', 'execute', 'function', 'do_long') f = fiber.create(function() ok, err = pcall(c.call, c, 'do_long') end) while f:status() ~= 'suspended' do fiber.sleep(0.01) end c:close() ready = true while not err do fiber.sleep(0.01) end ok, err -- -- gh-3856: wait_connected = false is ignored. -- c = net.connect('8.8.8.8:123456', {wait_connected = false}) c c:close() box.schema.func.drop('do_long') box.schema.user.revoke('guest', 'write', 'space', '_schema') box.schema.user.revoke('guest', 'read,write', 'space', '_space') box.schema.user.revoke('guest', 'create', 'space') -- -- gh-3958 updating box.cfg.readahead doesn't affect existing connections. -- readahead = box.cfg.readahead box.cfg{readahead = 128} s = box.schema.space.create("test") _ = s:create_index("pk") box.schema.user.grant("guest", "read,write", "space", "test") -- connection is created with small readahead value, -- make sure it is updated if box.cfg.readahead is changed. c = net.connect(box.cfg.listen) box.cfg{readahead = 100 * 1024} box.error.injection.set("ERRINJ_WAL_DELAY", true) pad = string.rep('x', 8192) for i = 1, 5 do c.space.test:replace({i, pad}, {is_async = true}) end box.error.injection.set("ERRINJ_WAL_DELAY", false) test_run:wait_log('default', 'readahead limit is reached', 1024, 0.1) s:drop() box.cfg{readahead = readahead} -- -- related to gh-4040: log corrupted rows -- log_level = box.cfg.log_level box.cfg{log_level=6} sock = socket.tcp_connect(LISTEN.host, LISTEN.service) sock:read(9) -- we need to have a packet with correctly encoded length, -- so that it bypasses iproto length check, but cannot be -- decoded in xrow_header_decode -- 0x3C = 60, sha1 digest is 20 bytes long data = string.fromhex('3C'..string.rep(require('digest').sha1_hex('bcde'), 3)) sock:write(data) sock:close() -- gh-1148: test stacked diagnostics. -- test_run:cmd("setopt delimiter ';'") stack_err = function() local e1 = box.error.new({code = 111, reason = "e1"}) local e2 = box.error.new({code = 111, reason = "e2"}) local e3 = box.error.new({code = 111, reason = "e3"}) assert(e1 ~= nil) e2:set_prev(e1) assert(e2.prev == e1) e3:set_prev(e2) box.error(e3) end; test_run:cmd("setopt delimiter ''"); box.schema.user.grant('guest', 'read,write,execute', 'universe') c = net.connect(box.cfg.listen) f = function(...) return c:call(...) end r, e3 = pcall(f, 'stack_err') assert(r == false) e3 e2 = e3.prev assert(e2 ~= nil) e2 e1 = e2.prev assert(e1 ~= nil) e1 assert(e1.prev == nil) box.schema.user.revoke('guest', 'read,write,execute', 'universe') test_run:wait_log('default', 'Got a corrupted row.*', nil, 10) test_run:wait_log('default', '00000000:.*', nil, 10) test_run:wait_log('default', '00000010:.*', nil, 10) test_run:wait_log('default', '00000020:.*', nil, 10) test_run:wait_log('default', '00000030:.*', nil, 10) -- we expect nothing below, so don't wait test_run:grep_log('default', '00000040:.*') box.cfg{log_level=log_level}
local feedbackWindow local textEdit local okButton local cancelButton local postId = 0 local tries = 0 local replyEvent = nil function init() feedbackWindow = g_ui.displayUI('feedback') feedbackWindow:hide() textEdit = feedbackWindow:getChildById('text') okButton = feedbackWindow:getChildById('okButton') cancelButton = feedbackWindow:getChildById('cancelButton') okButton.onClick = send cancelButton.onClick = hide feedbackWindow.onEscape = hide end function terminate() feedbackWindow:destroy() removeEvent(replyEvent) end function show() if not Services or not Services.feedback or Services.feedback:len() < 4 then return end feedbackWindow:show() feedbackWindow:raise() feedbackWindow:focus() textEdit:setMaxLength(8192) textEdit:setText('') textEdit:setEditable(true) textEdit:setCursorVisible(true) feedbackWindow:focusChild(textEdit, KeyboardFocusReason) tries = 0 end function hide() feedbackWindow:hide() textEdit:setEditable(false) textEdit:setCursorVisible(false) end function send() local text = textEdit:getText() if text:len() > 1 then local localPlayer = g_game.getLocalPlayer() local playerData = nil if localPlayer ~= nil then playerData = { name = localPlayer:getName(), position = localPlayer:getPosition() } end local details = { report_delay = sendInterval, os = g_app.getOs(), graphics_vendor = g_graphics.getVendor(), graphics_renderer = g_graphics.getRenderer(), graphics_version = g_graphics.getVersion(), fps = g_app.getFps(), maxFps = g_app.getMaxFps(), atlas = g_atlas.getStats(), classic = tostring(g_settings.getBoolean("classicView")), fullscreen = tostring(g_window.isFullscreen()), vsync = tostring(g_settings.getBoolean("vsync")), window_width = g_window.getWidth(), window_height = g_window.getHeight(), player_name = g_game.getCharacterName(), world_name = g_game.getWorldName(), otserv_host = G.host, otserv_protocol = g_game.getProtocolVersion(), otserv_client = g_game.getClientVersion(), build_version = g_app.getVersion(), build_revision = g_app.getBuildRevision(), build_commit = g_app.getBuildCommit(), build_date = g_app.getBuildDate(), display_width = g_window.getDisplayWidth(), display_height = g_window.getDisplayHeight(), cpu = g_platform.getCPUName(), mem = g_platform.getTotalSystemMemory(), os_name = g_platform.getOSName() } local data = json.encode({ text = text, version = g_app.getVersion(), host = g_settings.get('host'), player = playerData, details = details }) postId = HTTP.post(Services.feedback, data, function(ret, err) if err then tries = tries + 1 if tries < 3 then replyEvent = scheduleEvent(send, 1000) end end end) end hide() end