content stringlengths 5 1.05M |
|---|
#!/usr/bin/env th
require 'hdf5'
require 'postprocess'
----------------------------------------------------------------
-- parse arguments
----------------------------------------------------------------
cmd = torch.CmdLine()
cmd:text()
cmd:text('DNA ConvNet testing')
cmd:text()
cmd:text('Arguments')
cmd:argument('model_file')
cmd:argument('data_file')
cmd:argument('out_file')
cmd:text()
cmd:text('Options:')
cmd:option('-batch_size', 128, 'Batch size')
cmd:option('-cuda', false, 'Run on GPGPU')
cmd:option('-norm', false, 'Normalize all targets to a level plane')
cmd:option('-pool', 10, 'Pool adjacent positions for filter outputs')
cmd:text()
opt = cmd:parse(arg)
-- set cpu/gpu
cuda = opt.cuda
require 'convnet'
----------------------------------------------------------------
-- load data
----------------------------------------------------------------
local data_open = hdf5.open(opt.data_file, 'r')
local test_seqs = data_open:read('test_in')
local test_targets = data_open:read('test_out')
local num_seqs = test_seqs:dataspaceSize()[1]
local seq_len = test_seqs:dataspaceSize()[4]
local num_targets = test_targets:dataspaceSize()[2]
----------------------------------------------------------------
-- construct model
----------------------------------------------------------------
-- initialize
local convnet = ConvNet:__init()
-- load from saved parameters
local convnet_params = torch.load(opt.model_file)
convnet:load(convnet_params)
-- pooling
local nn_pool = nn.SpatialMaxPooling(opt.pool, 1)
local pseq_len = math.floor((seq_len-convnet.conv_filter_sizes[1]+1) / opt.pool)
----------------------------------------------------------------
-- predict and test
----------------------------------------------------------------
-- guarantee evaluate mode
convnet.model:evaluate()
-- track statistics across batches
local preds = torch.Tensor(num_seqs, num_targets)
local filter_outs = torch.Tensor(num_seqs, convnet.conv_filters[1], pseq_len)
local si = 1
-- maintain variables
local preds_batch
local filter_outs_batch
local filter_outs_pool
-- initialize batcher
local batcher = Batcher:__init(test_seqs, nil, opt.batch_size)
-- next batch
local Xb = batcher:next()
-- while batches remain
while Xb ~= nil do
-- cuda
if cuda then
Xb = Xb:cuda()
end
-- predict
preds_batch = convnet.model:forward(Xb)
-- get filter outputs
filter_outs_batch = convnet:get_nonlinearity(1).output:squeeze()
filter_outs_pool = nn_pool:updateOutput(filter_outs_batch)
-- copy into full Tensors
for i = 1,(#preds_batch)[1] do
preds[{si,{}}] = preds_batch[{i,{}}]:float()
filter_outs[{si,{}}] = filter_outs_pool[{i,{}}]:float()
si = si + 1
end
-- next batch
Xb = batcher:next()
collectgarbage()
end
-- normalize
if opt.norm then
preds = troy_norm(preds, convnet.pred_means)
end
-- close HDF5
data_open:close()
----------------------------------------------------------------
-- dump to file
----------------------------------------------------------------
local hdf_out = hdf5.open(opt.out_file, 'w')
hdf_out:write("preds", preds)
hdf_out:write("filter_outs", filter_outs)
hdf_out:close()
|
-- Nnw.lua
-- common functions for the Nearest Neighbor package
require 'affirm'
require 'makeVerbose'
require 'verify'
-- API overview
if false then
-- simple average
ok, estimate = Nnw.estimateAvg(xs, ys, nearestIndices, visible, weights, k)
-- kernel-weighted average
ok, estimate = Nnw.estimateKwavg(xs, ys, nearestIndices, visible, weights, k)
-- local linear regression
ok,estimate = Nnw.estimateLlr(xs, ys, nearestIndices, visible, weights, k)
-- euclidean distance
distances = Nnw.euclideanDistances(xs, query)
-- nearest neighbor distances and indices
sortedDistances, sortedIndices = Nnw.nearest(xs, query)
-- weights from the Epanenchnikov kernel
-- where lambda is the distance to the k-th nearest neighbor
weights = Nnw.weights(sortedDistances, lambda)
end
Nnw = {}
function Nnw.estimateAvg(xs, ys, nearestIndices, visible, k)
-- return true, average of k nearest visible neighbors
-- ignore the weights
local v, isVerbose = makeVerbose(false, 'Nnw.estimateAvg')
verify(v, isVerbose,
{{xs, 'xs', 'isAny'},
{ys, 'ys', 'isTensor1D'},
{nearestIndices, 'nearestIndices', 'isTensor1D'},
{visible, 'visible', 'isTensor1D'},
{k, 'k', 'isIntegerPositive'}})
local sum = 0
local found = 0
for nearestIndex = 1, nearestIndices:size(1) do
local obsIndex = nearestIndices[nearestIndex]
if visible[obsIndex] == 1 then
found = found + 1
sum = sum + ys[obsIndex]
v('obsIndex, y', obsIndex, ys[obsIndex])
if found == k then
break
end
end
end
if found < k then
return false, 'not able to find k neighbors'
else
local result = sum / k
v('result', result)
return true, result
end
end -- Nnw.estimateAvg
function Nnw.estimateKwavg(k, sortedNeighborIndices, visible, weights, allYs)
-- ARGS
-- k : integer > 0, number of neighbors to use
-- sortedNeighborIndices : 1D Tensor
-- use first k neighbors that are also visible
-- visible : 1D Tensor
-- visible[obsIndex] == 1 ==> use this observation
-- as a neighbor
-- weights : 1D Tensor
-- allYs : 1D Tensor
-- RETURNS
-- ok : true or false
-- estimate : number or string
local v, isVerbose = makeVerbose(false, 'Nnw.estimateKwavg')
verify(v, isVerbose,
{{k, 'k', 'isIntegerPositive'},
{sortedNeighborIndices, 'sortedNeighborIndices', 'isTensor1D'},
{visible, 'visible', 'isTensor1D'},
{weights, 'weights', 'isTensor1D'},
{allYs, 'allYs', 'isTensor1D'}})
local sumWeightedYs = 0
local sumWeights = 0
local found = 0
for i = 1, visible:size(1) do
local obsIndex = sortedNeighborIndices[i]
if visible[obsIndex] == 1 then
local weight = weights[i]
local y = allYs[obsIndex]
v('i,obsIndex,weight,y', i, obsIndex, weight, y)
sumWeights = sumWeights + weight
sumWeightedYs = sumWeightedYs + weight * y
found = found + 1
if found == k then
break
end
end
end
v('sumWeights', sumWeights)
v('sumWeightedYs', sumWeightedYs)
if sumWeights == 0 then
return false, 'all weights were zero'
elseif found < k then
return false, string.format('only %d obs in neighborhood; k = %d',
found, k)
else
local estimate = sumWeightedYs / sumWeights
v('estimate', estimate)
return true, estimate
end
end -- Nnw.estimateKwavg
function Nnw.estimateLlr(k, regularizer,
sortedNeighborIndices, visible, weights,
query, allXs, allYs)
-- ARGS
-- k : integer > 0, number of neighbors to use
-- regularizer : number >= 0, added to each weight
-- sortedNeighborIndices : 1D Tensor
-- use first k neighbors that are also visible
-- visible : 1D Tensor
-- visible[obsIndex] == 1 ==> use this observation
-- as a neighbor
-- weights : 1D Tensor
-- allXs : 2D Tensor
-- allYs : 1D Tensor
-- RETURNS
-- ok : true or false
-- estimate : number or string
local debug = 0
--local debug = 1 -- determine why inverse fails
local v, isVerbose = makeVerbose(false, 'Nnw.estimateLlr')
verify(v, isVerbose,
{{k, 'k', 'isIntegerPositive'},
{regularizer, 'regularizer', 'isNumberNonNegative'},
{sortedNeighborIndices, 'sortedNeighborIndices', 'isTensor1D'},
{visible, 'visible', 'isTensor1D'},
{weights, 'weights', 'isTensor1D'},
{query, 'query', 'isTensor1D'},
{allXs, 'allXs', 'isTensor2D'},
{allYs, 'allYs', 'isTensor1D'}})
assert(allYs:size(1) == allXs:size(1),
'allXs and allYs must have same number of observations')
local nDims = allXs:size(2)
assert(k > nDims,
string.format('undetermined since k(=%d) <= nDims (=%d)',
k, nDims))
-- FIX ME: create using k nearest visible neighbors
-- create regression matrix B
-- by prepending a 1 in the first position
local B = torch.Tensor(k, nDims + 1)
local selectedYs = torch.Tensor(k)
local wVector = torch.Tensor(k)
local found = 0
for i = 1, allXs:size(1) do
local obsIndex = sortedNeighborIndices[i]
if visible[obsIndex] == 1 then
found = found + 1
v('i,obsIndex,found', i, obsIndex, found)
B[found][1] = 1
for d = 1, nDims do
B[found][d+1] = allXs[obsIndex][d]
end
selectedYs[found] = allYs[obsIndex]
wVector[found] = weights[i] + regularizer
if found == k then
break
end
end
end
v('nObs, nDims', nObs, nDims)
v('B (regression matrix)', B)
v('selectedYs', selectedYs)
v('wVector', wVector)
-- also prepend a 1 in the first position of the query
-- to make the final multiplication work, the prepended query needs to be 2D
local extendedQuery = torch.Tensor(1, nDims + 1)
extendedQuery[1][1] = 1
for d = 1, nDims do
extendedQuery[1][d + 1] = query[d]
end
v('extendedQuery', extendedQuery)
local BT = B:t() -- transpose B
local W = DiagonalMatrix(wVector)
v('BT', BT)
v('W', W)
-- BTWB = B^T W B
local BTWB = BT * (W:mul(B))
v('BTWB', BTWB)
-- invert BTWB, catching error
local ok, BTWBInv = pcall(torch.inverse, BTWB)
if not ok then
-- if the error message is "getrf: U(i,i) is 0, U is singular"
-- then LU factorization succeeded but U is exactly 0, so that
-- division by zero will occur if U is used to solve a
-- system of equations
-- ref: http://dlib.net/dlib/matrix/lapack/getrf.h.html
if debug == 1 then
print('Llr:estimate: error in call to torch.inverse')
print('error message = ' .. BTWBInv)
error(BTWBInv)
end
return false, BTWBInv -- return the error message
end
local betas = BTWBInv * BT * W:mul(selectedYs)
local estimate1 = extendedQuery * BTWBInv * BT * W:mul(selectedYs)
v('estimate1', estimate1)
local estimate = extendedQuery * betas
v('extendedQuery', extendedQuery)
v('beta', BTWBInv * BT * W:mul(selectedYs))
v('estimate', estimate[1])
affirm.isTensor1D(estimate, 'estimate')
assert(1 == estimate:size(1))
return true, estimate[1]
end -- Nnw.estimateLlr
function Nnw.euclideanDistance(x, query)
-- return scalar Euclidean distance
local debug = 0
--debug = 1 -- zero value for lambda
local v, isVerbose = makeVerbose(false, 'Nnw:euclideanDistance')
verify(v, isVerbose,
{{x, 'x', 'isTensor1D'},
{query, 'query', 'isTensor1D'}})
assert(x:size(1) == query:size(1))
local ds = x - query
if debug == 1 then
for i = 1, x:size(1) do
print(string.format('x[%d] %f query[%d] %f ds[%d] %f',
i, x[i], i, query[i], i, ds[i]))
end
end
v('ds', ds)
local distance = math.sqrt(torch.sum(torch.cmul(ds, ds)))
v('distance', distance)
return distance
end -- euclideanDistance
function Nnw.euclideanDistances(xs, query)
-- return 1D tensor such that result[i] = EuclideanDistance(xs[i], query)
-- We require use of Euclidean distance so that this code will work.
-- It computes all the distances from the query point at once
-- using Clement Farabet's idea to speed up the computation.
local v, isVerbose = makeVerbose(false, 'Nnw:euclideanDistances')
verify(v,
isVerbose,
{{xs, 'xs', 'isTensor2D'},
{query, 'query', 'isTensor1D'}})
assert(xs:size(2) == query:size(1),
'number of columns in xs must equal size of query')
-- create a 2D Tensor where each row is the query
-- This construction is space efficient relative to replicating query
-- queries[i] == query for all i in range
-- Thanks Clement Farabet!
local queries =
torch.Tensor(query:clone():storage(),-- clone in case query is a row of xs
1, -- offset
xs:size(1), 0, -- row index offset and stride
xs:size(2), 1) -- col index offset and stride
local distances = torch.add(queries, -1 , xs) -- queries - xs
distances:cmul(distances) -- (queries - xs)^2
distances = torch.sum(distances, 2):squeeze() -- \sum (queries - xs)^2
distances = distances:sqrt() -- Euclidean distances
v('distances', distances)
return distances
end -- Nnw.euclideanDistances
function Nnw.nearest(xs, query)
-- find nearest observations to a query
-- RETURN
-- sortedDistances : 1D Tensor
-- distances of each xs from query
-- sortedIndices : 1D Tensor
-- indices that sort the distances
local v, isVerbose = makeVerbose(false, 'Nnw.nearest')
verify(v, isVerbose,
{{xs, 'xs', 'isTensor2D'},
{query, 'query', 'isTensor1D'}})
local distances = Nnw.euclideanDistances(xs, query)
v('distances', distances)
local sortedDistances, sortedIndices = torch.sort(distances)
v('sortedDistances', sortedDistances)
v('sortedIndices', sortedIndices)
return sortedDistances, sortedIndices
end -- Nnw.nearest
function Nnw.weights(sortedDistances, lambda)
-- return values of Epanenchnov kernel using euclidean distance
local v, isVerbose = makeVerbose(false, 'KernelSmoother.weights')
verify(v, isVerbose,
{{sortedDistances, 'sortedDistances', 'isTensor1D'},
{lambda, 'lambda', 'isNumberPositive'}})
local nObs = sortedDistances:size(1)
local t = sortedDistances / lambda
v('t', t)
local one = torch.Tensor(nObs):fill(1)
local indicator = torch.le(torch.abs(t), one):type('torch.DoubleTensor')
v('indicator', indicator)
local dt = torch.mul(one - torch.cmul(t, t), 0.75)
v('dt', dt)
-- in torch, inf * 0 --> nan (not zero)
local weights = torch.cmul(dt, indicator)
v('weights', weights)
return weights
end -- Nnw.weights
|
object_building_mustafar_structures_must_bandit_generator = object_building_mustafar_structures_shared_must_bandit_generator:new {
}
ObjectTemplates:addTemplate(object_building_mustafar_structures_must_bandit_generator, "object/building/mustafar/structures/must_bandit_generator.iff")
|
---
-- Unit testing support for NSE libraries.
--
-- This library will import all NSE libraries looking for a global variable
-- <code>test_suite</code>. This must be a callable that returns true or false
-- and the number of tests that failed. For convenience, the
-- <code>unittest.TestSuite</code> class has this property, and tests can be
-- added with <code>add_test</code>. Example:
--
-- <code>
-- local data = {"foo", "bar", "baz"}
-- test_suite = unittest.TestSuite:new()
-- test_suite:add_test(equal(data[2], "bar"), "data[2] should equal 'bar'")
-- </code>
--
-- The library is driven by the unittest NSE script.
--
-- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html
local stdnse = require "stdnse"
local string = require "string"
local table = require "table"
local nmap = require "nmap"
local nsedebug = require "nsedebug"
local listop = require "listop"
_ENV = stdnse.module("unittest", stdnse.seeall)
local libs = {
"afp",
"ajp",
"amqp",
"asn1",
"base32",
"base64",
"bin",
"bitcoin",
"bit",
"bittorrent",
"bjnp",
"brute",
"cassandra",
"citrixxml",
"comm",
"creds",
"cvs",
"datafiles",
"dhcp6",
"dhcp",
"dnsbl",
"dns",
"dnssd",
"drda",
"eap",
"eigrp",
"formulas",
"ftp",
"giop",
"gps",
"http",
"httpspider",
"iax2",
"ike",
"imap",
"informix",
"ipOps",
"ipp",
"iscsi",
"isns",
"jdwp",
"json",
"ldap",
"lfs",
"listop",
"match",
"membase",
"mobileme",
"mongodb",
"msrpc",
"msrpcperformance",
"msrpctypes",
"mssql",
"mysql",
"natpmp",
"ncp",
"ndmp",
"netbios",
"nmap",
"nrpc",
"nsedebug",
"omp2",
"openssl",
"ospf",
"packet",
"pcre",
"pgsql",
"pop3",
"pppoe",
"proxy",
"rdp",
"redis",
"rmi",
"rpcap",
"rpc",
"rsync",
"rtsp",
"sasl",
"shortport",
"sip",
"smbauth",
"smb",
"smtp",
"snmp",
"socks",
"srvloc",
"ssh1",
"ssh2",
"sslcert",
"stdnse",
"strbuf",
"stun",
"tab",
"target",
"tftp",
"tns",
"unicode",
"unittest",
"unpwdb",
"upnp",
"url",
"versant",
"vnc",
"vulns",
"vuzedht",
"wsdd",
"xdmcp",
"xmpp",
}
local am_testing = stdnse.get_script_args('unittest.run')
---Check whether tests are being run
--
-- Libraries can use this function to avoid the overhead of creating tests if
-- the user hasn't chosen to run them. Unittesting is turned on with the
-- <code>unittest.run</code> script-arg.
-- @return true if unittests are being run, false otherwise.
function testing()
return am_testing
end
---
-- Run tests provided by NSE libraries
-- @param to_test A list (table) of libraries to test. If none is provided, all
-- libraries are tested.
run_tests = function(to_test)
am_testing = true
if to_test == nil then
to_test = libs
end
local fails = stdnse.output_table()
for _,lib in ipairs(to_test) do
stdnse.debug1("Testing %s", lib)
local status, thelib = pcall(require, lib)
if not status then
stdnse.debug1("Failed to load %s", lib)
else
local failed = 0
if rawget(thelib,"test_suite") ~= nil then
failed = thelib.test_suite()
end
if failed ~= 0 then
fails[lib] = failed
end
end
end
return fails
end
--- The TestSuite class
--
-- Holds and runs tests.
TestSuite = {
--- Creates a new TestSuite object
--
-- @name TestSuite.new
-- @return TestSuite object
new = function(self)
local o = {}
setmetatable(o, self)
self.__index = self
o.tests = {}
return o
end,
--- Set up test environment. Override this.
-- @name TestSuite.setup
setup = function(self)
return true
end,
--- Tear down test environment. Override this.
-- @name TestSuite.teardown
teardown = function(self)
return true
end,
--- Add a test.
-- @name TestSuite.add_test
-- @param test Function that will be called with the TestSuite object as its only parameter.
-- @param description A description of the test being run
add_test = function(self, test, description)
self.tests[#self.tests+1] = {test, description}
end,
--- Run tests.
-- Runs all tests in the TestSuite, and returns the number of failures.
-- @name TestSuite.__call
-- @return failures The number of tests that failed
-- @return tests The number of tests run
__call = function(self)
local failures = 0
local passes = 0
self:setup()
for _,test in ipairs(self.tests) do
stdnse.debug2("| Test: %s...", test[2])
local status, note = test[1](self)
local result
local lvl = 2
if status then
result = "Pass"
passes = passes + 1
else
result = "Fail"
lvl = 1
if nmap.debugging() < 2 then
stdnse.debug1("| Test: %s...", test[2])
end
failures = failures + 1
end
if note then
stdnse.debug(lvl, "| \\_result: %s (%s)", result, note)
else
stdnse.debug(lvl, "| \\_result: %s", result)
end
end
stdnse.debug1("|_%d of %d tests passed", passes, #self.tests)
self:teardown()
return failures, #self.tests
end,
}
--- Test creation helper function.
-- Turns a simple function into a test factory.
-- @param test A function that returns true or false depending on test
-- @param fmt A format string describing the failure condition using the
-- arguments to the test function
-- @return function that generates tests suitable for use in add_test
make_test = function(test, fmt)
return function(...)
local args={...}
local nargs = select("#", ...)
return function(suite)
if not test(table.unpack(args,1,nargs)) then
return false, string.format(fmt, table.unpack(listop.map(nsedebug.tostr, args),1,nargs))
end
return true
end
end
end
--- Test for nil
-- @param value The value to test
-- @return bool True if the value is nil, false otherwise.
is_nil = function(value)
return value == nil
end
is_nil = make_test(is_nil, "Expected not nil, got %s")
--- Test for not nil
-- @param value The value to test
-- @return bool True if the value is not nil, false otherwise.
not_nil = function(value)
return value ~= nil
end
not_nil = make_test(not_nil, "Expected not nil, got %s")
--- Test tables for equality, 1 level deep
-- @param a The first table to test
-- @param b The second table to test
-- @return bool True if #a == #b and a[i] == b[i] for every i<#a, false otherwise.
table_equal = function(a, b)
return function (suite)
if #a ~= #b then
return false, "Length not equal"
end
for i, v in ipairs(a) do
if b[i] ~= v then
return false, string.format("%s ~= %s at position %d", v, b[i], i)
end
end
return true
end
end
--- Test for equality
-- @param a The first value to test
-- @param b The second value to test
-- @return bool True if a == b, false otherwise.
equal = function(a, b)
return a == b
end
equal = make_test(equal, "%s not equal to %s")
--- Test for inequality
-- @param a The first value to test
-- @param b The second value to test
-- @return bool True if a != b, false otherwise.
not_equal = function(a, b)
return a ~= b
end
not_equal = make_test(not_equal, "%s unexpectedly equal to %s")
--- Test for truth
-- @param value The value to test
-- @return bool True if value is a boolean and true
is_true = function(value)
return value == true
end
is_true = make_test(is_true, "Expected true, got %s")
--- Test for falsehood
-- @param value The value to test
-- @return bool True if value is a boolean and false
is_false = function(value)
return value == false
end
is_false = make_test(is_false, "Expected false, got %s")
--- Test less than
-- @param a The first value to test
-- @param b The second value to test
-- @return bool True if a < b, false otherwise.
lt = function(a, b)
return a < b
end
lt = make_test(lt, "%s not less than %s")
--- Test less than or equal to
-- @param a The first value to test
-- @param b The second value to test
-- @return bool True if a <= b, false otherwise.
lte = function(a, b)
return a <= b
end
lte = make_test(lte, "%s not less than %s")
--- Test length
-- @param t The table to test
-- @param l The length to test
-- @return bool True if the length of t is l
length_is = function(t, l)
return #t == l
end
length_is = make_test(length_is, "Length of %s is not %s")
--- Expected failure test
-- @param test The test to run
-- @return function A test for expected failure of the test
expected_failure = function(test)
return function(suite)
if test(suite) then
return true, "Test unexpectedly passed"
else
return true, "Test failed as expected"
end
return true
end
end
if not testing() then
return _ENV
end
-- Self test
test_suite = TestSuite:new()
test_suite:add_test(is_nil(test_suite["asdfdoesnotexist"]), "Nonexistent key does not exist")
test_suite:add_test(equal(1+1336, 7 * 191), "Arithmetically equal expressions are equal")
test_suite:add_test(not_equal( true, "true" ), "Boolean true not equal to string \"true\"")
test_suite:add_test(is_true("test" == "test"), "Boolean expression evaluates to true")
test_suite:add_test(is_false(1.9999 == 2.0), "Boolean expression evaluates to false")
test_suite:add_test(lt(1, 999), "1 < 999")
test_suite:add_test(lte(8, 8), "8 <= 8")
test_suite:add_test(expected_failure(not_nil(nil)), "Test expected to fail fails")
test_suite:add_test(expected_failure(is_nil(nil)), "Test expected to fail succeeds")
test_suite:add_test(length_is(test_suite.tests, 10), "Number of tests is 10")
return _ENV;
|
x = esp.random(1, led.width(0) - 2)
y = esp.random(1, led.height(0) - 2)
xdir = esp.random(5,30) / 100
ydir = esp.random(5,30) / 100
rgb = color.palette(2)
fade = 0
function frame()
x = x + xdir
y = y + ydir
if x >= led.width(0) then
x = led.width(0) - 1
xdir = esp.random(-30,-5) / 100
rgb = color.palette(esp.random(0, 0x0f))
elseif x < 0 then
x = 0
xdir = esp.random(5, 30) / 100
rgb = color.palette(esp.random(0, 0x0f))
end
if y >= led.height(0) then
y = led.height(0) - 1
ydir = esp.random(-30,-5) / 100
rgb = color.palette(esp.random(0, 0x0f))
elseif y < 0 then
y = 0
ydir = esp.random(5, 30) / 100
rgb = color.palette(esp.random(0, 0x0f))
end
fade = fade + 1
if fade >= 5 then
led.fade(0)
fade = 0
end
led.draw(0, x, y, rgb)
end
|
function model.getPartToDrop(distributionExtent,partDistribution,shiftDistribution,rotationDistribution,massDistribution,scalingDistribution,partsData)
local errString=nil
local dropName=model.getDistributionValue(partDistribution)
local thePartD=partsData[dropName]
local partToDrop=nil
if thePartD then
-- local destinationName=model.getDistributionValue(destinationDistribution)
local dropShift=model.getDistributionValue(shiftDistribution)
if not dropShift then dropShift={0,0,0} end
dropShift[1]=dropShift[1]*distributionExtent[1]
dropShift[2]=dropShift[2]*distributionExtent[2]
dropShift[3]=dropShift[3]*distributionExtent[3]
local dropRotation=model.getDistributionValue(rotationDistribution)
local dropMass=model.getDistributionValue(massDistribution)
local dropScaling=nil
if scalingDistribution then
dropScaling=model.getDistributionValue(scalingDistribution)
end
partToDrop={name=dropName,position=dropShift,rotation=dropRotation,mass=dropMass,scaling=dropScaling}
else
local nm=' ['..simBWF.getObjectAltName(model.handle)..']'
local msg="WARNING (run-time): Part '"..dropName.."' was not found in the part repository"..nm
simBWF.outputMessage(msg,simBWF.MSG_WARN)
end
return partToDrop,errString
end
function model.getDistributionValue(distribution)
-- Distribution string could be:
-- {} --> returns nil
-- {{}} --> returns nil
-- a,a,b,c --> returns a,b, or c
-- {{2,a},{1,b},{1,c}} --> returns a,b, or c
if #distribution>0 then
if (type(distribution[1])~='table') or (#distribution[1]>0) then
if (type(distribution[1])=='table') and (#distribution[1]==2) then
local cnt=0
for i=1,#distribution,1 do
cnt=cnt+distribution[i][1]
end
local p=sim.getFloatParameter(sim.floatparam_rand)*cnt
cnt=0
for i=1,#distribution,1 do
if cnt+distribution[i][1]>=p then
return distribution[i][2]
end
cnt=cnt+distribution[i][1]
end
else
local cnt=#distribution
local p=1+math.floor(sim.getFloatParameter(sim.floatparam_rand)*cnt-0.0001)
return distribution[p]
end
end
end
end
function model.getSensorState()
if model.sensorHandle>=0 then
local data=sim.readCustomDataBlock(model.sensorHandle,simBWF.modelTags.BINARYSENSOR)
if data then
data=sim.unpackTable(data)
return data['detectionState']
end
local data=sim.readCustomDataBlock(model.sensorHandle,simBWF.modelTags.OLDSTATICPICKWINDOW)
if data then
data=sim.unpackTable(data)
return data['triggerState']
end
end
return 0
end
function model.getConveyorDistanceTrigger()
if model.conveyorHandle>=0 then
local data=sim.readCustomDataBlock(model.conveyorHandle,simBWF.modelTags.CONVEYOR)
if data then
data=sim.unpackTable(data)
local d=data['encoderDistance']
if d then
if not lastConveyorDistance then
lastConveyorDistance=d
end
if math.abs(lastConveyorDistance-d)>model.conveyorTriggerDist then
lastConveyorDistance=d
return true,d
end
end
end
end
return false,d
end
function model.prepareStatisticsDialog(enabled)
if enabled then
local xml =[[
<label id="1" text="Part production count: 0" style="* {font-size: 20px; font-weight: bold; margin-left: 20px; margin-right: 20px;}"/>
]]
statUi=simBWF.createCustomUi(xml,simBWF.getObjectAltName(model.handle)..' Statistics','bottomLeft',true--[[,onCloseFunction,modal,resizable,activate,additionalUiAttribute--]])
end
end
function model.updateStatisticsDialog(enabled)
if statUi then
simUI.setLabelText(statUi,1,"Part production count: "..model.productionCount,true)
end
end
function model.wasMultiFeederTriggered()
local data=model.readInfo()
local val=data['multiFeederTriggerCnt']
if val and val~=model.multiFeederTriggerLastState then
model.multiFeederTriggerLastState=val
return true
end
return false
end
function model.getStartStopTriggerType()
if model.stopTriggerSensor~=-1 then
local data=sim.readCustomDataBlock(model.stopTriggerSensor,simBWF.modelTags.BINARYSENSOR)
if data then
data=sim.unpackTable(data)
local state=data['detectionState']
if not lastStopTriggerState then
lastStopTriggerState=state
end
if lastStopTriggerState~=state then
lastStopTriggerState=state
return -1 -- means stop
end
end
end
if model.startTriggerSensor~=-1 then
local data=sim.readCustomDataBlock(model.startTriggerSensor,simBWF.modelTags.BINARYSENSOR)
if data then
data=sim.unpackTable(data)
local state=data['detectionState']
if not lastStartTriggerState then
lastStartTriggerState=state
end
if lastStartTriggerState~=state then
lastStartTriggerState=state
return 1 -- means restart
end
end
end
return 0
end
function model.manualTrigger_callback()
manualTrigger=true
end
function sysCall_init()
model.codeVersion=1
local data=model.readInfo()
model.maxProductionCnt=data.maxProductionCnt
if model.maxProductionCnt==0 then
model.maxProductionCnt=-1 -- means unlimited
end
model.online=simBWF.isSystemOnline()
if model.online then
else
model.prepareStatisticsDialog(sim.boolAnd32(data['bitCoded'],128)>0)
model.productionCount=0
model.stopTriggerSensor=simBWF.getReferencedObjectHandle(model.handle,model.objRefIdx.STOPSIGNAL)
model.startTriggerSensor=simBWF.getReferencedObjectHandle(model.handle,model.objRefIdx.STARTSIGNAL)
model.sensorHandle=simBWF.getReferencedObjectHandle(model.handle,model.objRefIdx.SENSOR)
model.conveyorHandle=simBWF.getReferencedObjectHandle(model.handle,model.objRefIdx.CONVEYOR)
model.conveyorTriggerDist=data['conveyorDist']
model.mode=0 -- 0=frequency, 1=sensor, 2=user, 3=conveyor, 4=multi-feeder
local tmp=sim.boolAnd32(data['bitCoded'],4+8+16)
if tmp==4 then model.mode=1 end
if tmp==8 then model.mode=2 end
if tmp==12 then model.mode=3 end
if tmp==16 then model.mode=4 end
if tmp==20 then model.mode=5 end
model.sensorLastState=0
model.multiFeederTriggerLastState=0
model.getStartStopTriggerType()
local parts=simBWF.getAllPartsFromPartRepository()
model.partsData={}
if parts then
for i=1,#parts,1 do
local h=parts[i][2]
local dat=sim.readCustomDataBlock(h,simBWF.modelTags.PART)
dat=sim.unpackTable(dat)
dat['handle']=h
model.partsData[simBWF.getObjectAltName(h)]=dat
end
else
sim.addStatusbarMessage('\nWarning: no part repository found in the scene.\n')
end
model.allProducedParts={}
model.timeForIdlePartToDeactivate=simBWF.modifyPartDeactivationTime(data['deactivationTime'])
counter=0
model.wasEnabled=false
model.fromStartStopTriggerEnable=true
model.fromStartStopTriggerWasEnable=true
if model.mode==5 then
local xml ='<button text="Trigger part production" on-click="model.manualTrigger_callback" style="* {min-width: 220px; min-height: 50px;}"/>'
model.manualTriggerUi=simBWF.createCustomUi(xml,simBWF.getUiTitleNameFromModel(model.handle,_MODELVERSION_,_CODEVERSION_),nil,false,"",false,false,false,"")
end
end
end
function sysCall_actuation()
local t=sim.getSimulationTime()
local dt=sim.getSimulationTimeStep()
local data=model.readInfo()
if model.online then
else
local distributionExtent=data['size']
local dropFrequency=data['frequency']
local feederAlgo=data['algorithm']
local enabled=sim.boolAnd32(data['bitCoded'],2)>0
local nothing
if model.maxProductionCnt~=0 then
if enabled then
if not model.wasEnabled then
model.fromStartStopTriggerEnable=true
model.fromStartStopTriggerWasEnable=true
model.sensorLastState=model.getSensorState()
lastDropTime=nil
nothing,lastConveyorDistance=model.getConveyorDistanceTrigger()
end
end
model.wasEnabled=enabled
local trigger=model.getStartStopTriggerType()
if enabled then
if trigger>0 then
model.fromStartStopTriggerEnable=true
end
if trigger<0 then
model.fromStartStopTriggerEnable=false
end
if model.fromStartStopTriggerEnable and not model.fromStartStopTriggerWasEnable then
model.sensorLastState=model.getSensorState()
lastDropTime=nil
nothing,lastConveyorDistance=model.getConveyorDistanceTrigger()
end
end
model.fromStartStopTriggerWasEnable=model.fromStartStopTriggerEnable
if enabled and model.fromStartStopTriggerEnable then
-- The feeder is enabled
local partDistribution='{'..data['partDistribution']..'}'
local f=loadstring("return "..partDistribution)
partDistribution=f()
-- local destinationDistribution='{'..data['destinationDistribution']..'}'
-- local f=loadstring("return "..destinationDistribution)
-- destinationDistribution=f()
local shiftDistribution='{'..data['shiftDistribution']..'}'
local f=loadstring("return "..shiftDistribution)
shiftDistribution=f()
local rotationDistribution='{'..data['rotationDistribution']..'}'
local f=loadstring("return "..rotationDistribution)
rotationDistribution=f()
local massDistribution='{'..data['weightDistribution']..'}'
local f=loadstring("return "..massDistribution)
massDistribution=f()
local labelDistribution='{'..data['labelDistribution']..'}'
local f=loadstring("return "..labelDistribution)
labelDistribution=f()
local scalingDistribution=nil
if data['sizeScaling'] and data['sizeScaling']>0 then
if data['sizeScaling']==1 then
scalingDistribution='{'..data['isoSizeScalingDistribution']..'}'
end
if data['sizeScaling']==2 then
scalingDistribution='{'..data['nonIsoSizeScalingDistribution']..'}'
end
local f=loadstring("return "..scalingDistribution)
scalingDistribution=f()
end
local sensorState=model.getSensorState()
local partToDrop=nil
local errStr=nil
local t=sim.getSimulationTime()
if model.mode==0 then
-- Frequency triggered
if not lastDropTime then
lastDropTime=t-9999
end
if t-lastDropTime>(1/dropFrequency) then
lastDropTime=t
partToDrop,errStr=model.getPartToDrop(distributionExtent,partDistribution,shiftDistribution,rotationDistribution,massDistribution,scalingDistribution,model.partsData)
end
end
if model.mode==1 then
-- Sensor triggered
if sensorState~=model.sensorLastState then
partToDrop,errStr=model.getPartToDrop(distributionExtent,partDistribution,shiftDistribution,rotationDistribution,massDistribution,scalingDistribution,model.partsData)
end
end
if model.mode==3 and model.getConveyorDistanceTrigger() then
-- Conveyor belt distance triggered
partToDrop,errStr=model.getPartToDrop(distributionExtent,partDistribution,shiftDistribution,rotationDistribution,massDistribution,scalingDistribution,model.partsData)
end
if model.mode==2 then
-- User triggered
local algo=assert(loadstring(feederAlgo))
if algo() then
partToDrop,errStr=model.getPartToDrop(distributionExtent,partDistribution,shiftDistribution,rotationDistribution,massDistribution,scalingDistribution,model.partsData)
end
end
if model.mode==4 then
-- Multi-feeder triggered
if model.wasMultiFeederTriggered() then
partToDrop,errStr=model.getPartToDrop(distributionExtent,partDistribution,shiftDistribution,rotationDistribution,massDistribution,scalingDistribution,model.partsData)
end
end
if model.mode==5 then
-- Manually triggered
if manualTrigger then
manualTrigger=nil
lastDropTime=t
partToDrop,errStr=model.getPartToDrop(distributionExtent,partDistribution,shiftDistribution,rotationDistribution,massDistribution,scalingDistribution,model.partsData)
end
end
if errStr then
sim.addStatusbarMessage('\n'..errStr..'\n')
end
model.sensorLastState=sensorState
if partToDrop then
if model.maxProductionCnt>0 then
model.maxProductionCnt=model.maxProductionCnt-1
end
counter=counter+1
local itemName=partToDrop.name
-- local itemDestination=partToDrop[2]
local itemPosition=partToDrop.position
local itemOrientation=partToDrop.orientation
local itemMass=partToDrop.mass
local itemScaling=partToDrop.scaling
local dat=model.partsData[itemName]
if dat then
model.productionCount=model.productionCount+1
local h=dat['handle']
-- if itemDestination and itemDestination=='<DEFAULT>' then
-- itemDestination=nil
-- end
if not itemPosition then
itemPosition=sim.getObjectPosition(model.handle,-1) -- default
else
itemPosition=sim.multiplyVector(sim.getObjectMatrix(model.handle,-1),itemPosition)
end
if not itemOrientation then
itemOrientation=sim.getObjectOrientation(model.handle,-1) -- default
else
local m=sim.buildMatrix({0,0,0},itemOrientation)
m=sim.multiplyMatrices(sim.getObjectMatrix(model.handle,-1),m)
itemOrientation=sim.getEulerAnglesFromMatrix(m)
end
if itemMass and itemMass=='<DEFAULT>' then
itemMass=nil
end
local labelsToEnable=model.getDistributionValue(labelDistribution)
simBWF.instanciatePart(h,itemPosition,itemOrientation,itemMass,itemScaling,labelsToEnable,true)
end
end
end
end
model.updateStatisticsDialog()
end
end
|
WidgetUnitSayCommand = Command:extends{}
WidgetUnitSayCommand.className = "WidgetUnitSayCommand"
function WidgetUnitSayCommand:init(unit, text)
self.unit = unit
self.text = text
end
function WidgetUnitSayCommand:execute()
SB.displayUtil:unitSay(self.unit, self.text)
-- SB.model.areaManager:addArea(self.value, self.id)
end
|
if SERVER
then
util.AddNetworkString("magic_BroadcastMagicTrail")
CreateConVar("magic_broadcast_trail", "1")
local broadcastParticle = GetConVar("magic_broadcast_trail")
net.Receive("magic_BroadcastMagicTrail", function(_, ply)
if !broadcastParticle:GetBool() then return end
local pos = net.ReadVector()
local angle = net.ReadDouble()
net.Start("magic_BroadcastMagicTrail", true)
net.WriteVector(pos)
net.WriteDouble(angle)
net.WriteColor(Color(ply:GetInfoNum("magic_trail_color_r", 255), ply:GetInfoNum("magic_trail_color_g", 255), ply:GetInfoNum("magic_trail_color_b", 255)))
local filter = RecipientFilter()
filter:AddPVS(ply:GetPos())
filter:RemovePlayer(ply)
net.Send(filter)
end)
util.AddNetworkString("magic_CastSpell")
util.AddNetworkString("magic_SpellCasted")
net.Receive("magic_CastSpell", function(_, ply)
if !ply:CanCast() then return end
local combo = net.ReadString()
local spell = magic.spells[combo]
if spell == nil
then
return
end
if spell:OnCasted(ply) != false
then
hook.Run("magic_PlayerCastSpell", spell, ply)
net.Start("magic_SpellCasted")
net.WriteString(combo)
net.WriteEntity(ply)
net.Broadcast()
end
end)
util.AddNetworkString("magic_net")
else
net.Receive("magic_BroadcastMagicTrail", function()
magic.addMagicTrail(net.ReadVector(), net.ReadDouble(), nil, net.ReadColor())
end)
net.Receive("magic_SpellCasted", function()
local combo = net.ReadString()
local ply = net.ReadEntity()
local spell = magic.spells[combo]
hook.Run("magic_PlayerCastSpell", spell, ply)
if spell.OnCasted == nil or spell:OnCasted(ply) != false
then
for k, v in ipairs(spell.elementalEffects)
do
local effect = ply:CreateParticleEffect(v)
end
end
end)
end
local receivers = {}
function magic.netReceive(name, callback)
receivers[name] = callback
end
net.Receive("magic_net", function(len, ply)
local name = net.ReadString()
local fn = receivers[name]
if fn
then
fn(len, ply)
end
end)
function magic.netStart(name)
net.Start("magic_net")
net.WriteString(name)
end |
--- The concommand library is used to create console commands which can be used to network (basic) information & events between the client and the server.
_G.concommand = {}
--- Creates a console command that runs a function in lua with optional autocompletion function and help text.
--- 🦟 **BUG**: [This will fail if the concommand was previously removed with concommand.Remove in a different realm (creating a command on the client that was removed from the server and vice-versa).](https://github.com/Facepunch/garrysmod-issues/issues/1183)
--- @param name string @The command name to be used in console
--- @param callback function @The function to run when the concommand is executed
--- @param autoComplete function @The function to call which should return a table of options for autocompletion
--- @param helpText string @The text to display should a user run 'help cmdName'.
--- @param flags number @Concommand modifier flags
function concommand.Add(name, callback, autoComplete, helpText, flags)
end
--- Returns the tables of all console command callbacks, and autocomplete functions, that were added to the game with concommand.Add.
--- @return table @Table of command callback functions.
--- @return table @Table of command autocomplete functions.
function concommand.GetTable()
end
--- Removes a console command.
--- 🦟 **BUG**: [This will not always remove the command from auto-complete.](https://github.com/Facepunch/garrysmod-issues/issues/1183)
--- 🦟 **BUG**: [concommand.Add will fail if the concommand was previously removed with this function in a different realm (creating a command on the client that was removed from the server and vice-versa).](https://github.com/Facepunch/garrysmod-issues/issues/1183)
--- @param name string @The name of the command to be removed.
function concommand.Remove(name)
end
|
local wk = require('which-key')
wk.register(
{
vd = { '<Cmd>Dirbuf<Cr>', 'dirbuf' },
vD = { '<Cmd>Dirbuf %<Cr>', 'dirbuf in current directory' },
},
{
prefix = '<Leader>',
}
)
|
--define the class
ACF_defineGunClass("ARTY", {
type = "missile",
spread = 1,
name = "Artillery Rockets",
desc = "Artillery rockets provide massive HE delivery over a broad area, with arcing ballistic trajectories and limited guidance. Best equipped with a seeker head, fired up at an angle, then guided toward a stationary target.",
muzzleflash = "gl_muzzleflash_noscale",
rofmod = 1,
sound = "acf_missiles/missiles/missile_rocket.mp3",
soundDistance = " ",
soundNormal = " ",
effect = "Rocket Motor",
ammoBlacklist = {"AP", "APHE", "FL", "SM"} -- Including FL would mean changing the way round classes work.
} )
ACF_defineGun("Type 63 RA", { --id
name = "Type 63 Rocket",
desc = "A common artillery rocket in the third world, able to be launched from a variety of platforms with a painful whallop and a very arced trajectory.\nContrary to appearances and assumptions, does not in fact werf nebel.",
model = "models/missiles/glatgm/mgm51.mdl",
caliber = 10.7,
gunclass = "ARTY",
rack = "1xRK_small", -- Which rack to spawn this missile on?
weight = 80,
length = 80,
year = 1960,
rofmod = 0.6,
roundclass = "Rocket",
round =
{
model = "models/missiles/glatgm/mgm51.mdl",
maxlength = 50,
casing = 0.1, -- thickness of missile casing, cm
armour = 8, -- effective armour thickness of casing, in mm
propweight = 0.7, -- motor mass - motor casing
thrust = 2400, -- average thrust - kg*in/s^2
burnrate = 400, -- cm^3/s at average chamber pressure
starterpct = 0.1,
minspeed = 200, -- minimum speed beyond which the fins work at 100% efficiency
dragcoef = 0.002, -- drag coefficient while falling
dragcoefflight = 0.001, -- drag coefficient during flight
finmul = 0.02, -- fin multiplier (mostly used for unpropelled guidance)
penmul = math.sqrt(2) -- 139 HEAT velocity multiplier. Squared relation to penetration (math.sqrt(2) means 2x pen)
},
ent = "acf_rack", -- A workaround ent which spawns an appropriate rack for the missile.
guidance = { "Dumb" },
fuses = { "Contact", "Timed", "Optical", "Cluster" },
racks = {["1xRK_small"] = true, ["1xRK"] = true, ["2xRK"] = true, ["3xRK"] = true, ["4xRK"] = true, ["6xUARRK"] = true}, -- a whitelist for racks that this missile can load into. can also be a 'function(bulletData, rackEntity) return boolean end'
viewcone = 180, -- cone radius, 180 = full 360 tracking
agility = 0.08,
armdelay = 0.2 -- minimum fuse arming delay
} )
ACF_defineGun("SAKR-10 RA", { --id
name = "SAKR-10 Rocket",
desc = "A short-range but formidable artillery rocket, based upon the Grad. Well suited to the backs of trucks.",
model = "models/missiles/9m31.mdl",
caliber = 12.2,
gunclass = "ARTY",
rack = "1xRK", -- Which rack to spawn this missile on?
weight = 160,
length = 320, --320
year = 1980,
rofmod = 0.75,
roundclass = "Rocket",
round =
{
model = "models/missiles/9m31.mdl",
maxlength = 140,
casing = 0.1, -- thickness of missile casing, cm
armour = 12, -- effective armour thickness of casing, in mm
propweight = 1.2, -- motor mass - motor casing
thrust = 1300, -- average thrust - kg*in/s^2
burnrate = 120, -- cm^3/s at average chamber pressure
starterpct = 0.1,
minspeed = 300, -- minimum speed beyond which the fins work at 100% efficiency
dragcoef = 0.002, -- drag coefficient while falling
dragcoefflight = 0.010, -- drag coefficient during flight
finmul = 0.03, -- fin multiplier (mostly used for unpropelled guidance)
penmul = math.sqrt(1.1) -- 139 HEAT velocity multiplier. Squared relation to penetration (math.sqrt(2) means 2x pen)
},
ent = "acf_rack", -- A workaround ent which spawns an appropriate rack for the missile.
guidance = { "Dumb", "Laser", "GPS Guided" },
fuses = { "Contact", "Timed", "Optical", "Cluster" },
racks = {["1xRK"] = true, ["1xRK_small"] = true, ["2xRK"] = true, ["3xRK"] = true, ["4xRK"] = true, ["6xUARRK"] = true}, -- a whitelist for racks that this missile can load into. can also be a 'function(bulletData, rackEntity) return boolean end'
agility = 0.07,
viewcone = 180,
armdelay = 0.4 -- minimum fuse arming delay
} )
ACF_defineGun("SS-40 RA", { --id
name = "SS-40 Rocket",
desc = "A large, heavy, guided artillery rocket for taking out stationary or dug-in targets. Slow to load, slow to fire, slow to guide, and slow to arrive.",
model = "models/missiles/aim120.mdl",
caliber = 18.0,
gunclass = "ARTY",
rack = "1xRK", -- Which rack to spawn this missile on?
weight = 320,
length = 420,
year = 1983,
rofmod = 1.1,
roundclass = "Rocket",
round =
{
model = "models/missiles/aim120.mdl",
maxlength = 115,
casing = 0.1, -- thickness of missile casing, cm
armour = 12, -- effective armour thickness of casing, in mm
propweight = 4.0, -- motor mass - motor casing
thrust = 850, -- average thrust - kg*in/s^2
burnrate = 200, -- cm^3/s at average chamber pressure
starterpct = 0.075,
minspeed = 300, -- minimum speed beyond which the fins work at 100% efficiency
dragcoef = 0.002, -- drag coefficient while falling
dragcoefflight = 0.009, -- drag coefficient during flight
finmul = 0.05, -- fin multiplier (mostly used for unpropelled guidance)
penmul = math.sqrt(2) -- 139 HEAT velocity multiplier. Squared relation to penetration (math.sqrt(2) means 2x pen)
},
ent = "acf_rack", -- A workaround ent which spawns an appropriate rack for the missile.
guidance = { "Dumb", "Laser", "GPS Guided" },
fuses = { "Contact", "Timed", "Optical", "Cluster" },
racks = {["1xRK"] = true, ["2xRK"] = true, ["3xRK"] = true, ["4xRK"] = true, ["6xUARRK"] = true}, -- a whitelist for racks that this missile can load into. can also be a 'function(bulletData, rackEntity) return boolean end'
agility = 0.04,
viewcone = 180,
armdelay = 0.6 -- minimum fuse arming delay
} )
|
Weapon = require "Weapon"
-- Ship object
local Ship = {}
Ship.__index = Ship
function Ship:create(world, player)
local obj = Entity:create({
name = "Ship",
player = player,
density = 10,
integrity = 5000,
integrity_max = 8000,
integrity_cur = 5000,
max_torque = 1000,
weapon = nil
})
setmetatable(obj, self)
-- Set initial position
local px, py = player:getPosition()
obj:setPosition(px, py)
-- Create body, shape and combine into fixture
local body = love.physics.newBody(world, px, py, "dynamic")
local shape = love.physics.newCircleShape(16)
local fixture = love.physics.newFixture(body, shape, obj.density)
fixture:setUserData(obj)
fixture:setCategory(player.category)
fixture:setMask(player.category-10)
fixture:setRestitution(0.3)
fixture:setFriction(1.0)
obj.fixture = fixture
obj:getBody():setFixedRotation(true)
---
-- Draw
--
function obj:draw()
colorDefaultApply()
local x, y = self:getPosition()
self.sprite:draw(x, y, self:getBody():getAngle())
self.weapon:draw()
end
---
-- Update
-- @param dt
-- @param world
--
function obj:update(dt, world)
local px, py = self.player:getPosition()
self:setPosition(px, py)
self.sprite:update(dt)
self.weapon:update(dt, world)
self.weapon:reload(dt)
end
return obj
end
return Ship
|
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:26' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
local SMITHING_SCENE_NAME = "smithing"
ZO_Smithing = ZO_Smithing_Common:Subclass()
function ZO_Smithing:New(...)
return ZO_Smithing_Common.New(self, ...)
end
function ZO_Smithing:Initialize(control)
ZO_Smithing_Common.Initialize(self, control)
self.refinementPanel = ZO_SmithingRefinement:New(self.control:GetNamedChild("RefinementPanel"), self)
self.creationPanel = ZO_SmithingCreation:New(self.control:GetNamedChild("CreationPanel"), self)
self.improvementPanel = ZO_SmithingImprovement:New(self.control:GetNamedChild("ImprovementPanel"), self)
self.deconstructionPanel = ZO_SmithingExtraction:New(self.control:GetNamedChild("DeconstructionPanel"), self)
self.researchPanel = ZO_SmithingResearch:New(self.control:GetNamedChild("ResearchPanel"), self)
self:InitializeKeybindStripDescriptors()
self:InitializeModeBar()
SMITHING_SCENE = self:CreateInteractScene(SMITHING_SCENE_NAME)
SMITHING_SCENE:RegisterCallback("StateChange", function(oldState, newState)
if newState == SCENE_SHOWING then
local craftingType = GetCraftingInteractionType()
ZO_Skills_TieSkillInfoHeaderToCraftingSkill(self.control:GetNamedChild("SkillInfo"), craftingType)
local isCraftingTypeDifferent = not self.interactingWithSameStation or self.oldCraftingType ~= craftingType
self.refinementPanel:SetCraftingType(craftingType, self.oldCraftingType, isCraftingTypeDifferent)
self.creationPanel:SetCraftingType(craftingType, self.oldCraftingType, isCraftingTypeDifferent)
self.improvementPanel:SetCraftingType(craftingType, self.oldCraftingType, isCraftingTypeDifferent)
self.deconstructionPanel:SetCraftingType(craftingType, self.oldCraftingType, isCraftingTypeDifferent)
self.researchPanel:SetCraftingType(craftingType, self.oldCraftingType, isCraftingTypeDifferent)
self.oldCraftingType = craftingType
KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
self:AddTabsToMenuBar(craftingType, isCraftingTypeDifferent)
elseif newState == SCENE_HIDDEN then
ZO_InventorySlot_RemoveMouseOverKeybinds()
KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
self:DirtyAllPanels()
ZO_Skills_UntieSkillInfoHeaderToCraftingSkill(self.control:GetNamedChild("SkillInfo"))
CRAFTING_RESULTS:SetCraftingTooltip(nil)
end
end)
self.control:RegisterForEvent(EVENT_CRAFTING_STATION_INTERACT, function(eventCode, craftingType, sameStation)
if ZO_Smithing_IsSmithingStation(craftingType) and not IsInGamepadPreferredMode() then
self.interactingWithSameStation = sameStation
SCENE_MANAGER:Show(SMITHING_SCENE_NAME)
end
end)
self.control:RegisterForEvent(EVENT_END_CRAFTING_STATION_INTERACT, function(eventCode, craftingType)
if ZO_Smithing_IsSmithingStation(craftingType) and not IsInGamepadPreferredMode() then
SCENE_MANAGER:Hide(SMITHING_SCENE_NAME)
end
end)
local function HandleDirtyEvent()
self:DirtyAllPanels()
end
self.control:RegisterForEvent(EVENT_INVENTORY_FULL_UPDATE, HandleDirtyEvent)
self.control:RegisterForEvent(EVENT_INVENTORY_SINGLE_SLOT_UPDATE, HandleDirtyEvent)
self.control:RegisterForEvent(EVENT_NON_COMBAT_BONUS_CHANGED, function(eventCode, nonCombatBonusType)
if SMITHING_BONUSES[nonCombatBonusType] then
HandleDirtyEvent()
end
end)
self.control:RegisterForEvent(EVENT_SMITHING_TRAIT_RESEARCH_STARTED, HandleDirtyEvent)
self.control:RegisterForEvent(EVENT_SMITHING_TRAIT_RESEARCH_COMPLETED, HandleDirtyEvent)
end
function ZO_Smithing:InitializeKeybindStripDescriptors()
self.keybindStripDescriptor =
{
alignment = KEYBIND_STRIP_ALIGN_CENTER,
-- Perform craft/extract/improve
{
name = function()
if self.mode == SMITHING_MODE_CREATION then
local cost = GetCostToCraftSmithingItem(self.creationPanel:GetAllCraftingParameters())
return ZO_CraftingUtils_GetCostToCraftString(cost)
elseif self.mode == SMITHING_MODE_REFINEMENT then
local action = self.refinementPanel:IsMultiExtract() and "SI_DECONSTRUCTACTIONNAME_PERFORMMULTIPLE" or "SI_DECONSTRUCTACTIONNAME"
return GetString(action, DECONSTRUCT_ACTION_NAME_REFINE)
elseif self.mode == SMITHING_MODE_DECONSTRUCTION then
local action = self.deconstructionPanel:IsMultiExtract() and "SI_DECONSTRUCTACTIONNAME_PERFORMMULTIPLE" or "SI_DECONSTRUCTACTIONNAME"
return GetString(action, DECONSTRUCT_ACTION_NAME_DECONSTRUCT)
elseif self.mode == SMITHING_MODE_IMPROVEMENT then
return GetString(SI_SMITHING_IMPROVE)
elseif self.mode == SMITHING_MODE_RESEARCH then
return GetString(SI_ITEM_ACTION_RESEARCH)
end
end,
keybind = "UI_SHORTCUT_SECONDARY",
callback = function()
if self.mode == SMITHING_MODE_REFINEMENT then
self.refinementPanel:ConfirmRefine()
elseif self.mode == SMITHING_MODE_CREATION then
self.creationPanel:ConfirmCreate()
elseif self.mode == SMITHING_MODE_DECONSTRUCTION then
self.deconstructionPanel:ConfirmExtractAll()
elseif self.mode == SMITHING_MODE_IMPROVEMENT then
self.improvementPanel:Improve()
elseif self.mode == SMITHING_MODE_RESEARCH then
self.researchPanel:Research()
end
end,
enabled = function()
if ZO_CraftingUtils_IsPerformingCraftProcess() then
return false
end
if self.mode == SMITHING_MODE_REFINEMENT then
return self.refinementPanel:IsExtractable()
elseif self.mode == SMITHING_MODE_CREATION then
return self.creationPanel:ShouldCraftButtonBeEnabled()
elseif self.mode == SMITHING_MODE_DECONSTRUCTION then
return self.deconstructionPanel:IsExtractable()
elseif self.mode == SMITHING_MODE_IMPROVEMENT then
return self.improvementPanel:IsImprovable()
elseif self.mode == SMITHING_MODE_RESEARCH then
return self.researchPanel:IsResearchable()
end
end,
},
-- Clear selections / Cancel Research
{
name = function()
if self.mode == SMITHING_MODE_RESEARCH then
return GetString(SI_CRAFTING_CANCEL_RESEARCH)
else
return GetString(SI_CRAFTING_CLEAR_SELECTIONS)
end
end,
keybind = "UI_SHORTCUT_NEGATIVE",
callback = function()
if self.mode == SMITHING_MODE_REFINEMENT then
self.refinementPanel:ClearSelections()
elseif self.mode == SMITHING_MODE_DECONSTRUCTION then
self.deconstructionPanel:ClearSelections()
elseif self.mode == SMITHING_MODE_IMPROVEMENT then
self.improvementPanel:ClearSelections()
elseif self.mode == SMITHING_MODE_RESEARCH then
return self.researchPanel:CancelResearch()
end
end,
visible = function()
if not ZO_CraftingUtils_IsPerformingCraftProcess() then
if self.mode == SMITHING_MODE_REFINEMENT then
return self.refinementPanel:HasSelections()
elseif self.mode == SMITHING_MODE_DECONSTRUCTION then
return self.deconstructionPanel:HasSelections()
elseif self.mode == SMITHING_MODE_IMPROVEMENT then
return self.improvementPanel:HasSelections()
elseif self.mode == SMITHING_MODE_RESEARCH then
return self.researchPanel:CanCancelResearch()
end
end
end,
},
-- Crown Store opening action
{
name = function()
if self.mode == SMITHING_MODE_CREATION then
return GetString(SI_SMITHING_BUY_CRAFTING_ITEMS)
end
end,
keybind = "UI_SHORTCUT_TERTIARY",
callback = function()
if self.mode == SMITHING_MODE_CREATION then
self.creationPanel:BuyCraftingItems()
end
end,
visible = function()
if not ZO_CraftingUtils_IsPerformingCraftProcess() then
if self.mode == SMITHING_MODE_CREATION and not self.creationPanel:ShouldIgnoreStyleItems() then
return true
end
return false
end
end,
},
}
ZO_CraftingUtils_ConnectKeybindButtonGroupToCraftingProcess(self.keybindStripDescriptor)
end
function ZO_Smithing:InitializeModeBar()
self.modeBar = self.control:GetNamedChild("ModeMenuBar")
self.modeBarLabel = self.modeBar:GetNamedChild("Label")
local function CreateModeData(name, mode, normal, pressed, highlight, disabled)
return {
categoryName = name,
descriptor = mode,
normal = normal,
pressed = pressed,
highlight = highlight,
disabled = disabled,
callback = function(tabData)
self.modeBarLabel:SetText(GetString(name))
self:SetMode(mode)
end,
}
end
self.refinementTab = CreateModeData(SI_SMITHING_TAB_REFINEMENT, SMITHING_MODE_REFINEMENT, "EsoUI/Art/Crafting/smithing_tabIcon_refine_up.dds", "EsoUI/Art/Crafting/smithing_tabIcon_refine_down.dds", "EsoUI/Art/Crafting/smithing_tabIcon_refine_over.dds", "EsoUI/Art/Crafting/smithing_tabIcon_refine_disabled.dds")
self.creationTab = CreateModeData(SI_SMITHING_TAB_CREATION, SMITHING_MODE_CREATION, "EsoUI/Art/Crafting/smithing_tabIcon_creation_up.dds", "EsoUI/Art/Crafting/smithing_tabIcon_creation_down.dds", "EsoUI/Art/Crafting/smithing_tabIcon_creation_over.dds", "EsoUI/Art/Crafting/smithing_tabIcon_creation_disabled.dds")
self.deconstructionTab = CreateModeData(SI_SMITHING_TAB_DECONSTRUCTION, SMITHING_MODE_DECONSTRUCTION, "EsoUI/Art/Crafting/enchantment_tabIcon_deconstruction_up.dds", "EsoUI/Art/Crafting/enchantment_tabIcon_deconstruction_down.dds", "EsoUI/Art/Crafting/enchantment_tabIcon_deconstruction_over.dds", "EsoUI/Art/Crafting/enchantment_tabIcon_deconstruction_disabled.dds")
self.improvementTab = CreateModeData(SI_SMITHING_TAB_IMPROVEMENT, SMITHING_MODE_IMPROVEMENT, "EsoUI/Art/Crafting/smithing_tabIcon_improve_up.dds", "EsoUI/Art/Crafting/smithing_tabIcon_improve_down.dds", "EsoUI/Art/Crafting/smithing_tabIcon_improve_over.dds", "EsoUI/Art/Crafting/smithing_tabIcon_improve_disabled.dds")
self.researchTab = CreateModeData(SI_SMITHING_TAB_RESEARCH, SMITHING_MODE_RESEARCH, "EsoUI/Art/Crafting/smithing_tabIcon_research_up.dds", "EsoUI/Art/Crafting/smithing_tabIcon_research_down.dds", "EsoUI/Art/Crafting/smithing_tabIcon_research_over.dds", "EsoUI/Art/Crafting/smithing_tabIcon_research_disabled.dds")
self.recipeTab =
{
descriptor = SMITHING_MODE_RECIPES,
callback = function(tabData)
self.modeBarLabel:SetText(GetString(tabData.categoryName))
self:SetMode(SMITHING_MODE_RECIPES)
end,
}
ZO_CraftingUtils_ConnectMenuBarToCraftingProcess(self.modeBar)
end
function ZO_Smithing:AddTabsToMenuBar(craftingType, isCraftingTypeDifferent)
local oldMode = self.mode
self.mode = nil
local recipeCraftingSystem = GetTradeskillRecipeCraftingSystem(craftingType)
local recipeCraftingSystemNameStringId = _G["SI_RECIPECRAFTINGSYSTEM"..recipeCraftingSystem]
local normal, pressed, highlight, disabled = GetKeyboardRecipeCraftingSystemButtonTextures(recipeCraftingSystem)
local recipeTab = self.recipeTab
recipeTab.categoryName = recipeCraftingSystemNameStringId
recipeTab.normal = normal
recipeTab.pressed = pressed
recipeTab.highlight = highlight
recipeTab.disabled = disabled
ZO_MenuBar_ClearButtons(self.modeBar)
self.refinementButton = ZO_MenuBar_AddButton(self.modeBar, self.refinementTab)
self.creationButton = ZO_MenuBar_AddButton(self.modeBar, self.creationTab)
ZO_MenuBar_AddButton(self.modeBar, self.deconstructionTab)
self.improvementButton = ZO_MenuBar_AddButton(self.modeBar, self.improvementTab)
ZO_MenuBar_AddButton(self.modeBar, self.researchTab)
self.recipeButton = ZO_MenuBar_AddButton(self.modeBar, self.recipeTab)
if isCraftingTypeDifferent or not oldMode then
ZO_MenuBar_SelectDescriptor(self.modeBar, SMITHING_MODE_REFINEMENT)
else
ZO_MenuBar_SelectDescriptor(self.modeBar, oldMode)
end
end
function ZO_Smithing:OnItemReceiveDrag(slotControl, bagId, slotIndex)
if self.mode == SMITHING_MODE_REFINEMENT then
self.refinementPanel:OnItemReceiveDrag(slotControl, bagId, slotIndex)
elseif self.mode == SMITHING_MODE_IMPROVEMENT then
self.improvementPanel:OnItemReceiveDrag(slotControl, bagId, slotIndex)
elseif self.mode == SMITHING_MODE_DECONSTRUCTION then
self.deconstructionPanel:OnItemReceiveDrag(slotControl, bagId, slotIndex)
end
end
function ZO_Smithing:SetMode(mode)
if self.mode ~= mode then
local oldMode = self.mode
self.mode = mode
if oldMode == SMITHING_MODE_DECONSTRUCTION then
self.deconstructionPanel:ClearSelections()
end
CRAFTING_RESULTS:SetCraftingTooltip(nil)
if mode == SMITHING_MODE_RECIPES then
KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
PROVISIONER:EmbedInCraftingScene()
else
if oldMode == SMITHING_MODE_RECIPES then
PROVISIONER:RemoveFromCraftingScene()
KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
end
KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
TriggerTutorial(self.GetTutorialTrigger(self, GetCraftingInteractionType(), mode))
end
self.refinementPanel:SetHidden(mode ~= SMITHING_MODE_REFINEMENT)
self.creationPanel:SetHidden(mode ~= SMITHING_MODE_CREATION)
self.improvementPanel:SetHidden(mode ~= SMITHING_MODE_IMPROVEMENT)
self.deconstructionPanel:SetHidden(mode ~= SMITHING_MODE_DECONSTRUCTION)
self.researchPanel:SetHidden(mode ~= SMITHING_MODE_RESEARCH)
end
end
function ZO_Smithing:UpdateSharedKeybindStrip()
KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_Smithing:GetResearchPanel()
return self.researchPanel
end
function ZO_Smithing:UpdateQuestPins()
if self.refinementButton then
self.refinementButton.questPin:SetHidden(not self.shouldRefineForQuest)
end
if self.creationButton then
self.creationButton.questPin:SetHidden(not self.shouldCraftForQuest)
end
if self.improvementButton then
self.improvementButton.questPin:SetHidden(not self.shouldImproveForQuest)
end
if self.recipeButton then
self.recipeButton.questPin:SetHidden(not self.usesProvisioningForQuest)
end
end
function ZO_Smithing_Initialize(control)
SMITHING = ZO_Smithing:New(control)
ZO_Smithing_AddScene(SMITHING_SCENE_NAME, SMITHING)
end |
-- Combat settings
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
worldType = "no-pvp"
hotkeyAimbotEnabled = false
protectionLevel = 1
killsToRedSkull = 3
killsToBlackSkull = 6
pzLocked = 30000
removeChargesFromRunes = true
timeToDecreaseFrags = 24 * 60 * 60 * 1000
whiteSkullTime = 15 * 60 * 1000
stairJumpExhaustion = 0
experienceByKillingPlayers = false
expFromPlayersLevelRange = 75
allowWalkthrough = false
-- Connection Config
-- NOTE: maxPlayers set to 0 means no limit
-- ip = "eldorrealms.servegame.com"
ip = "127.0.0.1"
bindOnlyGlobalAddress = false
loginProtocolPort = 7171
gameProtocolPort = 7172
statusProtocolPort = 7171
maxPlayers = 0
motd = "Seja bem-vindo ao Eldor Realms!"
onePlayerOnlinePerAccount = false
allowClones = false
serverName = "Eldor Realms"
statusTimeout = 5000
replaceKickOnLogin = true
maxPacketsPerSecond = 40
-- Cast
enableLiveCasting = true
liveCastPort = 7173
-- Store Config
storeImagesUrl = "http://link/to/store"
storeCoinPacket = 5
-- Deaths
-- NOTE: Leave deathLosePercent as -1 if you want to use the default
-- death penalty formula. For the old formula, set it to 10. For
-- no skill/experience loss, set it to 0.
deathLosePercent = 10
-- Houses
-- NOTE: set housePriceEachSQM to -1 to disable the ingame buy house functionality
housePriceEachSQM = 1000
houseRentPeriod = "never"
-- Item Usage
timeBetweenActions = 200
timeBetweenExActions = 1000
-- Map
-- NOTE: set mapName WITHOUT .otbm at the end
mapName = "forgotten"
mapAuthor = "EldorRealms"
-- Market
marketOfferDuration = 30 * 24 * 60 * 60
premiumToCreateMarketOffer = true
checkExpiredMarketOffersEachMinutes = 60
maxMarketOffersAtATimePerPlayer = 100
-- MySQL
mysqlHost = "127.0.0.1"
mysqlUser = "root"
mysqlPass = ""
mysqlDatabase = "eldor"
mysqlPort = 3306
mysqlSock = ""
-- Misc.
allowChangeOutfit = true
freePremium = false
kickIdlePlayerAfterMinutes = 15
maxMessageBuffer = 4
emoteSpells = false
classicEquipmentSlots = true
-- Rates
-- NOTE: rateExp is not used if you have enabled stages in data/XML/stages.xml
rateExp = 1
rateSkill = 1
rateLoot = 1
rateMagic = 1
rateSpawn = 1
-- Monsters
deSpawnRange = 0
deSpawnRadius = 0
-- Stamina
staminaSystem = false
-- Scripts
warnUnsafeScripts = true
convertUnsafeScripts = true
-- Startup
-- NOTE: defaultPriority only works on Windows and sets process priority.
defaultPriority = "high"
startupDatabaseOptimization = false
-- Status server information
ownerName = "Paulo Salvatore"
ownerEmail = "paulo.salvatore@hotmail.com.br"
url = "maruim.paulosalvatore.com.br"
location = "Brasil"
|
--[[
Author: Ractidous
Date: 12.02.2015.
Store the target location.
If the caster has tethered ally, refresh the tether duration.
The hard-coded one won't take care of the tethered ally's tether duration.
We refresh even the ally's duration.
]]
function CastRelocate( event )
local caster = event.caster
local ability = event.ability
local point = event.target_points[1]
-- Store the target loc
ability.relocate_targetPoint = point
-- Reset states
ability.relocate_isInterrupted = false
-- Try to refresh the tether duration
local tetherModifierName = event.tether_modifier
if caster:HasModifier( tetherModifierName ) then
local tetherAbility = caster:FindAbilityByName( event.tether_ability )
local tetheredAlly = tetherAbility[event.tether_ally_property_name]
if IsRelocatableUnit( tetheredAlly ) then
tetherAbility:ApplyDataDrivenModifier( caster, caster, tetherModifierName, {} )
tetherAbility:ApplyDataDrivenModifier( caster, tetheredAlly, event.tether_ally_modifier, {} )
end
end
end
--[[
Author: Ractidous
Date: 12.02.2015.
Create the endpoint particle at the target location.
And create a vision to the target location.
]]
function CreateMarkerEndpoint( event )
local caster = event.caster
local ability = event.ability
local pfx = ParticleManager:CreateParticle( event.endpoint_particle, PATTACH_CUSTOMORIGIN, caster )
ParticleManager:SetParticleControl( pfx, 0, ability.relocate_targetPoint )
-- Store the particle ID
ability.relocate_endpointPfx = pfx
-- Create vision
ability:CreateVisibilityNode( ability.relocate_targetPoint, event.vision_radius, event.vision_duration )
end
--[[
Author: Ractidous
Date: 12.02.2015.
Check to see if the relocate has been interrupted.
]]
function CheckToInterrupt( event )
local caster = event.caster
local ability = event.ability
if caster:IsStunned() or caster:IsHexed() or caster:IsNightmared() or caster:IsOutOfGame() then
-- Interrupt the ability
ability.relocate_isInterrupted = true
caster:RemoveModifierByName( event.channel_modifier )
end
end
--[[
Author: Ractidous
Date: 12.02.2015.
Destroy the endpoint particle.
]]
function DestroyMarkerEndpoint( event )
local ability = event.ability
local pfx = ability.relocate_endpointPfx
ParticleManager:DestroyParticle( pfx, false )
ability.relocate_endpointPfx = nil
end
--[[
Author: Ractidous
Date: 12.02.2015.
Check to see if the teleport is possible.
If the caster is ensnared when the delay time is expired, the teleport won't happen.
]]
function TryToTeleport( event )
local caster = event.caster
local ability = event.ability
-- Interrupted by any disable?
if ability.relocate_isInterrupted then
ability.relocate_isInterrupted = nil
return
end
-- Ensnared?
if caster:IsRooted() then
return
end
-- Now we teleport!
ability:ApplyDataDrivenModifier( caster, caster, event.timer_modifier, {} )
end
--[[
Author: Ractidous
Date: 12.02.2015.
If the caster has tethered ally, refresh the tether duration.
Store the original location and teleport the caster.
Fire the teleport particle on the old location before the teleportation.
After this function is called, trees around the caster will be destroyed.
]]
function Teleportation_PreDestroyTree( event )
local caster = event.caster
local ability = event.ability
-- Try to refresh the tether duration
local tetherModifierName = event.tether_modifier
local tetherAbility = caster:FindAbilityByName( event.tether_ability )
local tetheredAlly = nil
if caster:HasModifier( tetherModifierName ) then
tetheredAlly = tetherAbility[event.tether_ally_property_name]
if IsRelocatableUnit( tetheredAlly ) then
local tetherDuration = event.tether_duration
tetherAbility:ApplyDataDrivenModifier( caster, caster, tetherModifierName, { duration = tetherDuration } )
tetherAbility:ApplyDataDrivenModifier( caster, tetheredAlly, event.tether_ally_modifier, { duration = tetherDuration } )
else
tetheredAlly = nil
end
end
ability.relocate_tetheredAlly = tetheredAlly
-- Store the original loc
ability.relocate_originalPoint = caster:GetAbsOrigin()
-- Fire the teleport particle
local pfx = ParticleManager:CreateParticle( event.teleport_particle, PATTACH_POINT, caster )
ParticleManager:SetParticleControlEnt( pfx, 0, caster, PATTACH_POINT, "attach_hitloc", caster:GetAbsOrigin(), true )
if tetheredAlly then
pfx = ParticleManager:CreateParticle( event.teleport_particle, PATTACH_POINT, tetheredAlly )
ParticleManager:SetParticleControlEnt( pfx, 0, tetheredAlly, PATTACH_POINT, "attach_hitloc", tetheredAlly:GetAbsOrigin(), true )
end
-- Move to the location
caster:SetAbsOrigin( ability.relocate_targetPoint )
end
--[[
Author: Ractidous
Date: 12.02.2015.
Find clear space for the caster, then teleport the tethered ally to near the caster.
Discard current orders of caster and the tethered ally.
We need to create the timer particle from script in order to control the number showing.
Even the original location marker is created in this function.
]]
function Teleportation_PostDestroyTree( event )
local caster = event.caster
local ability = event.ability
-- Find clear space for the caster, and stop
FindClearSpaceForUnit( caster, ability.relocate_targetPoint, false )
caster:Stop()
-- Find clear space for the tethered ally
-- Ally's teleportation point is always NORTH EAST from the caster.
local tetheredAlly = ability.relocate_tetheredAlly
if tetheredAlly then
FindClearSpaceForUnit( tetheredAlly, ability.relocate_targetPoint + Vector( 16, 16, 0 ), false )
tetheredAlly:Stop()
ability.relocate_tetheredAlly = nil
end
-- Initialize the timer
ability.relocate_timer = event.return_time
local pfx = ParticleManager:CreateParticle( event.timer_particle, PATTACH_OVERHEAD_FOLLOW, caster )
local timerCP1_x = event.return_time >= 10 and 1 or 0
local timerCP1_y = event.return_time % 10
ParticleManager:SetParticleControl( pfx, 1, Vector( timerCP1_x, timerCP1_y, 0 ) )
ability.relocate_timerPfx = pfx
-- Create original location marker
pfx = ParticleManager:CreateParticle( event.marker_particle, PATTACH_CUSTOMORIGIN, caster )
ParticleManager:SetParticleControl( pfx, 0, ability.relocate_originalPoint )
ability.relocate_markerPfx = pfx
end
--[[
Author: Ractidous
Date: 12.02.2015.
Update the timer particle.
]]
function UpdateTimer( event )
local ability = event.ability
ability.relocate_timer = ability.relocate_timer - 1
local pfx = ability.relocate_timerPfx
local timerCP1_x = ability.relocate_timer >= 10 and 1 or 0
local timerCP1_y = ability.relocate_timer % 10
ParticleManager:SetParticleControl( pfx, 1, Vector( timerCP1_x, timerCP1_y, 0 ) )
end
--[[
Author: Ractidous
Date: 12.02.2015.
Destroy the particle effects.
Check to see if the caster is alive.
]]
function TryReturningTeleportation( event )
local caster = event.caster
local ability = event.ability
-- Destroy particle FXs
ParticleManager:DestroyParticle( ability.relocate_timerPfx, false )
ParticleManager:DestroyParticle( ability.relocate_markerPfx, false )
-- If caster is dead, skip the teleportation back
if not caster:IsAlive() then
return
end
-- Now we teleport to the original location!
ability:ApplyDataDrivenModifier( caster, caster, event.returning_modifier, {} )
end
--[[
Author: Ractidous
Date: 12.02.2015.
If the caster is still alive, teleport back to the original location.
Fire the teleport particle on the old location before the teleportation.
After this function is called, trees around the caster will be destroyed.
]]
function ReturningTeleportation_PreDestroyTree( event )
local caster = event.caster
local ability = event.ability
-- Grab the tethered ally
local tetherAbility = caster:FindAbilityByName( event.tether_ability )
local tetheredAlly = nil
if caster:HasModifier( event.tether_modifier ) then
tetheredAlly = tetherAbility[event.tether_ally_property_name]
if not IsRelocatableUnit( tetheredAlly ) then
tetheredAlly = nil
end
end
ability.relocate_tetheredAlly = tetheredAlly
-- Fire the teleport particle
local pfx = ParticleManager:CreateParticle( event.teleport_particle, PATTACH_POINT, caster )
ParticleManager:SetParticleControlEnt( pfx, 0, caster, PATTACH_POINT, "attach_hitloc", caster:GetAbsOrigin(), true )
if tetheredAlly then
pfx = ParticleManager:CreateParticle( event.teleport_particle, PATTACH_POINT, tetheredAlly )
ParticleManager:SetParticleControlEnt( pfx, 0, tetheredAlly, PATTACH_POINT, "attach_hitloc", tetheredAlly:GetAbsOrigin(), true )
end
-- Move to the location
caster:SetAbsOrigin( ability.relocate_originalPoint )
end
--[[
Author: Ractidous
Date: 12.02.2015.
Find clear space for the caster, then teleport back even the tethered ally.
Discard current orders of caster and the tethered ally.
]]
function ReturningTeleportation_PostDestroyTree( event )
local caster = event.caster
local ability = event.ability
-- Find clear space for the caster, and stop
FindClearSpaceForUnit( caster, ability.relocate_originalPoint, false )
caster:Stop()
-- Find clear space for the tethered ally
-- Ally's teleportation point is always NORTH EAST from the caster.
local tetheredAlly = ability.relocate_tetheredAlly
if tetheredAlly then
FindClearSpaceForUnit( tetheredAlly, ability.relocate_originalPoint + Vector( 16, 16, 0 ), false )
tetheredAlly:Stop()
ability.relocate_tetheredAlly = nil
end
end
--[[
Author: Ractidous
Date: 13.02.2015.
Heroes, Illusions, LD's spirit bear, Warlock's Golem, Storm and Fire spirits from Primal Split can be relocated.
Spirit bear, Golem, Storm and Fire spirits all have this property:
"ConsideredHero" "1"
So we can use it in order to check to see if the unit is relocatable.
]]
function IsRelocatableUnit( unit )
if unit:IsHero() then return true end
return false
end
--[[
Author: Ractidous
Date: 13.02.2015.
Stop a sound on the target unit.
]]
function StopSound( event )
StopSoundEvent( event.sound_name, event.target )
end |
nym_destroyer = Creature:new {
objectName = "@mob/creature_names:nym_destroyer",
randomNameType = NAME_GENERIC,
randomNameTag = true,
socialGroup = "nym",
faction = "nym",
level = 40,
chanceHit = 0.43,
damageMin = 355,
damageMax = 420,
baseXp = 4006,
baseHAM = 9100,
baseHAMmax = 11100,
armor = 1,
resists = {15,15,15,15,60,15,-1,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0.0,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = PACK + KILLER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {"object/mobile/dressed_nym_destroyer_rod_m.iff",
"object/mobile/dressed_nym_destroyer_hum_m.iff",
"object/mobile/dressed_nym_destroyer_nikto_m.iff",
"object/mobile/dressed_nym_destroyer_wee_m.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 4500000},
{group = "wearables_uncommon", chance = 2000000},
{group = "nyms_common", chance = 1000000},
{group = "pistols", chance = 1000000},
{group = "carbines", chance = 1000000},
{group = "tailor_components", chance = 500000}
}
}
},
weapons = {"rebel_weapons_medium"},
conversationTemplate = "",
reactionStf = "@npc_reaction/slang",
attacks = merge(riflemanmaster,carbineermaster,brawlermaster)
}
CreatureTemplates:addCreatureTemplate(nym_destroyer, "nym_destroyer")
|
up = false
down = false
left = false
right = false
movementSpeed = 250
jumpSpeed = 200
kickVerticleSpeed = 100
kickHorizontalSpeed = 50
kickHorizontalPower = 300
kickVerticlePower = 200
function leftHandle(pressed)
if pressed then
left = true
else
left = false
end
end
function rightHandle(pressed)
if pressed then
right = true
else
right = false
end
end
function upHandle(pressed)
if pressed then
up = true
else
up = false
end
end
function pickUpHandle(pressed)
if pressed then
player = getGlobalValue("player")
if getEntityValue(player, "holdingItem") == getNullEntity() then
if entityStaticCollidesWithGroup(player, 0, "Items", 0) then
function getItems(object)
if entityStaticCollidesWithEntity(player, 0, object, 0) then
setEntityValue(player, "holdingItem", object)
end
end
forEachEntityInGroup("Items", "getItems")
end
else
setEntityValue(player, "holdingItem", getNullEntity())
end
end
end
function useHandle(pressed)
if pressed then
player = getGlobalValue("player")
if entityStaticCollidesWithGroup(player, 0, "Teleporters", 0) or entityStaticCollidesWithGroup(player, 0, "AnimatedTeleporters", 0)then
teleportedThisFrame = false
function teleport(teleporter)
if entityStaticCollidesWithEntity(player, 0, teleporter, 0) and teleportedThisFrame == false then
teleportedThisFrame = true
setEntityX(player, getEntityValue(teleporter, "destinationX"))
setEntityY(player, getEntityValue(teleporter, "destinationY") - getAnimationHeight("treyStanding"))
if getEntityValue(teleporter, "removeScreenLag") == true then
setGlobalValue("xWanted", getEntityX(entity) - ((getScreenWidth() - getEntityRenderWidth(entity)) / 2))
setGlobalValue("yWanted", getEntityY(entity) - ((getScreenHeight() - getEntityRenderHeight(entity)) / 2) - (getScreenHeight() / 5))
setScreenX(getGlobalValue("xWanted"))
setScreenY(getGlobalValue("yWanted"))
end
end
end
forEachEntityInGroup("Teleporters", "teleport")
forEachEntityInGroup("AnimatedTeleporters", "teleport")
elseif getEntityValue(player, "holdingItem") ~= getNullEntity() then
callEntityFunction(getEntityValue(player, "holdingItem"), "action")
elseif entityStaticCollidesWithGroup(player, 0, "Buttons", 0) then
function pressButton(button)
if entityStaticCollidesWithEntity(player, 0, button, 0) then
callEntityFunction(button, "press")
end
end
forEachEntityInGroup("Buttons", "pressButton")
end
end
end
--arrowkoy handles
addKeyHandle(1073741904, "leftHandle")
addKeyHandle(1073741903, "rightHandle")
addKeyHandle(1073741906, "upHandle")
addKeyHandle(1073741905, "pickUpHandle")
addKeyHandle(string.byte("a"), "leftHandle")
addKeyHandle(string.byte("d"), "rightHandle")
addKeyHandle(string.byte("w"), "upHandle")
addKeyHandle(string.byte("s"), "pickUpHandle")
addKeyHandle(string.byte(" "), "upHandle")
addKeyHandle(string.byte("e"), "useHandle")
function create(x, y)
entity = getNewEntity("baseLuaEntity")
setEntityLabel(entity, "player")
setEntityX(entity, x)
setEntityY(entity, y)
setEntityRenderHeight(entity, 99)
setEntityRenderWidth(entity, 78)
startEntityAnimation(entity, "treyStanding")
addEntityCollisionBox(entity, 27, 19, 26, 80)--0:main collision
addEntityCollisionBox(entity, 27, 19, 26, 80 + 1)--1:ground collision
addEntityValue(entity, "holdingItem", "entity")
addEntityFunction(entity, "update", "void")
addEntityToGroup(entity, "Player")
addEntityToRenderGroup(entity, "450Player")
return entity
end
function update(entity)
setEntityDeltaY(entity, getEntityDeltaY(entity) + (getGlobalValue("gravitySpeed") * getDeltaTime()))
onGround = entityStaticCollidesWithGroup(entity, 1, "CollisionBlocks", 0)
if onGround == true then
setEntityDeltaX(entity, 0)
if left then
setEntityDeltaX(entity, movementSpeed * -1)
setEntityRenderFlip(entity, true)
end
if right then
setEntityDeltaX(entity, movementSpeed)
setEntityRenderFlip(entity, false)
end
if left or right then
if getCurrentEntityAnimation(entity) ~= "treyWalking" then
startEntityAnimation(entity, "treyWalking")
end
else
startEntityAnimation(entity, "treyStanding")
end
if up then
--do player jump
setEntityDeltaY(entity, jumpSpeed * -1)
onGround = false
startEntityAnimation(entity, "treyFalling")
else
if down then
end
end
end
--item Holding/colisions
x, y, width, height = getEntityCollisionBox(entity, 0)
itemHeld = getEntityValue(entity, "holdingItem")
if itemHeld ~= getNullEntity() then --set item values to player's
itemX, itemY, itemWidth, itemHeight = getEntityCollisionBox(itemHeld, 0)
setEntityDeltaX(itemHeld, getEntityDeltaX(entity))
setEntityDeltaY(itemHeld, getEntityDeltaY(entity))
setEntityX(itemHeld, (getEntityX(entity) + x) - ((itemWidth - width) / 2))
setEntityY(itemHeld, (getEntityY(entity) + y) - ((itemHeight - height) / 2))
setEntityRenderFlip(itemHeld, getEntityRenderFlip(entity))
end
if itemHeld ~= getNullEntity() and entityXMovementCollidesWithGroup(itemHeld, 0, "CollisionBlocks", 0) then --if item collides set player delta to 0
setEntityDeltaX(entity, 0)
elseif entityXMovementCollidesWithGroup(entity, 0, "CollisionBlocks", 0) then --elseif player collides set delta 0
setEntityDeltaX(entity, 0)
end
if itemHeld ~= getNullEntity() and entityYMovementCollidesWithGroup(itemHeld, 0, "CollisionBlocks", 0) then
setEntityDeltaY(entity, 0)
elseif entityYMovementCollidesWithGroup(entity, 0, "CollisionBlocks", 0) then
setEntityDeltaY(entity, 0)
end
if itemHeld ~= getNullEntity() and entityMovementCollidesWithGroup(itemHeld, 0, "CollisionBlocks", 0) then
setEntityDeltaX(entity, 0)
setEntityDeltaY(entity, 0)
elseif entityMovementCollidesWithGroup(entity, 0, "CollisionBlocks", 0) then
setEntityDeltaX(entity, 0)
setEntityDeltaY(entity, 0)
end
if itemHeld ~= getNullEntity() then --catch up item delta to the new player delta
setEntityDeltaX(itemHeld, getEntityDeltaX(entity))
setEntityDeltaY(itemHeld, getEntityDeltaY(entity))
end
setGlobalValue("xWanted", getEntityX(entity) - ((getScreenWidth() - getEntityRenderWidth(entity)) / 2))
setGlobalValue("yWanted", getEntityY(entity) - ((getScreenHeight() - getEntityRenderHeight(entity)) / 2) - (getScreenHeight() / 5))
end
|
local bytes_per_pixel = {4, 8, 12, 16, 32}
function num_of_pixels(w, h)
return w * (h/2)
end
function num_of_bytes(nop, bpp)
return bpp * nop
end
function resolution(bpp, memused)
local side = math.sqrt(memused * 1000000 * 2 / bpp / (4*3))+ 1;
local w = side * 4;
local h = side * 3;
return w, h
end
local op = 1
while op do
print("Digite 1 para numero de bytes, 2 para resolução, 3 para bytes per pixel")
op = tonumber(io.read())
if op == 1 then
print("Entre com a largura:")
local w = tonumber(io.read())
print("Entre com a altura:")
local h = tonumber(io.read())
for v=4,32,4 do
local nop = num_of_pixels(w,h)
local nob = num_of_bytes(nop, v)
print(string.format("%d bytes %d x %d | %d | %d", v, w, h, nop, nob))
end
elseif op == 2 then
print("Entre com a memoria maxima usada:")
local mmu = tonumber(io.read())
for v=4,32,4 do
local w, h = resolution(v, mmu)
print(string.format("%d bytes %d x %d", v, w, h))
end
elseif op == 3 then
print("Entre com a memoria maxima usada:")
local mmu = tonumber(io.read())
local nop = num_of_pixels(800, 600)
print(string.format("%d bytes %d x %d", mmu*1000000/nop, 800, 600))
else
op = nil
end
end
|
--[[
Copyright 2020 Matthew Hesketh <matthew@matthewhesketh.com>
This code is licensed under the MIT. See LICENSE for details.
]]
local delete = {}
local mattata = require('mattata')
function delete:init()
delete.commands = mattata.commands(self.info.username):command('delete').table
delete.help = '/delete [message ID] - Deletes the specified (or replied-to) message.'
end
function delete:on_message(message, configuration, language)
if message.chat.type ~= 'supergroup'
then
return mattata.send_reply(
message,
language['errors']['supergroup']
)
elseif not mattata.is_group_admin(
message.chat.id,
message.from.id
)
then
return mattata.send_reply(
message,
language['errors']['admin']
)
end
local input = mattata.input(message.text)
or (
message.reply
and message.reply.message_id
)
if not input
or tonumber(input) == nil
then
return mattata.send_reply(
message,
delete.help
)
end
local success = mattata.delete_message(
message.chat.id,
tonumber(input)
)
if not success
then
return mattata.send_reply(
message,
language['delete']['1']
)
end
return mattata.delete_message(
message.chat.id,
message.message_id
)
end
return delete |
local uv = require('luv')
if #arg==0 then
print(string.format("Usage: %s <command> <file1> [file2 ...]",arg[0]));
return
end
for i=1,#arg do
local fse = uv.new_fs_event()
assert(uv.fs_event_start(fse,arg[i],{
--"watch_entry"=true,"stat"=true,
recursive=true
},function (err,fname,status)
if(err) then
print("Error "..err)
else
print(string.format('Change detected in %s',
uv.fs_event_getpath(fse)))
for k,v in pairs(status) do
print(k,v)
end
print('file changed:'..(fname and fname or ''))
end
end))
end
uv.run('default')
uv.loop_close()
|
local Crossing = require("ak.road.Crossing")
local Lane = require("ak.road.Lane")
local TrafficLight = require("ak.road.TrafficLight")
local TrafficLightModel = require("ak.road.TrafficLightModel")
-- Einfache Kreuzung mit zwei Fahrspuren und drei Ampeln
local K1 = TrafficLight:new("K1", 13, TrafficLightModel.JS2_3er_mit_FG)
local K2 = TrafficLight:new("K2", 24, TrafficLightModel.JS2_3er_ohne_FG)
local K3 = TrafficLight:new("K3", 15, TrafficLightModel.JS2_3er_mit_FG)
local K4 = TrafficLight:new("K4", 12, TrafficLightModel.JS2_3er_mit_FG)
local K5 = TrafficLight:new("K5", 17, TrafficLightModel.JS2_3er_ohne_FG)
local K6 = TrafficLight:new("K6", 09, TrafficLightModel.JS2_3er_mit_FG)
local F1 = TrafficLight:new("F1", 20, TrafficLightModel.JS2_2er_nur_FG)
local F2 = TrafficLight:new("F2", 21, TrafficLightModel.JS2_2er_nur_FG)
lane1 = Lane:new("FS1", 1, K1, { Lane.Directions.STRAIGHT, Lane.Directions.RIGHT })
lane2 = Lane:new("FS2", 2, K2, { Lane.Directions.LEFT })
lane3 = Lane:new("FS3", 3, K5, { Lane.Directions.STRAIGHT, Lane.Directions.RIGHT })
lane4 = Lane:new("FS4", 4, K6, { Lane.Directions.LEFT })
local c = Crossing:new("Einfache Kreuzung", 5)
local sequenceA = c:newSequence("Schaltung A")
sequenceA:addCarLights(K1)
sequenceA:addPedestrianLights(K4, K6, F1, F2)
local sequenceB = c:newSequence("Schaltung B")
sequenceB:addCarLights(K2, K3)
sequenceB:addPedestrianLights(K4, K6)
local sequenceC = c:newSequence("Schaltung C")
sequenceC:addCarLights(K4, K5, K6)
sequenceC:addPedestrianLights(K1, K3)
-- Modulverwaltung der Lua-Bibliothek laden
local ModuleRegistry = require("ak.core.ModuleRegistry")
ModuleRegistry.registerModules(
require("ak.core.CoreLuaModule"),
require("ak.data.DataLuaModule"),
require("ak.road.CrossingLuaModul")
)
function EEPMain()
ModuleRegistry.runTasks()
return 1
end
|
--[[
Copyright 2018 American Megatrends Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
package.path = package.path .. ";./libs/?.lua;./libs/?;"
local utils = require('utils')
local JSON = require("turbo.3rdparty.JSON")
local redis = require('redis')
local CONFIG = require("config")
local posix = require("posix")
local _ = require('underscore')
utils.daemon("/var/run/redfishgroup2fns.pid")
local params = {
scheme = 'unix',
path = CONFIG.redis_sock,
-- host = CONFIG.redis_host,
-- port = CONFIG.redis_port,
timeout = 0
}
local client = redis.connect(params)
local db = redis.connect(params)
local redis_db_index = 0
-- choose db if needed
client:select(redis_db_index)
-- Set the keyspace notification as redis conf
client:config('set', 'notify-keyspace-events','KEA')
-- TODO: change this to configurable option. Where they can choose keyspace or keyevent notification
-- From this channel we will know any operation performed on any key
-- We will be most interested in SET, SADD, HSET, HMSET, MSET kind of operations
-- Identify all possible set commands required and subscribe individually, to avoid subscription overload
local ch_prefix = '__keyspace@'.. redis_db_index ..'__:'
local channels = {ch_prefix .. 'Redfish:PendingOperations'}
local changes = client:pubsub({psubscribe = channels})
-- Primary coroutine that listens on the channel and performs the function triggers for registered keys change events
local sync_redfish_to_fns = coroutine.wrap(function()
while true do
-- The changes is a coroutine wrap which when called, resumes automatically
local msg, abort = changes()
-- ignore the psubscribe notification that you get as soon as you subscribe
if msg and msg.kind ~= "psubscribe" and msg.payload == "sadd" then
-- can be a string or table
local redis_key = string.sub(msg.channel, string.len(ch_prefix)+1)
-- Skip unwanted key patterns
-- all sensor updates can be ignored
-- If the changed redis_key is valid
if redis_key == 'Redfish:PendingOperations' then
-- This delay is to prevent multiple processes being launched when the same group name is added to the set multiple times
os.execute("sleep 0.1")
local pending_ops = db:smembers(redis_key)
db:del(redis_key)
utils.sub_process_nonblocking("subagents/groupfns_handler.lua", unpack(pending_ops))
end
end
coroutine.yield()
end
end)
while true do
sync_redfish_to_fns()
end
|
function isVehicleArmed(vehicle)
assertArgumentType(vehicle, "vehicle")
return ARMED_VEHICLES[getElementModel(vehicle)] == true
end
|
-- this is minified, take a look at https://github.com/wyozi/gmod-medialib/releases/download/1.0.2/medialib.lua for readable code
local a;do local b="git@871fb36d"local c=true;a={}a.VERSION=b;a.DISTRIBUTABLE=c;a.INSTANCE=a.VERSION.."_"..tostring(10000+math.random(90000))a.Modules={}local d=CreateConVar("medialib_debug","0",FCVAR_ARCHIVE)cvars.AddChangeCallback(d:GetName(),function(e,e,f)a.DEBUG=f=="1"end)a.DEBUG=d:GetBool()function a.modulePlaceholder(g)a.Modules[g]={}end;function a.module(g,h)if a.DEBUG then print("[MediaLib] Creating module "..g)end;local i=a.Modules[g]or{name=g,options=h}a.Modules[g]=i;return i end;if SERVER then for e,j in pairs(file.Find("medialib/*","LUA"))do AddCSLuaFile("medialib/"..j)end end;local k=file.Exists;function a.tryInclude(file)if k(file,"LUA")then include(file)return true end;if a.DEBUG then print("[MediaLib] Attempted to include nonexistent file "..file)end;return false end;function a.load(g)local i=a.Modules[g]if i then return i end;if a.DEBUG then print("[MediaLib] Loading unreferenced module "..g)end;local file="medialib/"..g..".lua"if not a.tryInclude(file)then return nil end;return a.Modules[g]end;local l=setmetatable({medialib=a},{__index=_G})local m={read=function(self)return file.Read(self.lua_path,"LUA")end,load=function(self)return include(self.lua_path)end,addcs=function(self)AddCSLuaFile(self.lua_path)end}m.__index=m;local n={read=function(self)return self.source end,load=function(self)local o=CompileString(self:read(),"MediaLib_DynFile_"..self.name)setfenv(o,l)return o()end,addcs=function()end}n.__index=n;a.FolderItems={}function a.folderIterator(p)local q={}for e,j in pairs(file.Find("medialib/"..p.."/*.lua","LUA"))do table.insert(q,setmetatable({name=j,lua_path="medialib/"..p.."/"..j},m))end;for r,s in pairs(a.FolderItems)do local t=r:match("^([^/]*).+")if t==p then table.insert(q,setmetatable({name=r:match("^[^/]*/(.+)"),source=s},n))end end;return pairs(q)end;if CLIENT then local function u()for v=1,30 do MsgC(HSVToColor(30*v,0.5,0.9)," "..string.rep("SEE BELOW FOR INSTRUCTIONS ",3).."\n")end end;concommand.Add("medialib_noflash",function(e,e,w)if w[1]=="rainbow"then u()end;SetClipboardText("http://get.adobe.com/flashplayer/otherversions/")MsgN("[ MediaLib: How to get Flash Player ]")MsgN("1. Open this website in your browser (not the ingame Steam browser): ".."http://get.adobe.com/flashplayer/otherversions/")MsgN(" (the link has been automatically copied to your clipboard)")MsgN("2. Download and install the NSAPI (for Firefox) version")MsgN("3. Restart your Garry's Mod and rejoin this server")MsgN("[ ======================= ]")end)concommand.Add("medialib_lowaudio",function(e,e,w)if w[1]=="rainbow"then u()end;SetClipboardText("http://windows.microsoft.com/en-us/windows7/adjust-the-sound-level-on-your-computer")MsgN("[ MediaLib: How to fix muted sound ]")MsgN("1. Follow instructions here: ".."http://windows.microsoft.com/en-us/windows7/adjust-the-sound-level-on-your-computer")MsgN(" (the link has been automatically copied to your clipboard, you can open it in the steam ingame browser)")MsgN("2. Increase the volume of a process called 'Awesomium Core'")MsgN("3. You should immediately start hearing sound if a mediaclip is playing")MsgN("[ ======================= ]")end)hook.Add("OnPlayerChat","MediaLib.ShowInstructions",function(e,x)if x:match("!ml_noflash")then RunConsoleCommand("medialib_noflash","rainbow")RunConsoleCommand("showconsole")elseif x:match("!ml_lowvolume")then RunConsoleCommand("medialib_lowaudio","rainbow")RunConsoleCommand("showconsole")end end)end end;a.modulePlaceholder("oop")do local b=a.module("oop")b.Classes=b.Classes or{}function b.class(c,d)local e=b.Classes[c]if not e then e=b.createClass(c,d)b.Classes[c]=e;if a.DEBUG then print("[MediaLib] Registering oopclass "..c)end end;return e end;function b.resolveClass(f)if f==nil then return b.Object end;local g=type(f)if g=="string"then local h=b.Classes[f]if h then return h end;error("Resolving class from inexistent class string '"..tostring(f).."'")end;if g=="table"then return f end;error("Resolving class from invalid object '"..tostring(f).."'")end;local i={}local j={'__add','__call','__concat','__div','__ipairs','__le','__len','__lt','__mod','__mul','__pairs','__pow','__sub','__tostring','__unm'}function b.createClass(c,d)local e={}local k;if d~=i then k=b.resolveClass(d)end;e.name=c;e.super=k;e.members=setmetatable({},{__index=e.super})e.members.class=e;e.members.super=e.super;local l={}do l.__index=e.members;for m,n in pairs(j)do l[n]=function(...)local o=e.members[n]if o then return o(...)end end end end;local p={}do p.__index=e.members;p.__newindex=e.members;p.__tostring=function(self)return"class "..self.name end;function p:__call(...)local q={}setmetatable(q,l)local r=q.initialize;if r then r(q,...)end;return q end end;setmetatable(e,p)return e end;b.Object=b.createClass("Object",i)function b.Object:hashCode()local s=getmetatable(self)local t=s.__tostring;s.__tostring=nil;local u=tostring(self):match("table: 0x(.*)")s.__tostring=t;return u end;function b.Object:__tostring()return string.format("%s@%s",self.class.name,self:hashCode())end end;a.modulePlaceholder("mediabase")do local b=a.load("oop")local c=b.class("Media")function c:on(d,e)self._events=self._events or{}self._events[d]=self._events[d]or{}self._events[d][e]=true end;function c:emit(d,...)if not self._events then return end;local f=self._events[d]if not f then return end;for g,h in pairs(f)do g(...)end end;function c:getServiceBase()error("Media:getServiceBase() not implemented!")end;function c:getService()return self._service end;function c:getUrl()return self._unresolvedUrl end;function c:lookupMetadata()local i=self._metadata;if type(i)=="table"then return i end;if i==true or type(i)=="string"then return nil end;self._metadata=true;self:getService():query(self:getUrl(),function(j,k)if j then self._metadata=j else self._metadata=k end end)return nil end;function c:isValid()return false end;function c:IsValid()return self:isValid()end;function c:setVolume(l)end;function c:getVolume()end;function c:setQuality(m)end;function c:seek(n)end;function c:getTime()return 0 end;function c:sync(o,p)if self._lastSync and self._lastSync>CurTime()-5 then return end;local q=self:shouldSync(o,p)if not q then return end;self:seek(o+0.1)self._lastSync=CurTime()end;function c:shouldSync(o,p)if not self:isValid()or not self:isPlaying()then return false end;p=p or 2;local r=self:getTime()local s=math.abs(r-o)return s>p end;function c:getState()end;function c:isPlaying()return self:getState()=="playing"end;function c:play()end;function c:pause()end;function c:stop()end;function c:runCommand(t)end;function c:draw(u,v,w,x)end;function c:getTag()return self._tag end;function c:setTag(y)self._tag=y end;function c:guessDefaultTag()for z=1,10 do local A=debug.getinfo(z,"S")if not A then break end;local B=A.short_src;local C=B:match("addons/(.-)/")if C and C~="medialib"then return string.format("addon:%s",C)end end;return"addon:medialib"end;function c:setDefaultTag()self:setTag(self:guessDefaultTag())end;function c:getDebugInfo()return string.format("[%s] Media [%s] valid:%s state:%s url:%s time:%d",self:getTag(),self.class.name,tostring(self:isValid()),self:getState(),self:getUrl(),self:getTime())end end;a.modulePlaceholder("media")do local b=a.module("media")b.Services={}function b.registerService(c,d)b.Services[c]=d()end;b.RegisterService=b.registerService;function b.service(c)return b.Services[c]end;b.Service=b.service;function b.guessService(e,f)for c,g in pairs(b.Services)do local h=true;if f and f.whitelist then h=h and table.HasValue(f.whitelist,c)end;if f and f.blacklist then h=h and not table.HasValue(f.blacklist,c)end;if h and g:isValidUrl(e)then return g end end end;b.GuessService=b.guessService end;a.modulePlaceholder("mediaregistry")do local b=a.module("mediaregistry")local c=setmetatable({},{__mode="v"})function b.add(d)table.insert(c,d)end;function b.get()return c end;concommand.Add("medialib_listall",function()hook.Run("MediaLib_ListAll")end)hook.Add("MediaLib_ListAll","MediaLib_"..a.INSTANCE,function()print("Media for medialib version "..a.INSTANCE..":")for e,f in pairs(c)do print(f:getDebugInfo())end end)concommand.Add("medialib_stopall",function()hook.Run("MediaLib_StopAll")end)hook.Add("MediaLib_StopAll","MediaLib_"..a.INSTANCE,function()for e,f in pairs(c)do f:stop()end;table.Empty(c)end)local g=CreateConVar("medialib_debugmedia","0")hook.Add("HUDPaint","MediaLib_G_DebugMedia",function()if not g:GetBool()then return end;local h={0}hook.Run("MediaLib_DebugPaint",h)end)hook.Add("MediaLib_DebugPaint","MediaLib_"..a.INSTANCE,function(h)local i=h[1]for e,d in pairs(c)do local j=string.format("#%d %s",i,d:getDebugInfo())draw.SimpleText(j,"DermaDefault",10,10+i*15)i=i+1 end;h[1]=i end)end;a.modulePlaceholder("servicebase")do local b=a.load("oop")local c=a.load("mediaregistry")local d=b.class("Service")function d:on(e,f)self._events={}self._events[e]=self._events[e]or{}self._events[e][f]=true end;function d:emit(e,...)for g,h in pairs(self._events[e]or{})do g(...)end;if e=="error"then MsgN("[MediaLib] Video error: "..table.ToString{...})end end;function d:load()end;function d:loadMediaObject(i,j,k)i._unresolvedUrl=j;i._service=self;i:setDefaultTag()hook.Run("Medialib_ProcessOpts",i,k or{})c.add(i)self:resolveUrl(j,function(l,m)i:openUrl(l)if m and m.start and(not k or not k.dontSeek)then i:seek(m.start)end end)end;function d:isValidUrl()end;function d:directQuery()end;local n={}n.__index=n;function n:addCallback(o)table.insert(self._callbacks,o)end;function n:run(p,q)local r=table.remove(self._callbacks,1)if not r then return end;r(p,q,function(s,t)self:run(s,t)end)end;function d:query(j,f)local u=setmetatable({_callbacks={}},n)u:addCallback(function(h,h,o)return self:directQuery(j,o)end)hook.Run("Medialib_ExtendQuery",j,u)u:addCallback(function(p,q)f(p,q)end)u:run(j)end;function d:parseUrl()end;function d:resolveUrl(j,o)o(j,self:parseUrl(j))end end;a.modulePlaceholder("timekeeper")do local b=a.load("oop")local c=b.class("TimeKeeper")function c:initialize()self:reset()end;function c:reset()self.cachedTime=0;self.running=false;self.runningTimeStart=0 end;function c:getTime()local d=self.cachedTime;if self.running then d=d+RealTime()-self.runningTimeStart end;return d end;function c:isRunning()return self.running end;function c:play()if self.running then return end;self.runningTimeStart=RealTime()self.running=true end;function c:pause()if not self.running then return end;local e=RealTime()-self.runningTimeStart;self.cachedTime=self.cachedTime+e;self.running=false end;function c:seek(d)self.cachedTime=d;if self.running then self.runningTimeStart=RealTime()end end end;a.modulePlaceholder("service_html")do local b=a.load("oop")a.load("timekeeper")local c=b.class("HTMLService","Service")function c:load(d,e)local f=b.class("HTMLMedia")()self:loadMediaObject(f,d,e)return f end;function c:hasReliablePlaybackEvents(g)return false end;local h={instances={}}local function i()return a.MAX_HTMLPOOL_INSTANCES or 0 end;hook.Add("MediaLib_HTMLPoolInfo",a.INSTANCE,function()print(a.INSTANCE.."> Free HTMLPool instance count: "..#h.instances.."/"..i())end)concommand.Add("medialib_htmlpoolinfo",function()hook.Run("MediaLib_HTMLPoolInfo")end)timer.Create("MediaLib."..a.INSTANCE..".HTMLPoolCleaner",60,0,function()if#h.instances==0 then return end;local j=table.remove(h.instances,1)if IsValid(j)then j:Remove()end end)function h.newInstance()return vgui.Create("DHTML")end;function h.get()if#h.instances==0 then if a.DEBUG then MsgN("[MediaLib] Returning new instance; htmlpool empty")end;return h.newInstance()end;local j=table.remove(h.instances,1)if not IsValid(j)then if a.DEBUG then MsgN("[MediaLib] Returning new instance; instance was invalid")end;return h.newInstance()end;if a.DEBUG then MsgN("[MediaLib] Returning an instance from the HTML pool")end;return j end;function h.free(j)if not IsValid(j)then return end;if#h.instances>=i()then if a.DEBUG then MsgN("[MediaLib] HTMLPool full; removing the freed instance")end;j:Remove()else if a.DEBUG then MsgN("[MediaLib] Freeing an instance to the HTMLPool")end;j:SetHTML("")table.insert(h.instances,j)end end;local k=CreateConVar("medialib_showallmessages","0")local l=b.class("HTMLMedia","Media")local m,n=1280,720;function l:initialize()self.timeKeeper=b.class("TimeKeeper")()self.panel=h.get()local o=self.panel;o:SetPos(0,0)o:SetSize(m,n)local p="MediaLib.HTMLMedia.FakeThink-"..self:hashCode()hook.Add("Think",p,function()if not IsValid(self.panel)then hook.Remove("Think",p)return end;self.panel:Think()end)local q=o._OldCM or o.ConsoleMessage;o._OldCM=q;o.ConsoleMessage=function(r,s)if s and not k:GetBool()then if string.find(s,"XMLHttpRequest",nil,true)then return end;if string.find(s,"Unsafe JavaScript attempt to access",nil,true)then return end;if string.find(s,"Unable to post message to",nil,true)then return end;if string.find(s,"ran insecure content from",nil,true)then return end;if string.find(s,"Mixed Content:",nil,true)then return end end;return q(r,s)end;o:AddFunction("console","warn",function(t)if not k:GetBool()then return end;o:ConsoleMessage(t)end)o:SetPaintedManually(true)o:SetVisible(false)o:AddFunction("medialiblua","Event",function(u,v)self:handleHTMLEvent(u,util.JSONToTable(v))end)end;function l:getBaseService()return"html"end;function l:openUrl(d)self.panel:OpenURL(d)self.URLChanged=CurTime()end;function l:runJS(w,...)local x=string.format(w,...)self.panel:QueueJavascript(x)end;function l:handleHTMLEvent(u,y)if a.DEBUG then MsgN("[MediaLib] HTML Event: "..u.." ("..table.ToString(y)..")")end;if u=="stateChange"then local z=y.state;local A;if y.time then self.timeKeeper:seek(y.time)end;if z=="playing"then A="playing"self.timeKeeper:play()elseif z=="ended"or z=="paused"or z=="buffering"then A=z;self.timeKeeper:pause()end;if A then self.state=A;self:emit(A)end elseif u=="playerLoaded"then for B,C in pairs(self.commandQueue or{})do C()end elseif u=="error"then self:emit("error",{errorId="service_error",errorName="Error from service: "..tostring(y.message)})else MsgN("[MediaLib] Unhandled HTML event "..tostring(u))end end;function l:getState()return self.state end;local D=CreateConVar("medialib_html_updatestride","1",FCVAR_ARCHIVE)function l:setUpdateStrideOverride(E)self._updateStrideOverride=E end;function l:updateTexture()local F=FrameNumber()local G=self._nextTextureUpdateFrame or 0;local H=self._updateStrideOverride or D:GetInt()if G<=F then self.panel:UpdateHTMLTexture()self._nextTextureUpdateFrame=F+H end end;function l:getHTMLMaterial()if self._htmlMat then return self._htmlMat end;local I=self.panel:GetHTMLMaterial()self._htmlMat=I;return I end;function l:draw(J,K,L,M)self:updateTexture()local I=self:getHTMLMaterial()if not I then return end;surface.SetMaterial(I)surface.SetDrawColor(255,255,255)local N,O=m/I:Width(),n/I:Height()surface.DrawTexturedRectUV(J or 0,K or 0,L or m,M or n,0,0,N,O)end;function l:getTime()return self.timeKeeper:getTime()end;function l:setQuality(P)if self.lastSetQuality and self.lastSetQuality==P then return end;self.lastSetQuality=P;self:runJS("medialibDelegate.run('setQuality', {quality: %q})",P)end;function l:applyVolume()local Q=self.internalVolume or 1;local R=self.volume or 1;local S=Q*R;if self.lastSetVolume and self.lastSetVolume==S then return end;self.lastSetVolume=S;self:runJS("medialibDelegate.run('setVolume', {vol: %f})",S)end;function l:setVolume(S)self.volume=S;self:applyVolume()end;function l:getVolume()return self.volume or 1 end;local T=0.2;function l:seek(U)self.timeKeeper:seek(U-T)self:runJS("medialibDelegate.run('seek', {time: %.1f})",U)end;function l:hasReliablePlaybackEvents()local V=self:getService()return V and V:hasReliablePlaybackEvents(self)end;function l:play()if not self:hasReliablePlaybackEvents()then self.timeKeeper:play()end;self:runJS("medialibDelegate.run('play')")end;function l:pause()if not self:hasReliablePlaybackEvents()then self.timeKeeper:pause()end;self:runJS("medialibDelegate.run('pause')")end;function l:stop()h.free(self.panel)self.panel=nil;self.timeKeeper:pause()self:emit("ended",{stopped=true})self:emit("destroyed")end;function l:runCommand(C)if self._playerLoaded then C()else self.commandQueue=self.commandQueue or{}self.commandQueue[#self.commandQueue+1]=C end end;function l:isValid()return IsValid(self.panel)end end;a.modulePlaceholder("service_bass")do local b=a.load("oop")local c=b.class("BASSService","Service")function c:load(d,e)local f=b.class("BASSMedia")()self:loadMediaObject(f,d,e)return f end;local g=b.class("BASSMedia","Media")function g:initialize()self.bassPlayOptions={"noplay","noblock"}self.commandQueue={}end;function g:getBaseService()return"bass"end;function g:updateFFT()local h=FrameNumber()if self._lastFFTUpdate and self._lastFFTUpdate==h then return end;self._lastFFTUpdate=h;local i=self.chan;if not IsValid(i)then return end;self.fftValues=self.fftValues or{}i:FFT(self.fftValues,FFT_512)end;function g:getFFT()return self.fftValues end;function g:draw(j,k,l,m)surface.SetDrawColor(0,0,0)surface.DrawRect(j,k,l,m)self:updateFFT()local n=self:getFFT()if not n then return end;local o=#n;local p=l/o;for q=1,o do surface.SetDrawColor(HSVToColor(q,0.9,0.5))local r=n[q]*m;surface.DrawRect(j+q*p,k+m-r,p,r)end end;function g:openUrl(d)self._openingInfo={"url",d}local s=table.concat(self.bassPlayOptions," ")sound.PlayURL(d,s,function(i,t,u)self:bassCallback(i,t,u)end)end;function g:openFile(v)self._openingInfo={"file",v}local s=table.concat(self.bassPlayOptions," ")sound.PlayFile(v,s,function(i,t,u)self:bassCallback(i,t,u)end)end;function g:reload()local w,x=unpack(self._openingInfo or{})if not w then MsgN("[Medialib] Attempting to reload BASS stream that was never started the first time!")return end;if IsValid(self.chan)then self.chan:Stop()self.chan=nil end;self._stopped=false;self:stopStateChecker()self.commandQueue={}MsgN("[Medialib] Attempting to reload BASS stream ",w,x)if w=="url"then self:openUrl(x)elseif w=="file"then self:openFile(x)elseif w then MsgN("[Medialib] Failed to reload audio resource ",w,x)return end;self:applyVolume(true)if self._commandState=="play"then self:play()end end;function g:bassCallback(i,t,u)if not IsValid(i)then ErrorNoHalt("[MediaLib] BassMedia play failed: ",u)self._stopped=true;self:emit("error","loading_failed",string.format("BASS error id: %s; name: %s",t,u))return end;if self._stopped then MsgN("[MediaLib] Loading BASS media aborted; stop flag was enabled")i:Stop()return end;self.chan=i;for y,z in pairs(self.commandQueue)do z(i)end;self.commandQueue={}self:startStateChecker()end;function g:startStateChecker()timer.Create("MediaLib_BASS_EndChecker_"..self:hashCode(),1,0,function()if IsValid(self.chan)and self.chan:GetState()==GMOD_CHANNEL_STOPPED then self:emit("ended")self:stopStateChecker()end end)end;function g:stopStateChecker()timer.Remove("MediaLib_BASS_EndChecker_"..self:hashCode())end;function g:runCommand(A)if IsValid(self.chan)then A(self.chan)else self.commandQueue[#self.commandQueue+1]=A end end;function g:applyVolume(B)local C=self.internalVolume or 1;local D=self.volume or 1;local E=C*D;if not B and self.lastSetVolume and self.lastSetVolume==E then return end;self.lastSetVolume=E;self:runCommand(function(i)i:SetVolume(E)end)end;function g:setVolume(E)self.volume=E;self:applyVolume()end;function g:getVolume()return self.volume or 1 end;function g:seek(F)self:runCommand(function(i)if i:IsBlockStreamed()then return end;self._seekingTo=F;local G="MediaLib_BASSMedia_Seeker_"..self:hashCode()local function H()if self._seekingTo~=F or not IsValid(i)then timer.Destroy(G)return end;i:SetTime(F)if math.abs(i:GetTime()-F)<0.25 then timer.Destroy(G)end end;timer.Create(G,0.2,0,H)H()end)end;function g:getTime()if self:isValid()and IsValid(self.chan)then return self.chan:GetTime()end;return 0 end;function g:getState()if not self:isValid()then return"error"end;if not IsValid(self.chan)then return"loading"end;local I=self.chan:GetState()if I==GMOD_CHANNEL_PLAYING then return"playing"end;if I==GMOD_CHANNEL_PAUSED then return"paused"end;if I==GMOD_CHANNEL_STALLED then return"buffering"end;if I==GMOD_CHANNEL_STOPPED then return"paused"end;return end;function g:play()self:runCommand(function(i)i:Play()self:emit("playing")self._commandState="play"end)end;function g:pause()self:runCommand(function(i)i:Pause()self:emit("paused")self._commandState="pause"end)end;function g:stop()self._stopped=true;self:runCommand(function(i)i:Stop()self:emit("ended",{stopped=true})self:emit("destroyed")self:stopStateChecker()end)end;function g:isValid()return not self._stopped end;local J=a.load("mediaregistry")local K="ML_MapCleanHack_"..a.INSTANCE;if CLIENT then net.Receive(K,function()for y,L in pairs(J.get())do if L:getBaseService()=="bass"and L:isValid()and IsValid(L.chan)and L.chan:GetState()==GMOD_CHANNEL_STOPPED then L:reload()end end end)end;if SERVER then util.AddNetworkString(K)hook.Add("PostCleanupMap","MediaLib_BassReload"..a.INSTANCE,function()net.Start(K)net.Broadcast()end)end end;a.FolderItems["services/gdrive.lua"]="local a=medialib.load(\"oop\")local b=a.class(\"GDriveService\",\"HTMLService\")b.identifier=\"GDrive\"local c={\"^https?://drive.google.com/file/d/([^/]*)/edit\"}function b:parseUrl(d)for e,f in pairs(c)do local g=string.match(d,f)if g then return{id=g}end end end;function b:isValidUrl(d)return self:parseUrl(d)~=nil end;local function h(i)if i then i=string.gsub(i,\"\\n\",\"\\r\\n\")i=string.gsub(i,\"([^%w ])\",function(j)return string.format(\"%%%02X\",string.byte(j))end)i=string.gsub(i,\" \",\"+\")end;return i end;local k=\"https://wyozi.github.io/gmod-medialib/mp4.html?id=%s\"local l=\"https://drive.google.com/uc?export=download&confirm=yTib&id=%s\"function b:resolveUrl(d,m)local n=self:parseUrl(d)local o=string.format(k,h(string.format(l,n.id)))m(o,{start=n.start})end;function b:directQuery(d,m)m(nil,{title=d:match(\"([^/]+)$\")})end;function b:hasReliablePlaybackEvents()return true end;return b"a.FolderItems["services/mp4.lua"]="local a=medialib.load(\"oop\")local b=a.class(\"Mp4Service\",\"HTMLService\")b.identifier=\"mp4\"local c={\"^https?://.*%.mp4\"}function b:parseUrl(d)for e,f in pairs(c)do local g=string.match(d,f)if g then return{id=g}end end end;function b:isValidUrl(d)return self:parseUrl(d)~=nil end;local h=\"https://wyozi.github.io/gmod-medialib/mp4.html?id=%s\"function b:resolveUrl(d,i)local j=self:parseUrl(d)local k=string.format(h,j.id)i(k,{start=j.start})end;function b:directQuery(d,i)i(nil,{title=d:match(\"([^/]+)$\")})end;function b:hasReliablePlaybackEvents()return true end;return b"a.FolderItems["services/soundcloud.lua"]="local a=medialib.load(\"oop\")local b=a.class(\"SoundcloudService\",\"BASSService\")b.identifier=\"soundcloud\"local c={\"^https?://www.soundcloud.com/([A-Za-z0-9_%-]+/[A-Za-z0-9_%-]+)/?.*$\",\"^https?://soundcloud.com/([A-Za-z0-9_%-]+/[A-Za-z0-9_%-]+)/?.*$\"}local d=\"^https?://api.soundcloud.com/tracks/(%d+)\"function b:parseUrl(e)for f,g in pairs(c)do local h=string.match(e,g)if h then return{path=h}end end;local i=string.match(e,d)if i then return{id=i}end end;function b:isValidUrl(e)return self:parseUrl(e)~=nil end;function b:resolveUrl(e,j)local k=medialib.SOUNDCLOUD_API_KEY;if not k then ErrorNoHalt(\"SoundCloud error: Missing SoundCloud API key\")return end;if type(k)==\"table\"then k=table.Random(k)end;local l=self:parseUrl(e)if l.id then j(string.format(\"https://api.soundcloud.com/tracks/%s/stream?client_id=%s\",l.id,k),{})else http.Fetch(string.format(\"https://api.soundcloud.com/resolve.json?url=http://soundcloud.com/%s&client_id=%s\",l.path,k),function(m)local n=util.JSONToTable(m)if not n then ErrorNoHalt(\"Failed to retrieve SC track id for \"..l.path..\": empty JSON\")return end;local i=n.id;j(string.format(\"https://api.soundcloud.com/tracks/%s/stream?client_id=%s\",i,k),{})end)end end;function b:directQuery(e,j)local k=medialib.SOUNDCLOUD_API_KEY;if not k then j(\"Missing SoundCloud API key\")return end;if type(k)==\"table\"then k=table.Random(k)end;local l=self:parseUrl(e)local o;if l.path then o=string.format(\"https://api.soundcloud.com/resolve.json?url=http://soundcloud.com/%s&client_id=%s\",l.path,k)else o=string.format(\"https://api.soundcloud.com/tracks/%s?client_id=%s\",l.id,k)end;http.Fetch(o,function(p,q)if q==0 then j(\"http body size = 0\")return end;local r=util.JSONToTable(p)if r.errors then local s=r.errors[1].error_message or\"error\"local t=s;if string.StartWith(s,\"404\")then t=\"Invalid id\"end;j(t)return end;j(nil,{title=r.title,duration=tonumber(r.duration)/1000})end,function(u)j(\"HTTP: \"..u)end)end;return b"a.FolderItems["services/twitch.lua"]="local a=medialib.load(\"oop\")local b=a.class(\"TwitchService\",\"HTMLService\")b.identifier=\"twitch\"local c={\"https?://www.twitch.tv/([A-Za-z0-9_%-]+)\",\"https?://twitch.tv/([A-Za-z0-9_%-]+)\"}function b:parseUrl(d)for e,f in pairs(c)do local g=string.match(d,f)if g then return{id=g}end end end;function b:isValidUrl(d)return self:parseUrl(d)~=nil end;local h=\"https://wyozi.github.io/gmod-medialib/twitch.html?channel=%s\"function b:resolveUrl(d,i)local j=self:parseUrl(d)local k=string.format(h,j.id)i(k,{start=j.start})end;local l=\"4cryixome326gh0x0j0fkulahsbdvx\"local function m(n,i)http.Fetch(\"https://api.twitch.tv/kraken/users?login=\"..n,function(o)local p=util.JSONToTable(o)if not p then i(\"malformed response JSON\")return end;i(nil,p.users[1]._id)end,function()i(\"failed HTTP request\")end,{Accept=\"application/vnd.twitchtv.v5+json\",[\"Client-ID\"]=l})end;local function q(g,i)http.Fetch(\"https://api.twitch.tv/kraken/channels/\"..g,function(o)local p=util.JSONToTable(o)if not p then i(\"malformed response JSON\")return end;i(nil,p)end,function()i(\"failed HTTP request\")end,{Accept=\"application/vnd.twitchtv.v5+json\",[\"Client-ID\"]=l})end;function b:directQuery(d,i)local j=self:parseUrl(d)m(j.id,function(r,g)if r then i(r)return end;q(g,function(s,t)if s then i(s)return end;local u={}u.id=j.id;if t.error then i(t.message)return else u.title=t.display_name..\": \"..t.status end;i(nil,u)end)end)end;return b"a.FolderItems["services/vimeo.lua"]="local a=medialib.load(\"oop\")local b=a.class(\"VimeoService\",\"HTMLService\")b.identifier=\"vimeo\"local c={\"https?://www.vimeo.com/([0-9]+)\",\"https?://vimeo.com/([0-9]+)\",\"https?://www.vimeo.com/channels/staffpicks/([0-9]+)\",\"https?://vimeo.com/channels/staffpicks/([0-9]+)\"}function b:parseUrl(d)for e,f in pairs(c)do local g=string.match(d,f)if g then return{id=g}end end end;function b:isValidUrl(d)return self:parseUrl(d)~=nil end;local h=\"http://wyozi.github.io/gmod-medialib/vimeo.html?id=%s\"function b:resolveUrl(d,i)local j=self:parseUrl(d)local k=string.format(h,j.id)i(k,{start=j.start})end;function b:directQuery(d,i)local j=self:parseUrl(d)local l=string.format(\"http://vimeo.com/api/v2/video/%s.json\",j.id)http.Fetch(l,function(m,n,o,p)if n==0 then i(\"http body size = 0\")return end;if p==404 then i(\"Invalid id\")return end;local q={}q.id=j.id;local r=util.JSONToTable(m)if r then q.title=r[1].title;q.duration=r[1].duration else q.title=\"ERROR\"end;i(nil,q)end,function(s)i(\"HTTP: \"..s)end)end;function b:hasReliablePlaybackEvents()return true end;return b"a.FolderItems["services/webaudio.lua"]="local a=medialib.load(\"oop\")local b=a.class(\"WebAudioService\",\"BASSService\")b.identifier=\"webaudio\"local c={\"^https?://(.*)%.mp3\",\"^https?://(.*)%.ogg\"}function b:parseUrl(d)for e,f in pairs(c)do local g=string.match(d,f)if g then return{id=g}end end end;function b:isValidUrl(d)return self:parseUrl(d)~=nil end;function b:resolveUrl(d,h)h(d,{})end;function b:directQuery(d,h)h(nil,{title=d:match(\"([^/]+)$\")})end;return b"a.FolderItems["services/webm.lua"]="local a=medialib.load(\"oop\")local b=a.class(\"WebmService\",\"HTMLService\")b.identifier=\"webm\"local c={\"^https?://.*%.webm\"}function b:parseUrl(d)for e,f in pairs(c)do local g=string.match(d,f)if g then return{id=g}end end end;function b:isValidUrl(d)return self:parseUrl(d)~=nil end;local h=\"http://wyozi.github.io/gmod-medialib/webm.html?id=%s\"function b:resolveUrl(d,i)local j=self:parseUrl(d)local k=string.format(h,j.id)i(k,{start=j.start})end;function b:directQuery(d,i)i(nil,{title=d:match(\"([^/]+)$\")})end;return b"a.FolderItems["services/webradio.lua"]="local a=medialib.load(\"oop\")local b=a.class(\"WebRadioService\",\"BASSService\")b.identifier=\"webradio\"local c={\"^https?://(.*)%.pls\",\"^https?://(.*)%.m3u\"}function b:parseUrl(d)for e,f in pairs(c)do local g=string.match(d,f)if g then return{id=g}end end end;function b:isValidUrl(d)return self:parseUrl(d)~=nil end;function b:resolveUrl(d,h)h(d,{})end;function b:directQuery(d,h)h(nil,{title=d:match(\"([^/]+)$\")})end;return b"a.FolderItems["services/youtube.lua"]="local a=medialib.load(\"oop\")local b=a.class(\"YoutubeService\",\"HTMLService\")b.identifier=\"youtube\"local c={\"^https?://[A-Za-z0-9%.%-]*%.?youtu%.be/([A-Za-z0-9_%-]+)\",\"^https?://[A-Za-z0-9%.%-]*%.?youtube%.com/watch%?.*v=([A-Za-z0-9_%-]+)\",\"^https?://[A-Za-z0-9%.%-]*%.?youtube%.com/v/([A-Za-z0-9_%-]+)\"}local d={}for e,f in pairs(c)do local function g(h)table.insert(d,f..h..\"t=(%d+)m(%d+)s\")table.insert(d,f..h..\"t=(%d+)s?\")end;g(\"#\")g(\"&\")g(\"?\")table.insert(d,f)end;function b:parseUrl(i)for e,j in pairs(d)do local k,l,m=string.match(i,j)if k then local n;if l and m then n=tonumber(l)*60+tonumber(m)else n=tonumber(l)end;return{id=k,start=n}end end end;function b:isValidUrl(i)return self:parseUrl(i)~=nil end;local o=\"http://wyozi.github.io/gmod-medialib/youtube.html?id=%s\"function b:resolveUrl(i,p)local q=self:parseUrl(i)local r=string.format(o,q.id)p(r,{start=q.start})end;local function s(t)local u=t:match(\"(%d+)H\")or 0;local v=t:match(\"(%d+)M\")or 0;local w=t:match(\"(%d+)S\")or 0;return u*60*60+v*60+w end;local x=\"AIzaSyBmQHvMSiOTrmBKJ0FFJ2LmNtc4YHyUJaQ\"function b:directQuery(i,p)local y=medialib.YOUTUBE_API_KEY or x;local q=self:parseUrl(i)local z=string.format(\"https://www.googleapis.com/youtube/v3/videos?part=snippet%%2CcontentDetails&id=%s&key=%s\",q.id,y)http.Fetch(z,function(A,B)if B==0 then p(\"http body size = 0\")return end;local C={}C.id=q.id;local D=util.JSONToTable(A)if D and D.items then local E=D.items[1]if not E then p(\"No video id found\")return end;C.title=E.snippet.title;local F=E.snippet.liveBroadcastContent==\"live\"if F then C.live=true else C.duration=tonumber(s(E.contentDetails.duration))end;C.raw=E else p(A)return end;p(nil,C)end,function(G)p(\"HTTP: \"..G)end)end;function b:hasReliablePlaybackEvents()return true end;return b"a.modulePlaceholder("serviceloader")do a.load("servicebase")a.load("service_html")a.load("service_bass")local b=a.load("media")for c,d in a.folderIterator("services")do if a.DEBUG then print("[MediaLib] Registering service "..d.name)end;if SERVER then d:addcs()end;local e,f=pcall(function()return d:load()end)if e then b.registerService(f.identifier,f)else print("[MediaLib] Failed to load service ",d,": ",f)end end end;a.modulePlaceholder("__loader")do a.load("mediabase")a.load("media")a.load("serviceloader")end;return a |
Locales['fi'] = {
['show_active_character'] = 'Näytä nykyinen hahmosi',
['active_character'] = 'Nykyinen hahmosi: ~b~%s~s~',
['error_active_character'] = "Hahmosi hakemisessa ilmeni ongelma. Ota yhteyttä ylläpitoon.",
['delete_character'] = 'Poista hahmosi ja luo uusi.',
['deleted_character'] = 'Hahmosi on poistetu.',
['error_delete_character'] = "Hahmosi poistossa ilmeni ongelma. Ota yhteyttä ylläpitoon.",
['thank_you_for_registering'] = "Kiitos registeröitymisestä. Pidä hauskaa!",
['registration_error'] = "Registeröinnissä ilmeni ongelma. Ota yhteyttä ylläpitoon.",
['debug_xPlayer_get_first_name'] = "Palauta etunimi",
['debug_xPlayer_get_last_name'] = "Palauta sukunimi",
['debug_xPlayer_get_full_name'] = "Palauta kokonimi",
['debug_xPlayer_get_sex'] = "Palauta sukupuoli",
['debug_xPlayer_get_dob'] = "Palauta syntymäpäivä",
['debug_xPlayer_get_height'] = "Palauta pituus",
['error_debug_xPlayer_get_first_name'] = "Hahmosi etunimen haussa ilmeni ongelma.",
['error_debug_xPlayer_get_last_name'] = "Hahmosi sukunimen haussa ilmeni ongelma.",
['error_debug_xPlayer_get_full_name'] = "Hahmosi kokonimen haussa ilmeni ongelma.",
['error_debug_xPlayer_get_sex'] = "Hahmosi sukupuolen haussa ilmeni ongelma.",
['error_debug_xPlayer_get_dob'] = "Hahmosi syntymäpäivän haussa ilmeni ongelma.",
['error_debug_xPlayer_get_height'] = "Hahmosi pituuden haussa ilmeni ongelma.",
['return_debug_xPlayer_get_first_name'] = "Etunimi: ~b~%s",
['return_debug_xPlayer_get_last_name'] = "Sukunimi: ~b~%s",
['return_debug_xPlayer_get_full_name'] = "Kokonimi: ~b~%s",
['return_debug_xPlayer_get_sex'] = "Sukupuoli: ~b~%s",
['return_debug_xPlayer_get_dob'] = "Syntymäpäivä: ~b~%s",
['return_debug_xPlayer_get_height'] = "Pituus: ~b~%s CM",
['data_incorrect'] = 'Data syötetty väärin. Yritä uudelleen.',
['invalid_format'] = 'Data syötetty väärässä muodossa. Yritä uudelleen.',
['no_identifier'] = 'Hahmosi lataamisessa ilmeni ongelma!\nVirhekoodi: identifier-missing\n\nVirhekoodin syytä ei tiedetä, joten ota yhteyttä ylläpitoon.',
['missing_identity'] = 'Hahmosi lataamisessa ilmeni ongelma!\nError code: identity-missing\n\nNäyttää että hahmoasi ei ole olemassa. Kokeile yhdistää uudelleen tai ota yhteyttä ylläpitoon',
['deleted_identity'] = 'Hahmosi on poistetu. Yhdistä uudestaan palvelimelle luodaksesi uuden hahmosi.'
}
|
local gcc = require("gcc")
local cdecl = require("gcc.cdecl")
local fficdecl = require("ffi-cdecl")
-- send assembler output to /dev/null
gcc.set_asm_file_name(gcc.HOST_BIT_BUCKET)
-- Captured C declarations.
local decls = {}
-- Type declaration identifiers.
local types = {}
-- Parse C declaration from capture macro.
gcc.register_callback(gcc.PLUGIN_PRE_GENERICIZE, function(node)
local decl, id = fficdecl.parse(node)
local op = node:name():value():match("^cdecl_(.-)__(.+)")
if decl then
if decl:class() == "type" or decl:code() == "type_decl" then
types[decl] = id
if (id == 'bool') then
return
end
end
table.insert(decls, {decl = decl, id = id})
end
end)
local function format_helper(node)
if node == decl then return id end
return types[node]
end
local function format(decl, id)
if decl:class() == "constant" then
return "static const int " .. id .. " = " .. decl:value()
end
if decl:class() == "type" and decl:code() == "enumeral_type" then
return string.format([[struct enum_%s {
%s;
}]], id, cdecl.declare(decl, format_helper))
end
return cdecl.declare(decl, format_helper)
end
local decl_names = {}
-- invoke Lua function after translation unit has been parsed
gcc.register_callback(gcc.PLUGIN_FINISH_UNIT, function()
-- get global variables in reverse order of declaration
local vars = gcc.get_variables()
for i = #vars, 1, -1 do
-- initial value is a string constant
--print(vars[i]:initial():value())
end
local result = {}
for i, decl in ipairs(decls) do
local res = format(decl.decl, decl.id) .. ";"
decl_names[decl.id] = (decl_names[decl.id] or '\n')..res..'\n'
result[i] = res.."\n\n"
end
print[=[local all_types=[[]=]
print(table.concat(result))
print[=[]]]=]
print('return {all_types = all_types}')
-- print('local pg_import = {}')
-- for k, v in pairs(decl_names) do
-- print(string.format("pg_import['%s'] = [[%s]]",k,v))
-- end
-- print[=[
-- local ffi = require('ffi')
-- pg_import.import = function(t)
-- local tnamed = {}
-- for i = 1, #t do
-- table.insert(tnamed, pg_import[t[i]])
-- end
-- return(table.concat(tnamed))
-- end
--
-- pg_import.all_types = all_types
-- ]=]
-- print('return pg_import')
-- print([[--total ]]..#result)
end)
|
---
-- The internal __striter module.
-- It allows creating striter objects, which can be used to iterate through a
-- string.
-- @classmod striter
---
local m = {}
m.__index = m
--- Create a new striter object.
-- @function __striter.new
-- @tparam string|file arg the source of data for the striter
-- @treturn striter the striter object
function m.new(arg)
if io.type(arg) == "file" then
local file = arg
arg = file:read("a*")
file:close()
end
if type(arg) ~= "string" then
return nil, "Input must be an open file or a string."
end
local self = setmetatable({}, m)
self.__index = 0
self.__string = arg
return self
end
--- Advance a character in the iterator
-- @function striter:next
-- @treturn string|nil the next character
function m:next()
self.__index = self.__index + 1
local value = self.__string:sub(self.__index, self.__index)
return #value ~= 0 and value or nil
end
--- Peek the next characters
-- @function striter:peek
-- @tparam[opt] int n the characters to peek (default is 1)
-- @treturn string|nil the peeked characters
function m:peek(n)
if n == nil then
n = 1
end
local value = self.__string:sub(self.__index+1, self.__index+n)
return #value ~= 0 and value or nil
end
return m
|
vim.o.shell = '/usr/bin/bash'
vim.o.showmatch = true
vim.o.hidden = true
vim.o.errorbells = false
vim.o.tabstop = 2
vim.o.softtabstop = 2
vim.o.shiftwidth = 2
vim.o.expandtab = true
vim.o.smartindent = true
vim.o.smarttab = true
vim.o.wrap = false
vim.o.swapfile = false
vim.o.backup = false
vim.o.updatetime = 50
vim.o.showmode = false
vim.o.showcmd = false
vim.o.cmdheight = 1
vim.o.scrolloff = 8
vim.o.clipboard = 'unnamedplus'
vim.o.incsearch = true
vim.o.inccommand = 'split'
vim.o.signcolumn = 'auto'
vim.o.completeopt = 'menu,menuone,noselect'
vim.o.mouse = 'nvr'
vim.o.list = true
vim.o.listchars = 'tab:»·,trail:·'
-- folds
vim.wo.foldcolumn = '1'
vim.wo.foldmethod = 'expr'
vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'
vim.o.foldlevel = 99
-- line numbers
vim.wo.number = true
vim.wo.relativenumber = true
vim.cmd [[set shortmess+=c]]
vim.g.mapleader = ' '
|
object_draft_schematic_weapon_rifle_bowcaster_master = object_draft_schematic_weapon_shared_rifle_bowcaster_master:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_weapon_rifle_bowcaster_master, "object/draft_schematic/weapon/rifle_bowcaster_master.iff")
|
HashMap = require("com.blacksheepherd.util.HashMap")
return {
{
selectorStack = {
{
class = "Red"
}
},
properties = HashMap({
BrickColor = "255, 0, 0"
})
}
} |
return function(l)
local version = "0.1"
-- Add version info
l:addOp('version')
-- Get version info to client when it requests it
l:addProcessOnServer('version',function(self,peer,arg,storage)
return version
end)
-- Process version information on client side
l:addProcessOnClient('version',function(self,peer,arg,storage)
if version == arg then
return true
else
return "Version mismatch!\n\nClient: "..tostring(arg).."\nServer: "..tostring(version)
end
end)
-- What to do while it waits for version information
l:addDefaultOnClient('version',function(self,peer,arg,storage)
return "Waiting for version information"
end)
local isValidString = function(input)
local utf8 = require("utf8")
local success = utf8.len(input)
return success
end
-- Add a way to name users
l:addOp('whoami')
-- Validate the name argument
l:addValidateOnServer('whoami',{name="string"})
-- Store the user's name in the user data
l:addProcessOnServer('whoami',function(self,peer,arg,storage)
local user = self:getUser(peer)
self:log("event","Rename: "..tostring(user.name).." => "..tostring(arg.name))
if isValidString(arg.name) then
user.name = arg.name
end
end)
-- Add a way to send the current user's position
l:addOp('pos')
-- Validate the x and y arguments as numbers
l:addValidateOnServer('pos',{x="number",y="number"})
-- Store the position of the user in the user data
l:addProcessOnServer('pos',function(self,peer,arg,storage)
local user = self:getUser(peer)
user.x = arg.x
user.y = arg.y
end)
-- Add a way to inform all clients where all players are
l:addOp('p')
-- Create a table containing the name, x and y of each user
l:addProcessOnServer('p',function(self,peer,arg,storage)
local info = {}
for i,v in pairs(self:getUsers()) do
if v.x and v.y then
table.insert(info,{name=v.name,x=v.x,y=v.y})
end
end
-- Return it to the requester
return info
end)
-- Validate that the data is indeed a table containing users with name,x and y
l:addValidateOnClient('p',function(self,peer,arg,storage)
if type(arg) ~= "table" then return false,"root expecting table" end
for i,v in pairs(arg) do
if type(v.name) ~= "string" then return false,"v.name expecting string" end
if type(v.x) ~= "number" then return false,"v.x expecting number" end
if type(v.y) ~= "number" then return false,"v.y expecting number" end
end
return true
end)
-- Provide an empty table by default when a client requests the players
l:addDefaultOnClient('p',function(self,peer,arg,storage)
return {}
end)
-- Get board updates
l:addOp('b')
l:addValidateOnServer('b',"number")
l:addProcessOnServer('b',function(self,peer,arg,storage)
local ret = {}
for x,row in pairs(storage.board or {}) do
for y,val in pairs(row) do
if val.u >= arg then
table.insert(ret,{x=x,y=y,u=val.u,r=val.r,g=val.g,b=val.b})
end
end
end
return ret
end)
l:addOp('draw')
local check_dim = function(data)
if type(data) ~= "number" then return false,"data expecting number" end
if math.floor(data) ~= data then return false,"data expecting int" end
if data < 1 or data > board_size then
return false,"data expecting 1-"..board_size
end
return true
end
local check_color_part = function(data)
if type(data) ~= "number" then return false,"data expecting number" end
if math.floor(data) ~= data then return false,"data expecting int" end
if data < 0 or data > 255 then
return false,"data expecting 0-255"
end
return true
end
l:addValidateOnServer('draw',{
x=check_dim,y=check_dim,
r=check_color_part,g=check_color_part,b=check_color_part,
})
l:addProcessOnServer('draw',function(self,peer,arg,storage)
storage.board = storage.board or {}
storage.board[arg.x] = storage.board[arg.x] or {}
if storage.board[arg.x][arg.y] then
if storage.board[arg.x][arg.y].r == arg.r and
storage.board[arg.x][arg.y].g == arg.g and
storage.board[arg.x][arg.y].b == arg.b then
-- nop
else
storage.board[arg.x][arg.y] = {
r=arg.r,g=arg.g,b=arg.b,
u=storage.draw_index or 0,
}
end
else
storage.board[arg.x][arg.y] = {
r=arg.r,g=arg.g,b=arg.b,
u=storage.draw_index or 0,
}
end
storage.draw_index = ( storage.draw_index or 0 ) + 1
end)
end
|
-- This generated buttons for the camera switcher guis, put it in a separete
-- module because both Static and Moving cameras use it
local utils = require(script.Parent.Utils)
local button = require(script.Parent.Parent.GuiComponents.RoundedButton)
local smoothGrid = require(script.Parent.SmoothGrid)
local other = {}
function other:generateButtonsForFolder(folder: Folder, parent: GuiObject, camType: string)
local frame = utils:NewInstance("Frame", {
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
AutomaticSize = Enum.AutomaticSize.Y,
Parent = parent,
})
local grid = utils:NewInstance("UIGridLayout", {
CellSize = UDim2.fromOffset(100, 30),
Parent = frame,
})
for i, v in pairs(folder:GetChildren()) do
local button = button(v.Name)
button.Parent = frame
button.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Events.ChangeCam:FireServer(camType, v:GetAttribute("ID"))
end)
end
smoothGrid(frame, grid)
end
return other
|
Pipe= Class{}
local pipe_image=love.graphics.newImage('pipe.png')
local pipe_scroll=-60
pipe_height=288
pipe_width=70
function Pipe:init(y)
self.scored=false
self.x=virtual_width
self.y=y
self.width=pipe_image:getWidth()
self.height=pipe_image:getWidth()
end
function Pipe:update(dt)
self.x=self.x+pipe_scroll*dt
if bird.y+bird.height>virtual_height-16 or bird.y<0 then
gStatemachine:change('score')
sounds['collision']:play()
scrolling=true
bird.y=virtual_height/2-(self.height/2)
end
if bird.x<=self.x+pipe_width and bird.x+bird.width>=self.x then
if (bird.y>=self.y and bird.y+bird.height<=pipe_gap+self.y) or (bird.y+bird.height <=self.y and bird.y>=self.y-pipe_gap)then
return false
else
return true
end
end
end
function Pipe:render(o)
if o==1 then
love.graphics.draw(pipe_image,self.x,self.y,0,1,-1)
else
love.graphics.draw(pipe_image,self.x,self.y,0,1,1)
end
end
|
-- NO TOUCHY, IF SOMETHING IS WRONG CONTACT KANERSPS! --
-- NO TOUCHY, IF SOMETHING IS WRONG CONTACT KANERSPS! --
-- NO TOUCHY, IF SOMETHING IS WRONG CONTACT KANERSPS! --
-- NO TOUCHY, IF SOMETHING IS WRONG CONTACT KANERSPS! --
-- Global variables
Users = {}
commands = {}
settings = {}
settings.defaultSettings = {
['pvpEnabled'] = false,
['permissionDenied'] = false,
['debugInformation'] = false,
['startingCash'] = 0,
['startingBank'] = 0,
['enableRankDecorators'] = false,
['moneyIcon'] = "$",
['nativeMoneySystem'] = false,
['commandDelimeter'] = '/',
['enableLogging'] = false,
['enableCustomData'] = GetConvar('es_enableCustomData', 'false')
}
settings.sessionSettings = {}
commandSuggestions = {}
function stringsplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
function startswith(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
function returnIndexesInTable(t)
local i = 0;
for _,v in pairs(t)do
i = i + 1
end
return i;
end
function debugMsg(msg)
if(settings.defaultSettings.debugInformation and msg)then
print("ES_DEBUG: " .. msg)
end
end
function logExists(date, cb)
Citizen.CreateThread(function()
local log = LoadResourceFile(GetCurrentResourceName(), "logs/" .. date .. ".txt")
if log then cb(true) else cb(false) end
return
end)
end
function doesLogExist(cb)
logExists(string.gsub(os.date('%x'), '(/)', '-'), function(exists)
Citizen.CreateThread(function()
if not exists then
local file = SaveResourceFile(GetCurrentResourceName(), "logs/" .. string.gsub(os.date('%x'), '(/)', '-') .. ".txt", '-- Begin of log for ' .. string.gsub(os.date('%x'), '(/)', '-') .. ' --\n', -1)
end
cb(exists)
log('== EssentialMode started, version ' .. _VERSION .. ' ==')
return
end)
end)
end
Citizen.CreateThread(function()
if settings.defaultSettings.enableLogging then doesLogExist(function()end) end
return
end)
function log(log)
if settings.defaultSettings.enableLogging then
Citizen.CreateThread(function()
local file = LoadResourceFile(GetCurrentResourceName(), "logs/" .. string.gsub(os.date('%x'), '(/)', '-') .. ".txt")
if file then
SaveResourceFile(GetCurrentResourceName(), "logs/" .. string.gsub(os.date('%x'), '(/)', '-') .. ".txt", file .. log .. "\n", -1)
return
end
end)
end
end
AddEventHandler("es:debugMsg", debugMsg) |
local _, L = ...;
if GetLocale() ~= "esES" then return end
L["Actions"] = "Acciones"
L["Alive"] = "Vivo"
L["Any"] = "Cualquiera"
L["Are you sure you want to delete filter set?"] = "¿Seguro que quieres borrar este conjunto de filtros?"
L["At least one word"] = "Por lo menos una palabra"
--Translation missing
-- L["Attention! Update interval shorter than 15 seconds may cause the game to run slow and impact your gaming experience!!!"] = ""
L["Boss status colors"] = "Colores de estado de los jefes"
L["By hiding the window you can activate background search so you can do anything else in the game."] = "Al esconder la ventana puedes activar la búsqueda en segundo plano para poder hacer otras cosas en el juego."
L["Click [+] to open window within extended features."] = "Haz clic en [+] para abrir la ventana sin las características ampliadas."
L["Defeated"] = "Derrotado"
L["Define minimum and/or maximum number of players of any role."] = "Escoge la cantidad máxima y/o mínima de roles de personajes."
L["Enable sound notifications"] = "Activar notificaciones de sonido"
L["Enter filter set name"] = "Nombre del conjunto de filtros"
L["Enter the words you want to be present or absent in group title and comment."] = "Escribe las palabras que quieres que aparezcan o no en el título del grupo y comenta."
L["Exclude words"] = "Excluir palabras"
L["EXPERIMENTAL"] = "DE PRUEBAS"
L["Filter set"] = "Conjunto de filtros"
L["For example if you are a tank you can set maximum number of tanks to 1 and you get the groups you are guaranteed to have a spot."] = "Por ejemplo, si eres un tanque puedes establecer el máximo número de tanques a 1 y te saldrán los grupos que tienen ese sitio libre."
L["found new group"] = "Nuevo grupo encontrado"
L["found new player"] = "Nuevo jugador encontrado"
L["If a group is not created by the addon this option is ignored."] = "Si no sea crea un grupo con esta extensión, esta opción no está disponible."
L["If you want to join a group of highly equipped characters you can setup minimum item level defined for its members."] = "Si te quieres unir a un grupo de personajes bien equipados puedes establecer un nivel de objeto mínimo para sus miembros."
L["Include words"] = "Incluir palabras"
L["Monitor new groups in background?"] = "¿Monitorizar grupos nuevos en segundo plano?"
L["Monitoring"] = "Monitorizando"
L["More"] = "Más"
L["More options"] = "Más opciones"
L["New filter set"] = "Nuevo conjunto de filtros"
L["New version available"] = "Nueva versión disponible"
L["Notifications"] = "Notificaciones"
L["Notify in chat on new group"] = "Notificación de chat al encontrar un grupo nuevo"
L["Notify in chat on new player"] = "Notificación de chat al encontrar un jugador nuevo"
L["Select group activity: quest, dungeon, raid, difficulty"] = "Selecciona una actividad de grupo: misión, mazmorra, banda, dificultad"
L["Select the roles you can fulfill."] = "Selecciona los roles que puedes cumplir."
L["The addon notifies you if it finds a group that matches your requirements."] = "La extensión te notifica si encuentra algún grupo que cumpla tus requisitos."
L["The filters take effect when you click this button. The changes don't take effect until you do that."] = "El filtro empieza a funcionar cuando haces clic en este botón. Los cambios no se guardarán hasta que hagas clic aquí."
L["The words you don't want"] = "Palabras que no quieres"
L["The words you want"] = "Palabras que quieres"
L["Update interval (sec.)"] = "Intervalo de actualización (seg.)"
L["Want to find a mythic raid? Choose your realm only."] = "¿Quieres encontrar una banda mítica? Escoge solamente tu reino."
L["Works only on premades created with Premade Filter addon"] = "Solo funciona en grupos creados con la extensión Premade Filter"
L["You can find a group that uses specific voice chat software or a group tha doesn't use voice chat at all."] = "Puedes encontrar un grupo que use un software de voz específico en los chats o un grupo que no usa chats de voz."
L["You can mark the bosses you want to be still alive with [v] and the bosses you want to be already defeated by [-]."] = "Puedes seleccionar a los jefes que quieras mantener con vida con [v] y a los jefes que quieras que estén derrotados con [-]."
L["You can save the filters to use them in future."] = "Puedes guardar los filtros para usarlos en el futuro."
L["You want at least one of these words"] = "Por lo menos una de estas palabras"
|
function Client_PresentSettingsUI(rootParent)
UI.CreateLabel(rootParent)
.SetText('Commanderplayer StartArmies: ' .. Mod.Settings.StartArmies);
end
|
object_tangible_loot_creature_loot_collections_space_capacitor_mark_05_moncal = object_tangible_loot_creature_loot_collections_space_shared_capacitor_mark_05_moncal:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_space_capacitor_mark_05_moncal, "object/tangible/loot/creature/loot/collections/space/capacitor_mark_05_moncal.iff")
|
FPP = FPP or {}
surface.CreateFont("TabLarge", {
size = 17,
weight = 700,
antialias = true,
shadow = false,
font = "Trebuchet MS"})
hook.Add("CanTool", "FPP_CL_CanTool", function(ply, trace, tool) -- Prevent client from SEEING his toolgun shoot while it doesn't shoot serverside.
if IsValid(trace.Entity) and not FPP.canTouchEnt(trace.Entity, "Toolgun") then
return false
end
end)
-- This looks weird, but whenever a client touches an ent he can't touch, without the code it'll look like he picked it up. WITH the code it really looks like he can't
-- besides, when the client CAN pick up a prop, it also looks like he can.
hook.Add("PhysgunPickup", "FPP_CL_PhysgunPickup", function(ply, ent)
if not FPP.canTouchEnt(ent, "Physgun") then
return false
end
end)
-- Makes sure the client doesn't think they can punt props
hook.Add("GravGunPunt", "FPP_CL_GravGunPunt", function(ply, ent)
if tobool(FPP.Settings.FPP_GRAVGUN1.noshooting) then return false end
if IsValid(ent) and not FPP.canTouchEnt(ent, "Gravgun") then
return false
end
end)
local surface_SetFont = surface.SetFont
local surface_GetTextSize = surface.GetTextSize
local surface_SetDrawColor = surface.SetDrawColor
local draw_SimpleText = draw.SimpleText
local draw_DrawText = draw.DrawText
local draw_RoundedBox = draw.RoundedBox
local HUDNote_c = 0
local HUDNote_i = 1
local HUDNotes = {}
--Notify ripped off the Sandbox notify, changed to my likings
function FPP.AddNotify( str, type )
local tab = {}
tab.text = str
tab.recv = SysTime()
tab.velx = 0
tab.vely = -5
surface_SetFont( "TabLarge" )
local w = surface_GetTextSize( str )
tab.x = ScrW() / 2 + w * 0.5 + (ScrW() / 20)
tab.y = ScrH()
tab.a = 255
if type then
tab.type = true
else
tab.type = false
end
table.insert( HUDNotes, tab )
HUDNote_c = HUDNote_c + 1
HUDNote_i = HUDNote_i + 1
local ply = LocalPlayer()
if not IsValid(ply) then return end -- I honestly got this error
ply:EmitSound("npc/turret_floor/click1.wav", 10, 100)
end
net.Receive("FPP_Notify", function(u) FPP.AddNotify(u:ReadString(), u:ReadBool()) end)
local function DrawNotice(k, v, i)
local H = ScrH() / 1024
local x = v.x - 75 * H
local y = v.y - 20 * H - 2
surface_SetFont( "TabLarge" )
local w, h = surface_GetTextSize( v.text )
w = w
h = h + 10
if v.type then
draw_RoundedBox(4, x - w - h + 16, y - 8, w + h, h, Color(30, 100, 30, v.a * 0.4))
else
draw_RoundedBox(4, x - w - h + 16, y - 8, w + h, h, Color(100, 30, 30, v.a * 0.4))
end
-- Draw Icon
surface_SetDrawColor( 255, 255, 255, v.a )
draw_SimpleText(v.text, "TabLarge", x + 1, y + 1, Color(0, 0, 0, v.a * 0.8), TEXT_ALIGN_RIGHT)
draw_SimpleText(v.text, "TabLarge", x - 1, y - 1, Color(0, 0, 0, v.a * 0.5), TEXT_ALIGN_RIGHT)
draw_SimpleText(v.text, "TabLarge", x + 1, y - 1, Color(0, 0, 0, v.a * 0.6), TEXT_ALIGN_RIGHT)
draw_SimpleText(v.text, "TabLarge", x - 1, y + 1, Color(0, 0, 0, v.a * 0.6), TEXT_ALIGN_RIGHT)
draw_SimpleText(v.text, "TabLarge", x, y, Color(255, 255, 255, v.a), TEXT_ALIGN_RIGHT)
local ideal_y = ScrH() - (HUDNote_c - i) * h
local ideal_x = ScrW() / 2 + w * 0.5 + (ScrW() / 20)
local timeleft = 6 - (SysTime() - v.recv)
-- Cartoon style about to go thing
if (timeleft < 0.8) then
ideal_x = ScrW() / 2 + w * 0.5 + 200
end
-- Gone!
if (timeleft < 0.5) then
ideal_y = ScrH() + 50
end
local spd = RealFrameTime() * 15
v.y = v.y + v.vely * spd
v.x = v.x + v.velx * spd
local dist = ideal_y - v.y
v.vely = v.vely + dist * spd * 1
if (math.abs(dist) < 2 and math.abs(v.vely) < 0.1) then
v.vely = 0
end
dist = ideal_x - v.x
v.velx = v.velx + dist * spd * 1
if math.abs(dist) < 2 and math.abs(v.velx) < 0.1 then
v.velx = 0
end
-- Friction.. kind of FPS independant.
v.velx = v.velx * (0.95 - RealFrameTime() * 8)
v.vely = v.vely * (0.95 - RealFrameTime() * 8)
end
local weaponClassTouchTypes = {
["weapon_physgun"] = "Physgun",
["weapon_physcannon"] = "Gravgun",
["gmod_tool"] = "Toolgun",
}
local function FilterEntityTable(t)
local filtered = {}
for i, ent in ipairs(t) do
if (not ent:IsWeapon()) and (not ent:IsPlayer()) then table.insert(filtered, ent) end
end
return filtered
end
local boxBackground = Color(0, 0, 0, 110)
local canTouchTextColor = Color(0, 255, 0, 255)
local cannotTouchTextColor = Color(255, 0, 0, 255)
local function HUDPaint()
local i = 0
for k, v in pairs(HUDNotes) do
if v ~= 0 then
i = i + 1
DrawNotice(k, v, i)
end
end
for k, v in pairs(HUDNotes) do
if v ~= 0 and v.recv + 6 < SysTime() then
HUDNotes[ k ] = 0
HUDNote_c = HUDNote_c - 1
if (HUDNote_c == 0) then HUDNotes = {} end
end
end
if FPP.getPrivateSetting("HideOwner") then return end
--Show the owner:
local ply = LocalPlayer()
local LAEnt2 = ents.FindAlongRay(ply:EyePos(), ply:EyePos() + EyeAngles():Forward() * 16384)
local LAEnt = FilterEntityTable(LAEnt2)[1]
if not IsValid(LAEnt) then return end
-- Prevent being able to see ownership through walls
local eyeTrace = ply:GetEyeTrace()
-- GetEyeTrace can return nil before InitPostEntity
if eyeTrace == nil then return end
if eyeTrace.HitPos:DistToSqr(eyeTrace.StartPos) < LAEnt:NearestPoint(eyeTrace.StartPos):DistToSqr(eyeTrace.StartPos) then return end
local weapon = ply:GetActiveWeapon()
local class = weapon:IsValid() and weapon:GetClass() or ""
local touchType = weaponClassTouchTypes[class] or "EntityDamage"
local reason = FPP.entGetTouchReason(LAEnt, touchType)
if not reason then return end
local originalOwner = LAEnt:GetNW2String("FPP_OriginalOwner")
originalOwner = originalOwner ~= "" and (" (previous owner: %s)"):format(originalOwner) or ""
reason = reason .. originalOwner
surface_SetFont("Default")
local w,h = surface_GetTextSize(reason)
local col = FPP.canTouchEnt(LAEnt, touchType) and canTouchTextColor or cannotTouchTextColor
local scrH = ScrH()
draw_RoundedBox(4, 0, scrH / 2 - h - 2, w + 10, 20, boxBackground)
draw_DrawText(reason, "Default", 5, scrH / 2 - h, col, 0)
surface_SetDrawColor(255, 255, 255, 255)
end
hook.Add("HUDPaint", "FPP_HUDPaint", HUDPaint)
|
--=========================================================================
--
-- Copyright Insight Software Consortium
--
-- 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.txt
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--=========================================================================
require "SimpleITK"
local sitk = {};
sitk = SimpleITK;
outfile = "sitk-lua-test.png";
-- parse the command line options
n = #arg;
for i=1,n do
if ( (arg[i] == "--help") or (arg[i] == "-h") ) then
print ("Usage: SimpleDerivative.lua [--help|-h] [output_image]");
os.exit();
else
outfile = arg[i];
end
end
-- setup the parameters for the Gaussian source image
-- pixel dimensions of the Gaussian image image
size = sitk.VectorUInt32();
size:push_back(128);
size:push_back(128);
-- sigma of the Gaussian
sigma = sitk.VectorDouble();
sigma:push_back(32.0);
sigma:push_back(32.0);
-- center of the Gaussian
center = sitk.VectorDouble();
center:push_back(64.0);
center:push_back(64.0);
-- create Gaussian image
gauss = sitk.GaussianSource (sitk.sitkFloat32, size, sigma, center);
-- take the first derivative in the X direction of the Gaussian
deriv = sitk.Derivative(gauss);
-- rescale the intensities to [0, 255]
result = sitk.RescaleIntensity(deriv, 0, 255.0);
-- convert the float image pixels to unsigned char
result = sitk.Cast(result, sitk.sitkUInt8);
-- write the resulting image
sitk.WriteImage(result, outfile);
-- display the image via the Show function, which invokes ImageJ, by default.
if (os.getenv("SITK_NOSHOW") == nil) then
sitk.Show(result);
end
|
-- Event: ChatSendFilter
local _,_,msg = ...
local cmdArgs = {}
for i in string.gmatch(msg, "%S+") do
table.insert(cmdArgs, i)
end
local switch
switch = {
["//help"] = {
["desc"] = "help command",
["fun"] = function()
for k,v in pairs(switch) do
log(k..": "..v.desc)
end
end
},
["/home"] = {
["desc"] = "add home home to blank home command",
["fun"] = function()
return "/home "..(cmdArgs[2] or "home")
end
},
["/flyspeed"] = {
["desc"] = "",
["fun"] = function()
runThread("../Hacks/FastFly.lua", cmdArgs[2])
end
},
["/flytoggle"] = {
["desc"] = "",
["fun"] = function()
runThread("../Hacks/Fly.lua")
end
},
["/nofall"] = {
["desc"] = "",
["fun"] = function()
runThread("../Hacks/NoFall.lua")
end
},
["/runspeed"] = {
["desc"] = "",
["fun"] = function()
runThread("../Hacks/FastRun.lua", cmdArgs[2])
end
},
["/fastplace"] = {
["desc"] = "",
["fun"] = function()
runThread("../Hacks/FastPlace.lua")
end
},
["/step"] = {
["desc"] = "",
["fun"] = function()
runThread("../Hacks/Step.lua", cmdArgs[2])
end
}
}
if (switch[cmdArgs[1]]) then
return switch[cmdArgs[1]].fun()
else
print(msg)
return msg
end
|
Locales ['en'] = {
['blip_name'] = 'Prison de bolingbroke',
['judge'] = 'Juge',
['escape_attempt'] = 'Vous ne pouvez pas vous échapper',
['remaining_msg'] = 'Encore ~b~%s~s~ secondes avant la liberté',
['jailed_msg'] = '%s est maintenant en prison pour %s minutes',
['unjailed'] = '%s a été relaché de prison'
}
|
return
{
GCS_WGS_1984 = "+proj=latlong +ellps=WGS84 +degrees",
NZGD_2000_New_Zealand_Transverse_Mercator = "+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs",
}
|
--
-- Author: SunLightJuly
-- Date: 2014-07-29 16:56:47
--
local ArmatureTestLayer = require("layers.ArmatureTestLayer")
local TestFrameEvent = class("TestFrameEvent", ArmatureTestLayer)
local scheduler = require("framework.scheduler")
local frameEventActionTag = 10000
function TestFrameEvent:ctor(index)
TestFrameEvent.super.ctor(self)
self:creatTitleAndSubTitle(index)
end
function TestFrameEvent:onEnter()
local gridNode = cc.NodeGrid:create()
local armature = ccs.Armature:create("HeroAnimation")
armature:getAnimation():play("attack")
armature:getAnimation():setSpeedScale(0.5)
armature:setPosition(cc.p(display.cx - 50, display.cy -100))
local function onFrameEvent( bone,evt,originFrameIndex,currentFrameIndex)
if (not gridNode:getActionByTag(frameEventActionTag)) or (not gridNode:getActionByTag(frameEventActionTag):isDone()) then
gridNode:stopAllActions()
local action = cc.ShatteredTiles3D:create(0.2, cc.size(16,12), 5, false)
action:setTag(frameEventActionTag)
gridNode:runAction(action)
end
end
armature:getAnimation():setFrameEventCallFunc(onFrameEvent)
gridNode:addChild(armature)
self:addChild(gridNode)
local function checkAction(dt)
if gridNode:getNumberOfRunningActions() == 0 and gridNode:getGrid() ~= nil then
gridNode:setGrid(nil)
end
end
self.handle = scheduler.scheduleUpdateGlobal(checkAction)
end
function TestFrameEvent:onExit()
scheduler.unscheduleGlobal(self.handle)
end
return TestFrameEvent |
--- Physics body component class.
-- Physical representation of an Object.
-- @classmod PhysicsBodyComponent
--- Computes Axis-Aligned Bounding Box over the objects's physical representation.
-- @tparam transform t Also apply this transform
-- @treturn vec2 lower bound
-- @treturn vec2 upper bound
function PhysicsBodyComponent:computeAABB(t)
end
|
require "user.options"
require "user.keymaps"
require "user.plugins"
require "user.colorscheme"
require "user.completion"
require "user.treesitter"
require "user.telescope"
require "user.autopairs"
require "user.lsp"
require "user.comments"
require "user.nvim-tree"
require "user.lualine"
|
--------------------------------------------------------------------
--Task
--------------------------------------------------------------------
require 'mock.core.task.ThreadTask'
--------------------------------------------------------------------
require 'mock.core.task.ThreadDataTask'
require 'mock.core.task.ThreadImageLoadTask'
|
{{/*
This command manages the leaderboard. Usage is -leaderboard [page] where page is optional.
Recommended trigger: Regex trigger with trigger `\A(-|<@!?204255221017214977>\s*)(leaderboard|lb|top)(\s+|\z)`.
*/}}
{{ $page := 1 }} {{/* Default page to start at */}}
{{ with reFind `\d+` (joinStr " " .CmdArgs) }} {{ $page = . | toInt }} {{ end }} {{/* If the user provided a page, change $page variable to that */}}
{{ $skip := mult (sub $page 1) 10 }} {{/* Amount of entries to skip */}}
{{ $users := dbTopEntries "xp" 10 $skip }} {{/* Retrieve the relevant DB entries with the parameters provided */}}
{{ if not (len $users) }}
There were no users on that page! {{/* If there were no users, return */}}
{{ else }}
{{ $rank := $skip }} {{/* Instantiate rank variable with value of $skip */}}
{{ $display := "" }} {{/* The description for the leaderboard description */}}
{{- range $users -}}
{{ $xp := toInt .Value }} {{/* XP for this user entry */}}
{{ $rank = add $rank 1 }} {{/* Increment rank variable */}}
{{ $display = printf "%s\n• **%d.** [%s](https://yagpdb.xyz) :: Level %d (%d XP)"
$display $rank .User.String (toInt (roundFloor (mult 0.1 (sqrt $xp)))) $xp
}} {{/* Format this line */}}
{{- end -}}
{{ $id := sendMessageRetID nil (cembed
"title" "❯ Leaderboard"
"thumbnail" (sdict "url" "https://i.imgur.com/mJ7zu6k.png")
"color" 14232643
"description" $display
"footer" (sdict "text" (joinStr "" "Page " $page))
) }} {{/* Construct and send the embed */}}
{{ addMessageReactions nil $id "◀️" "▶️" }} {{/* Add reactions for pagination */}}
{{ end }} |
-- This is the fake Entity used to Deploy the Mobile Factory --
-- Entity --
local mfDE = {}
mfDE.type = "simple-entity-with-owner"
mfDE.name = "MFDeploy"
mfDE.icone = "__Mobile_Factory_Graphics__/graphics/icons/MFDeployI.png"
mfDE.icon_size = 32
mfDE.minable = {mining_time=1}
mfDE.collision_mask = {} -- mask copied from MobileFactory in DFF
mfDE.collision_box = {{-3.5, -3.5}, {2.5, 4.5}}
mfDE.selection_box = mfDE.collision_box
mfDE.flags = {"not-rotatable"}
mfDE.picture = {
filename = "__Mobile_Factory_Graphics__/graphics/icons/MFDeployE.png",
priority = "high",
width = 600,
height = 800,
scale = 1/3
}
data:extend{mfDE}
-- Item --
local mfdI = {}
mfdI.type = "item"
mfdI.name = "MFDeploy"
mfdI.icon = "__Mobile_Factory_Graphics__/graphics/icons/MFDeployI.png"
mfdI.place_result = "MFDeploy"
mfdI.icon_size = 32
mfdI.stack_size = 1
mfdI.flags = {"hidden", "only-in-cursor"}
data:extend{mfdI}
-- Technology --
local mfDT = {}
mfDT.name = "MFDeploy"
mfDT.type = "technology"
mfDT.icon = "__Mobile_Factory_Graphics__/graphics/icons/MFDeployT.png"
mfDT.icon_size = 600
mfDT.unit = {
count=1,
time=3,
ingredients={
{"DimensionalSample", 350}
}
}
mfDT.prerequisites = {"DimensionalOre"}
mfDT.effects = {{type="nothing", effect_description={"description.Deploy"}}}
data:extend{mfDT}
-- Slot Technologies --
for i = 5, 20 do
local mfDTS = {}
mfDTS.name = "MFDSlot" .. i
mfDTS.type = "technology"
mfDTS.icon = "__Mobile_Factory_Graphics__/graphics/icons/DPSlotT.png"
mfDTS.icon_size = 64
mfDTS.unit = {
count=1*i,
time=i,
ingredients={
{"DimensionalSample", 100}
}
}
if i > 13 then
table.insert(mfDTS.unit.ingredients, {"DimensionalCrystal", 1})
end
if i == 5 then
mfDTS.prerequisites = {"MFDeploy"}
else
mfDTS.prerequisites = {"MFDSlot" .. i-1}
end
mfDTS.effects = {{type="nothing", effect_description={"description.MFDSlot" .. i}}}
data:extend{mfDTS}
end
|
local _CUR = ...
local _M = {
LoopTimer = cc.import(".LoopTimer", _CUR),
GateSocketTimer = cc.import(".GateSocketTimer", _CUR),
}
return _M
|
local memoize = require("../memoize")
print("Run tests for `memoize`")
function fib(n)
if n < 2 then
return n
else
return fib(n - 1) + fib(n - 2)
end
end
local fibnitro = memoize(fib)
print("a memoized version of fibonacci produces identical results")
assert(fib(10) == 55)
assert(fibnitro(10) == 55)
function o(key, value) return value end
local oo = memoize(o)
local v1 = {}
local v2 = {}
print("on first call memoize")
assert(oo(1, v1) == v1)
print("on second call just returns memoized")
assert(oo(1, v2) == v1)
print("memoize by table key")
assert(oo(v1, v2) == v2)
print("memoized new value")
assert(oo(v1) == v2)
print("values do not override")
assert(oo(1) ~= oo(v1))
print("returns same value as un-memoized")
assert(o(3, v2) == oo(v1, 3))
|
local GameSettings = require('GameSettings')
registerHotkey('ExportSettings', 'Export all settings', function()
GameSettings.ExportTo('settings.lua')
end)
registerHotkey('SwitchFOV', 'Switch FOV', function()
local fov = GameSettings.Var('/graphics/basic/FieldOfView')
fov.value = fov.value + fov.step
if fov.value > fov.max then
fov.value = fov.min
end
GameSettings.Set('/graphics/basic/FieldOfView', fov.value)
print(('Current FOV: %.1f'):format(GameSettings.Get('/graphics/basic/FieldOfView')))
end)
registerHotkey('SwitchResolution', 'Switch resolution', function()
-- You can get available options and current selection for lists
local options, current = GameSettings.Options('/video/display/Resolution')
local next = current + 1
if next > #options then
next = 1
end
GameSettings.Set('/video/display/Resolution', options[next])
if GameSettings.NeedsConfirmation() then
GameSettings.Confirm()
end
print(('Switched resolution from %s to %s'):format(options[current], options[next]))
end)
registerHotkey('ToggleHUD', 'Toggle HUD', function()
-- Option 1: Toggle all settings in the group
GameSettings.ToggleGroup('/interface/hud')
-- Option 2: Toggle specific settings
--GameSettings.ToggleAll({
-- '/interface/hud/action_buttons',
-- '/interface/hud/activity_log',
-- '/interface/hud/ammo_counter',
-- '/interface/hud/healthbar',
-- '/interface/hud/input_hints',
-- '/interface/hud/johnny_hud',
-- '/interface/hud/minimap',
-- '/interface/hud/npc_healthbar',
-- '/interface/hud/npc_names',
-- '/interface/hud/object_markers',
-- '/interface/hud/quest_tracker',
-- '/interface/hud/stamina_oxygen',
--})
end)
registerHotkey('SwitchBlur', 'Switch blur', function()
local options, current = GameSettings.Options('/graphics/basic/MotionBlur')
local next = current + 1
if next > #options then
next = 1
end
GameSettings.Set('/graphics/basic/MotionBlur', options[next])
GameSettings.Save() -- Required for most graphics settings
print(('Switched blur from %s to %s'):format(options[current], options[next]))
end)
|
function serialize (o)
if type(o) == "number" then
io.write(o)
elseif type(o) == "string" then
io.write(string.format("%q", o))
elseif type(o) == "table" then
io.write("{\n")
for k,v in pairs(o) do
io.write(" ", k, " = ")
serialize(v)
io.write(",\n")
end
io.write("}\n")
else
error("cannot serialize a " .. type(o))
end
end
|
return {
widget = {
clock = {
-- Clock widget format
military_mode = false
}},
module = {
auto_start = {
-- Will create notification if true
debug_mode = false
},
}
}
|
--[[
Copyright (c) 2012 Zeliarden & Roland Yonaba
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 Debug = {}
-- Draws informations relevant to the last path search
-- Outputs whether or not the path was found, the time of search
-- in milliseconds and the path length.
function Debug.printPathInfo(font,x,y,pathInfo)
love.graphics.setFont(font)
love.graphics.print(('Path: %s - Time: %.2f ms - Length: %.2f'):
format(pathInfo.path and 'Found' or 'False' ,
pathInfo.time or 0.00,
pathInfo.len or 0.00)
,x,y)
end
-- Draws a path with a set of points on each node, lines
-- linking them and involved nodes coordinates
function Debug.drawPath(font, path, shouldDraw)
local x1,y1,x2,y2
if shouldDraw and path then
love.graphics.setLine(1,'smooth')
love.graphics.setPoint(5,'smooth')
for i = 2,#path do
x1,y1 = path[i-1].x*32+16, path[i-1].y*32+16
x2,y2 = path[i].x*32+16, path[i].y*32+16
love.graphics.setColor(255,255,0,255)
love.graphics.line(x1,y1,x2,y2)
love.graphics.setColor(255,0,0,255)
love.graphics.point(x1,y1)
love.graphics.point(x2,y2)
love.graphics.setColor(255,255,255,255)
love.graphics.setFont(font)
love.graphics.printf(('(%d,%d)'):format(path[i-1].x,path[i-1].y),x1-16,y1+5,32,'center')
love.graphics.printf(('(%d,%d)'):format(path[i].x, path[i].y),x2-16,y2+5,32,'center')
end
end
end
return Debug |
local http = require "net.http";
local json = require "util.json";
local parse_timestamp = require "util.datetime".parse;
module:set_global();
local current_credentials = module:shared("/*/aws_profile/credentials");
local function get_role_credentials(role_name, cb)
http.request("http://169.254.169.254/latest/meta-data/iam/security-credentials/"..role_name, nil, function (credentials_json)
local credentials = credentials_json and json.decode(credentials_json);
if not credentials or not (credentials.AccessKeyId and credentials.SecretAccessKey) then
module:log("warn", "Failed to fetch credentials for %q", role_name);
cb(nil);
return;
end
local expiry = parse_timestamp(credentials.Expiration);
local ttl = os.difftime(expiry, os.time());
cb({
access_key = credentials.AccessKeyId;
secret_key = credentials.SecretAccessKey;
ttl = ttl;
expiry = expiry;
});
end);
end
local function get_credentials(cb)
http.request("http://169.254.169.254/latest/meta-data/iam/security-credentials", nil, function (role_name)
role_name = role_name and role_name:match("%S+");
if not role_name then
module:log("warn", "Unable to discover role name");
cb(nil);
return;
end
get_role_credentials(role_name, cb);
end);
end
function refresh_credentials(force)
if not force and current_credentials.expiry and current_credentials.expiry - os.time() > 300 then
return;
end
get_credentials(function (credentials)
if not credentials then
module:log("warn", "Failed to refresh credentials!");
return;
end
current_credentials.access_key = credentials.access_key;
current_credentials.secret_key = credentials.secret_key;
current_credentials.expiry = credentials.expiry;
module:timer(credentials.ttl or 240, refresh_credentials);
module:fire_event("aws_profile/credentials-refreshed", current_credentials);
end);
end
function module.load()
refresh_credentials(true);
end
|
local a = {FRUIT.BANANA, FRUIT.APPLE, FRUIT.PLUM, FRUIT.PEACH}
local b = seq.fruitQ(a)
local c = seq.fruitQA(a)
assert(#b == #a)
assert(#c == #a)
for i=1, #b do
assert(b[i] == a[i])
assert(c[i] == a[i])
end
local a = {DNA.GUANINE, DNA.THYMINE, DNA.ADENINE, DNA.CYTOSINE}
local b = seq.geneQ(a)
local c = seq.geneQA(a)
assert(#b == #a)
assert(#c == #a)
for i=1, #b do
assert(b[i] == a[i])
assert(c[i] == a[i])
end
local a = {"mama", "mia", "lezatos", "hmm"}
local b = seq.stringQ(a)
local c = seq.stringQA(a)
assert(#b == #a)
assert(#c == #a)
for i=1, #b do
assert(b[i] == a[i])
assert(c[i] == a[i])
end
local b = seq.rootv(11.5)
for i=1, 10 do
local c = (i-1) * 11.5
assert(c == b[i])
end
|
--!A cross-platform build utility based on Lua
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- Copyright (C) 2015-present, TBOOX Open Source Group.
--
-- @author ruki
-- @file find_vcpkgdir.lua
--
-- imports
import("core.base.option")
import("core.base.global")
import("core.project.config")
import("core.cache.detectcache")
import("lib.detect.find_tool")
-- find vcpkgdir
function main()
local vcpkgdir = detectcache:get("detect.sdks.find_vcpkgdir")
if vcpkgdir == nil then
if not vcpkgdir then
vcpkgdir = config.get("vcpkg") or global.get("vcpkg")
if vcpkgdir then
if os.isfile(vcpkgdir) then
vcpkgdir = path.directory(vcpkgdir)
end
end
end
if not vcpkgdir then
vcpkgdir = os.getenv("VCPKG_ROOT") or os.getenv("VCPKG_INSTALLATION_ROOT")
end
if not vcpkgdir and is_host("macosx", "linux") then
local brew = find_tool("brew")
if brew then
dir = try
{
function ()
return os.iorunv(brew.program, {"--prefix", "vcpkg"})
end
}
end
if dir then
dir = path.join(dir:trim(), "libexec")
if os.isdir(path.join(dir, "installed")) then
vcpkgdir = dir
end
end
end
if not vcpkgdir and is_host("windows") then
-- attempt to read path info after running `vcpkg integrate install`
local pathfile = "~/../Local/vcpkg/vcpkg.path.txt"
if os.isfile(pathfile) then
local dir = io.readfile(pathfile):trim()
if os.isdir(dir) then
vcpkgdir = dir
end
end
end
detectcache:set("detect.sdks.find_vcpkgdir", vcpkgdir or false)
detectcache:save()
end
return vcpkgdir or nil
end
|
object_tangible_item_beast_converted_kai_tok_decoration = object_tangible_item_beast_shared_converted_kai_tok_decoration:new {
}
ObjectTemplates:addTemplate(object_tangible_item_beast_converted_kai_tok_decoration, "object/tangible/item/beast/converted_kai_tok_decoration.iff")
|
--- @module fimbul.v35.rules
local rules = {}
local stacked_value = require("fimbul.stacked_value")
rules.types = {
BASE = "base",
DODGE = "dodge",
CIRCUMSTANCE = "circumstance",
NEGATIVE_LEVEL = "negative_level",
}
rules.damage_types = {
POSITIVE = "positive",
NEGATIVE = "negative",
}
rules.stacking_rules = {
stack = stacked_value.DONT_STACK,
-- http://www.d20srd.org/srd/theBasics.htm
-- "Dodge bonuses and circumstance bonuses however, do stack
-- with one another unless otherwise specified."
[rules.types.DODGE] = stacked_value.STACK,
[rules.types.CIRCUMSTANCE] = stacked_value.STACK,
-- Negative levels do stack
[rules.types.NEGATIVE_LEVEL] = stacked_value.STACK,
}
rules.MAX_MODIFIER = 10
rules.armors = {}
-- PHB 126
rules.armors.masterwork_price = 250
-- DMG 216
rules.armors.modifier_prices = {
[0] = 0,
[1] = 1000,
[2] = 4000,
[3] = 9000,
[4] = 16000,
[5] = 25000,
[6] = 36000,
[7] = 49000,
[8] = 64000,
[9] = 81000,
[10] = 100000,
}
rules.armors.modifier_prices.calculate = function(mod)
return math.pow(mod, 2) * 1000
end
-- Per PHB armor == shields in this regard
rules.shields = rules.armors
rules.weapons = {}
-- PHB 122
rules.weapons.masterwork_price = 300
-- DMG 222
rules.weapons.modifier_prices = {
[0] = 0,
[1] = 2000,
[2] = 8000,
[3] = 18000,
[4] = 32000,
[5] = 50000,
[6] = 72000,
[7] = 98000,
[8] = 128000,
[9] = 162000,
[10] = 200000,
}
rules.weapons.modifier_prices.calculate = function(mod)
return math.pow(mod, 2) * 2000
end
rules.crafting = {}
-- How many GP per day
rules.crafting.GP_PER_DAY = 1000
-- XP cost: 1/25
rules.crafting.XP_COST = 0.04
-- Material cost: half
rules.crafting.MATERIAL_COST = 0.5
rules.wand = {}
rules.wand.BASE_CRAFT_PRICE = 375
rules.wand.BASE_ITEM_PRICE = 750
rules.wand.MAX_SPELL_LEVEL = 4
return rules
|
-----------------------------------
-- Ability: Nightingale
-- Game Description: Halves the casting and recast times of songs
-- Obtained: Bard Level 75 Group 2 Meriting
-- Recast Time: 0:10:00
-- Duration: 0:01:00
-----------------------------------
require("scripts/globals/settings")
require("scripts/globals/status")
-----------------------------------
function onAbilityCheck(player,target,ability)
return 0,0
end
function onUseAbility(player, target, ability)
player:addStatusEffect(tpz.effect.NIGHTINGALE,0,0,60)
end |
local vdom = require('vdom')
return function(props)
return vdom.create_element(
'label',
{
halign='right',
valign='top',
top=0,
height = 24,
text = props.version,
color = '#f0f'
}
)
end
|
local playsession = {
{"dorpdorp", {251871}},
{"Achskelmos", {1673}},
{"gearmach1ne", {250807}},
{"WiredMesh", {176987}},
{"Nate66873", {238489}},
{"Roeno1997", {236815}},
{"Qwicks", {211158}},
{"NappingYG", {10492}},
{"glukuzzz", {130126}},
{"Lucidityvt", {3824}},
{"GuidoCram", {97836}},
{"CmonMate497", {83476}},
{"Nikkichu", {64774}},
{"ratboyboxshall", {4473}},
{"Artengineer", {42534}},
{"kinny09", {5433}}
}
return playsession |
-- Bengineering Pokemon overlay script
package.path = _G.script_path() .. [[../lib/lua/?.lua;]] .. package.path
package.cpath = _G.script_path() .. [[../lib/?.dll;]] .. package.cpath
local obs = _G.obslua
function _G.script_description()
return "Automates Ben's Pokémon overlay by connecting with Google Docs.\n\nWritten by DarkMorford"
end
function _G.script_properties()
local props = obs.obs_properties_create()
obs.obs_properties_add_text(props, "api_key", "Google API Key", obs.OBS_TEXT_PASSWORD)
obs.obs_properties_add_text(props, "spreadsheet", "Google Spreadsheet", obs.OBS_TEXT_DEFAULT)
obs.obs_properties_add_int(props, "refresh", "Refresh Interval (seconds)", 1, 60, 1)
return props
end
function _G.script_defaults(settings)
obs.obs_data_set_default_string(settings, "spreadsheet", "1SvOZFM3yPPdQ00bFIK9Og4CwucKHjsFzwKRcRnF-vVg")
obs.obs_data_set_default_int(settings, "refresh", 5)
end
function _G.script_update(settings)
end
function _G.script_load(settings)
end
function _G.script_unload()
end
|
local lib = require "resty.nettle.library"
local ffi = require "ffi"
local ffi_new = ffi.new
local ffi_typeof = ffi.typeof
local ffi_cdef = ffi.cdef
local ffi_str = ffi.string
local setmetatable = setmetatable
ffi_cdef[[
typedef struct knuth_lfib_ctx {
uint32_t x[100];
unsigned index;
} KNUTH_LFIB_CTX;
void nettle_knuth_lfib_init(struct knuth_lfib_ctx *ctx, uint32_t seed);
uint32_t nettle_knuth_lfib_get(struct knuth_lfib_ctx *ctx);
void nettle_knuth_lfib_get_array(struct knuth_lfib_ctx *ctx, size_t n, uint32_t *a);
void nettle_knuth_lfib_random(struct knuth_lfib_ctx *ctx, size_t n, uint8_t *dst);
]]
local uint8t = ffi_typeof "uint8_t[?]"
local uint32t = ffi_typeof "uint32_t[?]"
local ctx = ffi_typeof "KNUTH_LFIB_CTX[1]"
local knuth = { func = lib.nettle_knuth_lfib_random }
knuth.__index = knuth
function knuth.context(seed)
local context = ffi_new(ctx)
lib.nettle_knuth_lfib_init(context, seed or 0)
return context
end
function knuth.new(seed)
local self = setmetatable({ context = ffi_new(ctx) }, knuth)
lib.nettle_knuth_lfib_init(self.context, seed or 0)
return self
end
function knuth:number()
return lib.nettle_knuth_lfib_get(self.context)
end
function knuth:array(n)
local b = ffi_new(uint32t, n)
lib.nettle_knuth_lfib_get_array(self.context, n, b)
local r = {}
for i=1, n do r[i] = b[i-1] end
return r
end
function knuth:random(n)
local b = ffi_new(uint8t, n)
lib.nettle_knuth_lfib_random(self.context, n, b)
return ffi_str(b, n)
end
return knuth |
local default_scale = 3
config = {
window = {
width = 128 * default_scale,
height = 128 * default_scale,
min_width = 128,
min_height = 128,
title = "tsab_pico"
}
} |
local quote_info = new_struct()
-- id: int
-- quote_type: quote_types
-- level: int
-- localized_string_id: int
function quote_info:init(id, quote_type, level, localized_string_id)
self.id = id
self.type = quote_type
self.level = level
self.localized_string_id = localized_string_id
end
--#if log
function quote_info:_tostring()
return "("..(self.type == quote_types.attack and "A" or "R")..self.id..") Lv"..self.level..": localized string "..self.localized_string_id
end
--#endif
return quote_info
|
return {
---------------------
-- Herbalist
---------------------
[201789]=2, [201801]=8, [201815]=48, [200339]=288, [200368]=1728, -- Bitterleaf
[201786]=2, [201800]=8, [201814]=48, [200337]=288, [200367]=1728, -- Beetroot
[201785]=2, [201799]=8, [201813]=48, [200336]=288, [200366]=1728, -- Mountain Demon Grass
[201788]=2, [201802]=8, [201816]=48, [200340]=288, [201787]=1728, -- Moxa
[201792]=2, [201804]=8, [201818]=48, [200344]=288, [201793]=1728, -- Barsaleaf
[201791]=2, [201803]=8, [201817]=48, [200341]=288, [201790]=1728, -- Dusk Orchid
[201794]=2, [201805]=8, [201819]=48, [200355]=288, [201795]=1728, -- Moon Orchid
[201796]=2, [201806]=8, [201820]=48, [200356]=288, [201809]=1728, -- Sinners Palm
[201797]=2, [201807]=8, [201821]=48, [200360]=288, [201810]=1728, -- Dragon Mallow
[201798]=2, [201808]=8, [201822]=48, [200364]=288, [201811]=1728, -- Thorn Apple
[202631]=2, [202638]=8, [202645]=48, [202652]=288, [202659]=1728, -- Rosemary
[202632]=2, [202639]=8, [202646]=48, [202653]=288, [202660]=1728, -- Bison Grass
[202633]=2, [202640]=8, [202647]=48, [202654]=288, [202661]=1728, -- Foloin Nut
[202634]=2, [202641]=8, [202648]=48, [202655]=288, [202662]=1728, -- Green Thistle
[202635]=2, [202642]=8, [202649]=48, [202656]=288, [202663]=1728, -- Straw Mushroom
[202636]=2, [202643]=8, [202650]=48, [202657]=288, [202664]=1728, -- Mirror Sedge
[202637]=2, [202644]=8, [202651]=48, [202658]=288, [202665]=1728, -- Goblin Grass
[208247]=2, [208248]=8, [208249]=48, [208250]=288, [208251]=1728, -- Verbena
[240330]=2, [240331]=8, [240332]=48, [240333]=288, [240334]=1728, -- Nocturnal Lantern Grass
[241409]=2, [241410]=8, [241411]=48, [241412]=288, [241413]=1728, -- Thunderhoof Grass
[241415]=2, [241416]=8, [241417]=48, [241418]=288, [241419]=1728, -- Dovetail Flower
[242251]=2, [242252]=8, [242253]=48, -- Isyeh Grass
[242299]=2, [242300]=8, [242301]=48, -- Dragonsprout Grass
---------------------
-- Mining
---------------------
[201749]=2, [201761]=8, [201773]=48, [200294]=288, [200321]=1728, -- Ash Wood
[201750]=2, [201762]=8, [201774]=48, [200301]=288, [200323]=1728, -- Willow Wood
[201751]=2, [201763]=8, [201775]=48, [200303]=288, [200324]=1728, -- Maple Wood
[201753]=2, [201766]=8, [201778]=48, [200309]=288, [200328]=1728, -- Holly Wood
[201752]=2, [201764]=8, [201776]=48, [200305]=288, [200325]=1728, -- Oak Wood
[201754]=2, [201765]=8, [201777]=48, [200308]=288, [200327]=1728, -- Pine Wood
[201757]=2, [201767]=8, [201779]=48, [200314]=288, [200330]=1728, -- Yew Wood
[201758]=2, [201768]=8, [201780]=48, [200315]=288, [201755]=1728, -- Tarslin Demon Wood
[201759]=2, [201769]=8, [201781]=48, [200317]=288, [201756]=1728, -- Dragonlair Wood
[201760]=2, [201770]=8, [201782]=48, [200319]=288, [201771]=1728, -- Ancient Spirit Oak Wood
[202598]=2, [202605]=8, [202612]=48, [202619]=288, [202626]=1728, -- Redwood
[202600]=2, [202607]=8, [202614]=48, [202621]=288, [202628]=1728, -- Sagewood
[202599]=2, [202606]=8, [202613]=48, [202620]=288, [202627]=1728, -- Dragon Beard Root Wood
[202596]=2, [202603]=8, [202610]=48, [202617]=288, [202624]=1728, -- Chime Wood
[202597]=2, [202604]=8, [202611]=48, [202618]=288, [202625]=1728, -- Stone Rotan Wood
[202601]=2, [202608]=8, [202615]=48, [202622]=288, [202629]=1728, -- Fairywood
[202602]=2, [202609]=8, [202616]=48, [202623]=288, [202630]=1728, -- Aeontree Wood
[208241]=2, [208242]=8, [208243]=48, [208244]=288, [208245]=1728, -- Fastan Banyan
[240324]=2, [240325]=8, [240326]=48, [240327]=288, [240328]=1728, -- Janost Cypress Wood
[241421]=2, [241422]=8, [241423]=48, [241424]=288, [241425]=1728, -- Todo Ginkgo Tree
[241427]=2, [241428]=8, [241429]=48, [241430]=288, [241431]=1728, -- Stone Pine
[242243]=2, [242244]=8, [242245]=48, -- Nadal Wisteria Wood
[242291]=2, [242292]=8, [242293]=48, -- Blood Palm Wood
---------------------
-- Woodcutting
---------------------
[201710]=2, [201723]=8, [201736]=48, [200233]=288, [200263]=1728, -- Zinc Ore
[201711]=2, [201724]=8, [201737]=48, [200240]=288, [201712]=1728, -- Tin Ore
[201713]=2, [201725]=8, [201738]=48, [200248]=288, [201719]=1728, -- Iron Ore
[201714]=2, [201726]=8, [201739]=48, [200251]=288, [201722]=1728, -- Copper Ore
[201715]=2, [201727]=8, [201740]=48, [200253]=288, [201733]=1728, -- Dark Crystal
[201716]=2, [201728]=8, [201741]=48, [200255]=288, [201734]=1728, -- Silver Ore
[201717]=2, [201729]=8, [201742]=48, [200257]=288, [201735]=1728, -- Wizard-Iron Ore
[201718]=2, [201730]=8, [201743]=48, [200259]=288, [201746]=1728, -- Moon Silver Ore
[202563]=2, [202570]=8, [202577]=48, [202584]=288, [202591]=1728, -- Rock Crystal
[201720]=2, [201731]=8, [201744]=48, [200261]=288, [201747]=1728, -- Abyss-Mercury
[202565]=2, [202572]=8, [202579]=48, [202586]=288, [202593]=1728, -- Mithril
[201721]=2, [201732]=8, [201745]=48, [200262]=288, [201748]=1728, -- Rune Obsidian Ore
[202564]=2, [202571]=8, [202578]=48, [202585]=288, [202592]=1728, -- Mysticite
[202562]=2, [202569]=8, [202576]=48, [202583]=288, [202590]=1728, -- Cyanide
[202561]=2, [202568]=8, [202575]=48, [202582]=288, [202589]=1728, -- Flame Dust
[202566]=2, [202573]=8, [202580]=48, [202587]=288, [202594]=1728, -- Frost Crystal
[202567]=2, [202574]=8, [202581]=48, [202588]=288, [202595]=1728, -- Mica
[208235]=2, [208236]=8, [208237]=48, [208238]=288, [208239]=1728, -- Olivine
[240315]=2, [240316]=8, [240317]=48, [240318]=288, [240319]=1728, -- Purple Agate Crystal
[241433]=2, [241434]=8, [241435]=48, [241436]=288, [241437]=1728, -- Olegan Stone
[241439]=2, [241440]=8, [241441]=48, [241442]=288, [241443]=1728, -- Rein Crystal
[242247]=2, [242248]=8, [242249]=48, -- Silver Star Stone
[242295]=2, [242296]=8, [242297]=48, -- Ironaxe Stone
---------------------
-- Alchemy
---------------------
[209762]=12, -- Purified Crystal
---------------------
-- Tailoring
---------------------
[203005]=5, [203019]=25, -- Tiny Magical Remnant
[209763]=12, -- Purified Crystal
[230752]=12, -- Essence Crystal
---------------------
-- Armorcrafting
---------------------
[203007]=5, [203020]=25, -- Tiny Runic Remnant
[209760]=12, -- Purified Crystal
[230751]=12, -- Essence Crystal
---------------------
-- Carpentry
---------------------
[209761]=12, -- Purified Crystal
[230754]=12, -- Essence Crystal
---------------------
-- Blacksmithing
---------------------
[202990]=5, [202992]=25, -- Smashed Fire Essence Fragment
[202991]=5, [202993]=25, -- Smashed Water Essence Fragment
[209759]=12, -- Purified Crystal
[230753]=12, -- Essence Crystal
}
|
enum {
PGM_ERROR_DOMAIN_IF,
PGM_ERROR_DOMAIN_PACKET,
PGM_ERROR_DOMAIN_RECV,
PGM_ERROR_DOMAIN_TIME,
PGM_ERROR_DOMAIN_SOCKET,
PGM_ERROR_DOMAIN_ENGINE,
PGM_ERROR_DOMAIN_HTTP,
PGM_ERROR_DOMAIN_SNMP
};
enum {
PGM_ERROR_ADDRFAMILY,
PGM_ERROR_AFNOSUPPORT,
PGM_ERROR_AGAIN,
PGM_ERROR_BADE,
PGM_ERROR_BADF,
PGM_ERROR_BOUNDS,
PGM_ERROR_CKSUM,
PGM_ERROR_CONNRESET,
PGM_ERROR_FAIL,
PGM_ERROR_FAULT,
PGM_ERROR_INPROGRESS,
PGM_ERROR_INTR,
PGM_ERROR_INVAL,
PGM_ERROR_MFILE,
PGM_ERROR_NFILE,
PGM_ERROR_NOBUFS,
PGM_ERROR_NODATA,
PGM_ERROR_NODEV,
PGM_ERROR_NOENT,
PGM_ERROR_NOMEM,
PGM_ERROR_NONAME,
PGM_ERROR_NONET,
PGM_ERROR_NOPROTOOPT,
PGM_ERROR_NOSYS,
PGM_ERROR_NOTUNIQ,
PGM_ERROR_NXIO,
PGM_ERROR_PERM,
PGM_ERROR_PROCLIM,
PGM_ERROR_PROTO,
PGM_ERROR_RANGE,
PGM_ERROR_SERVICE,
PGM_ERROR_SOCKTNOSUPPORT,
PGM_ERROR_SYSNOTAREADY,
PGM_ERROR_SYSTEM,
PGM_ERROR_VERNOTSUPPORTED,
PGM_ERROR_XDEV,
PGM_ERROR_FAILED
};
enum {
PGM_LOG_ROLE_MEMORY = 0x001,
PGM_LOG_ROLE_NETWORK = 0x002,
PGM_LOG_ROLE_CONFIGURATION = 0x004,
PGM_LOG_ROLE_SESSION = 0x010,
PGM_LOG_ROLE_NAK = 0x020,
PGM_LOG_ROLE_RATE_CONTROL = 0x040,
PGM_LOG_ROLE_TX_WINDOW = 0x080,
PGM_LOG_ROLE_RX_WINDOW = 0x100,
PGM_LOG_ROLE_FEC = 0x400,
PGM_LOG_ROLE_CONGESTION_CONTROL = 0x800
};
enum {
PGM_LOG_LEVEL_DEBUG = 0,
PGM_LOG_LEVEL_TRACE = 1,
PGM_LOG_LEVEL_MINOR = 2,
PGM_LOG_LEVEL_NORMAL = 3,
PGM_LOG_LEVEL_WARNING = 4,
PGM_LOG_LEVEL_ERROR = 5,
PGM_LOG_LEVEL_FATAL = 6
};
extern const unsigned pgm_major_version;
extern const unsigned pgm_minor_version;
extern const unsigned pgm_micro_version;
extern const char* pgm_build_date;
extern const char* pgm_build_time;
extern const char* pgm_build_system;
extern const char* pgm_build_machine;
extern const char* pgm_build_revision;
extern int pgm_log_mask;
extern int pgm_min_log_level;
extern bool pgm_mem_gc_friendly;
typedef void (*pgm_log_func_t) (const int, const char*restrict, void*restrict);
typedef struct pgm_list_t {
void* data;
struct pgm_list_t* next;
struct pgm_list_t* prev;
} pgm_list_t;
typedef struct pgm_error_t {
int domain;
int code;
char* message;
} pgm_error_t;
bool pgm_init( pgm_error_t** );
bool pgm_supported( );
bool pgm_shutdown( );
void pgm_drop_superuser( );
void* pgm_malloc( const size_t );
void* pgm_malloc_n( const size_t, const size_t );
void* pgm_malloc0( const size_t );
void* pgm_malloc0_n( const size_t, const size_t );
void* pgm_memdup( const void*, const size_t );
void* pgm_realloc( void*, const size_t );
void pgm_free( void* );
void pgm_messages_init( );
void pgm_messages_shutdown( );
pgm_log_func_t
pgm_log_set_handler( pgm_log_func_t, void* );
void pgm_error_free (pgm_error_t*);
void pgm_set_error (pgm_error_t**restrict, const int, const int, const char*restrict, ...) PGM_GNUC_PRINTF (4, 5);
void pgm_propagate_error (pgm_error_t**restrict, pgm_error_t*restrict);
void pgm_clear_error (pgm_error_t**);
void pgm_prefix_error (pgm_error_t**restrict, const char*restrict, ...) PGM_GNUC_PRINTF (2, 3);
int pgm_error_from_errno (const int) PGM_GNUC_CONST;
int pgm_error_from_h_errno (const int) PGM_GNUC_CONST;
int pgm_error_from_eai_errno (const int, const int) PGM_GNUC_CONST;
int pgm_error_from_wsa_errno (const int) PGM_GNUC_CONST;
int pgm_error_from_win_errno (const int) PGM_GNUC_CONST;
//#define PGM_GSISTRLEN (sizeof("000.000.000.000.000.000"))
//#define PGM_GSI_INIT {{ 0, 0, 0, 0, 0, 0 }}
//#define PGM_TSISTRLEN (sizeof("000.000.000.000.000.000.00000"))
//#define PGM_TSI_INIT { PGM_GSI_INIT, 0 }
typedef struct pgm_gsi_t {
uint8_t identifier[6];
} pgm_gsi_t;
typedef struct pgm_tsi_t {
pgm_gsi_t gsi;
uint16_t sport;
} pgm_tsi_t;
bool pgm_gsi_create_from_hostname( pgm_gsi_t*, pgm_error_t** );
bool pgm_gsi_create_from_addr( pgm_gsi_t*, pgm_error_t** );
bool pgm_gsi_create_from_data( pgm_gsi_t*, const uint8_t*, const size_t );
bool pgm_gsi_create_from_string( pgm_gsi_t*, const char*, ssize_t );
int pgm_gsi_print_r( const pgm_gsi_t*, char*, const size_t );
char* pgm_gsi_print( const pgm_gsi_t* );
bool pgm_gsi_equal( const void*restrict, const void*restrict);
char* pgm_tsi_print( const pgm_tsi_t*);
int pgm_tsi_print_r( const pgm_tsi_t*restrict, char*restrict, size_t);
bool pgm_tsi_equal( const void*restrict, const void*restrict);
bool pgm_http_init (uint16_t, pgm_error_t**);
bool pgm_http_shutdown (void);
void pgm_if_print_all (void);
PGM_STATIC_ASSERT(sizeof(struct pgm_tsi_t) == 8);
|
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local feed= helpers.feed
local source = helpers.source
local clear = helpers.clear
local feed_command = helpers.feed_command
describe('prompt buffer', function()
local screen
before_each(function()
clear()
screen = Screen.new(25, 10)
screen:attach()
source([[
func TextEntered(text)
if a:text == "exit"
set nomodified
stopinsert
close
else
call append(line("$") - 1, 'Command: "' . a:text . '"')
set nomodfied
call timer_start(20, {id -> TimerFunc(a:text)})
endif
endfunc
func TimerFunc(text)
call append(line("$") - 1, 'Result: "' . a:text .'"')
endfunc
]])
feed_command("set noshowmode | set laststatus=0")
feed_command("call setline(1, 'other buffer')")
feed_command("new")
feed_command("set buftype=prompt")
feed_command("call prompt_setcallback(bufnr(''), function('TextEntered'))")
end)
after_each(function()
screen:detach()
end)
it('works', function()
screen:expect([[
^ |
~ |
~ |
~ |
[Prompt] |
other buffer |
~ |
~ |
~ |
|
]])
feed("i")
feed("hello\n")
screen:expect([[
% hello |
Command: "hello" |
Result: "hello" |
% ^ |
[Prompt] [+] |
other buffer |
~ |
~ |
~ |
|
]])
feed("exit\n")
screen:expect([[
^other buffer |
~ |
~ |
~ |
~ |
~ |
~ |
~ |
~ |
|
]])
end)
it('editing', function()
screen:expect([[
^ |
~ |
~ |
~ |
[Prompt] |
other buffer |
~ |
~ |
~ |
|
]])
feed("i")
feed("hello<BS><BS>")
screen:expect([[
% hel^ |
~ |
~ |
~ |
[Prompt] [+] |
other buffer |
~ |
~ |
~ |
|
]])
feed("<Left><Left><Left><BS>-")
screen:expect([[
% -^hel |
~ |
~ |
~ |
[Prompt] [+] |
other buffer |
~ |
~ |
~ |
|
]])
feed("<End>x")
screen:expect([[
% -helx^ |
~ |
~ |
~ |
[Prompt] [+] |
other buffer |
~ |
~ |
~ |
|
]])
feed("<C-U>exit\n")
screen:expect([[
^other buffer |
~ |
~ |
~ |
~ |
~ |
~ |
~ |
~ |
|
]])
end)
end)
|
--[[
The look of the buttons/numbers/arrow can be altered by adding this addon to the
OptionalDeps of an external addon which then overrides the functions under the "Overridables" header.
]]
local _, addon = ...
BossesKilled = addon
function addon:PLAYER_LOGIN()
-- Hook raid finder frame's onshow and onhide
if RaidFinderQueueFrame and RaidFinderQueueFrame_SetRaid then
local function myRaidFinderFrame_OnShow(frame)
self:CreateButtons(frame, GetNumRFDungeons, GetRFDungeonInfo, RaidFinderQueueFrame_SetRaid)
self:UpdateButtonsAndTooltips(frame)
self:UpdateQueueStatuses()
self.UpdateArrow()
self:RegisterEvent("LFG_UPDATE")
self.LFG_UPDATE = self.UpdateQueueStatuses -- Our event dispatcher calls functions like addon[eventName](...), so point it to the right update function
end
local function myRaidFinderFrame_OnHide(frame)
self:UnregisterEvent("LFG_UPDATE")
end
RaidFinderQueueFrame:HookScript("OnShow", myRaidFinderFrame_OnShow)
RaidFinderQueueFrame:HookScript("OnHide", myRaidFinderFrame_OnHide)
hooksecurefunc("RaidFinderQueueFrame_SetRaid", self.UpdateArrow)
end
end
addon:RegisterEvent("PLAYER_LOGIN")
-- Creates the buttons. LFR and Flex use different functions and dropdown menus so take them as arguments
function addon:CreateButtons(parentFrame, DungeonAmountFunc, DungeonInfoFunc, SetDropdownMenuFunc)
local scale = self:GetButtonScale(DungeonAmountFunc())
if not parentFrame.BossesKilledButtons then
parentFrame.BossesKilledButtons = {}
end
local buttons = parentFrame.BossesKilledButtons
for i = 1, DungeonAmountFunc() do
local id, name = DungeonInfoFunc(i)
local isAvailable, isAvailableToPlayer = IsLFGDungeonJoinable(id)
-- Only make a button if there's data for it, and it hasn't been already made. This gets called multiple times so it updates correctly when you open up more raids
if isAvailable and isAvailableToPlayer and not buttons[id] and self.raidData[id] then
local button = self:CreateButton(parentFrame, scale)
buttons[id] = button
button.dungeonID = id
button.dungeonName = name
parentFrame.lastButton = button
-- I just realised a CheckButton might already have it's own FontString, but uh... whatever.
button.number = self:CreateNumberFontstring(button)
button:SetScript("OnEnter", function(this)
if this.tooltip then
self:ShowTooltip(this)
end
end)
button:SetScript("OnClick", function(this)
SetDropdownMenuFunc(this.dungeonID)
self.UpdateArrow()
-- This is to override the automatic highlighting when you click the button, while we want to use that to show queue status instead.
-- I've no idea why simply overriding this OnClick and not doing a SetChecked doesn't disable the behavior.
-- I probably shouldn't be using a CheckButton at all, but the SpellBookSkillLineTabTemplate looks pretty nice for the job.
this:SetChecked(this.checked)
end)
button.checked = false
end
end
end
---------------------------------------- Overridables ----------------------------------------
-- Must return a CheckButton, or implement :SetChecked() and support OnClick scripts. Not 100% right now if anything else
function addon:CreateButton(parent, scale)
local button = CreateFrame("CheckButton", parent:GetName().."BossesKilledButton"..tostring(id), parent, "SpellBookSkillLineTabTemplate")
button:Show()
if parent.lastButton then
button:SetPoint("TOPLEFT", parent.lastButton, "BOTTOMLEFT", 0, -15)
else
local x = 3
-- SocialTabs compatibility
if IsAddOnLoaded("SocialTabs") then
x = x + ceil(32 / scale)
end
button:SetPoint("TOPLEFT", parent, "TOPRIGHT", x, -50)
end
button:SetScale(scale)
button:SetWidth(32 + 16) -- Originally 32
-- Need to find the button's texture in the regions so we can resize it. I don't like this part, but I can't think of a better way in case it's not the first region returned. (Is it ever not?)
for _, region in ipairs({button:GetRegions()}) do
if type(region) ~= "userdata" and region.GetTexture and region:GetTexture() == "Interface\\SpellBook\\SpellBook-SkillLineTab" then
region:SetWidth(64 + 24) -- Originally 64
break
end
end
return button
end
function addon:GetButtonScale(numDungeons)
-- Ok, I still don't understand anything about the positioning and sizing of stuff in WoW, but the target frame is about 280'ish tall and buttons 32 and who gives a shit about margins and aaargh I'm going crazy /headexplode
-- Magic numbers! There's really no method to the madness, these numbers just happen to look ok
return min(480 / (numDungeons * 17), 1) -- 24 17
end
-- Must return a fontstring
function addon:CreateNumberFontstring(parentButton)
local number = parentButton:CreateFontString(parentButton:GetName().."Number", "OVERLAY", "SystemFont_Shadow_Huge3")
number:SetPoint("TOPLEFT", -4, 4)
number:SetPoint("BOTTOMRIGHT", 5, -5)
return number
end
-- Must return a texture, which will be pointing to selected dungeon's button
function addon:CreateArrow()
local arrow = GroupFinderFrame:CreateTexture("BossesKilledArrow", "ARTWORK")
arrow:SetTexture("Interface\\ChatFrame\\ChatFrameExpandArrow")
arrow:SetTexCoord(1, 0, 0, 1) -- This somehow turns the arrow other way around. Magic. /shrug
arrow:SetSize(32, 32) -- Originally 16, 16
arrow:Hide()
return arrow
end
--------------------------------------- Update functions -------------------------------------
function addon:UpdateButtonsAndTooltips(parentFrame)
local buttons = parentFrame.BossesKilledButtons
for id, button in pairs(buttons) do
local numKilled = 0
-- GetLFGDungeonNumEncounters returns the full set of bosses for the whole raid, while LFR and Flex raids
-- are split into several separate raids, so get the amount of bosses and where to start from from our data file
local index = self.raidData[id].startFrom
local numEncounters = self.raidData[id].numEncounters
-- Tooltip format:
-- Button.tooltip = {
-- { -- #1
-- text = "Text for the button",
-- color = { redValueFloat, greenValueFloat, blueValueFloat } -- Omit to get default color
-- },
-- {...} -- #2 etc etc
-- }
local tooltip = {{text = button.dungeonName}} -- Set up tooltip data with the dungeon name
for i = index, numEncounters + index - 1 do
if id == 847 and i == 3 then
i = 7
end
if id == 846 and i == 4 then
i = 3
end
if id == 846 and i == 6 then
i = 8
end
if id == 848 and i == 7 then
i = 4
end
if id == 848 and i == 8 then
i = 6
end
if id == 984 and i == 9 then
i = 11
end
if id == 985 and i == 10 then
i = 9
end
if id == 985 and i == 11 then
i = 10
end
local encounterLine = {}
local bossName, _, isDead = GetLFGDungeonEncounterInfo(id, i)
if isDead then
if ENABLE_COLORBLIND_MODE == "0" then -- TODO: figure out if it's 0/false/null when not set
encounterLine.color = {RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b}
end
if bossName == nil then
bossName = "bossname"
encounterLine.text = "Dead - "..bossName
else
encounterLine.text = "Dead - "..bossName
numKilled = numKilled + 1
end
else
if ENABLE_COLORBLIND_MODE == "0" then
encounterLine.color = {GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b}
end
if bossName == nil then
bossName = "bossname"
encounterLine.text = "Alive - "..bossName
else
encounterLine.text = "Alive - "..bossName
end
end
table.insert(tooltip, encounterLine)
end
button.tooltip = tooltip
local statusString = numKilled.."/"..numEncounters
if ENABLE_COLORBLIND_MODE == "1" then
button.number:SetFormattedText("|c00ffffff%s|r", statusString)
else
button.number:SetFormattedText(self.textColorTable[statusString], statusString)
end
end
end
function addon:UpdateQueueStatuses()
for id, button in pairs(RaidFinderQueueFrame.BossesKilledButtons) do
local mode = GetLFGMode(LE_LFG_CATEGORY_RF, id);
if mode == "queued" or mode == "listed" or mode == "rolecheck" or mode == "suspended" then
button:SetChecked(true)
button.checked = true -- This is for the PostClick script earlier
else
button:SetChecked(false)
button.checked = false
end
end
end
-- Not a method because it's used as callback for hooksecurefuncs so it would get the wrong "self"
function addon.UpdateArrow()
local self = addon
if not self.arrow then
self.arrow = self:CreateArrow()
end
local parent
if RaidFinderQueueFrame and RaidFinderQueueFrame:IsVisible() then
parent = RaidFinderQueueFrame
else
self.arrow:Hide()
return
end
if parent.raid and parent.BossesKilledButtons[parent.raid] then
local button = parent.BossesKilledButtons[parent.raid]
self.arrow:SetParent(button) -- Re-set the parent so we inherit the scale, so our smaller LFR buttons get a smaller arrow
self.arrow:SetPoint("LEFT", button, "RIGHT")
self.arrow:Show()
end
end
--------------------------------- Tooltip and colorization stuff -----------------------------
function addon:ShowTooltip(button)
GameTooltip:SetOwner(button, "ANCHOR_RIGHT")
for i = 1, #button.tooltip do
tooltip = button.tooltip[i]
if tooltip.color then
GameTooltip:AddLine(tooltip.text, unpack(tooltip.color))
else
GameTooltip:AddLine(tooltip.text)
end
end
GameTooltip:AddLine(" ")
GameTooltip:AddLine("<Click to select this raid>")
GameTooltip:AddLine(" ")
if ENABLE_COLORBLIND_MODE == "1" then -- TODO: Remove duplicates. Only check for not ENABLE_COLORBLIND_MODE in which case add the first AddLine. After outside of if, add second AddLine
GameTooltip:AddLine("(Button lights up if you're queued for this raid)")
else
GameTooltip:AddLine("(|c00ff0000Red|r for killed bosses, |c0000ff00green|r for alive ones,")
GameTooltip:AddLine(" button lights up if you're queued for this raid)")
end
GameTooltip:Show()
end
-- gets passed a "x/y" STRING. No sanity checks so make sure the calling function feeds it the expected format.
-- the vararg gets passed color triples, eg. 0.0,1.0,0.0, 1.0,0.0,0.0 (green to red)
function addon:TextColorGradient(str_percent, ...)
local num = select("#", ...)
local low, high = strmatch(str_percent, "(%d+)/(%d+)")
local percent = (low + 0) / (high + 0) -- implicit cast to number, cheaper than tonumber
local r, g, b
if percent >= 1 then
r, g, b = select(num - 2, ...), select(num - 1, ...), select(num, ...)
return format("|cff%02x%02x%02x%%s|r", r * 255, g * 255, b * 255)
elseif percent <= 0 then
r, g, b = ...
return format("|cff%02x%02x%02x%%s|r", r * 255, g * 255, b * 255)
end
local segment, relperc = math.modf(percent * (num / 3 - 1))
local r1, g1, b1, r2, g2, b2
r1, g1, b1 = select((segment * 3) + 1, ...), select((segment * 3) + 2, ...), select((segment * 3) + 3, ...)
r2, g2, b2 = select((segment * 3) + 4, ...), select((segment * 3) + 5, ...), select((segment * 3) + 6, ...)
if not r2 or not g2 or not b2 then
r, g, b = r1, g1, b1
else
r, g, b = r1 + (r2 - r1) * relperc,
g1 + (g2 - g1) * relperc,
b1 + (b2 - b1) * relperc
end
return format("|cff%02x%02x%02x%%s|r", r * 255, g * 255, b * 255)
end
-- Use a memoization table so each x/y colorstring is only computed once and then does a simple lookup
addon.textColorTable = setmetatable({}, {__index = function(t, k)
local colorStr = addon:TextColorGradient(k, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, -- "From" color
RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b) -- "To" color
rawset(t, k, colorStr)
return colorStr
end}) |
local M = {}
M.post = function()
local which_key = require 'which-key'
local nnoremap = vim.keymap.nnoremap
vim.g.dashboard_default_executive = 'telescope'
vim.g.dashboard_custom_header = {
[[ ___..._ _...___]],
[[/'--.._ `'-="""=-'` _..--'\]],
[[| ~. ) _ _ ( .~ |]],
[[ \ '~/ a _ a \~' /]],
[[ \ `| / \ |` /]],
[[ `'--\ \_/ /--'`]],
[[ .'._ J__.-'.]],
[[ / / '-/_ `- \]],
[[ / -"-'-. '-.__/]],
[[ \__,-.\/ | `\]],
[[ / ;---. .--' |]],
[[ | /\'-' /]],
[[ '.___.\ _.--;'`)]],
[[ '-' `"]],
}
vim.g.dashboard_custom_section = {
a = {
description = { ' New File SPC f n' },
command = 'DashboardNewFile',
},
b = {
description = { ' Find File SPC f d' },
command = 'Telescope git_files',
},
c = {
description = { ' Sync Plugins ' },
command = 'PackerSync',
},
d = {
description = { ' Compile Plugins ' },
command = 'PackerCompile',
},
}
vim.g.dashboard_custom_footer = {
'MKII',
}
which_key.register(
{ f = { n = { '<cmd>DashboardNewFile<CR>', 'New File' } } },
{ prefix = '<leader>' }
)
end
return M
|
--This script runs a graphical user interface (GUI) in order to built up a documentation tree of the current repository and a documentation of related files and repositories. It displays the tree saved in documentation_tree.lua
--1. basic data
--1.1 libraries and clipboard
--1.1.1 libraries
require("iuplua") --require iuplua for GUIs
require("iuplua_scintilla") --for Scintilla-editor
--1.1.2 initalize clipboard
clipboard=iup.clipboard{}
--1.1.3 math.integer for Lua 5.1 and Lua 5.2
if _VERSION=='Lua 5.1' then
function math.tointeger(a) return a end
elseif _VERSION=='Lua 5.2' then
function math.tointeger(a) return a end
end --if _VERSION=='Lua 5.1' then
--1.1.4 securisation by allowing only necessary os.execute commands
do --sandboxing
local old=os.date("%H%M%S")
local secureTable={}
secureTable[old]=os.execute
function os.execute(a)
if
a:lower():match("^sftp ") or
a:lower():match("^dir ") or
a:lower():match("^pause") or
a:lower():match("^title") or
a:lower():match("^md ") or
a:lower():match("^copy ") or
a:lower():match("^color ") or
a:lower():match("^start ") or
a:lower():match("^cls")
then
return secureTable[old](a)
else
print(a .." ist nicht erlaubt.")
end --if a:match("del") then
end --function os.execute(a)
secureTable[old .. "1"]=io.popen
function io.popen(a)
if
a:lower():match("^dir ") or
a:lower():match('^"dir ')
then
return secureTable[old .. "1"](a)
else
print(a .." ist nicht erlaubt.")
end --if a:match("del") then
end --function io.popen(a)
end --do --sandboxing
--1.2 color section
--1.2.1 color of the console associated with the graphical user interface if started with lua54.exe and not wlua54.exe
os.execute('color 71')
--1.2.2 colors
color_red="135 131 28"
color_light_color_grey="96 197 199"
color_grey="162 163 165"
color_blue="18 132 86"
--1.2.3 color definitions
color_background=color_light_color_grey
color_buttons=color_blue -- works only for flat buttons
color_button_text="255 255 255"
color_background_tree="246 246 246"
--2.1 path of the graphical user interface and filename of this script
path=arg[0]:match("(.*)\\")
--test with: print(path)
thisfilename=arg[0]:match("\\([^\\]+)$")
--test with: print(arg[0])
--test with: print(thisfilename)
--test with (status before installment): for k,v in pairs(installTable) do print(k,v) end
--3 functions
--3.1 general Lua functions
--3.1.1 function checking if file exits
function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end --function file_exists(name)
--3.1.2 function escaping magic characters
function string.escape_forbidden_char(insertstring) --this function takes a string and returns the same string with escaped characters
return insertstring:gsub("\\", "\\\\"):gsub("\"", "\\\""):gsub("\'", "\\\'"):gsub("\n", "\\n"):gsub("\r", "\\n")
end --function string.escape_forbidden_char(insertstring)
--3.1.3 general function for distance between texts
function string.levenshtein(str1, str2)
local len1 = string.len(str1)
local len2 = string.len(str2)
local matrix = {}
local cost = 0
-- quick cut-offs to save time
if (len1 == 0) then
return len2
elseif (len2 == 0) then
return len1
elseif (str1 == str2) then
return 0
end --if (len1 == 0) then
-- initialise the base matrix values
for i = 0, len1, 1 do
matrix[i] = {}
matrix[i][0] = i
end --for i = 0, len1, 1 do
for j = 0, len2, 1 do
matrix[0][j] = j
end --for j = 0, len2, 1 do
-- actual Levenshtein algorithm
for i = 1, len1, 1 do
for j = 1, len2, 1 do
if (str1:byte(i) == str2:byte(j)) then
cost = 0
else
cost = 1
end --if (str1:byte(i) == str2:byte(j)) then
matrix[i][j] = math.min(matrix[i-1][j] + 1, matrix[i][j-1] + 1, matrix[i-1][j-1] + cost)
end --for j = 1, len2, 1 do
end --for i = 1, len1, 1 do
-- return the last value - this is the Levenshtein distance
return matrix[len1][len2]
end --function string.levenshtein(str1, str2)
--3.2 function to change expand/collapse relying on depth
--This function is needed in the expand/collapsed dialog. This function relies on the depth of the given level.
function change_state_level(new_state,level,descendants_also)
if descendants_also=="YES" then
for i=0,tree.count-1 do
if tree["depth" .. i]==level then
iup.TreeSetNodeAttributes(tree,i,{state=new_state}) --changing the state of current node
iup.TreeSetDescendantsAttributes(tree,i,{state=new_state})
end --if tree["depth" .. i]==level then
end --for i=0,tree.count-1 do
else
for i=0,tree.count-1 do
if tree["depth" .. i]==level then
iup.TreeSetNodeAttributes(tree,i,{state=new_state})
end --if tree["depth" .. i]==level then
end --for i=0,tree.count-1 do
end --if descendants_also=="YES" then
end --function change_state_level(new_state,level,descendants_also)
--3.3 function to change expand/collapse relying on keyword
--This function is needed in the expand/collapsed dialog. This function changes the state for all nodes, which match a keyword. Otherwise it works like change_stat_level.
function change_state_keyword(new_state,keyword,descendants_also)
if descendants_also=="YES" then
for i=0,tree.count-1 do
if tree["title" .. i]:match(keyword)~=nil then
iup.TreeSetNodeAttributes(tree,i,{state=new_state})
iup.TreeSetDescendantsAttributes(tree,i,{state=new_state})
end --if tree["title" .. i]:match(keyword)~=nil then
end --for i=0,tree.count-1 do
else
for i=0,tree.count-1 do
if tree["title" .. i]:match(keyword)~=nil then
iup.TreeSetNodeAttributes(tree,i,{state=new_state})
end --if tree["title" .. i]:match(keyword)~=nil then
end --for i=0,tree.count-1 do
end --if descendants_also=="YES" then
end --function change_state_keyword(new_state,level,descendants_also)
--3 functions end
--4. dialogs
--4.1 expand and collapse dialog
--function needed for the expand and collapse dialog
function button_expand_collapse(new_state)
if toggle_level.value=="ON" then
if checkbox_descendants_collapse.value=="ON" then
change_state_level(new_state,tree.depth,"YES")
else
change_state_level(new_state,tree.depth)
end --if checkbox_descendants_collapse.value="ON" then
elseif toggle_keyword.value=="ON" then
if checkbox_descendants_collapse.value=="ON" then
change_state_keyword(new_state,text_expand_collapse.value,"YES")
else
change_state_keyword(new_state,text_expand_collapse.value)
end --if checkbos_descendants_collapse.value=="ON" then
end --if toggle_level.value="ON" then
end --function button_expand_collapse(new_state)
--button for expanding branches
expand_button=iup.flatbutton{title="Ausklappen",size="EIGHTH",BGCOLOR=color_buttons,FGCOLOR=color_button_text}
function expand_button:flat_action()
button_expand_collapse("EXPANDED") --call above function with expand as new state
end --function expand_button:flat_action()
--button for collapsing branches
collapse_button=iup.flatbutton{title="Einklappen",size="EIGHTH",BGCOLOR=color_buttons,FGCOLOR=color_button_text}
function collapse_button:flat_action()
button_expand_collapse("COLLAPSED") --call above function with collapsed as new state
end --function collapse_button:flat_action()
--button for cancelling the dialog
cancel_expand_collapse_button=iup.flatbutton{title="Abbrechen",size="EIGHTH",BGCOLOR=color_buttons,FGCOLOR=color_button_text}
function cancel_expand_collapse_button:flat_action()
return iup.CLOSE
end --function cancel_expand_collapse_button:flat_action()
--toggle if expand/collapse should be applied to current depth
toggle_level=iup.toggle{title="Nach aktueller Ebene", value="ON"}
function toggle_level:action()
text_expand_collapse.active="NO"
end --function toggle_level:action()
--toggle if expand/collapse should be applied to search, i.e. to all nodes containing the text in the searchfield
toggle_keyword=iup.toggle{title="Nach Suchwort", value="OFF"}
function toggle_keyword:action()
text_expand_collapse.active="YES"
end --function toggle_keyword:action()
--radiobutton for toggles, if search field or depth expand/collapse function
radio=iup.radio{iup.hbox{toggle_level,toggle_keyword},value=toggle_level}
--text field for expand/collapse
text_expand_collapse=iup.text{active="NO",expand="YES"}
--checkbox if descendants also be changed
checkbox_descendants_collapse=iup.toggle{title="Auf untergeordnete Knoten anwenden",value="ON"}
--put this together into a dialog
dlg_expand_collapse=iup.dialog{
iup.vbox{
iup.hbox{radio},
iup.hbox{text_expand_collapse},
iup.hbox{checkbox_descendants_collapse},
iup.hbox{expand_button,collapse_button,cancel_expand_collapse_button},
};
defaultenter=expand_button,
defaultesc=cancel_expand,
title="Ein-/Ausklappen",
size="QUARTER",
startfocus=searchtext,
}
--4.1 expand and collapse dialog end
--4. dialogs end
--5. no context menus
--6 buttons
--6.1 logo image definition and button with logo
img_logo = iup.image{
{ 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,1,3,3,1,1,3,3,3,1,1,1,1,1,3,1,1,1,3,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,1,3,3,1,1,3,1,1,3,1,1,1,1,3,1,1,3,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,3,3,3,3,1,1,1,1,1,3,1,1,3,1,1,1,1,3,1,3,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,3,3,3,4,4,3,1,1,1,1,3,3,3,3,1,1,1,1,3,3,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,3,3,3,3,4,4,3,3,1,1,1,3,1,1,1,3,1,1,1,3,1,3,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,3,3,3,3,3,3,3,3,1,1,1,3,1,1,1,3,1,1,1,3,1,1,3,1,1,1,1,1,4,4,4 },
{ 4,1,1,3,3,3,3,3,3,3,3,1,1,1,3,3,3,3,1,1,3,1,3,1,1,1,3,1,3,1,1,4,4,4 },
{ 4,1,1,1,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,3,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,3,1,3,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,1,1,1,1,3,1,3,3,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,1,1,1,1,4,4,4,4,1,1,3,3,1,3,1,3,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,1,1,4,4,4,4,4,4,4,1,1,3,3,1,3,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,1,1,1,4,4,4,4,4,3,3,4,4,4,4,1,3,3,1,1,1,1,1,1,1,4,4,4,4 },
{ 4,1,1,1,1,1,1,1,4,4,4,4,3,3,3,3,3,3,4,4,4,3,1,1,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,1,4,4,4,4,4,3,3,3,3,3,3,3,3,3,4,3,4,1,1,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,1,1,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,1,1,1,1,1,1,4,4,4 },
{ 4,1,1,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,1,1,1,1,1,4,4,4 },
{ 4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,1,1,1,4,4,4 },
{ 4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,1,1,4,4,4 },
{ 4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,4,4,4 },
{ 4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4 },
{ 4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4 },
{ 4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4 },
{ 4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 },
{ 4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4 },
{ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4 },
{ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 },
{ 3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 },
{ 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 }
; colors = { "255 255 255", color_light_color_grey, color_blue, "255 255 255" }
}
button_logo=iup.button{image=img_logo,title="", size="23x20"}
function button_logo:action()
iup.Message("Dr. Bruno Kaiser","Lizenz Open Source\nb.kaiser@beckmann-partner.de")
end --function button_logo:flat_action()
--6.2 button for loading text file 1
button_loading_first_text_file=iup.flatbutton{title="Erste Textdatei laden", size="85x20", BGCOLOR=color_buttons, FGCOLOR=color_button_text}
function button_loading_first_text_file:flat_action()
local inputfile1
if file_exists(textbox1.value) then
inputfile1=io.open(textbox1.value,"r")
textfield1.value=inputfile1:read("*all")
inputfile1:close()
else
--build file dialog for reading text file
local filedlg=iup.filedlg{dialogtype="OPEN",title="Datei öffnen",filter="*.*",filterinfo="Text Files",directory=path}
filedlg:popup(iup.ANYWHERE,iup.ANYWHERE) --show the file dialog
if filedlg.status=="1" then
iup.Message("Neue Datei",filedlg.value)
elseif filedlg.status=="0" then --this is the usual case, when a file was choosen
textbox1.value=filedlg.value
inputfile1=io.open(filedlg.value,"r")
textfield1.value=inputfile1:read("*all")
inputfile1:close()
else
iup.Message("Die Baumansicht wird nicht aktualisiert","Es wurde keine Datei ausgewählt")
iup.NextField(maindlg)
end --if filedlg.status=="1" then
end --if file_exists(textbox1.value) then
end --function button_loading_first_text_file:flat_action()
--6.2.1 button for loading text file 1
button_scripter_first_text_file=iup.flatbutton{title="Skripter mit erster \nTextdatei starten", size="85x20", BGCOLOR=color_buttons, FGCOLOR=color_button_text}
function button_scripter_first_text_file:flat_action()
--read first line of file. If it is empty then scripter cannot open it. So open file with notepad.exe
if file_exists(textbox1.value) then inputfile=io.open(textbox1.value,"r") ErsteZeile=inputfile:read() inputfile:close() end
if file_exists(textbox1.value) and ErsteZeile then
os.execute('start "d" C:\\Lua\\iupluascripter54.exe "' .. textbox1.value .. '"')
elseif file_exists(textbox1.value) then
os.execute('start "d" notepad.exe "' .. textbox1.value .. '"')
else
os.execute('start "d" C:\\Lua\\iupluascripter54.exe ')
end --if file_exists(textbox1.value) and ErsteZeile then
end --function button_scripter_first_text_file:flat_action()
--6.3 button for loading text file 2
button_loading_second_text_file=iup.flatbutton{title="Zweite Textdatei laden", size="85x20", BGCOLOR=color_buttons, FGCOLOR=color_button_text}
function button_loading_second_text_file:flat_action()
local inputfile2
if file_exists(textbox2.value) then
inputfile1=io.open(textbox2.value,"r")
textfield2.value=inputfile1:read("*all")
inputfile1:close()
else
--build file dialog for reading text file
local filedlg=iup.filedlg{dialogtype="OPEN",title="Datei öffnen",filter="*.*",filterinfo="Text Files",directory=path}
filedlg:popup(iup.ANYWHERE,iup.ANYWHERE) --show the file dialog
if filedlg.status=="1" then
iup.Message("Neue Datei",filedlg.value)
elseif filedlg.status=="0" then --this is the usual case, when a file was choosen
textbox2.value=filedlg.value
inputfile2=io.open(filedlg.value,"r")
textfield2.value=inputfile2:read("*all")
inputfile2:close()
else
iup.Message("Die Baumansicht wird nicht aktualisiert","Es wurde keine Datei ausgewählt")
iup.NextField(maindlg)
end --if filedlg.status=="1" then
end --if file_exists(textbox2.value) then
end --function button_loading_second_text_file:flat_action()
--6.3.1 button for loading text file 2
button_scripter_second_text_file=iup.flatbutton{title="Skripter mit zweiter \nTextdatei starten", size="85x20", BGCOLOR=color_buttons, FGCOLOR=color_button_text}
function button_scripter_second_text_file:flat_action()
--read first line of file. If it is empty then scripter cannot open it. So open file with notepad.exe
if file_exists(textbox2.value) then inputfile=io.open(textbox2.value,"r") ErsteZeile=inputfile:read() inputfile:close() end
if file_exists(textbox2.value) and ErsteZeile then
os.execute('start "d" C:\\Lua\\iupluascripter54.exe "' .. textbox2.value .. '"')
elseif file_exists(textbox2.value) then
os.execute('start "d" notepad.exe "' .. textbox2.value .. '"')
else
os.execute('start "d" C:\\Lua\\iupluascripter54.exe ')
end --if file_exists(textbox2.value) and ErsteZeile then
end --function button_scripter_second_text_file:flat_action()
--6.3.2 button for loading all text files without versions in IUP Lua scripter found in first directory and subdirectories containing the search text
button_scripter_loading_text_files_with_search=iup.flatbutton{title="Skripter mit maximal x Textdateien im \nersten Ordner mit Suchergebnissen laden", size="150x20", BGCOLOR=color_buttons, FGCOLOR=color_button_text}
function button_scripter_loading_text_files_with_search:flat_action()
local directoryText
clipboard.text=textbox3.value
if textbox1.value:match("^.:\\") and textbox1.value:match("%.")==nil and textbox1.value:match("\\$")==nil then --directory without dot and without backslash at the end
directoryText=textbox1.value:match("(.*)")
elseif textbox1.value:match("^.:\\.*\\") then
directoryText=textbox1.value:match("(.*)\\")
end --if textbox1.value:match("^.:\\") then
if directoryText~=nil and textbox3.value~="" then
searchAlarm=iup.Alarm("Wollen Sie die Suche der Dateien in folgendem Verzeichnis?",tostring(directoryText)," Ja, bitte Suchen "," Nicht Suchen ")
if searchAlarm==1 then
local fileFound=""
local numberFileFound=0
p=io.popen('dir ' .. directoryText .. ' /b/o/s ')
for fileText in p:lines() do
--do not scan versions and archived files, lnk, js, sh, bat, office files and files with blanks
if fileText:match("%.js")==nil
and fileText:match(" ")==nil
and fileText:match("%.lnk")==nil
and fileText:match("%.bat")==nil
and fileText:match("%.sh")==nil
and fileText:match("%.html")==nil
and fileText:match("%.doc")==nil
and fileText:match("%.xls")==nil
and fileText:match("%.ppt")==nil
and fileText:match("%.accdb")==nil
and fileText:match("_Version(%d+)")==nil
and fileText:match("%d%d%d%d%d%d%d%d")==nil
and fileText:match("%(")==nil
and fileText:match("%)")==nil
then
local inputfile2=io.open(fileText,"r")
if inputfile2 then --open if it is a file, for directory inputfile2 is nil
inputText2=inputfile2:read("*all")
inputfile2:close()
if checkboxforcasesensitive.value=="OFF" then
if inputText2:lower():match(textbox3.value:lower()) and numberFileFound <math.tointeger(tonumber(textbox4.value)) then
fileFound=fileFound .. " " .. fileText
numberFileFound=numberFileFound+1
elseif inputText2:lower():match(textbox3.value:lower()) and numberFileFound >=math.tointeger(tonumber(textbox4.value)) then
numberFileFound=numberFileFound+1
end --if inputText2:lower():match(textbox3.value:lower()) then
else
if inputText2:match(textbox3.value) and numberFileFound <math.tointeger(tonumber(textbox4.value)) then
fileFound=fileFound .. " " .. fileText
numberFileFound=numberFileFound+1
elseif inputText2:match(textbox3.value) and numberFileFound >=math.tointeger(tonumber(textbox4.value)) then
numberFileFound=numberFileFound+1
end --if inputText2:lower():match(textbox3.value:lower()) then
end --if checkboxforcasesensitive.value=="ON" then
end --if inputfile2 then
end --if fileText:match("_Version(%d+)")==nil then
end --for fileText in p:lines() do
iup.Message("Fundstellen in " .. numberFileFound .. " Dateien mit den ersten " .. math.tointeger(tonumber(textbox4.value)) .. " Dateien:",fileFound:gsub(" ","\n"))
if numberFileFound>0 then
os.execute('start "d" C:\\Lua\\iupluascripter54.exe ' .. fileFound .. " ")
end --if numberFileFound>0 then
else
iup.Message("Keine Suche","Es wird nicht gesucht.")
end --if searchAlarm==1 then
end --if directoryText~=nil then
end --function button_scripter_loading_text_files_with_search:flat_action()
--6.4 button for expand and collapse
button_expand_collapse_dialog=iup.flatbutton{title="Ein-/\nAusklappen", size="55x20", BGCOLOR=color_buttons, FGCOLOR=color_button_text}
function button_expand_collapse_dialog:flat_action()
text_expand_collapse.value=tree.title
dlg_expand_collapse:popup(iup.ANYWHERE, iup.ANYWHERE)
end --function button_expand_collapse_dialog:flat_action()
--6.5.1 button for filtering the two texts to be compared on filtered lines
button_filter=iup.flatbutton{title="Texte \nfiltern", size="55x20", BGCOLOR=color_buttons, FGCOLOR=color_button_text}
function button_filter:flat_action()
local textSubsitute=""
for line in (textfield1.value .. "\n"):gmatch("([^\n]*)\n") do
if line:match(textbox3.value) then
textSubsitute=textSubsitute .. line .. "\n"
end --if line:match(textbox3.value) then
end --for line in (textbox3.value .. "\n"):gmatch("([^\n]*)\n") do
textfield1.value=textSubsitute
textSubsitute=""
for line in (textfield2.value .. "\n"):gmatch("([^\n]*)\n") do
if line:match(textbox3.value) then
textSubsitute=textSubsitute .. line .. "\n"
end --if line:match(textbox3.value) then
end --for line in (textbox3.value .. "\n"):gmatch("([^\n]*)\n") do
textfield2.value=textSubsitute
end --function button_filter:flat_action()
--6.5.2 button for filtering negatively the two texts to be compared on filtered lines
button_filter_negatively=iup.flatbutton{title="Texte negativ\nfiltern", size="55x20", BGCOLOR=color_buttons, FGCOLOR=color_button_text}
function button_filter_negatively:flat_action()
local textSubsitute=""
for line in (textfield1.value .. "\n"):gmatch("([^\n]*)\n") do
if line:match(textbox3.value)==nil then
textSubsitute=textSubsitute .. line .. "\n"
end --if line:match(textbox3.value)==nil then
end --for line in (textbox3.value .. "\n"):gmatch("([^\n]*)\n") do
textfield1.value=textSubsitute
textSubsitute=""
for line in (textfield2.value .. "\n"):gmatch("([^\n]*)\n") do
if line:match(textbox3.value)==nil then
textSubsitute=textSubsitute .. line .. "\n"
end --if line:match(textbox3.value)==nil then
end --for line in (textbox3.value .. "\n"):gmatch("([^\n]*)\n") do
textfield2.value=textSubsitute
end --function button_filter_negatively:flat_action()
--6.6 button for comparing text file of tree and text file of tree2
button_compare=iup.flatbutton{title="Textdateien \nvergleichen", size="55x20", BGCOLOR=color_buttons, FGCOLOR=color_button_text}
function button_compare:flat_action()
tree.delnode0 = "CHILDREN"
tree.title='compare'
--make the comparison
--go through text file 2
tree_script={branchname="compare",{branchname="Vergleich von " .. tostring(textbox1.value) .. " mit " .. tostring(textbox2.value)}}
local file2existsTable={}
local file2numberTable={}
for line in (textfield2.value .. "\n"):gmatch("([^\n]*)\n") do
file2numberTable[#file2numberTable+1]=line
file2existsTable[line]=#file2numberTable
end --for line in (textfield2.value .. "\n"):gmatch("([^\n]*)\n") do
--go through text file 1
local lineNumber=0
local file1existsTable={}
for line in (textfield1.value .. "\n"):gmatch("([^\n]*)\n") do
file1existsTable[line]=true
lineNumber=lineNumber+1
if line==file2numberTable[lineNumber] then
if tree_script[#tree_script].branchname=="gleich" then
tree_script[#tree_script][#tree_script[#tree_script]+1]=lineNumber .. ": " .. line
else
tree_script[#tree_script+1]={branchname="gleich"}
tree_script[#tree_script][#tree_script[#tree_script]+1]=lineNumber .. ": " .. line
end --if tree_script[#tree_script].branchname=="gleich" then
elseif file2existsTable[line] and lineNumber>file2existsTable[line] then
if tree_script[#tree_script].branchname=="gleich siehe oben" then
tree_script[#tree_script][#tree_script[#tree_script]+1]=lineNumber .. ": " .. line
else
tree_script[#tree_script+1]={branchname="gleich siehe oben"}
tree_script[#tree_script][#tree_script[#tree_script]+1]=lineNumber .. ": " .. line
end --if tree_script[#tree_script].branchname=="gleich siehe oben" then
elseif file2existsTable[line] and lineNumber<file2existsTable[line] then
if tree_script[#tree_script].branchname=="gleich siehe unten" then
tree_script[#tree_script][#tree_script[#tree_script]+1]=lineNumber .. ": " .. line
else
tree_script[#tree_script+1]={branchname="gleich siehe unten"}
tree_script[#tree_script][#tree_script[#tree_script]+1]=lineNumber .. ": " .. line
end --if tree_script[#tree_script].branchname=="gleich siehe unten" then
else
--without Levenshtein distance: tree_script[#tree_script+1]={branchname="unterschiedlich",{branchname=lineNumber .. ": " .. line,lineNumber .. ": " .. tostring(file2numberTable[lineNumber])}}
tree_script[#tree_script+1]={branchname="unterschiedlich",{branchname=lineNumber .. ": " .. line,{branchname=lineNumber .. ": " .. tostring(file2numberTable[lineNumber]) ,"Levenshtein-Distanz: " .. string.levenshtein(line, tostring(file2numberTable[lineNumber]))}}}
end --if file2Table[line] then
end --for line in (textfield1.value .. "\n"):gmatch("([^\n]*)\n") do
--go through text file 1 to search for missing lines in text file 2
local line1Number=0
for line in (textfield1.value .. "\n"):gmatch("([^\n]*)\n") do
line1Number=line1Number+1
if file2existsTable[line]==nil then
if tree_script[#tree_script].branchname=="nur in erster Datei" then
tree_script[#tree_script][#tree_script[#tree_script]+1]=line1Number .. ": " .. line
else
tree_script[#tree_script+1]={branchname="nur in erster Datei"}
tree_script[#tree_script][#tree_script[#tree_script]+1]=line1Number .. ": " .. line
end --if tree_script[#tree_script].branchname=="nur in erster Datei" then
end --if file2existsTable[line] then
end --for line in (textfield1.value .. "\n"):gmatch("([^\n]*)\n") do
--go through text file 2 to search for missing lines in text file 1
local line2Number=0
for line in (textfield2.value .. "\n"):gmatch("([^\n]*)\n") do
line2Number=line2Number+1
if file1existsTable[line]==nil then
if tree_script[#tree_script].branchname=="nur in zweiter Datei" then
tree_script[#tree_script][#tree_script[#tree_script]+1]=line2Number .. ": " .. line
else
tree_script[#tree_script+1]={branchname="nur in zweiter Datei"}
tree_script[#tree_script][#tree_script[#tree_script]+1]=line2Number .. ": " .. line
end --if tree_script[#tree_script].branchname=="nur in zweiter Datei" then
end --if file1existsTable[line] then
end --for line in (textfield2.value .. "\n"):gmatch("([^\n]*)\n") do
--build the compare tree
iup.TreeAddNodes(tree,tree_script)
end --function button_compare:flat_action()
--6.7 button with second logo
button_logo2=iup.button{image=img_logo,title="", size="23x20"}
function button_logo2:action()
iup.Message("Dr. Bruno Kaiser","Lizenz Open Source\nb.kaiser@beckmann-partner.de")
end --function button_logo:flat_action()
--6 buttons end
--7 Main Dialog
--7.1 textboxes
textbox1 = iup.multiline{value="",size="320x20",WORDWRAP="YES"}
textbox2 = iup.multiline{value="",size="320x20",WORDWRAP="YES"}
textbox3 = iup.multiline{value="",size="220x20",WORDWRAP="YES"}
textbox4 = iup.text{value="12",size="30x20"}
--7.1.1 checkboxes
checkboxforcasesensitive = iup.toggle{title="Groß-/\nKleinschreibung", value="OFF"} --checkbox for casesensitiv search
--7.2 display empty compare tree
actualtree={branchname="compare"}
tree=iup.tree{
map_cb=function(self)
self:AddNodes(actualtree)
end, --function(self)
SIZE="400x320",
showrename="YES",--F2 key active
markmode="SINGLE",--for Drag & Drop SINGLE not MULTIPLE
showdragdrop="YES",
}
--set the background color of the tree
tree.BGCOLOR=color_background_tree
--7.3.1 text file field as scintilla editor 1
textfield1=iup.scintilla{}
textfield1.SIZE="280x530" --I think this is not optimal! (since the size is so appears to be fixed)
--textfield1.wordwrap="WORD" --enable wordwarp
textfield1.WORDWRAPVISUALFLAGS="MARGIN" --show wrapped lines
textfield1.FONT="Courier New, 8" --font of shown code
textfield1.LEXERLANGUAGE="lua" --set the programming language to Lua for syntax higlighting
textfield1.KEYWORDS0="for end while date time if io elseif else execute do dofile require return break and or os type string nil not next false true gsub gmatch goto ipairs open popen pairs print" --list of keywords for syntaxhighlighting, this list is not complete and can be enlarged
--colors for syntax highlighting
textfield1.STYLEFGCOLOR0="0 0 0" -- 0-Default
textfield1.STYLEFGCOLOR1="0 128 0" -- 1-Lua comment
textfield1.STYLEFGCOLOR2="0 128 0" -- 2-Lua comment line
textfield1.STYLEFGCOLOR3="0 128 0" -- 3-JavaDoc/ Doxygen style Lua commen
textfield1.STYLEFGCOLOR4="180 0 0" -- 4-Number
textfield1.STYLEFGCOLOR5="0 0 255" -- 5-Keywords (id=0)
textfield1.STYLEFGCOLOR6="160 20 180" -- 6-String
textfield1.STYLEFGCOLOR7="128 0 0" -- 7-Character
textfield1.STYLEFGCOLOR8="160 20 180" -- 8-Literal string
textfield1.STYLEFGCOLOR9="0 0 255" -- 9-Old preprocessor block (obsolete)
textfield1.STYLEFGCOLOR10="128 0 0" -- 10-Operator
--textfield1.STYLEBOLD10="YES"
--textfield1.STYLEFGCOLOR11="255 0 255" -- 11-Identifier (this overwrites the default color)
--textfield1.STYLEITALIC10="YES"
textfield1.MARGINWIDTH0="40"
--7.3.2 text file field as scintilla editor 2
textfield2=iup.scintilla{}
textfield2.SIZE="280x530" --I think this is not optimal! (since the size is so appears to be fixed)
--textfield2.wordwrap="WORD" --enable wordwarp
textfield2.WORDWRAPVISUALFLAGS="MARGIN" --show wrapped lines
textfield2.FONT="Courier New, 8" --font of shown code
textfield2.LEXERLANGUAGE="lua" --set the programming language to Lua for syntax higlighting
textfield2.KEYWORDS0="for end while date time if io elseif else execute do dofile require return break and or os type string nil not next false true gsub gmatch goto ipairs open popen pairs print" --list of keywords for syntaxhighlighting, this list is not complete and can be enlarged
--colors for syntax highlighting
textfield2.STYLEFGCOLOR0="0 0 0" -- 0-Default
textfield2.STYLEFGCOLOR1="0 128 0" -- 1-Lua comment
textfield2.STYLEFGCOLOR2="0 128 0" -- 2-Lua comment line
textfield2.STYLEFGCOLOR3="0 128 0" -- 3-JavaDoc/ Doxygen style Lua commen
textfield2.STYLEFGCOLOR4="180 0 0" -- 4-Number
textfield2.STYLEFGCOLOR5="0 0 255" -- 5-Keywords (id=0)
textfield2.STYLEFGCOLOR6="160 20 180" -- 6-String
textfield2.STYLEFGCOLOR7="128 0 0" -- 7-Character
textfield2.STYLEFGCOLOR8="160 20 180" -- 8-Literal string
textfield2.STYLEFGCOLOR9="0 0 255" -- 9-Old preprocessor block (obsolete)
textfield2.STYLEFGCOLOR10="128 0 0" -- 10-Operator
--textfield2.STYLEBOLD10="YES"
--textfield2.STYLEFGCOLOR11="255 0 255" -- 11-Identifier (this overwrites the default color)
--textfield2.STYLEITALIC10="YES"
textfield2.MARGINWIDTH0="40"
--7.4 building the dialog and put buttons, trees and preview together
maindlg = iup.dialog{
--simply show a box with buttons
iup.vbox{
--first row of buttons
iup.hbox{
button_logo,
button_loading_first_text_file,
button_scripter_first_text_file,
iup.label{size="5x",},
button_loading_second_text_file,
button_scripter_second_text_file,
iup.label{size="5x",},
button_scripter_loading_text_files_with_search,
textbox3,
checkboxforcasesensitive,
iup.label{title="x: "},
textbox4,
iup.fill{},
button_filter,
button_filter_negatively,
button_compare,
iup.label{size="5x",},
button_expand_collapse_dialog,
iup.label{size="5x",},
button_logo2,
},
iup.hbox{
iup.frame{title="Erste Textdatei",iup.vbox{textbox1,textfield1,},},
iup.frame{title="Zweite Textdatei",iup.vbox{textbox2,textfield2,},},
iup.frame{title="Manuelle Zuordnung als Baum",tree,},
},
},
icon = img_logo,
title = path .. " Documentation Tree",
SIZE = 'FULLxFULL',
BACKGROUND=color_background
}
--7.5 show the dialog
maindlg:show()
--7.6 Main Loop
if (iup.MainLoopLevel()==0) then
iup.MainLoop()
end --if (iup.MainLoopLevel()==0) then
|
local get_user = require('get_user')
describe('get_user', function()
local GITTER_TOKEN = os.getenv('GITTER_TOKEN')
it('returns a table when required', function()
local module_type = type(get_user)
local expected = 'table'
assert.are.equal(module_type, expected)
end)
it('returns user as a string when called', function()
local user = get_user(GITTER_TOKEN)
local user_type = type(user)
local expected = 'string'
assert.are.equal(user_type, expected)
end)
it('returns nil and error if no token', function()
local user, err = get_user()
local expected = 'No token given'
assert.has_no(user)
assert.are.equal(err, expected)
end)
end)
|
require ("lib.lclass.init")
class "MouseButtonDown"
function MouseButtonDown:MouseButtonDown (x, y, button)
self.position = {
x = x,
y = y
}
self.button = button
end
|
hook.Add("InitPostEntity", "AttachmentVendorReady", function()
timer.Simple(5, function()
net.Start("attvend_ready");
net.SendToServer();
end);
end); |
local M = {}
local snippy = require('snippy')
local shared = require('snippy.shared')
local api = vim.api
local function feedkey(key)
if key then
api.nvim_feedkeys(api.nvim_replace_termcodes(key, true, true, true), 'n', true)
end
end
local fallback = {}
M.expand = function(idx)
if snippy.can_expand() then
snippy.expand()
else
feedkey(fallback[idx])
end
end
M.expand_or_advance = function(idx)
if snippy.can_expand_or_advance() then
snippy.expand_or_advance()
else
feedkey(fallback[idx])
end
end
M.next = function(idx)
if snippy.can_jump(1) then
snippy.next()
else
feedkey(fallback[idx])
end
end
M.previous = function(idx)
if snippy.can_jump(-1) then
snippy.previous()
else
feedkey(fallback[idx])
end
end
M.cut_text = '<Plug>(snippy-cut-text)'
local function create_rhs(rhs, lhs)
if type(M[rhs]) == 'function' then
local idx = #fallback + 1
fallback[idx] = lhs
return '<cmd>lua require("snippy.mapping").' .. rhs .. '(' .. idx .. ')<cr>', { noremap = true }
elseif type(M[rhs]) == 'string' then
return M[rhs], {}
end
end
function M.init()
local mappings = shared.config.mappings
if not mappings then
return
end
for modes, mapping in pairs(mappings) do
modes = type(modes) == 'table' and modes or vim.split(modes, '')
for _, mode in ipairs(modes) do
for lhs, _rhs in pairs(mapping) do
local rhs, opt = create_rhs(_rhs, lhs)
api.nvim_set_keymap(mode, lhs, rhs, opt)
end
end
end
end
return M
|
local colors = require "term".colors
local function fileToString(filename)
local file, _ = io.open(filename, "r")
if not file then
return nil
end
local str = file:read("*all")
file:close()
return str
end
local dump
dump = function(t, inc, seen)
if type(t) == "table" and (inc or 0) < 5 then
inc = inc or 1
seen = seen or {}
seen[t] = true
io.write(
"{ "
.. colors.dim .. colors.cyan .. "-- " .. tostring(t) .. colors.reset
.. "\n"
)
local metatable = getmetatable(t)
if metatable then
io.write(
(" "):rep(inc)
.. colors.dim(colors.cyan "metatable = ")
)
if not seen[metatable] then
dump(metatable, inc + 1, seen)
io.write ",\n"
else
io.write(colors.yellow .. tostring(metatable) .. colors.reset .. ",\n")
end
end
local count = 0
for k, v in pairs(t) do
count = count + 1
if count > 10 then
io.write((" "):rep(inc) .. colors.dim(colors.cyan("...")) .. "\n")
break
end
io.write((" "):rep(inc))
local typeK = type(k)
local typeV = type(v)
if typeK == "table" and not seen[v] then
io.write "["
dump(k, inc + 1, seen)
io.write "] = "
elseif typeK == "string" then
io.write(colors.blue .. k:format("%q") .. colors.reset
.. " = ")
else
io.write("["
.. colors.yellow .. tostring(k) .. colors.reset
.. "] = ")
end
if typeV == "table" and not seen[v] then
dump(v, inc + 1, seen)
io.write ",\n"
elseif typeV == "string" then
io.write(colors.green .. "\"" .. v .. "\"" .. colors.reset .. ",\n")
else
io.write(colors.yellow .. tostring(v) .. colors.reset .. ",\n")
end
end
io.write((" "):rep(inc - 1).. "}")
return
elseif type(t) == "string" then
io.write(colors.green .. "\"" .. t .. "\"" .. colors.reset)
return
end
io.write(colors.yellow .. tostring(t) .. colors.reset)
end
local function contains(hay, needle)
for _, v in pairs(hay) do
if v == needle then
return true
end
end
return false
end
local splitCache = {}
local function split(self, delim, maxNb)
local cache = splitCache[self] and splitCache[self][delim]
if cache then
return cache
end
if string.find(self, delim) == nil then
return { self }
end
local result = {}
if delim == '' or not delim then
for i=1,#self do
result[i]=self:sub(i,i)
end
return result
end
if maxNb == nil or maxNb < 1 then
maxNb = 0
end
local pat = "(.-)" .. delim .. "()"
local nb = 0
local lastPos
for part, pos in string.gmatch(self, pat) do
nb = nb + 1
result[nb] = part
lastPos = pos
if nb == maxNb then break end
end
if nb ~= maxNb then
result[nb + 1] = string.sub(self, lastPos)
end
splitCache[self] = splitCache[self] or {}
splitCache[self][delim] = result
return result
end
local function trim(s)
return s:match "^%s*(.-)%s*$"
end
return {
fileToString = fileToString,
dump = dump,
contains = contains,
split = split,
trim = trim
}
|
object_building_content_rebel_theme_park_military_base_command_post = object_building_content_rebel_theme_park_shared_military_base_command_post:new {
}
ObjectTemplates:addTemplate(object_building_content_rebel_theme_park_military_base_command_post, "object/building/content/rebel_theme_park/military_base_command_post.iff")
|
-- Handler for isometric grid astar
local const = require("eva.const")
local basic_handler = require("eva.libs.astar.basic_handler")
local M = {}
function M.new_handler(get_node_fn, options)
local data = basic_handler.get_handler(get_node_fn)
data.neighbors = const.ASTAR.ISO.NEIGHBORS
if options and options.diagonal then
data.neighbors = const.ASTAR.ISO.NEIGHBORS_DIAGONAL
end
data.get_neighbors = function(map_handler, x, y)
return map_handler.neighbors[(bit.band(y, 1)) + 1]
end
return setmetatable(data, { __index = basic_handler })
end
return M
|
return {
version = "1.1",
luaversion = "5.1",
tiledversion = "1.1.6",
orientation = "orthogonal",
renderorder = "right-down",
width = 25,
height = 19,
tilewidth = 32,
tileheight = 32,
nextobjectid = 3,
properties = {},
tilesets = {
{
name = "001-Grassland01",
firstgid = 1,
filename = "../../data/tilesets/001-Grassland01.json",
tilewidth = 32,
tileheight = 32,
spacing = 0,
margin = 0,
image = "../tilesets/001-Grassland01.png",
imagewidth = 256,
imageheight = 576,
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 32,
height = 32
},
properties = {},
terrains = {},
tilecount = 144,
tiles = {}
}
},
layers = {
{
type = "tilelayer",
name = "G1",
x = 0,
y = 0,
width = 25,
height = 19,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
}
},
{
type = "tilelayer",
name = "G2",
x = 0,
y = 0,
width = 25,
height = 19,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0,
22, 20, 0, 12, 0, 14, 0, 0, 0, 0, 0, 0, 14, 0, 0, 14, 0, 0, 0, 12, 0, 0, 22, 0, 0,
0, 0, 0, 0, 0, 7, 0, 0, 0, 11, 0, 0, 0, 20, 0, 0, 0, 0, 0, 20, 16, 0, 0, 0, 0,
0, 0, 14, 0, 0, 20, 0, 0, 21, 0, 15, 0, 10, 0, 24, 7, 0, 0, 21, 0, 0, 0, 10, 0, 0,
0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
20, 22, 0, 0, 10, 0, 15, 0, 12, 0, 0, 0, 20, 0, 0, 11, 0, 10, 0, 0, 14, 0, 20, 0, 0,
0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 11, 0, 0,
0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 21, 41, 0, 44, 20, 0, 0, 0, 14, 0, 0, 0, 0, 0,
14, 24, 0, 16, 14, 0, 22, 0, 10, 0, 0, 0, 0, 20, 0, 0, 0, 12, 0, 0, 0, 0, 0, 15, 0,
0, 0, 0, 0, 20, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,
0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 15, 0, 16, 0, 10, 0, 0, 22, 0, 21, 0, 0, 20, 0, 14,
0, 0, 10, 0, 0, 21, 7, 0, 0, 0, 22, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 16, 0, 11, 0, 0, 0, 22, 24, 14, 0, 0,
0, 0, 20, 0, 14, 0, 16, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 10, 0, 0, 0, 0, 0, 21, 0,
0, 14, 0, 11, 0, 0, 0, 0, 0, 21, 0, 12, 0, 0, 0, 15, 0, 0, 0, 21, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 24, 0, 0, 0, 20, 0, 10, 0,
0, 16, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 20, 0, 21, 0, 14, 0, 0, 0, 11, 0, 0, 0, 0,
0, 7, 0, 15, 0, 0, 21, 0, 0, 16, 12, 11, 0, 0, 0, 0, 0, 0, 7, 20, 0, 0, 14, 16, 0,
0, 0, 0, 14, 0, 0, 0, 0, 24, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0
}
},
{
type = "tilelayer",
name = "T1",
x = 0,
y = 0,
width = 25,
height = 19,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 58, 59, 60, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, 0, 0, 65, 66, 67, 68, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 49, 50, 51, 52, 0, 0, 73, 74, 75, 76, 45, 46, 47, 48, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 57, 58, 59, 60, 0, 0, 0, 0, 0, 0, 53, 54, 55, 56, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 65, 66, 67, 68, 0, 0, 0, 0, 0, 0, 61, 62, 63, 64, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 73, 74, 75, 76, 0, 0, 0, 0, 0, 0, 69, 70, 71, 72, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 78, 79, 80, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 41, 42, 43, 44, 0, 0, 0, 0, 0, 57, 58, 59, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 65, 66, 67, 68, 0, 0, 0, 41, 42, 43, 44, 0, 0, 0,
0, 0, 57, 58, 59, 60, 0, 0, 0, 0, 0, 73, 74, 75, 76, 0, 0, 0, 49, 50, 51, 52, 0, 0, 0,
0, 0, 65, 66, 67, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 58, 59, 60, 0, 0, 0,
0, 0, 73, 74, 75, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, 67, 68, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 74, 75, 76, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
},
{
type = "objectgroup",
name = "Spawn Point",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 2,
name = "",
type = "",
shape = "rectangle",
x = 449,
y = 194,
width = 29,
height = 29,
rotation = 0,
visible = true,
properties = {}
}
}
}
}
}
|
vim.wo.number = false
vim.wo.relativenumber = false
vim.wo.signcolumn = 'no'
|
--[[
MIT License
Copyright (c) 2022 Ilyas TAOUAOU (CodesOtaku)
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.
--]]
----> Contribution
--[[
Bug thrixtle: versin, coversin, exsec, haversin, lerpExp, invLerpExp, fastFactorial
]]
----> Math library dependencies
local sqrt = math.sqrt
local cos, sin, tan, atan2 = math.cos, math.sin, math.tan, math.atan2
local exp, log, log10 = math.exp, math.log, math.log10
local floor, ceil, clamp = math.floor, math.ceil, math.clamp
local abs = math.abs
local pow = math.pow
local PI = math.pi
local sign = math.sign
local min, max = math.min, math.max
----> Constructors
local vector2, vector3 = Vector2.new, Vector3.new
----> Constants
local E = exp(1)
local TAU = PI*2
local PHI = (1+sqrt(5))/2
local EPSILON = 0.001
----> Pure Mathematical Functions
local ncos = function(x) return -cos(x) end
local nsin = function(x) return -sin(x) end
local nrt = function(x, n) return x^(1/n) end
local cbrt = function(x) return x^(1/3) end
local ln = function(x) return math.log(x, E) end
local log2 = function(x) return math.log(x, 2) end
local sec = function(x) return 1/cos(x) end
local csc = function(x) return 1/sin(x) end
local cot = function(x) return 1/tan(x) end
local versin = function(x) return 1 - math.cos(x) end
local coversin = function(x) return 1 - math.sin(x) end
local exsec = function(x) return (1 / math.cos(x)) - 1 end
local haversin = function(x) return 1 / 2 * (1 - math.cos(x)) end
local function inverse(x)
return 1/x
end
local factCache = {
[0] = 1,
[1] = 1,
[2] = 2,
[10] = 3628800,
[50] = 3.0414093202*pow(10, 64),
[100] = 9.3326215444*pow(10, 157),
[150] = 5.7133839564*pow(10,262),
}
local function factorial(x)
local sign = sign(x)
x = abs(x)
local c = factCache[x]
if c then return c*sign end
c = x*factorial(x-1)
factCache[x] = c
return c*sign
end
local function factorialFast(x)
local sign = sign(x)
x = abs(x)
local y = math.sqrt((2*x + 1/3) * 3.1415926535897932) * (x / 2.718281828459045) ^ x
return y*sign
end
local fibCache = {
[0] = 0,
[1] = 1,
[2] = 1,
[3] = 2,
[10] = 55,
[50] = 12586269025,
[100] = 354224848179261915075,
[200] = 280571172992510140037611932413038677189525,
[500] = 139423224561697880139724382870407283950070256587697307264108962948325571622863290691557658876222521294125,
[1000] = 43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875,
[1477] = math.huge, -- Overflow
}
local function fibonacci(x)
local sign = sign(x)
x = abs(x)
local c = fibCache[x]
if c then return c*sign end
c = fibonacci(x-1)+fibonacci(x-2)
fibCache[x] = c
return c*sign
end
local function numberLength(x, base)
base = base or 10
return ceil(log(x, base))+1
end
local function fract(x)
return x-floor(x)
end
local function toFract(x, base)
base = base or 10
return x*pow(base, -ceil(log(x, base)))
end
local function wrap(x, min, max)
return (x-min)%(max-min+1) + min
end
local function step(x, factor, offset)
offset = offset or 0
if factor == 0 then return x end
return floor((x-offset)/factor + 0.5)*factor + offset
end
local function snap(x, factor, offset, sep)
if factor == 0 then return x end
local a = step(x, factor + sep, offset)
local b = a
if x >= 0 then
b -= sep
else
b += step
end
return abs(x-a < x-b and a or b)
end
local function stepDecimals(x, decimalPlaces)
return step(x, 10^(-decimalPlaces))
end
local function cartesian2polar(x, y)
return vector2(sqrt(x^2+y^2), atan2(y,x))
end
local function polar2cartesian(rau, angle)
return vector2(rau*cos(angle), rau*sin(angle))
end
local function cylindrical2cartesian(rau, angle, z)
return vector3(rau*cos(angle), rau*sin(angle), z)
end
local function spherical2cartesian(r, angle, theta, z)
return vector3(r*cos(angle)*sin(theta), r*sin(angle)*sin(theta), r*cos(theta))
end
local function ease(x, curve)
x = clamp(x, 0, 1)
if curve > 0 then
if curve < 1 then
return 1 - pow(1-x, 1/curve)
else
return pow(x, curve)
end
elseif curve < 0 then
if x < 0.5 then
return pow(x*2, -curve) * 0.5
else
return (1 - pow(1 - (x-0.5)*2, -curve))*0.5 + 0.5
end
else
return 0
end
end
local function smoothStep(from, to, x)
local s = clamp((x-from)/(to-from), 0, 1)
return s*s*(3-2*s)
end
local function lerp(a, b, t)
return a + (b-a)*t
end
local function invLerp(c, d, x)
return (x-c)/(d-c)
end
local function lerpExp(a, b, t)
return a ^ (1 - t) * b ^ t
end
local function invLerpExp(a, b, t)
return math.log(a / t) / math.log(a / b)
end
local function map(i1, i2, o1, o2, x)
return o1 + (o2-o1)*((x-i1)/(i2-i1))
end
-- Comparaison functions
local function approxEq(x, y, epsilon)
epsilon = epsilon or EPSILON
return abs(x-y) < epsilon
end
local function approxZero(x, epsilon)
epsilon = epsilon or EPSILON
return abs(x) < epsilon
end
-- Table helper functions
local function deepCopyT(t : table, isKeyCopy : boolean, tableCopy : table?, registry : table?)
local reg = registry and registry[t]
if reg then return reg end
tableCopy = tableCopy or {}
registry = registry or {}
registry[t] = tableCopy
for k,v in pairs(t) do
if isKeyCopy and typeof(k) == "table" then
k = deepCopyT(k)
end
if typeof(v) == "table" then
local r = deepCopyT(v, isKeyCopy, nil, registry)
tableCopy[k] = r
else
tableCopy[k] = v
end
end
return tableCopy
end
local function copyT(t : table, tableCopy : table?)
tableCopy = tableCopy or {}
for k,v in pairs(t) do
tableCopy[k] = v
end
return tableCopy
end
local function invertT(t, r)
r = r or {}
for k,v in pairs(t) do
r[v] = k
end
return r
end
-- Calculus
local definiteDerivative = {
[cos] = nsin,
[nsin] = ncos,
[ncos] = sin,
[sin] = cos,
[ln] = inverse,
[exp] = exp
}
local definitePrimitive = invertT(definiteDerivative)
local function derivative(x, dx, f)
local dF = definiteDerivative[f]
if dF then
return dF(x)
end
dx = dx or EPSILON
return (f(x+dx)-f(x))/dx
end
local function productDerivative(x, dx, f, g)
return g(x)*derivative(x, dx, f) + f(x)*derivative(x, dx, g)
end
local function quotientDerivative(x, dx, f, g)
local gx = g(x)
return (gx*derivative(x, dx, f) + f(x)*derivative(x, dx, g))/(gx^2)
end
local function compositeDerivative(x, dx, f, g)
return derivative(g(x), dx, f)*derivative(x, dx, g)
end
local function integral(x1, x2, dx, f)
local primitive = definitePrimitive[f]
if primitive then
return primitive(x2) - primitive(x1)
end
dx = dx or abs(x2-x1)*EPSILON
local surface = 0
for x = min(x1, x2), max(x1, x2), abs(dx) do
surface += f(x)*dx
end
return surface*sign(x2-x1)*sign(dx)
end
local function integralAbs(x1, x2, dx, f)
local primitive = definitePrimitive[f]
if primitive then
return primitive(x2) - primitive(x1)
end
dx = dx or abs(x2-x1)*EPSILON
local surface = 0
for x = x1, x2, dx do
surface += abs(f(x)*dx)
end
return surface
end
local function addDefiniteFunction(f, dF)
definiteDerivative[f] = dF
definitePrimitive[dF] = f
end
local function getDefinitivePrimitive(f)
return definitePrimitive[f]
end
local function getDefinitiveDerivative(f)
return definiteDerivative[f]
end
-- Table math
local function sumT(t)
local n = 0
for _,v in pairs(t) do
n += v
end
return n
end
local function differenceT(t)
local n = 0
for _,v in pairs(t) do
n -= v
end
return n
end
local function productT(t)
local n = 1
for _,v in pairs(t) do
if v == 0 then return 0 end
n *= v
end
return n
end
local function quotientT(t)
local n = 1
for _,v in pairs(t) do
n /= v
end
return n
end
local function meanT(t)
return sumT(t)/#t
end
local function medianT(t)
t = copyT(t)
table.sort(t, function(a, b)
return a < b
end)
local l = #t
if l%2 == 0 then
local mid = l/2
return (t[mid]+t[mid+1])/2
else
return t[(l+1)/2]
end
end
local function maxT(t, isOverride)
local index = nil
local value = -math.huge
for k,v in pairs(t) do
if isOverride and v >= value or v > value then
index = k
value = v
end
end
return value, index
end
local function minT(t, isOverride)
local index = nil
local value = math.huge
for k,v in pairs(t) do
if isOverride and v <= value or v < value then
index = k
value = v
end
end
return value, index
end
local function rangeT(t, isOverride)
local indexMin, indexMax
local min, max = math.huge, math.huge
for k,v in pairs(t) do
if isOverride and v <= min or v < min then
indexMin = k
min = v
end
if isOverride and v >= max or v > max then
indexMax = k
max = v
end
end
return {min, indexMin}, {max, indexMax}
end
local function countValuesT(t)
local elements = {}
for k,v in pairs(t) do
local element = elements[v]
if element then
elements[v] = element + 1
else
elements[v] = 1
end
end
return elements
end
local function modeT(t, isOverride)
return maxT(countValuesT(t), isOverride)
end
local function processPairsT(t, func)
local r = {}
for n = 1, #t, 2 do
table.insert(r, func(t[n], t[n+1]))
end
return r
end
local function mapT(t, func, isOverride, isStrict)
local r = isOverride and t or {}
for k, v in pairs(func) do
local rv, rk = func(v, k)
if isStrict then
r[rk] = rv
else
r[rk or k] = rv
end
end
return r
end
local function filterT(t, func, isOrdered : bool?)
local r = {}
if isOrdered then
for i, v in ipairs(t) do
if func(v, i) then
table.insert(r, v)
end
end
else
for k, v in pairs(t) do
if func(v, k) then
r[k] = v
end
end
end
return r
end
local function countT(t, func)
local n = 0
for k,v in pairs(t) do
n += func(v) or 0
end
return n
end
local function countMulT(t, func)
local n = 1
for k,v in pairs(t) do
n *= func(v) or 0
end
return n
end
local function zipT(t1, t2)
local r = {}
for i = 1, min(#t1, #t2) do
r[i] = {t1[i], t2[i]}
end
return r
end
local function unzipT(t)
local r1, r2 = {},{}
for _, tuple in ipairs(t) do
table.insert(r1, tuple[1])
table.insert(r2, tuple[2])
end
return r1, r2
end
local function toRawT(t, isRecursive, tOut)
local r = tOut or {}
for _, tuple in ipairs(t) do
for _, element in ipairs(tuple) do
if isRecursive and typeof(element) == "table" then
toRawT(t, true, r)
else
table.insert(r, element)
end
end
end
return r
end
local function keysT(t, isRecursive, tOut)
local r = tOut or {}
for k,v in pairs(t) do
if isRecursive and typeof(v) == "table" then
keysT(k, true, r)
else
table.insert(r, k)
end
end
return r
end
local function valuesT(t, isRecursive, tOut)
local r = tOut or {}
for _,v in pairs(t) do
if isRecursive and typeof(v) == "table" then
keysT(v, true, r)
else
table.insert(r, v)
end
end
return r
end
local function sampleT(func, samples, x1, x2)
if samples < 2 then
error("A minimum of 2 samples is required", 2)
end
local result = table.create(samples)
-- we're starting from 0 for the calculations
samples = samples - 1
for i = 0, samples do
-- table index starts from 1
local t = i/samples
result[i+1] = func(lerp(x1, x2, t))
end
return result
end
-- Vector math
local function distanceV(vec1, vec2)
return (vec1 - vec2).magnitude
end
local function midPosV(vec1, vec2)
return (vec1 + vec2)/2
end
local function applyV(vec, func)
return Vector3.new(func(vec.X, 1), func(vec.Y, 2), func(vec.Z, 3))
end
local function absV(vec)
return applyV(vec, abs)
end
local function angleV(vec1, vec2)
vec2 = vec2 or Vector3.zero
local vec = vec1.Unit - vec2.Unit
return atan2(vec.Y, vec.X)
end
-- Random
local RNG = Random.new()
local function randomN(a, b)
if not b then
b = a
a = 0
end
return RNG:NextInteger(a, b)
end
local function random(a, b)
if not b then
b = a
a = 0
end
return RNG:NextNumber(a, b)
end
local function randomV()
return RNG:NextUnitVector()
end
local function randomItemT(t)
local keys = keysT(t)
local key = keys[randomN(1, #keys)]
return key, t[key]
end
return {
----> Constants
PI = PI, -- Ratio of a circle's circumference to its diameter.
TAU = TAU, -- PI*2
E = E, -- Euler's number
PHI = PHI, -- Golden Ratio
----> Pure mathematical functions
nrt = nrt, -- Nth root; (x, n)
cbrt = cbrt, -- Cubic root; (x)
inverse = inverse, -- 1/x; (x)
ln = ln, -- Natural logarithm; (x)
log2 = log2, -- Log of base 2
cos = cos, -- cos(x)
sin = sin, -- sin(x)
ncos = ncos, -- -cos(x), it might seem silly, but I added this so I can optimize derivative and integral by referencing it, so you can pass in this function to integral, and it's already optimized
nsin = nsin, -- -sin(x)
sec = sec, -- Secant(x), I don't use this functions usually, but it might be helpful if you have a formula that use them and you're too lazy like me
csc = csc, -- Co-secant(x),
cot = cot, -- Co-tangent(x),
versin = versin, -- versin(θ) = 1 - cos(θ) = 2sin²(θ/2)
coversin = coversin, -- coversine(θ) = 1 - sin(θ)
exsec = exsec, -- exsecant(θ) = sec(θ) - 1 = 1 / cos(θ) - 1
haversin = haversin, -- haversine(θ) = sin²(0⁄2) = 1 - cos(θ) / 2
ease = ease, -- https://godotengine.org/qa/59172/how-do-i-properly-use-the-ease-function
smoothStep = smoothStep, -- https://thebookofshaders.com/glossary/?search=smoothstep
factorial = factorial, -- x!
fastFactorial = factorialFast, factorialFast = factorialFast, -- x! but sacrifice accuracy for speed
fibonacci = fibonacci, -- fib(x-1)+fib(x-2)
----> Practical mathematical functions
numberLength = numberLength, -- returns the number of digits in the number #tostring(number)
fract = fract, -- return the fractional part of a number, what's after the comma
toFract = toFract, -- return the number after the comma like 0.number
wrap = wrap, -- it cycles a arbitrary value between min and max, equivalent to the modulo operator but with configurable minimum
step = step, -- returns the closest multiple of factor to x, can be used to snap a position's components to a grid (Minecraft...)
snap = snap, -- the same as step, but can also handle seperation, Ex: your grid have a border
stepDecimals = stepDecimals, -- round the number to n digits after the comma
lerp = lerp, -- takes a range [a -> b] and a t value [0->1]. it returns a value travalling from a to b linearly, where t is the percentage it advanced (Ex: 50% = 0.5)
invLerp = invLerp, inverseLerp = invLerp, -- takes a range [c -> d] and a value x, it returns the t value of the value in range, basically where the value is relative to the range.
map = map, -- lerp(o1, o2, inverseLerp(i1, i2, x)), remaps a value x from the range [i1->i2] to [o1->o2], can be useful to create sliders.
lerpExp = lerpExp, -- exponential lerp
invLerpExp = invLerpExp, inverseLerpExp = invLerpExp, -- inverse exponential lerp
----> Conversion
cartesian2polar = cartesian2polar, -- x, y to rau, angle
cylindrical2cartesian = cylindrical2cartesian, -- rau, angle, z to x,y,z
spherical2cartesian = spherical2cartesian, -- rau, angle, theta to x,y,z
polar2cartesian = polar2cartesian, -- rau, angle to x,y
----> Comparaison functions
approxEq = approxEq, -- Returns true if x approximately equals y, where EPSILON is the tolerance, error or deviation allowed; (x, y, epsilon?)
approxZero = approxZero, -- Returns true if x approximately equals 0
----> Calculus
derivative = derivative, -- calculate the derivative of f using it's definite derivative (optimized) or numerically if none found
integral = integral, -- calculate the integral of f from x1 to x2 using it's definite primitive (optimized) or numerically if none found
integralAbs = integralAbs, -- the absolute version of the integral, the sign of f(x) is ignored
addDefiniteFunction = addDefiniteFunction, -- takes 2 functions. a function and it's derivative, it will be used by the functions above if the definite version exist, as it's much better and accurate than the numerical method
productDerivative = productDerivative, -- (f*g)' = f'g-g'f the chain rule
quotientDerivative = quotientDerivative, -- (f/g)' = (f'g-g'f)/(g^2) the chain rule and the derivative of the inverse of f(x)
compositeDerivative = compositeDerivative, -- (f(g))' = f'(g)*g'
----> Table math
sumT = sumT, -- Sum of the values; (table)
differenceT = differenceT, -- Difference of the values; (table)
productT = productT, -- Product of the values; (table)
quotientT = quotientT, -- Quotient of the values; (table)
meanT = meanT, -- Average of the values; (table)
modeT = modeT, -- The middle value or the average of the middle values in the sorted version of the table; (table)
maxT = maxT, -- The maximum value in the table, if isOverride is true, return the last maximum found, otherwise the first; (table, isOverride?)
minT = minT, -- The minumum value in the table;, if isOverride is true, return the last minimum found, otherwise the first; (table, isOverride?)
countValuesT = countValuesT, -- Returns a table with the count of all the values in the table; (table)
rangeT = rangeT, -- Returns {min, minIndex}, {max, maxIndex}; (table)
processPairsT = processPairsT, -- Gets a table with 2*n elements, it returns a table with n elements by processing each pair with the function f
mapT = mapT, -- Gets a table [x1, x2, x3...xn] and a function, returns [f(x1), f(x2), f(x3)...f(xn)]
filterT = filterT, -- Gets a table and a function, returns a new table with the elements that evaluated the function f(value, key) to true
countT = countT, -- Accumulates the result of a function f(v, k) traversing a table, returns the accumulated value
countMulT = countMulT, -- The same as countT but with multiplication
sampleT = sampleT, -- Sample function output n times from x1 to x2 linearly
----> Vector math
distanceV = distanceV, -- Returns the distance between the position vec1 and vec2
midPosV = midPosV, -- Returns the middle position between the position vec1 and vec2, equivalent to lerp(vec1, vec2, 0.5)
applyV = applyV, -- Returns a new Vector3 by applying a function on the X, Y and Z components of a Vector3
absV = absV, -- Returns a new Vector3 where all the components of the vector are absolute (positive or nil)
angleV = angleV,
-- Random
randomItemT = randomItemT, -- Returns a random key in table
random = random, -- returns a random number in range [a,b]
randomN = randomN, -- returns a random integer in range [a,b]
randomV = randomV, -- returns a unit vector3 as a random direction
----> Helper functions
copyT = copyT, -- Returns a copy of a table
deepCopyT = deepCopyT, -- Returns a copy of the table and all of the tables inside it, if isKeyCopy, then it will also deep copy the keys of the table if they're also tables.
invertT = invertT, -- the keys becomes the values and vice versa, takes a table [y1 = x1, y2 = x2...yn = xn], returns [x1 = y1, x2 = y2...xn = yn]
zipT = zipT, -- takes 2 tables and zip them together {{t1[1], t2[1]}, {t1[2], t2[2]}...{t1[n], t2[n]}}
unzipT = unzipT, -- the inverse of zip, takes 1 table of pairs and unzip it into 2 tables
valuesT = valuesT, -- return a table of all the values inside the table, there is also recursive mode for nested tables
keysT = keysT, -- the same as valuesT, but for table keys
toRawT = toRawT, -- returns a one dimensional table copy of a complex recursive table
}
|
--[[=============================================================================
Initialization Functions
Copyright 2015 Control4 Corporation. All Rights Reserved.
===============================================================================]]
require "thermostat.thermostat_proxy_class"
require "thermostat.thermostat_proxy_commands"
require "thermostat.thermostat_proxy_notifies"
-- This macro is utilized to identify the version string of the driver template version used.
if (TEMPLATE_VERSION ~= nil) then
TEMPLATE_VERSION.proxy_init = "2014.12.11"
end
function ON_DRIVER_EARLY_INIT.proxy_init()
-- declare and initialize global variables
end
function ON_DRIVER_INIT.proxy_init()
-- instantiate the thermostat proxy class
gTStatProxy = ThermostatProxy:new(DEFAULT_PROXY_BINDINGID)
gTStatProxy:dev_Scale("F") -- default to Fahrenheit
end
function ON_DRIVER_LATEINIT.proxy_init()
end
|
local aceDBOptions = LibStub("AceDBOptions-3.0")
function Rekt:GetRektOptions()
local db = self.db.profile;
local options = {
type = "group", name = "Rekt", childGroups = "tab",
args = {
enabled = {
type = "toggle", name = "Enabled", desc = "Enable/Disable the addon", order = 0,
get = function() return Rekt:isEnabled() end,
set = function(_, v)
Rekt:setEnabledOrDisabled(v);
end
},
lock = {
type = "toggle", name = "Lock", desc = "Uncheck to move the frames", order = 1,
get = function() return Rekt:isLocked() end,
set = function(_, v)
db.locked = v;
if v then Rekt:LockFrames() else Rekt:UnlockFrames() end;
end
},
targetandfocus = {
type = "group", name = "CDs", desc = "Cooldown frame's settings.", childGroups = "tab", order = 2,
args = Rekt:getTargetandFocusOptions();
},
droptions = {
type = "group", name = "DRs", desc = "DR frame's settings.", childGroups = "tab",order = 3,
args = Rekt:getDROptions();
},
coloroptions = {
type = "group", name = "Global", desc = "Global settings.", childGroups = "tab",order = 4,
args = Rekt:getGlobalOptions()
},
debugoptions = {
type = "group", name = "Debug", desc = "Debug settings.", childGroups = "tab", order = 5,
args = Rekt:getDebugOptions();
},
profileoptions = aceDBOptions:GetOptionsTable(self.db)
}
}
return options;
end
--order 10-20
function Rekt:getTargetandFocusOptions()
local args = {
targetHeader = {
type = "header", name = "Target's settings", order = 10
},
targettoggle = {
type = "toggle", name = "Target", desc = "Enable/Disable showing the target's cooldowns", order = 11,
get = function() return Rekt:isPartEnabled("target") end,
set = function(_, v)
Rekt:SetPartEnabledOrDisabled("target", v);
end
},
targetrange = {
type = "range", name = "Target's size", order = 12, min = 10, max = 150, step = 1,
get = function() return Rekt:getFrameSize("target") end,
set = function(_, v)
Rekt:setFrameSize("target", v);
end
},
targetGrowSelect = {
type = "select", style = "dropdown", name = "targetGrow",
desc = "Change which way the target's cooldowns will grow", order = 13,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left"
},
get = function() return Rekt:getGrowOrder("target") end,
set = function(_, v)
Rekt:setGrowOrder("target", v);
end
},
targetSortSelect = {
type = "select", style = "dropdown", name = "targetSortOrder",
desc = "Change the target's cooldowns's sort order", order = 14,
values = {
["1"] = "Ascending (CD left)",
["2"] = "Descending (CD left)",
["3"] = "Ascending (CD total)",
["4"] = "Descending (CD total)",
["5"] = "Recent first",
["6"] = "Recent Last",
["7"] = "No order"
},
get = function() return Rekt:getSortOrder("target") end,
set = function(_, v)
Rekt:setSortOrder("target", v);
end
},
targetcolortoggle = {
type = "toggle", name = "Colors", desc = "Enable/Disable showing the target's cooldown's colors.", order = 15,
get = function() return Rekt:getColorFrameEnabled("target") end,
set = function(_, v)
Rekt:setColorFrameEnabled("target", v);
end
},
targetcolorrange = {
type = "range", name = "Target's Color size", order = 16, min = 1, max = 30, step = 1,
get = function() return Rekt:getColorFrameSize("target") end,
set = function(_, v)
Rekt:setColorFrameSize("target", v);
end
},
focusHeader = {
type = "header", name = "Focus's settings", order = 17
},
focustoggle = {
type = "toggle", name = "Focus", desc = "Enable/Disable showing the focus's cooldowns", order = 18,
get = function() return Rekt:isPartEnabled("focus") end,
set = function(_, v)
Rekt:SetPartEnabledOrDisabled("focus", v);
end
},
focusRange = {
type = "range", name = "Focus's size", order = 19, min = 10, max = 150, step = 1,
get = function() return Rekt:getFrameSize("focus") end,
set = function(_, v)
Rekt:setFrameSize("focus", v);
end
},
focusGrowSelect = {
type = "select", style = "dropdown", name = "focusGrow",
desc = "Change which way the focus's cooldowns will grow", order = 20,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left"
},
get = function() return Rekt:getGrowOrder("focus") end,
set = function(_, v)
Rekt:setGrowOrder("focus", v);
end
},
focusSortSelect = {
type = "select", style = "dropdown", name = "focusSortOrder",
desc = "Change the focus's cooldowns's sort order", order = 21,
values = {
["1"] = "Ascending (CD left)",
["2"] = "Descending (CD left)",
["3"] = "Ascending (CD total)",
["4"] = "Descending (CD total)",
["5"] = "Recent first",
["6"] = "Recent Last",
["7"] = "No order"
},
get = function() return Rekt:getSortOrder("focus") end,
set = function(_, v)
Rekt:setSortOrder("focus", v);
end
},
focuscolortoggle = {
type = "toggle", name = "Colors", desc = "Enable/Disable showing the target's cooldown's colors.", order = 22,
get = function() return Rekt:getColorFrameEnabled("focus") end,
set = function(_, v)
Rekt:setColorFrameEnabled("focus", v);
end
},
focuscolorrange = {
type = "range", name = "Focus's Color size", order = 23, min = 1, max = 30, step = 1,
get = function() return Rekt:getColorFrameSize("focus") end,
set = function(_, v)
Rekt:setColorFrameSize("focus", v);
end
},
ibHeader = {
type = "header", name = "InterruptBar's settings", order = 30
},
ibtoggle = {
type = "toggle", name = "InterruptBar", desc = "Enable/Disable showing the InterruptBar", order = 31,
get = function() return Rekt:isPartEnabled("interruptbar") end,
set = function(_, v)
Rekt:SetPartEnabledOrDisabled("interruptbar", v);
end
},
ibrange = {
type = "range", name = "InterruptBar's size", order = 32, min = 10, max = 150, step = 1,
get = function() return Rekt:getFrameSize("interruptbar") end,
set = function(_, v)
Rekt:setFrameSize("interruptbar", v);
end
},
ibGrowSelect = {
type = "select", style = "dropdown", name = "InterruptBarGrow",
desc = "Change which way the InterruptBar's cooldowns will grow", order = 33,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left"
},
get = function() return Rekt:getGrowOrder("interruptbar") end,
set = function(_, v)
Rekt:setGrowOrder("interruptbar", v);
end
},
ibSortSelect = {
type = "select", style = "dropdown", name = "InterruptBarSortOrder",
desc = "Change the InterruptBar's cooldowns's sort order", order = 34,
values = {
["1"] = "Ascending (CD left)",
["2"] = "Descending (CD left)",
["3"] = "Ascending (CD total)",
["4"] = "Descending (CD total)",
["5"] = "Recent first",
["6"] = "Recent Last",
["7"] = "No order"
},
get = function() return Rekt:getSortOrder("interruptbar") end,
set = function(_, v)
Rekt:setSortOrder("interruptbar", v);
end
},
ibcolortoggle = {
type = "toggle", name = "Colors", desc = "Enable/Disable showing the InterruptBar's cooldown's colors.", order = 35,
get = function() return Rekt:getColorFrameEnabled("interruptbar") end,
set = function(_, v)
Rekt:setColorFrameEnabled("interruptbar", v);
end
},
ibcolorrange = {
type = "range", name = "InterruptBar's Color size", order = 36, min = 1, max = 30, step = 1,
get = function() return Rekt:getColorFrameSize("interruptbar") end,
set = function(_, v)
Rekt:setColorFrameSize("interruptbar", v);
end
},
--[[
warnHeader = {
type = "header", name = "Warn Frame's settings", order = 40
},
warntoggle = {
type = "toggle", name = "Warn Frame", desc = "Enable/Disable showing the Warn Frame", order = 41,
get = function() return Rekt:isPartEnabled("interruptbar") end,
set = function(_, v)
Rekt:SetPartEnabledOrDisabled("interruptbar", v);
end
},
warnrange = {
type = "range", name = "Warn Frame's size", order = 42, min = 10, max = 150, step = 1,
get = function() return Rekt:getFrameSize("interruptbar") end,
set = function(_, v)
Rekt:setFrameSize("interruptbar", v);
end
},
warntextsizerange = {
type = "range", name = "Text size", desc = "Warn Frame's Text size. Set it to 0 to disable it!",
order = 43, min = 1, max = 30, step = 1,
get = function() return Rekt:getDRNumSize("targetdr") end,
set = function(_, v)
Rekt:setDRNumSize("targetdr", v);
end
},
warntextposselect = {
type = "select", style = "dropdown", name = "Warn Frame Text Position",
desc = "Change the target's DR's number's position.", order = 44,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left",
["5"] = "Middle"
},
get = function() return Rekt:getDRNumPosition("targetdr") end,
set = function(_, v)
Rekt:setDRNumPosition("targetdr", v);
end
},
]]--
}
return args;
end
--order 20-40
function Rekt:getDROptions()
local args = {
targetdrHeader = {
type = "header", name = "Target's settings", order = 10
},
targetdrtoggle = {
type = "toggle", name = "Enabled", desc = "Enable/Disable showing the target's DRs.", order = 11,
get = function() return Rekt:isPartEnabled("targetdr") end,
set = function(_, v)
Rekt:SetDRPartEnabledOrDisabled("targetdr", v);
end
},
targetdrrange = {
type = "range", name = "Target's DRs size", order = 12, min = 10, max = 150, step = 1,
get = function() return Rekt:getFrameSize("targetdr") end,
set = function(_, v)
Rekt:setFrameSize("targetdr", v);
end
},
targetdrGrowSelect = {
type = "select", style = "dropdown", name = "targetDRGrow",
desc = "Change which way the target's cooldowns will grow", order = 13,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left"
},
get = function() return Rekt:getGrowOrder("targetdr") end,
set = function(_, v)
Rekt:setDRGrowOrder("targetdr", v);
end
},
targetdrSortSelect = {
type = "select", style = "dropdown", name = "targetDRSortOrder",
desc = "Change the target's DR's sort order", order = 14,
values = {
["1"] = "Ascending (CD left)",
["2"] = "Descending (CD left)",
["3"] = "Ascending (CD total)",
["4"] = "Descending (CD total)",
["5"] = "Recent first",
["6"] = "Recent Last",
["7"] = "No order"
},
get = function() return Rekt:getSortOrder("targetdr") end,
set = function(_, v)
Rekt:setSortOrder("targetdr", v);
end
},
targetdrnumsizerange = {
type = "range", name = "Number's size", desc = "Target's DR's Number's size. Set it to 0 to disable it!",
order = 15, min = 1, max = 30, step = 1,
get = function() return Rekt:getDRNumSize("targetdr") end,
set = function(_, v)
Rekt:setDRNumSize("targetdr", v);
end
},
targetdrnumposselect = {
type = "select", style = "dropdown", name = "targetDRNumPos",
desc = "Change the target's DR's number's position.", order = 16,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left",
["5"] = "Middle"
},
get = function() return Rekt:getDRNumPosition("targetdr") end,
set = function(_, v)
Rekt:setDRNumPosition("targetdr", v);
end
},
targetdrOnlyShowDRCountDownToggle = {
type = "toggle", name = "Only Show DR CountDown", desc = "If enabled the DR icon will only show up when the DR countdown actually starts.", order = 17,
get = function() return Rekt:isOnlyShowDRCountDown("targetdr") end,
set = function(_, v)
Rekt:setOnlyShowDRCountDown("targetdr", v);
end
},
focusdrHeader = {
type = "header", name = "Focus's settings", order = 18
},
focusdrtoggle = {
type = "toggle", name = "Enabled", desc = "Enable/Disable showing the focus's DRs.", order = 19,
get = function() return Rekt:isPartEnabled("focusdr") end,
set = function(_, v)
Rekt:SetDRPartEnabledOrDisabled("focusdr", v);
end
},
focusdrRange = {
type = "range", name = "Focus's size", order = 20, min = 10, max = 150, step = 1,
get = function() return Rekt:getFrameSize("focusdr") end,
set = function(_, v)
Rekt:setFrameSize("focusdr", v);
end
},
focusdrGrowSelect = {
type = "select", style = "dropdown", name = "focusDRGrow",
desc = "Change which way the focus's DRs will grow", order = 21,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left"
},
get = function() return Rekt:getGrowOrder("focusdr") end,
set = function(_, v)
Rekt:setDRGrowOrder("focusdr", v);
end
},
focusdrSortSelect = {
type = "select", style = "dropdown", name = "focusDRSortOrder",
desc = "Change the focus's DR's sort order", order = 22,
values = {
["1"] = "Ascending (CD left)",
["2"] = "Descending (CD left)",
["3"] = "Ascending (CD total)",
["4"] = "Descending (CD total)",
["5"] = "Recent first",
["6"] = "Recent Last",
["7"] = "No order"
},
get = function() return Rekt:getSortOrder("focusdr") end,
set = function(_, v)
Rekt:setSortOrder("focusdr", v);
end
},
focusdrnumsizerange = {
type = "range", name = "Number's size", desc = "Focus's DR's Number's size. Set it to 0 to disable it!",
order = 23, min = 1, max = 30, step = 1,
get = function() return Rekt:getDRNumSize("focusdr") end,
set = function(_, v)
Rekt:setDRNumSize("focusdr", v);
end
},
focusdrnumposselect = {
type = "select", style = "dropdown", name = "focusDRNumPos",
desc = "Change the focus's DR's number's position.", order = 24,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left",
["5"] = "Middle"
},
get = function() return Rekt:getDRNumPosition("focusdr") end,
set = function(_, v)
Rekt:setDRNumPosition("focusdr", v);
end
},
focusdrOnlyShowDRCountDownToggle = {
type = "toggle", name = "Only Show DR CountDown", desc = "If enabled the DR icon will only show up when the DR countdown actually starts.", order = 25,
get = function() return Rekt:isOnlyShowDRCountDown("focusdr") end,
set = function(_, v)
Rekt:setOnlyShowDRCountDown("focusdr", v);
end
},
selfdrHeader = {
type = "header", name = "Self's settings", order = 26
},
selfdrtoggle = {
type = "toggle", name = "Enabled", desc = "Enable/Disable showing the your DRs.", order = 27,
get = function() return Rekt:isPartEnabled("selfdr") end,
set = function(_, v)
Rekt:SetDRPartEnabledOrDisabled("selfdr", v);
end
},
selfdrrange = {
type = "range", name = "Self's DRs size", order = 28, min = 10, max = 150, step = 1,
get = function() return Rekt:getFrameSize("selfdr") end,
set = function(_, v)
Rekt:setFrameSize("selfdr", v);
end
},
selfdrGrowSelect = {
type = "select", style = "dropdown", name = "selfDRGrow",
desc = "Change which way the your DRs will grow", order = 29,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left"
},
get = function() return Rekt:getGrowOrder("selfdr") end,
set = function(_, v)
Rekt:setDRGrowOrder("selfdr", v);
end
},
selfdrSortSelect = {
type = "select", style = "dropdown", name = "selfDRSortOrder",
desc = "Change the your DR's sort order", order = 30,
values = {
["1"] = "Ascending (CD left)",
["2"] = "Descending (CD left)",
["3"] = "Ascending (CD total)",
["4"] = "Descending (CD total)",
["5"] = "Recent first",
["6"] = "Recent Last",
["7"] = "No order"
},
get = function() return Rekt:getSortOrder("selfdr") end,
set = function(_, v)
Rekt:setSortOrder("selfdr", v);
end
},
selfdrnumsizerange = {
type = "range", name = "Number's size", desc = "Your DR's Number's size. Set it to 0 to disable it!",
order = 31, min = 1, max = 30, step = 1,
get = function() return Rekt:getDRNumSize("selfdr") end,
set = function(_, v)
Rekt:setDRNumSize("selfdr", v);
end
},
selfdrnumposselect = {
type = "select", style = "dropdown", name = "selfDRNumPos",
desc = "Change your DR's number's position.", order = 32,
values = {
["1"] = "Up",
["2"] = "Right",
["3"] = "Down",
["4"] = "Left",
["5"] = "Middle"
},
get = function() return Rekt:getDRNumPosition("selfdr") end,
set = function(_, v)
Rekt:setDRNumPosition("selfdr", v);
end
},
selfdrOnlyShowDRCountDownToggle = {
type = "toggle", name = "Only Show DR CountDown", desc = "If enabled the DR icon will only show up when the DR countdown actually starts.", order = 33,
get = function() return Rekt:isOnlyShowDRCountDown("selfdr") end,
set = function(_, v)
Rekt:setOnlyShowDRCountDown("selfdr", v);
end
},
}
return args;
end
--order 40-50
function Rekt:getGlobalOptions()
local args = {
globalHeader = {
type = "header", name = "Global CD settings", order = 10
},
specdetectiontoggle = {
type = "toggle", name = "Spec Detection", desc = "Enable/Disable Spec Detection", order = 11,
get = function() return Rekt:isSpecDetectionEnabled() end,
set = function(_, v)
Rekt:setSpecDetectionEnabledorDisabled(v);
end
},
petcdguessingtoggle = {
type = "toggle", name = "Pet CD Guessing",
desc = "Enable/Disable Pet Cd Guessing, this will show pet cds on all possible masters, since there is no reasonable way of determining who's pet it is from combatlog events and GUIDs, this will be really inaccurate if there are 2-3 lock for example.",
order = 12,
get = function() return Rekt:getPetCDGuessing() end,
set = function(_, v)
Rekt:setPetCDGuessing(v);
end
},
globalcdtypesortHeader = {
type = "header", name = "Global CD Type sorting", order = 13
},
cdtypesortordertoggle = {
type = "toggle", name = "Enabled", desc = "Enable/Disable CD Type Sort Order, It works like this: you set silence to 1, then cc to 2 and anticc to 2, then silences will go first, then cc and anticc as secound, they are organized within groups based on how you set them in the CDs settings tab.", order = 15,
get = function() return Rekt:getCDTypeSortingEnable() end,
set = function(_, v)
Rekt:setCDTypeSortingEnable(v);
end
},
silencerange = {
type = "range", name = "Silence's Type Order", order = 17, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("silence") end,
set = function(_, v)
Rekt:setTypeSortOrder("silence", v);
end
},
gapcloserrange = {
type = "range", name = "Gapcloser's Type Order", order = 18, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("gapcloser") end,
set = function(_, v)
Rekt:setTypeSortOrder("gapcloser", v);
end
},
defensiverange = {
type = "range", name = "Defensive's Type Order", order = 19, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("defensive") end,
set = function(_, v)
Rekt:setTypeSortOrder("defensive", v);
end
},
potionrange = {
type = "range", name = "Potion's Type Order", order = 20, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("potion") end,
set = function(_, v)
Rekt:setTypeSortOrder("potion", v);
end
},
nukerange = {
type = "range", name = "Nuke's Type Order", order = 21, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("nuke") end,
set = function(_, v)
Rekt:setTypeSortOrder("nuke", v);
end
},
anticcrange = {
type = "range", name = "Anticc's Type Order", order = 22, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("anticc") end,
set = function(_, v)
Rekt:setTypeSortOrder("anticc", v);
end
},
ccrange = {
type = "range", name = "Cc's Type Order", order = 23, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("cc") end,
set = function(_, v)
Rekt:setTypeSortOrder("cc", v);
end
},
stunrange = {
type = "range", name = "Stun's Type Order", order = 24, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("stun") end,
set = function(_, v)
Rekt:setTypeSortOrder("stun", v);
end
},
disarmrange = {
type = "range", name = "Disarm's Type Order", order = 25, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("disarm") end,
set = function(_, v)
Rekt:setTypeSortOrder("disarm", v);
end
},
cdresetrange = {
type = "range", name = "Cdreset's Type Order", order = 26, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("cdreset") end,
set = function(_, v)
Rekt:setTypeSortOrder("cdreset", v);
end
},
shieldrange = {
type = "range", name = "shield's Type Order", order = 27, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("shield") end,
set = function(_, v)
Rekt:setTypeSortOrder("shield", v);
end
},
uncategorizedrange = {
type = "range", name = "Uncategorized's Type Order", order = 28, min = 1, max = 15, step = 1,
get = function() return Rekt:getTypeSortOrder("uncategorized") end,
set = function(_, v)
Rekt:setTypeSortOrder("uncategorized", v);
end
},
--50+
globalcolorHeader = {
type = "header", name = "CD Color settings", order = 51
},
silencecolorsel = {
type = "color", name = "Silence's color", hasAlpha = true, order = 52,
get = function() return Rekt:getColor("silence") end,
set = function(_, r, g, b, a)
Rekt:setColor("silence", r, g, b, a);
end
},
gapclosercolorsel = {
type = "color", name = "Gapcloser's color", hasAlpha = true, order = 53,
get = function() return Rekt:getColor("gapcloser") end,
set = function(_, r, g, b, a)
Rekt:setColor("gapcloser", r, g, b, a);
end
},
defensivecolorsel = {
type = "color", name = "Defensive's color", hasAlpha = true, order = 54,
get = function() return Rekt:getColor("defensive") end,
set = function(_, r, g, b, a)
Rekt:setColor("defensive", r, g, b, a);
end
},
potioncolorsel = {
type = "color", name = "Potion's color", hasAlpha = true, order = 55,
get = function() return Rekt:getColor("potion") end,
set = function(_, r, g, b, a)
Rekt:setColor("potion", r, g, b, a);
end
},
nukecolorsel = {
type = "color", name = "Nuke's color", hasAlpha = true, order = 56,
get = function() return Rekt:getColor("nuke") end,
set = function(_, r, g, b, a)
Rekt:setColor("nuke", r, g, b, a);
end
},
anticccolorsel = {
type = "color", name = "Anticc's color", hasAlpha = true, order = 57,
get = function() return Rekt:getColor("anticc") end,
set = function(_, r, g, b, a)
Rekt:setColor("anticc", r, g, b, a);
end
},
cccolorsel = {
type = "color", name = "Cc's color", hasAlpha = true, order = 58,
get = function() return Rekt:getColor("cc") end,
set = function(_, r, g, b, a)
Rekt:setColor("cc", r, g, b, a);
end
},
stuncolorsel = {
type = "color", name = "Stun's color", hasAlpha = true, order = 59,
get = function() return Rekt:getColor("stun") end,
set = function(_, r, g, b, a)
Rekt:setColor("stun", r, g, b, a);
end
},
disarmcolorsel = {
type = "color", name = "Disarm's color", hasAlpha = true, order = 60,
get = function() return Rekt:getColor("disarm") end,
set = function(_, r, g, b, a)
Rekt:setColor("disarm", r, g, b, a);
end
},
cdresetcolorsel = {
type = "color", name = "Cdreset's color", hasAlpha = true, order = 61,
get = function() return Rekt:getColor("cdreset") end,
set = function(_, r, g, b, a)
Rekt:setColor("cdreset", r, g, b, a);
end
},
shieldcolorsel = {
type = "color", name = "Shield's color", hasAlpha = true, order = 62,
get = function() return Rekt:getColor("shield") end,
set = function(_, r, g, b, a)
Rekt:setColor("shield", r, g, b, a);
end
},
uncategorizedcolorsel = {
type = "color", name = "Uncategorized's color", hasAlpha = true, order = 63,
get = function() return Rekt:getColor("uncategorized") end,
set = function(_, r, g, b, a)
Rekt:setColor("uncategorized", r, g, b, a);
end
},
--70+
globalotherHeader = {
type = "header", name = "Other settings", order = 70
},
drtimerange = {
type = "range", name = "Diminishing Return time", order = 71, min = 1, max = 25, step = 1,
get = function() return Rekt:getDRTime() end,
set = function(_, v)
Rekt:setDRTime(v);
end
},
}
--[[
--100+ (Modules)
local ordern = 1;
for k, v in pairs(self.modules) do
local options = v:GetOptions()
args["moduleheader" .. ordern] = {
type = "header", name = "Other settings", order = 100 * ordern
};
local orderic = 1;
for k1, v1 in pairs(options) do
args[k1] = {
type = v1["type"], name = v1["name"], order = (100 * ordern) + orderic
};
end
ordern = ordern + 1
end
]]--
return args;
end
--order 50+
function Rekt:getDebugOptions()
local args = {
spellcast = {
type = "toggle", name = "SpellCast", desc = "Enable/Disable writing out SPELL_CAST_SUCCESS events.", order = 50,
get = function() return Rekt:getSpellCastDebug() end,
set = function(_, v)
Rekt:setSpellCastDebug(v);
end
},
spellAura = {
type = "toggle", name = "SpellAura", desc = "Enable/Disablewriting out SPLL_AURA_* events", order = 51,
get = function() return Rekt:getSpellAuraDebug() end,
set = function(_, v)
Rekt:setSpellAuraDebug(v);
end
},
allLog = {
type = "toggle", name = "Uber debug", desc = "Enable/Disable writing out all combatlog events", order = 52,
get = function() return Rekt:getAllCDebug() end,
set = function(_, v)
Rekt:setAllCDebug(v);
end
},
selfcd = {
type = "toggle", name = "Self CDs", desc = "Enable/Disable registering self CDs", order = 53,
get = function() return Rekt:getSelfCDRegister() end,
set = function(_, v)
Rekt:setSelfCDRegister(v);
end
},
selfIBcd = {
type = "toggle", name = "Friendly + Self Interrupts", desc = "Enable/Disable registering, and showing friendly and self interrupts at the interruptbar.", order = 54,
get = function() return Rekt:getIBSelfCDRegister() end,
set = function(_, v)
Rekt:setIBSelfCDRegister(v);
end
},
debugselect = {
type = "select", style = "dropdown", name = "debuglevel",
desc = "Change the debuglevel", order = 55,
values = {
["0"] = "No Messages",
},
get = function() return Rekt:getDebugLevel() end,
set = function(_, v)
Rekt:setDebugLevel(v);
end
},
debuglistselfdrs = {
type = "execute", name = "List SelfDRs",
desc = "List SelfDRs", order = 56,
func = function() return Rekt:printAllDRsForGUID(Rekt.targets["self"]); end,
},
}
return args;
end
function Rekt:GetTypeSortDropdown(num)
local arr = {
type = "select", style = "dropdown", name = "selfDRSortOrder",
desc = "Change the your DR's sort order", order = 28,
values = {
["1"] = "Ascending (CD left)",
["2"] = "Descending (CD left)",
["3"] = "Ascending (CD total)",
["4"] = "Descending (CD total)",
["5"] = "Recent first",
["6"] = "Recent Last",
["7"] = "No order"
},
get = function() return Rekt:getSortOrder("selfdr") end,
set = function(_, v)
Rekt:setSortOrder("selfdr", v);
end
}
return arr;
end
|
local sha2 = require 'sha2'
local t = require 'testhelper'
t( sha2( "Hello world!" ), "C0535E4BE2B79FFD93291305436BF889314E4A3FAEC05ECFFCBB7DF31AD9E51A", t.hexsame )
t( sha2( '' ), "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", t.hexsame )
t( sha2(( "a" ):rep( 1 )), "CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB", t.hexsame )
t( sha2(( "b" ):rep( 63 )), "94E419FABAC7F930810F9636354042F8C1426D2F834D4AB65C93DC1E69326B13", t.hexsame )
t( sha2(( "c" ):rep( 64 )), "52B6419D27BD7F547CEE3B92F8C17A908B8A49601ECBEC161E5030DE1DFE9E0A", t.hexsame )
t( sha2(( "d" ):rep( 65 )), "899987F295364060C6ABD752A7E895124B467FD7CF56B52CE22F4A684A5723F4", t.hexsame )
t( sha2(( "e" ):rep( 130 )), "C78A24F98CC9596CAFD6FC954A0664CA5CAD156AD406A8CC246B5E1F56864DB7", t.hexsame )
t( sha2(( "\xFF" ), 1), "B9DEBF7D52F36E6468A54817C1FA071166C3A63D384850E1575B42F702DC5AA1", t.hexsame )
t( sha2(( "\x00" ), 1), "BD4F9E98BEB68C6EAD3243B1B4C7FED75FA4FEAAB1F84795CBD8A98676A2A375", t.hexsame )
t( sha2(( "a" ):rep( 70 ), 69*8+1), "056ECB5B2DB796F0E49B5A7F3010C5DB3ECA6E87E03EB45F4E618F4867D002A9", t.hexsame )
t( sha2(( "a" ):rep( 70 ), 69*8+2), "0926C28F521555DB93892916F22414353234FCAB237AC5DC3AE6FA41A51BE15B", t.hexsame )
t( sha2(( "a" ):rep( 70 ), 69*8+7), "6759507E5A185A774D2C980067B4451671AA70705A35080779AAA6D3CEAA00FC", t.hexsame )
local function sha256(x,y) return sha2( x, y, 256 ) end
local function sha224(x,y) return sha2( x, y, 224 ) end
local function sha512(x,y) return sha2( x, y, 512 ) end
local function sha384(x,y) return sha2( x, y, 384 ) end
t( sha256( "Hello world!" ), "C0535E4BE2B79FFD93291305436BF889314E4A3FAEC05ECFFCBB7DF31AD9E51A", t.hexsame )
t( sha224( "Hello world!" ), "7E81EBE9E604A0C97FEF0E4CFE71F9BA0ECBA13332BDE953AD1C66E4", t.hexsame )
t( sha512( "Hello world!" ), "F6CDE2A0F819314CDDE55FC227D8D7DAE3D28CC556222A0A8AD66D91CCAD4AAD6094F517A2182360C9AACF6A3DC323162CB6FD8CDFFEDB0FE038F55E85FFB5B6", t.hexsame )
t( sha384( "Hello world!" ), "86255FA2C36E4B30969EAE17DC34C772CBEBDFC58B58403900BE87614EB1A34B8780263F255EB5E65CA9BBB8641CCCFE", t.hexsame )
t( sha256( '' ), "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", t.hexsame )
t( sha256(( "a" ):rep( 1 )), "CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB", t.hexsame )
t( sha256(( "b" ):rep( 63 )), "94E419FABAC7F930810F9636354042F8C1426D2F834D4AB65C93DC1E69326B13", t.hexsame )
t( sha256(( "c" ):rep( 64 )), "52B6419D27BD7F547CEE3B92F8C17A908B8A49601ECBEC161E5030DE1DFE9E0A", t.hexsame )
t( sha256(( "d" ):rep( 65 )), "899987F295364060C6ABD752A7E895124B467FD7CF56B52CE22F4A684A5723F4", t.hexsame )
t( sha256(( "e" ):rep( 130 )), "C78A24F98CC9596CAFD6FC954A0664CA5CAD156AD406A8CC246B5E1F56864DB7", t.hexsame )
t( sha512( '' ), "CF83E1357EEFB8BDF1542850D66D8007D620E4050B5715DC83F4A921D36CE9CE47D0D13C5D85F2B0FF8318D2877EEC2F63B931BD47417A81A538327AF927DA3E", t.hexsame )
t( sha512(( "a" ):rep( 1 )), "1F40FC92DA241694750979EE6CF582F2D5D7D28E18335DE05ABC54D0560E0F5302860C652BF08D560252AA5E74210546F369FBBBCE8C12CFC7957B2652FE9A75", t.hexsame )
t( sha512(( "b" ):rep( 127 )), "1FB5054735807A95088312066BDD2ACEC2EB8F65454BF77873CDF93998F79C75FC0F229AB4A8FFE0BFD5310A3357272ADCECB378D1F310EE43ED4A0634C6E5B8", t.hexsame )
t( sha512(( "c" ):rep( 128 )), "1CADAE2171FD051AA72F31D7D11D232D867E9823E0DA1FAB3F40288C46C009ABA8A378454514FA6756D00C1037FFBC32B3716DF881569C545A2E190CE426C79B", t.hexsame )
t( sha512(( "d" ):rep( 129 )), "30E54405DCC986AE90F830E01FC144190FF756EFD6E7E9FE4BDF9D6416B54C63E5CE18BFCE172DC360436052DB834A37317D0E2085FAF11E3C69A59020CDD8FC", t.hexsame )
t( sha512(( "e" ):rep( 300 )), "C2202F2BC948039340224757BF24A0B59A24737A3083DF9A8DD062AB7A0717147E025FDAB38CFC5DED56B3E8AC8072D87457AFA143DBD4F26ACF4CB26BB35266", t.hexsame )
t.test_embedded_example()
t()
|
-- Automatically generated from limoDrive.xml
{
{x = 0, y = 0, width = 2048, height = 646, offsetX = 0, offsetY = 0, offsetWidth = 0, offsetHeight = 0}, -- 1: Limo stage0000
{x = 0, y = 656, width = 2048, height = 646, offsetX = 0, offsetY = 0, offsetWidth = 0, offsetHeight = 0}, -- 2: Limo stage0001
{x = 0, y = 1312, width = 2048, height = 646, offsetX = 0, offsetY = 0, offsetWidth = 0, offsetHeight = 0}, -- 3: Limo stage0002
{x = 0, y = 0, width = 2048, height = 646, offsetX = 0, offsetY = 0, offsetWidth = 0, offsetHeight = 0} -- 4: Limo stage0003
},
|
--- Copyright (c) 2020 Sammy James
local ADDON_NAME = ...
local CC = LibStub("AceAddon-3.0"):GetAddon(ADDON_NAME)
assert(CC, ADDON_NAME .. "not found")
local FL = CC:NewModule("FogLight")
local LOC = LibStub("AceLocale-3.0"):GetLocale(ADDON_NAME)
function FL:OnInitialize()
CC:AppendLocale("enUS", function(L)
L["FogLight"] = "Fog Light"
L["Module to show unexplored areas on the map."] = true
L["Unexplored color"] = true
L["Change the color of the unexplored areas"] = true
end)
CC:AddModuleOptions(self.moduleName, {
name = LOC["FogLight"],
desc = LOC["Module to show unexplored areas on the map."],
type = 'group',
args = {},
handler = self,
disabled = function()
return not CC:IsModuleEnabled(self.moduleName) or not CC:IsEnabled(self)
end,
})
end
function FL:OnEnable()
end
function FL:OnDisable()
end |
local playsession = {
{"MeggalBozale", {142041}},
{"PogomanD", {69134}},
{"rocifier", {129203}},
{"aceofshovels", {4047}},
{"15944831778", {35933}},
{"sadler1321", {86480}},
{"Menander", {85931}},
{"realDonaldTrump", {58813}}
}
return playsession |
local LIST = require 'Core.Modules.interface-list'
local listeners = {}
listeners.pos = function(e)
local list = LOCAL.pos_top_ads and {STR['settings.topads'], STR['settings.bottomads']} or {STR['settings.bottomads'], STR['settings.topads']}
LIST.new(list, e.target.x, e.target.y - e.target.height / 2, 'down', function(e)
if e.index > 0 then
LOCAL.pos_top_ads = e.text == STR['settings.topads'] ADMOB.hide()
if LOCAL.show_ads then ADMOB.show('banner', {bgColor = '#0f0f11', y = LOCAL.pos_top_ads and 'top' or 'bottom'}) end
SETTINGS.group:removeSelf()
SETTINGS.group = nil
SETTINGS.create()
SETTINGS.group.isVisible = true
NEW_DATA()
end
end, nil, nil, 0.5)
end
listeners.show = function(e)
local list = LOCAL.show_ads and {STR['button.yes'], STR['button.no']} or {STR['button.no'], STR['button.yes']}
LIST.new(list, e.target.x, e.target.y - e.target.height / 2, 'down', function(e)
if e.index > 0 then
LOCAL.show_ads = e.text == STR['button.yes'] ADMOB.hide()
if LOCAL.show_ads then ADMOB.show('banner', {bgColor = '#0f0f11', y = LOCAL.pos_top_ads and 'top' or 'bottom'}) end
SETTINGS.group:removeSelf()
SETTINGS.group = nil
SETTINGS.create()
SETTINGS.group.isVisible = true
NEW_DATA()
end
end, nil, nil, 0.5)
end
listeners.confirm = function(e)
local list = LOCAL.confirm and {STR['button.yes'], STR['button.no']} or {STR['button.no'], STR['button.yes']}
LIST.new(list, e.target.x, e.target.y - e.target.height / 2, 'down', function(e)
if e.index > 0 then
LOCAL.confirm = e.text == STR['button.yes']
SETTINGS.group:removeSelf()
SETTINGS.group = nil
SETTINGS.create()
SETTINGS.group.isVisible = true
NEW_DATA()
end
end, nil, nil, 0.5)
end
listeners.lang = function(e)
local list = {{STR['lang.' .. LOCAL.lang]}, {LOCAL.lang}}
for i = 1, #LANGS do
if LOCAL.lang ~= LANGS[i] then
list[1][#list[1] + 1] = STR['lang.' .. LANGS[i]]
list[2][#list[2] + 1] = LANGS[i]
end
end
LIST.new(list[1], e.target.x, e.target.y - e.target.height / 2, 'down', function(e)
if e.index > 0 then
LOCAL.lang = list[2][e.index]
STR = LANG[LOCAL.lang]
MENU.group:removeSelf()
MENU.group = nil
MENU.create()
SETTINGS.group:removeSelf()
SETTINGS.group = nil
SETTINGS.create()
SETTINGS.group.isVisible = true
NEW_DATA()
end
end, nil, nil, 0.5)
end
return function(e, type)
if ALERT then
if e.phase == 'began' then
display.getCurrentStage():setFocus(e.target)
e.target:setFillColor(0.22, 0.22, 0.24)
e.target.click = true
elseif e.phase == 'moved' and (math.abs(e.x - e.xStart) > 30 or math.abs(e.y - e.yStart) > 30) then
display.getCurrentStage():setFocus(nil)
e.target:setFillColor(0, 0, 0, 0.005)
e.target.click = false
elseif e.phase == 'ended' or e.phase == 'cancelled' then
display.getCurrentStage():setFocus(nil)
e.target:setFillColor(0, 0, 0, 0.005)
if e.target.click then
e.target.click = false
listeners[type](e)
end
end
end
return true
end
|
local ngx = ngx
local ngx_ERR = ngx.ERR
local ngx_log = ngx.log
local ngx_time = ngx.time
local ngx_var = ngx.var
local md5 = ngx.md5
local lua_cache_data = ngx.shared.lua_cache_data
local init_config = require "cache_proxy.config.config"
local op_time_version = require "cache_proxy.lua_script.op_time_version"
local op_redis = require "cache_proxy.lua_script.module.op_redis"
local nowtime_ver = lua_cache_data:get('cache_version')
if not nowtime_ver then
nowtime_ver = op_time_version.get_nowtime_version()
-- ngx_log(ngx_ERR,'缓存时间版本是:',nowtime_ver)
end
local url = (ngx_var.host or '') .. (ngx_var.request_uri or '')
url = 'sdt_' .. ngx.md5(url)
local redis_sharding = ngx_var.redis_sharding
local time_ver_h = 60/tonumber(init_config.cache_version_updatetime)
local cache_exist_ver_maximum = init_config.cache_servers_exprise * time_ver_h
local day_all_ver_count = 24 * time_ver_h
local set_ttl = function()
local expired_ver
if nowtime_ver > cache_exist_ver_maximum then
expired_ver = nowtime_ver - cache_exist_ver_maximum
else
expired_ver = day_all_ver_count - cache_exist_ver_maximum + nowtime_ver
end
return expired_ver
end
if ngx_var.http_user_agent == init_config.spider_user_agent then
local expired_ver = set_ttl()
local cmds = {
{'zadd', url, nowtime_ver,nowtime_ver},
{'zrem', url, expired_ver},
{'expire', url, 21600}
}
op_redis.pipeline_redis(cmds,redis_sharding)
ngx.req.set_header("need-static-dt-version",nowtime_ver)
else
--ngx.log(ngx_ERR,ngx_var.http_need_static_dt_version)
local client_time_ver = tonumber(ngx_var.http_need_static_dt_version) or nowtime_ver
if client_time_ver == 0 then
client_time_ver = nowtime_ver
end
local cmd = {'zrange', url , 0, -1}
local r = op_redis.pipeline_redis(cmd,redis_sharding)
local n_v = -1
if type(r) == 'table' then
if client_time_ver >= cache_exist_ver_maximum then
local min_v = client_time_ver - cache_exist_ver_maximum
for _, k in ipairs(r) do
k = tonumber(k)
if k > min_v and k <= client_time_ver and k > n_v then
n_v = k
end
end
else
local max_v = day_all_ver_count + (client_time_ver - cache_exist_ver_maximum)
local j = -1
for _, k in ipairs(r) do
k = tonumber(k)
if k > max_v then
if k > j then
j = k
end
elseif k <= client_time_ver then
if k > n_v then
n_v = k
end
end
end
if n_v == -1 then
n_v = j
end
end
if n_v > -1 then
ngx.req.set_header("need-static-dt-version",n_v)
end
else
local expired_ver = set_ttl()
local cmds = {
{'zadd', url, nowtime_ver,nowtime_ver},
{'expire', url, 21600}
}
op_redis.pipeline_redis(cmds,redis_sharding)
ngx.req.set_header("need-static-dt-version",nowtime_ver)
end
end
|
mysterious_merchant = {
on_healed = function(mob, healer)
mob_ai_basic.on_healed(mob, healer)
end,
on_attacked = function(mob, attacker)
--mob.target = 0
mob.newMove = 500
mob.state = MOB_ESCAPE
if (attacker.damage >= mob.health) then
if math.random(1, 1) == 1 then
attacker:msg(
0,
mob.name .. " spawns a mysterious portal in an attempt to escape death",
attacker.ID
)
mob:addNPC(
"TreasurePortalNpc",
mob.m,
mob.x,
mob.y,
2,
500,
60000,
0
)
end
end
mob_ai_basic.on_attacked(mob, attacker)
RunAway(mob, attacker)
end,
move = function(mob, target)
--mob_ai_basic.move(mob, target)
RunAway(mob, target)
end
}
|
--Copyright (c) 2013, Byrthnoth
--All rights reserved.
--Redistribution and use in source and binary forms, with or without
--modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of <addon name> nor the
-- names of its contributors may be used to endorse or promote products
-- derived from this software without specific prior written permission.
--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
--ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
--WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
--DISCLAIMED. IN NO EVENT SHALL <your name> BE LIABLE FOR ANY
--DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
--(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
--LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
--ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
--SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------------
--Name: outgoing_text(original,modified)
--Desc: Searches the client's outgoing text for GearSwap handled commands and
-- returns '' if it finds one. Otherwise returns the command unaltered.
--Args:
---- original - String entered by the user
---- modified - String after being modified by upstream addons/plugins
-----------------------------------------------------------------------------------
--Returns:
---- none or ''
-----------------------------------------------------------------------------------
windower.register_event('outgoing text',function(original,modified)
if debugging >= 1 then windower.debug('outgoing text (debugging)') end
if gearswap_disabled then return modified end
local temp_mod = windower.convert_auto_trans(modified)
local splitline = temp_mod:split(' ')
local command = splitline[1]
local a,b,abil = string.find(temp_mod,'"(.-)"')
if abil then
abil = abil:lower()
elseif splitline.n == 3 then
abil = splitline[2]:lower()
end
local temptarg,temp_mob_arr = valid_target(splitline[splitline.n])
if command_list[command] and temptarg and (validabils[language][unify_prefix[command]][abil] or unify_prefix[command]=='/ra') then
if st_flag then
st_flag = nil
return true
elseif temp_mob_arr then
if logging then logit(logfile,'\n\n'..tostring(os.clock)..'(93) temp_mod: '..temp_mod) end
if clocking then out_time = os.clock() end
refresh_globals()
local r_line
if command_list[command] == 'Magic' then
r_line = r_spells[validabils[language][unify_prefix[command]][abil]]
storedcommand = command..' "'..r_line[language]..'" '
elseif command_list[command] == 'Ability' then
r_line = r_abilities[validabils[language][unify_prefix[command]][abil]]
storedcommand = command..' "'..r_line[language]..'" '
elseif command_list[command] == 'Item' then
r_line = r_items[validabils[language][unify_prefix[command]][abil]]
r_line.prefix = '/item'
r_line.type = 'Item'
storedcommand = command..' "'..r_line[language]..'" '
elseif command_list[command] == 'Ranged Attack' then
r_line = r_abilities[1]
storedcommand = command..' '
end
r_line.name = r_line[language]
spell = aftercast_cost(r_line)
spell.target = temp_mob_arr
spell.action_type = command_list[command]
if tonumber(splitline[splitline.n]) then
local inde,id
if out_arr[unify_prefix[spell.prefix]..' "'..spell.english..'" nil'] then
inde = unify_prefix[spell.prefix]..' "'..spell.english..'" nil'
else
inde = mk_out_arr_entry(spell,{target_id=spell.target.id},nil)
end
if outgoing_action_category_table[unify_prefix[spell.prefix]] == 3 then
id = spell.index
else
id = spell.id
end
out_arr[inde].proposed_packet = assemble_action_packet(spell.target.id,spell.target.index,outgoing_action_category_table[unify_prefix[spell.prefix]],id)
if out_arr[inde].proposed_packet then
equip_sets('precast',inde,spell)
return true
end
else
return equip_sets('pretarget',nil,spell)
end
end
end
return modified
end)
-----------------------------------------------------------------------------------
--Name: inc_action(act)
--Desc: Calls midcast or aftercast functions as appropriate in response to incoming
-- action packets.
--Args:
---- act - Action packet array (described on the dev wiki)
-----------------------------------------------------------------------------------
--Returns:
---- none
-----------------------------------------------------------------------------------
function inc_action(act)
if debugging >= 1 then windower.debug('action') end
if gearswap_disabled or act.category == 1 then return end
local temp_player = windower.ffxi.get_player()
local temp_player_mob_table = windower.ffxi.get_mob_by_index(temp_player.index)
local player_id = temp_player.id
-- Update player info for aftercast costs.
player.tp = temp_player.vitals.tp
player.mp = temp_player.vitals.mp
player.mpp = temp_player.vitals.mpp
local temp_pet,pet_id
if temp_player_mob_table.pet_index then
temp_pet = windower.ffxi.get_mob_by_index(temp_player_mob_table.pet_index)
if temp_pet then
pet_id = temp_pet.id
end
end
if act.actor_id ~= player_id and act.actor_id ~= pet_id then
return -- If the action is not being used by the player, the pet, or is a melee attack then abort processing.
end
local prefix = ''
if act.actor_id == pet_id then
prefix = 'pet_'
end
spell = get_spell(act)
local category = act.category
if logging then
if spell then logit(logfile,'\n\n'..tostring(os.clock)..'(178) Event Action: '..tostring(spell.english)..' '..tostring(act.category))
else logit(logfile,'\n\nNil spell detected') end
end
local inde
if spell and spell.english then
local pre = get_prefix(spell.prefix)
inde = pre..' "'..spell.english..'"'
spell.target = target_complete(windower.ffxi.get_mob_by_id(act.targets[1].id))
spell.action_type = command_list[pre]
elseif spell then
unknown_out_arr_deletion(prefix,act.targets[1].id)
return
end
-- Paralysis of JAs/spells/etc. and Out of Range messages for avatars both send two action packets when they occur.
-- The first packet is a paralysis packet that contains the message and spell-appropriate information.
-- The second packet contains the interruption code and no useful information as far as I can see.
-- The same occurs for items, except that they are both category 9 messages.
-- For some reason avatar Out of Range messages send two packets (Category 4 and Category 7)
-- Category 4 contains real information, while Category 7 does not.
-- I do not know if this will affect automatons being interrupted.
if (jas[act.category] or uses[act.category]) and spell then
if uses[act.category] and act.param == 28787 then
spell.action_type = 'Interruption'
spell.interrupted = true
end
if (out_arr[inde..' '..act.targets[1].id] or out_arr[inde..' nil'] or out_arr[inde..' '..player.id] or (debugging >= 1)) then
-- Only aftercast things that were precasted.
-- Also, there are some actions (like being paralyzed while casting Ninjutsu) that sends two result action packets. Block the second packet.
refresh_globals()
equip_sets(prefix..'aftercast',inde,spell)
end
elseif (readies[act.category] and act.param == 28787) and spell then -- and not (act.category == 9 or (act.category == 7 and prefix == 'pet_'))) then
spell.action_type = 'Interruption'
spell.interrupted = true
if (out_arr[inde..' '..act.targets[1].id] or out_arr[inde..' nil'] or out_arr[inde..' '..player.id] or (debugging >= 1)) then
-- Only aftercast things that were precasted.
-- Also, there are some actions (like being paralyzed while casting Ninjutsu) that sends two result action packets. Block the second packet.
refresh_globals()
equip_sets(prefix..'aftercast',inde,spell)
end
elseif readies[act.category] and prefix == 'pet_' and act.targets[1].actions[1].message ~= 0 then -- Entry for pet midcast. Excludes the second packet of "Out of range" BPs.
inde = mk_out_arr_entry(spell,{target_id==spell.target.id},nil)
refresh_globals()
equip_sets('pet_midcast',inde,spell)
end
end
-----------------------------------------------------------------------------------
--Name: inc_action_message(arr)
--Desc: Calls midcast or aftercast functions as appropriate in response to incoming
-- action message packets.
--Args:
---- arr - Action message packet arguments (described on the dev wiki):
-- actor_id,target_id,param_1,param_2,param_3,actor_index,target_index,message_id)
-----------------------------------------------------------------------------------
--Returns:
---- none
-----------------------------------------------------------------------------------
function inc_action_message(arr)
if debugging >= 1 then windower.debug('action message') end
if gearswap_disabled then return end
if T{6,20,113,406,605,646}:contains(arr.message_id) then
-- If your current spell's target is defeated or falls to the ground
delete_out_arr_by_id(arr.target_id)
end
local tempplay = windower.ffxi.get_player()
local prefix = ''
if arr.actor_id ~= tempplay.id then
if tempplay.pet_index then
if arr.actor_id ~= windower.ffxi.get_mob_by_index(tempplay.pet_index).id then
return
else
prefix = 'pet_'
end
else
return
end
end
if unable_to_use:contains(arr.message_id) then
if logging then logit(logfile,'\n\n'..tostring(os.clock)..'(195) Event Action Message: '..tostring(message_id)..' Interrupt') end
unknown_out_arr_deletion(prefix,arr.target_id)
end
end
|
--
-- LEW-19710-1, CCSDS SOIS Electronic Data Sheet Implementation
--
-- Copyright (c) 2020 United States Government as represented by
-- the Administrator of the National Aeronautics and Space Administration.
-- All Rights Reserved.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- -------------------------------------------------------------------------
-- Lua implementation of "implicit nodes" processing step
--
-- This resolves those cases where an entity must exist that is not explicitly
-- written in the EDS source. This includes:
--
-- Implicit Types:
-- When a container entry uses an "encoding" element to essentially override
-- the specified type, for all intents and purposes this is making a new type
-- on the fly. To keep future processing simpler, it is best to create a
-- new type node for this.
--
-- Multiple constraints:
-- When a container has a "ConstrantSet" with multiple entities in it, the
-- intended effect is to treat them as an "AND" function. To facilitate
-- conversion to a decision tree, this rearranges the constraints across
-- multiple implicit base type nodes, with one constraint per base type.
--
-- All of these implicit nodes must be created _before_ the linkages are determined,
-- so adjustments can be made more easily and relationships will be correct after
-- linkages/refs are resolved.
--
-- -------------------------------------------------------------------------
SEDS.info ("SEDS implicit scalars START")
-- -------------------------------------------------------------------------
-- HELPER FUNCTIONS
-- These are used locally but not exposed to the outside world
-- -------------------------------------------------------------------------
local ENCODING_FILTER = SEDS.create_nodetype_filter
{
"INTEGER_DATA_ENCODING",
"FLOAT_DATA_ENCODING",
"STRING_DATA_ENCODING"
}
-- The ALL_IMPLICIT_TYPES is a local registry of all types created in this
-- script. It is indexed by the container that necessitated them.
local ALL_IMPLICIT_TYPES = {}
-- Creates an implicit node (might be a type or something else)
-- This sets up the metadata of the new node consistently.
local function initialize_implicit_node(entity_type, refentry)
local implicit_node = SEDS.new_tree_object(entity_type)
-- Copy the xml_filename/xml_linenum attributes for traceability
-- This helps with diagnosis if an error occurs later
implicit_node.implicit = true -- mark to indicate this was not in original XML
implicit_node.xml_filename = refentry.xml_filename
implicit_node.xml_linenum = refentry.xml_linenum
implicit_node.attributes = { }
return implicit_node
end
-- Creates an implicit type node.
-- This helper function enforces a consistent naming convention
-- for the implicit type and also adds it to the local registry table
local function add_implicit_type(container, entry, entity_type, subnodes)
local typenode = initialize_implicit_node(entity_type, entry)
typenode.name = container.name .. "_" .. entry.name
typenode.subnodes = subnodes
-- Register the implicit type in the dictionary
-- This is used to update the datatypeset later.
local typelist = ALL_IMPLICIT_TYPES[container]
if (not typelist) then
typelist = {}
ALL_IMPLICIT_TYPES[container] = typelist
end
typelist[1 + #typelist] = typenode
return typenode
end
-- -------------------------------------------------------------------------
-- MAIN SCRIPT ROUTINE BEGINS HERE
-- -------------------------------------------------------------------------
-- Fix up all "DataTypeSet" entities as needed
local datatypesets = {}
for datatypeset in SEDS.root:iterate_subtree("DATA_TYPE_SET") do
datatypesets[1 + #datatypesets] = datatypeset
end
for _,datatypeset in ipairs(datatypesets) do
for cont in datatypeset:iterate_children("CONTAINER_DATATYPE") do
for entry in cont:iterate_subtree(SEDS.container_entry_filter) do
local typeref = entry.type
local encoding = entry:find_first(ENCODING_FILTER)
local arraydim = entry:find_first("ARRAY_DIMENSIONS")
if (encoding) then
local subnodes = {}
subnodes[1 + #subnodes] = encoding
subnodes[1 + #subnodes] = entry.type:find_first("ENUMERATION_LIST")
local implicit_encnode = add_implicit_type(cont, entry, typeref.entity_type, subnodes)
typeref = implicit_encnode
implicit_encnode.implicit_basetype = entry.type
end
if (arraydim or entry.entity_type == "CONTAINER_LIST_ENTRY") then
local dimension_list = initialize_implicit_node("DIMENSION_LIST", entry)
if (arraydim) then
-- Reference the subnodes directly
-- Should contain "Dimension" subnode(s)
dimension_list.subnodes = arraydim.subnodes
else
-- Create a dimension node
-- Should have a "ValidRange" subnode or a use a
-- range-restricted type as an indextyperef
local dimension_node = initialize_implicit_node("DIMENSION", entry)
local vrange = entry.listlengthfield:find_first("VALID_RANGE")
if (not vrange) then
-- Assume the type is an index type (will be verified later)
dimension_node.indextyperef = entry.listlengthfield.type
elseif (vrange.resolved_range.min and
(not vrange.resolved_range.min.inclusive or
vrange.resolved_range.min.value ~= 0)) then
entry:error("Range is not zero-based", entry.listlengthfield)
elseif (not vrange.resolved_range.max or not
vrange.resolved_range.max.value) then
entry:error("Range has no maximum defined", entry.listlengthfield)
else
local dim_size = vrange.resolved_range.max.value
if (vrange.resolved_range.max.inclusive) then
dim_size = 1 + dim_size
end
dimension_node.size = dim_size
end
dimension_node.parent = dimension_list
dimension_list.subnodes = { dimension_node }
end
local implicit_arraynode = add_implicit_type(cont, entry, "ARRAY_DATATYPE", { dimension_list })
dimension_list.parent = implicit_arraynode
implicit_arraynode.datatyperef = typeref
typeref = implicit_arraynode
end
entry.type = typeref
end
end
-- Create a new "subnodes" list for the parent datatypeset,
-- by inserting any implicit types directly prior
-- to the container that requires them
local merged_typelist = {}
for typenode in datatypeset:iterate_children() do
for _,implicit_type in ipairs(ALL_IMPLICIT_TYPES[typenode] or {}) do
implicit_type.parent = datatypeset
merged_typelist[1 + #merged_typelist] = implicit_type
end
merged_typelist[1 + #merged_typelist] = typenode
end
datatypeset.subnodes = merged_typelist
end
SEDS.info ("SEDS implicit scalars END")
|
local button = modules.class.get("button")
local allowed_characters = {
["."] = true
}
local text_entry = modules.class("text_entry", "button")
function text_entry:init()
button.init(self)
self.time_since_last_keypressed = os.clock()
self.time_since_last_keydown = os.clock()
self.keydown_start_delay = 0.5
self.keydown_event_delay = 0.03
self.blink_time_passed = 0
self.blink_duration = 0.5
self.draw_blink_line = false
self.numeric = false
self.max_characters = nil
--new
self.selecting = false
end
function text_entry:post_init()
button.post_init(self)
--default text label is the "default text" that appears when your textbox is empty, and clears itself when you have anything in it
self.default_text_label = self:add("label")
self.default_text_label:set_text("")
self.default_text_label:dock("fill")
self.default_text_label:set_text_color(0.5, 0.5, 0.5, 1)
self:set_text("")
self:set_default_text("")
self:set_align(5)
self:add_hook("on_set_text", function(this, text)
if text == "" or not text then
self.default_text_label:set_text(self.default_text)
else
self.default_text_label:set_text("")
end
end)
self:add_hook("on_keypressed", function(this, key)
local text = this:get_text()
this.blink_time_passed = 0
this.draw_blink_line = true
if key == "backspace" then
this:set_text(text:sub(1, #text - 1))
this.time_since_last_keypressed = os.clock()
elseif key == "return" then
this:run_hooks("on_enter_pressed")
end
if love.keyboard.isDown("lctrl") then
if key == "c" then
love.system.setClipboardText(this:get_text())
elseif key == "v" then
this:set_text(love.system.getClipboardText())
end
end
end)
self:add_hook("on_keydown", function(this, key)
local time = os.clock()
this.blink_time_passed = 0
this.draw_blink_line = true
if time >= this.time_since_last_keypressed + this.keydown_start_delay then
if time >= this.time_since_last_keydown + this.keydown_event_delay then
local text = this:get_text()
if key == "backspace" then
this:set_text(text:sub(1, #text - 1))
this.time_since_last_keydown = time
end
end
end
end)
self:add_hook("on_textinput", function(this, text)
if this:get_numeric() and not tonumber(text) then
if not allowed_characters[text] then
return
end
end
local current_text = this:get_text()
local max_characters = this:get_max_characters()
if max_characters and #current_text + 1 > max_characters then
return
end
this.blink_time_passed = 0
this.draw_blink_line = true
this:set_text(current_text .. text)
end)
self:add_hook("on_mousepressed", function(this)
this.blink_time_passed = 0
this.draw_blink_line = true
end)
self:add_hook("on_update", function(this, dt)
if this.ui.active_child == this then
this.blink_time_passed = this.blink_time_passed + dt
if this.blink_time_passed >= this.blink_duration then
this.blink_time_passed = 0
this.draw_blink_line = not this.draw_blink_line
end
else
this.blink_time_passed = 0
this.draw_blink_line = false
end
end)
-----------------WIP
--mouse selection
--arrow keys move seletion
--delete removes forward letter from selection
--control a select from 1 to #text
--set start of selection based on font width and align, not sure about padding yet though
--if there is a big empty space because of word wrap that u click, should go to the left and find the next letter
self:add_hook("on_mousepressed", function(this, x, y, button)
if button == 1 then
self.selecting = true
end
end)
self:add_hook("on_mousereleased", function(this, x, y, button)
if button == 1 then
self.selecting = false
end
end)
--if selecting, draw selection box from start to end, blinking arrow at end (note end might be at hte beginning if u selected from right to left)
self:add_hook("on_update", function(this, dt)
end)
end
function text_entry:set_align(align)
button.set_align(self, align)
if self.default_text_label then
self.default_text_label:set_align(align)
end
end
function text_entry:draw()
button.draw(self)
if self.ui.active_child == self then --questionable
if self.draw_blink_line then
local font = self:get_font()
local previous_font = love.graphics.getFont()
local x, y = self:get_screen_pos()
local text = self:get_text()
love.graphics.setFont(font)
love.graphics.setColor(self:get_text_color())
love.graphics.print("|", x + self.w / 2 + font:getWidth(text), y + self.h / 2, 0, 1, 1, font:getWidth(text) / 2, font:getHeight() / 2)
love.graphics.setFont(previous_font)
end
end
end
function text_entry:set_font(font)
button.set_font(self, font)
self.default_text_label:set_font(font)
end
function text_entry:set_default_text(text)
self.default_text = text
end
function text_entry:get_default_text()
return self.default_text
end
function text_entry:set_numeric(bool)
self.numeric = bool
end
function text_entry:get_numeric()
return self.numeric
end
function text_entry:set_max_characters(number)
self.max_characters = number
end
function text_entry:get_max_characters()
return self.max_characters
end
return text_entry |
local zthreads = require "lzmq.threads"
-- If we run as thread we get global context
-- If we run as process we create new context
local ctx = zthreads.context()
-- Create new REQ socket and connect to the server
local skt, err = ctx:socket{"REQ",
connect = "tcp://127.0.0.1:5555"
}
if not skt then
print("Can not create client socket:", err)
os.exit(1)
end
-- Send message
local ok, err = skt:send("Hello")
if not ok then
print("Can not send hello message:", err)
os.exit(1)
end
-- Recv server response
local msg, err = skt:recv()
if not msg then
print("Can not recv server response:", err)
os.exit(1)
end
print("Client recv message:", msg)
|
local skynet = require "skynet"
local netpack = require "netpack"
local socket = require "socket"
local protobufload = require "protobufload"
local logstat = require "base.logstat"
local p_core = require "p.core"
local battle_send = require "battle.battle_send"
local cards = require "data.carddata"
cards = cards.inst()
require "struct.globle"
local card = {}
local mt = { __index = card }
local function get_out_oid()
if _G.card_oid==nil then
_G.card_oid = 1
end
if _G.card_oid>100000000 then
_G.card_oid = 1
end
_G.card_oid= _G.card_oid+1
return _G.card_oid
end
function card.new(war,player,cid)
local o = {} -- create object if user does not provide one
setmetatable (o, mt)
o:init(war,player,cid)
return o
end
function card:set_postype(value)
self.postype = value
end
function card:get_postype()
return postype
end
function card:set_mp( value )
self.mp = value
end
function card:get_mp()
return self.mp
end
function card:init(war,player,cid)
self.war = war
self.uid = player:get_userid()
self.player = player
self:set_id(cid)
--init状态
self.zz = 0
end
function card:set_oid(value)
self.oid = value
end
function card:get_oid()
return self.oid
end
function card:set_id(value)
self.id = value --卡牌ID
--print("card:"..value)
local mp = cards.get_obj( value )
--print_r(mp)
self:set_mp( table_copy( mp ) )
--print_r(mp)
self.ap = mp["atk"]
self.mhp = mp["health"]
self.hp = mp["health"]
self.type = mp["type"] -- 种类
self.skill_id = mp["skill_id"] -- 技能编号
self.zz = 0
self.oid = get_out_oid()
self.mpStates = {}
self.mpBufStates = {}
self.war:set_obj(self,self.oid)
self.ap1 = 0
self.ap2 = 0
self.ap99 = 0
self.hp1 = 0
self.hp2 = 0
self.hp99 = 0
self.dp1 = 0
self.dp2 = 0
self.dp99 = 0
self.mhp1 = 0
self.mhp2 = 0
self.mhp22 = 0
self.mhp99 = 0
if self.ap == nil then
self.ap = 0
end
end
function card:get_id()
print(self.id)
return self.id
end
function card:get_cid()
return self.id
end
function card:set_pos(value)
self.pos = value
end
function card:get_pos()
return self.pos
end
function card:set_uid(value)
self.uid = value
end
function card:get_uid()
return self.uid
end
function card:get_zz()
return self.zz
end
function card:set_zz(value)
self.zz = value
--print("self:get_hp()"..self:get_hp())
battle_send.cards_info(self.war,self:get_pos(),self:get_hp(),self:get_mhp(),self:get_ap(),self:get_zz())
end
function card:get_war()
return self.war
end
function card:set_war(value)
self.war = value
end
function card:set_player(value)
self.player = value
end
function card:get_player()
return self.player
end
function card:add_hp(mValue, times)
local k = self:get_mhp( )-self:get_hp( )
if mValue>k then
mValue = k
end
self.hp = self.hp+mValue
return self.hp
end
function card:get_hp( )
local i,j
i = self.hp + self.hp2
if i<0 then
i = 0
end
j = self:get_mhp()
if i>j then
self.hp = self.hp-i+j
return j
end
return i
end
function card:add_ap(mValue, times)
local value
if times==1 then
self.ap1 = self.ap1+i
elseif times==-1 then --光环
self.ap2 = self.ap2+i
else
self.ap99 = self.ap99+i
end
end
function card:get_ap( )
local value;
value = self.ap + self.ap1 + self.ap99 + self.ap2;
if value<0 then
value = 0
end
return value
end
function card:add_dp(mValue, times)
local value
if times==1 then
self.dp1 = self.dp1+i
elseif times==-1 then --光环
self.dp2 = self.dp2+i
else
self.dp99 = self.dp99+i
end
end
function card:get_dp( )
local value
value = self.dp1 + self.dp99 + self.dp2
if value<0 then
value = 0
end
return value
end
function card:add_mhp( mValue, times )
local value
if times==1 then
self.mhp1 = self.mhp1+i
elseif times==-1 then --光环
self.mhp2 = self.mhp2+i
else
self.mhp99 = self.mhp99+i
end
end
function card:get_mhp( )
local value
value = self.mhp + self.mhp1 + self.mhp99 + self.mhp2
if value<0 then
value = 0
end
return value
end
function card:addBuffStatus( mType, value )
if self.mpBufStates[mType] == nil then
self.mpBufStates[mType] = {}
end
self.mpBufStates[mType][v] = value
end
function card:delBuffStatus( mType )
if self.mpBufStates[mType] == nil then
return
end
self.mpBufStates[mType] = nil;
end
function card:cleanBuffStatus( )
self.mpBufStates = {}
if self.ap2 or self.hp2 or self.mhp2 or self.dp2 then
self.ap2 = 0
self.mhp22 = self.mhp2
self.hp2 = 0
self.mhp2 = 0
self.dp2 = 0
end
end
function card:onTimeStatus( )
local keys,i,size;
for k,v in pairs(card.mpStates) do
if v["t"] <=1 then
card.mpStates[k]= nil
else
v["t"] = v["t"] -1
end
end
if self.ap1 or self.mhp1 or self.dp1 then
self.ap1 = 0
self.mhp1 = 0
self.dp1 = 0
battle_send.cards_info(self.war,self:get_pos(),self:get_hp(),self:get_mhp(),self:get_ap(),self:get_zz())
end
end
function card:addStatus( mType, value, times )
if times==-1 then
self:addBuffStatus(mType,value)
return
else
if self.mpStates[mType]==nil then
self.mpStates[mType] = {}
end
self.mpStates[mType]["v"] = value
self.mpStates[mType]["t"] = times
end
end
function card:delStatus( mType )
if self.mpStates[mType]==nil then
self.mpStates[mType] = {}
end
battle_send.cards_info(self.war,self:get_pos(),self:get_hp(),self:get_mhp(),self:get_ap(),self:get_zz())
self.mpStates[mType] = nil
end
function card:resetStatus( )
self.ap = 0
self.ap1 = 0
self.ap2 = 0
self.ap99 = 0
self.hp = 0
self.hp1 = 0
self.hp2 = 0
self.hp99 = 0
self.dp = 0
self.dp1 = 0
self.dp2 = 0
self.dp99 = 0
self.mhp = 0
self.mhp1 = 0
self.mhp2 = 0
self.mhp22 = 0
self.mhp99 = 0
self:set_id(self.cid)
end
function card:get_mhp2()
return self.get_mhp2
end
function card:get_mhp22()
return self.get_mhp22
end
function card:getStatus( mType )
if self.mpStates[mType] == nil then
if self.mpBufStates[mType] == nil then
return 0
else
return self.mpBufStates[mType]["v"]
end
else
if self.mpStates[mType] == nil then
return 0
else
return self.mpStates[mType]["v"]
end
end
end
--sw 属于
function card:set_jj(i)
local hp
if((self.jj==0)and(i==0)) then return end
if(card.jj~=0) then
hp = self.jj.hp
self.jj.sw=0
end
card.jj = i
if i then
i.sw = self
i.pos = card.pos
i.postype = define_battle.AREA_ZHANCHANG
end
card.hp = card.hp+hp
battle_ctrl.battle_next(self.war,define_battle.BATTLE_GUANGHUAN)
battle_send.jiejie_mov(self.war,self.uid,self.oid,self.cid,self.pos,self.postype)
end
function card:get_jj()
return self.jj
end
return card
|
require 'torch'
torch.setdefaulttensortype('torch.FloatTensor')
local ffi = require 'ffi'
local class = require('pl.class')
local dir = require 'pl.dir'
local tablex = require 'pl.tablex'
local argcheck = require 'argcheck'
require 'sys'
require 'xlua'
require 'image'
local dataset = torch.class('dataLoader')
local initcheck = argcheck{
pack=true,
help=[[
A dataset class for images in a flat folder structure (folder-name is
class-name). Optimized for extremely large datasets (upwards of 14
million images). Tested only on Linux (as it uses command-line linux
utilities to scale up)
]],
{name="path",
type="string",
help="Path to root directory of Cifar10"},
{name="protocol",
type="string",
default="train",
help="train | test"}
}
function dataset:__init(...)
-- argcheck
local args = initcheck(...)
print(args)
for k,v in pairs(args) do self[k] = v end
self.sampleHookTrain = self.defaultSampleHook
self.sampleHookTest = self.defaultSampleHook
-- get dataset
local filePath = paths.concat(self.path, 'cifar100_whitened.t7')
local file = torch.load(filePath)
local fileData
if self.protocol == 'train' then
fileData = file.trainData
elseif self.protocol == 'test' then
fileData = file.testData
else
error('Unidentified protocol:' .. self.protocol)
end
self.imageData = fileData.data:float():view(-1, 3072)
self.imageClass = fileData.labels:float()
self.image_size = self.imageData:size(1)
self.classes = {}
for i = 1,100 do table.insert(self.classes, i) end
self.classList = {}
for i=1,self.imageData:size(1) do
local lab = self.imageClass[i]
self.classList[lab] = self.classList[lab] or {}
local len = #self.classList[lab]
self.classList[lab][len+1] = i
end
self.classListSample = {}
for i=1,#self.classes do
self.classListSample[i] = torch.LongTensor(self.classList[i])
end
end
-- default image hooker
function dataset:defaultSampleHook(img)
local input = img:view(3,32,32)
return input
end
-- size(), size(class)
function dataset:size()
return self.image_size
end
-- getByClass
function dataset:getByClass(class)
local index = math.max(1,
math.ceil(torch.uniform() * self.classListSample[class]:nElement()))
local class_ind = self.classListSample[class][index]
local img = self.imageData[class_ind]
return self:sampleHookTrain(img)
end
-- converts a table of samples (and corresponding labels) to a clean tensor
local function tableToOutput(self, tab)
local tensor
local quantity = #tab
local iSize = torch.isTensor(tab[1]) and tab[1]:size():totable() or {}
local tSize = {quantity}
for _, dim in ipairs(iSize) do table.insert(tSize, dim) end
tensor = torch.Tensor(table.unpack(tSize)):fill(-1)
for i=1,quantity do
tensor[i] = tab[i]
end
return tensor
end
-- sampler, samples from the training set.
function dataset:sample(quantity)
assert(quantity)
local dataTable = {}
local scalarTable = {}
for i=1,quantity do
local class = torch.random(1, #self.classes)
local out = self:getByClass(class)
table.insert(dataTable, out)
table.insert(scalarTable, class)
end
local data = tableToOutput(self, dataTable)
local scalarLabels = tableToOutput(self, scalarTable)
return data, scalarLabels
end
function dataset:genInputs(quantity, currentEpoch)
local data, scalarLabels = self:sample(quantity)
return {data}, {scalarLabels}
end
function dataset:get(i1, i2)
local indices = torch.range(i1, i2);
local quantity = i2 - i1 + 1;
assert(quantity > 0)
-- now that indices has been initialized, get the samples
local dataTable = {}
local scalarTable = {}
for i=1,quantity do
-- load the sample
local img = self.imageData[indices[i]]
local out = self:sampleHookTest(img)
table.insert(dataTable, out)
table.insert(scalarTable, self.imageClass[indices[i]])
end
local data = tableToOutput(self, dataTable)
local scalarLabels = tableToOutput(self, scalarTable)
return data, scalarLabels
end
function dataset:getInputs(i1, i2, currentEpoch)
local data, scalarLabels = self:get(i1, i2)
return {data}, {scalarLabels}
end
return dataset
|
local foo = {}
function foo.bar(x)
return x*x + 1
end
print(foo.bar(4))
|
local isadmin = require("util.isadmin")
local send = require("util.send")
return function(client, line, subargs)
if line.prefix.host and isadmin(line.prefix.host) then
if #subargs > 0 then
for _, channel in pairs(subargs) do
if channel:sub(1,1) == "#" then
send(client, "PART :" .. channel)
end
end
elseif line.args[1]:sub(1,1) == "#" then
send(client, "PART :" .. line.args[1])
end
end
end |
modifier_attribute_bonus
modifier_healing_campfire_aura
modifier_healing_campfire_heal
modifier_lesser_nightcrawler_pounce
modifier_zombie_berserk
modifier_corpselord_revive
modifier_greater_clarity
modifier_upgraded_mortar
modifier_upgraded_barricade
modifier_creature_hybrid_flyer
modifier_creature_full_avoidance
modifier_lootdrop_thinker
modifier_fountain_glyph
modifier_radar_thinker
modifier_controller_test_melee_attack
modifier_glyph_reset
modifier_magic_immune
modifier_camera_follow
modifier_item_editor
modifier_prosperous_soul
modifier_movespeed_percentage
modifier_kill
modifier_phased
modifier_dominated
modifier_truesight
modifier_stunned
modifier_bashed
modifier_taunt
modifier_persistent_invisibility
modifier_invisible
modifier_followthrough
modifier_silence
modifier_invulnerable
modifier_attack_immune
modifier_disarmed
modifier_rooted
modifier_no_healthbar
modifier_fountain_aura
modifier_fountain_aura_buff
modifier_filler_thinker
modifier_filler_buff_icon
modifier_filler_heal_aura
modifier_filler_heal
modifier_fountain_invulnerability
modifier_illusion
modifier_rune_doubledamage
modifier_rune_haste
modifier_rune_invis
modifier_rune_regen
modifier_rune_arcane
modifier_truesight_aura
modifier_tower_truesight_aura
modifier_fountain_truesight_aura
modifier_tower_aura
modifier_tower_aura_bonus
modifier_tower_armor_bonus
modifier_disable_taunt_animation_cancel
modifier_teleporting
modifier_hexxed
modifier_knockback
modifier_backdoor_protection
modifier_backdoor_protection_in_base
modifier_backdoor_protection_active
modifier_projectile_vision
modifier_projectile_vision_on_minimap
modifier_cyclone
modifier_pet
modifier_tutorial_sleep
modifier_ice_slide
modifier_hero_statue
modifier_hero_statue_pedestal
modifier_battle_cup_effigy
modifier_hidden_nodamage
modifier_tutorial_disable_healing
modifier_tutorial_speechbubble
modifier_tutorial_forceanimation
modifier_tutorial_hide_npc
modifier_tutorial_low_attack_priority
modifier_tutorial_lasthit_helper
modifier_tutorial_lasthittable
modifier_creep_slow
modifier_creep_haste
modifier_buyback_gold_penalty
modifier_gold_bag_launch
modifier_provide_vision
modifier_scripted_motion_controller
modifier_teamshowcase_global
modifier_teamshowcase_showcase
modifier_halloffame_glow
modifier_book_of_strength
modifier_book_of_agility
modifier_book_of_intelligence
modifier_datadriven
modifier_lua
modifier_lua_horizontal_motion
modifier_lua_vertical_motion
modifier_lua_motion_both
modifier_neutral_sleep_ai
modifier_kobold_taskmaster_speed_aura
modifier_kobold_taskmaster_speed_aura_bonus
modifier_centaur_khan_endurance_aura
modifier_centaur_khan_endurance_aura_bonus
modifier_spawnlord_master_stomp
modifier_spawnlord_master_freeze
modifier_spawnlord_master_freeze_root
modifier_gnoll_assassin_envenomed_weapon
modifier_gnoll_assassin_envenomed_weapon_poison
modifier_ghost_frost_attack
modifier_ghost_frost_attack_slow
modifier_polar_furbolg_ursa_warrior_thunder_clap
modifier_neutral_spell_immunity
modifier_neutral_spell_immunity_visible
modifier_ogre_magi_frost_armor
modifier_ogre_magi_frost_armor_slow
modifier_dark_troll_warlord_ensnare
modifier_giant_wolf_critical_strike
modifier_mud_golem_rock_destroy
modifier_alpha_wolf_critical_strike
modifier_alpha_wolf_command_aura
modifier_alpha_wolf_command_aura_bonus
modifier_tornado_tempest
modifier_tornado_tempest_debuff
modifier_enraged_wildkin_toughness_aura
modifier_enraged_wildkin_toughness_aura_bonus
modifier_granite_golem_hp_aura
modifier_granite_golem_hp_aura_bonus
modifier_satyr_trickster_purge
modifier_satyr_hellcaller_unholy_aura
modifier_satyr_hellcaller_unholy_aura_bonus
modifier_spawnlord_aura
modifier_spawnlord_aura_bonus
modifier_forest_troll_high_priest_heal_autocast
modifier_forest_troll_high_priest_mana_aura
modifier_forest_troll_high_priest_mana_aura_bonus
modifier_harpy_storm_chain_lightning
modifier_black_dragon_fireball
modifier_black_dragon_splash_attack
modifier_black_dragon_dragonhide_aura
modifier_black_dragon_dragonhide_aura_bonus
modifier_mudgolem_cloak_aura
modifier_mudgolem_cloak_aura_bonus
modifier_blue_dragonspawn_sorcerer_evasion
modifier_blue_dragonspawn_overseer_evasion
modifier_blue_dragonspawn_overseer_devotion_aura
modifier_blue_dragonspawn_overseer_devotion_aura_bonus
modifier_big_thunder_lizard_wardrums
modifier_big_thunder_lizard_wardrums_aura
modifier_big_thunder_lizard_slam
modifier_big_thunder_lizard_frenzy
modifier_greevil_miniboss_casting
modifier_greevil_miniboss_black_nightmare
modifier_greevil_miniboss_black_nightmare_invulnerable
modifier_greevil_miniboss_blue_cold_feet
modifier_greevil_miniboss_blue_coldfeet_freeze
modifier_greevil_miniboss_blue_ice_vortex_thinker
modifier_greevil_miniboss_blue_ice_vortex
modifier_greevil_miniboss_red_earthshock
modifier_greevil_miniboss_red_overpower
modifier_greevil_miniboss_yellow_ion_shell
modifier_greevil_miniboss_yellow_surge
modifier_greevil_miniboss_white_degen_aura
modifier_greevil_miniboss_white_degen_aura_effect
modifier_greevil_miniboss_green_living_armor
modifier_greevil_miniboss_green_overgrowth
modifier_greevil_miniboss_orangelight_strike_array
modifier_greevil_miniboss_purple_venomous_gale
modifier_greevil_miniboss_sight
modifier_special_bonus_hp
modifier_special_bonus_mp
modifier_special_bonus_attack_speed
modifier_special_bonus_all_stats
modifier_special_bonus_movement_speed
modifier_special_bonus_hp_regen
modifier_special_bonus_mp_regen
modifier_special_bonus_intelligence
modifier_special_bonus_strength
modifier_special_bonus_agility
modifier_special_bonus_magic_resistance
modifier_special_bonus_day_vision
modifier_special_bonus_night_vision
modifier_special_bonus_vision
modifier_special_bonus_armor
modifier_special_bonus_attack_damage
modifier_special_bonus_attack_range
modifier_special_bonus_cast_range
modifier_special_bonus_spell_amplify
modifier_special_bonus_cooldown_reduction
modifier_special_bonus_respawn_reduction
modifier_special_bonus_gold_income
modifier_special_bonus_evasion
modifier_special_bonus_unique_morphling_4
modifier_special_bonus_unique_treant_3
modifier_special_bonus_20_bash
modifier_special_bonus_crit
modifier_special_bonus_lifesteal
modifier_special_bonus_cleave
modifier_special_bonus_corruption
modifier_special_bonus_corruption_debuff
modifier_special_bonus_mana_break
modifier_special_bonus_spell_block
modifier_special_bonus_spell_immunity
modifier_special_bonus_haste
modifier_special_bonus_truestrike
modifier_special_bonus_reincarnation
modifier_special_bonus_spell_lifesteal
modifier_special_bonus_exp_boost
modifier_tutorial_npcblocker_thinker
modifier_tutorial_npcblocker
modifier_tutorial_stat_collector
modifier_disabled_invulnerable
modifier_ancient_apparition_cold_feet_charge_counter
modifier_cold_feet
modifier_ancientapparition_coldfeet_freeze
modifier_ancient_apparition_ice_vortex_thinker
modifier_ice_vortex
modifier_chilling_touch
modifier_chilling_touch_slow
modifier_ice_blast
modifier_antimage_mana_break
modifier_antimage_blink_illusion
modifier_antimage_spell_shield
modifier_axe_berserkers_call
modifier_axe_berserkers_call_armor
modifier_axe_battle_hunger
modifier_axe_battle_hunger_self
modifier_axe_counter_helix
modifier_axe_culling_blade_boost
modifier_holdout_culling_blade
modifier_bane_enfeeble
modifier_bane_nightmare
modifier_bane_nightmare_invulnerable
modifier_bane_fiends_grip
modifier_bane_fiends_grip_self
modifier_bloodseeker_bloodrage
modifier_bloodseeker_bloodbath_thinker
modifier_bloodseeker_thirst
modifier_bloodseeker_thirst_vision
modifier_bloodseeker_thirst_speed
modifier_bloodseeker_rupture_charge_counter
modifier_bloodseeker_rupture
modifier_crystal_maiden_crystal_nova
modifier_crystal_maiden_frostbite
modifier_crystal_maiden_brilliance_aura
modifier_crystal_maiden_brilliance_aura_effect
modifier_crystal_maiden_freezing_field
modifier_crystal_maiden_freezing_field_slow
modifier_crystal_maiden_freezing_field_tracker
modifier_drow_ranger_frost_arrows
modifier_drow_ranger_frost_arrows_slow
modifier_drowranger_wave_of_silence_knockback
modifier_drow_ranger_trueshot
modifier_drow_ranger_trueshot_global
modifier_drow_ranger_trueshot_aura
modifier_drow_ranger_marksmanship
modifier_drow_ranger_marksmanship_reduction
modifier_earthshaker_fissure_stun
modifier_earthshaker_fissure
modifier_fissure_rooted
modifier_earthshaker_enchant_totem_leap
modifier_earthshaker_enchant_totem
modifier_earthshaker_aftershock
modifier_juggernaut_blade_fury
modifier_juggernaut_healing_ward_aura
modifier_juggernaut_healing_ward_heal
modifier_juggernaut_blade_dance
modifier_juggernaut_omnislash
modifier_juggernaut_omnislash_invulnerability
modifier_holdout_blade_fury
modifier_holdout_omnislash
modifier_kunkka_torrent_thinker
modifier_kunkka_torrent
modifier_kunkka_torrent_slow
modifier_kunkka_tidebringer
modifier_kunkka_x_marks_the_spot
modifier_kunkka_x_marks_the_spot_thinker
modifier_kunkka_ghost_ship_fleet
modifier_kunkka_ghost_ship_knockback
modifier_kunkka_ghost_ship_loaded
modifier_kunkka_ghost_ship_damage_absorb
modifier_kunkka_ghost_ship_damage_delay
modifier_lich_attack_slow
modifier_lich_attack_slow_debuff
modifier_lich_frostnova_slow
modifier_lich_chainfrost_slow
modifier_lich_frost_armor_autocast
modifier_lich_frost_armor
modifier_lich_frostarmor_slow
modifier_lich_chain_frost_thinker
modifier_lina_light_strike_array
modifier_lina_fiery_soul
modifier_lina_laguna_blade
modifier_holdout_fiery_soul
modifier_mirana_starfall_scepter_thinker
modifier_mirana_starfall_thinker
modifier_mirana_leap_charge_counter
modifier_mirana_leap
modifier_mirana_leap_buff
modifier_mirana_moonlight_shadow
modifier_morphling_waveform
modifier_morphling_adaptive_strike
modifier_morphling_morph
modifier_morphling_morph_agi
modifier_morphling_morph_str
modifier_morphling_replicate
modifier_nevermore_shadowraze_debuff
modifier_nevermore_shadowraze_counter
modifier_nevermore_presence_aura
modifier_nevermore_presence
modifier_nevermore_requiem_invis_break
modifier_nevermore_requiem_thinker
modifier_nevermore_requiem_aura
modifier_nevermore_requiem
modifier_nevermore_necromastery
modifier_phantom_lancer_spirit_lance
modifier_phantomlancer_dopplewalk_phase
modifier_phantom_lancer_doppelwalk_illusion
modifier_phantom_lancer_juxtapose
modifier_phantom_lancer_phantom_edge
modifier_phantom_lancer_phantom_edge_boost
modifier_phantom_lancer_phantom_edge_agility
modifier_phantom_lancer_juxtapose_illusion
modifier_puck_phase_shift
modifier_dream_coil_thinker
modifier_puck_coiled
modifier_pudge_meat_hook_pathingfix
modifier_pudge_meat_hook
modifier_pudge_rot
modifier_pudge_flesh_heap
modifier_pudge_dismember
modifier_pudge_dismember_pull
modifier_razor_plasma_field_thinker
modifier_razor_static_link
modifier_razor_static_link_buff
modifier_razor_static_link_debuff
modifier_razor_link_vision
modifier_razor_unstable_current
modifier_razor_unstablecurrent_slow
modifier_razor_eye_of_the_storm
modifier_razor_eye_of_the_storm_armor
modifier_sand_king_caustic_finale
modifier_sand_king_caustic_finale_orb
modifier_sand_king_caustic_finale_slow
modifier_sandking_impale
modifier_sandking_burrowstrike
modifier_sandking_sand_storm
modifier_sandking_sand_storm_invis
modifier_sandking_sand_storm_slow
modifier_sand_king_epicenter
modifier_sand_king_epicenter_slow
modifier_shadow_shaman_voodoo
modifier_shadow_shaman_shackles
modifier_shadow_shaman_serpent_ward
modifier_skeleton_king_hellfire_blast
modifier_skeleton_king_vampiric_aura
modifier_skeleton_king_vampiric_aura_buff
modifier_skeleton_king_mortal_strike_summon_thinker
modifier_skeleton_king_mortal_strike
modifier_skeleton_king_mortal_strike_summon
modifier_skeleton_king_reincarnation
modifier_skeleton_king_reincarnate_slow
modifier_skeleton_king_reincarnation_scepter
modifier_skeleton_king_reincarnation_scepter_active
modifier_storm_spirit_static_remnant_thinker
modifier_storm_spirit_electric_vortex_self_slow
modifier_storm_spirit_electric_vortex_pull
modifier_storm_spirit_electric_vortex_pull_nostack
modifier_storm_spirit_overload_passive
modifier_storm_spirit_overload
modifier_storm_spirit_overload_debuff
modifier_storm_spirit_ball_lightning
modifier_holdout_static_remnant_thinker
modifier_storm_spirit_static_remnant_talent
modifier_sven_great_cleave
modifier_sven_warcry
modifier_sven_gods_strength
modifier_sven_gods_strength_child
modifier_holdout_gods_strength
modifier_tidehunter_gush
modifier_tidehunter_kraken_shell
modifier_tidehunter_anchor_smash
modifier_tidehunter_ravage
modifier_tiny_avalanche_stun
modifier_tiny_avalanche
modifier_tiny_toss_charge_counter
modifier_tiny_toss
modifier_tiny_craggy_exterior
modifier_tiny_toss_tree_bonus
modifier_tiny_grow
modifier_vengefulspirit_wave_of_terror
modifier_vengefulspirit_command_aura
modifier_vengefulspirit_command_aura_illusion
modifier_vengefulspirit_command_aura_effect
modifier_vengefulspirit_command_negative_aura
modifier_vengefulspirit_command_negative_aura_effect
modifier_vengefulspirit_nether_swap
modifier_vengefulspirit_nether_swap_pathingfix
modifier_vengefulspirit_hybrid_special
modifier_windrunner_shackle_shot
modifier_windrunner_windrun_invis
modifier_windrunner_windrun
modifier_windrunner_windrun_slow
modifier_windrunner_focusfire
modifier_zuus_arc_lightning
modifier_zuus_lightningbolt_vision_thinker
modifier_zuus_static_field
modifier_zuus_thundergodswrath_vision_thinker
modifier_zuus_cloud
modifier_track_order_issuer
modifier_courier_morph_effect
modifier_courier_flying
modifier_courier_transfer_items
modifier_courier_take_stash_items
modifier_courier_return_stash_items
modifier_courier_burst
modifier_courier_shield
modifier_beastmaster_wild_axes
modifier_beastmaster_axe_stack_counter
modifier_beastmaster_axe_invulnerable
modifier_beastmaster_hawk_invisibility_activator
modifier_beastmaster_hawk_invisibility
modifier_beastmaster_boar_poison
modifier_beastmaster_boar_poison_greater
modifier_beastmaster_boar_poison_effect
modifier_beastmaster_inner_beast_aura
modifier_beastmaster_inner_beast
modifier_beastmaster_primal_roar_slow
modifier_beastmaster_primal_roar_speed
modifier_beastmaster_prima_roar_push
modifier_death_prophet_witchcraft
modifier_death_prophet_spirit_siphon_charge_counter
modifier_death_prophet_spirit_siphon
modifier_death_prophet_spirit_siphon_slow
modifier_death_prophet_exorcism
modifier_enigma_malefice
modifier_demonic_conversion
modifier_enigma_midnight_pulse_thinker
modifier_enigma_black_hole_thinker
modifier_enigma_black_hole_pull
modifier_faceless_void_backtrack
modifier_faceless_void_time_lock
modifier_faceless_void_timelock_freeze
modifier_faceless_void_time_dilation_slow
modifier_faceless_void_time_walk_tracker
modifier_faceless_void_time_walk_slow
modifier_faceless_void_time_walk
modifier_faceless_void_chronosphere
modifier_faceless_void_chronosphere_freeze
modifier_faceless_void_chronosphere_selfbuff
modifier_faceless_void_chronosphere_speed
modifier_lion_impale
modifier_lion_voodoo
modifier_lion_mana_drain
modifier_lion_finger_of_death
modifier_necrolyte_sadist_active
modifier_necrolyte_sadist_aura_effect
modifier_necrolyte_death_pulse
modifier_necrolyte_death_pulse_counter
modifier_necrolyte_heartstopper_aura
modifier_necrolyte_heartstopper_aura_effect
modifier_necrolyte_reapers_scythe
modifier_necrolyte_reapers_scythe_respawn_time
modifier_phantom_assassin_stiflingdagger_caster
modifier_phantom_assassin_stiflingdagger
modifier_phantom_assassin_phantom_strike
modifier_phantom_assassin_blur
modifier_phantom_assassin_blur_active
modifier_phantom_assassin_coupdegrace
modifier_phantomassassin_gravestone_thinker
modifier_phantomassassin_gravestone
modifier_phantomassassin_screensplatter
modifier_pugna_nether_blast_thinker
modifier_pugna_decrepify
modifier_pugna_nether_ward
modifier_pugna_nether_ward_aura
modifier_pugna_life_drain
modifier_queenofpain_shadow_strike
modifier_queenofpain_scream_of_pain_fear
modifier_riki_smoke_screen_thinker
modifier_riki_smoke_screen
modifier_riki_blinkstrike
modifier_riki_permanent_invisibility
modifier_riki_tricks_of_the_trade_phase
modifier_slardar_sprint
modifier_slardar_sprint_river
modifier_slithereen_crush
modifier_slardar_bash
modifier_slardar_amplify_damage
modifier_sniper_shrapnel_charge_counter
modifier_sniper_shrapnel_thinker
modifier_sniper_shrapnel_slow
modifier_sniper_headshot
modifier_sniper_headshot_slow
modifier_sniper_take_aim
modifier_sniper_assassinate_caster
modifier_sniper_assassinate
modifier_templar_assassin_refraction_damage
modifier_templar_assassin_refraction_absorb
modifier_templar_assassin_meld_animation
modifier_templar_assassin_meld
modifier_templar_assassin_meld_armor
modifier_templar_assassin_psi_blades
modifier_templar_assassin_psi_blades_slow
modifier_templar_assassin_trap
modifier_templar_assassin_trap_slow
modifier_templar_assassin_refraction_holdout
modifier_tinker_laser_blind
modifier_tinker_march_thinker
modifier_tinker_rearm
modifier_ursa_earthshock
modifier_ursa_overpower
modifier_ursa_fury_swipes
modifier_ursa_fury_swipes_damage_increase
modifier_ursa_enrage
modifier_venomancer_venomous_gale
modifier_venomancer_poison_sting_applier
modifier_venomancer_poison_sting
modifier_venomancer_poison_sting_ward
modifier_plague_wards_bonus
modifier_venomancer_poison_nova_thinker
modifier_venomancer_poison_nova
modifier_viper_poison_attack
modifier_viper_poison_attack_slow
modifier_viper_nethertoxin_thinker
modifier_viper_nethertoxin
modifier_viper_corrosive_skin
modifier_viper_corrosive_skin_slow
modifier_viper_viper_strike_slow
modifier_warlock_fatal_bonds
modifier_warlock_shadow_word
modifier_warlock_upheaval
modifier_warlock_rain_of_chaos_death_trigger
modifier_warlock_rain_of_chaos_thinker
modifier_special_bonus_unique_warlock_1
modifier_special_bonus_unique_warlock_2
modifier_warlock_golem_flaming_fists
modifier_warlock_golem_permanent_immolation
modifier_warlock_golem_permanent_immolation_debuff
modifier_witchdoctor_cask_thinker
modifier_voodoo_restoration_aura
modifier_voodoo_restoration_heal
modifier_maledict
modifier_witch_doctor_death_ward
modifier_animated_right_claw_swipe
modifier_animated_left_claw_swipe
modifier_move_from_activity
modifier_attached_unit
modifier_nian_dive
modifier_nian_frenzy
modifier_nian_roar
modifier_nian_invulnerable
modifier_nian_intrinsic
modifier_nian_attachment
modifier_nian_attachment_regrow
modifier_nian_waiting
modifier_animated_tail_spin
modifier_nian_apocalypse
modifier_nian_knockdown
modifier_nian_big_flinch
modifier_firecracker_debuff
modifier_nian_greater_bash
modifier_nian_greater_bash_speed
modifier_nian_charge
modifier_nian_charge_pinned
modifier_nian_tail_swipe_wall
modifier_nian_tail_swipe_air_time
modifier_nian_hurricane_whirlpool
modifier_nian_torrent_thinker
modifier_nian_whirlpool_thinker
modifier_nian_whirlpool_pull
modifier_nian_eruption_pending
modifier_nian_eruption
modifier_nian_waterball
modifier_nian_damage_reflection
modifier_nian_flag_trap_thinker
modifier_nian_flag_trapped
modifier_firework_mine
modifier_item_forcebootsintrinsic
modifier_item_force_boots
modifier_item_jumpbootsintrinsic
modifier_item_jump_boots
modifier_nian_leap
modifier_item_vermillion_robe_flames
modifier_item_vermillion_robe
modifier_roshan_spell_block
modifier_roshan_bash
modifier_roshan_slam
modifier_roshan_inherent_buffs
modifier_roshan_devotion_aura
modifier_roshan_devotion
modifier_alchemist_acid_spray_thinker
modifier_alchemist_acid_spray
modifier_alchemist_unstable_concoction
modifier_alchemist_goblins_greed
modifier_alchemist_chemical_rage_transform
modifier_alchemist_chemical_rage
modifier_batrider_sticky_napalm
modifier_flamebreak_knockback
modifier_flamebreak_damage
modifier_batrider_firefly
modifier_batrider_flaming_lasso
modifier_batrider_flaming_lasso_self
modifier_batrider_flaming_lasso_damage
modifier_bounty_hunter_jinada
modifier_bounty_hunter_jinada_slow
modifier_bounty_hunter_wind_walk
modifier_bounty_hunter_track
modifier_bounty_hunter_track_effect
modifier_brewmaster_thunder_clap
modifier_brewmaster_drunken_haze
modifier_brewmaster_drunken_brawler
modifier_brewmaster_primal_split_delay
modifier_brewmaster_primal_split_fire_phase
modifier_brewmaster_primal_split_duration
modifier_brewmaster_primal_split
modifier_brewmaster_earth_spell_immunity
modifier_brewmaster_earth_pulverize
modifier_brewmaster_storm_cyclone
modifier_brewmaster_storm_wind_walk
modifier_brewmaster_fire_permanent_immolation_aura
modifier_brewmaster_fire_permanent_immolation
modifier_broodmother_spawn_spiderlings
modifier_broodmother_spider_hp
modifier_broodmother_spawn_spiderite
modifier_broodmother_spawn_spiderite_debuff
modifier_broodmother_poison_sting
modifier_broodmother_poison_sting_debuff
modifier_broodmother_spin_web_charge_counter
modifier_broodmother_spin_web_web
modifier_broodmother_spin_web_invisible_applier
modifier_broodmother_spin_web_slowed
modifier_broodmother_spin_web
modifier_broodmother_incapacitating_bite
modifier_broodmother_incapacitating_bite_orb
modifier_broodmother_insatiable_hunger
modifier_chen_penitence
modifier_chen_holy_persuasion
modifier_chen_test_of_faith_teleport
modifier_clinkz_strafe
modifier_clinkz_searing_arrows
modifier_clinkz_wind_walk
modifier_clinkz_death_pact
modifier_dark_seer_vacuum
modifier_dark_seer_ion_shell
modifier_dark_seer_surge
modifier_dark_seer_wall_of_replica
modifier_dark_seer_wall_slow
modifier_darkseer_wallofreplica_illusion
modifier_dazzle_poison_touch
modifier_dazzle_shallow_grave
modifier_dazzle_weave_armor
modifier_doom_bringer_devour
modifier_doom_bringer_scorched_earth_effect
modifier_doom_bringer_scorched_earth_effect_aura
modifier_doombringer_infernal_blade
modifier_doom_bringer_infernal_blade_burn
modifier_doom_bringer_doom
modifier_dragonknight_breathefire_reduction
modifier_dragon_knight_dragon_blood
modifier_dragon_knight_dragon_form
modifier_dragon_knight_corrosive_breath
modifier_dragon_knight_corrosive_breath_dot
modifier_dragon_knight_splash_attack
modifier_dragon_knight_frost_breath
modifier_dragon_knight_frost_breath_slow
modifier_enchantress_untouchable
modifier_enchantress_untouchable_slow
modifier_enchantress_enchant
modifier_enchantress_enchant_controlled
modifier_enchantress_enchant_slow
modifier_enchantress_natures_attendants
modifier_enchantress_impetus
modifier_furion_wrath_of_nature_thinker
modifier_furion_wrathofnature_spawn
modifier_treant_bonus
modifier_treant_large_bonus
modifier_gyrocopter_rocket_barrage
modifier_gyrocopter_homing_missile_charge_counter
modifier_gyrocopter_homing_missile
modifier_gyrocopter_flak_cannon
modifier_gyrocopter_flak_cannon_scepter
modifier_gyrocopter_call_down_thinker
modifier_gyrocopter_call_down_slow
modifier_huskar_inner_vitality
modifier_huskar_burning_spear_self
modifier_huskar_burning_spear_counter
modifier_huskar_burning_spear_debuff
modifier_huskar_berserkers_blood
modifier_huskar_life_break_charge
modifier_huskar_life_break_slow
modifier_invoker_cold_snap
modifier_invoker_cold_snap_freeze
modifier_invoker_ghost_walk_self
modifier_invoker_ghost_walk_enemy
modifier_invoker_tornado
modifier_invoker_emp
modifier_invoker_alacrity
modifier_invoker_chaos_meteor_land
modifier_invoker_chaos_meteor_burn
modifier_invoker_sun_strike
modifier_invoker_sun_strike_cataclysm
modifier_forged_spirit_stats
modifier_melting_strike
modifier_forged_spirit_melting_strike_debuff
modifier_invoker_ice_wall_thinker
modifier_invoker_ice_wall_slow_aura
modifier_invoker_ice_wall_slow_debuff
modifier_invoker_deafening_blast_knockback
modifier_invoker_deafening_blast_disarm
modifier_invoker_quas_instance
modifier_invoker_wex_instance
modifier_invoker_exort_instance
modifier_jakiro_dual_breath
modifier_jakiro_dual_breath_slow
modifier_jakiro_dual_breath_burn
modifier_jakiro_ice_path_stun
modifier_jakiro_ice_path
modifier_jakiro_liquidfire
modifier_jakiro_liquid_fire_burn
modifier_jakiro_macropyre
modifier_leshrac_split_earth_thinker
modifier_leshrac_diabolic_edict
modifier_leshrac_lightning_storm_scepter_thinker
modifier_leshrac_lightning_storm
modifier_leshrac_lightning_storm_slow
modifier_leshrac_pulse_nova
modifier_life_stealer_rage
modifier_life_stealer_feast
modifier_life_stealer_open_wounds
modifier_life_stealer_infest
modifier_life_stealer_infest_effect
modifier_life_stealer_infest_creep
modifier_life_stealer_assimilate
modifier_life_stealer_assimilate_effect
modifier_lone_druid_spirit_bear_attack_check
modifier_lone_druid_spirit_bear_talent_logic
modifier_spirit_bear_attack_damage
modifier_lone_druid_spirit_bear_return
modifier_lone_druid_spirit_bear_entangle
modifier_lone_druid_spirit_bear_entangle_effect
modifier_lone_druid_spirit_bear_demolish
modifier_lone_druid_rabid
modifier_lone_druid_true_form_transform
modifier_lone_druid_true_form
modifier_lone_druid_druid_form_transform
modifier_lone_druid_true_form_battle_cry
modifier_lone_druid_savage_roar
modifier_luna_moon_glaive
modifier_luna_lunar_blessing
modifier_luna_lunar_blessing_aura
modifier_luna_eclipse
modifier_lycan_summon_wolves_bash
modifier_lycan_summon_wolves_critical_strike
modifier_lycan_summon_wolves_crit_maim
modifier_lycan_summon_wolves_invisibility
modifier_lycan_howl
modifier_lycan_feral_impulse_aura
modifier_lycan_feral_impulse
modifier_lycan_shapeshift_transform
modifier_lycan_shapeshift_aura
modifier_lycan_shapeshift
modifier_lycan_shapeshift_speed
modifier_night_stalker_void
modifier_night_stalker_crippling_fear
modifier_night_stalker_hunter_in_the_night_flight
modifier_night_stalker_hunter_in_the_night
modifier_nightstalker_darkness_thinker
modifier_nightstalker_darkness_blind
modifier_night_stalker_darkness
modifier_obsidian_destroyer_arcane_orb
modifier_obsidian_destroyer_astral_imprisonment_charge_counter
modifier_obsidian_destroyer_astral_imprisonment_prison
modifier_obsidian_destroyer_astral_imprisonment_debuff
modifier_obsidian_destroyer_astral_imprisonment_debuff_counter
modifier_obsidian_destroyer_astral_imprisonment_buff
modifier_obsidian_destroyer_astral_imprisonment_buff_counter
modifier_obsidian_destroyer_essence_aura
modifier_obsidian_destroyer_essence_aura_effect
modifier_obsidian_destroyer_sanity_eclipse_thinker
modifier_omniknight_repel
modifier_omniknight_degen_aura
modifier_omniknight_degen_aura_effect
modifier_omninight_guardian_angel
modifier_rattletrap_battery_assault
modifier_rattletrap_cog_thinker
modifier_rattletrap_cog_marker
modifier_rattletrap_cog
modifier_rattletrap_cog_push
modifier_clockwerk_rocket_flare_thinker
modifier_rattletrap_rocket_flare
modifier_rattletrap_hookshot
modifier_shadow_demon_disruption
modifier_shadow_demon_soul_catcher
modifier_shadow_demon_soul_catcher_illusion
modifier_shadow_demon_shadow_poison
modifier_shadow_demon_demonic_purge_charge_counter
modifier_shadow_demon_purge_slow
modifier_silencer_int_steal
modifier_silencer_curse_of_the_silent
modifier_silencer_glaives_of_wisdom
modifier_silencer_last_word
modifier_silencer_last_word_disarm
modifier_silencer_global_silence
modifier_spectre_spectral_dagger_path
modifier_spectre_spectral_dagger
modifier_spectre_spectral_dagger_in_path
modifier_spectre_spectral_dagger_path_phased
modifier_spectre_desolate
modifier_spectre_desolate_blind
modifier_spectre_dispersion
modifier_spectre_haunt
modifier_spirit_breaker_greater_bash
modifier_spirit_breaker_greater_bash_speed
modifier_spirit_breaker_charge_of_darkness
modifier_spirit_breaker_charge_of_darkness_vision
modifier_spirit_breaker_special_attack
modifier_spirit_breaker_empowering_haste_aura
modifier_spirit_breaker_empowering_haste
modifier_spirit_breaker_nether_strike_vision
modifier_spirit_breaker_nether_strike
modifier_weaver_swarm
modifier_weaver_swarm_debuff
modifier_weaver_shukuchi
modifier_weaver_geminate_attack
modifier_weaver_timelapse
modifier_abaddon_aphotic_shield
modifier_abaddon_frostmourne
modifier_abaddon_frostmourne_debuff
modifier_abaddon_frostmourne_buff
modifier_abaddon_borrowed_time
modifier_abaddon_borrowed_time_passive
modifier_abaddon_borrowed_time_damage_redirect
modifier_abyssal_underlord_firestorm_thinker
modifier_abyssal_underlord_firestorm_burn
modifier_abyssal_underlord_pit_of_malice_thinker
modifier_abyssal_underlord_pit_of_malice_ensare
modifier_abyssal_underlord_pit_of_malice_buff_placer
modifier_abyssal_underlord_atrophy_aura
modifier_abyssal_underlord_atrophy_aura_effect
modifier_abyssal_underlord_atrophy_aura_hero_buff
modifier_abyssal_underlord_atrophy_aura_creep_buff
modifier_abyssal_underlord_atrophy_aura_dmg_buff_counter
modifier_abyssal_underlord_atrophy_aura_scepter
modifier_abyssal_underlord_dark_rift
modifier_arc_warden_flux
modifier_arc_warden_magnetic_field_thinker_evasion
modifier_arc_warden_magnetic_field_thinker_attack_speed
modifier_arc_warden_magnetic_field_evasion
modifier_arc_warden_magnetic_field_attack_speed
modifier_arc_warden_spark_wraith_purge
modifier_arc_warden_spark_wraith_thinker
modifier_arc_warden_tempest_double
modifier_bristleback_viscous_nasal_goo
modifier_bristleback_quillspray_thinker
modifier_bristleback_quill_spray
modifier_bristleback_quill_spray_stack
modifier_bristleback_bristleback
modifier_bristleback_warpath
modifier_bristleback_warpath_stack
modifier_centaur_return_aura
modifier_centaur_return
modifier_centaur_stampede_slow
modifier_centaur_stampede
modifier_chaos_knight_reality_rift
modifier_chaos_knight_chaos_strike
modifier_chaos_knight_chaos_strike_debuff
modifier_chaos_knight_phantasm
modifier_dark_willow_bramble_maze_creation_thinker
modifier_dark_willow_bramble_maze_thinker
modifier_dark_willow_bramble_maze
modifier_dark_willow_shadow_realm_buff
modifier_dark_willow_shadow_realm_buff_attack_logic
modifier_dark_willow_cursed_crown
modifier_dark_willow_bedlam
modifier_dark_willow_terrorize_thinker
modifier_dark_willow_debuff_fear
modifier_dark_willow_creature_invulnerable
modifier_disruptor_thunder_strike
modifier_disruptor_glimpse
modifier_disruptor_glimpse_thinker
modifier_disruptor_kinetic_field_thinker
modifier_disruptor_kinetic_field
modifier_disruptor_static_storm_thinker
modifier_disruptor_static_storm
modifier_earth_spirit_stone_caller_charge_counter
modifier_earth_spirit_stone_thinker
modifier_earth_spirit_boulder_smash
modifier_earth_spirit_rolling_boulder_caster
modifier_earth_spirit_rolling_boulder_slow
modifier_earth_spirit_geomagnetic_grip_debuff
modifier_earth_spirit_geomagnetic_grip
modifier_earthspirit_petrify
modifier_earth_spirit_magnetize
modifier_elder_titan_ancestral_spirit
modifier_elder_titan_ancestral_spirit_buff
modifier_elder_titan_ancestral_spirit_hidden
modifier_elder_titan_ancestral_spirit_cast_time
modifier_elder_titan_echo_stomp
modifier_elder_titan_natural_order_aura_armor
modifier_elder_titan_natural_order_aura_magic_resistance
modifier_elder_titan_natural_order_armor
modifier_elder_titan_natural_order_magic_resistance
modifier_elder_titan_earth_splitter_caster
modifier_elder_titan_earth_splitter_thinker
modifier_elder_titan_earth_splitter
modifier_elder_titan_earth_splitter_scepter
modifier_ember_spirit_searing_chains
modifier_ember_spirit_sleight_of_fist_charge_counter
modifier_ember_spirit_sleight_of_fist_marker
modifier_ember_spirit_sleight_of_fist_caster
modifier_ember_spirit_sleight_of_fist_caster_invulnerability
modifier_ember_spirit_flame_guard
modifier_ember_spirit_fire_remnant_charge_counter
modifier_ember_spirit_fire_remnant_thinker
modifier_ember_spirit_fire_remnant_timer
modifier_ember_spirit_fire_remnant
modifier_keeper_of_the_light_illuminate
modifier_keeper_of_the_light_spirit_form_illuminate
modifier_keeper_of_the_light_mana_leak
modifier_keeper_of_the_light_chakra_magic
modifier_keeper_of_the_light_spirit_form
modifier_keeper_of_the_light_recall
modifier_keeper_of_the_light_blinding_light
modifier_blinding_light_knockback
modifier_legion_commander_overwhelming_odds
modifier_legion_commander_press_the_attack
modifier_legion_commander_moment_of_courage
modifier_legion_commander_moment_of_courage_lifesteal
modifier_legion_commander_duel_damage_boost
modifier_legion_commander_duel
modifier_holdout_gladiators_unite_thinker
modifier_holdout_gladiators_unite
modifier_magnataur_shockwave
modifier_magnataur_empower
modifier_magnataur_skewer_movement
modifier_magnataur_skewer_impact
modifier_magnataur_skewer_slow
modifier_magnataur_reverse_polarity
modifier_medusa_split_shot
modifier_medusa_mana_shield
modifier_medusa_stone_gaze
modifier_medusa_stone_gaze_slow
modifier_medusa_stone_gaze_facing
modifier_medusa_stone_gaze_stone
modifier_meepo_earthbind
modifier_meepo_self_geostrike
modifier_meepo_geostrike_debuff
modifier_meepo_divided_we_stand
modifier_monkey_king_boundless_strike_stun
modifier_monkey_king_boundless_strike_crit
modifier_monkey_king_bounce
modifier_monkey_king_bounce_leap
modifier_monkey_king_tree_dance_activity
modifier_monkey_king_right_click_jump_activity
modifier_monkey_king_spring_slow
modifier_monkey_king_spring_thinker
modifier_monkey_king_tree_dance_hidden
modifier_monkey_king_bounce_perch
modifier_monkey_king_unperched_stunned
modifier_monkey_king_arc_to_ground
modifier_monkey_king_transform
modifier_monkey_king_fur_army_thinker
modifier_monkey_king_fur_army_soldier
modifier_monkey_king_fur_army_soldier_in_position
modifier_monkey_king_fur_army_soldier_inactive
modifier_monkey_king_fur_army_soldier_hidden
modifier_obliterate_soldier
modifier_monkey_king_fur_army_bonus_damage
modifier_monkey_king_quadruple_tap
modifier_monkey_king_quadruple_tap_counter
modifier_monkey_king_quadruple_tap_bonuses
modifier_monkeyking_cloudrun
modifier_monkeyking_cloudrunstart
modifier_naga_siren_mirror_image
modifier_naga_siren_ensnare
modifier_naga_siren_rip_tide
modifier_naga_siren_song_of_the_siren_aura
modifier_naga_siren_song_of_the_siren
modifier_naga_siren_song_of_the_siren_ignore_me
modifier_nyx_assassin_impale
modifier_nyx_assassin_burrow
modifier_nyx_assassin_spiked_carapace
modifier_nyx_assassin_vendetta
modifier_ogre_magi_fireblast_multicast
modifier_ogre_magi_ignite
modifier_ogre_magi_ignite_multicast
modifier_ogre_magi_bloodlust_autocast
modifier_ogre_magi_bloodlust
modifier_ogre_magi_item_multicast
modifier_oracle_fortunes_end_channel_target
modifier_oracle_fortunes_end_purge
modifier_oracle_fates_edict
modifier_oracle_purifying_flames
modifier_oracle_false_promise_timer
modifier_oracle_false_promise_invis
modifier_oracle_false_promise
modifier_pangolier_heartpiercer
modifier_pangolier_heartpiercer_delay
modifier_pangolier_heartpiercer_debuff
modifier_pangolier_shield_crash_jump
modifier_pangolier_shield_crash_buff
modifier_pangolier_swashbuckle
modifier_pangolier_swashbuckle_stunned
modifier_pangolier_gyroshell
modifier_pangolier_gyroshell_ricochet
modifier_pangolier_gyroshell_bounce
modifier_pangolier_gyroshell_stunned
modifier_phoenix_sun_ray_vision
modifier_phoenix_sun_ray
modifier_phoenix_icarus_dive
modifier_phoenix_icarus_dive_burn
modifier_phoenix_fire_spirit_count
modifier_phoenix_fire_spirit_burn
modifier_phoenix_supernova_hiding
modifier_phoenix_sun
modifier_phoenix_sun_debuff
modifier_rubick_telekinesis
modifier_rubick_fade_bolt
modifier_rubick_fade_bolt_debuff
modifier_rubick_null_field
modifier_rubick_null_field_effect
modifier_rubick_spell_steal
modifier_shredder_whirling_death_debuff
modifier_shredder_timber_chain
modifier_shredder_reactive_armor
modifier_shredder_reactive_armor_stack
modifier_shredder_chakram_thinker
modifier_shredder_chakram_debuff
modifier_shredder_chakram_disarm
modifier_skywrath_mage_concussive_shot_slow
modifier_skywrath_mage_ancient_seal
modifier_skywrath_mage_mystic_flare
modifier_skywrath_mystic_flare_aura_effect
modifier_slark_dark_pact
modifier_slark_dark_pact_pulses
modifier_slark_pounce
modifier_slark_pounce_leash
modifier_slark_essence_shift
modifier_slark_essence_shift_debuff_counter
modifier_slark_essence_shift_debuff
modifier_slark_essence_shift_buff
modifier_slark_shadow_dance_aura
modifier_slark_shadow_dance_passive
modifier_slark_shadow_dance_passive_regen
modifier_slark_shadow_dance
modifier_slark_shadow_dance_visual
modifier_techies_suicide_respawn_time
modifier_techies_land_mine
modifier_techies_land_mine_burn
modifier_techies_stasis_trap
modifier_techies_stasis_trap_stunned
modifier_techies_suicide_leap_animation
modifier_techies_suicide_leap
modifier_techies_deploy_trap
modifier_techies_remote_mine
modifier_techies_minefield_sign_thinker
modifier_techies_minefield_sign_aura
modifier_techies_arcana_damage_listener
modifier_terrorblade_reflection_invulnerability
modifier_terrorblade_reflection_slow
modifier_terrorblade_conjureimage
modifier_terrorblade_metamorphosis_transform_aura
modifier_terrorblade_metamorphosis_transform_aura_applier
modifier_terrorblade_metamorphosis_transform
modifier_terrorblade_metamorphosis
modifier_terrorblade_arcana_kill_effect
modifier_treant_eyes_in_the_forest
modifier_treant_natures_guise
modifier_treant_natures_guise_invis
modifier_treant_natures_guise_root
modifier_treant_leech_seed
modifier_treant_living_armor
modifier_treant_overgrowth
modifier_troll_warlord_berserkers_rage
modifier_troll_warlord_whirling_axes_slow
modifier_troll_warlord_whirling_axes_melee
modifier_troll_warlord_axe_invulnerable
modifier_troll_warlord_whirling_axes_blind
modifier_troll_warlord_fervor
modifier_troll_warlord_battle_trance
modifier_tusk_ice_shard
modifier_tusk_snowball_visible
modifier_tusk_snowball_movement
modifier_tusk_snowball_movement_friendly
modifier_tusk_frozen_sigil_aura
modifier_tusk_frozen_sigil
modifier_tusk_walrus_punch
modifier_tusk_walrus_punch_slow
modifier_tusk_walrus_punch_air_time
modifier_tusk_walrus_kick_slow
modifier_tusk_walrus_kick_air_time
modifier_undying_decay_debuff_counter
modifier_undying_decay_debuff
modifier_undying_decay_buff_counter
modifier_undying_decay_buff
modifier_undying_tombstone_zombie_deathstrike_slow
modifier_undying_tombstone_zombie_deathstrike_slow_counter
modifier_undying_tombstone_zombie_deathstrike
modifier_undying_tombstone_zombie_deathlust
modifier_undying_tombstone_zombie_modifier
modifier_tombstone_hp
modifier_undying_tombstone_zombie_aura
modifier_undying_flesh_golem
modifier_undying_flesh_golem_plague_aura
modifier_undying_tombstone_death_trigger
modifier_visage_grave_chill_debuff
modifier_visage_grave_chill_buff
modifier_visage_soul_assumption
modifier_visage_gravekeepers_cloak_stack
modifier_visage_gravekeepers_cloak
modifier_visage_gravekeepers_cloak_secondary
modifier_visage_summon_familiars_damage_charge
modifier_visage_summon_familiars_stone_form
modifier_visage_summon_familiars_stone_form_buff
modifier_visage_summonfamiliars_timer
modifier_winter_wyvern_frost_attack
modifier_winter_wyvern_arctic_burn_flight
modifier_winter_wyvern_arctic_burn_slow
modifier_winter_wyvern_splinter_blast_slow
modifier_winter_wyvern_cold_embrace
winter_wyvern_winters_curse_kill_credit
modifier_winter_wyvern_winters_curse_aura
modifier_winter_wyvern_winters_curse
modifier_wisp_tentacles
modifier_wisp_tether
modifier_wisp_tether_slow
modifier_wisp_tether_haste
modifier_wisp_tether_scepter
modifier_wisp_spirit_invulnerable
modifier_wisp_spirits
modifier_wisp_overcharge
modifier_wisp_relocate_thinker
modifier_wisp_relocate_return
modifier_item_abyssal_blade
modifier_item_aegis
modifier_aegis_regen
modifier_item_aether_lens
modifier_item_ancient_janggo
modifier_item_ancient_janggo_aura_effect
modifier_item_ancient_janggo_active
modifier_item_arcane_boots
modifier_item_arcane_ring
modifier_item_armlet
modifier_item_armlet_unholy_strength
modifier_item_assault_positive_aura
modifier_item_assault_positive
modifier_item_assault_negative_armor_aura
modifier_item_assault_negative_armor
modifier_item_assault
modifier_item_battlefury
modifier_item_belt_of_strength
modifier_black_king_bar_immune
modifier_item_black_king_bar
modifier_item_blade_mail_reflect
modifier_item_blade_mail
modifier_item_blade_of_alacrity
modifier_item_blades_of_attack
modifier_item_blight_stone
modifier_blight_stone_buff
modifier_item_blink_dagger
modifier_item_bloodstone
modifier_item_bloodthorn
modifier_bloodthorn_debuff
modifier_item_energy_booster
modifier_item_point_booster
modifier_item_vitality_booster
modifier_item_boots_of_speed
modifier_item_boots_of_travel
modifier_boots_of_travel_incoming
modifier_item_power_treads
modifier_item_phase_boots
modifier_item_phase_boots_active
modifier_item_tranquil_boots
modifier_item_tranquil_boots2
modifier_item_boots_of_elves
modifier_item_bracer
modifier_item_broadsword
modifier_item_buckler
modifier_item_buckler_effect
modifier_item_butterfly_extra
modifier_item_butterfly
modifier_item_chainmail
modifier_item_circlet
modifier_clarity_potion
modifier_item_claymore
modifier_item_combo_breaker
modifier_item_combo_breaker_buff
modifier_item_cranium_basher
modifier_item_crimson_guard_extra
modifier_item_crimson_guard
modifier_item_crimson_guard_nostack
modifier_dagon
modifier_item_dagon
modifier_item_demon_edge
modifier_item_desolator
modifier_desolator_buff
modifier_item_diffusal_blade
modifier_item_diffusal_blade_slow
modifier_item_divine_rapier
modifier_item_dragon_lance
modifier_item_dustofappearance
modifier_item_eaglehorn
modifier_item_echo_sabre
modifier_echo_sabre_debuff
modifier_item_empty_bottle
modifier_bottle_regeneration
modifier_item_enchanted_mango
modifier_item_ethereal_blade
modifier_item_ethereal_blade_ethereal
modifier_item_ethereal_blade_slow
modifier_item_faerie_fire
modifier_flask_healing
modifier_item_forcestaff
modifier_item_forcestaff_active
modifier_item_gauntlets
modifier_item_gem_of_true_sight
modifier_item_ghost_scepter
modifier_ghost_state
modifier_item_glimmer_cape_building_limit
modifier_item_glimmer_cape
modifier_item_glimmer_cape_fade
modifier_item_gloves_of_haste
modifier_item_guardian_greaves
modifier_item_guardian_greaves_aura
modifier_item_hand_of_midas
modifier_item_headdress
modifier_item_headdress_aura
modifier_item_heart
modifier_item_heavens_halberd
modifier_heavens_halberd_buff
modifier_heavens_halberd_debuff
modifier_item_helm_of_iron_will
modifier_item_helm_of_the_dominator
modifier_item_helm_of_the_dominator_aura
modifier_item_helm_of_the_dominator_bonushealth
modifier_item_hood_of_defiance_barrier
modifier_item_hood_of_defiance
modifier_item_hurricane_pike
modifier_item_hurricane_pike_active
modifier_item_hurricane_pike_active_alternate
modifier_item_hurricane_pike_range
modifier_item_hyperstone
modifier_item_infused_raindrop
modifier_item_invisibility_edge
modifier_item_invisibility_edge_windwalk
modifier_item_iron_talon
modifier_item_ironwood_branch
modifier_item_javelin
modifier_item_lotus_orb
modifier_item_lotus_orb_active
modifier_lotus_orb_delay
modifier_item_lotus_orb_channel_check
modifier_maelstrom_chain
modifier_item_maelstrom
modifier_item_magic_stick
modifier_item_magic_wand
modifier_item_manta_style
modifier_manta_phase
modifier_manta
modifier_item_mantle
modifier_item_mask_of_death
modifier_item_mask_of_madness
modifier_item_mask_of_madness_berserk
modifier_item_medallion_of_courage
modifier_item_medallion_of_courage_armor_addition
modifier_item_medallion_of_courage_armor_reduction
modifier_item_mekansm
modifier_item_mekansm_aura
modifier_item_mekansm_spell
modifier_item_mekansm_noheal
modifier_item_meteor_hammer
modifier_item_meteor_hammer_land
modifier_item_meteor_hammer_burn
modifier_item_mithril_hammer
modifier_mjollnir_chain
modifier_item_mjollnir
modifier_item_mjollnir_static
modifier_item_monkey_king_bar
modifier_item_moon_shard
modifier_item_moon_shard_consumed
modifier_item_mystic_staff
modifier_item_necronomicon
modifier_necronomicon_warrior_mana_burn
modifier_necronomicon_warrior_last_will
modifier_necronomicon_warrior_sight
modifier_necronomicon_archer_purge
modifier_necronomicon_archer_aoe
modifier_necronomicon_archer_aura
modifier_item_null_talisman
modifier_item_nullifier
modifier_item_nullifier_mute
modifier_item_nullifier_slow
modifier_item_oblivion_staff
modifier_item_octarine_core
modifier_item_ogre_axe
modifier_item_orb_of_venom
modifier_item_orb_of_venom_slow
modifier_item_orchid_malevolence
modifier_orchid_malevolence_debuff
modifier_item_perseverance
modifier_item_pipe
modifier_item_pipe_aura
modifier_item_pipe_barrier
modifier_item_pipe_debuff
modifier_item_planeswalkers_cloak
modifier_item_plate_mail
modifier_item_poor_mans_shield
modifier_item_poor_mans_shield_bonus
modifier_item_quarterstaff
modifier_item_quelling_blade
modifier_item_radiance
modifier_item_radiance_debuff
modifier_item_reaver
modifier_item_refresherorb
modifier_item_ring_of_aquila_aura
modifier_item_ring_of_aquila_aura_bonus
modifier_item_ring_of_aquila
modifier_item_ring_of_basilius_aura
modifier_item_ring_of_basilius_aura_bonus
modifier_item_ring_of_basilius
modifier_item_ring_of_health
modifier_item_ring_of_protection
modifier_item_ring_of_regeneration
modifier_item_robe_of_magi
modifier_item_rod_of_atos
modifier_rod_of_atos_debuff
modifier_item_sacred_relic
modifier_item_sange
modifier_sange_buff
modifier_item_sange_and_yasha
modifier_sange_and_yasha_buff
modifier_item_satanic
modifier_item_satanic_unholy
modifier_item_cyclone
modifier_eul_cyclone
modifier_item_shadow_amulet
modifier_item_shadow_amulet_fade
modifier_item_sheepstick
modifier_sheepstick_debuff
modifier_item_shivas_guard
modifier_item_shivas_guard_aura
modifier_item_shivas_guard_thinker
modifier_item_shivas_guard_blast
modifier_item_silver_edge
modifier_item_silver_edge_windwalk
modifier_silver_edge_debuff
modifier_item_skadi
modifier_item_skadi_slow
modifier_item_slippers
modifier_smoke_of_deceit
modifier_item_sobi_mask
modifier_item_solar_crest
modifier_item_solar_crest_armor_addition
modifier_item_solar_crest_armor_reduction
modifier_item_soul_booster
modifier_item_soul_ring
modifier_item_soul_ring_buff
modifier_item_sphere
modifier_item_sphere_target
modifier_item_spirit_vessel
modifier_item_spirit_vessel_heal
modifier_item_spirit_vessel_damage
modifier_item_staff_of_wizardry
modifier_item_stout_shield
modifier_item_talisman_of_evasion
modifier_tango_heal
modifier_item_tome_of_knowledge
modifier_item_trident
modifier_item_ultimate_orb
modifier_item_ultimate_scepter
modifier_item_ultimate_scepter_consumed
modifier_item_urn_of_shadows
modifier_item_urn_heal
modifier_item_urn_damage
modifier_item_vanguard
modifier_item_veil_of_discord
modifier_item_veil_of_discord_debuff
modifier_item_vladmir
modifier_item_vladmir_aura
modifier_item_void_stone
modifier_item_ward_dispenser
modifier_ward_delay
modifier_item_buff_ward
modifier_item_observer_ward
modifier_item_sentry_ward
modifier_item_ward_true_sight
modifier_item_greater_crit
modifier_item_lesser_crit
modifier_item_wind_lace
modifier_item_wind_lace_bonus
modifier_item_wraith_band
modifier_item_yasha |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.