content
stringlengths 5
1.05M
|
|---|
local unicode = require("unicode")
local shell = require("shell")
local args, options = shell.parse(...)
local bytes = 0
local chars = 0
local words = 0
local lines = 0
local word = false
while true do
local data = io.read(1)
if not data then break end
if io.input().remaining() > 0 then
data = data .. io.read(io.input().remaining())
end
bytes = bytes + #data
chars = chars + unicode.len(data)
for char in data:gmatch(".") do
if char == "\n" then
lines = lines + 1
end
if data:match("%s") and word then
word = false
words = words + 1
else
word = true
end
end
end
if options.c or options.bytes then
print(bytes)
elseif options.m or options.chars then
print(chars)
elseif options.l or options.lines then
print(lines)
else
print(words)
end
|
#!/usr/bin/env lua
local exec = require "tek.lib.exec"
local PI = math.pi
local PI2 = PI*2
local SIN = math.sin
local s1 = 0
local s2 = 0
local x1 = 0
local x2 = 0
while true do
local n = 256
x1 = s1
x2 = s2
for cx = 0, n-1 do
local y = ((x1 % 2) - 1 + SIN(x2) * 0.5) / 4 + 0.5
y = y * 0x10000
io.stdout:write(("%.0f "):format(y))
x1 = x1 + 0.08
x2 = x2 + 0.33
end
io.stdout:write("\n")
s1 = s1 + 0.047
s2 = s2 + 0.133
if s2 > PI2 then
s2 = s2 - PI2
end
-- wait given number of milliseconds:
exec.sleep(10)
end
|
Class = require 'hump.class'
require 'entities/powerup'
require 'bigballmode'
local BIGBALLPOWERUP_IMG = love.graphics.newImage("resources/graphics/bigballpowerup.png")
local BIGBALLPOWERUP_QUAD = love.graphics.newQuad(0, 0, 32, 32, 32, 32)
BigBallPowerUp = Class{
__includes = PowerUp,
init = function(self, x, y, level)
PowerUp.init(self, x, y, level, 20, 16)
self.mode = BigBallMode()
end;
draw = function(self)
love.graphics.draw(BIGBALLPOWERUP_IMG, BIGBALLPOWERUP_QUAD, self.x, self.y, self.angle, 1, 1, 16, 16)
end;
}
|
slot0 = class("GuessForkGameView", import("..BaseMiniGameView"))
slot1 = {
100,
50
}
slot2 = {
10
}
slot3 = {
20
}
slot4 = {
3,
3,
3,
4,
4,
4,
5,
5,
5,
6,
6,
6,
7,
7,
7,
8,
8,
8,
8,
9,
9,
9,
9,
9,
10,
10,
10,
10,
10,
10,
11,
11,
11,
11,
11,
12
}
slot5 = {
1000,
200
}
slot6 = 10000
slot7 = 2
slot8 = 2
slot9 = "event:/ui/ddldaoshu2"
slot10 = "event:/ui/taosheng"
slot11 = "event:/ui/zhengque"
slot12 = "event:/ui/shibai"
slot13 = "backyard"
slot14 = {
"Cup_B",
"Cup_G",
"Cup_P",
"Cup_R",
"Cup_Y"
}
slot15 = 3
slot16 = 0.5
slot17 = "Thinking_Loop"
slot18 = {
"Select_L",
"Select_M",
"Select_R"
}
slot19 = {
"Correct_L",
"Correct_M",
"Correct_R"
}
slot20 = {
"Incorrect_L",
"Incorrect_M",
"Incorrect_R"
}
slot21 = "Manjuu_Correct"
slot22 = {
"Ayanami",
"Cheshire",
"Eldridge",
"Formidable",
"Javelin",
"Laffey",
"LeMalin",
"Merkuria",
"PingHai",
"Roon",
"Saratoga",
"Shiratsuyu",
"Yukikaze",
"Z23"
}
slot0.getUIName = function (slot0)
return "GuessForkGameUI"
end
slot0.getBGM = function (slot0)
return slot0
end
slot0.init = function (slot0)
slot0.countUI = slot0:findTF("count_ui")
slot0.countAnimator = slot0:findTF("count_bg/count", slot0.countUI):GetComponent(typeof(Animator))
slot0.countDft = slot0:findTF("count_bg/count", slot0.countUI):GetComponent(typeof(DftAniEvent))
slot0.countDft:SetEndEvent(function ()
setActive(slot0.countUI, false)
setActive:startGame()
end)
slot0.pauseUI = slot0.findTF(slot0, "pause_ui")
slot0.resuemBtn = slot0:findTF("box/sure_btn", slot0.pauseUI)
setText(slot0:findTF("box/content", slot0.pauseUI), i18n("idolmaster_game_tip1"))
slot0.exitUI = slot0:findTF("exit_ui")
slot0.exitSureBtn = slot0:findTF("box/sure_btn", slot0.exitUI)
slot0.exitCancelBtn = slot0:findTF("box/cancel_btn", slot0.exitUI)
setText(slot0:findTF("box/content", slot0.exitUI), i18n("idolmaster_game_tip2"))
slot0.endUI = slot0:findTF("end_ui")
slot0.endSureBtn = slot0:findTF("box/sure_btn", slot0.endUI)
setText(slot0:findTF("box/cur_score", slot0.endUI), i18n("idolmaster_game_tip3"))
slot0.endScoreTxt = slot0:findTF("box/cur_score/score", slot0.endUI)
slot0.newTag = slot0:findTF("new", slot0.endScoreTxt)
setText(slot0:findTF("box/highest_score", slot0.endUI), i18n("idolmaster_game_tip4"))
slot0.highestScoreTxt = slot0:findTF("box/highest_score/score", slot0.endUI)
slot0.gameUI = slot0:findTF("game_ui")
slot0.returnBtn = slot0:findTF("top/return_btn", slot0.gameUI)
slot0.pauseBtn = slot0:findTF("top/pause_btn", slot0.gameUI)
slot0.roundTxt = slot0:findTF("top/title/round/num", slot0.gameUI)
slot0.roundNum = 0
slot0.curScoreTxt = slot0:findTF("top/title/score_title/score", slot0.gameUI)
slot0.curScore = 0
setText(slot0.curScoreTxt, slot0.curScore)
slot0.curTimeTxt = slot0:findTF("top/time_bg/time", slot0.gameUI)
slot0.curTime = 0
setText(slot0:findTF("top/title/score_title", slot0.gameUI), i18n("idolmaster_game_tip5"))
slot0.correctBar = slot0:findTF("correct_bar", slot0.gameUI)
slot0.failBar = slot0:findTF("fail_bar", slot0.gameUI)
slot0.manjuu = slot0:findTF("play/manjuu", slot0.gameUI)
slot0.manjuuAnimator = slot0.manjuu:GetComponent(typeof(Animator))
slot0.manjuuDft = slot0.manjuu:GetComponent(typeof(DftAniEvent))
slot0.result = slot0:findTF("result", slot0.gameUI)
slot0.resultAnimator = slot0.result:GetComponent(typeof(Animator))
slot0.resultDft = slot0.result:GetComponent(typeof(DftAniEvent))
slot0.scoreAni = slot0:findTF("score", slot0.gameUI)
slot0.cupContainer = slot0:findTF("cup_container", slot0.gameUI)
slot0.fork = slot0:findTF("fork", slot0.gameUI)
slot0.isGuessTime = false
end
slot0.didEnter = function (slot0)
onButton(slot0, slot0.pauseBtn, function ()
setActive(slot0.pauseUI, true)
setActive:pauseGame()
end, SFX_PANEL)
onButton(slot0, slot0.resuemBtn, function ()
setActive(slot0.pauseUI, false)
setActive:resumeGame()
end, SFX_PANEL)
onButton(slot0, slot0.returnBtn, function ()
setActive(slot0.exitUI, true)
setActive:pauseGame()
end, SFX_PANEL)
onButton(slot0, slot0.exitSureBtn, function ()
setActive(slot0.exitUI, false)
setActive:enterResultUI()
end, SFX_PANEL)
onButton(slot0, slot0.exitCancelBtn, function ()
setActive(slot0.exitUI, false)
setActive:resumeGame()
end, SFX_PANEL)
onButton(slot0, slot0.endSureBtn, function ()
slot0:emit(slot1.ON_BACK)
end, SFX_PANEL)
eachChild(slot0.cupContainer, function (slot0)
onButton(slot0, slot0, function ()
if not slot0.isGuessTime then
return
end
setActive(slot0:findTF("select", slot0.findTF), true)
setActive.isGuessTime = false
slot0 = string.gsub(false.name, "cup_", "")
slot0.selectIndex = tonumber(slot0)
slot0:endRound(slot0.selectIndex == slot0.forkIndex)
end, SFX_PANEL)
end)
slot0.initGameData(slot0)
setActive(slot0.countUI, true)
slot0.countAnimator:Play("countDown")
pg.CriMgr.GetInstance():PlaySoundEffect_V3(pg.CriMgr.GetInstance().PlaySoundEffect_V3)
end
slot0.initGameData = function (slot0)
eachChild(slot0.cupContainer, function (slot0)
GetSpriteFromAtlasAsync("ui/minigameui/guessforkgameui", slot0, function (slot0)
setImageSprite(slot0:findTF("front", setImageSprite), slot0, true)
end)
end)
slot0.forkIndex = math.random(slot1)
slot0.selectIndex = nil
slot0.roundNum = slot0.roundNum + 1
setText(slot0.roundTxt, slot0.roundNum)
slot0.curTime = slot2[slot0.roundNum] or slot2[#slot2]
setText(slot0.curTimeTxt, slot0.curTime)
setActive(slot0.result, false)
end
slot0.startGame = function (slot0)
slot0.manjuuAnimator:Play(slot0)
slot1 = slot0.manjuuAnimator.Play[slot0.roundNum] or slot1[#slot1]
slot0:playForkAni(function ()
slot0:startSwap(slot0)
end)
slot0.gameStartFlag = true
end
slot0.playForkAni = function (slot0, slot1)
setParent(slot0.fork, slot0:findTF("fork_node", slot2), false)
setLocalScale(slot0.fork, Vector3.one)
setLocalPosition(slot0.fork, Vector3(0, 50, 0))
setActive(slot0.fork, true)
slot0:managedTween(LeanTween.delayedCall, function ()
slot0:managedTween(LeanTween.moveY, function ()
setActive(slot0.fork, false)
if slot0.fork then
slot1()
end
end, slot0.fork, -20, ).setEase(slot0, LeanTweenType.linear)
end, 0.5, nil)
end
slot0.startSwap = function (slot0, slot1)
if slot1 < 1 then
slot0.isGuessTime = true
slot0:startTimer()
return
end
table.remove(slot2, slot3)
slot0:swapCup(slot0:findTF("cup_" .. ({
1,
2,
3
})[1], slot0.cupContainer), slot0:findTF("cup_" .. ()[2], slot0.cupContainer), function ()
slot0:startSwap(slot1 - 1)
end)
end
slot0.swapCup = function (slot0, slot1, slot2, slot3)
pg.CriMgr.GetInstance():PlaySoundEffect_V3(slot0)
slot0:managedTween(LeanTween.moveX, nil, slot1, slot2.anchoredPosition.x, slot8):setEase(LeanTweenType.linear)
slot0:managedTween(LeanTween.moveX, function ()
if slot0 then
slot0()
end
end, slot2, slot1.anchoredPosition.x, math.abs(slot2.anchoredPosition.x - slot1.anchoredPosition.x) / ((slot1[1] + (slot0.roundNum - 1) * slot1[2] < slot2 and slot4) or slot2)):setEase(LeanTweenType.linear)
end
slot0.startTimer = function (slot0)
slot1 = slot0.curTime
slot0.timer = Timer.New(function ()
slot0.curTime = slot0.curTime - 1
if slot0.curTime <= 0 then
slot0:endRound(false)
end
setText(slot0.curTimeTxt, slot0.curTime)
end, 1, -1)
slot0.timer.Start(slot2)
end
slot0.stopTimer = function (slot0)
if slot0.timer then
slot0.timer:Stop()
slot0.timer = nil
end
end
slot0.pauseGame = function (slot0)
slot0:pauseManagedTween()
if slot0.timer then
slot0.timer:Pause()
end
slot0.manjuuAnimator.speed = 0
slot0.resultAnimator.speed = 0
end
slot0.resumeGame = function (slot0)
slot0:resumeManagedTween()
if slot0.timer then
slot0.timer:Resume()
end
slot0.manjuuAnimator.speed = 1
slot0.resultAnimator.speed = 1
end
slot0.endRound = function (slot0, slot1)
slot0:stopTimer()
if slot0.selectIndex then
slot0:playManjuuAni(slot1)
else
slot0:playTimeOutAni()
slot0:endGame()
end
end
slot0.playManjuuAni = function (slot0, slot1)
slot0.manjuuAnimator:Play(slot0[(slot0:findTF("cup_" .. slot0.selectIndex, slot0.cupContainer).anchoredPosition.x + 480) / 480 + 1])
slot0.manjuuDft:SetEndEvent(function ()
slot0.manjuuDft:SetEndEvent(nil)
setActive((slot0.manjuuDft and slot2[slot3]) or slot4[slot3]:findTF("select", slot5), false)
(slot0.manjuuDft and slot2[slot3]) or slot4[slot3].manjuuAnimator:Play((slot0.manjuuDft and slot2[slot3]) or slot4[slot3])
(slot0.manjuuDft and slot2[slot3]) or slot4[slot3]:playResultAni((slot0.manjuuDft and slot2[slot3]) or slot4[slot3].playResultAni)
end)
end
slot0.playResultAni = function (slot0, slot1)
setParent(slot0.result, slot0:findTF("result_node", slot0:findTF("cup_" .. slot0.selectIndex, slot0.cupContainer)), false)
setLocalScale(slot0.result, Vector3.one)
setLocalPosition(slot0.result, Vector3.zero)
setActive(slot0.result, true)
if slot1 then
pg.CriMgr.GetInstance():PlaySoundEffect_V3(slot0)
slot0.resultAnimator:Play(slot1)
slot0.resultDft:SetEndEvent(function ()
slot0.resultDft:SetEndEvent(nil)
slot0.resultDft.SetEndEvent:showCorrectBar()
end)
else
pg.CriMgr.GetInstance().PlaySoundEffect_V3(slot3, slot2)
slot0.resultAnimator:Play(slot3)
slot0.resultDft:SetEndEvent(function ()
slot0.resultDft:SetEndEvent(nil)
slot0.resultDft.SetEndEvent:endGame()
end)
end
end
slot0.showCorrectBar = function (slot0)
setActive(slot0.correctBar, true)
slot0.curScore = slot0.curScore + slot0[1] + (slot0.roundNum - 1) * slot0[2]
setText(slot0.curScoreTxt, slot0.curScore)
setLocalPosition(slot0.scoreAni, Vector3(0, 250, 0))
setText(slot0.scoreAni, "+" .. slot1)
setActive(slot0.scoreAni, true)
LeanTween.moveY(slot0.scoreAni, 300, 1):setOnComplete(System.Action(function ()
setActive(slot0.scoreAni, false)
end))
slot4 = slot0.curScore + (slot1[slot0.roundNum] or slot1[#slot1]) * slot0.curTime
LeanTween.value(go(slot0.curScoreTxt), slot0.curScore, slot4, 0.5):setOnUpdate(System.Action_float(function (slot0)
setText(slot0.curScoreTxt, math.ceil(slot0))
end)).setOnComplete(slot5, System.Action(function ()
slot0.curScore = slot1
setText(slot0.curScoreTxt, slot0.curScore)
end))
LeanTween.value(go(slot0.curTimeTxt), slot0.curTime, 0, slot2):setOnUpdate(System.Action_float(function (slot0)
setText(slot0.curTimeTxt, math.ceil(slot0))
end)).setOnComplete(slot5, System.Action(function ()
slot0.curScore = slot1
setText(slot0.curTimeTxt, 0)
end))
onButton(slot0, slot0.correctBar, function ()
setActive(slot0.correctBar, false)
setActive(slot0.scoreAni, false)
setActive:initGameData()
setActive.initGameData:startGame()
end, SFX_PANEL)
slot0.managedTween(slot0, LeanTween.delayedCall, function ()
if isActive(slot0.correctBar) then
triggerButton(slot0.correctBar)
end
end, 0.5, nil)
end
slot0.playTimeOutAni = function (slot0)
setParent(slot0.result, slot0:findTF("result_node", slot0:findTF("cup_" .. slot0.forkIndex, slot0.cupContainer)), false)
setLocalScale(slot0.result, Vector3.one)
setLocalPosition(slot0.result, Vector3.zero)
setActive(slot0.result, true)
slot0.resultAnimator:Play(slot0)
slot0.resultDft:SetEndEvent(function ()
slot0.resultDft:SetEndEvent(nil)
end)
end
slot0.endGame = function (slot0)
setActive(slot0.failBar, true)
onButton(slot0, slot0.failBar, function ()
setActive(slot0.failBar, false)
setActive:enterResultUI()
end, SFX_PANEL)
slot0.managedTween(slot0, LeanTween.delayedCall, function ()
if isActive(slot0.failBar) then
triggerButton(slot0.failBar)
end
end, slot0, nil)
end
slot0.enterResultUI = function (slot0)
slot0.gameStartFlag = false
setActive(slot0.endUI, true)
setText(slot0.endScoreTxt, slot0.curScore)
setActive(slot0.newTag, ((slot0:GetMGData():GetRuntimeData("elements") and #slot1 > 0 and slot1[1]) or 0) < slot0.curScore)
if slot2 <= slot0.curScore then
slot0:StoreDataToServer({
slot0.curScore
})
end
setText(slot0.highestScoreTxt, slot2)
if slot0:GetMGHubData().count > 0 then
slot0:SendSuccess(0)
end
end
slot0.OnGetAwardDone = function (slot0, slot1)
if slot1.cmd == MiniGameOPCommand.CMD_COMPLETE and slot0:GetMGHubData().ultimate == 0 and slot2:getConfig("reward_need") <= slot2.usedtime then
pg.m02:sendNotification(GAME.SEND_MINI_GAME_OP, {
hubid = slot2.id,
cmd = MiniGameOPCommand.CMD_ULTIMATE,
args1 = {}
})
end
end
slot0.onBackPressed = function (slot0)
if not slot0.gameStartFlag then
slot0:emit(slot0.ON_BACK_PRESSED)
else
setActive(slot0.exitUI, true)
slot0:pauseGame()
end
end
return slot0
|
--[[ MIT License
Copyright (c) 2021 Christophe MICHEL
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]
local ADDON, _ = ...
local L = LibStub("AceLocale-3.0"):NewLocale(ADDON, "frFR", false)
if not L then return end
-- UI elements
L["TAB_TITLE"] = "Formes d’âme"
L["COUNT_LABEL"] = "Total"
L["UNTRACKABLE_TOOLTIP_TITLE"] = "Cette forme d’âme ne peut pas être détectée automatiquement"
L["UNTRACKABLE_TOOLTIP_CLICK_ME"] = "Cliquez pour marquer %s comme débloquée si vous l'avez déjà."
L["WARNING_NOT_NIGHT_FAE"] = "Vous n'êtes pas membre des Faë nocturnes, vous ne pouvez pas\ncollecter de nouvelle forme d’âme actuellement."
L["Available since"] = "Disponible depuis la"
-- Labels
L["Loot"] = "Butin"
L["Quest"] = "Quête"
L["Campaign"] = "Campagne"
L["World Event"] = "Événement mondial"
L["World Quest"] = "Expédition"
L["NPC"] = "PNJ"
L["Region"] = "Région"
L["Cost"] = "Coût"
L["Faction"] = true
L["Profession"] = "Métier"
L["Covenant Feature"] = "Fonctionnalité de la congrégation"
L["Difficulty"] = "Difficulté"
L["Coordinates"] = "Coordonnées"
L["Renown"] = "Renom"
L["Spell"] = "Sort"
L["Vendor"] = "Vendeur"
-- Zone Names
L["Shadowlands"] = "Ombreterre"
L["Ardenweald"] = "Sylvarden"
L["Bastion"] = "Le Bastion"
L["Revendreth"] = true
L["Maldraxxus"] = true
L["Oribos"] = true
L["The Maw"] = "Antre"
L["Torghast"] = "Tourment"
L["The Adamant Vaults"] = "Caveaux Impitoyables"
L["Korthia"] = true
L["De Other Side"] = "L’Autre côté"
L["Mists of Tirna Scithe"] = "Brumes de Tirna Scithe"
L["Tazavesh, the Veiled Market"] = "Tazavesh, le marché voilé"
L["Castle Nathria"] = "Château Nathria"
L["Sanctum of Domination"] = "Sanctum de Domination"
-- Quest and Campaign Names (could be translated automatically through the API?)
L["Drust and Ashes"] = "De Drust et de cendres"
L["Mending a Broken Hart"] = "Soulager un cœur brisé"
L["The Power of Elune"] = "Le pouvoir d’Élune"
L["Night Warrior's Curse"] = "La malédiction de la guerrière de la Nuit"
L["The Power of Night"] = "Le pouvoir de la nuit"
-- Item Names (could be translated automatically through the API?)
L["Bounty of the Grove Wardens"] = "Butin des gardiens du Bosquet"
L["Queen's Conservatory Cache"] = "Cache du jardin d’hiver de la Reine"
L["War Chest of the Wild Hunt"] = "Trésor de guerre de l’Hallali"
L["Wild Hunt Supplies"] = "Fournitures de l’Hallali"
L["Synvir Lockbox"] = "Coffret en vicevyr"
L["Stygian Lockbox"] = "Coffret stygien"
L["Riftbound Cache"] = "Cache liée à la faille"
L["Wildseed Root Grain"] = "Grain de racine sauvage"
L["Repaired Riftkey"] = "Clé de faille réparée"
-- NPC Names (could be translated automatically through the API?)
L["Lost Soul"] = "Âme égarée"
L["Ma'oh"] = "Ma’oh"
L["Sparkle"] = "Sparkel"
L["Aithlyn"] = true
L["Liawyn"] = true
L["The Grand Menagerie"] = "Grandiose Ménagerie"
L["Master Clerk Salorn"] = "Ouvreur en chef Salorn"
L["Lady Sylvanas Windrunner"] = "Dame Sylvanas Coursevent"
L["Mueh'Zala"] = true
L["Mistcaller"] = "Mandebrume"
L["Cortinarius"] = true
L["Sire Denathrius"] = true
L["Skuld Vit"] = true
L["So'leah"] = true
L["Valfir the Unrelenting"] = "Valfir le Tenace"
L["Spindlenose"] = "Fusenez"
L["Shopkeeper"] = "Commerçant"
L["Mystic Rainbowhorn"] = "Mystique Arc-en-Corne"
-- Others
L["Burning Crusade Timewalking"] = "Marcheurs du temps de Burning Crusade"
L["Wrath of the Lich King Timewalking"] = "Marcheurs du temps de Wrath of the Lich King"
L["Cataclysm Timewalking"] = "Marcheurs du temps de Cataclysm"
L["Mists of Pandaria Timewalking"] = "Marcheurs du temps de Mists of Pandaria"
L["Warlords of Draenor Timewalking"] = "Marcheurs du temps de Warlords of Draenor"
L["Legion Timewalking"] = "Marcheurs du temps de Legion"
L["Pet Battle"] = "Combat de mascottes"
L["Shadowlands World Bosses"] = "Boss hors instance de l'Ombreterre"
L["Queen's Conservatory"] = "Jardin d’hiver de la Reine"
L["Mythic+ dungeons"] = "Donjons mythiques +"
L["Night Fae dailies"] = "Quêtes quotidiennes des Faë nocturnes"
L["Mushroom Network"] = "Réseau de champignons"
L["Marasmius"] = true
L["Paragon reward."] = "Récompense de parangon."
L["Soulshape"] = "Forme d’âme"
L["Crittershape"] = "Forme de bestiole"
L["Pilgrim's Bounty"] = "Les Bienfaits du pèlerin"
L["Covenant Callings reward chests"] = "Coffres de récompense d'appels de congrégation"
L["Normal"] = true
L["Heroic"] = "Héroïque"
L["Mythic"] = "Mythique"
L["Hardmode"] = true
L["Any"] = "Toutes"
-- Database
L["Alpaca Soul"] = "Âme d’alpaga"
L["Ardenmoth Soul"] = "Âme de phalarden"
L["Boar Soul"] = "Âme de sanglier"
L["Boar Soul Guide"] = "Peut-être obtenu sur le dernier boss de n’importe quel donjon des Marcheurs du temps de Warlords of Draenor."
L["Bunny Soul"] = "Âme de lapin"
L["Bunny Soul Guide"] = "Récompense occasionnelle des expéditions de combat de mascottes."
L["Cat Soul"] = "Âme de chat"
L["Cat Soul Guide"] = "Une âme de chat peut apparaître au sommet d'un des plus hauts arbres de Sylvarden (Palun Chanterêve, Bassin Tombe-Lueur, Tirna Vaal, Creux Hibernal ou Bord-de-Griffe). Utilisez /apaise sur lui pour obtenir la forme d'âme."
L["Cat Soul (Well Fed)"] = "Âme de chat (bien nourri)"
L["Cat Soul (Well Fed) Guide"] = "Disponible après avoir débloqué l'âme de chat. Récupérez d'abord les Céréales spectrales, puis revenez au Cœur de la forêt, Ma'oh est une âme de chat qui dort dans un panier près de l'entrée du Jardin d'hiver de la Reine." .. "|n" .. "Faites-lui /miaou (il vous dira qu'il a faim) puis donnez-lui les Céréales spectrales. Vous recevez directement la forme d'âme (pas de quête à rendre)."
L["Chicken Soul"] = "Âme de poulet"
L["Chicken Soul Guide"] = "Récupérez d'abord les Céréales spectrales, puis faites /poulet à l'âme de poulet et donnez-lui les Céréales spectrales."
L["Cloud Serpent Soul"] = "Âme de serpent-nuage"
L["Cloud Serpent Soul Guide"] = "Peut-être obtenu sur le dernier boss de n’importe quel donjon des Marcheurs du temps de Mists of Pandaria."
L["Cobra Soul"] = "Âme de cobra"
L["Cobra Soul Guide"] = "Récompense occasionnelle après une victoire en Arène ou Champ de bataille coté."
L["Corgi Soul"] = "Âme de corgi"
L["Corgi Soul Guide"] = "Sparkel est une âme de corgi qui tourne dans le Cœur de la forêt. Faites-lui /cajoler et vous recevez directement la forme d'âme (pas de quête à rendre)."
L["Crane Soul"] = "Âme de grue"
L["Cricket Soul"] = "Âme de criquet"
L["Direhorn Soul"] = "Âme de navrecorne"
L["Eagle Soul"] = "Âme d’aigle"
L["Equine Soul"] = "Âme d’étalon"
L["Frog Soul"] = "Âme de grenouille"
L["Frog Soul Guide"] = "Disponible dans n'importe quelle zone de congrégation."
L["Goat Soul"] = "Âme de chèvre"
L["Goat Soul Guide"] = "Obtenable dans les coffres de n'importe quel Appel de congrégation, pas uniquement des Faë nocturnes."
L["Gryphon Soul"] = "Âme de griffon"
L["Gryphon Soul Guide"] = "Récompense occasionnelle après une victoire en Escarmouche, Arène, Champ de bataille aléatoire ou Champ de bataille coté."
L["Gulper Soul"] = "Âme de gobeur"
L["Gulper Soul Guide"] = "Obtenable avec des esprits de n'importe quelle qualité, mais n'utilisez qu'un seul %s."
L["Hippo Soul"] = "Âme de potamodonte"
L["Hippo Soul Guide"] = "Récompense de l'assaut des Faë nocturnes."
L["Hippogryph Soul"] = "Âme d’hippogriffe"
L["Hyena Soul"] = "Âme de hyène"
L["Hyena Soul Guide"] = "Peut s'obtenir à n'importe quel niveau de clé."
L["Jormungar Soul"] = "Âme de jormungar"
L["Jormungar Soul Guide"] = "Peut-être obtenu sur le dernier boss de n’importe quel donjon des Marcheurs du temps de Wrath of the Lich King."
L["Kodo Soul"] = "Âme de kodo"
L["Kodo Soul Guide"] = "Peut-être obtenu sur le dernier boss de n’importe quel donjon des Marcheurs du temps de Cataclysm."
L["Leonine Soul"] = "Âme de lion"
L["Lupine Soul"] = "Âme de loup"
L["Mammoth Soul"] = "Âme de mammouth"
L["Moose Soul"] = "Âme d’élan"
L["Moose Soul Guide"] = "Vous devez avoir battu 5 des 7 différents boss rares des représentations de l'amphitéatre."
L["Otter Soul"] = "Âme de loutre"
L["Otter Soul Guide"] = "Une âme de loutre peut apparaître dans le lac sous le Repos du Héros (60 minutes de respawn).\nFaites-lui /serrer pour recevoir l'objet de quête de la forme d'âme."
L["Owl Soul"] = "Âme de chouette"
L["Owl Soul Guide"] = "Peut-être obtenu sur le dernier boss de n’importe quel donjon des Marcheurs du temps de Legion."
L["Owlcat Soul"] = "Âme de fauve-huant"
L["Porcupine Soul"] = "Âme de porc-épic"
L["Prairie Dog Soul"] = "Âme de chien de prairie"
L["Ram Soul"] = "Âme de bélier"
L["Raptor Soul"] = "Âme de raptor"
L["Rat Soul"] = "Âme de rat"
L["Rat Soul Guide"] = "Quand il vous aborde, répondez avec /oui ou /hoche pour accéder à ses marchandises."
L["Runestag Soul"] = "Âme de cerf runique"
L["Runestag Soul Guide"] = "Apparaît au nord-est de Sylvarden."
L["Saurid Soul"] = "Âme de sauride"
L["Saurid Soul Guide"] = "A l'intérieur d'une grotte. Ciblez la pile de débris et faites /incliner."
L["Saurolisk Soul"] = "Âme de saurolisque"
L["Saurolisk Hatchling Soul"] = "Âme de bébé saurolisque"
L["Shadowstalker Soul"] = "Âme de traqueur des ombres"
L["Shoveltusk Soul"] = "Âme de brochepelle"
L["Shoveltusk Soul Guide"] = "Récompense occasionnelle après une victoire dans n'importe quel Choc JcJ."
L["Shrieker Soul"] = "Âme de hurleur"
L["Snake Soul"] = "Âme de serpent"
L["Snapper Soul"] = "Âme de mordeuse"
L["Spider Soul"] = "Âme d’araignée"
L["Spider Soul Guide"] = "Entrez dans un portail de faille avec une %s. Il y a 4 caches qui apparaissent chaque jour à des emplacements aléatoires."
L["Sporebat Soul"] = "Âme de sporoptère"
L["Sporebat Soul Guide"] = "Peut-être obtenu sur le dernier boss de n’importe quel donjon des Marcheurs du temps de Burning Crusade."
L["Squirrel Soul"] = "Âme d’écureuil"
L["Squirrel Soul Guide"] = "La première forme de bestiole de votre collection, offerte par Choufa !"
L["Stag Soul"] = "Âme de cerf"
L["Stag Soul Guide"] = "Peut-être aléatoirement offert en récompense de n'importe quelle quête journalière des Faë nocturnes à Korthia."
L["Tiger Soul"] = "Âme de tigre"
L["Turkey Soul"] = "Âme de dinde"
L["Turkey Soul Guide"] = "Allez dans une capitale et trouvez une table des Bienfaits du pèlerin.\nMangez de chaque nourriture jusqu'à avoir les 5 buffs différents, puis continuer à manger et changer de siège à chaque fois. jusqu'à obtenir la forme d'âme."
L["Ursine Soul"] = "Âme d’ours"
L["Veilwing Soul"] = "Âme d’aile-voilée"
L["Vulpine Soul"] = "Âme de vulpin"
L["Vulpine Soul Guide"] = "La toute première forme d'âme de votre collection !"
L["Wolfhawk Soul"] = "Âme de loup-faucon"
L["Wolfhawk Soul Guide"] = "Vous devez utiliser votre forme d'âme pour traverser la barrière."
L["Wyvern Soul"] = "Âme de wyverne"
L["Yak Soul"] = "Âme de yack"
|
local Util = {}
function Util.lerp(a, b, amount)
return a + (b - a) * amount
end
function Util.gridToScreen(x, y)
local sx = (x - 1) * 64
local sy = (y - 1) * 64
return sx, sy, 64, 64
end
function Util.gridToScreenTile(x, y)
local sx = (x - 1) * 64 + 4
local sy = (y - 1) * 64 + 4
return sx, sy, 56, 56
end
return Util
|
-- @Author: detailyang
-- @Date: 2016-10-10 15:45:33
-- @Last Modified by: detailyang
-- @Last Modified time: 2017-02-19 13:29:41
-- https://www.w3.org/TR/cors/
local re_match = ngx.re.match
local _M = { _VERSION = '0.2.1.5'}
local Origin = 'Origin'
local AccessControlAllowOrigin = 'Access-Control-Allow-Origin'
local AccessControlExposeHeaders = 'Access-Control-Expose-Headers'
local AccessControlMaxAge = 'Access-Control-Max-Age'
local AccessControlAllowCredentials = 'Access-Control-Allow-Credentials'
local AccessControlAllowMethods = 'Access-Control-Allow-Methods'
local AccessControlAllowHeaders = 'Access-Control-Allow-Headers'
local mt = { __index = _M }
local allow_hosts = {}
local allow_headers = {}
local allow_methods = {}
local expose_headers = {}
local max_age = 3600
local allow_credentials = true
local join = table.concat
function _M.allow_host(host)
if allow_hosts[host] == nil then
allow_hosts[host] = host
allow_hosts[#allow_hosts + 1] = host
end
end
function _M.allow_method(method)
if allow_methods[method] == nil then
allow_methods[method] = method
allow_methods[#allow_methods + 1] = method
end
end
function _M.allow_header(header)
if allow_headers[header] == nil then
allow_headers[header] = header
allow_headers[#allow_headers + 1] = header
end
end
function _M.expose_header(header)
if expose_headers[header] == nil then
expose_headers[header] = header
expose_headers[#expose_headers + 1] = header
end
end
function _M.max_age(age)
max_age = age
end
function _M.allow_credentials(credentials)
allow_credentials = credentials
end
function _M.run()
local origin = ngx.req.get_headers()[Origin]
if not origin then
return
end
local matched = false
for k, v in pairs(allow_hosts) do
local from, to, err = ngx.re.find(origin, v, "jo")
if from then
matched = true
break
end
end
if matched == false then
return
end
ngx.header[AccessControlAllowOrigin] = origin
ngx.header[AccessControlMaxAge] = max_age
if #expose_headers >= 0 then
ngx.header[AccessControlExposeHeaders] = join(expose_headers, ',')
end
if #allow_headers >= 0 then
ngx.header[AccessControlAllowHeaders] = join(allow_headers, ',')
end
if #allow_methods >= 0 then
ngx.header[AccessControlAllowMethods] = join(allow_methods, ',')
end
if allow_credentials == true then
ngx.header[AccessControlAllowCredentials] = "true"
else
ngx.header[AccessControlAllowCredentials] = "false"
end
end
return _M
|
local u = require 'utilities'
require('lspsaga').init_lsp_saga()
-- lsp provider to find the cursor word definition and reference
u.map('n', 'gh', '<cmd>lua require(\'lspsaga.provider\').lsp_finder()<cr>', {noremap = true, silent = true})
-- code action
u.map('n', '<leader>ca', '<cmd>lua require(\'lspsaga.codeaction\').code_action()<cr>', {noremap = true, silent = true})
u.map('v', '<leader>ca', ':<C-U>lua require(\'lspsaga.codeaction\').range_code_action()<cr>', {noremap = true, silent = true})
-- show hover doc
u.map('n', 'K', '<cmd>lua require(\'lspsaga.hover\').render_hover_doc()<cr>', {noremap = true, silent = true})
-- scroll down hover doc or scroll in definition preview
u.map('n', '<C-f>', '<cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(1)<cr>', {noremap = true, silent = true})
-- scroll up hover doc
u.map('n', '<C-b>', '<cmd>lua require(\'lspsaga.action\').smart_scroll_with_saga(-1)<cr>', {noremap = true, silent = true})
-- show signature help
u.map('n', 'gs', '<cmd>lua require(\'lspsaga.signaturehelp\').signature_help()<cr>', {noremap = true, silent = true})
-- show signature help
u.map('n', 'gs', '<cmd>lua require(\'lspsaga.signaturehelp\').signature_help()<cr>', {noremap = true, silent = true})
-- rename
u.map('n', 'gR', '<cmd>lua require(\'lspsaga.rename\').rename()<cr>', {noremap = true, silent = true})
-- preview definition - not working with Elixir
u.map('n', 'gP', '<cmd>lua require\'lspsaga.provider\'.preview_definition()<cr>', {noremap = true, silent = true})
-- show diagnostic
u.map('n', '<leader>cd', '<cmd>lua require\'lspsaga.diagnostic\'.show_line_diagnostics()<cr>', {noremap = true, silent = true})
-- only show diagnostic if cursor is over the area
u.map('n', '<leader>cc', '<cmd>lua require\'lspsaga.diagnostic\'.show_cursor_diagnostics()<cr>', {noremap = true, silent = true})
-- jump diagnostic
u.map('n', '[e', '<cmd>lua require\'lspsaga.diagnostic\'.lsp_jump_diagnostic_prev()<cr>', {noremap = true, silent = true})
u.map('n', ']e', '<cmd>lua require\'lspsaga.diagnostic\'.lsp_jump_diagnostic_next()<cr>', {noremap = true, silent = true})
-- float terminal also you can pass the cli command in open_float_terminal function
u.map('n', '<A-d>', '<cmd>lua require(\'lspsaga.floaterm\').open_float_terminal()<cr>', {noremap = true, silent = true}) -- or open_float_terminal('lazygit')<CR>
u.map('t', '<A-d>', '<C-\\><C-n>:lua require(\'lspsaga.floaterm\').close_float_terminal()<cr>', {noremap = true, silent = true})
|
local ESX = exports['es_extended']:getSharedObject()
function getPlayerFromId(source)
local steamid = false
local license = false
local discord = false
local xbl = false
local liveid = false
local ip = false
for k,v in pairs(GetPlayerIdentifiers(source))do
if string.sub(v, 1, string.len("steam:")) == "steam:" then
steamid = v
elseif string.sub(v, 1, string.len("license:")) == "license:" then
license = v
elseif string.sub(v, 1, string.len("xbl:")) == "xbl:" then
xbl = v
elseif string.sub(v, 1, string.len("ip:")) == "ip:" then
ip = v
elseif string.sub(v, 1, string.len("discord:")) == "discord:" then
discord = v
elseif string.sub(v, 1, string.len("live:")) == "live:" then
liveid = v
end
end
return steamid
end
RegisterCommand('maintenance', function()
cfg.isOnMaintenance = not cfg.isOnMaintenance
print("Maintenance Mode", cfg.isOnMaintenance)
end)
AddEventHandler('playerConnecting', function(peerName, setKickReason)
local allowed = false
for i,allowedID in ipairs(cfg.AllowedIDs) do
print(getPlayerFromId(source), allowedID)
if getPlayerFromId(source) == allowedID then
allowed = true
end
end
if cfg.isOnMaintenance == true and not allowed then
print('-----------------ESX MAINTENANCE SYSTEM-----------')
print('Dropping Connection for: [' .. peerName ..'] ')
print('-----------------ESX MAINTENANCE SYSTEM-----------')
setKickReason('The server is under maintenance, please come back later!')
CancelEvent()
end
end)
|
--[[
]]--
module("luci.controller.app.vendor", package.seeall)
function index()
local page = node("app", "vendor")
page.target = firstchild()
page.title = _("")
page.order = 10
page.sysauth = "admin"
page.sysauth_authenticator = "jsonauth"
page.index = true
entry({"app"}, firstchild(), _(""), 700)
entry({"app", "vendor"}, firstchild(), _(""), 700)
entry({"app", "vendor", "ss"}, template("app/vendor/ss"), _("status"), 700, true)
entry({"app", "vendor", "ss_ajax"}, template("app/vendor/ss_ajax"), _("status"), 700, true)
end
|
vim.g["bujo#todo_file_path"] = tostring(os.getenv("HOME")) .. "/.cache/bujo"
vim.g["bujo#window_width"] = 100
|
return {
version = "1.1",
luaversion = "5.1",
tiledversion = "0.16.1",
orientation = "orthogonal",
renderorder = "right-down",
width = 20,
height = 6,
tilewidth = 32,
tileheight = 32,
nextobjectid = 2,
properties = {},
tilesets = {},
layers = {
{
type = "tilelayer",
name = "Tile Layer 1",
x = 0,
y = 0,
width = 20,
height = 6,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
},
{
type = "objectgroup",
name = "Object Layer 1",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
objects = {
{
id = 1,
name = "Ground",
type = "ground",
shape = "rectangle",
x = 0,
y = 173,
width = 640,
height = 20,
rotation = 0,
visible = true,
properties = {
["collidable"] = true
}
}
}
}
}
}
|
//________________________________
//
// NS2 CustomEntitesMod
// Made by JimWest 2013
//
//________________________________
Script.Load("lua/ScriptActor.lua")
Script.Load("lua/Mixins/ModelMixin.lua")
Script.Load("lua/ExtraEntitiesMod/LogicMixin.lua")
Script.Load("lua/TeamMixin.lua")
Script.Load("lua/ExtraEntitiesMod/ScaledModelMixin.lua")
class 'LogicBreakable' (ScriptActor)
LogicBreakable.kMapName = "logic_breakable"
LogicBreakable.kCinematic = PrecacheAsset("cinematics/breakable/breakable_debris.cinematic")
local kSurfaceName = {
"metal",
"rock",
"organic",
"infestation",
"thin_metal",
"electronic",
"armor",
"flesh",
"membrane",
}
local networkVars =
{
scale = "vector",
surface = "integer (0 to 10)",
cinematicName = "string (128)",
team = "integer (0 to 2)",
}
AddMixinNetworkVars(BaseModelMixin, networkVars)
AddMixinNetworkVars(ModelMixin, networkVars)
AddMixinNetworkVars(LiveMixin, networkVars)
AddMixinNetworkVars(TeamMixin, networkVars)
function LogicBreakable:OnCreate()
ScriptActor.OnCreate(self)
InitMixin(self, BaseModelMixin)
InitMixin(self, ModelMixin)
InitMixin(self, LiveMixin)
InitMixin(self, TeamMixin)
end
function LogicBreakable:OnInitialized()
ScriptActor.OnInitialized(self)
InitMixin(self, ScaledModelMixin)
if not Predict and (self.model ~= nil) then
PrecacheAsset(self.model)
self:SetScaledModel(self.model)
end
if not self.cinematicName then
self.cinematicName = LogicBreakable.kCinematic
end
PrecacheAsset(self.cinematicName)
if Server then
InitMixin(self, LogicMixin)
InitMixin(self, StaticTargetMixin)
if (self.team and self.team > 0) then
self:SetTeamNumber(self.team)
end
end
self.health = tonumber(self.health)
self.initialHealth = self.health
if not self.surface then
self.surface = 0
end
self:SetPhysicsType(PhysicsType.Kinematic)
end
function LogicBreakable:Reset()
self.health = self.initialHealth
if not self:GetRenderModel() then
if(self.model ~= nil) then
self:SetScaledModel(self.model)
end
end
end
function LogicBreakable:GetCanIdle()
return false
end
function LogicBreakable:GetSendDeathMessageOverride()
return false
end
function LogicBreakable:GetCanBeUsed(player, useSuccessTable)
useSuccessTable.useSuccess = false
end
function LogicBreakable:GetCanTakeDamageOverride()
return true
end
function LogicBreakable:OnTakeDamage(damage, attacker, doer, point)
end
function LogicBreakable:GetShowHitIndicator()
return true
end
function LogicBreakable:GetSurfaceOverride()
return kSurfaceName[self.surface + 1]
end
function LogicBreakable:OnKill(damage, attacker, doer, point, direction)
ScriptActor.OnKill(self, damage, attacker, doer, point, direction)
BaseModelMixin.OnDestroy(self)
self:SetPhysicsGroup(PhysicsGroup.DroppedWeaponGroup)
self:SetPhysicsGroupFilterMask(PhysicsMask.None)
if Server then
self:TriggerOutputs(attacker)
Print("Trigger ouputs")
end
effectEntity = Shared.CreateEffect(nil, self.cinematicName, nil, Coords.GetTranslation(self:GetOrigin()))
end
if (Client) then
function LogicBreakable:OnKillClient()
BaseModelMixin.OnDestroy(self)
self:SetPhysicsType(PhysicsType.None)
// TODO: delete phys model from Client.propList
end
function LogicBreakable:OnTakeDamage(damage, attacker, doer, point)
end
end
Shared.LinkClassToMap("LogicBreakable", LogicBreakable.kMapName , networkVars )
|
MenuScene = Scene:extend()
function MenuScene:onEnter()
Scene.setScene(main)
end
|
return { }
--[[
{
Name = 'Recipe: Enhance I',
Type = 'CraftingRecipe',
Rarity = 'Common',
MUID = '8FF69EDBD803461C:CRAFT_Enhance1',
RecipeBookPage = '1',
Method = 'PrimaryItemEnhance',
YieldItemName = '',
IngredientAmount1 = '50',
IngredientName1 = 'Shards',
IngredientAmount2 = '',
IngredientName2 = '',
IngredientAmount3 = '',
IngredientName3 = '',
Lore = 'Enhance the stats of a common item.',
},
{
Name = 'Recipe: Enhance II',
Type = 'CraftingRecipe',
Rarity = 'Uncommon',
MUID = '8E3953FE153684F2:CRAFT_Enhance2',
RecipeBookPage = '1',
Method = 'PrimaryItemEnhance',
YieldItemName = '',
IngredientAmount1 = '100',
IngredientName1 = 'Shards',
IngredientAmount2 = '',
IngredientName2 = '',
IngredientAmount3 = '',
IngredientName3 = '',
Lore = 'Enhance the stats of an uncommon item.',
},
{
Name = 'Recipe: Enhance III',
Type = 'CraftingRecipe',
Rarity = 'Rare',
MUID = 'A69E71228957FF9B:CRAFT_Enhance3',
RecipeBookPage = '1',
Method = 'PrimaryItemEnhance',
YieldItemName = '',
IngredientAmount1 = '200',
IngredientName1 = 'Shards',
IngredientAmount2 = '',
IngredientName2 = '',
IngredientAmount3 = '',
IngredientName3 = '',
Lore = 'Enhance the stats of a rare item.',
},
{
Name = 'Recipe: Enhance IV',
Type = 'CraftingRecipe',
Rarity = 'Epic',
MUID = '3644F915F46A9A39:CRAFT_Enhance4',
RecipeBookPage = '1',
Method = 'PrimaryItemEnhance',
YieldItemName = '',
IngredientAmount1 = '400',
IngredientName1 = 'Shards',
IngredientAmount2 = '',
IngredientName2 = '',
IngredientAmount3 = '',
IngredientName3 = '',
Lore = 'Enhance the stats of a epic item.',
},
{
Name = 'Recipe: Enhance V',
Type = 'CraftingRecipe',
Rarity = 'Legendary',
MUID = 'E878101ACF4BEC00:CRAFT_Enhance5',
RecipeBookPage = '1',
Method = 'PrimaryItemEnhance',
YieldItemName = '',
IngredientAmount1 = '800',
IngredientName1 = 'Shards',
IngredientAmount2 = '',
IngredientName2 = '',
IngredientAmount3 = '',
IngredientName3 = '',
Lore = 'Enhance the stats of a legendary item.',
},
}
--]]
|
local Bilinear, parent = torch.class('nn.Bilinear', 'nn.Module')
local function isint(x) return type(x) == 'number' and x == math.floor(x) end
function Bilinear:__assertInput(input)
assert(input and type(input) == 'table' and #input == 2,
'input should be a table containing two data Tensors')
assert(input[1]:nDimension() == 2 and input[2]:nDimension() == 2,
'input Tensors should be two-dimensional')
assert(input[1]:size(1) == input[2]:size(1),
'input Tensors should have the same number of rows (instances)')
assert(input[1]:size(2) == self.weight:size(2),
'dimensionality of first input is erroneous')
assert(input[2]:size(2) == self.weight:size(3),
'dimensionality of second input is erroneous')
end
function Bilinear:__assertInputGradOutput(input, gradOutput)
assert(input[1]:size(1) == gradOutput:size(1),
'number of rows in gradOutput does not match input')
assert(gradOutput:size(2) == self.weight:size(1),
'number of columns in gradOutput does not output size of layer')
end
function Bilinear:__init(inputSize1, inputSize2, outputSize, bias)
-- assertions:
assert(self and inputSize1 and inputSize2 and outputSize,
'should specify inputSize1 and inputSize2 and outputSize')
assert(isint(inputSize1) and isint(inputSize2) and isint(outputSize),
'inputSize1 and inputSize2 and outputSize should be integer numbers')
assert(inputSize1 > 0 and inputSize2 > 0 and outputSize > 0,
'inputSize1 and inputSize2 and outputSize should be positive numbers')
-- set up model:
parent.__init(self)
local bias = ((bias == nil) and true) or bias
self.weight = torch.Tensor(outputSize, inputSize1, inputSize2)
self.gradWeight = torch.Tensor(outputSize, inputSize1, inputSize2)
if bias then
self.bias = torch.Tensor(outputSize)
self.gradBias = torch.Tensor(outputSize)
end
self.gradInput = {torch.Tensor(), torch.Tensor()}
self:reset()
end
function Bilinear:reset(stdv)
assert(self)
if stdv then
assert(stdv and type(stdv) == 'number' and stdv > 0,
'standard deviation should be a positive number')
stdv = stdv * math.sqrt(3)
else
stdv = 1 / math.sqrt(self.weight:size(2))
end
self.weight:uniform(-stdv, stdv)
if self.bias then self.bias:uniform(-stdv, stdv) end
return self
end
function Bilinear:updateOutput(input)
assert(self)
self:__assertInput(input)
-- set up buffer:
self.buff2 = self.buff2 or input[1].new()
self.buff2:resizeAs(input[2])
-- compute output scores:
self.output:resize(input[1]:size(1), self.weight:size(1))
for k = 1,self.weight:size(1) do
torch.mm(self.buff2, input[1], self.weight[k])
self.buff2:cmul(input[2])
torch.sum(self.output:narrow(2, k, 1), self.buff2, 2)
end
if self.bias then
self.output:add(
self.bias:reshape(1, self.bias:nElement()):expandAs(self.output)
)
end
return self.output
end
function Bilinear:updateGradInput(input, gradOutput)
assert(self)
if self.gradInput then
self:__assertInputGradOutput(input, gradOutput)
-- compute d output / d input:
self.gradInput[1]:resizeAs(input[1]):fill(0)
self.gradInput[2]:resizeAs(input[2]):fill(0)
-- do first slice of weight tensor (k = 1)
self.gradInput[1]:mm(input[2], self.weight[1]:t())
self.gradInput[1]:cmul(gradOutput:narrow(2,1,1):expand(self.gradInput[1]:size(1),
self.gradInput[1]:size(2)))
self.gradInput[2]:addmm(1, input[1], self.weight[1])
self.gradInput[2]:cmul(gradOutput:narrow(2,1,1):expand(self.gradInput[2]:size(1),
self.gradInput[2]:size(2)))
-- do remaining slices of weight tensor
if self.weight:size(1) > 1 then
self.buff1 = self.buff1 or input[1].new()
self.buff1:resizeAs(input[1])
for k = 2, self.weight:size(1) do
self.buff1:mm(input[2], self.weight[k]:t())
self.buff1:cmul(gradOutput:narrow(2,k,1):expand(self.gradInput[1]:size(1),
self.gradInput[1]:size(2)))
self.gradInput[1]:add(self.buff1)
self.buff2:mm(input[1], self.weight[k])
self.buff2:cmul(gradOutput:narrow(2,k,1):expand(self.gradInput[2]:size(1),
self.gradInput[2]:size(2)))
self.gradInput[2]:add(self.buff2)
end
end
return self.gradInput
end
end
function Bilinear:accGradParameters(input, gradOutput, scale)
local scale = scale or 1
self:__assertInputGradOutput(input, gradOutput)
assert(scale and type(scale) == 'number' and scale >= 0)
-- make sure we have buffer:
self.buff1 = self.buff1 or input[1].new()
self.buff1:resizeAs(input[1])
-- accumulate parameter gradients:
for k = 1,self.weight:size(1) do
torch.cmul(
self.buff1, input[1], gradOutput:narrow(2, k, 1):expandAs(input[1])
)
self.gradWeight[k]:addmm(self.buff1:t(), input[2])
end
if self.bias then self.gradBias:add(scale, gradOutput:sum(1)) end
end
-- we do not need to accumulate parameters when sharing:
Bilinear.sharedAccUpdateGradParameters = Bilinear.accUpdateGradParameters
function Bilinear:__tostring__()
return torch.type(self) ..
string.format(
'(%dx%d -> %d) %s',
self.weight:size(2), self.weight:size(3), self.weight:size(1),
(self.bias == nil and ' without bias' or '')
)
end
function Bilinear:clearState()
if self.buff2 then self.buff2:set() end
if self.buff1 then self.buff1:set() end
return parent.clearState(self)
end
|
--- Entity lifespan.
--
-- @setting zombie.lifetime
-- @settype int
-- @default 300 (5 minutes)
cmer_zombie.lifetime = tonumber(core.settings:get("zombie.lifetime")) or 300
--- Spawn rate frequency.
--
--
-- @setting zombie.spawn_interval
-- @settype int
-- @default 36
-- @see [ABM definition](http://minetest.gitlab.io/minetest/definition-tables.html#abm-activeblockmodifier-definition)
cmer_zombie.spawn_interval = tonumber(core.settings:get("zombie.spawn_interval")) or 36
--- Chance of spawn at interval.
--
-- @setting zombie.spawn_chance
-- @settype int
-- @default 7600
-- @see [ABM definition](http://minetest.gitlab.io/minetest/definition-tables.html#abm-activeblockmodifier-definition)
cmer_zombie.spawn_chance = tonumber(core.settings:get("zombie.spawn_chance")) or 7600
|
local function try_staple(itemstack, placer, pointed)
if pointed.type ~= "node" then
return
end
if pointed.above.y - pointed.under.y ~= 0 then
return
end
-- Node under must be a tree
local node_under = minetest.get_node(pointed.under)
local def_under = minetest.registered_nodes[node_under.name] or {}
if not def_under.groups or not def_under.groups.tree then
return
end
if def_under.paramtype2 == "facedir"
or def_under.paramtype2 == "colorfacedir" then
-- Only vertical facedirs are allowed
local dir = minetest.wallmounted_to_dir(node_under.param2)
if dir.x ~= 0 or dir.z ~= 0 then
return
end
end
-- Node above must be airlike, but not ignore
local node_above = minetest.get_node(pointed.above)
local def_above = minetest.registered_nodes[node_above.name] or {}
if node_above.name == "ignore" or not def_above.buildable_to then
return
end
-- Staple to the tree
local dir = vector.direction(pointed.above, pointed.under)
local pos = minetest.pointed_thing_to_face_pos(placer, pointed)
local obj = minetest.add_entity(
vector.add(pos, vector.multiply(dir, -0.01)),
"stapled_bread:bread_slice"
)
if obj then
local entity = obj:get_luaentity()
if not creative or not creative.is_enabled_for(
placer:get_player_name()) then
itemstack:take_item(1)
end
entity.object:set_yaw(math.atan2(-dir.x, dir.z))
entity.object:set_properties({
textures = { itemstack:get_name() }
})
end
return itemstack
end
local function staple_place_wrapper(itemstack, placer, pointed_thing)
return try_staple(itemstack, placer, pointed_thing) or itemstack
end
local extent = 0.12
local box = {-extent, -extent, -extent, extent, extent, extent}
minetest.register_entity("stapled_bread:bread_slice", {
visual = "wielditem",
textures = { "unknown_node.png" },
visual_size = {x = 0.2, y = 0.2},
physical = false,
collisionbox = box,
selectionbox = box,
get_staticdata = function(self)
return self.object:get_properties().textures[1]
end,
on_activate = function(self, staticdata, dtime_s)
if staticdata and staticdata ~= "" then
self.object:set_properties({
textures = { staticdata }
})
end
end
})
-- REGISTER BREAD STUFF
minetest.override_item("farming:bread", {
on_place = staple_place_wrapper
})
minetest.register_craftitem("stapled_bread:bread_slice", {
description = "Bread Slice",
inventory_image = "stapled_bread_slice.png",
on_use = minetest.item_eat(1),
on_place = staple_place_wrapper
})
minetest.register_craft({
type = "shapeless",
output = "stapled_bread:bread_slice 5",
recipe = {
"farming:bread"
}
})
|
villageSivarraPhase4ConvoTemplate = ConvoTemplate:new {
initialScreen = "",
templateType = "Lua",
luaClassHandler = "villageSivarraPhase4ConvoHandler",
screens = {}
}
intro_not_eligible = ConvoScreen:new {
id = "intro_not_eligible",
leftDialog = "@conversation/fs_combat_healing_quest:s_48b1807b", -- "What? Do I look like I have time to chit chat?!?"
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_not_eligible);
intro_full_inventory = ConvoScreen:new {
id = "intro_full_inventory",
leftDialog = "@conversation/fs_combat_healing_quest:s_a7b82bb9", -- "Huh? I can't deal with you if you don't have any room to hold things, clear up some room and come back! And hurry, I'm not sure how long we have."
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_full_inventory);
intro_give_first_set_reward = ConvoScreen:new {
id = "intro_give_first_set_reward",
leftDialog = "@conversation/fs_combat_healing_quest:s_8d7b6d3", -- "Hmm... I see the Force has gifted you as a healer. You seem to have unlocked some potential in yourself. I wish I could guide you more, but that is all I can do for you. There is still much to do, let me know if you would like to help some more."
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_give_first_set_reward);
intro_give_second_set_reward = ConvoScreen:new {
id = "intro_give_second_set_reward",
leftDialog = "@conversation/fs_combat_healing_quest:s_5b948c11", -- "Ah! Yes, you're back! You've done so much, I happen to have an extra tank that we don't have room for, I'm sure a gifted healer such as yourself will find a good place for it."
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_give_second_set_reward);
intro_has_otherquest = ConvoScreen:new {
id = "intro_has_otherquest",
leftDialog = "@conversation/fs_combat_healing_quest:s_5b2d3e0f", -- "Who? Oh, you seem far too busy to help me now, if you have time please see if there are any other medics available."
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_has_otherquest);
intro_has_no_medic = ConvoScreen:new {
id = "intro_has_no_medic",
leftDialog = "@conversation/fs_combat_healing_quest:s_14e60463", -- "You don't seem to have any medical training at all. I'm sorry, but I don't think you are going to be able to help me"
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_has_no_medic);
intro_begin = ConvoScreen:new {
id = "intro_begin",
leftDialog = "@conversation/fs_combat_healing_quest:s_7ed32afc", -- "Huh? Oh! Great! More medics! The troops are in desperate need of support. Are you here to provide the medical support?"
stopConversation = "false",
options = {
{"@conversation/fs_combat_healing_quest:s_8fddaea0", "choose_accept"}, -- "Yes, I want to help."
{"@conversation/fs_combat_healing_quest:s_d4d1a11f", "choose_decline"}, -- "Sorry, no."
}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_begin);
choose_decline = ConvoScreen:new {
id = "choose_decline",
leftDialog = "@conversation/fs_combat_healing_quest:s_df4917e", -- "Too bad, too bad, we need some help here, but I'm sure you already realized that. Excuse me, I have much to do."
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(choose_decline);
choose_accept = ConvoScreen:new {
id = "choose_accept",
leftDialog = "@conversation/fs_combat_healing_quest:s_ad2d5f2b", -- "Help? Yes, you can help! What I need you to help with is troop support. This may put you in direct harms way, and you won't be able to help the other villagers with their tasks, but I will make sure Noldan helps you to develop your healing abilities even more. Are you sure?"
stopConversation = "false",
options = {
{"@conversation/fs_combat_healing_quest:s_25b83816", "choose_certain"}, -- "Yes, I'm sure."
{"@conversation/fs_combat_healing_quest:s_5d4f7fdb", "choose_uncertain"}, -- "On second thought..."
}
}
villageSivarraPhase4ConvoTemplate:addScreen(choose_accept);
choose_certain = ConvoScreen:new {
id = "choose_certain",
leftDialog = "@conversation/fs_combat_healing_quest:s_1f0513d3", -- "Yes! Yes! I need you to go find the groups of defenders and join them, you will need to support them while they are defending us as any good medic would. Be careful, you will be in harms way sometimes! If you can help out fifty times that would be a great help! Oh, and you can come back and talk to me or the droids to track your progress!"
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(choose_certain);
choose_uncertain = ConvoScreen:new {
id = "choose_uncertain",
leftDialog = "@conversation/fs_combat_healing_quest:s_8c663fab", -- "I see, I see... I was hoping you would be made of sterner stuff, but I guess not."
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(choose_uncertain);
intro_start_second_set = ConvoScreen:new {
id = "intro_start_second_set",
leftDialog = "@conversation/fs_combat_healing_quest:s_6a7931f2", -- "Hmm... I can tell you are a great healer, I may have something else for you if you are interested in helping some more."
stopConversation = "false",
options = {
{"@conversation/fs_combat_healing_quest:s_aa2e6c00", "choose_continue"}, -- "Sure, I'll help."
{"@conversation/fs_combat_healing_quest:s_2e7fd1c", "choose_cease"}, -- "Sorry, maybe later."
}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_start_second_set);
choose_continue = ConvoScreen:new {
id = "choose_continue",
leftDialog = "@conversation/fs_combat_healing_quest:s_3fd56843", -- "Brilliant! I need you to, well to help the troops more. If you can help out a total of 100 times that would be wonderful."
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(choose_continue);
choose_cease = ConvoScreen:new {
id = "choose_cease",
leftDialog = "@conversation/fs_combat_healing_quest:s_671a071f", -- "Well, let me know if you change your mind!"
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(choose_cease);
intro_in_progress = ConvoScreen:new {
id = "intro_in_progress",
leftDialog = "@conversation/fs_combat_healing_quest:s_e6d3592a", -- "I see, I see, yes very good, it looks like %TO"
stopConversation = "false",
options = {
{"@conversation/fs_combat_healing_quest:s_67e6df55", "update_continue"}, -- "Okay."
}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_in_progress);
update_continue = ConvoScreen:new {
id = "update_continue",
leftDialog = "@conversation/fs_combat_healing_quest:s_e734fdf3", -- "Keep at it!"
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(update_continue);
intro_completed_quest = ConvoScreen:new {
id = "intro_completed_quest",
leftDialog = "@conversation/fs_combat_healing_quest:s_7263868e", -- "Thank you! Thank you so much for your help! Can't talk much, still have much to do."
stopConversation = "true",
options = {}
}
villageSivarraPhase4ConvoTemplate:addScreen(intro_completed_quest);
addConversationTemplate("villageSivarraPhase4ConvoTemplate", villageSivarraPhase4ConvoTemplate);
|
-- Config for Travis CI cmdline client
-- https://github.com/travis-ci/travis.rb
-- created on top of external debian chroot, prepared by debian-setup.cfg.lua
-- using debian-sandbox.cfg.lua config file as base
-- do not forget to install ruby and ruby-dev packages inside sandbox chroot
defaults.recalculate_orig=defaults.recalculate
function defaults.recalculate()
tunables.datadir=loader.path.combine(loader.workdir,"userdata-travis")
defaults.recalculate_orig()
end
defaults.recalculate()
-- load base config
dofile(loader.path.combine(loader.workdir,"debian-sandbox.cfg.lua"))
-- remove some unneded features and mounts
loader.table.remove_value(sandbox.features,"dbus")
loader.table.remove_value(sandbox.features,"gvfs_fix")
loader.table.remove_value(sandbox.features,"pulse")
-- remove some mounts from base config
loader.table.remove_value(sandbox.setup.mounts,defaults.mounts.devsnd_mount)
loader.table.remove_value(sandbox.setup.mounts,defaults.mounts.devdri_mount)
loader.table.remove_value(sandbox.setup.mounts,defaults.mounts.sys_mount)
loader.table.remove_value(sandbox.setup.mounts,defaults.mounts.devinput_mount)
loader.table.remove_value(sandbox.setup.mounts,defaults.mounts.devshm_mount)
-- enable resolvconf feature
table.insert(sandbox.features,"resolvconf")
loader.table.remove_value(sandbox.setup.mounts,defaults.mounts.resolvconf_mount)
-- add mounts with sources directory
table.insert(sandbox.setup.mounts,{prio=100,tag="data","bind-try","/mnt/data","/mnt/data"})
shell.term_orphans=true
shell.desktop={
name = "Travis-CI shell",
generic_name= "Travis-CI utility",
comment = "Shell for Travis-CI utility, sandbox uid "..config.sandbox_uid,
icon = "terminal",
terminal = true,
startupnotify = false,
categories="Development;Utility;",
}
shell.env_set={
{"TERM",os.getenv("TERM")},
{"GEM_HOME","/home/sandboxer/gems"},
{"GEM_PATH","/home/sandboxer/gems"},
}
shell.exec="/bin/bash"
shell.args={"-c","PATH=\"$HOME/gems/bin:$PATH\" /bin/bash -l"}
travis_install={
exec="/bin/bash",
path="/home/sandboxer",
env_set=shell.env_set,
args={"-c","rm -rf $HOME/gems && ( PATH=\"$HOME/gems/bin:$PATH\" gem install travis )"},
term_signal=defaults.signals.SIGTERM,
attach=true,
pty=true,
exclusive=true,
term_orphans=true,
}
|
local cld_cmd_util = {}
cld_cmd_util.table_sep = " "
function cld_cmd_util.display_table(o)
headers = o.headers
table_data = o.data
column_widths = o.column_widths
fmtspecs = {}
if column_widths ~= nil then
for k, v in pairs(column_widths) do
fmtspecs[k] = "%-" .. (v + 1) .. "." .. v .. "s"
end
end
items = 0
for _, k in ipairs(headers) do
if o.show_headers then
if fmtspecs[k] ~= nil then
io.write(string.format(fmtspecs[k], k) .. cld_cmd_util.table_sep)
else
io.write(k .. cld_cmd_util.table_sep)
end
end
if items == 0 then items = #table_data[k] end
end
if o.show_headers then io.write("\n") end
for i = 1, items do
for _, k in ipairs(headers) do
if fmtspecs[k] ~= nil then
io.write(string.format(fmtspecs[k], table_data[k][i]) ..
cld_cmd_util.table_sep)
else
io.write(table_data[k][i] .. cld_cmd_util.table_sep)
end
end
io.write("\n")
end
end
function cld_cmd_util.print_options(options)
for opt, opt_val in pairs(options) do
io.write(opt .. " [")
io.write("name=" .. opt_val["name"] .. " ")
if opt_val["short_name"] ~= nil then
io.write("short_name=" .. tostring(opt_val["short_name"]) .. " ")
end
if opt_val["val"] ~= nil then
io.write("value=" .. tostring(opt_val["val"]) .. " ")
end
if opt_val["default_val"] ~= nil then
io.write("default=" .. tostring(opt_val["default_val"]) .. " ")
end
if opt_val["description"] ~= nil then
io.write("description=" .. tostring(opt_val["description"]) .. " ")
end
io.write(']\n')
end
end
function cld_cmd_util.has_option(options, key) return options[key] ~= nil end
function cld_cmd_util.option_val(options, key)
if cld_cmd_util.has_option(options, key) then
return options[key]["val"]
else
return nil
end
end
function cld_cmd_util.filters_to_list(filters)
filters_ls = {}
for w in string.gmatch(filters, "[%w<>:-/@]+=[%w<>:-/@]+") do
count = 0
key = nil
val = nil
for k in string.gmatch(w, "[%w<>:-/@]+") do
if count == 0 then
key = k
else
val = k
end
count = count +1
end
if filters_ls[key] == nil then
filters_ls[key] = {}
end
table.insert(filters_ls[key], val)
end
return filters_ls
end
return cld_cmd_util
|
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2129
---------------------------------------------------------------------------------------------------
-- Description:
-- In case:
-- 1) Mobile app is activated
-- SDL must:
-- 1) Send OnHMIStatus notification with appropriate value of 'audioStreamingState' parameter
-- Particular value depends on app's 'appHMIType' and 'isMediaApplication' flag, and described in 'testCases' table below
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/MobileProjection/Phase2/common')
local runner = require('user_modules/script_runner')
--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
--[[ Local Variables ]]
local testCases = {
[001] = { t = "PROJECTION", m = false, s = "NOT_AUDIBLE" },
[003] = { t = "NAVIGATION", m = false, s = "AUDIBLE" },
[005] = { t = "NAVIGATION", m = true, s = "AUDIBLE" },
[007] = { t = "PROJECTION", m = true, s = "AUDIBLE" }
}
--[[ Local Functions ]]
local function activateApp(pTC, pAudioSS)
local requestId = common.getHMIConnection():SendRequest("SDL.ActivateApp", { appID = common.getHMIAppId() })
common.getHMIConnection():ExpectResponse(requestId)
common.getMobileSession():ExpectNotification("OnHMIStatus")
:ValidIf(function(_, data)
return common.checkAudioSS(pTC, "App1", pAudioSS, data.payload.audioStreamingState)
end)
end
--[[ Scenario ]]
for n, tc in common.spairs(testCases) do
runner.Title("TC[" .. string.format("%03d", n) .. "]: "
.. "[hmiType:" .. tc.t .. ", isMedia:" .. tostring(tc.m) .. "]")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Set App Config", common.setAppConfig, { 1, tc.t, tc.m })
runner.Step("Register App", common.registerApp)
runner.Step("Activate App, audioState:" .. tc.s, activateApp, { n, tc.s })
runner.Step("Clean sessions", common.cleanSessions)
runner.Step("Stop SDL", common.postconditions)
end
runner.Step("Print failed TCs", common.printFailedTCs)
|
-- effect_id :: string: The effect_id specified in the trigger effect.
-- surface_index :: uint: The surface the effect happened on.
-- source_position :: Position (optional)
-- source_entity :: LuaEntity (optional)
-- target_position :: Position (optional)
-- target_entity :: LuaEntity (optional)
local function effect_triggered(event)
if (event.effect_id == "RTCrank"
and global.AllPlayers[event.source_entity.player.index].sliding
and global.AllPlayers[event.source_entity.player.index].succ.energy ~= 0
and game.get_player(event.source_entity.player.index).character.get_inventory(defines.inventory.character_guns)[game.get_player(event.source_entity.player.index).character.selected_gun_index].valid_for_read
and game.get_player(event.source_entity.player.index).character.get_inventory(defines.inventory.character_guns)[game.get_player(event.source_entity.player.index).character.selected_gun_index].name == "RTZiplineItem"
and game.get_player(event.source_entity.player.index).character.get_inventory(defines.inventory.character_ammo)[game.get_player(event.source_entity.player.index).character.selected_gun_index].valid_for_read
and game.get_player(event.source_entity.player.index).character.get_inventory(defines.inventory.character_ammo)[game.get_player(event.source_entity.player.index).character.selected_gun_index].name == "RTZiplineCrankControlsItem"
and game.get_player(event.source_entity.player.index).walking_state.walking == true
) then
if (global.AllPlayers[event.source_entity.player.index].ForwardDirection[game.get_player(event.source_entity.player.index).walking_state.direction] ~= nil) then
if (global.AllPlayers[event.source_entity.player.index].LetMeGuideYou.speed <= 0.420) then
global.AllPlayers[event.source_entity.player.index].LetMeGuideYou.speed = global.AllPlayers[event.source_entity.player.index].LetMeGuideYou.speed + 0.040 --increments slower than 0.008 don't seem to do anything
game.get_player(event.source_entity.player.index).surface.play_sound
{
path = "RTZipAttach",
position = game.get_player(event.source_entity.player.index).position,
volume = 0.7
}
end
elseif (global.AllPlayers[event.source_entity.player.index].BackwardsDirection[game.get_player(event.source_entity.player.index).walking_state.direction] ~= nil) then
if (global.AllPlayers[event.source_entity.player.index].LetMeGuideYou.speed >= -0.420) then
global.AllPlayers[event.source_entity.player.index].LetMeGuideYou.speed = global.AllPlayers[event.source_entity.player.index].LetMeGuideYou.speed - 0.040
game.get_player(event.source_entity.player.index).surface.play_sound
{
path = "RTZipAttach",
position = game.get_player(event.source_entity.player.index).position,
volume = 0.7
}
end
end
end
end
return effect_triggered
|
object_static_worldbuilding_furniture_frn_vet_couch_section_lg = object_static_worldbuilding_furniture_shared_frn_vet_couch_section_lg:new {
}
ObjectTemplates:addTemplate(object_static_worldbuilding_furniture_frn_vet_couch_section_lg, "object/static/worldbuilding/furniture/frn_vet_couch_section_lg.iff")
|
--[[
***********************************************************************
Project owner: RageQuit community
Project name: GTW-RPG
Developers: Mr_Moose
Source code: https://github.com/404rq/GTW-RPG/
Bugtracker: https://discuss.404rq.com/t/issues
Suggestions: https://discuss.404rq.com/t/development
Version: Open source
License: BSD 2-Clause
Status: Stable release
***********************************************************************
]]--
--[[ All help related text is in this file ]]--
list = {
{ "Rules", 0 },
{ "English", 1, [[
***********************************************************************
* Rules in English
***********************************************************************
#1 Do not spawn kill other players.
#2 Drive on the right side of the road. Do not block other players, do not crash into other players unless you have a reason to do so, e.g in a police chase or to revenge.
#3 Do not use any kind of hack or exploit bugs. GTW-RPG is an open source game mode which we claim to be stable and of high quality, it's therefore important to let us know about any bug you may find. Bug reports are rewardable, exploits are punishable.
#4 Do not advertise, feel free to talk about anything as long you're not advertising it. If you don't get the difference here's an example: Talking: xBox vs PS3... Advertising: buy xBox here...
#5 Do not obstruct or interrupt role play situations. It's not appropriate to show up with a minigun and kill a group of players standing together chatting for instance, do not use more violence than the situation require.
#6 Do not spam the chats, repeating nonsense on purpose will lead to a mute, note that this mute are global and applies to many other servers running GTW-RPG resources as well.
#7 Do NOT try this in game: apply for staff, suggest new features, complaint on other players or staff, ask about stuff you'll find information about in the list to the left. This is not punishable but you may not get the response you expected.
#8 Do not actively troll, provoke, annoy or insult other players. Instead, solve your conflicts here: Report/Appeal: https://forum.404rq.com/complaints-and-reports/
Thank you for complying with our rules.
***********************************************************************
* Last edit: 2015-01-28
***********************************************************************]] },
{ "Russian", 1, [[
***********************************************************************
* Rules in Russian
***********************************************************************
# 1 Не убивать других игроков. (Применяется около больниц)
# 2 Движение толь по правой стороне дороги. Не перекрывайте дорогу другим игрокам,
не врезаться в другие игроком, если у вас нет причин для этого.
#3 Не используйте какие либо трейнеры, читы или баги на сервере GTW-PRG.
#4 Не рекламируйте что либо. И так же не бойтесь говорить о чем угодно Вот вам пример правильного общения на сервере (Пример разговора: XBox против PS3) (Пример рекламы: Купить XBox можно тут "Ссылка")
# 5 Не мешайте и не препятствуйте отыгровки РП ситуаций. (Пример: Стоят люди отыгрывают РП ситуацию, прибегает парень достаёт миниган и начинает расстреливать всё что движется)
# 6 Не спамьте в чат(ы), повторяя одно и тоже по несколько раз.Обратите внимание, что этот за это можно получить мут и это носят глобальный характер и относится ко многим другим серверам, работающие на ресурсах GTW-RPG
# 7 Не пытайтесь повторить это в игре: подать заявку на администратора , предлогать новые функции, жаловаться на других игроков или администраторов, Это не наказывается но вы не сможете получить на эти вопросы ожидаемый ответ.
# 8 Не тролль, не провоцируй или не оскорбляй других игроков на сервере.Вместо этого постарайтесь решить свои недопонимания на форуме: https://forum.404rq.com/complaints-and-reports/
Благодарим Вас за соблюдение наших правил.
***********************************************************************
* Last edit: 2016-02-10
***********************************************************************]] },
{ "Dutch (Nederlands)", 1, [[
***********************************************************************
* Rules in Dutch (Nederlands)
***********************************************************************
#1 Geen andere spelers spawnkillen. (Geld rond ziekenhuizen)
#2 Rijd aan de rechterkant van de weg. Blokkeer geen andere spelers, rijd niet in andere spelers zonder een geldige reden. bv. in een politie achtervolging of wraak.
#3 Gebruik geen soort van hack of misbruik geen bugs. GTW-RPG is een open source game modus waarbij we zeggen dat hij stabiel en van hoge kwaliteit is, het is daarom belangrijk dat je ons laat weten van een bug die je vind. Bug reports zijn beloonbaar, misbruik is strafbaar.
#4 Adverteer niet, voel je vrij om over alles te praten zolang je het niet adverteerd. Als je het verschil niet snapt dan is hier een voorbeeld: Praten: Xbox vs PS3... Adverteren: Koop je Xbox hier...
#5 Onderbreek of belemmer rolspel situaties niet. Het is niet volwassen om met een minigun te komen en een groep van spelers die aan het praten zijn te vermoorden, gebruik niet meer geweld dan dat de situatie nodig heeft.
#6 Spam de chat niet, onzin herhalen met opzet zal leiden tot een mute, denk eraan dat deze mute globaal werkt en dus in alle andere GTW servers werken.
#7 Probeer dit spel NIET: soliciteren voor personeel, nieuwe kenmerken aanvragen, klagen over de andere spelers of personeel, iets vragen dat je in de lijst links van dit kan vinden. Dit is niet strafbaar maar het kan zijn dat je je verwachtte antwoord niet krijgt.
#8 Ga niet actief trollen, provoceren, irriteren of spelers uitschelden. Inplaats daarvan, los je problemen hier op: https://forum.404rq.com/complaints-and-reports/
Bedankt om mee te werken met ons reglement.
Translated by:
- WhoopeeTheClown (Global moderator, In game staff)
***********************************************************************
* Last edit: 2015-03-07
***********************************************************************]] },
{ "Italian (Italiano)", 1, [[
***********************************************************************
* Rules in Italian (Italiano)
***********************************************************************
#1 Non spawn-killare gli altri giocatori. (Questa regola vale vicino agli ospedali)
#2 Guida sul lato destro della strada. Non bloccare gli altri giocatori, non schiantarti contro gli altri giocatori a meno che non hai una ragione per farlo, per esempio in un inseguimento o per vendetta.
#3 Non usare nessun tipo di hack e non abusare dei bug. GTW-RPG è una modalità di gioco open source che affermiamo sia stabile e di alta qualità, quindi è importante notificarci riguardo qualsiasi bug che riesci a trovare. Vieni ricompensato se segnali un bug, ma vieni punito se abusi di un exploit.
#4 Non pubblicizzare, sii libero di parlare di qualsiasi cosa purché non la pubblicizzi. Se non capisci la differenza, eccoti un esempio: Parlare: xBox vs PS3... Pubblicizzare: compra la xBox qua...
#5 Non ostruire o interrompere situazioni role play. Non è appropriato presentarsi con una minigun e uccidere un gruppo di giocatori che stanno insieme a parlare per esempio, non usare più violenza di quanto la situazione richiede.
#6 Non spammare nelle chat, ripetere cose senza senso porterà ad essere mutati,tieni conto che questo mute è globale e viene applicato a molti altri server che usano le risorse di GTW-RPG.
#7 NON fare questo nel gioco: chiedere per diventare staff, suggerire nuove idee, lamentarsi di altri giocatori o staffer, chiedere cose ovvie allo staff che puoi trovare nella lista alla tua sinistra. Questo non è punibile ma potrai non ottenere la riposta che ti aspettavi.
#8 Non trollare, provocare, annoiare o insultare gli altri giocatori. Invece, risolvi i tuoi conflitti qua: https://forum.404rq.com/complaints-and-reports/
Grazie per aver letto le regole.
Translated by:
- Franckf (Community member)
***********************************************************************
* Last edit: 2015-03-07
***********************************************************************]] },
{ "Swedish (Svenska)", 1, [[
***********************************************************************
* Rules in Swedish (Svenska)
***********************************************************************
#1 Spawn kill är ej tillåtet (gäller framförallt vid sjukhus)
#2 Håll till höger när du kör, blockera ej andra spelare, krocka inte medveted med andra spelare om du inte har en anledning som exempelvis hämnd eller en biljakt (tjuv och polis).
#3 Missbruka inte eventuella buggar, GTW-RPG är baserat på öppen källkod och bör vara stabilt, belöning utlovas till den som upptäcker och rapporterar buggar beroende på dess storlek, missbruk av buggar bestraffas.
#4 Reklam är ej tillåten, vi tillämpar yttrandefrihet så du får självklart prata om precis vad du vill, så länge du inte öppet gör reklam för en produkt exempelvis.
#5 Avbryt ej rolspel, servern stödjer både role-play och RPG, om en grupp spelare står och sysslar med /me och /do rollspel är det olämpligt att dyka upp med minigun och ha ihjäl dem eller meja ner dem med din bil.
#6 SPAM är ej tillåten, toleransen här är dock hög men får du en varning bör du lugna dig en aning.
#7 Administrativa uppgifter delas INTE ut till den som skriker högst, detsamma gäller för serverns utveckling (förslag och dylikt) samt klagomål på andra spelare med mera, allt sånt hanteras i forumet.
#8 Att aktivt trolla eller provocera är ej heller tillåtet, lös era konflikter här: https://forum.404rq.com/complaints-and-reports/
Tack för att du respekterar våra regler!
Translated by:
- Mr.Moose (Developer/Administrator of Grand Theft Walrus)
***********************************************************************
* Last edit: 2015-03-07
***********************************************************************]] },
{ "Danish (Danska)", 1, [[
***********************************************************************
* Rules in Danish (Danska)
***********************************************************************
#1 Du må ikke gyde dræbe andre spillere. (Gælder omkring hospitaler)
#2 Kørsel på højre side af vejen. Bloker ikke andre spillere, ikke køre ind i andre spillere, medmindre du har en grund til det, fx i en politi jagt eller til hævn.
#3 Brug ikke nogen form for hack eller udnytte bugs. GTW-RPG er en open source game mode, som vi hævder at være stabil og høj kvalitet, er det derfor vigtigt at lade os vide om enhver fejl du kan finde. Fejlrapporter er rewardable, exploits er strafbare.
#4 Du må ikke annoncere, er du velkommen til at tale om noget, så længe du er ikke reklame det. Hvis du ikke får forskellen Her er et eksempel: Talking: Xbox vs PS3 ... Reklame: indkøbe xBox her ...
#5 Du må ikke hindre eller afbryde rollespil situationer. Det er ikke hensigtsmæssigt at dukke op med en minigun og dræbe en gruppe af spillere står sammen chatter for eksempel, brug ikke mere vold end situationen kræver.
#6 ikke spam de chats, gentage nonsens med vilje vil føre til en stum, bemærke, at denne mute er globale og gælder for mange andre servere, der kører ressourcer GTW-RPG så godt.
#7 Du må ikke prøve dette i gmae: ansøge om personale, foreslå nye funktioner, klage på andre spillere eller medarbejdere, spørge om ting, du vil find oplysninger om i listen til venstre. Dette er ikke strafbar, men du kan ikke få det svar du forventede.
#8 Du må ikke aktivt trold, provokere, irritere eller fornærme andre spillere. I stedet løse dine konflikter her: https://forum.404rq.com/complaints-and-reports/
Tak for at overholde vores regler.
Translated by:
- The.Penguin (Developer & Administrator)
***********************************************************************
* Last edit: 2015-03-07
***********************************************************************]] },
{ "Urdu (Urdu)", 1, [[
***********************************************************************
* Rules in Urdu (Urdu)
***********************************************************************
#1 Jab player spawn hota hai to use kill mat kareu. (Hospitals ke ird gird)
#2 Road ki right side pe drive kareu, kisi waja ke bagaar gaari ko doosre players ki gaari pe na mareu. Sirf kareu agar aap ke paas koi acha reason ho jese ke police chase meu ya phir revenge ke liye.
#3 Kisi bhi tarha ka hack na use kareu aur bugs ko abuse na kareu. GTW aik open source community hai. Agar aap ko koi bug milta hai to aap please GTW forums pe GTW developers ko is bugs ka batain. Aap ko is ka reward diya jai ga.
#4 Aap please advertise na kareu. Aap kisi bhi cheez ke bare meu baat kar sakte hain lekin please aap advertise na kareu.
#5 Roleplay situations ko interept na kareu. Ye theek nahi hai ke aap aik minigun kisi group ko dekha kar group ko maar deu.
#6 Do not spam the chats, repeating nonsense on purpose will lead #6 Chat mein spamming na kareu aur nonsense material bhi post na kareu, warna aap mute ho jain gay.
#7 Game mein ye na kareu: staff ke liye apply, new features ko add karne ki suggestion, dosre players ya staff ki complaint.
#8 Kisi ko troll, annoy ya insult na kareu. Aap yahan pe jaa sakte hain: https://forum.404rq.com/complaints-and-reports/
Shukriya hamare rules parhane ke liye.
Translated by:
- ccv (Contributor)
***********************************************************************
* Last edit: 2015-03-07
***********************************************************************]] },
{ "Egyptian (Masry)", 1, [[
***********************************************************************
* Rules in Egyptian (Masry)
***********************************************************************
#1 Mate2telsh awl lama el la3eeb yes7a, w dah kman fel mostashfa.
#2 Dayman so2 3ala el yemeen, mate8batsh el nas bel 3ayabeya aw 7aga zay keda. Te2dar te3mel keda 3ashan ta5od ha2ak aw law enta shorta w betegry wara 7aramy.
#3 Mate3mlsh Hack lel server. Ay bug tela2ee fel server e3melo report 3ala el mawka3 w momken ta5od floos law tele3 begad w etsala7. Ay taree2 3ashan teksab beeha haga zay haraka w ta5od floos deeh hata5od punish feeha.
#4 Etkalem 3an ay haga bas mat7awelsh enak tesa5an el nas 3ala haga masalan Xbox ded el PS4.
#5 Ew3a tera5em 3ala el nas w homa beye3mlo 7agat akenaha fel ha2eeya aw teegy te2teel magmoo3a men el nas w homa bey3melo haga.
#6 Ew3a tekteb 7agat keteer fel chat ya3ny te3melaha spam aw tekteb aya haga malhash ay talateen lazma aw teba2 haga mesh kwayesa.
#7 Ew3a te7awel fel le3ba enak te3mel apply lel staff aw te2ool 3ala fekra lel server aw teshteky 3ala 7ad aw tesa2l haga tela2eeha fel list 3ala el shemal w momken ta5od fe deeh punish.
#8 Matra5emsh 3ala ay 7ad fel server, aw teshtem 7ad, aw te2ool kelma we7sha fel chat badal keda eshteky 3ala 7ad hena: https://forum.404rq.com/complaints-and-reports/
Shokran 3ashan betrakez fel hagat deeh!
Translated by:
- Smart (Moderator)
***********************************************************************
* Last edit: 2015-05-27
***********************************************************************]] },
{ "Portuguese (Portuguese)", 1, [[
***********************************************************************
* Rules in Portuguese (Portuguese)
***********************************************************************
#1 Não faça spawn kill em outros jogadores. (Aplica-se ao redor de hospitais)
#2 Dirigir sempre no lado direito da estrada. Não bloquear os outros jogadores, não bater em outros jogadores, a menos que você tenha uma razão para fazer isso, por exemplo, em uma perseguição policial ou por vingança.
#3 Não use qualquer tipo de hack ou exploração de bugs. GTW-RPG é um modo de jogo de código aberto que pretendemos deixar estável e de alta qualidade, Portanto, é importante que você nos informe sobre qualquer bug, que você encontrar. Relatórios de bug são recompensados, explarações são puníveis..
#4 Não anunciar, sinta-se livre para falar sobre qualquer coisa, contanto que você não anuncie. Se você não entende a diferença aqui está um exemplo: Falando: xBox vs PS3... Publicidade: compre xBox aqui...
#5 Não obstrua ou interrompa as situações de role play. Não é apropriado aparecer com uma minigun e matar um grupo de jogadores que estão juntos conversando, por exemplo. Não use mais violência do que a situação requer.
#6 Não faça spam no chat, se repetir propositalmente você sera mutado, note que o mute é global e aplicado em todos os servidores GTW.
#7 Não tente isso em jogo: pedir para ser staff, sugerir novas funcionalidades, reclamar sobre outros jogadores ou staff, Perguntar sobre coisas que estão no menu à esquerda. Isso não é punível, mas você pode não obter a resposta que você esperava.
#8 Não seja um troll, não provoque, irrite ou insulte os outros jogadores. Em vez disso, resolve seus conflitos aqui: https://forum.404rq.com/complaints-and-reports/
Obrigado por cumprir com as nossas regras.
Translated by:
- EHLuC & EHPHUCK (Community members)
***********************************************************************
* Last edit: 2015-05-27
***********************************************************************]] },
{ "General", 0 },
{ "RageQuit community", 1, [[
***********************************************************************
* RageQuit community
***********************************************************************
Where the game is a true pleasure, we started as a small hobby project to give some new life to a bunch of old gaming PC's, thanks to the great Linux distribution "Debian" and a overkill network in northern Europe RageQuit has been growing over a couple of years and is now running multiple Multi Theft Auto and Minecraft servers.
As our main interest always been the development we don't put much effort in limitations of the free speech or other bureocratic "rules", instead we're trying to make our game mode enjoyable for as many players as possible, this includes everything from design details to pure performance, we hate FPS lag and bad ping just as much as you do.
We're one of feew communities almost completly built on open source software, especially the GTW-RPG project for Multi Theft Auto which we are the main contributors to. We also offers total freedom of speech and high security on our servers so that you don't have to loose any of your valuable game progress or items you worked hard for.
Find our more on our websites:
www.404rq.com
forum.404rq.com
wiki.404rq.com
code.404rq.com
media.404rq.com
***********************************************************************
* Last edit: 2015-09-01
***********************************************************************
]] },
{ "User accounts commands", 1, [[
***********************************************************************
* About user accounts
***********************************************************************
How to login or register:
* Enter your credentials then press login and your data will be saved and synced
* If you don't have any account, choose and enter any credentials then press "register", on success you'll see a green text, press login to login to your new account.
How to change password:
* Press F8 to open your console, then enter:
chgmypass <oldpass> <newpass>
How to change nick name:
* Press F8 to open your console, then enter:
nick <new-nick>
Note that these commands are built in and works on any Multi Theft Auto server.
]]},
{ "Staff guidelines", 1, [[
***********************************************************************
* Staff guidelines (only relevant to server staff)
***********************************************************************
How do I get into "staff mode":
* Use /gostaff(f/m) last f/m is optional and specifies if you want to use the male or female skin
Where is the staff panel located:
* Use /staff or press P
How to spawn a vehicle:
* Use /gv to open the rental spawn menu anywhere on the map, all vehicles are free
How do I warp:
* Use /setpos x y z or open the staff panel for warp to options
Do I need to use tags:
* Nope, it's completly optional, no matter which mode you're in
]]},
{ "How to prevent FPS lag", 1, [[
***********************************************************************
* How to prevent FPS lag
***********************************************************************
You can toggle the shaders to improve your FPS
Toggle car paint reflection shader:
/reflect
Toggle high details shader:
/detail
Toggle water shader (if you get FPS drops near lakes or the sea):
/water
Toggle high contrast shader:
/contrast
You can locally change your weather to increase your FPS too, using the following commands:
/sunny
/rainy
/foggy
If none of these options help check our forum for more suggestions:
https://forum.404rq.com
]]},
{ "How to prevent high latency", 1, [[
***********************************************************************
* How to prevent high latency
***********************************************************************
High latency occurs for two reasons, either the network is overloaded or you're very far away from the server, consider for instance if you're connected to a wireless network with lot's of disturbances (which pretty much all wireless networks has more or less).
To prevent high latency you neet to consider these two things:
* If possible, use a cable network rather than a wireless one. That should reduce your latency to max 400 no matter where in the world you're located, (lower values applies to Europe and USA since that's our location).
* Avoid downloading files while playing, especially torrent files and similar which tends to overflow local networks, also make sure noone else on the same network aren't downloading anything in the background.
What happens when the latency is too high?
We block some features for you temporary, in worst case scenario we kick you. These systems are automatic so don't blame online staff for your own high latency.
]]},
{ "F.A.Q", 1, [[
***********************************************************************
* Frequently asked questions
***********************************************************************
Q: How do I change my skin?
A: Look for a green t-shirt on your radar, enter the shop, walk up to the marker then select a new skin from the GUI
Q: How do I make money?
A: Take a job, (walk up into a yellow marker to open the application GUI), do criminal stuff like robbing stores, steal cars, kill bots etc..
Q: Where can I find a car?
A: You can rent a car by entering any white marker close to gas stations, you can also buy a vehicle from markers with a vehicle type name written over it.
Q: How can I become staff?
A: Visit: https://forum.404rq.com/staff-applications/ to learn everything you need to know
Q: Is there any other way?
A: A few, although none of them works if you annoy other players/staff or lack in braincells
Q: Can I become staff by inviting players?
A: No, but you can earn good money by invitations if you instruct them to enter your account name in the invitation field
Q: Is there any website?
A: Yes: https://www.404rq.com
Q: Is there any forum?
A: Yes: https://forum.404rq.com
Q: What's the uptime?
A: 100%, all RageQuit 404/Grand Theft Walrus servers are hosted in "the cloud" (big datacenters worldwide with 100% uptime guarentee).
Q: How do I donate?
A: Visit: https://404rq.com/donations/
Q: My question wasn't answered here, what should I do?
A: Ask your question here: https://forum.404rq.com/questions-and-concerns/
]]},
{ "Vehicles", 0 },
{ "Vehicle rental", 1, [[
***********************************************************************
* Vehicle rental
***********************************************************************
What is a rental vehicle:
* Any vehicle you spawn by walking up to a white or yellow marker located near work places or gas stations, it's a pay per minute vehicle you can use to quickly travel around the map
Where do I get a rental vehicle:
* press F11 to toggle the big map, look for tiny white or yellow colored squares and find the marker at that location
Why can't I spawn a rental vehicle:
* If you are wanted for comitting a crime and a law enforcer is nearby you can't spawn
How do I return my vehicle:
* Use /djv or /rrv, vehicles are also removed 5 minutes after an explosion caused by damage or immediately if you leave the server.
]] },
{ "Vehicle shops/personal vehicles", 1, [[
***********************************************************************
* Vehicle shops/personal vehicles
***********************************************************************
What is a personal vehicle:
* A vehicle you own by yourself.
Why should I buy when I can rent:
* A owned vehicle can be spawned anywhere on the map
* A owned vehicle can be customized and all your modifications are saved
* A owned vehicle's trunk can be used to hide weapons from the law, press F9 to open/close the trunk
* Owned vehicles doesn't have any rental charges
* You can spawn a unlimed amount of owned vehicles while in a rental vehicle you can only spawn one vehicle at the time
Where do I find the car shops:
* Press F11 to toggle the big map, look for dark grey blips (hard to see) that looks like vehicles (cars/trucks/boats/aircraft/trains)
Which vehicles can I buy:
* Nearly all vehicles that is available in game can be bought, including trains
]] },
{ "Vehicle commands/binds", 1, [[
***********************************************************************
* Vehicle commands/binds
***********************************************************************
Useful keys while driving:
* 'C' - Toggle cruising control
* 'L' - Toggle vehicle headlights
* 'H' - Horn/Toggle vehicle emergency lights (police vehicles/firetrucks and ambulances)
* ',' - Turn indicator to left
* '.' - Turn indicator to right
* '-' - Toggle hazard lights
And the commands to be used while driving:
- Open/close vehicle doors, all or individual
* /cd\[0-6\]
* /od\[0-6\]
- Turn indicators
* /warn
* /lleft
* /lright
- Misc features
* /engine - Start/stop the vehicle engine
* /lock - Lock/unlock the doors of your vehicle
* /emlight - Toggle emergency lights
* /topspeed - Show current top speed in KM/h
* /plate <text> - Change license plate text
* /drop - Exit a helicopter with a rope
- Return rental vehicles
* /djv - destroy job vehicle
* /rrv - return rental vehicle
]] },
{ "Civilians", 0 },
{ "Bus driver", 1, [[
***********************************************************************
* Bus driver:
***********************************************************************
Where do I find this job:
* Unity station - Los Santos
* Pier 69 - San Fierro
* West side storage building - Las Venturas
What do I need for this job:
* A bus or coach, you can rent one near the job location or use your own vehicle
What do I do in this job:
* Enter your bus, select the route you wish to drive and follow the instructions on your screen
When do I get paid:
* Every time you hit a bus stop or pick up another player as passenger
Advantages:
* Largest first, nobody mess with you in the traffic unpunished
* Ability to pickup and get to know mnay new friends
* A strong vehicle with lot's of fuel for long distance travelling
]] },
{ "Farmer", 1, [[
***********************************************************************
* Farmer:
***********************************************************************
Where do I find this job:
* The Farm - (south about San Fierro)
What do I need for this job:
* A tractor, a combine harvester and money for the seeds. You need to buy these vehicles or borrow them from a friend
What do I do in this job:
* Enter the tractor and drive to nearest unoccupied field
* Plant your seeds with the 'N' key
* Let your seeds grow, (you can do anything you want while waiting, just make sure you're there when it's harvest time).
* Harvest your seeds with the combine harvester and pick up the bales
When do I get paid:
* Each bale you pick up gives you cash, just make sure nobody else steal them from you
Advantages:
* You're a redneck, you can kill anyone getting to cloose to your seeds without getting wanted
* A real cash boost for players who have money to invest, without limitations.
]] },
{ "Fisher", 1, [[
***********************************************************************
* Fisher:
***********************************************************************
Where do I find this job:
* The lighthouse west about the beach - Los Santos
What do I need for this job:
* A boat of any type. You need to buy your boat or borrow one from your friend
What do I do in this job:
* Drive your boat slowly on any water
* Cruise if you want and you'll soon start to capture fish
When do I get paid:
* Every time you get a fish, (or anything else that might be valuable for that matter)
Advantages:
* Not much traffic on the sea, a perfect place to relax with your friends
* Possibility to get rich if you're lucky
]] },
{ "Iron miner", 1, [[
***********************************************************************
* Iron miner:
***********************************************************************
Where do I find this job:
* The quarry - Las Venturas
What do I need for this job:
* A minimal amount of cash to afford to buy dynamite
* A schovel, (buy from the job panel or in a hardware store)
What do I do in this job:
* Plant a dynamite using 'N' then run fast as hell
* Take cover for the explosion
* Go to the messy area and start mining
* Sell the minerals you mined at the big white marker near the job location
When do I get paid:
* Every time you sell your minerals
Advantages:
* Free access to dynamite, imagine all the fun you can do with that ;)
]] },
{ "Mechanic", 1, [[
***********************************************************************
* Mechanic:
***********************************************************************
Where do I find this job:
* West side mod shop and pay 'n' spray - Los Santos
* Just north about the train station and fire department - San Fierro
* North/Central between burger shot and LVPD - Las Venturas
What do I need for this job:
* (Optional) a towtruck
What do I do in this job:
* Press X to toggle your cursor
* Click on a damaged car
* Choose if you want to repair or refuel in the menu
* Tow broken vehicles to pay'n'spray for a small bonus
When do I get paid:
* Every repair or refuel (except for your own vehicles) or if another player tip you
Advantages:
* You'll never suffer from a broken car in the middle of nowhere
* Cheaper repairs and refulings
* Big chance of getting tipped by other players
]] },
{ "Pilot", 1, [[
***********************************************************************
* Pilot:
***********************************************************************
Where do I find this job:
* Los Santos international airport
* San Fierro international airport
* Las Venturas international airport
What do I need for this job:
* An airplane or helicopter owned or rented, aircraft rental markers are found near or in the beginning of start and landing fields
What do I do in this job:
* Drive to the assigned pickup point and load passengers/cargo
* Fly to the destination airport (if helicopter or small aircraft more locations are available, often harder to land in)
* Land safely and get paid
When do I get paid:
* As soon you hit the drop off marker and your aircraft isn't too damaged
Advantages:
* A quick way to travel around the state
* Earns lot's of cash compared to other transporter jobs
* Earns a bonus for each player picked up as passenger
]] },
{ "Taxi", 1, [[
***********************************************************************
* Taxi driver:
***********************************************************************
Where do I find this job:
* Los Santos international airport
* San Fierro international airport
* Las Venturas international airport
What do I need for this job:
* A taxi or cabby, owned or rented
What do I do in this job:
* Cruise around until you find a passenger (player) or pick up any AI passenger
* "Deliver" the passenger to requested location and get paid
When do I get paid:
* As soon your passenger is successfully delivered, if you drive a player you'll get paid each minute
Advantages:
* Earn money by giving other players a ride
]] },
{ "Train driver", 1, [[
***********************************************************************
* Train driver:
***********************************************************************
Where do I find this job:
* Unity station - Los Santos
* Cranberry station - San Fierro
* Yellow Bell station - Las Venturas
What do I need for this job:
* A train (with any amount of cars attached), rented or owned
What do I do in this job:
* Drive your train safely around the state
* Deliver passengers and cargo from station to station
* !Watch the speedlimits (see bottom right of your screen)
When do I get paid:
* As soon you hit the dropoff destination, the more attached cars the more money you make, but your train is also getting slower during start/stop the more cars you're pulling
* Players gives an extra bonus payment each minute
Advantages:
* Your vehicle is imortal and unstoppable
* Pickup and drop off cars along the tracks
]] },
{ "Tram driver", 1, [[
***********************************************************************
* Tram driver:
***********************************************************************
Where do I find this job:
* San Fierro, between the hospital and SFPD (central)
What do I need for this job:
* A tram (with any amount of cars attached), rented or owned
What do I do in this job:
* Drive your tram(s) around the tracks in the streets of San Fierro
* Deliver passengers and players around San Fierro
* !Watch for other vehicles and players that might be in your way
* !Watch the speedlimits (see bottom right of your screen)
When do I get paid:
* As soon you hit the dropoff destination, the more attached cars the more money you make, but your train is also getting slower during start/stop the more cars you're pulling
* Players gives an extra bonus payment each minute
Advantages:
* Your vehicle is (almost) imortal and unstoppable
* Pickup and drop off cars along the tracks
]] },
{ "Trucker", 1, [[
***********************************************************************
* Trucker:
***********************************************************************
Where do I find this job:
* The docks - San Fierro
* The gas station west of Los Santos
* The docks - Los Santos
What do I need for this job:
* A truck/van of any type, owned or rented, (semi trucks needs one or more trailers to load the cargo in)
What do I do in this job:
* Enter your truck to view the routes
* Select the route you want to drive
* Deliver cargo around the state or within the city (local deliveries)
When do I get paid:
* As soon you hit the dropoff destination, damaged cargo will reduce your payment, drive carefully!
Advantages:
* Your vehicle is (almost) imortal and unstoppable
* Access to CB radio using: /r <message> (only for truckers) to trace where cops are checking for speeders
]] },
{ "Government", 0 },
{ "Police", 1, [[
***********************************************************************
* Police:
***********************************************************************
Where do I find this job:
* LSPD - Los Santos (inside HQ)
* SFPD - San Fierro (inside HQ)
* LVPD - Las Venturas (inside HQ)
* Inside all country side sheriff stations
What do I need for this job:
* A nightstick to arrest
* A tazer to force suspects to stop
* Additional stronger weapons like M4, MP5 and teargas
* A fast and bullet resistant car, rented or owned (police vehicles can be spawned for free outside all police departments)
What do I do in this job:
* Use /wanted to list all wanted players and their locations
* Patrol until you find anythnig suspicious
* Check bottom right for an orange text telling you the distance to nearest suspect, (use that information to find the suspect)
* When you got a visual on the suspect stop his/her car, (use your sirens and lights to show you're a cop, press 'H' quickly to toggle)
* Once you stopped the suspects car arrest him/her by hitting them with your nightstick once
* If the suspect runs, shoot them with your tazer (works only on short distance)
* If the suspect is violent (i.e opens fire at you) you may perform a so called kill arrest where you shoot to kill the suspect.
* Once arrested, bring the suspect to nearest police department, walk inside and down in the basement to find the cell blocks, walk up to a cell of your choice to lock up the suspect and get paid
When do I get paid:
* When you kill a violent suspect, (killing non violent suspects or innocent people will make you loose your job)
* When you arrested someone and locked that person up in a jail cell
* (Unofficial) Bribes, arrested players may try to bribe you, scam is allowed here so be sure what you're doing, i.e require the money first
Advantages:
* Access to emergency lights (press 'H' quickly to toggle) in any vehicle
* Access to all law enforement vehicles
* Ability to arrest law breakers
* Ability to get paid instantly for killing a violent player, (consult /wanted and make sure the player you want to kill is marked as red and not orange or any other color)
]] },
{ "Prison guard", 1, [[
***********************************************************************
* Prison guard:
***********************************************************************
Where do I find this job:
* See "Police"
What do I need for this job:
* See "Police"
What do I do in this job:
* Travel to the prison located on the west side of Bayside Marina, (north of San Fierro)
* Guard the prisoners either by sitting in a tower with a sniper or by cruising over with a helicopter
* Kill anyone trying to escape
* Check visitors and let them in/out
* Organize activities for the prisoners
* Stop riots by throwing teargas or taze the prisoners
When do I get paid:
* You're not getting paid in money, only (nearly) free sadism towards the prisoners
Advantages:
* Free access to armored helicopters and boats
* You're in charge over the prisoners and your job is to force them to obey you
]] },
{ "Police chief", 1, [[
Police chiefs makes sure that players working for the law enforcement respects the laws themselves and has the ability to ban players from taking part of law related activities as a law enforcer, not anyone can be a police chief, you have to submit an application in the forum to grant access, see this link for more details:
https://forum.404rq.com/law-board/police-chief-center-topic/
To add or remove a new police chief (admins only)
* /addpc <nickname>
* /removepc <nickname>
To ban or unban a law enforcer (as police chief)
* /banfromlaw <nickname>
* /revokebanfromlaw <nickname>
]] },
{ "Police codes", 1, [[
A list of police codes used in role play situations:
10-4 Roger that
10-10 Off duty
10-14 Provide Escort
10-15 Prisoner in custody
10-23 Stand by
10-29 Check For Wanted (person, Vehicle Or Object)
10-97 Arrived At Scene
10-98 Assignment Completed
11-10 Take A Report
11-24 Abandoned Vehicle
11-25 Traffic Hazard
11-41 Ambulance Required
11-66 Defective Traffic Signals
11-78 Paramedics Dispatched
11-79 Accident- Ambulance Rolling
11-98 Officer Requires Help, Emergency]]},
{ "How to arrest", 1, [[
There are two ways:
A: Kill arrest:
* kill a violent player to arrest him/her
B: Traditional arrest
* Hit the suspect with your nightstick once
* If he insist in running, shoot him with your tazer to stop him first
]] },
{ "How do I know who's wanted?", 1, [[
Use the command /wanted to get a list of wanted players
* "violent time" is the time remaining in where you can perform a kill arrest
* "wanted level" indicates how "hot" a suspect are, the higher wanted level the more payment you get
What the colors mean:
* Names that appears in red are "violent" players, these may be kill arrested
* Names that appears in orange are "non violent", you may only perform a traditional arrest on them
* Names that appears in yellow are arrested players, you may only protect the law enforcer holding the suspect
* Names that appears in green are in prison, (time is seen here as well expressed as seconds left)
]] },
{ "Law chat", 1, [[
Law chat is a multi team chat visible to Government and Emergency service
* Usage: /e <message>
]] },
{ "Server staff", 1, [[
Read more about server staff and the different types of staff on this link:
https://forum.404rq.com/staff-applications/staff-applications-guidelines/
Report staff or players violating the server rules on this link:
https://forum.404rq.com/complaints-and-reports/complaints-user-reports-and-guidelines/
]] },
{ "Developers", 1, [[
Developers are the second highest rank available, listen to developers, respect their orders and requests or face a punishment. Remember, developers are always right. You can become a developer by invitation after contributing to the GTW-RPG project on Github:
https://github.com/404rq/GTW-RPG
]] },
{ "Criminals", 0 },
{ "How do I become a criminal", 1, [[
There are three common ways to become a criminal:
* By command: /criminal
* By GUI: press F5, then go criminal (press F5 again to close the GUI)
* By comitting a crime, i.e when your wanted level raise quickly or over a limit
]] },
{ "How do I rob a store", 1, [[
Enter any store and target a weapon at the cashier, if you intend to use a meele weapon or your fists you have to stand close to the cashier before starting the robbery.
There are many different stores that can be robbed
* 17 Skin shops
* 34 Fast food restaurants
* 3 Hardware shops
* 11 Ammu nation (at your own risk)
]] },
{ "Hijacking missions", 1, [[
Look for the flag blip on your map, locate the car in that location and enter it, deliver the car to the dropoff location and get paid. The more criminals fighthing about the car the money money you make]] },
{ "Mystery bags", 1, [[
Look for the question mark blip on the map, locate and pick up the bag in that location, it contains a happy surprise for criminals.]] },
{ "Turfs", 1, [[
Colored areas on the map are turfs, you can capture a turf by entering it as a criminal and member of a gang, (press F6 to join or create one). Once entering the turf it will start flashing if above requirements are fulfilled. You can see the time you have to protect the turf at the bottom of your screen, during that time you can not die or leave the turf, if you do you'll lose it.
Turfs gives you money each 10 minute while being online. The more turfs you own the more money you make.
Requirements:
* Being in the team criminal or gangster
* Being a member of a gang
]] },
{ "Gangsters", 1, [[
Players who die in a turf will be moved to the gangster team, it works just the same way as criminal team although criminals and gangsters can not see eachothers blips on the map, thus it's a great opportunity for a stealth attack. Gangsters can any time become a criminal again by command or by pressing F5.
]] },
{ "How to reduce wanted level", 1, [[
There are two ways to redcue your wanted level:
* Staying away from cops, the text showing your wanted level in the hud will be green if reducing and red if increasing, white means that you're violent and the wanted level remains constant until the violent time has counted down successfully
* Paying your fines, use /fine to see how much it will cost and follow the instructions on your screen to accept or reject, you can not pay a fine when a law enforcer is nearby.
Already arrested? don't worry there might still be hope:
* Offer to bribe the cop who arrested you, this is risky tho and they may scam you, scam is allowed during Bribery
In jail? don't worry there might still be hope:
* You can escape from jail, see the "Jail" section for more details
]] },
{ "Jail", 1, [[
The Jail is located on it's own island built by concre on top of
smaller rock islands behind the mountains just west about Bayside
Marina, this is a place full of hiding spots, a place where cops
and other law units can become prison guards and kill any criminal
trying to escape, (yes you can escape).
7 guard towers with rockets will fire at anything coming nearby
except for law units, unless they are trying to help a criminal
escape. The place is only reachable by boat or helicopter and
prison guards has multiple spawners for these vehicles around
jail.
To escape, you need to get far away from the jail, unnoticed and
survive both rockets and potential guards that may notice your
escape attempt, a successfull escape attempt will gice you 10
stars, (making it the worst crime you can commit).
Note that your weapons will be returned when you get released,
but not if you escaped from jail during the session.]] },
{ "Shops", 0 },
{ "Fast food restaurants", 1, [[
If you want to regain health but are far away from a hospital or
just wanna get fat we have 32 fast food restaurants for you, All
Clucki'n Bells, Burger shots and Well stack Pizza C.o are open
for you 24/7. Welcome.
Are you lazy? Try the new drive thru outside most burger shots.]] },
{ "Ammu nation", 1, [[
Protect yourself with a gun, the patriotic way. Ammu nation is the
best place to buy cheap weapons with 11 shops around the map, there
is also two special shops where you can buy the heavy stuff such as
Heat seeking rockets, bombs and grenades.]] },
{ "Skin and clothes shops", 1, [[
Six different chains and 17 shops allover the map, in case you want
to change your skin or jsut get a new look.]] },
{ "Gas stations", 1, [[
Buy fuel for your vehicles here.]] },
{ "Pay'n'spray", 1, [[
Are your car damaged? Then come in and we repair it for you for a
fair price, way cheaper than calling for a mechanic.]] },
{ "Mod shops", 1, [[
Want to mod your car? We have all the equiptment you need,
hydralics, nitrus, new colors, spoilers and other nice stuff.]] },
{ "Vending machines", 1, [[
If you see a vending machine walk up to it and press 'Enter' to buy
snacks and regain health.]] },
{ "Hardware shops", 1, [[
If you ever need a baseball bad, golf club, knife or other tools we
have them here.]] },
{ "Misc features", 0 },
{ "Command list", 1, [[
:: Animations ::
Key 'F10' -- Opens a GUI with all available animations
/chat -- Face expressions to chat
/cpr -- Do CPR on another player
/deal1 -- If you want to look like a drugdealer
/deal2
/deal3
/fatidle -- Look like a fat person
/getup -- Rise from the ground
/getupfront -- Rise forward from the ground
/gum -- Take a gum
/gumchew -- Chew a gum
/handcower -- Take cower using your hands
/handsup -- Handsup to follow the orders from a
law officer and prevent getting shot
/lean -- Lean towards a wall or a car
/lookaround -- Look around in place
/mourn -- Look sad (if someone dies maybe)
/sit -- Sit down on anything you want to sit on
/smoke -- Smoke a cigarette
/taxiwink -- Wink in a taxi
/tired -- Look tired
/turn180 -- Turn around
/urp -- Open ye mouth
/wave -- Wave to another player
* All animations can be interupted by walking forward at any time
:: General (keys) ::
F1 -- Toggle help
F2 -- Show the vehicle GUI where you
can manage your own vehicles.
F3 | /stats -- Show the stats window
F4 -- Use drugs
F5 -- Show the job management GUI, current job
stats and quick buttons to end your work
or become a criminal.
/endwork
/criminal -- (See job management GUI)
F6 -- Open group system, create a group/gang
and invite people, useful for turfning
or if you just want to chat privately.
F7 (admin) -- The admin panel (staff only)
F8 -- Show the console
F9 -- (nearby vehicle) open the vehicle trunk
F10 -- All available animations.
F11 -- The map over San Andreas
F12 -- Take a screenshot
B -- Show your phone
:: Bank ::
/give <player_nick> <amount> -- Transfer money to another
player pocket to pocket
:: Police ::
/e <message> -- Say something in law chat
/wanted -- Shows a list of all wanted players
/release -- Release a suspect you are holding
:: Criminals ::
/fine -- Attempts to pay a fine to get rid
of your wanted level. Warning! it's
expensive and may fail.
/sell -- Start/stop selling drugs
:: Public transportation ::
/taxi -- Call for a taxi
/bus -- Let the busdrivers know youre waiting
/pilot -- Call for a pilot in helicopter
/train -- Let the train drivers know youre waiting
/tram -- Let the tramdrivers know youre waiting
:: Staff ::
/gv -- Spawn a vehicle
/setpos x y z -- Move anywhere on the map
/mute <player_nick> <time_in_minutes> <reason>
/jail <player_nick> <time_in_seconds> <reason>
/ban <player_nick> <time_in_minutes> <reason>
]]},
{ "House system", 1, [[
Buy a house as a place to relax, a place to hide from the law, hide
your money and weapons or as a base for your gang. The posibilities
are infinite. Houses are available in a wide price range allover the
map, starting from just 500$ for a shed countryside up to 1'000'000$
for a luxury manson in north Los Santos or downtown San Fierro and
everything between.
You may also rent your house as a landlord or rent from someone else,
all this will be configured in the house GUI which is simple to
understand, type: /househelp for more info or ask anyone else.]] },
{ "The phone", 1, [[
Press 'B' to open your nokia phone which you may use to listen to
radio, send SMS to other players or to call for services. ]] },
{ "Trains", 1, [[
Avoid driving your car on the railroads, you may getting hit by a
train, you may also see trams in San Fierro so be careful while driving
there as well, they won't stop for you, trains and trams is also a great
way to travel around the map for free.]] },
{ "Business system", 1, [[
There are a lot of business properties to invest in around the map, a
business start's to generate money after about two weeks, after that
time it has produced as much money as you payed for buying it. Busniess
are available in all price classes but may be hard to find thought.]] },
{ "Bank system", 1, [[
Safe your money by putting them into the bank, ATM's and banks are all
useful to deposit, withdraw or send money to other players. ATM's and
banks are marked with a dollar sign on the map.]] },
{ "Hospitals", 1, [[
There are many hospitals around the map, you can regain health at nay
hospital quick and for a fair price, you will also respawn at nearest
hospital if you die. Hospitals are safe zones and it's strictly forbidden
to kill or damage people or vehicles near a hospital.]] },
}
|
require('lsp_signature').setup({
handler_opts = {
border = 'none',
},
-- floating_window_above_cur_line = true,
hint_prefix = ' ',
zindex = 50,
})
|
object_building_player_construction_construction_player_diner = object_building_player_construction_shared_construction_player_diner:new {
}
ObjectTemplates:addTemplate(object_building_player_construction_construction_player_diner, "object/building/player/construction/construction_player_diner.iff")
|
---@class GridCollisionClass @enum
GridCollisionClass = {}
---
--- 0
GridCollisionClass.COLLISION_NONE = 0
---
--- 1
GridCollisionClass.COLLISION_PIT = 1
---
--- 2
GridCollisionClass.COLLISION_OBJECT = 2
---
--- 3
GridCollisionClass.COLLISION_SOLID = 3
---
--- 4
GridCollisionClass.COLLISION_WALL = 4
---
--- 5
GridCollisionClass.COLLISION_WALL_EXCEPT_PLAYER = 5
return GridCollisionClass
|
workspace "Akame"
architecture "x64"
startproject "imGui"
configurations
{
"Debug",
"Release"
}
ComDir={}
ComDir["AkameCore"]="%{wks.location}/AkameCore/"
IncludeDir={}
IncludeDir["vendor"]="%{wks.location}/AkameCore/vendor"
IncludeDir["glad"]="%{IncludeDir.vendor}/glad-akame-"
IncludeDir["json"]="%{IncludeDir.vendor}/single_include/nlohmann"
IncludeDir["GLFW"]="%{IncludeDir.vendor}/glfw/include"
IncludeDir["imGui"]="%{IncludeDir.vendor}/imGui"
IncludeDir["assimp"]="%{IncludeDir.vendor}/assimp/include"
IncludeDir["AkameCore"]="%{wks.location}/AkameCore/Header Files"
IncludeDir["ECS"]="%{wks.location}/ECS/HeaderFiles"
IncludeDir["pugixml"]="%{IncludeDir.vendor}/pugixml/src"
IncludeDir["spdlog"]="%{IncludeDir.vendor}/spdlog/include"
IncludeDir["Physx"]=[[%{IncludeDir.vendor}/PhysX/physx/include;
%{IncludeDir.vendor}/PhysX/physx/source/physxextensions/src;
%{IncludeDir.vendor}/PhysX/pxshared/include;
%{IncludeDir.vendor}/PhysX/physx/source/foundation/include;
%{IncludeDir.vendor}/PhysX/physx/snippets]]
LibraryDir={}
LibraryDir["GLFW"]="%{IncludeDir.vendor}/glfw/builds/src/%{cfg.buildcfg}"
LibraryDir["assimp"]="%{IncludeDir.vendor}/assimp/lib/%{cfg.buildcfg}"
LibraryDir["AkameCore"]="%{wks.location}/AkameCore/bin/%{cfg.buildcfg}"
LibraryDir["Physx"]="%{IncludeDir.vendor}/PhysX/physx/bin/win.x86_64.vc142.md/%{cfg.buildcfg}"
LibraryDir["imGui"]="%{IncludeDir.vendor}/imGui/%{cfg.system}/%{cfg.buildcfg}"
LibraryDir["pugixml"]="%{IncludeDir.vendor}/pugixml/src/bin/%{cfg.buildcfg}"
LiblinksRelease={
"glfw3dll.lib",
"opengl32.lib",
"imGui.lib",
"assimp-vc142-mt.lib",
"AkameCore.lib",
"PhysX_64.lib",
"PhysXCommon_64.lib",
"PhysXCooking_64.lib",
"PhysXFoundation_64.lib",
"PhysXPvdSDK_static_64.lib",
"PhysXExtensions_static_64.lib"
}
LiblinksDebug={
"glfw3dll.lib",
"opengl32.lib",
"imGui.lib",
"assimp-vc142-mtd.lib",
"AkameCore.lib",
"PhysX_64.lib",
"PhysXCommon_64.lib",
"PhysXCooking_64.lib",
"PhysXFoundation_64.lib",
"PhysXPvdSDK_static_64.lib",
"PhysXExtensions_static_64.lib"
}
AllIncludeDir="%{IncludeDir.GLFW};%{IncludeDir.json};%{IncludeDir.glad};%{IncludeDir.vendor};%{IncludeDir.imGui};%{IncludeDir.assimp};%{IncludeDir.ECS};%{IncludeDir.AkameCore};%{IncludeDir.pugixml};%{IncludeDir.spdlog};"..IncludeDir["Physx"]
AllDebugEnvPaths="PATH=$(SolutionDir)/AkameCore/vendor/PhysX/physx/bin/win.x86_64.vc142.md/%{cfg.buildcfg};$(SolutionDir)/AkameCore/vendor/assimp/bin/%{cfg.buildcfg};$(SolutionDir)/AkameCore/bin/%{cfg.buildcfg};$(SolutionDir)/AkameCore/vendor/glfw/builds/src/%{cfg.buildcfg}"
startproject "Test"
include "premakeconfig/AkameCore.lua"
include "premakeconfig/ECS.lua"
include "premakeconfig/AkameEngine.lua"
group "Dependencies"
include "premakeconfig/imGui.lua"
include "premakeconfig/Dependencies.lua"
group ""
group "Samples"
include "premakeconfig/Test.lua"
include "premakeconfig/RenderStressTest.lua"
include "premakeconfig/Model.lua"
include "premakeconfig/RandomStuffTest.lua"
include "premakeconfig/AnimationTest.lua"
group ""
group "tools"
include "premakeConfig/AkameExporter"
group ""
|
-- Copyright (C) Yichun Zhang (agentzh)
local ffi = require "ffi"
local base = require "resty.core.base"
local C = ffi.C
local ffi_string = ffi.string
local ngx = ngx
local type = type
local error = error
local tostring = tostring
local get_string_buf = base.get_string_buf
local subsystem = ngx.config.subsystem
local ngx_lua_ffi_escape_uri
local ngx_lua_ffi_unescape_uri
local ngx_lua_ffi_uri_escaped_length
local NGX_ESCAPE_URI = 0
local NGX_ESCAPE_URI_COMPONENT = 2
local NGX_ESCAPE_MAIL_AUTH = 6
if subsystem == "http" then
ffi.cdef[[
size_t ngx_http_lua_ffi_uri_escaped_length(const unsigned char *src,
size_t len, int type);
void ngx_http_lua_ffi_escape_uri(const unsigned char *src, size_t len,
unsigned char *dst, int type);
size_t ngx_http_lua_ffi_unescape_uri(const unsigned char *src,
size_t len, unsigned char *dst);
]]
ngx_lua_ffi_escape_uri = C.ngx_http_lua_ffi_escape_uri
ngx_lua_ffi_unescape_uri = C.ngx_http_lua_ffi_unescape_uri
ngx_lua_ffi_uri_escaped_length = C.ngx_http_lua_ffi_uri_escaped_length
elseif subsystem == "stream" then
ffi.cdef[[
size_t ngx_stream_lua_ffi_uri_escaped_length(const unsigned char *src,
size_t len, int type);
void ngx_stream_lua_ffi_escape_uri(const unsigned char *src, size_t len,
unsigned char *dst, int type);
size_t ngx_stream_lua_ffi_unescape_uri(const unsigned char *src,
size_t len, unsigned char *dst);
]]
ngx_lua_ffi_escape_uri = C.ngx_stream_lua_ffi_escape_uri
ngx_lua_ffi_unescape_uri = C.ngx_stream_lua_ffi_unescape_uri
ngx_lua_ffi_uri_escaped_length = C.ngx_stream_lua_ffi_uri_escaped_length
end
ngx.escape_uri = function (s, esc_type)
if type(s) ~= 'string' then
if not s then
s = ''
else
s = tostring(s)
end
end
if esc_type == nil then
esc_type = NGX_ESCAPE_URI_COMPONENT
else
if type(esc_type) ~= 'number' then
error("\"type\" is not a number", 3)
end
if esc_type < NGX_ESCAPE_URI or esc_type > NGX_ESCAPE_MAIL_AUTH then
error("\"type\" " .. esc_type .. " out of range", 3)
end
end
local slen = #s
local dlen = ngx_lua_ffi_uri_escaped_length(s, slen, esc_type)
-- print("dlen: ", tonumber(dlen))
if dlen == slen then
return s
end
local dst = get_string_buf(dlen)
ngx_lua_ffi_escape_uri(s, slen, dst, esc_type)
return ffi_string(dst, dlen)
end
ngx.unescape_uri = function (s)
if type(s) ~= 'string' then
if not s then
s = ''
else
s = tostring(s)
end
end
local slen = #s
local dlen = slen
local dst = get_string_buf(dlen)
dlen = ngx_lua_ffi_unescape_uri(s, slen, dst)
return ffi_string(dst, dlen)
end
return {
version = base.version,
}
|
AddCSLuaFile()
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.PrintName = ""
ENT.Author = ""
ENT.AutomaticFrameAdvance = true
ENT.Spawnable = false
ENT.AdminSpawnable = false
function ENT:Initialize()
self:SetSolid(SOLID_NONE)
self:SetNotSolid(true)
self:DrawShadow(false)
self:SetMoveType(MOVETYPE_NONE)
self:SetCollisionBounds( Vector(0, 0, 0), Vector(0, 0, 0) )
local phy = self:GetPhysicsObject()
if phy:IsValid() then
phy:EnableCollisions(false)
phy:EnableDrag(false)
phy:SetMass(0)
phy:Sleep()
end
end
|
-----------------------------------
-- Area: Western Altepa Desert
-- Mob: Western Sphinx
-----------------------------------
local ID = require("scripts/zones/Western_Altepa_Desert/IDs")
require("scripts/globals/missions")
require("scripts/globals/status")
-----------------------------------
function onMobInitialize(mob)
mob:setMobMod(tpz.mobMod.IDLE_DESPAWN, 180)
end
function onMobSpawn(mob)
DespawnMob(mob:getID(), 180)
end
function onMobDeath(mob, player, isKiller)
if
GetMobByID(ID.mob.EASTERN_SPHINX):isDead() and
GetMobByID(ID.mob.WESTERN_SPHINX):isDead() and
player:getCurrentMission(BASTOK) == tpz.mission.id.bastok.RETURN_OF_THE_TALEKEEPER and
player:getCharVar("MissionStatus") == 2
then
player:setCharVar("Mission6-1MobKilled", 1)
end
end
|
Global( "PlayerHP", {} )
function PlayerHP:Init(anID)
self.playerID = anID
self.unitParams = {}
self.objParams = {}
self.shield = 0
self.hp = 0
self.lastShield = -1
self.lastHP = -1
--PlayerWounds.lua не достаточно, тк EVENT_UNIT_WOUNDS_COMPLEXITY_CHANGED не приходит на руническое проклятье и тд
self.woundsComplexity = 0
self.lastWoundsComplexity = -1
self.eventFunc = self:GetEventFunc()
self.base = copyTable(PlayerBase)
self.base:Init()
self:RegisterEvent(anID)
end
function PlayerHP:ClearLastValues()
self.lastHP = -1
self.lastShield = -1
self.lastWoundsComplexity = -1
end
function PlayerHP:SubscribeTargetGui(aLitener)
self:ClearLastValues()
self.base:SubscribeTargetGui(self.playerID, aLitener, self.eventFunc)
end
function PlayerHP:UnsubscribeTargetGui()
self.base:UnsubscribeTargetGui()
end
function PlayerHP:SubscribeRaidGui(aLitener)
self:ClearLastValues()
self.base:SubscribeRaidGui(self.playerID, aLitener, self.eventFunc)
end
function PlayerHP:UnsubscribeRaidGui()
self.base:UnsubscribeRaidGui()
end
function PlayerHP:TryDestroy()
if self.base:CanDestroy() then
self:UnRegisterEvent()
return true
end
return false
end
function PlayerHP:UpdateValueIfNeeded()
local res = nil
local profile = GetCurrentProfile()
if self.shield ~= self.lastShield then
self.lastShield = self.shield
res = profile.raidFormSettings.showShieldButton and self.base.guiRaidListener and self.base.guiRaidListener.listenerShield(self.shield, self.base.guiRaidListener)
res = profile.targeterFormSettings.showShieldButton and self.base.guiTargetListener and self.base.guiTargetListener.listenerShield(self.shield, self.base.guiTargetListener)
end
if self.hp ~= self.lastHP then
self.lastHP = self.hp
res = self.base.guiRaidListener and self.base.guiRaidListener.listenerHP(self.hp, self.base.guiRaidListener)
res = self.base.guiTargetListener and self.base.guiTargetListener.listenerHP(self.hp, self.base.guiTargetListener)
if profile.raidFormSettings.woundsShowButton or profile.targeterFormSettings.woundsShowButton then
self.woundsComplexity = 100*(1-1/((1+unit.GetRuneWoundsComplexity(self.playerID)/10)*(unit.GetRelativeWoundsComplexity(self.playerID)))) or 0
if self.hp == 100 then
self.woundsComplexity = 0
end
if self.woundsComplexity ~= self.lastWoundsComplexity then
self.lastWoundsComplexity = self.woundsComplexity
res = profile.raidFormSettings.woundsShowButton and self.base.guiRaidListener and self.base.guiRaidListener.listenerWounds(self.woundsComplexity, self.base.guiRaidListener)
res = profile.targeterFormSettings.woundsShowButton and self.base.guiTargetListener and self.base.guiTargetListener.listenerWounds(self.woundsComplexity, self.base.guiTargetListener)
end
end
end
end
function PlayerHP:GetEventFunc()
return function(aParams)
local playerID = aParams.unitId or aParams.id
if isExist(playerID) then
local healthInfo = object.GetHealthInfo(playerID)
self.shield = healthInfo and healthInfo.additionalPercents
self.hp = healthInfo and healthInfo.valuePercents
end
end
end
function PlayerHP:RegisterEvent(anID)
self.unitParams.unitId = anID
common.RegisterEventHandler(self.eventFunc, "EVENT_UNIT_HEALTH_CHANGED", self.unitParams)
self.objParams.id = anID
common.RegisterEventHandler(self.eventFunc, "EVENT_OBJECT_HEALTH_CHANGED", self.objParams)
if g_debugSubsrb then
self.base:reg("hp")
self.base:reg("hp")
end
end
function PlayerHP:UnRegisterEvent()
common.UnRegisterEventHandler(self.eventFunc, "EVENT_UNIT_HEALTH_CHANGED", self.unitParams)
common.UnRegisterEventHandler(self.eventFunc, "EVENT_OBJECT_HEALTH_CHANGED", self.objParams)
if g_debugSubsrb then
self.base:unreg("hp")
self.base:unreg("hp")
end
end
|
--[[
Copyright 2012 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
local fs = require('fs')
local os = require('os')
local table = require('table')
local string = require('string')
local path = require('path')
local Object = require('core').Object
local async = require('async')
local misc = require('./util/misc')
local logging = require('logging')
local request = require('./protocol/request')
local CrashReporter = Object:extend()
function CrashReporter:initialize(binary, bundle, platform, dump_dir, endpoints)
self.binary = binary
self.bundle = bundle
self.platform = platform
self.dump_dir = dump_dir
self.endpoints = endpoints
end
function CrashReporter:submit(callback)
local productName = virgo.default_name:gsub('%-', '%%%-')
local function send_and_delete(file, callback)
local mtime
local options = {headers={}}
async.series({
function(callback)
fs.stat(file, function(err, stats)
if err then
logging.errorf("couldn't stat file: %s because %s.", self.upload, tostring(err))
return callback(err)
end
mtime = stats.mtime
options.headers["Content-Type"] = "application/octet-stream"
options.headers['Content-Length'] = stats.size
callback()
end)
end,
function(callback)
local querytable = {
binary_version = self.binary,
bundle_version = self.bundle,
platform = self.platform,
time = mtime
}
--TODO: add to luvit querstring.stringify like nodes
local querystring = ""
for key,value in pairs(querytable) do
querystring = string.format('%s%s=%s&', querystring, key, value)
end
local req_options = misc.merge({
method = "POST",
path = string.format("/agent-crash-report?%s", querystring),
endpoints = self.endpoints,
upload = file
}, self._options, options)
request.makeRequest(req_options, callback)
end,
function(callback)
logging.infof('Upload crash dump, now unlinking: %s', file)
fs.unlink(file, callback)
end
}, function(err, res)
if err then
logging.errorf('Error uploading crash report: %s because %s', file, tostring(err))
end
callback(err)
end)
end
fs.readdir(self.dump_dir, function (err, files)
if err then
return callback(err)
end
local reports = {}
for _, file in ipairs(files) do
if string.find(file, productName .. "%-crash%-report-.+.dmp") ~= nil then
logging.infof('Found previous crash report %s/%s', self.dump_dir, file)
table.insert(reports, path.join(self.dump_dir, file))
end
end
async.forEach(reports, send_and_delete, callback)
end)
end
local exports = {}
exports.CrashReporter = CrashReporter
return exports
|
local container = 'backpack' --write your main bp's name
local InboxFull = true -- don't touch
local BpsCount = 6 -- amount of your stacked bps, these have to be stacked properly and without any items inside
local CurItems = 0 -- don't touch
local BpFull = false -- don't touch
local Logout = false -- I have set distance statue as logout place, change in waypoints last leaver place to set it for yourcelf
--- not all items are listed in there, because I was nat selling all of them and I was wearing boh and rh, so it would mess up some
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "SellMagic") then
Walker.Stop()
Self.SayToNpc("Hi")
sleep(math.random(1000, 1500))
Self.SayToNpc("trade")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Wand of Inferno")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Wand of Cosmic Energy")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Wand of Decay")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Wand of Draconia")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Wand of Starstorm")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Wand of Dragonbreath")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Power Ring")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Magic Light Wand")
sleep(math.random(1000, 1500))
Walker.Start()
elseif (labelName == "SellRest") then
Walker.Stop()
Self.SayToNpc("Hi")
sleep(math.random(1000, 1500))
Self.SayToNpc("trade")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Blue Robe")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Broadsword")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Crown Armor")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Crown Helmet")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Crown Legs")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Crown Shield")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Crusader Helmet")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Dragon Shield")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Fire Axe")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Fire Sword")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Guardian Shield")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Ice Rapier")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Obsidian Lance")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("Spike Sword")
sleep(math.random(1000, 1500))
Self.ShopSellAllItems("War Hammer")
sleep(math.random(1000, 1500))
Walker.Start()
elseif (labelName == "DepositGold") then
Walker.Stop()
Self.SayToNpc("Hi")
sleep(math.random(2000, 2500))
Self.SayToNpc("deposit all")
sleep(math.random(2000, 2500))
Self.SayToNpc("yes")
sleep(math.random(2000, 2500))
Walker.Start()
elseif (labelName == "GetItems") then
CurItems = 0
BpFull = false
Self.OpenLocker()
withdraw()
elseif (labelName == "Start") then
Self.CloseContainers()
Self.OpenMainBackpack(false)
elseif (labelName == "WaitForNext") then
if(InboxFull == false) then
if(Logout == true) then
gotoLabel("Logout")
else
Walker.Stop()
end
else
gotoLabel("Start")
end
end
end
function withdraw()
local cfrom = Container.New('Your Inbox')
local cto = Container.New(container)
while not cfrom:isOpen() do
cfrom = Container.New('Your Inbox')
local dp = Container.New('Locker')
for mailspot, touse in dp:iItems() do
if touse.id == 12902 then
dp:UseItem(mailspot, true)
wait(500, 1700)
end
end
end
if cfrom:isOpen() and cto:isOpen() then
while (cfrom:ItemCount() >= 0) do
local slot = 0
if(cfrom:ItemCount() == 0) then
InboxFull = false
break
else
InboxFull = true
end
local items = cfrom:GetItemData(slot)
if Self.Cap() - Item.GetWeight(items.id) < 1 then
error('You need '..math.floor((Item.GetWeight(items.id)+1)-Self.Cap())..' cap to pick this item.')
break
end
while Self.Cap() - Item.GetWeight(items.id) >= 1 do
if not cto:isFull() then
if (CurItems < (BpsCount * 19)) then
cfrom:MoveItemToContainer(slot, cto:Index(), 19, 100)
wait(300, 1200)
CurItems = CurItems + 1
break
else
BpFull = true
break
end
else
for spot, item in cto:iItems() do
if Item.isContainer(item.id) then
cto:UseItem(spot, true)
wait(500, 1600)
end
end
end
end
if (BpFull == true) then
error('Your bp is full.')
break
end
end
end
end
|
local ipairs = ipairs
local tab_insert = table.insert
local tab_new = require('resty.core.base').new_tab
local balancer = require('apicast.balancer')
local UpstreamSelector = require('upstream_selector')
local Request = require('request')
local Rule = require('rule')
local _M = require('apicast.policy').new('Routing policy')
local new = _M.new
local function init_rules(config)
if not config or not config.rules then return tab_new(0, 0) end
local res = tab_new(#config.rules, 0)
for _, config_rule in ipairs(config.rules) do
local rule, err = Rule.new_from_config_rule(config_rule)
if rule then
tab_insert(res, rule)
else
ngx.log(ngx.WARN, err)
end
end
return res
end
function _M.new(config)
local self = new(config)
self.upstream_selector = UpstreamSelector.new()
self.rules = init_rules(config)
return self
end
function _M:content(context)
-- This should be moved to the place where the context is started, so other
-- policies can use it.
context.request = context.request or Request.new()
-- Once request is in the context, we should move this to wherever the jwt is
-- validated.
context.request:set_validated_jwt(context.jwt)
local upstream = self.upstream_selector:select(self.rules, context)
if upstream then
upstream:call(context)
else
return nil, 'no upstream'
end
end
_M.balancer = balancer.call
return _M
|
if not _G.THREATLIB_LOAD_MODULES then return end -- only load if LibThreatClassic2.lua allows it
if not LibStub then return end
local ThreatLib, MINOR = LibStub("LibThreatClassic2", true)
if not ThreatLib then return end
local BROODLORD_LASHLAYER_ID = 12017
local KNOCK_AWAY_ID = 18670
ThreatLib:GetModule("NPCCore-r"..MINOR):RegisterModule(BROODLORD_LASHLAYER_ID, function(BroodlordLashlayer)
function BroodlordLashlayer:Init()
self:RegisterCombatant(BROODLORD_LASHLAYER_ID, true)
self:RegisterSpellDamageHandler(BROODLORD_LASHLAYER_ID, KNOCK_AWAY_ID, self.KnockAway)
end
function BroodlordLashlayer:KnockAway(sourceGUID, unitId)
self:ModifyThreat(sourceGUID, unitId, 0.5, 0)
end
end)
|
--[[
--==Contributers==--
- Rami Sabbagh (RamiLego4Game)
]]
--TREE-2 Events System
local reg = {} --The list of registered events
local e = {} --The events system
--- Register a new function to be called at a specific event.
--P <name> (String): The name of the event.
--P <func> (Function): The function to register.
function e:registerEvent(name,func)
--Arguments type verification.
if type(name) ~= "string" then return error("Event name must be a string, provided: "..type(name)) end
if type(func) ~= "function" then return error("Event function must be a string, provided: "..type(func)) end
if not reg[name] then reg[name] = {} end --Create a new table for this event name.
table.insert(reg[name],func) --Add the function.
end
--- Trigger the functions register for a specific event.
--P <name> (String): The name of the event.
--P [...]: Any arguments to pass to the functions.
--
--R reponds (Table): The return values of the functions.
function e:triggerEvent(name,...)
--Argument type verification.
if type(name) ~= "string" then return error("Event name must be a string, provided: "..type(name)) end
if not reg[name] then return {} end --No functions are registered for this event.
local responds = {}
for id,func in ipairs(reg[name]) do
local respond = {func(...)} --Call each function, in the order they are registered with.
table.insert(responds,respond) --Add the repond to the responds list.
end
return responds --Return the responds list.
end
return e
|
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
dofile(modpath.."/netherman.lua")
--dofile(modpath.."/dragon.lua")
|
-- Copyright (c) 2010-2011 by Robert G. Jakabosky <bobby@neoawareness.com>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
local setmetatable = setmetatable
local print = print
local nixio = require"nixio"
local ev = require"ev"
-- important SSL error codes
local SSL_ERROR_SSL = 1
local SSL_ERROR_WANT_READ = 2
local SSL_ERROR_WANT_WRITE = 3
local SSL_ERROR_WANT_X509_LOOKUP = 4
local SSL_ERROR_SYSCALL = 5
local SSL_ERROR_ZERO_RETURN = 6
local SSL_ERROR_WANT_CONNECT = 7
local SSL_ERROR_WANT_ACCEPT = 8
local function sock_setsockopt(self, level, option, value)
return self.sock.socket:setsockopt(level, option, value)
end
local function sock_getsockopt(self, level, option)
return self.sock.socket:getsockopt(level, option)
end
local function sock_getpeername(self)
return self.sock.socket:getpeername()
end
local function sock_getsockname(self)
return self.sock.socket:getsockname()
end
local function sock_shutdown(self, read, write)
if read then
-- stop reading from socket, we don't want any more data.
self.io_read:stop(self.loop)
end
end
local function sock_close(self)
self.is_closing = true
if not self.write_buf or self.has_error then
local loop = self.loop
if self.write_timer then
self.write_timer:stop(loop)
end
self.io_write:stop(loop)
self.io_read:stop(loop)
self.sock:shutdown()
end
end
local function sock_block_read(self, block)
-- block/unblock read
if block ~= self.read_blocked then
self.read_blocked = block
if block then
self.io_read:stop(self.loop)
else
self.io_read:start(self.loop)
end
end
end
local function sock_handle_error(self, err, errno)
local handler = self.handler
local errFunc = handler and handler.handle_error
self.has_error = true -- mark socket as bad.
sock_close(self)
if err == nil then
if errno == SSL_ERROR_SYSCALL then
errno = nixio.errno()
end
err = 'TLS error code: ' .. tostring(errno)
end
if errFunc then
errFunc(handler, err)
else
print('socket error:', err)
end
end
local function sock_set_write_timeout(self, timeout)
local timer = self.write_timer
-- default to no write timeout.
timeout = timeout or -1
self.write_timeout = timeout
-- enable/disable timeout
local is_disable = (timeout <= 0)
-- create the write timer if one is needed.
if not timer then
-- don't create a disabled timer.
if is_disable then return end
timer = ev.Timer.new(function()
sock_handle_error(self, 'write timeout')
end, timeout, timeout)
self.write_timer = timer
-- enable timer if socket is write blocked.
if self.write_blocked then
timer:start(self.loop)
end
return
end
-- if the timer should be disabled.
if is_disable then
-- then disable the timer
timer:stop(self.loop)
return
end
-- update timeout interval and start the timer if socket is write blocked.
if self.write_blocked then
timer:again(self.loop, timeout)
end
end
local function sock_reset_write_timeout(self)
local timeout = self.write_timeout
local timer = self.write_timer
-- write timeout is disabled.
if timeout < 0 or timer == nil then return end
-- update timeout interval
timer:again(self.loop, timeout)
end
local function sock_send_data(self, buf)
local sock = self.sock
local is_blocked = false
local num, errno, err = sock:send(buf)
if not num then
-- got timeout error block writes.
if num == false or SSL_ERROR_WANT_WRITE then
-- got EAGAIN
is_blocked = true
else -- data == nil
-- report error
sock_handle_error(self, err, errno)
return nil, err
end
else
-- trim sent data.
if num < #buf then
-- remove sent bytes from buffer.
buf = buf:sub(num+1)
-- partial send, not enough socket buffer space, so blcok writes.
is_blocked = true
else
self.write_buf = nil
if self.is_closing then
-- write buffer is empty, finish closing socket.
sock_close(self)
return num, 'closed'
end
end
end
-- block/un-block write events.
if is_blocked ~= self.write_blocked then
self.write_blocked = is_blocked
if is_blocked then
self.write_buf = buf
self.io_write:start(self.loop)
-- socket is write blocked, start write timeout
sock_reset_write_timeout(self)
return num, 'blocked'
else
local loop = self.loop
self.io_write:stop(loop)
-- no data to write, so stop timer.
if self.write_timer then
self.write_timer:stop(loop)
end
end
elseif is_blocked then
-- reset write timeout, since some data was written and the socket is still write blocked.
sock_reset_write_timeout(self)
end
return num
end
local function sock_send(self, data)
-- only process send when given data to send.
if data == nil or #data == 0 then return end
local num, err
local buf = self.write_buf
if buf then
buf = buf .. data
else
buf = data
end
if not self.write_blocked then
num, err = sock_send_data(self, buf)
else
self.write_buf = buf
-- let the caller know that the socket is blocked and data is being buffered
err = 'blocked'
end
-- always return the size of the data passed in, since un-sent data will be buffered
-- for sending later.
return #data, err
end
local function sock_handle_connected(self)
local handler = self.handler
self.is_connecting = false
if handler then
local handle_connected = handler.handle_connected
if handle_connected then
handle_connected(handler)
end
end
end
local function sock_recv_data(self)
local read_len = self.read_len
local read_max = self.read_max
local handler = self.handler
local sock = self.sock
local len = 0
local is_connecting = self.is_connecting
repeat
local data, errno, err = sock:recv(read_len)
if not data then
if data == false then
-- check if we where in the connecting state.
if is_connecting then
is_connecting = false
sock_handle_connected(self)
end
elseif errno ~= SSL_ERROR_WANT_READ then
-- report error
sock_handle_error(self, err, errno)
return false, err
end
-- no data
return true
end
-- check if the other side shutdown there send stream
if #data == 0 then
-- report socket closed
sock_handle_error(self, 'closed')
return false, 'closed'
end
-- check if we where in the connecting state.
if is_connecting then
is_connecting = false
sock_handle_connected(self)
end
-- pass read data to handler
len = len + #data
err = handler:handle_data(data)
if err then
-- report error
sock_handle_error(self, err)
return false, err
end
until len >= read_max and not self.read_blocked or self.shutdown_waiting
return true
end
local function sock_sethandler(self, handler)
self.handler = handler
if handler and not self.is_connecting then
-- raise 'connected' event for the new handler
sock_handle_connected(self)
end
end
local function sock_is_closed(self)
return self.is_closing
end
local function sock_handshake(self, is_client)
local stat, code
if is_client then
stat, code = self.sock:connect()
else
stat, code = self.sock:accept()
end
if stat then
self.is_handshake_complete = true
return true, code
else
self.is_handshake_complete = false
return false, code
end
end
local tls_sock_mt = {
is_tls = true,
send = sock_send,
getsockopt = sock_getsockopt,
setsockopt = sock_setsockopt,
getsockname = sock_getsockname,
getpeername = sock_getpeername,
shutdown = sock_shutdown,
close = sock_close,
block_read = sock_block_read,
set_write_timeout = sock_set_write_timeout,
sethandler = sock_sethandler,
is_closed = sock_is_closed,
}
tls_sock_mt.__index = tls_sock_mt
local function sock_tls_wrap(self, tls, is_client)
local loop = self.loop
-- create TLS context
tls = tls or nixio.tls(is_client and 'client' or 'server')
-- convertion normal socket to TLS
setmetatable(self, tls_sock_mt)
self.sock = tls:create(self.sock)
-- create callback closure
local write_cb = function()
local num, err = sock_send_data(self, self.write_buf)
if self.write_buf == nil and not self.is_closing then
-- write buffer is empty and socket is still open,
-- call drain callback.
local handler = self.handler
local drain = handler.handle_drain
if drain then
local err = drain(handler)
if err then
-- report error
sock_handle_error(self, err)
end
end
end
end
local read_cb = function()
sock_recv_data(self)
end
-- create callback for TLS handshake
self.is_handshake_complete = false
-- block writes until handshake is completed, to force queueing of sent data.
self.write_blocked = true
self.read_blocked = false -- no need to block reads.
local handshake_cb = function()
local is_handshake_complete, code = sock_handshake(self, is_client)
if is_handshake_complete then
self.write_blocked = false
self.io_write:stop(loop)
-- install normal read/write callbacks
self.io_write:callback(write_cb)
self.io_read:callback(read_cb)
-- check if we where in the connecting state.
if self.is_connecting then
sock_handle_connected(self)
end
-- check for pending write data.
local buf = self.write_buf
if buf then
sock_send_data(self, buf)
end
else
if code == SSL_ERROR_WANT_WRITE then
self.io_write:start(loop)
elseif code == SSL_ERROR_WANT_READ then
self.io_write:stop(loop)
else
-- report error
sock_handle_error(self, "SSL_Error: code=" .. code)
end
end
end
self.io_write:callback(handshake_cb)
self.io_read:callback(handshake_cb)
-- start TLS handshake
handshake_cb()
-- always keep read events enabled.
self.io_read:start(loop)
return self
end
module(...)
-- export
wrap = sock_tls_wrap
|
local K, C, L, _ = unpack(select(2, ...))
if C["chat"].enable ~= true or C["chat"].damage_meter_spam ~= true then return end
local ipairs = ipairs
local match = string.match
local time = time
local strsplit = strsplit
local UIParent = UIParent
-- Merge damage meter spam(SpamageMeters by Wrug and Cybey)
local firstLines = {
"^Recount - (.*)$", -- Recount
"^Skada: (.*) for (.*):$", -- Skada enUS
"^Skada: (.*) für (.*):$", -- Skada deDE
"^Skada: (.*) pour (.*):$", -- Skada frFR
"^Отчёт Skada: (.*), с (.*):$", -- Skada ruRU
"^Skada: (.*) por (.*):$", -- Skada esES/ptBR
"^Skada: (.*) per (.*):$", -- Skada itIT
"^(.*) 의 Skada 보고 (.*):$", -- Skada koKR
"^Skada报告(.*)的(.*):$", -- Skada zhCN
"^Skada:(.*)來自(.*):$", -- Skada zhTW
"^(.*) Done for (.*)$", -- TinyDPS enUS
"^(.*) für (.*)$", -- TinyDPS deDE
"데미지량 -(.*)$", -- TinyDPS koKR
"힐량 -(.*)$", -- TinyDPS koKR
"Урон:(.*)$", -- TinyDPS ruRU
"Исцеление:(.*)$", -- TinyDPS ruRU
"^Numeration: (.*) - (.*)$", -- Numeration
"alDamageMeter : (.*)$", -- alDamageMeter
"^Details! Report for (.*)$" -- Details!
}
local nextLines = {
"^(%d+)\. (.*)$", -- Recount, Details! and Skada
"^(.*) (.*)$", -- Additional Skada
"^[+-]%d+.%d", -- Numeration deathlog details
"^(%d+). (.*):(.*)(%d+)(.*)(%d+)%%(.*)%((%d+)%)$" -- TinyDPS
}
local meters = {}
local events = {
"CHAT_MSG_CHANNEL",
"CHAT_MSG_GUILD",
"CHAT_MSG_OFFICER",
"CHAT_MSG_PARTY",
"CHAT_MSG_PARTY_LEADER",
"CHAT_MSG_RAID",
"CHAT_MSG_RAID_LEADER",
"CHAT_MSG_SAY",
"CHAT_MSG_WHISPER",
"CHAT_MSG_WHISPER_INFORM",
"CHAT_MSG_YELL"
}
local function FilterLine(event, source, message, ...)
local spam = false
for k, v in ipairs(nextLines) do
if message:match(v) then
local curTime = time()
for i, j in ipairs(meters) do
local elapsed = curTime - j.time
if j.source == source and j.event == event and elapsed < 1 then
local toInsert = true
for a, b in ipairs(j.data) do
if b == message then
toInsert = false
end
end
if toInsert then
table.insert(j.data, message)
end
return true, false, nil
end
end
end
end
for k, v in ipairs(firstLines) do
local newID = 0
if message:match(v) then
local curTime = time()
for i, j in ipairs(meters) do
local elapsed = curTime - j.time
if j.source == source and j.event == event and elapsed < 1 then
newID = i
return true, true, string.format("|HMergeSpamMeter:%1$d|h|cFFFFFF00[%2$s]|r|h", newID or 0, message or "nil")
end
end
table.insert(meters, {source = source, event = event, time = curTime, data = {}, title = message})
for i, j in ipairs(meters) do
if j.source == source and j.event == event and j.time == curTime then
newID = i
end
end
return true, true, string.format("|HMergeSpamMeter:%1$d|h|cFFFFFF00[%2$s]|r|h", newID or 0, message or "nil")
end
end
return false, false, nil
end
local orig2 = SetItemRef
function SetItemRef(link, text, button, frame)
local linkType, id = strsplit(":", link)
if linkType == "MergeSpamMeter" then
local meterID = tonumber(id)
ShowUIPanel(ItemRefTooltip)
if not ItemRefTooltip:IsShown() then
ItemRefTooltip:SetOwner(UIParent, "ANCHOR_PRESERVE")
end
ItemRefTooltip:ClearLines()
ItemRefTooltip:AddLine(meters[meterID].title)
ItemRefTooltip:AddLine(string.format(BY_SOURCE..": %s", meters[meterID].source))
for k, v in ipairs(meters[meterID].data) do
local left, right = v:match("^(.*) (.*)$")
if left and right then
ItemRefTooltip:AddDoubleLine(left, right, 1, 1, 1, 1, 1, 1)
else
ItemRefTooltip:AddLine(v, 1, 1, 1)
end
end
ItemRefTooltip:Show()
else
return orig2(link, text, button, frame)
end
end
local function ParseChatEvent(self, event, message, sender, ...)
for _, value in ipairs(events) do
if event == value then
local isRecount, isFirstLine, newMessage = FilterLine(event, sender, message)
if isRecount then
if isFirstLine then
return false, newMessage, sender, ...
else
return true
end
end
end
end
end
for _, event in pairs(events) do
ChatFrame_AddMessageEventFilter(event, ParseChatEvent)
end
|
function numzero(s, c, z)
if c == 0 then
return (z == 0) and 1 or 0
elseif #s < c or z + c * s[1] > 0 or z + c * s[#s] < 0 then
return 0
end
local t = {}
for i = 1, #s-1 do t[#t+1] = s[i+1] end
return numzero(t, c-1, z + s[1]) + numzero(t, c, z)
end
for line in io.lines(arg[1]) do
local s = {}
for i in line:gmatch("[-]?%d+") do
s[#s+1] = tonumber(i)
end
table.sort(s)
print(numzero(s, 4, 0))
end
|
slot0 = class("WorldBossListPage", import("....base.BaseSubView"))
slot0.Listeners = {
onRankListUpdated = "OnRankListUpdated",
onCacheBossUpdated = "OnCacheBossUpdated"
}
slot1 = {
[970701] = {
411,
777
},
[970702] = {
411,
574
},
[970201] = {
296,
610,
0.95,
0.95
},
[970703] = {
1424,
1267.9,
1.7,
1.7
}
}
slot0.getUIName = function (slot0)
return "WorldBossListUI"
end
slot0.Setup = function (slot0, slot1)
for slot5, slot6 in pairs(slot0.Listeners) do
slot0[slot5] = function (...)
slot0[slot1](slot2, ...)
end
end
slot0.proxy = slot1
end
slot0.OnLoaded = function (slot0)
slot0.awardPage = WorldBossAwardPage.New(slot0._tf.parent.parent, slot0._event)
slot0.rankPage = WorldBossRankPage.New(slot0._tf.parent.parent, slot0._event)
slot0:AddListeners(slot0.proxy)
slot0.groupId = WorldBossConst.GetCurrBossGroup()
end
slot0.OnInit = function (slot0)
slot0:findTF("main/label"):GetComponent(typeof(Image)).sprite = LoadSprite("metaship/" .. slot0.groupId .. "_title")
slot1 = slot0:getTpl("list_panel/mask/tpl")
slot1:Find("complete"):GetComponent(typeof(Image)).sprite = LoadSprite("metaship/" .. slot0.groupId .. "_item_02")
slot1:Find("raiding"):GetComponent(typeof(Image)).sprite = LoadSprite("metaship/" .. slot0.groupId .. "_item_03")
slot2 = slot1:Find("empty"):GetComponent(typeof(Image))
slot2.sprite = LoadSprite("metaship/" .. slot0.groupId .. "_item_04")
slot2:SetNativeSize()
slot1:Find("selected/challenging"):GetComponent(typeof(Image)).sprite = LoadSprite("metaship/" .. slot0.groupId .. "_item_01")
slot1:Find("selected/finished"):GetComponent(typeof(Image)).sprite = LoadSprite("metaship/" .. slot0.groupId .. "_item_05")
slot0.scrollRect = WorldBossItemList.New(slot0:findTF("list_panel/mask/bg/container"), slot1)
slot0.scrollRect:Make(function (slot0, slot1)
slot0:OnInitCard(slot0, slot1)
end, function (slot0, slot1)
slot0:OnPreviewCard(slot0, slot1)
end, function (slot0, slot1)
slot0:OnSelectCard(slot0, slot1)
end)
slot0.hpSlider = slot0.findTF(slot0, "main/hp/slider"):GetComponent(typeof(Slider))
slot0.levelTxt = slot0:findTF("main/hp/level/Text"):GetComponent(typeof(Text))
slot0.hpTxt = slot0:findTF("main/hp/Text"):GetComponent(typeof(Text))
slot0.expiredTimeTxt = slot0:findTF("main/time/Text"):GetComponent(typeof(Text))
slot0.mainPanel = slot0:findTF("main")
slot0.painting = slot0:findTF("paint")
setActive(slot0.painting, false)
setActive(slot0.mainPanel, false)
slot0.awardBtn = slot0.mainPanel:Find("award_btn")
slot0.rankBtn = slot0.mainPanel:Find("rank_btn")
slot0.startBtn = slot0.mainPanel:Find("start_btn")
slot0.refreshBtn = slot0:findTF("list_panel/frame/filter/refresh_btn")
slot0.refreshBtnGray = slot0:findTF("list_panel/frame/filter/refresh_btn_gray")
slot0.cdTime = 0
onButton(slot0, slot0.refreshBtn, function ()
if slot0.cdTime <= pg.TimeMgr.GetInstance():GetServerTime() then
slot0.worldBossId = nil
slot0:emit(WorldBossMediator.UPDATE_CACHE_BOSS_HP, function ()
slot0:OnCacheBossUpdated()
end)
slot0.cdTime = pg.TimeMgr.GetInstance().GetServerTime(slot2) + pg.gameset.world_boss_resfresh.key_value
slot0:RotateRefreshBtn(pg.gameset.world_boss_resfresh.key_value)
else
pg.TipsMgr.GetInstance():ShowTips(i18n("world_joint_not_refresh_frequently"))
end
end, SFX_PANEL)
onButton(slot0, slot0.refreshBtnGray, function ()
pg.TipsMgr.GetInstance():ShowTips(i18n("world_joint_not_refresh_frequently"))
end, SFX_PANEL)
function slot3()
if _.all(slot0.filterFlags, function (slot0)
return slot0 == -1
end) then
triggerToggle(slot0.findTF(slot1, "list_panel/frame/filter/toggles/world"), true)
triggerToggle(slot0:findTF("list_panel/frame/filter/toggles/friend"), true)
triggerToggle(slot0:findTF("list_panel/frame/filter/toggles/guild"), true)
end
end
slot0.filterToggle = slot0.findTF(slot0, "list_panel/frame/filter/toggles")
slot0.filterFlags = {
WorldBoss.BOSS_TYPE_WORLD,
WorldBoss.BOSS_TYPE_FRIEND,
WorldBoss.BOSS_TYPE_GUILD
}
onToggle(slot0, slot0:findTF("list_panel/frame/filter/toggles/world"), function (slot0)
slot0.filterFlags[1] = (slot0 and WorldBoss.BOSS_TYPE_WORLD) or -1
slot0.filterFlags()
slot0:UpdateNonProcessList()
end, SFX_PANEL)
onToggle(slot0, slot0:findTF("list_panel/frame/filter/toggles/friend"), function (slot0)
slot0.filterFlags[2] = (slot0 and WorldBoss.BOSS_TYPE_FRIEND) or -1
slot0.filterFlags()
slot0:UpdateNonProcessList()
end, SFX_PANEL)
onToggle(slot0, slot0:findTF("list_panel/frame/filter/toggles/guild"), function (slot0)
slot0.filterFlags[3] = (slot0 and WorldBoss.BOSS_TYPE_GUILD) or -1
slot0.filterFlags()
slot0:UpdateNonProcessList()
end, SFX_PANEL)
setPaintingPrefabAsync(slot0.painting, slot0.groupId, "lihuisha")
if slot0[slot0.groupId] then
setAnchoredPosition(slot0.painting, {
x = slot0[slot0.groupId][1],
y = slot0[slot0.groupId][2]
})
slot4 = slot0[slot0.groupId][3] or 1
slot0.painting.localScale = Vector3(slot4, slot0[slot0.groupId][4] or 1, 1)
end
end
slot0.RotateRefreshBtn = function (slot0, slot1)
LeanTween.rotate(rtf(slot0.refreshBtn), -360, 0.5):setOnComplete(System.Action(function ()
slot0.refreshBtn.localEulerAngles = Vector3(0, 0, 0)
setActive(slot0.refreshBtnGray, false)
setActive(slot0.refreshBtnGray, true)
end))
if slot0.refreshtimer then
slot0.refreshtimer.Stop(slot3)
slot0.refreshtimer = nil
end
slot0.refreshtimer = Timer.New(function ()
setActive(slot0.refreshBtnGray, true)
setActive(slot0.refreshBtnGray, false)
end, slot1, 1)
slot0.refreshtimer:Start()
end
slot0.AddListeners = function (slot0, slot1)
slot1:AddListener(WorldBossProxy.EventRankListUpdated, slot0.onRankListUpdated)
slot1:AddListener(WorldBossProxy.EventCacheBossListUpdated, slot0.onCacheBossUpdated)
end
slot0.RemoveListeners = function (slot0, slot1)
slot1:RemoveListener(WorldBossProxy.EventRankListUpdated, slot0.onRankListUpdated)
slot1:RemoveListener(WorldBossProxy.EventCacheBossListUpdated, slot0.onCacheBossUpdated)
end
slot0.OnCacheBossUpdated = function (slot0)
slot0:UpdateNonProcessList()
end
slot0.OnRankListUpdated = function (slot0, slot1, slot2, slot3)
if slot0.boss and slot0.boss.id == slot3 and slot0.rankPage:GetLoaded() and slot0.rankPage:isActive() then
slot0.rankPage:ExecuteAction("Update", slot0.proxy, slot0.boss.id)
end
end
slot0.Update = function (slot0)
slot0:emit(WorldBossMediator.UPDATE_CACHE_BOSS_HP, function ()
slot0:UpdateNonProcessList()
slot0.UpdateNonProcessList:Show()
end)
end
slot0.UpdateNonProcessList = function (slot0)
slot2 = slot0.proxy.GetCacheBossList(slot1)
function slot3(slot0)
slot1 = _.select(slot0.filterFlags, function (slot0)
return slot0 >= 0
end)
return _.any(slot1, function (slot0)
return slot0:GetType() == slot0
end)
end
slot0.displays = {}
for slot7, slot8 in ipairs(slot2) do
if not slot8:isDeath() and not slot8:IsExpired() and slot3(slot8) and not slot8:IsFullPeople() then
table.insert(slot0.displays, slot8)
end
end
table.sort(slot0.displays, function (slot0, slot1)
return slot1:GetJoinTime() < slot0:GetJoinTime()
end)
slot4 = 1
for slot8, slot9 in ipairs(slot0.displays) do
if slot9.id == slot0.contextData.worldBossId or slot9.id == slot0.worldBossId then
slot4 = slot8
break
end
end
slot0.contextData.worldBossId = nil
WorldBossScene.inOtherBossBattle = nil
slot0.scrollRect:Align(#slot0.displays, slot4)
setActive(slot0.filterToggle, true)
setActive(slot0.refreshBtn, true)
end
slot0.OnInitCard = function (slot0, slot1, slot2)
slot4 = false
slot5 = slot1:Find("tags")
removeOnButton(slot1)
if slot0.displays[slot2 + 1] then
slot4 = slot3:isDeath()
setActive(slot1:Find("tags/friend"), slot3:GetType() == WorldBoss.BOSS_TYPE_FRIEND)
setActive(slot1:Find("tags/guild"), slot6 == WorldBoss.BOSS_TYPE_GUILD)
setActive(slot1:Find("tags/world"), slot6 == WorldBoss.BOSS_TYPE_WORLD)
slot5.anchoredPosition = Vector3(0, 14, 0)
setText(slot1:Find("tags/friend/Text"), slot3:GetRoleName())
setText(slot1:Find("tags/guild/Text"), slot3:GetRoleName())
onButton(slot0, slot1, function ()
slot0.scrollRect:SliceTo(slot0.scrollRect)
end, SFX_PANEL)
end
setActive(slot1.Find(slot1, "complete"), slot3 and slot4)
setActive(slot1:Find("raiding"), slot3 and not slot4)
setActive(slot1:Find("empty"), not slot3)
setActive(slot5, slot3)
setActive(slot1:Find("tags/friend/Text"), false)
setActive(slot1:Find("tags/guild/Text"), false)
end
slot0.OnPreviewCard = function (slot0, slot1, slot2)
if slot0.prevSelected and slot0.prevSelected.boss then
slot0.prevSelected.childTF:Find("tags").anchoredPosition = Vector3(0, 14, 0)
setActive(slot0.prevSelected.childTF:Find("tags/friend/Text"), false)
setActive(slot0.prevSelected.childTF:Find("tags/guild/Text"), false)
setActive(slot0.prevSelected.childTF:Find("selected"), false)
end
if slot0.displays[slot2 + 1] then
setActive(slot1:Find("selected/challenging"), not slot3:isDeath())
setActive(slot1:Find("selected/finished"), slot4)
slot1:Find("tags").anchoredPosition = Vector3(-17, 41.69, 0)
setActive(slot1:Find("tags/friend/Text"), true)
setActive(slot1:Find("tags/guild/Text"), true)
end
setActive(slot1:Find("selected"), slot3)
slot0.prevSelected = {
childTF = slot1,
boss = slot3
}
end
slot0.OnSelectCard = function (slot0, slot1, slot2)
slot0.boss = slot0.displays[slot2 + 1]
slot0.worldBossId = nil
if slot0.boss then
slot0.worldBossId = slot3.id
slot0:UpdateMainView(slot3)
else
setActive(slot0.mainPanel, false)
setActive(slot0.painting, false)
end
end
slot0.UpdateMainView = function (slot0, slot1, slot2)
setActive(slot0.mainPanel, true)
setActive(slot0.painting, true)
slot3 = slot0.proxy
setActive(slot0.awardBtn, not slot1:isDeath())
onButton(slot0, slot0.awardBtn, function ()
slot0.awardPage:ExecuteAction("Update", slot0.awardPage)
end, SFX_PANEL)
onButton(slot0, slot0.rankBtn, function ()
slot0.rankPage:ExecuteAction("Update", slot0.proxy, slot1.id)
end, SFX_PANEL)
slot0.hpSlider.value = 1
slot0.levelTxt.text = slot1:GetLevel()
slot0.hpTxt.text = "HP:" .. slot6
onButton(slot0, slot0.startBtn, function ()
slot0:emit(WorldBossMediator.ON_BATTLE, slot1.id, true)
end, SFX_PANEL)
setActive(slot0.startBtn, not slot1.isDeath() and slot1:GetLeftTime() > 0)
slot0.removeBattleTimer(slot0)
if not slot4 and not slot2 then
slot0:addBattleTimer(slot1)
end
end
slot0.addBattleTimer = function (slot0, slot1)
if slot1:GetExpiredTime() - pg.TimeMgr.GetInstance():GetServerTime() >= 0 then
slot0.timer = Timer.New(function ()
if slot0 - pg.TimeMgr.GetInstance():GetServerTime() <= 0 then
slot1.expiredTimeTxt.text = i18n("world_word_expired")
slot1.expiredTimeTxt:removeBattleTimer()
slot1.expiredTimeTxt.removeBattleTimer:UpdateMainView(slot1.expiredTimeTxt.removeBattleTimer, true)
else
slot1.expiredTimeTxt.text = pg.TimeMgr.GetInstance():DescCDTime(slot0)
end
end, 1, -1)
slot0.timer.Start(slot5)
slot0.timer.func()
else
slot0.expiredTimeTxt.text = i18n("world_word_expired")
slot0:UpdateMainView(slot1, true)
end
end
slot0.removeBattleTimer = function (slot0)
if slot0.timer then
slot0.timer:Stop()
slot0.timer = nil
end
end
slot0.OnDestroy = function (slot0)
retPaintingPrefab(slot0.painting, slot0.groupId)
slot0:RemoveListeners(slot0.proxy)
slot0:removeBattleTimer()
slot0.scrollRect:Dispose()
slot0.awardPage:Destroy()
slot0.rankPage:Destroy()
if slot0.refreshtimer then
slot0.refreshtimer:Stop()
slot0.refreshtimer = nil
end
end
return slot0
|
function EFFECT:Init( data )
--print("bourne bourne bourne yes ur gonna bourne")
self.PartName = "flamethrower"
self.StartPacket = data:GetStart()
self.EntityV = data:GetEntity()
self.Attachment = data:GetAttachment()
if self.Attachment and IsValid(self.EntityV) then
local owner = Entity(math.Round(self.StartPacket.x))
if owner == LocalPlayer() and math.Round(self.StartPacket.y)==1 then
self.EntityV = owner:GetViewModel()
if IsValid(self.EntityV) then
ParticleEffectAttach(self.PartName,PATTACH_POINT_FOLLOW,self.EntityV,self.Attachment)
end
else
self.EntityV = owner:GetActiveWeapon()
if IsValid(self.EntityV) then
ParticleEffectAttach(self.PartName,PATTACH_POINT_FOLLOW,self.EntityV,self.Attachment)
end
end
end
end
function EFFECT:Think( )
return false
end
function EFFECT:Render()
end
|
local packer = require("packer")
packer.use({
"akinsho/nvim-bufferline.lua",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("bufferline").setup({
options = {
diagnostics = "nvim_lsp",
offsets = { { filetype = "NvimTree", text = "File Explorer", text_align = "left" } },
},
})
end,
})
|
--ロイヤル・ストレート・スラッシャー
--Script by mercury233
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,25652259,64788463,90876561)
c:EnableReviveLimit()
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id)
e2:SetCondition(s.descon)
e2:SetTarget(s.destg)
e2:SetOperation(s.desop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_BATTLE_DESTROYED)
e3:SetCountLimit(1,id+o)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,25652259)
and Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,64788463)
and Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,90876561)
end
function s.tgfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsLevelBelow(5) and c:IsAbleToGrave()
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if not Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) then return false end
local tg=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_HAND+LOCATION_DECK,0,nil)
return tg:CheckSubGroup(aux.dlvcheck,5,5)
end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,5,tp,LOCATION_HAND+LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_HAND+LOCATION_DECK,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=tg:SelectSubGroup(tp,aux.dlvcheck,false,5,5)
if sg then
Duel.SendtoGrave(sg,REASON_EFFECT)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
if #g>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
end
function s.spfilter(c,e,tp)
return c:IsRace(RACE_WARRIOR) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if chk==0 then return ft>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
if ft>1 and Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
if ft>3 then ft=3 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,ft,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,#g,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then return end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
if sg:GetCount()>1 and Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
if sg:GetCount()>ft then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
sg=sg:Select(tp,ft,ft,nil)
end
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
|
--Bans module for ULX GUI -- by Stickly Man!
--Manages banned users and shows ban details
xgui.prepareDataType( "bans" )
xgui.prepareDataType( "sbans" )
local xbans = xlib.makepanel{ parent=xgui.null }
xbans.isPopulating = 0
xbans.showperma = xlib.makecheckbox{ x=445, y=10, value=1, label="Show Permabans", parent=xbans }
function xbans.showperma:OnChange()
xbans.clearbans()
xbans.populateBans()
end
xbans.banlist = xlib.makelistview{ x=5, y=30, w=572, h=310, multiselect=false, parent=xbans }
xbans.banlist:AddColumn( "Name/SteamID" )
xbans.banlist:AddColumn( "Banned By" )
xbans.banlist:AddColumn( "Unban Date" )
xbans.banlist:AddColumn( "Reason" )
xbans.banlist.DoDoubleClick = function()
xbans.ShowBanDetailsWindow( xbans.banlist:GetLine( xbans.banlist:GetSelectedLine() ):GetValue( 5 ) )
end
xbans.banlist.OnRowRightClick = function( self, LineID, line )
local menu = DermaMenu()
menu:AddOption( "Details...", function() xbans.ShowBanDetailsWindow( line:GetValue( 5 ) ) end )
menu:AddOption( "Edit Ban...", function() xgui.ShowBanWindow( nil, line:GetValue( 5 ), nil, true ) end )
menu:AddOption( "Remove", function() xbans.RemoveBan( line:GetValue( 5 ) ) end )
menu:Open()
end
xlib.makelabel{ x=200, y=10, label="Right-click on a ban for more options", parent=xbans }
xbans.freezeban = xlib.makecheckbox{ x=140, y=343, label="Use Freezeban", tooltip="Freezes a player you have selected for banning while editing ban information (!fban in chat)", value=1, parent=xbans }
xlib.makebutton{ x=5, y=340, w=130, label="Add Ban...", parent=xbans }.DoClick = function()
local menu = DermaMenu()
for k, v in ipairs( player.GetAll() ) do
menu:AddOption( v:Nick(), function() xgui.ShowBanWindow( v, v:SteamID(), xbans.freezeban:GetChecked() ) end )
end
menu:AddSpacer()
if LocalPlayer():query("ulx banid") then menu:AddOption( "Ban by STEAMID...", function() xgui.ShowBanWindow() end ) end
menu:Open()
end
xlib.makebutton{ x=447, y=340, w=130, label="View Source Bans...", parent=xbans }.DoClick = function()
if xbans.sbanWindow and xbans.sbanWindow:IsVisible() then return end
xbans.sbanWindow = xlib.makeframe{ w=160, h=400, label="Bans added via banid", skin=xgui.settings.skin }
xbans.sbanWindow.bans = xlib.makelistview{ x=5, y=50, w=150, h=323, headerheight=0, parent=xbans.sbanWindow }
xbans.sbanWindow.bans:AddColumn( "" )
xbans.sbanWindow.bans.OnRowSelected = function( self, LineID, Line )
xbans.sbanWindow.sbanDelete:SetDisabled( false )
xbans.sbanWindow.sbanDetails:SetDisabled( false )
end
xlib.makelabel{ x=5, y=32, label="100 per page", parent=xbans.sbanWindow }
xbans.sbanWindow.pgleft = xlib.makebutton{ x=80, y=30, w=20, icon="icon16/arrow_left.png", centericon=true, disabled=true, parent=xbans.sbanWindow }
xbans.sbanWindow.pgleft.DoClick = function()
local page = xbans.sbanWindow.sbanPage:GetValue()-1
xbans.sbanWindow.gotoPage( page )
xbans.sbanWindow.sbanPage:SetText( page )
end
xbans.sbanWindow.pgright = xlib.makebutton{ x=100, y=30, w=20, icon="icon16/arrow_right.png", centericon=true, disabled=true, parent=xbans.sbanWindow }
xbans.sbanWindow.pgright.DoClick = function()
local page = xbans.sbanWindow.sbanPage:GetValue()+1
xbans.sbanWindow.gotoPage( page )
xbans.sbanWindow.sbanPage:SetText( page )
end
xbans.sbanWindow.sbanPage = xlib.makecombobox{x=120, y=30, w=35, text="1", disabled=true, parent=xbans.sbanWindow }
function xbans.sbanWindow.sbanPage:OnSelect()
xbans.sbanWindow.gotoPage( tonumber( self:GetValue() ) )
end
xbans.sbanWindow.sbanDelete = xlib.makebutton{ x=5, y=373, w=75, label="Delete", disabled=true, parent=xbans.sbanWindow }
xbans.sbanWindow.sbanDelete.DoClick = function()
xbans.RemoveBan( xbans.sbanWindow.bans:GetSelected()[1]:GetColumnText(1), true )
end
xbans.sbanWindow.sbanDetails = xlib.makebutton{ x=80, y=373, w=75, label="Add Details...", disabled=true, parent=xbans.sbanWindow }
xbans.sbanWindow.sbanDetails.DoClick = function()
xgui.ShowBanWindow( nil, xbans.sbanWindow.bans:GetSelected()[1]:GetColumnText(1), nil, true )
end
function xbans.sbanWindow.gotoPage( pageno )
xbans.sbanWindow.bans:Clear()
xbans.sbanWindow.sbanDelete:SetDisabled( true )
xbans.sbanWindow.sbanDetails:SetDisabled( true )
for i,ID in ipairs( xbans.sbanWindow.banlist ) do
if i > ( pageno-1 )*100 and i <= ( pageno )*100 then
xbans.sbanWindow.bans:AddLine( ID )
end
end
xbans.sbanWindow.sbanPage:SetText( pageno )
if xbans.sbanPages > 2 then
xbans.sbanWindow.sbanPage:SetDisabled( false )
xbans.sbanWindow.pgright:SetDisabled( not ( pageno < xbans.sbanPages ) )
xbans.sbanWindow.pgleft:SetDisabled( not ( pageno > 1 ) )
else
xbans.sbanWindow.sbanPage:SetDisabled( true )
xbans.sbanWindow.pgright:SetDisabled( true )
xbans.sbanWindow.pgleft:SetDisabled( true )
end
end
function xbans.populateSBans( page )
xbans.sbanWindow.banlist = {}
for ID,_ in pairs( xgui.data.sbans ) do
table.insert( xbans.sbanWindow.banlist, ID )
end
table.sort( xbans.sbanWindow.banlist )
xbans.sbanWindow.sbanPage:Clear()
xbans.sbanPages = 0
for i=1,#xbans.sbanWindow.banlist,100 do
xbans.sbanWindow.sbanPage:AddChoice( tostring(math.floor((i+100)/100)) )
xbans.sbanPages = xbans.sbanPages + 1
end
xbans.sbanWindow.gotoPage( page )
end
xbans.populateSBans( 1 )
end
function xbans.RemoveBan( ID, noName )
local tempstr = "<Unknown>"
if not noName then tempstr = xgui.data.bans[ID].name or "<Unknown>" end
Derma_Query( "Are you sure you would like to unban " .. tempstr .. " - " .. ID .. "?", "XGUI WARNING",
"Remove", function()
RunConsoleCommand( "ulx", "unban", ID ) end,
"Cancel", function() end )
end
xbans.openWindows = {}
function xbans.ShowBanDetailsWindow( ID )
local wx, wy
if xbans.openWindows[ID] then
wx, wy = xbans.openWindows[ID]:GetPos()
xbans.openWindows[ID]:Remove()
end
xbans.openWindows[ID] = xlib.makeframe{ label="Ban Details", x=wx, y=wy, w=285, h=295, skin=xgui.settings.skin }
local panel = xbans.openWindows[ID]
local name = xlib.makelabel{ x=50, y=30, label="Name:", parent=panel }
xlib.makelabel{ x=90, y=30, w=190, label=( xgui.data.bans[ID].name or "<Unknown>" ), parent=panel, tooltip=xgui.data.bans[ID].name }
xlib.makelabel{ x=36, y=50, label="SteamID:", parent=panel }
xlib.makelabel{ x=90, y=50, label=ID, parent=panel }
xlib.makelabel{ x=33, y=70, label="Ban Date:", parent=panel }
if xgui.data.bans[ID].time then xlib.makelabel{ x=90, y=70, label=os.date( "%b %d, %Y - %I:%M:%S %p", tonumber( xgui.data.bans[ID].time ) ), parent=panel } end
xlib.makelabel{ x=20, y=90, label="Unban Date:", parent=panel }
xlib.makelabel{ x=90, y=90, label=( tonumber( xgui.data.bans[ID].unban ) == 0 and "Never" or os.date( "%b %d, %Y - %I:%M:%S %p", math.min( tonumber( xgui.data.bans[ID].unban ), 4294967295 ) ) ), parent=panel }
xlib.makelabel{ x=10, y=110, label="Length of Ban:", parent=panel }
xlib.makelabel{ x=90, y=110, label=( tonumber( xgui.data.bans[ID].unban ) == 0 and "Permanent" or xgui.ConvertTime( tonumber( xgui.data.bans[ID].unban ) - xgui.data.bans[ID].time ) ), parent=panel }
xlib.makelabel{ x=33, y=130, label="Time Left:", parent=panel }
local timeleft = xlib.makelabel{ x=90, y=130, label=( tonumber( xgui.data.bans[ID].unban ) == 0 and "N/A" or xgui.ConvertTime( tonumber( xgui.data.bans[ID].unban ) - os.time() ) ), parent=panel }
xlib.makelabel{ x=26, y=150, label="Banned By:", parent=panel }
if xgui.data.bans[ID].admin then xlib.makelabel{ x=90, y=150, label=string.gsub( xgui.data.bans[ID].admin, "%(STEAM_%w:%w:%w*%)", "" ), parent=panel } end
if xgui.data.bans[ID].admin then xlib.makelabel{ x=90, y=165, label=string.match( xgui.data.bans[ID].admin, "%(STEAM_%w:%w:%w*%)" ), parent=panel } end
xlib.makelabel{ x=41, y=185, label="Reason:", parent=panel }
xlib.makelabel{ x=90, y=185, w=190, label=xgui.data.bans[ID].reason, parent=panel, tooltip=xgui.data.bans[ID].reason ~= "" and xgui.data.bans[ID].reason or nil }
xlib.makelabel{ x=13, y=205, label="Last Updated:", parent=panel }
xlib.makelabel{ x=90, y=205, label=( ( xgui.data.bans[ID].modified_time == nil ) and "Never" or os.date( "%b %d, %Y - %I:%M:%S %p", tonumber( xgui.data.bans[ID].modified_time ) ) ), parent=panel }
xlib.makelabel{ x=21, y=225, label="Updated by:", parent=panel }
if xgui.data.bans[ID].modified_admin then xlib.makelabel{ x=90, y=225, label=string.gsub( xgui.data.bans[ID].modified_admin, "%(STEAM_%w:%w:%w*%)", "" ), parent=panel } end
if xgui.data.bans[ID].modified_admin then xlib.makelabel{ x=90, y=240, label=string.match( xgui.data.bans[ID].modified_admin, "%(STEAM_%w:%w:%w*%)" ), parent=panel } end
xlib.makebutton{ x=5, y=265, w=89, label="Edit Ban...", parent=panel }.DoClick = function()
xgui.ShowBanWindow( nil, ID, nil, true )
end
xlib.makebutton{ x=99, y=265, w=89, label="Unban", parent=panel }.DoClick = function()
xbans.RemoveBan( ID )
end
xlib.makebutton{ x=192, y=265, w=88, label="Close", parent=panel }.DoClick = function()
xbans.openWindows[ID] = nil
panel:Remove()
end
panel.btnClose.DoClick = function ( button )
xbans.openWindows[ID] = nil
panel:Remove()
end
if timeleft:GetValue() ~= "N/A" then
function panel.OnTimer()
if panel:IsVisible() then
if not xgui.data.bans[ID] then
panel:Remove()
return
end
local bantime = tonumber( xgui.data.bans[ID].unban ) - os.time()
if bantime <= 0 then
timeleft:SetText( xgui.ConvertTime( 0 ) .. " (Waiting for server)" )
else
timeleft:SetText( xgui.ConvertTime( bantime ) )
end
timeleft:SizeToContents()
timer.Simple( 1, panel.OnTimer )
end
end
panel.OnTimer()
end
end
function xgui.ShowBanWindow( ply, ID, doFreeze, isUpdate )
if LocalPlayer():query( "ulx ban" ) or LocalPlayer():query( "ulx banid" ) then
local xgui_banwindow = xlib.makeframe{ label=( isUpdate and "Edit Ban" or "Ban Player" ), w=285, h=180, skin=xgui.settings.skin }
xlib.makelabel{ x=37, y=33, label="Name:", parent=xgui_banwindow }
xlib.makelabel{ x=23, y=58, label="SteamID:", parent=xgui_banwindow }
xlib.makelabel{ x=28, y=83, label="Reason:", parent=xgui_banwindow }
xlib.makelabel{ x=10, y=108, label="Ban Length:", parent=xgui_banwindow }
local reason = xlib.makecombobox{ x=75, y=80, w=200, parent=xgui_banwindow, enableinput=true, selectall=true, choices=ULib.cmds.translatedCmds["ulx ban"].args[4].completes }
local bantime = xlib.makeslider{ x=150, y=105, w=125, value=0, min=0, max=360, decimal=0, disabled=true, parent=xgui_banwindow }
local interval = xlib.makecombobox{ x=75, y=105, w=75, text="Permanent", choices={ "Permanent", "Minutes", "Hours", "Days", "Weeks", "Years" }, parent=xgui_banwindow }
interval.OnSelect = function( self, index, value, data )
bantime:SetDisabled( value == "Permanent" )
end
local name
if not isUpdate then
name = xlib.makecombobox{ x=75, y=30, w=200, parent=xgui_banwindow, enableinput=true, selectall=true }
for k,v in pairs( player.GetAll() ) do
name:AddChoice( v:Nick(), v:SteamID() )
end
name.OnSelect = function( self, index, value, data )
self.steamIDbox:SetText( data )
end
else
name = xlib.maketextbox{ x=75, y=30, w=200, parent=xgui_banwindow, selectall=true }
if xgui.data.bans[ID] then
name:SetText( xgui.data.bans[ID].name or "" )
reason:SetText( xgui.data.bans[ID].reason or "" )
if tonumber( xgui.data.bans[ID].unban ) ~= 0 then
local btime = ( tonumber( xgui.data.bans[ID].unban ) - tonumber( xgui.data.bans[ID].time ) )
if btime % 31536000 == 0 then
interval:SetText( "Years" )
btime = btime / 31536000
elseif btime % 86400 == 0 then
interval:SetText( "Days" )
btime = btime / 86400
elseif btime % 3600 == 0 then
interval:SetText( "Hours" )
btime = btime / 3600
else
btime = btime / 60
interval:SetText( "Minutes" )
end
bantime:SetDisabled( false )
bantime:SetValue( btime )
end
end
end
local steamID = xlib.maketextbox{ x=75, y=55, w=200, selectall=true, disabled=( isUpdate or not LocalPlayer():query( "ulx banid" ) ), parent=xgui_banwindow }
name.steamIDbox = steamID --Make a reference to the steamID textbox so it can change the value easily without needing a global variable
if doFreeze and ply then
if LocalPlayer():query( "ulx freeze" ) then
RunConsoleCommand( "ulx", "freeze", "$" .. ULib.getUniqueIDForPlayer( ply ) )
steamID:SetDisabled( true )
name:SetDisabled( true )
xgui_banwindow:ShowCloseButton( false )
else
doFreeze = false
end
end
xlib.makebutton{ x=165, y=150, w=75, label="Cancel", parent=xgui_banwindow }.DoClick = function()
if doFreeze and ply and ply:IsValid() then
RunConsoleCommand( "ulx", "unfreeze", "$" .. ULib.getUniqueIDForPlayer( ply ) )
end
xgui_banwindow:Remove()
end
xlib.makebutton{ x=45, y=150, w=75, label=( isUpdate and "Update" or "Ban!" ), parent=xgui_banwindow }.DoClick = function()
local calctime = bantime:GetValue()
if interval:GetValue() == "Permanent" then calctime = calctime*0
elseif interval:GetValue() == "Hours" then calctime = calctime*60
elseif interval:GetValue() == "Days" then calctime = calctime*1440
elseif interval:GetValue() == "Years" then calctime = calctime*525600 end
if isUpdate then
local function performUpdate()
RunConsoleCommand( "xgui", "updateBan", steamID:GetValue(), calctime, reason:GetValue(), name:GetValue() )
xgui_banwindow:Remove()
end
if calctime ~= 0 and xgui.data.bans[steamID:GetValue()] and calctime*60 + xgui.data.bans[steamID:GetValue()].time < os.time() then
Derma_Query( "WARNING! The new ban time you have specified will cause this ban to expire.\nThe minimum time required in order to change the ban length successfully is "
.. xgui.ConvertTime( os.time() - xgui.data.bans[steamID:GetValue()].time ) .. ".\nAre you sure you wish to continue?", "XGUI WARNING",
"Expire Ban", function()
performUpdate()
end,
"Cancel", function() end )
else
performUpdate()
end
return
end
if ULib.isValidSteamID( steamID:GetValue() ) then
local isOnline = false
for k, v in ipairs( player.GetAll() ) do
if v:SteamID() == steamID:GetValue() then
isOnline = v
break
end
end
if not isOnline then
if name:GetValue() == "" then
RunConsoleCommand( "ulx", "banid", steamID:GetValue(), calctime, reason:GetValue() )
else
RunConsoleCommand( "xgui", "updateBan", steamID:GetValue(), calctime, reason:GetValue(), ( name:GetValue() ~= "" and name:GetValue() or nil ) )
end
else
RunConsoleCommand( "ulx", "ban", "$" .. ULib.getUniqueIDForPlayer( isOnline ), calctime, reason:GetValue() )
end
xgui_banwindow:Remove()
else
local ply = ULib.getUser( name:GetValue() )
if ply then
RunConsoleCommand( "ulx", "ban", "$" .. ULib.getUniqueIDForPlayer( ply ), calctime, reason:GetValue() )
xgui_banwindow:Remove()
return
end
Derma_Message( "Invalid SteamID, player name, or multiple player targets found!" )
end
end
if ply then name:SetText( ply:Nick() ) end
if ID then steamID:SetText( ID ) else steamID:SetText( "STEAM_0:" ) end
end
end
--If the user requests to sort by unban date, tell the listview to sort by column 6 (unban date in seconds) for better sort accuracy
xbans.banlist.Columns[3].DoClick = function( self )
self:GetParent():SortByColumn( 6, self:GetDescending() )
self:SetDescending( not self:GetDescending() )
end
function xgui.ConvertTime( seconds )
--Convert number of seconds remaining to something more legible (Thanks JamminR!)
local years = math.floor( seconds / 31536000 )
seconds = seconds - ( years * 31536000 )
local days = math.floor( seconds / 86400 )
seconds = seconds - ( days * 86400 )
local hours = math.floor( seconds/3600 )
seconds = seconds - ( hours * 3600 )
local minutes = math.floor( seconds/60 )
seconds = seconds - ( minutes * 60 )
local curtime = ""
if years ~= 0 then curtime = curtime .. years .. " year" .. ( ( years > 1 ) and "s, " or ", " ) end
if days ~= 0 then curtime = curtime .. days .. " day" .. ( ( days > 1 ) and "s, " or ", " ) end
curtime = curtime .. ( ( hours < 10 ) and "0" or "" ) .. hours .. ":"
curtime = curtime .. ( ( minutes < 10 ) and "0" or "" ) .. minutes .. ":"
return curtime .. ( ( seconds < 10 and "0" or "" ) .. seconds )
end
---Update stuff
function xbans.clearbans()
xbans.banlist:Clear()
end
function xbans.populateBans( chunk )
if not chunk then chunk = xgui.data.bans end
xbans.showperma:SetDisabled( true )
xbans.isPopulating = xbans.isPopulating + 1
for steamID, baninfo in pairs( chunk ) do
if not ( xbans.showperma:GetChecked() == false and tonumber( baninfo.unban ) == 0 ) then
xgui.queueFunctionCall( xbans.addbanline, "bans", baninfo, steamID ) --Queue this via xgui.queueFunctionCall to prevent lag
end
end
xgui.queueFunctionCall( function() xbans.isPopulating = xbans.isPopulating - 1
if xbans.isPopulating == 0 then xbans.showperma:SetDisabled( false ) end end, nil )
end
function xbans.addbanline( baninfo, steamID )
xbans.banlist:AddLine( baninfo.name or steamID,
( baninfo.admin ) and string.gsub( baninfo.admin, "%(STEAM_%w:%w:%w*%)", "" ) or "",
(( tonumber( baninfo.unban ) ~= 0 ) and os.date( "%c", math.min( tonumber( baninfo.unban ), 4294967295 ) )) or "Never",
baninfo.reason,
steamID,
tonumber( baninfo.unban ) )
end
function xbans.banRemoved( banids )
for _,ID in ipairs( banids ) do
if xbans.openWindows[ID] then
xbans.openWindows[ID]:Remove()
xbans.openWindows[ID] = nil
end
for i, v in ipairs( xbans.banlist.Lines ) do
if v.Columns[5]:GetValue() == ID then
xbans.banlist:RemoveLine(i)
break
end
end
if xgui.data.sbans[ID] then
xgui.data.sbans[ID] = nil
if xbans.sbanWindow and xbans.sbanWindow:IsVisible() then
xbans.populateSBans( tonumber( xbans.sbanWindow.sbanPage:GetValue() ) )
end
end
end
end
function xbans.banUpdated( bantable )
for SteamID, data in pairs( bantable ) do
local found = false
for i, v in ipairs( xbans.banlist.Lines ) do
if v.Columns[5]:GetValue() == SteamID then
found = true
v:SetColumnText( 1, data.name or SteamID )
v:SetColumnText( 2, data.admin and string.gsub( data.admin, "%(STEAM_%w:%w:%w*%)", "" ) or "" )
v:SetColumnText( 3, (( tonumber( data.unban ) ~= 0 ) and os.date( "%c", math.min( tonumber( data.unban ), 4294967295 ) )) or "Never" )
v:SetColumnText( 4, data.reason )
v:SetColumnText( 5, SteamID )
v:SetColumnText( 6, tonumber( data.unban ) )
break
end
end
if not found then
local t = {}
t[SteamID] = data
xbans.populateBans( t )
end
if xbans.openWindows[SteamID] then xbans.ShowBanDetailsWindow( SteamID ) end
end
end
function xbans.updateSBans( chunk )
if xbans.sbanWindow and xbans.sbanWindow:IsVisible() then
xbans.populateSBans( tonumber( xbans.sbanWindow.sbanPage:GetValue() ) )
end
end
function xbans.xban( ply, cmd, args, dofreeze )
if args[1] and args[1] ~= "" then
local target = ULib.getUser( args[1] )
if target then
xgui.ShowBanWindow( target, target:SteamID(), dofreeze )
end
else
xgui.ShowBanWindow()
end
end
ULib.cmds.addCommandClient( "xgui xban", xbans.xban )
function xbans.fban( ply, cmd, args )
xbans.xban( ply, cmd, args, true )
end
ULib.cmds.addCommandClient( "xgui fban", xbans.fban )
xgui.hookEvent( "bans", "process", xbans.populateBans )
xgui.hookEvent( "bans", "clear", xbans.clearbans )
xgui.hookEvent( "bans", "add", xbans.banUpdated )
xgui.hookEvent( "bans", "remove", xbans.banRemoved )
xgui.hookEvent( "sbans", "process", xbans.updateSBans )
xgui.hookEvent( "sbans", "remove", xbans.updateSBans )
xgui.addModule( "Bans", xbans, "icon16/exclamation.png", "xgui_managebans" )
|
local TableUtil = {}
function TableUtil.clone(tbl)
local clone = {}
for key, value in pairs(tbl) do
if typeof(value) == "table" then
clone[key] = TableUtil.clone(value)
else
clone[key] = value
end
end
return clone
end
return TableUtil
|
----------------------------
-- Author: M. Utku Altinkaya
-- utkualtinkaya@gmail.com
----------------------------
--Base class for all scenes
Scene = {}
function Scene:init()
end
function Scene:draw()
end
function Scene:update(dt)
end
function Scene:keypressed( key, unicode )
end
function Scene:keyreleased( key, unicode )
end
function Scene:mousepressed( x, y, button )
end
--Class of UI container scenes, manages ui elements
UIScene = Class(Scene)
function UIScene:init()
Scene.init(self)
self.ui = {}
end
--draw all ui elements
function UIScene:draw()
for i, ui in pairs(self.ui) do
ui:draw()
end
end
function UIScene:update(dt)
for i, ui in pairs(self.ui) do
ui:update(dt)
end
end
--pass mouse press event to memeber ui elements
function UIScene:mousepressed(x, y, button )
for name, ui in pairs(self.ui) do
if ui:mousepressed(x,y,button) then
self:buttonClick(name)
end
end
end
--pass mouse keypress event to memeber ui elements
function UIScene:keypressed( key, unicode )
for name, ui in pairs(self.ui) do
ui:keypressed(key, unicode)
end
end
--set color of ui elements
function UIScene:setColor(color)
for _,ui in pairs(self.ui) do
ui.color = color
ui.normalColor = color
end
end
|
--[[
alert.lua
a finish effect that displays the cooldown at the center of the screen
--]]
local Addon = _G[...]
local L = _G.OMNICC_LOCALS
local Frame = CreateFrame("Frame", nil, UIParent)
Frame:SetPoint("CENTER")
Frame:SetSize(50, 50)
Frame:SetAlpha(0)
Frame:Hide()
local Icon = Frame:CreateTexture()
Icon:SetAllPoints()
local Anims = Frame:CreateAnimationGroup()
Anims:SetLooping("NONE")
Anims:SetScript(
"OnFinished",
function()
Frame:Hide()
end
)
local function newAnim(type, order, from, to)
local anim = Anims:CreateAnimation(type)
anim:SetDuration(0.3)
anim:SetOrder(order)
if type == "Scale" then
anim:SetOrigin("CENTER", 0, 0)
anim:SetScale(from, from)
else
anim:SetFromAlpha(from)
anim:SetToAlpha(to)
end
end
newAnim("Scale", 1, 2.5)
newAnim("Alpha", 1, 0, .7)
newAnim("Scale", 2, -2.5)
newAnim("Alpha", 2, .7, 0)
local Alert = Addon.FX:Create("alert", L.Alert, L.AlertTip)
function Alert:Run(cooldown)
local icon = Addon:GetButtonIcon(cooldown:GetParent())
if not icon then
return
end
Icon:SetVertexColor(icon:GetVertexColor())
Icon:SetTexture(icon:GetTexture())
Frame:Show()
if Anims:IsPlaying() then
Anims:Finish()
end
Anims:Play()
end
|
project "FractalPlayer"
configurations { "Debug", "Release" }
dependson { "FractalEngine" }
kind "ConsoleApp"
architecture "x64"
language "C++"
cppdialect "C++17"
characterset ("MBCS")
-- Set Directories
targetdir (flBinPath)
debugdir (flBinPath)
objdir (flBuildsPath .. "/output/%{cfg.platform}_%{cfg.buildcfg}")
symbolspath '$(OutDir)$(TargetName).pdb'
-- Includes
includedirs { "include/" }
includedirs { "../Engine/include/" }
-- Project Files
files { "source/**.cpp", "source/**.h", "source/**.inl" , "**.natvis" }
-- Third Party
third_party_prefix = "../3rdParty/"
dofile "../3rdParty/3rd-party.lua"
-- Lib links
libdirs { flBuildsPath }
links { "FractalEngine" }
|
-- SkyBlock plugin for cuberite.
-- Before starting the server, you need to add a (configurable world name in Config.ini)
-- world in the settings.ini under the section [Worlds]
-- Example: World=skyblock
PLUGIN = nil
ISLAND_NUMBER = nil -- Gets increased, before a new island is created
ISLAND_DISTANCE = nil -- Distance betweens the islands
ISLAND_SCHEMATIC = nil -- Schematic file for islands
SPAWN_SCHEMATIC = nil -- Schematic file for the spawn
SPAWN_CREATED = nil -- Check value, if spawn has already been created
SKYBLOCK = nil -- Instance of a world
PLAYERS = nil -- A table that contains player uuid and PlayerInfos
ISLANDS = nil -- A table contains island numbers and IslandInfo
WORLD_NAME = nil -- The world that the plugin is using
LEVELS = nil -- Store all levels
CONFIG_FILE = nil -- Config file for SkyBlock
BLOCK_VALUES = nil -- Store the points of block / meta
LANGUAGES = nil -- Contains a list of languages
LANGUAGE_DEFAULT = nil -- Default language file
LANGUAGE_OTHERS = nil -- Enable other language files
ISLAND_AREA = nil -- The island file
function Initialize(Plugin)
Plugin:SetName("SkyBlock")
Plugin:SetVersion(3)
PLUGIN = Plugin
ISLAND_NUMBER = 0
ISLAND_DISTANCE = 96
ISLAND_SCHEMATIC = ""
SPAWN_SCHEMATIC = ""
SPAWN_CREATED = false
PLAYERS = {}
ISLANDS = {}
WORLD_NAME = "skyblock"
LEVELS = {}
CONFIG_FILE = PLUGIN:GetLocalFolder() .. "/Config.ini"
BLOCK_VALUES = {}
LANGUAGES = {}
LANGUAGE_DEFAULT = "english.ini"
LANGUAGE_OTHERS = 1
-- Load all lua files
LoadLuaFiles()
-- Load Config file
LoadConfiguration()
ISLAND_AREA = cBlockArea()
if not(ISLAND_AREA:LoadFromSchematicFile(PLUGIN:GetLocalFolder() .. "/" .. ISLAND_SCHEMATIC)) then
ISLAND_AREA = nil
end
-- Check for world <WORLD NAME>
SKYBLOCK = cRoot:Get():GetWorld(WORLD_NAME)
if (SKYBLOCK == nil) then
LOGERROR("The plugin SkyBlock requires the world " .. WORLD_NAME .. ". Please add this line")
LOGERROR("World=" .. WORLD_NAME)
LOGERROR("to the section [Worlds] in the settings.ini.")
LOGERROR("Then stop and start the server again.")
return false
end
-- Create language folder
cFile:CreateFolder(PLUGIN:GetLocalFolder() .. "/languages/")
LoadLanguageFiles()
-- Load the points for block / meta
LoadBlockValues()
-- Load all ChallengeInfos
LoadAllLevels(PLUGIN:GetLocalFolder() .. "/challenges/Config.ini")
-- Load all PlayerInfos and IslandInfos from players who are in the world
LoadPlayerInfos()
-- Register hooks
cPluginManager:AddHook(cPluginManager.HOOK_CHUNK_GENERATING, OnChunkGenerating)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_DESTROYED, OnPlayerQuit)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_SPAWNED, OnPlayerSpawn)
cPluginManager:AddHook(cPluginManager.HOOK_WORLD_STARTED, OnWorldLoaded)
cPluginManager:AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage)
cPluginManager:AddHook(cPluginManager.HOOK_ENTITY_CHANGED_WORLD, OnPlayerChangedWorld)
-- This below are required for checking the permission in the island area
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_PLACING_BLOCK, OnBlockPlacing)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_LEFT_CLICK, OnPlayerLeftClick)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICK, OnPlayerRightClick)
-- Command Bindings
cPluginManager:BindCommand("/skyblock", "skyblock.command", CommandSkyBlock , " - Access to the skyblock plugin")
cPluginManager:BindCommand("/challenges", "skyblock.command", CommandChallenges , " - Access to the challenges")
cPluginManager:BindCommand("/island", "skyblock.command", CommandIsland , " - Access to the island commands")
LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true
end
function OnDisable()
LOG(PLUGIN:GetName() .. " is shutting down...")
end
function LoadConfiguration()
-- Create players folder
if (not cFile:IsFolder(PLUGIN:GetLocalFolder() .. "/players/")) then
cFile:CreateFolder(PLUGIN:GetLocalFolder() .. "/players/")
end
-- Create islands folder
if (not cFile:IsFolder(PLUGIN:GetLocalFolder() .. "/islands/")) then
cFile:CreateFolder(PLUGIN:GetLocalFolder() .. "/islands/")
end
local configIni = cIniFile()
configIni:ReadFile(CONFIG_FILE)
ISLAND_NUMBER = configIni:GetValueI("Island", "Number")
ISLAND_DISTANCE = configIni:GetValueI("Island", "Distance")
ISLAND_SCHEMATIC = "schematics/" .. configIni:GetValue("Schematic", "Island")
SPAWN_SCHEMATIC = "schematics/" .. configIni:GetValue("Schematic", "Spawn")
WORLD_NAME = configIni:GetValue("General", "Worldname")
SPAWN_CREATED = configIni:GetValueB("PluginValues", "SpawnCreated")
LANGUAGE_DEFAULT = configIni:GetValue("Language", "Default")
LANGUAGE_OTHERS = configIni:GetValueB("Language", "EnableOthers")
-- Reminder: Any new settings who gets added in new versions, should be added, to the config file trough the plugin, if not existent
end
-- Save settings who gets changed trough the plugin
function SaveConfiguration()
local configIni = cIniFile()
configIni:ReadFile(CONFIG_FILE)
configIni:SetValue("Island", "Number", ISLAND_NUMBER, true)
configIni:SetValueB("PluginValues", "SpawnCreated", SPAWN_CREATED, true)
configIni:WriteFile(CONFIG_FILE)
end
-- Only for the world that the plugin is using
function LoadPlayerInfos()
cRoot:Get():ForEachPlayer(function(a_Player)
if (a_Player:GetWorld():GetName() == WORLD_NAME) then
local playerInfo = cPlayerInfo.new(a_Player)
if (cFile:IsFolder(PLUGIN:GetLocalFolder() .. "/islands/" .. playerInfo.m_IslandNumber .. ".ini")) then
GetIslandInfo(playerInfo.m_IslandNumber)
end
PLAYERS[a_Player:GetUUID()] = playerInfo
end
end);
end
-- Loads all level challenges
function LoadAllLevels(a_File)
local configIni = cIniFile()
configIni:ReadFile(a_File)
local amount = configIni:GetNumValues("Levels")
for counter = 1, amount do
local fileLevel = configIni:GetValue("Levels", tostring(counter))
LEVELS[counter] = cLevel.new(fileLevel)
end
end
function LoadBlockValues()
local f = io.open(PLUGIN:GetLocalFolder() .. "/blockvalues.txt")
while true do
local line = f:read()
if (line == nil) then break end
local values = StringSplit(line, ":")
local point = tonumber(values[2])
if (string.find(values[1], "#") == nil) then
local id = tonumber(values[1])
BLOCK_VALUES[id] = {}
BLOCK_VALUES[id][0] = point
else
local idMeta = StringSplit(values[1], "#")
local id = tonumber(idMeta[1])
local meta = tonumber(idMeta[2])
if (BLOCK_VALUES[id] == nil) then
BLOCK_VALUES[id] = {}
end
BLOCK_VALUES[id][meta] = point
end
end
end
function LoadLanguageFiles()
local files = cFile:GetFolderContents(PLUGIN:GetLocalFolder() .. "/languages")
if
#files == 0 or
not(cFile:IsFile(PLUGIN:GetLocalFolder() .. "/languages/english.ini"))
then
-- Write Default language file
LANGUAGES["english.ini"] = cLanguage.new()
return
end
if (LANGUAGE_OTHERS) then
for i = 1, #files do
if (cFile:IsFile(PLUGIN:GetLocalFolder() .. "/languages/" .. files[i])) then
LANGUAGES[files[i]] = cLanguage.new(files[i])
end
end
else
LANGUAGES[LANGUAGE_DEFAULT] = cLanguage.new(LANGUAGE_DEFAULT)
end
end
function LoadLuaFiles()
local folders = { "/code", "/code/classes", "/code/commands" }
for _, folder in pairs(folders) do
local files = cFile:GetFolderContents(PLUGIN:GetLocalFolder() .. folder)
for _, file in pairs(files) do
if (string.sub(file, #file -3, #file) == ".lua") then
dofile(PLUGIN:GetLocalFolder() .. folder .. "/" .. file)
end
end
end
end
|
-- ProtectionAreas.lua
-- Defines the main plugin entrypoint, as well as some utility functions
--- Prefix for all messages logged to the server console
PluginPrefix = "ProtectionAreas: ";
--- Bounds for the area loading. Areas less this far in any direction from the player will be loaded into cPlayerAreas
g_AreaBounds = 48;
--- If a player moves this close to the PlayerAreas bounds, the PlayerAreas will be re-queried
g_AreaSafeEdge = 12;
--- Called by MCS when the plugin loads
-- Returns true if initialization successful, false otherwise
function Initialize(a_Plugin)
a_Plugin:SetName("ProtectionAreas");
a_Plugin:SetVersion(1);
InitializeConfig();
if (not(InitializeStorage())) then
LOGWARNING(PluginPrefix .. "failed to initialize Storage, plugin is disabled");
return false;
end
InitializeHooks(a_Plugin);
dofile(cPluginManager:GetPluginsPath() .. "/InfoReg.lua")
RegisterPluginInfoCommands()
-- We might be reloading, so there may be players already present in the server; reload all of them
cRoot:Get():ForEachWorld(
function(a_World)
ReloadAllPlayersInWorld(a_World:GetName());
end
);
return true;
end
--- Loads a cPlayerAreas object from the DB for the player, and assigns it to the player map
function LoadPlayerAreas(a_Player)
local PlayerID = a_Player:GetUniqueID();
local PlayerX = math.floor(a_Player:GetPosX());
local PlayerZ = math.floor(a_Player:GetPosZ());
local WorldName = a_Player:GetWorld():GetName();
g_PlayerAreas[PlayerID] = g_Storage:LoadPlayerAreas(a_Player:GetName(), PlayerX, PlayerZ, WorldName);
end
function ReloadAllPlayersInWorld(a_WorldName)
local World = cRoot:Get():GetWorld(a_WorldName);
World:ForEachPlayer(LoadPlayerAreas);
end
|
function onCreate()
setProperty('cameraSpeed', 1.8);
makeLuaSprite('sky', 'SonicP2/sky', -414, -440.8);
setScrollFactor('sky', 1, 1);
scaleObject('sky', 1.4, 1.4);
makeLuaSprite('backtrees', 'SonicP2/backtrees', -290.55, -298.3);
setScrollFactor('backtrees', 1.1, 1);
scaleObject('backtrees', 1.2, 1.2);
makeLuaSprite('trees', 'SonicP2/trees', -306, -334.65);
setScrollFactor('trees', 1.2, 1);
scaleObject('trees', 1.2, 1.2);
makeLuaSprite('floor', 'SonicP2/ground', -306, -334.65);
setScrollFactor('floor', 1.3, 1);
scaleObject('floor', 1.2, 1.2);
makeLuaSprite('readthefiletitlelol', 'makeGraphicsucks', 0, 0);
scaleObject('readthefiletitlelol', 6.0, 6.0);
setObjectCamera('readthefiletitlelol', 'other');
addLuaSprite('readthefiletitlelol', true);
makeLuaSprite('introcircle', 'StartScreens/CircleYouCantRun', 100, 0);
setObjectCamera('introcircle', 'other');
addLuaSprite('introcircle', true);
makeLuaSprite('introtext', 'StartScreens/TextYouCantRun', -100, 0);
setObjectCamera('introtext', 'other');
addLuaSprite('introtext', true);
--makeLuaSprite('greenhills', 'GreenHill', -428.5 + 50 + 700, -449.35 + 25 + 392 + 105 + 50);
--setScrollFactor('greenhills', 1, 1);
--scaleObject('greenhills', 8, 8);
addLuaSprite('sky', false);
addLuaSprite('backtrees', false);
addLuaSprite('trees', false);
addLuaSprite('floor', false);
end
function onStartCountdown()
doTweenX('circleTween', 'introcircle', -100, 2, 'quintOut')
doTweenX('textTween', 'introtext', 100, 2, 'quintOut')
return Function_Continue
end
function onSongStart()
doTweenAlpha('graphicAlpha', 'readthefiletitlelol', 0, 0.2, 'quintOut');
doTweenAlpha('circleAlpha', 'introcircle', 0, 0.2, 'quintOut');
doTweenAlpha('textAlpha', 'introtext', 0, 0.2, 'quintOut');
end
function onUpdate()
for i = 0, getProperty('unspawnNotes.length')-1 do
setPropertyFromGroup('unspawnNotes', i, 'noteSplashTexture', 'BloodSplash');
end
end
--The note splash texture took me so long to figure out..
|
require "./scripts/libcowgol"
local args = {...}
local infilename = args[2]
local outfilename = args[3]
local midcodes = loadmidcodes(infilename)
local hfp = io.open(outfilename, "w")
local function title(s)
return s:sub(1, 1):upper()..s:sub(2):lower()
end
-- Midcode names.
local first = true
for m, t in pairs(midcodes) do
hfp:write(string.format("const MIDCODE_%s := %d;\n", m, t.id))
end
-- Midcode subrecords.
for m, md in pairs(midcodes) do
if (#md.args > 0) then
hfp:write("record Midcode", title(m), "\n")
for _, a in ipairs(md.args) do
hfp:write("\t", a.name, ": ", a.type, ";\n")
end
hfp:write("end record;\n")
end
end
-- Midcode structure itself.
hfp:write("record Node\n");
for m, md in pairs(midcodes) do
if (#md.args > 0) then
hfp:write("\t", m:lower(), " @at(0): Midcode", title(m), ";\n")
end
end
hfp:write("\ttype: [Symbol];\n")
hfp:write("\tleft: [Node];\n")
hfp:write("\tright: [Node];\n")
hfp:write("\tdlink: [Node]; # only used during destruction and codegen\n")
hfp:write("\tproducer: [Instruction];\n")
hfp:write("\tconsumer: [Instruction];\n")
hfp:write("\tdesired_reg: RegId;\n")
hfp:write("\tproduced_reg: RegId;\n")
hfp:write("\top: uint8;\n")
hfp:write("end record;\n");
-- Routines for allocating midnodes.
hfp:write("sub AllocateNewNode(code: uint8): (m: [Node])\n")
hfp:write("\tm := Alloc(@bytesof Node) as [Node];\n")
hfp:write("\t#print(\"alloc \");\n");
hfp:write("\t#print_hex_i32(m as intptr as uint32);\n");
hfp:write("\t#print(\" op \");\n");
hfp:write("\t#print_i8(code);\n");
hfp:write("\t#print_nl();\n");
hfp:write("\tm.op := code;\n")
hfp:write("end sub;\n")
local function write_midcode_constructor(m, t)
local first = true
if t.hassizes then
if not m:find("0$") then
return
end
hfp:write("sub Mid", title(m):gsub("0$", ""), "(width: uint8")
first = false
else
hfp:write("sub Mid", title(m), "(")
end
if t.ins >= 1 then
if not first then
hfp:write(', ')
end
hfp:write('left: [Node]')
first = false
end
if t.ins == 2 then
if not first then
hfp:write(', ')
end
hfp:write('right: [Node]')
first = false
end
if (#t.args > 0) then
for _, a in ipairs(t.args) do
if not first then
hfp:write(", ")
end
hfp:write(a.name, ": ", a.type)
first = false
end
end
hfp:write("): (m: [Node])\n")
hfp:write("\tm := AllocateNewNode(MIDCODE_", m)
if t.hassizes then
hfp:write(" + WidthToIndex(width)")
end
hfp:write(");\n")
if t.ins >= 1 then
hfp:write('\tm.left := left;\n')
end
if t.ins == 2 then
hfp:write('\tm.right := right;\n')
end
for _, a in ipairs(t.args) do
hfp:write("\tm.", m:lower(), ".", a.name, " := ", a.name, ";\n")
end
hfp:write("end sub;\n")
end
for m, t in pairs(midcodes) do
write_midcode_constructor(m, t)
end
hfp:close()
|
return PlaceObj("ModDef", {
"title", "Rogue Rocket (Philip DeFranco) (Logo)",
"version", 1,
"version_major", 0,
"version_minor", 1,
"image", "Preview.png",
"id", "ChoGGi_Logos_RogueRocket",
"steam_id", "1739995106",
"author", "BrowncoatTrekky & ChoGGi",
"lua_revision", 1001569,
"TagColonyLogos", true,
"code", {
"Code/Script.lua",
},
"description", "[b]\"Sup you beautiful bastards?\" ~ Philip DeFranco[/b]\n\nRogue Rocket is a new media circuit formed by Philip DeFranco. Their logo seemed a good fit for Surviving Mars. This is for fellow fans of the YouTube channel.\n\nRogue Rocket website: https://roguerocket.com/\nPhilip DeFranco YouTube channel: https://www.youtube.com/user/sxephil/featured\n\n\nCredit for creation and implementation for Surviving Mars belongs to [b][url=https://steamcommunity.com/id/ChoGGi/]ChoGGi[/url][/b]. Commissioned by [b][url=https://steamcommunity.com/profiles/76561198030245978]BrowncoatTrekky.[/url][/b] No adaptations are to be made to this asset in this game without prior consent from [b][url=https://steamcommunity.com/id/ChoGGi/myworkshopfiles/]ChoGGi[/url][/b] and [b][url=https://steamcommunity.com/profiles/76561198030245978/myworkshopfiles/]BrowncoatTrekky[/url][/b]. Credit to Philip DeFranco & Rogue Rocket for the logo. Source file found [url=https://media.licdn.com/dms/image/C4E0BAQGQUM2BK_jUCg/company-logo_200_200/0?e=2159024400&v=beta&t=BT5wDlmxmqKUnlWu2S9TE1iyTsCl4Y5H8X1pNNp5uyg]here.[/url]",
})
|
local skynet = require "skynet"
local sharedata = require "sharedata"
local data_pool = {}
local query_queue = {}
local function query_sharedata(name)
if data_pool[name] then return data_pool[name] end
if not query_queue[name] then
query_queue[name] = {}
data_pool[name] = sharedata.query(name)
local tmp_queue = query_queue[name]
query_queue[name] = nil
for k,v in ipairs(tmp_queue) do skynet.wakeup(v) end
else
table.insert(query_queue[name], (coroutine.running()))
skynet.wait()
end
return data_pool[name]
end
return query_sharedata
|
--- @class Logger
--- @field defaultLogLevel LogLevel
local Logger
--- returns the global log history
--- @return LoggerLogEntry[]
function Logger.history()end
--- sets or gets the global log history size
--- @param size number|nil @desired number of log entries to keep in the history; if omitted, will return the current size; the starting value is 0 (disabled)
--- @return number @current or new history size
function Logger.historySize(size)end
--- creates a new logger instance
--- @param id string @identifier for the instance
--- @param loglevel LogLevel @can be 'nothing', 'error', 'warning', 'info', 'debug', or 'verbose', or a corresponding number between 0 and 5; uses hs.logger.defaultLogLevel if omitted
--- @return LoggerInstance @new logger instance
function Logger.new(id, loglevel)end
--- prints the global log history to the console
--- @param entries number|nil @maximum number of entries to print; if omitted, all entries in the history will be printed
--- @param level LogLevel|nil @desired log level (see hs.logger:setLogLevel()); if omitted, defaults to verbose
--- @param filter string|nil @string to filter the entries (by logger id or message) via string.find plain matching
--- @param caseSensitive boolean|nil @if `true`, filtering is case sensitive
function Logger.printHistory(entries, level, filter, caseSensitive)end
--- sets the log level for all logger instances (including objects' loggers)
--- @param lvl LogLevel @can be 'nothing', 'error', 'warning', 'info', 'debug', or 'verbose', or a corresponding number between 0 and 5
function Logger.setGlobalLogLevel(lvl)end
--- sets the log level for all currently loaded modules
--- @param lvl LogLevel @can be 'nothing', 'error', 'warning', 'info', 'debug', or 'verbose', or a corresponding number between 0 and 5
function Logger.setModulesLogLevel(lvl)end
|
local lsp = vim.lsp
local format = {}
local function nvim_create_augroup(group_name, definitions)
vim.api.nvim_command("augroup " .. group_name)
vim.api.nvim_command("autocmd!")
for _, def in ipairs(definitions) do
local command = table.concat(vim.tbl_flatten({ "autocmd", def }), " ")
vim.api.nvim_command(command)
end
vim.api.nvim_command("augroup END")
end
function format.lsp_before_save()
local defs = {}
local ext = vim.fn.expand("%:e")
table.insert(defs, { "BufWritePre", "*." .. ext, "lua vim.lsp.buf.formatting_sync(nil,1000)" })
if ext == "go" then
table.insert(
defs,
{ "BufWritePre", "*.go", "lua require('modules.completion.format').go_organize_imports_sync(1000)" }
)
end
nvim_create_augroup("lsp_before_save", defs)
end
-- Synchronously organise (Go) imports. Taken from
-- https://github.com/neovim/nvim-lsp/issues/115#issuecomment-654427197.
function format.go_organize_imports_sync(timeout_ms)
local context = { source = { organizeImports = true } }
vim.validate({ context = { context, "t", true } })
local params = vim.lsp.util.make_range_params()
params.context = context
-- See the implementation of the textDocument/codeAction callback
-- (lua/vim/lsp/handler.lua) for how to do this properly.
local result = lsp.buf_request_sync(0, "textDocument/codeAction", params, timeout_ms)
if not result or next(result) == nil then
return
end
local actions = result[1].result or nil
if not actions then
return
end
local action = actions[1]
-- textDocument/codeAction can return either Command[] or CodeAction[]. If it
-- is a CodeAction, it can have either an edit, a command or both. Edits
-- should be executed first.
if action.edit or type(action.command) == "table" then
if action.edit then
vim.lsp.util.apply_workspace_edit(action.edit)
end
if type(action.command) == "table" then
vim.lsp.buf.execute_command(action.command)
end
else
vim.lsp.buf.execute_command(action)
end
end
return format
|
local tango = require 'tango'
local client_backend = "socket"
local config = { address = os.getenv("TANGO_SERVER") or "localhost" }
local connect = tango.client[client_backend].connect
local client, android
if config.address == "localhost" then
os.execute("adb forward tcp:12345 tcp:12345")
end
describe("#BasicTests : `android` module with JVM access", function()
setup(function()
client = connect(config)
android = client.require "android"
end)
it("can call some basic runtime functions",
function()
local ext_storage_path = android.getExternalStoragePath()
assert.is_equal( "string", type(ext_storage_path) )
assert.truthy( ext_storage_path:find('/') )
local ext_files_dir = android.externalFilesDir
assert.is_equal( "string", type(ext_files_dir) )
assert.truthy( ext_files_dir:find(ext_storage_path), "android.externalFilesDir does not contain android.getExternalStoragePath()" )
end)
it("can get some device info",
function()
local product,version,name,flavor = android.getProduct(),android.getVersion(),
android.getName(),android.getFlavor()
assert.is_equal( "string", type(product) )
assert.is_equal( "string", type(version) )
assert.is_equal( "string", type(name) )
assert.is_equal( "string", type(flavor) )
assert.truthy( string.find( product..'/'..version..'/'..name..'/'..flavor,
"%/luajit%-launcher%-debug%/") )
end)
it("can get some device values",
function()
local scr_wid = android.getScreenWidth()
assert.is_equal( "number", type(scr_wid) )
assert.truthy( scr_wid>0 and scr_wid<9999 )
local scr_bri = android.getScreenBrightness()
assert.is_equal( "number", type(scr_bri) )
assert.truthy( scr_bri>0 and scr_bri<9999 )
local batt = android.getBatteryLevel()
assert.is_equal( "number", type(batt) )
assert.truthy( batt>0 and batt<9999 )
end)
it("can handle Android clipboard",
function()
local clipb = android.getClipboardText()
assert.is_equal( "string", type(clipb) )
android.setClipboardText("Hello, Android world!")
clipb = android.getClipboardText()
assert.is_equal( "Hello, Android world!", clipb )
end)
it("can exec a command in a subprocess",
function()
local out = android.stdout("uname", "-a")
assert.truthy( out:find("Linux") )
end)
it("can handle exceptions in jvm",
function()
local fn_FindClass_str = [[
name = ...
return android.jni:jpcallInContext(function(jni)
return jni.env[0].FindClass(jni.env, name)
end)
]]
local remFindClass = client.loadstring( fn_FindClass_str )
assert.is_not.equal(nil, remFindClass, "failed to push fn remFindClass() to server")
assert.equal('function', remFindClass.__tango_type)
local ok, aClazz = remFindClass("java/lang/String")
assert.equal(true, ok)
assert.equal("cdata<void *>", aClazz.__tango_type)
ok, aClazz = remFindClass("java/lang/NONEXISTANT")
assert.equal(false, ok)
assert.equal("string", type(aClazz))
assert.truthy(aClazz:find("Didn't find class"))
end)
end)
|
return ccompile{"main.c"};
|
local p = require 'pretty-print-ffi'.prettyPrint
local loop = require 'uv-ffi'
require 'safe-coro'(function ()
local timer = loop:newTimer()
p("About to sleep", timer)
timer:sleep(1000)
p("Done sleeping!", timer)
timer:close()
end)
loop:run('default')
|
--憶念の相剣
--
--Script by KillerDJSH
function c101107067.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--remove
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(101107067,0))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_REMOVE)
e2:SetCountLimit(1,101107067)
e2:SetTarget(c101107067.remtg)
e2:SetOperation(c101107067.remop)
c:RegisterEffect(e2)
--token
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(101107067,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_REMOVE)
e3:SetCountLimit(1,101107067+100)
e3:SetTarget(c101107067.sptg)
e3:SetOperation(c101107067.spop)
c:RegisterEffect(e3)
end
function c101107067.rmfilter(c)
return (c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_WYRM) or c:IsSetCard(0x16b))
and c:IsAbleToRemove() and (c:IsFaceup() or not c:IsOnField())
end
function c101107067.remtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c101107067.rmfilter,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_DECK,LOCATION_ONFIELD,nil)
if chk==0 then return g:GetCount()>0 end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_DECK)
end
function c101107067.remop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c101107067.rmfilter,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_DECK,LOCATION_ONFIELD,1,1,nil)
if #g>0 then
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
end
function c101107067.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,20001444,0x16b,TYPES_TOKEN_MONSTER+TYPE_TUNER,0,0,4,RACE_WYRM,ATTRIBUTE_WATER) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c101107067.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,20001444,0x16b,TYPES_TOKEN_MONSTER+TYPE_TUNER,0,0,4,RACE_WYRM,ATTRIBUTE_WATER) then
local token=Duel.CreateToken(tp,101107167)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetAbsoluteRange(tp,1,0)
e1:SetTarget(c101107067.splimit)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
token:RegisterEffect(e1,true)
Duel.SpecialSummonComplete()
end
end
function c101107067.splimit(e,c)
return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA)
end
|
vim.o.termguicolors = true
require('common.utils')
require('config.settings')
-- File auto commands
require('config.files')
require('config.mapping')
require('config.theme')
require('config.abbrev')
-- Everything else we want to use fennel for
-- Note: this runs AFTER fennel plugin configuration
require('config.fennel')
-- Plugins
require('config.plugins')
cmd "syntax enable"
cmd "syntax on"
|
-- premake5.lua
function AddWXWidgetStaticLibrary(libpath)
wxwidgetOption = "lib"
--links { "comctl32.lib" } -- necessary for WXWIDGET
--links { "rpcrt4.lib" } -- necessary for WXWIDGET
--defines { "UNICODE" } -- necessary for WXWIDGET
--defines { "_UNICODE" } -- necessary for WXWIDGET
includedirs{
libpath .. "wxWidgets/include/"
}
filter "system:Windows"
links { "comctl32.lib" } -- necessary for WXWIDGET
links { "rpcrt4.lib" } -- necessary for WXWIDGET
defines { "UNICODE" } -- necessary for WXWIDGET
defines { "_UNICODE" } -- necessary for WXWIDGET
filter "configurations:Debug"
links { "wxbase31ud.lib" } -- necessary for WXWIDGET
links { "wxmsw31ud_core.lib" } -- necessary for WXWIDGET
links { "wxpngd.lib" } -- necessary for WXWIDGET
links { "wxzlibd.lib" } -- necessary for WXWIDGET
filter "configurations:Release"
links { "wxbase31u.lib" } -- necessary for WXWIDGET
links { "wxmsw31u_core.lib" } -- necessary for WXWIDGET
links { "wxpng.lib" } -- necessary for WXWIDGET
links { "wxzlib.lib" } -- necessary for WXWIDGET
filter "platforms:x86"
libdirs
{
libpath .. "wxWidgets/lib/vc_".. wxwidgetOption .."/"
}
includedirs
{
libpath .. "wxWidgets/lib/vc_" .. wxwidgetOption .."/mswu/"
}
filter "platforms:x64"
libdirs
{
libpath .. "wxWidgets/lib/vc_x64_".. wxwidgetOption .."/"
}
includedirs
{
libpath .. "wxWidgets/lib/vc_x64_".. wxwidgetOption .."/mswu/"
}
filter {}
end
function AddWXWidgetDynamicLibrary(libpath)
wxwidgetOption = "dll"
--links { "comctl32.lib" } -- necessary for WXWIDGET
--links { "rpcrt4.lib" } -- necessary for WXWIDGET
--defines { "UNICODE" } -- necessary for WXWIDGET
--defines { "_UNICODE" } -- necessary for WXWIDGET
defines { "WXUSINGDLL" } -- necessary for WXWIDGET (DLL)
includedirs{
libpath .. "wxWidgets/include/"
}
filter "system:Windows"
links { "comctl32.lib" } -- necessary for WXWIDGET
links { "rpcrt4.lib" } -- necessary for WXWIDGET
defines { "UNICODE" } -- necessary for WXWIDGET
defines { "_UNICODE" } -- necessary for WXWIDGET
filter "configurations:Debug"
links { "wxbase31ud.lib" } -- necessary for WXWIDGET
links { "wxmsw31ud_core.lib" } -- necessary for WXWIDGET
links { "wxpngd.lib" } -- necessary for WXWIDGET
links { "wxzlibd.lib" } -- necessary for WXWIDGET
filter "configurations:Release"
links { "wxbase31u.lib" } -- necessary for WXWIDGET
links { "wxmsw31u_core.lib" } -- necessary for WXWIDGET
links { "wxpng.lib" } -- necessary for WXWIDGET
links { "wxzlib.lib" } -- necessary for WXWIDGET
filter "platforms:x86"
libdirs
{
libpath .. "wxWidgets/lib/vc_".. wxwidgetOption .."/"
}
includedirs
{
libpath .. "wxWidgets/lib/vc_" .. wxwidgetOption .."/mswu/"
}
filter "platforms:x64"
libdirs
{
libpath .. "wxWidgets/lib/vc_x64_".. wxwidgetOption .."/"
}
includedirs
{
libpath .. "wxWidgets/lib/vc_x64_".. wxwidgetOption .."/mswu/"
}
filter {}
end
rootdir = "../.."
srcroot = rootdir .. "/src/"
libroot = rootdir .. "/lib/"
workspace "RayTracerProject"
configurations { "Debug" , "Release" }
platforms { "x86" , "x64" }
location (rootdir .. "/build/solutions/".._ACTION)
filter "system:Windows"
libpath = libroot
filter { }
project "RayTracer"
kind "WindowedApp"
flags { "WinMain" }
language "C++"
targetdir (rootdir.."/bin/%{cfg.buildcfg}")
--cppdialect "C++17"
files
{
srcroot .. "**.h",
srcroot .. "**.cpp"
}
filter "system:Windows"
filter {}
--includedirs
--{
-- Invision libraries
-- srcroot
--}
AddWXWidgetStaticLibrary(libpath)
filter "configurations:Debug"
defines { "DEBUG" }
flags { "Symbols" }
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
filter "platforms:x86"
architecture "x86"
filter "platforms:x64"
architecture "x86_64"
|
local VariantSource = {}
VariantSource.__index = VariantSource
function VariantSource.For(baseName, count, extension)
local varSrc = {
Variants = {}
}
for i = 1, count do
table.insert(varSrc.Variants, MultiSource.For(baseName .. string.format("%02d", i) .. extension))
end
return setmetatable(varSrc, VariantSource)
end
function VariantSource:PlayRandom()
assert(getmetatable(self) == VariantSource, ERR_STATIC_CALL:format("PlayRandom", "VariantSource.For(baseName, count, extension)"))
local randIndex = math.random(1, #self.Variants)
self.Variants[randIndex]:Play()
end
function VariantSource:Play(index)
assert(getmetatable(self) == VariantSource, ERR_STATIC_CALL:format("Play", "VariantSource.For(baseName, count, extension)"))
if index < 1 or index > #self.Variants then
error("Attempt to play invalid VariantSource! Index out of range.")
end
self.Variants[index]:Play()
end
return VariantSource
|
AelsKoSGUI = AelsKoS:NewModule("GUI");
local mainWindow
local scrollFrame
local scrollBar
local contentFrame
local scrollItems = {
count = 0
}
local killData
local activeSortMode = ""
local sortFlag = true
function AelsKoSGUI:toggle()
if mainWindow == nil or not mainWindow:IsShown() then
self:show()
else
self:hide()
end
end
function AelsKoSGUI:show()
if mainWindow == nil then
self:createGUI()
end
self:loadKillData()
mainWindow:Show()
end
function AelsKoSGUI:hide()
mainWindow:Hide()
end
function AelsKoSGUI:loadKillData()
killData = {count = 0}
for k, v in pairs(AelsKoS.db.global.stats) do
local score = v.kills - v.deaths
table.insert(killData, {name = k, kills = v.kills, deaths = v.deaths, score = score})
killData.count = killData.count + 1
end
self:setScrollItems(killData)
end
function AelsKoSGUI:sortBy(sortMode)
if sortMode == activeSortMode then
sortFlag = not sortFlag
else
sortFlag = true
end
if sortMode == "name" then
if(sortFlag) then
table.sort(killData, function(a, b)
return a.name < b.name
end)
else
table.sort(killData, function(a, b)
return a.name > b.name
end)
end
elseif sortMode == "kills" or sortMode == "deaths" or sortMode == "score" then
if(sortFlag) then
table.sort(killData, function(a, b)
return a[sortMode] > b[sortMode]
end)
else
table.sort(killData, function(a, b)
return a[sortMode] < b[sortMode]
end)
end
end
activeSortMode = sortMode
self:setScrollItems(killData)
end
function AelsKoSGUI:createGUI()
self:createMainWindow()
self:createScrollFrame()
self:createScrollContent()
end
function AelsKoSGUI:setScrollItems(items)
for k, v in ipairs(items) do
local item
if(k > scrollItems.count) then
item = self:createScrollItem()
else
item = scrollItems[k]
end
item:setText(v.name, v.kills, v.deaths, v.score)
if v.score > 0 then
item.text4:SetTextColor(0, 1, 0)
elseif v.score < 0 then
item.text4:SetTextColor(0.9, 0, 0)
else
item.text4:SetTextColor(1, 0.82, 0)
end
end
contentFrame:SetHeight(16 * items.count)
end
function AelsKoSGUI:createMainWindow()
mainWindow = CreateFrame("Frame", "AelsKoSMainWindow", UIParent)
mainWindow:SetFrameStrata("DIALOG")
mainWindow:SetToplevel(true)
mainWindow:EnableMouse(true)
mainWindow:SetMovable(true)
mainWindow:SetClampedToScreen(true)
mainWindow:SetWidth(384)
mainWindow:SetHeight(512)
mainWindow:SetPoint("TOP", 0, -50)
mainWindow:Hide()
mainWindow:SetScript('OnShow', function() PlaySound(SOUNDKIT.IG_MAINMENU_OPTION) end)
mainWindow:SetScript('OnHide', function() PlaySound(SOUNDKIT.GS_TITLE_OPTION_EXIT) end)
mainWindow:RegisterForDrag('LeftButton')
mainWindow:SetScript('OnDragStart', function(f) f:StartMoving() end)
mainWindow:SetScript('OnDragStop', function(f) f:StopMovingOrSizing() end)
local closeButton = CreateFrame("Button", "AelsKoSCloseButton", mainWindow, "UIPanelCloseButton");
closeButton:SetPoint("TOPRIGHT", mainWindow, -30, -8);
local backgroundIconTexture = mainWindow:CreateTexture("AelsKoSIcon", "BACKGROUND");
backgroundIconTexture:SetTexture("Interface\\FriendsFrame\\FriendsFrameScrollIcon");
backgroundIconTexture:SetWidth(60);
backgroundIconTexture:SetHeight(60);
backgroundIconTexture:SetPoint("TOPLEFT", 7, -6);
local backgroundTopLeft = mainWindow:CreateTexture("AelsKoSBGTL", "ARTWORK");
backgroundTopLeft:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-TopLeft");
backgroundTopLeft:SetWidth(256);
backgroundTopLeft:SetHeight(256);
backgroundTopLeft:SetPoint("TOPLEFT");
local backgroundTopRight = mainWindow:CreateTexture("AelsKoSBGTR", "ARTWORK");
backgroundTopRight:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-TopRight");
backgroundTopRight:SetWidth(128);
backgroundTopRight:SetHeight(256);
backgroundTopRight:SetPoint("TOPRIGHT");
local backgroundBottomLeft = mainWindow:CreateTexture("AelsKoSBGBL", "ARTWORK");
backgroundBottomLeft:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-General-BottomLeft");
backgroundBottomLeft:SetWidth(256);
backgroundBottomLeft:SetHeight(256);
backgroundBottomLeft:SetPoint("BOTTOMLEFT");
local backgroundBottomRight = mainWindow:CreateTexture("AelsKoSBGBR", "ARTWORK");
backgroundBottomRight:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-General-BottomRight");
backgroundBottomRight:SetWidth(128);
backgroundBottomRight:SetHeight(256);
backgroundBottomRight:SetPoint("BOTTOMRIGHT");
local title = mainWindow:CreateFontString("ARTWORK")
title:SetFontObject("GameFontNormal")
title:SetPoint("TOP", mainWindow, "TOP", 0, -18)
title:SetText("AelsKoS")
end
function AelsKoSGUI:createScrollFrame()
scrollFrame = CreateFrame("ScrollFrame", "AelsKoSInnerFrame", mainWindow)
scrollFrame:EnableMouse(true)
scrollFrame:SetPoint("TOPLEFT", 19, -95)
scrollFrame:SetPoint("BOTTOMRIGHT", -43, 81)
scrollFrame:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
scrollFrame:SetBackdropBorderColor(0.4, 0.4, 0.4)
scrollFrame:EnableMouseWheel(true)
scrollFrame:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel)
scrollBar = CreateFrame("Slider", "TestScroll", scrollFrame, "UIPanelScrollBarTemplate")
scrollBar:SetPoint("TOPRIGHT", scrollFrame, "TOPRIGHT", -6, -20)
scrollBar:SetPoint("BOTTOMRIGHT", scrollFrame, "BOTTOMRIGHT", -6, 20)
scrollBar:SetMinMaxValues(0, 1000)
scrollBar:SetValueStep(16)
scrollBar:SetValue(0)
scrollBar:SetWidth(16)
scrollBar:SetHeight(50)
scrollBar:SetScript("OnValueChanged", ScrollBar_OnScrollValueChanged)
scrollBar.scrollStep = 16
local scrollbg = scrollBar:CreateTexture(nil, "BACKGROUND")
scrollbg:SetAllPoints(scrollBar)
scrollbg:SetColorTexture(0, 0, 0, 0.4)
local testTab = CreateFrame("Button", "TestTab", scrollFrame, "WhoFrameColumnHeaderTemplate")
testTab:SetPoint("BOTTOMLEFT", scrollFrame, "TOPLEFT")
WhoFrameColumn_SetWidth(testTab, 162)
testTab:SetText("Name")
testTab:EnableMouse(true)
testTab:SetScript("OnClick", function() AelsKoSGUI:sortBy("name") end)
local testTab2 = CreateFrame("Button", "TestTab2", scrollFrame, "WhoFrameColumnHeaderTemplate")
testTab2:SetPoint("TOPLEFT", testTab, "TOPRIGHT")
WhoFrameColumn_SetWidth(testTab2, 46)
testTab2:SetText("Kills")
testTab2:EnableMouse(true)
testTab2:SetScript("OnClick", function() AelsKoSGUI:sortBy("kills") end)
local testTab3 = CreateFrame("Button", "TestTab3", scrollFrame, "WhoFrameColumnHeaderTemplate")
testTab3:SetPoint("TOPLEFT", testTab2, "TOPRIGHT")
WhoFrameColumn_SetWidth(testTab3, 46)
testTab3:SetText("Deaths")
testTab3:EnableMouse(true)
testTab3:SetScript("OnClick", function() AelsKoSGUI:sortBy("deaths") end)
local testTab4 = CreateFrame("Button", "TestTab4", scrollFrame, "WhoFrameColumnHeaderTemplate")
testTab4:SetPoint("TOPLEFT", testTab3, "TOPRIGHT")
WhoFrameColumn_SetWidth(testTab4, 46)
testTab4:SetText("Score")
testTab4:EnableMouse(true)
testTab4:SetScript("OnClick", function() AelsKoSGUI:sortBy("score") end)
end
function AelsKoSGUI:createScrollContent()
contentFrame = CreateFrame("Frame", "Hywqe", scrollFrame)
scrollFrame:SetScrollChild(contentFrame)
contentFrame:SetPoint("TOPLEFT", 0, 0)
contentFrame:SetPoint("TOPRIGHT", 0, 0)
contentFrame:SetHeight(400)
end
function AelsKoSGUI:createScrollItem()
local itemIndex = scrollItems.count + 1
scrollItems.count = itemIndex
local listButton = CreateFrame("Button", "ScrollItem" .. itemIndex, contentFrame);
listButton:SetWidth(298);
listButton:SetHeight(16);
listButton:RegisterForClicks("LeftButtonUp", "RightButtonUp");
listButton:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight");
listButton:GetHighlightTexture():SetBlendMode("ADD");
if itemIndex == 1 then
listButton:SetPoint("TOPLEFT", 0, 0);
else
listButton:SetPoint("TOPLEFT", scrollItems[itemIndex - 1].button, "BOTTOMLEFT");
end
local listButtonText = listButton:CreateFontString("ScrollItemButton" .. itemIndex .. "Text1", "BORDER");
listButtonText:SetWidth(142);
listButtonText:SetHeight(14);
listButtonText:SetJustifyH("LEFT");
listButtonText:SetJustifyV("MIDDLE");
listButtonText:SetFontObject("GameFontNormalSmall");
listButtonText:SetPoint("TOPLEFT", listButton, "TOPLEFT", 10, 0);
listButtonText:SetText("Aelexe-Frostmourne")
local listButtonText2 = listButton:CreateFontString("ScrollItemButton" .. itemIndex .. "Text2", "BORDER");
listButtonText2:SetWidth(36);
listButtonText2:SetHeight(14);
listButtonText2:SetJustifyH("RIGHT");
listButtonText2:SetJustifyV("MIDDLE");
listButtonText2:SetFontObject("GameFontNormalSmall");
listButtonText2:SetPoint("TOPLEFT", listButtonText, "TOPRIGHT", 15, 0);
listButtonText2:SetText("3")
listButtonText2:SetTextColor(0, 1, 0)
local listButtonText3 = listButton:CreateFontString("ScrollItemButton" .. itemIndex .. "Text3", "BORDER");
listButtonText3:SetWidth(36);
listButtonText3:SetHeight(14);
listButtonText3:SetJustifyH("RIGHT");
listButtonText3:SetJustifyV("MIDDLE");
listButtonText3:SetFontObject("GameFontNormalSmall");
listButtonText3:SetPoint("TOPLEFT", listButtonText2, "TOPRIGHT", 10, 0);
listButtonText3:SetText("1")
listButtonText3:SetTextColor(0.9, 0, 0)
local listButtonText4 = listButton:CreateFontString("ScrollItemButton" .. itemIndex .. "Text4", "BORDER");
listButtonText4:SetWidth(36);
listButtonText4:SetHeight(14);
listButtonText4:SetJustifyH("RIGHT");
listButtonText4:SetJustifyV("MIDDLE");
listButtonText4:SetFontObject("GameFontNormalSmall");
listButtonText4:SetPoint("TOPLEFT", listButtonText3, "TOPRIGHT", 10, 0);
listButtonText4:SetText("2")
listButtonText4:SetTextColor(0, 1, 0)
scrollItems[itemIndex] = {
button = listButton,
text1 = listButtonText,
text2 = listButtonText2,
text3 = listButtonText3,
text4 = listButtonText4,
setText = function(self, content1, content2, content3, content4)
self.text1:SetText(content1)
self.text2:SetText(content2)
self.text3:SetText(content3)
self.text4:SetText(content4)
end
}
return scrollItems[itemIndex]
end
function ScrollBar_OnScrollValueChanged(frame, value)
local difference = contentFrame:GetHeight() - scrollFrame:GetHeight()
local scrollAmount = difference * (value / 1000)
contentFrame:SetPoint("TOPLEFT", 0, scrollAmount)
contentFrame:SetPoint("TOPRIGHT", 0, scrollAmount)
end
function ScrollFrame_OnMouseWheel(frame, value)
scrollBar:SetValue(scrollBar:GetValue() + (scrollBar.scrollStep * -value))
end
|
local Module = nn.Module
-- You can use this to manually forget past memories in AbstractRecurrent instances
function Module:forget()
if self.modules then
for i,module in ipairs(self.modules) do
module:forget()
end
end
return self
end
-- Used by nn.Sequencers
function Module:remember(remember)
if self.modules then
for i, module in ipairs(self.modules) do
module:remember(remember)
end
end
return self
end
function Module:stepClone(shareParams, shareGradParams)
return self:sharedClone(shareParams, shareGradParams, true)
end
function Module:backwardOnline()
print("Deprecated Jan 6, 2016. By default rnn now uses backwardOnline, so no need to call this method")
end
-- calls setOutputStep on all component AbstractRecurrent modules
-- used by Recursor() after calling stepClone.
-- this solves a very annoying bug...
function Module:setOutputStep(step)
if self.modules then
for i,module in ipairs(self.modules) do
module:setOutputStep(step)
end
end
end
-- set the maximum number of backpropagation through time (BPTT) time-steps
function Module:maxBPTTstep(rho)
if self.modules then
for i, module in ipairs(self.modules) do
module:maxBPTTstep(rho)
end
end
end
function Module:getHiddenState(step)
if self.modules then
local hiddenState = {}
for i, module in ipairs(self.modules) do
hiddenState[i] = module:getHiddenState(step)
end
return hiddenState
end
end
function Module:setHiddenState(step, hiddenState)
if self.modules then
assert(torch.type(hiddenState) == 'table')
for i, module in ipairs(self.modules) do
module:setHiddenState(step, hiddenState[i])
end
end
end
function Module:getGradHiddenState(step)
if self.modules then
local gradHiddenState = {}
for i, module in ipairs(self.modules) do
gradHiddenState[i] = module:getGradHiddenState(step)
end
return gradHiddenState
end
end
function Module:setGradHiddenState(step, gradHiddenState)
if self.modules then
assert(torch.type(gradHiddenState) == 'table')
for i, module in ipairs(self.modules) do
module:setGradHiddenState(step, gradHiddenState[i])
end
end
end
|
-- moneytweakdata.lua - MoneyTweakData:init, fixes infinite money loss at the results/exp screen.
-- Must be in this seperate hook as the main init function is called on the loading of the tweak_data lua file, so this hook will be added after the main call of it has already taken place
-- This method prevents issues with other mods that may also touch this function
-- Gets called after every call of the init function on the MoneyTweakData class table, init is called in tweak_data after it has already been initialized for a particular difficulty
Hooks:PostHook(MoneyTweakData, "init", "BigLobbyModifyMoneyTweak", function(self)
self.alive_humans_multiplier = self._create_value_table(1, self.alive_players_max, BigLobbyGlobals:num_player_slots(), false, 1)
end)
|
function hsvToRgb(h, s, v) -- from https://love2d.org/wiki/HSV_color
if s <= 0 then return v,v,v end
h, s, v = h/256*6, s/255, v/255
local c = v*s
local x = (1-math.abs((h%2)-1))*c
local m,r,g,b = (v-c), 0,0,0
if h < 1 then r,g,b = c,x,0
elseif h < 2 then r,g,b = x,c,0
elseif h < 3 then r,g,b = 0,c,x
elseif h < 4 then r,g,b = 0,x,c
elseif h < 5 then r,g,b = x,0,c
else r,g,b = c,0,x
end return (r+m)*255,(g+m)*255,(b+m)*255
end
function randomChoice(array)
return array[love.math.random(1,#array)]
end
function vectorNorm(array)
local sum = 0
for i=1,#array do sum = sum + array[i]*array[i] end
return math.sqrt(sum)
end
function vectorNormalized(array)
local n = vectorNorm(array)
local out = {}
for i=1,#array do out[i]=array[i]/n end
return out
end
function randomCharacter()
return string.char(love.math.random(string.byte("A"), string.byte("Z")))
end
function loveDoFile(filename)
return assert(loadstring(love.filesystem.read(filename), filename))()
end
function clamp(value, low, hi)
return math.max(low, math.min(value, hi))
end
|
local types = {}
for _, key in ipairs(KEYS) do
table.insert(types, redis.call('type', key))
end
return types
|
--[[ TEMPLATE CHECKS
=============== ]]
check_parent = function (n, parent_type)
it("appears as part of a " .. parent_type, function()
expect(n:appears_as_child_of_type(parent_type)).should_be(true)
end)
end
is_a_lone_feature = function (n)
it("appears as a root node", function()
expect(n:appears_as_root_node()).should_be(true)
end)
it("should not have children", function()
expect(count(n:direct_children())).should_be(0)
end)
end
does_not_cross_a_contig_boundary = function(n, childtype)
it("does not have a CDS overlapping a gap", function()
local ovl = feature_index:get_features_for_range(n:get_seqid(),
n:get_range())
local contigs = {}
for _,v in ipairs(ovl) do
if v:get_type() == "gap" then
for c in n:children() do
if c:get_type() == childtype then
expect(c:get_range():overlap(v:get_range())).should_be_falsy()
end
end
end
end
end)
end
--[[ GENE
==== ]]
describe.feature("gene", function(gene)
local valid_child_types = {"mRNA","tRNA","rRNA","snoRNA","snRNA", "scRNA",
"lncRNA", "ncRNA", "promoter"}
does_not_cross_a_contig_boundary(gene, "CDS")
it("has only allowed child types", function()
for f in gene:direct_children() do
expect(valid_child_types).should_contain(f:get_type())
end
end)
it("has at least one valid child", function()
local has_child = false
for f in gene:direct_children() do
if not has_child and table.contains(valid_child_types, f:get_type()) then
has_child = true
break
end
end
expect(has_child).should_be(true)
end)
it("only contains allowed attributes", function()
for k,_ in gene:attribute_pairs() do
expect({"ID", "Name", "comment", "Note", "End_range",
"Start_range", "Dbxref", "controlled_curation",
"previous_systematic_id", "fiveEndPartial", "threeEndPartial",
"literature", "synonym", "eupathdb_uc",
"internalGap", "ratt_ortholog", "original_prot_length",
"Target", "has_internal_stop", "has_frameshift"}).should_contain(k)
end
end)
it("appears as a root node", function()
expect(gene:appears_as_root_node()).should_be(true)
end)
it("contains all child features within its coordinates", function()
for child in gene:children() do
expect(gene:get_range():contains(child:get_range())).should_be(true)
end
end)
it("has consistent strands across all children", function()
for child in gene:children() do
expect(gene:get_strand()).should_be(child:get_strand())
end
end)
it("does not overlap another protein coding gene", function()
local nof_genes_at_site = 0
local overlapping = feature_index:get_features_for_range(gene:get_seqid(),
gene:get_range())
if gene:has_child_of_type("mRNA") then
for _,f in ipairs(overlapping) do
if f:get_type() == "gene" and f:has_child_of_type("mRNA") then
nof_genes_at_site = nof_genes_at_site + 1
end
end
expect(nof_genes_at_site).should_equal(1)
end
end)
end)
--[[ PSEUDOGENE
========== ]]
describe.feature("pseudogene", function(pseudogene)
does_not_cross_a_contig_boundary(pseudogene, "pseudogenic_exon")
it("contains a pseudogenic_transcript", function()
expect(pseudogene:has_child_of_type("pseudogenic_transcript")).should_be(true)
end)
it("has only allowed child types", function()
for f in pseudogene:direct_children() do
expect({"pseudogenic_transcript"}).should_contain(f:get_type())
end
end)
it("appears as a root node", function()
expect(pseudogene:appears_as_root_node()).should_be(true)
end)
it("only contains allowed attributes", function()
for k,_ in pseudogene:attribute_pairs() do
expect({"ID", "Name", "comment", "Note", "End_range",
"Start_range", "Dbxref", "controlled_curation",
"previous_systematic_id", "literature",
"synonym", "eupathdb_uc", "has_internal_stop",
"has_frameshift", "has_start", "has_stop",
"original_prot_length", "Target",
"ratt_ortholog", "threeEndPartial",
"fiveEndPartial"}).should_contain(k)
end
end)
it("contains all child features within its coordinates", function()
for child in pseudogene:children() do
expect(pseudogene:get_range():overlap(child:get_range())).should_be(true)
end
end)
it("has consistent strands across all children", function()
for child in pseudogene:children() do
expect(pseudogene:get_strand()).should_be(child:get_strand())
end
end)
end)
--[[ PSEUDOGENIC_TRANSCRIPT
====================== ]]
describe.feature("pseudogenic_transcript", function(ptranscript)
check_parent(ptranscript, "pseudogene")
it("only contains allowed attributes", function()
for k,_ in ptranscript:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "End_range",
"Start_range", "Dbxref", "controlled_curation",
"previous_systematic_id"}).should_contain(k)
end
end)
it("contains at least one pseudogenic_exon", function()
expect(ptranscript:has_child_of_type("pseudogenic_exon")).should_be(true)
end)
it("has only allowed child types", function()
for f in ptranscript:direct_children() do
expect({"pseudogenic_exon"}).should_contain(f:get_type())
end
end)
end)
--[[ PSEUDOGENIC_EXON
================ ]]
describe.feature("pseudogenic_exon", function(pexon)
check_parent(pexon, "pseudogenic_transcript")
it("only contains allowed attributes", function()
for k,_ in pexon:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "End_range",
"Start_range", "Dbxref", "controlled_curation",
"previous_systematic_id"}).should_contain(k)
end
end)
it("should not have children", function()
expect(count(pexon:direct_children())).should_be(0)
end)
end)
--[[ MRNA
==== ]]
describe.feature("mRNA", function(mrna)
local dnaseq = mrna:extract_sequence("CDS", true, region_mapping):lower()
local protseq = mrna:extract_and_translate_sequence("CDS", true,
region_mapping)
check_parent(mrna, "gene")
it("only contains allowed attributes", function()
for k,_ in mrna:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "End_range",
"Start_range", "Dbxref", "controlled_curation",
"previous_systematic_id",
"stop_codon_redefined_as_selenocysteine"}).should_contain(k)
end
end)
it("consists of less than 50% Ns", function()
expect(dnaseq:char_count("n")/dnaseq:len()).should_be_smaller_than(0.5)
end)
it("has at least one CDS child", function()
expect(mrna:has_child_of_type("CDS")).should_be(true)
end)
it("has only allowed child types", function()
for f in mrna:direct_children() do
expect({"CDS", "exon", "five_prime_UTR",
"three_prime_UTR"}).should_contain(f:get_type())
end
end)
it("has a coding sequence >= 3bp", function()
expect(dnaseq:len()).should_be_larger_than(2)
end)
it("has a protein product >= 10aa", function()
expect(protseq:len()).should_be_larger_than(10)
end)
it("has non-partial CDS ending on a stop codon", function()
local in_partial_gene = false
for _,g in ipairs(mrna:get_path()) do
if g:get_type() == "gene" then
if ((g:get_strand() == "+" and g:get_attribute("End_range")) or
(g:get_strand() == "-" and g:get_attribute("Start_range")) or
g:get_attribute("threeEndPartial")) then
in_partial_gene = true
break
end
end
end
if not in_partial_gene then
expect(protseq:sub(-1)).should_match("[*+#]")
end
end)
it("has non-partial CDS beginning with a start codon", function()
local in_partial_gene = false
for _,g in ipairs(mrna:get_path()) do
if g:get_type() == "gene" then
if ((g:get_strand() == "+" and g:get_attribute("Start_range")) or
(g:get_strand() == "-" and g:get_attribute("End_range")) or
g:get_attribute("fiveEndPartial")) then
in_partial_gene = true
break
end
end
end
if not in_partial_gene then
expect(protseq:sub(1,1)).should_match("[Mm]")
end
end)
it("has non-selenocysteine CDS with no internal stop codons", function()
local overlapping = feature_index:get_features_for_range(mrna:get_seqid(),
mrna:get_range())
is_selenocysteine = false
for _,n in pairs(overlapping) do
for c in n:children() do
if not is_selenocysteine
and c:get_attribute("stop_codon_redefined_as_selenocysteine") then
is_selenocysteine = true
break
end
end
end
if not is_selenocysteine then
expect(protseq:sub(1, -2)).should_not_match("[*+#]")
end
end)
it("agrees exactly with CDS/UTR coordinates of its children", function()
local rng = nil
-- collect and join CDS ranges
for c in mrna:children() do
if c:get_type() == "CDS" or string.match(c:get_type(), "UTR") then
if not rng then
rng = c:get_range()
else
rng = rng:join(c:get_range())
end
end
end
-- should overlap with at least one feature
expect(rng).should_be_truthy()
-- check if coordinates match
if rng then
expect(rng:get_start() == mrna:get_range():get_start() and
rng:get_end() == mrna:get_range():get_end()).should_be_truthy()
end
end)
end)
--[[ FIVE_PRIME_UTR
============== ]]
describe.feature("five_prime_UTR", function(futr)
check_parent(futr, "gene")
it("only contains allowed attributes", function()
for k,_ in futr:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "End_range",
"Start_range", "Dbxref", "controlled_curation",
"previous_systematic_id", "literature"}).should_contain(k)
end
end)
it("should not have children", function()
expect(#(collect(futr:direct_children()))).should_be(0)
end)
end)
--[[ THREE_PRIME_UTR
=============== ]]
describe.feature("three_prime_UTR", function(tutr)
check_parent(tutr, "gene")
it("only contains allowed attributes", function()
for k,_ in tutr:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "End_range",
"Start_range", "Dbxref", "controlled_curation",
"previous_systematic_id", "literature"}).should_contain(k)
end
end)
it("should not have children", function()
expect(#(collect(tutr:direct_children()))).should_be(0)
end)
end)
--[[ CDS
=== ]]
describe.feature("CDS", function(cds)
it("appears as child of an mRNA", function()
expect(cds:appears_as_child_of_type("mRNA")).should_be(true)
end)
it("only contains allowed attributes", function()
for k,_ in cds:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "End_range",
"Start_range", "Dbxref", "controlled_curation",
"previous_systematic_id"}).should_contain(k)
end
end)
it("should not have children", function()
expect(#(collect(cds:direct_children()))).should_be(0)
end)
end)
--[[ POLYPEPTIDE
=========== ]]
derives_from = {}
describe.feature("polypeptide", function(pp)
it("must be derived_from a unique mRNA", function()
local dfrom = pp:get_attribute("Derives_from")
expect(dfrom).should_not_be(nil)
expect(derives_from).should_not_have_key(dfrom)
derives_from[dfrom] = true
end)
it("appears as a root node", function()
expect(pp:appears_as_root_node()).should_be(true)
end)
it("has a required product attribute", function()
expect(pp:get_attribute("product")).should_not_be(nil)
end)
it("has only allowed child types", function()
for f in pp:direct_children() do
expect({"polypeptide_motif","protein_match",
"polypeptide_domain", "transmembrane_polypeptide_region",
"transmembrane_polypeptide_region",
"non_cytoplasmic_polypeptide_region",
"membrane_structure"}).should_contain(f:get_type())
end
end)
it("only contains allowed attributes", function()
for k,_ in pp:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "End_range",
"Start_range", "Dbxref", "controlled_curation",
"previous_systematic_id", "Ontology_term", "Derives_from",
"cytoplasmic_polypeptide_region", "literature",
"non_cytoplasmic_polypeptide_region",
"transmembrane_polypeptide_region", "membrane_structure",
"gPI_anchor_cleavage_site", "paralogous_to", "orthologous_to",
"polypeptide_domain", "product", "product_synonym",
"signal_peptide", "similarity",
"stop_codon_redefined_as_selenocysteine",
"translation", "ortholog_cluster"}).should_contain(k)
end
end)
local overlapping = feature_index:get_features_for_range(pp:get_seqid(),
pp:get_range())
it("overlaps the transcript it derives_from", function()
local num_transcripts = 0
expect(#overlapping).should_be_larger_than(0)
if #overlapping > 0 then
for _,ovl_feat in ipairs(overlapping) do
for c in ovl_feat:children() do
if c:get_attribute("ID") == pp:get_attribute("Derives_from") then
num_transcripts = num_transcripts + 1
end
end
end
expect(num_transcripts).should_be_larger_than(0)
end
end)
it("agrees exactly with CDS of >=1 overlapping coding transcripts", function()
local nof_possible = 0
local nof_correct = 0
-- check every feature in the range
for _,ovl_feat in ipairs(overlapping) do
for n in ovl_feat:children() do
if n:get_type() == "mRNA"
or n:get_type() =="pseudogenic_transcript" then
-- locate transcript (no pseudogene etc)
local rng = nil
-- collect and join CDS ranges
for c in n:children() do
if c:get_type() == "CDS"
or c:get_type() == "pseudogenic_exon" then
if not rng then
rng = c:get_range()
else
rng = rng:join(c:get_range())
end
end
end
-- check if coordinates match
if rng then
nof_possible = nof_possible + 1
if rng:get_start() == pp:get_range():get_start() and
rng:get_end() == pp:get_range():get_end() then
nof_correct = nof_correct + 1
end
end
end
end
end
if nof_possible > 0 then
expect(nof_correct).should_be_larger_than(0)
end
end)
end)
--[[ POLYPEPTIDE_MOTIF
================= ]]
describe.feature("polypeptide_motif", function(cds)
it("appears as child of a polypeptide", function()
expect(cds:appears_as_child_of_type("polypeptide")).should_be(true)
end)
it("only contains allowed attributes", function()
for k,_ in cds:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note",
"Dbxref", "controlled_curation",
"literature"}).should_contain(k)
end
end)
it("should not have children", function()
expect(#(collect(cds:direct_children()))).should_be(0)
end)
end)
--[[ NCRNA
===== ]]
describe.feature("ncRNA", function(node)
check_parent(node, "gene")
it("only contains allowed attributes", function()
for k,_ in node:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "Start_range",
"End_range", "Dbxref", "controlled_curation", "product",
"product_synonym", "previous_systematic_id",
"literature", "Ontology_term"}).should_contain(k)
end
end)
it("should not have children", function()
expect(#(collect(node:direct_children()))).should_be(0)
end)
end)
--[[ TRNA
==== ]]
describe.feature("tRNA", function(node)
check_parent(node, "gene")
it("only contains allowed attributes", function()
for k,_ in node:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "Start_range",
"End_range", "Dbxref", "controlled_curation", "product",
"product_synonym", "previous_systematic_id",
"literature", "Ontology_term", "aa", "anticodon",
"gc_content"}).should_contain(k)
end
end)
it("should not have children", function()
expect(#(collect(node:direct_children()))).should_be(0)
end)
end)
--[[ RRNA
==== ]]
describe.feature("rRNA", function(node)
check_parent(node, "gene")
it("only contains allowed attributes", function()
for k,_ in node:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "Start_range",
"End_range", "Dbxref", "controlled_curation", "product",
"product_synonym", "previous_systematic_id",
"literature", "Ontology_term", "model_name", "model_range",
"gc", "evalue", "score"}).should_contain(k)
end
end)
it("should not have children", function()
expect(#(collect(node:direct_children()))).should_be(0)
end)
end)
--[[ SNRNA
===== ]]
describe.feature("snRNA", function(node)
check_parent(node, "gene")
it("only contains allowed attributes", function()
for k,_ in node:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "Start_range",
"End_range", "Dbxref", "controlled_curation", "product",
"product_synonym", "previous_systematic_id",
"literature", "internalGap", "Ontology_term",
"model_name", "model_range",
"gc", "evalue", "score"}).should_contain(k)
end
end)
it("should not have children", function()
expect(#(collect(node:direct_children()))).should_be(0)
end)
end)
--[[ SNORNA
====== ]]
describe.feature("snoRNA", function(node)
check_parent(node, "gene")
it("only contains allowed attributes", function()
for k,_ in node:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "Start_range",
"End_range", "Dbxref", "controlled_curation", "product",
"product_synonym", "previous_systematic_id",
"literature", "Ontology_term", "model_name", "model_range",
"gc", "evalue", "score"}).should_contain(k)
end
end)
it("should not have children", function()
expect(#(collect(node:direct_children()))).should_be(0)
end)
end)
--[[ GAP
=== ]]
describe.feature("gap", function(gap)
is_a_lone_feature(gap)
it("only contains allowed attributes", function()
for k,_ in gap:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "Start_range",
"End_range", "Dbxref", "controlled_curation",
"previous_systematic_id", "literature", "estimated_length",
"gap_type"}).should_contain(k)
end
end)
end)
--[[ CONTIG
====== ]]
describe.feature("contig", function(contig)
is_a_lone_feature(contig)
it("only contains allowed attributes", function()
for k,_ in contig:attribute_pairs() do
expect({"ID", "Name", "Parent", "comment", "Note", "Start_range",
"End_range", "Dbxref", "controlled_curation",
"previous_systematic_id", "literature"}).should_contain(k)
end
end)
end)
--[[ CENTROMERE
========== ]]
describe.feature("centromere", function(centromere)
is_a_lone_feature(centromere)
end)
--[[ DIRECT_REPEAT
============= ]]
describe.feature("direct_repeat", function(node)
is_a_lone_feature(node)
end)
--[[ INVERTED_REPEAT
=============== ]]
describe.feature("inverted_repeat", function(node)
is_a_lone_feature(node)
end)
--[[ REPEAT_REGION
============= ]]
describe.feature("repeat_region", function(node)
is_a_lone_feature(node)
end)
--[[ REPEAT_UNIT
=========== ]]
describe.feature("repeat_unit", function(node)
is_a_lone_feature(node)
end)
--[[ NUCLEOTIDE_MATCH
================ ]]
describe.feature("nucleotide_match", function(node)
is_a_lone_feature(node)
end)
|
-- Default Fight AI
fight_ai_name = "Default AI"
fight_ai_monster_family = "*"
fight_ai_monster_name = "*"
function execute()
local data = teal_fight_data
local character = data.character
character:MoveAndAttack()
character:TakeCover()
end
|
--
-- User: maks
-- Date: 2019-02-14
-- Time: 13:16
--
local planeRenderInfo = {
mesh = "models/plane.obj",
material = Game.makeMaterial {
diffuse = "textures/land.jpg",
specularColor = {0.05, 0.08, 0.05},
shininess = 10
}
}
local scenery = {
{
Name = "camera",
Transform = {
position = { x = 0, y = 0, z = 10 }
},
Camera = {},
CameraOrbitBehavior = {
target = "head",
distance = 10,
minTilt = -60,
maxTilt = 60,
}
},
{
Name = "plane",
Transform = {
position = { x = 0 , y = 0 , z = 0 },
scale = { x = 10, y = 10, z = 10 }
},
RenderInfo = planeRenderInfo
},
{
Name = "wallXP",
Transform = {
position = { 10, 10, 0 },
scale = { 10, 10, 10 },
rotation = { 0, 0, 90}
},
RenderInfo = planeRenderInfo
},
{
Name = "wallXN",
Transform = {
position = { -10, 10, 0 },
scale = { 10, 10, 10 },
rotation = { 0, 0, -90}
},
RenderInfo = planeRenderInfo
},
{
Name = "wallZP",
Transform = {
position = { 0, 10, 10 },
scale = { 10, 10, 10 },
rotation = { -90, 0, 0 }
},
RenderInfo = planeRenderInfo
},
{
Name = "wallZN",
Transform = {
position = { 0, 10, -10 },
scale = { 10, 10, 10 },
rotation = { 90, 0, 0 }
},
RenderInfo = planeRenderInfo
},
{
Name = "ceiling",
Transform = {
position = { 0, 20, 0 },
scale = { 10, 10, 10 },
rotation = { 180, 0, 0 }
},
RenderInfo = planeRenderInfo
},
{
Name = "cube",
Transform = {
position = { x = 0, y = 2, z = 0 },
scale = { x = 1, y = 1, z = 1 }
},
RenderInfo = {
mesh = "models/cube_flat.obj",
material = {
diffuse = "textures/container/diffuse.png",
specular = "textures/container/specular.png",
shininess = 100
}
},
},
{
Name = "head",
Transform = {
position = { x = 0, y = 5, z = 0 }
},
RenderInfo = {
mesh = "models/suzanna_flat.obj",
material = {
diffuse = "textures/bricks.jpg",
shininess = 100
}
}
},
{
Name = "teapot",
Transform = {
position = { x = 0, y = 7, z = 0 }
},
RenderInfo = {
mesh = "models/teapot_smooth.obj",
material = {
diffuse = "textures/bricks.jpg"
}
}
}
}
local scene = {}
function scene:start()
Game.makeActors(scenery)
Game.makeActor {
Name = "Light",
Transform = {
scale = {0.1, 0.1, 0.1}
},
RenderInfo = {
mesh = "models/sphere2.obj",
material = {}
},
Light = {
intensity = 10
}
}
Game.makeActor {
Name = "Light2",
Transform = {
position = {3, 2, 0},
scale = {0.1, 0.1, 0.1}
},
RenderInfo = {
mesh = "models/sphere2.obj",
material = {}
},
Light = {
intensity = 10
}
}
Game.makeActor {
Name = "LightDirectional",
Transform = {
scale = {0.1, 0.1, 0.1},
rotation = {-45, 0, 0}
},
Light = {
kind = "directional",
ambientColor = {0, 0, 0},
intensity = 0.1
}
}
Game.makeActor {
Name = "LightDirectional2",
Transform = {
scale = {0.1, 0.1, 0.1},
rotation = {0, 0, 0}
},
Light = {
kind = "directional",
ambientColor = {0, 0, 0},
intensity = 0.1
}
}
Game.makeActor {
Name = "Panel",
Transform = {
children = {
{
Name = "FontAtlasView",
Transform = {},
UIRect = {
anchorMin = {0, 0},
anchorMax = {1, 1},
offsetMin = {0, 0},
offsetMax = {0, -60}
},
UISprite = {
material = {
shader = "sprite",
texture = "textures/transparent.png"
}
},
LuaBehavior = {
onMouseEnter = function(self)
self.actor:get("UISprite").isEnabled = false
end,
onMouseLeave = function(self)
self.actor:get("UISprite").isEnabled = true
end
}
},
{
Name = "FontAtlasViewTitle",
Transform = {},
UIRect = {
anchorMin = {0, 1},
anchorMax = {1, 1},
offsetMin = {0, -60},
offsetMax = {0, 0}
},
UISprite = {
material = {
shader = "sprite",
texture = "textures/white.png"
}
},
Text = {
string = "Font atlas:",
font = "fonts/Menlo.ttc",
fontSize = 50,
color = {0,0,0,1}
}
}
}
},
UIRect = {
anchorMin = {0, 0},
anchorMax = {1, 1},
offsetMin = { 100, 200},
offsetMax = {-100, -100}
},
UISprite = {
material = {
shader = "sprite",
texture = "textures/black.png"
}
}
}
Game.makeActor {
Name = "PanelBottom",
Transform = {},
UIRect = {
anchorMin = {0, 0},
anchorMax = {1, 0},
offsetMin = {50 , 0},
offsetMax = {-50, 100}
},
UISprite = {
material = {
shader = "sprite",
texture = "textures/black.png"
}
},
LuaBehavior = {
update = function(self)
self.actor:get("UIRect").isEnabled = not self.actor:get("UIRect").isMouseOver
end
}
}
Game.makeActor {
Name = "TextElement",
Transform = {parent = "PanelBottom"},
UIRect = {},
Text = {
font = "fonts/Menlo.ttc",
color = {0, 1 / 3, 2 / 3, 1},
string = "The quick brown fox jumps over the lazy dog\nThe quick brown fox jumps over the lazy dog"
},
LuaBehavior = {
update = function(self, dt)
local text = self.actor:get("Text")
text.string = string.sub("The quick brown fox jumps over the lazy dog\nThe quick brown fox jumps over the lazy dog", 1, 1 + math.floor(Game.getTime() * 10))
--text.font = math.fmod(Game.getTime(), 2) < 1 and "fonts/Menlo.ttc" or "fonts/arial.ttf"
local color = text.color
color.x = math.fmod(color.x + dt * 0.1, 1)
color.y = math.fmod(color.y + dt * 0.1, 1)
color.z = math.fmod(color.z + dt * 0.1, 1)
text.color = color
text.fontSize = math.floor(30 + math.sin(Game.getTime()) * 20)
end
}
}
end
local function animateUITransform(actor)
local tf = actor:get("Transform")
tf.rotation = {0, 0, 10 * math.sin(Game.getTime() * 8) }
local scale = 1 + 0.03 * math.sin(Game.getTime() * 8)
tf.scale = {scale, scale, scale }
local uiRect = actor:get("UIRect")
uiRect.pivot = {
math.sin(Game.getTime() * 0.1) * 0.5 + 0.5,
math.cos(Game.getTime() * 0.1) * 0.5 + 0.5
}
end
function scene:update(dt)
Game.find("Light"):get("Transform").position = {-4, 3 + 2 * math.sin(Game.getTime()), 0}
--Game.find("LightDirectional"):get("Transform"):rotate(45 * dt, 1, 0, 0);
if Game.keyboard.isHeld("Up") then
Game.find("Light2"):get("Transform"):move(0, 2 * dt, 0)
elseif Game.keyboard.isHeld("Down") then
Game.find("Light2"):get("Transform"):move(0, -2 * dt, 0)
end
--Game.find("Panel"):get("UIRect").isEnabled = math.fmod(Game.getTime(), 2) < 1
animateUITransform(Game.find("Panel"))
end
return scene
|
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/smartdevicelink/sdl_core/issues/2129
---------------------------------------------------------------------------------------------------
-- Description:
-- In case:
-- 1) There is a mobile app which is audio/video source
-- 2) And this app starts Audio/Video streaming
-- 3) And HMI sends 'BC.OnEventChanged' (AUDIO_SOURCE)
-- 4) And app still continue streaming
-- SDL must:
-- 1) Send to HMI:
-- Navigation.OnAudioDataStreaming(available = false)
-- Navigation.OnVideoDataStreaming(available = false)
-- Navigation.StopAudioStream
-- Navigation.StopStream
-- 2) Send End Audio/Video service control messages to app
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/MobileProjection/Phase2/common')
local runner = require('user_modules/script_runner')
local events = require("events")
local constants = require("protocol_handler/ford_protocol_constants")
--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
config.defaultProtocolVersion = 3
--[[ Local Variables ]]
local testCases = {
[001] = { t = "PROJECTION", m = true },
[002] = { t = "NAVIGATION", m = true },
}
--[[ Local Functions ]]
local function appStartAudioStreaming()
common.getMobileSession():StartService(10)
:Do(function()
common.getHMIConnection():ExpectRequest("Navigation.StartAudioStream")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
common.getMobileSession():StartStreaming(10,"files/MP3_1140kb.mp3")
common.getHMIConnection():ExpectNotification("Navigation.OnAudioDataStreaming", { available = true })
end)
end)
common.getMobileSession():ExpectNotification("OnHMIStatus")
:Times(0)
end
local function appStartVideoStreaming()
common.getMobileSession():StartService(11)
:Do(function()
common.getHMIConnection():ExpectRequest("Navigation.StartStream")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
common.getMobileSession():StartStreaming(11, "files/MP3_4555kb.mp3")
common.getHMIConnection():ExpectNotification("Navigation.OnVideoDataStreaming", { available = true })
end)
end)
common.getMobileSession():ExpectNotification("OnHMIStatus")
:Times(0)
end
local function appStopStreaming()
common.getMobileSession():StopStreaming("files/MP3_1140kb.mp3")
common.getMobileSession():StopStreaming("files/MP3_4555kb.mp3")
common.getMobileSession():ExpectNotification("OnHMIStatus")
:Times(0)
end
local function expectEndService(pServiceId)
local event = events.Event()
event.matches = function(_, data)
return data.frameType == constants.FRAME_TYPE.CONTROL_FRAME
and data.serviceType == pServiceId
and data.sessionId == common.getMobileSession().mobile_session_impl.control_services.session.sessionId.get()
and data.frameInfo == constants.FRAME_INFO.END_SERVICE
end
return common.getMobileSession():ExpectEvent(event, "EndService")
end
local function changeAudioSource()
common.getHMIConnection():SendNotification("BasicCommunication.OnEventChanged", {
eventName = "AUDIO_SOURCE",
isActive = true })
common.getMobileSession():ExpectNotification("OnHMIStatus", {
hmiLevel = "BACKGROUND",
systemContext = "MAIN",
audioStreamingState = "NOT_AUDIBLE",
videoStreamingState = "NOT_STREAMABLE"
})
common.wait(2000)
common.getHMIConnection():ExpectNotification("Navigation.OnAudioDataStreaming", { available = false }):Times(AtLeast(1))
common.getHMIConnection():ExpectNotification("Navigation.OnVideoDataStreaming", { available = false }):Times(AtLeast(1))
common.getHMIConnection():ExpectRequest("Navigation.StopAudioStream", { appID = common.getHMIAppId() })
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
common.getHMIConnection():ExpectRequest("Navigation.StopStream", { appID = common.getHMIAppId() })
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
expectEndService(10)
expectEndService(11)
end
--[[ Scenario ]]
for n, tc in common.spairs(testCases) do
runner.Title("TC[" .. string.format("%03d", n) .. "]: "
.. "[hmiType:" .. tc.t .. ", isMedia:" .. tostring(tc.m) .. "]")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Set App Config", common.setAppConfig, { 1, tc.t, tc.m })
runner.Step("Register App", common.registerApp, { 1 })
runner.Step("Activate App", common.activateApp, { 1 })
runner.Step("App starts Audio streaming", appStartAudioStreaming)
runner.Step("App starts Video streaming", appStartVideoStreaming)
runner.Step("Change Audio Source", changeAudioSource)
runner.Step("Stop A/V streaming", appStopStreaming)
runner.Step("Clean sessions", common.cleanSessions)
runner.Step("Stop SDL", common.postconditions)
end
|
--Copyright (c) 2013, Byrthnoth
--All rights reserved.
--Redistribution and use in source and binary forms, with or without
--modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of <addon name> nor the
-- names of its contributors may be used to endorse or promote products
-- derived from this software without specific prior written permission.
--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
--ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
--WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
--DISCLAIMED. IN NO EVENT SHALL <your name> BE LIABLE FOR ANY
--DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
--(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
--LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
--ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
--SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
_addon.name = 'GearSwap'
_addon.version = '0.818'
_addon.author = 'Byrth'
_addon.commands = {'gs','gearswap'}
if windower.file_exists(windower.addon_path..'data/bootstrap.lua') then
debugging = 1
else
debugging = 0
end
language = 'english'
file = require 'files'
require 'strings'
require 'tables'
require 'lists'
require 'sets'
require 'texts'
require 'helper_functions'
require 'statics'
require 'equip_processing'
require 'targets'
require 'user_functions'
require 'refresh'
require 'parse_augments'
require 'export'
require 'validate'
require 'flow'
require 'triggers'
res = require 'resources'
windower.register_event('load',function()
if debugging >= 1 then windower.debug('load') end
if windower.dir_exists('../addons/GearSwap/data/logs') then
logging = false
logfile = io.open('../addons/GearSwap/data/logs/NormalLog'..tostring(os.clock())..'.log','w+')
logit(logfile,'GearSwap LOGGER HEADER\n')
end
refresh_globals()
if world.logged_in then
refresh_user_env()
if debugging >= 1 then windower.send_command('@unload spellcast;') end
end
end)
windower.register_event('unload',function ()
if debugging >= 1 then windower.debug('unload') end
user_pcall('file_unload')
if logging then logfile:close() end
end)
windower.register_event('addon command',function (...)
if debugging >= 1 then windower.debug('addon command') end
if logging then
local command = table.concat({...},' ')
logit(logfile,'\n\n'..tostring(os.clock)..command)
end
local splitup = {...}
if not splitup[1] then return end -- handles //gs
if splitup[1]:lower() == 'c' then
if gearswap_disabled then return end
if splitup[2] then
refresh_globals()
equip_sets('self_command',nil,_raw.table.concat(splitup,' ',2,#splitup))
else
windower.add_to_chat(123,'GearSwap: No self command passed.')
end
elseif splitup[1]:lower() == 'equip' then
if gearswap_disabled then return end
local set_split = string.split(_raw.table.concat(splitup,' ',2,#splitup):gsub('%[','%.'):gsub('[%]\']',''),'.')
local n = 1
local tempset
if set_split[1] == 'sets' then tempset = user_env
else tempset = user_env.sets end
while n <= #set_split do
if tempset[set_split[n]] or tempset[tonumber(set_split[n])] then
tempset = tempset[set_split[n]] or tempset[tonumber(set_split[n])]
if n == #set_split then
refresh_globals()
equip_sets('equip_command',nil,tempset)
break
else
n = n+1
end
else
windower.add_to_chat(123,'GearSwap: Equip command cannot be completed. That set does not exist.')
break
end
end
elseif splitup[1]:lower() == 'export' then
table.remove(splitup,1)
export_set(splitup)
elseif splitup[1]:lower() == 'validate' then
if user_env and user_env.sets then
refresh_globals()
table.remove(splitup, 1)
validate(splitup)
else
windower.add_to_chat(123,'GearSwap: There is nothing to validate because there is no file loaded.')
end
elseif splitup[1]:lower() == 'enable' then
disenable(splitup,enable,'enable',false)
elseif splitup[1]:lower() == 'disable' then
disenable(splitup,disable,'disable',true)
elseif splitup[1]:lower() == 'reload' then
refresh_user_env()
elseif strip(splitup[1]) == 'debugmode' then
_settings.debug_mode = not _settings.debug_mode
print('GearSwap: Debug Mode set to '..tostring(_settings.debug_mode)..'.')
elseif strip(splitup[1]) == 'showswaps' then
_settings.show_swaps = not _settings.show_swaps
print('GearSwap: Show Swaps set to '..tostring(_settings.show_swaps)..'.')
elseif not ((strip(splitup[1]) == 'eval' or strip(splitup[1]) == 'visible' or strip(splitup[1]) == 'invisible' or strip(splitup[1]) == 'clocking' ) and debugging>0) then
print('GearSwap: Command not found')
end
end)
function disenable(tab,funct,functname,pol)
if tab[2] and tab[2]:lower()=='all' then
funct('main','sub','range','ammo','head','neck','lear','rear','body','hands','lring','rring','back','waist','legs','feet')
print('GearSwap: All slots '..functname..'d.')
elseif tab[2] then
for i=2,#tab do
if slot_map[tab[i]:gsub('[^%a_%d]',''):lower()] then
funct(tab[i])
print('GearSwap: '..tab[i]..' slot '..functname..'d.')
else
print('GearSwap: Unable to find slot '..tostring(tab[i])..'.')
end
end
elseif gearswap_disabled ~= pol and not tab[2] then
print('GearSwap: User file '..functname..'d')
gearswap_disabled = pol
end
end
windower.register_event('incoming chunk',function(id,data,modified,injected,blocked)
if debugging >= 1 then windower.debug('incoming chunk '..id) end
if id == 0x0E and not injected and pet.index and pet.index == data:byte(9) + data:byte(10)*256 and math.floor((data:byte(11)%8)/4)== 1 then
local oldstatus = pet.status
local newstatus = res.statuses[data:byte(32)]
if newstatus then newstatus = newstatus.english
else newstatus = data:byte(32) end
if oldstatus ~= newstatus then
-- Should put a filter on this to prevent it from sending anything other than resting, engaged, and idle.
refresh_globals()
equip_sets('pet_status_change',nil,newstatus,oldstatus)
end
elseif id == 0x28 and not injected then
if clocking then windower.add_to_chat(8,'Action Packet: '..(os.clock() - out_time)) end
data = data:sub(5)
local act = {}
-- act.do_not_need = get_bit_packed(data,0,8)
act.actor_id = get_bit_packed(data,8,40)
act.target_count = get_bit_packed(data,40,50)
act.category = get_bit_packed(data,50,54)
act.param = get_bit_packed(data,54,70)
act.unknown = get_bit_packed(data,70,86)
act.recast = get_bit_packed(data,86,118)
act.targets = {}
local offset = 118
for i = 1,act.target_count do
act.targets[i] = {}
act.targets[i].id = get_bit_packed(data,offset,offset+32)
act.targets[i].action_count = get_bit_packed(data,offset+32,offset+36)
offset = offset + 36
act.targets[i].actions = {}
for n = 1,act.targets[i].action_count do
act.targets[i].actions[n] = {}
act.targets[i].actions[n].reaction = get_bit_packed(data,offset,offset+5)
act.targets[i].actions[n].animation = get_bit_packed(data,offset+5,offset+16)
act.targets[i].actions[n].effect = get_bit_packed(data,offset+16,offset+21)
act.targets[i].actions[n].stagger = get_bit_packed(data,offset+21,offset+27)
act.targets[i].actions[n].param = get_bit_packed(data,offset+27,offset+44)
act.targets[i].actions[n].message = get_bit_packed(data,offset+44,offset+54)
act.targets[i].actions[n].unknown = get_bit_packed(data,offset+54,offset+85)
act.targets[i].actions[n].has_add_effect = get_bit_packed(data,offset+85,offset+86)
offset = offset + 86
if act.targets[i].actions[n].has_add_effect == 1 then
act.targets[i].actions[n].has_add_effect = true
act.targets[i].actions[n].add_effect_animation = get_bit_packed(data,offset,offset+6)
act.targets[i].actions[n].add_effect_effect = get_bit_packed(data,offset+6,offset+10)
act.targets[i].actions[n].add_effect_param = get_bit_packed(data,offset+10,offset+27)
act.targets[i].actions[n].add_effect_message = get_bit_packed(data,offset+27,offset+37)
offset = offset + 37
else
act.targets[i].actions[n].has_add_effect = false
act.targets[i].actions[n].add_effect_animation = 0
act.targets[i].actions[n].add_effect_effect = 0
act.targets[i].actions[n].add_effect_param = 0
act.targets[i].actions[n].add_effect_message = 0
end
act.targets[i].actions[n].has_spike_effect = get_bit_packed(data,offset,offset+1)
offset = offset +1
if act.targets[i].actions[n].has_spike_effect == 1 then
act.targets[i].actions[n].has_spike_effect = true
act.targets[i].actions[n].spike_effect_animation = get_bit_packed(data,offset,offset+6)
act.targets[i].actions[n].spike_effect_effect = get_bit_packed(data,offset+6,offset+10)
act.targets[i].actions[n].spike_effect_param = get_bit_packed(data,offset+10,offset+24)
act.targets[i].actions[n].spike_effect_message = get_bit_packed(data,offset+24,offset+34)
offset = offset + 34
else
act.targets[i].actions[n].has_spike_effect = false
act.targets[i].actions[n].spike_effect_animation = 0
act.targets[i].actions[n].spike_effect_effect = 0
act.targets[i].actions[n].spike_effect_param = 0
act.targets[i].actions[n].spike_effect_message = 0
end
end
end
inc_action(act)
elseif id == 0x29 and not injected then
if clocking then windower.add_to_chat(8,'Action Message: '..(os.clock() - out_time)) end
if gearswap_disabled then return end
data = data:sub(5)
local arr = {}
arr.actor_id = get_bit_packed(data,0,32)
arr.target_id = get_bit_packed(data,32,64)
arr.param_1 = get_bit_packed(data,64,96)
arr.param_2 = get_bit_packed(data,96,102) -- First 6 bits
arr.param_3 = get_bit_packed(data,102,128) -- Rest
arr.actor_index = get_bit_packed(data,128,144)
arr.target_index = get_bit_packed(data,144,160)
arr.message_id = get_bit_packed(data,160,175) -- Cut off the most significant bit, hopefully
inc_action_message(arr)
elseif id == 0x01B and not injected then
-- 'Job Info Packet'
local enc = data:byte(97) + data:byte(98)*256
items = windower.ffxi.get_items()
local tab = {}
for i,v in pairs(default_slot_map) do
if encumbrance_table[i] and math.floor( (enc%(2^(i+1))) / 2^i ) ~= 1 and not_sent_out_equip[v] and not disable_table[i] then
tab[v] = not_sent_out_equip[v]
not_sent_out_equip[v] = nil
if _settings.debug_mode then windower.add_to_chat(8,"GearSwap (Debug Mode): Your "..v..' are now unlocked.') end
end
encumbrance_table[i] = tf
end
if table.length(tab) > 0 then
refresh_globals()
equip_sets('equip_command',nil,tab)
end
elseif id == 0x067 and not injected then
local flag_1 = data:byte(5)
local flag_2 = data:byte(6)
local owner_ind = data:byte(14)*256+data:byte(13)
local subj_ind = data:byte(8)*256+data:byte(7)
-- if debugging >= 1 and (windower.ffxi.get_player().index == owner_ind or windower.ffxi.get_player().index == subj_ind) then windower.add_to_chat(8,flag_2..' '..flag_1) end
if flag_1 == 3 and flag_2 == 5 and windower.ffxi.get_player().index == owner_ind then
local temp_mob = windower.ffxi.get_mob_by_index(subj_ind)
if temp_mob then
refresh_globals()
table.reassign(pet,target_complete(temp_mob))
pet.isvalid = true
pet.claim_id = nil
pet.is_npc = nil
if pet.tp then pet.tp = pet.tp/10 end
if avatar_element[pet.name] then
pet.element = avatar_element[pet.name]
else
pet.element = 'None'
end
equip_sets('pet_change',nil,pet,true)
end
elseif flag_1 == 4 and flag_2 == 5 and windower.ffxi.get_player().index == subj_ind then
refresh_globals()
pet.isvalid = false
equip_sets('pet_change',nil,pet,false)
end
elseif gearswap_disabled then
return
elseif id == 0x050 and not injected then
-- 'Equipment packet'
if sent_out_equip[data:byte(6)] == data:byte(5) then
sent_out_equip[data:byte(6)] = nil
limbo_equip[data:byte(6)] = data:byte(5)
end
elseif id == 0x01D and not injected then
limbo_equip = {}
end
end)
windower.register_event('status change',function(new,old)
if debugging >= 1 then windower.debug('status change '..new) end
if gearswap_disabled or T{2,3,4}:contains(old) or T{2,3,4}:contains(new) then return end
refresh_globals()
equip_sets('status_change',nil,res.statuses[new].english,res.statuses[old].english)
end)
windower.register_event('gain buff',function(name,id)
if debugging >= 1 then windower.debug('gain buff '..name) end
if gearswap_disabled then return end
-- Need to figure out what I'm going to do with this:
if _global.midaction and T{'terror','sleep','stun','petrification','charm','weakness'}:contains(name:lower()) then _global.midaction = false end
refresh_globals()
equip_sets('buff_change',nil,name,true)
end)
windower.register_event('lose buff',function(name,id)
if debugging >= 1 then windower.debug('lose buff '..name) end
if gearswap_disabled then return end
refresh_globals()
equip_sets('buff_change',nil,name,false)
end)
windower.register_event('job change',function(mjob, mjob_id, mjob_lvl, sjob, sjob_id, sjob_lvl)
if debugging >= 1 then windower.debug('job change') end
disable_table = {false,false,false,false,false,false,false,false,false,false,false,false,false,false,false}
not_sent_out_equip = {}
sent_out_equip = {}
limbo_equip = {}
if mjob ~= current_job_file then
refresh_user_env(mjob_id)
end
end)
windower.register_event('login',function(name)
if debugging >= 1 then windower.debug('login '..name) end
windower.send_command('@wait 2;lua i gearSwap refresh_user_env;')
end)
windower.register_event('day change',function(new,old)
if debugging >= 1 then windower.debug('day change') end
windower.send_command('@wait 0.5;lua invoke gearSwap refresh_ffxi_info')
end)
windower.register_event('weather change',function(new_weather, new_weather_id, old_weather, old_weather_id)
if debugging >= 1 then windower.debug('weather change') end
refresh_ffxi_info()
end)
windower.register_event('zone change',function(new_zone,new_zone_id,old_zone,old_zone_id)
if debugging >= 1 then windower.debug('zone change') end
_global.midaction = false
_global.pet_midaction = false
sent_out_equip = {}
not_sent_out_equip = {}
out_arr = {}
end)
if debugging and debugging >= 1 then
require('data/bootstrap')
windower.register_event('addon command', function(...)
local pantsu = {...}
local opt = table.remove(pantsu,1)
if opt == 'eval' then
assert(loadstring(table.concat(pantsu,' ')))()
elseif opt == 'visible' then
windower.text.set_visibility('precast',true)
windower.text.set_visibility('midcast',true)
windower.text.set_visibility('aftercast',true)
windower.text.set_visibility('buff_change',true)
elseif opt == 'invisible' then
windower.text.set_visibility('precast',false)
windower.text.set_visibility('midcast',false)
windower.text.set_visibility('aftercast',false)
windower.text.set_visibility('buff_change',false)
elseif opt == 'clocking' then
if clocking then clocking = false else clocking = true end
end
end)
windower.text.create('precast')
windower.text.set_bg_color('precast',100,100,100,100)
windower.text.set_bg_visibility('precast',true)
windower.text.set_font('precast','Consolas')
windower.text.set_font_size('precast',12)
windower.text.set_color('precast',255,255,255,255)
windower.text.set_location('precast',250,10)
windower.text.set_visibility('precast',false)
windower.text.set_text('precast','Panda')
windower.text.create('midcast')
windower.text.set_bg_color('midcast',100,100,100,100)
windower.text.set_bg_visibility('midcast',true)
windower.text.set_font('midcast','Consolas')
windower.text.set_font_size('midcast',12)
windower.text.set_color('midcast',255,255,255,255)
windower.text.set_location('midcast',500,10)
windower.text.set_visibility('midcast',false)
windower.text.set_text('midcast','Panda')
windower.text.create('aftercast')
windower.text.set_bg_color('aftercast',100,100,100,100)
windower.text.set_bg_visibility('aftercast',true)
windower.text.set_font('aftercast','Consolas')
windower.text.set_font_size('aftercast',12)
windower.text.set_color('aftercast',255,255,255,255)
windower.text.set_location('aftercast',750,10)
windower.text.set_visibility('aftercast',false)
windower.text.set_text('aftercast','Panda')
windower.text.create('buff_change')
windower.text.set_bg_color('buff_change',100,100,100,100)
windower.text.set_bg_visibility('buff_change',true)
windower.text.set_font('buff_change','Consolas')
windower.text.set_font_size('buff_change',12)
windower.text.set_color('buff_change',255,255,255,255)
windower.text.set_location('buff_change',1000,10)
windower.text.set_visibility('buff_change',false)
windower.text.set_text('buff_change','Panda')
end
|
do singleton "BasicSingle"
{
message = "",
}
accessor "Message->message"
function Initialize( self )
end
end
|
local pkg = require 'aula.core.package'
local M = {}
function M.init()
pkg.add('tpope/vim-surround')
end
return M
|
--[[
Copyright 2014 The Luvit Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
local Object = require('luvit.core').Object
local os = require('os_binding')
local table = require('table')
local path_base = require('luvit.path_base')
local function setup_meta(ospath)
local path = {}
path._internal = ospath
setmetatable(path, {__index = function(table, key)
if type(path._internal[key]) == 'function' then
return function(...)
return path._internal[key](path._internal, ...)
end
else
return path._internal:_get(key)
end
end
})
return path
end
if os.type() == "win32" then
return setup_meta(path_base.nt)
else
return setup_meta(path_base.posix)
end
|
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local steps = tonumber(param)
if not steps then
return false
end
local position = player:getPosition()
position:getNextPosition(player:getDirection(), steps)
position = player:getClosestFreePosition(position, false)
if position.x == 0 then
player:sendCancelMessage("You cannot teleport there.")
return false
end
player:teleportTo(position)
return false
end
|
local json = require("dkjson")
local socket = require("socket")
socket.unix = require("socket.unix")
local SOCK_PATH = "/var/run/yggdrasil.sock"
local control = {}
function control:request(command, args)
if args == nil then args = {} end
args["request"] = command
local data = json.encode(args)
local c = assert(socket.unix())
if c:connect(SOCK_PATH) == nil then return nil end
if c:send(data) == nil then return nil end
local resp = c:receive("*a")
c:close()
return json.decode(resp)
end
function control:get_DHT()
return control:request("getDHT")
end
function control:get_peers()
return control:request("getPeers")
end
function control:add_peer(uri)
return control:request("addPeer", {uri = uri})
end
function control:remove_peer(port)
return control:request("removePeer", {port = port})
end
function control:get_switch_peers()
return control:request("getSwitchPeers")
end
function control:get_self()
return control:request("getSelf")
end
function control:get_sessions()
return control:request("getSessions")
end
function control:get_tun_tap()
return control:request("getTunTap")
end
function control:get_allowed_encryption_public_keys()
return control:request("getAllowedEncryptionPublicKeys")
end
function control:add_allowed_encryption_public_key(box_pub_key)
return control:request("addAllowedEncryptionPublicKey",
{box_pub_key = box_pub_key})
end
function control:remove_allowed_encryption_public_key(box_pub_key)
return control:request("removeAllowedEncryptionPublicKey",
{box_pub_key = box_pub_key})
end
function control:get_multicast_interfaces()
return control:request("getMulticastInterfaces")
end
function control:get_routes()
return control:request("getRoutes")
end
function control:add_route(subnet, box_pub_key)
return control:request("addRoute",
{subnet = subnet, box_pub_key = box_pub_key})
end
function control:remove_route(subnet, box_pub_key)
return control:request("removeRoute",
{subnet = subnet, box_pub_key = box_pub_key})
end
function control:get_source_subnets()
return control:request("getSourceSubnets")
end
function control:add_source_subnet(subnet)
return control:request("addSourceSubnet", {subnet = subnet})
end
function control:remove_source_subnet(subnet)
return control:request("removeSourceSubnet", {subnet = subnet})
end
function control:dht_ping(box_pub_key, coords, target)
args = {box_pub_key = box_pub_key, coords = coords}
if target ~= nil then
args["target"] = target
end
return control:request("dhtPing", args)
end
function control:get_node_info(box_pub_key, coords)
return control:request("getNodeInfo",
{box_pub_key = box_pub_key, coords = coords})
end
return control
|
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
net.Receive("OpenBarricadeMenu", function()
local ent = net.ReadEntity()
local player = net.ReadEntity()
local entName = ent:GetClass()
local entHealth = net.ReadInt(11)
local playerBalance = player:GetNWInt("playerMoney")
local upgradePrice = ent.BaseHealth * 2
local UpgradeMenu = vgui.Create("DFrame")
UpgradeMenu:SetPos(0, 0)
UpgradeMenu:SetSize(500, 375)
UpgradeMenu:Center()
UpgradeMenu:SetTitle("Barricade Upgrade Menu")
UpgradeMenu:SetDraggable(false)
UpgradeMenu:ShowCloseButton(true)
UpgradeMenu:SetVisible(true)
UpgradeMenu:MakePopup()
UpgradeMenu.Paint = function()
draw.RoundedBox(3, 0, 0, UpgradeMenu:GetWide(), UpgradeMenu:GetTall(), Color(60, 60, 60))
draw.RoundedBox(0, 0, 24, UpgradeMenu:GetWide(), 1, Color(255, 255, 255))
draw.DrawText(entName:gsub("^%l", string.upper), "DermaLarge", 10, 35, Color(255, 255, 255), TEXT_ALIGN_LEFT)
draw.DrawText("Health: "..entHealth.."/"..ent.BaseHealth, "Trebuchet24", 10, 65, Color(255, 255, 255), TEXT_ALIGN_LEFT)
if (ent.CurHealthLevel != ent.MaxHealthLevel) then
draw.DrawText("Upgrade Max Health | "..ent.CurHealthLevel.."/"..ent.MaxHealthLevel.." | $"..upgradePrice, "Trebuchet24", 10, 125, Color(255, 255, 255), TEXT_ALIGN_LEFT)
else
draw.DrawText("Upgrade Max Health | Max Level Reached", "Trebuchet24", 10, 125, Color(255, 255, 255), TEXT_ALIGN_LEFT)
end
end
local UpgradeButton = vgui.Create("DButton", UpgradeMenu)
UpgradeButton:SetPos(10, 155)
UpgradeButton:SetText("Upgrade Max Health")
UpgradeButton:SetSize(120, 50)
UpgradeButton.DoClick = function()
playerBalance = player:GetNWInt("playerMoney")
if (playerBalance >= upgradePrice && ent.CurHealthLevel < ent.MaxHealthLevel) then
ent.BaseHealth = ent.BaseHealth * 2
ent.CurHealthLevel = ent.CurHealthLevel + 1
entHealth = ent.BaseHealth
net.Start("UpgradeEntityHealth")
net.WriteEntity(ent)
net.WriteInt(upgradePrice, 11)
net.WriteInt(ent.BaseHealth, 11)
net.SendToServer()
upgradePrice = ent.BaseHealth * 2
elseif (ent.CurHealthLevel == ent.MaxHealthLevel) then
player:PrintMessage(HUD_PRINTTALK, "The max level has been reached!")
else
player:PrintMessage(HUD_PRINTTALK, "You do not have enough money to upgrade!")
end
end
end)
|
Colors = {}
function Colors:load()
self.buttonScale = 0.1 * utils.vh -- 0.5
local paddingScale = 1
if utils.isMobile then
self.buttonScale = 0.6 * self.buttonScale
paddingScale = 0.6
end
local ButtonImage = love.graphics.newImage("assets/color.png")
local ButtonWidth = ButtonImage:getWidth() * self.buttonScale
local ButtonHeight = ButtonImage:getHeight() * self.buttonScale
local ButtonPressed = love.graphics.newImage("assets/color-pressed.png")
local ButtonX = love.graphics.getWidth() / 2 - ButtonWidth / 2
local ButtonY = love.graphics.getHeight() / 2 - ButtonHeight / 2 + utils.vh * 30
self.colorButton = ColorButton:new({
img = ButtonImage,
scale = self.buttonScale,
pressedImg = ButtonPressed,
x = ButtonX,
y = ButtonY,
image_map = love.image.newImageData("assets/color.png"),
image_map_pressed = love.image.newImageData("assets/color-pressed.png"),
})
local leftArrowButtonImage = love.graphics.newImage('assets/button-left-arrow.png')
local leftArrowButtonWidth = leftArrowButtonImage:getWidth() * self.buttonScale
local leftArrowButtonHeight = leftArrowButtonImage:getHeight() * self.buttonScale
local leftArrowButtonPressed = love.graphics.newImage("assets/button-left-arrow-pressed.png")
local leftArrowButtonX = love.graphics.getWidth() / 2 - ButtonWidth / 2 - leftArrowButtonWidth - utils.vh * 0.1
local leftArrowButtonY = love.graphics.getHeight() / 2 - leftArrowButtonHeight / 2 + utils.vh * 30
self.leftArrowButton = Button:new({
img = leftArrowButtonImage,
scale = self.buttonScale,
pressedImg = leftArrowButtonPressed,
x = leftArrowButtonX,
y = leftArrowButtonY,
})
-- obg amor
local rightArrowButtonImage = love.graphics.newImage('assets/button-right-arrow.png')
local rightArrowButtonWidth = rightArrowButtonImage:getWidth() * self.buttonScale
local rightArrowButtonHeight = rightArrowButtonImage:getHeight() * self.buttonScale
local rightArrowButtonPressed = love.graphics.newImage("assets/button-right-arrow-pressed.png")
local rightArrowButtonX = love.graphics.getWidth() / 2 + ButtonWidth / 2 + utils.vh * 0.1
local rightArrowButtonY = love.graphics.getHeight() / 2 - rightArrowButtonHeight / 2 + utils.vh * 30
self.rightArrowButton = Button:new({
img = rightArrowButtonImage,
scale = self.buttonScale,
pressedImg = rightArrowButtonPressed,
x = rightArrowButtonX,
y = rightArrowButtonY,
})
local backButtonX = utils.vh * 5
local backButtonY = love.graphics.getHeight() - leftArrowButtonHeight - (utils.vh * 5 * paddingScale)
self.backButton = Button:new({
img = leftArrowButtonImage,
scale = self.buttonScale,
pressedImg = leftArrowButtonPressed,
x = backButtonX,
y = backButtonY,
})
-- colors we are currently using, may be added more according to users' sugestions
self.availableColors = {
{255, 255, 255, 255},
{204, 51, 0, 255},
{51, 153, 51, 255},
{0, 0, 230, 255},
{255, 255, 0, 255},
{221, 0, 0, 255},
{255, 51, 204, 255},
{51, 204, 255, 255},
{190, 92, 255, 255},
{255, 102, 0, 255},
{207, 201, 229, 255},
{223, 153, 255, 255},
{255, 158, 215, 255},
{252, 179, 200, 255},
}
-- current color is by default the first one in the available colors if there is no save
self.currentColor = Save:readCurrentColor()
self.changeColor(self:getCurrentColor())
end
function Colors:update(dt)
self.colorButton:setColor(self:getCurrentColor())
end
function Colors:nextColor()
if self.currentColor == #self.availableColors then
self.currentColor = 1
else
self.currentColor = self.currentColor + 1
end
self.changeColor(self:getCurrentColor())
end
function Colors:previousColor()
if self.currentColor == 1 then
self.currentColor = #self.availableColors
else
self.currentColor = self.currentColor - 1
end
self.changeColor(self:getCurrentColor())
end
function Colors.changeColor(color)
Player:changesColor(color)
AI:changesColor(color)
AIColors:changesColor(color)
end
function Colors:getCurrentColor()
return self.availableColors[self.currentColor]
end
function Colors:getCurrentColorIndex()
return self.currentColor
end
function Colors:draw()
self.leftArrowButton:draw()
self.colorButton:draw()
self.rightArrowButton:draw()
self.backButton:draw()
end
|
-- @brief Builds deck layout from table data.
-- @brief The function which builds deck layout from table data.
-- @param data The table data.
-- @return The deck layout.
function deckLayoutBuilder(data)
-- validate
if not data.components then
error('Deck layout without components')
end
-- layout
local layout = ui.layout.DeckLayout.new()
-- components
for _,component in ipairs(data.components) do
layout:append(ui.layout.builder.build(component))
end
return layout
end
-- @brief Initializes the deck layout builder.
function init()
ui.layout.builder.registerBuilder('deck',deckLayoutBuilder)
end
-- initialize
init()
|
Class = require("pl.class")
Script = require("speedwalking.script")
Types = require("pl.types")
Class.Avalon_Walhalla_Zugang_Raus(Script)
function Avalon_Walhalla_Zugang_Raus:setup()
world.AddTriggerEx("avalon_walhalla_teich_ankunft_langsam",
"*Toll. Du haettest eigentlich mehr von den Goettern erwartet.",
"speedwalk_active_script():success()",
trigger_flag.Enabled,
NOCHANGE,
0,
'',
'',
sendto.script,
100
)
world.AddTriggerEx("avalon_walhalla_teich_ankunft_schnell",
"Wow - wenn man Schafe zaehlt, vergeht die Zeit ja wie im Fluge...",
"speedwalk_active_script():success()",
trigger_flag.Enabled,
NOCHANGE,
0,
'',
'',
sendto.script,
100
)
if not Types.is_empty(Avalon.IID()) and Avalon.IID() == "raum/718b91f6b42e217f3640b8ce2ffbeb18" then
self:success()
return
end
self:add_command("kletter in loch")
end
function Avalon_Walhalla_Zugang_Raus:teardown()
world.DeleteTrigger("avalon_walhalla_teich_ankunft_schnell")
world.DeleteTrigger("avalon_walhalla_teich_ankunft_langsam")
end
function Avalon_Walhalla_Zugang_Raus:get_duration()
return 20.0
end
function Avalon_Walhalla_Zugang_Raus:inverts(s)
return Types.type(s) == 'Avalon_Walhalla_Zugang_Rein'
end
return Avalon_Walhalla_Zugang_Raus
|
local cmd = vim.cmd
local fn = vim.fn
cmd(
[[
call wilder#setup({'modes': [':', '/', '?']})
call wilder#set_option('use_python_remote_plugin', 0)
call wilder#set_option('pipeline', [ wilder#branch( wilder#cmdline_pipeline({ 'use_python': 0, 'fuzzy': 1, 'fuzzy_filter': wilder#lua_fzy_filter(), }), wilder#vim_search_pipeline(),), ])
call wilder#set_option('renderer', wilder#popupmenu_renderer({ 'highlighter': wilder#lua_fzy_highlighter(), 'left': [ wilder#popupmenu_devicons() ], 'right': [ ' ', wilder#popupmenu_scrollbar(), ] }))
]]
)
|
--------------------------------------------------------------------------------
local class = require "lib.middleclass"
--------------------------------------------------------------------------------
local GenericInput = class("GenericInput")
function GenericInput:initialize(parent, left, top, width, options)
self.options = options or {}
self.parent = parent
self.width = width
self.height = self.options.height or 30
self.top = top
self.left = left
self.input_value = self.options.value
self.group = display.newGroup()
self:redraw()
end
function GenericInput:redraw()
if self.group then
self.group:removeSelf()
end
self.group = display.newGroup()
self.group.anchorX = 0
self.group.anchorY = 0
self.group.x = self.left
self.group.y = self.top
self:drawInput()
self.parent:insert(self.group)
end
function GenericInput:setErrorMode()
self.errorMode = true
self:redraw()
end
function GenericInput:clear()
self.input_value = nil
self.valueLabel = nil
self:redraw()
end
function GenericInput:setValue(value)
self.input_value = value
self:redraw()
end
function GenericInput:value()
return self.input_value
end
function GenericInput:required()
return self.options.required
end
function GenericInput:setFocus()
end
return GenericInput
|
local BaseClass = include('sh_actor_base.lua')
local slib = slib
local bgNPC = bgNPC
local table = table
local math = math
local SERVER = SERVER
local setmetatable = setmetatable
--
BGN_ACTOR = {}
function BGN_ACTOR:Instance(npc, npc_type, custom_uid, not_sync_actor_on_client, not_auto_added_to_list)
local npc_data = bgNPC:GetActorConfig(npc_type)
if not npc_data then return end
not_sync_actor_on_client = not_sync_actor_on_client or false
not_auto_added_to_list = not_auto_added_to_list or false
local default_name = 'Unknown citizen'
if npc_data.nicks and istable(npc_data.nicks) then
default_name = table.RandomBySeq(npc_data.nicks)
end
local default_gender = 'unknown'
if npc_data.gender and isstring(npc_data.gender) then
default_gender = npc_data.gender
end
local data = table.Copy(npc_data)
local obj = {}
obj.info = {
name = default_name,
gender = default_gender,
}
obj.uid = custom_uid or slib.GetUid()
obj.npc = npc
obj.npc_index = npc:EntIndex()
obj.class = npc:GetClass()
obj.collision_group = npc:GetCollisionGroup()
obj.model_scale = npc:GetModelScale()
obj.data = data
obj.weapon = nil
obj.sync_players_hash = {}
obj.state_delay = -1
if data.weapons and (not data.getting_weapon_chance or math.random(0, 100) < data.getting_weapon_chance) then
obj.weapon = table.RandomBySeq(data.weapons)
end
obj.type = npc_type
obj.reaction = ''
obj.eternal = false
obj.vehicle = nil
obj.state_data = {
state = 'none',
data = {}
}
if SERVER then
obj.next_anim = nil
obj.sync_animation_delay = 0
end
obj.anim_time = 0
obj.anim_time_normal = 0
obj.loop_time = 0
obj.loop_time_normal = 0
obj.anim_is_loop = false
obj.anim_name = ''
obj.is_animated = false
obj.anim_action = nil
obj.old_state = {
state = 'none',
data = {}
}
obj.state_lock = false
obj.walkPath = {}
obj.walkPos = nil
obj.walkTarget = NULL
obj.walkType = SCHED_FORCED_GO
obj.walkUpdatePathDelay = 0
obj.pathType = nil
obj.isChase = false
obj.isBgnClass = true
obj.targets = {}
obj.enemies = {}
obj.npc_schedule = -1
obj.npc_state = -1
setmetatable(obj, BaseClass)
local gender = obj:GetGenderByModel()
if gender and bgNPC.cfg.npc_names[gender] then
obj.info.name = table.RandomBySeq( bgNPC.cfg.npc_names[gender] )
obj.info.gender = gender
else
gender = table.RandomBySeq( { 'male', 'female' } )
obj.info.name = table.RandomBySeq( bgNPC.cfg.npc_names[gender] )
obj.info.gender = gender
end
function npc:GetActor()
return obj
end
npc.isBgnActor = true
if SERVER and not not_sync_actor_on_client then
snet.Request('bgn_add_actor_from_client', npc, npc_type, obj.uid, obj.info).InvokeAll()
end
if not not_auto_added_to_list then
bgNPC:AddNPC(obj)
end
return obj
end
snet.RegisterValidator('actor', function(ply, uid, actor_uid)
return bgNPC:GetActorByUid(actor_uid) ~= nil
end)
|
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
print('[^bitch-silahkutusu^0] - Baslatildi!')
ESX.RegisterUsableItem("silahkutusu", function(source)
local xPlayer = ESX.GetPlayerFromId(source)
TriggerClientEvent('bitchdev:silahkutusuac', source)
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Silah kutusu kullandın'})
end)
RegisterServerEvent("bitchdev:silahkutusu")
AddEventHandler("bitchdev:silahkutusu", function(itemname)
local xPlayer = ESX.GetPlayerFromId(source)
local yilbasi = xPlayer.getInventoryItem('silahkutusu').count
if yilbasi > 0 then
xPlayer.removeInventoryItem('silahkutusu', Config.Kutu)
xPlayer.addInventoryItem(RandomItem(), Config.KacTaneCiksin)
else
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Üzerinde silah kutusu yok!'})
end
end)
Items = { -- Burdan çıkabilcek itemleri ayarlayabilirsiniz.
'WEAPON_PISTOL',
'WEAPON_HEAVYPISTOL',
'WEAPON_APPISTOL',
'WEAPON_SNSPISTOL',
'WEAPON_VINTAGEPISTOL',
'WEAPON_KNIFE',
'WEAPON_PISTOL50',
'WEAPON_COMBATPISTOL',
'WEAPON_BAT',
'WEAPON_COMPACTRIFLE',
'WEAPON_SMG_MK2',
'WEAPON_SNIPERRIFLE',
'WEAPON_BAT',
'water'
}
function RandomItem()
return Items[math.random(#Items)]
end
ESX.RegisterServerCallback('bitch-checkitem', function(source, cb, item, output)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer ~= nil then
local items = xPlayer.getInventoryItem(item)
if items == nil then
cb(0)
else
cb(items.count)
end
end
end)
|
if !DOME_ENT then
DOME_ENT = {}
end
local BlockData = {}
BlockData.__index = BlockData
function BlockData:GetShapeMode()
return self.Shape.Type
end
function BlockData:GetPreventMode()
return self.preventMode
end
function BlockData:SetSphere(radius)
if not isnumber(radius) then return end
self.Shape.Radius = radius
self.Shape.Type = "Sphere"
end
function BlockData:GetSphereRadius()
if self.Shape.Type == "Sphere" then
return self.Shape.Radius
end
end
function BlockData:IsPermitted(ply)
if self.permission_type then
return table.HasValue(self.permitted,ply)
else
return not table.HasValue(self.permitted,ply)
end
end
function BlockData:GetPermittedPlayers()
return self.permitted
end
function BlockData:GetPermissionType()
return self.permission_type
end
function BlockData:SetPermissionType(ptype)
if not isbool(ptype) then
error("expected boolean, got "..type(ptype))
return
end
self.permission_type = ptype
end
function BlockData:MakeFromSteamID()
self.permitted = {}
for K,V in pairs(self.permittedSteamID) do
local ply = player.GetBySteamID(V)
if ply then table.insert(self.permitted,ply) end
end
end
function BlockData:MakeFromCopy(data)
self.permittedSteamID = data.permittedSteamID --we copy only steamid data
self.preventMode = data.preventMode --1 teleport, 2 damage and dissolve, 3 just dissolve
self.permission_type = data.permission_type --false : accept players out of the list, true - in the list
self.Shape = data.Shape
end
function BlockData:create()
local data = {}
data.permitted = {}
data.permittedSteamID = {}
data.preventMode = 3 --1 teleport, 2 damage and dissolve, 3 just dissolve
data.permission_type = false --false : accept players out of the list, true - in the list
data.Shape = {}
data.Shape.Radius = 512 --default
data.Shape.Type = "Sphere"
setmetatable(data,BlockData)
return data
end
setmetatable(BlockData,{
__call = function(self)
return self:create()
end
})
DOME_ENT.BlockData = BlockData
|
-- telescope.nvim
-- https://github.com/nvim-telescope/telescope.nvim
vim.cmd 'packadd telescope.nvim'
vim.cmd 'packadd telescope-symbols.nvim'
vim.cmd 'packadd telescope-z.nvim'
local telescope = require 'telescope'
local actions = require 'telescope.actions'
local previewers = require 'telescope.previewers'
telescope.setup {
defaults = {
prompt_prefix = '❯ ',
selection_caret = '❯ ',
color_devicons = true,
file_previewer = previewers.vim_buffer_cat.new,
grep_previewer = previewers.vim_buffer_vimgrep.new,
qflist_previewer = previewers.vim_buffer_qflist.new,
winblend = 10,
mappings = {
n = {
['<CR>'] = actions.select_default + actions.center,
s = actions.select_horizontal,
v = actions.select_vertical,
t = actions.select_tab,
j = actions.move_selection_next,
k = actions.move_selection_previous,
u = actions.preview_scrolling_up,
d = actions.preview_scrolling_down,
},
},
},
}
telescope.load_extension 'builtin_extensions'
telescope.load_extension 'z'
|
local style = utaha.styleCollection
style
:addFont("font.normal", "res/fonts/wqy-zenhei.ttf", 20)
:addFont("font.small", "res/fonts/wqy-zenhei.ttf", 12)
:addFont("font.big", "res/fonts/wqy-zenhei.ttf", 20)
style
:setFont("test.font", "font.normal")
:setColor("test.3", 0xff010200)
:setSize("test.2", 100, 200)
:setInt("test.1", 1)
:setFloat("test.4", 1.1001)
|
local ADDON_NAME, namespace = ...
local L = namespace.L
local addonName = "ArkInventory"
local ArkInventoryMixin = {}
function ArkInventoryMixin:GetName()
return addonName
end
function ArkInventoryMixin:Init()
hooksecurefunc(ArkInventory.API, "ItemFrameUpdated", function(...) self:OnFrameItemUpdate(...) end)
end
function ArkInventoryMixin:SetTooltipItem(tooltip, item, locationInfo)
if locationInfo.isOffline then
if not item:IsItemEmpty() then
tooltip:SetHyperlink(item:GetItemLink())
end
elseif not item:HasItemLocationBankOrBags() then
local speciesID, level, breedQuality, maxHealth, power, speed, name = tooltip:SetGuildBankItem(locationInfo.tab, locationInfo.index)
elseif locationInfo.bag == BANK_CONTAINER then
local hasItem, hasCooldown, repairCost, speciesID, level, breedQuality, maxHealth, power, speed, name = tooltip:SetInventoryItem("player", BankButtonIDToInvSlotID(locationInfo.slot))
else
local hasCooldown, repairCost, speciesID, level, breedQuality, maxHealth, power, speed, name = tooltip:SetBagItem(locationInfo.bag, locationInfo.slot)
end
end
function ArkInventoryMixin:Refresh()
ArkInventory.ItemCacheClear( )
ArkInventory.Frame_Main_Generate( nil, ArkInventory.Const.Window.Draw.Recalculate )
end
function ArkInventoryMixin:GetDisplayInfo(button, item, feature, locationInfo, options, mogStatus, bindingStatus)
if locationInfo.isOffline then
local showBindingStatus = CaerdonWardrobeConfig.Binding.ShowStatus.BankAndBags
local showOwnIcon = CaerdonWardrobeConfig.Icon.ShowLearnable.BankAndBags
local showOtherIcon = CaerdonWardrobeConfig.Icon.ShowLearnableByOther.BankAndBags
local showSellableIcon = CaerdonWardrobeConfig.Icon.ShowSellable.BankAndBags
return {
bindingStatus = {
shouldShow = showBindingStatus
},
ownIcon = {
shouldShow = showOwnIcon
},
otherIcon = {
shouldShow = showOtherIcon
},
sellableIcon = {
shouldShow = showSellableIcon
}
}
elseif not item:HasItemLocationBankOrBags() then
return {
bindingStatus = {
shouldShow = CaerdonWardrobeConfig.Binding.ShowStatus.GuildBank
},
ownIcon = {
shouldShow = CaerdonWardrobeConfig.Icon.ShowLearnable.GuildBank
},
otherIcon = {
shouldShow = CaerdonWardrobeConfig.Icon.ShowLearnableByOther.GuildBank
},
sellableIcon = {
shouldShow = CaerdonWardrobeConfig.Icon.ShowSellable.GuildBank
}
}
else
return {}
end
end
function ArkInventoryMixin:OnFrameItemUpdate(frame, loc_id, bag_id, slot_id)
C_Timer.After(0.2, function () -- ArkInventory is slow compared to some - doing this until I find a better way - may need tweaked higher
local bag = ArkInventory.API.InternalIdToBlizzardBagId(loc_id, bag_id)
local slot = slot_id
local options = {
showMogIcon=true,
showBindStatus=true,
showSellables=true
}
if not ArkInventory.API.LocationIsOffline(loc_id) then
if loc_id == ArkInventory.Const.Location.Vault then
local itemDB = ArkInventory.API.ItemFrameItemTableGet(frame)
local itemLink = itemDB and itemDB.h
-- ArkInventory creates invalid hyperlinks for caged battle pets - fix 'em up for now
if ( itemLink and strfind(itemLink, "battlepet:") ) then
local _, speciesID, level, quality, health, power, speed, battlePetID = strsplit(":", itemLink);
local name, icon, petType, creatureID, sourceText, description, isWild, canBattle, tradable, unique, _, displayID = C_PetJournal.GetPetInfoBySpeciesID(speciesID);
if battlePetID == name then
battlePetID = "0"
end
itemLink = string.format("%s|Hbattlepet:%s:%s:%s:%s:%s:%s:%s|h[%s]|h|r", YELLOW_FONT_COLOR_CODE, speciesID, level, quality, health, power, speed, battlePetID, name)
end
local tab = ArkInventory.Global.Location[loc_id].view_tab
if itemLink then
local item = CaerdonItem:CreateFromItemLink(itemLink)
CaerdonWardrobe:UpdateButton(frame, item, self, {
locationKey = format("tab%d-index%d", tab, slot),
tab = tab,
index = slot
}, options)
else
CaerdonWardrobe:ClearButton(frame)
end
else
local item = CaerdonItem:CreateFromBagAndSlot(bag, slot)
CaerdonWardrobe:UpdateButton(frame, item, self, { bag = bag, slot = slot }, options)
end
else
local itemLink
local i = ArkInventory.API.ItemFrameItemTableGet( frame )
if i and i.h then
itemLink = i.h
end
if itemLink then
local item = CaerdonItem:CreateFromItemLink(itemLink)
CaerdonWardrobe:UpdateButton(frame, item, self, {
locationKey = format("bag%d-slot%d", bag, slot),
isOffline = true
}, options)
else
CaerdonWardrobe:ClearButton(frame)
end
end
end)
end
local Version = nil
if select(4, GetAddOnInfo(addonName)) then
if IsAddOnLoaded(addonName) then
Version = GetAddOnMetadata(addonName, 'Version')
CaerdonWardrobe:RegisterFeature(ArkInventoryMixin)
end
end
|
local tw, th = wm.getSize()
local w, h = term.getSize()
local recent = {}
local pinned = {}
local util = require("/lib/util")
local textbox = require("/lib/textbox")
local scroll = require("/lib/scrollwindow")
local draw = require("/lib/draw")
local file = util.loadModule("file")
local theme = _G.wm.getTheme()
local search = textbox.new(3, h - 1, w - 7, nil, "Search", nil, theme.userInput.background, theme.userInput.text)
local searchWindow = scroll.new(2, 2, w - 3, h - 4, {}, theme.menu.background, false)
local pinnedWindow = scroll.new(2, 2, w - 3, h - 4, {}, theme.menu.background, true)
local wm = _G.wm
local query
local searchResults = {}
local function setColors(text, background)
term.setTextColor(text)
term.setBackgroundColor(background)
end
local function searchSystem(query, depth)
if not depth then depth = 10 end
local found = {}
local function searchDir(path, query, iteration, depth)
for _, file in pairs(fs.list(path)) do
if file:sub(1, 1) ~= "." then
if fs.isDir(fs.combine(path, file)) and iteration < depth then
searchDir(fs.combine(path, file), query, iteration + 1, depth)
else
if string.find(string.lower(file), string.lower(query)) then
table.insert(found, fs.combine(path, file))
end
end
end
end
end
searchDir("/", query, 1, depth)
return found
end
local function none() end
local function updateRecent()
file.writeTable("/etc/menu/recent.cfg", recent)
end
local function loadRecent()
recent = file.readTable("/etc/menu/recent.cfg")
end
local function updatePinned()
file.writeTable("/etc/menu/pinned.cfg", pinned)
end
local function loadPinned()
pinned = file.readTable("/etc/menu/pinned.cfg")
end
local function cleanRecent(path)
for i, v in pairs(recent) do
if path == v.path then
table.remove(recent, i)
end
end
end
local function drawUI()
term.setBackgroundColor(theme.menu.background)
term.clear()
local sw = w - 3
if not query then
searchWindow.setVisible(false)
pinnedWindow.setVisible(true)
pinnedWindow.setElements({})
local pos = 1
pinnedWindow.addElement(scroll.createElement(2, pos, "Pinned", colors.white, theme.menu.background, none))
pos = pos + 1
pinnedWindow.addElement(scroll.createElement(1, pos, string.rep("\140", sw), colors.lightGray, theme.menu.background, none))
pos = pos + 1
for i, v in pairs(pinned) do
pinnedWindow.addElement(scroll.createElement(2, pos, draw.overflow(v.title, sw), colors.white, theme.menu.background, function()
wm.endProcess(id)
wm.selectProcess(wm.createProcess(v.path, v.insettings))
cleanRecent(v.path)
table.insert(recent, 1, {
name = v.insettings.title or fs.getName(v.path),
path = v.path,
settings = {
width = v.insettings.width,
height = v.insettings.height,
title = v.insettings.title,
}
})
updateRecent()
end))
pos = pos + 1
end
pos = pos + 1
pinnedWindow.addElement(scroll.createElement(2, pos, "Recent", colors.white, theme.menu.background, none))
pos = pos + 1
pinnedWindow.addElement(scroll.createElement(1, pos, string.rep("\140", sw), colors.lightGray, theme.menu.background, none))
pos = pos + 1
for i, v in pairs(recent) do
pinnedWindow.addElement(scroll.createElement(2, pos, draw.overflow(v.name, sw), colors.white, theme.menu.background, function()
wm.endProcess(id)
wm.selectProcess(wm.createProcess(v.path, {}))
cleanRecent(v.path)
table.insert(recent, 1, {
name = v.name,
path = v.path,
settings = v.settings
})
updateRecent()
end))
pos = pos + 1
end
if #recent == 0 then
pinnedWindow.addElement(scroll.createElement(2, pos, draw.overflow("No recent apps", sw), colors.white, theme.menu.background, none))
end
pinnedWindow.redraw()
else
local pos = 1
local elements = {}
searchWindow.setVisible(true)
pinnedWindow.setVisible(false)
searchWindow.setElements({})
if #searchResults == 0 then
searchWindow.addElement(scroll.createElement(math.ceil(searchWindow.getWidth() / 2 - string.len("No results") / 2), pos, "No results.", colors.lightGray, theme.menu.background, function() end))
else
searchWindow.addElement(scroll.createElement(1, pos, "Found " .. #searchResults .. " results", colors.white, theme.menu.background, none))
pos = pos + 1
searchWindow.addElement(scroll.createElement(1, pos, string.rep("\140", sw), colors.lightGray, theme.menu.background, none))
pos = pos + 1
for i, v in pairs(searchResults) do
local function addFunction()
wm.endProcess(id)
wm.selectProcess(wm.createProcess(v, {}))
cleanRecent(v)
table.insert(recent, 1, {
name = fs.getName(v),
path = v,
settings = {}
})
updateRecent()
end
searchWindow.addElement(scroll.createElement(2, pos, draw.overflow(fs.getName(v), sw), colors.white, theme.menu.background, addFunction))
pos = pos + 1
local text = fs.getDir(v)
if fs.getDir(v) == "" then
text = "Root"
end
searchWindow.addElement(scroll.createElement(2, pos, draw.overflow(text, sw), colors.lightGray, theme.menu.background, addFunction))
pos = pos + 1
searchWindow.addElement(scroll.createElement(2, pos, "", colors.lightGray, theme.menu.background, function() end))
pos = pos + 1
end
searchWindow.removeElement(#searchWindow.getElements())
end
searchWindow.redraw()
end
term.setBackgroundColor(colors.red)
term.setTextColor(colors.white)
term.setCursorPos(w - 2, h - 1)
term.write("O")
term.setCursorPos(w - 1, h - 2)
term.setBackgroundColor(theme.menu.background)
draw.drawBorder(w - 2, h - 1, 1, 1, colors.red)
term.setCursorPos(w, h - 1)
search.redraw()
term.setCursorPos(w - 1, h - 2)
term.setBackgroundColor(theme.menu.background)
draw.drawBorder(3, h - 1, w - 7, 1, theme.userInput.background)
end
if not fs.exists("/etc/menu/recent.cfg") then
updateRecent()
end
loadRecent()
loadPinned()
drawUI()
while true do
local e = {os.pullEvent()}
if e[1] == "mouse_click" then
local m, x, y = e[2], e[3], e[4]
if x == w - 2 and y == h - 1 then
wm.endProcess(id)
wm.selectProcess(wm.createProcess("/bin/ui/shutdown.lua", {
height = 6,
showTitlebar = false,
dontShowInTitlebar = true,
title = "Power"
}))
elseif x >= 2 and x <= w - 5 and y == h - 1 then
query = search.select()
if query == "" then query = nil end
if query then
searchResults = searchSystem(query)
drawUI()
end
end
elseif e[1] == "wm_themeupdate" then
theme = file.readTable("/etc/colors.cfg")
end
local found = searchWindow.checkEvents(e)
pinnedWindow.checkEvents(e)
end
|
name 'Lua Connection'
author 'Gaada'
description 'Gade Lua Connection'
fx_version 'adamant'
game 'gta5'
server_scripts {
'server.lua',
}
|
local cmd = vim.cmd
local fn = vim.fn
local defaults = {
comment_italics = true,
}
local M = {
Color = require('colorbuddy.init').Color,
colors = require('colorbuddy.init').colors,
Group = require('colorbuddy.init').Group,
groups = require('colorbuddy.init').groups,
styles = require('colorbuddy.init').styles,
}
function M.setup(opts)
if not opts then opts = {} end
for k, v in pairs(defaults) do
if opts[k] == nil then opts[k] = v end
end
-- typos are annoying
for k, _ in pairs(opts) do
if defaults[k] == nil then print("neosolarized: unknown setting: ", k) end
end
cmd([[
packadd! colorbuddy.nvim
highlight clear
]])
if fn.exists('syntax_on') then cmd('syntax reset') end
vim.g.colors_name = 'neosolarized'
local Color = M.Color
local colors = M.colors
local Group = M.Group
local groups = M.groups
local styles = M.styles
Color.new('base03', '#002b36')
Color.new('base02', '#073642')
Color.new('base01', '#586e75')
Color.new('base00', '#657b83')
Color.new('base0', '#839496')
Color.new('base1', '#93a1a1')
Color.new('base2', '#eee8d5')
Color.new('base3', '#fdf6e3')
Color.new('yellow', '#b58900')
Color.new('orange', '#cb4b16')
Color.new('red', '#dc322f')
Color.new('magenta', '#d33682')
Color.new('violet', '#6c71c4')
Color.new('blue', '#268bd2')
Color.new('cyan', '#2aa198')
Color.new('green', '#719e07')
Color.new('bg', colors.base03)
Group.new('Error', colors.red)
Group.new('Warning', colors.yellow)
Group.new('Information', colors.blue)
Group.new('Hint', colors.cyan)
-- normal non-current text
Group.new('Normal', colors.base0, colors.NONE, styles.NONE)
Group.new('NormalNC', colors.base0:dark(), colors.NONE, styles.NONE)
Group.new('Comment', colors.base01, colors.none, opts.comment_italics and styles.italic or styles.NONE)
Group.new('Constant', colors.cyan, colors.none, styles.NONE)
-- Any variable name, function or class name
Group.new('Identifier', colors.blue, colors.none, styles.NONE)
-- any statement, conditional, repeat (for, do while), label, operator
Group.new('Statement', colors.green, colors.none, styles.NONE)
Group.new('PreProc', colors.orange, colors.none, styles.NONE)
Group.new('Type', colors.yellow, colors.none, styles.NONE)
Group.new('Special', colors.red, colors.none, styles.NONE)
Group.new('Underlined', colors.violet, colors.none, styles.NONE)
Group.new('Ignore', colors.none, colors.none, styles.NONE)
Group.new('Error', colors.red, colors.none, styles.NONE)
Group.new('TODO', colors.magenta, colors.none, styles.bold)
Group.new('SpecialKey', colors.base00, colors.base02, styles.bold)
Group.new('NonText', colors.base00, colors.NONE, styles.bold)
Group.new('StatusLine', colors.base1, colors.base02, styles.reverse)
Group.new('StatusLineNC', colors.base00, colors.base02, styles.reverse)
Group.new('Visual', colors.base01, colors.base03, styles.reverse)
Group.new('Directory', colors.blue, colors.none, styles.NONE)
Group.new('ErrorMsg', colors.red, colors.none, styles.reverse)
Group.new('IncSearch', colors.orange, colors.none, styles.standout)
Group.new('Search', colors.yellow, colors.none, styles.reverse)
Group.new('MoreMsg', colors.blue, colors.none, styles.NONE)
Group.new('ModeMsg', colors.blue, colors.none, styles.NONE)
Group.new('Question', colors.cyan, colors.none, styles.bold)
Group.new('VertSplit', colors.base00, colors.none, styles.NONE)
Group.new('Title', colors.orange, colors.none, styles.bold)
Group.new('VisualNOS', colors.none, colors.base02, styles.reverse)
Group.new('WarningMsg', colors.red, colors.none, styles.NONE)
Group.new('WildMenu', colors.base2, colors.base02, styles.reverse)
Group.new('Folded', colors.base0, colors.base02, styles.bold, colors.base03)
Group.new('FoldColumn', colors.base0, colors.base02, styles.NONE)
Group.new('DiffAdd', colors.green, colors.base02, styles.bold, colors.green)
Group.new('DiffChange', colors.yellow, colors.base02, styles.bold, colors.yellow)
Group.new('DiffDelete', colors.red, colors.base02, styles.bold)
Group.new('DiffText', colors.blue, colors.base02, styles.bold, colors.blue)
Group.new('SignColumn', colors.base0, colors.none, styles.NONE)
Group.new('Conceal', colors.blue, colors.none, styles.NONE)
Group.new('SpellBad', colors.none, colors.none, styles.undercurl, colors.red)
Group.new('SpellCap', colors.none, colors.none, styles.undercurl, colors.violet)
Group.new('SpellRare', colors.none, colors.none, styles.undercurl, colors.cyan)
Group.new('SpellLocal', colors.none, colors.none, styles.undercurl, colors.yellow)
-- pum (popup menu)
Group.new('Pmenu', groups.Normal, colors.base02, styles.none) -- popup menu normal item
Group.new('PmenuSel', colors.base01, colors.base2, styles.reverse) -- selected item
Group.new('PmenuSbar', colors.base02, colors.none, styles.reverse)
Group.new('PmenuThumb', colors.base0, colors.none, styles.reverse)
-- be nice for this float border to be cyan if active
Group.new('FloatBorder', colors.base02)
Group.new('TabLine', colors.base0, colors.base02, styles.NONE, colors.base0)
Group.new('TabLineFill', colors.base0, colors.base02)
Group.new('TabLineSel', colors.yellow, colors.bg)
Group.new('LineNr', colors.base01, colors.none, styles.NONE)
Group.new('CursorLine', colors.none, colors.base02, styles.NONE, colors.base1)
Group.new('CursorLineNr', colors.none, colors.none, styles.NONE, colors.base1)
Group.new('ColorColumn', colors.none, colors.base02, styles.NONE)
Group.new('Cursor', colors.base03, colors.base0, styles.NONE)
Group.link('lCursor', groups.Cursor)
Group.link('TermCursor', groups.Cursor)
Group.new('TermCursorNC', colors.base03, colors.base01)
Group.new('MatchParen', colors.red, colors.base01, styles.bold)
Group.new('GitGutterAdd', colors.green)
Group.new('GitGutterChange', colors.yellow)
Group.new('GitGutterDelete', colors.red)
Group.new('GitGutterChangeDelete', colors.red)
Group.new('GitSignsAddLn', colors.green)
Group.new('GitSignsAddNr', colors.green)
Group.new('GitSignsChangeLn', colors.yellow)
Group.new('GitSignsChangeNr', colors.yellow)
Group.new('GitSignsDeleteLn', colors.red)
Group.new('GitSignsDeleteNr', colors.red)
Group.link('GitSignsCurrentLineBlame', groups.Comment)
-- vim highlighting
Group.link('vimVar', groups.Identifier)
Group.link('vimFunc', groups.Identifier)
Group.link('vimUserFunc', groups.Identifier)
Group.link('helpSpecial', groups.Special)
Group.link('vimSet', groups.Normal)
Group.link('vimSetEqual', groups.Normal)
Group.new('vimCommentString', colors.violet)
Group.new('vimCommand', colors.yellow)
Group.new('vimCmdSep', colors.blue, colors.NONE, styles.bold)
Group.new('helpExample', colors.base1)
Group.new('helpOption', colors.cyan)
Group.new('helpNote', colors.magenta)
Group.new('helpVim', colors.magenta)
Group.new('helpHyperTextJump', colors.blue, colors.NONE, styles.underline)
Group.new('helpHyperTextEntry', colors.green)
Group.new('vimIsCommand', colors.base00)
Group.new('vimSynMtchOpt', colors.yellow)
Group.new('vimSynType', colors.cyan)
Group.new('vimHiLink', colors.blue)
Group.new('vimGroup', colors.blue, colors.NONE, styles.underline + styles.bold)
Group.new('gitcommitSummary', colors.green)
Group.new('gitcommitComment', colors.base01, colors.NONE, styles.italic)
Group.link('gitcommitUntracked', groups.gitcommitComment)
Group.link('gitcommitDiscarded', groups.gitcommitComment)
Group.new('gitcommitSelected', groups.gitcommitComment)
Group.new('gitcommitUnmerged', colors.green, colors.NONE, styles.bold)
Group.new('gitcommitOnBranch', colors.base01, colors.NONE, styles.bold)
Group.new('gitcommitBranch', colors.magenta, colors.NONE, styles.bold)
Group.link('gitcommitNoBranch', groups.gitcommitBranch)
Group.new('gitcommitDiscardedType', colors.red)
Group.new('gitcommitSelectedType', colors.green)
Group.new('gitcommitHeader', colors.base01)
Group.new('gitcommitUntrackedFile', colors.cyan)
Group.new('gitcommitDiscardedFile', colors.red)
Group.new('gitcommitSelectedFile', colors.green)
Group.new('gitcommitUnmergedFile', colors.yellow)
Group.new('gitcommitFile', colors.base0)
Group.link('gitcommitDiscardedArrow', groups.gitCommitDiscardedFile)
Group.link('gitcommitSelectedArrow', groups.gitCommitSelectedFile)
Group.link('gitcommitUnmergedArrow', groups.gitCommitUnmergedFile)
Group.link('diffAdded', groups.Statement)
Group.link('diffLine', groups.Identifier)
Group.new('NeomakeErrorSign', colors.orange)
Group.new('NeomakeWarningSign', colors.yellow)
Group.new('NeomakeMessageSign', colors.cyan)
Group.new('NeomakeNeomakeInfoSign', colors.green)
Group.new('CmpItemKind', colors.green, colors.none, styles.none)
Group.new('CmpItemMenu', groups.NormalNC, colors.bg, styles.none)
-- Group.new('CmpItemAbbr', colors.base0, colors.bg, styles.none)
-- Group.new('CmpItemAbbrMatch', colors.base0, colors.bg, styles.none)
Group.new('LspSagaCodeActionTitle', colors.green)
Group.new('LspSagaBorderTitle', colors.yellow, colors.none, styles.bold)
Group.new('LspSagaDiagnosticHeader', colors.yellow)
Group.new('ProviderTruncateLine', colors.base02)
Group.new('LspSagaShTruncateLine', groups.ProviderTruncateLine)
Group.new('LspSagaDocTruncateLine', groups.ProviderTruncateLine)
Group.new('LspSagaCodeActionTruncateLine', groups.ProviderTruncateLine)
Group.new('LspSagaHoverBorder', colors.cyan)
Group.new('LspSagaRenameBorder', groups.LspSagaHoverBorder)
Group.new('LSPSagaDiagnosticBorder', groups.LspSagaHoverBorder)
Group.new('LspSagaSignatureHelpBorder', groups.LspSagaHoverBorder)
Group.new('LspSagaCodeActionBorder', groups.LspSagaHoverBorder)
Group.new('LspSagaLspFinderBorder', groups.LspSagaHoverBorder)
Group.new('LspSagaFloatWinBorder', groups.LspSagaHoverBorder)
Group.new('LspSagaSignatureHelpBorder', groups.LspSagaHoverBorder)
Group.new('LspSagaDefPreviewBorder', groups.LspSagaHoverBorder)
Group.new('LspSagaAutoPreviewBorder', groups.LspSagaHoverBorder)
Group.new('LspFloatWinBorder', groups.LspSagaHoverBorder)
Group.new('LspLinesDiagBorder', groups.LspSagaHoverBorder)
Group.new('LspSagaFinderSelection', colors.green, colors.none, styles.bold)
--Group.new('SagaShadow', colors.base02)
Group.new('TelescopeMatching', colors.orange, groups.Special, groups.Special, groups.Special)
Group.new('TelescopeBorder', colors.base01) -- float border not quite dark enough, maybe that needs to change?
Group.new('TelescopePromptBorder', colors.cyan) -- active border lighter for clarity
Group.new('TelescopeTitle', groups.Normal) -- separate them from the border a little, but not make them pop
Group.new('TelescopePromptPrefix', groups.Normal) -- default is groups.Identifier
Group.link('TelescopeSelection', groups.CursorLine)
Group.new('TelescopeSelectionCaret', colors.cyan)
Group.new('NeogitDiffAddHighlight', colors.blue, colors.red)
Group.new('NeogitDiffDeleteHighlight', colors.blue, colors.red)
Group.new('NeogitHunkHeader', groups.Normal, colors.base02)
Group.new('NeogitHunkHeaderHighlight', groups.Normal, colors.red)
Group.new('NeogitDiffContextHighlight', colors.base2, colors.base02)
Group.new('NeogitCommandText', groups.Normal)
Group.new('NeogitCommandTimeText', groups.Normal)
Group.new('NeogitCommandCodeNormal', groups.Normal)
Group.new('NeogitCommandCodeError', groups.Error)
Group.new('NeogitNotificationError', groups.Error, colors.none)
Group.new('NeogitNotificationInfo', groups.Information, colors.none)
Group.new('NeogitNotificationWarning', groups.Warning, colors.none)
-- seblj/nvim-tabline
Group.new('TabLineSeparatorActive', colors.cyan)
Group.link('TabLineModifiedSeparatorActive', groups.TablineSeparatorActive)
-- kevinhwang91/nvim-bqf
Group.new('BqfPreviewBorder', colors.base01)
Group.new('BqfSign', colors.cyan)
-- Primeagen/harpoon
Group.new("HarpoonBorder", colors.cyan)
Group.new("HarpoonWindow", groups.Normal)
Group.new("NvimTreeFolderIcon", colors.blue)
-- phaazon/hop.nvim
Group.link('HopNextKey', groups.IncSearch)
Group.link('HopNextKey1', groups.IncSearch)
Group.link('HopNextKey2', groups.IncSearch)
function M.translate(group)
if fn.has("nvim-0.6.0") == 0 then return group end
if not string.match(group, "^LspDiagnostics") then return group end
local translated = group
translated = string.gsub(translated, "^LspDiagnosticsDefault", "Diagnostic")
translated = string.gsub(translated, "^LspDiagnostics", "Diagnostic")
translated = string.gsub(translated, "Warning$", "Warn")
translated = string.gsub(translated, "Information$", "Info")
return translated
end
local lspColors = {
Error = groups.Error,
Warning = groups.Warning,
Information = groups.Information,
Hint = groups.Hint,
}
for _, lsp in pairs({ "Error", "Warning", "Information", "Hint" }) do
local lspGroup = Group.new(M.translate("LspDiagnosticsDefault" .. lsp), lspColors[lsp])
Group.link(M.translate("LspDiagnosticsVirtualText" .. lsp), lspGroup)
Group.new(M.translate("LspDiagnosticsUnderline" .. lsp), colors.none, colors.none, styles.undercurl, lspColors[lsp])
end
for _, name in pairs({ "LspReferenceText", "LspReferenceRead", "LspReferenceWrite" }) do
Group.link(M.translate(name), groups.CursorLine)
end
return M
end
return M
|
-- Copyright (c) 2018 Redfern, Trevor <trevorredfern@gmail.com>
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
local Stack = { }
function Stack:new()
local s = {}
setmetatable(s, self)
self.__index = self
return s
end
function Stack:push(value)
self[#self + 1] = value
end
function Stack:pop()
return table.remove(self)
end
function Stack:top()
return self[#self]
end
function Stack:isEmpty()
return #self == 0
end
function Stack:clear()
while not self:isEmpty() do
self:pop()
end
end
return Stack
|
local json = require("snaker.utils.json")
local _M = {}
function _M:init()
local req = {
params = {},
body = {}
}
local request_method = ngx.var.request_method
local request_args , request_body
if "POST" == request_method then
ngx.req.read_body()
request_args = ngx.req.get_post_args()
request_body = ngx.req.get_body_data()
req.body = request_body
else
request_args = ngx.req.get_uri_args()
end
req.params = request_args
return req
end
return _M
|
require 'kbd'
stead.module_init(function()
hook_keys('1','2','3','4','5','6','7','8','9','0');
end)
game.kbd = stead.hook(game.kbd, function(f, s, down, key, ...)
if down and key >= '0' and key <= '9' then
if isDialog(stead.here()) then
if key == '0' then key = '10' end
local p = stead.here():srch(key);
if p and stead.nameof(p) == key then
return stead.call(p, 'act');
end
end
return
end
return f(s, down, key, ...);
end)
-- vim:ts=4
|
local oil = require "oil"
local oo = require "oil.oo"
local assert = require "oil.assert"
local UnorderedArraySet = require "loop.collection.UnorderedArraySet"
local ProxyPushConsumer = require "oil.corba.services.event.ProxyPushConsumer"
module("oil.corba.services.event.SupplierAdmin", oo.class)
function __init(class, channel)
return oo.rawnew(class, {
channel = channel,
proxypushconsumers = UnorderedArraySet()
})
end
-- The obtain_push_consumer operation returns a ProxyPushConsumer object.
-- The ProxyPushConsumer object is then used to connect a push-style supplier.
function obtain_push_consumer(self)
return ProxyPushConsumer(self)
end
-- invoked by ProxyPushConsumer to signal it's connected
function add_push_supplier(self, proxy, push_supplier)
self.proxypushconsumers:add(proxy)
self.channel:add_push_supplier(push_supplier)
end
-- invoked by ProxyPushConsumer to signal it's connected
function rem_push_supplier(self, proxy, push_supplier)
assert.results(self.proxypushconsumers:contains(proxy))
self.proxypushconsumers:remove(proxy)
self.channel:rem_push_supplier(push_supplier)
end
-- invoked by the channel to disconnect all proxies of the admin
-- must reverse iterate over proxypushconsumers because the disconnection
-- removes the supplier from the array.
function destroy(self)
for i=#self.proxypushconsumers,1,-1 do
local proxy = self.proxypushconsumers[i]
oil.pcall(proxy.disconnect_push_consumer, proxy)
end
self.proxypushconsumers = nil
self.channel = nil
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.