content stringlengths 5 1.05M |
|---|
--[[
ComputerCraft Package Tool Installer
Author: PentagonLP
Version: 1.0
Lines of Code: 161; Characters: 5541
]]
-- Read arguments
args = {...}
-- FILE MANIPULATION FUNCTIONS --
--[[ Checks if file exists
@param String filepath: Filepath to check
@return boolean: Does the file exist?
--]]
function file_exists(filepath)
local f=io.open(filepath,"r")
if f~=nil then
io.close(f)
return true
else
return false
end
end
--[[ Stores a file in a desired location
@param String filepath: Filepath where to create file (if file already exists, it gets overwritten)
@param String content: Content to store in file
--]]
function storeFile(filepath,content)
writefile = fs.open(filepath,"w")
writefile.write(content)
writefile.close()
end
--[[ Reads a file from a desired location
@param String filepath: Filepath to the file to read
@param String createnew: (Optional) Content to store in new file and return if file does not exist. Can be nil.
@return String|boolean content|error: Content of the file; If createnew is nil and file doesn't exist boolean false is returned
--]]
function readFile(filepath,createnew)
readfile = fs.open(filepath,"r")
if readfile == nil then
if not (createnew==nil) then
storeFile(filepath,createnew)
return createnew
else
return false
end
end
content = readfile.readAll()
readfile.close()
return content
end
--[[ Stores a table in a file
@param String filepath: Filepath where to create file (if file already exists, it gets overwritten)
@param Table data: Table to store in file
--]]
function storeData(filepath,data)
storeFile(filepath,textutils.serialize(data):gsub("\n",""))
end
--[[ Reads a table from a file in a desired location
@param String filepath: Filepath to the file to read
@param boolean createnew: If true, an empty table is stored in new file and returned if file does not exist.
@return Table|boolean content|error: Table thats stored in the file; If createnew is false and file doesn't exist boolean false is returned
--]]
function readData(filepath,createnew)
if createnew then
return textutils.unserialize(readFile(filepath,textutils.serialize({}):gsub("\n","")))
else
return textutils.unserialize(readFile(filepath,nil))
end
end
-- HTTP FETCH FUNCTIONS --
--[[ Gets result of HTTP URL
@param String url: The desired URL
@return Table|boolean result|error: The result of the request; If the URL is not reachable, an error is printed in the terminal and boolean false is returned
--]]
function gethttpresult(url)
if not http.checkURL(url) then
print("ERROR: Url '" .. url .. "' is blocked in config. Unable to fetch data.")
return false
end
result = http.get(url)
if result == nil then
print("ERROR: Unable to reach '" .. url .. "'")
return false
end
return result
end
--[[ Download file HTTP URL
@param String filepath: Filepath where to create file (if file already exists, it gets overwritten)
@param String url: The desired URL
@return nil|boolean nil|error: nil; If the URL is not reachable, an error is printed in the terminal and boolean false is returned
--]]
function downloadfile(filepath,url)
result = gethttpresult(url)
if result == false then
return false
end
storeFile(filepath,result.readAll())
end
-- MISC HELPER FUNCTIONS --
--[[ Checks wether a String starts with another one
@param String haystack: String to check wether is starts with another one
@param String needle: String to check wether another one starts with it
@return boolean result: Wether the firest String starts with the second one
]]--
function startsWith(haystack,needle)
return string.sub(haystack,1,string.len(needle))==needle
end
-- MAIN PROGRAMM --
if (args[1]=="install") or (args[1]==nil) then
print("[Installer] Well, hello there!")
print("[Installer] Thank you for downloading the ComputerCraft Package Tool! Installing...")
print("[Installer] Installing 'properprint' library...")
if downloadfile("lib/properprint","https://raw.githubusercontent.com/PentagonLP/properprint/main/properprint")== false then
return false
end
print("[Installer] Successfully installed 'properprint'!")
print("[Installer] Installing 'ccpt'...")
if downloadfile("ccpt","https://raw.githubusercontent.com/PentagonLP/ccpt/main/ccpt")==false then
return false
end
print("[Installer] Successfully installed 'ccpt'!")
print("[Installer] Running 'ccpt update'...")
shell.run("ccpt","update")
print("[Installer] Reading package data...")
packagedata = readData("/.ccpt/packagedata")
print("[Installer] Storing installed packages...")
storeData("/.ccpt/installedpackages",{
ccpt = packagedata["ccpt"]["newestversion"],
pprint = packagedata["pprint"]["newestversion"]
})
print("[Installer] 'ccpt' successfully installed!")
elseif args[1]=="update" then
print("[Installer] Updating 'ccpt'...")
if downloadfile("ccpt","https://raw.githubusercontent.com/PentagonLP/ccpt/main/ccpt")==false then
return false
end
elseif args[1]=="remove" then
print("[Installer] Uninstalling 'ccpt'...")
fs.delete("/ccpt")
fs.delete("/.ccpt")
shell.setCompletionFunction("ccpt", nil)
if file_exists("startup") and startsWith(startup,"-- ccpt: Seach for updates\nshell.run(\"ccpt\",\"startup\")") then
print("[Installer] Removing 'ccpt' from startup...")
startup = readFile("startup","")
storeFile("startup",string.sub(startup,56))
end
print("[Installer] So long, and thanks for all the fish!")
else
print("[Installer] Invalid argument: " .. args[1])
end |
fort_spikes = {
wood_durability_index = 0.4,
iron_durability_index = 0.9
}
-- add damage to any object.
fort_spikes.do_damage = function(obj, durability_index)
if obj == nil then return end
if obj:is_player() or (obj:get_luaentity() ~= nil and obj:get_luaentity().name ~= "__builtin:item") then
obj:punch(obj, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy=5}}, nil)
if durability_index ~= nil and fort_spikes.is_broken(durability_index) then
return 1
end
end
return 0
end
-- check nodes below/above to forbid construct spikes in two vertical rows.
fort_spikes.is_allowed_position = function(pos)
local node = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
if minetest.get_node_group(node.name, "spikes") > 0 then
return false
end
node = minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z})
if minetest.get_node_group(node.name, "spikes") > 0 then
return false
end
return true
end
-- ramdomly decide if spike is broken.
fort_spikes.is_broken = function(durability_index)
if (durability_index < math.random()) then
return true
end
return false
end
minetest.register_node("fort_spikes:wood_spikes", {
description = "Wood spikes",
drawtype = "plantlike",
visual_scale = 1,
tiles = {"fort_spikes_wood_spikes.png"},
inventory_image = ("fort_spikes_wood_spikes.png"),
paramtype = "light",
walkable = false,
drop = "default:stick 3",
sunlight_propagates = true,
groups = {spikes=1, flammable=2, choppy = 2, oddly_breakable_by_hand = 1},
on_punch = function(pos, node, puncher, pointed_thing)
fort_spikes.do_damage(puncher, nil)
end,
on_construct = function(pos)
if fort_spikes.is_allowed_position(pos) == false then
minetest.dig_node(pos)
end
end,
})
minetest.register_node("fort_spikes:broken_wood_spikes", {
description = "Broken wood spikes",
drawtype = "plantlike",
visual_scale = 1,
tiles = {"fort_spikes_broken_wood_spikes.png"},
inventory_image = ("fort_spikes_broken_wood_spikes.png"),
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "default:stick 3",
groups = {spikes=1, flammable=2, choppy = 2, oddly_breakable_by_hand = 1},
})
minetest.register_craft({
output = 'fort_spikes:wood_spikes 3',
recipe = {
{'default:stick', '', 'default:stick'},
{'', 'default:stick', ''},
{'default:stick', '', 'default:stick'},
},
on_place = function(itemstack, placer, pointed_thing, param2)
if (fort_spikes.is_spikes_below(pointed_thing)) then
return
end
end,
})
minetest.register_node("fort_spikes:iron_spikes", {
description = "Iron spikes",
drawtype = "plantlike",
visual_scale = 1,
tiles = {"fort_spikes_iron_spikes.png"},
inventory_image = ("fort_spikes_iron_spikes.png"),
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "default:steel_ingot 2",
groups = {cracky=2, spikes=1},
on_punch = function(pos, node, puncher, pointed_thing)
fort_spikes.do_damage(puncher, nil)
end,
on_construct = function(pos)
if fort_spikes.is_allowed_position(pos) == false then
minetest.dig_node(pos)
end
end,
})
minetest.register_node("fort_spikes:broken_iron_spikes", {
description = "Broken spikes",
drawtype = "plantlike",
visual_scale = 1,
tiles = {"fort_spikes_broken_iron_spikes.png"},
inventory_image = ("fort_spikes_broken_iron_spikes.png"),
paramtype = "light",
walkable = false,
sunlight_propagates = true,
drop = "default:steel_ingot 2",
groups = {cracky=2, spikes=1},
})
minetest.register_craft({
output = 'fort_spikes:iron_spikes 3',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''},
{'default:steel_ingot', '', 'default:steel_ingot'},
},
on_place = function(itemstack, placer, pointed_thing, param2)
if (fort_spikes.is_spikes_below(pointed_thing)) then
return
end
end,
})
minetest.register_abm(
{nodenames = {"fort_spikes:wood_spikes"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local times_broken = 0
local objs = minetest.get_objects_inside_radius(pos, 1)
for k, obj in pairs(objs) do
times_broken = times_broken + fort_spikes.do_damage(obj, fort_spikes.wood_durability_index)
end
if times_broken > 0 then
minetest.remove_node(pos)
minetest.place_node(pos, {name="fort_spikes:broken_wood_spikes"})
end
end,
}
)
minetest.register_abm(
{nodenames = {"fort_spikes:iron_spikes"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local times_broken = 0
local objs = minetest.get_objects_inside_radius(pos, 1)
for k, obj in pairs(objs) do
times_broken = times_broken + fort_spikes.do_damage(obj, fort_spikes.iron_durability_index)
end
if times_broken > 0 then
minetest.remove_node(pos)
minetest.place_node(pos, {name="fort_spikes:broken_iron_spikes"})
end
end,
}
)
|
local public = {}
public.create = function(c)
local border = display.newGroup()
local topBorder = display.newRect( centerX, (centerY - (screenH / 2)), screenW, 5 )
topBorder.type = "wall"
topBorder:setFillColor(color.hex(c))
physics.addBody(topBorder, "static", { isSensor = false })
border:insert(topBorder)
local rightBorder = display.newRect( (centerX + (screenW / 2)), centerY, 5, screenH )
rightBorder.type = "wall"
rightBorder:setFillColor(color.hex(c))
physics.addBody(rightBorder, "static", { isSensor = false })
border:insert(rightBorder)
local bottomBorder = display.newRect( centerX, (centerY + (screenH / 2)), screenW, 5 )
bottomBorder.type = "wall"
bottomBorder:setFillColor(color.hex(c))
physics.addBody(bottomBorder, "static", { isSensor = false })
border:insert(bottomBorder)
local leftBorder = display.newRect( (centerX - (screenW / 2)), centerY, 5, screenH )
leftBorder.type = "wall"
leftBorder:setFillColor(color.hex(c))
physics.addBody(leftBorder, "static", { isSensor = false })
border:insert(leftBorder)
return border
end
return public |
PLUGIN.name = "3D2D Blur Library"
PLUGIN.author = "Black Tea"
PLUGIN.desc = "Plugin for Developers."
nut.blur3d2d = nut.blur3d2d or {}
nut.blur3d2d.list = nut.blur3d2d.list or {}
-- for easy managements
function nut.blur3d2d.add(id, pos, ang, scale, callback)
if (id and pos and ang and scale and callback) then
nut.blur3d2d.list[id] = {
pos = pos,
ang = ang,
scale = scale,
callback = callback,
draw = true,
}
end
end
-- remove the screen from the rendering list completely.
function nut.blur3d2d.remove(id)
if (id and nut.blur3d2d.list[id]) then
nut.blur3d2d.list[id] = nil
end
end
-- pause drawing the screen. does not removes the info from the table.
function nut.blur3d2d.pause(id)
if (id and nut.blur3d2d.list[id]) then
nut.blur3d2d.list[id].draw = false
end
end
-- start drawing the screen again.
function nut.blur3d2d.resume(id)
if (id and nut.blur3d2d.list[id]) then
nut.blur3d2d.list[id].draw = true
end
end
function nut.blur3d2d.get(id)
return nut.blur3d2d.list[id]
end
function PLUGIN:PostDrawTranslucentRenderables()
render.ClearStencil()
render.SetStencilEnable(true)
-- for avoid conflict with poorly written stencil badbois
render.SetStencilWriteMask(99)
render.SetStencilTestMask(99)
render.SetStencilFailOperation(STENCILOPERATION_KEEP)
render.SetStencilZFailOperation(STENCILOPERATION_KEEP)
render.SetStencilPassOperation(STENCILOPERATION_REPLACE)
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_ALWAYS)
render.SetStencilReferenceValue(1)
-- I had to change this because I don't want to make draw post process compute run by O(n)
if (table.Count(nut.blur3d2d.list) > 0) then
SUPPRESS_FROM_STENCIL = true
for _, data in pairs(nut.blur3d2d.list) do
if (data.draw == false) then continue end
cam.Start3D2D(data.pos, data.ang, data.scale)
data.callback()
cam.End3D2D()
end
render.SetStencilReferenceValue(2)
render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_EQUAL )
render.SetStencilPassOperation( STENCILOPERATION_REPLACE )
render.SetStencilReferenceValue(1)
cam.Start2D()
nut.util.drawBlurAt(0, 0, ScrW(), ScrH(), nut.blur3d2d.amount, nut.blur3d2d.passes)
cam.End2D()
render.SetStencilEnable( false )
for _, data in pairs(nut.blur3d2d.list) do
if (data.draw == false) then continue end
cam.Start3D2D(data.pos, data.ang, data.scale)
data.callback(true)
cam.End3D2D()
end
SUPPRESS_FROM_STENCIL = nil
end
end |
cBnivCfg = {
["CompressEmpty"] = true,
["SortBags"] = true,
["scale"] = 1.2,
["Unlocked"] = true,
["Armor"] = true,
["Junk"] = true,
["NewItems"] = true,
["CoolStuff"] = false,
["BankBlack"] = false,
["TradeGoods"] = true,
["SortBank"] = true,
["FilterBank"] = true,
["AmmoAlwaysHidden"] = false,
}
cB_CustomBags = {
}
cBniv_CatInfo = {
}
|
description = [[
Detecta CITRIX Application Delivery Controller (ADC) potencialmente vulnerables a CVE-2019-19781
]]
local http = require "http"
local shortport = require "shortport"
local vulns = require "vulns"
local stdnse = require "stdnse"
local string = require "string"
---
-- @hackyseguridad
-- nmap -Pn -sVC -p <port> --script CVE-2019-19781.nse <target>
--
author = "hackingyseguridad.com"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = { "vuln" }
portrule = shortport.http
action = function(host, port)
local vuln = {
title = "Detecta Citrix Application Delivery Controller (ADC) potencialmente vulnerable a CVE-2019-19781",
state = vulns.STATE.NOT_VULN,
description = [[
]],
IDS = {
CVE = "CVE-2019-19781"
},
references = {
'https://support.citrix.com/article/CTX267027',
},
dates = {
disclosure = { year = '2019', month = '12', day = '17' }
}
}
-- Send a simple GET request to the server, if it returns appropiate string, then you have a vuln host
options = {header={}} options['header']['User-Agent'] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
--local req = http.get(host, port, uri, options)
local vuln_report = vulns.Report:new(SCRIPT_NAME, host, port)
local url = stdnse.get_script_args(SCRIPT_NAME..".url") or "/logon/LogonPoint/tmindex.html"
local response = http.generic_request(host, port, "GET", "/logon/LogonPoint/tmindex.html", options)
if response.status == 200 then
-- if response.status == 200 then
vuln.state = vulns.STATE.VULN
end
return vuln_report:make_output(vuln)
end
|
hs.application = require("hs.application")
hs.dockicon = require("hs.dockicon")
function testAttributesFromBundleID()
local appName = "Safari"
local appPath = "/Applications/Safari.app"
local bundleID = "com.apple.Safari"
assertTrue(hs.application.launchOrFocusByBundleID(bundleID))
local app = hs.application.applicationsForBundleID(bundleID)[1]
assertIsEqual(appName, app:name())
assertIsEqual(appPath, app:path())
assertIsEqual(appName, hs.application.nameForBundleID(bundleID))
assertIsEqual(appPath, hs.application.pathForBundleID(bundleID))
assertIsEqual("Safari", hs.application.infoForBundleID("com.apple.Safari")["CFBundleExecutable"])
assertIsEqual("Safari", hs.application.infoForBundlePath("/Applications/Safari.app")["CFBundleExecutable"])
return success()
end
function testBasicAttributes()
local appName = "Hammerspoon"
local bundleID = "org.hammerspoon.Hammerspoon"
local currentPID = hs.processInfo.processID
local app = hs.application.applicationForPID(currentPID)
assertIsEqual(bundleID, app:bundleID())
assertIsEqual(appName, app:name())
assertIsEqual(appName, app:title())
assertIsEqual(currentPID, app:pid())
hs.dockicon.show()
assertIsEqual(1, app:kind())
hs.dockicon.hide()
assertIsEqual(0, app:kind())
return success()
end
function testActiveAttributes()
-- need to use application.watcher for testing these async events
local appName = "Stickies"
local app = hs.application.open(appName, 0, true)
assertTrue(app:isRunning())
assertTrue(app:activate())
assertTrue(app:hide())
assertTrue(app:isHidden())
assertTrue(app:unhide())
assertFalse(app:isHidden())
assertTrue(app:activate())
local menuPathBlue = {"Color", "Blue"}
local menuPathGreen = {"Color", "Green"}
assertTrue(app:selectMenuItem(menuPathBlue))
app:selectMenuItem({"Color"})
assertTrue(app:findMenuItem(menuPathBlue).ticked)
assertTrue(app:selectMenuItem(menuPathGreen))
app:selectMenuItem({"Color"})
assertFalse(app:findMenuItem(menuPathBlue).ticked)
assertIsEqual(appName, app:getMenuItems()[1].AXTitle)
return success()
end
function testMetaTable()
-- hs.application's userdata is not aligned with other HS types (via LuaSkin) because it is old and special
-- the `__type` field is not currently on hs.application object metatables like everything else
-- this test should pass but can wait for rewrite
local app = launchAndReturnAppFromBundleID("com.apple.Safari")
assertIsUserdataOfType("hs.application", app)
return success()
end
function testFrontmostApplication()
local app = hs.application.frontmostApplication()
assertTrue(app:isFrontmost())
return success()
end
function testRunningApplications()
local apps = hs.application.runningApplications()
assertIsEqual("table", type(apps))
assertGreaterThan(1, #apps)
return success()
end
function testHiding()
local app = hs.application.open("Stickies", 5, true)
assertIsNotNil(app)
assertTrue(app:isRunning())
assertFalse(app:isHidden())
app:hide()
hs.timer.usleep(500000)
assertTrue(app:isHidden())
app:unhide()
hs.timer.usleep(500000)
assertFalse(app:isHidden())
app:kill9()
return success()
end
function testKilling()
local app = hs.application.open("Chess", 5, true)
assertIsNotNil(app)
assertTrue(app:isRunning())
app:kill()
hs.timer.usleep(500000)
assertFalse(app:isRunning())
return success()
end
function testForceKilling()
app = hs.application.open("Calculator", 5, true)
assertIsNotNil(app)
assertTrue(app:isRunning())
app:kill9()
hs.timer.usleep(500000)
assertFalse(app:isRunning())
return success()
end
function testWindows()
local app = hs.application.open("Grapher", 5, true)
assertIsNotNil(app)
local wins = app:allWindows()
assertIsEqual("table", type(wins))
assertIsEqual(1, #wins)
app:kill()
return success()
end
|
-- Terrain editing prototype
-- Water example.
-- This sample demonstrates:
-- - Creating a large plane to represent a water body for rendering
-- - Setting up a second camera to render reflections on the water surface
require "LuaScripts/Utilities/Sample"
require "LuaScripts/nodegraphui"
uiStyle = cache:GetResource("XMLFile", "UI/DefaultStyle.xml")
ui.root.defaultStyle = uiStyle;
iconStyle = cache:GetResource("XMLFile", "UI/EditorIcons.xml");
function CreateCursor()
cursor = Cursor:new("Cursor")
cursor:SetStyleAuto(uiStyle)
cursor:SetPosition(graphics.width / 2, graphics.height / 2)
ui.cursor = cursor
cursor.visible=true
end
function Start()
SampleStart()
CreateScene()
SubscribeToEvents()
end
function Stop()
end
function CreateScene()
scene_ = Scene()
CreateCursor()
scene_:CreateComponent("Octree")
nodeui=scene_:CreateScriptObject("NodeGraphUI")
end
function CreateInstructions()
end
function SubscribeToEvents()
SubscribeToEvent("Update", "HandleUpdate")
end
function HandleUpdate(eventType, eventData)
-- Take the frame time step, which is stored as a float
local timeStep = eventData["TimeStep"]:GetFloat()
if input:GetKeyPress(KEY_PRINTSCREEN) then
local img=Image(context)
graphics:TakeScreenShot(img)
local t=os.date("*t")
local filename="screen-"..tostring(t.year).."-"..tostring(t.month).."-"..tostring(t.day).."-"..tostring(t.hour).."-"..tostring(t.min).."-"..tostring(t.sec)..".png"
img:SavePNG(filename)
end
end
|
return {
table = "ssl_servers_names",
primary_key = { "name" },
fields = {
name = { type = "text", required = true },
ssl_certificate_id = { type = "id", foreign = "ssl_certificates:id" },
created_at = {
type = "timestamp",
immutable = true,
dao_insert_value = true,
required = true,
},
},
marshall_event = function(_, t)
return {
name = t.name
}
end,
}
|
local _={}
_.name="Pegasus"
_.new=function(options)
local result=BaseEntity.new(options)
result.x=0
result.y=0
result.mountX=27
result.mountY=31
result.originX=27
result.originY=31
result.footX=22
result.footY=46
Entity.setSprite(result,"pegasus")
result.isDrawable=true
result.aiEnabled=Session.isServer
result.isMountable=true
Entity.afterCreated(result,_,options)
return result
end
_.draw=DrawableBehaviour.draw
--_.update=function(pantera,dt)
-- log("pantera update ")
-- yes, it working
--end
local _ai=require("misc/ai/pantera_ai")
-- managed by Entity
_.updateAi=_ai
return _ |
local lunaconf = require('lunaconf')
local awful = require('awful')
local gears = require('gears')
local run_picom = function()
lunaconf.utils.run_once('picom --config ' .. gears.filesystem.get_configuration_dir() .. '/configs/picom.conf -b')
end
local restart_picom = function()
lunaconf.utils.spawn('killall picom')
run_picom()
end
-- Register the _PICOM_NO_SHADOW property even if disabled, so we don't need
-- to check in other files whether we can use it
awesome.register_xproperty('_PICOM_NO_SHADOW', 'boolean')
function awful.client.object.set_disable_shadow(c, value)
c:set_xproperty('_PICOM_NO_SHADOW', value)
end
if not lunaconf.config.get('disable_compositor', false) then
local function set_shadow_hint(c)
c.disable_shadow = not c.floating
end
-- Shadow handling of picom
-- Disable shadows (set _PICOM_NO_SHADOW xproperty) on all non floating windows
-- and windows with a shape so they won't leave ugly shadows on the screen bar(s).
client.connect_signal('manage', function(c, startup)
set_shadow_hint(c)
c:connect_signal('property::floating', set_shadow_hint)
end)
lunaconf.utils.only_if_command_exists('picom', function()
-- Due to a bug in picom we need to kill and restart it if the screen
-- configuration changes, since otherwise some screens might stay blank
screen.connect_signal('list', restart_picom)
screen.connect_signal('property::geometry', restart_picom)
if not awesome.composite_manager_running then
run_picom()
end
end)
end
|
local add_fertilizer_from = function(fish)
local recipe = table.deepcopy(data.raw.recipe["fertilizer"])
if recipe ~= nil then
recipe.name = "fertilizer-from-" .. fish
local element = 1
for _,v in pairs(recipe.ingredients) do
if v.name then element = 'name' end
if v[element] == "biomass" then
v[element] = "raw-" .. fish
v["amount"] = 5
end
end
recipe.results = nil
recipe.result = "fertilizer"
recipe.result_count = 5
recipe.localised_name = "Fertilizer from " .. fish
end
return recipe
end
--[[ deprecated: now that fish can be converted to fertilizer
local add_wood_from = function(fish)
local recipe = table.deepcopy(data.raw.recipe["kr-grow-wood-plus"])
if recipe ~= nil then
recipe.name = "kr-grow-wood-" .. fish
recipe.icon = "__xtreme-fishing__/graphics/icons/recipe/wood-plus-plus.png"
recipe.icon_size = 64
local element = 1
for _,v in pairs(recipe.ingredients) do
if v.name then element = 'name' end
if v[element] == "fertilizer" then
v[element] = "raw-" .. fish
v["amount"] = 10
end
end
recipe.result_count = 120
recipe.localised_name = "Wood from " .. fish
end
return recipe
end
--]]
local add_first_aid = function(fish)
local recipe = table.deepcopy(data.raw.recipe["first-aid-kit"])
if recipe ~= nil then
recipe.name = "first-aid-kit-" .. fish
recipe.icon = "__Krastorio2Assets__/icons/items/first-aid-kit.png"
recipe.icon_size = 64
recipe.icon_mipmaps = 4
recipe.enabled = "true"
local element = 1
for _,v in pairs(recipe.ingredients) do
if v.name then element = 'name' end
if v[element] == "biomass" then
v[element] = "raw-" .. fish
end
end
recipe.localised_name = "First aid kit"
end
return recipe
end
local add_biomthanol_from = function(fish)
local recipe = table.deepcopy(data.raw.recipe["biomethanol"])
if recipe ~= nil then
recipe.name = "biomethanol-" .. fish
recipe.icon = "__Krastorio2Assets__/icons/fluids/biomethanol.png"
recipe.icon_size = 64
recipe.icon_mipmaps = nil
local element = 1
for _,v in pairs(recipe.ingredients) do
if v.name then element = 'name' end
if v[element] == "wood" then
v[element] = "raw-" .. fish
v["amount"] = 10
end
end
recipe.localised_name = "Biomethanol from " .. fish
end
return recipe
end
-- create recipes for each fish
for fish,t in pairs(data.raw.fish) do
if fish ~= "fish" then
data:extend({
add_fertilizer_from(fish),
-- add_wood_from(fish),
add_first_aid(fish),
add_biomthanol_from(fish)
})
else
data:extend({
add_fertilizer_from(fish),
-- add_wood_from(fish),
add_biomthanol_from(fish)
})
end
table.insert(data.raw.technology["kr-bio-processing"].effects, { type = "unlock-recipe", recipe = "fertilizer-from-" .. fish})
-- table.insert(data.raw.technology["kr-bio-processing"].effects, { type = "unlock-recipe", recipe = "kr-grow-wood-" .. fish })
table.insert(data.raw.technology["kr-gas-power-station"].effects, { type = "unlock-recipe", recipe = "biomethanol-" .. fish }) -- changed from kr-advanced-chemistry
end
-- pipe stack size based on settings
data.raw.item["kr-steel-pipe"].stack_size = settings.startup["xtreme-fishing-pipestacksize"].value
data.raw.item["kr-steel-pipe-to-ground"].stack_size = settings.startup["xtreme-fishing-ugpipestacksize"].value |
-- reload every lua file (except me)
function make()
local some = io.popen("ls *.lua")
for one in some:lines() do
if (one ~= "0.lua") then
print("-- loading " .. one)
dofile(one)
end
end
some:close()
end
make()
|
-- Additional Plugins
lvim.plugins = {
-- Themes
{ "folke/tokyonight.nvim" },
{ "ellisonleao/gruvbox.nvim", requires = { "rktjmp/lush.nvim" } },
{ "sainnhe/sonokai" },
--Trouble diagnostics and more
{
"folke/trouble.nvim",
cmd = "TroubleToggle",
},
-- TODO and keywords in comment highlight
{
"folke/todo-comments.nvim",
event = "BufRead",
config = require("user.plugin.todocomments").config,
},
{
"blackCauldron7/surround.nvim",
config = require("user.plugin.nvim-surround").config,
},
{
"phaazon/hop.nvim",
event = "BufRead",
config = require("user.plugin.nvim-hop").config,
},
{
"aserowy/tmux.nvim",
config = require("user.plugin.nvim-tmux").config,
},
-- Null_ls typescript utils
{ "jose-elias-alvarez/nvim-lsp-ts-utils" },
-- Git diff view
{ "sindrets/diffview.nvim", event = "BufRead" },
-- Rainbow parentheses
{
"p00f/nvim-ts-rainbow",
},
-- Get color representation of RGB codes
{
"norcalli/nvim-colorizer.lua",
config = require("user.plugin.colorizer").config,
},
-- Advanced code refactoring
{
"ThePrimeagen/refactoring.nvim",
config = require("user.plugin.refactor").config,
requires = {
{ "nvi-rua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" },
},
},
-- xml/html tag autoclose
{
"windwp/nvim-ts-autotag",
event = "InsertEnter",
config = function()
require("autotag").config()
end,
},
-- emmet support
{ "mattn/emmet-vim" },
-- Shows indentation guides
{
"lukas-reineke/indent-blankline.nvim",
event = "BufRead",
setup = require("user.plugin.blankline").config,
},
-- An organizer like notion (uses neorg files)?
{
"nvim-neorg/neorg",
config = require("user.plugin.norg").config,
requires = "nvim-lua/plenary.nvim",
},
}
|
object_tangible_tcg_series4_decorative_child_bed_01 = object_tangible_tcg_series4_shared_decorative_child_bed_01:new {
}
ObjectTemplates:addTemplate(object_tangible_tcg_series4_decorative_child_bed_01, "object/tangible/tcg/series4/decorative_child_bed_01.iff") |
-- Dimensional Accumulator --
-- Entity --
local daE = {}
daE.type = "accumulator"
daE.name = "DimensionalAccumulator"
daE.icon = "__Mobile_Factory_Graphics__/graphics/icones/DimensionalAccumulator.png"
daE.icon_size = 32
daE.flags = {"placeable-neutral", "player-creation"}
daE.minable = {mining_time = 0.5, result = "DimensionalAccumulator"}
daE.max_health = 150
daE.corpse = "accumulator-remnants"
daE.collision_box = {{-0.9, -0.9}, {0.9, 0.9}}
daE.selection_box = {{-1, -1}, {1, 1}}
daE.drawing_box = {{-1, -1.5}, {1, 1}}
daE.circuit_wire_connection_point = circuit_connector_definitions["accumulator"].points
daE.circuit_connector_sprites = circuit_connector_definitions["accumulator"].sprites
daE.circuit_wire_max_distance = default_circuit_wire_max_distance
daE.default_output_signal = {type = "virtual", name = "signal-A"}
daE.energy_source =
{
type = "electric",
buffer_capacity = "5MJ",
usage_priority = "tertiary",
input_flow_limit = "1MW",
output_flow_limit = "1MW"
}
daE.charge_cooldown = 30
daE.charge_light = {intensity = 0.3, size = 7, color = {r = 1.0, g = 1.0, b = 1.0}}
daE.discharge_animation = accumulator_discharge()
daE.discharge_cooldown = 60
daE.discharge_light = {intensity = 0.7, size = 7, color = {r = 1.0, g = 1.0, b = 1.0}}
daE.vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }
daE.working_sound =
{
sound =
{
filename = "__base__/sound/accumulator-working.ogg",
volume = 1
},
idle_sound =
{
filename = "__base__/sound/accumulator-idle.ogg",
volume = 0.4
},
max_sounds_per_type = 5
}
daE.picture = {
layers =
{
{
filename = "__Mobile_Factory_Graphics__/graphics/entity/DimensionalAccumulator.png",
priority = "high",
width = 130,
height = 189,
repeat_count = repeat_count,
shift = util.by_pixel(0, -11),
tint = tint,
animation_speed = 0.5,
scale = 0.5
},
{
filename = "__base__/graphics/entity/accumulator/hr-accumulator-shadow.png",
priority = "high",
width = 234,
height = 106,
repeat_count = repeat_count,
shift = util.by_pixel(29, 6),
draw_as_shadow = true,
scale = 0.5
}
}
}
daE.charge_animation = {
layers =
{
accumulator_picture({ r=1, g=1, b=1, a=1 } , 24),
{
filename = "__base__/graphics/entity/accumulator/hr-accumulator-charge.png",
priority = "high",
width = 178,
height = 206,
line_length = 6,
frame_count = 24,
blend_mode = "additive",
shift = util.by_pixel(0, -22),
scale = 0.5
}
}
}
data:extend{daE}
-- Item --
local daI = {}
daI.type = "item"
daI.name = "DimensionalAccumulator"
daI.place_result = "DimensionalAccumulator"
daI.icon = "__Mobile_Factory_Graphics__/graphics/icones/DimensionalAccumulator.png"
daI.icon_size = 32
daI.subgroup = "DimensionalStuff"
daI.order = "c"
daI.stack_size = 5
data:extend{daI}
-- Crafting --
local daC = {}
daC.type = "recipe"
daC.name = "DimensionalAccumulator"
daC.energy_required = 5
daC.enabled = false
daC.ingredients =
{
{"MachineFrame2", 3},
{"DimensionalCircuit", 15}
}
daC.result = "DimensionalAccumulator"
data:extend{daC}
-- Technology --
local daT = {}
daT.name = "ElectricityCompression"
daT.type = "technology"
daT.icon = "__Mobile_Factory_Graphics__/graphics/icones/DimensionalAccumulator.png"
daT.icon_size = 32
daT.unit = {
count=450,
time=2,
ingredients={
{"DimensionalSample", 1}
}
}
daT.prerequisites = {"DimensionalElectronic"}
daT.effects = {{type="unlock-recipe", recipe="DimensionalAccumulator"}}
data:extend{daT}
|
-- Constants
local gravity = 0.8165
local accel = 0.166
local decel = 0.3
local jmpStg = -13.0
local minJmp = -6.5
local maxSpd = 0.0
local defMaxSpd = 4.0
local runMaxSpd = 8.5
local hitboxRad = {16.0, 32.0}
-- Variables
local direction = 1.0
local ground = false
local speed = {0.0, 0.0, 0.0}
-- Components
local animator = nil
local mastersensor = nil
local bottomsensor = nil
local bottomLsensor = nil
local bottomRsensor = nil
local ledgeLsensor = nil
local ledgeRsensor = nil
local leftsensor = nil
local rightsensor = nil
local topsensor = nil
local clamp = function(x, min, max)
return math.min(math.max(x, min), max)
end
function init()
entity.setProperty(1, true)
entity.setProperty(2, false)
entity.setProperty(3, false)
entity.translate({128, 128, 0}, true)
animator = entity.getComponent("animator")
-- Get sensors
mastersensor = entity.getComponent("MasterSensor")
bottomsensor = entity.getComponent("BottomSensor")
bottomLsensor = entity.getComponent("BottomLSensor")
bottomRsensor = entity.getComponent("BottomRSensor")
ledgeLsensor = entity.getComponent("LedgeLSensor")
ledgeRsensor = entity.getComponent("LedgeRSensor")
leftsensor = entity.getComponent("LeftSensor")
rightsensor = entity.getComponent("RightSensor")
topsensor = entity.getComponent("TopSensor")
end
function update(dt)
local pos = entity.getPosition()
local lstick = common.lstick()
-- Y axis movement
if not ground then speed[Y] = speed[Y] + gravity end
if ground and common.btntap(PAD_A) then
ground = false
speed[Y] = jmpStg
end
-- X axis movement
speed[X] = speed[X] + (lstick[X] * accel)
speed[X] = clamp(speed[X], -maxSpd, maxSpd)
if ground then
if lstick[X] == 0.0 then
if speed[X] > 0.0 then speed[X] = speed[X] - decel
elseif speed[X] < 0.0 then speed[X] = speed[X] + decel
end
if math.abs(speed[X]) < decel then speed[X] = 0.0 end
elseif lstick[X] < 0.0 and speed[X] > 0.0 then
speed[X] = speed[X] - decel * 2.0
elseif lstick[X] > 0.0 and speed[X] < 0.0 then
speed[X] = speed[X] + decel * 2.0
end
end
if common.btnpress(PAD_X) then maxSpd = runMaxSpd
else maxSpd = defMaxSpd end
-- Collision Detection
ground = false
for key, obj in pairs(entity.getNearest()) do
if not entity.getProperty(1, obj) then
local objBV = entity.getComponent("AABB", obj)
local solidpos = entity.getPosition(obj)
local solidsz = {entity.getMagnification(X, obj),
entity.getMagnification(Y, obj),
entity.getMagnification(Z, obj)}
-- Ground collision
if (not ground) -- No ground found previously
and (speed[Y] >= 0.0) -- Player is not going up
and (entity.getProperty(2, obj)) -- Is Solid
and (entity.bv.isOverlapping(bottomsensor, objBV)
or entity.bv.isOverlapping(bottomLsensor, objBV)
or entity.bv.isOverlapping(bottomRsensor, objBV))
then
-- It is indeed a solid object.
-- Ground collisions ahoy
pos[Y] = solidpos[Y] - hitboxRad[Y]
speed[Y] = 0.0
ground = true
end
-- Top collision
if speed[Y] < 0.0 -- Player is going up
and entity.getProperty(2, obj) -- Is Solid
and not entity.getProperty(3, obj) -- Is NOT jumpthru
and entity.bv.isOverlapping(topsensor, objBV)
then
pos[Y] = (solidpos[Y] + solidsz[Y]) + hitboxRad[Y]
speed[Y] = 0.0
end
-- Left collision
if (speed[X] < 0.0) -- Player is walking
and entity.getProperty(2, obj) -- Is Solid
and (not entity.getProperty(3, obj)) -- Is NOT jumpthru
and entity.bv.isOverlapping(leftsensor, objBV)
then
pos[X] = (solidpos[X] + solidsz[X]) + hitboxRad[X]
speed[X] = 0.0
end
-- Right collision
if (speed[X] > 0.0) -- Player is walking
and entity.getProperty(2, obj) -- Is Solid
and (not entity.getProperty(3, obj)) -- Is NOT jumpthru
and entity.bv.isOverlapping(rightsensor, objBV)
then
pos[X] = solidpos[X] - hitboxRad[X]
speed[X] = 0.0
end
end
end
-- Platformer-like jump
if not ground
and speed[Y] < minJmp
and not common.btnpress(PAD_A)
then speed[Y] = minJmp end
-- Transform position
pos[X] = pos[X] + speed[X]
pos[Y] = pos[Y] + speed[Y]
pos[Z] = pos[Z] + speed[Z]
-- Hand position back to engine
entity.translate(pos, true)
-- Direction
if speed[X] > 0.0 then
direction = 1.0
elseif speed[X] < 0.0 then
direction = -1.0
end
entity.scale({direction, 1, 1}, true)
-- Animation
if ground then
if speed[X] == 0.0 then -- If not moving, stop
render.animator.setAnimation(animator, "stopped")
else
render.animator.setAnimation(animator, "walking")
local norm = 1.0 - (math.abs(speed[X]) / runMaxSpd)
local animspd = norm * 6.0
render.animator.setSpeed(animator,
animspd + render.animator.getDefaultSpeed(animator))
end
else
render.animator.setAnimation(animator, "jumping")
end
end
|
-- Neovim indent file
-- Language: Tree-sitter query
-- Last Change: 2022 Mar 29
-- it's a lisp!
vim.cmd [[ runtime! indent/lisp.vim ]]
|
if string.find(Var "Element", "Active") then
return Def.Sprite {
Texture = NOTESKIN:GetPath("_Down", "Hold Active"),
Frame0000 = 0,
Delay0000 = 1
}
else
return Def.Sprite {
Texture = NOTESKIN:GetPath("_Down", "Tap Note"),
Frame0000 = 0,
Delay0000 = 1
}
end
|
if not opt then
cmd = torch.CmdLine()
cmd:option('-root_data_dir', '', 'Root path of the data, $DATA_PATH.')
cmd:text()
opt = cmd:parse(arg or {})
assert(opt.root_data_dir ~= '', 'Specify a valid root_data_dir path argument.')
end
dofile 'utils/utils.lua'
dofile 'entities/relatedness/relatedness.lua'
input = opt.root_data_dir .. 'generated/wiki_canonical_words.txt'
output = opt.root_data_dir .. 'generated/wiki_canonical_words_RLTD.txt'
ouf = assert(io.open(output, "w"))
print('\nStarting dataset filtering.')
local cnt = 0
for line in io.lines(input) do
cnt = cnt + 1
if cnt % 500000 == 0 then
print(' =======> processed ' .. cnt .. ' lines')
end
local parts = split(line, '\t')
assert(table_len(parts) == 3)
local ent_wikiid = tonumber(parts[1])
local ent_name = parts[2]
assert(ent_wikiid)
if rewtr.reltd_ents_wikiid_to_rltdid[ent_wikiid] then
ouf:write(line .. '\n')
end
end
ouf:flush()
io.close(ouf)
|
local vfs = vfs or {}
local fs = require("modules.fs")
vfs.mounts = {}
function vfs.getMounts(pre)
assertType(pre, "string")
return vfs.mounts[pre]
end
function vfs.mount(path, pre)
assertType(path, "string")
assertType(pre, "string")
vfs.unmount(path)
path = path:gsub("\\","/")
if path:sub(1,1) == "/" then path = path:sub(2) end
if not path:match("/$") then path = path .. "/" end
vfs.mounts[pre:lower()] = path
end
function vfs.unmount(path)
assertType(path, "string")
for mk, m in pairs(vfs.mounts) do
if m:lower() == path:lower() then
vfs.mounts[mk] = nil
end
end
end
vfs.mount(E.SRC_FOLDER, "lua")
function vfs.resolveMount(p)
local pre = p:match("^(.-):")
local path = p:match("^.-:(.+)"):gsub("\\","/")
if path:sub(1,1) == "/" then path = path:sub(2) end
if vfs.mounts[pre:lower()] then
return vfs.mounts[pre:lower()] .. path
end
end
function vfs.files(path)
-- baab, will complete later on
return fs.find(path, true)
end
local META = {} -- file
function META:isValid()
return not not self.file
end
function META:checkfile()
if not self:isValid() then
error("invalid file")
end
end
function META:open(fn, mode)
if isValid(self.file) then
error("file already exists")
end
local f, e = io.open(fn, mode)
if f then
self.file = f
else
return nil, e
end
end
function META:close()
self:checkfile()
self.file:close()
self.file = nil
end
function META:read(w)
self:checkfile()
local r, e = self.file:read(w)
if r then
return r
else
return nil, e
end
end
function META:readAndClose(w, regerror)
local r, e = self:read(w)
if not r then
if not regerror then
self.file:close()
end
else
self.file:close()
end
return r, e
end
function META:write(data)
self:checkfile()
local r, e = self.file:write(data)
return r, e
end
function META:writeAndClose(w, regerror)
local r, e = self:write(w)
if not r then
if not regerror then
self.file:close()
end
else
self.file:close()
end
return r, e
end
function META:flush()
self:checkfile()
local r, e = self.file:flush()
return r, e
end
function META:__ctor(f, m)
self:open(f, m)
end
object.register("basefile", META)
function vfs.open(path, mode)
assertType(path, "string")
assertType(mode, "string")
path = vfs.resolveMount(path)
if not path then return end
f = object.new("basefile", path, mode)
if f:isValid() then
return f
end
end
function vfs.read(path)
assertType(path, "string")
f = vfs.open(path, "rb")
if f:isValid() then
return f:readAndClose("*all")
end
end
function vfs.load(path)
assertType(path, "string")
local script = vfs.read(path)
if not script then return end
return loadstring(script)
end
function vfs.include(path, ...)
local stuff = vfs.load("lua:" .. path)
if stuff then return stuff(...) end
end
return vfs
|
class 'HControls'
function HControls:__init()
Events:Subscribe( "ModulesLoad", self, self.ModulesLoad )
Events:Subscribe( "EngHelp", self, self.EngHelp )
end
function HControls:EngHelp()
Events:Fire( "HelpRemoveItem",
{
name = "Часто задаваемые вопросы (FAQ)"
} )
Events:Fire( "HelpAddItem",
{
name = "FAQ",
text =
"> What language is the server?\n" ..
" This is a Russian server.\n" ..
" Now jokes about vodka and Putin will go.\n \n" ..
"> What languages can I use to chat?\n" ..
" You can chat in absolutely any language!\n \n" ..
"> Is there any missions on server?\n" ..
" There is no mission on our server, but they may be on other servers.\n" ..
" We recommend RLS: Just Cause 2 Roleplay for them. \n \n" ..
"> How to gain Opyt?\n" ..
" Play minigames and gain rewards!\n \n" ..
"> Where is bots?\n" ..
" There are only bot planes and bot boats on server !\n" ..
" No any police here.\n \n" ..
"> What to do here?\n" ..
" Get a rid of fun of here!\n" ..
" You always can find what to do on server. That's for sure!\n" ..
" In every moment the answer for this question will be found automatically.\n \n" ..
"> The market and map doesn't work?\n" ..
" You don't have needed files in 'images' folder.\n" ..
" You need to verify your game files, using the 'Properties->Verify Game Files' buttons in Steam.\n \n" ..
"> The model of player is broken. What i should do?\n" ..
" Bug can be obtained on entering the server.\n" ..
" To fix this, you need to re-enter the game. Or have fun with it :3\n \n" ..
"> How to become an administrator?\n" ..
" We will decide it on our own :)\n \n" ..
"> Other problems with JC2MP:\n wiki.jc-mp.com/Troubleshooting\n \n" ..
"Enjoy the game on the Russian server! :D"
} )
end
function HControls:ModulesLoad()
Events:Fire( "HelpAddItem",
{
name = "Часто задаваемые вопросы (FAQ)",
text =
"> Тут есть миссии?\n" ..
" На нашем сервере нет, но возможно есть на других.\n" ..
" Рекомендуем для этого сервер - RLS: Just Cause 2 Roleplay\n \n" ..
"> Как зарабатывать?\n" ..
" - Выигрывай в мини-играх.\n" ..
" - Находи ящики с деньгами по карте.\n" ..
" - Удерживайте и устанавливайте хорошечные рекорды.\n" ..
" - Выполняйте ежедневные задания.\n" ..
" - Выполняйте задания в чате.\n" ..
" - Убивайте игроков, которые имеют более 1-го убийства (посмотреть можно в списке игроков).\n" ..
" - Устройте стартап и выпрашивайте деньги у других игроков.\n" ..
" Игровую валюту можно также приобрести за донат, подробности во вкладке 'Информация'\n \n" ..
"> Где NPC?\n" ..
" NPC только ЛОДКИ!\n" ..
" Никакой полиции и т.п. тут нету.\n \n" ..
"> Что тут делать?\n" ..
" Веселись, бухай, стреляй, угарай!\n" ..
" На сервере всегда найдется, чем заняться. Уж это точно.\n" ..
" В любой момент этот вопрос найдет сам на себя ответ.\n \n" ..
"> Не работает магазин/карта?\n" ..
" У вас отсутствуют нужные файлы в папке images.\n" ..
" Чтобы восстановить файлы, достаточно переустановить клиент\n или через свойства стима выполнить проверку цельности файлов игры.\n \n" ..
"> Сломались кости персонажа?\n" ..
" Баг появляется после любого перезахода на сервер.\n" ..
" Чтобы исправить, просто перезайдите в игру или наслаждайтесь :3\n \n" ..
"> Что такое СКМ?\n" ..
" СКМ - Средняя кнопка мыши.\n" ..
" Средняя кнопка мыши - это колесико мыши. Просто нажмите по нему.\n \n" ..
"> Мешают РП процессу?\n" ..
" Это не РП сервер и каждый игрок может делать то, что он захочет, соблюдая правила.\n" ..
" Любой игрок может вас убить до тех пор, пока вы не будете находиться в мирном режиме.\n \n" ..
"> Как стать админом?\n" ..
" Мы сами решим :)\n \n" ..
"> Решение других проблем связанных с JC2MP:\n wiki.jc-mp.com/Troubleshooting\n \n" ..
"Надеюсь, после прочтения этой вкладки у вас будет меньше вопросов.\n" ..
"(Хотя кто её прочитал?)"
} )
end
hcontrols = HControls() |
ModifyEvent(-2, 19, -2, -2, -1, -1, -1, -1, -1, -1, -2, -2, -2);
ModifyEvent(-2, 21, -2, -2, -1, -1, -1, -1, -1, -1, -2, -2, -2);
ModifyEvent(-2, 3, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2);
ModifyEvent(-2, 4, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2);
ModifyEvent(-2, 5, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2);
do return end;
|
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You 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 core = require("apisix.core")
local tab_insert = table.insert
local tab_concat = table.concat
local string_format = string.format
local re_gmatch = ngx.re.gmatch
local re_sub = ngx.re.sub
local ipairs = ipairs
local ngx = ngx
local str_find = core.string.find
local str_sub = string.sub
local lrucache = core.lrucache.new({
ttl = 300, count = 100
})
local reg = [[(\\\$[0-9a-zA-Z_]+)|]] -- \$host
.. [[\$\{([0-9a-zA-Z_]+)\}|]] -- ${host}
.. [[\$([0-9a-zA-Z_]+)|]] -- $host
.. [[(\$|[^$\\]+)]] -- $ or others
local schema = {
type = "object",
properties = {
ret_code = {type = "integer", minimum = 200, default = 302},
uri = {type = "string", minLength = 2, pattern = reg},
regex_uri = {
description = "params for generating new uri that substitute from client uri, " ..
"first param is regular expression, the second one is uri template",
type = "array",
maxItems = 2,
minItems = 2,
items = {
description = "regex uri",
type = "string",
}
},
http_to_https = {type = "boolean"},
encode_uri = {type = "boolean", default = false},
append_query_string = {type = "boolean", default = false},
},
oneOf = {
{required = {"uri"}},
{required = {"regex_uri"}},
{required = {"http_to_https"}}
}
}
local plugin_name = "redirect"
local _M = {
version = 0.1,
priority = 900,
name = plugin_name,
schema = schema,
}
local function parse_uri(uri)
local iterator, err = re_gmatch(uri, reg, "jiox")
if not iterator then
return nil, err
end
local t = {}
while true do
local m, err = iterator()
if err then
return nil, err
end
if not m then
break
end
tab_insert(t, m)
end
return t
end
function _M.check_schema(conf)
local ok, err = core.schema.check(schema, conf)
if not ok then
return false, err
end
if conf.regex_uri and #conf.regex_uri > 0 then
local _, _, err = re_sub("/fake_uri", conf.regex_uri[1],
conf.regex_uri[2], "jo")
if err then
local msg = string_format("invalid regex_uri (%s, %s), err:%s",
conf.regex_uri[1], conf.regex_uri[2], err)
return false, msg
end
end
return true
end
local tmp = {}
local function concat_new_uri(uri, ctx)
local passed_uri_segs, err = lrucache(uri, nil, parse_uri, uri)
if not passed_uri_segs then
return nil, err
end
core.table.clear(tmp)
for _, uri_segs in ipairs(passed_uri_segs) do
local pat1 = uri_segs[1] -- \$host
local pat2 = uri_segs[2] -- ${host}
local pat3 = uri_segs[3] -- $host
local pat4 = uri_segs[4] -- $ or others
core.log.info("parsed uri segs: ", core.json.delay_encode(uri_segs))
if pat2 or pat3 then
tab_insert(tmp, ctx.var[pat2 or pat3])
else
tab_insert(tmp, pat1 or pat4)
end
end
return tab_concat(tmp, "")
end
function _M.rewrite(conf, ctx)
core.log.info("plugin rewrite phase, conf: ", core.json.delay_encode(conf))
local ret_code = conf.ret_code
local uri = conf.uri
local regex_uri = conf.regex_uri
if conf.http_to_https and ctx.var.scheme == "http" then
-- TODO: add test case
-- PR: https://github.com/apache/apisix/pull/1958
uri = "https://$host$request_uri"
local method_name = ngx.req.get_method()
if method_name == "GET" or method_name == "HEAD" then
ret_code = 301
else
-- https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308
ret_code = 308
end
end
if ret_code then
local new_uri
if uri then
local err
new_uri, err = concat_new_uri(uri, ctx)
if not new_uri then
core.log.error("failed to generate new uri by: " .. uri .. err)
return 500
end
elseif regex_uri then
local n, err
new_uri, n, err = re_sub(ctx.var.uri, regex_uri[1],
regex_uri[2], "jo")
if not new_uri then
local msg = string_format("failed to substitute the uri:%s (%s) with %s, error:%s",
ctx.var.uri, regex_uri[1], regex_uri[2], err)
core.log.error(msg)
return 500
end
if n < 1 then
return
end
end
if not new_uri then
return
end
local index = str_find(new_uri, "?")
if conf.encode_uri then
if index then
new_uri = core.utils.uri_safe_encode(str_sub(new_uri, 1, index-1)) ..
str_sub(new_uri, index)
else
new_uri = core.utils.uri_safe_encode(new_uri)
end
end
if conf.append_query_string and ctx.var.is_args == "?" then
if index then
new_uri = new_uri .. "&" .. (ctx.var.args or "")
else
new_uri = new_uri .. "?" .. (ctx.var.args or "")
end
end
core.response.set_header("Location", new_uri)
return ret_code
end
end
return _M
|
-- requires subliminal, version 1.0 or newer
-- default keybinding: b
-- add the following to your input.conf to change the default keybinding:
-- keyname script_binding auto_load_subs
local utils = require 'mp.utils'
function title_fn()
mp.osd_message(mp.get_property("path"))
end
mp.add_key_binding("N", "print_title", title_fn)
|
function clone(object)
local lookup_table = {}
local function _copy(object)
if type(object) ~= "table" then
return object
elseif lookup_table[object] then
return lookup_table[object]
end
local new_table = {}
lookup_table[object] = new_table
for key, value in pairs(object) do
new_table[_copy(key)] = _copy(value)
end
return setmetatable(new_table, getmetatable(object))
end
return _copy(object)
end
-- require "common/class"
class = require("common/middleclass")
require("common/stack")
require("common/functions")
-- require "common/simple_state_machine"
|
--------------------------------
-- @module ccui
--------------------------------------------------------
-- the ccui VideoPlayer
-- @field [parent=#ccui] VideoPlayer#VideoPlayer VideoPlayer preloaded module
return nil
|
module("php.utils", package.seeall)
local ffi = require "ffi"
ffi.cdef[[
struct in_addr {
uint32_t s_addr;
};
int inet_aton(const char *cp, struct in_addr *inp);
uint32_t ntohl(uint32_t netlong);
char *inet_ntoa(struct in_addr in);
uint32_t htonl(uint32_t hostlong);
]]
local C = ffi.C
function ip2long(ip)
local inp = ffi.new("struct in_addr[1]")
if C.inet_aton(ip, inp) ~= 0 then
return tonumber(C.ntohl(inp[0].s_addr))
end
return nil
end
function long2ip(long)
if type(long) ~= "number" then
return nil
end
local addr = ffi.new("struct in_addr")
addr.s_addr = C.htonl(long)
return ffi.string(C.inet_ntoa(addr))
end
|
--This was programmed by vissequ#1301 (Discord). You may use this any way you wish, but please do not remove this credit.
--you will need the dependant scripts included in the Complex Weather System (same repo)
local L = game:service("Lighting")
local RS = game:GetService("ReplicatedStorage")
local REs = RS:WaitForChild("REs")
local rE_StartRain = REs:WaitForChild("WeatherClient")
local rE_EndRain = REs:WaitForChild("WeatherClientEnd")
--while wait(60) do
--end
local stormOverride = false
local function SetDensity(target)
local negOrPos = 1
if target > L.Atmosphere.Density then
negOrPos = 1
elseif target < L.Atmosphere.Density then
negOrPos = -1
end
for i = L.Atmosphere.Density, target, .01 * negOrPos do
L.Atmosphere.Density = i
wait(1)
end
end
local function Rain()
print("Initiating stormoverride. Will rain soon.")
stormOverride = true
print("Setting fog density before the rain.")
SetDensity(.431)
local rainDuration = math.random(60*2, 60*5)
print("It will rain for "..rainDuration.." seconds.")
rE_StartRain:FireAllClients(true)
wait(rainDuration)
rE_EndRain:FireAllClients()
end
wait(10)
--Rain()
local T_targetDensities = {
.21,
.22,
.23,
.24,
.25,
.26,
.27,
.28,
.29,
.3,
}
while wait(60*3) do
if not stormOverride then
local targetDensity = T_targetDensities[math.random(1,#T_targetDensities)]
print("TargetDensity is now: "..targetDensity)
SetDensity(targetDensity)
end
end
|
--[[
Kill Confirmed
PvE Ground Branch game mode by Jakub 'eelSkillz' Baranowski
More details @ https://github.com/JakBaranowski/ground-branch-game-modes/wiki/game-mode-kill-confirmed
]]--
local MTeams = require('Players.Teams')
local MSpawnsGroups = require('Spawns.Groups')
local MSpawnsCommon = require('Spawns.Common')
local MObjectiveExfiltrate = require('Objectives.Exfiltrate')
local MObjectiveConfirmKill = require('Objectives.ConfirmKill')
--#region Properties
local KillConfirmed = {
UseReadyRoom = true,
UseRounds = true,
MissionTypeDescription = '[Solo/Co-Op] Locate, neutralize and confirm elimination of all High Value Targets in the area of operation.',
StringTables = {'KillConfirmed'},
Settings = {
HVTCount = {
Min = 1,
Max = 5,
Value = 1,
Last = 1,
AdvancedSetting = false,
},
OpForPreset = {
Min = 0,
Max = 4,
Value = 2,
AdvancedSetting = false,
},
Difficulty = {
Min = 0,
Max = 4,
Value = 2,
AdvancedSetting = false,
},
RoundTime = {
Min = 10,
Max = 60,
Value = 60,
AdvancedSetting = false,
},
RespawnCost = {
Min = 0,
Max = 10000,
Value = 1000,
AdvancedSetting = true,
},
DisplayScoreMessage = {
Min = 0,
Max = 1,
Value = 0,
AdvancedSetting = true,
},
DisplayScoreMilestones = {
Min = 0,
Max = 1,
Value = 1,
AdvancedSetting = true,
},
DisplayObjectiveMessages = {
Min = 0,
Max = 1,
Value = 1,
AdvancedSetting = true,
},
DisplayObjectivePrompts = {
Min = 0,
Max = 1,
Value = 1,
AdvancedSetting = true,
},
},
PlayerScoreTypes = {
KillStandard = {
Score = 100,
OneOff = false,
Description = 'Eliminated threat'
},
KillHvt = {
Score = 250,
OneOff = false,
Description = 'Eliminated HVT'
},
ConfirmHvt = {
Score = 750,
OneOff = false,
Description = 'Confirmed HVT elimination'
},
Survived = {
Score = 200,
OneOff = false,
Description = 'Made it out alive'
},
TeamKill = {
Score = -250,
OneOff = false,
Description = 'Killed a teammate'
},
Accident = {
Score = -50,
OneOff = false,
Description = 'Killed oneself'
}
},
TeamScoreTypes = {
KillHvt = {
Score = 250,
OneOff = false,
Description = 'Eliminated HVT'
},
ConfirmHvt = {
Score = 750,
OneOff = false,
Description = 'Confirmed HVT elimination'
},
Respawn = {
Score = -1,
OneOff = false,
Description = 'Respawned'
}
},
PlayerTeams = {
BluFor = {
TeamId = 1,
Loadout = 'NoTeam',
Script = nil
},
},
AiTeams = {
OpFor = {
Tag = 'OpFor',
CalculatedAiCount = 0,
Spawns = nil
},
},
Objectives = {
ConfirmKill = nil,
Exfiltrate = nil,
},
HVT = {
Tag = 'HVT',
},
Timers = {
-- Repeating timers with constant delay
SettingsChanged = {
Name = 'SettingsChanged',
TimeStep = 1.0,
},
-- Delays
CheckBluForCount = {
Name = 'CheckBluForCount',
TimeStep = 1.0,
},
CheckReadyUp = {
Name = 'CheckReadyUp',
TimeStep = 0.25,
},
CheckReadyDown = {
Name = 'CheckReadyDown',
TimeStep = 0.1,
},
SpawnOpFor = {
Name = 'SpawnOpFor',
TimeStep = 0.5,
},
},
}
--#endregion
--#region Preparation
function KillConfirmed:PreInit()
print('Pre initialization')
print('Initializing Kill Confirmed')
self.PlayerTeams.BluFor.Script = MTeams:Create(
1,
false,
self.PlayerScoreTypes,
self.TeamScoreTypes
)
-- Gathers all OpFor spawn points by groups
self.AiTeams.OpFor.Spawns = MSpawnsGroups:Create()
-- Gathers all HVT spawn points
self.Objectives.ConfirmKill = MObjectiveConfirmKill:Create(
self,
self.OnAllKillsConfirmed,
self.PlayerTeams.BluFor.Script,
self.HVT.Tag,
self.Settings.HVTCount.Value
)
-- Gathers all extraction points placed in the mission
self.Objectives.Exfiltrate = MObjectiveExfiltrate:Create(
self,
self.OnExfiltrated,
self.PlayerTeams.BluFor.Script,
5.0,
1.0
)
-- Set maximum HVT count and ensure that HVT value is within limit
self.Settings.HVTCount.Max = math.min(
ai.GetMaxCount(),
self.Objectives.ConfirmKill:GetAllSpawnPointsCount()
)
self.Settings.HVTCount.Value = math.min(
self.Settings.HVTCount.Value,
self.Settings.HVTCount.Max
)
-- Set last HVT count for tracking if the setting has changed.
-- This is neccessary for adding objective markers on map.
self.Settings.HVTCount.Last = self.Settings.HVTCount.Value
end
function KillConfirmed:PostInit()
print('Post initialization')
gamemode.AddGameObjective(self.PlayerTeams.BluFor.TeamId, 'NeutralizeHVTs', 1)
gamemode.AddGameObjective(self.PlayerTeams.BluFor.TeamId, 'ConfirmEliminatedHVTs', 1)
print('Added Kill Confirmation objectives')
gamemode.AddGameObjective(self.PlayerTeams.BluFor.TeamId, 'ExfiltrateBluFor', 1)
print('Added exfiltration objective')
end
--#endregion
--#region Common
function KillConfirmed:OnRoundStageSet(RoundStage)
print('Started round stage ' .. RoundStage)
timer.ClearAll()
if RoundStage == 'WaitingForReady' then
self:PreRoundCleanUp()
self.Objectives.Exfiltrate:SelectPoint(false)
self.Objectives.ConfirmKill:ShuffleSpawns()
timer.Set(
self.Timers.SettingsChanged.Name,
self,
self.CheckIfSettingsChanged,
self.Timers.SettingsChanged.TimeStep,
true
)
elseif RoundStage == 'PreRoundWait' then
self:SetUpOpForStandardSpawns()
self:SpawnOpFor()
elseif RoundStage == 'InProgress' then
self.PlayerTeams.BluFor.Script:RoundStart(
self.Settings.RespawnCost.Value,
self.Settings.DisplayScoreMessage.Value == 1,
self.Settings.DisplayScoreMilestones.Value == 1,
self.Settings.DisplayObjectiveMessages.Value == 1,
self.Settings.DisplayObjectivePrompts.Value == 1
)
end
end
function KillConfirmed:OnCharacterDied(Character, CharacterController, KillerController)
print('OnCharacterDied')
if
gamemode.GetRoundStage() == 'PreRoundWait' or
gamemode.GetRoundStage() == 'InProgress'
then
if CharacterController ~= nil then
local killedTeam = actor.GetTeamId(CharacterController)
local killerTeam = nil
if KillerController ~= nil then
killerTeam = actor.GetTeamId(KillerController)
end
if actor.HasTag(CharacterController, self.HVT.Tag) then
self.Objectives.ConfirmKill:Neutralized(Character, KillerController)
elseif actor.HasTag(CharacterController, self.AiTeams.OpFor.Tag) then
print('OpFor standard eliminated')
if killerTeam == self.PlayerTeams.BluFor.TeamId then
self.PlayerTeams.BluFor.Script:AwardPlayerScore(KillerController, 'KillStandard')
end
else
print('BluFor eliminated')
if CharacterController == KillerController then
self.PlayerTeams.BluFor.Script:AwardPlayerScore(CharacterController, 'Accident')
elseif killerTeam == killedTeam then
self.PlayerTeams.BluFor.Script:AwardPlayerScore(KillerController, 'TeamKill')
end
self.PlayerTeams.BluFor.Script:PlayerDied(CharacterController, Character)
timer.Set(
self.Timers.CheckBluForCount.Name,
self,
self.CheckBluForCountTimer,
self.Timers.CheckBluForCount.TimeStep,
false
)
end
end
end
end
--#endregion
--#region Player Status
function KillConfirmed:PlayerInsertionPointChanged(PlayerState, InsertionPoint)
print('PlayerInsertionPointChanged')
if InsertionPoint == nil then
-- Player unchecked insertion point.
timer.Set(
self.Timers.CheckReadyDown.Name,
self,
self.CheckReadyDownTimer,
self.Timers.CheckReadyDown.TimeStep,
false
)
else
-- Player checked insertion point.
timer.Set(self.Timers.CheckReadyUp.Name,
self,
self.CheckReadyUpTimer,
self.Timers.CheckReadyUp.TimeStep,
false
)
end
end
function KillConfirmed:PlayerReadyStatusChanged(PlayerState, ReadyStatus)
print('PlayerReadyStatusChanged ' .. ReadyStatus)
if ReadyStatus ~= 'DeclaredReady' then
-- Player declared ready.
timer.Set(
self.Timers.CheckReadyDown.Name,
self,
self.CheckReadyDownTimer,
self.Timers.CheckReadyDown.TimeStep,
false
)
elseif
gamemode.GetRoundStage() == 'PreRoundWait' and
gamemode.PrepLatecomer(PlayerState)
then
-- Player did not declare ready, but the timer run out.
gamemode.EnterPlayArea(PlayerState)
end
end
function KillConfirmed:CheckReadyUpTimer()
if
gamemode.GetRoundStage() == 'WaitingForReady' or
gamemode.GetRoundStage() == 'ReadyCountdown'
then
local ReadyPlayerTeamCounts = gamemode.GetReadyPlayerTeamCounts(true)
local BluForReady = ReadyPlayerTeamCounts[self.PlayerTeams.BluFor.TeamId]
if BluForReady >= gamemode.GetPlayerCount(true) then
gamemode.SetRoundStage('PreRoundWait')
elseif BluForReady > 0 then
gamemode.SetRoundStage('ReadyCountdown')
end
end
end
function KillConfirmed:CheckReadyDownTimer()
if gamemode.GetRoundStage() == 'ReadyCountdown' then
local ReadyPlayerTeamCounts = gamemode.GetReadyPlayerTeamCounts(true)
if ReadyPlayerTeamCounts[self.PlayerTeams.BluFor.TeamId] < 1 then
gamemode.SetRoundStage('WaitingForReady')
end
end
end
function KillConfirmed:ShouldCheckForTeamKills()
print('ShouldCheckForTeamKills')
if gamemode.GetRoundStage() == 'InProgress' then
return true
end
return false
end
function KillConfirmed:PlayerCanEnterPlayArea(PlayerState)
print('PlayerCanEnterPlayArea')
if
gamemode.GetRoundStage() == 'InProgress' or
player.GetInsertionPoint(PlayerState) ~= nil
then
return true
end
return false
end
function KillConfirmed:GetSpawnInfo(PlayerState)
print('GetSpawnInfo')
if gamemode.GetRoundStage() == 'InProgress' then
self.PlayerTeams.BluFor.Script:RespawnCleanUp(PlayerState)
end
end
function KillConfirmed:PlayerEnteredPlayArea(PlayerState)
print('PlayerEnteredPlayArea')
player.SetInsertionPoint(PlayerState, nil)
end
function KillConfirmed:LogOut(Exiting)
print('Player left the game ')
print(Exiting)
if
gamemode.GetRoundStage() == 'PreRoundWait' or
gamemode.GetRoundStage() == 'InProgress'
then
timer.Set(
self.Timers.CheckBluForCount.Name,
self,
self.CheckBluForCountTimer,
self.Timers.CheckBluForCount.TimeStep,
false
)
end
end
--#endregion
--#region Spawns
function KillConfirmed:SetUpOpForStandardSpawns()
print('Setting up AI spawn points by groups')
local maxAiCount = math.min(
self.AiTeams.OpFor.Spawns.Total,
ai.GetMaxCount() - self.Settings.HVTCount.Value
)
self.AiTeams.OpFor.CalculatedAiCount = MSpawnsCommon.GetAiCountWithDeviationPercent(
5,
maxAiCount,
gamemode.GetPlayerCount(true),
5,
self.Settings.OpForPreset.Value,
5,
0.1
)
local missingAiCount = self.AiTeams.OpFor.CalculatedAiCount
-- Select groups guarding the HVTs and add their spawn points to spawn list
local maxAiCountPerHvtGroup = math.floor(
missingAiCount / self.Settings.HVTCount.Value
)
local aiCountPerHvtGroup = MSpawnsCommon.GetAiCountWithDeviationNumber(
3,
maxAiCountPerHvtGroup,
gamemode.GetPlayerCount(true),
1,
self.Settings.OpForPreset.Value,
1,
0
)
print('Adding group spawns closest to HVTs')
for i = 1, self.Objectives.ConfirmKill:GetHvtCount() do
local hvtLocation = actor.GetLocation(
self.Objectives.ConfirmKill:GetShuffledSpawnPoint(i)
)
self.AiTeams.OpFor.Spawns:AddSpawnsFromClosestGroup(aiCountPerHvtGroup, hvtLocation)
end
missingAiCount = self.AiTeams.OpFor.CalculatedAiCount -
self.AiTeams.OpFor.Spawns:GetSelectedSpawnPointsCount()
-- Select random groups and add their spawn points to spawn list
print('Adding random group spawns')
while missingAiCount > 0 do
if self.AiTeams.OpFor.Spawns:GetRemainingGroupsCount() <= 0 then
break
end
local aiCountPerGroup = MSpawnsCommon.GetAiCountWithDeviationNumber(
2,
10,
gamemode.GetPlayerCount(true),
0.5,
self.Settings.OpForPreset.Value,
1,
1
)
if aiCountPerGroup > missingAiCount then
print('Remaining AI count is not enough to fill group')
break
end
self.AiTeams.OpFor.Spawns:AddSpawnsFromRandomGroup(aiCountPerGroup)
missingAiCount = self.AiTeams.OpFor.CalculatedAiCount -
self.AiTeams.OpFor.Spawns:GetSelectedSpawnPointsCount()
end
-- Select random spawns
self.AiTeams.OpFor.Spawns:AddRandomSpawns()
self.AiTeams.OpFor.Spawns:AddRandomSpawnsFromReserve()
end
function KillConfirmed:SpawnOpFor()
self.Objectives.ConfirmKill:Spawn(0.4)
timer.Set(
self.Timers.SpawnOpFor.Name,
self,
self.SpawnStandardOpForTimer,
self.Timers.SpawnOpFor.TimeStep,
false
)
end
function KillConfirmed:SpawnStandardOpForTimer()
self.AiTeams.OpFor.Spawns:Spawn(3.5, self.AiTeams.OpFor.CalculatedAiCount, self.AiTeams.OpFor.Tag)
end
--#endregion
--#region Objective: Kill confirmed
function KillConfirmed:OnAllKillsConfirmed()
self.Objectives.Exfiltrate:SelectedPointSetActive(true)
end
--#endregion
--#region Objective: Extraction
function KillConfirmed:OnGameTriggerBeginOverlap(GameTrigger, Player)
print('OnGameTriggerBeginOverlap')
if self.Objectives.Exfiltrate:CheckTriggerAndPlayer(GameTrigger, Player) then
self.Objectives.Exfiltrate:PlayerEnteredExfiltration(
self.Objectives.ConfirmKill:AreAllConfirmed()
)
end
end
function KillConfirmed:OnGameTriggerEndOverlap(GameTrigger, Player)
print('OnGameTriggerEndOverlap')
if self.Objectives.Exfiltrate:CheckTriggerAndPlayer(GameTrigger, Player) then
self.Objectives.Exfiltrate:PlayerLeftExfiltration()
end
end
function KillConfirmed:OnExfiltrated()
if gamemode.GetRoundStage() ~= 'InProgress' then
return
end
-- Award surviving players
local alivePlayers = self.PlayerTeams.BluFor.Script:GetAlivePlayers()
for _, alivePlayer in ipairs(alivePlayers) do
self.PlayerTeams.BluFor.Script:AwardPlayerScore(alivePlayer, 'Survived')
end
-- Prepare summary
gamemode.AddGameStat('Result=Team1')
gamemode.AddGameStat('Summary=HVTsConfirmed')
gamemode.AddGameStat(
'CompleteObjectives=NeutralizeHVTs,ConfirmEliminatedHVTs,ExfiltrateBluFor'
)
gamemode.SetRoundStage('PostRoundWait')
end
--#endregion
--#region Fail Condition
function KillConfirmed:CheckBluForCountTimer()
if gamemode.GetRoundStage() ~= 'InProgress' then
return
end
if self.PlayerTeams.BluFor.Script:IsWipedOut() then
gamemode.AddGameStat('Result=None')
if self.Objectives.ConfirmKill:AreAllNeutralized() then
gamemode.AddGameStat('Summary=BluForExfilFailed')
gamemode.AddGameStat('CompleteObjectives=NeutralizeHVTs')
elseif self.Objectives.ConfirmKill:AreAllConfirmed() then
gamemode.AddGameStat('Summary=BluForExfilFailed')
gamemode.AddGameStat(
'CompleteObjectives=NeutralizeHVTs,ConfirmEliminatedHVTs'
)
else
gamemode.AddGameStat('Summary=BluForEliminated')
end
gamemode.SetRoundStage('PostRoundWait')
end
end
--#endregion
--#region Helpers
function KillConfirmed:PreRoundCleanUp()
ai.CleanUp(self.HVT.Tag)
ai.CleanUp(self.AiTeams.OpFor.Tag)
self.Objectives.ConfirmKill:Reset()
self.Objectives.Exfiltrate:Reset()
end
function KillConfirmed:CheckIfSettingsChanged()
if self.Settings.HVTCount.Last ~= self.Settings.HVTCount.Value then
print('Leader count changed, reshuffling spawns & updating objective markers.')
self.Objectives.ConfirmKill:SetHvtCount(self.Settings.HVTCount.Value)
self.Objectives.ConfirmKill:ShuffleSpawns()
self.Settings.HVTCount.Last = self.Settings.HVTCount.Value
end
end
function KillConfirmed:GetPlayerTeamScript()
return self.PlayerTeams.BluFor.Script
end
--#endregion
return KillConfirmed
|
--- @module ColorPicker
-- Allows users to choose colors from a palette
-- @commonParams
-- @option caption string
-- @option color string|table The currently-selected color
-- @option captionFont number A font preset
-- @option captionColor string|table A color preset
-- @option frameColor string|table A color preset
-- @option bg string|table A color preset
-- @option round number Corner radius
-- @option pad number Padding between the caption and the element frame
-- @option shadow boolean
local Buffer = require("public.buffer")
local Font = require("public.font")
local Color = require("public.color")
local GFX = require("public.gfx")
local Text = require("public.text")
local Config = require("gui.config")
local ColorPicker = require("gui.element"):new()
ColorPicker.__index = ColorPicker
ColorPicker.defaultProps = {
name = "colorPicker",
type = "ColorPicker",
x = 0,
y = 0,
w = 20,
h = 20,
frameColor = "elementBody",
color = "highlight",
round = 0,
caption = "",
bg = "background",
captionFont = 3,
captionColor = "text",
pad = 4,
shadow = true,
state = 0,
}
function ColorPicker:new(props)
local picker = self:addDefaultProps(props)
return setmetatable(picker, self)
end
function ColorPicker:init()
self.buffer = self.buffer or Buffer.get()
gfx.dest = self.buffer
gfx.setimgdim(self.buffer, -1, -1)
gfx.setimgdim(self.buffer, 2 * self.w + 4, self.h + 2)
self:drawFrame()
end
function ColorPicker:onDelete()
Buffer.release(self.buffer)
end
--- Gets or sets the current color
-- @option new string|table A color preset
-- @return string|table A color preset
function ColorPicker:val(new)
if new then
self.color = new
self:redraw()
else
return self.color
end
end
function ColorPicker:draw()
local x, y, w, h = self.x + 2 * self.state, self.y + 2 * self.state, self.w, self.h
if self.state == 0 and self.shadow and Config.drawShadows then
for i = 1, Config.shadowSize do
gfx.blit(self.buffer, 1, 0, w + 2, 0, w + 2, h + 2, x + i - 1, y + i - 1)
end
end
gfx.blit(self.buffer, 1, 0, 0, 0, w + 2, h + 2, x - 1, y - 1)
self:drawCaption()
self:drawColor()
end
function ColorPicker:onMouseUp(state)
self.state = 0
self:redraw()
if state.preventDefault then return end
self:selectColor()
end
function ColorPicker:onMouseDown()
self.state = 1
self:redraw()
end
function ColorPicker:onDoubleClick()
self.state = 0
self:redraw()
end
--- Opens the color palette, setting the returned value as the current selection
function ColorPicker:selectColor()
local current = Color.toNative(self.color)
local retval, colorOut = reaper.GR_SelectColor(nil, current)
if retval ~= 0 then
self.color = Color.fromNative(colorOut)
self:redraw()
end
end
------------------------------------
-------- Drawing methods -----------
------------------------------------
function ColorPicker:drawFrame()
local w, h = self.w, self.h
local round = self.round
-- Frame background
if self.bg then
Color.set(self.bg)
if round > 0 then
GFX.roundRect(1, 1, w, h, round, 1, true)
else
gfx.rect(1, 1, w, h, true)
end
end
-- Shadow
local r, g, b, a = table.unpack(Color.colors.shadow)
gfx.set(r, g, b, 1)
GFX.roundRect(w + 2, 1, w, h, round, 1, 1)
gfx.muladdrect(w + 2, 1, w + 2, h + 2, 1, 1, 1, a, 0, 0, 0, 0 )
-- Frame
Color.set(self.frameColor)
if round > 0 then
GFX.roundRect(1, 1, w, h, round, 1, false)
else
gfx.rect(1, 1, w, h, false)
end
end
function ColorPicker:drawCaption()
if not self.caption or self.caption == "" then return end
Font.set(self.captionFont)
local strWidth, strHeight = gfx.measurestr(self.caption)
gfx.x = self.x - strWidth - self.pad
gfx.y = self.y + (self.h - strHeight) / 2
Text.drawBackground(self.caption, self.bg)
Text.drawWithShadow(self.caption, self.captionColor, "shadow")
end
-- Draw the chosen color inside the frame
function ColorPicker:drawColor()
local x, y, w, h = self.x + 1 + 2 * self.state, self.y + 1 + 2 * self.state, self.w - 2, self.h - 2
Color.set(self.color)
gfx.rect(x, y, w, h, true)
Color.set("black")
gfx.rect(x, y, w, h, false)
end
return ColorPicker
|
local S = homedecor.gettext
local cutlery_cbox = {
type = "fixed",
fixed = {
{ -5/16, -8/16, -6/16, 5/16, -7/16, 2/16 },
{ -2/16, -8/16, 2/16, 2/16, -4/16, 6/16 }
}
}
homedecor.register("cutlery_set", {
drawtype = "mesh",
mesh = "homedecor_cutlery_set.obj",
tiles = { "homedecor_cutlery_set.png" },
inventory_image = "homedecor_cutlery_set_inv.png",
description = "Cutlery set",
groups = {snappy=3},
selection_box = cutlery_cbox,
walkable = false,
sounds = default.node_sound_glass_defaults(),
})
local bottle_cbox = {
type = "fixed",
fixed = {
{ -0.125, -0.5, -0.125, 0.125, 0, 0.125}
}
}
local fbottle_cbox = {
type = "fixed",
fixed = {
{ -0.375, -0.5, -0.3125, 0.375, 0, 0.3125 }
}
}
local bottle_colors = {"brown", "green"}
for _, b in ipairs(bottle_colors) do
homedecor.register("bottle_"..b, {
tiles = { "homedecor_bottle_"..b..".png" },
inventory_image = "homedecor_bottle_"..b.."_inv.png",
description = "Bottle ("..b..")",
mesh = "homedecor_bottle.obj",
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
selection_box = bottle_cbox
})
-- 4-bottle sets
homedecor.register("4_bottles_"..b, {
tiles = {
"homedecor_bottle_"..b..".png",
"homedecor_bottle_"..b..".png"
},
inventory_image = "homedecor_4_bottles_"..b.."_inv.png",
description = "Four "..b.." bottles",
mesh = "homedecor_4_bottles.obj",
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
selection_box = fbottle_cbox
})
end
homedecor.register("4_bottles_multi", {
tiles = {
"homedecor_bottle_brown.png",
"homedecor_bottle_green.png"
},
inventory_image = "homedecor_4_bottles_multi_inv.png",
description = "Four misc brown/green bottles",
mesh = "homedecor_4_bottles.obj",
groups = {snappy=3},
walkable = false,
sounds = default.node_sound_glass_defaults(),
selection_box = fbottle_cbox
})
local wine_cbox = homedecor.nodebox.slab_z(-0.75)
homedecor.register("wine_rack", {
description = "Wine Rack",
mesh = "homedecor_wine_rack.obj",
tiles = {
"homedecor_generic_wood_red.png",
"homedecor_bottle_brown.png",
"homedecor_bottle_brown2.png",
"homedecor_bottle_brown3.png",
"homedecor_bottle_brown4.png"
},
inventory_image = "homedecor_wine_rack_inv.png",
groups = {choppy=2},
selection_box = wine_cbox,
collision_box = wine_cbox,
sounds = default.node_sound_defaults(),
})
homedecor.register("dartboard", {
description = "Dartboard",
mesh = "homedecor_dartboard.obj",
tiles = { "homedecor_dartboard.png" },
inventory_image = "homedecor_dartboard_inv.png",
wield_image = "homedecor_dartboard_inv.png",
paramtype2 = "wallmounted",
walkable = false,
selection_box = {
type = "wallmounted",
},
groups = {choppy=2,dig_immediate=2,attached_node=1},
legacy_wallmounted = true,
sounds = default.node_sound_wood_defaults(),
})
homedecor.register("beer_tap", {
description = "Beer tap",
mesh = "homedecor_beer_taps.obj",
tiles = {
"homedecor_generic_metal_bright.png",
"homedecor_generic_metal_black.png",
},
inventory_image = "homedecor_beertap_inv.png",
groups = { snappy=3 },
walkable = false,
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 }
},
on_punch = function(pos, node, puncher, pointed_thing)
local wielditem = puncher:get_wielded_item()
local inv = puncher:get_inventory()
local wieldname = wielditem:get_name()
if wieldname == "vessels:drinking_glass" then
if inv:room_for_item("main", "homedecor:beer_mug 1") then
wielditem:take_item()
puncher:set_wielded_item(wielditem)
inv:add_item("main", "homedecor:beer_mug 1")
minetest.chat_send_player(puncher:get_player_name(), "Ahh, a frosty cold beer - look in your inventory for it!")
else
minetest.chat_send_player(puncher:get_player_name(), "No room in your inventory to add a beer mug!")
end
end
end
})
minetest.register_craft({
output = "homedecor:beer_tap",
recipe = {
{ "group:stick","default:steel_ingot","group:stick" },
{ "homedecor:kitchen_faucet","default:steel_ingot","homedecor:kitchen_faucet" },
{ "default:steel_ingot","default:steel_ingot","default:steel_ingot" }
},
})
local beer_cbox = {
type = "fixed",
fixed = { -5/32, -8/16, -9/32 , 7/32, -2/16, 1/32 }
}
homedecor.register("beer_mug", {
description = "Beer mug",
drawtype = "mesh",
mesh = "homedecor_beer_mug.obj",
tiles = { "homedecor_beer_mug.png" },
inventory_image = "homedecor_beer_mug_inv.png",
groups = { snappy=3, oddly_breakable_by_hand=3 },
walkable = false,
sounds = default.node_sound_glass_defaults(),
selection_box = beer_cbox,
on_use = minetest.item_eat(2)
})
local svm_cbox = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}
}
homedecor.register("soda_machine", {
description = "Soda Vending Machine",
mesh = "homedecor_soda_machine.obj",
tiles = {"homedecor_soda_machine.png"},
groups = {snappy=3},
selection_box = svm_cbox,
collision_box = svm_cbox,
expand = { top="placeholder" },
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
on_punch = function(pos, node, puncher, pointed_thing)
local wielditem = puncher:get_wielded_item()
local wieldname = wielditem:get_name()
local fdir_to_fwd = { {0, -1}, {-1, 0}, {0, 1}, {1, 0} }
local fdir = node.param2
local pos_drop = { x=pos.x+fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+fdir_to_fwd[fdir+1][2] }
if wieldname == "homedecor:coin" then
wielditem:take_item()
puncher:set_wielded_item(wielditem)
minetest.spawn_item(pos_drop, "homedecor:soda_can")
minetest.sound_play("insert_coin", {
pos=pos, max_hear_distance = 5
})
else
minetest.chat_send_player(puncher:get_player_name(), "Please insert a coin in the machine.")
end
end
})
|
-- Copyright (C) 2012 by Yichun Zhang (agentzh)
local ffi = require "ffi"
module(...)
_VERSION = '0.08'
ffi.cdef[[
typedef unsigned long SHA_LONG;
typedef unsigned long long SHA_LONG64;
enum {
SHA_LBLOCK = 16
};
]];
|
-- test.lua - test suite for lib module.
-- 'findbin' -- https://github.com/davidm/lua-find-bin
package.preload.findbin = function()
local M = {_TYPE='module', _NAME='findbin', _VERSION='0.1.1.20120406'}
local script = arg and arg[0] or ''
local bin = script:gsub('[/\\]?[^/\\]+$', '') -- remove file name
if bin == '' then bin = '.' end
M.bin = bin
setmetatable(M, {__call = function(_, relpath) return bin .. relpath end})
return M
end
package.path = require 'findbin' '/lua/?.lua;' .. package.path
-- from file_slurp 0.4.2.20120406 https://github.com/davidm/lua-file-slurp
local FS = {}
local function check_options(options)
if not options then return {} end
local bad = options:match'[^tTsap]'
if bad then error('ASSERT: invalid option '..bad, 3) end
local t = {}; for v in options:gmatch'.' do t[v] = true end
if t.T and t.t then error('ASSERT: options t and T mutually exclusive',3) end
return t
end
function FS.writefile(filename, data, options)
local tops = check_options(options)
local open = tops.p and io.popen or io.open
local ok
local fh, err, code = open(filename,
(tops.a and 'a' or 'w') .. ((tops.t or tops.p) and '' or 'b'))
if fh then
ok, err, code = fh:write(data)
if ok then ok, err, code = fh:close() else fh:close() end
end
if not ok then return fail(tops, err, code, filename) end
return data
end
local M = require 'lib'
assert(#M.cpath_form ~= 0)
M.cpath_form = {'<dir>/?.so', '<dir>/?.dll'}
local function checkeq(a, b, e)
if a ~= b then error(
'not equal ['..tostring(a)..'] ['..tostring(b)..'] ['..tostring(e)..']', 2)
end
end
local sep = package.config:sub(3,3)
local function P(paths) return (paths:gsub(';', sep)) end
-- test split
local function ssplit(s) return table.concat(M.split(s), '\0') end
checkeq( ssplit(''), '' )
checkeq( ssplit(P';'), '' )
checkeq( ssplit(P';;'), '' )
checkeq( ssplit(P'./?.lua'), './?.lua' )
checkeq( ssplit(P'./?.lua;/foo/?.lua'), './?.lua\0/foo/?.lua' )
-- test join
checkeq( M.join{}, '')
checkeq( M.join{'./?.lua'}, './?.lua')
checkeq( M.join{'./?.lua', '/foo/?.lua'}, P'./?.lua;/foo/?.lua' )
-- test after
package.path = ''; package.cpath = ''
M.after('foo')
checkeq(package.path, P'foo/?.lua;foo/?/init.lua')
checkeq(package.cpath, P'foo/?.so;foo/?.dll')
M.after('bar')
checkeq(package.path, P'foo/?.lua;foo/?/init.lua;bar/?.lua;bar/?/init.lua')
checkeq(package.cpath, P'foo/?.so;foo/?.dll;bar/?.so;bar/?.dll')
package.path = ''; package.cpath = ''
local ok, err = pcall(function() M.after('a?b') end)
assert(err:match'contains a %?') -- '?' can't be escaped
local ok, err = pcall(function() M.after('a'..sep) end)
assert(err:match'contains a %?') -- ';' can't be escaped
-- test before
package.path = ''; package.cpath = ''
M.before('foo')
checkeq(package.path, P'foo/?.lua;foo/?/init.lua')
checkeq(package.cpath, P'foo/?.so;foo/?.dll')
M.before('bar')
checkeq(package.path, P'bar/?.lua;bar/?/init.lua;foo/?.lua;foo/?/init.lua')
checkeq(package.cpath, P'bar/?.so;bar/?.dll;foo/?.so;foo/?.dll')
-- test before shorthand
package.path = ''
M 'foo'
checkeq(package.path, P'foo/?.lua;foo/?/init.lua')
-- test complex
package.cpath = '?.z'
M {before='a', after={'b','c'}, cpath_form='<dir>/?.dllx'}
checkeq(package.cpath, P'a/?.dllx;?.z;b/?.dllx;c/?.dllx')
-- test newrequire
FS.writefile('tmp135.x', 'return {}')
M.path_form = {'<dir>/?.x'}
local require2 = M.newrequire('.')
local X = require2 'tmp135'
assert(X)
os.remove 'tmp135.x'
package.path = '?.lua'
local require2 = M.newrequire{before='a', after={'b','c'}, path_form='<dir>/?.luac'}
local path
package.preload._lib_debug = function()
path = package.path
end
require2 '_lib_debug'
checkeq(path, 'a/?.luac;?.lua;b/?.luac;c/?.luac')
-- findbin tests
package.loaded.findbin = nil
arg[0] = 'a/b/c.lua' -- trick findbin
if pcall(require, 'findbin') then
package.path = ''; package.cpath = ''
M.path_form = {'<dir>/?.lua', '<dir>/?/init.lua'}
M.before('<bin>/../foo')
checkeq(package.path, P'a/b/../foo/?.lua;a/b/../foo/?/init.lua')
else
print 'WARNING: tests with findbin skipped (module not found)'
end
print 'OK'
|
IncludeDir = {}
IncludeDir["ImGui"] = "%{wks.location}/vendor/ImGui"
IncludeDir["rlImgui"] = "%{wks.location}/vendor/rlImgui"
IncludeDir["raylib"] = "%{wks.location}/vendor/raylib/src"
IncludeDir["SPDLOG"] = "%{wks.location}/vendor/spdlog/include"
IncludeDir["ENTT"] = "%{wks.location}/vendor/entt/src/"
IncludeDir["IconFontCppHeaders"] = "%{wks.location}/vendor/IconFontCppHeaders/"
IncludeDir["cppcoro"] = "%{wks.location}/vendor/cppcoro/include"
IncludeDir["yamlcpp"] = "%{wks.location}/vendor/yaml-cpp/include"
-- IncludeDir["glm"] = "%{wks.location}/vendor/glm"
LibraryDir = {}
Library = {}
Library["Release"] = {}
Library["Debug"] = {}
|
-- UDPBroadcaster.lua
-- David Skrundz
--
-- udp = UDPBroadcaster.new()
-- udp:start(ip, port, message, interval)
-- bool = udp:isBroadcasting()
-- udp:stop()
UDPBroadcaster = {}
function UDPBroadcaster.new()
local _udpbroadcaster = {}
setmetatable(_udpbroadcaster, {__index = UDPBroadcaster})
return _udpbroadcaster
end
function UDPBroadcaster:isBroadcasting()
return self.socket ~= nil
end
function UDPBroadcaster:start(ip, port, message, interval)
if self:isBroadcasting() then self:stop() end
self.canSend = true
self.socket = net.createUDPSocket()
self.socket:on("sent", function(_)
self.canSend = true
end)
self.timer = tmr.create()
self.timer:alarm(interval, tmr.ALARM_AUTO, function()
if not self.canSend then return end
self.socket:send(port, ip, message)
end)
end
function UDPBroadcaster:stop()
if not self:isBroadcasting() then return end
self.timer:unregister()
self.timer = nil
self.canSend = nil
self.socket = nil
end
|
--[=[
@class GameConfigCmdrUtils
]=]
local require = require(script.Parent.loader).load(script)
local GameConfigAssetTypes = require("GameConfigAssetTypes")
local GameConfigCmdrUtils = {}
function GameConfigCmdrUtils.registerAssetTypes(cmdr, configPicker)
assert(cmdr, "Bad cmdr")
assert(configPicker, "Bad configPicker")
for _, assetType in pairs(GameConfigAssetTypes) do
GameConfigCmdrUtils.registerAssetType(cmdr, configPicker, assetType)
end
end
function GameConfigCmdrUtils.registerAssetType(cmdr, configPicker, assetType)
assert(cmdr, "Bad cmdr")
assert(type(assetType) == "string", "Bad assetType")
assert(configPicker, "Bad configPicker")
local assetIdDefinition = {
Transform = function(text)
local allAssets = configPicker:GetAllActiveAssetsOfType(assetType)
local assetKeys = {}
-- TODO: Translate too?
for _, assetConfig in pairs(allAssets) do
table.insert(assetKeys, assetConfig:GetAssetKey())
end
local find = cmdr.Util.MakeFuzzyFinder(assetKeys)
local found = find(text)
-- Allow numbers here too
if tonumber(text) then
table.insert(found, tonumber(text))
end
return found
end;
Validate = function(keys)
return #keys > 0, ("No %s with that name could be found."):format(assetType)
end,
Autocomplete = function(keys)
local stringified = {}
for _, item in pairs(keys) do
table.insert(stringified, tostring(item))
end
return stringified
end,
Parse = function(keys)
local value = keys[1]
if type(value) == "number" then
return value
end
local asset = configPicker:FindFirstActiveAssetOfKey(assetType, value)
if asset then
return asset:GetAssetId()
end
end;
}
cmdr.Registry:RegisterType(assetType .. "Id", assetIdDefinition)
cmdr.Registry:RegisterType(assetType .. "Ids", cmdr.Util.MakeListableType(assetIdDefinition))
end
return GameConfigCmdrUtils |
resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'
client_script 'client.lua'
|
local timestamp = require "kong.tools.timestamp"
local connection = require "kong.plugins.scalable-rate-limiter.policies.connection"
local kong = kong
local pairs = pairs
local null = ngx.null
local shm = ngx.shared.kong_rate_limiting_counters
local fmt = string.format
local EMPTY_UUID = "00000000-0000-0000-0000-000000000000"
local function get_service_and_route_ids(conf)
conf = conf or {}
local service_id = conf.service_id
local route_id = conf.route_id
if not service_id or service_id == null then
service_id = EMPTY_UUID
end
if not route_id or route_id == null then
route_id = EMPTY_UUID
end
return service_id, route_id
end
local get_local_key = function(conf, identifier, period, period_date)
local service_id, route_id = get_service_and_route_ids(conf)
return fmt("ratelimit:%s:%s:%s:%s:%s", route_id, service_id, identifier, period_date, period)
end
local EXPIRATION = require "kong.plugins.scalable-rate-limiter.expiration"
return {
["redis"] = {
increment = function(conf, limits, identifier, current_timestamp, value)
local red, err = connection.get_redis_conn_pool(conf)
if not red then
return nil, err
end
local periods = timestamp.get_timestamps(current_timestamp)
for period, period_date in pairs(periods) do
if limits[period] then
local cache_key = get_local_key(conf, identifier, period, period_date)
local redis_hit_count = red:incrby(cache_key, value)
if redis_hit_count == 1 then
red:expire(cache_key, EXPIRATION[period])
end
end
end
return true
end,
usage = function(conf, identifier, period, current_timestamp)
local red, err = connection.get_redis_conn_pool(conf)
if not red then
return nil, err
end
local periods = timestamp.get_timestamps(current_timestamp)
local cache_key = get_local_key(conf, identifier, period, periods[period])
local current_metric, err_get = red:get(cache_key)
if err_get then
return nil, err_get
end
if current_metric == null then
current_metric = nil
end
return current_metric or 0
end,
},
["batch-redis"] = {
increment = function(conf, limits, identifier, current_timestamp, value)
local periods = timestamp.get_timestamps(current_timestamp)
for period, period_date in pairs(periods) do
-- If a limit has been defined for current period
if limits[period] then
local cache_key = get_local_key(conf, identifier, period, period_date)
local node_hit_count, err = shm:incr(cache_key, value, 0, EXPIRATION[period])
if not node_hit_count then
kong.log.err("Could not increment counter for period '", period, "' ", err)
return nil, err
end
-- Update Redis if batch completed
if node_hit_count % conf.batch_size == 0 then
-- If the batch size is too low, then key may not expire due to race conditions
-- Refer https://redis.io/commands/incr#pattern-rate-limiter-2
local red, err_get_redis_connection = connection.get_redis_conn_pool(conf)
if not red then
return nil, err_get_redis_connection
end
local redis_hit_count = red:incrby(cache_key, conf.batch_size)
if redis_hit_count == conf.batch_size then
red:expire(cache_key, EXPIRATION[period])
end
-- Due to non-atomic get-set, count may have some error
local latest_node_hit_count, err_shm_get = shm:get(cache_key)
local set_value
if err_shm_get or not latest_node_hit_count then
set_value = redis_hit_count
else
set_value = redis_hit_count + latest_node_hit_count - node_hit_count
end
local success, err_shm_set = shm:set(cache_key, set_value, EXPIRATION[period])
if not success then
kong.log.err("Could not set rate-limiting counter in SHM for period '", period, "': ",
err_shm_set)
return nil, err_shm_set
end
end
end
end
return true
end,
usage = function(conf, identifier, period, current_timestamp)
local periods = timestamp.get_timestamps(current_timestamp)
local cache_key = get_local_key(conf, identifier, period, periods[period])
-- Read current_metric from node cache
local current_metric, err = shm:get(cache_key, nil, function () return 0 end)
if err then
return nil, err
end
return current_metric
end,
},
}
|
-- Factorio-Lib: https://factoriolib.github.io/flib/index.html
local table = require("__flib__.table")
-- Ban research pack fron the planning
local BanResearchPacks = {packs = {}}
BanResearchPacks.__index = BanResearchPacks
function BanResearchPacks:hydrate(o) setmetatable(o, self) end
function BanResearchPacks:apply(force, technologies)
return {}, table.filter(technologies, self:filter())
end
function BanResearchPacks:filter()
local function contain_banned_sciend(packs, suffix)
for _, pack in ipairs(packs) do
for _, p in ipairs(self.packs) do
if pack == p .. (suffix or "") then return true end
end
end
return false
end
return function(tech)
-- Present packs
local used_packs = table.map(tech.research_unit_ingredients,
function(i) return i.name end)
-- Get all banned science-packs with complete name
if contain_banned_sciend(used_packs) then return false end
-- Get all banned science-packs ending with "-science-packs"
if contain_banned_sciend(used_packs, "-science-pack") then
return false
end
-- There was no match then
return true
end
end
-- Ban research family from the planning
local BanResearchTypes = {types = {}}
BanResearchTypes.__index = BanResearchTypes
function BanResearchTypes:hydrate(o) setmetatable(o, self) end
function BanResearchTypes:apply(force, technologies)
return {}, table.filter(technologies, self:filter())
end
function BanResearchTypes:filter()
-- Filtering by prefix
local function starts_with(s, p) return s:sub(0, #p) == p end
return function(tech)
-- The first match stop the loockup
for _, banned_type in ipairs(self.types) do
if starts_with(tech.name, banned_type) then return false end
end
-- There was no match then
return true
end
end
return {
["filter.ban-research-packs"] = BanResearchPacks,
["filter.ban-research-types"] = BanResearchTypes
}
|
--local config = require("bots/config")
--
--function TeamToChar()
-- -- TEAM_RADIANT==2 TEAM_DIRE==3. Makes total sense!
-- if GetTeam() == TEAM_RADIANT then return 'R' else return 'D' end
--end
--
--function GetBotNames ()
-- truncated_team_id = string.sub(config.game_id, 1, 8) .. "_" .. TeamToChar()
-- return {
-- truncated_team_id .. "0",
-- truncated_team_id .. "1",
-- truncated_team_id .. "2",
-- truncated_team_id .. "3",
-- truncated_team_id .. "4",
-- }
--end
--
--local bot_heroes = {"npc_dota_hero_nevermore"}
--
--function Think()
-- -- This gets called (every server tick AND until all heroes are picked).
-- -- This needs to gets called at least once if there is no human.
-- local ids = GetTeamPlayers(GetTeam())
-- for i,v in pairs(ids) do
-- -- If the human is in the unassigned slot, the radiant bots start at v = 2
-- -- If the human is in the radiant coach slot, the radiant bots start at v = 2
-- -- If the human is in the first radiant slot, the radiant bots start at v = 0
-- -- If the human is in the second radiant slot, the radiant bots start at v = 1
-- -- If the human is in the third radiant slot, the radiant bots start at v = 2
-- if IsPlayerBot(v) and IsPlayerInHeroSelectionControl(v) then
-- -- if i == 1 and GetTeam() == TEAM_RADIANT then
-- if i == 1 then
-- SelectHero( v, "npc_dota_hero_nevermore" );
-- else
-- SelectHero( v, "npc_dota_hero_sniper" );
-- end
-- end
-- end
--end
local config = require("bots/config")
function TeamToChar()
-- TEAM_RADIANT==2 TEAM_DIRE==3. Makes total sense!
if GetTeam() == TEAM_RADIANT then return 'R' else return 'D' end
end
function GetBotNames ()
-- truncated_team_id = string.sub(config.game_id, 1, 8) .. "_" .. TeamToChar()
truncated_team_id = "LastOrder" .. "_" .. TeamToChar()
return {
truncated_team_id .. "0",
truncated_team_id .. "1",
truncated_team_id .. "2",
truncated_team_id .. "3",
truncated_team_id .. "4",
}
end
local bot_heroes = {"npc_dota_hero_nevermore"}
function Think()
-- This gets called (every server tick AND until all heroes are picked).
-- This needs to gets called at least once if there is no human.
local ids = GetTeamPlayers(GetTeam())
for i,v in pairs(ids) do
-- If the human is in the unassigned slot, the radiant bots start at v = 2
-- If the human is in the radiant coach slot, the radiant bots start at v = 2
-- If the human is in the first radiant slot, the radiant bots start at v = 0
-- If the human is in the second radiant slot, the radiant bots start at v = 1
-- If the human is in the third radiant slot, the radiant bots start at v = 2
if IsPlayerBot(v) and IsPlayerInHeroSelectionControl(v) then
-- if i == 1 and GetTeam() == TEAM_RADIANT then
if i == 1 then
if GetTeam() == TEAM_RADIANT then
SelectHero( v, "npc_dota_hero_nevermore" );
elseif GetTeam() == TEAM_DIRE then
SelectHero( v, "npc_dota_hero_nevermore" );
end
else
SelectHero( v, "npc_dota_hero_wisp" );
end
end
end
end
-- Function below sets the lane assignments for default bots
-- Obviously, our own agents will do what they belive best
function UpdateLaneAssignments()
if GetTeam() == TEAM_RADIANT then
return {
[1] = LANE_MID,
[2] = LANE_BOT,
[3] = LANE_BOT,
[4] = LANE_TOP,
[5] = LANE_TOP,
}
elseif GetTeam() == TEAM_DIRE then
return {
[1] = LANE_MID,
[2] = LANE_BOT,
[3] = LANE_BOT,
[4] = LANE_TOP,
[5] = LANE_TOP,
}
end
end
|
local Vector2 = import("./Vector2")
local function extractValues(v)
return { v.X, v.Y }
end
describe("types.Vector2", function()
it("should have an empty constructor", function()
local v = Vector2.new()
assert.not_nil(v)
assert.are.same({0, 0}, extractValues(v))
end)
it("should have a constructor with two parameters", function()
local v = Vector2.new(1, 200)
assert.not_nil(v)
assert.are.same({1, 200}, extractValues(v))
end)
it("should throw when bad params are passed to the constructor", function()
assert.has.errors(function()
Vector2.new(1, "test")
end)
assert.has.errors(function()
Vector2.new("test", 10)
end)
end)
it("should add another Vector2", function()
local vectorA = Vector2.new(1, 200)
local vectorB = Vector2.new(100, 500)
local v = vectorA + vectorB
assert.not_nil(v)
assert.are.same({101, 700}, extractValues(v))
end)
it("should subtract another Vector2", function()
local vectorA = Vector2.new(1, 200)
local vectorB = Vector2.new(100, 500)
local v = vectorA - vectorB
assert.not_nil(v)
assert.are.same({-99, -300}, extractValues(v))
end)
it("should equal another Vector2 with the same x and y", function()
local vectorA = Vector2.new(1, 200)
local vectorB = Vector2.new(1, 200)
assert.equals(vectorA, vectorB)
end)
it("should not equal another UDim with different scale and offset", function()
local vectorA = Vector2.new(1, 200)
local vectorB1 = Vector2.new(10, 200)
local vectorB2 = Vector2.new(1, 300)
local vectorB3 = Vector2.new(5, 10)
assert.not_equals(vectorA, vectorB1)
assert.not_equals(vectorA, vectorB2)
assert.not_equals(vectorA, vectorB3)
end)
end)
|
function showCredits()
outputChatBox("------------------------------------------", 255, 194, 14)
outputChatBox("Script by Daniels, Chamberlain, Hankey, Cazomino05, mabako, Carlo, Serizzim, Konstantine & Flobu.", 255, 194, 14)
outputChatBox("Special thanks to Arc_, Ryden and Talidan.", 255, 194, 14)
outputChatBox("------------------------------------------", 255, 194, 14)
end
addCommandHandler("credits", showCredits, false)
addCommandHandler("about", showCredits, false) |
local self = {}
GLib.Containers.BinarySetOperatorController = GLib.MakeConstructor (self)
GLib.Containers.SetIntersectionController = function (...) return GLib.Containers.BinarySetOperatorController (function (left, right) return left and right end, ...) end
GLib.Containers.SetUnionController = function (...) return GLib.Containers.BinarySetOperatorController (function (left, right) return left or right end, ...) end
GLib.Containers.SetSubtractionController = function (...) return GLib.Containers.BinarySetOperatorController (function (left, right) return left and not right end, ...) end
GLib.Containers.SetXorController = function (...) return GLib.Containers.BinarySetOperatorController (function (left, right) return left ~= right end, ...) end
function self:ctor (membershipFunction, left, right, result)
self.MembershipFunction = function (leftContains, rightContains, item) return false end
self.Left = nil
self.Right = nil
self.Result = nil
self:SetLeft (left)
self:SetRight (right)
self:SetMembershipFunction (membershipFunction)
self:SetResult (result)
end
function self:dtor ()
self:SetResult (nil)
self:SetLeft (nil)
self:SetRight (nil)
end
function self:GetLeft ()
return self.Left
end
function self:GetRight ()
return self.Right
end
function self:GetMembershipFunction ()
return self.MembershipFunction
end
function self:GetResult ()
return self.Result
end
function self:SetLeft (left)
if self.Left == left then return self end
local lastLeft = self.Left
self:UnhookSet (self.Left)
self.Left = left
self:HookSet (self.Left)
self:TestUpdateItems (lastLeft)
self:TestUpdateItems (self.Left)
return self
end
function self:SetRight (right)
if self.Right == right then return self end
local lastRight = self.Right
self:UnhookSet (self.Right)
self.Right = right
self:HookSet (self.Right)
self:TestUpdateItems (lastRight)
self:TestUpdateItems (self.Right)
return self
end
function self:SetMembershipFunction (membershipFunction)
if self.MembershipFunction == membershipFunction then return self end
self.MembershipFunction = membershipFunction or function (leftContains, rightContains, item) return false end
self:TestUpdateItems (self.Left)
self:TestUpdateItems (self.Right)
return self
end
function self:SetResult (result)
if self.Result == result then return self end
self.Result = result
self:TestUpdateItems (self.Left)
self:TestUpdateItems (self.Right)
return self
end
-- Internal, do not call
function self:HookSet (set)
if not set then return end
set:AddEventListener ("ItemAdded", "BinarySetOperatorController." .. self:GetHashCode (),
function (_, item)
self:TestUpdateItem (item)
end
)
set:AddEventListener ("ItemRemoved", "BinarySetOperatorController." .. self:GetHashCode (),
function (_, item)
self:TestUpdateItem (item)
end
)
end
function self:UnhookSet (set)
if not set then return end
set:RemoveEventListener ("ItemAdded", "BinarySetOperatorController." .. self:GetHashCode ())
set:RemoveEventListener ("ItemRemoved", "BinarySetOperatorController." .. self:GetHashCode ())
end
function self:TestUpdateItem (item)
if not self.Result then return end
if self.MembershipFunction (self.Left and self.Left:Contains (item) or false, self.Right and self.Right:Contains (item) or false, item) then
self.Result:Add (item)
else
self.Result:Remove (item)
end
end
function self:TestUpdateItems (enumerable)
if not enumerable then return end
if not self.Result then return end
for item in enumerable:GetEnumerator () do
self:TestUpdateItem (item)
end
end |
local md5 = require "md5"
local ut = require "lluv.utils"
local struct = require "lluv.pg.utils.bin"
local FSM = require "lluv.pg.utils.fsm"
local MessageEncoder = require "lluv.pg.msg".encoder
local MessageDecoder = require "lluv.pg.msg".decoder
local DataTypes = require "lluv.pg.types"
local utils = require "lluv.pg.utils"
local Error = require "lluv.pg.error"
local append, super = utils.append, utils.super
local PGServerError, PGProtoError = Error.ServerError, Error.ProtoError
local function on_server_error(fsm, event, ctx, data)
local err = MessageDecoder.ErrorResponse(data)
err = PGServerError.new(err)
ctx.on_error(ctx._self, err)
return ctx, err
end
local function on_protocol_error(fsm, event, ctx, data)
local err = PGProtoError.new(fsm:active(), event, data)
ctx.on_protocol_error(ctx._self, err)
return ctx, err
end
local function on_status(fsm, event, ctx, data)
local key, val = MessageDecoder.ParameterStatus(data)
ctx.on_status(ctx._self, key, val)
return ctx, key, val
end
local function on_notice(fsm, event, ctx, data)
local res = MessageDecoder.NoticeResponse(data)
ctx.on_notice(ctx._self, res)
return ctx, res
end
local function on_notify(fsm, event, ctx, data)
local pid, name, payload = MessageDecoder.NotificationResponse(data)
ctx.on_notify(ctx._self, pid, name, payload)
return ctx, pid, name, payload
end
local function on_ready(fsm, event, ctx, data)
local status = MessageDecoder.ReadyForQuery(data)
ctx.on_ready(ctx._self, status)
end
local function on_terminate(fsm, event, ctx, data)
ctx.on_send(ctx._self, MessageEncoder.Terminate())
ctx.on_terminate(ctx._self)
end
local function on_new_recordset(self, event, ctx, data)
local rows, n = MessageDecoder.RowDescription(data)
local cols, typs = {}, {}
for i, desc in ipairs(rows) do
cols[#cols + 1] = desc[1]
desc[1] = DataTypes.type_name(desc[2])
typs[#typs + 1] = desc
end
ctx.on_new_rs(ctx._self, {cols, typs})
end
local function on_data_row(self, event, ctx, data)
local row = MessageDecoder.DataRow(data)
ctx.on_row(ctx._self, row)
end
local function on_close_recordset(self, event, ctx, data)
local cmd, rows = MessageDecoder.CommandComplete(data)
ctx.on_close_rs(ctx._self, rows)
end
-- calls if execute empty query
local function on_empty_recordset(self, event, ctx, data)
ctx.on_empty_rs(ctx._self)
end
local function on_portal_suspended(self, event, ctx, data)
MessageDecoder.PortalSuspended(data)
ctx.on_suspended(ctx._self)
end
local function on_execute(self, event, ctx, data)
local cmd, rows = MessageDecoder.CommandComplete(data)
ctx.on_exec(ctx._self, rows)
end
local Base = ut.class() do
function Base:__init(opt)
self._self = opt and opt.self or self
return self
end
function Base:reset()
self._fsm:reset()
return self
end
function Base:step(event, data)
event, data = MessageDecoder.dispatch(event, data)
-- print("RECV EVENT:", event)
return self._fsm:step(event, self, data)
end
function Base:send(header, msg)
self.on_send(self._self, header, msg)
end
--- FSM need send data.
--
function Base:on_send(header, msg) end
--- Server return error message (ErrorResponse)
--
function Base:on_error(err) end
--- Server send change status message (ParameterStatus)
--
function Base:on_status(key, value) end
---
--
function Base:on_notice(note) end
---
--
function Base:on_notify(pid, channel, payload) end
--- Got unexpected message.
--
function Base:on_protocol_error(err) end
--- FSM done success (finit state)
--
function Base:on_ready() end
--- FSM fail (finit state)
-- Connection is in undefined state and should be closed
--
function Base:on_terminate() end
end
local function InitFSM(...)
local fsm = FSM.new(...)
-- ACTIONS
fsm:action("server_error", on_server_error)
fsm:action("protocol_error", on_protocol_error)
fsm:action("decode_status", on_status)
fsm:action("decode_notify", on_notify)
fsm:action("decode_notice", on_notice)
fsm:action("new_rs", on_new_recordset)
fsm:action("decode_row", on_data_row)
fsm:action("close_rs", on_close_recordset)
fsm:action("empty_rs", on_empty_recordset)
fsm:action("exec_complite", on_execute)
fsm:action("suspended", on_portal_suspended)
-- STATES
fsm:state("ready", on_ready)
fsm:state("terminate", on_terminate)
return fsm
end
local function InitState(a, b)
local err_state, t = a, b
if not t then err_state, t = nil, a end
local default = {
['*'] = {"protocol_error", "terminate" };
ParameterStatus = {"decode_status" };
NoticeResponse = {"decode_notice" };
NotificationResponse = {"decode_notify" };
}
if err_state then
default.ErrorResponse = {"server_error", err_state };
end
for k, v in pairs(default) do
if not t[k] then t[k] = v end
end
return t
end
local S = InitState
local Setup = ut.class(Base) do
local fsm = InitFSM("setup")
fsm:action("send_md5_auth", function(self, event, ctx, data)
local _, salt = MessageDecoder.AuthenticationMD5Password(data)
local user, password = ctx.on_need_password(ctx._self)
local digest = md5.digest(password .. user)
digest = "md5" .. md5.digest(digest .. salt)
ctx:send(MessageEncoder.PasswordMessage(digest))
end)
fsm:action("send_clear_auth", function(self, event, ctx, data)
MessageDecoder.AuthenticationCleartextPassword(data)
local user, password = ctx.on_need_password(ctx._self)
ctx:send(MessageEncoder.PasswordMessage(password))
end)
fsm:action("decode_pidkey", function(self, event, ctx, data)
local pid, key = MessageDecoder.BackendKeyData(data)
ctx.on_backend_key(ctx._self, pid, key)
end)
fsm:state("setup", S("terminate", {
BackendKeyData = {"decode_pidkey" };
ReadyForQuery = {nil, "ready" };
AuthenticationOk = {nil, "auth_done" };
AuthenticationMD5Password = {"send_md5_auth", "wait_auth_response" };
AuthenticationCleartextPassword = {"send_clear_auth", "wait_auth_response" };
}))
fsm:state("wait_auth_response", S("terminate", {
ReadyForQuery = {nil, "ready" };
AuthenticationOk = {nil, "auth_done"};
}))
fsm:state("auth_done", S("terminate", {
BackendKeyData = {"decode_pidkey" };
ReadyForQuery = {nil, "ready" };
}))
function Setup:__init(...)
self = super(Setup, self, '__init', ...)
self._fsm = fsm:clone():reset()
return self
end
function Setup:start(ver, opt)
self:send(MessageEncoder.greet(ver, opt))
self._fsm:start()
end
function Setup:on_backend_key(pid, key) end
function Setup:on_need_password() end
end
local SimpleQuery = ut.class(Base) do
local fsm = InitFSM("wait_response")
fsm:state("wait_response", S("error_recived", {
ReadyForQuery = {nil, "ready" };
EmptyQueryResponse = {"empty_rs" };
CommandComplete = {"exec_complite" };
RowDescription = {"new_rs", "wait_row_data" };
}))
fsm:state("wait_row_data",S("error_recived", {
ReadyForQuery = {nil, "ready" };
DataRow = {"decode_row" };
CommandComplete = {"close_rs", "wait_response" };
}))
fsm:state("error_recived", S("error_recived", {
['*'] = {};
ReadyForQuery = {nil, "ready" };
}))
function SimpleQuery:__init(...)
self = super(SimpleQuery, self, '__init', ...)
self._fsm = fsm:clone():reset()
return self
end
function SimpleQuery:start(qry)
self:send(MessageEncoder.Query(qry))
self._fsm:start()
end
function SimpleQuery:on_new_rs(desc) end
function SimpleQuery:on_row(desc) end
function SimpleQuery:on_close_rs(rows) end
function SimpleQuery:on_empty_rs() end
function SimpleQuery:on_exec(rows) end
end
local Idle = ut.class(Base) do
local fsm = InitFSM("wait")
fsm:state("wait", S{})
function Idle:__init(...)
self = super(Idle, self, '__init', ...)
self._fsm = fsm:clone():reset()
return self
end
function Idle:start()
self._fsm:start()
end
end
local Prepare = ut.class(Base) do
local fsm = InitFSM("wait")
fsm:action("decode_params", function(self, event, ctx, data)
local typs = MessageDecoder.ParameterDescription(data)
ctx.on_params(ctx._self, typs)
end)
fsm:state("wait", S("describe", {
ParseComplete = {nil, "describe" };
}))
fsm:state("describe", S("describe", {
ParameterDescription = {"decode_params" };
RowDescription = {"new_rs" };
NoData = {};
ReadyForQuery = {nil, "ready" };
}))
function Prepare:__init(...)
self = super(Prepare, self, '__init', ...)
self._fsm = fsm:clone():reset()
return self
end
function Prepare:start(name, sql, opt)
self:send(MessageEncoder.Parse(name, sql, opt))
self:send(MessageEncoder.Describe("S", name))
self:send(MessageEncoder.Sync())
self._fsm:start()
end
function Prepare:on_new_rs() end
function Prepare:on_params() end
end
local Execute = ut.class(Base) do
local fsm = InitFSM("binding")
fsm:state("binding", S("closing", {
BindComplete = {nil, "describing" };
}))
fsm:state("describing", S("closing", {
-- Describe portal response
RowDescription = {"new_rs", "fetching" };
NoData = {};
-- Execute responses
CommandComplete = {"exec_complite", "closing" };
EmptyQueryResponse = {"empty_rs", "closing" };
-- Execute responses if we do not send Describe
DataRow = {"decode_row", "fetching" };
PortalSuspended = {"suspended", "closing" };
}))
fsm:state("fetching", S("closing", {
DataRow = {"decode_row" };
PortalSuspended = {"suspended", "closing" };
CommandComplete = {"close_rs", "closing" };
}))
fsm:state("closing", S("wait_ready", {
ReadyForQuery = {"send_close", "wait_ready" };
}))
fsm:state("wait_ready", S("wait_ready", {
CloseComplete = {};
ReadyForQuery = {nil, "ready" };
}))
fsm:action("send_close", function(self, event, ctx, data)
if ctx._portal ~= '' then
ctx:send(MessageEncoder.Close("P", ctx._portal))
end
-- Send sync to get `ReadyForQuery`
ctx:send(MessageEncoder.Sync())
end)
function Execute:__init(...)
self = super(Execute, self, '__init', ...)
self._fsm = fsm:clone():reset()
return self
end
function Execute:start(describe, portal, name, formats, values, rows)
self._portal = portal
self._fsm:start()
-- we have to send commands with sync
-- in other case tehre may be no response from server.
-- In my test without sync I did not get `BindComplete`
self:send(
MessageEncoder.Bind(portal, name, formats, values)
)
if describe then
self:send(
MessageEncoder.Describe("P", portal)
)
end
self:send(
MessageEncoder.Execute(portal, rows)
)
self:send(MessageEncoder.Sync())
end
function Execute:on_suspended() end
function Execute:on_empty_rs() end
end
local Close = ut.class(Base) do
local fsm = InitFSM("wait")
fsm:state("wait", S{
CloseComplete = {};
ReadyForQuery = {nil, "ready" };
})
function Close:__init(...)
self = super(Close, self, '__init', ...)
self._fsm = fsm:clone():reset()
return self
end
-- `P` portal
-- `S` prepared statement
function Close:start(typ, name)
assert(typ == 'S' or typ == 'P')
self._fsm:start()
self:send(MessageEncoder.Close(typ, name))
-- Send sync to get `ReadyForQuery`
self:send(MessageEncoder.Sync())
end
end
local MessageReader = ut.class() do
function MessageReader:__init(opt)
self._buf = ut.Buffer.new()
self._typ = nil
self._len = nil
self._self = opt and opt.self or self
return self
end
local function next_msg(self)
if not self._typ then
local header = self._buf:read(5)
if not header then return end
self._typ, self._len = struct.unpack(">c1I4", header)
assert(self._len >= 4, string.format("%q", self._typ) .. "/" .. tostring(self._len))
end
local data, typ = self._buf:read(self._len - 4), self._typ
if not data then return end
self._typ, self._len = nil
return typ, data
end
function MessageReader:append(data)
self._buf:append(data)
while true do
local typ, msg = next_msg(self)
if not typ then break end
local ret = self.on_message(self._self, typ, msg)
if not ret then break end
end
end
function MessageReader:close()
self._buf:reset()
self._buf, self._typ, self._len = nil
end
end
local FSMReader = ut.class(MessageReader) do
function FSMReader:__init(fsm)
self = super(FSMReader, self, '__init')
self._fsm = fsm
self._done = false
return self
end
function FSMReader:on_message(typ, data)
if not self._fsm:step(typ, data) then
self._done = true
return false
end
return true
end
function FSMReader:done()
return not not self._done
end
function FSMReader:reset(fsm)
if fsm then self._fsm = fsm end
self._done = false
return self
end
end
return{
Setup = Setup;
SimpleQuery = SimpleQuery;
Idle = Idle;
Prepare = Prepare;
Execute = Execute;
Close = Close;
MessageReader = MessageReader;
FSMReader = FSMReader;
}
|
require('style')
|
DDHT = {}
DDHT.__index = DDHT
function DDHT:create(pin, sample_rate)
local this = {
-- The pin number of the DHT sensor, cannot be 0, type of a number.
executing_pin = pin;
-- The reference to the global DHT object.
DHT = dht;
-- The last status that was determined when reading from the Ddht.
last_status = dht.OK,
last_response = nil,
-- if the chip component is ready to sample again or not.
can_sample_again = true,
-- the sample rate in milliseconds
sample_rate = sample_rate
}
setmetatable(this, DDHT)
if this.sample_rate == nil then
this.sample_rate = 2500
end
return this
end
-- Reads all raw data coming from any dht sensor including the dh11.
function DDHT:read_raw()
if not self.can_sample_again then
return self.last_response
end
local status, temp, humi, temp_dec, humi_dec self.DHT.read(self.executing_pin)
return self:process_response(status, temp, humi, temp_dec, humi_dec)
end
-- Reads raw information from all non-dht11 sensors.
function DDHT:read_raw_not_11()
if not self.can_sample_again then
return self.last_response
end
local status, temp, humi, temp_dec, humi_dec = self.DHT.readxx(self.executing_pin)
return self:process_response(status, temp, humi, temp_dec, humi_dec)
end
-- Reads as if its a DHT11, taking the response status, temp and humdi with all its decimal values.
-- Followed by post processing.
function DDHT:read()
if not self.can_sample_again then
return self.last_response
end
local status, temp, humi, temp_dec, humi_dec = self.DHT.read11(self.executing_pin)
return self:process_response(status, temp, humi, temp_dec, humi_dec)
end
-- process_response does some post read processing, ensuring tot track the status for internal
-- referencing and formatting the repsonse into a easily handled object over multiple properties.
function DDHT:process_response(status, temp, humi, temp_dec, humi_dec)
self.last_status = status;
self.last_response = {
temperature = temp,
temperature_decimal = temp_dec,
humidity = humi,
humidity_decimal = humi_dec
}
-- start the sample timer, which will allow the sensor sampling rate to be respected. Otherwise we
-- can get unexpected results back from the sensor.
self:start_sample_timer()
return self.last_response
end
function DDHT:start_sample_timer()
local pwm_timer = tmr.create()
self.can_sample_again = false
pwm_timer:alarm(self.sample_rate, tmr.ALARM_SINGLE, function ()
self.can_sample_again = true
end)
end
-- returns true if the last sensor was ok.
function DDHT:is_ok()
return self.last_status == self.DHT.OK
end
-- returns true if the last sensor was not ok.
function DDHT:is_error()
return self.last_status ~= self.DHT.OK
end
-- returns true if the sensor is reporting the data otherwise false for no real value is being
-- reported.
function DDHT:is_reporting()
return self.last_response ~= nil and self.last_response.temperature ~= -999 and self.last_response.humidity ~= -999
end
-- retuns the last returned status from the chip or dht module, otherwise nil.
function DDHT:get_status()
return self.last_status
end
-- returns a string based message for a given status. OK, ERROR_CHECKSUM, ERROR_TIMEOUT errors.
-- Otherwise UNKNOWN.
function DDHT:status_string()
if self.last_status == self.DHT.OK then
return "OK"
elseif self.last_status == self.DHT.ERROR_CHECKSUM then
return "CHECKSUM ERROR"
elseif self.last_status == self.DHT.ERROR_TIMEOUT then
return "TIMEOUT ERROR"
end
return "UNKNOWN"
end
return DDHT |
local create_server = require "nvim-lsp-installer.servers.vscode-langservers-extracted"
return create_server("jsonls", "vscode-json-language-server")
|
-- Copyright 2012,2013 Green Code LLC
-- 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.
--
-- Contributors:
-- James Domingo, Green Code LLC
-- ============================================================================
function main()
if not _ACTION or _ACTION == "help" then
printHelp()
return 0
end
if _ACTION ~= "install" then
print('Error: invalid action \"'.._ACTION..'"')
printHelp()
return 1
end
if # _ARGS == 0 then
print("No configurations specified on command line.")
printHelp()
return 0
end
installDir = "../build/install"
majorVersion, minorVersion = readMajorMinor("../SharedAssemblyInfo.cs")
majorMinor = majorVersion..'.'..minorVersion
releaseStatus = readFirstLine("release-status.txt")
GDALversion = readFirstLine("../third-party/GDAL/GDAL-version.txt")
GDALmajorMinor = string.match(GDALversion, "^(%d+\.%d+)")
print("Installing LANDIS-II "..majorMinor.." ("..releaseStatus..") with GDAL")
for _, config in ipairs(_ARGS) do
configInstallDir = installDir.."/"..config
installConfig(config)
end
return 0
end
-- ============================================================================
function printHelp()
local premakeName = path.getname(_PREMAKE_COMMAND)
print()
print("Usage: "..premakeName.." action [configurations]")
print()
print("ACTIONS")
print()
print(" install Install configuration(s) into ../build/install/CONFIG")
print(" help Display this message")
end
-- ============================================================================
function readMajorMinor(pathToAssemblyInfoSrc)
for line in io.lines(pathToAssemblyInfoSrc) do
local major, minor = string.match(line, 'AssemblyVersion%("(%d+).(%d+).*"%)')
if major then
return major, minor
end
end
return nil
end
-- ============================================================================
function readFirstLine(filePath)
for line in io.lines(filePath) do
return line
end
return nil -- if file is empty (no lines)
end
-- ============================================================================
-- Install a build configuration
function installConfig(config)
print("Installing "..config.." configuration into "..configInstallDir.."/ ...")
if not os.isdir("../build/"..config) then
print("Error: The "..config.." configuration has not been built")
return
end
installCount = 0
-- {InstallDir}/bin/
-- [../bin directory deleted during SDK purge; 17 Mar 2017, bmarron]
-- install { file="bin/landis.cmd", from="deploy/bin/" }
install { file="bin/landis-ii.cmd", from="deploy/bin/" }
install { file="bin/landis-{X.Y}.cmd", from="deploy/bin/landis-X.Y.cmd", replace={ ["{VERSION}"]=GDALmajorMinor } }
install { file="bin/landis-extensions.cmd", from="deploy/bin/" }
install { file="bin/landis-v{X}-extensions.cmd", from="deploy/bin/landis-vX-extensions.cmd" }
install { file="bin/uninstall-landis.cmd", from="deploy/bin/" }
install { file="bin/uninstall-landis.sh", from="deploy/bin/" }
install { file="bin/uninstall-extensions.cmd", from="deploy/bin/" }
-- {InstallDir}/vX/bin/
GDALcsharpVersion = getAssemblyVersion("../third-party/GDAL/managed/gdal_csharp.dll")
install { file="v{X}/bin/Landis.Console-{X.Y}.exe", from="build/"..config.."/Landis.Console-"..majorMinor..".exe" }
install { file="v{X}/bin/Landis.Console-{X.Y}.exe.config", from="console/Landis.Console-X.Y.exe.config",
replace={ ["{RELEASE}"]=releaseStatus,
["{GDAL_CSHARP_VERSION}"]=GDALcsharpVersion } }
install { file="v{X}/bin/Landis.Extensions.exe", from="build/"..config }
install { file="v{X}/bin/Landis.Extensions.exe.config", from="ext-admin/Landis.Extensions.exe.config" }
-- {InstallDir}/vX/bin/extensions/
install { file="v{X}/bin/extensions/Landis.Extensions.Dataset.dll", from="build/"..config }
-- {InstallDir}/vX/bin/X.Y/
install { file="v{X}/bin/{X.Y}/Landis.Core.dll", from="build/"..config }
install { file="v{X}/bin/{X.Y}/Landis.Core.Implementation.dll", from="build/"..config }
install { file="v{X}/bin/{X.Y}/log4net.dll", from="libs/" }
install { file="v{X}/bin/{X.Y}/Edu.Wisc.Forest.Flel.Util.dll", from="libs/" }
install { file="v{X}/bin/{X.Y}/Troschuetz.Random.dll", from="libs/" }
install { file="v{X}/bin/{X.Y}/Landis.SpatialModeling.dll", from="libs/" }
install { file="v{X}/bin/{X.Y}/Landis.Landscapes.dll", from="libs/" }
install { file="v{X}/bin/{X.Y}/Landis.RasterIO.dll", from="libs/" }
install { file="v{X}/bin/{X.Y}/Landis.RasterIO.Gdal.dll", from="libs/" }
install { file="v{X}/bin/{X.Y}/gdal_csharp.dll", from="third-party/GDAL/managed" }
install { file="v{X}/bin/{X.Y}/uninstall-list.txt", from="deploy/", replace={ ["{X}"]=majorVersion,
["{X.Y}"]=majorMinor } }
-- Workaround so that extensions requiring v6.0 will install on v6.1 26-NOV-2014
install { file="v{X}/bin/{X}.0/README-6-0.txt", from="deploy/", replace={ ["{X}"]=majorVersion,
["{X.Y}"]=majorMinor } }
-- {InstallDir}/GDAL/#.#/
install { dir="GDAL/"..GDALmajorMinor, source="third-party/GDAL/native/" }
-- {InstallDir}/vX/licenses/
-- install { file="v{X}/licenses/+NOTICE.txt", from="+NOTICE.txt" }
install { file="v{X}/licenses/Apache License 2.0.txt", from="third-party/log4net/LICENSE.txt" }
install { file="v{X}/licenses/GNU Lesser General Public License 2.1.txt", from="third-party/Troschuetz/LICENSE.txt" }
-- install { file="v{X}/licenses/LANDIS-II Binary License.rtf", from="deploy/windows/LANDIS-II_Binary_license.rtf" }
if installCount == 0 then
print("All installed files are up-to-date.")
end
end
-- ============================================================================
-- Install a file or directory
function install(info)
-- Install a file
if info.file then
-- The destination path is relative to the configuration's installation
-- directory.
local filePath = string.gsub(info.file, "{X.Y}", majorMinor)
filePath = string.gsub(filePath, "{X}", majorVersion)
local destPath = configInstallDir.."/"..filePath
-- The source path is relative to the project's root directory.
local srcPath = "../"..trimTrailingSlash(info.from)
if string.endswith(info.from, "/") and not os.isdir(srcPath) then
error('No such directory "'..srcPath..'"')
elseif os.isdir(srcPath) then
srcPath = path.join(srcPath, path.getname(destPath))
elseif not os.isfile(srcPath) then
error('No such file "'..srcPath..'"')
end
installFile(srcPath, destPath, info.replace)
-- Install a directory
elseif info.dir then
-- The destination path is relative to the configuration's installation
-- directory.
local destDir = configInstallDir.."/"..trimTrailingSlash(info.dir)
if os.isfile(destDir) then
error('"'..destDir..'" is not a directory')
end
if not os.isdir(destDir) then
makeDir(destDir)
end
-- The source directory is relative to the project's root directory.
local srcDir = "../"..trimTrailingSlash(info.source)
if not os.isdir(srcDir) then
error('No such directory "'..srcDir..'"')
end
copyDir(srcDir, destDir)
else
error("no file or directory specified")
end
end
-- ============================================================================
-- Trim trailing separator from a path string. Necessary because os.dir on
-- Windows doesn't work with a trailing slash (forward or backward).
function trimTrailingSlash(pathStr)
if pathStr:endswith("/") then
return pathStr:sub(1,-2)
else
return pathStr
end
end
-- ============================================================================
-- Install (copy) a file to a specific location if the file doesn't exist at
-- location or if the installed file is out-of-date.
function installFile(srcPath, destPath, textReplacements)
if os.isdir(destPath) then
error(destPath.." is a directory, not a file")
end
if isUpToDate(destPath, srcPath) then
return
end
local destDir = path.getdirectory(destPath)
if not os.isdir(destDir) then
makeDir(destDir)
end
if textReplacements then
copyFileAndReplaceText(srcPath, destPath, textReplacements)
else
if not os.copyfile(srcPath, destPath) then
error("Cannot copy "..srcPath.." to "..destPath)
end
end
print("Installed "..destPath)
if printFrom then
print(" from "..srcPath)
end
installCount = installCount + 1
end
-- ============================================================================
function copyDir(srcDir, destDir)
local filesInSrcDir = os.matchfiles(srcDir.."/*")
for i, srcPath in ipairs(filesInSrcDir) do
local destPath = destDir.."/"..path.getname(srcPath)
installFile(srcPath, destPath)
end
local dirsInSrcDir = os.matchdirs(srcDir.."/*")
for i, srcPath in ipairs(dirsInSrcDir) do
local destPath = destDir.."/"..path.getname(srcPath)
copyDir(srcPath, destPath)
end
end
-- ============================================================================
function makeDir(dirPath)
if os.mkdir(dirPath) then
print("Created directory "..dirPath.."/")
else
error("Cannot create directory "..dirPath.."/")
end
end
-- ============================================================================
-- Is a destination file up-to-date with a source file?
--
-- The destination file is up-to-date if its modification time is newer than
-- the source file's modification time, or their modification times and sizes
-- are both equal.
function isUpToDate(destPath, srcPath)
if os.isdir(destPath) then
error('"' .. destPath .. '" is a directory, not a file', 2)
elseif not os.isfile(destPath) then
return false
else
local destStat = os.stat(destPath)
local srcStat = os.stat(srcPath)
if srcStat.mtime < destStat.mtime then
-- destination file is newer
return true
elseif destStat.mtime < srcStat.mtime then
-- source file is newer
return false
else
-- mod times are equal; their sizes must also be equal.
return srcStat.size == destStat.size
end
end
end
-- ============================================================================
-- Copy a file and replace certain text strings in its contents.
function copyFileAndReplaceText(srcPath, destPath, textReplacements)
local outFile, errMessage = io.open(destPath, "w")
if not outFile then
error(errMessage)
end
if textReplacements == nil then
textReplacements = {}
end
for line in io.lines(srcPath) do
for text, replacement in pairs(textReplacements) do
line = string.gsub(line, text, replacement)
end
outFile:write(line.."\n")
end
io.close(outFile)
end
-- ============================================================================
-- Get the version number of an assembly.
function getAssemblyVersion(assemblyPath)
local scriptEngine = path.translate("../third-party/CS-Script/cscs.exe")
local outFileName = "assembly-version.txt"
assemblyPath = path.translate(assemblyPath)
local status = os.execute(scriptEngine.." /nl assembly-version.cs "..assemblyPath.." >"..outFileName)
if status ~= 0 then
error("Unable to get assembly version for '"..assemblyPath.."'")
end
local version = readFirstLine(outFileName)
return version
end
-- ============================================================================
exitCode = main()
os.exit(exitCode)
|
local Dta = select(2, ...)
Dta.Lang.English = {}
local English = Dta.Lang.English
----------------------------------------
--Help
----------------------------------------
---Intro------------------------------------------------------------------
English.Intro = {}
English.Intro.Label = "Intro"
English.Intro.Text1 = "\
Hello Dimensioneers!\
\
This Addon is the continuation of Dimension Tools, originally developed\
by Kikimora with the support of the Rift Dream Dimensions team.\
And Dimension Tools is an advancement of Dimension Toolbox by Arkzy.\
\
The following is a summary of the core features:\
\
<u>Tinker Tools Features:</u>\
- Compact user interface giving you more screen space when building dimensions.\
All the tools can be brought up individually with the buttons provided in\
the main window.\
\
- Move, scale and rotate hundreds of items at once precisely in various modes.\
(Though you must keep in mind that the more items you modify, the longer it\
takes to finish processing it.)\
\
- The functionality of the Copy/Paste tool ranges from transfering selected values\
between items with optional offset to cloning whole groups of items and placing\
multiple copies in your dimension directly from your bags and/or bank.\
\
- With the Load/Save feature you can choose between loading one of the\
default sets or your own saved sets. And for convenience you can place\
multiple copies of a saved set at once with an offset on the X, Y or X axis.\
\
- The Import/Export feature allows you to transfer your saved sets using a global file\
or via text copy and paste. Also supports importing Toolbox sets in text format.\
\
Thanks for all the support from the dimension community,\
and have fun building your dreams!"
English.Intro.Text2 = "<u>Change Log</u>\
For the changes please refer to the included Changelog.txt file.\
\
For a more detailed list of changes, you can also check the commit log at\
https://github.com/Lynx3d/dimension_tools/commits/master"
English.Intro.Text3 = ""
---Main-------------------------------------------------------------------
English.Main = {}
English.Main.Label = "Main"
English.Main.Text1 = "\
The tool button is where it all starts. Left-click it to open the main window,\
right-click it to drag it. The main window holds the basic information about\
the selected items along with the buttons to open up all the individual tools.\
\
Tinker Tools can only be opened inside of dimensions, unless you override\
this with the '/tt force' chat command."
English.Main.Text2 = "\
The item icon has a small 'x'-button to clear the selection, and a right-click\
on the icon will set a waypoint on the minimap.\
\
<u>Window Toggle Buttons:</u>\
- ?: Opens up this help window.\
- Move: A tool to move items in various modes.\
- Rotate: A tool to rotate items in various modes.\
- Scale: A tool to scale items in various modes.\
- Offset Calc.: A tool to determine offset values for proper item alignment.\
- Copy / Paste: A tool to copy and paste items with many options.\
- Load / Save: A tool to load and save structures. Also links to Import / Export.\
- Tribal Magic: A tool that allows you to move more freely.\
- Alfiebet: A text creation tool using standard building blocks.\
- Reskin: A tool to replace building blocks with a different appearance."
English.Main.Text3 = ""
---Move-------------------------------------------------------------------
English.Move = {}
English.Move.Label = "Move"
English.Move.Text1 = "\
The Move Window is where you modify the positions of the selected items."
English.Move.Text2 = "\
<u>Descriptions:</u>\
- X/Y/Z: Specifies the coordinates for the X/Y/Z axis.\
Empty fields will leave the associated axis unaffected.\
- Absolute: Moves the item(s) to the coordinates set in X,Y,Z.\
- Relative: Moves the item(s) with an offset from current position by the\
numbers set in X,Y,Z.\
- As Group: Treats the whole selection as one object with the selection center\
as position; only available in absolute mode.\
- Local Axes: Moves each item along its local axes. Local axis means the item's\
rotation is applied to the global axis, creating a coordinate system that rotates\
with the object. Since the item itself defines the origin, this is only available\
in relative mode.\
- Move: Starts the moving of the item(s).\
- Reset: Resets the item(s) to your current position."
English.Move.Text3 = ""
---Rotate-----------------------------------------------------------------
English.Rotate = {}
English.Rotate.Label = "Rotate"
English.Rotate.Text1 = "\
The Rotate Window is where you modify the Rotation of the selected item(s)."
English.Rotate.Text2 = "\
<u>Descriptions:</u>\
- Pitch: Specifies the rotation about the X axis.\
- Yaw: Specifies the rotation about the Y axis.\
- Roll: Specifies the rotation about the Z axis.\
- Absolute: Sets the item(s) rotation to the exact numbers you put in Pitch,\
Yaw and Roll.\
NOTE: While empty fields will use the current values, there is always more\
than one way to represent the same rotation. Rift may convert the angles if\
your input exceeds certain boundaries, and hence chance all 3 values, which\
may greatly confuse you on subsequent rotation adjustments. So it is highly\
recommended to not leave fields empty in absolute mode.\
- Relative: Rotates the item(s) with the numbers you set in Yaw, Pitch and\
Roll from the current rotation. So if current rotation is 30 degrees Yaw\
and you put 20 degrees in the Yaw box it will end up having a rotation\
of 50 degrees.\
- As Group: Treats the whole selection as one object. Note that since selections\
are temporary, there is no way to save a current rotation for the group.\
This has two consequences: This mode is only available in relative mode, and\
the rotation happens around the global axis.\
Note that you can rotate a single item around global axis too this way.\
- Rotate: Starts the rotation of the item(s).\
- Reset: Resets the item(s) Pitch, Yaw and Roll to 0 degrees."
English.Rotate.Text3 = ""
---Scale------------------------------------------------------------------
English.Scale = {}
English.Scale.Label = "Scale"
English.Scale.Text1 = "\
The Scale Window is where you modify the Scale of the selected item(s)."
English.Scale.Text2 = "\
<u>Descriptions:</u>\
- Scale: Specifies the scale factor for the selected item(s).\
- Absolute: Sets the scale of the item(s) to the exact number you put in.\
- Relative: Sets the scale of the item(s) to the current scale multiplied by\
the number you put in.\
- As Group: Treats the whole selection as one object. Note that since selections\
are temporary, there is no way to determine a current scale of the group,\
so it is only available in relative mode.\
Warning: Items have diverse scale limitations. If you exceed those, your group\
will fall apart, so to speak, because this mode also has to move items.\
- Scale: Starts the scaling of the item(s).\
- Reset: Resets the item(s) scale to 1."
English.Scale.Text3 = ""
---Copy and Paste---------------------------------------------------------
English.CopyandPaste = {}
English.CopyandPaste.Label = "Copy and Paste"
English.CopyandPaste.Text1 = "\
The Copy / Paste Tool is pretty versatile, and behaves a bit different\
depending on what you do.\
When you copy a single item, you can paste its values to any other item,\
the item type gets ignored in this case, and individual values can be excluded.\
But the real power lies in the ability to copy a group of items and paste an\
array with incremental offsets, using items from your inventory."
English.CopyandPaste.Text2 = "\
You can disable and enable any of the offsets by clicking the selection box\
in front of the text fields. When pasting to a single selected object, this\
also controls which properties are transferred to the selected item.\
\
<u>Descriptions:</u>\
- Offset X, Y, Z: Sets the offset for the X, Y, Z axis for the item(s) you\
are going to paste the clipboard to.\
- Offset Pitch, Yaw, Roll: Sets the rotation offset for the Pitch, Yaw,\
Roll axis for the item(s) you are going to paste the clipboard to.\
For single items, the values are simply added to the original values.\
For item groups or when a pivot is used, the items get transformed using the\
global coordinate axis.\
- Offset Scale: Sets the scale change for the paste. For example, 0.2 will make\
the placed copy 20% larger, and -0.2 consequently 20% smaller.\
- Offset multiple items: Makes it possible to paste an array by iteratively adding\
the offsets to the values of the previously placed copy. This accepts either\
a count or a range in the form first:last. So 5 is equivalent to 1:5. First and\
last may be zero or even negative. This way you can include the original position\
with 0:5, extend a previously pasted array like 6:10 for 5 more copies, inverse\
the direction with -1:-5 etc.\
- Flicker reduction: This adds a small quasi-random offset to each placed copy to\
prevent visual flickering from overlapping coplanar parts (Z-fighting).\
The input field lets you adjust the amplitude of the offset sequence.\
- Custom Pivot: This causes rotation and scaling to be calculated relative to the\
point you picked (see below for details).\
- Use New Items: Activates the possibility to place new items from your bags or\
bank into your dimension. Your inventory will be scanned to ensure you have\
enough items before the pasting begins\
- Copy: Copies the stats of the items you have selected to clipboard.\
- Paste: Pastes the clipboard according to the settings you made.\
This may take a while when placing many new items.\
\
Depending on the settings, additional controls become available, as seen below:"
English.CopyandPaste.Text3 = "\
<u>Descriptions of additional options:</u>\
- Nr. of Copies: This will be showing up when Offset multiple items is activated.\
- Pick: This button is available when Custom Pivot is active and lets you record the\
position of your current selection. This lets you for example build a spiral\
staircase around a specific center point.\
The pivot is kept until you pick a new one (or leave the dimension), and doesn't\
change if you move or remove the item(s) afterwards.\
- Bags: Controls whether to include items from your bags to place new items.\
- Bank: Controls whether to include items from your bank (bags and vaults) to\
place new items. Note that this has limitations when you don't have\
actual bank access."
---Load and Save----------------------------------------------------------
English.LoadandSave = {}
English.LoadandSave.Label = "Load and Save"
English.LoadandSave.Text1 = "\
The Load / Save Sets window is all about saving the sets you created to be\
able to load them up on other places in your dimension or in other dimensions\
you have."
English.LoadandSave.Text2 = "\
<u>Descriptions:</u>\
- Name (Textbox): Here you set the name for the set you want to save.\
- Save Set: Saves the set to file.\
- Import/Export: Opens the Import/Export dialog (see next help topic)\
\
- Default Sets: Gives you the possibility to load the default sets provided\
by the RiftDreamDimensions team.\
These sets are tools created to aid you in your creativity.\
\
For a detailed guide on how to use these tools you can go to\
http://RiftDreamDimensions.com and take a look at the\
Dimension Tools PDF file.\
\
- Saved Sets: Gives you the possibility to load your own made sets into your\
Dimensions.\
- Tbx Sets: Gives you the possibility to load your old Toolbox Sets, explanation\
on how that works you find later in this help.\
\
- Search: Filters the drop-down below, refreshes when hitting 'return'.\
- Name (Drop-down): A list of all available set. Depending on if you have\
chosen Default Sets or Saved Sets the drop box will go to different lists.\
- Load Set: Loads the selected set into your dimension using items you have\
selected in your dimension or using items from your bags.\
- Print Materials: Print out a list of items needed for the selected set.\
- Delete Set: Removes the selected set from your saved list (only Saved Sets).\
- To Clipboard: This copies the set to the Copy&Paste clipboard, so you can paste\
it with that tool. This gives you more options, for example pasting multiple\
copies, but also allows using the Reskin tool to change materials before pasting.\
- Use New Items: This places new items from your inventory. Otherwise you need\
to have the required items placed and selected.\
- Load at original location: If this is selected, the set will be loaded with\
the coordinates it was originally saved with. Otherwise it will be loaded close\
to your current position, or if enabled, at your reference point.\
Only advisable when dimension keys of load and save match.\
\
- Use Reference Point: This option allows for more control over the placement of\
loaded sets. When saving a set, the picked point is simply saved along with the\
items of the set. When you later load this set, the set will be moved so that\
the saved reference point aligns with your current pick. If the set has no\
reference point, the center point of the set will be used instead.\
- Pick: This sets your current selection center as reference point."
English.LoadandSave.Text3 = "\
Tbx Sets is somewhat special. By default that set is empty, but for old Dimension\
Toolbox users this is a way to get your sets that you made with Dimension\
Toolbox to work within Tinker Tools as well.\
\
To get your old sets loaded into Dimension Tools you need to do the following:\
1: Locate the tbx.lua File, found under:\
/Users/[YourName]/Documents/RIFT/Interface/Saved/[YourRiftAccount]\
/SavedVariables\
2: Copy the file txb.lua into the same directory.\
3: Rename the new file to tbx_Import.lua\
4: Now start up rift and you should have all your old Dimension Toolbox Sets\
there to load up and place in your dimensions.\
\
Be aware you will not be able to remove any of the sets loaded under Tbx Sets,\
so I highly recommend that before you copy and rename the file go to Dimension\
Toolbox and delete all sets you don't want to use in Dimension Tools."
---Import and Export------------------------------------------------------
English.ImportandExport = {}
English.ImportandExport.Label = "Import and Export"
English.ImportandExport.Text1 = "\
The Import / Export Sets window is all about sharing your sets with other\
friends in the game.\
There are two ways to exchange sets, with the Dimension Tools export addon\
and by converting it to/from text you can copy/paste using the system clipboard.\
\
The Dimension Tools export is an embedded addon that uses saved variabls to\
exchange the data, the file will be named Dimtools_Export.lua\
Usually you will find that file at:\
C:/Users/%USERNAME%/My Documents/RIFT/Interface/Saved/SavedVariables\
Note that the default path depends on the Windows version and locale, and\
furthermore depends on the DocumentsDirectory variable in rift.cfg.\
But generally, Saved/ resides in the same directory as your Addons/ directory,\
which can be opened from Rift's addons configuration dialog."
English.ImportandExport.Text2 = "\
<u>Descriptions:</u>\
- Saved Sets: Sets the source for sets to your Tinker Tools saved sets.\
- Tbx Sets: Sets the source to your Toolbox sets that were auto-imported.\
- Name (First drop-down): Here you can select any of your own saved sets to\
be exported.\
- Export: Exports the selected set to the Dimtools_Export.lua file.\
- Export Text: Exports the selected set to the text box at the bottom.\
- Name (Second drop-down): Here you can select any of the sets saved in the\
export File.\
- New Name: Specify the name this set will have. Optional for Dimension Tools\
Import, mandatory for Text Import.\
- Import: Imports the selected set to your saved sets list and then removes\
the set from the export file.\
- Import Text: Imports the text from the text box at the bottom to your saved\
sets list. Also accepts the Dimension Toolbox format (auto-detected).\
\
When using Dimension Tools file export, keep in mind that addon data is not\
written to disk until addons are unloaded, so either logout or use the /reloadui\
chat command to save the data to Dimtools_Export.lua\
\
When you import from a foreign Dimtools_Export.lua file, you must not be logged in\
with your character when you copy it into the SavedVariables directory, otherwise\
it will be overwritten before you can import anything from it."
English.ImportandExport.Text3 = ""
---Tribal Magic-----------------------------------------------------------
English.TribalMagic = {}
English.TribalMagic.Label = "Tribal Magic"
English.TribalMagic.Text1 = "\
Tribal Magic is based on the Magic Carpet addon made by AladdinRift.\
Instead of an Ochre Rug it uses the smaller Round Tribal Table to give you\
more room to look around without seeing the edges of the item you fly on."
English.TribalMagic.Text2 = "\
<u>Descriptions:</u>\
- Place: places the Round Tribal Table in your dimension for flying.\
- Pick up: Picks up the Round Tribal Table from your dimension.\
- Slider: Changes the angle of the Round Tribal Table.\
0: Levels out the Round Tribal Table, so you can move around on the altitude\
you currently are.\
+1 to +4: The higher the number the more you will go upwards as you move.\
-1 to -4: The lower the number the more you will go downwards as you move.\
The slider can also be moved with the mouse wheel when the cursor is above it."
English.TribalMagic.Text3 = ""
---Reskin-----------------------------------------------------------------
English.Reskin = {}
English.Reskin.Label = "Reskin"
English.Reskin.Text1 = "\
The Reskin Tool replaces building blocks of one surface appearance (skin)\
with another skin of your choice.\
It works on the Copy / Paste clipboard, so before you can start, you need\
to copy something first. Note that you can also copy a saved set to the\
clipboard.\
When you're finished, you can paste the reskinned clipboard. You'll probably\
want to activate the 'Use New Items' option for this, and pick up the original\
structure if you're pasting at the original location."
English.Reskin.Text2 = "\
<u>Descriptions:</u>\
- Old Skin: The skin you want to replace.\
- New Skin: The skin that will replace the old one.\
- Checkboxes: Select the building block shapes you want to be included.\
- Apply: Applies the changes to the clipboard and prints a summary."
English.Reskin.Text3 = ""
---Afterword--------------------------------------------------------------
English.Afterword = {}
English.Afterword.Label = "Afterword"
English.Afterword.Text1 = "\
Many thanks to the Rift Community for supporting me. Your feedback\
and in-game donations have helped me a lot to stay motivated and continue\
from where Kikimora left Dimension Tools at.\
\
A lot of work was put into refactoring the old code, effectively making\
this a whole new addon.\
\
I hope you will enjoy the addon with its signifficant interface changes\
and keep making a lot of wonderful creations with it.\
For questions, errors, suggestions or other information about the addon you\
want to share, have a look at the Dimensions section of the Rift forums.\
\
Special Thanks:\
AladdinRift, for allowing to integrate his code from Magic Carpet into\
Dimension Tools.\
\
The Translators:\
Aeryle, French translations.\
Thanks for continuing to work on the translation for this remake of the\
Dimension Tools addon.\
\
A little word from Aeryle:\
It was a pleasure for me to translate this Add-on in French.\
I hope the French Dimension community will enjoy it and i hope this\
translation will allow them to use this add-on more easily!"
English.Afterword.Text2 = ""
English.Afterword.Text3 = ""
---Offset Calc.-----------------------------------------------------------
English.OffsetCalc = {}
English.OffsetCalc.Label = "Offset Calc."
English.OffsetCalc.Text1 = "\
The Offset Calculator is a tool you can use to see what offset is need to\
place building blocks seamlessly against each other.\
This tool has come to life because of questions about how you determine the\
offset of a building block."
English.OffsetCalc.Text2 = "\
- Shape: Here you choose the type of item you want the offset for.\
Supported shapes: Pole, Square, Cube, Plank, Rectangle and Floors.\
- Orientation: Here you choose the orientation of an item.\
Supported are all 6 possible +/- 90° rotation combinations.\
For arbitrarily rotated items, Transformed X, Y and Z Offset give the\
vector that represents the item's local X, Y or Z vector respectively.\
A special case is 'Selection Delta', this does not work on the\
shape of an item, but calculates the differences between two\
selected items, and hence ignores the Shape and Scale setting.\
- Scale: Here you set the scale of the item.\
- Multiplier: Optional input. If present, the result will be multiplied\
by this value.\
- Calculate: Calculates the offsets for you.\
- X: The offset on the X axis.\
- Y: The offset on the Y axis.\
- Z: The offset on the Z axis.\
- Detect: This tries to detect all parameters from the item selection."
English.OffsetCalc.Text3 = ""
---Alfiebet-----------------------------------------------------------
English.Alfiebet = {}
English.Alfiebet.Label = "Alfiebet"
English.Alfiebet.Text1 = "\
Going through allot of dimensions over time one thing you see a lot, people\
writing words using different items. Some are really clear others are really\
bright using light sources to make them. But one thing they all have in common,\
people want to say something to their dimension visitors. That is why we as\
the RiftDreamDimensions team came up with the idea to make a word processor\
in Dimension Tools. And after a lot of thinking and work done by the\
RiftDreamDimensions team creating fonts for it we managed to get this tool\
working for you all to enjoy."
English.Alfiebet.Text2 = "\
- Word: This is where you type in the word you want in your dimension.\
- The tool only works with letters A to Z.\
- Font: This is where you choose what font you like to use.\
- Size: Here you can choose the size of the font.\
- Skin: Here you can choose what type of skin you want to give your word.\
- Place Horizontal: Writes the word horizontal along the X axis.\
- Place Vertical: Writes the word vertical along the Y axis.\
- Load Word: places the word into your dimension.\
- Print Materials: Prints a list of items you need in your chat window.\
This list will adjust itself depending on what skin you choose."
English.Alfiebet.Text3 = ""
English.Selection = {}
English.Selection.Label = "Selection"
English.Selection.Text1 = "\
The Selection tool mainly helps you saving and restoring the selection state\
of placed items. Some tool actions also automatically save a set of the items\
they used. Note that item identifiers are only valid for one building session.\
If the dimension gets unloaded (when the last player leaves), IDs become invalid\
and new ones are generated when you enter again. Consequently these sets are not\
saved when you log out, they are only temporary."
English.Selection.Text2 = "\
- Save Set: Saves your current selection\
- Load Set: Selects all items in the set. Currently selected items will remain\
selected so you can combine selections as you please.\
- Name (drop-down): Lists all saved sets, including automatically created ones.\
Automatically saved are your last copy selection, and the items placed by your\
last paste and set loading.\
- Delete Set: Delete a saved set.\
- Invert: This inverts the selection state of all items, i.e. what's currently\
selected will be unselected, and what's unselected will be selected. So if\
nothing is selected, this will attempt to select everything (selecting requires\
items to be in vewing range too).\
*WARNING*: Attempting to modify too many items with Rift's own tools will cause\
disconnects, losing all temporary data of your building session like TT's clipboard\
and selection sets.\
- Pick Up: This does the same thing as Rift's Pick Up button. But this function\
can handle large item counts without disconnect, you're only limited by the\
bag space you have."
English.Selection.Text3 = ""
----------------------------------------
--Buttons
----------------------------------------
English.Buttons = {}
English.Buttons.MoveWindow = "Move"
English.Buttons.RotateWindow = "Rotate"
English.Buttons.ScaleWindow = "Scale"
English.Buttons.CopyPaste = "Copy / Paste"
English.Buttons.LoadSave = "Load / Save"
English.Buttons.ImportExport = "Import / Export"
English.Buttons.TribalMagic = "Tribal Magic"
English.Buttons.OffsetCalc = "Offset Calc."
English.Buttons.Reskin = "Reskin"
English.Buttons.Selection = "Selection"
English.Buttons.Copy = "Copy"
English.Buttons.Paste = "Paste"
English.Buttons.Pick = "Pick"
English.Buttons.Import = "Import"
English.Buttons.ImportText = "Import Text"
English.Buttons.Export = "Export"
English.Buttons.ExportText = "Export Text"
English.Buttons.Place = "Place"
English.Buttons.PickUp = "Pick Up"
English.Buttons.SaveSet = "Save Set"
English.Buttons.LoadSet = "Load Set"
English.Buttons.RemoveSet = "Delete Set"
English.Buttons.PrintMaterials = "Material List"
English.Buttons.ToClipboard = "To Clipboard"
English.Buttons.Move = "Move"
English.Buttons.Reset = "Reset"
English.Buttons.Rotate = "Rotate"
English.Buttons.Scale = "Scale"
English.Buttons.Calculate = "Calculate"
English.Buttons.Detect = "Detect"
English.Buttons.Transfer = "Transfer"
English.Buttons.LoadWord = "Load Word"
English.Buttons.Yes = "Yes"
English.Buttons.No = "No"
English.Buttons.OK = "OK"
English.Buttons.Cancel = "CANCEL"
English.Buttons.Apply = "Apply"
English.Buttons.More = "More..."
English.Buttons.Less = "Less..."
English.Buttons.InvertSelection = "Invert"
----------------------------------------
--Menus
----------------------------------------
English.Menus = {}
English.Menus.WindowStyle = { "Default", "Borderless" }
English.Menus.ItemType = {
"Cubes",
"Plank",
"Pole",
"Rectangle",
"Square",
"Floor",
"Hall Floor",
"Large Floor"
}
English.Menus.Orientation = {
"Default",
"Pitch 90",
"Yaw 90",
"Roll 90",
"Pitch & Yaw 90",
"Pitch & Roll 90",
"Selection Delta",
"Transformed X Offset",
"Transformed Y Offset",
"Transformed Z Offset"
}
----------------------------------------
--Titles
----------------------------------------
English.Titles = {}
English.Titles.Main = "Tinker Tools"
English.Titles.Move = "Move"
English.Titles.Rotate = "Rotate"
English.Titles.Scale = "Scale"
English.Titles.CopyPaste = "Copy / Paste Items"
English.Titles.LoadSave = "Load / Save Sets"
English.Titles.ImportExport = "Import / Export Sets"
English.Titles.TribalMagic = "Tribal Magic"
English.Titles.OffsetCalc = "Offset Calculation"
English.Titles.Help = "Tinker Tools Help"
English.Titles.Settings = "Settings"
English.Titles.TransferValues = "Transfer Values to:"
English.Titles.Reskin = "Replace Skins"
English.Titles.Selection = "Selection"
English.Titles.MaterialList = "Material List"
----------------------------------------
--Text
----------------------------------------
English.Text = {}
English.Text.Yaw = "Yaw"
English.Text.Pitch = "Pitch"
English.Text.Roll = "Roll"
English.Text.Scale = "Scale"
English.Text.NothingSelected = "Nothing selected"
English.Text.NrSelectItems = "Nr. of selected items:"
English.Text.MultiSelectItems = "%d items selected"
English.Text.Offset = "Offset"
English.Text.OffsetMultiItems = "Offset multiple items"
English.Text.FlickerReduce = "Flicker Reduction"
English.Text.UseNewItems = "Use New Items"
English.Text.SelectionPivot = "Custom Pivot"
English.Text.NrItems = "Nr. of Copies"
English.Text.Bags = "Bags"
English.Text.BankBags = "Bank"
English.Text.Vaults = "Vaults"
English.Text.DefaultSets = "Default Sets"
English.Text.SavedSets = "Saved Sets"
English.Text.TbxSets = "Tbx Sets"
English.Text.Name = "Name"
English.Text.Search = "Search"
English.Text.LoadOrigionalLocation = "Load at original location"
English.Text.UseRefPoint = "Use reference point"
English.Text.Absolute = "Absolute"
English.Text.Relative = "Relative"
English.Text.MoveAsGroup = "As group"
English.Text.LocalAxes = "Local Axes"
English.Text.Type = "Shape"
English.Text.Orientation = "Orientation"
English.Text.Word = "Word"
English.Text.Font = "Font"
English.Text.Size = "Size"
English.Text.Skin = "Skin"
English.Text.Horizontal = "Place Horizontal"
English.Text.Vertical = "Place Vertical"
English.Text.ConsoleMessages = "Console Messages"
English.Text.WindowStyle = "Window Style"
English.Text.RestoreTools = "Remember opened Tools when closing\nMain Window"
English.Text.NotIdleNotification = "Previous operation has not finished yet.\nAbort currently running operation now?"
English.Text.ConfirmDeleteSet = "Delete item set '%s'?"
English.Text.ConfirmOverwrite = "The set '%s' already exists.\nOverwrite this set?"
English.Text.ConfirmUsePosition = "The original position of this set is %.1fm away.\nContinue operation?"
English.Text.ConfirmPickup = "Are you sure you want to pick up all selected items?"
English.Text.ConfirmInvSelect = "Handling too many items may cause disconnects.\nSelect %d items?"
English.Text.Invert = "Inverse Direction"
English.Text.OldSkin = "Old Skin"
English.Text.NewSkin = "New Skin"
English.Text.Tile = "Square"
English.Text.Rectangle = "Rectangle"
English.Text.Triangle = "Triangle"
English.Text.Plank = "Plank"
English.Text.Cube = "Cube"
English.Text.Sphere = "Sphere"
English.Text.Pole = "Pole"
English.Text.Disc = "Disc"
English.Text.NewName = "New Name"
English.Text.Category = "Category"
English.Text.AnySkin = "<Any Skin>"
English.Text.Multiplier = "Multiplier"
----------------------------------------
--Prints
----------------------------------------
English.Prints = {}
--Main
English.Prints.DimensionOnly = "This addon is intended for use in Dimensions only."
English.Prints.ProcessFinished = "Processing Finished."
English.Prints.SetFinished = "Item set \"%s\" loaded and selected."
English.Prints.PasteFinished = "All items are placed and selected."
English.Prints.WordFinished = "The word is placed and selected."
--Copy / Paste
English.Prints.Copy_SelectItem = "Please select an item in order to copy attributes"
English.Prints.NumbersOnly = "Please enter numeric values only"
English.Prints.CopyFirst = "Please copy an item before pasting"
English.Prints.SelectItemSource = "Please select at least one source for new items"
English.Prints.NotPasteInventory = "Cannot paste clipboard - your inventory is missing the following items:"
English.Prints.NotPasteSelection = "Cannot paste clipboard - the selection is missing the following items:"
--Tribal Magic
English.Prints.NoRoundTable = "You do not seem to have an Round Tribal Table in your inventory!"
--Alfiebet
English.Prints.SelectFont = "Select a Font"
English.Prints.SelectSize = "Select a Size"
English.Prints.SelectSkin = "Select a Skin"
English.Prints.OnlyLetters = "Only letters allowed in the word"
English.Prints.TypeWord = "Please type a word first"
English.Prints.WordMissingItems = "Cannot build this word - the following items are missing from your bags:"
English.Prints.WordNeededItems = "The following items are required to create the word \"%s\":"
English.Prints.WordCouldNotPrint = "Could not print materials"
--Import/Export
English.Prints.SetNotFound = "Item set \"%s\" not found"
English.Prints.SelectExport = "You must select a set in order to Export it"
English.Prints.Exported = "Item set \"%s\" Exported"
English.Prints.SelectImport = "You must select a set in order to Import it"
English.Prints.Imported = "Item set \"%s\" Imported"
English.Prints.TextHint = "<Text input/output>\nCtrl+C: Copy\nCtrl+V: Paste\nCtrl+A: Select all\n"
--Load / Save
English.Prints.Saved = "Item set \"%s\" saved"
English.Prints.MinOneItem = "Must select 1 or more items in order to save them"
English.Prints.EnterName = "Must enter a name in order to save the set"
English.Prints.LoadNeededItems = "The following items are required for loading \"%s\":"
English.Prints.LoadPrintMats = "You must select a set in order to view its materials"
English.Prints.LoadSelectSet = "You must select a set in order to load it"
English.Prints.NotLoadedBags = "Cannot load set - the following items are missing from your bags:"
English.Prints.NotLoadedSelection = "Cannot load set - the following items are missing from your selection:"
English.Prints.SetLoaded = "Item set \"%s\" loaded"
English.Prints.SetRemoved = "Item set \"%s\" removed"
English.Prints.NotRemoved = "Could not remove \"%s\" - no such set found"
English.Prints.RemoveSelectSet = "You must select a set in order to remove it"
English.Prints.CopiedClipboard = "Item set \"%s\" has been copied to the Copy & Paste tool's clipboard."
English.Prints.PickRefPoint = "Please pick a reference point first."
English.Prints.NoRefPointWarn = "This item set has no reference point. Using center point instead."
--Measurements
English.Prints.SelectType = "Select a Type"
English.Prints.SelectOrientation = "Select an Orientation"
English.Prints.TypeSize = "Type a Size"
English.Prints.SizeC = "Make sure Size is between %.2f and %.1f"
English.Prints.Selection1 = "Transformed mode requires one selected item."
English.Prints.Selection2 = "Selection Delta requires two selected items."
--Move, Rotate, Scale
English.Prints.ModifyPosition = "Please select an item in order to modify its position"
English.Prints.ModifyRotation = "Please select an item in order to modify its rotation"
English.Prints.ModifyScale = "Please select an item in order to modify its scale"
--Reskin
English.Prints.ClipboardEmpty = "The Copy & Paste clipboard is empty."
English.Prints.Summary = "Replacement summary:"
|
local filters = require "kong.plugins.corax.filters"
local mocks = require "spec.mocks"
local PLUGIN_NAME = require("kong.plugins.corax").PLUGIN_NAME
describe(PLUGIN_NAME .. ": (filters) ", function()
local conf
before_each(function()
conf = {
request_method = {"GET", "POST"},
content_type = {"application/json"},
response_code = {"200", "404"}
}
end)
describe("request filters", function()
it("filters by request method", function()
local args = {"path", "host", "port", {}, "FOOBAR", {}}
local request = mocks.request(unpack(args))
assert.True(filters.by_request(conf, request))
end)
it("allows request method", function()
local args = {"path", "host", "port", {}, "GET", {}}
local request = mocks.request(unpack(args))
assert.False(filters.by_request(conf, request))
end)
end)
describe("response header filters", function()
local headers = {
["content-type"] = "application/json; charset=utf-8",
["foo"] = "bar"
}
it("filters by status code", function()
local res = mocks.response(418, headers)
assert.True(filters.by_response(conf, res))
end)
it("allows by status code", function()
local res = mocks.response(200, headers)
assert.False(filters.by_response(conf, res))
end)
it("filters by content type", function()
conf.content_type = {"text/plain"}
local res = mocks.response(200, headers)
assert.True(filters.by_response(conf, res))
end)
it("allows by content type", function()
local res = mocks.response(200, headers)
assert.False(filters.by_response(conf, res))
end)
end)
end)
|
function zb_sailInfo()
resetGUI()
local text = "Welcome the new SAIL window! In addition to the new look, this rework can:\n\n > View non-vanilla currencies (Which cannot be displayed in the inventory because of hardcoded limitations)\n\n > Missions are split into main, and secondary tabs, as well as notifying you which are replays\n\n > You get a little bit more info about crew\n\n > Easy-to-add custom functions called through button in the 'Misc.' menu (There are instructions in FU's files located at /interface/scripted/fu_sail/user)\n\nNote that currently, the window is unaffected by customizable SAIL, but will be in the near future."
textTyper.init(cfg.TextData, text)
end
function zb_skipStarterCrap()
local quests = {"gaterepair", "shiprepair", "human_mission1", "mechunlock", "outpostclue"}
local str = "Quest IDs:"
for _, quest in ipairs(quests) do
if not player.hasCompletedQuest(quest) then
player.startQuest(quest)
str = str.."\n"..quest
end
end
resetGUI()
textTyper.init(cfg.TextData, "[(instant)"..str.."]")
end |
--[[
Filter target, then use a hidden channel to tp
]]
local tent = Entities:FindByClassname(nil, "npc_dota_tower")
--[[function OnSpellStart(keys)
print("oss called by" .. keys.caster:GetClassname())
local caster = keys.caster
local channel = caster:FindAbilityByName("troll_hidden_tp_channel")
print(channel:GetClassname())
if keys.target and keys.target:GetClassname() == "npc_dota_tower" then
caster:CastAbilityOnTarget(keys.target, channel, 0)
else keys.ability:EndCooldown()
end
end]]
function OnSpellStart(keys)
print("oss called baaaay" .. keys.caster:GetClassname())
local caster = keys.caster
local channel = keys.ability
print(caster:GetClassname())
print(keys.target:GetClassname())
if caster == keys.target then
print("Atteempting stop...")
caster:Stop()
channel:EndCooldown()
elseif keys.target and keys.target:GetTeamNumber() == caster:GetTeamNumber() then
caster.tpTarget = keys.target
end
end
function OnSpellStart_Channel(keys)
print("called by" .. keys.caster:GetClassname())
if keys.target and keys.caster then keys.caster.tpTarget = keys.target end
end
function OnChannelFinish(keys)
print("ocf called by" .. keys.caster:GetClassname())
if keys.caster and keys.caster.tpTarget then
FindClearSpaceForUnit(keys.caster, keys.caster.tpTarget:GetOrigin(), true)
end
end
function OnChannelInterrupted(keys)
end
function TeleportCastFilter(target)
end |
--
-- Created by IntelliJ IDEA.
-- User: nander
-- Date: 03/03/2019
-- Time: 10:17
-- To change this template use File | Settings | File Templates.
--
--
-- Created by IntelliJ IDEA.
-- User: nander
-- Date: 01/03/2019
-- Time: 21:57
-- To change this template use File | Settings | File Templates.
--
local dist = function(pos1, pos2)
local xd = (pos1.x - pos2.x)
local yd = (pos1.y - pos2.y)
return math.sqrt(xd * xd + yd * yd)
end
return function()
local hovers
return {
onHover = function(x, y)
local xx, yy = CAM:toWorld(x, y)
hovers = nil
for k, v in pairs(F.station) do
if dist(v.position, { x = xx, y = yy }) < 100 then
hovers = v
end
end
end,
draw = function()
if hovers then
love.graphics.setColor(1,0,0,hovers.pauper/30)
CAM:draw(function()
love.graphics.arc( "fill", hovers.position.x, hovers.position.y, 100, math.pi, 2*math.pi )
love.graphics.setColor(165/255,42/255,42/255, hovers.dirt/10)
love.graphics.arc( "fill", hovers.position.x, hovers.position.y, 100, 0, math.pi )
love.graphics.setColor(1, 1, 1)
end)
end
end,
mousePressed = function()
if hovers then
MOUSEMISSED = false
end
end
}
end |
local e=epoe -- we cant be in epoe table or we'd need to add locals here on everything too
local TagHuman=e.TagHuman
-- For reloading
if ValidPanel(e.GUI) then e.GUI:Remove() end
local gradient = surface.GetTextureID( "VGUI/gradient_up" )
local epoe_font = CreateClientConVar("epoe_font", "BudgetLabel", true, false)
local epoe_draw_background = CreateClientConVar("epoe_draw_background", "1", true, false)
local epoe_show_in_screenshots = CreateClientConVar("epoe_show_in_screenshots", "0", true, false)
local epoe_keep_active = CreateClientConVar("epoe_keep_active", "0", true, false)
local epoe_max_alpha = CreateClientConVar("epoe_max_alpha", "255", true, false)
local epoe_always_clickable = CreateClientConVar("epoe_always_clickable", "0", true, false)
local epoe_links_mode = CreateClientConVar("epoe_links_mode", "1", true, false)
local epoe_parse_steamids = CreateClientConVar("epoe_parse_steamids", "1", true, false)
--- HELPER ---
local function CheckFor(tbl,a,b)
local a_len=#a
local res,endpos=true,1
while res and endpos < a_len do
res,endpos=a:find(b,endpos)
if res then
tbl[#tbl+1]={res,endpos}
end
end
end
local function make_url(url)
if epoe_parse_steamids:GetBool() then
if url:find"^76561[0123]%d%d%d%d+$" then
return 'http://steamcommunity.com/profiles/'..url
end
if url:find"^STEAM_0%:[01]:%d+$" then
local sid = util.SteamIDTo64(url)
if sid then return 'http://steamcommunity.com/profiles/'..sid end
end
end
end
local function SORT1(a, b)
return a[1] < b[1]
end
local function AppendTextLink(a, callback)
local result = { }
local checkpatterns = {
"https?://[^%s%\"]+",
"ftp://[^%s%\"]+",
"steam://[^%s%\"]+"
}
if epoe_parse_steamids:GetBool() then
table.insert(checkpatterns, "76561[0123]%d%d%d%d+")
table.insert(checkpatterns, "STEAM_0%:[01]:%d+")
end
hook.Run("EPOEAddLinkPatterns", checkpatterns)
for _, patt in pairs(checkpatterns) do
CheckFor(result, a, patt)
end
if #result == 0 then
return false
end
table.sort(result, SORT1)
local _l, _r
for k, tbl in next,result do
local l, r = tbl[1], tbl[2]
if not _l then
_l, _r = tbl[1], tbl[2]
continue
end
if l < _r then
table.remove(result, k)
end
_l, _r = tbl[1], tbl[2]
end
local function TEX(str)
callback(false, str)
end
local function LNK(str)
callback(true, str, make_url(str))
end
local offset = 1
local right
for _, tbl in pairs(result) do
local l, r = tbl[1], tbl[2]
local link = a:sub(l, r)
local left = a:sub(offset, l - 1)
right = a:sub(r + 1, -1)
offset = r + 1
TEX(left)
LNK(link)
end
TEX(right)
return true
end
--------------
local PANEL={}
function PANEL:Init()
-- Activity fade
self.LastActivity = RealTime()
self:SetFocusTopLevel( true )
self:SetCursor( "sizeall" )
self:SetPaintBackgroundEnabled( false )
self:SetPaintBorderEnabled( false )
self:DockPadding( 3, 6, 3, 3 )
local Cfg=vgui.Create( "DHorizontalScroller", self )
Cfg:DockMargin(-8,0,-8,4)
Cfg:SetOverlap( -4 )
Cfg:SetTall(16)
Cfg:Dock( TOP )
function Cfg:Paint()
surface.SetDrawColor(40 ,40 ,40,196)
surface.SetTexture( gradient )
surface.DrawTexturedRect(0,0,self:GetWide(),self:GetTall())
surface.SetDrawColor(40 ,40 ,40,196)
surface.DrawRect(0,0,self:GetWide(),self:GetTall())
return true
end
Cfg.OnMousePressed=function(_,...) self.OnMousePressed(self,...) end
Cfg.OnMouseReleased=function(_,...) self.OnMouseReleased(self,...) end
local Button = vgui.Create( "DButton" , self )
Button:SetText( "Login" )
function Button:DoClick()
epoe.AddSub()
end
Button:SizeToContents() Button:SetDrawBorder(false) Button:SetTall( 16 ) Button:SetWide( Button:GetWide( ) + 6 ) -- gah
Cfg:AddPanel( Button )
local Button = vgui.Create( "DButton" , self )
Button:SetText( "Logout" )
function Button:DoClick()
epoe.DelSub()
end
Button:SizeToContents() Button:SetDrawBorder(false) Button:SetTall( 16 ) Button:SetWide( Button:GetWide( ) + 6 ) -- gah
Cfg:AddPanel( Button )
local Button = vgui.Create( "DButton" , self )
Button:SetText( "Clear" )
function Button:DoClick()
e.ClearLog()
end
Button:SizeToContents() Button:SetDrawBorder(false) Button:SetTall( 16 ) Button:SetWide( Button:GetWide( ) + 6 ) -- gah
Cfg:AddPanel( Button )
local function CheckBox(txt,cvar)
local checkbox = vgui.Create( "DCheckBoxLabel" , self )
checkbox:SetText( txt )
checkbox:SetConVar( cvar )
checkbox:SizeToContents()
checkbox:SetMouseInputEnabled( true )
checkbox:SetKeyboardInputEnabled( true )
function checkbox.OnMouseReleased( _, mousecode )
self.pressing= false
return checkbox.Button:Toggle()
end
function checkbox.OnMousePressed( checkbox, mousecode )
self.pressing= true
-- return checkbox.Button.OnMousePressed( checkbox.Button, mousecode )
end
checkbox.Button.OnMouseReleased=checkbox.OnMouseReleased
checkbox.Label.OnMouseReleased=checkbox.OnMouseReleased
checkbox.Button.OnMousePressed=checkbox.OnMousePressed
checkbox.Label.OnMousePressed=checkbox.OnMousePressed
checkbox.m_iIndent=-16
checkbox.Button:SetAlpha(0)
checkbox:SetWide(checkbox:GetWide() -8 )
checkbox.Paint=function(checkbox,w,h)
if checkbox.Label:IsHovered() or checkbox:IsHovered() or checkbox.Button:IsHovered() then
surface.SetDrawColor(255,255,255,self.pressing and 150 or 55)
surface.DrawRect(0,h-2,w,2)
end
if checkbox:GetChecked() then
surface.SetDrawColor(109+9,207+9,246+9,100)
surface.DrawRect(0,h-2,w,2)
end
end
checkbox:SetTall( 16 )
Cfg:AddPanel( checkbox )
end
CheckBox("autologin","epoe_autologin")
CheckBox("time","epoe_timestamps")
CheckBox("to console","epoe_toconsole")
CheckBox("show on activity","epoe_show_on_activity")
CheckBox("no autoscroll","epoe_disable_autoscroll")
CheckBox("stay active","epoe_keep_active")
CheckBox("no HUD mode","epoe_always_clickable")
CheckBox("background","epoe_draw_background")
CheckBox("screenshots","epoe_show_in_screenshots")
local FontChooser = vgui.Create("DComboBox", Cfg )
local function AddFont(txt,name)
local ok=pcall(function() surface.SetFont(name) end)
if ok then
FontChooser:AddChoice(txt,name)
end
end
AddFont("Fixed","BudgetLabel")
AddFont("Fixed Shadow","DefaultFixedDropShadow")
AddFont("Fixed Tiny","DebugFixed")
AddFont("Even smaller","DebugFixedSmall")
AddFont("Smallest","HudHintTextSmall")
AddFont("Smaller","ConsoleText")
AddFont("Small","DefaultSmall")
AddFont("Chat","ChatFont")
AddFont("Big","Default")
AddFont("Bigger","HDRDemoText")
AddFont("Huge","DermaLarge")
AddFont("Huger","DermaLarge")
AddFont("TEST","BUTOFCOURSE")
function FontChooser.Think(FontChooser)
FontChooser:ConVarStringThink()
end
function FontChooser.PerformLayout(FontChooser,w,h)
DComboBox.PerformLayout(FontChooser,w,h)
FontChooser:SizeToContents()
FontChooser:SetTall(16)
FontChooser:SetWide(FontChooser:GetWide()+32)
Cfg:InvalidateLayout()
end
-- we're overriding big time
function FontChooser.OnSelect(FontChooser,_,_,font)
self.RichText:SetFontInternal(font)
local _ = self.RichText.SetUnderlineFont and self.RichText:SetUnderlineFont(font)
RunConsoleCommand("epoe_font",font)
end
FontChooser:SetConVar("epoe_font")
FontChooser:SizeToContents()
FontChooser:SetTall(16)
FontChooser:SetWide(FontChooser:GetWide()+32)
Cfg:AddPanel( FontChooser )
-- FEEL FREE TO CHANGE/FIX/REMOVE( :( ) THIS
local ok,err = pcall(function()
local PlaceChooser = vgui.Create("DComboBox", Cfg )
PlaceChooser:AddChoice("Wherever", "0")
PlaceChooser:AddChoice("Top Left", "1")
PlaceChooser:AddChoice("Top", "2")
PlaceChooser:AddChoice("Top Right", "3")
PlaceChooser:AddChoice("Left", "4")
PlaceChooser:AddChoice("Center", "5")
PlaceChooser:AddChoice("Right", "6")
PlaceChooser:AddChoice("Bottom Left", "7")
PlaceChooser:AddChoice("Bottom", "8")
PlaceChooser:AddChoice("Bottom Right", "9")
function PlaceChooser:Think()
self:ConVarStringThink()
PlaceChooser:SizeToContents()
PlaceChooser:SetTall(16)
PlaceChooser:SetWide(PlaceChooser:GetWide()+32)
end
function PlaceChooser:OnSelect(index, value, data)
LocalPlayer():ConCommand("epoe_autoplace " .. (index - 1))
end
PlaceChooser:ChooseOptionID((GetConVarNumber("epoe_autoplace") or 0) + 1)
PlaceChooser:SizeToContents()
PlaceChooser:SetTall(16)
PlaceChooser:SetWide(PlaceChooser:GetWide()+32)
Cfg:AddPanel( PlaceChooser )
end)
if not ok then ErrorNoHalt(err) end
self.uppermenu=Cfg
self.canvas=vgui.Create('EditablePanel',self)
local canvas=self.canvas
canvas:Dock(FILL)
self.RichText = vgui.Create('RichText',canvas)
local RichText=self.RichText
RichText:InsertColorChange(255,255,255,255)
RichText:SetPaintBackgroundEnabled( false )
RichText:SetPaintBorderEnabled( false )
RichText:SetMouseInputEnabled(true)
-- We'll keep it visible constantly but clip it off to make the richtext behave how we want
RichText:SetVerticalScrollbarEnabled(true)
RichText:Dock(FILL)
function RichText.HideScrollbar()
RichText.__background=false
RichText:DockMargin(0,0,-20,0)
end
function RichText.ShowScrollbar()
RichText.__background=true
RichText:DockMargin(0,0,0,0)
end
RichText:HideScrollbar()
function RichText:Paint()
if self.__background then
surface.SetDrawColor(70,70,70,40)
surface.DrawOutlinedRect(0,0,self:GetWide(),self:GetTall())
end
end
local function linkhack(self,id)
self:InsertClickableTextStart( id )
self:AppendText' '
self:InsertClickableTextEnd()
self:AppendText' '
end
RichText.AddLink=function(richtext,func,func2)
-- warning: infinitely growing list. fix!
richtext.__links=richtext.__links or {}
local id = table.insert(richtext.__links,func2)
richtext.__links[id]=func2
local cbid = "cb_"..tostring(id)
linkhack(richtext,cbid)
richtext:InsertClickableTextStart(cbid)
func(richtext)
richtext:InsertClickableTextEnd()
end
RichText.ActionSignal=function(richtext,key,value)
if key~="TextClicked" then return end
local id = value:match("cb_(.+)",1,true)
id=tonumber(id)
local callback = id and richtext.__links[id]
if callback then
callback(richtext,value)
return
end
end
self:ButtonHolding(false)
end
function PANEL:PostInit()
self.RichText:SetVerticalScrollbarEnabled(true)
local ok = pcall(function()
self.RichText:SetFontInternal( epoe_font:GetString() )
local _ = self.RichText.SetUnderlineFont and self.RichText:SetUnderlineFont(epoe_font:GetString())
end)
if not ok then
RunConsoleCommand("epoe_font","BudgetLabel")
self.RichText:SetFontInternal( "BudgetLabel" )
end
end
---------------------
-- Text manipulation
---------------------
-- We don't want a newline appended right away so we hack it up..
PANEL.__appendNL=false
function PANEL:AppendText(txt)
if self.__appendNL then
self.RichText:AppendText "\n"
end
if txt:sub(-1)=="\n" then
self.__appendNL=true
txt = txt:sub(1,txt:len()-1)
else
self.__appendNL=false
end
-- fix crashing from big texts
-- limit around 512,000
if #txt > 510000 then
txt = txt:sub(1, 510000) .. "..."
end
self.RichText:AppendText(txt)
end
function PANEL:AppendTextX(txt)
local lmode = epoe_links_mode:GetInt()
if lmode==0 then
return self:AppendText(txt)
end
local function func(link,url,real_url)
if url:len()==0 then return end
real_url = real_url or url
if link then
self.RichText:AddLink(
function()
self:ResetLastColor()
self:AppendText(url)
end,
function()
local lmode = epoe_links_mode:GetInt()
if lmode >= 2 then
SetClipboardText(real_url)
-- should probably print this on EPOE?
if lmode==2 then
LocalPlayer():ChatPrint("Copied to clipboard: "..real_url.." ")
end
end
if lmode==1 or lmode>2 then
local handled = hook.Run("EPOEOpenLink", real_url)
if not handled then
gui.OpenURL(real_url)
end
end
end
)
else
self:AppendText(url)
end
end
local res = AppendTextLink(txt,func)
if not res then
self:AppendText(txt)
end
end
function PANEL:Clear()
self.RichText:SetText ""
self.RichText:GotoTextEnd()
end
function PANEL:SetColor(r,g,b)
self.RichText:InsertColorChange(r,g,b,255)
self.RichText.lr = r
self.RichText.lg = g
self.RichText.lb = b
end
function PANEL:ResetLastColor(r,g,b)
local r = self.RichText.lr or r or 255
local g = self.RichText.lg or g or 255
local b = self.RichText.lb or b or 255
self.RichText:InsertColorChange(r,g,b,255)
end
---------------------
-- Visuals
---------------------
--[[function PANEL:PerformLayout()
self.RichText:InvalidateLayout()
end]]--
function PANEL:Paint(w,h)
-- cvar callback ffs
if self.Last_SetRenderInScreenshots ~= epoe_show_in_screenshots:GetBool() then
local new = epoe_show_in_screenshots:GetBool()
self.Last_SetRenderInScreenshots = new
self:SetRenderInScreenshots(new)
end
if self.__repeatact then
if self.__repeatact>RealTime() then
surface.SetDrawColor(180,230 ,255,196)
surface.DrawRect(0,0,3,6)
else
self.__repeatact = false
end
end
if not self.__holding and not epoe_draw_background:GetBool() and not self.being_hovered then return end
if self.__holding then
surface.SetDrawColor(40 ,40 ,40,196)
local q=16+4
surface.DrawRect(0,q,w,h-q)
-- header
surface.SetDrawColor(90,90,90,255)
surface.DrawRect(0,0,w,16)
if self.__highlight then
surface.SetDrawColor(35 ,35 ,35,255)
else
surface.SetDrawColor(30 ,30 ,30,255)
end
surface.DrawRect(1,1,w-2,16-2)
local txt="EPOE - Enhanced Perception Of Errors"
surface.SetFont"DebugFixed"
local w,h=surface.GetTextSize(txt)
surface.SetTextPos(3,8-h*0.5)
if self.__highlight then
surface.SetTextColor(255,255,255,255)
else
surface.SetTextColor(150,150,150,255)
end
surface.DrawText(txt)
else
surface.SetDrawColor(40 ,40 ,40,196)
surface.DrawRect(0,0,w,h)
end
return true
end
---------------------
-- Functionality
---------------------
function PANEL:ButtonHolding(isHolding)
self.__holding=isHolding
if isHolding then
self:DockPadding( 8, 16+4, 8, 8 )
self.being_hovered = true
self.RichText:ShowScrollbar()
self.uppermenu:Dock(TOP)
self.uppermenu:SetVisible(true)
self:FixPosition()
self:InvalidateLayout()
self:SetParent()
else
self.being_hovered = false
self.RichText:HideScrollbar()
self.uppermenu:Dock(NODOCK)
self:DockPadding( 0,0,0,0 )
self.uppermenu:SetVisible(false)
self:InvalidateLayout()
if not epoe_always_clickable:GetBool() then
self:ParentToHUD()
end
end
end
local epoe_ui_holdtime=CreateClientConVar("epoe_ui_holdtime","5",true,false)--seconds
local remainvisible=CreateClientConVar("epoe_ui_obeydrawing","1",true,false)
local fadespeed=CreateClientConVar("epoe_ui_fadespeed","3",true,false)--seconds
function PANEL:Think()
if not self.__starthack then
self.__starthack=true
self:PostInit()
end
local mx = gui.MouseX()
local my = gui.MouseY()
local px, py = self:GetPos()
if
mx > px and
mx < px + self:GetWide() and
my > py and
my < py + self:GetTall()
then
self.being_hovered = true
--self.RichText:PerformLayout()
else
--self.RichText:PerformLayout()
self.being_hovered = false
end
-- Hiding for gmod camera..
if remainvisible:GetBool() and hook.Call('HUDShouldDraw',GAMEMODE,"CHud"..TagHuman)==false and not self.being_hovered then self:SetAlpha(0) return end
if (self.Dragging) then
local x = mx - self.Dragging[1]
local y = my - self.Dragging[2]
--if ( self:GetScreenLock() ) then
x = math.Clamp( x, 0, ScrW() - self:GetWide() )
y = math.Clamp( y, 0, ScrH() - self:GetTall() )
--end
self:SetPos( x, y )
end
if ( self.Sizing ) then
local x = mx - self.Sizing[1]
local y = my - self.Sizing[2]
if ( x < 100 ) then x = 100 end
if ( y < 18 ) then y = 18 end
self:SetSize( x, y )
self:SetCursor( "sizenwse" )
return
end
if ( self.Hovered and
--self.m_bSizable and
mx > (self.x + self:GetWide() - 20) and
my > (self.y + self:GetTall() - 20) ) then
self:SetCursor( "sizenwse" )
return
end
if ( self.Hovered and my < (self.y + 20) ) then
self:SetCursor( "sizeall" )
self.__highlight=true
return
end
self.__highlight=false
self:SetCursor( "arrow" )
if self:IsActive() then self:Activity() end
local inactive_time = RealTime() - self.LastActivity
--print("inactive_time",inactive_time)
local epoe_ui_holdtime=epoe_ui_holdtime:GetInt()
local fadespeed=fadespeed:GetInt()
inactive_time = ( inactive_time - epoe_ui_holdtime ) * ( 255 / fadespeed )
--print("inactive_time post",inactive_time)
local alpha = 255 - ( (inactive_time >= 255 and 255) or (inactive_time <= 0 and 0) or inactive_time )
if alpha<=0 then
self:SetVisible(false)
self:SetAlpha(255)
end
local alphascale = 255
if not self.__highlight and not self.__holding then
alphascale = epoe_max_alpha:GetInt()
alphascale = alphascale >255 and 255 or alphascale<0 and 0 or alphascale
alphascale=alphascale/255
end
self:SetAlpha(math.ceil(alpha*alphascale))
end
function PANEL:OnMousePressed( mc )
if mc == MOUSE_RIGHT or ( gui.MouseX() > (self.x + self:GetWide() - 20) and
gui.MouseY() > (self.y + self:GetTall() - 20) ) then
self.Sizing = { gui.MouseX() - self:GetWide(), gui.MouseY() - self:GetTall() }
self:MouseCapture( true )
return
else
self.Dragging = { gui.MouseX() - self.x, gui.MouseY() - self.y }
self:MouseCapture( true )
return
end
end
function PANEL:FixPosition()
local x,y=self:GetPos()
local w,h=self:GetSize()
local sw,sh=ScrW(),ScrH()
local failed=false
if w > sw then
failed=true
w=sw
end
if h > sh then
failed=true
h=sh
end
if x > sw then
failed=true
x=0
end
if y > sh then
failed=true
y=0
end
if x+w > sw then
failed=true
x=sw-w
end
if y+h > sh then
failed=true
y=sh-h
end
if failed then
self:SetPos(x,y)
self:SetSize(w,h)
--self.RichText:AppendText"GUI: Recovered position after invalid values\n"
end
end
function PANEL:OnMouseReleased()
self.Dragging = nil
self.Sizing = nil
self:FixPosition()
local x,y=self:GetPos()
e.GUI:SetCookie("w",self:GetWide())
e.GUI:SetCookie("h",self:GetTall())
e.GUI:SetCookie("x",x)
e.GUI:SetCookie("y",y)
self:MouseCapture( false )
end
function PANEL:ToggleActive()
local state=epoe_keep_active:GetBool()
RunConsoleCommand("epoe_keep_active",state and "0" or "1")
e.internalPrint(state and "Fading Enabled" or "Fading Disabled")
end
function PANEL:IsActive()
if epoe_keep_active:GetBool() or self.being_hovered or self:HasFocus() or vgui.FocusedHasParent( self ) then return true end
end
-- Bring up if something happened.
function PANEL:Activity()
self:SetAlpha(255)
self.LastActivity=RealTime()
end
PANEL.OnCursorMoved=PANEL.Activity
function PANEL:Repeat()
self.__repeatact = RealTime()+0.01
end
vgui.Register( "EPOEUI", PANEL, "EditablePanel" )
function e.CreateGUI()
if not ValidPanel(e.GUI) then
e.GUI=vgui.Create('EPOEUI')
if not ValidPanel(e.GUI) then
return
end
e.GUI:SetCookieName("epoe2_gui")
local w = tonumber( e.GUI:GetCookie("w") ) or ScrW()*0.5
local h = tonumber( e.GUI:GetCookie("h") ) or ScrH()*0.25
local x = tonumber( e.GUI:GetCookie("x") ) or ScrW()*0.5 - w*0.5
local y = tonumber( e.GUI:GetCookie("y") ) or ScrH() - h
e.GUI:SetSize(w,h)
e.GUI:SetPos(x,y)
end
end
function e.ShowGUI(show)
e.CreateGUI()
e.GUI:SetVisible(show==nil or show)
e.GUI:Activity()
end
function e.ClearLog()
if ValidPanel( e.GUI ) then
e.GUI:Clear()
end
end
concommand.Add('epoe_clearlog', e.ClearLog)
-- Debug
concommand.Add('epoe_ui_remove',function()
if ValidPanel(e.GUI) then e.GUI:Remove() end
end)
local threshold = 0.35 -- I'm sorry if you can't click this fast!
local lastclick = 0
local function epoe_toggle(_,cmd,args)
if cmd=="+epoe" then
gui.EnableScreenClicker(true)
e.ShowGUI() -- also creates it
local egui=e.GUI
if ValidPanel(egui) then
local x,y=egui:LocalToScreen( )
x,y=x+egui:GetWide()*0.5,y+10
gui.SetMousePos(x,y)
if lastclick+threshold>RealTime() then -- Doubleclick
lastclick = 0 -- reset
e.GUI:ToggleActive()
else
lastclick=RealTime()
end
e.GUI:ButtonHolding(true)
end
else
gui.EnableScreenClicker(false)
e.GUI:ButtonHolding(false)
end
end
concommand.Add('+epoe',epoe_toggle)
concommand.Add('-epoe',epoe_toggle)
----------------------------
-- Hooking, timestamps, activity showing
----------------------------
local epoe_timestamps = CreateClientConVar("epoe_timestamps", "1", true, false)
local epoe_timestamp_format = CreateClientConVar("epoe_timestamp_format", "%H:%M", true, false)
local epoe_show_on_activity = CreateClientConVar("epoe_show_on_activity", "1", true, false)
local epoe_disable_autoscroll = CreateClientConVar("epoe_disable_autoscroll", "0", true, false)
local notimestamp = false
local prevtext
hook.Add( TagHuman, TagHuman..'_GUI', function(newText,flags,c)
flags = flags or 0
-- create the gui (if possible) so we can print epoe.api prints also regardless of subscription status
local ok,err = pcall(e.CreateGUI)
if not ok then ErrorNoHalt(err..'\n') end
if ValidPanel( e.GUI ) then
local epoemsg = e.HasFlag(flags,e.IS_EPOE)
if epoemsg then
e.ShowGUI() -- Force it
e.GUI:Activity()
end
if epoemsg or epoe_show_on_activity:GetBool() then
e.ShowGUI()
local same = prevtext==newText
prevtext=newText
if same then
e.GUI:Repeat()
end
e.GUI:Activity()
end
if epoe_timestamps:GetBool() then
if not notimestamp then
e.GUI:SetColor(100,100,100) e.GUI:AppendText( "[")
local formatted_stamp = os.date(epoe_timestamp_format:GetString())
e.GUI:SetColor(255,255,255) e.GUI:AppendText(formatted_stamp)
e.GUI:SetColor(100,100,100) e.GUI:AppendText( "] ")
end
notimestamp = not ( newText:Right(1)=="\n" ) -- negation hard
end
if epoemsg then
e.GUI:SetColor(255,100,100)
e.GUI:AppendText("[EPOE] ")
e.GUI:SetColor(255,250,250)
e.GUI:AppendTextX(newText.."\n")
notimestamp = false
return
end
-- did I really write this. Oh well...
if e.HasFlag(flags,e.IS_MSGC) and c and type(c) == "table" and type(c.r) == "number" and type(c.g) == "number" and type(c.b) == "number" then
e.GUI:SetColor(c.r, c.g, c.b)
elseif e.HasFlag(flags,e.IS_ERROR) then
e.GUI:SetColor(255,80,80)
elseif e.HasFlag(flags,e.IS_CERROR) then
e.GUI:SetColor( 234,111,111)
elseif e.HasFlag(flags,e.IS_MSGN) or e.HasFlag(flags,e.IS_MSG) then
e.GUI:SetColor( 255,181,80)
else
e.GUI:SetColor(255,255,255)
end
e.GUI:AppendTextX(newText)
if not epoe_disable_autoscroll:GetBool() and not e.GUI.being_hovered then
e.GUI.RichText:GotoTextEnd()
end
end
end)
|
module 'mock'
local defaultTextStyle = MOAITextStyle.new()
defaultTextStyle:setFont( getFontPlaceHolder() )
defaultTextStyle:setSize( 10 )
local textAlignments={
center=MOAITextBox.CENTER_JUSTIFY,
left=MOAITextBox.LEFT_JUSTIFY,
right=MOAITextBox.RIGHT_JUSTIFY
}
local function countLine(s)
local c = 0
for _ in s:gmatch('\n') do
c=c+1
end
return c
end
local function fitTextboxString( box, text, align)
local style = box:getStyle()
local size = style:getSize() * style:getScale()
local textSize = #text
local lines = countLine(text) + 1
if align=='center' then
box:setRect( rectCenter( 0, 0, size * textSize, size * lines * 1.4 ) )
elseif align=='right' then
box:setRect( rect( 0, 0, -size * textSize, -size * lines * 1.4 ) )
else
box:setRect( rect( 0, 0, size * textSize, -size * lines * 1.4 ) )
end
box:setString( text )
end
---TextBox declarative creator
function TextBox( option )
local box = MOAITextBox.new()
box:setYFlip ( true )
if option then
local style = option.style or defaultTextStyle
local hasfont = false
---font style
if style then
if type(style) == 'table' then
local defaultStyle = false
for k, v in pairs( style ) do
box:setStyle( k, v )
if not defaultStyle then defaultStyle = v end
if k=='default' then
hasfont = true
defaultStyle = v
end
end
if defaultStyle then
box:setStyle( defaultStyle )
end
else
box:setStyle(style)
end
else
local defaultSize = 20
if option.font then
hasfont = true
defaultSize = option.font.size or 20
box:setFont( option.font )
end
assert(hasfont,'No Font for textbox')
local size = option.size or defaultSize
box:setTextSize(size)
end
---format
if option.align then
box:setAlignment( textAlignments[ option.align ] )
end
if option.lineSpacing then
box:setLineSpacing( option.lineSpacing )
end
local text = option.text or option.string or ''
---rect
if option.rect then
local x,y,x1,y1 = unpack( option.rect )
if not x1 then x, y, x1, y1 = 0, 0, x, y end
box:setRect( x, y, x1, y1 )
else
if option.autofit ~= false and #text >1 then
fitTextboxString( box, text, option.align )
end
end
box:setString( text )
if not option.shader then option.shader='color-tex' end
setupMoaiProp( box, option )
end
return box
end
function setDefaultTextStyle( style )
defaultTextStyle = style
end
function getDefaultTextStyle()
return defaultTextStyle
end
--backward compatiblity?
function Entity:addTextBox( option )
return self:attach ( TextBox(option) )
end
updateAllSubClasses( Entity )
|
local Item = "ItemName"
local Quantity = 10
local Land = nil
for i,v in pairs(game.Workspace.Properties:GetChildren()) do
if v.Owner.Value == game.Players.LocalPlayer then
Land = v
break
end
end
if not Land then
for i,v in pairs(game.Workspace.Properties:GetChildren()) do
if v.Owner.Value == game.Players.LocalPlayer or v.Owner.Value == nil then
Land = v
game.ReplicatedStorage.Interaction.ClientIsDragging:FireServer(v)
break
end
end
end
function Spawn(Item)
local Info = {}
Info.Name = Item.Name
Info.Type = game.ReplicatedStorage.Purchasables.Structures.HardStructures.Sawmill2.Type
Info.OtherInfo = game.ReplicatedStorage.Purchasables.WireObjects.Wire.OtherInfo
local Points = {Land.OriginSquare.Position + Vector3.new(0,5,0), Land.OriginSquare.Position + Vector3.new(0,5,0)}
game.ReplicatedStorage.PlaceStructure.ClientPlacedWire:FireServer(Info, Points)
end
for i=1, Quantity do
Spawn(game.ReplicatedStorage.Purchasables:FindFirstChild(Item, true))
end |
local t = Def.ActorFrame{};
t[#t+1] = Def.ActorFrame{
LoadActor("base");
LoadActor("hl")..{
InitCommand=cmd(diffusealpha,0);
OnCommand=cmd(smooth,0.3;diffusealpha,1;diffuseshift;effectcolor1,color("1,1,1,1");effectcolor2,color("1,1,1,0");effectperiod,1);
};
};
return t;
|
local whw = {}
-- utility functions
-- return output of given command
whw.capture = function(cmd, raw)
local f = assert(io.popen(cmd, "r"))
local s = assert(f:read("*a"))
f:close()
if raw then return s end
s = string.gsub(s, "^%s+", "")
s = string.gsub(s, "%s+$", "")
s = string.gsub(s, "[\n\r]+", " ")
return s
end
whw.get_hostname = function()
return whw.capture("hostname")
end
whw.has_battery = function()
power_supply = whw.capture("ls /sys/class/power_supply/")
if power_supply == "" then
return false
end
return true
end
-- formatting
whw.colors = {
red = "#FF4C4C",
green = "#78AB46",
light_blue = "#ADD8E6"
}
whw.fg = function(text, args)
local span = "<span"
if args and args.color ~= nil then
span = span .. " color=\"" .. args.color .. "\""
end
if args and args.strikethrough == true then
span = span .. " strikethrough=\"true\""
end
span = span .. ">" .. text .. "</span>"
return span
end
return whw
|
Locales['en'] = {
['updating_information'] = '[%s] Updating player information....',
['waiting_information'] = '[%s] Waiting for database connection....',
['updated_information'] = '[%s] Player information updated....'
} |
highscoreList = {}
-- this is out here because it needs to be accessible before highscoreList:init() is called
highscoreList.file = 'highscores.txt'
function highscoreList:init()
self.leftAlign = 75
self.initialsInput = {' ', ' ', ' '}
self.selectorPos = 1
self.playerScore = 0
self.fromGame = false
self.scoreEntered = false
self.initialChar = true
end
function highscoreList:initializeScores()
self.scores = {}
if not love.filesystem.exists(self.file) then
self.scores = self:getDefaultScores()
else
self.scores = self:getScores()
end
self.maxScores = 10 -- how many high scores are stored
end
function highscoreList:enter(prev)
if prev == menu then -- hides the score enter
self.fromGame = false
else -- the menu would have no player data stored
self.fromGame = true
self.scoreEntered = false
self.initialChar = true
self.playerScore = game.highScore.currentScore
self.initialsInput = {' ', ' ', ' '}
self.selectorPos = 1
end
local bottomMargin = 60
self.back = Button:new("< BACK", self.leftAlign, love.graphics.getHeight() - bottomMargin)
self.back.activated = function()
if prev == restart then
state.pop()
state.switch(game)
else
state.switch(menu)
end
end
end
function highscoreList:leave()
end
function highscoreList:mousepressed(x, y, button)
self.back:mousepressed(x, y, button)
end
function highscoreList:keypressed(key)
if key == "escape" then
self.back.activated()
end
if self.fromGame then
if key == "return" then
if not self.scoreEntered then
self.scoreEntered = true
self.fromGame = false
self:checkScore()
end
end
if key == "left" then
if self.selectorPos > 1 then
self.selectorPos = self.selectorPos - 1
end
elseif key == "right" then
if self.selectorPos < 3 then
self.selectorPos = self.selectorPos + 1
end
end
if key == "backspace" then
if self.selectorPos > 1 then
self.selectorPos = self.selectorPos - 1
end
end
end
end
function highscoreList:deleteScores()
self.scores = self:getDefaultScores()
self:save()
end
function highscoreList:textinput(t)
if self.fromGame and not self.scoreEntered then
self.initialsInput [self.selectorPos] = t
if self.selectorPos < 3 then
self.selectorPos = self.selectorPos + 1
end
end
end
function highscoreList:update(dt)
self.back:update(dt)
end
function highscoreList:draw()
love.graphics.setFont(font[72])
love.graphics.setColor(1, 1, 1)
local x, y = love.graphics.getWidth()/2 - fontBold[72]:getWidth("HIGH SCORES")/2, 70
x, y = math.floor(x), math.floor(y)
love.graphics.print('HIGH SCORES', x, y)
love.graphics.setFont(font[32])
love.graphics.setColor(1, 1, 1)
local sep = 45
for i, scoreData in ipairs(self.scores) do
if i == 1 then
love.graphics.setFont(fontBold[36])
love.graphics.setColor(1, 1, 0)
elseif i == 2 then
love.graphics.setFont(fontBold[32])
love.graphics.setColor(192/255, 192/255, 192/255)
elseif i == 3 then
love.graphics.setFont(fontBold[32])
love.graphics.setColor(205/255, 127/255, 50/255)
else
love.graphics.setFont(fontLight[30])
love.graphics.setColor(255/255, 255/255, 255/255)
end
local line = scoreData.score
local x = love.graphics.getWidth()/2 + 15
local y = 200+(sep*(i-1))
x, y = math.floor(x), math.floor(y)
love.graphics.print(line, x, y)
line = string.upper(scoreData.initials)
x = love.graphics.getWidth()/2 - love.graphics.getFont():getWidth(line) - 15
x = math.floor(x)
love.graphics.print(line, x, y)
end
-- optimize! polish!
-- initials input
if self.fromGame then
local y = love.graphics.getHeight()/2
love.graphics.setColor(0, 0, 0, 96/255)
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
love.graphics.setColor(255/255, 255/255, 255/255)
love.graphics.rectangle("fill", 0, y-150, love.graphics.getWidth(), 300)
love.graphics.setColor(0, 0, 0)
local text = 'ENTER YOUR INITIALS'
love.graphics.setFont(font[24])
local textX, textY = love.graphics.getWidth()/2-font[24]:getWidth(text)/2, y - 100
textX, textY = math.floor(textX), math.floor(textY)
love.graphics.print(text, textX, textY)
local f = fontBold[72]
love.graphics.setFont(f)
local spacing = 20
local width = f:getWidth('W')
local height = f:getHeight() + 10
local x = love.graphics.getWidth()/2 - (spacing*3)/2 - (width*3)/2
for i = 1, 3 do
love.graphics.setLineWidth(2)
if i == self.selectorPos then
love.graphics.setColor(255/255, 0, 0)
else
love.graphics.setColor(0, 0, 0)
end
local dx = (width+spacing)*(i-1)
love.graphics.line(x + dx, y + height/2, x + dx + width, y + height/2)
local char = self.initialsInput[i]
char = string.upper(char)
local charWidth = f:getWidth(char)
love.graphics.setColor(0, 0, 0)
local x, y = x + dx + width/2 - charWidth/2, y - height/2
x, y = math.floor(x), math.floor(y)
love.graphics.print(char, x, y)
end
if not self.scoreEntered then
love.graphics.setFont(font[24])
love.graphics.setColor(0, 0, 0)
local text = 'Press enter to save your score!'
local textX, textY = love.graphics.getWidth()/2-font[24]:getWidth(text)/2, y + 85
textX, textY = math.floor(textX), math.floor(textY)
love.graphics.print(text, textX, textY)
end
end
self.back:draw()
end
function highscoreList:checkScore()
-- check if the score actually belongs in the scoreboard (top 10)
local playerInitials = self.initialsInput[1]..self.initialsInput[2]..self.initialsInput[3]
local playerScore = self.playerScore
if self:scoreIsValid(playerScore) then -- check if it belongs on the scoreboard
-- find where the score belongs
local pos = 1
if #self.scores > 0 then -- if there are no scores in the list, it will place the score at pos 1
for i = #self.scores, 1, -1 do
if self.scores[i].score >= playerScore then -- found where new score belongs, right below the first score it is lower than
pos = i+1
break
end
end
end
table.insert(self.scores, pos, {initials = playerInitials, score = playerScore})
if #self.scores > self.maxScores then -- if it's more than the max, it will only be one greater. so cut off the last score
table.remove(self.scores)
end
end
self:save()
end
function highscoreList:scoreIsValid(score)
-- evaluates true if the high score list is not full, or the score is greater than the lowest score
return ((#self.scores < self.maxScores) or (score > self.scores[self.maxScores].score)) and score > 0
end
function highscoreList:getDefaultScores()
-- default values on the scoreboard
local o = {
{
initials = 'IKR',
score = 7960,
},
{
initials = 'NTH',
score = 6653,
},
{
initials = 'ACE',
score = 3531
},
{
initials = 'AAA',
score = 1200
},
{
initials = 'KEK',
score = 572
},
{
initials = 'H8R',
score = 22
},
}
return o
end
function highscoreList:save()
local string = ''
for i, scoreData in ipairs(self.scores) do
string = string..scoreData.initials..' '..scoreData.score..'\n'
end
love.filesystem.write(self.file, string)
end
function highscoreList:getScores()
assert(love.filesystem.exists(self.file), 'Tried to load highscores file, but it does not exist.')
local highscores = {}
for line in love.filesystem.lines(highscoreList.file) do
if string.len(line) > 0 then
local name = string.sub(line, 1, 3)
local number = tonumber(string.sub(line, 5))
table.insert(highscores, {initials = name, score = number})
end
end
return highscores
end
|
---@meta
---@class cc.EaseSineOut :cc.ActionEase
local EaseSineOut={ }
cc.EaseSineOut=EaseSineOut
---*
---@param action cc.ActionInterval
---@return self
function EaseSineOut:create (action) end
---*
---@return self
function EaseSineOut:clone () end
---*
---@param time float
---@return self
function EaseSineOut:update (time) end
---*
---@return cc.ActionEase
function EaseSineOut:reverse () end
---*
---@return self
function EaseSineOut:EaseSineOut () end |
require "Polycode/Resource"
class "Cubemap" (Resource)
function Cubemap:Cubemap(...)
if type(arg[1]) == "table" and count(arg) == 1 then
if ""..arg[1]:class() == "Resource" then
self.__ptr = arg[1].__ptr
return
end
end
for k,v in pairs(arg) do
if type(v) == "table" then
if v.__ptr ~= nil then
arg[k] = v.__ptr
end
end
end
if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
self.__ptr = Polycore.Cubemap(unpack(arg))
Polycore.__ptr_lookup[self.__ptr] = self
end
end
function Cubemap:__delete()
Polycore.__ptr_lookup[self.__ptr] = nil
Polycore.delete_Cubemap(self.__ptr)
end
|
-- vessels_mtg/init.lua
minetest.register_alias("vessels:glass_bottle", "base_vessels:glass_bottle")
minetest.register_alias("vessels:steel_bottle", "base_vessels:steel_bottle")
minetest.register_alias("vessels:drinking_glass", "base_vessels:drinking_glass")
|
return
function(self)
self.indents_obj:init()
self.chunk_length = utf8.len(self.indents_obj.indent_chunk)
end
|
function onCreate()
makeAnimatedLuaSprite('static', 'tripletroublestuff/Phase3Static') --change to your static image path
addAnimationByPrefix('static', 'idle', 'Phase3Static instance 1', 24, false);
scaleObject('static', 4,4);
setProperty('static.alpha', 0.7);
setObjectCamera('static', 'hud')
setProperty('static.visible', false);
addLuaSprite('static');
objectPlayAnimation('static', 'idle', false);
end
function onEvent(name, v1, v2)
if name == 'static' then
setProperty('static.visible', true);
objectPlayAnimation('static', 'idle', false);
end
end
function onUpdate()
if getProperty('static.visible') == true and getProperty('static.animation.curAnim.finished') == true then
setProperty('static.visible', false);
end
end |
local ops = require("mongodbOps") --加载mongodb操作模块
local row = ops.rawRow() --当前数据库的一行数据,table类型,key为列名称
local action = ops.rawAction() --当前数据库事件,包括:insert、update、delete
local id = row["ID"] --获取ID列的值
local userName = row["USER_NAME"] --获取USER_NAME列的值
local password = row["PASSWORD"] --获取USER_NAME列的值
local createTime = row["CREATE_TIME"] --获取CREATE_TIME列的值
local result = {} -- 定义一个table
result["_id"] = id -- _id为MongoDB的主键标识
result["account"] = userName
result["password"] = password
result["createTime"] = createTime
result["source"] = "binlog" -- 数据来源
if action == "insert" then -- 只监听insert事件
ops.INSERT("t_user",result) -- 新增,第一个参数为collection名称,string类型;第二个参数为要修改的数据,talbe类型
end |
project "Engine.UI.GDI"
kind "StaticLib"
pchheader "ghuigdipch.h"
pchsource "src/ghuigdipch.cpp"
staticruntime "on"
dependson {
"Engine.Core",
"Engine.UI"
}
files {
"src/**.h",
"src/**.cpp"
}
includedirs {
"src",
includeDir["Engine.Core"],
includeDir["Engine.UI"],
includeDir["tinyxml2"]
}
|
--[[
MIT License
Copyright (c) 2019 Michael Wiesendanger
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.
]]--
--[[
GUI setup outline
---------- classFrame ----------
¦ ¦---- classScrollFrame -----¦ ¦
¦ ¦ ¦-- classContentFrame --¦ ¦ ¦
¦ ¦ ¦ ¦- classSpellFrame -¦ ¦ ¦ ¦
¦ ¦ ¦ ¦ 1 ¦ ¦ ¦ ¦
¦ ¦ ¦ ¦-------------------¦ ¦ ¦ ¦
¦ ¦ ¦ ¦- classSpellFrame -¦ ¦ ¦ ¦
¦ ¦ ¦ ¦ 2 ¦ ¦ ¦ ¦
¦ ¦ ¦ ¦-------------------¦ ¦ ¦ ¦
¦ ¦ ¦ ¦- classSpellFrame -¦ ¦ ¦ ¦
¦ ¦ ¦ ¦ n.. ¦ ¦ ¦ ¦
¦ ¦ ¦ ¦-------------------¦ ¦ ¦ ¦
¦-------------------------------¦
--]]
local mod = pvpw
local me = {}
mod.configurationMenu = me
me.tag = "ConfigurationMenu"
--[[
Currently active class configuration screen
]]--
me.classId = 0
--[[
The class configuration menu consists of multiple tabs. This module is responsible
for handling those tabs
]]--
local navigation = {
-- tab 1
[1] = {
["active"] = false,
["func"] = "spellWarnCastTab"
},
-- tab 2
[2] = {
["active"] = false,
["func"] = "spellWarnResistTab"
}
}
--[[
Callback for tab navigation buttons
]]--
function me.TabNavigationButtonOnClick()
local tabId = this:GetID()
local classId = this:GetParent():GetID()
if navigation[tabId].active then
-- window is already active
return
end
me.Reset()
me.ActivateTab(tabId, classId)
end
--[[
Activate a specific tab. Function is either called by an onclick event on one
of the tab buttons or initialy when the first tab is activated automatically
@param {number} position
@param {number} classId
]]--
function me.ActivateTab(position, classId)
if classId == nil then
local classFrame = getglobal(PVPW_CONSTANTS.ELEMENT_PVPW_CLASS_FRAME)
classId = classFrame:GetID()
end
navigation[position].active = true
getglobal(PVPW_CONSTANTS["ELEMENT_PVPW_CLASS_CONFIGURATION_BUTTON_" .. position]):LockHighlight()
mod[navigation[position]["func"]].Init(classId)
end
--[[
Reset navigation before activating a new tab
]]--
function me.Reset()
for index, value in pairs(navigation) do
navigation[index].active = false
getglobal(PVPW_CONSTANTS["ELEMENT_PVPW_CLASS_CONFIGURATION_BUTTON_" .. index]):UnlockHighlight()
getglobal(PVPW_CONSTANTS["ELEMENT_PVPW_CLASS_CONFIGURATION_TAB_" .. index]):Hide()
end
end
|
--救いの架け橋
--
--Script by Trishula9
function c100287014.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,100287014+EFFECT_COUNT_CODE_DUEL)
e1:SetCondition(c100287014.condition)
e1:SetTarget(c100287014.target)
e1:SetOperation(c100287014.activate)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,100287014+100+EFFECT_COUNT_CODE_DUEL)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c100287014.thtg)
e2:SetOperation(c100287014.thop)
c:RegisterEffect(e2)
end
function c100287014.filter(c)
return c:IsFaceup() and c:IsLevelAbove(10)
end
function c100287014.condition(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c100287014.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
return g:GetClassCount(Card.GetRace)>=2
end
function c100287014.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(aux.NOT(Card.IsStatus),tp,0x1e,0x1e,nil,STATUS_BATTLE_DESTROYED)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0x1e)
end
function c100287014.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(aux.NOT(Card.IsStatus),tp,0x1e,0x1e,aux.ExceptThisCard(e),STATUS_BATTLE_DESTROYED)
if aux.NecroValleyNegateCheck(g) then return end
if Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)==0 then return end
local tg=Duel.GetOperatedGroup():Filter(Card.IsLocation,nil,LOCATION_DECK)
if tg:IsExists(Card.IsControler,1,nil,tp) then Duel.ShuffleDeck(tp) end
if tg:IsExists(Card.IsControler,1,nil,1-tp) then Duel.ShuffleDeck(1-tp) end
Duel.BreakEffect()
Duel.Draw(tp,5,REASON_EFFECT)
Duel.Draw(1-tp,5,REASON_EFFECT)
end
function c100287014.thfilter1(c)
return c:IsSetCard(0x1034) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c100287014.thfilter2(c)
return c:IsType(TYPE_FIELD) and c:IsAbleToHand()
end
function c100287014.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100287014.thfilter1,tp,LOCATION_DECK,0,1,nil)
and Duel.IsExistingMatchingCard(c100287014.thfilter2,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK)
end
function c100287014.thop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(c100287014.thfilter1,tp,LOCATION_DECK,0,nil)
local g2=Duel.GetMatchingGroup(c100287014.thfilter2,tp,LOCATION_DECK,0,nil)
if g1:GetCount()>0 and g2:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg1=g1:Select(tp,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg2=g2:Select(tp,1,1,nil)
sg1:Merge(sg2)
Duel.SendtoHand(sg1,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg1)
end
end
|
inFile = io.open("input.txt", "r")
data = inFile:read("*all") -- may be abbreviated to "*a";
-- other options are "*line",
-- or the number of characters to read.
inFile:close()
outFile = io.open("output.txt", "w")
outfile:write(data)
outfile:close()
-- Oneliner version:
io.open("output.txt", "w"):write(io.open("input.txt", "r"):read("*a"))
|
C_ReportSystem = {}
---@param playerLocation PlayerLocationMixin
---@return boolean canReport
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.CanReportPlayer)
function C_ReportSystem.CanReportPlayer(playerLocation) end
---@param playerLocation PlayerLocationMixin
---@return boolean canReport
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.CanReportPlayerForLanguage)
function C_ReportSystem.CanReportPlayerForLanguage(playerLocation) end
---@param complaintType string
---@param playerLocation? PlayerLocationMixin
---@return number token
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.InitiateReportPlayer)
---Not allowed to be called by addons
function C_ReportSystem.InitiateReportPlayer(complaintType, playerLocation) end
---@param reportType string
---@param playerName string
---@param playerLocation? PlayerLocationMixin
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.OpenReportPlayerDialog)
---Addons should use this to open the ReportPlayer dialog. InitiateReportPlayer and SendReportPlayer are no longer accessible to addons.
function C_ReportSystem.OpenReportPlayerDialog(reportType, playerName, playerLocation) end
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.ReportServerLag)
function C_ReportSystem.ReportServerLag() end
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.ReportStuckInCombat)
function C_ReportSystem.ReportStuckInCombat() end
---@param token number
---@param comment? string
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.SendReportPlayer)
---Not allowed to be called by addons
function C_ReportSystem.SendReportPlayer(token, comment) end
---@param target? string
---@return boolean set
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.SetPendingReportPetTarget)
function C_ReportSystem.SetPendingReportPetTarget(target) end
---@param target? string
---@return boolean set
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.SetPendingReportTarget)
function C_ReportSystem.SetPendingReportTarget(target) end
---@param guid? string
---@return boolean set
---[Documentation](https://wow.gamepedia.com/API_C_ReportSystem.SetPendingReportTargetByGuid)
function C_ReportSystem.SetPendingReportTargetByGuid(guid) end
|
describe("Arithmetic progression", function()
local arithmetic_progression = require("numeric.sum.arithmetic_progression")
-- Compare against a simple for loop
local function arithmetic_progression_loop(from, to, step)
local sum = 0
for i = from, to, step do
sum = sum + i
end
return sum
end
it("returns the correct sum", function()
for step = 1, 5 do
for from = 1, 10 do
for to = from, 100 do
assert.equal(arithmetic_progression_loop(from, to, step), arithmetic_progression(from, to, step))
end
end
end
end)
end)
|
local gateway = require("./gateway")
local format = string.format
local Bot = {}
function Bot:login(token)
if token == nil then return error("Nil token.") end
gateway:pack({token = token, first_heartbeat = true,
reconnecting = true,
session_id = nil,
sequence = 0,
bot = Bot
})
gateway:start()
end
function Bot:on(fn, callback)
fn = fn:upper()
gateway[fn] = callback
end
return Bot |
local huge = math.huge;
local VUHDO_CUSTOM_DEBUFF_CONFIG = { };
local VUHDO_UNIT_CUSTOM_DEBUFFS = { };
setmetatable(VUHDO_UNIT_CUSTOM_DEBUFFS, VUHDO_META_NEW_ARRAY);
local VUHDO_LAST_UNIT_DEBUFFS = { };
local VUHDO_PLAYER_ABILITIES = { };
local VUHDO_IGNORE_DEBUFFS_BY_CLASS = { };
local VUHDO_IGNORE_DEBUFF_NAMES = { };
--
local VUHDO_DEBUFF_TYPES = {
["Magic"] = VUHDO_DEBUFF_TYPE_MAGIC,
["Disease"] = VUHDO_DEBUFF_TYPE_DISEASE,
["Poison"] = VUHDO_DEBUFF_TYPE_POISON,
["Curse"] = VUHDO_DEBUFF_TYPE_CURSE
};
VUHDO_DEBUFF_BLACKLIST = {
[GetSpellInfo(69127)] = true, -- Chill of the Throne
[GetSpellInfo(57724)] = true, -- Sated (Bloodlust)
[GetSpellInfo(71328)] = true, -- Dungeon Cooldown
[GetSpellInfo(57723)] = true, -- Exhaustion (Heroism)
[GetSpellInfo(80354)] = true -- Temporal Displacement
};
-- BURST CACHE ---------------------------------------------------
local VUHDO_CONFIG;
local VUHDO_RAID;
local VUHDO_PANEL_SETUP;
local VUHDO_DEBUFF_COLORS = { };
local VUHDO_shouldScanUnit;
local VUHDO_DEBUFF_BLACKLIST = { };
local UnitDebuff = UnitDebuff;
local UnitBuff = UnitBuff;
local table = table;
local GetTime = GetTime;
local PlaySoundFile = PlaySoundFile;
local InCombatLockdown = InCombatLockdown;
local twipe = table.wipe;
local pairs = pairs;
local _;
local tostring = tostring;
local sIsNotRemovableOnly;
local sIsNotRemovableOnlyIcons;
local sIsUseDebuffIcon;
local sIsUseDebuffIconBossOnly;
local sIsMiBuColorsInFight;
local sStdDebuffSound;
local sAllDebuffSettings;
local sEmpty = { };
--local sColorArray = nil;
function VUHDO_debuffsInitLocalOverrides()
VUHDO_CONFIG = _G["VUHDO_CONFIG"];
VUHDO_RAID = _G["VUHDO_RAID"];
VUHDO_PANEL_SETUP = _G["VUHDO_PANEL_SETUP"];
VUHDO_DEBUFF_BLACKLIST = _G["VUHDO_DEBUFF_BLACKLIST"];
VUHDO_shouldScanUnit = _G["VUHDO_shouldScanUnit"];
sIsNotRemovableOnly = not VUHDO_CONFIG["DETECT_DEBUFFS_REMOVABLE_ONLY"];
sIsNotRemovableOnlyIcons = not VUHDO_CONFIG["DETECT_DEBUFFS_REMOVABLE_ONLY_ICONS"];
sIsUseDebuffIcon = VUHDO_PANEL_SETUP["BAR_COLORS"]["useDebuffIcon"];
sIsUseDebuffIconBossOnly = VUHDO_PANEL_SETUP["BAR_COLORS"]["useDebuffIconBossOnly"];
sIsMiBuColorsInFight = VUHDO_BUFF_SETTINGS["CONFIG"]["BAR_COLORS_IN_FIGHT"];
sStdDebuffSound = VUHDO_CONFIG["SOUND_DEBUFF"];
sAllDebuffSettings = VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"];
VUHDO_DEBUFF_COLORS = {
[1] = VUHDO_PANEL_SETUP["BAR_COLORS"]["DEBUFF1"],
[2] = VUHDO_PANEL_SETUP["BAR_COLORS"]["DEBUFF2"],
[3] = VUHDO_PANEL_SETUP["BAR_COLORS"]["DEBUFF3"],
[4] = VUHDO_PANEL_SETUP["BAR_COLORS"]["DEBUFF4"],
[6] = VUHDO_PANEL_SETUP["BAR_COLORS"]["DEBUFF6"],
};
--[[if not sColorArray then
sColorArray = { };
for tCnt = 1, 40 do
sColorArray[tCnt] = { };
end
end]]
end
----------------------------------------------------
--
local function VUHDO_copyColorTo(aSource, aDest)
aDest["R"], aDest["G"], aDest["B"] = aSource["R"], aSource["G"], aSource["B"];
aDest["TR"], aDest["TG"], aDest["TB"] = aSource["TR"], aSource["TG"], aSource["TB"];
aDest["O"], aDest["TO"] = aSource["O"], aSource["TO"];
aDest["useText"], aDest["useBackground"], aDest["useOpacity"] = aSource["useText"], aSource["useBackground"], aSource["useOpacity"];
return aDest;
end
--
local tSourceColor;
local tDebuffSettings;
local tDebuff;
local tColor = { };
local tEmpty = { };
function _VUHDO_getDebuffColor(anInfo)
if anInfo["charmed"] then
return VUHDO_PANEL_SETUP["BAR_COLORS"]["CHARMED"];
end
tDebuff = anInfo["debuff"];
if not anInfo["mibucateg"] and (tDebuff or 0) == 0 then -- VUHDO_DEBUFF_TYPE_NONE
return tEmpty;
end
if (tDebuff or 6) ~= 6 and VUHDO_DEBUFF_COLORS[tDebuff] then -- VUHDO_DEBUFF_TYPE_CUSTOM
return VUHDO_DEBUFF_COLORS[tDebuff];
end
tDebuffSettings = sAllDebuffSettings[anInfo["debuffName"]];
if tDebuff == 6 and tDebuffSettings ~= nil -- VUHDO_DEBUFF_TYPE_CUSTOM
and tDebuffSettings["isColor"] then
if tDebuffSettings["color"] ~= nil then
tSourceColor = tDebuffSettings["color"];
else
tSourceColor = VUHDO_DEBUFF_COLORS[6];
end
twipe(tColor);
if VUHDO_DEBUFF_COLORS[6]["useBackground"] then
tColor["R"], tColor["G"], tColor["B"], tColor["O"], tColor["useBackground"] = tSourceColor["R"], tSourceColor["G"], tSourceColor["B"], tSourceColor["O"], true;
end
if VUHDO_DEBUFF_COLORS[6]["useText"] then
tColor["TR"], tColor["TG"], tColor["TB"], tColor["TO"], tColor["useText"] = tSourceColor["TR"], tSourceColor["TG"], tSourceColor["TB"], tSourceColor["TO"], true;
end
return tColor;
end
if not anInfo["mibucateg"] or not VUHDO_BUFF_SETTINGS[anInfo["mibucateg"]] then return tEmpty; end
tSourceColor = VUHDO_BUFF_SETTINGS[anInfo["mibucateg"]]["missingColor"];
twipe(tColor);
if VUHDO_BUFF_SETTINGS["CONFIG"]["BAR_COLORS_TEXT"] then
tColor["useText"], tColor["TR"], tColor["TG"], tColor["TB"], tColor["TO"] = true, tSourceColor["TR"], tSourceColor["TG"], tSourceColor["TB"], tSourceColor["TO"];
end
if VUHDO_BUFF_SETTINGS["CONFIG"]["BAR_COLORS_BACKGROUND"] then
tColor["useBackground"], tColor["R"], tColor["G"], tColor["B"], tColor["O"] = true, tSourceColor["R"], tSourceColor["G"], tSourceColor["B"], tSourceColor["O"];
end
return tColor;
end
--
local tCopy = { };
function VUHDO_getDebuffColor(anInfo)
return VUHDO_copyColorTo(_VUHDO_getDebuffColor(anInfo), tCopy);
end
--
local tNextSoundTime = 0;
local function VUHDO_playDebuffSound(aSound)
if (aSound or "") == "" or GetTime() < tNextSoundTime then
return;
end
PlaySoundFile(aSound);
tNextSoundTime = GetTime() + 2;
end
--
local tIconIndex = 0;
local tIconArray;
local tIconArrayDispenser = { };
local function VUHDO_getOrCreateIconArray(anIcon, aExpiry, aStacks, aDuration, anIsBuff, aSpellId, aCnt)
tIconIndex = tIconIndex + 1;
if #tIconArrayDispenser < tIconIndex then
tIconArray = { anIcon, aExpiry, aStacks, aDuration, anIsBuff, aSpellId, aCnt };
tIconArrayDispenser[tIconIndex] = tIconArray;
else
tIconArray = tIconArrayDispenser[tIconIndex];
tIconArray[1], tIconArray[2], tIconArray[3], tIconArray[4], tIconArray[5], tIconArray[6], tIconArray[7]
= anIcon, aExpiry, aStacks, aDuration, anIsBuff, aSpellId, aCnt;
end
return tIconArray;
end
--
function VUHDO_resetDebuffIconDispenser()
twipe(tIconArrayDispenser);
tIconIndex = 0;
end
--
local VUHDO_UNIT_DEBUFF_INFOS = { };
setmetatable(VUHDO_UNIT_DEBUFF_INFOS, {
__index = function(aTable, aKey)
local tValue = {
["CHOSEN"] = { [1] = nil, [2] = 0 },
[VUHDO_DEBUFF_TYPE_POISON] = { },
[VUHDO_DEBUFF_TYPE_DISEASE] = { },
[VUHDO_DEBUFF_TYPE_MAGIC] = { },
[VUHDO_DEBUFF_TYPE_CURSE] = { },
};
rawset(aTable, aKey, tValue);
return tValue;
end
});
local sCurChosenType;
local sCurChosenName;
local sCurChosenSpellId;
local sCurIsStandard;
local sCurIcons = { };
local tUnitDebuffInfo;
local function VUHDO_initDebuffInfos(aUnit)
tUnitDebuffInfo = VUHDO_UNIT_DEBUFF_INFOS[aUnit];
tUnitDebuffInfo[1][2] = nil; -- VUHDO_DEBUFF_TYPE_POISON
tUnitDebuffInfo[2][2] = nil; -- VUHDO_DEBUFF_TYPE_DISEASE
tUnitDebuffInfo[3][2] = nil; -- VUHDO_DEBUFF_TYPE_MAGIC
tUnitDebuffInfo[4][2] = nil; -- VUHDO_DEBUFF_TYPE_CURSE
sCurChosenType = VUHDO_DEBUFF_TYPE_NONE;
sCurChosenName = "";
sCurChosenSpellId = nil;
sCurIsStandard = false;
tIconIndex = 0;
twipe(sCurIcons);
return tUnitDebuffInfo;
end
--
local tInfo;
local tSound;
local tRemaining;
local tAbility;
local tSchool;
local tName, tIcon, tStacks, tTypeString, tDuration, tExpiry, tSpellId, tIsBossDebuff;
local tDebuffConfig;
local tIsRelevant;
local tNow;
local tUnitDebuffInfo;
local tType;
local tDebuffSettings;
local tCurChosenStoredName;
function VUHDO_determineDebuff(aUnit)
tInfo = (VUHDO_RAID or sEmpty)[aUnit];
if not tInfo then return 0, ""; -- VUHDO_DEBUFF_TYPE_NONE
elseif VUHDO_CONFIG_SHOW_RAID then return tInfo["debuff"], tInfo["debuffName"]; end
tUnitDebuffInfo = VUHDO_initDebuffInfos(aUnit);
if VUHDO_shouldScanUnit(aUnit) then
tNow = GetTime();
for tCnt = 1, huge do
tName, tIcon, tStacks, tTypeString, tDuration, tExpiry, _, _, _, tSpellId, _, tIsBossDebuff = UnitDebuff(aUnit, tCnt, false);
if not tIcon then break; end
tStacks = tStacks or 0;
if (tExpiry or 0) == 0 then tExpiry = (sCurIcons[tName] or sEmpty)[2] or tNow; end
-- Custom Debuff?
tDebuffConfig = VUHDO_CUSTOM_DEBUFF_CONFIG[tName] or VUHDO_CUSTOM_DEBUFF_CONFIG[tostring(tSpellId)] or sEmpty;
if tDebuffConfig[1] then -- Color?
sCurChosenType, sCurChosenName, sCurChosenSpellId = 6, tName, tSpellId; -- VUHDO_DEBUFF_TYPE_CUSTOM
end
if sCurIcons[tName] then tStacks = tStacks + sCurIcons[tName][3]; end
if tDebuffConfig[2] then -- Icon?
sCurIcons[tName] = VUHDO_getOrCreateIconArray(tIcon, tExpiry, tStacks, tDuration, false, tSpellId, tCnt);
end
tType = VUHDO_DEBUFF_TYPES[tTypeString];
tAbility = VUHDO_PLAYER_ABILITIES[tType];
tIsRelevant = not VUHDO_IGNORE_DEBUFF_NAMES[tName]
and not (VUHDO_IGNORE_DEBUFFS_BY_CLASS[tInfo["class"] or ""] or sEmpty)[tName];
if tType and tIsRelevant then
tSchool = tUnitDebuffInfo[tType];
tRemaining = floor(tExpiry - tNow);
if (tSchool[2] or 0) < tRemaining then
tSchool[1], tSchool[2], tSchool[3], tSchool[4] = tIcon, tRemaining, tStacks, tDuration;
end
end
if sCurChosenType ~= 6 -- VUHDO_DEBUFF_TYPE_CUSTOM
and not VUHDO_DEBUFF_BLACKLIST[tName]
and not VUHDO_DEBUFF_BLACKLIST[tostring(tSpellId)]
and tIsRelevant then
if sIsUseDebuffIcon and (tIsBossDebuff or not sIsUseDebuffIconBossOnly)
and (sIsNotRemovableOnlyIcons or tAbility ~= nil) then
sCurIcons[tName] = VUHDO_getOrCreateIconArray(tIcon, tExpiry, tStacks, tDuration, false, tSpellId, tCnt);
sCurIsStandard = true;
end
-- Entweder F�higkeit vorhanden ODER noch keiner gew�hlt UND auch nicht entfernbare
if tType and (tAbility or (sCurChosenType == 0 and sIsNotRemovableOnly)) then -- VUHDO_DEBUFF_TYPE_NONE
sCurChosenType = tType;
tUnitDebuffInfo["CHOSEN"][1], tUnitDebuffInfo["CHOSEN"][2] = tIcon, tStacks;
end
end
end
for tCnt = 1, huge do
tName, tIcon, tStacks, _, tDuration, tExpiry, _, _, _, tSpellId = UnitBuff(aUnit, tCnt);
if not tIcon then break; end
tDebuffConfig = VUHDO_CUSTOM_DEBUFF_CONFIG[tName] or VUHDO_CUSTOM_DEBUFF_CONFIG[tostring(tSpellId)] or sEmpty;
if tDebuffConfig[1] then -- Set color
sCurChosenType, sCurChosenName, sCurChosenSpellId = 6, tName, tSpellId; -- VUHDO_DEBUFF_TYPE_CUSTOM
end
if tDebuffConfig[2] then -- Set icon
sCurIcons[tName] = VUHDO_getOrCreateIconArray(tIcon, tExpiry, tStacks or 0, tDuration, true, tSpellId, tCnt);
end
end
-- Gained new custom debuff?
-- note we only play sounds for debuff customs with isIcon set to true
for tName, tDebuffInfo in pairs(sCurIcons) do
if not VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName] then
-- tExpiry, tStacks, tIcon
VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName] = { tDebuffInfo[2], tDebuffInfo[3], tDebuffInfo[1] };
VUHDO_addDebuffIcon(aUnit, tDebuffInfo[1], tName, tDebuffInfo[2], tDebuffInfo[3], tDebuffInfo[4], tDebuffInfo[5], tDebuffInfo[6], tDebuffInfo[7]);
if not VUHDO_IS_CONFIG and VUHDO_MAY_DEBUFF_ANIM then
-- the key used to store the debuff settings is either the debuff name or spell ID
tDebuffSettings = sAllDebuffSettings[tName] or sAllDebuffSettings[tostring(tDebuffInfo[6])];
if tDebuffSettings then -- particular custom debuff sound?
VUHDO_playDebuffSound(tDebuffSettings["SOUND"]);
elseif VUHDO_CONFIG["CUSTOM_DEBUFF"]["SOUND"] then -- default custom debuff sound?
VUHDO_playDebuffSound(VUHDO_CONFIG["CUSTOM_DEBUFF"]["SOUND"]);
end
end
VUHDO_updateBouquetsForEvent(aUnit, 29); -- VUHDO_UPDATE_CUSTOM_DEBUFF
-- update number of stacks?
elseif VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName][1] ~= tDebuffInfo[2]
or VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName][2] ~= tDebuffInfo[3]
or VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName][3] ~= tDebuffInfo[1]
or VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName][4] ~= tDebuffInfo[7] then
VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName][1] = tDebuffInfo[2];
VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName][2] = tDebuffInfo[3];
VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName][3] = tDebuffInfo[1];
VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName][4] = tDebuffInfo[7];
VUHDO_updateDebuffIcon(aUnit, tDebuffInfo[1], tName, tDebuffInfo[2], tDebuffInfo[3], tDebuffInfo[4], tDebuffInfo[5], tDebuffInfo[6], tDebuffInfo[7]);
VUHDO_updateBouquetsForEvent(aUnit, 29); -- VUHDO_UPDATE_CUSTOM_DEBUFF
end
end
-- Play standard debuff sound?
if sStdDebuffSound
and (sCurChosenType ~= VUHDO_DEBUFF_TYPE_NONE or sCurIsStandard)
and sCurChosenType ~= VUHDO_DEBUFF_TYPE_CUSTOM
and sCurChosenType ~= VUHDO_LAST_UNIT_DEBUFFS[aUnit]
and tInfo["range"] then
VUHDO_playDebuffSound(sStdDebuffSound);
VUHDO_LAST_UNIT_DEBUFFS[aUnit] = sCurChosenType;
end
end -- shouldScanUnit
-- Lost old custom debuff?
for tName, _ in pairs(VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit]) do
if not sCurIcons[tName] then
twipe(VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName]);
VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName] = nil;
VUHDO_removeDebuffIcon(aUnit, tName);
VUHDO_updateBouquetsForEvent(aUnit, 29); -- VUHDO_UPDATE_CUSTOM_DEBUFF
end
end
if sCurChosenType == VUHDO_DEBUFF_TYPE_NONE and tInfo["missbuff"] and (sIsMiBuColorsInFight or not InCombatLockdown()) then
sCurChosenType = VUHDO_DEBUFF_TYPE_MISSING_BUFF;
end
-- we need to return the actual key that the debuff settings are stored under
-- this key is either the debuff name or the debuff spell ID
if sAllDebuffSettings[sCurChosenName] ~= nil then
tCurChosenStoredName = sCurChosenName;
elseif sAllDebuffSettings[tostring(sCurChosenSpellId)] ~= nil then
tCurChosenStoredName = tostring(sCurChosenSpellId);
end
return sCurChosenType, tCurChosenStoredName;
end
local VUHDO_determineDebuff = VUHDO_determineDebuff;
--
function VUHDO_updateAllCustomDebuffs(anIsEnableAnim)
twipe(VUHDO_UNIT_CUSTOM_DEBUFFS);
VUHDO_MAY_DEBUFF_ANIM = false;
for tUnit, tInfo in pairs(VUHDO_RAID) do
VUHDO_removeAllDebuffIcons(tUnit);
tInfo["debuff"], tInfo["debuffName"] = VUHDO_determineDebuff(tUnit);
end
VUHDO_MAY_DEBUFF_ANIM = anIsEnableAnim;
end
-- Remove debuffing abilities individually not known to the player
function VUHDO_initDebuffs()
local tAbility;
local _, tClass = UnitClass("player");
twipe(VUHDO_PLAYER_ABILITIES);
for tDebuffType, tAbilities in pairs(VUHDO_INIT_DEBUFF_ABILITIES[tClass] or sEmpty) do
for tCnt = 1, #tAbilities do
tAbility = tAbilities[tCnt];
-- VUHDO_Msg("check: " .. tAbility);
if VUHDO_isSpellKnown(tAbility) or tAbility == "*" then
VUHDO_PLAYER_ABILITIES[tDebuffType] = VUHDO_SPEC_TO_DEBUFF_ABIL[tAbility] or tAbility;
-- VUHDO_Msg("KEEP: Type " .. tDebuffType .. " because of spell " .. VUHDO_PLAYER_ABILITIES[tDebuffType]);
break;
end
end
end
-- VUHDO_Msg("---");
if not VUHDO_CONFIG then VUHDO_CONFIG = _G["VUHDO_CONFIG"]; end
for _, tDebuffName in pairs(VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED"]) do
if not VUHDO_CUSTOM_DEBUFF_CONFIG[tDebuffName] then
VUHDO_CUSTOM_DEBUFF_CONFIG[tDebuffName] = { };
end
VUHDO_CUSTOM_DEBUFF_CONFIG[tDebuffName][1] = VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tDebuffName]["isColor"];
VUHDO_CUSTOM_DEBUFF_CONFIG[tDebuffName][2] = VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tDebuffName]["isIcon"];
end
for tDebuffName, _ in pairs(VUHDO_CUSTOM_DEBUFF_CONFIG) do
if not VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tDebuffName] then
VUHDO_CUSTOM_DEBUFF_CONFIG[tDebuffName] = nil;
end
end
twipe(VUHDO_IGNORE_DEBUFF_NAMES);
if VUHDO_CONFIG["DETECT_DEBUFFS_IGNORE_NO_HARM"] then
VUHDO_IGNORE_DEBUFFS_BY_CLASS = VUHDO_INIT_IGNORE_DEBUFFS_BY_CLASS;
VUHDO_tableAddAllKeys(VUHDO_IGNORE_DEBUFF_NAMES, VUHDO_INIT_IGNORE_DEBUFFS_NO_HARM);
else
VUHDO_IGNORE_DEBUFFS_BY_CLASS = sEmpty;
end
if VUHDO_CONFIG["DETECT_DEBUFFS_IGNORE_MOVEMENT"] then
VUHDO_tableAddAllKeys(VUHDO_IGNORE_DEBUFF_NAMES, VUHDO_INIT_IGNORE_DEBUFFS_MOVEMENT);
end
if VUHDO_CONFIG["DETECT_DEBUFFS_IGNORE_DURATION"] then
VUHDO_tableAddAllKeys(VUHDO_IGNORE_DEBUFF_NAMES, VUHDO_INIT_IGNORE_DEBUFFS_DURATION);
end
end
--
function VUHDO_getDebuffAbilities()
return VUHDO_PLAYER_ABILITIES;
end
--
function VUHDO_getUnitDebuffSchoolInfos(aUnit, aDebuffSchool)
return VUHDO_UNIT_DEBUFF_INFOS[aUnit][aDebuffSchool];
end
--
function VUHDO_getChosenDebuffInfo(aUnit)
return VUHDO_UNIT_DEBUFF_INFOS[aUnit]["CHOSEN"];
end
--
function VUHDO_resetDebuffsFor(aUnit)
VUHDO_initDebuffInfos(aUnit);
twipe(VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit]);
end
|
--死境残存
local m=14000107
local cm=_G["c"..m]
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(cm.actcon)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
function cm.BRAVE(c)
local m=_G["c"..c:GetCode()]
return m and m.named_with_brave
end
function cm.setfilter(c,e,tp)
return c:IsFaceup() and c:GetSequence()<5
end
function cm.actcon(e)
local tp=e:GetHandlerPlayer()
return not Duel.IsExistingMatchingCard(cm.setfilter,tp,LOCATION_SZONE,0,1,nil)
end
function cm.filter(c)
return cm.BRAVE(c) and not c:IsForbidden()
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,2,nil)
and ((Duel.GetLocationCount(tp,LOCATION_SZONE)>1 and e:GetHandler():IsLocation(LOCATION_SZONE)) or Duel.GetLocationCount(tp,LOCATION_SZONE)>2) end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=1 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,2,2,nil)
local tc=g:GetFirst()
while tc do
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,true)
Duel.ConfirmCards(1-tp,tc)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
if Duel.GetFlagEffect(tp,m)~=0 or g:GetCount()<=0 then return end
Duel.BreakEffect()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(m,1))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetTargetRange(LOCATION_HAND+LOCATION_MZONE,0)
e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)
end |
local L = LibStub("AceLocale-3.0"):NewLocale("TidyPlatesThreat", "koKR", false)
if not L then return end
L[" <no option> Displays options dialog"] = " <옵션 없음> 옵션 대화창 표시"
L[" 8.4-design Changes default settings to new look and feel (introduced with 8.4)"] = " 8.4-design 기본 설정을 새로운 모양과 느낌으로 변경합니다 (8.4에서 도입)"
L[" classic-design Reverts default settings back to look and feel before 8.4"] = " classic-design 기본 설정을 8.4 이전의 모양과 느낌으로 되돌립니다"
L[" help Prints this help message"] = " help 이 도움말 출력"
L[" new-defaults Changes default settings to new look and feel (introduced with 8.4)"] = " new-defaults 기본 설정을 새로운 모양과 느낌으로 변경합니다 (8.4에서 도입)"
L[" old-defaults Reverts default settings back to look and feel before 8.4"] = " old-defaults 모양과 느낌을 8.4 이전 기본 설정으로 되돌립니다"
L[" update-profiles Migrates deprecated settings in your configuration"] = " update-profiles 자신의 구성에서 사용되지 않는 설정을 이전합니다"
L[" options by typing: /tptp"] = "옵션 열기 명령어: /tptp"
L[" role."] = "역할입니다."
L[" to DPS."] = "|1을;를; DPS로 설정합니다."
L[" to tanking."] = "|1을;를; 방어 전담으로 설정합니다."
L[ [=[
Feel free to email me at |cff00ff00threatplates@gmail.com|r
--
Blacksalsify
(Original author: Suicidal Katt - |cff00ff00Shamtasticle@gmail.com|r)]=] ] = [=[
|cff00ff00threatplates@gmail.com|r으로 자유롭게 이메일을 보내주세요
--
Blacksalsify
(원 제작자: Suicidal Katt - |cff00ff00Shamtasticle@gmail.com|r)]=]
L[". You have installed an older or incompatible version of TidyPlates: "] = ". 오래됐거나 호환되지 않는 TidyPlates를 설치했습니다: "
L[ [=[:
---------------------------------------
|cff89F559Threat Plates|r v8.4 introduces a new default look and feel (currently shown). Do you want to switch to this new look and feel?
None of your custom settings will be changed. You can always use '/tptp classic-design' or '/tptp 8.4-design' to revert your decision later on.]=] ] = [=[:
---------------------------------------
|cff89F559Threat Plates|r v8.4부터 새로운 기본 모양과 느낌이 도입되었습니다 (현재 표시된). 새로운 모양과 느낌으로 전환하고 싶은가요?
사용자 설정은 변경되지 않습니다. '/tptp classic-design' 또는 '/tptp 8.4-design'을 사용하여 나중에 다시 선택할 수 있습니다.]=]
L[ [=[:
---------------------------------------
|cff89F559Threat Plates|r v8.4 introduces a new default look and feel (currently shown). Do you want to switch to this new look and feel?
You can revert your decision by changing the default look and feel again in the options dialog (under Nameplate Settings - Healthbar View - Default Settings).
Note: Some of your custom settings may get overwritten if you switch back and forth.]=] ] = [=[:
---------------------------------------
|cff89F559Threat Plates|r v8.4부터 새로운 기본 모양과 느낌이 도입되었습니다 (현재 표시된). 새로운 모양과 느낌으로 전환하고 싶은가요?
옵션 창에서 기본 모양과 느낌을 다시 변경할 수 있습니다 (이름표 설정 - 생명력바 보기 - 기본 설정).
참고: 상호 전환하면 몇몇 사용자 설정을 덮어씁니다.]=]
L[ [=[:
---------------------------------------
|cff89F559Threat Plates|r v8.4 introduces a new default look and feel (which is currently shown). Do you want to switch to this look and feel as new default?
You can change this setting anytime in the options dialog (under Nameplate Settings - Healthbar View - Default Settings).
Note: Some of your custom settings will change to their default value if you switch back and forth.]=] ] = [=[:
---------------------------------------
|cff89F559Threat Plates|r v8.4부터 새로운 기본 모양과 느낌이 도입되었습니다 (현재 표시된). 새로운 모양과 느낌으로 전환하고 싶은가요?
옵션 창에서 언제든지 이 설정을 변경할 수 있습니다 (이름표 설정 - 생명력바 보기 - 기본 설정).
참고: 상호 전환하면 몇몇 설정이 기본 값으로 변경됩니다.]=]
L[ [=[:
---------------------------------------
Would you like to
set your theme to |cff89F559Threat Plates|r?
Clicking '|cff00ff00Yes|r' will set you to Threat Plates & reload UI.
Clicking '|cffff0000No|r' will open the Tidy Plates options.]=] ] = [=[:
---------------------------------------
테마를 |cff89F559Threat Plates|r로
지정하고 싶으세요?
'|cff00ff00네|r'를 클릭하면 Threat Plates로 지정하고 UI를 다시 불러옵니다.
'|cffff0000아니오|r'를 클릭하면 Tidy Plates 옵션을 엽니다.]=]
L[ [=[:
----------
Would you like to
set your theme to |cff89F559Threat Plates|r?
Clicking '|cff00ff00Yes|r' will set you to Threat Plates & reload UI.
Clicking '|cffff0000No|r' will open the Tidy Plates options.]=] ] = [=[:
----------
당신의 테마를
|cff89F559Threat Plates|r로 설정할까요?
'|cff00ff00네|r'를 클릭하면 Threat Plates로 설정 후 UI를 다시 불러옵니다.
'|cffff0000아니오|r'를 클릭하면 Tidy Plates 옵션 창을 엽니다.]=]
L[ [=[:
---------------------------------------
Would you like to
set your theme to |cff89F559Threat Plates|r?
Clicking '|cff00ff00Yes|r' will set you to Threat Plates & reload UI.
Clicking '|cffff0000No|r' will open the Tidy Plates options.]=] ] = [=[:
---------------------------------------
테마를 |cff89F559Threat Plates|r로
지정하고 싶으세요?
'|cff00ff00네|r'를 클릭하면 Threat Plates로 지정하고 UI를 다시 불러옵니다.
'|cffff0000아니오|r'를 클릭하면 Tidy Plates 옵션을 엽니다.]=]
L[ [=[:
---------------------------------------
Would you like to
set your theme to |cff89F559Threat Plates|r?
Clicking '|cff00ff00Yes|r' will set you to Threat Plates.
Clicking '|cffff0000No|r' will open the Tidy Plates options.]=] ] = [=[:
---------------------------------------
테마를 |cff89F559Threat Plates|r로
지정하고 싶으세요?
'|cff00ff00네|r'를 클릭하면 Threat Plates로 지정합니다.
'|cffff0000아니오|r'를 클릭하면 Tidy Plates 옵션을 엽니다.]=]
L["|cff00ff00High Threat|r"] = "|cff00ff00높은 위협 수준|r"
L["|cff00ff00Low Threat|r"] = "|cff00ff00낮은 위협 수준|r"
L["|cff00ff00Tank|r"] = "|cff00ff00방어 전담|r"
L["|cff00ff00tanking|r"] = "|cff00ff00방어 전담|r"
L["|cff0faac8Off-Tank|r"] = "|cff0faac8방어 안함|r"
L["|cff89f559 role.|r"] = "|cff89f559 역할입니다.|r"
L["|cff89f559Additional options can be found by typing |r'/tptp'|cff89F559.|r"] = "|cff89f559추가 옵션은|r '/tptp'|cff89f559를 입력하면 찾을 수 있습니다|r|cff89F559.|r"
L["|cff89f559Threat Plates:|r Welcome back |cff"] = "|cff89f559Threat Plates:|r 돌아온 걸 환영해요 |cff"
L["|cff89F559Threat Plates|r: DPS switch detected, you are now in your |cffff0000dpsing / healing|r role."] = "|cff89F559Threat Plates|r: 공격 전담 전환 감지, 당신은 현재 |cffff0000공격 전담 / 치유 전담|r 역할입니다."
L["|cff89F559Threat Plates|r: Role toggle not supported because automatic role detection is enabled."] = "|cff89F559Threat Plates|r: 자동 역할 감지가 사용 중이어서 역할 전환이 지원되지 않습니다."
L["|cff89F559Threat Plates|r: Tank switch detected, you are now in your |cff00ff00tanking|r role."] = "|cff89F559Threat Plates|r: 방어 전담 전환 감지, 당신은 현재 |cff00ff00방어 전담|r 역할입니다."
L[ [=[|cff89f559Welcome to |rTidy Plates: |cff89f559Threat Plates!
This is your first time using Threat Plates and you are a(n):
|r|cff]=] ] = [=[Tidy Plates: |cff89f559Threat Plates|r|cff89f559에 오신 걸 환영합니다!|r
|cff89f559Threat Plates를 처음 사용하며 당신은:|r|cff]=]
L["|cff89f559You are currently in your "] = "|cff89f559당신은 현재 "
L["|cffff0000DPS/Healing|r"] = "|cffff0000공격 전담/치유 전담|r"
L["|cffff0000dpsing / healing|r"] = "|cffff0000공격 전담 / 치유 전담|r"
L["|cffff0000High Threat|r"] = "|cffff0000높은 위협 수준|r"
L["|cffff0000Low Threat|r"] = "|cffff0000낮은 위협 수준|r"
L["|cffffff00Medium Threat|r"] = "|cffffff00중간 위협 수준|r"
L["|cffffffffGeneral Settings|r"] = "|cffffffff일반 설정|r"
L["|cffffffffTotem Settings|r"] = "|cffffffff토템 설정|r"
L["-->>|cff00ff00Tank Plates Enabled|r<<--"] = "-->>|cff00ff00방어 전담 이름표 활성화|r<<--"
L["-->>|cffff0000Activate Threat Plates from the Tidy Plates options!|r<<--"] = "-->>|cffff0000Tidy Plates 옵션에서 Threat Plates를 활성화하세요!|r<<--"
L["-->>|cffff0000DPS Plates Enabled|r<<--"] = "-->>|cffff0000공격 전담 이름표 활성화|r<<--"
L["-->>Nameplate Overlapping is now |cff00ff00ON!|r<<--"] = "-->>이름표 겹치기가 |cff00ff00켜졌습니다!|r<<--"
L["-->>Nameplate Overlapping is now |cffff0000OFF!|r<<--"] = "-->>이름표 겹치기가 |cffff0000꺼졌습니다!|r<<--"
L["-->>Threat Plates verbose is now |cff00ff00ON!|r<<--"] = "-->>Threat Plates 문자 알림이 |cff00ff00켜졌습니다!|r<<--"
L["-->>Threat Plates verbose is now |cffff0000OFF!|r<<-- shhh!!"] = "-->>Threat Plates 문자 알림이 |cffff0000꺼졌습니다!|r<<-- 쉿!!"
L["A to Z"] = "가나다 순"
L["About"] = "정보"
L["Absolut Transparency"] = "절대 투명도"
L["Add black outline."] = "검은색 외곽선을 추가합니다."
L["Add thick black outline."] = "두꺼운 검은색 외곽선을 추가합니다."
L["Additional Adjustments"] = "추가 조정"
L["Additionally color the healthbar based on the target mark if the unit is marked."] = "유닛에 징표가 있으면 대상 징표에 따라 생명력바의 색상을 바꿉니다."
L["Additionally color the name based on the target mark if the unit is marked."] = "유닛에 징표가 있으면 대상 징표에 따라 이름의 색상을 바꿉니다."
L["Additionally color the nameplate's healthbar or name based on the target mark if the unit is marked."] = "유닛에 징표가 있으면 대상 징표에 따라 이름표의 생명력바나 이름의 색상을 바꿉니다."
L["Adjust Alpha for"] = "투명도 조절: "
L["Adjust Alpha For"] = "투명도 조절:"
L["Adjust Color For"] = "색상 조절:"
L["Adjust Scale For"] = "크기 비율 조절:"
L["Adjust Scale for"] = "크기 비율 조절: "
L["All Auras"] = "모든 효과"
L["All Auras (Mine)"] = "모든 효과 (내 것)"
L["Alpha"] = "투명도"
L["Alpha & Scaling"] = "투명도 & 크기 변경"
L["Alpha by Status"] = "상태 별 투명도"
L["Amount Text"] = "수치 문자"
L["Amount Text Formatting"] = "수치 문자 형식화"
L["Anchor"] = "고정"
L["Anchor Point"] = "고정 지점"
L["Appearance"] = "모양"
L["Area"] = "지역"
L["Area Quest"] = "지역 퀘스트"
L["Arena"] = "투기장"
L["Arena 1"] = "투기장 1"
L["Arena 2"] = "투기장 2"
L["Arena 3"] = "투기장 3"
L["Arena 4"] = "투기장 4"
L["Arena 5"] = "투기장 5"
L["Arena Number Colors"] = "투기장 번호 색상"
L["Arena Orb Colors"] = "투기장 구슬 색상"
L["Army of the Dead Ghoul"] = "사자의 군대"
L["Art Options"] = "미술 옵션"
L["Aura"] = "효과"
L["Aura 2.0"] = "효과 2.0"
L["Background Color"] = "배경 색상"
L["Background Color:"] = "배경 색상:"
L["Background Opacity"] = "배경 불투명도"
L["Background Texture"] = "배경 텍스쳐"
L["Background Transparency"] = "배경 투명도"
L["Bar Border"] = "바 테두리"
L["Bar Height"] = "바 높이"
L["Bar Limit"] = "바 제한"
L["Bar Mode"] = "바 모드"
L["Bar Width"] = "바 너비"
L["Base Alpha by Unit"] = "유닛 별 기본 투명도"
L["Base Scale by Unit"] = "유닛 별 기본 크기 비율"
L["Black List"] = "차단 목록"
L["Black List (Mine)"] = "차단 목록 (내 것)"
L["Blizzard"] = "블리자드"
L["Blizzard Filter Options"] = "블리자드 필터 옵션"
L["Blizzard Nameplates"] = "블리자드 이름표"
L["Blizzard Nameplates for Friendly Units"] = "우호적 유닛에 블리자드 이름표"
L["Blizzard Target Fading"] = "블리자드 대상 흐려짐"
L["Bone Spike"] = "뼈 가시"
L["Border Color:"] = "테두리 색상:"
L["Border Texture"] = "테두리 텍스쳐"
L["Borders"] = "테두리"
L["Boss Mods"] = "우두머리 모듈"
L["Bosses"] = "우두머리"
L["Bottom-to-top"] = "아래에서 위로"
L["By Class"] = "직업 별"
L["By Custom Color"] = "사용자 설정 색상 별"
L["By Health"] = "생명력 별"
L["By Reaction"] = "반응 별"
L["Canal Crab"] = "대운하 게"
L["Cancel"] = "취소"
L["Castbar"] = "시전바"
L["Casting Units"] = "시전 유닛"
L["Change the color depending on the amount of health points the nameplate shows."] = "이름표에 표시된 생명력의 수치에 따라 색상을 변경합니다."
L["Change the color depending on the reaction of the unit (friendly, hostile, neutral)."] = "유닛의 반응에 따라 색상을 변경합니다 (우호적, 적대적, 중립)."
L["Change the scale of nameplates depending on whether a target unit is selected or not. As default, this scale is added to the unit base scale."] = "유닛의 대상 지정 여부에 따라 이름표의 크기 비율을 변경합니다. 기본값으로, 이 크기 비율은 유닛 기본 크기 비율로 추가됩니다."
L["Change the scale of nameplates in certain situations, overwriting all other settings."] = "특정 상황에서 이름표의 크기 비율을 변경합니다, 모든 다른 설정을 덮어씁니다."
L["Change the transparency of nameplates depending on whether a target unit is selected or not. As default, this transparency is added to the unit base transparency."] = "유닛의 대상 지정 여부에 따라 이름표의 투명도를 변경합니다. 기본값으로, 이 투명도는 유닛 기본 투명도로 추가됩니다."
L["Change the transparency of nameplates in certain situations, overwriting all other settings."] = "특덩 상황에서 이름표의 투명도를 변경합니다, 모든 다른 설정을 덮어씁니다."
L["Changes the default settings to the selected design. Some of your custom settings may get overwritten if you switch back and forth.."] = "기본 설정을 선택한 디자인으로 변경합니다. 상호 전환하면 몇몇 사용자 설정을 덮어씁니다.."
L["Changing default settings to new look and feel (introduced with 8.4) ..."] = "기본 설정을 새로운 모양과 느낌으로 변경 (8.4에서 도입) ..."
L["Changing default settings to updated look and feel introduced with 8.4 ..."] = "기본 설정을 8.4에서 도입된 갱신된 모양과 느낌으로 변경 중입니다..."
L["Changing these settings will alter the placement of the nameplates, however the mouseover area does not follow. |cffff0000Use with caution!|r"] = "이 설정을 변경하면 이름표의 배치가 변경됩니다, 하지만 마우스오버 영역은 변경되지 않습니다. |cffff0000주의해서 사용하세요!|r"
L["Class Icons"] = "직업 아이콘"
L["Clear"] = "초기화"
L[ [=[Clear and easy to use nameplate theme for use with TidyPlates.
Current version: ]=] ] = [=[TidyPlates와 사용할 수 있는 깔끔하고 쉬운 이름표 테마입니다.
현재 버전: ]=]
L["Color"] = "색상"
L["Color By Class"] = "직업 별 색상"
L["Color by Dispel Type"] = "무효화 유형에 따른 색상"
L["Color by Health"] = "생명력 별 색상"
L["Color by Reaction"] = "반응 별 색상"
L["Color by Target Mark"] = "대상 징표 별 색상"
L["Color Healthbar By Enemy Class"] = "적대적 직업 별 생명력바 색상"
L["Color Healthbar By Friendly Class"] = "아군 직업 별 생명력바 색상"
L["Color Healthbar by Target Marks in Healthbar View"] = "생명력바 보기에서 대상 징표 별 생명력바 색상"
L["Color Name by Target Marks in Headline View"] = "헤드라인 보기에서 대상 징표 별 이름 색상"
L["Coloring"] = "색상화"
L["Colors"] = "색상"
L["Column Limit"] = "열 제한"
L["Combo Points"] = "연계 점수"
L["Cooldown Spiral"] = "재사용 대기시간 나선"
L["Copied!"] = "복사되었습니다!"
L["Copy"] = "복사"
L["Creation"] = "적용 순서"
L["Custom"] = "사용자 설정"
L["Custom Alpha"] = "사용자 설정 투명도"
L["Custom Color"] = "사용자 설정 색상"
L["Custom Nameplates"] = "사용자 설정 이름표"
L["Custom No-Target Alpha"] = "사용자 설정 대상 미지정 투명도"
L["Custom No-Target Scale"] = "사용자 설정 대상 미지정 크기 비율"
L["Custom Scale"] = "사용자 설정 크기 비율"
L["Custom Target Alpha"] = "사용자 설정 대상 투명도"
L["Custom Target Scale"] = "사용자 설정 대상 크기 비율"
L["Custom Text"] = "사용자 설정 문자"
L["Custom Transparency"] = "사용자 설정 투명도"
L["Custom-Text-specific"] = "사용자 설정-문자-특정"
L["Darnavan"] = "다르나반"
L["Debuffs On Friendly Units"] = "우호적 유닛에게 걸린 약화 효과"
L["Default Buff Color"] = "기본 강화 효과 색상"
L["Default Debuff Color"] = "기본 약화 효과 색상"
L["Default Settings"] = "기본 설정"
L["Default Settings (All Profiles)"] = "기본 설정 (모든 프로필)"
L["Deficit Text"] = "손실 문자"
L["Define a custom alpha for this nameplate and overwrite any other alpha settings."] = "이 이름표에 사용자 설정 투명도를 지정하고 다른 투명도 설정을 덮어씁니다."
L["Define a custom color for this nameplate and overwrite any other color settings."] = "이 이름표에 사용자 설정 색상을 지정하고 다른 색상 설정을 덮어씁니다."
L["Define a custom scaling for this nameplate and overwrite any other scaling settings."] = "이 이름표에 사용자 설정 크기 변경을 지정하고 다른 크기 변경 설정을 덮어씁니다."
L["Define a custom transparency for this nameplate and overwrite any other transparency settings."] = "이 이름표에 사용자 설정 투명도를 정의하고 다른 모든 투명도 설정을 덮어씁니다."
L["Define base alpha settings for various unit types. Only one of these settings is applied to a unit at the same time, i.e., they are mutually exclusive."] = "여러 유닛 유형들의 기본 투명도 설정을 정의합니다. 이 설정들 중 동시에 하나만 유닛에 적용됩니다, 즉, 상호 배타적입니다."
L["Define base scale settings for various unit types. Only one of these settings is applied to a unit at the same time, i.e., they are mutually exclusive."] = "여러 유닛 유형들의 기본 크기 비율 설정을 정의합니다. 이 설정들 중 동시에 하나만 유닛에 적용됩니다, 즉, 상호 배타적입니다."
L["Define if threat feedback should be shown for various units based on their type or status."] = "유형 또는 상태에 따라 여러 유닛들에 대한 위협 수준 피드백을 표시할 지 여부를 정의합니다."
L["Deformed Fanatic"] = "변형된 광신자"
L["Determine your role (tank/dps/healing) automatically based on current spec."] = "현재 전문화에 따라 자동으로 당신의 역할 (방어 전담/공격 전담/치유 전담)을 판단합니다."
L["Disable Custom Alpha"] = "사용자 설정 투명도 비활성"
L["Disable Custom Scale"] = "사용자 설정 크기 비율 비활성"
L["Disable threat scale for target marked, mouseover or casting units."] = "징표 대상, 마우스오버 또는 시전 중인 유닛의 위협 수준 크기 비율을 비활성합니다."
L["Disable threat transparency for target marked, mouseover or casting units."] = "징표 대상, 마우스오버 또는 시전 중인 유닛의 위협 수준 투명도를 비활성합니다."
L["Disables nameplates (healthbar and name) for the units of this type and only shows an icon (if enabled)."] = "이 유형의 유닛의 이름표 (생명력바와 이름)를 비활성하고 아이콘만 표시합니다 (활성화 했을 때만)."
L["Disables the custom alpha setting for this nameplate and instead uses your normal alpha settings."] = "이 이름표에 사용자 설정 투명도를 비활성하고 일반 투명도 설정을 사용합니다."
L["Disables the custom scale setting for this nameplate and instead uses your normal scale settings."] = "이 이름표에 사용자 설정 크기 비율을 비활성하고 일반 크기 비율 설정을 사용합니다."
L["Disabling this will turn off all icons for custom nameplates without harming other custom settings per nameplate."] = "비활성하면 이름표 당 다른 사용자 설정에 영향을 주지 않고 사용자 설정 이름표의 모든 아이콘을 끕니다."
L["Disconnected Units"] = "접속 종료 유닛"
L["Display health amount text."] = "생명력 수치를 문자로 표시합니다."
L["Display health percentage text."] = "생명력 백분율 문자를 표시합니다."
L["Display health text on targets with full HP."] = "가득 찬 HP의 대상에 생명력 문자를 표시합니다."
L["Display Settings"] = "표시 설정"
L["Do not sort auras."] = "효과를 정렬하지 않습니다."
L["Don't Switch"] = "전환하지 않기"
L["DPS/Healing"] = "공격 전담/치유 전담"
L["Drudge Ghoul"] = "노역꾼 구울"
L["Duration"] = "지속시간"
L["Ebon Gargoyle"] = "칠흑의 가고일"
L["Edge Size"] = "모서리 크기"
L["Elite Border"] = "정예 테두리"
L["Elite Icon"] = "정예 아이콘"
L["Elite Icon Style"] = "정예 아이콘 스타일"
L["Empowered Adherent"] = "강화된 신봉자"
L["Enable"] = "사용"
L["Enable Adjustments"] = "조정 사용"
L["Enable Alpha Threat"] = "위협 수준 투명도 사용"
L["Enable Arena Widget"] = "투기장 장치 사용"
L["Enable Aura Widget 2.0"] = "효과 장치 2.0 사용"
L["Enable Blizzard 'On-Target' Fading"] = "블리자드 '지정 대상' 흐려짐 사용"
L["Enable Boss Mods Widget"] = "우두머리 모듈 장치 활성화"
L["Enable Class Icons Widget"] = "직업 아이콘 장치 사용"
L["Enable Coloring"] = "색상화 사용"
L["Enable Combo Points Widget"] = "연계 점수 장치 사용"
L["Enable Custom Alpha"] = "사용자 설정 투명도 사용"
L["Enable Custom Color"] = "사용자 설정 색상 사용"
L["Enable Custom Colors"] = "사용자 설정 색상 사용"
L["Enable Custom Scale"] = "사용자 설정 크기 비율 사용"
L["Enable Enemy"] = "적 사용"
L["Enable Friendly"] = "아군 사용"
L["Enable Friends"] = "친구 사용"
L["Enable Guild Members"] = "길드원 사용"
L["Enable Headline View (Text-Only)"] = "헤드라인 보기 (문자만) 사용"
L["Enable nameplate clickthrough for enemy units."] = "적 유닛의 이름표에 클릭 무시를 사용합니다."
L["Enable nameplate clickthrough for friendly units."] = "아군 유닛의 이름표에 클릭 무시를 사용합니다."
L["Enable Healer Tracker"] = "힐러 추적기 사용"
L["Enable Nameplates"] = "이름표 사용"
L["Enable Quest Widget"] = "퀘스트 장치 사용"
L["Enable Resource Widget"] = "자원 장치 사용"
L["Enable Scale Threat"] = "위협 수준 크기 비율 사용"
L["Enable Shadow"] = "그림자 사용"
L["Enable Social Widget"] = "소셜 장치 사용"
L["Enable Stealth Widget (Feature not yet fully implemented!)"] = "은신 장치 사용 (완전하지 않은 기능입니다!)"
L["Enable Target Highlight Widget"] = "대상 강조 장치 사용"
L["Enable Threat Coloring of Healthbar"] = "생명력바의 위협 수준 색상화 사용"
L["Enable Threat Feedback"] = "위협 수준 피드백 활성화"
L["Enable Threat Scale"] = "위협 수준 크기 비율 활성화"
L["Enable Threat System"] = "위협 수준 체제 사용"
L["Enable Threat Textures"] = "위협 수준 텍스쳐 사용"
L["Enable Threat Transparency"] = "위협 수준 투명도 활성화"
L["Enabled Threat Glow"] = "위협 수준 반짝임 사용"
L["Enabling this will allow you to set the alpha adjustment for non-target nameplates."] = "사용하면 대상이 아닌 이름표에 투명도 조정 설정을 허용합니다."
L["Enabling this will allow you to set the alpha adjustment for non-target names in headline view."] = "사용하면 대상이 아닌 헤드라인 이름에 투명도 조정 설정을 허용합니다."
L["Enemy Casting"] = "적 시전"
L["Enemy Custom Text"] = "적 사용자 설정 문자"
L["Enemy Headline Color"] = "적 헤드라인 색상"
L["Enemy Name Color"] = "적 이름 색상"
L["Enemy NPCs"] = "적 NPC"
L["Enemy Players"] = "적 플레이어"
L["Enemy Status Text"] = "적 상태 문자"
L["Enemy Units"] = "적 유닛"
L["Everything"] = "모두"
L["Faction Icon"] = "진영 아이콘"
L["Fanged Pit Viper"] = "송곳니 구덩이독사"
L["Filter by Dispel Type"] = "무효화 유형으로 필터"
L["Filter by Spell"] = "주문으로 필터"
L["Filter by Unit Reaction"] = "유닛 반응으로 필터"
L["Filtered Auras"] = "필터링할 효과"
L["Filtering"] = "필터링"
L["Font"] = "글꼴"
L["Font Size"] = "글꼴 크기"
L["Font Style"] = "글꼴 스타일"
L["Force Headline View while Out-of-Combat"] = "전투 중이 아닐 때 강제 헤드라인 보기"
L["Force Healthbar on Target"] = "대상에 강제 생명력바"
L["Force View By Status"] = "상태 별 강제 보기"
L["Foreground Texture"] = "전경 텍스쳐"
L["Friend"] = "친구"
L["Friendly & Neutral Units"] = "아군 & 중립 유닛"
L["Friendly ames Color"] = "아군 이름 색상"
L["Friendly Caching"] = "아군 캐시"
L["Friendly Casting"] = "아군 시전"
L["Friendly Custom Text"] = "아군 사용자 설정 문자"
L["Friendly Headline Color"] = "아군 헤드라인 색상"
L["Friendly Name Color"] = "아군 이름 색상"
L["Friendly Names Color"] = "아군 이름 색상"
L["Friendly NPCs"] = "우호적 NPC"
L["Friendly Players"] = "우호적 플레이어"
L["Friendly Status Text"] = "아군 상태 문자"
L["Friendly Units"] = "우호적 유닛"
L["Friendly Units in Combat"] = "전투 중 아군 유닛"
L["Friends & Guild Members"] = "친구 & 길드원"
L["Gas Cloud"] = "가스 구름"
L["General Colors"] = "일반 색상"
L["General Nameplate Settings"] = "일반 이름표 설정"
L["General Settings"] = "일반 설정"
L["Group Quest"] = "파티 퀘스트"
L["Guardians"] = "경비병"
L["Guild Member"] = "길드원"
L["Headline View"] = "헤드라인 보기"
L["Headline View X"] = "헤드라인 보기 X"
L["Headline View Y"] = "헤드라인 보기 Y"
L["Health"] = "생명력"
L["Health Coloring"] = "생명력 색상화"
L["Health Text"] = "생명력 문자"
L["Healthbar Mode"] = "생명력바 모드"
L["Healthbar View"] = "생명력바 보기"
L["Healthbar View X"] = "생명력바 보기 X"
L["Healthbar View Y"] = "생명력바 보기 Y"
L["Healthbar X"] = "생명력바 X"
L["Healthbar Y"] = "생명력바 Y"
L["Healer Tracker"] = "힐러 추적기"
L["Hide Friendly Units"] = "우호적 유닛 숨기기"
L["Hide Healthbars"] = "생명력바 숨기기"
L["Hide in Combat"] = "전투 중 숨기기"
L["Hide in Instance"] = "인스턴스에서 숨기기"
L["Hide Nameplate"] = "이름표 숨기기"
L["Hide Nameplates"] = "이름표 숨기기"
L["Hide on Attacked Units"] = "공격당한 유닛 숨기기"
L["Hide Special Units"] = "특별한 유닛 숨기기"
L["High Threat"] = "높은 위협 수준"
L["Highlight Mobs on Off-Tanks"] = "방어 중이지 않은 몹 강조"
L["Highlight Texture"] = "강조 텍스쳐"
L["Horizontal Align"] = "수평 조절"
L["Horizontal Alignment"] = "가로 정렬"
L["Horizontal Spacing"] = "가로 간격"
L["Hostile NPCs"] = "적대적 NPC"
L["Hostile Players"] = "적대적 플레이어"
L["Icon"] = "아이콘"
L["Icon Mode"] = "아이콘 모드"
L["Icon Style"] = "아이콘 스타일"
L["If checked, nameplates of mobs attacking another tank can be shown with different color, scale, and opacity."] = "선택하면 다른 방어 전담을 공격 중인 몹의 이름표가 다른 색상, 크기 비율, 투명도로 표시됩니다."
L["If checked, nameplates of mobs attacking another tank can be shown with different color, scale, and transparency."] = "선택하면 다른 방어 전담을 공격하는 몹의 이름표의 색상, 크기 비율, 그리고 투명도를 다르게 표시할 수 있습니다."
L["If checked, threat feedback from boss level mobs will be shown."] = "선택하면 우두머리 레벨 몹의 위협 수준 피드백이 표시됩니다."
L["If checked, threat feedback from elite and rare mobs will be shown."] = "선택하면 정예와 희귀 몹의 위협 수준 피드백이 표시됩니다."
L["If checked, threat feedback from minor mobs will be shown."] = "선택하면 하급 몹의 위협 수준 피드백이 표시됩니다."
L["If checked, threat feedback from mobs you're currently not in combat with will be shown."] = "선택하면 자신과 전투 중이지 않은 몹의 위협 수준 피드백이 표시됩니다."
L["If checked, threat feedback from neutral mobs will be shown."] = "선택하면 중립 몹의 위협 수준 피드백이 표시됩니다."
L["If checked, threat feedback from normal mobs will be shown."] = "선택하면 일반 몹의 위협 수준 피드백이 표시됩니다."
L["If checked, threat feedback from tapped mobs will be shown regardless of unit type."] = "선택하면 유닛 유형에 상관없이 선점된 몹의 위협 수준 피드백이 표시됩니다."
L["If checked, threat feedback will only be shown in instances (dungeons, raids, arenas, battlegrounds), not in the open world."] = "선택하면 위협 수준 피드백이 인스턴스 내에서만 표시되며, 야외에선 표시되지 않습니다 (던전, 공격대, 투기장, 전장)."
L["If enabled your nameplates alpha will always be the setting below when you have no target."] = "활성화하면 대상으로 지정하지 않은 이름표 투명도가 아래 설정으로 변경됩니다."
L["If enabled your nameplates scale will always be the setting below when you have no target."] = "활성화하면 대상으로 지정하지 않은 이름표 크기 비율이 아래 설정으로 변경됩니다."
L["If enabled your target's alpha will always be the setting below."] = "활성화하면 자신의 대상의 투명도가 항상 아래 설정으로 변경됩니다."
L["If enabled your target's scale will always be the setting below."] = "활성화하면 자신의 대상의 크기 비율이 항상 아래 설정으로 변경됩니다."
L["Ignore Marked Units"] = "징표 유닛 무시"
L["Ignored Alpha"] = "투명도 무시"
L["Ignored Scaling"] = "크기 변경 무시"
L["Immortal Guardian"] = "불멸의 수호병"
L["In combat, use alpha based on threat level as configured in the threat system. The custom alpha is only used out of combat."] = "전투 중에 위협 수준 체제에서 구성된 위협 수준에 따른 투명도를 사용합니다. 사용자 설정 투명도는 비 전투 중에만 사용됩니다."
L["In combat, use coloring based on threat level as configured in the threat system. The custom color is only used out of combat."] = "전투 중에 위협 수준 체제에서 구성된 위협 수준에 따른 색상을 사용합니다. 사용자 설정 색상은 비 전투 중에만 사용됩니다."
L["In combat, use coloring, alpha, and scaling based on threat level as configured in the threat system. Custom settings are only used out of combat."] = "전투 중에 위협 수준 체제에서 구성된 위협 수준에 따른 색상, 투명도, 크기 변경을 사용합니다. 사용자 설정은 비 전투 중에만 사용됩니다."
L["In combat, use coloring, transparency, and scaling based on threat level as configured in the threat system. Custom settings are only used out of combat."] = "전투 중에 위협 수준 체제에서 구성된 위협 수준 단계에 따른 색상화, 투명도, 그리고 크기 비율 변경을 사용합니다. 사용자 설정은 비 전투 중에만 사용됩니다."
L["In combat, use scaling based on threat level as configured in the threat system. The custom scale is only used out of combat."] = "전투 중에 위협 수준 체제에서 구성된 위협 수준에 따른 크기 변경을 사용합니다. 사용자 설정 크기 비율은 비 전투 중에만 사용됩니다."
L["Interruptable Casts"] = "방해 가능 한 시전"
L["Kinetic Bomb"] = "요동치는 폭탄"
L["Label Text Offset"] = "라벨 문자 위치"
L["Layout"] = "배치"
L["Left-to-right"] = "왼쪽에서 오른쪽으로"
L["Level"] = "레벨"
L["Level Text"] = "레벨 문자"
L["Lich King"] = "리치 왕"
L["Living Ember"] = "살아있는 불씨"
L["Living Inferno"] = "살아있는 지옥불"
L["Look and Feel"] = "모양과 느낌"
L["Low Threat"] = "낮은 위협 수준"
L["Marked Immortal Guardian"] = "표시된 불멸의 수호병"
L["Max HP Text"] = "가득 찬 HP 문자"
L["Medium Threat"] = "중간 위협 수준"
L["Migrating deprecated settings in configuration ..."] = "구성에서 사용되지 않는 설정 이전 중..."
L["Minions & By Status"] = "하수인 & 상태 별"
L["Minor"] = "하급"
L["Minuss"] = "하급"
L["Mode"] = "모드"
L["Mono"] = "모노"
L["Mouseover"] = "마우스오버"
L["Mouseover Units"] = "마우스오버 유닛"
L["Muddy Crawfish"] = "진흙투성이 가재"
L["Name Text"] = "이름 문자"
L["Nameplate Clickthrough"] = "이름표 클릭 무시"
L["Nameplate clickthrough cannot be changed while in combat."] = "전투 중엔 이름표 클릭 무시를 변경할 수 없습니다."
L["Nameplate Settings"] = "이름표 설정"
L["Nameplate Style"] = "이름표 스타일"
L["Names"] = "이름"
L["Neutral NPCs"] = "중립 NPC"
L["Neutral Units"] = "중립 유닛"
L["Neutral Units & Minions & Status"] = "중립 유닛 & 하수인 & 상태"
L["No"] = "아니오"
L["No Outline, Monochrome"] = "외곽선 없음, 모노크롬"
L["No Target"] = "대상 없음"
L["No target found."] = "대상을 찾을 수 없습니다."
L["Non-Attacked Units"] = "공격받지 않은 유닛"
L["None"] = "없음"
L["Non-Target"] = "비-대상"
L["Non-Target Alpha"] = "비-대상 투명도"
L["Normal Border"] = "일반 테두리"
L["Normal Units"] = "일반 유닛"
L["Nothing to paste!"] = "붙여넣기 할게 없습니다!"
L["NPC Role"] = "NPC 역할"
L["NPC Role, Guild"] = "NPC 역할, 길드"
L["NPC Role, Guild, or Level"] = "NPC 역할, 길드, 또는 레벨"
L["NPCs"] = "NPC"
L["Offset"] = "위치"
L["Offset X"] = "X 좌표"
L["Offset Y"] = "Y 좌표"
L["Off-Tank"] = "방어 안함"
L["On Enemy Units You Cannot Attack"] = "공격할 수 없는 적 유닛"
L["On Friendly Units in Combat"] = "전투 중 아군 유닛"
L["On Target"] = "대상"
L["Only Alternate Power"] = "보조 마력만"
L["Only in Instances"] = "인스턴스에서만"
L["Only on Attacked Units"] = "공격당한 유닛만"
L["Onyxian Whelp"] = "오닉시아 새끼용"
L["Open Blizzard Settings"] = "블리자드 설정 열기"
L["Open Config"] = "설정 열기"
L["Open Options"] = "옵션 열기"
L["Options"] = "옵션"
L["options:"] = "옵션:"
L["Out of Combat"] = "비 전투"
L["Outline"] = "외곽선"
L["Outline, Monochrome"] = "외곽선, 모노크롬"
L["Paste"] = "붙여넣기"
L["Pasted!"] = "붙여넣었습니다!"
L["Percent Text"] = "백분율 문자"
L["Pets"] = "소환수"
L["Placement"] = "배치"
L["Player Quest"] = "플레이어 퀘스트"
L["Players"] = "플레이어"
L["Presences"] = "형상"
L["Preview"] = "미리보기"
L["Quest"] = "퀘스트"
L["Quests of your group members that you don't have in your quest log or that you have already completed."] = "당신의 퀘스트 목록에 없거나 당신이 이미 완료한 당신의 파티원들의 퀘스트입니다."
L["Raging Spirit"] = "노여워하는 영혼"
L["Rares & Bosses"] = "희귀 & 우두머리"
L["Rares & Elites"] = "희귀 & 정예"
L["Reanimated Adherent"] = "되살아난 신봉자"
L["Reanimated Fanatic"] = "되살아난 광신자"
L["Render font without antialiasing."] = "계단 현상 방지 기능없이 글꼴을 표현합니다."
L["Resource"] = "자원"
L["Resource Bar"] = "자원 바"
L["Resource Text"] = "자원 문자"
L["Restore Defaults"] = "기본값 복구"
L["Reverse Order"] = "순서 반대로"
L["Reverse the sort order (e.g., \"A to Z\" becomes \"Z to A\")."] = "정렬 순서를 반대로 바꿉니다 (예. \"가나다 순\"이 \"다나가 순\"이 됩니다)."
L["Reverting default settings back to look and feel before 8.4 ..."] = "기본 설정을 8.4 이전의 모양과 느낌으로 전한 중 ..."
L["Right-to-left"] = "오른쪽에서 왼쪽으로"
L["Row Limit"] = "행 제한"
L["Same as Background"] = "배경과 동일하게"
L["Same as Foreground"] = "전경과 똑같이"
L["Same as Headline"] = "헤드라인과 동일하게"
L["Scale"] = "크기 비율"
L["Scale by Status"] = "상태 별 크기 비율"
L["Seals"] = "문장"
L["Set alpha settings for different threat levels."] = "위협 수준 등급에 따라 투명도를 설정합니다."
L["Set Icon"] = "아이콘 설정"
L["Set Name"] = "이름 설정"
L["Set scale settings for different threat levels."] = "위협 수준 등급에 따라 크기 비율을 설정합니다."
L["Set the outlining style of the text."] = "문자의 외곽선 스타일을 설정합니다."
L["Set the roles your specs represent."] = "전문화에 맞는 역할을 설정합니다."
L["Set threat textures and their coloring options here."] = "여기서 위협 수준 텍스쳐와 색상화 옵션을 설정합니다."
L["Set transparency settings for different threat levels."] = "다른 위협 수준 단계에 투명도 설정을 지정합니다."
L["Sets your spec "] = "당신의 전문화 "
L["Shadow"] = "그림자"
L["Shadow Fiend"] = "어둠의 마귀"
L["Shadowy Apparition"] = "그림자 원혼"
L["Shambling Horror"] = "휘청거리는 괴물"
L["Shapeshifts"] = "변신"
L["Shielded Coloring"] = "방해 불가 색상화"
L["Show a glow based on threat level around the nameplate's healthbar (in combat)."] = "이름표의 생명력바 주위에 위협 수준 등급에 따라 반짝임을 표시합니다 (전투 중)."
L["Show Absorbs"] = "흡수 표시"
L["Show all debuffs on friendly units that you can cure."] = "자신이 해제할 수 있는 우호적 유닛에게 걸린 모든 약화 효과를 표시합니다."
L["Show all nameplates (CTRL-V)."] = "모든 이름표 표시 (CTRL-V)."
L["Show an quest icon at the nameplate for quest mobs."] = "퀘스트 몹의 이름표에 퀘스트 아이콘을 표시합니다."
L["Show auras as bars (with optional icons)."] = "효과를 바 형식으로 표시합니다 (선택적 아이콘 사용)."
L["Show auras as icons in a grid configuration."] = "격자 구성의 아이콘으로 효과를 표시합니다."
L["Show auras in order created with oldest aura first."] = "효과를 오래된 순으로 표시합니다."
L["Show Blizzard Nameplates for Friendly Units"] = "우호적 유닛에 블리자드 이름표 표시"
L["Show Border"] = "테두리 표시"
L["Show Buffs on Bosses"] = "우두머리에 강화 효과 표시"
L["Show By Status"] = "상태 별 표시"
L["Show By Unit Type"] = "유닛 유형 별 표시"
L["Show Castbar"] = "시전바 표시"
L["Show Castbar in Headline View"] = "헤드라인 보기에 시전바 표시"
L["Show Elite Border"] = "정예 테두리 표시"
L["Show Elite Icon"] = "정예 아이콘 표시"
L["Show Enemy"] = "적대적 대상 표시"
L["Show enemy nameplates (ALT-V)."] = "적 이름표 표시 (ALT-V)."
L["Show Enemy Totems"] = "적대적 토템 표시"
L["Show Enemy Units"] = "적 유닛 표시"
L["Show For"] = "표시:"
L["Show Friendly"] = "아군 표시"
L["Show Friendly Class Icons"] = "아군 직업 아이콘 표시"
L["Show friendly nameplates (SHIFT-V)."] = "아군 이름표 표시 (SHIFT-V)."
L["Show Friendly Totems"] = "우호적 토템 표시"
L["Show Friendly Units"] = "우호적 유닛 표시"
L["Show Health Text"] = "생명력 문자 표시"
L["Show Icon to the Left"] = "왼쪽에 아이콘 표시"
L["Show in Headline View"] = "헤드라인 보기에 표시"
L["Show in Healthbar View"] = "생명력바 보기에 표시"
L["Show Level Text"] = "레벨 문자 표시"
L["Show Mouseover"] = "마우스오버 표시"
L["Show Name Text"] = "이름 문자 표시"
L["Show Nameplate"] = "이름표 표시"
L["Quest Progress"] = "퀘스트 세부 정보 표시"
L["Show Neutral Units"] = "중립 유닛 표시"
L["Show Overlay for Uninterruptable Casts"] = "방해할 수 없는 시전에 오버레이 표시"
L["Show shadow with text."] = "문자에 그림자를 표시합니다."
L["Show Skull Icon"] = "해골 아이콘 표시"
L["Show Spell Icon"] = "주문 아이콘 표시"
L["Show Spell Text"] = "주문 문자 표시"
L["Show stack count as overlay on aura icon."] = "효과 아이콘에 중첩 횟수를 표시합니다."
L["Show Target"] = "대상 표시"
L["Show Target Mark Icon in Headline View"] = "헤드라인 보기에 대상 징표 아이콘 표시"
L["Show Target Mark Icon in Healthbar View"] = "생명력바 보기에 대상 징표 아이콘 표시"
L["Show the amount you need to loot or kill"] = "약탈하거나 죽이기 위해 필요한 금액 표시"
L["Show the mouseover highlight on all units."] = "모든 유닛에 마우스오버 강조를 표시합니다."
L["Show threat feedback based on unit type or status or environmental conditions."] = "위협 수준 피드백을 유닛 유형이나 상태 또는 환경 상황에 따라 표시합니다."
L["Show threat feedback for units based on their type or status or your current area."] = "유닛에 대한 위협 수준 피드백을 유형이나 상태 또는 당신의 현재 지역에 따라 표시합니다."
L["Show Threat Feedback From"] = "위협 수준 피드백 표시: "
L["Show Threat Glow"] = "위협 수준 반짝임 표시"
L["Show threat glow only on units in combat with the player."] = "플레이어와 전투 중인 유닛에만 위협 수준 반짝임을 표시합니다."
L["Shows a border around the castbar of nameplates (requires /reload)."] = "이름표의 시전바 주위에 테두리를 표시합니다 (/reload 필요)."
L["Shows a faction icon next to the nameplate of players."] = "플레이어의 이름표 옆에 진영 아이콘을 표시합니다."
L["Shows a glow based on threat level around the nameplate's healthbar (in combat)."] = "이름표의 생명력바 주위에 위협 수준에 따라 반짝임 효과를 표시합니다 (전투 중)."
L["Shows an icon for friends and guild members next to the nameplate of players."] = "플레이어의 이름표 옆에 친구와 길드원 아이콘을 표시합니다."
L["Shows resource information for bosses and rares."] = "우두머리와 희귀의 자원 정보를 표시합니다."
L["Shows resource information only for alternatve power (of bosses or rares, mostly)."] = "보조 마력의 자원 정보만 표시합니다 (대부분 우두머리 또는 희귀의)."
L["Situational Scale"] = "상황 별 크기 비율"
L["Situational Transparency"] = "상황 별 투명도"
L["Size"] = "크기"
L["Sizing"] = "크기 조절"
L["Skull"] = "해골"
L["Skull Icon"] = "해골 아이콘"
L["Social"] = "소셜"
L["Sort by overall duration in ascending order."] = "전체 지속시간을 오름차순으로 정렬합니다."
L["Sort by time left in ascending order."] = "남은 시간을 오름차순으로 정렬합니다."
L["Sort in ascending alphabetical order."] = "가나다 순의 오름차순으로 정렬합니다."
L["Sort Order"] = "정렬 순서"
L["Spec Roles"] = "전문화 역할"
L["Special Effects"] = "특별한 효과"
L["Spell Icon"] = "주문 아이콘"
L["Spell Text"] = "주문 문자"
L["Spirit Wolf"] = "늑대 정령"
L["Square"] = "정사각형"
L["Stack Count"] = "중첩 횟수"
L["Stances"] = "태세"
L["Status Text"] = "상태 문자"
L["Stealth"] = "은신"
L["Style"] = "스타일"
L["Switch"] = "전환하기"
L["Symbol"] = "상징"
L["Tank"] = "방어 전담"
L["Tapped Units"] = "선점된 유닛"
L["Target"] = "대상"
L["Target Highlight"] = "대상 강조"
L["Target Marked"] = "징표 대상"
L["Target Marked Units"] = "징표 지정된 유닛"
L["Target Markers"] = "대상 징표"
L["Target Only"] = "대상만"
L["Target Unit"] = "대상 유닛"
L["Target-based Scale"] = "대상 기반 크기 비율"
L["Target-based Transparency"] = "대상 기반 투명도"
L["Text at Full HP"] = "가득 찬 HP 문자"
L["Text Boundaries"] = "문자 경계"
L["Text Bounds and Sizing"] = "문자 범위와 크기 조절"
L["Text Height"] = "문자 높이"
L["Text Width"] = "문자 너비"
L["Texture"] = "텍스쳐"
L["Textures"] = "텍스쳐"
L["The scale of all nameplates if you have no target unit selected."] = "대상 유닛을 선택하지 않았을 때 모든 이름표의 크기 비율입니다."
L["The scale of non-target nameplates if a target unit is selected."] = "대상 유닛을 선택했을 때 비-대상 이름표의 크기 비율입니다."
L["The target nameplate's scale if a target unit is selected."] = "대상 유닛을 선택했을 때 대상 이름표의 크기 비율입니다."
L["The target nameplate's transparency if a target unit is selected."] = "대상 유닛을 선택했을 때 대상 이름표의 투명도입니다."
L["The transparency of all nameplates if you have no target unit selected."] = "대상 유닛을 선택하지 않았을 때 모든 이름표의 투명도입니다."
L["The transparency of non-target nameplates if a target unit is selected."] = "대상 유닛을 선택했을 때 비-대상 이름표의 투명도입니다."
L["These options allow you to control whether target marker icons are hidden or shown on nameplates and whether a nameplate's healthbar (in healthbar view) or name (in headline view) are colored based on target markers."] = "이 옵션은 이름표에 대상 징표 아이콘을 숨기거나 표시하고 이름표의 생명력바 (생명력바 보기에서) 또는 이름 (헤드라인 보기에서)에 대상 징표에 따른 색상을 입힐 지 제어할 수 있게 해줍니다."
L["These options allow you to control whether the castbar is hidden or shown on nameplates."] = "이 옵션은 이름표에 시전바를 숨기거나 표시하도록 제어할 수 있게 해줍니다."
L["These options allow you to control which nameplates are visible within the game field while you play."] = "이 옵션은 플레이하는 동안 게임 영역 내에서 볼수 있는 이름표를 제어할 수 있게 해줍니다."
L["These settings will define the space that text can be placed on the nameplate. Having too large a font and not enough height will cause the text to be not visible."] = "이름표 위에 위치할 수 있는 문자의 공간을 정의하는 설정입니다. 매우 큰 글꼴에 공간을 부족하게 설정하면 문자가 표시되지 않습니다."
L[ [=[These settings will define the space that text can be placed on the nameplate.
Having too large a font and not enough height will cause the text to be not visible.]=] ] = [=[이름표에서 문자가 위치할 수 있는 공간을 정의하는 설정입니다.
글꼴이 너무 크거나 충분한 높이가 없으면 문자가 보여지지 않습니다.]=]
L["Thick"] = "두껍게"
L["Thick Outline"] = "두꺼운 외곽선"
L["Thick Outline, Monochrome"] = "두꺼운 외곽선, 모노크롬"
L["This allows you to save friendly player class information between play sessions or nameplates going off the screen. |cffff0000(Uses more memory)"] = "플레이 세션 간에 또는 이름표가 화면에서 사라질 때 우호적 플레이어의 직업 정보를 저장할 수 있게 해줍니다. |cffff0000(메모리를 더 많이 사용합니다)"
L["This lets you select the layout style of the aura widget."] = "효과 장치의 배치 스타일을 선택할 수 있습니다."
L["This lets you select the layout style of the aura widget. (requires /reload)"] = "효과 장치의 배치 스타일을 선택할 수 있습니다. (/reload 필요)"
L["This option allows you to control whether a spell's icon is hidden or shown on castbars."] = "이 옵션은 시전바에 주문의 아이콘을 숨기거나 표시하도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether a spell's name is hidden or shown on castbars."] = "이 옵션은 시전바에 주문의 이름을 숨기거나 표시하도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether a unit's health is hidden or shown on nameplates."] = "이 옵션은 이름표에 유닛의 생명력을 숨기거나 표시하도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether a unit's level is hidden or shown on nameplates."] = "이 옵션은 이름표에 유닛의 레벨을 숨기거나 표시하도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether a unit's name is hidden or shown on nameplates."] = "이 옵션은 이름표에 유닛의 이름을 숨기거나 표시하도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether custom settings for nameplate style, color, alpha and scaling should be used for this nameplate."] = "이 옵션은 이름표의 모양, 색상, 투명도와 크기 변경에 대한 사용자 설정을 이 이름표에 적용할 수 있도록 해줍니다."
L["This option allows you to control whether custom settings for nameplate style, color, transparency and scaling should be used for this nameplate."] = "이 옵션은 이 이름표에 사용자 설정 이름표 모양, 색상, 투명도와 크기 비율 변경을 사용할 수 있도록 허용합니다."
L["This option allows you to control whether headline view (text-only) is enabled for nameplates."] = "이 옵션은 이름표를 헤드라인 보기(문자만)로 사용하도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether nameplates should fade in or out when displayed or hidden."] = "이 옵션은 이름표가 표시되거나 숨겨질 때 서서히 나타나거나 사라지도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether textures are hidden or shown on nameplates for different threat levels. Dps/healing uses regular textures, for tanking textures are swapped."] = "이 옵션은 위협 수준 등급에 따라 이름표에 텍스쳐를 표시할 지 숨길 지 제어할 수 있도록 해줍니다. Dps/치유는 보통 텍스쳐를 사용하고, 방어 전담 텍스쳐는 교체됩니다."
L["This option allows you to control whether the custom icon is hidden or shown on this nameplate."] = "이 옵션은 이 이름표에 사용자 설정 아이콘을 숨기거나 표시하도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether the elite icon for elite units is hidden or shown on nameplates."] = "이 옵션은 이름표에 정예 유닛의 정예 아이콘을 숨기거나 표시하도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether the skull icon for rare units is hidden or shown on nameplates."] = "이 옵션은 이름표에 희귀 유닛의 해골 아이콘을 숨기거나 표시하도록 제어할 수 있게 해줍니다."
L["This option allows you to control whether threat affects the alpha of nameplates."] = "이 옵션은 위협 수준이 이름표의 투명도에 영향을 줄 지 제어할 수 있게 해줍니다."
L["This option allows you to control whether threat affects the healthbar color of nameplates."] = "이 옵션은 위협 수준이 이름표의 생명력바 색상에 영향을 줄 지 제어할 수 있게 해줍니다."
L["This option allows you to control whether threat affects the scale of nameplates."] = "이 옵션은 위협 수준이 이름표의 크기 비율에 영향을 줄 지 제어할 수 있게 해줍니다."
L["This option allows you to control whether threat affects the transparency of nameplates."] = "이 옵션은 위협 수준이 이름표의 투명도를 변경할 수 있도록 허용합니다."
L["This setting will disable threat scale for target marked, mouseover or casting units and instead use the general scale settings."] = "이 설정은 징표 대상, 마우스오버 또는 시전 중인 유닛에 위협 수준 크기 비율을 비활성하고 대신 기본 크기 비율 설정을 사용합니다."
L["This setting will disable threat transparency for target marked, mouseover or casting units and instead use the general transparency settings."] = "이 설정은 징표 대상, 마우스오버 또는 시전 중인 유닛에 위협 수준 투명도를 비활성하고 대신 기본 투명도 설정을 사용합니다."
L["This widget shows a highlight border around the healthbar of your target's nameplate."] = "이 장치는 현재 대상의 이름표의 생명력바 주변에 강조 테두리를 표시합니다."
L["This widget shows a highlight border around your target nameplate."] = "자신의 대상 이름표 주위에 강조 테두리를 표시하는 장치입니다."
L["This widget shows a highlight border around your target's nameplate or colors the healthbar of your target's nameplate in a custom color."] = "이 장치는 자신의 현재 대상의 이름표 주변에 강조 테두리를 표시하거나 대상의 이름표의 생명력바에 사용자 설정 색상을 입힙니다."
L["This widget shows a quest icon above unit nameplates or colors the nameplate healthbar of units that are involved with any of your current quests."] = "자신의 현재 퀘스트와 관련된 유닛 이름표 위에 퀘스트 아이콘을 표시하거나 유닛의 이름표 생명력바에 색상을 입히는 장치입니다."
L["This widget shows a stealth icon on nameplates of units that can detect stealth."] = "은신을 감지할 수 있는 유닛의 이름표에 은신 아이콘을 표시하는 장치입니다."
L["This widget shows a unit's auras (buffs and debuffs) on its nameplate."] = "이름표에 유닛의 효과(강화 효과와 약화 효과)를 표시하는 장치입니다."
L["This widget shows auras from boss mods on your nameplate (since patch 7.2, hostile nameplates only in instances and raids)."] = "이 장치는 당신의 이름표에 우두머리 모듈의 효과를 표시합니다 (7.2패치 이후부터, 인스턴스와 공격대 내에서만 적대적 이름표에)."
L["This widget shows class icons on nameplates of players."] = "플레이어의 이름표에 직업 아이콘을 표시하는 장치입니다."
L["This widget shows icons for friends, guild members, and faction on nameplates."] = "이름표에 친구, 길드원, 진영 아이콘을 표시하는 장치입니다."
L["This widget shows information about your target's resource on your target nameplate. The resource bar's color is derived from the type of resource automatically."] = "자신의 대상 이름표에 대상의 자원에 대한 정보를 표시하는 장치입니다. 자원 유형에 따라 자동으로 자원 바의 색상이 변경됩니다."
L["This widget shows various icons (orbs and numbers) on enemy nameplates in arenas for easier differentiation."] = "쉽게 구별하기 위해 투기장에서 다양한 아이콘 (구슬과 숫자)을 적 이름표에 표시하는 장치입니다."
L["This widget shows your combo points on your target nameplate."] = "자신의 연계 점수를 대상 이름표에 표시하는 장치입니다."
L["This widget shows players that are healers."] = "이 위젯은 치료자 인 플레이어를 보여줍니다."
L["This widget will display auras that match your filtering on your target nameplate and others you recently moused over."] = "이 장치는 현재 대상의 이름표나 최근에 마우스를 올렸던 이름표에 자신의 필터링과 일치하는 효과를 표시합니다."
L["This will allow you to add additional scaling changes to specific mob types."] = "특정 몹 유형에 따라 추가적인 크기 변경을 추가하도록 허용합니다."
L["This will allow you to disable threat art on target marked units."] = "대상 징표가 지정된 유닛에 위협 수준 표시를 비활성 할 수 있도록 해줍니다."
L["This will allow you to disable threat scale changes on target marked units."] = "대상 징표가 지정된 유닛에 위협 수준 크기 비율 변경을 비활성 할 수 있게 해줍니다."
L["This will allow you to disabled threat alpha changes on target marked units."] = "대상 징표가 지정된 유닛에 위협 수준 투명도 변경을 비활성할 수 있게 해줍니다."
L["This will color the aura based on its type (poison, disease, magic, curse) - for Icon Mode the icon border is colored, for Bar Mode the bar itself."] = "효과의 유형에 따라 색상을 입힙니다 (독, 질병, 마법, 저주) - 아이콘 모드에선 아이콘 테두리가 색상화되며, 바 모드에선 바 자체에 색을 넣습니다."
L["This will format text to a simpler format using M or K for millions and thousands. Disabling this will show exact HP amounts."] = "백만 단위와 천 단위에 M 이나 K를 사용하여 문자 형식을 더 간단하게 바꿉니다. 비활성하면 정확한 HP 수치를 표시합니다."
L["This will format text to show both the maximum hp and current hp."] = "최대 HP와 현재 HP 둘다 표시합니다."
L["This will format text to show hp as a value the target is missing."] = "대상의 손실 생명력 수치를 표시합니다."
L["This will toggle the aura widget to only show for your current target."] = "효과 장치가 현재 대상만 표시하도록 전환합니다."
L["This will toggle the aura widget to show the cooldown spiral on auras."] = "효과에 재사용 대기시간 나선을 표시 전환합니다."
L["This will toggle the aura widget to show the cooldown spiral on auras. (requires /reload)"] = "효과에 재사용 대기시간 나선을 표시 전환합니다. (/reload 필요)"
L["Threat Glow"] = "위협 수준 반짝임"
L["Threat System"] = "위협 수준 체제"
L["Tidy Plates Fading"] = "Tidy Plates 흐릿하게"
L["Time Left"] = "남은 시간"
L["Time Text Offset"] = "시간 문자 위치"
L["Toggling"] = "전환"
L["Top-to-bottom"] = "위에서 아래로"
L["Totem Alpha"] = "토템 투명도"
L["Totem Nameplates"] = "토템 이름표"
L["Totem Scale"] = "토템 크기 비율"
L["Totem Transparency"] = "토템 투명도"
L["Totems"] = "토템"
L["Transparency"] = "투명도"
L["Transparency & Scaling"] = "투명도 & 크기 비율 변경"
L["Treant"] = "나무정령"
L["Truncate Text"] = "축약 문자"
L["Type direct icon texture path using '\\' to separate directory folders, or use a spellid."] = "'\\'로 디렉토리 폴더를 분리하여 아이콘 무늬 경로를 직접 입력하거나, 주문ID를 사용하세요."
L["Typeface"] = "활자체"
L["Undetermined"] = "분명하지 않음"
L["Uninterruptable Casts"] = "방해할 수 없는 시전"
L["Unit Base Alpha"] = "유닛 기본 투명도"
L["Unit Base Scale"] = "유닛 기본 크기 비율"
L["Unit Base Transparency"] = "유닛 기본 투명도"
L["Unknown option: "] = "알 수 없는 옵션: "
L["Usage: /tptp [options]"] = "사용법: /tptp [옵션]"
L["Use a custom color for healthbar (in healthbar view) or name (in headline view) of friends and/or guild members."] = "친구, 길드원의 생명력바 (생명력바 보기에서)또는 이름 (헤드라인 보기에서)에 사용자 설정 색상을 사용합니다."
L["Use a custom color for the castbar's background."] = "시전바의 배경에 사용자 설정 색상을 사용합니다."
L["Use a custom color for the healtbar's background."] = "생명력바의 배경에 사용자 설정 색상을 사용합니다."
L["Use a custom color for the healtbar's border."] = "생명력바의 테두리에 사용자 설정 색상을 사용합니다."
L["Use a custom color for the healthbar of quest mobs."] = "퀘스트 몹의 생명력바에 사용자 설정 색상을 사용합니다."
L["Use a custom color for the healthbar of the current target."] = "현재 대상의 생명력바에 사용자 설정 색상을 사용합니다."
L["Use a custom color for the healthbar of your current target."] = "자신의 현재 대상의 생명력바에 사용자 설정 색상을 사용합니다."
L["Use alpha settings of healthbar view also to headline view."] = "생명력바 보기의 투명도 설정을 헤드라인 보기에도 사용합니다."
L["Use Blizzard default nameplates for friendly nameplates and disable ThreatPlates for these units."] = "우호적 유닛에 ThreatPlates를 비활성하고 블리자드 기본 이름표를 사용합니다."
L["Use coloring based an threat level (configured in Threat System) in combat (custom color is only used out of combat)."] = "전투 중에 위협 수준 등급 (위협 수준 체제에서 구성된)에 따라 색상화합니다 (사용자 설정 색상은 전투 중이 아닐 때만 사용됨)."
L["Use Custom Settings"] = "사용자 설정 사용"
L["Use scale settings of Healthbar View also for Headline View."] = "생명력바 보기의 크기 비율 설정을 헤드라인 보기에도 사용합니다."
L["Use scaling settings of healthbar view also to headline view."] = "생명력바 보기의 크기 변경 설정을 헤드라인 보기에도 사용합니다."
L["Use target-based scale as absolute scale and ignore unit base scale."] = "대상 기반 크기 비율을 절대 크기 비율로 사용하고 유닛 기본 크기 비율을 무시합니다."
L["Use target-based transparency as absolute transparency and ignore unit base transparency."] = "대상 기반 투명도를 절대 투명도로 사용하고 유닛 기본 투명도를 무시합니다."
L["Use Target's Name"] = "대상의 이름 사용"
L["Use the castbar's foreground color also for the background."] = "시전바의 전경 색상을 배경에도 사용합니다."
L["Use the healthbar's background color also for the border."] = "생명력바의 배경 색상을 테두리에도 사용합니다."
L["Use the healthbar's foreground color also for the background."] = "생명력바의 배경 색상을 전경 색상에도 사용합니다."
L["Use the healthbar's foreground color also for the border."] = "생명력바의 전경 색상을 테두리에도 사용합니다."
L["Use Threat Alpha"] = "위협 수준 투명도 사용"
L["Use Threat Coloring"] = "위협 수준 색상 사용"
L["Use Threat Colors"] = "위협 수준 색상 사용"
L["Use Threat Scale"] = "위협 수준 크기 변경 사용"
L["Use threat scale as additive scale and add or substract it from the general scale settings."] = "위협 수준 크기 비율을 추가적 크기 비율로 사용하고 기본 크기 비율 설정에서 추가하거나 뺍니다."
L["Use threat transparency as additive transparency and add or substract it from the general transparency settings."] = "위협 수준 투명도를 추가적 투명도로 사용하고 기본 투명도 설정에서 추가하거나 뺍니다."
L["Use transparency settings of Healthbar View also for Headline View."] = "생명력바 보기의 투명도 설정을 헤드라인 보기에도 사용합니다."
L["Uses the target-based transparency as absolute transparency and ignore unit base transparency."] = "대상 기반 투명도를 절대 투명도로 사용하고 유닛 기본 투명도를 무시합니다."
L["Val'kyr Shadowguard"] = "발키르 어둠수호병"
L["Venomous Snake"] = "독사"
L["Vertical Align"] = "수직 정렬"
L["Vertical Alignment"] = "세로 정렬"
L["Vertical Spacing"] = "세로 간격"
L["Viper"] = "살무사"
L["Visibility"] = "표시"
L["Volatile Ooze"] = "일촉즉발 수액괴물"
L["Warning Glow for Threat"] = "위협 수준 경보 반짝임"
L["Water Elemental"] = "물 정령"
L["Web Wrap"] = "거미줄 올가미"
L["We're unable to change this while in combat"] = "전투 중엔 변경할 수 없습니다"
L["White List"] = "허용 목록"
L["White List (Mine)"] = "허용 목록 (내 것)"
L["Wide"] = "넓게"
L["Widgets"] = "장치"
L["X"] = "X"
L["Y"] = "Y"
L["Yes"] = "네"
L["You can access the "] = "접근 가능: "
L["Your own quests that you have to complete."] = "당신이 완료해야 하는 자신의 퀘스트입니다."
|
-- themerooms is an array of tables and/or functions.
-- the tables define "frequency", "contents", "mindiff" and "maxdiff".
-- frequency is optional; if omitted, 1 is assumed.
-- mindiff and maxdiff are optional and independent; if omitted, the room is
-- not constrained by level difficulty.
-- a plain function has frequency of 1, and no difficulty constraints.
-- des.room({ type = "ordinary", filled = 1 })
-- - ordinary rooms can be converted to shops or any other special rooms.
-- - filled = 1 means the room gets random room contents, even if it
-- doesn't get converted into a special room. Without filled,
-- the room only gets what you define in here.
-- - use type = "themed" to force a room that's never converted
-- to a special room, such as a shop or a temple. As a rule of thumb, any
-- room that can have non-regular-floor terrain should use this.
-- core calls themerooms_generate() multiple times per level
-- to generate a single themed room.
------------------------------- HELPER FUNCTIONS -------------------------------
function way_out_method(trap_ok)
-- Lua analogue to generate_way_out_method() for non-joined, inaccessible
-- areas the player might teleport into
-- intended to be called inside the contents() of such an area
if trap_ok and percent(60) then
if percent(60) then
des.trap('hole')
else
des.trap('teleport')
end
else
items = { { id = 'pick-axe' },
{ id = 'dwarvish mattock' },
{ class = '/', id = 'digging' },
{ class = '?', id = 'teleportation' },
{ class = '=', id = 'teleportation' } } -- no wand of teleportation
des.object(items[d(#items)])
end
end
themerooms = {
{
-- the "default" room
frequency = 1000,
contents = function()
des.room({ type = "ordinary", filled = 1 });
end
},
-- Fake Delphi
function()
des.room({ type = "themed", w = 11,h = 9, filled = 1,
contents = function()
des.room({ type = "themed", x = 4,y = 3, w = 3,h = 3, filled = 1,
contents = function()
des.door({ state="random", wall="all" });
des.feature("fountain", 1, 1);
end
});
for i = 1, d(2) do
des.object({ id = "statue", montype = "C" })
end
end
});
end,
-- Room in a room
-- FIXME: subroom location is too often left/top?
function()
des.room({ type = "ordinary", filled = 1,
contents = function()
des.room({ type = "ordinary",
contents = function()
des.door({ state="random", wall="all" });
end
});
end
});
end,
-- Huge room, with another room inside (90%)
function()
des.room({ type = "ordinary", w = nh.rn2(10)+11,h = nh.rn2(5)+8, filled = 1,
contents = function()
if (percent(90)) then
des.room({ type = "ordinary", filled = 1,
contents = function()
des.door({ state="random", wall="all" });
if (percent(50)) then
des.door({ state="random", wall="all" });
end
end
});
end
end
});
end,
-- Ice room
function()
des.room({ type = "themed", filled = 1,
contents = function()
des.terrain(selection.floodfill(1,1), "I");
end
});
end,
-- Boulder room
{
-- rolling boulder traps only generate on DL2 and below; bump the difficulty up a bit
mindiff = 4,
contents = function()
des.room({ type = "themed",
contents = function(rm)
for x = 0, rm.width - 1 do
for y = 0, rm.height - 1 do
if (percent(30)) then
if (percent(50)) then
des.object("boulder");
else
des.trap("rolling boulder");
end
end
end
end
end
});
end
},
-- Spider nest
function()
des.room({ type = "themed",
contents = function(rm)
local spooders = nh.level_difficulty() > 8;
for x = 0, rm.width - 1 do
for y = 0, rm.height - 1 do
if (percent(30)) then
des.trap({ type = "web", x = x, y = y,
spider_on_web = spooders and percent(80) });
end
end
end
end
});
end,
-- Trap room
function()
des.room({ type = "themed", filled = 0,
contents = function(rm)
local traps = { "arrow", "dart", "falling rock", "bear",
"land mine", "sleep gas", "rust",
"anti magic" };
shuffle(traps);
for x = 0, rm.width - 1 do
for y = 0, rm.height - 1 do
if (percent(30)) then
des.trap(traps[1], x, y);
end
end
end
end
});
end,
-- Buried treasure
function()
des.room({ type = "themed", filled = 1,
contents = function()
des.object({ id = "chest", buried = true, contents = function()
for i = 1, d(3,4) do
des.object();
end
end });
-- not necessarily on top of the chest
if percent(50) then
des.engraving({ type="engrave", text="X" })
end
end
});
end,
-- Massacre
function()
des.room({ type = "themed",
contents = function()
local mon = { "apprentice", "warrior", "ninja", "thug",
"hunter", "acolyte", "abbot", "page",
"attendant", "neanderthal", "chieftain",
"student", "wizard", "valkyrie", "tourist",
"samurai", "rogue", "ranger", "priestess",
"priest", "monk", "knight", "healer",
"cavewoman", "caveman", "barbarian",
"archeologist" };
shuffle(mon);
for i = 1, d(5,5) do
if (percent(10)) then shuffle(mon); end
des.object({ id = "corpse", montype = mon[1] });
end
end
});
end,
-- Pillars
function()
des.room({ type = "themed", w = 10, h = 10,
contents = function(rm)
local terr = { "-", "-", "-", "-", "L", "P", "T" };
shuffle(terr);
for x = 0, (rm.width / 4) - 1 do
for y = 0, (rm.height / 4) - 1 do
des.terrain({ x = x * 4 + 2, y = y * 4 + 2, typ = terr[1], lit = -2 });
des.terrain({ x = x * 4 + 3, y = y * 4 + 2, typ = terr[1], lit = -2 });
des.terrain({ x = x * 4 + 2, y = y * 4 + 3, typ = terr[1], lit = -2 });
des.terrain({ x = x * 4 + 3, y = y * 4 + 3, typ = terr[1], lit = -2 });
end
end
end
});
end,
-- Statuary
function()
des.room({ type = "themed",
contents = function()
for i = 1, d(5,5) do
des.object({ id = "statue" });
end
for i = 1, d(3) do
des.trap("statue");
end
end
});
end,
-- Light source
function()
des.room({ type = "themed", lit = 0,
contents = function()
des.object({ id = "oil lamp", lit = true });
end
});
end,
-- Temple of the gods
function()
des.room({ type = "themed",
contents = function()
des.altar({ align = align[1] });
des.altar({ align = align[2] });
des.altar({ align = align[3] });
end
});
end,
-- Mausoleum
function()
des.room({ type = "themed", w = 5 + nh.rn2(3)*2, h = 5 + nh.rn2(3)*2,
contents = function(rm)
des.room({ type = "themed",
x = (rm.width - 1) / 2, y = (rm.height - 1) / 2,
w = 1, h = 1, joined = false,
contents = function()
if (percent(50)) then
local mons = { "M", "V", "L", "Z" };
shuffle(mons);
des.monster({ class = mons[1], x=0,y=0, waiting = 1 });
else
des.object({ id = "corpse", montype = "@", coord = {0,0} });
end
if (percent(20)) then
des.door({ state="secret", wall="all" });
end
end
});
end
});
end,
-- Random dungeon feature in the middle of a odd-sized room
function()
local wid = 3 + (nh.rn2(3) * 2);
local hei = 3 + (nh.rn2(3) * 2);
des.room({ type = "themed", filled = 1, w = wid, h = hei,
contents = function(rm)
local feature = { "C", "L", "I", "P", "T" };
shuffle(feature);
des.terrain((rm.width - 1) / 2, (rm.height - 1) / 2,
feature[1]);
end
});
end,
-- L-shaped
function()
des.map({ map = [[
-----xxx
|...|xxx
|...|xxx
|...----
|......|
|......|
|......|
--------]], contents = function(m) des.region({ region={1,1,3,3}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- L-shaped, rot 1
function()
des.map({ map = [[
xxx-----
xxx|...|
xxx|...|
----...|
|......|
|......|
|......|
--------]], contents = function(m) des.region({ region={5,1,5,3}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- L-shaped, rot 2
function()
des.map({ map = [[
--------
|......|
|......|
|......|
----...|
xxx|...|
xxx|...|
xxx-----]], contents = function(m) des.region({ region={1,1,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- L-shaped, rot 3
function()
des.map({ map = [[
--------
|......|
|......|
|......|
|...----
|...|xxx
|...|xxx
-----xxx]], contents = function(m) des.region({ region={1,1,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Blocked center
function()
des.map({ map = [[
-----------
|.........|
|.........|
|.........|
|...LLL...|
|...LLL...|
|...LLL...|
|.........|
|.........|
|.........|
-----------]], contents = function(m)
if (percent(30)) then
local terr = { "-", "P" };
shuffle(terr);
des.replace_terrain({ region = {1,1, 9,9}, fromterrain = "L", toterrain = terr[1] });
end
des.region({ region={1,1,2,2}, type="themed", irregular=true, filled=1 });
end });
end,
-- Circular, small
function()
des.map({ map = [[
xx---xx
x--.--x
--...--
|.....|
--...--
x--.--x
xx---xx]], contents = function(m) des.region({ region={3,3,3,3}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Circular, medium
function()
des.map({ map = [[
xx-----xx
x--...--x
--.....--
|.......|
|.......|
|.......|
--.....--
x--...--x
xx-----xx]], contents = function(m) des.region({ region={4,4,4,4}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Circular, big
function()
des.map({ map = [[
xxx-----xxx
x---...---x
x-.......-x
--.......--
|.........|
|.........|
|.........|
--.......--
x-.......-x
x---...---x
xxx-----xxx]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- T-shaped
function()
des.map({ map = [[
xxx-----xxx
xxx|...|xxx
xxx|...|xxx
----...----
|.........|
|.........|
|.........|
-----------]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- T-shaped, rot 1
function()
des.map({ map = [[
-----xxx
|...|xxx
|...|xxx
|...----
|......|
|......|
|......|
|...----
|...|xxx
|...|xxx
-----xxx]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- T-shaped, rot 2
function()
des.map({ map = [[
-----------
|.........|
|.........|
|.........|
----...----
xxx|...|xxx
xxx|...|xxx
xxx-----xxx]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- T-shaped, rot 3
function()
des.map({ map = [[
xxx-----
xxx|...|
xxx|...|
----...|
|......|
|......|
|......|
----...|
xxx|...|
xxx|...|
xxx-----]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- S-shaped
function()
des.map({ map = [[
-----xxx
|...|xxx
|...|xxx
|...----
|......|
|......|
|......|
----...|
xxx|...|
xxx|...|
xxx-----]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- S-shaped, rot 1
function()
des.map({ map = [[
xxx--------
xxx|......|
xxx|......|
----......|
|......----
|......|xxx
|......|xxx
--------xxx]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Z-shaped
function()
des.map({ map = [[
xxx-----
xxx|...|
xxx|...|
----...|
|......|
|......|
|......|
|...----
|...|xxx
|...|xxx
-----xxx]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Z-shaped, rot 1
function()
des.map({ map = [[
--------xxx
|......|xxx
|......|xxx
|......----
----......|
xxx|......|
xxx|......|
xxx--------]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Cross
function()
des.map({ map = [[
xxx-----xxx
xxx|...|xxx
xxx|...|xxx
----...----
|.........|
|.........|
|.........|
----...----
xxx|...|xxx
xxx|...|xxx
xxx-----xxx]], contents = function(m) des.region({ region={6,6,6,6}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Four-leaf clover
function()
des.map({ map = [[
-----x-----
|...|x|...|
|...---...|
|.........|
---.....---
xx|.....|xx
---.....---
|.........|
|...---...|
|...|x|...|
-----x-----]], contents = function(m) des.region({ region={6,6,6,6}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Water-surrounded vault
function()
des.map({ map = [[
}}}}}}
}----}
}|..|}
}|..|}
}----}
}}}}}}]], contents = function(m) des.region({ region={3,3,3,3}, type="themed", irregular=true, filled=0, joined=false });
local nasty_undead = { "giant zombie", "ettin zombie", "vampire lord" };
des.object("chest", 2, 2);
des.object("chest", 3, 2);
des.object("chest", 2, 3);
des.object("chest", 3, 3);
shuffle(nasty_undead);
des.monster(nasty_undead[1], 2, 2);
way_out_method(false);
end });
end,
-- Four connected rooms
-- Note: they're all independent, meaning each one generates monsters,
-- objects, furniture etc separately.
function()
des.map({ map = [[
-----x-----
|...|x|...|
|...+#+...|
|...|x|...|
--+--x--+--
xx#xxxxx#xx
--+--x--+--
|...|x|...|
|...+#+...|
|...|x|...|
-----x-----]], contents = function(m)
des.region({ region={1,1,3,3}, type="ordinary", filled=1 })
des.region({ region={1,7,3,9}, type="ordinary", filled=1 })
des.region({ region={7,1,9,3}, type="ordinary", filled=1 })
des.region({ region={7,7,9,9}, type="ordinary", filled=1 })
end })
end,
-- Barbell-shaped room, horizontal
function()
des.map({ map = [[
-----xxx-----
|...-----...|
|...........|
|...-----...|
-----xxx-----]], contents = function(m)
des.region({ region={2,2,2,2}, type="themed", irregular=true,
filled=1 })
des.door("random", 04, 02)
des.door("random", 08, 02)
end })
end,
-- Barbell-shaped room, vertical
function()
des.map({ map = [[
-----
|...|
|...|
|...|
--.--
x|.|x
x|.|x
x|.|x
--.--
|...|
|...|
|...|
-----]], contents = function(m)
des.region({ region={2,2,2,2}, type="themed", irregular=true,
filled=1 })
des.door("random", 02, 04)
des.door("random", 02, 08)
end })
end,
-- Graffiti room
function()
des.room({ type = "themed", filled = 1,
contents = function(rm)
for x = 0, rm.width - 1 do
for y = 0, rm.height - 1 do
if percent(30) then
des.engraving({ coord={x,y}, type="mark", text="" })
end
end
end
end })
end,
-- Room with small pillars (also, possibly wood nymph room)
function()
des.room({ type = "themed", w = 5 + nh.rn2(3)*2, h = 5 + nh.rn2(3)*2,
filled = 1, contents = function(rm)
local grove = percent(20)
if nh.level_difficulty() < nh.mon_difficulty("wood nymph") then
grove = false
end
local mapchr = (grove and 'T') or '-'
for i = 0, (rm.width - 3) / 2 do
for j = 0, (rm.height - 3) / 2 do
des.terrain(i*2 + 1, j*2 + 1, mapchr)
end
end
if grove then
des.replace_terrain({ selection = selection.area(0,0,rm.width-1,rm.height-1),
fromterrain = '.', toterrain='g' })
if percent(50) then
des.object({ id = "statue", montype = "wood nymph" })
end
if percent(20) then
if percent(50) then
des.object({ id = "statue", montype = "wood nymph" })
else
des.object({ id = "figurine", montype = "wood nymph",
material = "wooden" })
end
end
local nnymphs = math.floor(d(nh.level_difficulty()) / 4)
for i=1,nnymphs do
des.monster("wood nymph")
end
end
end })
end,
-- Boomerang-shaped, rot 1
function()
des.map({ map = [[
-----xxxxx
|...---xxx
|.....--xx
--.....--x
x----...--
xxxx--...|
xxxxx|...|
xxxx--...|
x----...--
--.....--x
|.....--xx
|...---xxx
-----xxxxx]], contents = function(m)
des.region({ region={2,2,2,2}, type="ordinary", irregular=true,
filled=1 })
end })
end,
-- Boomerang-shaped, rot 2
function()
des.map({ map = [[
xxxxx-----
xxx---...|
xx--.....|
x--.....--
--...----x
|...--xxxx
|...|xxxxx
|...--xxxx
--...----x
x--.....--
xx--.....|
xxx---...|
xxxxx-----]], contents = function(rm)
des.region({ region={7,1,7,1}, type="ordinary", irregular=true,
filled=1 })
end })
end,
-- Rectangular walled corridor
-- Note: a 5x5 version of this room could be confused for Mausoleum
function()
des.room({ type = "themed", filled = 1,
contents = function(rm)
for x = 1, rm.width - 2 do
for y = 1, rm.height - 2 do
des.terrain(x, y, "-")
end
end
end })
end,
-- Tiny cage, big monster
function()
des.map({ map = [[
-------
|.....|
|.FFF.|
|.F.F.|
|.FFF.|
|.....|
-------]], contents = function(m)
des.region({ region={1,1,5,5}, type="themed", irregular=false,
filled=1 })
if percent(80) then
local mons = { 'M', 'Z', 'O', 'T' }
if nh.level_difficulty() > 6 then
table.insert(mons, 'H')
if nh.level_difficulty() > 12 then
table.insert(mons, 'D')
end
end
shuffle(mons)
des.monster(mons[1], 3,3)
else
des.trap({ x = 3, y = 3})
end
end })
end,
-- Split room
function()
des.room({ type = "ordinary", filled = 1,
w = 3 + nh.rn2(10), h = 3 + nh.rn2(4),
contents = function(rm)
local doorstates = { "open", "closed", "locked" }
local doiron = nh.level_difficulty() > 10 and percent(30)
if nh.level_difficulty() >= 5 and not doiron then
-- a secret door in a wall of iron bars doesn't make
-- sense...
table.insert(doorstates, "secret")
end
shuffle(doorstates)
local rndx = nh.rn2(rm.width - 2) + 1
local rndy = nh.rn2(rm.height - 2) + 1
local repltyp -- TODO: this is dumb, replace_terrain with
-- fromterrain='w' doesn't work
if percent(50) then
des.room({ type = "ordinary", x = 0, y = 0,
w = rndx, h = rm.height, filled = 1,
contents = function()
des.door({ state = doorstates[1], wall = "east",
iron = bool2int(doiron) })
end })
repltyp = '|'
else
des.room({ type = "ordinary", x = 0, y = 0,
w = rm.width, h = rndy, filled = 1,
contents = function()
des.door({ state = doorstates[1], wall = "south",
iron = bool2int(doiron) })
end })
repltyp = '-'
end
if doiron then
des.replace_terrain({ selection = selection.area(0,0,rm.width-1,rm.height-1),
fromterrain = repltyp, toterrain = 'F' })
end
end })
end,
-- Corner 2x2 subroom
function()
des.room({ type = "themed", filled = 1,
w = 4 + nh.rn2(9), h = 4 + nh.rn2(3),
contents = function(rm)
local doorstates = { "open", "closed", "locked" }
if nh.level_difficulty() >= 5 then
table.insert(doorstates, "secret")
end
shuffle(doorstates)
local rmx = 0
local rmy = 0
if percent(50) then
rmx = rm.width - 2
end
if percent(50) then
rmy = rm.height - 2
end
des.room({ type = "themed", x = rmx, y = rmy, w = 2, h = 2,
filled = 1, contents = function()
des.door({ state = doorstates[1], wall = "random" })
end })
end })
end,
-- Storeroom vault
{
maxdiff = 14,
contents = function()
des.room({ type = "themed", filled = 0, w = 2, h = 2, joined = false,
contents = function(rm)
for i=1,d(3) do
des.object("chest")
end
way_out_method(true)
end })
end
},
-- Storeroom vault v2
function()
-- TODO: the nut of figuring out how to have a room that is only joinable
-- at certain points/sides still hasn't been cracked. Thus the part of
-- this room that wraps up and to the left. In the initial proposal, this
-- was supposed to be a room connected only on one side, with the
-- storeroom component in the dead end.
des.map({ map=[[
--------
|......|
|-----.|
|..|...|
|..|...|
--------]], contents = function()
des.region({ region = {01,01,01,01}, type = 'themed', filled = 0,
irregular = 1 })
des.region({ region = {01,03,02,04}, type = 'themed', filled = 0,
joined = false, contents = function()
for i = 1, d(2) do
local boxtype = percent(4) and 'ice box'
or percent(50) and 'chest' or 'large box'
des.object(boxtype)
end
for i = 1, d(4) do
des.monster('r')
end
if percent(20) then
des.door({ wall="east", locked = 1, iron = 1,
state = percent(50) and 'secret' or 'closed' })
end
way_out_method(true)
end })
end })
end,
-- Crossed X of water
-- FIXME: This breaks the rule that the space in front of a door should
-- always be free of traps or dangerous terrain, but we can't address that
-- here since no doors exist yet.
function()
des.room({ type = "themed", filled = 1,
w = 5 + nh.rn2(9), h = 5 + nh.rn2(3),
contents = function(rm)
des.terrain(selection.line(0, 0, rm.width - 1, rm.height - 1), "}")
des.terrain(selection.line(0, rm.height - 1, rm.width - 1, 0), "}")
end })
end,
-- Mini maze
-- Warning: x and y must be odd for mazewalk not to break out of the walls.
-- The formulas for obtaining them assume ROWNO=21 and COLNO=80.
-- Unfortunately, this does not work with a des.room() of varying size
-- because the room borders are the outer wall and it tries to connect doors
-- to that and fails, and there's no way to get it to unmake the room.
{
mindiff = 6,
contents = function()
des.map({ map = [[
-----------
-----------
||.- - - ||
||-------||
|| - - - ||
||-------||
|| - - - ||
||-------||
|| - - - ||
-----------
-----------]], x = 3 + nh.rn2(32)*2, y = 3 + nh.rn2(4)*2, contents = function()
des.mazewalk({ x = 2, y = 2, dir = "east", stocked = false })
des.region({ region={2,2,2,2}, type="themed", irregular=true,
filled=1, joined=true, lit=1 })
end })
end
},
-- Bunch of closets
{
mindiff = 5,
contents = function()
des.room({ type = "themed", filled = 1, joined = true,
w = 3 + nh.rn2(6)*2, h = 5, contents = function(rm)
for x = 0, rm.width - 1 do
for y = 0, 4 do
if y == 0 or y == 4 then
-- closet row
if x % 2 == 0 then
-- closet column
if percent(10) then
des.monster({ x = x, y = y })
end
if percent(10) then
des.object({ x = x, y = y })
end
else
-- wall column
des.terrain(x, y, '|')
end
elseif y == 1 or y == 3 then
-- wall row
if x % 2 == 0 then
-- closet column
local doiron = percent(nh.level_difficulty() * 4)
des.door({ x = x, y = y, iron = bool2int(doiron) })
else
-- wall column
des.terrain(x, y, '-')
end
end
end
end
end })
end
},
-- Beehives
{
mindiff = 10, -- minimum beehive depth in rand_roomtype()
contents = function()
local nhives = d(3)
des.room({ type = "themed", w = 1 + 5*nhives, h = 6,
contents = function()
for i=1,nhives do
des.room({ type = "beehive", w = 2, h = 2, x = (i*5) - 3, y = 2,
filled = 1, contents = function()
des.door({ wall = "random" })
end })
end
end })
end
},
-- Super Honeycomb
{
mindiff = 13,
contents = function()
des.map({ map = [[
xxxx----xx----xxxx
xxx--..----..--xxx
xxx|....||....|xxx
x----..----..----x
--..----..----..--
|....||....||....|
--..----..----..--
x----..----..----x
xxx|....||....|xxx
xxx--..----..--xxx
xxxx----xx----xxxx]], contents=function(m)
-- The goal: connect adjacent cells until a spanning tree is formed.
-- The following tables {a,b,w,x,y,z} denote pairs of cells with
-- ids a and b that would become connected if positions (w,x)
-- and (y,z) became floor. Cell ids are 1-7 left to right then
-- top to bottom.
local conns = {
{1,2, 08,02,09,02},
{1,3, 04,03,04,04},
{1,4, 07,03,07,04},
{2,4, 10,03,10,04},
{2,5, 13,03,13,04},
{3,4, 05,05,06,05},
{3,6, 04,06,04,07},
{4,5, 11,05,12,05},
{4,6, 07,06,07,07},
{4,7, 10,06,10,07},
{5,7, 13,06,13,07},
{6,7, 08,08,09,08}
}
local reached = { false, false, false, false, false, false, false }
reached[d(7)] = true -- initial cell
local nreached = 1
while nreached < 7 do
-- pick a random element of conns that adds a new cell
local pick = d(#conns)
while reached[conns[pick][1]] == reached[conns[pick][2]] do
pick = d(#conns)
end
-- change those walls to floor
des.terrain(conns[pick][3], conns[pick][4], '.')
des.terrain(conns[pick][5], conns[pick][6], '.')
-- update reached; one of the two must have been true so set both
-- to true
reached[conns[pick][1]] = true
reached[conns[pick][2]] = true
-- recompute allconnected
nreached = nreached + 1
end
des.region({ region={05,01,05,01}, type="beehive", irregular=true,
joined=true, filled=1 })
end })
end
},
-- Random terrain room, except randomly applied to any square, not just the
-- center
function()
des.room({ type="themed", filled=1, contents=function(rm)
local picks = selection.floodfill(1,1):percentage(30)
local feature = { "C", "I", 'g' }
-- These features can spawn in such a way that traversal is
-- impossible across the room (e.g. doors on the left and right, and
-- a line of trees stretches vertically across the room). Cope by
-- ensuring none of the real blockers can be created before the Mines.
if nh.level_difficulty() > 4 then
table.insert(feature, 'P')
table.insert(feature, 'T')
if nh.level_difficulty() > 10 then
table.insert(feature, 'L')
end
end
shuffle(feature)
-- Prevent the features from blocking off an entire wall, which will
-- cause impossibles if a door tries to generate on that wall.
-- The room being filled = 1 shouldn't randomly generate an extra
-- tree in one of the spaces deliberately left blank here, unless no
-- door generated next to it; there's a bydoor() check in that bit
-- of code.
if feature[1] == 'P' or feature[1] == 'T' or feature[1] == 'L' then
picks:set(nh.rn2(rm.width), 0, 0) -- top
picks:set(nh.rn2(rm.width), rm.height - 1, 0) -- bottom
picks:set(0, nh.rn2(rm.height), 0) -- left
picks:set(rm.width - 1, nh.rn2(rm.height), 0) -- right
end
des.terrain(picks, feature[1])
end })
end,
-- Swimming pool
{
mindiff = 5,
contents = function()
des.room({ type="themed", filled=0, contents=function(rm)
local poolarea = selection.fillrect(1,1,rm.width-2,rm.height-2)
des.terrain(poolarea, '}')
-- spice it up with some sea monsters
local waterarea = (rm.width-2)*(rm.height-2)
local nmonsters = math.min(d(5), waterarea/2)
for i=1,nmonsters do
des.monster(';')
end
-- sunken treasure
if percent(50) then
des.object({ id='chest', coord={poolarea:rndcoord(1)},
contents=function()
for i=1,d(2,2) do
des.object('*')
end
des.object({ id = "gold piece", quantity = d(80, 5) })
end })
end
end })
end
},
-- Anti swimming pool
{
mindiff = 14,
contents = function()
des.room({ type="themed", filled=0, contents = function(rm)
local water = selection.rect(0, 0, rm.width-1, rm.height-1)
des.terrain(water, '}')
for i = 1, d(3) do
des.monster(';')
end
end })
end
},
-- Thin long horizontal room
function()
local width = 14 + d(6)
des.room({ type="ordinary", filled=1, w=14+d(6), h=d(2) })
end,
-- Scummy moldy room
{
mindiff = 6,
contents = function()
des.room({ type="themed", filled=0, contents=function(rm)
mons = { 'gas spore', 'F', 'b', 'j', 'P' }
local nummons = math.min(rm.width * rm.height, d(4,3))
for i=1, nummons do
-- Note: this is a bit different from the original UnNetHack
-- room; that one picked one member from mons and filled the room
-- with it, whereas this randomizes the member of mons each time.
des.monster(mons[d(#mons)])
end
end })
end
},
-- Ozymandias' Tomb
{
mindiff = 18,
contents = function()
des.room({ type="themed", filled=0, w=7, h=7, contents=function()
des.feature("throne", 3, 3)
for i = 1, 2+d(4) do
des.trap({ type="web", spider_on_web = false })
end
for i=1,4 do
if percent(75) then
des.trap('falling rock')
end
end
for i=1,d(3)+1 do
des.trap('hole')
end
des.object({ id = "chest", trapped = 1 })
for i=1,2 do
des.trap('statue')
end
-- no statue of Ozymandias; it shouldn't be possible to reanimate it
local x=3
local y=3
if percent(50) then
x = x + ((2 * nh.rn2(2)) - 1)
else
y = y + ((2 * nh.rn2(2)) - 1)
end
des.engraving({ coord={x,y}, type="engrave",
text="My name is Ozymandias, king of kings: Look on my works, ye Mighty, and despair!" })
end })
end
},
-- Gas spore den
-- Tread carefully...
{
mindiff = 5,
contents = function()
des.room({ type="themed", filled=0, contents=function(rm)
for x=0,rm.width-1 do
for y=0,rm.width-1 do
if percent(math.min(100, 75 + nh.level_difficulty())) then
des.monster({ id='gas spore', asleep=1 })
end
end
end
end })
end
},
-- Pool room: a homage to the /dev/null pool challenge
function()
des.room({ type="themed", filled=0, w=9, h=9, contents = function(rm)
des.trap('hole', 0, 0)
des.trap('hole', 0, 4)
des.trap('hole', 0, 8)
des.trap('hole', 8, 0)
des.trap('hole', 8, 4)
des.trap('hole', 8, 8)
for i=1,9 do
-- pick x and y to avoid placing the boulders on the pockets
bx = 0
by = 0
while ((bx == 0 or bx == 8) and (by % 4 == 0)) do
bx = nh.rn2(9)
by = nh.rn2(9)
end
des.object({ id = 'boulder', x = bx, y = by, name = tostring(i) })
end
end })
end,
-- Twin businesses
{
mindiff = 4, -- arbitrary
contents = function()
-- Due to the way room connections work in mklev.c, we must guarantee
-- that the "aisle" between the shops touches all four walls of the
-- larger room. Thus it has an extra width and height.
des.room({ type="themed", w=9, h=5, contents = function()
-- There are eight possible placements of the two shops, four of
-- which have the vertical aisle in the center.
southeast = function() return percent(50) and "south" or "east" end
northeast = function() return percent(50) and "north" or "east" end
northwest = function() return percent(50) and "north" or "west" end
southwest = function() return percent(50) and "south" or "west" end
placements = {
{ lx = 1, ly = 1, rx = 4, ry = 1, lwall = "south", rwall = southeast() },
{ lx = 1, ly = 2, rx = 4, ry = 2, lwall = "north", rwall = northeast() },
{ lx = 1, ly = 1, rx = 5, ry = 1, lwall = southeast(), rwall = southwest() },
{ lx = 1, ly = 1, rx = 5, ry = 2, lwall = southeast(), rwall = northwest() },
{ lx = 1, ly = 2, rx = 5, ry = 1, lwall = northeast(), rwall = southwest() },
{ lx = 1, ly = 2, rx = 5, ry = 2, lwall = northeast(), rwall = northwest() },
{ lx = 2, ly = 1, rx = 5, ry = 1, lwall = southwest(), rwall = "south" },
{ lx = 2, ly = 2, rx = 5, ry = 2, lwall = northwest(), rwall = "north" }
}
ltype,rtype = "weapon shop","armor shop"
if percent(50) then
ltype,rtype = rtype,ltype
end
shopdoorstate = function()
if percent(1) then
return "locked"
elseif percent(50) then
return "closed"
else
return "open"
end
end
p = placements[d(#placements)]
des.room({ type=ltype, x=p["lx"], y=p["ly"], w=3, h=3, filled=1,
joined=false, contents = function()
des.door({ state=shopdoorstate(), wall=p["lwall"] })
end })
des.room({ type=rtype, x=p["rx"], y=p["ry"], w=3, h=3, filled=1,
joined=false, contents = function()
des.door({ state=shopdoorstate(), wall=p["rwall"] })
end })
end })
end
},
-- Four-way circle-and-cross room
function()
des.map({ map = [[
xxxx---xxxx
xxxx|.|xxxx
xxx--.--xxx
xx--...--xx
---.....---
|.........|
---.....---
xx--...--xx
xxx--.--xxx
xxxx|.|xxxx
xxxx---xxxx]], contents = function(m)
centerfeature = percent(15)
des.region({ region = {5,1,5,1}, irregular=1,
type=centerfeature and "themed" or "ordinary" })
if centerfeature then
des.terrain(5, 5, percent(20) and 'T' or '{')
end
end })
end,
-- Four 3x3 rooms, directly adjacent
-- Like the other four-room cluster, each room generates its own monsters,
-- items and features.
function()
des.room({ type="ordinary", w=7, h=7, filled=1, contents=function()
des.room({ type="ordinary", x=1, y=1, w=3, h=3, filled=1 })
des.room({ type="ordinary", x=4, y=1, w=3, h=3, filled=1,
contents=function()
des.door({ state="random", wall = "west" })
des.door({ state="random", wall = "south" })
end })
des.room({ type="ordinary", x=1, y=4, w=3, h=3, filled=1,
contents=function()
des.door({ state="random", wall = "north" })
des.door({ state="random", wall = "east" })
end })
-- the southeast room is just the parent room and doesn't need to
-- be defined specially; in fact, if it is, the level generator may
-- stumble on trying to place a feature in the parent room and not
-- finding any open spaces for it.
end })
end,
-- Prison cell
{
mindiff = 8,
contents = function()
des.map({ map = [[
--------
|......|
|......|
|FFFF..|
|...F..|
|...+..|
--------]], contents = function()
des.door({ state = "locked", x=4, y=5, iron=1 })
if percent(70) then
des.monster({ id="prisoner", x=d(3), y=3+d(2), peaceful=1,
asleep=1 })
-- and a rat for company
-- no 'r' = rock moles to break them out!
rats = {"sewer rat", "giant rat", "rabid rat"}
des.monster(rats[d(#rats)])
end
des.region({ region={01,01,01,01}, type="themed", irregular=true,
filled=1, joined=true })
des.region({ region={01,04,03,05}, type="themed", irregular=true,
filled=0, joined=false })
end })
end
},
-- Mirrored obstacles, sort of like a Rorschasch figure
{
-- obstacles can impede stairways in unlucky cases; put this after Mines
mindiff = 5,
contents = function()
width = 5 + nh.rn2(10)
height = 5 + nh.rn2(4)
des.room({ type="themed", w=width, h=height, contents=function(rm)
-- no grass/ice; not obstacles
obstacles = { 'T', '}', 'F', 'L', 'C' }
terrain = obstacles[d(#obstacles)]
for x = 1,rm.width/2 do
for y = 1,rm.height-2 do
if percent(40) then
des.terrain(x, y, terrain)
des.terrain(rm.width - x - 1, y, terrain)
end
end
end
end })
end
},
-- Dragon hall
{
mindiff = nh.mon_difficulty('black dragon') + 3,
contents = function()
des.map({ map = [[
xxxxxx----xx----xxx
xxxx---..----..--xx
xxx--...........--x
x---.............--
--................|
|................--
|...............--x
----..........---xx
xxx--........--xxxx
xxxx----....--xxxxx
xxxxxxx------xxxxxx]], contents = function()
des.region({ region = {04,04,04,04}, irregular = true, filled = 0,
type = "themed", joined = true })
local floor = selection.floodfill(04, 04)
local hoardx, hoardy = floor:rndcoord()
function loot(x, y)
local choice = d(25)
if choice == 1 then
des.object('(', x, y)
elseif choice == 2 then
des.object({ class=')', x=x, y=y, spe=2+nh.rn2(3) })
elseif choice == 3 then
des.object({ class='[', x=x, y=y, spe=2+nh.rn2(3) })
elseif choice == 4 then
des.object('chest', x, y)
elseif choice >= 5 and choice <= 7 then
des.object('=', x, y)
elseif choice == 8 then
des.object(percent(50) and '?' or '+', x, y)
else
des.object('*', x, y)
end
-- recursive 10% chance for more loot
if percent(10) then
loot(x, y)
end
end
local goldpile = selection.circle(hoardx, hoardy, 5, 1)
goldpile:filter_mapchar('.'):iterate(function(x,y)
local dist2 = (x-hoardx) * (x-hoardx) + (y-hoardy) * (y-hoardy)
if (dist2 >= 20 and percent(20)) -- radius 4-5
or (dist2 >= 12 and dist2 < 20 and percent(50)) -- radius 3-4
or dist2 < 12 then -- radius 0-3
des.object({ id = 'gold piece', x = x, y = y,
quantity = 200 - dist2*5 + d(50) })
end
-- given circle radius of 5, practical max for dist2 is 29
if percent(40 - (dist2 * 2)) then
loot(x, y)
end
-- dragon eggs
if dist2 < 3 and percent(80) then
des.object({ id = 'egg', x = x, y = y, montype = 'D' })
end
end)
-- put some pits and traps down
local nonpile = (floor ~ goldpile) & floor
for i = 1, 2+d(2) do
des.trap({ type="pit", coord={nonpile:rndcoord()} })
des.trap({ coord = {nonpile:rndcoord()} })
end
-- no way to specifically force a baby or adult dragon
-- so we have to do it manually
colors = { 'gray', 'silver', 'red', 'white', 'orange', 'black',
'blue', 'green', 'yellow', 'gold' }
for i = 1, 3+d(3) do
des.monster({ id='baby '..colors[d(#colors)]..' dragon',
coord={goldpile:rndcoord()}, waiting=1 })
end
for i = 1, 5 + d(5) do
-- would be neat if the adult dragons here could be buffed
des.monster({ id=colors[d(#colors)]..' dragon',
coord={goldpile:rndcoord()}, waiting=1 })
end
-- TODO: problem with this room is that the dragons start picking
-- up the hoard. Something needs to tell their AI that it's a
-- dragon hoard and shouldn't be picked up.
end })
end
},
-- Water temple (not a real temple)
{
mindiff = nh.mon_difficulty('water nymph') + 1,
contents = function()
des.room({ type = 'themed', contents = function(rm)
local totsiz = rm.width * rm.height
for i = 1, math.min(d(6)+6, math.floor(totsiz / 4)) do
des.feature({ type='pool' })
end
for i = 1, math.min(d(3), math.floor(totsiz / 4)) do
des.feature({ type='fountain' })
end
if percent(30) then
des.feature({ type='sink' })
end
for i = 1, math.min(d(4)+1, math.floor(totsiz / 4)) do
des.monster('water nymph')
end
end })
end
},
-- Meadow
function()
des.room({ type='themed', contents = function(rm)
des.terrain(selection.floodfill(0, 0), 'g')
if rm.width > 2 and rm.height > 2 then
local interior = selection.area(1, 1, rm.width-2, rm.height-2)
for i = 1, d(4)-2 do
des.terrain({interior:rndcoord()}, 'T')
end
end
end })
end,
-- Garden (based on the garden rooms patch by Pasi Kallinen)
{
mindiff = 10,
contents = function()
des.room({ type='themed', contents = function(rm)
local totsiz = rm.width * rm.height
local nnymphs = math.min(d(5) + 2, totsiz / 2)
local nfeatures = math.min(d(3) + 2, totsiz / 2)
des.terrain(selection.floodfill(0, 0), 'g')
for i = 1, nfeatures do
-- The only thing missing from the original patch here is a
-- nexttodoor() check, because themed rooms generate before rooms
-- are connected but special rooms get filled after joining.
-- This means a tree could theoretically block a door.
des.feature({ type = percent(66) and 'tree' or 'fountain' })
end
for i = 1, nnymphs do
des.monster('n')
end
end })
end
},
-- Triple rhombus
function()
des.map({ map = [[
-------xxx-------
|.....--x--.....|
--.....---.....--
x--.....|.....--x
xx--....|....--xx
xxx-----.-----xxx
xxxxxx--.--xxxxxx
xxxxx--...--xxxxx
xxxxx|.....|xxxxx
xxxxx|.....|xxxxx
xxxxx--...--xxxxx
xxxxxx--.--xxxxxx
xxxxxxx---xxxxxxx]], contents = function()
des.region({ region = {01,01,01,01}, type = 'ordinary',
irregular = true })
end })
end,
-- Spiral
function()
des.map({ map = [[
x-----------xxx
--.........----
|..-------....|
|.--.....----.|
|.|..---....|.|
|.|.--.----.|.|
|.|.|...+.|.|.|
|.|.--.--.|.|.|
|.|..---..|.|.|
|.--.....--.|.|
|..-------..|--
--.........--xx
x------------xx]], contents = function()
des.region({ region = {02,01,02,01}, type = 'themed', irregular = true,
filled = 1 })
des.region({ region = {06,06,06,06}, type = 'themed', irregular = true,
joined = false, contents = function()
local choice = d(5)
if choice == 1 then
des.feature({ type='tree', x=01, y=01 })
elseif choice == 2 then
des.feature({ type='fountain', x=01, y=01 })
elseif choice == 3 then
if percent(50) then
des.altar({ x=01, y=01 })
else
des.feature({ type='throne', x=01, y=01 })
end
elseif choice == 4 then
for i=1,3 do
des.object()
end
end -- choice 5 = nothing
des.monster()
end })
des.door("random", 08, 06)
end })
end,
-- Kitchen - idea by spicycebolla
function()
des.room({ type = 'themed', w = d(4)+8, h = 2, filled = 0,
contents = function()
-- furniture...
for i = 1, d(2) do
des.feature({ type='sink' })
end
if percent(50) then
des.object('ice box')
end
-- cookware and other useful things...
for i = 1, d(3)-1 do
des.object('dented pot')
end
for i = 1, d(3) do
des.object('knife')
end
if percent(70) then
des.object('tin opener')
end
if percent(20) then
des.object('tinning kit')
end
if percent(20) then
des.object('towel')
end
-- sauces and stocks...
for i = 1, d(3)-1 do
des.object({ class='!', id='oil' })
end
for i = 1, d(3)-1 do
des.object({ class='!', id='fruit juice' })
end
if percent(50) then
des.object({ class='!', id='booze' })
end
-- raw ingredients...
for i = 1, d(3) do
des.object('tin')
end
local ingr = { 'meatball', 'egg', 'apple', 'orange', 'pear', 'melon',
'banana', 'carrot', 'clove of garlic', 'fruit',
'meat stick' }
for i = 1, d(4) + 4 do
local ingrdt = ingr[d(#ingr)]
des.object({ class='%', id=ingr[d(#ingr)] })
end
end })
end,
-- Abandoned shop
{
mindiff = 16,
contents = function()
des.room({ type = "shop", filled = 0, contents = function(rm)
local size = rm.width * rm.height
for i = 1, math.floor(size / 5) + d(3) do
des.monster('m')
if percent(35) then
des.object()
end
end
end })
end
},
-- Irregular anthole
{
mindiff = nh.mon_difficulty('soldier ant') + 4,
contents = function()
des.map({ map = [[
...............
...............
...............
...............
...............
...............
...............]], contents = function()
local room = selection.area(00, 00, 14, 06)
local origroom = room:clone()
local center = selection.ellipse(07, 03, 7, 3, 1)
room = room ~ center -- outermost edge
des.replace_terrain({ selection=room, fromterrain='.',
toterrain=' ', chance=80 })
room = center
center = selection.ellipse(07, 03, 5, 2, 1)
room = room ~ center -- a bit further in...
des.replace_terrain({ selection=room, fromterrain='.',
toterrain=' ', chance=60 })
room = center
center = selection.ellipse(07, 03, 3, 1, 1)
room = room ~ center -- even further in...
des.replace_terrain({ selection=room, fromterrain='.',
toterrain=' ', chance=40 })
des.replace_terrain({ selection=center, fromterrain='.',
toterrain=' ', chance=20 })
des.terrain(07, 03, '.')
-- now clear out any orphaned disconnected spaces not accessible
-- from the center
local orphans = origroom:filter_mapchar('.')
~ selection.floodfill(07, 03, true)
des.terrain(orphans, ' ')
-- finally, mark it up as an anthole
des.region({ region={07,03,07,03}, type = "anthole", filled = 1,
joined = 1, irregular = true })
des.wallify()
end })
end
},
};
function is_eligible(room)
local t = type(room);
local diff = nh.level_difficulty();
if (t == "table") then
if (room.mindiff ~= nil and diff < room.mindiff) then
return false
elseif (room.maxdiff ~= nil and diff > room.maxdiff) then
return false
end
elseif (t == "function") then
-- functions currently have no constraints
end
return true
end
function themerooms_generate()
local pick = 1;
local total_frequency = 0;
for i = 1, #themerooms do
-- Reservoir sampling: select one room from the set of eligible rooms,
-- which may change on different levels because of level difficulty.
if is_eligible(themerooms[i]) then
local this_frequency;
if (type(themerooms[i]) == "table" and themerooms[i].frequency ~= nil) then
this_frequency = themerooms[i].frequency;
else
this_frequency = 1;
end
total_frequency = total_frequency + this_frequency;
-- avoid rn2(0) if a room has freq 0
if this_frequency > 0 and nh.rn2(total_frequency) < this_frequency then
pick = i;
end
end
end
local t = type(themerooms[pick]);
if (t == "table") then
themerooms[pick].contents();
elseif (t == "function") then
themerooms[pick]();
end
end
|
--- @class VolumeWatcherInfo
--- @field path string
|
before_each(function()
lor = _G.lor
app = lor({
debug = true
})
Request = _G.request
Response = _G.response
req = Request:new()
res = Response:new()
end)
after_each(function()
lor = nil
app = nil
Request = nil
Response = nil
req = nil
res = nil
end)
describe("multi route: mounted on `app`", function()
it("array param", function()
local flag = 0
local func1 = function(req, res, next)
flag = 1
next()
end
local func2 = function(req, res, next)
flag = 2
next()
end
local last_func = function(req, res, next)
flag = req.query.flag or 3
end
app:get("/flag", {func1, func2, last_func})
app:erroruse(function(err, req, res, next)
assert.is.truthy(err) -- should not reach here.
flag = 999
end)
req.path = "/flag"
req.method = "get"
app:handle(req, res)
assert.is.equals(3, flag)
req.path = "/flag"
req.query = {flag=111}
req.method = "get"
app:handle(req, res)
assert.is.equals(111, flag)
end)
it("unpacked params", function()
local flag = 0
local func1 = function(req, res, next)
flag = 1
next()
end
local func2 = function(req, res, next)
flag = 2
next()
end
local last_func = function(req, res, next)
flag = req.query.flag or 3
end
app:get("/flag", func1, func2, last_func)
app:erroruse(function(err, req, res, next)
assert.is.truthy(err) -- should not reach here.
flag = 999
end)
req.path = "/flag"
req.method = "get"
app:handle(req, res)
assert.is.equals(3, flag)
req.path = "/flag"
req.query = {flag=111}
req.method = "get"
app:handle(req, res)
assert.is.equals(111, flag)
end)
end)
describe("multi route: mounted on `group router`", function()
it("array param", function()
local flag = 0
local test_router = lor:Router()
local func1 = function(req, res, next)
flag = 1
next()
end
local func2 = function(req, res, next)
flag = 2
next()
end
local last_func = function(req, res, next)
flag = req.query.flag or 3
end
test_router:get("/flag", {func1, func2, last_func})
app:use("/test", test_router())
app:erroruse(function(err, req, res, next)
assert.is.truthy(err) -- should not reach here.
flag = 999
end)
req.path = "/test/flag"
req.method = "get"
app:handle(req, res)
assert.is.equals(3, flag)
req.path = "/test/flag"
req.query = {flag=111}
req.method = "get"
app:handle(req, res)
assert.is.equals(111, flag)
end)
it("unpacked params", function()
local flag = 0
local test_router = lor:Router()
local func1 = function(req, res, next)
flag = 1
next()
end
local func2 = function(req, res, next)
flag = 2
next()
end
local last_func = function(req, res, next)
flag = req.query.flag or 3
end
test_router:get("/flag", func1, func2, last_func)
app:use("/test", test_router())
app:erroruse(function(err, req, res, next)
assert.is.truthy(err) -- should not reach here.
flag = 999
end)
req.path = "/test/flag"
req.method = "get"
app:handle(req, res)
assert.is.equals(3, flag)
req.path = "/test/flag"
req.query = {flag=111}
req.method = "get"
app:handle(req, res)
assert.is.equals(111, flag)
end)
end)
describe("multi route: muixed funcs for group router", function()
it("mixed params, case1", function()
local flag = 0
local test_router = lor:Router()
local func1 = function(req, res, next)
flag = 1
next()
end
local func2 = function(req, res, next)
flag = 2
next()
end
local last_func = function(req, res, next)
flag = 3
end
test_router:put("mixed", {func1, func2}, last_func)
app:use("/test", test_router())
req.path = "/test/mixed"
req.method = "put"
app:handle(req, res)
assert.is.equals(3, flag)
end)
it("mixed params, case2", function()
local flag = 0
local test_router = lor:Router()
local func1 = function(req, res, next)
flag = 1
next()
end
local func2 = function(req, res, next)
flag = 2
next()
end
local last_func = function(req, res, next)
flag = 3
end
test_router:get("mixed", {func1}, func2, {last_func})
app:use("/test", test_router())
req.path = "/test/mixed"
req.method = "get"
app:handle(req, res)
assert.is.equals(3, flag)
end)
end)
describe("multi route: muixed funcs for `app`", function()
it("mixed params, case1", function()
local flag = 0
local func1 = function(req, res, next)
flag = 1
next()
end
local func2 = function(req, res, next)
flag = 2
next()
end
local last_func = function(req, res, next)
flag = 3
end
app:get("mixed", {func1, func2}, last_func)
req.path = "/mixed"
req.method = "get"
app:handle(req, res)
assert.is.equals(3, flag)
end)
it("mixed params, case2", function()
local flag = 0
local func1 = function(req, res, next)
flag = 1
next()
end
local func2 = function(req, res, next)
flag = 2
next()
end
local func3 = function(req, res, next)
flag = 3
next()
end
local last_func = function(req, res, next)
flag = 4
end
app:get("mixed", {func1}, func2, {func3}, last_func)
req.path = "/mixed"
req.method = "get"
app:handle(req, res)
assert.is.equals(4, flag)
end)
end)
|
local trigger = {}
trigger.name = "MaxHelpingHand/CameraCatchupSpeedTrigger"
trigger.placements = {
name = "trigger",
data = {
catchupSpeed = 1.0,
revertOnLeave = true
}
}
return trigger |
return {'set','setpoint','setpunt','setstanden','settelen','setter','setting','settopbox','setverlies','setwinst','setsysteem','seth','setz','seton','settels','setje','setjes','sets','setters','settertje','settopboxen','setpoints','settelde','setpunten','seths'} |
------------------------------------------------------------------------------
-- Button class
------------------------------------------------------------------------------
local ctrl = {
nick = "button",
parent = iup.WIDGET,
creation = "S-",
callback = {
action = "",
}
}
function ctrl.createElement(class, param)
return iup.Button(param.title)
end
iup.RegisterWidget(ctrl)
iup.SetClass(ctrl, "iup widget")
|
--------------------------------------------------------------------------------
-- АРС-АЛС
--------------------------------------------------------------------------------
Metrostroi.DefineSystem("BARS")
TRAIN_SYSTEM.DontAccelerateSimulation = true
function TRAIN_SYSTEM:Initialize()
self.Train:LoadSystem("RC2","Relay","Switch", {paketnik = true,normally_closed = true })
self.Train:LoadSystem("VAU","Relay","Switch",{ paketnik = true,normally_closed = true })
self.Train:LoadSystem("VRD","Relay","Switch",{ paketnik = true })
-- ALS state
self.Signal80 = false
self.Signal70 = false
self.Signal60 = false
self.Signal40 = false
self.Signal0 = false
self.Special = false
self.NoFreq = true
self.RealNoFreq = true
self.Alarm = false
self.CheckedNF = 2
-- Internal state
self.Speed = 0
self.SpeedLimit = 0
self.NextLimit = 0
self.Ring = false
self.PA_Ring = false
self.Overspeed = false
self.ElectricBrake = false
self.PneumaticBrake1 = false
self.PneumaticBrake2 = true
self.PneumaticBrake2_1 = false
self.AttentionPedal = false
self.KVT = false
self.IgnoreThisARS = false
-- ARS wires
self["33D"] = 0
self["33G"] = 0
self["33Zh"] = 1
self["2"] = 0
self["6"] = 0
self["8"] = 0
self["20"] = 0
--self["21"] = 0
self["29"] = 0
self["31"] = 0
self["32"] = 0
-- Lamps
---self.LKT = false
self.LVD = false
self.EPK = {}
end
function TRAIN_SYSTEM:Outputs()
return { "2", "8", "20", "31", "32", "29", "33D", "33G", "33Zh",
"Speed", "Signal80","Signal70","Signal60","Signal40","Signal0","Special","NoFreq","RealNoFreq",
"SpeedLimit", "NextLimit","Ring","KVT","EnableARS","EnableALS","Signal", "UAVA"}
end
function TRAIN_SYSTEM:Inputs()
return { "IgnoreThisARS","AttentionPedal","Ring", "PA-Ring" }
end
function TRAIN_SYSTEM:TriggerInput(name,value)
local Train = self.Train
if name == "AttentionPedal" then
self.AttentionPedal = value > 0.5
if Train and Train.PB then
Train.PB:TriggerInput("Set",value)
end
end
if name == "IgnoreThisARS" then
self.IgnoreThisARS = value > 0.5
end
if name == "Ring" then
self.RingOverride = value > 0.5
end
if name == "PA-Ring" then
self.PA_Ring= value > 0.5
end
end
function TRAIN_SYSTEM:EPVBrake(reason,imm)
if not self.EPK[reason] and not self.EPKOffTimer and not self.EPKActTimer then
if imm then
self.EPK[reason] = CurTime() - 1
else
self.EPK[reason] = CurTime() + ((10 <= self.Speed and self.Speed <= 30) and 5.5 or 3.3)
end
end
end
function TRAIN_SYSTEM:EPVDisableBrake(reason)
if self.EPK[reason] then
self.EPK[reason] = nil
end
end
function TRAIN_SYSTEM:Think(dT)
local Train = self.Train
--if GetConVarNumber("metrostroi_ars_printnext") == Train:EntIndex() then print(Train:ReadCell(49165)) end
self.LKT = true
for _,train in ipairs(Train.WagonList) do
--print(i,train.RKTT.Value,self["33G"],train.DKPT.Value)
--if (train.RKTT and train.RKTT.Value < 0.5 and train.DKPT.Value < 0.5 and self["33G"] > 0) or (train.DKPT and train.DKPT.Value < 0.5 and self["33G"] == 0) then
if (train.RKTT and train.RKTT.Value < 0.5 and train.DKPT.Value < 0.5) then-- or (train.DKPT and train.DKPT.Value < 0.5) then
self.LKT = false
end
end
local OverrideState = false
if (not Train.VB) or (not Train.ALS) or (not Train.ARS) or (not Train.KV) then
OverrideState = true
end
-- ALS, ARS state
local KRUEnabled = Train.KRU and Train.KRU.Position > 0
local EnableARS = (OverrideState or (Train.VB.Value == 1.0) and (Train.KV.ReverserPosition ~= 0.0 or KRUEnabled))
if Train.A42 and Train.A42.Value == 0.0 then EnableARS = false end
local EnableALS = OverrideState or (Train.VB.Value == 1.0) and Train.A43.Value == 1.0
--local EnableUOS = OverrideState or (Train.VB.Value == 1.0) and ((Train.KV.ReverserPosition ~= 0.0) or KRUEnabled)
local PAKSDM = Train.Blok == 4
local PAKSD = Train.Blok == 2
local PAM = Train.Blok == 3
local PUAV = Train.Blok == 1
local KSDType = Train.Blok == 4 and "PA-KSD-M" or Train.Blok == 2 and "PA-KSD" or "PA-M"
--if self.Train.ARSType == 3 and self.Train:EntIndex() ~= 3472 then self.Train.ARSType = 1 end
if not OverrideState then
if PAKSD then
EnableARS = EnableARS and (self.Train[KSDType].State > 4 and self.Train[KSDType].State ~= 45 and self.Train[KSDType].State ~= 49) and self.Train.RC1.Value > 0.5
EnableALS = EnableALS and Train[KSDType].VPA and (self.Train[KSDType].State > 0 or self.Train[KSDType].State == -1 or self.Train[KSDType].State == -9)
elseif PAKSDM then
EnableARS = EnableARS and (self.Train[KSDType].State > 7 or ((self.Train[KSDType].State == 1.1 or self.Train[KSDType].State == 1) and self.Train[KSDType].NextState > 8)) and self.Train.RC1.Value > 0.5
EnableALS = EnableALS and (self.Train[KSDType].State > 2 or ((self.Train[KSDType].State == 1.1 or self.Train[KSDType].State == 1) and self.Train[KSDType].NextState > 3))
else
EnableARS = EnableARS and Train.ARS.Value == 1
EnableALS = EnableALS and Train.ALS.Value == 1
end
EnableUOS = false--Train[KSDType].UOS--EnableUOS and Train[KSDType].UOS
end
self.EnableARS = EnableARS
self.EnableALS = EnableALS
local EPKActivated
if (PAKSD or PAKSDM) then
EPKActivated = EnableARS
else
EPKActivated = Train.EPK.Value > 0.5 and (Train.Pneumatic.ValveType == 2 and Train.DriverValveDisconnect.Value > 0.5 or Train.DriverValveBLDisconnect.Value > 0.5)
end
if not self.EPKActivated and EPKActivated then
self.EPKActivated = EPKActivated
end
if EPKActivated and self.EPKActTimer then
self.EPKActTimer = nil
end
if not EPKActivated and self.EPKActivated and not (PAKSD or PAKSDM) and not self.EPKActTimer then
self.EPKActTimer = CurTime() + 3
end
if not EPKActivated and self.EPKActivated and (PAKSD or PAKSDM) then
self.EPKActivated = false
--self.EPKBrake = false
for k in pairs(self.EPK) do
self.EPK[k] = nil
end
end
if self.EPKActTimer and CurTime() - self.EPKActTimer > 0 then
self.EPKActivated = false
--self.EPKBrake = false
for k in pairs(self.EPK) do
self.EPK[k] = nil
end
end
-- Pedal state
--if (Train.PB) and Train.PB.Value > 0.5 then self.AttentionPedal = true end
--if (Train.PB) and Train.PB.Value < 0.5 then self.AttentionPedal = false end
local PB = Train.PB and Train.PB.Value > 0.5
--(Train.PB) and Train.PB.Value > 0.5
if PB and not self.AttentionPedalTimer and not self.Overspeed then
self.AttentionPedalTimer = CurTime() + 1
end
if PB and self.AttentionPedalTimer and (CurTime() - self.AttentionPedalTimer) > 0 then
self.AttentionPedal = true
end
if not PB and (self.AttentionPedalTimer or self.AttentionPedal) then
self.AttentionPedal = false
self.AttentionPedalTimer = nil
end
if PB or (Train.KVT) and Train.KVT.Value > 0.5 then self.KVT = true end
if not PB and (Train.KVT) and Train.KVT.Value < 0.5 then self.KVT = false end
-- Ignore pedal
if self.IgnorePedal and self.KVT then
self.KVT = false
else
self.IgnorePedal = false
end
-- Speed check and update speed data
if CurTime() - (self.LastSpeedCheck or 0) > 0.5 then
self.LastSpeedCheck = CurTime()
self.Speed = (Train.Speed or 0)
end
if (Train.UAVA and Train.SpeedSign and Train.SpeedSign > 0 and self.Speed > 0.25) or EnableALS then
local ars,arsback
self.Timer = self.Timer or CurTime()
if CurTime() - self.Timer > 1.00 then
self.Timer = CurTime()
-- Get train position
local pos = Metrostroi.TrainPositions[Train] --Metrostroi.GetPositionOnTrack(Train:GetPos(),Train:GetAngles()) --(this metod laggy for dir checks)
if pos then pos = pos[1] end
-- Get previous ARS section
if pos then
ars,arsback = Metrostroi.GetARSJoint(pos.node1,pos.x,Metrostroi.TrainDirections[Train], Train)
end
if Train.UAVA and Train.SpeedSign > 0 then
if IsValid(arsback) and arsback == self.AutostopSignal then
Train.Pneumatic.EmergencyValve = not Train.Pneumatic.UAVA
self.UAVAContacts = not Train.Pneumatic.UAVA
self.AutostopSignal = nil
if not Train.Pneumatic.UAVA then
RunConsoleCommand("say","Autostop braking",Train:GetDriverName(),arsback.Name)
end
if Train.A5.Value < 1 then
RunConsoleCommand("say","Passed stop signal",Train:GetDriverName(),arsback.Name)
end
end
if IsValid(ars) then
if ars.AutoEnabled then
self.AutostopSignal = ars
--print("enty")
elseif self.AutostopSignal == ars then
self.AutostopSignal = nil
--print("entn")
end
end
end
if Train:ReadTrainWire(5) < 1 then
ars = nil
self.RealNoFreq = true
self.NoFreq = true
self.CheckedNF = 2
end
if IsValid(ars) then
self.CheckedNF = 0
self.Alert = nil
self.Signal80 = ars:GetARS(8,Train)
self.Signal70 = ars:GetARS(7,Train)
self.Signal60 = ars:GetARS(6,Train)
self.Signal40 = ars:GetARS(4,Train)
self.Signal0 = ars:GetARS(0,Train) or ars:GetARS(2,Train)
self.Special = ars:Get325Hz() and not ars:GetARS(2,Train)
self.NoFreq = ars:GetARS(1,Train) or not (self.Signal80 or self.Signal70 or self.Signal60 or self.Signal40 or self.Signal0)
if GetConVarNumber("metrostroi_ars_printnext") == Train:EntIndex() then RunConsoleCommand("say",ars.Name,tostring(arsback and arsback.Name),tostring(ars.NextSignalLink and ars.NextSignalLink.Name or "unknown"),tostring(pos.node1.path.id),tostring(Metrostroi.TrainDirections[Train])) end
self.RealNoFreq = not (self.Signal80 or self.Signal70 or self.Signal60 or self.Signal40 or self.Signal0)
self.AVSpeedLimit = 20
if ars:GetMaxARS() >= 4 then
self.AVSpeedLimit = ars:GetMaxARSNext()*10
end
else
if GetConVarNumber("metrostroi_ars_printnext") == Train:EntIndex() then RunConsoleCommand("say","LOSE SIGNAL",tostring(pos and pos.node1.path.id or "unknown"),tostring(Metrostroi.TrainDirections[Train])) end
if (self.CheckedNF and self.CheckedNF > 1) or (self.CheckedNF == 0 and self.NoFreq) or self.RealNoFreq then
self.Alert = nil
self.Signal80 = false
self.Signal70 = false
self.Signal60 = false
self.Signal40 = false
self.Signal0 = false
self.Special = false
self.NoFreq = true
self.RealNoFreq = true
self.CheckedNF = 2
else
if not self.CheckedNF then self.CheckedNF = 0 end
self.CheckedNF = self.CheckedNF + 1
self.NoFreq = true
self.Alert = CurTime() + 0.5
end
end
self.Signal = ars
end
end
-- Check ARS signals
if not EnableALS --[[or EnableUOS]] then
self.Signal80 = false
self.Signal70 = false
self.Signal60 = false
self.Signal40 = false
self.Signal0 = false
self.Special = false
self.NoFreq = EnableARS
self.RealNoFreq = EnableARS
self.CheckedNF = 2
self.Alert = nil
end
-- ARS system placeholder logic
if EnableALS --[[or EnableUOS]] then
local V = math.floor(self.Speed +0.05)
local Vlimit = 0
if self.Signal40 then Vlimit = 40 end
if self.Signal60 then Vlimit = 60 end
if self.Signal70 then Vlimit = 70 end
if self.Signal80 then Vlimit = 80 end
self.Overspeed = false
if (PAKSD or PAM or PAKSDM) and self.Train[KSDType].VRD and not self.Signal0 and not self.RealNoFreq then
self.Train[KSDType].VRD = false
end
if self.AttentionPedal then
Vlimit = 0
end
if ( self.KVT) and (Vlimit ~= 0) and (V > Vlimit) then self.Overspeed = true end
if ( self.KVT) and (Vlimit == 0) and (V > 20) then self.Overspeed = true end
Vlimit = Vlimit + 2
if (not self.KVT) and (V > Vlimit) and (V > (self.RealNoFreq and 0 or 3)) then self.Overspeed = true end
--if ( self.KVT) and (Vlimit == 0) and self.Train.ARSType and self.Train.ARSType == 3 and not self.Train[KSDType].VRD then self.Overspeed = true end
--self.Ring = self.Overspeed and (self.Speed > 5)
-- Determine next limit and current limit
self.SpeedLimit = Vlimit
self.NextLimit = Vlimit
if self.Signal80 then self.NextLimit = 80 end
if self.Signal70 then self.NextLimit = 70 end
if self.Signal60 then self.NextLimit = 60 end
if self.Signal40 then self.NextLimit = 40 end
if self.Signal0 then self.NextLimit = 0 end
--[=[if EnableUOS then
--hack
--[[
if self.NextLimit >= 60 then
self.SpeedLimit = 40
else
self.SpeedLimit = 20
end]]
self.SpeedLimit = 40
self.Overspeed = false
if (not self.KVT) then self.Overspeed = true end
if ( self.KVT) and (V > self.SpeedLimit) then self.Overspeed = true end
else]=]
if not EnableARS then
self.ElectricBrake = false
self.PneumaticBrake1 = false
self.PneumaticBrake2 = false
end
--self.Ring = false
else
local V = math.floor(self.Speed +0.05)
self.SpeedLimit = 0
self.NextLimit = 0
self.Overspeed = false
if not self.KVT and V > 0 then self.Overspeed = true end
if ( self.KVT) and (V > 20) then self.Overspeed = true end
end
------------------
if self.SpeedLimit > 20 then self.SpeedLimit = self.SpeedLimit - 2 end
if EnableARS then
if self.ElectricBrake1 and self.ARSBrake and not (self.RealNoFreq and not self.KVT and not self.ARSBrake) then
if self.ARSBrakeTimer == nil then self.ARSBrakeTimer = CurTime() + 5 end
else
self.ARSBrakeTimer = nil
end
if self.RealNoFreq and (not self.PrevNoFreq) and Train:ReadTrainWire(6) < 1 then
self.IgnorePedal = true
end
self.PrevNoFreq = self.RealNoFreq
-- Check overspeed
--if self.Train.Owner:GetName():find("E11") then self.SpeedLimit = 25 end
if self.SpeedLimit > 20 then
if (PAM or PAKSDM) and self.Train.YAR_13A.Slope == 0 and self.Speed >= self.SpeedLimit and not self.ARSBrake then
self.ElectricBrake1 = true
end
if self.Speed >= self.SpeedLimit + 1 then
if Train:ReadTrainWire(6) == 0 then
self.ElectricBrake = true
--self.PneumaticBrake1 = true
end
self.ElectricBrake1 = true
self.ARSBrake = true
end
end
if self.ElectricBrake then
self.PneumaticBrake1 = self.Train.Electric.I24 > -50
--print(self.PneumaticBrake1)
end
if self.Overspeed then
self.ARSBrake = true
self.ElectricBrake1 = true
self.ElectricBrake = true
--self.PneumaticBrake1 = true
end
-- Check cancel of overspeed command
if not self.Overspeed and not self.ElectricBrake1 and self.ARSBrake then
self.PneumaticBrake1 = false
end
if (self.KVT or not self.ARSBrakeTimer) and (self.Speed < self.SpeedLimit - 1 and self.SpeedLimit > 20 or self.SpeedLimit < 20 and not self.Overspeed) and (self.ElectricBrake or self.ARSBrake) then
self.ElectricBrake = false
self.ElectricBrake1 = false
self.ARSBrake = false
self.PneumaticBrake1 = false
self.PneumaticBrake2 = false
end
if self.Speed < self.SpeedLimit - 1 and (self.ARSBrake or self.ElectricBrake1) and not self.ElectricBrake then
self.ARSBrake = false
self.ElectricBrake1 = false
end
--print(Train:GetPackedBool(131))
-- Check use of valve #1 during overspeed
if self.ARSBrake and self.ElectricBrake1 and self.Speed < 0.25 then
self.PneumaticBrake2 = true
end
if self.Speed < 1.25 then
self.PneumaticBrake1 = true
end
-- Parking brake limit
local BPSWorking = Train:ReadTrainWire(5) > 0 and (not (PAKSD or PAM or PAKSDM) or not Train[KSDType].Nakat)
if BPSWorking then
if self.Nakat ~= nil then
self.PneumaticBrake1 = true
self.AntiRolling = self.Nakat and true or nil
self.Nakat = nil
end
if self.Speed*Train.SpeedSign < -0.5 then
if not self.Meters then self.Meters = 0 end
self.Meters = self.Meters + self.Speed/3600*1000*dT
if self.Meters > 0.5 + (Train:ReadTrainWire(1) > 0 and 2.5 or 0) then
self.AntiRolling = true
end
else
if Train.KV.ControllerPosition <= 0 and self.AntiRolling then
self.AntiRolling = false
end
if Train.KV.ControllerPosition > 0 and self.AntiRolling == false then
self.AntiRolling = nil
end
self.Meters = nil
end
else
self.AntiRolling = nil
if (PAKSD or PAM or PAKSDM) and Train[KSDType].Nakat then self.PneumaticBrake1 = false end
end
--if BPSWorking and self.EPKActivated and not Train[KSDType].Stancionniy and Train:ReadTrainWire(5) > 0 and self.Speed*self.Train.SpeedSign < -5 and not self.EPKBrake then
--self.EPKBrake = true
--RunConsoleCommand("say","EPV braking (Driver rolling back)",Train:GetDriverName())
--end
--BPS Logic
if not BPSWorking then
self.StoppedOnSlopeByRP = false
self.BPSActive = false
end
--if (Train.BPS == nil or Train.BPS.Value < 0.5) then self.AntiRolling = nil end
-- Check cancel pneumatic brake 1 command
if ((Train:ReadTrainWire(1) > 0) or (Train.RRP and Train.RRP.Value > 0 and not self.ElectricBrake1)) then
if (Train:ReadTrainWire(1) > 0 or (Train.RRP and Train.RRP.Value > 0 and not self.ElectricBrake1)) and self.PneumaticBrake1 and not self.Overspeed then
self.PneumaticBrake1 = false
end
end
if self.Signal0 and not self.Special and not self.RealNoFreq and not self.Signal40 and not self.Signal60 and not self.Signal70 and not self.Signal80 then
if not self.ReadyPeep then self.ReadyPeep = true end
if not self.NonVRD and (not Train[KSDType].VRD and (PAKSD or PAKSDM) or self.Train.VRD.Value < 0.5 and (PAM or PUAV)) then
self.VRDTimer = nil
end
self.NonVRD = (PAKSD or PAKSDM) and not Train[KSDType].VRD or (PAM or PUAV) and self.Train.VRD.Value < 0.5
if self.NonVRD and self.Train:ReadTrainWire(6) < 0 then
if self.VRDTimer and CurTime() - self.VRDTimer > 0 then
self.VRDTimer = false
elseif self.VRDTimer ~= false then
if not self.VRDTimer and self.KVT then self.VRDTimer = CurTime() + 1 end
if self.VRDTimer and not self.KVT then self.VRDTimer = nil end
end
elseif self.Train:ReadTrainWire(6) > 0 then
self.VRDTimer = false
else
self.VRDTimer = false
end
else
if self.ReadyPeep then
self.ReadyPeep = nil
self.PeepTimer = CurTime() + 0.1
end
if self.PeepTimer and self.PeepTimer - CurTime() < 0 then
self.PeepTimer = nil
end
-- self.PeepTimer = nil
--if self.ReadyPeep == nil then
--self.ReadyPeep = true
--end
if self.NonVRD then self.NonVRD = false end
self.VRDTimer = false
end
local VRDoff = (PAKSD or PAKSDM ) and 0 or 1
if (self.Train:ReadTrainWire(15) < 1.0) and (self.Speed < 1.0) and not Train[KSDType].KD and (PAKSD or PAM or PAKSDM) then
self.KD = true
elseif (PAKSD or PAM or PAKSDM) and Train[KSDType].AutodriveWorking and not self.Train.Autodrive.AutodriveEnabled then
self.KD = true
elseif Train[KSDType].KD or self.Train:ReadTrainWire(15) > 0.0 and (PAKSD or PAM or PAKSDM) then
self.KD = false
end
-- ARS signals
local Ebrake, Abrake, NFBrake, Pbrake1,Pbrake2 =
((self.ElectricBrake) and 1 or 0),
((self.ARSBrake) and 1 or 0),
((self.SpeedLimit < 20 and not self.KVT and not self.ARSBrake) and 1 or 0),
(self.PneumaticBrake1 and 1 or 0),
(self.PneumaticBrake2 and 1 or 0)
local VRDBrake = self.NonVRD or self.VRDTimer ~= false
-- Apply ARS system commands
self["33D"] = (1 - Abrake) *(1-NFBrake)*((self.KD or self.ElectricBrake1 or VRDBrake or self.AntiRolling ~= nil or Train[KSDType].StopTrain) and 0 or 1) --*(2 - Pbrake2)
self["33G"] = Ebrake + NFBrake*VRDoff + ((VRDBrake) and 1 or 0)*VRDoff
self["33Zh"] = (1 - Abrake)*(1-NFBrake*VRDoff)*((self.KD or VRDBrake or self.ElectricBrake1 or self.AntiRolling ~= nil or Train[KSDType].StopTrain) and 0 or 1)--*(2 - Pbrake2)
--print(self["33Zh"])
self["2"] = Ebrake + NFBrake*VRDoff + ((VRDBrake) and 1 or 0)*VRDoff
self["20"] = Ebrake + NFBrake*VRDoff + ((VRDBrake) and 1 or 0)*VRDoff
self["29"] = Pbrake1-- + (self.BPSActive and 1 or 0)
--print(Train.Speed)
--if GetConVarNumber("metrostroi_ars_printnext") == Train:EntIndex() then print(self.SpeedLimit,self.self.SpeedLimit <= 20 and not self.KVT) end
--if StPetersburg then print(self.Train:EntIndex()) end
self["8"] = Pbrake2
+ (KRUEnabled and 1 or 0)*Ebrake
+ ((self.SpeedLimit < 20 and not self.KVT and VRDBrake == 0 or self.Speed > 20 and self.SpeedLimit < 20) and 1 or 0)
+ (self.BPSActive and 1 or 0)
+ (self.AntiRolling ~= nil and 1 or 0)
+ (1 - ((self.EPKActivated and 1 or 0) or 1)
+ (Train[KSDType].StopTrain and 1 or 0))
---self.LKT = (self["33G"] > 0.5) or (self["29"] > 0.5) or (Train:ReadTrainWire(35) > 0)
self.LVD = self.LVD or self["33D"] < 0.5
if Train:ReadTrainWire(6) < 1 and self["33D"] > 0.5 then self.LVD = false end
self.Ring = ((self["33D"] < 0.5 and ((NFBrake < 1 and self.ARSBrakeTimer ~= nil and self.ARSBrakeTimer ~= false) or self.VRDTimer ~= false)) or self.KSZD or (self.PeepTimer and self.PeepTimer-CurTime() > 0)) or math.max(20,self.SpeedLimit-1) < self.Speed and (PAKSDM or PAM)
if self.ElectricBrake or self.PneumaticBrake2 then
if not self.LKT then
self:EPVBrake("LKT not light-up when ARS stopping")
else
self:EPVDisableBrake("LKT not light-up when ARS stopping")
end
else
self:EPVDisableBrake("LKT not light-up when ARS stopping")
end
if self.KVT and self.ARSBrakeTimer then self.ARSBrakeTimer = false end
if self.EPKActivated and not self.LKT and self.Speed < 0.05 and Train:ReadTrainWire(1) == 0 and (not (PAKSD or PAM or PAKSDM) or not Train[KSDType].Nakat) then -- or (self.AntiRolling ~= nil and Train:ReadTrainWire(1) > 0) then
self:EPVBrake("LKT off when stopped")
else
self:EPVDisableBrake("LKT off when stopped")
end
else
self.AntiRolling = nil
self.ElectricBrake1 = true
self.ElectricBrake = true
self.PneumaticBrake1 = false
self.PneumaticBrake2 = true
self.ARSBrake = true
self["33D"] = 0
self["33Zh"] = 1
self["8"] = KRUEnabled and (1-Train.RPB.Value) or 0
self["33G"] = 0
self["2"] = 0
self["20"] = 0
self["29"] = 0
---self.LKT = false
self.LVD = false
self.Ring = false
end
-- ARS signalling train wires
if EnableARS then
self.Train:WriteTrainWire(21,self.LVD and 1 or 0)-----self.LKT and 1 or 0)
else--if not EnableUOS then
self.Train:WriteTrainWire(21,0)
end
-- RC1 operation
if self.Train.RC1 and (self.Train.RC1.Value == 0) then
if PAKSD or PAKSDM and not Train[KSDType].UOS then
Train[KSDType].UOS = true
end
--self["33D"] = self.Speed > 55 and 0 or 1
self["33G"] = 0
self["33Zh"] = 1
--
self["2"] = 0
self["20"] = 0
self["29"] = 0
--
self["31"] = 0
self["32"] = 0
--self["8"] = KRUEnabled and (1-Train.RPB.Value) or 0
self["33D"] = (self.Speed + 0.5 > 9000 and ((not PAKSD and not PAKSDM) or Train[KSDType].State > 0)) and 0 or 1
--self["33G"] = (self.Speed + 0.5 > 35) and 1 or KRUEnabled and (1-Train.RPB.Value) or 0
--self["33Zh"] = 1--(self.Speed + 0.5 > 40) and 0 or KAH
self["8"] = (self.Speed + 0.5 > 9000 and ((not PAKSD and not PAKSDM) or Train[KSDType].State > 0)) and 1 or KRUEnabled and (1-Train.RPB.Value) or 0
else
if (not self.EPKActivated) then
self["33D"] = 0
self["33Zh"] = 1
end
end
if Train.RV_2 then
Train.RV_2:TriggerInput("Set",EnableARS and 1 or 0)
end
if self.EPKActivated then
--if self.EPKOffARS then
--self:EPVBrake("Was the emergency brake",true)
--end
--self.EPKOffARS = nil
--if self.EPKTimer then print(self.EPKTimer - CurTime(),self.EPKTimer < CurTime(),self.EPKTimer > CurTime() ) end
if not EnableARS then
self:EPVBrake("ARS disabled")
else
self:EPVDisableBrake("ARS disabled")
end
if self.ARSBrakeTimer then
self:EPVBrake("Braking 3 seconds")
else
self:EPVDisableBrake("Braking 3 seconds")
end
if (PAKSD or PAKSDM) and self.KVT and not self.EPKOffTimer and self.EPKBrake then
self.EPKOffTimer = CurTime() + 1
--self.EPKBrake = false
end
if self.EPKOffTimer and not self.KVT then
self.EPKOffTimer = nil
self.EPKBrake = true
end
if self.EPKOffTimer and CurTime()-self.EPKOffTimer > 0 then
self.EPKOffTimer = nil
self.EPKBrake = false
end
else
--self.EPKOffTimer = nil
--[[if EnableARS and self.EPKOffARS == nil then
self.EPKOffARS = true
else
self.EPKOffARS = false
end]]
--if self.EPKOffARS then
--self.EPKOffARS = false
--end
if not EnableARS then
self.EPKBrake = false
end
end
--if not EPKActivated then
--if EnableARS and self.EPKOffARS == nil then
--print(self.EPKBrake)
--self.EPKOffARS = self.EPKBrake
--end
--end
--if GetConVarNumber("metrostroi_ars_printnext") == Train:EntIndex() then print(self.EPKOffARS,EnableARS) end
if not EnableARS then self.EPKOffARS = false end
-- 81-717 autodrive/autostop
if (Train.Pneumatic and Train.Pneumatic.EmergencyValve) or self.UAVAContacts then
self["33D"] = 0
self["33Zh"] = 1
end
-- 81-717 special VZ1 button
if self.Train.VZ1 then
self["29"] = self["29"] + self.Train.VZ1.Value
end
if Train.UAVAContact and Train.UAVAContact.Value > 0.5 and not Train.Pneumatic.EmergencyValve then
self.UAVAContacts = nil
end
self["8"] = self["8"]*(self.Train.A41 and self.Train.A41.Value or 1)*(self.Train.A8 and self.Train.A8.Value or 1) + self.Train.OVT.Value
self["29"] = self["29"]*(self.Train.A8 and self.Train.A8.Value or 1)
self.Ring = self.Ring or (self.Alert and self.Alert - CurTime() > 0)
if Train.Rp8 then Train.Rp8:TriggerInput("Set",self["8"] + ((self.Train.RC1 and (self.Train.RC1.Value == 0)) and (1-self["33D"]) or 0)) end
self.Ring = self.PA_Ring or self.RingOverride or self.Ring
--[[
if PAKSD and Train["PA-KSD"].State == 5 then
self["33D"] = 1
self["33Zh"] = 1
self["33G"] = 0
self["2"] = 0
self["20"] = 0
self["29"] = 0
self["8"] = 0
end
if (PAM or PAKSDM) and Train["PA-M"].State == 8 then
self["33D"] = 1
self["33Zh"] = 1
self["33G"] = 0
self["2"] = 0
self["20"] = 0
self["29"] = 0
self["8"] = 0
end
]]
for k,v in pairs(self.EPK) do
if CurTime() - v > 0 and not self.EPKBrake and (not self.KVT or not (PAKSD or PAKSDM)) then
self.EPKBrake = true
RunConsoleCommand("say","EPV braking ("..k..")",self.Train:GetDriverName())
end
end
Train.Pneumatic.EmergencyValveEPK = self.EPKBrake and not self.EPKOffTimer and not self.EPKActTimer
end
|
local requestedIpl = {"h4_islandairstrip", "h4_islandairstrip_props", "h4_islandx_mansion", "h4_islandx_mansion_props", "h4_islandx_props", "h4_islandxdock", "h4_islandxdock_props", "h4_islandxdock_props_2", "h4_islandxtower", "h4_islandx_maindock", "h4_islandx_maindock_props", "h4_islandx_maindock_props_2", "h4_IslandX_Mansion_Vault", "h4_islandairstrip_propsb", "h4_beach", "h4_beach_props", "h4_beach_bar_props", "h4_islandx_barrack_props", "h4_islandx_checkpoint", "h4_islandx_checkpoint_props", "h4_islandx_Mansion_Office", "h4_islandx_Mansion_LockUp_01", "h4_islandx_Mansion_LockUp_02", "h4_islandx_Mansion_LockUp_03", "h4_islandairstrip_hangar_props", "h4_IslandX_Mansion_B", "h4_islandairstrip_doorsclosed", "h4_Underwater_Gate_Closed", "h4_mansion_gate_closed", "h4_aa_guns", "h4_IslandX_Mansion_GuardFence", "h4_IslandX_Mansion_Entrance_Fence", "h4_IslandX_Mansion_B_Side_Fence", "h4_IslandX_Mansion_Lights", "h4_islandxcanal_props", "h4_beach_props_party", "h4_islandX_Terrain_props_06_a", "h4_islandX_Terrain_props_06_b", "h4_islandX_Terrain_props_06_c", "h4_islandX_Terrain_props_05_a", "h4_islandX_Terrain_props_05_b", "h4_islandX_Terrain_props_05_c", "h4_islandX_Terrain_props_05_d", "h4_islandX_Terrain_props_05_e", "h4_islandX_Terrain_props_05_f", "H4_islandx_terrain_01", "H4_islandx_terrain_02", "H4_islandx_terrain_03", "H4_islandx_terrain_04", "H4_islandx_terrain_05", "H4_islandx_terrain_06", "h4_ne_ipl_00", "h4_ne_ipl_01", "h4_ne_ipl_02", "h4_ne_ipl_03", "h4_ne_ipl_04", "h4_ne_ipl_05", "h4_ne_ipl_06", "h4_ne_ipl_07", "h4_ne_ipl_08", "h4_ne_ipl_09", "h4_nw_ipl_00", "h4_nw_ipl_01", "h4_nw_ipl_02", "h4_nw_ipl_03", "h4_nw_ipl_04", "h4_nw_ipl_05", "h4_nw_ipl_06", "h4_nw_ipl_07", "h4_nw_ipl_08", "h4_nw_ipl_09", "h4_se_ipl_00", "h4_se_ipl_01", "h4_se_ipl_02", "h4_se_ipl_03", "h4_se_ipl_04", "h4_se_ipl_05", "h4_se_ipl_06", "h4_se_ipl_07", "h4_se_ipl_08", "h4_se_ipl_09", "h4_sw_ipl_00", "h4_sw_ipl_01", "h4_sw_ipl_02", "h4_sw_ipl_03", "h4_sw_ipl_04", "h4_sw_ipl_05", "h4_sw_ipl_06", "h4_sw_ipl_07", "h4_sw_ipl_08", "h4_sw_ipl_09", "h4_islandx_mansion", "h4_islandxtower_veg", "h4_islandx_sea_mines", "h4_islandx", "h4_islandx_barrack_hatch", "h4_islandxdock_water_hatch", "h4_beach_party"}
CreateThread(function()
for i = #requestedIpl, 1, -1 do
RequestIpl(requestedIpl[i])
requestedIpl[i] = nil
end
requestedIpl = nil
end)
CreateThread(function()
while true do
SetRadarAsExteriorThisFrame()
SetRadarAsInteriorThisFrame(`h4_fake_islandx`, vec(4700.0, -5145.0), 0, 0)
Wait(0)
end
end)
CreateThread(function()
Wait(2500)
local islandLoaded = false
local islandCoords = vector3(4840.571, -5174.425, 2.0)
SetDeepOceanScaler(0.0)
while true do
local pCoords = GetEntityCoords(PlayerPedId())
if #(pCoords - islandCoords) < 2000.0 then
if not islandLoaded then
islandLoaded = true
Citizen.InvokeNative(0xF74B1FFA4A15FBEA, 1)
end
else
if islandLoaded then
islandLoaded = false
Citizen.InvokeNative(0xF74B1FFA4A15FBEA, 0)
end
end
Wait(5000)
end
end) |
-- --------------------
-- TellMeWhen
-- Originally by Nephthys of Hyjal <lieandswell@yahoo.com>
-- Other contributions by:
-- Sweetmms of Blackrock, Oozebull of Twisting Nether, Oodyboo of Mug'thol,
-- Banjankri of Blackrock, Predeter of Proudmoore, Xenyr of Aszune
-- Currently maintained by
-- Cybeloras of Aerie Peak/Detheroc/Mal'Ganis
-- --------------------
if not TMW then return end
local TMW = TMW
local L = TMW.L
local print = TMW.print
TMW.Classes.SharableDataType.types.group:RegisterMenuBuilder(10, function(Item_group)
local gs = Item_group.Settings
local IMPORTS, EXPORTS = Item_group:GetEditBox():GetAvailableImportExportTypes()
-- copy group position
local info = TMW.DD:CreateInfo()
info.text = L["COPYGROUP"] .. " - " .. L["COPYPOSSCALE"]
info.func = function()
TMW.DD:CloseDropDownMenus()
local destgroup = IMPORTS.group_overwrite
local destgs = destgroup:GetSettings()
-- Restore all default settings first.
-- Not a special table (["**"]), so just normally copy it.
-- Setting it nil won't recreate it like other settings tables, so re-copy from defaults.
destgs.Point = CopyTable(TMW.Group_Defaults.Point)
TMW:CopyTableInPlaceUsingDestinationMeta(gs.Point, destgs.Point, true)
destgs.Scale = gs.Scale or TMW.Group_Defaults.Scale
destgs.Level = gs.Level or TMW.Group_Defaults.Level
destgs.Strata = gs.Strata or TMW.Group_Defaults.Strata
destgroup:Setup()
end
info.notCheckable = true
info.disabled = not IMPORTS.group_overwrite
TMW.DD:AddButton(info)
end)
|
local categories = require "category"
local function new(category)
local x = map.startX
local y = map.startY
local speedX = categories.speedX[category] or categories.speedX[#categories.speedX]
local speedY = categories.speedY[category] or categories.speedY[#categories.speedY]
local radius = categories.radius[category] or categories.radius[#categories.radius]
local health = categories.health[category] or categories.health[#categories.health]
local alive = true
local destinationIndex = 1
local function move(index)
local destination = map.destinations[destinationIndex]
local directionX = 0
if(x < destination.x) then
directionX = 1
elseif(x > destination.x) then
directionX = -1
end
local distance = math.abs(destination.x - x)
if speedX > distance then
x = x + distance * directionX
else
x = x + speedX * directionX
end
local directionY = 0
if(y < destination.y) then
directionY = 1
elseif(y > destination.y) then
directionY = -1
end
distance = math.abs(destination.y - y)
if speedY > distance then
y = y + distance * directionY
else
y = y + speedY * directionY
end
if circleCollision(x, y, 1, destination.x, destination.y, 1) then
destinationIndex = destinationIndex + 1
if destinationIndex > #map.destinations then
table.remove(enemies, index)
end
end
end
local function checkAlive(index)
if not alive then
table.remove(enemies, index)
end
end
local function update()
local index = nil
while true do
move(index)
index = coroutine.yield()
checkAlive(index)
end
end
local function draw()
local red = categories.red[category] or categories.red[#categories.red]
local green = categories.green[category] or categories.green[#categories.green]
local blue = categories.blue[category] or categories.blue[#categories.blue]
love.graphics.setColor(red, green, blue)
love.graphics.circle("fill", x, y, radius)
love.graphics.setColor(1, 1, 1)
end
local function getX()
return x
end
local function getY()
return y
end
local function takeDamage(damage)
health = health - damage
if health <= 0 then
alive = false
end
end
return {
getX = getX,
getY = getY,
radius = radius,
category = category,
update = coroutine.wrap(update),
draw = draw,
takeDamage = takeDamage,
}
end
return {
new = new,
}
|
Inventory = {
Items = {},
ItemCount = 0,
}
function Inventory:AddItem( item )
System:LogToConsole( "Add item to inventory..." );
self.ItemCount = self.ItemCount + 1;
self.Items[ self.ItemCount ] = item;
end
function Inventory:RemoveItem( itemid )
System:LogToConsole( "Remove item to inventory..." );
local i;
self.ItemCount = self.ItemCount - 1;
for i=itemid,self.ItemCount do
self.Items[ i ] = self.Items[ i + 1 ];
end
self.Items[ self.ItemCount + 1 ] = nil;
end
function Inventory:GetItemCount()
return self.ItemCount;
end
function Inventory:GetItem( itemid )
return self.Items[ itemid ];
end
function Inventory:GetItemId( item )
local checkitem;
local i;
for i, checkitem in self.Items do
if ( checkitem == item ) then
return i;
end
end
return nil;
end
function Inventory:HasItem( item )
local checkitem;
local i;
for i, checkitem in self.Items do
if ( checkitem == item ) then
return 1;
end
end
return nil;
end
function Inventory:Reset()
local checkitem;
local i;
for i, checkitem in self.Items do
self.Items[ i ] = nil;
end
self.ItemCount = 0;
end |
return {
components = {
bone = {},
parentConstraint = {
enabled = false,
},
},
children = {
{
components = {
bone = {
transform = {0, 0, 0, 1 / 32, 1 / 32, 6, 3},
},
parentConstraint = {},
sprite = {
image = "carnelia/resources/images/farmer/upperLeg.png",
normalMap = "carnelia/resources/images/farmer/upperLegNormal.png",
},
},
},
{
components = {
bone = {
transform = {0, 0.5, 0.5 * math.pi},
},
parentConstraint = {
enabled = false,
},
},
children = {
{
components = {
bone = {
transform = {0, 0, 0, 1 / 32, 1 / 32, 7, 3},
},
parentConstraint = {},
sprite = {
image = "carnelia/resources/images/farmer/lowerLeg.png",
normalMap = "carnelia/resources/images/farmer/lowerLegNormal.png",
},
},
},
{
components = {
foot = {},
bone = {
transform = {0, 0.5, -0.25 * math.pi},
},
parentConstraint = {
enabled = false,
},
},
children = {
{
components = {
bone = {
transform = {0, 0, 0, 1 / 32, 1 / 32, 4.75, 7},
},
parentConstraint = {},
sprite = {
image = "carnelia/resources/images/farmer/foot.png",
normalMap = "carnelia/resources/images/farmer/footNormal.png",
},
},
},
},
},
},
},
},
}
|
local class = require "lib.lua-oop"
Timer = class("Timer")
function Timer:constructor(timeOutSecs, oneShoot, start)
self.timeOutSecs = timeOutSecs
self.oneShoot = oneShoot
self.destroyed = false
self.started = false
self.hasTimeOuted = false
self.timeout = false
self.onTimeouts = {}
self.resetRequested = false
if start then
self:start()
end
end
function Timer:start()
if self.destroyed then return end
if not (self.started) then
self.started = true
self.endSecs = os.clock() + self.timeOutSecs
end
end
function Timer:update(dt)
if (not self.started) or self.destroyed then
return
end
-- check if reset is requested (for security)
if self.resetRequested then
self.resetRequested = false
self:reset(self.reqResetStart)
end
if os.clock() >= self.endSecs then
if self.oneShoot then
if self.hasTimeOuted then
self.timeout = false;
else
self.timeout = true;
self:executeOnTimeouts()
end
else
self.timeout = true;
self:executeOnTimeouts()
end
self.hasTimeOuted = true;
end
end
function Timer:doTimer(dt)
if self.destroyed then return end
self:start()
self:update(dt)
end
function Timer:onTimeout(func)
if self.destroyed then return end
assert(type(func) == "function", "Parameter is not a function (Timer)")
table.insert(self.onTimeouts, func)
end
function Timer:reset(start)
if self.destroyed then return end
if start == nil then
start = true
end
self.started = false
self.hasTimeOuted = false
self.timeout = false
if start then
self:start()
end
end
function Timer:requestReset(start)
if self.destroyed then return end
self.resetRequested = true
self.reqResetStart = start
end
function Timer:destroy()
self.destroyed = true
end
function Timer:executeOnTimeouts()
if self.destroyed then return end
for key, func in pairs(self.onTimeouts) do
func(self)
end
end
return Timer
|
--[[
LibPlayerSpells-1.0 - Additional information about player spells.
(c) 2013-2018 Adirelle (adirelle@gmail.com)
This file is part of LibPlayerSpells-1.0.
LibPlayerSpells-1.0 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
LibPlayerSpells-1.0 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LibPlayerSpells-1.0. If not, see <http://www.gnu.org/licenses/>.
--]]
local lib = LibStub('LibPlayerSpells-1.0')
if not lib then return end
lib:__RegisterSpells('MONK', 80000, 1, {
COOLDOWN = {
107428, -- Rising Sun Kick (Mistweaver/Windwalker)
109132, -- Roll
113656, -- Fists of Fury (Windwalker)
115098, -- Chi Wave (talent)
115313, -- Summon Jade Serpent Statue (Mistweaver talent)
115315, -- Summon Black Ox Statue (Brewmaster talent)
115399, -- Black Ox Brew (Brewmaster talent)
116844, -- Ring of Peace (talent)
119582, -- Purifying Brew (Brewmaster)
119996, -- Transcendence: Transfer (Brewmaster)
122281, -- Healing Elixir (Brewmaster/Mistweaver talent)
123904, -- Invoke Xuen, the White Tiger (Windwalker talent)
123986, -- Chi Burst (talent)
126892, -- Zen Pilgrimage
152175, -- Whirling Dragon Punch (Windwalker talent)
198644, -- Invoke Chi-Ji, the Red Crane (Mistweaver talent)
202370, -- Mighty Ox Kick (Brewmaster honor talent)
213658, -- Craft: Nimble Brew (Brewmaster honor talent)
261947, -- Fist of the White Tiger (Windwalker talent)
[115288] = 'POWER_REGEN', -- Energizing Elixir (Windwalker talent)
[116705] = 'INTERRUPT', -- Spear Hand Strike (Brewmaster)
AURA = {
HARMFUL = {
115804, -- Mortal Wounds (Windwalker)
122470, --Touch of Karma (Windwalker)
123725, -- Breath of Fire (Brewmaster)
201787, -- Heavy-Handed Strikes (Windwalker honor talent)
206891, -- Intimidated (Brewmaster honor talent)
233759, -- Grapple Weapon (Mistweaver/Windwalker honor talent)
[115080] = 'BURST', -- Touch of Death (Windwalker)
CROWD_CTRL = {
[115078] = 'INCAPACITATE', -- Paralysis
[116706] = 'ROOT', -- Disable (Windwalker)
DISORIENT = {
198909, -- Song of Chi-Ji (Mistweaver talent)
202274, -- Incendiary Brew (Brewmaster honor talent)
},
STUN = {
119381, -- Leg Sweep
202346, -- Double Barrel (Brewmaster honor talent)
},
TAUNT = {
116189, -- Provoke
118635, -- Provoke (Brewmaster talent)
196727, -- Provoke (Brewmaster talent)
},
},
SNARE = {
116095, -- Disable (Windwalker)
121253, -- Keg Smash (Brewmaster)
123586, -- Flying Serpent Kick (Wilnwalker)
},
},
HELPFUL = {
116841, -- Tiger's Lust (talent)
119611, -- Renewing Mist (Mistweaver)
191840, -- Essence Font (Mistweaver)
201447, -- Ride the Wind (Windwalker honor talent)
205655, -- Dome of Mist (Mistweaver honor talent)
SURVIVAL = {
116849, -- Life Cocoon (Mistweaver)
202162, -- Avert Harm (Brewmaster honor talent)
202248, -- Guided Meditation (Brewmaster honor talent)
},
},
PERSONAL = {
101643, -- Transcendence (Brewmaster)
116680, -- Thunder Focus Tea (Mistweaver)
116847, -- Rushing Jade Wind (Brewmaster talent)
119085, -- Chi Torpedo (talent)
196725, -- Refreshing Jade Wind (Mistweaver talent)
197908, -- Mana Tea (Mistweaver talent)
202335, -- Double Barrel (Brewmaster honor talent)
209584, -- Zen Focus Tea (Mistweaver honor talent)
215479, -- Ironskin Brew (Brewmaster)
261715, -- Rushing Jade Wind (Windwalker talent)
BURST = {
137639, -- Storm, Earth, and Fire (Windwalker)
152173, -- Serenity (Windwalker talent)
216113, -- Way of the Crane (Mistweaver honor talent)
},
SURVIVAL = {
115176, -- Zen Meditation (Brewmaster)
115295, -- Guard (Brewmaster talent)
120954, -- Fortifying Brew (Brewmaster)
122278, -- Dampen Harm (talent)
122783, -- Diffuse Magic (Mistweaver/Windwalker talent)
125174, -- Touch of Karma (Windwalker)
201318, -- Fortifying Brew (Windwalker honor talent)
243435, -- Fortifying Brew (Mistweaver)
},
},
},
DISPEL = {
HELPFUL = {
[115310] = 'DISEASE MAGIC POISON', -- Revival (Mistweaver)
[115450] = 'DISEASE MAGIC POISON', -- Detox (Mistweaver)
[205234] = 'MAGIC', -- Healing Sphere (Mistweaver honor talent)
[218164] = 'DISEASE POISON', -- Detox (Brewmaster/Windwalker)
},
}
},
AURA = {
HARMFUL = {
117952, -- Crackling Jade Lightning
228287, -- Mark of the Crane (Windwalker)
},
HELPFUL = {
115175, -- Soothing Mist (Mistweaver)
124682, -- Enveloping Mist (Mistweaver)
198533, -- Soothing Mist (Mistweaver talent)
227344, -- Surging Mist (Mistweaver honor talent)
},
PERSONAL = {
116768, -- Blackout Kick! (Windwalker)
195630, -- Elusive Brawler (Brewmaster)
196608, -- Eye of the Tiger (Brewmaster/Windwalker talent) -- NOTE: also HARMFUL with the same id (not supported)
197916, -- Lifecycles (Vivify) (Mistweaver talent)
197919, -- Lifecycles (Enveloping Mist) (Mistweaver talent)
202090, -- Teachings of the Monastery (Mistweaver)
228563, -- Blackout Combo (Brewmaster talent)
247483, -- Tigereye Brew (Windwalker honor talent)
261769, -- Inner Strength (Windwalker talent)
},
},
}, {
-- map aura to provider(s)
[115804] = 107428, -- Mortal Wounds (Windwalker) <- Rising Sun Kick
[116189] = 115546, -- Provoke
[116706] = 116095, -- Disable (Windwalker)
[116768] = 100780, -- Blackout Kick! (Windwalker) <- Tiger Palm
[118635] = 115315, -- Provoke (Brewmaster talent) <- Summon Black Ox Statue
[119085] = 115008, -- Chi Torpedo (talent)
[119611] = 115151, -- Renewing Mist (Mistweaver)
[120954] = 115203, -- Fortifying Brew (Brewmaster)
[123586] = 101545, -- Flying Serpent Kick (Wilnwalker)
[123725] = 115181, -- Breath of Fire (Brewmaster)
[125174] = 122470, -- Touch of Karma (Windwalker)
[137639] = 221771, -- Storm, Earth, and Fire (Windwalker)
[191840] = 231633, -- Essence Font <- Essense Font (Rank 2) (Mistweaver)
[195630] = 117906, -- Elusive Brawler (Brewmaster) <- Mastery: Elusive Brawler
[196608] = 196607, -- Eye of the Tiger (Brewmaster talent)
[196727] = 132578, -- Provoke (Brewmaster talent) <- Invoke Niuzao, the Black Ox -- BUG: not in the spellbook
[197916] = 197915, -- Lifecycles (Vivify) (Mistweaver talent) <- Lifecycles
[197919] = 197915, -- Lifecycles (Enveloping Mist) (Mistweaver talent) <- Lifecycles
[198533] = 115313, -- Soothing Mist (Mistweaver talent) <- Summon Jade Serpent Statue
[198909] = 198898, -- Song of Chi-Ji (Mistweaver talent)
[201447] = 201372, -- Ride the Wind (Windwalker honor talent)
[201787] = 232054, -- Heavy-Handed Strikes (Windwalker honor talent)
[202090] = 116645, -- Teachings of the Monastery (Mistweaver)
[202248] = 202200, -- Guided Meditation (Brewmaster honor talent)
[202274] = 202272, -- Incendiary Brew (Brewmaster honor talent) <- Incendiary Breath
[202346] = 202335, -- Double Barrel (Brewmaster honor talent)
[205655] = 202577, -- Dome of Mist (Mistweaver honor talent)
[206891] = 207025, -- Intimidated (Brewmaster honor talent) <- Admonishment
[215479] = 115308, -- Ironskin Brew (Brewmaster)
[228287] = 101546, -- Mark of the Crane (Windwalker) <- Spinning Crane Kick
[228563] = 196736, -- Blackout Combo (Brewmaster talent)
[261769] = 261767, -- Inner Strength (Windwalker talent)
}, {
-- map aura to modified spell(s)
[116680] = { -- Thunder Focus Tea (Mistweaver)
107428, -- Rising Sun Kick
115151, -- Renewing Mist
116670, -- Vivify
124682, -- Enveloping Mist
},
[116768] = 100784, -- Blackout Kick! (Windwalker) -> Blackout Kick
[118635] = 115546, -- Provoke (Brewmaster talent)
[191840] = 191837, -- Essence Font (Mistweaver)
[195630] = 205523, -- Elusive Brawler (Brewmaster) -> Blackout Strike
[196608] = 100780, -- Eye of the Tiger (Brewmaster talent) -> Tiger Palm
[196727] = 196727, -- Provoke (Niuzao) (Brewmaster talent) -- BUG: not in the spellbook
[197916] = 116670, -- Lifecycles (Vivify) (Mistweaver talent) -> Vivify
[197919] = 124682, -- Lifecycles (Enveloping Mist) (Mistweaver talent) -> Enveloping Mist
[201447] = 101545, -- Ride the Wind (Windwalker honor talent) -> Flying Serpent Kick
[201787] = 113656, -- Heavy-Handed Strikes (Windwalker honor talent) -> Fists of Fury
[202090] = 100784, -- Teachings of the Monastery (Mistweaver) -> Blackout Kick
[202248] = 115176, -- Guided Meditation (Brewmaster honor talent) -> Zen Meditation
[202274] = 115181, -- Incendiary Brew (Brewmaster honor talent) -> Breath of Fire
[202335] = 121253, -- Double Barrel (Brewmaster honor talent) -> Keg Smash
[202346] = 121253, -- Double Barrel (Brewmaster honor talent) -> Keg Smash
[205655] = 115151, -- Dome of Mist (Mistweaver honor talent) -> Renewing Mist
[228563] = { -- Blackout Combo (Brewmaster talent)
100780, -- Tiger Palm
115181, -- Breath of Fire
115308, -- Ironskin Brew
121253, -- Keg Smash
},
[261769] = { -- Inner Strength (Windwalker talent)
100784, -- Blackout Kick
101546, -- Spinning Crane Kick
107428, -- Rising Sun Kick
113656, -- Fists of Fury
},
})
|
-- LuaDist Package dependency solver
-- Part of the LuaDist project - http://luadist.org
-- Author: Martin Srank, hello@smasty.net
-- License: MIT
local const = require("rocksolver.constraints")
local utils = require("rocksolver.utils")
local Package = require("rocksolver.Package")
local DependencySolver = {}
DependencySolver.__index = DependencySolver
setmetatable(DependencySolver, {
__call = function(_, manifest, platform)
local self = setmetatable({}, DependencySolver)
self.manifest = manifest
self.platform = platform
return self
end
})
-- Check if a given package is in the provided list of installed packages.
-- Can also check for package version constraint.
function DependencySolver:is_installed(pkg_name, installed, pkg_constraint)
assert(type(pkg_name) == "string", "DependencySolver.is_installed: Argument 'pkg_name' is not a string.")
assert(type(installed) == "table", "DependencySolver.is_installed: Argument 'installed' is not a table.")
assert(not pkg_constraint or type(pkg_constraint) == "string", "DependencySolver.is_installed: Argument 'pkg_constraint' is not a string.")
local function selected(pkg)
return pkg.selected and "selected" or "installed"
end
local constraint_str = pkg_constraint and " " .. pkg_constraint or ""
local pkg_installed, err = false, nil
for _, installed_pkg in pairs(installed) do
assert(getmetatable(installed_pkg) == Package, "DependencySolver.is_installed: Argument 'installed' does not contain Package instances.")
if pkg_name == installed_pkg.name then
if not pkg_constraint or installed_pkg:matches(pkg_name .. " " .. pkg_constraint) then
pkg_installed = true
break
else
err = ("Package %s%s needed, but %s at version %s.")
:format(tostring(pkg_name), constraint_str, selected(installed_pkg), installed_pkg.version)
break
end
end
end
return pkg_installed, err
end
function DependencySolver:find_candidates(package)
assert(type(package) == "string", "DependencySolver.find_candidates: Argument 'package' is not a string.")
pkg_name, pkg_constraint = const.split(package)
pkg_constraint = pkg_constraint or ""
if not self.manifest.packages[pkg_name] then return {} end
local found = {}
for version, spec in utils.sort(self.manifest.packages[pkg_name], const.compareVersions) do
local pkg = Package(pkg_name, version, spec)
if pkg:matches(package) and pkg:supports_platform(self.platform) then
table.insert(found, pkg)
end
end
return found
end
-- Returns list of all needed packages to install the "package" using the manifest and a list of already installed packages.
function DependencySolver:resolve_dependencies(package, installed, dependency_parents, tmp_installed)
installed = installed or {}
dependency_parents = dependency_parents or {}
tmp_installed = tmp_installed or utils.deepcopy(installed)
if getmetatable(package) == Package then
package = tostring(package)
end
assert(type(package) == "string", "DependencySolver.resolve_dependencies: Argument 'package' is not a string.")
assert(type(installed) == "table", "DependencySolver.resolve_dependencies: Argument 'installed' is not a table.")
assert(type(dependency_parents) == "table", "DependencySolver.resolve_dependencies: Argument 'dependency_parents' is not a table.")
assert(type(tmp_installed) == "table", "DependencySolver.resolve_dependencies: Argument 'tmp_installed' is not a table.")
-- Sanitize and extract package name and constraint
package = package:gsub("%s+", " "):lower()
local pkg_name, pkg_const = const.split(package)
-- Check if the package is already installed
local pkg_installed, err = self:is_installed(pkg_name, tmp_installed, pkg_const)
if pkg_installed then return {} end
if err then return nil, err end
local to_install = {}
-- Get package candidates
local candidates = self:find_candidates(package)
if #candidates == 0 then
return nil, "No suitable candidate for package \"" .. package .. "\" found."
end
-- For each candidate (highest version first)
for _, pkg in ipairs(candidates) do
-- Clear state from previous iteration
pkg_installed, err = false, nil
-- Check if it was already added by previous candidate
pkg_installed, err = self:is_installed(pkg.name, tmp_installed, pkg_const)
if pkg_installed then
break
end
-- Maybe check for conflicting packages here if we will support that functionallity
-- Resolve dependencies of the package
local deps = pkg:dependencies(self.platform)
if deps then
-- For preventing circular dependencies
table.insert(dependency_parents, pkg.name)
-- For each dep of pkg
for _, dep in ipairs(deps) do
-- Detect circular dependencies
local has_circular_dependency = false
local dep_name = const.split(dep)
for _, parent in ipairs(dependency_parents) do
if dep_name == parent then
has_circular_dependency = true
break
end
end
-- If circular deps detected
if has_circular_dependency then
err = "Error getting dependency of \"" .. pkg .. "\": \"" .. dep .. "\" is a circular dependency."
break
end
-- No circular deps - recursively call on this dependency package.
local deps_to_install, deps_err = self:resolve_dependencies(dep, installed, dependency_parents, tmp_installed)
if deps_err then
err = "Error getting dependency of \"" .. pkg .. "\": " .. deps_err
break
end
-- If suitable deps found - add them to the to_install list.
if deps_to_install then
for _, dep_to_install in ipairs(deps_to_install) do
table.insert(to_install, dep_to_install)
table.insert(tmp_installed, dep_to_install)
table.insert(installed, dep_to_install)
end
end
end
-- Remove last pkg from the circular deps stack
table.remove(dependency_parents)
end
if not err then
-- Mark package as selected and add it to tmp_installed
pkg.selected = true
table.insert(tmp_installed, pkg)
table.insert(to_install, pkg)
--print("+ Installing package " .. pkg)
else
-- If some error occured, reset to original state
to_install = {}
tmp_installed = utils.deepcopy(installed)
end
end
-- If package is not installed and no candidates were suitable, return last error.
if #to_install == 0 and not pkg_installed then
return nil, err
end
return to_install, nil
end
return DependencySolver
|
response.status = "500 Internal Server Error"
if string.lower(response['content-type'] or "") == 'text/plain' then
print("An error occurred while processing this request")
print(request.params.error or "")
print(request.params.trace or "")
else
template:out("500", {error = webylene.config.show_errors and request.params.error, trace = webylene.config.show_backtrace and request.params.trace})
end
|
-- example of button click and hover events.
-- Should be in client context, as buttons would generally be per-player
local button = script.parent
function OnClicked(whichButton)
print("button clicked: " .. whichButton.name)
Events.Broadcast('AnswerChosen', whichButton.text)
end
button.clickedEvent:Connect(OnClicked)
|
local debuglinetrace = ImportPackage("debuglinetrace")
local function Check_aim_npc()
if IsPlayerAiming() then
local weap = GetPlayerWeapon(GetPlayerEquippedWeaponSlot())
if GetWeaponType(weap) ~= 0 then
local range = 2000
local camX, camY, camZ = GetCameraLocation()
local cfx, cfy, cfz = GetCameraForwardVector()
local muzzleX, muzzleY, muzzleZ = GetPlayerWeaponMuzzleLocation()
local hittype, hitid, impactX, impactY, impactZ
if debuglinetrace then
hittype, hitid, impactX, impactY, impactZ = debuglinetrace.Debug_LineTrace(muzzleX, muzzleY, muzzleZ, camX + cfx * range, camY + cfy * range, camZ + cfz * range)
else
hittype, hitid, impactX, impactY, impactZ = LineTrace(muzzleX, muzzleY, muzzleZ, camX + cfx * range, camY + cfy * range, camZ + cfz * range)
end
if hittype == 4 then
local nclothes = GetNPCPropertyValue(hitid, "NetworkedClothes")
if nclothes then
if nclothes.type == "preset" then
if (nclothes.clothes == 4 and not GetNPCPropertyValue(hitid, "InHeist")) then
CallRemoteEvent("StartSmallHeist", hitid)
end
end
end
end
end
end
end
AddEvent("OnPackageStart", function()
CreateTimer(Check_aim_npc, 1000)
end) |
--[[
© CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
include("shared.lua")
-- Called when the target ID HUD should be painted.
function ENT:HUDPaintTargetID(x, y, alpha)
local colorTargetID = Clockwork.option:GetColor("target_id");
local colorWhite = Clockwork.option:GetColor("white");
local amount = self:GetDTInt(0);
y = Clockwork.kernel:DrawInfo(L("Cash"), x, y, colorTargetID, alpha);
y = Clockwork.kernel:DrawInfo(Clockwork.kernel:FormatCash(amount), x, y, colorWhite, alpha);
end;
-- Called when the entity should draw.
function ENT:Draw()
if (Clockwork.plugin:Call("CashEntityDraw", self) != false) then
self:DrawModel();
end;
end; |
local filter = EasyDestroyFilterCriteria:New("Item Name", "name", 20)
-- There's no reason a filter should show up more than once
-- So we can treat it as a singleton and just use this to
-- get any previous creations of the filter frame, or
-- create it if it's not yet been made
function filter:Initialize()
-- We create the frame here, we'll leave the details on size/anchors to the Filters window.
self.frame = self.frame or CreateFrame("Frame", "EDFilterItemName", self.parent, "EasyDestroyEditBoxTemplate")
self.frame:SetLabel( filter.name .. ":")
self.frame:Hide()
self.scripts.OnEditFocusLost = { self.frame.input, }
end
-- check input vs item values
function filter:Check(inputname, item)
local itemname = item.name
if string.find(string.lower(itemname or ""), string.lower(inputname or "")) then
return true
end
return false
end
function filter:GetValues()
if self.frame then
if self.frame.input:GetText() ~= "" then
return self.frame.input:GetText()
end
else
return nil
end
end
function filter:SetValues(setvalueinput)
if self.frame then
self.frame.input:SetText(setvalueinput or "")
end
end
function filter:Clear()
if self.frame then
self.frame.input:SetText("")
end
end
EasyDestroy.Filters.RegisterCriteria(filter) |
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
local vicious = require("vicious")
local naughty = require("naughty")
-- Spacers
volspace = wibox.widget.textbox()
volspace:set_text(" ")
-- {{{ BATTERY
-- Battery attributes
local bat_state = ""
local bat_charge = 0
local bat_time = 0
local blink = true
-- Icon
baticon = wibox.widget.imagebox()
baticon:set_image(beautiful.widget_batfull)
-- Charge %
batpct = wibox.widget.textbox()
vicious.register(batpct, vicious.widgets.bat, function(widget, args)
bat_state = args[1]
bat_charge = args[2]
bat_time = args[3]
if args[1] == "-" then
if bat_charge > 70 then
baticon:set_image(beautiful.widget_batfull)
elseif bat_charge > 30 then
baticon:set_image(beautiful.widget_batmed)
elseif bat_charge > 10 then
baticon:set_image(beautiful.widget_batlow)
else
baticon:set_image(beautiful.widget_batempty)
end
else
baticon:set_image(beautiful.widget_ac)
if args[1] == "+" then
blink = not blink
if blink then
baticon:set_image(beautiful.widget_acblink)
end
end
end
return args[2] .. "%"
end, nil, "BAT0")
-- Buttons
function popup_bat()
local state = ""
if bat_state == "↯" then
state = "Full"
elseif bat_state == "↯" then
state = "Charged"
elseif bat_state == "+" then
state = "Charging"
elseif bat_state == "-" then
state = "Discharging"
elseif bat_state == "⌁" then
state = "Not charging"
else
state = "Unknown"
end
naughty.notify { text = "Charge : " .. bat_charge .. "%\nState : " .. state ..
" (" .. bat_time .. ")", timeout = 5, hover_timeout = 0.5 }
end
batpct:buttons(awful.util.table.join(awful.button({ }, 1, popup_bat)))
baticon:buttons(batpct:buttons())
-- End Battery}}}
--
-- {{{ PACMAN
-- Icon
pacicon = wibox.widget.imagebox()
pacicon:set_image(beautiful.widget_pac)
--
-- Upgrades
pacwidget = wibox.widget.textbox()
vicious.register(pacwidget, vicious.widgets.pkg, function(widget, args)
if args[1] > 0 then
pacicon:set_image(beautiful.widget_pacnew)
else
pacicon:set_image(beautiful.widget_pac)
end
return args[1]
end, 1801, "Arch S") -- Arch S for ignorepkg
--
-- Buttons
function popup_pac()
local pac_updates = ""
-- Try yaourt -Qua??
os.execute("/usr/bin/bash '/usr/bin/yaourt -Sya &> /dev/null'")
local f = io.popen("yaourt -Qua")
if f then
pac_updates = f:read("*a")
end
f:close()
if pac_updates == "" then
pac_updates = "System is up to date"
end
naughty.notify { text = pac_updates }
end
pacwidget:buttons(awful.util.table.join(awful.button({ }, 1, popup_pac)))
pacicon:buttons(pacwidget:buttons())
-- End Pacman }}}
--
-- {{{ VOLUME
-- Cache
vicious.cache(vicious.widgets.volume)
--
-- Icon
volicon = wibox.widget.imagebox()
volicon:set_image(beautiful.widget_vol)
--
-- Volume %
volpct = wibox.widget.textbox()
vicious.register(volpct, vicious.widgets.volume, "$1%", nil, "Master")
--
-- Buttons
volicon:buttons(awful.util.table.join(
awful.button({ }, 1,
function() awful.util.spawn_with_shell("amixer -q set Master toggle") end),
awful.button({ }, 4,
function() awful.util.spawn_with_shell("amixer -q set Master 3+% unmute") end),
awful.button({ }, 5,
function() awful.util.spawn_with_shell("amixer -q set Master 3-% unmute") end)
))
volpct:buttons(volicon:buttons())
volspace:buttons(volicon:buttons())
-- End Volume }}}
--
-- {{{ Start CPU
cpuicon = wibox.widget.imagebox()
cpuicon:set_image(beautiful.widget_cpu)
--
cpu = wibox.widget.textbox()
vicious.register(cpu, vicious.widgets.cpu, "All: $1% 1: $2% 2: $3%", 2)
-- End CPU }}}
--
-- {{{ Start Mem
memicon = wibox.widget.imagebox()
memicon:set_image(beautiful.widget_ram)
--
mem = wibox.widget.textbox()
vicious.register(mem, vicious.widgets.mem, "Mem: $1% Use: $2MB Total: $3MB Free: $4MB", 2)
-- End Mem }}}
--
-- {{{ Start Gmail
mailicon = wibox.widget.imagebox(beautiful.widget_mail)
mailwidget = wibox.widget.textbox()
gmail_t = awful.tooltip({ objects = { mailwidget },})
vicious.register(mailwidget, vicious.widgets.gmail,
function (widget, args)
gmail_t:set_text(args["{subject}"])
gmail_t:add_to_object(mailicon)
return args["{count}"]
end, 120)
mailicon:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.util.spawn("urxvt -e mutt", false) end)
))
-- End Gmail }}}
--
-- {{{ Start Wifi
wifiicon = wibox.widget.imagebox()
wifiicon:set_image(beautiful.widget_wifi)
--
-- Need wireless_tools (iwconfig) for this to work
wifi = wibox.widget.textbox()
vicious.register(wifi, vicious.widgets.wifi, "${ssid} Rate: ${rate}MB/s Link: ${link}%", 3, "wlp2s0")
-- End Wifi }}}
|
require('harpoon').setup({
nav_first_in_list = true,
})
vim.keymap.set('n', '<leader>hm', ':lua require("harpoon.mark").add_file()<CR>')
vim.keymap.set('n', '<leader>hum', ':lua require("harpoon.ui").toggle_quick_menu()<CR>')
vim.keymap.set('n', '<leader>hcm', ':lua require("harpoon.cmd-ui").toggle_quick_menu()<CR>')
vim.keymap.set('n', '<leader>j', ':lua require("harpoon.ui").nav_file(1)<CR>')
vim.keymap.set('n', '<leader>k', ':lua require("harpoon.ui").nav_file(2)<CR>')
vim.keymap.set('n', '<leader>l', ':lua require("harpoon.ui").nav_file(3)<CR>')
vim.keymap.set('n', '<leader>;', ':lua require("harpoon.ui").nav_file(4)<CR>')
|
local skynet = require "skynet"
local protobuf = require "protobuf" --引入文件protobuf.lua
skynet.start(function()
protobuf.register_file("./protos/test.pb")
protobuf.register_file("./protos/person.pb")
skynet.error("protobuf register:test.pb person.pb")
stringbuffer = protobuf.encode("cs.test", --对应person.proto协议的包名与类名
{
name = "xiaoming",
age = 1,
--email = "xiaoming@163.com",
online = true,
account = 888.88,
})
local data = protobuf.decode("cs.test",stringbuffer)
skynet.error("------decode------ \nname=",data.name
, ",\nage=", data.age
, ",\nemail=", data.email
, ",\nonline=", data.online
, ",\naccount=", data.account)
stringbuffer = protobuf.encode("cs.Person", --对应person.proto协议的包名与类名
{
name = "xiaoming",
id = 1,
email = "xiaoming@163.com",
phone = {
{
number = "1388888888",
type = "MOBILE",
},
{
number = "8888888",
},
{
number = "87878787",
type = "WORK",
},
}
})
local data = protobuf.decode("cs.Person",stringbuffer)
skynet.error("decode name="..data.name..",id="..data.id..",email="..data.email)
skynet.error("decode phone.type="..data.phone[1].type..",phone.number="..data.phone[1].number)
skynet.error("decode phone.type="..data.phone[2].type..",phone.number="..data.phone[2].number)
skynet.error("decode phone.type="..data.phone[3].type..",phone.number="..data.phone[3].number)
end)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.