content
stringlengths 5
1.05M
|
|---|
XYZChat = {}
XYZChat.Core = {}
XYZChat.UI = {}
print("Loading XYZ Chat Box")
local path = "xyz_chat/"
if SERVER then
local files, folders = file.Find(path .. "*", "LUA")
for _, folder in SortedPairs(folders, true) do
print("Loading folder:", folder)
for b, File in SortedPairs(file.Find(path .. folder .. "/sh_*.lua", "LUA"), true) do
print("Loading file:", File)
AddCSLuaFile(path .. folder .. "/" .. File)
include(path .. folder .. "/" .. File)
end
for b, File in SortedPairs(file.Find(path .. folder .. "/sv_*.lua", "LUA"), true) do
print("Loading file:", File)
include(path .. folder .. "/" .. File)
end
for b, File in SortedPairs(file.Find(path .. folder .. "/cl_*.lua", "LUA"), true) do
print("Loading file:", File)
AddCSLuaFile(path .. folder .. "/" .. File)
end
end
end
if CLIENT then
local files, folders = file.Find(path .. "*", "LUA")
for _, folder in SortedPairs(folders, true) do
print("Loading folder:", folder)
for b, File in SortedPairs(file.Find(path .. folder .. "/sh_*.lua", "LUA"), true) do
print("Loading file:", File)
include(path .. folder .. "/" .. File)
end
for b, File in SortedPairs(file.Find(path .. folder .. "/cl_*.lua", "LUA"), true) do
print("Loading file:", File)
include(path .. folder .. "/" .. File)
end
end
if not GetConVar("xyz_chat_w") then
CreateClientConVar("xyz_chat_w", ScrW()*0.25, true, false, "The width of the chat box.")
end
if not GetConVar("xyz_chat_h") then
CreateClientConVar("xyz_chat_h", ScrH()*0.25, true, false, "The height of the chat box.")
end
if not GetConVar("xyz_chat_x") then
CreateClientConVar("xyz_chat_x", 5, true, false, "The x position of the chat box.")
end
if not GetConVar("xyz_chat_y") then
CreateClientConVar("xyz_chat_y", ScrH()*0.55, true, false, "The y position of the chat box.")
end
end
print("Loaded XYZ Chat Box")
|
require "Utils/Module"
require "Global/Module"
require "Common/Module"
|
local grpc_tools = require "kong.tools.grpc"
describe("grpc tools", function()
it("visits service methods", function()
local methods = {}
local grpc_tools_instance = grpc_tools.new()
grpc_tools_instance:each_method("helloworld.proto",
function(parsed, service, method)
methods[#methods + 1] = string.format("%s.%s", service.name, method.name)
end)
assert.same({
"HelloService.SayHello",
"HelloService.UnknownMethod",
}, methods)
end)
it("visits imported methods", function()
local methods = {}
local grpc_tools_instance = grpc_tools.new()
grpc_tools_instance:each_method("direct_imports.proto",
function(parsed, service, method)
methods[#methods + 1] = string.format("%s.%s", service.name, method.name)
end, true)
assert.same({
"HelloService.SayHello",
"HelloService.UnknownMethod",
"Own.Open",
}, methods)
end)
it("imports recursively", function()
local methods = {}
local grpc_tools_instance = grpc_tools.new()
grpc_tools_instance:each_method("second_level_imports.proto",
function(parsed, service, method)
methods[#methods + 1] = string.format("%s.%s", service.name, method.name)
end, true)
assert.same({
"HelloService.SayHello",
"HelloService.UnknownMethod",
"Own.Open",
"Added.Final",
}, methods)
end)
end)
|
return [[
{
"Lang": "ru",
"Name": "Russian",
}
]]
|
object_tangible_collection_scout_trooper_right_bicep = object_tangible_collection_shared_scout_trooper_right_bicep:new {
gameObjectType = 8211,}
ObjectTemplates:addTemplate(object_tangible_collection_scout_trooper_right_bicep, "object/tangible/collection/scout_trooper_right_bicep.iff")
|
-- Add a server script
client_script 'client.lua'
|
-- language specific higlights
local lush = require("lush")
local base = require("apprentice.base")
local M = {}
M = lush(function()
return {
rustSigil {base.ApprenticeOrange},
rustEscape {base.ApprenticeAqua},
rustStringContinuation {base.ApprenticeAqua},
rustEnum {base.ApprenticeAqua},
rustStructure {base.ApprenticeAqua},
rustModPathSep {base.ApprenticeFg2},
rustCommentLineDoc {base.Comment},
rustDefault {base.ApprenticeAqua},
}
end)
return M
|
function stdev()
local sum, sumsq, k = 0,0,0
return function(n)
sum, sumsq, k = sum + n, sumsq + n^2, k+1
return math.sqrt((sumsq / k) - (sum/k)^2)
end
end
ldev = stdev()
for i, v in ipairs{2,4,4,4,5,5,7,9} do
print(ldev(v))
end
|
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0122-New_rules_for_providing_VRHelpItems_VRHelpTitle.md
-- User story: TBD
-- Use case: TBD
--
-- Requirement summary: TBD
--
-- Description:
-- In case:
-- 1. Command1 with vrCommand and Command2 without vrCommands are added
-- 2. Perform reopening session
-- SDL does:
-- 1. resume HMI level and added before reconnection AddCommands
-- 2. send SetGlobalProperties with constructed the vrHelp and helpPrompt parameters using added vrCommands
-- after each resumed command
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/SDL5_0/Handling_VR_help_requests/commonVRhelp')
local commonFunctions = require("user_modules/shared_testcases/commonFunctions")
--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
--[[ Local Variables ]]
local commandWithoutVr = {
cmdID = 2,
menuParams = {
menuName = "CommandWithoutVr"
}
}
local commandWithVr = {
cmdID = 1,
vrCommands = { "vrCommand"},
menuParams = {
menuName = "commandWithVr"
}
}
local uiCommandArray = { { cmdID = commandWithVr.cmdID }, { cmdID = commandWithoutVr.cmdID } }
--[[ Local Functions ]]
local function resumptionLevelLimited()
common.getHMIConnection():ExpectNotification("BasicCommunication.OnResumeAudioSource",
{ appID = common.getHMIAppId() })
:Do(function(_,data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
common.getMobileSession():ExpectNotification("OnHMIStatus",
{ hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN" },
{ hmiLevel = "LIMITED", audioStreamingState = "AUDIBLE", systemContext = "MAIN" })
:Times(2)
end
local function resumptionDataAddCommands()
EXPECT_HMICALL("VR.AddCommand")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
:ValidIf(function(_,data)
for _, value in pairs(common.commandArray) do
if data.params.cmdID == value.cmdID then
local vrCommandCompareResult = commonFunctions:is_table_equal(data.params.vrCommands, value.vrCommand)
local Msg = ""
if vrCommandCompareResult == false then
Msg = "vrCommands in received VR.AddCommand are not match to expected result.\n" ..
"Actual result:" .. common.tableToString(data.params.vrCommands) .. "\n" ..
"Expected result:" .. common.tableToString(value.vrCommand) .."\n"
end
return vrCommandCompareResult, Msg
end
end
return true
end)
:Times(#common.commandArray)
EXPECT_HMICALL("TTS.SetGlobalProperties")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
:ValidIf(function(_, data)
local expectedHelpPrompt = common.vrHelpPrompt(common.commandArray)
local vrCommandCompareResult = commonFunctions:is_table_equal(data.params.helpPrompt, expectedHelpPrompt)
local Msg = ""
if vrCommandCompareResult == false then
Msg = "helpPrompt in received TTS.SetGlobalProperties is not match to expected result.\n" ..
"Actual result:" .. common.tableToString(data.params.helpPrompt) .. "\n" ..
"Expected result:" .. common.tableToString(expectedHelpPrompt) .."\n"
end
return vrCommandCompareResult, Msg
end)
EXPECT_HMICALL("UI.AddCommand")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
:ValidIf(function(_,data)
for k, value in pairs(uiCommandArray) do
if data.params.cmdID == value.cmdID then
return true
elseif data.params.cmdID ~= value.cmdID and k == #uiCommandArray then
return false, "Received cmdID in UI.AddCommand was not added previously before resumption"
end
end
end)
:Times(#uiCommandArray)
EXPECT_HMICALL("UI.SetGlobalProperties")
:Do(function(_, data)
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
:ValidIf(function(_, data)
local expectedVrHelp = common.vrHelp(common.commandArray)
local vrCommandCompareResult = commonFunctions:is_table_equal(data.params.vrHelp, expectedVrHelp)
local Msg = ""
if vrCommandCompareResult == false then
Msg = "vrHelp in received TTS.SetGlobalProperties is not match to expected result.\n" ..
"Actual result:" .. common.tableToString(data.params.vrHelp) .. "\n" ..
"Expected result:" .. common.tableToString(expectedVrHelp) .."\n"
end
return vrCommandCompareResult, Msg
end)
end
local function deactivateAppToLimited()
common.getHMIConnection():SendNotification("BasicCommunication.OnAppDeactivated", {appID = common.getHMIAppId()})
common.getMobileSession():ExpectNotification("OnHMIStatus",
{ systemContext = "MAIN", hmiLevel = "LIMITED", audioStreamingState = "AUDIBLE"})
end
--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("App registration", common.registerAppWOPTU)
runner.Step("Pin OnHashChange", common.pinOnHashChange)
runner.Step("App activation", common.activateApp)
runner.Step("Bring app to LIMITED HMI level", deactivateAppToLimited)
runner.Title("Test")
runner.Step("AddCommand with vr command", common.addCommandWithSetGP, {nil, commandWithVr })
runner.Step("AddCommand without vr command", common.addCommandWithoutSetGP, {nil, commandWithoutVr })
runner.Step("App reconnect", common.reconnect)
runner.Step("App resumption", common.registrationWithResumption,
{ 1, resumptionLevelLimited, resumptionDataAddCommands })
runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
|
---------------------------------------------
-- Hard Membrane
--
-- Description: Enhances evasion.
-- Type: Enhancing
-- Utsusemi/Blink absorb: N/A
-- Range: Self
-- Notes: Very sharp evasion increase.
---------------------------------------------
require("scripts/globals/monstertpmoves")
require("scripts/globals/settings")
require("scripts/globals/status")
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
return 0
end
function onMobWeaponSkill(target, mob, skill)
local typeEffect = tpz.effect.EVASION_BOOST
skill:setMsg(MobBuffMove(mob, typeEffect, 25, 0, 60))
return typeEffect
end
|
--------------------------------
-- @module ParticleFire
-- @extend ParticleSystemQuad
-- @parent_module cc
--------------------------------
-- Create a fire particle system.<br>
-- return An autoreleased ParticleFire object.
-- @function [parent=#ParticleFire] create
-- @param self
-- @return ParticleFire#ParticleFire ret (return value: cc.ParticleFire)
--------------------------------
-- Create a fire particle system withe a fixed number of particles.<br>
-- param numberOfParticles A given number of particles.<br>
-- return An autoreleased ParticleFire object.<br>
-- js NA
-- @function [parent=#ParticleFire] createWithTotalParticles
-- @param self
-- @param #int numberOfParticles
-- @return ParticleFire#ParticleFire ret (return value: cc.ParticleFire)
--------------------------------
--
-- @function [parent=#ParticleFire] init
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#ParticleFire] initWithTotalParticles
-- @param self
-- @param #int numberOfParticles
-- @return bool#bool ret (return value: bool)
--------------------------------
-- js ctor
-- @function [parent=#ParticleFire] ParticleFire
-- @param self
-- @return ParticleFire#ParticleFire self (return value: cc.ParticleFire)
return nil
|
local unpack = table.unpack or _G.unpack
util.seed()
local SCALE = 0.3
local N_EACH = 25
local function randtable(n, a, b)
local t = {}
for i=1, n do
t[i] = util.randab(a, b)
end
return t
end
local MATERIALS = {surfacetype.DIFFUSE, surfacetype.REFLECTIVE, surfacetype.STOP}
local function randommaterial()
local emission = colorvec.new(unpack(randtable(4, 0, 1)))
local reflection = colormat.new(unpack(randtable(16, 0, 1)))
local surfacetype = util.choice(MATERIALS)
return material.new(emission, reflection, surfacetype)
end
local ORIENTATIONS = {
mat3.new(
1, 0, 0,
0, 1, 0,
0, 0, 1
),
mat3.new(
1, 0, 0,
0, 0, 1,
0, 1, 0
),
mat3.new(
0, 1, 0,
1, 0, 0,
0, 0, 1
),
mat3.new(
0, 1, 0,
0, 0, 1,
1, 0, 0
),
mat3.new(
0, 0, 1,
0, 1, 0,
1, 0, 0
),
mat3.new(
0, 0, 1,
1, 0, 0,
0, 1, 0
)
}
local function randomorientation()
return util.choice(ORIENTATIONS)
end
local function randomsphere()
local pos = vec3.new(unpack(randtable(3, -2, 2)))
local radius = util.randab(0, SCALE)
return obj.sphere(pos, radius)
end
local function randomtorus()
local pos = vec3.new(unpack(randtable(3, -2, 2)))
local radius = util.randab(0, SCALE)
local thickness = util.randab(radius/4, radius)
local orientation = randomorientation()
return util.transform(obj.torus(pos, radius, thickness), orientation)
end
local function randomcuboid()
local pos = vec3.new(unpack(randtable(3, -2, 2)))
local radius = util.randab(0, SCALE)
return obj.cuboid(pos, vec3.new(radius, radius, radius))
end
local function randomcylinder()
local pos = vec3.new(unpack(randtable(3, -2, 2)))
local radius = util.randab(0, SCALE)
local height = util.randab(0, SCALE)
local orientation = randomorientation()
return util.transform(
obj.intersection(
obj.cylinder(pos, radius),
obj.cuboid(pos, vec3.new(radius, height, radius))
),
orientation
)
end
local objects = {}
for i=1, N_EACH do table.insert(objects, randomsphere()) end
for i=1, N_EACH do table.insert(objects, randomtorus()) end
for i=1, N_EACH do table.insert(objects, randomcuboid()) end
for i=1, N_EACH do table.insert(objects, randomcylinder()) end
for i, object in ipairs(objects) do objects[i] = obj.withmaterial(object, randommaterial()) end
return util.union(objects)
|
--[[
s:UI Panels
Martin Karer / Sezz, 2014
http://www.sezz.at
--]]
local S = Apollo.GetPackage("Gemini:Addon-1.1").tPackage:GetAddon("SezzUI");
local M = S:CreateSubmodule("Panels");
local log;
-----------------------------------------------------------------------------
local tXMLData = {
__XmlNode = "Forms",
{ -- Form
__XmlNode="Form", Class="Window",
LAnchorPoint=".5", LAnchorOffset="-230",
TAnchorPoint="0", TAnchorOffset="0",
RAnchorPoint=".5", RAnchorOffset="230",
BAnchorPoint="0", BAnchorOffset="212",
RelativeToClient="1", Template="Default",
Font="Default", Text="", TooltipType="OnCursor",
BGColor="00000000", TextColor="UI_WindowTextDefault",
Border="0", Picture="1", SwallowMouseClicks="1", Moveable="0", Escapable="0", IgnoreMouse="1",
Overlapped="1", TooltipColor="", Sprite="BasicSprites:WhiteFill", Tooltip="",
Name="SezzUIPanel", NoClip="1",
},
};
-----------------------------------------------------------------------------
-- Initialization
-----------------------------------------------------------------------------
function M:OnInitialize()
log = S.Log;
self.tPanels = {};
self.xmlDoc = XmlDoc.CreateFromTable(tXMLData);
end
function M:OnEnable()
self:CreatePanel(CColor.new(0, 0, 0, 0.3), { 0, 1, 1, 1 }, { 0, -250, 0, -59 });
self:CreatePanel(CColor.new(1, 1, 1, 0.6), { 0, 1, 1, 1 }, { 0, -251, 0, -250 });
self:CreatePanel(CColor.new(1, 1, 1, 0.6), { 0, 1, 1, 1 }, { 0, -59, 0, -58 });
end
-----------------------------------------------------------------------------
-- Panel Creation
-----------------------------------------------------------------------------
function M:CreatePanel(tColor, tAnchorPoints, tAnchorOffsets, tParent)
local wndPanel = Apollo.LoadForm(self.xmlDoc, "SezzUIPanel", "InWorldHudStratum", tParent or self.tPanels); -- FixedHudStratumLow
wndPanel:SetName("SezzUIPanel"..(#self.tPanels + 1));
wndPanel:SetAnchorPoints(unpack(tAnchorPoints));
wndPanel:SetAnchorOffsets(unpack(tAnchorOffsets));
wndPanel:SetBGColor(tColor);
table.insert(self.tPanels, wndPanel);
return wndPanel;
end
|
instrument {
overlay = true,
name = 'Fibonacci retracements B.Bands',
short_name = 'FBBB',
icon="indicators:BB"}
period = input (200, "front.period", input.integer, 1)
source = input (1, "front.ind.source", input.string_selection, inputs.titles_overlay)
fn = input (1, "front.newind.average", input.string_selection, averages.titles)
devs = input (2.3, "front.newind.stddev", input.double, 0.5)
input_group {
"front.ind.dpo.generalline",
colottop = input { default = "#00FFFF", type = input.color },
colormdd = input { default = "#0000FF", type = input.color },
colorbtn = input { default = "#00FFFF", type = input.color },
colorbtb = input { default = "#808080", type = input.color }
}
local sourceSeries = inputs [source]
local averageFunction = averages [fn]
basis = averageFunction(sourceSeries, period)
dev = devs * stdev(sourceSeries, period)
upper_1 = basis + 0.236 * dev
upper_2 = basis + 0.382 * dev
upper_3 = basis + 0.5 * dev
upper_4 = basis + 0.618 * dev
upper_5 = basis + 0.764 * dev
upper_6 = basis + 1 * dev
lower_1 = basis - 0.236 * dev
lower_2 = basis - 0.382 * dev
lower_3 = basis - 0.5 * dev
lower_4 = basis - 0.618 * dev
lower_5 = basis - 0.764 * dev
lower_6 = basis - 1 * dev
plot(basis, "BB Midle",colormdd,2,0,style.solid_line,na_mode.continue)
p1 = plot(upper_1, "0.236", colorbtb, 1,0, style.solid_line, na_mode.continue)
p2 = plot(upper_2, "0.382", colorbtb, 1,0, style.solid_line, na_mode.continue)
p3 = plot(upper_3, "0.5", colormdd, 2,0, style.solid_line, na_mode.continue)
p4 = plot(upper_4,"0.618" , colormdd, 2,0, style.solid_line, na_mode.continue)
p5 = plot(upper_5, "0.764", colorbtb, 1,0, style.solid_line, na_mode.continue)
p6 = plot(upper_6, "1", colottop, 2,0, style.solid_line, na_mode.continue)
p13 = plot(lower_1, "0.236", colorbtb, 1,0, style.solid_line, na_mode.continue)
p14 = plot(lower_2, "0.382", colorbtb, 1,0, style.solid_line, na_mode.continue)
p15 = plot(lower_3, "0.5", colormdd, 2,0, style.solid_line, na_mode.continue)
p16 = plot(lower_4, "0.618", colormdd, 2,0, style.solid_line, na_mode.continue)
p17 = plot(lower_5, "0.764", colorbtb, 1,0, style.solid_line, na_mode.continue)
p18 = plot(lower_6, "1", colorbtn, 2,0, style.solid_line, na_mode.continue)
|
local sandbox = require('sandbox')
describe('sandboxing', function ()
describe('when handling base cases', function ()
it('should run harmless strings', function ()
assert.same('hello', sandbox.run('return "hello"'))
end)
it('should have access to safe methods', function ()
assert.same(10, sandbox.run('return tonumber("10")'))
assert.same('FOOBAR', sandbox.run('return string.upper("foobar")'))
assert.same(1, sandbox.run('local a = {3,2,1}; table.sort(a); return a[1]'))
assert.same(10, sandbox.run('return math.max(1, 10)'))
end)
it('should not allow access to unsafe code', function ()
assert.error(function () sandbox.run('return metatable({}, {})') end)
assert.error(function () sandbox.run('return string.rep("foobar", 5)') end)
end)
it('should be able to return multiple values', function ()
local r = { sandbox.run('return "foo", "bar"') }
assert.same({ 'foo', 'bar' }, r)
end)
end)
describe('when handling string.rep', function ()
it('should not allow string:rep', function ()
assert.error(function () sandbox.run('return ("hello"):rep(5)') end)
end)
it('should restore the initial string.rep', function ()
sandbox.run('')
assert.same('barbarbar', string.rep('bar', 3))
end)
it('should restore string.rep even if an error occurred', function ()
assert.error(function () sandbox.run('error("foobar")') end)
assert.same('barbarbar', string.rep('bar', 3))
end)
it('should pass parameters to the sandboxed code', function ()
assert.same(3, sandbox.run('local a, b = ...; return a + b', {}, 1, 2))
end)
end)
describe('when the sandboxed code attempts to modify the base environment', function ()
it('should not be able to do so for modules', function ()
assert.error(function () sandbox.run('string.foo = 1') end)
assert.error(function () sandbox.run('string.char = 2') end)
end)
it('should not persist modifications to base functions', function ()
sandbox.run('error = function() end')
assert.error(function () assert.run('error("this error should be raised")') end)
end)
it('should not persist modifications to base functions even when provided by the sandboxed environment', function ()
local environment = { ['next'] = 'foobar' }
sandbox.run('next = "foobaz"', { environment = environment })
assert.same(environment['next'], 'foobar')
end)
end)
describe('when given infinite loops', function ()
it('should throw an error with infinite loops', function ()
assert.error(function () sandbox.run('while true do end') end)
end)
it('should restore string.rep after an infinite loop', function ()
assert.error(function () sandbox.run('while true do end') end)
assert.same('barbarbar', string.rep('bar', 3))
end)
it('should accept a quota parameter', function ()
assert.has_no.errors(function () sandbox.run('for i = 1, 100 do end') end)
assert.error(function () sandbox.run('for i = 1, 100 do end', { quota = 20 }) end)
end)
it('should not use quotas if the quota parameter is false', function ()
assert.has_no.errors(function ()
sandbox.run('for i = 1, 1000000 do end', { quota = false })
end)
end)
end)
describe('when given an environment option', function ()
it('should be available to the sandboxed environment as the _G variable', function ()
local environment = { foo = 1 }
assert.same(1, sandbox.run('return foo', { environment = environment }))
assert.same(1, sandbox.run('return _G.foo', { environment = environment }))
end)
it('should not hide the base environment', function ()
assert.same('FOOBAR', sandbox.run('return string.upper(foo)', {environment = {foo = 'foobar'}}))
end)
it('should not be able to modify the environment', function ()
local environment = { foo = 1 }
sandbox.run('foo = 2', {environment = environment})
assert.same(1, environment.foo)
end)
it('should use the environment metatable, if it exists', function ()
local env1 = { foo = 1 }
local env2 = { bar = 2 }
setmetatable(env2, { __index = env1 })
assert.same(3, sandbox.run('return foo + bar', { environment = env2 }))
end)
it('should override the sandboxed environment', function ()
local environment = { tostring = function (x) return 'hello ' .. x end }
assert.same('hello alice', sandbox.run('return tostring("alice")', { environment = environment }))
end)
it('should override the base environment with false', function ()
local environment = { tostring = false }
assert.same(false, sandbox.run('return tostring', { environment = environment }))
end)
end)
end)
|
--[[
NetEz (Easy network library)
Author: tochonement
Email: tochonement@gmail.com
Credits:
- thelastpenguin for pON
23.07.2021
--]]
if not pon then
error("NetEz requires pon to work!")
end
netez = netez or {}
netez.storage = netez.storage or {}
netez.types = netez.types or {}
local pon = pon
local netez = netez
local nilString = "NIL"
local netString = "netez:Send"
if SERVER then
util.AddNetworkString(netString)
end
-- ANCHOR Handler meta table
local HANDLER = {}
HANDLER.__index = HANDLER
function HANDLER:__call(...)
if self.callback then
self.callback(...)
end
end
function HANDLER:AddField(type)
table.insert(self.fields, {
type = type
})
return self
end
function HANDLER:AddOptionalField(type)
table.insert(self.fields, {
type = type,
optional = true
})
return self
end
function HANDLER:SetDelay(delay)
self.delay = delay
return self
end
function HANDLER:SetCallback(func)
self.callback = func
return self
end
function HANDLER:GetFields()
return self.fields
end
function HANDLER:CheckArguments(tbl)
local fields = self:GetFields()
for i, field in ipairs(fields) do
local sType = field.type
local optional = field.optional
local value = tbl[i]
local isEmpty = value == nilString
if not optional and isEmpty then
print(string.format("(%s) No argument for the required field #%i!", self.id, i))
return false
end
local valid = netez.CheckByType(sType, value)
if valid ~= true and not optional and not isEmpty then
print(string.format("(%s) The argument #%i must be a %s, not a %s!", self.id, i, sType, type(value)))
return false
end
end
return true
end
function HANDLER:CheckPlayer(ply)
local endDelayTime = self.delays[ply]
if endDelayTime and endDelayTime >= CurTime() then
return false
end
return true
end
function HANDLER:OnSuccess(ply)
local delay = self.delay
if delay then
self.delays[ply] = CurTime() + delay
end
end
-- ANCHOR Functions
local function Pack(...)
local result = {}
local count = select("#", ...)
for i = 1, count do
local value = select(i, ...)
if value == nil then
result[i] = nilString
else
result[i] = value
end
end
return result
end
local function Unpack(tbl)
if not table.IsEmpty(tbl) then
local value = table.remove(tbl, 1)
if value == nilString then
value = nil
end
return value, Unpack(tbl)
end
end
---Creates a new type for fields
---@param type string
---@param checker function
function netez.CreateType(type, checker)
netez.types[type] = checker
end
---Checks an any value by type
---@param type string
---@param any any
---@return boolean
function netez.CheckByType(type, any)
local checker = netez.types[type]
if checker then
return checker(any)
else
return false
end
end
---Registers a new handler for network message receiving
---@param id string
---@return userdata
function netez.Register(id)
local handler = setmetatable({}, HANDLER)
handler.id = id
handler.fields = {}
handler.delays = {}
netez.storage[id] = handler
return handler
end
---Deletes the handler by id
---@param id string
function netez.Delete(id)
netez.storage[id] = nil
end
function netez.GetHandler(id)
return netez.storage[id]
end
do
local Send
local function Start(id, ...)
assert(id)
local Packed = Pack(...)
local data = pon.encode(Packed)
local length = #data
net.Start(netString)
net.WriteString(id)
net.WriteUInt(length, 16)
net.WriteData(data, length)
end
if SERVER then
Send = function(ply)
if ply then
net.Send(ply)
else
net.Broadcast()
end
end
function netez.Send(ply, id, ...)
Start(id, ...)
Send(ply)
end
else
Send = net.SendToServer
function netez.Send(id, ...)
Start(id, ...)
Send()
end
end
end
-- ANCHOR Networking
net.Receive("netez:Send", function(len, ply)
local id = net.ReadString()
local length = net.ReadUInt(16)
local data = net.ReadData(length)
local handler = netez.GetHandler(id)
if handler then
local allowed = handler:CheckPlayer(ply)
if allowed then
local decodedData = pon.decode(data)
local isDataValid = handler:CheckArguments(decodedData)
if isDataValid then
if SERVER then
handler(ply, Unpack(decodedData))
else
handler(Unpack(decodedData))
end
handler:OnSuccess(ply)
end
end
end
end)
-- ANCHOR Types
local PLAYER = FindMetaTable("Player")
local VECTOR = FindMetaTable("Vector")
local ANGLE = FindMetaTable("Angle")
local function IsPlayer(any)
return getmetatable(any) == PLAYER
end
local function IsVector(any)
return getmetatable(any) == VECTOR
end
local function IsAngle(any)
return getmetatable(any) == ANGLE
end
netez.CreateType("player", IsPlayer)
netez.CreateType("vector", IsVector)
netez.CreateType("angle", IsAngle)
netez.CreateType("string", isstring)
netez.CreateType("table", istable)
netez.CreateType("entity", isentity)
netez.CreateType("bool", isbool)
netez.CreateType("int", isnumber)
netez.CreateType("uint", function(any)
return (isnumber(any) and any >= 0)
end)
netez.CreateType("any", function(any)
return true
end)
|
-- Created by Elfansoer
--[[
Ability checklist (erase if done/checked):
- Scepter Upgrade
- Break behavior
- Linken/Reflect behavior
- Spell Immune/Invulnerable/Invisible behavior
- Illusion behavior
- Stolen behavior
]]
--------------------------------------------------------------------------------
modifier_spectre_haunt_lua = class({})
--------------------------------------------------------------------------------
-- Classifications
function modifier_spectre_haunt_lua:IsHidden()
return true
end
function modifier_spectre_haunt_lua:IsPurgable()
return false
end
--------------------------------------------------------------------------------
-- Initializations
function modifier_spectre_haunt_lua:OnCreated( kv )
-- references
local delay = self:GetAbility():GetSpecialValueFor( "attack_delay" )
if not IsServer() then return end
self.target = EntIndexToHScript( kv.target )
self.distance = 70
self.disarm = true
-- start delay interval
self:StartIntervalThink( delay )
-- activate sub ability
local ability = self:GetCaster():FindAbilityByName( "spectre_reality_lua" )
if ability and not ability:IsActivated() then
ability:SetActivated( true )
end
end
function modifier_spectre_haunt_lua:OnRefresh( kv )
end
function modifier_spectre_haunt_lua:OnRemoved()
end
function modifier_spectre_haunt_lua:OnDestroy()
if not IsServer() then return end
-- find other haunts
local haunts = FindUnitsInRadius(
self:GetCaster():GetTeamNumber(), -- int, your team number
self:GetCaster():GetOrigin(), -- point, center point
nil, -- handle, cacheUnit. (not known)
FIND_UNITS_EVERYWHERE, -- float, radius. or use FIND_UNITS_EVERYWHERE
DOTA_UNIT_TARGET_TEAM_FRIENDLY, -- int, team filter
DOTA_UNIT_TARGET_HERO, -- int, type filter
0, -- int, flag filter
0, -- int, order filter
false -- bool, can grow cache
)
local found = false
for _,haunt in pairs(haunts) do
if haunt~=self:GetParent() and haunt:HasModifier( "modifier_spectre_haunt_lua" ) then
found = true
break
end
end
if found then return end
-- deactivate sub ability
local ability = self:GetCaster():FindAbilityByName( "spectre_reality_lua" )
if ability and ability:IsActivated() then
ability:SetActivated( false )
end
end
--------------------------------------------------------------------------------
-- Status Effects
function modifier_spectre_haunt_lua:CheckState()
local state = {
-- [MODIFIER_STATE_INVULNERABLE] = true,
-- [MODIFIER_STATE_UNSELECTABLE] = true,
-- [MODIFIER_STATE_UNTARGETABLE] = true,
-- [MODIFIER_STATE_OUT_OF_GAME] = true,
[MODIFIER_STATE_DISARMED] = self.disarm,
[MODIFIER_STATE_NO_UNIT_COLLISION] = true,
-- [MODIFIER_STATE_NO_HEALTH_BAR] = true,
[MODIFIER_STATE_FLYING_FOR_PATHING_PURPOSES_ONLY] = true,
-- [MODIFIER_STATE_COMMAND_RESTRICTED] = true,
-- [MODIFIER_STATE_NOT_ON_MINIMAP] = true,
}
return state
end
--------------------------------------------------------------------------------
-- Interval Effects
function modifier_spectre_haunt_lua:OnIntervalThink()
if self.disarm then
self:StartIntervalThink( 0.1 )
self.disarm = false
else
self:FollowThink()
end
end
function modifier_spectre_haunt_lua:FollowThink()
-- kill if target is dead
if not self.target:IsAlive() then
self:GetParent():ForceKill( false )
self:Destroy()
return
end
local parent = self:GetParent()
local origin = self.target:GetOrigin()
local seen = self:GetCaster():CanEntityBeSeenByMyTeam( self.target )
if not seen then
if (parent:GetOrigin()-origin):Length2D()>self.distance/2 then
-- move to position
parent:MoveToPosition( origin )
end
else
if parent:GetAggroTarget()~=self.target then
-- command to attack target
local order = {
UnitIndex = parent:entindex(),
OrderType = DOTA_UNIT_ORDER_ATTACK_TARGET,
TargetIndex = self.target:entindex(),
}
ExecuteOrderFromTable( order )
end
end
end
|
local helpers = require('test.functional.helpers')(after_each)
local eval = helpers.eval
local clear = helpers.clear
local command = helpers.command
describe('autocmd FileType', function()
before_each(clear)
it("is triggered by :help only once", function()
command("let g:foo = 0")
command("autocmd FileType help let g:foo = g:foo + 1")
command("help help")
assert.same(1, eval('g:foo'))
end)
end)
|
local L = LibStub("AceLocale-3.0"):NewLocale("WorldQuestTrackerAddon", "ptBR")
if not L then return end
L["S_APOWER_AVAILABLE"] = "Disponível"
L["S_APOWER_NEXTLEVEL"] = "Próximo nível"
L["S_DECREASESIZE"] = "Diminuir Tamanho"
L["S_ENABLED"] = "Ativado"
L["S_ERROR_NOTIMELEFT"] = "Esta missão expirou."
L["S_ERROR_NOTLOADEDYET"] = "Esta missão não foi carregada ainda, por favor aguarde alguns segundos."
L["S_FACTION_TOOLTIP_SELECT"] = "Clique: selecione esta facção."
L["S_FACTION_TOOLTIP_TRACK"] = "Shift + Clique: rastreie as missões desta facção."
L["S_FLYMAP_SHOWTRACKEDONLY"] = "Apenas Rastreadas"
L["S_FLYMAP_SHOWTRACKEDONLY_DESC"] = "Mostrar apenas missões que estão sendo rastreadas."
L["S_FLYMAP_SHOWWORLDQUESTS"] = "Mostrar Missões Mundiais"
L["S_GROUPFINDER_ACTIONS_CANCEL_APPLICATIONS"] = "clique para cancelar aplicações..."
L["S_GROUPFINDER_ACTIONS_CANCELING"] = "cancelando..."
L["S_GROUPFINDER_ACTIONS_CREATE"] = [=[nenhum grupo encontrado?
clique para criar um]=]
L["S_GROUPFINDER_ACTIONS_CREATE_DIRECT"] = "criar grupo"
L["S_GROUPFINDER_ACTIONS_LEAVEASK"] = "Sair do grupo?"
L["S_GROUPFINDER_ACTIONS_LEAVINGIN"] = "Saindo do grupo em (clique para sair agora):"
L["S_GROUPFINDER_ACTIONS_RETRYSEARCH"] = "repetir busca"
L["S_GROUPFINDER_ACTIONS_SEARCH"] = "clique para iniciar busca por grupos"
L["S_GROUPFINDER_ACTIONS_SEARCH_RARENPC"] = "procurar por grupo para matar este raro"
L["S_GROUPFINDER_ACTIONS_SEARCH_TOOLTIP"] = "Entre em um grupo que está fazendo esta missão"
L["S_GROUPFINDER_ACTIONS_SEARCHING"] = "buscando..."
L["S_GROUPFINDER_ACTIONS_SEARCHMORE"] = "clique para buscar por mais jogadores para o grupo"
L["S_GROUPFINDER_ACTIONS_SEARCHOTHER"] = "Sair e buscar outro grupo?"
L["S_GROUPFINDER_ACTIONS_UNAPPLY1"] = "clique para remover a aplicação e criar um grupo novo"
L["S_GROUPFINDER_ACTIONS_UNLIST"] = "clique para deslistar o seu grupo"
L["S_GROUPFINDER_ACTIONS_UNLISTING"] = "deslistando..."
L["S_GROUPFINDER_ACTIONS_WAITING"] = "esperando..."
L["S_GROUPFINDER_AUTOOPEN_RARENPC_TARGETED"] = "Abrir automaticamente ao Selecionar um Raro"
L["S_GROUPFINDER_ENABLED"] = "Abrir esta janela automaticamente em uma nova missão"
L["S_GROUPFINDER_LEAVEOPTIONS"] = "Opções de sair do grupo"
L["S_GROUPFINDER_LEAVEOPTIONS_AFTERX"] = "Sair Depois de X Segundos"
L["S_GROUPFINDER_LEAVEOPTIONS_ASKX"] = "Não sair automaticamente, apenas perguntar durante X segundos"
L["S_GROUPFINDER_LEAVEOPTIONS_DONTLEAVE"] = "Não mostrar painel de sair do grupo"
L["S_GROUPFINDER_LEAVEOPTIONS_IMMEDIATELY"] = "Sair imediatamente após completar a missão"
L["S_GROUPFINDER_NOPVP"] = "Evitar servidores JxJ"
L["S_GROUPFINDER_OT_ENABLED"] = "Mostrar botões na listagem de objetivos"
L["S_GROUPFINDER_QUEUEBUSY"] = "você já está em uma fila."
L["S_GROUPFINDER_QUEUEBUSY2"] = "Não foi possível mostrar a janela do Localizador de grupo: você já está no grupo ou na fila."
L["S_GROUPFINDER_RESULTS_APPLYING"] = "Faltam %d grupos para aplicar, clique novamente"
L["S_GROUPFINDER_RESULTS_APPLYING1"] = "Falta um grupo para aplicar, clique novamente"
L["S_GROUPFINDER_RESULTS_FOUND"] = [=[%d grupos encontrados
clique para iniciar as aplicações]=]
L["S_GROUPFINDER_RESULTS_FOUND1"] = [=[1 grupo encontrado
clique para entrar no grupo]=]
L["S_GROUPFINDER_RESULTS_UNAPPLY"] = "%d aplicações restantes..."
L["S_GROUPFINDER_RIGHTCLICKCLOSE"] = "botão direito para fechar este painel"
L["S_GROUPFINDER_SECONDS"] = "Segundos"
L["S_GROUPFINDER_TITLE"] = "Localizador de Grupos"
L["S_GROUPFINDER_TUTORIAL1"] = "Faça missões mundiais mais rápido ao se juntar a um grupo que está fazendo a mesma missão!"
L["S_INCREASESIZE"] = "Aumentar Tamanho"
L["S_MAPBAR_FILTER"] = "Filtros"
L["S_MAPBAR_FILTERMENU_FACTIONOBJECTIVES"] = "Objetivos de facções"
L["S_MAPBAR_FILTERMENU_FACTIONOBJECTIVES_DESC"] = "Mostra missões de facções mesmo que tenham sido excluídas por filtros."
L["S_MAPBAR_OPTIONS"] = "Opções"
L["S_MAPBAR_OPTIONSMENU_ARROWSPEED"] = "Velocidade de atualização da seta"
L["S_MAPBAR_OPTIONSMENU_ARROWSPEED_HIGH"] = "Rápida"
L["S_MAPBAR_OPTIONSMENU_ARROWSPEED_MEDIUM"] = "Média"
L["S_MAPBAR_OPTIONSMENU_ARROWSPEED_REALTIME"] = "Em tempo real"
L["S_MAPBAR_OPTIONSMENU_ARROWSPEED_SLOW"] = "Lenta"
L["S_MAPBAR_OPTIONSMENU_EQUIPMENTICONS"] = "Ícones de equipamentos"
L["S_MAPBAR_OPTIONSMENU_QUESTTRACKER"] = "Habilitar Listagem de Missões"
L["S_MAPBAR_OPTIONSMENU_REFRESH"] = "Recarregar"
L["S_MAPBAR_OPTIONSMENU_SOUNDENABLED"] = "Habilitar som"
L["S_MAPBAR_OPTIONSMENU_STATUSBARANCHOR"] = "Ancorar ao topo"
L["S_MAPBAR_OPTIONSMENU_TOMTOM_WPPERSISTENT"] = "Ponto persistente"
L["S_MAPBAR_OPTIONSMENU_TRACKER_CURRENTZONE"] = "Apenas zona atual"
L["S_MAPBAR_OPTIONSMENU_TRACKER_SCALE"] = "Escala do rastreador: %s"
L["S_MAPBAR_OPTIONSMENU_TRACKERCONFIG"] = "Ajustes do rastreador"
L["S_MAPBAR_OPTIONSMENU_TRACKERMOVABLE_AUTO"] = "Posição automática"
L["S_MAPBAR_OPTIONSMENU_TRACKERMOVABLE_CUSTOM"] = "Posição manual"
L["S_MAPBAR_OPTIONSMENU_TRACKERMOVABLE_LOCKED"] = "Trancado"
L["S_MAPBAR_OPTIONSMENU_UNTRACKQUESTS"] = "Parar de listar tudo"
L["S_MAPBAR_OPTIONSMENU_WORLDMAPCONFIG"] = "Ajustes do Mapa Mundi"
L["S_MAPBAR_OPTIONSMENU_YARDSDISTANCE"] = "Mostrar Distância"
L["S_MAPBAR_OPTIONSMENU_ZONE_QUESTSUMMARY"] = "Resumo de missões (tela cheia)"
L["S_MAPBAR_OPTIONSMENU_ZONEMAPCONFIG"] = "Ajustas do Mapa Zona"
L["S_MAPBAR_RESOURCES_TOOLTIP_TRACKALL"] = "Clique para rastrear: |cFFFFFFFF%s|r quests."
L["S_MAPBAR_SORTORDER"] = "Ordem"
L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_FADE"] = "Usar Trasparência"
L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_OPTION"] = "Menos De %d Horas"
L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_SHOWTEXT"] = "Texto do Tempo Restante"
L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_SORTBYTIME"] = "Ordem por Tempo"
L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_TITLE"] = "Tempo Restante"
L["S_MAPBAR_SUMMARY"] = "Sumário"
L["S_MAPBAR_SUMMARYMENU_ACCOUNTWIDE"] = "Na Conta"
L["S_MAPBAR_SUMMARYMENU_MOREINFO"] = "botão esquerdo: mostrar mais"
L["S_MAPBAR_SUMMARYMENU_NOATTENTION"] = [=[Nenhuma quest sendo rastreadas nos seus demais personagens
tem menos de 2 horas de tempo restante.]=]
L["S_MAPBAR_SUMMARYMENU_REQUIREATTENTION"] = "Requer Atenção"
L["S_MAPBAR_SUMMARYMENU_TODAYREWARDS"] = "Conquistas de Hoje"
L["S_MAPFRAME_ALIGN_CENTER"] = "centro"
L["S_MAPFRAME_ALIGN_DESC"] = "|cFF22FF22Clique|r para alternar o alinhamento da janela do mapa do centro para a esquerda e da esquerda para o centro da sua tela."
L["S_MAPFRAME_ALIGN_LEFT"] = "esquerda"
--[[Translation missing --]]
--[[ L["S_OPTIONS_ANIMATIONS"] = ""--]]
L["S_OPTIONS_MAPFRAME_ALIGN"] = "Janela do Mapa Centralizada"
--[[Translation missing --]]
--[[ L["S_OPTIONS_MAPFRAME_ERROR_SCALING_DISABLED"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_MAPFRAME_SCALE"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_MAPFRAME_SCALE_ENABLED"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_QUESTBLACKLIST"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_RESET"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_SHOWFACTIONS"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_TIMELEFT_NOPRIORITY"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_TRACKER_RESETPOSITION"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_WORLD_ANCHOR_LEFT"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_WORLD_ANCHOR_RIGHT"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_WORLD_DECREASEICONSPERROW"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_WORLD_INCREASEICONSPERROW"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_WORLD_ORGANIZE_BYMAP"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_WORLD_ORGANIZE_BYTYPE"] = ""--]]
--[[Translation missing --]]
--[[ L["S_OPTIONS_ZONE_SHOWONLYTRACKED"] = ""--]]
L["S_OVERALL"] = "Em Geral"
L["S_PARTY"] = "Grupo"
L["S_PARTY_DESC1"] = "Uma estrela azul na quest significa que todos do grupo a possuem."
L["S_PARTY_DESC2"] = "Se uma estrela vermelha é mostrada, algum member do grupo não tem WQT instalado ainda."
L["S_PARTY_PLAYERSWITH"] = "Jogadores no grupo com WQT:"
L["S_PARTY_PLAYERSWITHOUT"] = "Jogadores no grupo sem WQT:"
L["S_QUESTSCOMPLETED"] = "Missões completadas"
L["S_QUESTTYPE_ARTIFACTPOWER"] = "Poder de Artefato"
L["S_QUESTTYPE_DUNGEON"] = "Masmorra"
L["S_QUESTTYPE_EQUIPMENT"] = "Equipamento"
L["S_QUESTTYPE_GOLD"] = "Ouro"
L["S_QUESTTYPE_PETBATTLE"] = "Batalha de Mascote"
L["S_QUESTTYPE_PROFESSION"] = "Profissão"
L["S_QUESTTYPE_PVP"] = "JxJ"
L["S_QUESTTYPE_RESOURCE"] = "Recursos"
L["S_QUESTTYPE_TRADESKILL"] = "Materiais"
L["S_RAREFINDER_ADDFROMPREMADE"] = "Adicionar Raros Encontrado em Grupos Premade"
L["S_RAREFINDER_NPC_NOTREGISTERED"] = "monstro raro não registrado no banco de dados"
L["S_RAREFINDER_OPTIONS_ENGLISHSEARCH"] = "Procurar Usando Nomes em Inglês"
L["S_RAREFINDER_OPTIONS_SHOWICONS"] = "Mostrar Ícones para Raros Ativos"
L["S_RAREFINDER_SOUND_ALWAYSPLAY"] = "Reproduzir mesmo quando os efeitos sonoros estão desativados"
L["S_RAREFINDER_SOUND_ENABLED"] = "Reproduzir Som para Raros no Mini Mapa"
L["S_RAREFINDER_SOUNDWARNING"] = "som reproduzido devido a um raro no minimapa, você pode desativar esse som no menu de opções > rato,localizar, sub-menu."
L["S_RAREFINDER_TITLE"] = "Procura de Raros"
L["S_RAREFINDER_TOOLTIP_REMOVE"] = "Remover"
L["S_RAREFINDER_TOOLTIP_SEACHREALM"] = "Procurar em outros reinos"
L["S_RAREFINDER_TOOLTIP_SPOTTEDBY"] = "Visto Por"
L["S_RAREFINDER_TOOLTIP_TIMEAGO"] = "minutos atrás"
L["S_SUMMARYPANEL_EXPIRED"] = "EXPIRADA"
L["S_SUMMARYPANEL_LAST15DAYS"] = "Últimos 15 dias"
L["S_SUMMARYPANEL_LIFETIMESTATISTICS_ACCOUNT"] = "Estatísticas da Conta"
L["S_SUMMARYPANEL_LIFETIMESTATISTICS_CHARACTER"] = "Estatísticas do Personagem"
L["S_SUMMARYPANEL_OTHERCHARACTERS"] = "Outros Personagems"
L["S_TUTORIAL_AMOUNT"] = "indica a quantidade a receber"
L["S_TUTORIAL_CLICKTOTRACK"] = "Clique para rastrear a missão."
--[[Translation missing --]]
--[[ L["S_TUTORIAL_MAPALIGN"] = ""--]]
L["S_TUTORIAL_PARTY"] = "Quando estiver em grupo, uma estrela azul é mostrada em missões em que todos do grupo estão!"
L["S_TUTORIAL_TIMELEFT"] = "indica o tempo restante (+4 horas, +90 minutos, +30 minutos, menos de 30 minutos)."
--[[Translation missing --]]
--[[ L["S_TUTORIAL_WORLDBUTTONS"] = ""--]]
L["S_TUTORIAL_WORLDMAPBUTTON"] = "Este botão mostra o mapa das Ilhas Partidas."
L["S_UNKNOWNQUEST"] = "Missão desconhecida"
--[[Translation missing --]]
--[[ L["S_WORLDBUTTONS_SHOW_NONE"] = ""--]]
--[[Translation missing --]]
--[[ L["S_WORLDBUTTONS_SHOW_TYPE"] = ""--]]
--[[Translation missing --]]
--[[ L["S_WORLDBUTTONS_SHOW_ZONE"] = ""--]]
--[[Translation missing --]]
--[[ L["S_WORLDBUTTONS_TOGGLE_QUESTS"] = ""--]]
L["S_WORLDMAP_QUESTLOCATIONS"] = "Mostrar local da quest"
L["S_WORLDMAP_QUESTSUMMARY"] = "Mostrar resumo de quest"
L["S_WORLDMAP_TOOGLEQUESTS"] = "Alternar Missões"
--[[Translation missing --]]
--[[ L["S_WORLDMAP_TOOLTIP_TRACKALL"] = ""--]]
L["S_WORLDQUESTS"] = "Missões Mundiais"
|
local table = require 'ext.table'
--[[
idk where to put this stuff
TODO luajit's getfenv is returning _G
I wonder if there's a way to set these variables to the local scope env of the require'ing files
...without using debug's upvalue stuff
--]]
return function(env)
env = env or {}
env.minmaxs = table{'min', 'max'}
local xNames = table{'x', 'y', 'z'}
env.xNames = xNames
env.symNames = table{'xx', 'xy', 'xz', 'yy', 'yz', 'zz'}
local from3x3to6_table = {{1, 2, 3}, {2, 4, 5}, {3, 5, 6},}
env.from3x3to6 = function(i,j)
assert(1 <= i and i <= 3 and 1 <= j and j <= 3, "got an oob i,j = "..tostring(i)..","..tostring(j))
return from3x3to6_table[i][j]
end
local from6to3x3_table = {{1,1},{1,2},{1,3},{2,2},{2,3},{3,3}}
env.from6to3x3 = function(i) return table.unpack(from6to3x3_table[i]) end
env.sym = function(a,b)
assert(a >= 1 and a <= 3, "tried to index sym with "..tostring(a)..", "..tostring(b))
assert(b >= 1 and b <= 3, "tried to index sym with "..tostring(a)..", "..tostring(b))
if a > b then a,b = b,a end
return xNames[a]..xNames[b]
end
return env
end
|
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
newBirthDescriptor{
type = "base",
name = "base",
desc = {
},
experience = 1.0,
body = { INVEN = 20, HOVER = 1, HEAD = 1, NECK = 1, TORSO = 1, BELT = 1, CLOAK = 1, QUIVER = 1, PACK = 1, LITE = 1, WATERSKIN = 1, TOOL = 1, ARMS = 1, HANDS = 1, WEAPON = 1, SHIELD = 1, RING1 = 1, RING2 = 1, FEET = 1 },
copy = {
max_level = 10,
max_life = 25,
},
}
newBirthDescriptor{
type = "role",
name = "Thief",
desc =
{
"Just trying to get by.",
},
stats = { str=1, rct=3, chr=1, },
move_others = true,
talents_types = {
["thief/mechanic"]={true, 0.3},
["thief/stealth"]={true, 0.3},
["thief/thief"]={true, 0.3},
},
talents = {
[ActorTalents.T_LOCKPICK]=1,
[ActorTalents.T_HIDE]=1,
[ActorTalents.T_LEAP]=1,
},
-- default load-out:
copy = {
sight = 7,
nightvision = 0,
resolvers.equipbirth{ id=true,
{type="tool", subtype="lockpick", name="makeshift lockpick", autoreq=true, ego_chance=-1000},
},
},
}
|
-- Экран смены номерного знака
NumberplateScreen = Screen:subclass "NumberplateScreen"
local MAX_NUMBERPLATE_TEXT_LENGTH = 10
local allowedLetters = "abcdefghijklmnopqrstuvwxyz0123456789"
function NumberplateScreen:init()
self.super:init()
self.numberplateText = GarageCar.getVehicle():getData("Numberplate")
if type(self.numberplateText) ~= "string" then
self.numberplateText = "unknown"
end
CameraManager.setState("previewNumberplate", false, 3)
guiSetInputMode("no_binds")
end
function NumberplateScreen:draw()
self.super:draw()
end
function NumberplateScreen:show()
self.super:show()
guiSetInputEnabled(true)
GarageUI.setHelpText(string.format(
exports.dpLang:getString("garage_help_numberplate"),
"DELETE",
"ENTER",
"BACKSPACE"
))
end
function NumberplateScreen:hide()
self.super:hide()
guiSetInputEnabled(false)
GarageUI.resetHelpText()
end
function NumberplateScreen:updateText()
self.numberplateText = string.sub(self.numberplateText, 1, MAX_NUMBERPLATE_TEXT_LENGTH)
GarageCar.previewTuning("Numberplate", self.numberplateText)
end
function NumberplateScreen:onKey(key)
self.super:onKey(key)
if key == "enter" then
local this = self
local price, level = unpack(exports.dpShared:getTuningPrices("numberplate"))
Garage.buy(price, level, function(success)
if success then
GarageCar.applyTuning("Numberplate", this.numberplateText)
else
GarageCar.resetTuning()
end
this.screenManager:showScreen(ComponentsScreen("Numberplate"))
end)
elseif key == "backspace" then
if string.len(self.numberplateText) > 0 then
self.numberplateText = string.sub(self.numberplateText, 1, -2)
self:updateText()
else
GarageCar.resetTuning()
self.screenManager:showScreen(ComponentsScreen("Numberplate"))
end
elseif key == "space" then
self.numberplateText = self.numberplateText .. " "
self:updateText()
else
if string.find(allowedLetters, key) then
self.numberplateText = self.numberplateText .. key
self:updateText()
end
end
end
|
function PLUGIN:IsPlayerRecognized(client)
if (client == LocalPlayer()) then
return true
end
local localPlayer = LocalPlayer()
if (IsValid(localPlayer) and localPlayer.character) then
local recognized = localPlayer.character:GetData("recog", {})
if (recognized[client.character:GetVar("id", 0)] == true) then
return true
end
end
end
local DESC_LENGTH = 37
function PLUGIN:GetPlayerName(client, mode, text)
if (client != LocalPlayer() and !AdvNut.hook.Run("IsPlayerRecognized", client)) then
// local fakeName = AdvNut.hook.Run("GetUnknownPlayerName", client)
// if (!fakeName) then
if (mode) then
local description = client.character:GetVar("description", "")
if (string.utf8len(description) > DESC_LENGTH) then
description = string.utf8sub(description, 1, DESC_LENGTH - 3).."..."
end
fakeName = "["..description.."]"
else
return self:GetPluginLanguage("rg_unknown");
end
// end
return fakeName
end
end
|
local _, core = ...;
local _G = _G;
local MonDKP = core.MonDKP;
local L = core.L;
local curReason;
function MonDKP:AdjustDKP(value)
local adjustReason = curReason;
local curTime = time()
local c;
local curOfficer = UnitName("player")
if not IsInRaid() then
c = MonDKP:GetCColors();
end
if (curReason == L["OTHER"]) then adjustReason = L["OTHER"].." - "..MonDKP.ConfigTab2.otherReason:GetText(); end
if curReason == L["BOSSKILLBONUS"] then adjustReason = core.CurrentRaidZone..": "..core.LastKilledBoss; end
if curReason == L["NEWBOSSKILLBONUS"] then adjustReason = core.CurrentRaidZone..": "..core.LastKilledBoss.." ("..L["FIRSTKILL"]..")" end
if (#core.SelectedData > 0 and adjustReason and adjustReason ~= L["OTHER"].." - "..L["ENTEROTHERREASONHERE"]) then
if core.IsOfficer then
local tempString = ""; -- stores list of changes
local dkpHistoryString = "" -- stores list for MonDKP_DKPHistory
for i=1, #core.SelectedData do
local current;
local search = MonDKP:Table_Search(MonDKP_DKPTable, core.SelectedData[i]["player"])
if search then
if not IsInRaid() then
if i < #core.SelectedData then
tempString = tempString.."|cff"..c[core.SelectedData[i]["class"]].hex..core.SelectedData[i]["player"].."|r, ";
else
tempString = tempString.."|cff"..c[core.SelectedData[i]["class"]].hex..core.SelectedData[i]["player"].."|r";
end
end
dkpHistoryString = dkpHistoryString..core.SelectedData[i]["player"]..","
current = MonDKP_DKPTable[search[1][1]].dkp
MonDKP_DKPTable[search[1][1]].dkp = MonDKP_round(tonumber(current + value), MonDKP_DB.modes.rounding)
if value > 0 then
MonDKP_DKPTable[search[1][1]]["lifetime_gained"] = MonDKP_round(tonumber(MonDKP_DKPTable[search[1][1]]["lifetime_gained"] + value), MonDKP_DB.modes.rounding)
end
end
end
local newIndex = curOfficer.."-"..curTime
tinsert(MonDKP_DKPHistory, 1, {players=dkpHistoryString, dkp=value, reason=adjustReason, date=curTime, index=newIndex})
MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP_DKPHistory[1])
if MonDKP.ConfigTab6.history and MonDKP.ConfigTab6:IsShown() then
MonDKP:DKPHistory_Update(true)
end
DKPTable_Update()
if IsInRaid() then
MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDDKPADJUSTBY"].." "..value.." "..L["FORREASON"]..": "..adjustReason)
else
MonDKP.Sync:SendData("MonDKPBCastMsg", L["DKPADJUSTBY"].." "..value.." "..L["FORPLAYERS"]..": ")
MonDKP.Sync:SendData("MonDKPBCastMsg", tempString)
MonDKP.Sync:SendData("MonDKPBCastMsg", L["REASON"]..": "..adjustReason)
end
end
else
local validation;
if (#core.SelectedData == 0 and not adjustReason) then
validation = L["PLAYERREASONVALIDATE"]
elseif #core.SelectedData == 0 then
validation = L["PLAYERVALIDATE"]
elseif not adjustReason or MonDKP.ConfigTab2.otherReason:GetText() == "" or MonDKP.ConfigTab2.otherReason:GetText() == L["ENTEROTHERREASONHERE"] then
validation = L["OTHERREASONVALIDATE"]
end
StaticPopupDialogs["VALIDATION_PROMPT"] = {
text = validation,
button1 = L["OK"],
timeout = 5,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
StaticPopup_Show ("VALIDATION_PROMPT")
end
end
local function DecayDKP(amount, deductionType, GetSelections)
local playerString = "";
local dkpString = "";
local curTime = time()
local curOfficer = UnitName("player")
for key, value in ipairs(MonDKP_DKPTable) do
local dkp = tonumber(value["dkp"])
local player = value["player"]
local amount = amount;
amount = tonumber(amount) / 100 -- converts percentage to a decimal
if amount < 0 then
amount = amount * -1 -- flips value to positive if officer accidently used negative number in editbox
end
local deducted;
if (GetSelections and MonDKP:Table_Search(core.SelectedData, player)) or GetSelections == false then
if dkp > 0 then
if deductionType == "percent" then
deducted = dkp * amount
dkp = dkp - deducted
value["dkp"] = MonDKP_round(tonumber(dkp), MonDKP_DB.modes.rounding);
dkpString = dkpString.."-"..MonDKP_round(deducted, MonDKP_DB.modes.rounding)..",";
playerString = playerString..player..",";
elseif deductionType == "points" then
-- do stuff for flat point deductions
end
elseif dkp < 0 and MonDKP.ConfigTab2.AddNegative:GetChecked() then
if deductionType == "percent" then
deducted = dkp * amount
dkp = (deducted - dkp) * -1
value["dkp"] = MonDKP_round(tonumber(dkp), MonDKP_DB.modes.rounding)
dkpString = dkpString..MonDKP_round(-deducted, MonDKP_DB.modes.rounding)..",";
playerString = playerString..player..",";
elseif deductionType == "points" then
-- do stuff for flat point deductions
end
end
end
end
dkpString = dkpString.."-"..amount.."%";
if tonumber(amount) < 0 then amount = amount * -1 end -- flips value to positive if officer accidently used a negative number
local newIndex = curOfficer.."-"..curTime
tinsert(MonDKP_DKPHistory, 1, {players=playerString, dkp=dkpString, reason=L["WEEKLYDECAY"], date=curTime, index=newIndex})
MonDKP.Sync:SendData("MonDKPDecay", MonDKP_DKPHistory[1])
if MonDKP.ConfigTab6.history then
MonDKP:DKPHistory_Update(true)
end
DKPTable_Update()
end
local function RaidTimerPopout_Create()
if not MonDKP.RaidTimerPopout then
MonDKP.RaidTimerPopout = CreateFrame("Frame", "MonDKP_RaidTimerPopout", UIParent, "ShadowOverlaySmallTemplate");
MonDKP.RaidTimerPopout:SetPoint("RIGHT", UIParent, "RIGHT", -300, 100);
MonDKP.RaidTimerPopout:SetSize(100, 50);
MonDKP.RaidTimerPopout:SetBackdrop( {
bgFile = "Textures\\white.blp", tile = true, -- White backdrop allows for black background with 1.0 alpha on low alpha containers
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 3,
insets = { left = 0, right = 0, top = 0, bottom = 0 }
});
MonDKP.RaidTimerPopout:SetBackdropColor(0,0,0,0.9);
MonDKP.RaidTimerPopout:SetBackdropBorderColor(1,1,1,1)
MonDKP.RaidTimerPopout:SetFrameStrata("DIALOG")
MonDKP.RaidTimerPopout:SetFrameLevel(15)
MonDKP.RaidTimerPopout:SetMovable(true);
MonDKP.RaidTimerPopout:EnableMouse(true);
MonDKP.RaidTimerPopout:RegisterForDrag("LeftButton");
MonDKP.RaidTimerPopout:SetScript("OnDragStart", MonDKP.RaidTimerPopout.StartMoving);
MonDKP.RaidTimerPopout:SetScript("OnDragStop", MonDKP.RaidTimerPopout.StopMovingOrSizing);
-- Popout Close Button
MonDKP.RaidTimerPopout.closeContainer = CreateFrame("Frame", "MonDKPChangeLogClose", MonDKP.RaidTimerPopout)
MonDKP.RaidTimerPopout.closeContainer:SetPoint("CENTER", MonDKP.RaidTimerPopout, "TOPRIGHT", -8, -4)
MonDKP.RaidTimerPopout.closeContainer:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 3,
});
MonDKP.RaidTimerPopout.closeContainer:SetBackdropColor(0,0,0,0.9)
MonDKP.RaidTimerPopout.closeContainer:SetBackdropBorderColor(1,1,1,0.2)
MonDKP.RaidTimerPopout.closeContainer:SetScale(0.7)
MonDKP.RaidTimerPopout.closeContainer:SetSize(28, 28)
MonDKP.RaidTimerPopout.closeBtn = CreateFrame("Button", nil, MonDKP.RaidTimerPopout, "UIPanelCloseButton")
MonDKP.RaidTimerPopout.closeBtn:SetPoint("CENTER", MonDKP.RaidTimerPopout.closeContainer, "TOPRIGHT", -14, -14)
MonDKP.RaidTimerPopout.closeBtn:SetScale(0.7)
MonDKP.RaidTimerPopout.closeBtn:HookScript("OnClick", function()
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetText(">");
end)
-- Raid Timer Output
MonDKP.RaidTimerPopout.Output = MonDKP.RaidTimerPopout:CreateFontString(nil, "OVERLAY")
MonDKP.RaidTimerPopout.Output:SetFontObject("MonDKPLargeLeft");
MonDKP.RaidTimerPopout.Output:SetScale(0.8)
MonDKP.RaidTimerPopout.Output:SetPoint("CENTER", MonDKP.RaidTimerPopout, "CENTER", 0, 0);
MonDKP.RaidTimerPopout.Output:SetText("|cff00ff0000:00:00|r")
MonDKP.RaidTimerPopout:Hide();
else
MonDKP.RaidTimerPopout:Show()
end
end
function MonDKP:AdjustDKPTab_Create()
MonDKP.ConfigTab2.header = MonDKP.ConfigTab2:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.header:SetPoint("TOPLEFT", MonDKP.ConfigTab2, "TOPLEFT", 15, -10);
MonDKP.ConfigTab2.header:SetFontObject("MonDKPLargeCenter")
MonDKP.ConfigTab2.header:SetText(L["ADJUSTDKP"]);
MonDKP.ConfigTab2.header:SetScale(1.2)
MonDKP.ConfigTab2.description = MonDKP.ConfigTab2:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.description:SetPoint("TOPLEFT", MonDKP.ConfigTab2.header, "BOTTOMLEFT", 7, -10);
MonDKP.ConfigTab2.description:SetWidth(400)
MonDKP.ConfigTab2.description:SetFontObject("MonDKPNormalLeft")
MonDKP.ConfigTab2.description:SetText(L["ADJUSTDESC"]);
-- Reason DROPDOWN box
-- Create the dropdown, and configure its appearance
MonDKP.ConfigTab2.reasonDropDown = CreateFrame("FRAME", "MonDKPConfigReasonDropDown", MonDKP.ConfigTab2, "MonolithDKPUIDropDownMenuTemplate")
MonDKP.ConfigTab2.reasonDropDown:SetPoint("TOPLEFT", MonDKP.ConfigTab2.description, "BOTTOMLEFT", -23, -60)
UIDropDownMenu_SetWidth(MonDKP.ConfigTab2.reasonDropDown, 150)
UIDropDownMenu_SetText(MonDKP.ConfigTab2.reasonDropDown, L["SELECTREASON"])
-- Create and bind the initialization function to the dropdown menu
UIDropDownMenu_Initialize(MonDKP.ConfigTab2.reasonDropDown, function(self, level, menuList)
local reason = UIDropDownMenu_CreateInfo()
reason.func = self.SetValue
reason.fontObject = "MonDKPSmallCenter"
reason.text, reason.arg1, reason.checked, reason.isNotRadio = L["ONTIMEBONUS"], L["ONTIMEBONUS"], L["ONTIMEBONUS"] == curReason, true
UIDropDownMenu_AddButton(reason)
reason.text, reason.arg1, reason.checked, reason.isNotRadio = L["BOSSKILLBONUS"], L["BOSSKILLBONUS"], L["BOSSKILLBONUS"] == curReason, true
UIDropDownMenu_AddButton(reason)
reason.text, reason.arg1, reason.checked, reason.isNotRadio = L["RAIDCOMPLETIONBONUS"], L["RAIDCOMPLETIONBONUS"], L["RAIDCOMPLETIONBONUS"] == curReason, true
UIDropDownMenu_AddButton(reason)
reason.text, reason.arg1, reason.checked, reason.isNotRadio = L["NEWBOSSKILLBONUS"], L["NEWBOSSKILLBONUS"], L["NEWBOSSKILLBONUS"] == curReason, true
UIDropDownMenu_AddButton(reason)
reason.text, reason.arg1, reason.checked, reason.isNotRadio = L["CORRECTINGERROR"], L["CORRECTINGERROR"], L["CORRECTINGERROR"] == curReason, true
UIDropDownMenu_AddButton(reason)
reason.text, reason.arg1, reason.checked, reason.isNotRadio = L["DKPADJUST"], L["DKPADJUST"], L["DKPADJUST"] == curReason, true
UIDropDownMenu_AddButton(reason)
reason.text, reason.arg1, reason.checked, reason.isNotRadio = L["UNEXCUSEDABSENCE"], L["UNEXCUSEDABSENCE"], L["UNEXCUSEDABSENCE"] == curReason, true
UIDropDownMenu_AddButton(reason)
reason.text, reason.arg1, reason.checked, reason.isNotRadio = L["OTHER"], L["OTHER"], L["OTHER"] == curReason, true
UIDropDownMenu_AddButton(reason)
end)
-- Dropdown Menu Function
function MonDKP.ConfigTab2.reasonDropDown:SetValue(newValue)
if curReason ~= newValue then curReason = newValue else curReason = nil end
UIDropDownMenu_SetText(MonDKP.ConfigTab2.reasonDropDown, curReason)
if (curReason == L["ONTIMEBONUS"]) then MonDKP.ConfigTab2.addDKP:SetNumber(MonDKP_DB.DKPBonus.OnTimeBonus); MonDKP.ConfigTab2.BossKilledDropdown:Hide()
elseif (curReason == L["BOSSKILLBONUS"]) then
MonDKP.ConfigTab2.addDKP:SetNumber(MonDKP_DB.DKPBonus.BossKillBonus);
MonDKP.ConfigTab2.BossKilledDropdown:Show()
UIDropDownMenu_SetText(MonDKP.ConfigTab2.BossKilledDropdown, core.CurrentRaidZone..": "..core.LastKilledBoss)
elseif (curReason == L["RAIDCOMPLETIONBONUS"]) then MonDKP.ConfigTab2.addDKP:SetNumber(MonDKP_DB.DKPBonus.CompletionBonus); MonDKP.ConfigTab2.BossKilledDropdown:Hide()
elseif (curReason == L["NEWBOSSKILLBONUS"]) then
MonDKP.ConfigTab2.addDKP:SetNumber(MonDKP_DB.DKPBonus.NewBossKillBonus);
MonDKP.ConfigTab2.BossKilledDropdown:Show()
UIDropDownMenu_SetText(MonDKP.ConfigTab2.BossKilledDropdown, core.CurrentRaidZone..": "..core.LastKilledBoss)
elseif (curReason == L["UNEXCUSEDABSENCE"]) then MonDKP.ConfigTab2.addDKP:SetNumber(MonDKP_DB.DKPBonus.UnexcusedAbsence); MonDKP.ConfigTab2.BossKilledDropdown:Hide()
else MonDKP.ConfigTab2.addDKP:SetText(""); MonDKP.ConfigTab2.BossKilledDropdown:Hide() end
if (curReason == L["OTHER"]) then
MonDKP.ConfigTab2.otherReason:Show();
MonDKP.ConfigTab2.BossKilledDropdown:Hide()
else
MonDKP.ConfigTab2.otherReason:Hide();
end
CloseDropDownMenus()
end
MonDKP.ConfigTab2.reasonDropDown:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["REASON"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["REASONTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["REASONTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.reasonDropDown:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
MonDKP.ConfigTab2.reasonHeader = MonDKP.ConfigTab2:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.reasonHeader:SetPoint("BOTTOMLEFT", MonDKP.ConfigTab2.reasonDropDown, "TOPLEFT", 25, 0);
MonDKP.ConfigTab2.reasonHeader:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.reasonHeader:SetText(L["REASONFORADJUSTMENT"]..":")
-- Other Reason Editbox. Hidden unless "Other" is selected in dropdown
MonDKP.ConfigTab2.otherReason = CreateFrame("EditBox", nil, MonDKP.ConfigTab2)
MonDKP.ConfigTab2.otherReason:SetPoint("TOPLEFT", MonDKP.ConfigTab2.reasonDropDown, "BOTTOMLEFT", 19, 2)
MonDKP.ConfigTab2.otherReason:SetAutoFocus(false)
MonDKP.ConfigTab2.otherReason:SetMultiLine(false)
MonDKP.ConfigTab2.otherReason:SetSize(225, 24)
MonDKP.ConfigTab2.otherReason:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 3,
});
MonDKP.ConfigTab2.otherReason:SetBackdropColor(0,0,0,0.9)
MonDKP.ConfigTab2.otherReason:SetBackdropBorderColor(1,1,1,0.6)
MonDKP.ConfigTab2.otherReason:SetMaxLetters(50)
MonDKP.ConfigTab2.otherReason:SetTextColor(0.4, 0.4, 0.4, 1)
MonDKP.ConfigTab2.otherReason:SetFontObject("MonDKPNormalLeft")
MonDKP.ConfigTab2.otherReason:SetTextInsets(10, 10, 5, 5)
MonDKP.ConfigTab2.otherReason:SetText(L["ENTEROTHERREASONHERE"])
MonDKP.ConfigTab2.otherReason:SetScript("OnEscapePressed", function(self) -- clears text and focus on esc
self:ClearFocus()
end)
MonDKP.ConfigTab2.otherReason:SetScript("OnEditFocusGained", function(self)
if (self:GetText() == L["ENTEROTHERREASONHERE"]) then
self:SetText("");
self:SetTextColor(1, 1, 1, 1)
end
end)
MonDKP.ConfigTab2.otherReason:SetScript("OnEditFocusLost", function(self)
if (self:GetText() == "") then
self:SetText(L["ENTEROTHERREASONHERE"])
self:SetTextColor(0.4, 0.4, 0.4, 1)
end
end)
MonDKP.ConfigTab2.otherReason:Hide();
-- Boss Killed Dropdown - Hidden unless "Boss Kill Bonus" or "New Boss Kill Bonus" is selected
-- Killing a boss on the list will auto select that boss
MonDKP.ConfigTab2.BossKilledDropdown = CreateFrame("FRAME", "MonDKPBossKilledDropdown", MonDKP.ConfigTab2, "MonolithDKPUIDropDownMenuTemplate")
MonDKP.ConfigTab2.BossKilledDropdown:SetPoint("TOPLEFT", MonDKP.ConfigTab2.reasonDropDown, "BOTTOMLEFT", 0, 2)
MonDKP.ConfigTab2.BossKilledDropdown:Hide()
UIDropDownMenu_SetWidth(MonDKP.ConfigTab2.BossKilledDropdown, 210)
UIDropDownMenu_SetText(MonDKP.ConfigTab2.BossKilledDropdown, L["SELECTBOSS"])
UIDropDownMenu_Initialize(MonDKP.ConfigTab2.BossKilledDropdown, function(self, level, menuList)
local boss = UIDropDownMenu_CreateInfo()
boss.fontObject = "MonDKPSmallCenter"
if (level or 1) == 1 then
boss.text, boss.checked, boss.menuList, boss.hasArrow = core.ZoneList[1], core.CurrentRaidZone == core.ZoneList[1], "MC", true
UIDropDownMenu_AddButton(boss)
boss.text, boss.checked, boss.menuList, boss.hasArrow = core.ZoneList[2], core.CurrentRaidZone == core.ZoneList[2], "BWL", true
UIDropDownMenu_AddButton(boss)
boss.text, boss.checked, boss.menuList, boss.hasArrow = core.ZoneList[3], core.CurrentRaidZone == core.ZoneList[3], "AQ", true
UIDropDownMenu_AddButton(boss)
boss.text, boss.checked, boss.menuList, boss.hasArrow = core.ZoneList[4], core.CurrentRaidZone == core.ZoneList[4], "NAXX", true
UIDropDownMenu_AddButton(boss)
boss.text, boss.checked, boss.menuList, boss.hasArrow = core.ZoneList[7], core.CurrentRaidZone == core.ZoneList[7], "ONYXIA", true
UIDropDownMenu_AddButton(boss)
boss.text, boss.checked, boss.menuList, boss.hasArrow = core.ZoneList[5], core.CurrentRaidZone == core.ZoneList[5], "ZG", true
UIDropDownMenu_AddButton(boss)
boss.text, boss.checked, boss.menuList, boss.hasArrow = core.ZoneList[6], core.CurrentRaidZone == core.ZoneList[6], "AQ20", true
UIDropDownMenu_AddButton(boss)
boss.text, boss.checked, boss.menuList, boss.hasArrow = core.ZoneList[8], core.CurrentRaidZone == core.ZoneList[8], "WORLD", true
UIDropDownMenu_AddButton(boss)
else
boss.func = self.SetValue
for i=1, #core.BossList[menuList] do
boss.text, boss.arg1, boss.checked = core.BossList[menuList][i], core.EncounterList[menuList][i], core.BossList[menuList][i] == core.LastKilledBoss
UIDropDownMenu_AddButton(boss, level)
end
end
end)
function MonDKP.ConfigTab2.BossKilledDropdown:SetValue(newValue)
local search = MonDKP:Table_Search(core.EncounterList, newValue);
if MonDKP:Table_Search(core.EncounterList.MC, newValue) then
core.CurrentRaidZone = core.ZoneList[1]
elseif MonDKP:Table_Search(core.EncounterList.BWL, newValue) then
core.CurrentRaidZone = core.ZoneList[2]
elseif MonDKP:Table_Search(core.EncounterList.AQ, newValue) then
core.CurrentRaidZone = core.ZoneList[3]
elseif MonDKP:Table_Search(core.EncounterList.NAXX, newValue) then
core.CurrentRaidZone = core.ZoneList[4]
elseif MonDKP:Table_Search(core.EncounterList.ZG, newValue) then
core.CurrentRaidZone = core.ZoneList[5]
elseif MonDKP:Table_Search(core.EncounterList.AQ20, newValue) then
core.CurrentRaidZone = core.ZoneList[6]
elseif MonDKP:Table_Search(core.EncounterList.ONYXIA, newValue) then
core.CurrentRaidZone = core.ZoneList[7]
--elseif MonDKP:Table_Search(core.EncounterList.WORLD, newValue) then -- encounter IDs not known yet
--core.CurrentRaidZone = core.ZoneList[8]
end
if search then
core.LastKilledBoss = core.BossList[search[1][1]][search[1][2]]
else
return;
end
MonDKP_DB.bossargs["LastKilledBoss"] = core.LastKilledBoss;
MonDKP_DB.bossargs["CurrentRaidZone"] = core.CurrentRaidZone;
if curReason ~= L["BOSSKILLBONUS"] and curReason ~= L["NEWBOSSKILLBONUS"] then
MonDKP.ConfigTab2.reasonDropDown:SetValue(L["BOSSKILLBONUS"])
end
UIDropDownMenu_SetText(MonDKP.ConfigTab2.BossKilledDropdown, core.CurrentRaidZone..": "..core.LastKilledBoss)
CloseDropDownMenus()
end
-- Add DKP Edit Box
MonDKP.ConfigTab2.addDKP = CreateFrame("EditBox", nil, MonDKP.ConfigTab2)
MonDKP.ConfigTab2.addDKP:SetPoint("TOPLEFT", MonDKP.ConfigTab2.reasonDropDown, "BOTTOMLEFT", 20, -44)
MonDKP.ConfigTab2.addDKP:SetAutoFocus(false)
MonDKP.ConfigTab2.addDKP:SetMultiLine(false)
MonDKP.ConfigTab2.addDKP:SetSize(100, 24)
MonDKP.ConfigTab2.addDKP:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2,
});
MonDKP.ConfigTab2.addDKP:SetBackdropColor(0,0,0,0.9)
MonDKP.ConfigTab2.addDKP:SetBackdropBorderColor(1,1,1,0.6)
MonDKP.ConfigTab2.addDKP:SetMaxLetters(10)
MonDKP.ConfigTab2.addDKP:SetTextColor(1, 1, 1, 1)
MonDKP.ConfigTab2.addDKP:SetFontObject("MonDKPNormalRight")
MonDKP.ConfigTab2.addDKP:SetTextInsets(10, 10, 5, 5)
MonDKP.ConfigTab2.addDKP:SetScript("OnEscapePressed", function(self) -- clears text and focus on esc
self:SetText("")
self:ClearFocus()
end)
MonDKP.ConfigTab2.addDKP:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["POINTS"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["POINTSTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["POINTSTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.addDKP:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
MonDKP.ConfigTab2.pointsHeader = MonDKP.ConfigTab2:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.pointsHeader:SetFontObject("GameFontHighlightLeft");
MonDKP.ConfigTab2.pointsHeader:SetPoint("BOTTOMLEFT", MonDKP.ConfigTab2.addDKP, "TOPLEFT", 3, 3);
MonDKP.ConfigTab2.pointsHeader:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.pointsHeader:SetText(L["POINTS"]..":")
-- Raid Only Checkbox
MonDKP.ConfigTab2.RaidOnlyCheck = CreateFrame("CheckButton", nil, MonDKP.ConfigTab2, "UICheckButtonTemplate");
MonDKP.ConfigTab2.RaidOnlyCheck:SetChecked(false)
MonDKP.ConfigTab2.RaidOnlyCheck:SetScale(0.6);
MonDKP.ConfigTab2.RaidOnlyCheck.text:SetText(" |cff5151deShow Raid Only|r");
MonDKP.ConfigTab2.RaidOnlyCheck.text:SetScale(1.5);
MonDKP.ConfigTab2.RaidOnlyCheck.text:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.RaidOnlyCheck:SetPoint("LEFT", MonDKP.ConfigTab2.addDKP, "RIGHT", 15, 13);
MonDKP.ConfigTab2.RaidOnlyCheck:Hide()
-- Select All Checkbox
MonDKP.ConfigTab2.selectAll = CreateFrame("CheckButton", nil, MonDKP.ConfigTab2, "UICheckButtonTemplate");
MonDKP.ConfigTab2.selectAll:SetChecked(false)
MonDKP.ConfigTab2.selectAll:SetScale(0.6);
MonDKP.ConfigTab2.selectAll.text:SetText(" |cff5151de"..L["SELECTALLVISIBLE"].."|r");
MonDKP.ConfigTab2.selectAll.text:SetScale(1.5);
MonDKP.ConfigTab2.selectAll.text:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.selectAll:SetPoint("LEFT", MonDKP.ConfigTab2.addDKP, "RIGHT", 15, -13);
MonDKP.ConfigTab2.selectAll:Hide();
-- Adjust DKP Button
MonDKP.ConfigTab2.adjustButton = self:CreateButton("TOPLEFT", MonDKP.ConfigTab2.addDKP, "BOTTOMLEFT", -1, -15, L["ADJUSTDKP"]);
MonDKP.ConfigTab2.adjustButton:SetSize(90,25)
MonDKP.ConfigTab2.adjustButton:SetScript("OnClick", function()
if #core.SelectedData > 0 and curReason and MonDKP.ConfigTab2.otherReason:GetText() then
local selected = L["AREYOUSURE"].." "..MonDKP_round(MonDKP.ConfigTab2.addDKP:GetNumber(), MonDKP_DB.modes.rounding).." "..L["DKPTOFOLLOWING"]..": \n\n";
for i=1, #core.SelectedData do
local classSearch = MonDKP:Table_Search(MonDKP_DKPTable, core.SelectedData[i].player)
if classSearch then
c = MonDKP:GetCColors(MonDKP_DKPTable[classSearch[1][1]].class)
else
c = { hex="ffffff" }
end
if i == 1 then
selected = selected.."|cff"..c.hex..core.SelectedData[i].player.."|r"
else
selected = selected..", |cff"..c.hex..core.SelectedData[i].player.."|r"
end
end
StaticPopupDialogs["ADJUST_DKP"] = {
text = selected,
button1 = L["YES"],
button2 = L["NO"],
OnAccept = function()
MonDKP:AdjustDKP(MonDKP.ConfigTab2.addDKP:GetNumber())
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
StaticPopup_Show ("ADJUST_DKP")
else
MonDKP:AdjustDKP(MonDKP.ConfigTab2.addDKP:GetNumber());
end
end)
MonDKP.ConfigTab2.adjustButton:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["ADJUSTDKP"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["ADJUSTDKPTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["ADJUSTDKPTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.adjustButton:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- weekly decay Editbox
MonDKP.ConfigTab2.decayDKP = CreateFrame("EditBox", nil, MonDKP.ConfigTab2)
MonDKP.ConfigTab2.decayDKP:SetPoint("BOTTOMLEFT", MonDKP.ConfigTab2, "BOTTOMLEFT", 21, 70)
MonDKP.ConfigTab2.decayDKP:SetAutoFocus(false)
MonDKP.ConfigTab2.decayDKP:SetMultiLine(false)
MonDKP.ConfigTab2.decayDKP:SetSize(100, 24)
MonDKP.ConfigTab2.decayDKP:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2,
});
MonDKP.ConfigTab2.decayDKP:SetBackdropColor(0,0,0,0.9)
MonDKP.ConfigTab2.decayDKP:SetBackdropBorderColor(1,1,1,0.6)
MonDKP.ConfigTab2.decayDKP:SetMaxLetters(4)
MonDKP.ConfigTab2.decayDKP:SetTextColor(1, 1, 1, 1)
MonDKP.ConfigTab2.decayDKP:SetFontObject("MonDKPNormalRight")
MonDKP.ConfigTab2.decayDKP:SetTextInsets(10, 15, 5, 5)
MonDKP.ConfigTab2.decayDKP:SetNumber(tonumber(MonDKP_DB.DKPBonus.DecayPercentage))
MonDKP.ConfigTab2.decayDKP:SetScript("OnEscapePressed", function(self) -- clears focus on esc
self:ClearFocus()
end)
MonDKP.ConfigTab2.decayDKP:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["WEEKLYDKPDECAY"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["WEEKLYDECAYTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["WEEKLYDECAYTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.decayDKP:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
MonDKP.ConfigTab2.decayDKPHeader = MonDKP.ConfigTab2:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.decayDKPHeader:SetFontObject("GameFontHighlightLeft");
MonDKP.ConfigTab2.decayDKPHeader:SetPoint("BOTTOMLEFT", MonDKP.ConfigTab2.decayDKP, "TOPLEFT", 3, 3);
MonDKP.ConfigTab2.decayDKPHeader:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.decayDKPHeader:SetText(L["WEEKLYDKPDECAY"]..":")
MonDKP.ConfigTab2.decayDKPFooter = MonDKP.ConfigTab2.decayDKP:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.decayDKPFooter:SetFontObject("MonDKPNormalLeft");
MonDKP.ConfigTab2.decayDKPFooter:SetPoint("LEFT", MonDKP.ConfigTab2.decayDKP, "RIGHT", -15, 0);
MonDKP.ConfigTab2.decayDKPFooter:SetText("%")
-- selected players only checkbox
MonDKP.ConfigTab2.SelectedOnlyCheck = CreateFrame("CheckButton", nil, MonDKP.ConfigTab2, "UICheckButtonTemplate");
MonDKP.ConfigTab2.SelectedOnlyCheck:SetChecked(false)
MonDKP.ConfigTab2.SelectedOnlyCheck:SetScale(0.6);
MonDKP.ConfigTab2.SelectedOnlyCheck.text:SetText(" |cff5151de"..L["SELPLAYERSONLY"].."|r");
MonDKP.ConfigTab2.SelectedOnlyCheck.text:SetScale(1.5);
MonDKP.ConfigTab2.SelectedOnlyCheck.text:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.SelectedOnlyCheck:SetPoint("TOP", MonDKP.ConfigTab2.decayDKP, "BOTTOMLEFT", 15, -13);
MonDKP.ConfigTab2.SelectedOnlyCheck:SetScript("OnClick", function(self)
PlaySound(808)
end)
MonDKP.ConfigTab2.SelectedOnlyCheck:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["SELPLAYERSONLY"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["SELPLAYERSTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["SELPLAYERSTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.SelectedOnlyCheck:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- add to negative dkp checkbox
MonDKP.ConfigTab2.AddNegative = CreateFrame("CheckButton", nil, MonDKP.ConfigTab2, "UICheckButtonTemplate");
MonDKP.ConfigTab2.AddNegative:SetChecked(MonDKP_DB.modes.AddToNegative)
MonDKP.ConfigTab2.AddNegative:SetScale(0.6);
MonDKP.ConfigTab2.AddNegative.text:SetText(" |cff5151de"..L["ADDNEGVALUES"].."|r");
MonDKP.ConfigTab2.AddNegative.text:SetScale(1.5);
MonDKP.ConfigTab2.AddNegative.text:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.AddNegative:SetPoint("TOP", MonDKP.ConfigTab2.SelectedOnlyCheck, "BOTTOM", 0, 0);
MonDKP.ConfigTab2.AddNegative:SetScript("OnClick", function(self)
MonDKP_DB.modes.AddToNegative = self:GetChecked();
PlaySound(808)
end)
MonDKP.ConfigTab2.AddNegative:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["ADDNEGVALUES"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["ADDNEGTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["ADDNEGTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.AddNegative:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
MonDKP.ConfigTab2.decayButton = self:CreateButton("TOPLEFT", MonDKP.ConfigTab2.decayDKP, "TOPRIGHT", 20, 0, L["APPLYDECAY"]);
MonDKP.ConfigTab2.decayButton:SetSize(90,25)
MonDKP.ConfigTab2.decayButton:SetScript("OnClick", function()
local SelectedToggle;
local selected;
if MonDKP.ConfigTab2.SelectedOnlyCheck:GetChecked() then SelectedToggle = "|cffff0000"..L["SELECTED"].."|r" else SelectedToggle = "|cffff0000"..L["ALL"].."|r" end
selected = L["CONFIRMDECAY"].." "..SelectedToggle.." "..L["DKPENTRIESBY"].." "..MonDKP.ConfigTab2.decayDKP:GetNumber().."%%";
StaticPopupDialogs["ADJUST_DKP"] = {
text = selected,
button1 = L["YES"],
button2 = L["NO"],
OnAccept = function()
DecayDKP(MonDKP.ConfigTab2.decayDKP:GetNumber(), "percent", MonDKP.ConfigTab2.SelectedOnlyCheck:GetChecked())
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
StaticPopup_Show ("ADJUST_DKP")
end)
MonDKP.ConfigTab2.decayButton:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["WEEKLYDKPDECAY"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["APPDECAYTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["APPDECAYTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.decayButton:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- Raid Timer Container
MonDKP.ConfigTab2.RaidTimerContainer = CreateFrame("Frame", nil, MonDKP.ConfigTab2);
MonDKP.ConfigTab2.RaidTimerContainer:SetSize(200, 360);
MonDKP.ConfigTab2.RaidTimerContainer:SetPoint("RIGHT", MonDKP.ConfigTab2, "RIGHT", -25, -60)
MonDKP.ConfigTab2.RaidTimerContainer:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2,
});
MonDKP.ConfigTab2.RaidTimerContainer:SetBackdropColor(0,0,0,0.9)
MonDKP.ConfigTab2.RaidTimerContainer:SetBackdropBorderColor(0.12, 0.12, 0.34, 1)
-- Pop out button
MonDKP.ConfigTab2.RaidTimerContainer.PopOut = CreateFrame("Button", nil, MonDKP.ConfigTab2, "UIMenuButtonStretchTemplate")
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetPoint("TOPRIGHT", MonDKP.ConfigTab2.RaidTimerContainer, "TOPRIGHT", -5, -5)
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetHeight(22)
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetWidth(18)
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetNormalFontObject("MonDKPLargeCenter")
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetHighlightFontObject("MonDKPLargeCenter")
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:GetFontString():SetTextColor(0, 0.3, 0.7, 1)
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetScale(1.2)
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetFrameStrata("DIALOG")
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetFrameLevel(15)
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetText(">")
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["POPOUTTIMER"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["POPOUTTIMERDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetScript("OnLeave", function(self)
GameTooltip:Hide();
end)
MonDKP.ConfigTab2.RaidTimerContainer.PopOut:SetScript("OnClick", function(self)
if self:GetText() == ">" then
self:SetText("<");
RaidTimerPopout_Create()
else
self:SetText(">");
MonDKP.RaidTimerPopout:Hide();
end
end)
-- Raid Timer Header
MonDKP.ConfigTab2.RaidTimerContainer.Header = MonDKP.ConfigTab2.RaidTimerContainer:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.RaidTimerContainer.Header:SetFontObject("MonDKPLargeLeft");
MonDKP.ConfigTab2.RaidTimerContainer.Header:SetScale(0.6)
MonDKP.ConfigTab2.RaidTimerContainer.Header:SetPoint("TOPLEFT", MonDKP.ConfigTab2.RaidTimerContainer, "TOPLEFT", 15, -15);
MonDKP.ConfigTab2.RaidTimerContainer.Header:SetText(L["RAIDTIMER"])
-- Raid Timer Output Header
MonDKP.ConfigTab2.RaidTimerContainer.OutputHeader = MonDKP.ConfigTab2.RaidTimerContainer:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.RaidTimerContainer.OutputHeader:SetFontObject("MonDKPNormalRight");
MonDKP.ConfigTab2.RaidTimerContainer.OutputHeader:SetPoint("TOP", MonDKP.ConfigTab2.RaidTimerContainer, "TOP", -20, -40);
MonDKP.ConfigTab2.RaidTimerContainer.OutputHeader:SetText(L["TIMEELAPSED"]..":")
MonDKP.ConfigTab2.RaidTimerContainer.OutputHeader:Hide();
-- Raid Timer Output
MonDKP.ConfigTab2.RaidTimerContainer.Output = MonDKP.ConfigTab2.RaidTimerContainer:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.RaidTimerContainer.Output:SetFontObject("MonDKPLargeLeft");
MonDKP.ConfigTab2.RaidTimerContainer.Output:SetScale(0.8)
MonDKP.ConfigTab2.RaidTimerContainer.Output:SetPoint("LEFT", MonDKP.ConfigTab2.RaidTimerContainer.OutputHeader, "RIGHT", 5, 0);
-- Bonus Awarded Header
MonDKP.ConfigTab2.RaidTimerContainer.BonusHeader = MonDKP.ConfigTab2.RaidTimerContainer:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.RaidTimerContainer.BonusHeader:SetFontObject("MonDKPNormalRight");
MonDKP.ConfigTab2.RaidTimerContainer.BonusHeader:SetPoint("TOP", MonDKP.ConfigTab2.RaidTimerContainer, "TOP", -15, -60);
MonDKP.ConfigTab2.RaidTimerContainer.BonusHeader:SetText(L["BONUSAWARDED"]..":")
MonDKP.ConfigTab2.RaidTimerContainer.BonusHeader:Hide();
-- Bonus Awarded Output
MonDKP.ConfigTab2.RaidTimerContainer.Bonus = MonDKP.ConfigTab2.RaidTimerContainer:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.RaidTimerContainer.Bonus:SetFontObject("MonDKPLargeLeft");
MonDKP.ConfigTab2.RaidTimerContainer.Bonus:SetScale(0.8)
MonDKP.ConfigTab2.RaidTimerContainer.Bonus:SetPoint("LEFT", MonDKP.ConfigTab2.RaidTimerContainer.BonusHeader, "RIGHT", 5, 0);
-- Start Raid Timer Button
MonDKP.ConfigTab2.RaidTimerContainer.StartTimer = self:CreateButton("BOTTOMLEFT", MonDKP.ConfigTab2.RaidTimerContainer, "BOTTOMLEFT", 10, 135, L["INITRAID"]);
MonDKP.ConfigTab2.RaidTimerContainer.StartTimer:SetSize(90,25)
MonDKP.ConfigTab2.RaidTimerContainer.StartTimer:SetScript("OnClick", function(self)
if not IsInRaid() then
StaticPopupDialogs["NO_RAID_TIMER"] = {
text = L["NOTINRAID"],
button1 = L["OK"],
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
StaticPopup_Show ("NO_RAID_TIMER")
return;
end
if not core.RaidInProgress then
if MonDKP_DB.DKPBonus.GiveRaidStart and self:GetText() ~= L["CONTINUERAID"] then
StaticPopupDialogs["START_RAID_BONUS"] = {
text = L["RAIDTIMERBONUSCONFIRM"],
button1 = L["YES"],
button2 = L["NO"],
OnAccept = function()
local setInterval = MonDKP.ConfigTab2.RaidTimerContainer.interval:GetNumber();
local setBonus = MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:GetNumber();
local setOnTime = tostring(MonDKP.ConfigTab2.RaidTimerContainer.StartBonus:GetChecked());
local setGiveEnd = tostring(MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus:GetChecked());
local setStandby = tostring(MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude:GetChecked());
MonDKP.Sync:SendData("MonDKPRaidTime", "start,false "..setInterval.. " "..setBonus.." "..setOnTime.." "..setGiveEnd.." "..setStandby)
if MonDKP.ConfigTab2.RaidTimerContainer.StartTimer:GetText() == L["CONTINUERAID"] then
MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDRESUME"])
else
MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDSTART"])
MonDKP.ConfigTab2.RaidTimerContainer.Output:SetText("|cff00ff0000|r")
end
MonDKP:StartRaidTimer(false)
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
StaticPopup_Show ("START_RAID_BONUS")
else
local setInterval = MonDKP.ConfigTab2.RaidTimerContainer.interval:GetNumber();
local setBonus = MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:GetNumber();
local setOnTime = tostring(MonDKP.ConfigTab2.RaidTimerContainer.StartBonus:GetChecked());
local setGiveEnd = tostring(MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus:GetChecked());
local setStandby = tostring(MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude:GetChecked());
MonDKP.Sync:SendData("MonDKPRaidTime", "start,false "..setInterval.. " "..setBonus.." "..setOnTime.." "..setGiveEnd.." "..setStandby)
if MonDKP.ConfigTab2.RaidTimerContainer.StartTimer:GetText() == L["CONTINUERAID"] then
MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDRESUME"])
else
MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDSTART"])
MonDKP.ConfigTab2.RaidTimerContainer.Output:SetText("|cff00ff0000|r")
end
MonDKP:StartRaidTimer(false)
end
else
StaticPopupDialogs["END_RAID"] = {
text = L["ENDCURRAIDCONFIRM"],
button1 = L["YES"],
button2 = L["NO"],
OnAccept = function()
MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDTIMERCONCLUDE"].." "..MonDKP.ConfigTab2.RaidTimerContainer.Output:GetText().."!")
MonDKP.Sync:SendData("MonDKPRaidTime", "stop")
MonDKP:StopRaidTimer()
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
StaticPopup_Show ("END_RAID")
end
end)
MonDKP.ConfigTab2.RaidTimerContainer.StartTimer:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["INITRAID"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["INITRAIDTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["INITRAIDTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.RaidTimerContainer.StartTimer:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- Pause Raid Timer Button
MonDKP.ConfigTab2.RaidTimerContainer.PauseTimer = self:CreateButton("BOTTOMRIGHT", MonDKP.ConfigTab2.RaidTimerContainer, "BOTTOMRIGHT", -10, 135, L["PAUSERAID"]);
MonDKP.ConfigTab2.RaidTimerContainer.PauseTimer:SetSize(90,25)
MonDKP.ConfigTab2.RaidTimerContainer.PauseTimer:Hide();
MonDKP.ConfigTab2.RaidTimerContainer.PauseTimer:SetScript("OnClick", function(self)
if core.RaidInProgress then
local setInterval = MonDKP.ConfigTab2.RaidTimerContainer.interval:GetNumber();
local setBonus = MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:GetNumber();
local setOnTime = tostring(MonDKP.ConfigTab2.RaidTimerContainer.StartBonus:GetChecked());
local setGiveEnd = tostring(MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus:GetChecked());
local setStandby = tostring(MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude:GetChecked());
MonDKP.Sync:SendData("MonDKPRaidTime", "start,true "..setInterval.. " "..setBonus.." "..setOnTime.." "..setGiveEnd.." "..setStandby)
MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDPAUSE"].." "..MonDKP.ConfigTab2.RaidTimerContainer.Output:GetText().."!")
MonDKP:StartRaidTimer(true)
end
end)
MonDKP.ConfigTab2.RaidTimerContainer.PauseTimer:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["PAUSERAID"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["PAUSERAIDTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["PAUSERAIDTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.RaidTimerContainer.PauseTimer:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- Award Interval Editbox
if not MonDKP_DB.modes.increment then MonDKP_DB.modes.increment = 60 end
MonDKP.ConfigTab2.RaidTimerContainer.interval = CreateFrame("EditBox", nil, MonDKP.ConfigTab2.RaidTimerContainer)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetPoint("BOTTOMLEFT", MonDKP.ConfigTab2.RaidTimerContainer, "BOTTOMLEFT", 35, 225)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetAutoFocus(false)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetMultiLine(false)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetSize(60, 24)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2,
});
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetBackdropColor(0,0,0,0.9)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetBackdropBorderColor(1,1,1,0.6)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetMaxLetters(5)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetTextColor(1, 1, 1, 1)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetFontObject("MonDKPSmallRight")
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetTextInsets(10, 15, 5, 5)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetNumber(tonumber(MonDKP_DB.modes.increment))
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetScript("OnTextChanged", function(self) -- clears focus on esc
if tonumber(self:GetNumber()) then
MonDKP_DB.modes.increment = self:GetNumber();
else
StaticPopupDialogs["ALERT_NUMBER"] = {
text = L["INCREMENTINVALIDWARN"],
button1 = L["OK"],
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
StaticPopup_Show ("ALERT_NUMBER")
end
end)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetScript("OnEscapePressed", function(self) -- clears focus on esc
self:HighlightText(0,0)
self:ClearFocus()
end)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetScript("OnEnterPressed", function(self) -- clears focus on esc
self:HighlightText(0,0)
self:ClearFocus()
end)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetScript("OnTabPressed", function(self) -- clears focus on esc
self:HighlightText(0,0)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetFocus()
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:HighlightText()
end)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["AWARDINTERVAL"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["AWARDINTERVALTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["AWARDINTERVALTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
MonDKP.ConfigTab2.RaidTimerContainer.intervalHeader = MonDKP.ConfigTab2.RaidTimerContainer:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.RaidTimerContainer.intervalHeader:SetFontObject("MonDKPTinyRight");
MonDKP.ConfigTab2.RaidTimerContainer.intervalHeader:SetPoint("BOTTOMLEFT", MonDKP.ConfigTab2.RaidTimerContainer.interval, "TOPLEFT", 0, 2);
MonDKP.ConfigTab2.RaidTimerContainer.intervalHeader:SetText(L["INTERVAL"]..":")
-- Award Value Editbox
if not MonDKP_DB.DKPBonus.IntervalBonus then MonDKP_DB.DKPBonus.IntervalBonus = 15 end
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue = CreateFrame("EditBox", nil, MonDKP.ConfigTab2.RaidTimerContainer)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetPoint("LEFT", MonDKP.ConfigTab2.RaidTimerContainer.interval, "RIGHT", 10, 0)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetAutoFocus(false)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetMultiLine(false)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetSize(60, 24)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2,
});
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetBackdropColor(0,0,0,0.9)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetBackdropBorderColor(1,1,1,0.6)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetMaxLetters(5)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetTextColor(1, 1, 1, 1)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetFontObject("MonDKPSmallRight")
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetTextInsets(10, 15, 5, 5)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetNumber(tonumber(MonDKP_DB.DKPBonus.IntervalBonus))
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetScript("OnTextChanged", function(self) -- clears focus on esc
if tonumber(self:GetNumber()) then
MonDKP_DB.DKPBonus.IntervalBonus = self:GetNumber();
else
StaticPopupDialogs["ALERT_NUMBER"] = {
text = L["INCREMENTINVALIDWARN"],
button1 = L["OK"],
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3,
}
StaticPopup_Show ("ALERT_NUMBER")
end
end)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetScript("OnEscapePressed", function(self) -- clears focus on esc
self:HighlightText(0,0)
self:ClearFocus()
end)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetScript("OnEnterPressed", function(self) -- clears focus on esc
self:HighlightText(0,0)
self:ClearFocus()
end)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetScript("OnTabPressed", function(self) -- clears focus on esc
self:HighlightText(0,0)
MonDKP.ConfigTab2.RaidTimerContainer.interval:SetFocus()
MonDKP.ConfigTab2.RaidTimerContainer.interval:HighlightText()
end)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["AWARDBONUS"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["AWARDBONUSTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalueHeader = MonDKP.ConfigTab2.RaidTimerContainer:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalueHeader:SetFontObject("MonDKPTinyRight");
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalueHeader:SetPoint("BOTTOMLEFT", MonDKP.ConfigTab2.RaidTimerContainer.bonusvalue, "TOPLEFT", 0, 2);
MonDKP.ConfigTab2.RaidTimerContainer.bonusvalueHeader:SetText(L["BONUS"]..":")
-- Give On Time Bonus Checkbox
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus = CreateFrame("CheckButton", nil, MonDKP.ConfigTab2.RaidTimerContainer, "UICheckButtonTemplate");
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus:SetChecked(MonDKP_DB.DKPBonus.GiveRaidStart)
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus:SetScale(0.6);
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus.text:SetText(" |cff5151de"..L["GIVEONTIMEBONUS"].."|r");
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus.text:SetScale(1.5);
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus.text:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus:SetPoint("TOPLEFT", MonDKP.ConfigTab2.RaidTimerContainer.interval, "BOTTOMLEFT", 0, -10);
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus:SetScript("OnClick", function(self)
if self:GetChecked() then
MonDKP_DB.DKPBonus.GiveRaidStart = true;
PlaySound(808)
else
MonDKP_DB.DKPBonus.GiveRaidStart = false;
end
end)
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["GIVEONTIMEBONUS"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["GIVEONTIMETTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.RaidTimerContainer.StartBonus:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- Give Raid End Bonus Checkbox
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus = CreateFrame("CheckButton", nil, MonDKP.ConfigTab2.RaidTimerContainer, "UICheckButtonTemplate");
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus:SetChecked(MonDKP_DB.DKPBonus.GiveRaidEnd)
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus:SetScale(0.6);
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus.text:SetText(" |cff5151de"..L["GIVEENDBONUS"].."|r");
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus.text:SetScale(1.5);
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus.text:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus:SetPoint("TOP", MonDKP.ConfigTab2.RaidTimerContainer.StartBonus, "BOTTOM", 0, 2);
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus:SetScript("OnClick", function(self)
if self:GetChecked() then
MonDKP_DB.DKPBonus.GiveRaidEnd = true;
PlaySound(808)
else
MonDKP_DB.DKPBonus.GiveRaidEnd = false;
end
end)
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["GIVEENDBONUS"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["GIVEENDBONUSTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- Include Standby Checkbox
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude = CreateFrame("CheckButton", nil, MonDKP.ConfigTab2.RaidTimerContainer, "UICheckButtonTemplate");
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude:SetChecked(MonDKP_DB.DKPBonus.IncStandby)
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude:SetScale(0.6);
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude.text:SetText(" |cff5151de"..L["INCLUDESTANDBY"].."|r");
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude.text:SetScale(1.5);
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude.text:SetFontObject("MonDKPSmallLeft")
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude:SetPoint("TOP", MonDKP.ConfigTab2.RaidTimerContainer.EndRaidBonus, "BOTTOM", 0, 2);
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude:SetScript("OnClick", function(self)
if self:GetChecked() then
MonDKP_DB.DKPBonus.IncStandby = true;
PlaySound(808)
else
MonDKP_DB.DKPBonus.IncStandby = false;
end
end)
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(L["INCLUDESTANDBY"], 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine(L["INCLUDESTANDBYTTDESC"], 1.0, 1.0, 1.0, true);
GameTooltip:AddLine(L["INCLUDESTANDBYTTWARN"], 1.0, 0, 0, true);
GameTooltip:Show();
end)
MonDKP.ConfigTab2.RaidTimerContainer.StandbyInclude:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
MonDKP.ConfigTab2.RaidTimerContainer.TimerWarning = MonDKP.ConfigTab2.RaidTimerContainer:CreateFontString(nil, "OVERLAY")
MonDKP.ConfigTab2.RaidTimerContainer.TimerWarning:SetFontObject("MonDKPTinyLeft");
MonDKP.ConfigTab2.RaidTimerContainer.TimerWarning:SetWidth(180)
MonDKP.ConfigTab2.RaidTimerContainer.TimerWarning:SetPoint("BOTTOMLEFT", MonDKP.ConfigTab2.RaidTimerContainer, "BOTTOMLEFT", 10, 10);
MonDKP.ConfigTab2.RaidTimerContainer.TimerWarning:SetText("|CFFFF0000"..L["TIMERWARNING"].."|r")
RaidTimerPopout_Create()
end
|
local meta = FindMetaTable( "Player" );
function meta:ClearDrug()
self.DrugEffects = { };
end
function meta:DoDrug( d )
if( !self.DrugEffects ) then self:ClearDrug() end
self.DrugEffects[d] = CurTime();
end
function meta:HasDrug( d )
if( !self.DrugEffects ) then self:ClearDrug() end
if( self.DrugEffects[d] ) then
return CurTime() - self.DrugEffects[d] < 60;
end
return false;
end
function meta:DrugSpeedMod()
local mul = 1;
if( self:HasDrug( DRUG_ANTLION ) ) then
mul = mul * 1.5;
end
return mul;
end
function meta:DrugDamageMod()
local mul = 1;
if( self:HasDrug( DRUG_ANTLION ) ) then
mul = mul * 0.4;
end
if( self:HasDrug( DRUG_EXTRACT ) ) then
mul = mul * 0.25;
end
if( self:HasDrug( DRUG_MEDKIT ) ) then
mul = mul * 0.7;
end
return mul;
end
function meta:DrugPerceptionMod()
local mul = 0;
if( GAMEMODE.DrugType == DRUG_BREEN ) then
mul = 50;
end
return mul;
end
|
local init = {
require(".Event");
Const = require(".Const");
Cmd = require(".Cmd");
}
return init;
|
local gui = require 'yue.gui'
local ca = require 'gui.new.common_attribute'
return function (t, data)
local btn = gui.Button.create('')
local bind = {}
if t.bind and t.bind.title then
local bind_title
bind_title = data:bind(t.bind.title, function()
btn:settitle(bind_title:get())
end)
btn:settitle(bind_title:get())
else
btn:settitle(t.title or '')
end
if t.style then
btn:setstyle(t.style)
end
if t.on and t.on.click then
function btn:onmousedown()
t.on.click(self, t)
end
end
ca.font(btn, t)
ca.button_color(btn, btn, t, data, bind)
ca.visible(btn, t, data, bind)
return btn
end
|
--------------------------------------------------------------------------------
--[[
Dusk Engine Component: Tile Culling
Manages displayed tiles for tile layers in a map.
--]]
--------------------------------------------------------------------------------
local lib_tileculling = {}
--------------------------------------------------------------------------------
-- Localize
--------------------------------------------------------------------------------
local require = require
local editQueue = require("Dusk.dusk_core.misc.editqueue")
local screen = require("Dusk.dusk_core.misc.screen")
local lib_settings = require("Dusk.dusk_core.misc.settings")
local getSetting = lib_settings.get
local newEditQueue = editQueue.new
local math_abs = math.abs
local math_ceil = math.ceil
local math_max = math.max
local math_min = math.min
--------------------------------------------------------------------------------
-- Add Tile Culling to a Map
--------------------------------------------------------------------------------
function lib_tileculling.addCulling(map)
local divTileWidth, divTileHeight = 1 / map.data.tileWidth, 1 / map.data.tileHeight
local culling = {}
local cullingMargin = getSetting("cullingMargin")
local tileCullingEnabled = getSetting("enableTileCulling")
local objectCullingEnabled = getSetting("enableObjectCulling")
local multiCullingFieldsEnabled = getSetting("enableMultipleCullingFields")
local enableRotatedMapCulling = getSetting("enableRotatedMapCulling")
------------------------------------------------------------------------------
-- New Culling Field
------------------------------------------------------------------------------
function culling.newCullingField(w, h, x, y)
local tileField = {
layer = {},
width = w or screen.right - screen.left,
height = h or screen.bottom - screen.top,
x = x or 0,
y = y or 0
}
tileField.hash = tostring(tileField)
----------------------------------------------------------------------------
-- Build Layer Culling
----------------------------------------------------------------------------
for layer, i in map.layers() do
if (layer._layerType == "tile" and tileCullingEnabled) or (layer._layerType == "object" and objectCullingEnabled) then
local layerCulling = {
prev = {l = 0, r = 0, t = 0, b = 0},
now = {l = 0, r = 0, t = 0, b = 0},
update = function() end
}
local prev, now = layerCulling.prev, layerCulling.now
local layerEdits = newEditQueue()
layerEdits.setTarget(layer)
if multiCullingFieldsEnabled then
layerEdits.setSource(tileField)
end
--------------------------------------------------------------------------
-- Update Culling
--------------------------------------------------------------------------
layerCulling.update = function()
local edgeModeLeft, edgeModeRight, edgeModeTop, edgeModeBottom = layer.edgeModeLeft, layer.edgeModeRight, layer.edgeModeTop, layer.edgeModeBottom
local nl, nr, nt, nb = layerCulling.updatePositions()
local pl, pr, pt, pb = layerCulling.prev.l, layerCulling.prev.r, layerCulling.prev.t, layerCulling.prev.b
layer._drawnLeft = nl
layer._drawnRight = nr
layer._drawnTop = nt
layer._drawnBottom = nb
-- if nl == pl and nr == pr and nt == pt and nb == pb then return end
-- Difference between current positions and previous positions
-- This is used to tell which direction the layer has moved
local lDiff = nl - pl
local rDiff = nr - pr
local tDiff = nt - pt
local bDiff = nb - pb
-- Left side
if lDiff > 0 then -- Moved left, so erase left
if edgeModeLeft ~= "stop" or pl <= layer._rightmostTile then
layerEdits.add(pl, nl, pt, pb, "e", "r")
end
elseif lDiff < 0 then -- Moved right, so draw left
if edgeModeLeft ~= "stop" or pl >= layer._leftmostTile then
layerEdits.add(pl, nl, nt, nb, "d")
end
end
-- Right side
if rDiff < 0 then -- Moved right, so erase right
if edgeModeRight ~= "stop" or pr <= layer._rightmostTile then
layerEdits.add(pr, nr, pt, pb, "e", "l")
end
elseif rDiff > 0 then -- Moved left
if edgeModeRight ~= "stop" or pr >= layer._leftmostTile then
layerEdits.add(pr, nr, nt, nb, "d")
end
end
-- Top side
if tDiff > 0 then -- Moved down, so erase top
if edgeModeY ~= "stop" or pt >= layer._highestTile then
layerEdits.add(nl, nr, pt, nt, "e", "d")
end
elseif tDiff < 0 then -- Moved up, so draw down
if edgeModeY ~= "stop" or pt <= layer._lowestTile then
layerEdits.add(nl, nr, pt, nt, "d")
end
end
-- Bottom side
if bDiff < 0 then -- Moved up, so erase bottom
if edgeModeY ~= "stop" or pb <= layer._lowestTile then
layerEdits.add(nl, nr, pb, nb, "e", "u")
end
elseif bDiff > 0 then -- Moved down
if edgeModeY ~= "stop" or pb >= layer._highestTile then
layerEdits.add(nl, nr, pb, nb, "d")
end
end
-- Guard against tile "leaks"
if lDiff > 0 and tDiff > 0 then -- Moved up-left
layerEdits.add(pl, nl, pt, nt, "e", "r")
end
if rDiff < 0 and tDiff > 0 then
layerEdits.add(nr, pr, pt, nt, "e", "l")
end
if lDiff > 0 and bDiff < 0 then
layerEdits.add(pl, nl, nb, pb, "e", "r")
end
if rDiff < 0 and bDiff < 0 then
layerEdits.add(nr, pr, nb, pb, "e", "l")
end
layerEdits.execute()
-- Reset current position
now.l = nl
now.r = nr
now.t = nt
now.b = nb
end
--------------------------------------------------------------------------
-- Update Positions
--------------------------------------------------------------------------
if enableRotatedMapCulling then
layerCulling.updatePositions = function()
local tlX, tlY = layer:contentToLocal(tileField.x - tileField.width * 0.5, tileField.y - tileField.height * 0.5)
local trX, trY = layer:contentToLocal(tileField.x + tileField.width * 0.5, tileField.y - tileField.height * 0.5)
local blX, blY = layer:contentToLocal(tileField.x - tileField.width * 0.5, tileField.y + tileField.height * 0.5)
local brX, brY = layer:contentToLocal(tileField.x + tileField.width * 0.5, tileField.y + tileField.height * 0.5)
local l, r = math_min(tlX, blX, trX, brX), math_max(tlX, blX, trX, brX)
local t, b = math_min(tlY, blY, trY, brY), math_max(tlY, blY, trY, brY)
-- Calculate left/right/top/bottom to the nearest tile
-- We expand each position by the culling margin to hide the drawing and erasing
l = math_ceil(l * divTileWidth) - cullingMargin
r = math_ceil(r * divTileWidth) + cullingMargin
t = math_ceil(t * divTileHeight) - cullingMargin
b = math_ceil(b * divTileHeight) + cullingMargin
-- Update previous position to be equal to current position
prev.l = now.l
prev.r = now.r
prev.t = now.t
prev.b = now.b
return l, r, t, b
end
else
layerCulling.updatePositions = function()
local l, t = layer:contentToLocal(tileField.x - tileField.width * 0.5, tileField.y - tileField.height * 0.5)
local r, b = layer:contentToLocal(tileField.x + tileField.width * 0.5, tileField.y + tileField.height * 0.5)
-- Calculate left/right/top/bottom to the nearest tile
-- We expand each position by one to hide the drawing and erasing
l = math_ceil(l * divTileWidth) - cullingMargin
r = math_ceil(r * divTileWidth) + cullingMargin
t = math_ceil(t * divTileHeight) - cullingMargin
b = math_ceil(b * divTileHeight) + cullingMargin
-- Update previous position to be equal to current position
prev.l = now.l
prev.r = now.r
prev.t = now.t
prev.b = now.b
return l, r, t, b
end
end
layer._updateTileCulling = layerCulling.update
tileField.layer[i] = layerCulling
end
end
----------------------------------------------------------------------------
-- Initialize Culling Field
----------------------------------------------------------------------------
function tileField.initialize()
for layer, i in map.layers() do
if tileField.layer[i] then
local l, r, t, b = tileField.layer[i].updatePositions()
tileField.layer[i].updatePositions()
layer._drawnLeft = tileField.layer[i].now.l
layer._drawnRight = tileField.layer[i].now.r
layer._drawnTop = tileField.layer[i].now.t
layer._drawnBottom = tileField.layer[i].now.b
if layer._layerType == "tile" then
layer._edit(l, r, t, b, "d", tileField)
else
layer.draw(l, r, t, b, tileField)
end
end
end
end
----------------------------------------------------------------------------
-- Update Layers
----------------------------------------------------------------------------
function tileField.updateLayers()
for layer, i in map.layers() do
if tileField.layer[i] then
tileField.layer[i].update()
end
end
end
function tileField.updateLayerPositions()
for layer, i in map.layers() do
if tileField.layer[i] then
tileField.layer[i].updatePositions()
end
end
end
return tileField
end
culling.screenCullingField = culling.newCullingField()
if multiCullingFieldsEnabled then
map.newCullingField = culling.newCullingField
end
return culling
end
return lib_tileculling
|
local playerPosition = 4
if playerPosition <= 3 then
print("Well done! You are in spot ".. playerPosition .. "!")
else
print("You are not in the top three yet! Keep going!")
end
|
local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
local zx = require "nvim-lsp-installer.installers.zx"
local root_dir = server.get_server_root_path "tailwindcss"
return server.Server:new {
name = "tailwindcss",
root_dir = root_dir,
installer = zx.file "./install.mjs",
default_options = {
cmd = {
"node",
path.concat { root_dir, "tailwindcss", "extension", "dist", "server", "tailwindServer.js" },
"--stdio",
},
},
}
|
-- for positive dx, dy: x=0..n, y=x..n
-- intervals of 0.5, n=50, inclusive
-- precision of 8 decimal places
distances = {}
distances[0.0] = {}
distances[0.0][0.0] = 0.0
distances[0.5] = {}
distances[0.5][0.0] = 0.5
distances[0.5][0.5] = 0.70710678
distances[1.0] = {}
distances[1.0][0.0] = 1.0
distances[1.0][0.5] = 1.118034
distances[1.0][1.0] = 1.4142136
distances[1.5] = {}
distances[1.5][0.0] = 1.5
distances[1.5][0.5] = 1.5811388
distances[1.5][1.0] = 1.8027756
distances[1.5][1.5] = 2.1213203
distances[2.0] = {}
distances[2.0][0.0] = 2.0
distances[2.0][0.5] = 2.0615528
distances[2.0][1.0] = 2.236068
distances[2.0][1.5] = 2.5
distances[2.0][2.0] = 2.8284271
distances[2.5] = {}
distances[2.5][0.0] = 2.5
distances[2.5][0.5] = 2.5495098
distances[2.5][1.0] = 2.6925824
distances[2.5][1.5] = 2.9154759
distances[2.5][2.0] = 3.2015621
distances[2.5][2.5] = 3.5355339
distances[3.0] = {}
distances[3.0][0.0] = 3.0
distances[3.0][0.5] = 3.0413813
distances[3.0][1.0] = 3.1622777
distances[3.0][1.5] = 3.354102
distances[3.0][2.0] = 3.6055513
distances[3.0][2.5] = 3.9051248
distances[3.0][3.0] = 4.2426407
distances[3.5] = {}
distances[3.5][0.0] = 3.5
distances[3.5][0.5] = 3.5355339
distances[3.5][1.0] = 3.6400549
distances[3.5][1.5] = 3.8078866
distances[3.5][2.0] = 4.0311289
distances[3.5][2.5] = 4.3011626
distances[3.5][3.0] = 4.6097722
distances[3.5][3.5] = 4.9497475
distances[4.0] = {}
distances[4.0][0.0] = 4.0
distances[4.0][0.5] = 4.0311289
distances[4.0][1.0] = 4.1231056
distances[4.0][1.5] = 4.2720019
distances[4.0][2.0] = 4.472136
distances[4.0][2.5] = 4.7169906
distances[4.0][3.0] = 5.0
distances[4.0][3.5] = 5.3150729
distances[4.0][4.0] = 5.6568542
distances[4.5] = {}
distances[4.5][0.0] = 4.5
distances[4.5][0.5] = 4.5276926
distances[4.5][1.0] = 4.6097722
distances[4.5][1.5] = 4.7434165
distances[4.5][2.0] = 4.9244289
distances[4.5][2.5] = 5.1478151
distances[4.5][3.0] = 5.4083269
distances[4.5][3.5] = 5.7008771
distances[4.5][4.0] = 6.0207973
distances[4.5][4.5] = 6.363961
distances[5.0] = {}
distances[5.0][0.0] = 5.0
distances[5.0][0.5] = 5.0249378
distances[5.0][1.0] = 5.0990195
distances[5.0][1.5] = 5.2201533
distances[5.0][2.0] = 5.3851648
distances[5.0][2.5] = 5.5901699
distances[5.0][3.0] = 5.8309519
distances[5.0][3.5] = 6.1032778
distances[5.0][4.0] = 6.4031242
distances[5.0][4.5] = 6.726812
distances[5.0][5.0] = 7.0710678
distances[5.5] = {}
distances[5.5][0.0] = 5.5
distances[5.5][0.5] = 5.5226805
distances[5.5][1.0] = 5.5901699
distances[5.5][1.5] = 5.7008771
distances[5.5][2.0] = 5.85235
distances[5.5][2.5] = 6.041523
distances[5.5][3.0] = 6.264982
distances[5.5][3.5] = 6.5192024
distances[5.5][4.0] = 6.8007353
distances[5.5][4.5] = 7.1063352
distances[5.5][5.0] = 7.4330344
distances[5.5][5.5] = 7.7781746
distances[6.0] = {}
distances[6.0][0.0] = 6.0
distances[6.0][0.5] = 6.0207973
distances[6.0][1.0] = 6.0827625
distances[6.0][1.5] = 6.1846584
distances[6.0][2.0] = 6.3245553
distances[6.0][2.5] = 6.5
distances[6.0][3.0] = 6.7082039
distances[6.0][3.5] = 6.946222
distances[6.0][4.0] = 7.2111026
distances[6.0][4.5] = 7.5
distances[6.0][5.0] = 7.8102497
distances[6.0][5.5] = 8.1394103
distances[6.0][6.0] = 8.4852814
distances[6.5] = {}
distances[6.5][0.0] = 6.5
distances[6.5][0.5] = 6.5192024
distances[6.5][1.0] = 6.5764732
distances[6.5][1.5] = 6.670832
distances[6.5][2.0] = 6.8007353
distances[6.5][2.5] = 6.9641941
distances[6.5][3.0] = 7.1589105
distances[6.5][3.5] = 7.3824115
distances[6.5][4.0] = 7.6321688
distances[6.5][4.5] = 7.9056942
distances[6.5][5.0] = 8.2006097
distances[6.5][5.5] = 8.5146932
distances[6.5][6.0] = 8.845903
distances[6.5][6.5] = 9.1923882
distances[7.0] = {}
distances[7.0][0.0] = 7.0
distances[7.0][0.5] = 7.0178344
distances[7.0][1.0] = 7.0710678
distances[7.0][1.5] = 7.1589105
distances[7.0][2.0] = 7.2801099
distances[7.0][2.5] = 7.4330344
distances[7.0][3.0] = 7.6157731
distances[7.0][3.5] = 7.8262379
distances[7.0][4.0] = 8.0622577
distances[7.0][4.5] = 8.3216585
distances[7.0][5.0] = 8.6023253
distances[7.0][5.5] = 8.9022469
distances[7.0][6.0] = 9.2195445
distances[7.0][6.5] = 9.5524866
distances[7.0][7.0] = 9.8994949
distances[7.5] = {}
distances[7.5][0.0] = 7.5
distances[7.5][0.5] = 7.5166482
distances[7.5][1.0] = 7.566373
distances[7.5][1.5] = 7.6485293
distances[7.5][2.0] = 7.7620873
distances[7.5][2.5] = 7.9056942
distances[7.5][3.0] = 8.0777472
distances[7.5][3.5] = 8.2764727
distances[7.5][4.0] = 8.5
distances[7.5][4.5] = 8.7464278
distances[7.5][5.0] = 9.0138782
distances[7.5][5.5] = 9.3005376
distances[7.5][6.0] = 9.6046864
distances[7.5][6.5] = 9.9247166
distances[7.5][7.0] = 10.259142
distances[7.5][7.5] = 10.606602
distances[8.0] = {}
distances[8.0][0.0] = 8.0
distances[8.0][0.5] = 8.0156098
distances[8.0][1.0] = 8.0622577
distances[8.0][1.5] = 8.1394103
distances[8.0][2.0] = 8.2462113
distances[8.0][2.5] = 8.3815273
distances[8.0][3.0] = 8.5440037
distances[8.0][3.5] = 8.7321246
distances[8.0][4.0] = 8.9442719
distances[8.0][4.5] = 9.1787799
distances[8.0][5.0] = 9.4339811
distances[8.0][5.5] = 9.7082439
distances[8.0][6.0] = 10.0
distances[8.0][6.5] = 10.307764
distances[8.0][7.0] = 10.630146
distances[8.0][7.5] = 10.965856
distances[8.0][8.0] = 11.313708
distances[8.5] = {}
distances[8.5][0.0] = 8.5
distances[8.5][0.5] = 8.5146932
distances[8.5][1.0] = 8.5586214
distances[8.5][1.5] = 8.6313383
distances[8.5][2.0] = 8.7321246
distances[8.5][2.5] = 8.8600226
distances[8.5][3.0] = 9.0138782
distances[8.5][3.5] = 9.1923882
distances[8.5][4.0] = 9.3941471
distances[8.5][4.5] = 9.617692
distances[8.5][5.0] = 9.8615415
distances[8.5][5.5] = 10.124228
distances[8.5][6.0] = 10.404326
distances[8.5][6.5] = 10.700467
distances[8.5][7.0] = 11.011358
distances[8.5][7.5] = 11.335784
distances[8.5][8.0] = 11.672618
distances[8.5][8.5] = 12.020815
distances[9.0] = {}
distances[9.0][0.0] = 9.0
distances[9.0][0.5] = 9.0138782
distances[9.0][1.0] = 9.0553851
distances[9.0][1.5] = 9.1241438
distances[9.0][2.0] = 9.2195445
distances[9.0][2.5] = 9.3407708
distances[9.0][3.0] = 9.486833
distances[9.0][3.5] = 9.656604
distances[9.0][4.0] = 9.8488578
distances[9.0][4.5] = 10.062306
distances[9.0][5.0] = 10.29563
distances[9.0][5.5] = 10.547512
distances[9.0][6.0] = 10.816654
distances[9.0][6.5] = 11.101802
distances[9.0][7.0] = 11.401754
distances[9.0][7.5] = 11.715375
distances[9.0][8.0] = 12.041595
distances[9.0][8.5] = 12.379418
distances[9.0][9.0] = 12.727922
distances[9.5] = {}
distances[9.5][0.0] = 9.5
distances[9.5][0.5] = 9.5131488
distances[9.5][1.0] = 9.5524866
distances[9.5][1.5] = 9.617692
distances[9.5][2.0] = 9.7082439
distances[9.5][2.5] = 9.8234414
distances[9.5][3.0] = 9.9624294
distances[9.5][3.5] = 10.124228
distances[9.5][4.0] = 10.307764
distances[9.5][4.5] = 10.511898
distances[9.5][5.0] = 10.735455
distances[9.5][5.5] = 10.977249
distances[9.5][6.0] = 11.236103
distances[9.5][6.5] = 11.510864
distances[9.5][7.0] = 11.800424
distances[9.5][7.5] = 12.103718
distances[9.5][8.0] = 12.419742
distances[9.5][8.5] = 12.747549
distances[9.5][9.0] = 13.086252
distances[9.5][9.5] = 13.435029
distances[10.0] = {}
distances[10.0][0.0] = 10.0
distances[10.0][0.5] = 10.012492
distances[10.0][1.0] = 10.049876
distances[10.0][1.5] = 10.111874
distances[10.0][2.0] = 10.198039
distances[10.0][2.5] = 10.307764
distances[10.0][3.0] = 10.440307
distances[10.0][3.5] = 10.59481
distances[10.0][4.0] = 10.77033
distances[10.0][4.5] = 10.965856
distances[10.0][5.0] = 11.18034
distances[10.0][5.5] = 11.412712
distances[10.0][6.0] = 11.661904
distances[10.0][6.5] = 11.92686
distances[10.0][7.0] = 12.206556
distances[10.0][7.5] = 12.5
distances[10.0][8.0] = 12.806248
distances[10.0][8.5] = 13.124405
distances[10.0][9.0] = 13.453624
distances[10.0][9.5] = 13.793114
distances[10.0][10.0] = 14.142136
distances[10.5] = {}
distances[10.5][0.0] = 10.5
distances[10.5][0.5] = 10.511898
distances[10.5][1.0] = 10.547512
distances[10.5][1.5] = 10.606602
distances[10.5][2.0] = 10.688779
distances[10.5][2.5] = 10.793517
distances[10.5][3.0] = 10.920165
distances[10.5][3.5] = 11.067972
distances[10.5][4.0] = 11.236103
distances[10.5][4.5] = 11.42366
distances[10.5][5.0] = 11.629703
distances[10.5][5.5] = 11.85327
distances[10.5][6.0] = 12.093387
distances[10.5][6.5] = 12.349089
distances[10.5][7.0] = 12.619429
distances[10.5][7.5] = 12.903488
distances[10.5][8.0] = 13.200379
distances[10.5][8.5] = 13.509256
distances[10.5][9.0] = 13.829317
distances[10.5][9.5] = 14.159802
distances[10.5][10.0] = 14.5
distances[10.5][10.5] = 14.849242
distances[11.0] = {}
distances[11.0][0.0] = 11.0
distances[11.0][0.5] = 11.011358
distances[11.0][1.0] = 11.045361
distances[11.0][1.5] = 11.101802
distances[11.0][2.0] = 11.18034
distances[11.0][2.5] = 11.280514
distances[11.0][3.0] = 11.401754
distances[11.0][3.5] = 11.543396
distances[11.0][4.0] = 11.7047
distances[11.0][4.5] = 11.884864
distances[11.0][5.0] = 12.083046
distances[11.0][5.5] = 12.298374
distances[11.0][6.0] = 12.529964
distances[11.0][6.5] = 12.776932
distances[11.0][7.0] = 13.038405
distances[11.0][7.5] = 13.313527
distances[11.0][8.0] = 13.601471
distances[11.0][8.5] = 13.901439
distances[11.0][9.0] = 14.21267
distances[11.0][9.5] = 14.534442
distances[11.0][10.0] = 14.866069
distances[11.0][10.5] = 15.206906
distances[11.0][11.0] = 15.556349
distances[11.5] = {}
distances[11.5][0.0] = 11.5
distances[11.5][0.5] = 11.510864
distances[11.5][1.0] = 11.543396
distances[11.5][1.5] = 11.597414
distances[11.5][2.0] = 11.672618
distances[11.5][2.5] = 11.768602
distances[11.5][3.0] = 11.884864
distances[11.5][3.5] = 12.020815
distances[11.5][4.0] = 12.175796
distances[11.5][4.5] = 12.349089
distances[11.5][5.0] = 12.539936
distances[11.5][5.5] = 12.747549
distances[11.5][6.0] = 12.971122
distances[11.5][6.5] = 13.209845
distances[11.5][7.0] = 13.462912
distances[11.5][7.5] = 13.72953
distances[11.5][8.0] = 14.008926
distances[11.5][8.5] = 14.30035
distances[11.5][9.0] = 14.603082
distances[11.5][9.5] = 14.916434
distances[11.5][10.0] = 15.239751
distances[11.5][10.5] = 15.572412
distances[11.5][11.0] = 15.91383
distances[11.5][11.5] = 16.263456
distances[12.0] = {}
distances[12.0][0.0] = 12.0
distances[12.0][0.5] = 12.010412
distances[12.0][1.0] = 12.041595
distances[12.0][1.5] = 12.093387
distances[12.0][2.0] = 12.165525
distances[12.0][2.5] = 12.257651
distances[12.0][3.0] = 12.369317
distances[12.0][3.5] = 12.5
distances[12.0][4.0] = 12.649111
distances[12.0][4.5] = 12.816006
distances[12.0][5.0] = 13.0
distances[12.0][5.5] = 13.200379
distances[12.0][6.0] = 13.416408
distances[12.0][6.5] = 13.647344
distances[12.0][7.0] = 13.892444
distances[12.0][7.5] = 14.150972
distances[12.0][8.0] = 14.422205
distances[12.0][8.5] = 14.705441
distances[12.0][9.0] = 15.0
distances[12.0][9.5] = 15.305228
distances[12.0][10.0] = 15.620499
distances[12.0][10.5] = 15.945219
distances[12.0][11.0] = 16.278821
distances[12.0][11.5] = 16.62077
distances[12.0][12.0] = 16.970563
distances[12.5] = {}
distances[12.5][0.0] = 12.5
distances[12.5][0.5] = 12.509996
distances[12.5][1.0] = 12.539936
distances[12.5][1.5] = 12.589678
distances[12.5][2.0] = 12.658989
distances[12.5][2.5] = 12.747549
distances[12.5][3.0] = 12.85496
distances[12.5][3.5] = 12.980755
distances[12.5][4.0] = 13.124405
distances[12.5][4.5] = 13.28533
distances[12.5][5.0] = 13.462912
distances[12.5][5.5] = 13.6565
distances[12.5][6.0] = 13.865425
distances[12.5][6.5] = 14.089003
distances[12.5][7.0] = 14.326549
distances[12.5][7.5] = 14.57738
distances[12.5][8.0] = 14.840822
distances[12.5][8.5] = 15.116216
distances[12.5][9.0] = 15.402922
distances[12.5][9.5] = 15.700318
distances[12.5][10.0] = 16.007811
distances[12.5][10.5] = 16.324828
distances[12.5][11.0] = 16.650826
distances[12.5][11.5] = 16.985288
distances[12.5][12.0] = 17.327723
distances[12.5][12.5] = 17.67767
distances[13.0] = {}
distances[13.0][0.0] = 13.0
distances[13.0][0.5] = 13.009612
distances[13.0][1.0] = 13.038405
distances[13.0][1.5] = 13.086252
distances[13.0][2.0] = 13.152946
distances[13.0][2.5] = 13.238202
distances[13.0][3.0] = 13.341664
distances[13.0][3.5] = 13.462912
distances[13.0][4.0] = 13.601471
distances[13.0][4.5] = 13.756816
distances[13.0][5.0] = 13.928388
distances[13.0][5.5] = 14.115594
distances[13.0][6.0] = 14.317821
distances[13.0][6.5] = 14.534442
distances[13.0][7.0] = 14.764823
distances[13.0][7.5] = 15.008331
distances[13.0][8.0] = 15.264338
distances[13.0][8.5] = 15.532225
distances[13.0][9.0] = 15.811388
distances[13.0][9.5] = 16.101242
distances[13.0][10.0] = 16.401219
distances[13.0][10.5] = 16.710775
distances[13.0][11.0] = 17.029386
distances[13.0][11.5] = 17.356555
distances[13.0][12.0] = 17.691806
distances[13.0][12.5] = 18.034689
distances[13.0][13.0] = 18.384776
distances[13.5] = {}
distances[13.5][0.0] = 13.5
distances[13.5][0.5] = 13.509256
distances[13.5][1.0] = 13.536986
distances[13.5][1.5] = 13.583078
distances[13.5][2.0] = 13.647344
distances[13.5][2.5] = 13.72953
distances[13.5][3.0] = 13.829317
distances[13.5][3.5] = 13.946326
distances[13.5][4.0] = 14.080128
distances[13.5][4.5] = 14.230249
distances[13.5][5.0] = 14.39618
distances[13.5][5.5] = 14.57738
distances[13.5][6.0] = 14.773287
distances[13.5][6.5] = 14.983324
distances[13.5][7.0] = 15.206906
distances[13.5][7.5] = 15.443445
distances[13.5][8.0] = 15.692355
distances[13.5][8.5] = 15.953056
distances[13.5][9.0] = 16.224981
distances[13.5][9.5] = 16.507574
distances[13.5][10.0] = 16.800298
distances[13.5][10.5] = 17.102631
distances[13.5][11.0] = 17.414075
distances[13.5][11.5] = 17.734148
distances[13.5][12.0] = 18.062392
distances[13.5][12.5] = 18.398369
distances[13.5][13.0] = 18.741665
distances[13.5][13.5] = 19.091883
distances[14.0] = {}
distances[14.0][0.0] = 14.0
distances[14.0][0.5] = 14.008926
distances[14.0][1.0] = 14.035669
distances[14.0][1.5] = 14.080128
distances[14.0][2.0] = 14.142136
distances[14.0][2.5] = 14.221463
distances[14.0][3.0] = 14.317821
distances[14.0][3.5] = 14.43087
distances[14.0][4.0] = 14.56022
distances[14.0][4.5] = 14.705441
distances[14.0][5.0] = 14.866069
distances[14.0][5.5] = 15.041609
distances[14.0][6.0] = 15.231546
distances[14.0][6.5] = 15.435349
distances[14.0][7.0] = 15.652476
distances[14.0][7.5] = 15.88238
distances[14.0][8.0] = 16.124515
distances[14.0][8.5] = 16.378339
distances[14.0][9.0] = 16.643317
distances[14.0][9.5] = 16.918924
distances[14.0][10.0] = 17.204651
distances[14.0][10.5] = 17.5
distances[14.0][11.0] = 17.804494
distances[14.0][11.5] = 18.117671
distances[14.0][12.0] = 18.439089
distances[14.0][12.5] = 18.768324
distances[14.0][13.0] = 19.104973
distances[14.0][13.5] = 19.44865
distances[14.0][14.0] = 19.79899
distances[14.5] = {}
distances[14.5][0.0] = 14.5
distances[14.5][0.5] = 14.508618
distances[14.5][1.0] = 14.534442
distances[14.5][1.5] = 14.57738
distances[14.5][2.0] = 14.637281
distances[14.5][2.5] = 14.713939
distances[14.5][3.0] = 14.807093
distances[14.5][3.5] = 14.916434
distances[14.5][4.0] = 15.041609
distances[14.5][4.5] = 15.182226
distances[14.5][5.0] = 15.337862
distances[14.5][5.5] = 15.508062
distances[14.5][6.0] = 15.692355
distances[14.5][6.5] = 15.890249
distances[14.5][7.0] = 16.101242
distances[14.5][7.5] = 16.324828
distances[14.5][8.0] = 16.560495
distances[14.5][8.5] = 16.807736
distances[14.5][9.0] = 17.066048
distances[14.5][9.5] = 17.334936
distances[14.5][10.0] = 17.613915
distances[14.5][10.5] = 17.902514
distances[14.5][11.0] = 18.200275
distances[14.5][11.5] = 18.506756
distances[14.5][12.0] = 18.82153
distances[14.5][12.5] = 19.14419
distances[14.5][13.0] = 19.474342
distances[14.5][13.5] = 19.811613
distances[14.5][14.0] = 20.155644
distances[14.5][14.5] = 20.506097
distances[15.0] = {}
distances[15.0][0.0] = 15.0
distances[15.0][0.5] = 15.008331
distances[15.0][1.0] = 15.033296
distances[15.0][1.5] = 15.074813
distances[15.0][2.0] = 15.132746
distances[15.0][2.5] = 15.206906
distances[15.0][3.0] = 15.297059
distances[15.0][3.5] = 15.402922
distances[15.0][4.0] = 15.524175
distances[15.0][4.5] = 15.66046
distances[15.0][5.0] = 15.811388
distances[15.0][5.5] = 15.976545
distances[15.0][6.0] = 16.155494
distances[15.0][6.5] = 16.347783
distances[15.0][7.0] = 16.552945
distances[15.0][7.5] = 16.77051
distances[15.0][8.0] = 17.0
distances[15.0][8.5] = 17.24094
distances[15.0][9.0] = 17.492856
distances[15.0][9.5] = 17.755281
distances[15.0][10.0] = 18.027756
distances[15.0][10.5] = 18.309833
distances[15.0][11.0] = 18.601075
distances[15.0][11.5] = 18.901058
distances[15.0][12.0] = 19.209373
distances[15.0][12.5] = 19.525624
distances[15.0][13.0] = 19.849433
distances[15.0][13.5] = 20.180436
distances[15.0][14.0] = 20.518285
distances[15.0][14.5] = 20.862646
distances[15.0][15.0] = 21.213203
distances[15.5] = {}
distances[15.5][0.0] = 15.5
distances[15.5][0.5] = 15.508062
distances[15.5][1.0] = 15.532225
distances[15.5][1.5] = 15.572412
distances[15.5][2.0] = 15.6285
distances[15.5][2.5] = 15.700318
distances[15.5][3.0] = 15.787653
distances[15.5][3.5] = 15.890249
distances[15.5][4.0] = 16.007811
distances[15.5][4.5] = 16.140012
distances[15.5][5.0] = 16.286497
distances[15.5][5.5] = 16.446884
distances[15.5][6.0] = 16.62077
distances[15.5][6.5] = 16.807736
distances[15.5][7.0] = 17.007351
distances[15.5][7.5] = 17.219175
distances[15.5][8.0] = 17.442764
distances[15.5][8.5] = 17.67767
distances[15.5][9.0] = 17.923448
distances[15.5][9.5] = 18.179659
distances[15.5][10.0] = 18.445867
distances[15.5][10.5] = 18.721645
distances[15.5][11.0] = 19.006578
distances[15.5][11.5] = 19.300259
distances[15.5][12.0] = 19.602296
distances[15.5][12.5] = 19.912308
distances[15.5][13.0] = 20.229928
distances[15.5][13.5] = 20.554805
distances[15.5][14.0] = 20.886599
distances[15.5][14.5] = 21.224985
distances[15.5][15.0] = 21.569655
distances[15.5][15.5] = 21.92031
distances[16.0] = {}
distances[16.0][0.0] = 16.0
distances[16.0][0.5] = 16.007811
distances[16.0][1.0] = 16.03122
distances[16.0][1.5] = 16.070159
distances[16.0][2.0] = 16.124515
distances[16.0][2.5] = 16.194135
distances[16.0][3.0] = 16.278821
distances[16.0][3.5] = 16.378339
distances[16.0][4.0] = 16.492423
distances[16.0][4.5] = 16.62077
distances[16.0][5.0] = 16.763055
distances[16.0][5.5] = 16.918924
distances[16.0][6.0] = 17.088007
distances[16.0][6.5] = 17.269916
distances[16.0][7.0] = 17.464249
distances[16.0][7.5] = 17.670597
distances[16.0][8.0] = 17.888544
distances[16.0][8.5] = 18.117671
distances[16.0][9.0] = 18.35756
distances[16.0][9.5] = 18.607794
distances[16.0][10.0] = 18.867962
distances[16.0][10.5] = 19.137659
distances[16.0][11.0] = 19.416488
distances[16.0][11.5] = 19.70406
distances[16.0][12.0] = 20.0
distances[16.0][12.5] = 20.303941
distances[16.0][13.0] = 20.615528
distances[16.0][13.5] = 20.934421
distances[16.0][14.0] = 21.260292
distances[16.0][14.5] = 21.592823
distances[16.0][15.0] = 21.931712
distances[16.0][15.5] = 22.276669
distances[16.0][16.0] = 22.627417
distances[16.5] = {}
distances[16.5][0.0] = 16.5
distances[16.5][0.5] = 16.507574
distances[16.5][1.0] = 16.530275
distances[16.5][1.5] = 16.568042
distances[16.5][2.0] = 16.62077
distances[16.5][2.5] = 16.688319
distances[16.5][3.0] = 16.77051
distances[16.5][3.5] = 16.867128
distances[16.5][4.0] = 16.977927
distances[16.5][4.5] = 17.102631
distances[16.5][5.0] = 17.24094
distances[16.5][5.5] = 17.392527
distances[16.5][6.0] = 17.55705
distances[16.5][6.5] = 17.734148
distances[16.5][7.0] = 17.923448
distances[16.5][7.5] = 18.124569
distances[16.5][8.0] = 18.337121
distances[16.5][8.5] = 18.560711
distances[16.5][9.0] = 18.794946
distances[16.5][9.5] = 19.039433
distances[16.5][10.0] = 19.293781
distances[16.5][10.5] = 19.557607
distances[16.5][11.0] = 19.830532
distances[16.5][11.5] = 20.112185
distances[16.5][12.0] = 20.402206
distances[16.5][12.5] = 20.700242
distances[16.5][13.0] = 21.005952
distances[16.5][13.5] = 21.319006
distances[16.5][14.0] = 21.639085
distances[16.5][14.5] = 21.965883
distances[16.5][15.0] = 22.299103
distances[16.5][15.5] = 22.638463
distances[16.5][16.0] = 22.98369
distances[16.5][16.5] = 23.334524
distances[17.0] = {}
distances[17.0][0.0] = 17.0
distances[17.0][0.5] = 17.007351
distances[17.0][1.0] = 17.029386
distances[17.0][1.5] = 17.066048
distances[17.0][2.0] = 17.117243
distances[17.0][2.5] = 17.18284
distances[17.0][3.0] = 17.262677
distances[17.0][3.5] = 17.356555
distances[17.0][4.0] = 17.464249
distances[17.0][4.5] = 17.585505
distances[17.0][5.0] = 17.720045
distances[17.0][5.5] = 17.867568
distances[17.0][6.0] = 18.027756
distances[17.0][6.5] = 18.200275
distances[17.0][7.0] = 18.384776
distances[17.0][7.5] = 18.580904
distances[17.0][8.0] = 18.788294
distances[17.0][8.5] = 19.006578
distances[17.0][9.0] = 19.235384
distances[17.0][9.5] = 19.474342
distances[17.0][10.0] = 19.723083
distances[17.0][10.5] = 19.981241
distances[17.0][11.0] = 20.248457
distances[17.0][11.5] = 20.524376
distances[17.0][12.0] = 20.808652
distances[17.0][12.5] = 21.100948
distances[17.0][13.0] = 21.400935
distances[17.0][13.5] = 21.708293
distances[17.0][14.0] = 22.022716
distances[17.0][14.5] = 22.343903
distances[17.0][15.0] = 22.671568
distances[17.0][15.5] = 23.005434
distances[17.0][16.0] = 23.345235
distances[17.0][16.5] = 23.690715
distances[17.0][17.0] = 24.041631
distances[17.5] = {}
distances[17.5][0.0] = 17.5
distances[17.5][0.5] = 17.507141
distances[17.5][1.0] = 17.528548
distances[17.5][1.5] = 17.564168
distances[17.5][2.0] = 17.613915
distances[17.5][2.5] = 17.67767
distances[17.5][3.0] = 17.755281
distances[17.5][3.5] = 17.846568
distances[17.5][4.0] = 17.951323
distances[17.5][4.5] = 18.069311
distances[17.5][5.0] = 18.200275
distances[17.5][5.5] = 18.343936
distances[17.5][6.0] = 18.5
distances[17.5][6.5] = 18.668155
distances[17.5][7.0] = 18.848077
distances[17.5][7.5] = 19.039433
distances[17.5][8.0] = 19.241881
distances[17.5][8.5] = 19.455076
distances[17.5][9.0] = 19.678669
distances[17.5][9.5] = 19.912308
distances[17.5][10.0] = 20.155644
distances[17.5][10.5] = 20.408332
distances[17.5][11.0] = 20.670027
distances[17.5][11.5] = 20.940392
distances[17.5][12.0] = 21.219095
distances[17.5][12.5] = 21.505813
distances[17.5][13.0] = 21.800229
distances[17.5][13.5] = 22.102036
distances[17.5][14.0] = 22.410935
distances[17.5][14.5] = 22.726636
distances[17.5][15.0] = 23.048861
distances[17.5][15.5] = 23.377339
distances[17.5][16.0] = 23.711811
distances[17.5][16.5] = 24.052027
distances[17.5][17.0] = 24.397746
distances[17.5][17.5] = 24.748737
distances[18.0] = {}
distances[18.0][0.0] = 18.0
distances[18.0][0.5] = 18.006943
distances[18.0][1.0] = 18.027756
distances[18.0][1.5] = 18.062392
distances[18.0][2.0] = 18.11077
distances[18.0][2.5] = 18.172782
distances[18.0][3.0] = 18.248288
distances[18.0][3.5] = 18.337121
distances[18.0][4.0] = 18.439089
distances[18.0][4.5] = 18.553975
distances[18.0][5.0] = 18.681542
distances[18.0][5.5] = 18.82153
distances[18.0][6.0] = 18.973666
distances[18.0][6.5] = 19.137659
distances[18.0][7.0] = 19.313208
distances[18.0][7.5] = 19.5
distances[18.0][8.0] = 19.697716
distances[18.0][8.5] = 19.906029
distances[18.0][9.0] = 20.124612
distances[18.0][9.5] = 20.353132
distances[18.0][10.0] = 20.59126
distances[18.0][10.5] = 20.838666
distances[18.0][11.0] = 21.095023
distances[18.0][11.5] = 21.360009
distances[18.0][12.0] = 21.633308
distances[18.0][12.5] = 21.914607
distances[18.0][13.0] = 22.203603
distances[18.0][13.5] = 22.5
distances[18.0][14.0] = 22.803509
distances[18.0][14.5] = 23.113849
distances[18.0][15.0] = 23.430749
distances[18.0][15.5] = 23.753947
distances[18.0][16.0] = 24.083189
distances[18.0][16.5] = 24.418231
distances[18.0][17.0] = 24.758837
distances[18.0][17.5] = 25.10478
distances[18.0][18.0] = 25.455844
distances[18.5] = {}
distances[18.5][0.0] = 18.5
distances[18.5][0.5] = 18.506756
distances[18.5][1.0] = 18.527007
distances[18.5][1.5] = 18.560711
distances[18.5][2.0] = 18.607794
distances[18.5][2.5] = 18.668155
distances[18.5][3.0] = 18.741665
distances[18.5][3.5] = 18.82817
distances[18.5][4.0] = 18.927493
distances[18.5][4.5] = 19.039433
distances[18.5][5.0] = 19.163768
distances[18.5][5.5] = 19.300259
distances[18.5][6.0] = 19.44865
distances[18.5][6.5] = 19.608672
distances[18.5][7.0] = 19.78004
distances[18.5][7.5] = 19.962465
distances[18.5][8.0] = 20.155644
distances[18.5][8.5] = 20.359273
distances[18.5][9.0] = 20.573041
distances[18.5][9.5] = 20.796634
distances[18.5][10.0] = 21.029741
distances[18.5][10.5] = 21.272047
distances[18.5][11.0] = 21.523243
distances[18.5][11.5] = 21.783021
distances[18.5][12.0] = 22.051077
distances[18.5][12.5] = 22.327114
distances[18.5][13.0] = 22.610838
distances[18.5][13.5] = 22.901965
distances[18.5][14.0] = 23.200216
distances[18.5][14.5] = 23.505319
distances[18.5][15.0] = 23.817011
distances[18.5][15.5] = 24.135037
distances[18.5][16.0] = 24.45915
distances[18.5][16.5] = 24.789111
distances[18.5][17.0] = 25.124689
distances[18.5][17.5] = 25.465663
distances[18.5][18.0] = 25.811819
distances[18.5][18.5] = 26.162951
distances[19.0] = {}
distances[19.0][0.0] = 19.0
distances[19.0][0.5] = 19.006578
distances[19.0][1.0] = 19.026298
distances[19.0][1.5] = 19.059119
distances[19.0][2.0] = 19.104973
distances[19.0][2.5] = 19.163768
distances[19.0][3.0] = 19.235384
distances[19.0][3.5] = 19.319679
distances[19.0][4.0] = 19.416488
distances[19.0][4.5] = 19.525624
distances[19.0][5.0] = 19.646883
distances[19.0][5.5] = 19.78004
distances[19.0][6.0] = 19.924859
distances[19.0][6.5] = 20.081086
distances[19.0][7.0] = 20.248457
distances[19.0][7.5] = 20.426698
distances[19.0][8.0] = 20.615528
distances[19.0][8.5] = 20.814658
distances[19.0][9.0] = 21.023796
distances[19.0][9.5] = 21.242646
distances[19.0][10.0] = 21.470911
distances[19.0][10.5] = 21.708293
distances[19.0][11.0] = 21.954498
distances[19.0][11.5] = 22.209232
distances[19.0][12.0] = 22.472205
distances[19.0][12.5] = 22.743131
distances[19.0][13.0] = 23.021729
distances[19.0][13.5] = 23.307724
distances[19.0][14.0] = 23.600847
distances[19.0][14.5] = 23.900837
distances[19.0][15.0] = 24.207437
distances[19.0][15.5] = 24.5204
distances[19.0][16.0] = 24.839485
distances[19.0][16.5] = 25.164459
distances[19.0][17.0] = 25.495098
distances[19.0][17.5] = 25.831183
distances[19.0][18.0] = 26.172505
distances[19.0][18.5] = 26.518861
distances[19.0][19.0] = 26.870058
distances[19.5] = {}
distances[19.5][0.0] = 19.5
distances[19.5][0.5] = 19.506409
distances[19.5][1.0] = 19.525624
distances[19.5][1.5] = 19.557607
distances[19.5][2.0] = 19.602296
distances[19.5][2.5] = 19.659603
distances[19.5][3.0] = 19.72942
distances[19.5][3.5] = 19.811613
distances[19.5][4.0] = 19.906029
distances[19.5][4.5] = 20.012496
distances[19.5][5.0] = 20.130822
distances[19.5][5.5] = 20.2608
distances[19.5][6.0] = 20.402206
distances[19.5][6.5] = 20.554805
distances[19.5][7.0] = 20.718349
distances[19.5][7.5] = 20.892582
distances[19.5][8.0] = 21.077239
distances[19.5][8.5] = 21.272047
distances[19.5][9.0] = 21.476732
distances[19.5][9.5] = 21.691012
distances[19.5][10.0] = 21.914607
distances[19.5][10.5] = 22.147235
distances[19.5][11.0] = 22.388613
distances[19.5][11.5] = 22.638463
distances[19.5][12.0] = 22.896506
distances[19.5][12.5] = 23.16247
distances[19.5][13.0] = 23.436083
distances[19.5][13.5] = 23.717082
distances[19.5][14.0] = 24.005208
distances[19.5][14.5] = 24.300206
distances[19.5][15.0] = 24.601829
distances[19.5][15.5] = 24.909837
distances[19.5][16.0] = 25.223997
distances[19.5][16.5] = 25.54408
distances[19.5][17.0] = 25.869867
distances[19.5][17.5] = 26.201145
distances[19.5][18.0] = 26.537709
distances[19.5][18.5] = 26.87936
distances[19.5][19.0] = 27.225907
distances[19.5][19.5] = 27.577164
distances[20.0] = {}
distances[20.0][0.0] = 20.0
distances[20.0][0.5] = 20.006249
distances[20.0][1.0] = 20.024984
distances[20.0][1.5] = 20.056171
distances[20.0][2.0] = 20.099751
distances[20.0][2.5] = 20.155644
distances[20.0][3.0] = 20.223748
distances[20.0][3.5] = 20.303941
distances[20.0][4.0] = 20.396078
distances[20.0][4.5] = 20.5
distances[20.0][5.0] = 20.615528
distances[20.0][5.5] = 20.742469
distances[20.0][6.0] = 20.880613
distances[20.0][6.5] = 21.029741
distances[20.0][7.0] = 21.18962
distances[20.0][7.5] = 21.360009
distances[20.0][8.0] = 21.540659
distances[20.0][8.5] = 21.731314
distances[20.0][9.0] = 21.931712
distances[20.0][9.5] = 22.14159
distances[20.0][10.0] = 22.36068
distances[20.0][10.5] = 22.588714
distances[20.0][11.0] = 22.825424
distances[20.0][11.5] = 23.070544
distances[20.0][12.0] = 23.323808
distances[20.0][12.5] = 23.584953
distances[20.0][13.0] = 23.853721
distances[20.0][13.5] = 24.129857
distances[20.0][14.0] = 24.413111
distances[20.0][14.5] = 24.703239
distances[20.0][15.0] = 25.0
distances[20.0][15.5] = 25.303162
distances[20.0][16.0] = 25.612497
distances[20.0][16.5] = 25.927784
distances[20.0][17.0] = 26.248809
distances[20.0][17.5] = 26.575365
distances[20.0][18.0] = 26.907248
distances[20.0][18.5] = 27.244265
distances[20.0][19.0] = 27.586228
distances[20.0][19.5] = 27.932955
distances[20.0][20.0] = 28.284271
distances[20.5] = {}
distances[20.5][0.0] = 20.5
distances[20.5][0.5] = 20.506097
distances[20.5][1.0] = 20.524376
distances[20.5][1.5] = 20.554805
distances[20.5][2.0] = 20.59733
distances[20.5][2.5] = 20.651876
distances[20.5][3.0] = 20.718349
distances[20.5][3.5] = 20.796634
distances[20.5][4.0] = 20.886599
distances[20.5][4.5] = 20.988092
distances[20.5][5.0] = 21.100948
distances[20.5][5.5] = 21.224985
distances[20.5][6.0] = 21.360009
distances[20.5][6.5] = 21.505813
distances[20.5][7.0] = 21.662179
distances[20.5][7.5] = 21.82888
distances[20.5][8.0] = 22.005681
distances[20.5][8.5] = 22.192341
distances[20.5][9.0] = 22.388613
distances[20.5][9.5] = 22.594247
distances[20.5][10.0] = 22.808989
distances[20.5][10.5] = 23.032586
distances[20.5][11.0] = 23.26478
distances[20.5][11.5] = 23.505319
distances[20.5][12.0] = 23.753947
distances[20.5][12.5] = 24.010414
distances[20.5][13.0] = 24.274472
distances[20.5][13.5] = 24.545875
distances[20.5][14.0] = 24.824383
distances[20.5][14.5] = 25.109759
distances[20.5][15.0] = 25.401772
distances[20.5][15.5] = 25.700195
distances[20.5][16.0] = 26.004807
distances[20.5][16.5] = 26.315395
distances[20.5][17.0] = 26.631748
distances[20.5][17.5] = 26.953664
distances[20.5][18.0] = 27.280946
distances[20.5][18.5] = 27.613403
distances[20.5][19.0] = 27.95085
distances[20.5][19.5] = 28.293109
distances[20.5][20.0] = 28.640007
distances[20.5][20.5] = 28.991378
distances[21.0] = {}
distances[21.0][0.0] = 21.0
distances[21.0][0.5] = 21.005952
distances[21.0][1.0] = 21.023796
distances[21.0][1.5] = 21.053503
distances[21.0][2.0] = 21.095023
distances[21.0][2.5] = 21.148286
distances[21.0][3.0] = 21.213203
distances[21.0][3.5] = 21.289669
distances[21.0][4.0] = 21.377558
distances[21.0][4.5] = 21.476732
distances[21.0][5.0] = 21.587033
distances[21.0][5.5] = 21.708293
distances[21.0][6.0] = 21.84033
distances[21.0][6.5] = 21.982948
distances[21.0][7.0] = 22.135944
distances[21.0][7.5] = 22.299103
distances[21.0][8.0] = 22.472205
distances[21.0][8.5] = 22.655022
distances[21.0][9.0] = 22.847319
distances[21.0][9.5] = 23.048861
distances[21.0][10.0] = 23.259407
distances[21.0][10.5] = 23.478714
distances[21.0][11.0] = 23.706539
distances[21.0][11.5] = 23.94264
distances[21.0][12.0] = 24.186773
distances[21.0][12.5] = 24.438699
distances[21.0][13.0] = 24.698178
distances[21.0][13.5] = 24.964975
distances[21.0][14.0] = 25.238859
distances[21.0][14.5] = 25.5196
distances[21.0][15.0] = 25.806976
distances[21.0][15.5] = 26.100766
distances[21.0][16.0] = 26.400758
distances[21.0][16.5] = 26.706741
distances[21.0][17.0] = 27.018512
distances[21.0][17.5] = 27.335874
distances[21.0][18.0] = 27.658633
distances[21.0][18.5] = 27.986604
distances[21.0][19.0] = 28.319605
distances[21.0][19.5] = 28.65746
distances[21.0][20.0] = 29.0
distances[21.0][20.5] = 29.347061
distances[21.0][21.0] = 29.698485
distances[21.5] = {}
distances[21.5][0.0] = 21.5
distances[21.5][0.5] = 21.505813
distances[21.5][1.0] = 21.523243
distances[21.5][1.5] = 21.552262
distances[21.5][2.0] = 21.592823
distances[21.5][2.5] = 21.644861
distances[21.5][3.0] = 21.708293
distances[21.5][3.5] = 21.783021
distances[21.5][4.0] = 21.868928
distances[21.5][4.5] = 21.965883
distances[21.5][5.0] = 22.07374
distances[21.5][5.5] = 22.192341
distances[21.5][6.0] = 22.321514
distances[21.5][6.5] = 22.461077
distances[21.5][7.0] = 22.610838
distances[21.5][7.5] = 22.770595
distances[21.5][8.0] = 22.940139
distances[21.5][8.5] = 23.119256
distances[21.5][9.0] = 23.307724
distances[21.5][9.5] = 23.505319
distances[21.5][10.0] = 23.711811
distances[21.5][10.5] = 23.926972
distances[21.5][11.0] = 24.150569
distances[21.5][11.5] = 24.382371
distances[21.5][12.0] = 24.622145
distances[21.5][12.5] = 24.86966
distances[21.5][13.0] = 25.124689
distances[21.5][13.5] = 25.387005
distances[21.5][14.0] = 25.656383
distances[21.5][14.5] = 25.932605
distances[21.5][15.0] = 26.215453
distances[21.5][15.5] = 26.504717
distances[21.5][16.0] = 26.800187
distances[21.5][16.5] = 27.10166
distances[21.5][17.0] = 27.40894
distances[21.5][17.5] = 27.721833
distances[21.5][18.0] = 28.04015
distances[21.5][18.5] = 28.363709
distances[21.5][19.0] = 28.692333
distances[21.5][19.5] = 29.025851
distances[21.5][20.0] = 29.364094
distances[21.5][20.5] = 29.706902
distances[21.5][21.0] = 30.054118
distances[21.5][21.5] = 30.405592
distances[22.0] = {}
distances[22.0][0.0] = 22.0
distances[22.0][0.5] = 22.005681
distances[22.0][1.0] = 22.022716
distances[22.0][1.5] = 22.051077
distances[22.0][2.0] = 22.090722
distances[22.0][2.5] = 22.14159
distances[22.0][3.0] = 22.203603
distances[22.0][3.5] = 22.276669
distances[22.0][4.0] = 22.36068
distances[22.0][4.5] = 22.455512
distances[22.0][5.0] = 22.561028
distances[22.0][5.5] = 22.677081
distances[22.0][6.0] = 22.803509
distances[22.0][6.5] = 22.940139
distances[22.0][7.0] = 23.086793
distances[22.0][7.5] = 23.243279
distances[22.0][8.0] = 23.4094
distances[22.0][8.5] = 23.584953
distances[22.0][9.0] = 23.769729
distances[22.0][9.5] = 23.963514
distances[22.0][10.0] = 24.166092
distances[22.0][10.5] = 24.377243
distances[22.0][11.0] = 24.596748
distances[22.0][11.5] = 24.824383
distances[22.0][12.0] = 25.059928
distances[22.0][12.5] = 25.303162
distances[22.0][13.0] = 25.553865
distances[22.0][13.5] = 25.811819
distances[22.0][14.0] = 26.07681
distances[22.0][14.5] = 26.348624
distances[22.0][15.0] = 26.627054
distances[22.0][15.5] = 26.911893
distances[22.0][16.0] = 27.202941
distances[22.0][16.5] = 27.5
distances[22.0][17.0] = 27.802878
distances[22.0][17.5] = 28.111386
distances[22.0][18.0] = 28.425341
distances[22.0][18.5] = 28.744565
distances[22.0][19.0] = 29.068884
distances[22.0][19.5] = 29.398129
distances[22.0][20.0] = 29.732137
distances[22.0][20.5] = 30.07075
distances[22.0][21.0] = 30.413813
distances[22.0][21.5] = 30.761177
distances[22.0][22.0] = 31.112698
distances[22.5] = {}
distances[22.5][0.0] = 22.5
distances[22.5][0.5] = 22.505555
distances[22.5][1.0] = 22.522211
distances[22.5][1.5] = 22.549945
distances[22.5][2.0] = 22.588714
distances[22.5][2.5] = 22.638463
distances[22.5][3.0] = 22.699119
distances[22.5][3.5] = 22.770595
distances[22.5][4.0] = 22.85279
distances[22.5][4.5] = 22.945588
distances[22.5][5.0] = 23.048861
distances[22.5][5.5] = 23.16247
distances[22.5][6.0] = 23.286262
distances[22.5][6.5] = 23.420077
distances[22.5][7.0] = 23.563743
distances[22.5][7.5] = 23.717082
distances[22.5][8.0] = 23.879908
distances[22.5][8.5] = 24.052027
distances[22.5][9.0] = 24.233242
distances[22.5][9.5] = 24.423349
distances[22.5][10.0] = 24.622145
distances[22.5][10.5] = 24.829418
distances[22.5][11.0] = 25.04496
distances[22.5][11.5] = 25.268558
distances[22.5][12.0] = 25.5
distances[22.5][12.5] = 25.739075
distances[22.5][13.0] = 25.985573
distances[22.5][13.5] = 26.239284
distances[22.5][14.0] = 26.5
distances[22.5][14.5] = 26.767518
distances[22.5][15.0] = 27.041635
distances[22.5][15.5] = 27.322152
distances[22.5][16.0] = 27.608875
distances[22.5][16.5] = 27.901613
distances[22.5][17.0] = 28.200177
distances[22.5][17.5] = 28.504386
distances[22.5][18.0] = 28.814059
distances[22.5][18.5] = 29.129023
distances[22.5][19.0] = 29.449109
distances[22.5][19.5] = 29.77415
distances[22.5][20.0] = 30.103986
distances[22.5][20.5] = 30.438463
distances[22.5][21.0] = 30.777427
distances[22.5][21.5] = 31.120733
distances[22.5][22.0] = 31.468238
distances[22.5][22.5] = 31.819805
distances[23.0] = {}
distances[23.0][0.0] = 23.0
distances[23.0][0.5] = 23.005434
distances[23.0][1.0] = 23.021729
distances[23.0][1.5] = 23.048861
distances[23.0][2.0] = 23.086793
distances[23.0][2.5] = 23.135471
distances[23.0][3.0] = 23.194827
distances[23.0][3.5] = 23.26478
distances[23.0][4.0] = 23.345235
distances[23.0][4.5] = 23.436083
distances[23.0][5.0] = 23.537205
distances[23.0][5.5] = 23.648467
distances[23.0][6.0] = 23.769729
distances[23.0][6.5] = 23.900837
distances[23.0][7.0] = 24.041631
distances[23.0][7.5] = 24.191941
distances[23.0][8.0] = 24.351591
distances[23.0][8.5] = 24.5204
distances[23.0][9.0] = 24.698178
distances[23.0][9.5] = 24.884734
distances[23.0][10.0] = 25.079872
distances[23.0][10.5] = 25.283394
distances[23.0][11.0] = 25.495098
distances[23.0][11.5] = 25.714782
distances[23.0][12.0] = 25.942244
distances[23.0][12.5] = 26.17728
distances[23.0][13.0] = 26.41969
distances[23.0][13.5] = 26.669271
distances[23.0][14.0] = 26.925824
distances[23.0][14.5] = 27.189152
distances[23.0][15.0] = 27.45906
distances[23.0][15.5] = 27.735356
distances[23.0][16.0] = 28.017851
distances[23.0][16.5] = 28.30636
distances[23.0][17.0] = 28.600699
distances[23.0][17.5] = 28.900692
distances[23.0][18.0] = 29.206164
distances[23.0][18.5] = 29.516944
distances[23.0][19.0] = 29.832868
distances[23.0][19.5] = 30.153773
distances[23.0][20.0] = 30.479501
distances[23.0][20.5] = 30.809901
distances[23.0][21.0] = 31.144823
distances[23.0][21.5] = 31.484123
distances[23.0][22.0] = 31.827661
distances[23.0][22.5] = 32.175301
distances[23.0][23.0] = 32.526912
distances[23.5] = {}
distances[23.5][0.0] = 23.5
distances[23.5][0.5] = 23.505319
distances[23.5][1.0] = 23.521267
distances[23.5][1.5] = 23.547824
distances[23.5][2.0] = 23.584953
distances[23.5][2.5] = 23.632605
distances[23.5][3.0] = 23.690715
distances[23.5][3.5] = 23.759209
distances[23.5][4.0] = 23.837995
distances[23.5][4.5] = 23.926972
distances[23.5][5.0] = 24.026028
distances[23.5][5.5] = 24.135037
distances[23.5][6.0] = 24.253866
distances[23.5][6.5] = 24.382371
distances[23.5][7.0] = 24.5204
distances[23.5][7.5] = 24.667793
distances[23.5][8.0] = 24.824383
distances[23.5][8.5] = 24.989998
distances[23.5][9.0] = 25.164459
distances[23.5][9.5] = 25.347584
distances[23.5][10.0] = 25.539186
distances[23.5][10.5] = 25.739075
distances[23.5][11.0] = 25.947061
distances[23.5][11.5] = 26.162951
distances[23.5][12.0] = 26.38655
distances[23.5][12.5] = 26.617663
distances[23.5][13.0] = 26.856098
distances[23.5][13.5] = 27.10166
distances[23.5][14.0] = 27.354159
distances[23.5][14.5] = 27.613403
distances[23.5][15.0] = 27.879204
distances[23.5][15.5] = 28.151377
distances[23.5][16.0] = 28.429738
distances[23.5][16.5] = 28.714108
distances[23.5][17.0] = 29.00431
distances[23.5][17.5] = 29.300171
distances[23.5][18.0] = 29.60152
distances[23.5][18.5] = 29.908193
distances[23.5][19.0] = 30.220026
distances[23.5][19.5] = 30.536863
distances[23.5][20.0] = 30.858548
distances[23.5][20.5] = 31.184932
distances[23.5][21.0] = 31.515869
distances[23.5][21.5] = 31.851217
distances[23.5][22.0] = 32.190837
distances[23.5][22.5] = 32.534597
distances[23.5][23.0] = 32.882366
distances[23.5][23.5] = 33.234019
distances[24.0] = {}
distances[24.0][0.0] = 24.0
distances[24.0][0.5] = 24.005208
distances[24.0][1.0] = 24.020824
distances[24.0][1.5] = 24.046829
distances[24.0][2.0] = 24.083189
distances[24.0][2.5] = 24.129857
distances[24.0][3.0] = 24.186773
distances[24.0][3.5] = 24.253866
distances[24.0][4.0] = 24.33105
distances[24.0][4.5] = 24.418231
distances[24.0][5.0] = 24.515301
distances[24.0][5.5] = 24.622145
distances[24.0][6.0] = 24.738634
distances[24.0][6.5] = 24.864634
distances[24.0][7.0] = 25.0
distances[24.0][7.5] = 25.144582
distances[24.0][8.0] = 25.298221
distances[24.0][8.5] = 25.460754
distances[24.0][9.0] = 25.632011
distances[24.0][9.5] = 25.811819
distances[24.0][10.0] = 26.0
distances[24.0][10.5] = 26.196374
distances[24.0][11.0] = 26.400758
distances[24.0][11.5] = 26.612967
distances[24.0][12.0] = 26.832816
distances[24.0][12.5] = 27.060118
distances[24.0][13.0] = 27.294688
distances[24.0][13.5] = 27.53634
distances[24.0][14.0] = 27.784888
distances[24.0][14.5] = 28.04015
distances[24.0][15.0] = 28.301943
distances[24.0][15.5] = 28.570089
distances[24.0][16.0] = 28.84441
distances[24.0][16.5] = 29.124732
distances[24.0][17.0] = 29.410882
distances[24.0][17.5] = 29.702693
distances[24.0][18.0] = 30.0
distances[24.0][18.5] = 30.30264
distances[24.0][19.0] = 30.610456
distances[24.0][19.5] = 30.923292
distances[24.0][20.0] = 31.240999
distances[24.0][20.5] = 31.563428
distances[24.0][21.0] = 31.890437
distances[24.0][21.5] = 32.221887
distances[24.0][22.0] = 32.557641
distances[24.0][22.5] = 32.897568
distances[24.0][23.0] = 33.24154
distances[24.0][23.5] = 33.589433
distances[24.0][24.0] = 33.941125
distances[24.5] = {}
distances[24.5][0.0] = 24.5
distances[24.5][0.5] = 24.505102
distances[24.5][1.0] = 24.5204
distances[24.5][1.5] = 24.545875
distances[24.5][2.0] = 24.581497
distances[24.5][2.5] = 24.627221
distances[24.5][3.0] = 24.68299
distances[24.5][3.5] = 24.748737
distances[24.5][4.0] = 24.824383
distances[24.5][4.5] = 24.909837
distances[24.5][5.0] = 25.005
distances[24.5][5.5] = 25.109759
distances[24.5][6.0] = 25.223997
distances[24.5][6.5] = 25.347584
distances[24.5][7.0] = 25.480385
distances[24.5][7.5] = 25.622256
distances[24.5][8.0] = 25.773048
distances[24.5][8.5] = 25.932605
distances[24.5][9.0] = 26.100766
distances[24.5][9.5] = 26.277367
distances[24.5][10.0] = 26.462237
distances[24.5][10.5] = 26.655206
distances[24.5][11.0] = 26.856098
distances[24.5][11.5] = 27.064737
distances[24.5][12.0] = 27.280946
distances[24.5][12.5] = 27.504545
distances[24.5][13.0] = 27.735356
distances[24.5][13.5] = 27.973201
distances[24.5][14.0] = 28.217902
distances[24.5][14.5] = 28.469282
distances[24.5][15.0] = 28.727165
distances[24.5][15.5] = 28.991378
distances[24.5][16.0] = 29.26175
distances[24.5][16.5] = 29.538111
distances[24.5][17.0] = 29.820295
distances[24.5][17.5] = 30.108138
distances[24.5][18.0] = 30.40148
distances[24.5][18.5] = 30.700163
distances[24.5][19.0] = 31.004032
distances[24.5][19.5] = 31.312937
distances[24.5][20.0] = 31.626729
distances[24.5][20.5] = 31.945266
distances[24.5][21.0] = 32.268406
distances[24.5][21.5] = 32.596012
distances[24.5][22.0] = 32.927952
distances[24.5][22.5] = 33.264095
distances[24.5][23.0] = 33.604315
distances[24.5][23.5] = 33.94849
distances[24.5][24.0] = 34.296501
distances[24.5][24.5] = 34.648232
distances[25.0] = {}
distances[25.0][0.0] = 25.0
distances[25.0][0.5] = 25.005
distances[25.0][1.0] = 25.019992
distances[25.0][1.5] = 25.04496
distances[25.0][2.0] = 25.079872
distances[25.0][2.5] = 25.124689
distances[25.0][3.0] = 25.179357
distances[25.0][3.5] = 25.243811
distances[25.0][4.0] = 25.317978
distances[25.0][4.5] = 25.401772
distances[25.0][5.0] = 25.495098
distances[25.0][5.5] = 25.597851
distances[25.0][6.0] = 25.70992
distances[25.0][6.5] = 25.831183
distances[25.0][7.0] = 25.96151
distances[25.0][7.5] = 26.100766
distances[25.0][8.0] = 26.248809
distances[25.0][8.5] = 26.405492
distances[25.0][9.0] = 26.570661
distances[25.0][9.5] = 26.744158
distances[25.0][10.0] = 26.925824
distances[25.0][10.5] = 27.115494
distances[25.0][11.0] = 27.313001
distances[25.0][11.5] = 27.518176
distances[25.0][12.0] = 27.730849
distances[25.0][12.5] = 27.95085
distances[25.0][13.0] = 28.178006
distances[25.0][13.5] = 28.412145
distances[25.0][14.0] = 28.653098
distances[25.0][14.5] = 28.900692
distances[25.0][15.0] = 29.154759
distances[25.0][15.5] = 29.415132
distances[25.0][16.0] = 29.681644
distances[25.0][16.5] = 29.954132
distances[25.0][17.0] = 30.232433
distances[25.0][17.5] = 30.516389
distances[25.0][18.0] = 30.805844
distances[25.0][18.5] = 31.100643
distances[25.0][19.0] = 31.400637
distances[25.0][19.5] = 31.705678
distances[25.0][20.0] = 32.015621
distances[25.0][20.5] = 32.330326
distances[25.0][21.0] = 32.649655
distances[25.0][21.5] = 32.973474
distances[25.0][22.0] = 33.301652
distances[25.0][22.5] = 33.63406
distances[25.0][23.0] = 33.970576
distances[25.0][23.5] = 34.311077
distances[25.0][24.0] = 34.655447
distances[25.0][24.5] = 35.003571
distances[25.0][25.0] = 35.355339
distances[25.5] = {}
distances[25.5][0.0] = 25.5
distances[25.5][0.5] = 25.504901
distances[25.5][1.0] = 25.5196
distances[25.5][1.5] = 25.54408
distances[25.5][2.0] = 25.578311
distances[25.5][2.5] = 25.622256
distances[25.5][3.0] = 25.675864
distances[25.5][3.5] = 25.739075
distances[25.5][4.0] = 25.811819
distances[25.5][4.5] = 25.894015
distances[25.5][5.0] = 25.985573
distances[25.5][5.5] = 26.086395
distances[25.5][6.0] = 26.196374
distances[25.5][6.5] = 26.315395
distances[25.5][7.0] = 26.443336
distances[25.5][7.5] = 26.580068
distances[25.5][8.0] = 26.725456
distances[25.5][8.5] = 26.87936
distances[25.5][9.0] = 27.041635
distances[25.5][9.5] = 27.21213
distances[25.5][10.0] = 27.390692
distances[25.5][10.5] = 27.577164
distances[25.5][11.0] = 27.771388
distances[25.5][11.5] = 27.973201
distances[25.5][12.0] = 28.182441
distances[25.5][12.5] = 28.398944
distances[25.5][13.0] = 28.622544
distances[25.5][13.5] = 28.853076
distances[25.5][14.0] = 29.090376
distances[25.5][14.5] = 29.33428
distances[25.5][15.0] = 29.584624
distances[25.5][15.5] = 29.841247
distances[25.5][16.0] = 30.103986
distances[25.5][16.5] = 30.372685
distances[25.5][17.0] = 30.647186
distances[25.5][17.5] = 30.927334
distances[25.5][18.0] = 31.212978
distances[25.5][18.5] = 31.503968
distances[25.5][19.0] = 31.800157
distances[25.5][19.5] = 32.101402
distances[25.5][20.0] = 32.407561
distances[25.5][20.5] = 32.718496
distances[25.5][21.0] = 33.034073
distances[25.5][21.5] = 33.35416
distances[25.5][22.0] = 33.678628
distances[25.5][22.5] = 34.007352
distances[25.5][23.0] = 34.34021
distances[25.5][23.5] = 34.677082
distances[25.5][24.0] = 35.017853
distances[25.5][24.5] = 35.362409
distances[25.5][25.0] = 35.710643
distances[25.5][25.5] = 36.062446
distances[26.0] = {}
distances[26.0][0.0] = 26.0
distances[26.0][0.5] = 26.004807
distances[26.0][1.0] = 26.019224
distances[26.0][1.5] = 26.043233
distances[26.0][2.0] = 26.07681
distances[26.0][2.5] = 26.119916
distances[26.0][3.0] = 26.172505
distances[26.0][3.5] = 26.234519
distances[26.0][4.0] = 26.305893
distances[26.0][4.5] = 26.38655
distances[26.0][5.0] = 26.476405
distances[26.0][5.5] = 26.575365
distances[26.0][6.0] = 26.683328
distances[26.0][6.5] = 26.800187
distances[26.0][7.0] = 26.925824
distances[26.0][7.5] = 27.060118
distances[26.0][8.0] = 27.202941
distances[26.0][8.5] = 27.354159
distances[26.0][9.0] = 27.513633
distances[26.0][9.5] = 27.681221
distances[26.0][10.0] = 27.856777
distances[26.0][10.5] = 28.04015
distances[26.0][11.0] = 28.231188
distances[26.0][11.5] = 28.429738
distances[26.0][12.0] = 28.635642
distances[26.0][12.5] = 28.848743
distances[26.0][13.0] = 29.068884
distances[26.0][13.5] = 29.295904
distances[26.0][14.0] = 29.529646
distances[26.0][14.5] = 29.769951
distances[26.0][15.0] = 30.016662
distances[26.0][15.5] = 30.269622
distances[26.0][16.0] = 30.528675
distances[26.0][16.5] = 30.793668
distances[26.0][17.0] = 31.064449
distances[26.0][17.5] = 31.340868
distances[26.0][18.0] = 31.622777
distances[26.0][18.5] = 31.91003
distances[26.0][19.0] = 32.202484
distances[26.0][19.5] = 32.5
distances[26.0][20.0] = 32.802439
distances[26.0][20.5] = 33.109666
distances[26.0][21.0] = 33.42155
distances[26.0][21.5] = 33.737961
distances[26.0][22.0] = 34.058773
distances[26.0][22.5] = 34.383862
distances[26.0][23.0] = 34.71311
distances[26.0][23.5] = 35.046398
distances[26.0][24.0] = 35.383612
distances[26.0][24.5] = 35.724641
distances[26.0][25.0] = 36.069378
distances[26.0][25.5] = 36.417715
distances[26.0][26.0] = 36.769553
distances[26.5] = {}
distances[26.5][0.0] = 26.5
distances[26.5][0.5] = 26.504717
distances[26.5][1.0] = 26.518861
distances[26.5][1.5] = 26.542419
distances[26.5][2.0] = 26.575365
distances[26.5][2.5] = 26.617663
distances[26.5][3.0] = 26.669271
distances[26.5][3.5] = 26.730133
distances[26.5][4.0] = 26.800187
distances[26.5][4.5] = 26.87936
distances[26.5][5.0] = 26.967573
distances[26.5][5.5] = 27.064737
distances[26.5][6.0] = 27.170756
distances[26.5][6.5] = 27.285527
distances[26.5][7.0] = 27.40894
distances[26.5][7.5] = 27.540879
distances[26.5][8.0] = 27.681221
distances[26.5][8.5] = 27.82984
distances[26.5][9.0] = 27.986604
distances[26.5][9.5] = 28.151377
distances[26.5][10.0] = 28.324018
distances[26.5][10.5] = 28.504386
distances[26.5][11.0] = 28.692333
distances[26.5][11.5] = 28.887714
distances[26.5][12.0] = 29.090376
distances[26.5][12.5] = 29.300171
distances[26.5][13.0] = 29.516944
distances[26.5][13.5] = 29.740545
distances[26.5][14.0] = 29.970819
distances[26.5][14.5] = 30.207615
distances[26.5][15.0] = 30.45078
distances[26.5][15.5] = 30.700163
distances[26.5][16.0] = 30.955613
distances[26.5][16.5] = 31.216983
distances[26.5][17.0] = 31.484123
distances[26.5][17.5] = 31.756889
distances[26.5][18.0] = 32.035137
distances[26.5][18.5] = 32.318725
distances[26.5][19.0] = 32.607514
distances[26.5][19.5] = 32.901368
distances[26.5][20.0] = 33.200151
distances[26.5][20.5] = 33.503731
distances[26.5][21.0] = 33.81198
distances[26.5][21.5] = 34.124771
distances[26.5][22.0] = 34.44198
distances[26.5][22.5] = 34.763487
distances[26.5][23.0] = 35.089172
distances[26.5][23.5] = 35.418921
distances[26.5][24.0] = 35.752622
distances[26.5][24.5] = 36.090165
distances[26.5][25.0] = 36.431442
distances[26.5][25.5] = 36.776351
distances[26.5][26.0] = 37.12479
distances[26.5][26.5] = 37.476659
distances[27.0] = {}
distances[27.0][0.0] = 27.0
distances[27.0][0.5] = 27.004629
distances[27.0][1.0] = 27.018512
distances[27.0][1.5] = 27.041635
distances[27.0][2.0] = 27.073973
distances[27.0][2.5] = 27.115494
distances[27.0][3.0] = 27.166155
distances[27.0][3.5] = 27.225907
distances[27.0][4.0] = 27.294688
distances[27.0][4.5] = 27.372431
distances[27.0][5.0] = 27.45906
distances[27.0][5.5] = 27.554491
distances[27.0][6.0] = 27.658633
distances[27.0][6.5] = 27.771388
distances[27.0][7.0] = 27.892651
distances[27.0][7.5] = 28.022313
distances[27.0][8.0] = 28.160256
distances[27.0][8.5] = 28.30636
distances[27.0][9.0] = 28.460499
distances[27.0][9.5] = 28.622544
distances[27.0][10.0] = 28.79236
distances[27.0][10.5] = 28.969812
distances[27.0][11.0] = 29.154759
distances[27.0][11.5] = 29.347061
distances[27.0][12.0] = 29.546573
distances[27.0][12.5] = 29.753151
distances[27.0][13.0] = 29.966648
distances[27.0][13.5] = 30.186918
distances[27.0][14.0] = 30.413813
distances[27.0][14.5] = 30.647186
distances[27.0][15.0] = 30.88689
distances[27.0][15.5] = 31.13278
distances[27.0][16.0] = 31.38471
distances[27.0][16.5] = 31.642535
distances[27.0][17.0] = 31.906112
distances[27.0][17.5] = 32.175301
distances[27.0][18.0] = 32.449961
distances[27.0][18.5] = 32.729956
distances[27.0][19.0] = 33.015148
distances[27.0][19.5] = 33.305405
distances[27.0][20.0] = 33.600595
distances[27.0][20.5] = 33.90059
distances[27.0][21.0] = 34.205263
distances[27.0][21.5] = 34.51449
distances[27.0][22.0] = 34.82815
distances[27.0][22.5] = 35.146124
distances[27.0][23.0] = 35.468296
distances[27.0][23.5] = 35.794553
distances[27.0][24.0] = 36.124784
distances[27.0][24.5] = 36.458881
distances[27.0][25.0] = 36.796739
distances[27.0][25.5] = 37.138255
distances[27.0][26.0] = 37.48333
distances[27.0][26.5] = 37.831865
distances[27.0][27.0] = 38.183766
distances[27.5] = {}
distances[27.5][0.0] = 27.5
distances[27.5][0.5] = 27.504545
distances[27.5][1.0] = 27.518176
distances[27.5][1.5] = 27.540879
distances[27.5][2.0] = 27.572631
distances[27.5][2.5] = 27.613403
distances[27.5][3.0] = 27.663152
distances[27.5][3.5] = 27.721833
distances[27.5][4.0] = 27.789386
distances[27.5][4.5] = 27.86575
distances[27.5][5.0] = 27.95085
distances[27.5][5.5] = 28.044607
distances[27.5][6.0] = 28.146936
distances[27.5][6.5] = 28.257742
distances[27.5][7.0] = 28.376927
distances[27.5][7.5] = 28.504386
distances[27.5][8.0] = 28.640007
distances[27.5][8.5] = 28.783676
distances[27.5][9.0] = 28.935273
distances[27.5][9.5] = 29.094673
distances[27.5][10.0] = 29.26175
distances[27.5][10.5] = 29.436372
distances[27.5][11.0] = 29.618406
distances[27.5][11.5] = 29.807717
distances[27.5][12.0] = 30.004166
distances[27.5][12.5] = 30.207615
distances[27.5][13.0] = 30.417922
distances[27.5][13.5] = 30.634947
distances[27.5][14.0] = 30.858548
distances[27.5][14.5] = 31.088583
distances[27.5][15.0] = 31.32491
distances[27.5][15.5] = 31.567388
distances[27.5][16.0] = 31.815877
distances[27.5][16.5] = 32.070235
distances[27.5][17.0] = 32.330326
distances[27.5][17.5] = 32.596012
distances[27.5][18.0] = 32.867157
distances[27.5][18.5] = 33.143627
distances[27.5][19.0] = 33.42529
distances[27.5][19.5] = 33.712016
distances[27.5][20.0] = 34.003676
distances[27.5][20.5] = 34.300146
distances[27.5][21.0] = 34.601301
distances[27.5][21.5] = 34.907019
distances[27.5][22.0] = 35.217183
distances[27.5][22.5] = 35.531676
distances[27.5][23.0] = 35.850384
distances[27.5][23.5] = 36.173194
distances[27.5][24.0] = 36.5
distances[27.5][24.5] = 36.830694
distances[27.5][25.0] = 37.165172
distances[27.5][25.5] = 37.503333
distances[27.5][26.0] = 37.845079
distances[27.5][26.5] = 38.190313
distances[27.5][27.0] = 38.538941
distances[27.5][27.5] = 38.890873
distances[28.0] = {}
distances[28.0][0.0] = 28.0
distances[28.0][0.5] = 28.004464
distances[28.0][1.0] = 28.017851
distances[28.0][1.5] = 28.04015
distances[28.0][2.0] = 28.071338
distances[28.0][2.5] = 28.111386
distances[28.0][3.0] = 28.160256
distances[28.0][3.5] = 28.217902
distances[28.0][4.0] = 28.284271
distances[28.0][4.5] = 28.359302
distances[28.0][5.0] = 28.442925
distances[28.0][5.5] = 28.535066
distances[28.0][6.0] = 28.635642
distances[28.0][6.5] = 28.744565
distances[28.0][7.0] = 28.861739
distances[28.0][7.5] = 28.987066
distances[28.0][8.0] = 29.12044
distances[28.0][8.5] = 29.26175
distances[28.0][9.0] = 29.410882
distances[28.0][9.5] = 29.567719
distances[28.0][10.0] = 29.732137
distances[28.0][10.5] = 29.904013
distances[28.0][11.0] = 30.083218
distances[28.0][11.5] = 30.269622
distances[28.0][12.0] = 30.463092
distances[28.0][12.5] = 30.663496
distances[28.0][13.0] = 30.870698
distances[28.0][13.5] = 31.084562
distances[28.0][14.0] = 31.304952
distances[28.0][14.5] = 31.53173
distances[28.0][15.0] = 31.76476
distances[28.0][15.5] = 32.003906
distances[28.0][16.0] = 32.249031
distances[28.0][16.5] = 32.5
distances[28.0][17.0] = 32.756679
distances[28.0][17.5] = 33.018934
distances[28.0][18.0] = 33.286634
distances[28.0][18.5] = 33.559648
distances[28.0][19.0] = 33.837849
distances[28.0][19.5] = 34.121108
distances[28.0][20.0] = 34.409301
distances[28.0][20.5] = 34.702305
distances[28.0][21.0] = 35.0
distances[28.0][21.5] = 35.302266
distances[28.0][22.0] = 35.608988
distances[28.0][22.5] = 35.92005
distances[28.0][23.0] = 36.235342
distances[28.0][23.5] = 36.554753
distances[28.0][24.0] = 36.878178
distances[28.0][24.5] = 37.20551
distances[28.0][25.0] = 37.536649
distances[28.0][25.5] = 37.871493
distances[28.0][26.0] = 38.209946
distances[28.0][26.5] = 38.551913
distances[28.0][27.0] = 38.897301
distances[28.0][27.5] = 39.246019
distances[28.0][28.0] = 39.59798
distances[28.5] = {}
distances[28.5][0.0] = 28.5
distances[28.5][0.5] = 28.504386
distances[28.5][1.0] = 28.517538
distances[28.5][1.5] = 28.539446
distances[28.5][2.0] = 28.570089
distances[28.5][2.5] = 28.609439
distances[28.5][3.0] = 28.65746
distances[28.5][3.5] = 28.714108
distances[28.5][4.0] = 28.779333
distances[28.5][4.5] = 28.853076
distances[28.5][5.0] = 28.935273
distances[28.5][5.5] = 29.025851
distances[28.5][6.0] = 29.124732
distances[28.5][6.5] = 29.231832
distances[28.5][7.0] = 29.347061
distances[28.5][7.5] = 29.470324
distances[28.5][8.0] = 29.60152
distances[28.5][8.5] = 29.740545
distances[28.5][9.0] = 29.887288
distances[28.5][9.5] = 30.041638
distances[28.5][10.0] = 30.203477
distances[28.5][10.5] = 30.372685
distances[28.5][11.0] = 30.549141
distances[28.5][11.5] = 30.732719
distances[28.5][12.0] = 30.923292
distances[28.5][12.5] = 31.120733
distances[28.5][13.0] = 31.32491
distances[28.5][13.5] = 31.535694
distances[28.5][14.0] = 31.752953
distances[28.5][14.5] = 31.976554
distances[28.5][15.0] = 32.206366
distances[28.5][15.5] = 32.442256
distances[28.5][16.0] = 32.684094
distances[28.5][16.5] = 32.931748
distances[28.5][17.0] = 33.185087
distances[28.5][17.5] = 33.443983
distances[28.5][18.0] = 33.708308
distances[28.5][18.5] = 33.977934
distances[28.5][19.0] = 34.252737
distances[28.5][19.5] = 34.532593
distances[28.5][20.0] = 34.817381
distances[28.5][20.5] = 35.106979
distances[28.5][21.0] = 35.401271
distances[28.5][21.5] = 35.70014
distances[28.5][22.0] = 36.003472
distances[28.5][22.5] = 36.311155
distances[28.5][23.0] = 36.62308
distances[28.5][23.5] = 36.939139
distances[28.5][24.0] = 37.259227
distances[28.5][24.5] = 37.583241
distances[28.5][25.0] = 37.91108
distances[28.5][25.5] = 38.242646
distances[28.5][26.0] = 38.577843
distances[28.5][26.5] = 38.916577
distances[28.5][27.0] = 39.258757
distances[28.5][27.5] = 39.604293
distances[28.5][28.0] = 39.953098
distances[28.5][28.5] = 40.305087
distances[29.0] = {}
distances[29.0][0.0] = 29.0
distances[29.0][0.5] = 29.00431
distances[29.0][1.0] = 29.017236
distances[29.0][1.5] = 29.038767
distances[29.0][2.0] = 29.068884
distances[29.0][2.5] = 29.107559
distances[29.0][3.0] = 29.154759
distances[29.0][3.5] = 29.210443
distances[29.0][4.0] = 29.274562
distances[29.0][4.5] = 29.347061
distances[29.0][5.0] = 29.427878
distances[29.0][5.5] = 29.516944
distances[29.0][6.0] = 29.614186
distances[29.0][6.5] = 29.719522
distances[29.0][7.0] = 29.832868
distances[29.0][7.5] = 29.954132
distances[29.0][8.0] = 30.083218
distances[29.0][8.5] = 30.220026
distances[29.0][9.0] = 30.364453
distances[29.0][9.5] = 30.516389
distances[29.0][10.0] = 30.675723
distances[29.0][10.5] = 30.842341
distances[29.0][11.0] = 31.016125
distances[29.0][11.5] = 31.196955
distances[29.0][12.0] = 31.38471
distances[29.0][12.5] = 31.579265
distances[29.0][13.0] = 31.780497
distances[29.0][13.5] = 31.988279
distances[29.0][14.0] = 32.202484
distances[29.0][14.5] = 32.422986
distances[29.0][15.0] = 32.649655
distances[29.0][15.5] = 32.882366
distances[29.0][16.0] = 33.12099
distances[29.0][16.5] = 33.365401
distances[29.0][17.0] = 33.615473
distances[29.0][17.5] = 33.871079
distances[29.0][18.0] = 34.132096
distances[29.0][18.5] = 34.398401
distances[29.0][19.0] = 34.669872
distances[29.0][19.5] = 34.946388
distances[29.0][20.0] = 35.22783
distances[29.0][20.5] = 35.514082
distances[29.0][21.0] = 35.805028
distances[29.0][21.5] = 36.100554
distances[29.0][22.0] = 36.400549
distances[29.0][22.5] = 36.704904
distances[29.0][23.0] = 37.013511
distances[29.0][23.5] = 37.326264
distances[29.0][24.0] = 37.64306
distances[29.0][24.5] = 37.963799
distances[29.0][25.0] = 38.288379
distances[29.0][25.5] = 38.616706
distances[29.0][26.0] = 38.948684
distances[29.0][26.5] = 39.284221
distances[29.0][27.0] = 39.623226
distances[29.0][27.5] = 39.96561
distances[29.0][28.0] = 40.311289
distances[29.0][28.5] = 40.660177
distances[29.0][29.0] = 41.012193
distances[29.5] = {}
distances[29.5][0.0] = 29.5
distances[29.5][0.5] = 29.504237
distances[29.5][1.0] = 29.516944
distances[29.5][1.5] = 29.538111
distances[29.5][2.0] = 29.567719
distances[29.5][2.5] = 29.605743
distances[29.5][3.0] = 29.65215
distances[29.5][3.5] = 29.706902
distances[29.5][4.0] = 29.769951
distances[29.5][4.5] = 29.841247
distances[29.5][5.0] = 29.920729
distances[29.5][5.5] = 30.008332
distances[29.5][6.0] = 30.103986
distances[29.5][6.5] = 30.207615
distances[29.5][7.0] = 30.319136
distances[29.5][7.5] = 30.438463
distances[29.5][8.0] = 30.565503
distances[29.5][8.5] = 30.700163
distances[29.5][9.0] = 30.842341
distances[29.5][9.5] = 30.991934
distances[29.5][10.0] = 31.148836
distances[29.5][10.5] = 31.312937
distances[29.5][11.0] = 31.484123
distances[29.5][11.5] = 31.66228
distances[29.5][12.0] = 31.847292
distances[29.5][12.5] = 32.039039
distances[29.5][13.0] = 32.237401
distances[29.5][13.5] = 32.442256
distances[29.5][14.0] = 32.653484
distances[29.5][14.5] = 32.87096
distances[29.5][15.0] = 33.094561
distances[29.5][15.5] = 33.324165
distances[29.5][16.0] = 33.559648
distances[29.5][16.5] = 33.800888
distances[29.5][17.0] = 34.047761
distances[29.5][17.5] = 34.300146
distances[29.5][18.0] = 34.557922
distances[29.5][18.5] = 34.820971
distances[29.5][19.0] = 35.089172
distances[29.5][19.5] = 35.362409
distances[29.5][20.0] = 35.640567
distances[29.5][20.5] = 35.92353
distances[29.5][21.0] = 36.211186
distances[29.5][21.5] = 36.503424
distances[29.5][22.0] = 36.800136
distances[29.5][22.5] = 37.101213
distances[29.5][23.0] = 37.40655
distances[29.5][23.5] = 37.716044
distances[29.5][24.0] = 38.029594
distances[29.5][24.5] = 38.347099
distances[29.5][25.0] = 38.668463
distances[29.5][25.5] = 38.993589
distances[29.5][26.0] = 39.322385
distances[29.5][26.5] = 39.65476
distances[29.5][27.0] = 39.990624
distances[29.5][27.5] = 40.32989
distances[29.5][28.0] = 40.672472
distances[29.5][28.5] = 41.018289
distances[29.5][29.0] = 41.367258
distances[29.5][29.5] = 41.7193
distances[30.0] = {}
distances[30.0][0.0] = 30.0
distances[30.0][0.5] = 30.004166
distances[30.0][1.0] = 30.016662
distances[30.0][1.5] = 30.037477
distances[30.0][2.0] = 30.066593
distances[30.0][2.5] = 30.103986
distances[30.0][3.0] = 30.149627
distances[30.0][3.5] = 30.203477
distances[30.0][4.0] = 30.265492
distances[30.0][4.5] = 30.335623
distances[30.0][5.0] = 30.413813
distances[30.0][5.5] = 30.5
distances[30.0][6.0] = 30.594117
distances[30.0][6.5] = 30.696091
distances[30.0][7.0] = 30.805844
distances[30.0][7.5] = 30.923292
distances[30.0][8.0] = 31.048349
distances[30.0][8.5] = 31.180924
distances[30.0][9.0] = 31.32092
distances[30.0][9.5] = 31.468238
distances[30.0][10.0] = 31.622777
distances[30.0][10.5] = 31.78443
distances[30.0][11.0] = 31.953091
distances[30.0][11.5] = 32.128648
distances[30.0][12.0] = 32.310989
distances[30.0][12.5] = 32.5
distances[30.0][13.0] = 32.695565
distances[30.0][13.5] = 32.897568
distances[30.0][14.0] = 33.105891
distances[30.0][14.5] = 33.320414
distances[30.0][15.0] = 33.54102
distances[30.0][15.5] = 33.767588
distances[30.0][16.0] = 34.0
distances[30.0][16.5] = 34.238137
distances[30.0][17.0] = 34.481879
distances[30.0][17.5] = 34.73111
distances[30.0][18.0] = 34.985711
distances[30.0][18.5] = 35.245567
distances[30.0][19.0] = 35.510562
distances[30.0][19.5] = 35.780581
distances[30.0][20.0] = 36.055513
distances[30.0][20.5] = 36.335245
distances[30.0][21.0] = 36.619667
distances[30.0][21.5] = 36.908671
distances[30.0][22.0] = 37.20215
distances[30.0][22.5] = 37.5
distances[30.0][23.0] = 37.802116
distances[30.0][23.5] = 38.108398
distances[30.0][24.0] = 38.418745
distances[30.0][24.5] = 38.733061
distances[30.0][25.0] = 39.051248
distances[30.0][25.5] = 39.373214
distances[30.0][26.0] = 39.698866
distances[30.0][26.5] = 40.028115
distances[30.0][27.0] = 40.360872
distances[30.0][27.5] = 40.697051
distances[30.0][28.0] = 41.036569
distances[30.0][28.5] = 41.379343
distances[30.0][29.0] = 41.725292
distances[30.0][29.5] = 42.074339
distances[30.0][30.0] = 42.426407
distances[30.5] = {}
distances[30.5][0.0] = 30.5
distances[30.5][0.5] = 30.504098
distances[30.5][1.0] = 30.516389
distances[30.5][1.5] = 30.536863
distances[30.5][2.0] = 30.565503
distances[30.5][2.5] = 30.602287
distances[30.5][3.0] = 30.647186
distances[30.5][3.5] = 30.700163
distances[30.5][4.0] = 30.761177
distances[30.5][4.5] = 30.83018
distances[30.5][5.0] = 30.907119
distances[30.5][5.5] = 30.991934
distances[30.5][6.0] = 31.084562
distances[30.5][6.5] = 31.184932
distances[30.5][7.0] = 31.29297
distances[30.5][7.5] = 31.408598
distances[30.5][8.0] = 31.53173
distances[30.5][8.5] = 31.66228
distances[30.5][9.0] = 31.800157
distances[30.5][9.5] = 31.945266
distances[30.5][10.0] = 32.097508
distances[30.5][10.5] = 32.256782
distances[30.5][11.0] = 32.422986
distances[30.5][11.5] = 32.596012
distances[30.5][12.0] = 32.775753
distances[30.5][12.5] = 32.962099
distances[30.5][13.0] = 33.154939
distances[30.5][13.5] = 33.35416
distances[30.5][14.0] = 33.559648
distances[30.5][14.5] = 33.77129
distances[30.5][15.0] = 33.988969
distances[30.5][15.5] = 34.212571
distances[30.5][16.0] = 34.44198
distances[30.5][16.5] = 34.677082
distances[30.5][17.0] = 34.917761
distances[30.5][17.5] = 35.163902
distances[30.5][18.0] = 35.415392
distances[30.5][18.5] = 35.672118
distances[30.5][19.0] = 35.933967
distances[30.5][19.5] = 36.200829
distances[30.5][20.0] = 36.472592
distances[30.5][20.5] = 36.74915
distances[30.5][21.0] = 37.030393
distances[30.5][21.5] = 37.316216
distances[30.5][22.0] = 37.606515
distances[30.5][22.5] = 37.901187
distances[30.5][23.0] = 38.200131
distances[30.5][23.5] = 38.503247
distances[30.5][24.0] = 38.810437
distances[30.5][24.5] = 39.121605
distances[30.5][25.0] = 39.436658
distances[30.5][25.5] = 39.755503
distances[30.5][26.0] = 40.078049
distances[30.5][26.5] = 40.404208
distances[30.5][27.0] = 40.733893
distances[30.5][27.5] = 41.067018
distances[30.5][28.0] = 41.403502
distances[30.5][28.5] = 41.743263
distances[30.5][29.0] = 42.086221
distances[30.5][29.5] = 42.432299
distances[30.5][30.0] = 42.781421
distances[30.5][30.5] = 43.133514
distances[31.0] = {}
distances[31.0][0.0] = 31.0
distances[31.0][0.5] = 31.004032
distances[31.0][1.0] = 31.016125
distances[31.0][1.5] = 31.036269
distances[31.0][2.0] = 31.064449
distances[31.0][2.5] = 31.100643
distances[31.0][3.0] = 31.144823
distances[31.0][3.5] = 31.196955
distances[31.0][4.0] = 31.256999
distances[31.0][4.5] = 31.32491
distances[31.0][5.0] = 31.400637
distances[31.0][5.5] = 31.484123
distances[31.0][6.0] = 31.575307
distances[31.0][6.5] = 31.674122
distances[31.0][7.0] = 31.780497
distances[31.0][7.5] = 31.894357
distances[31.0][8.0] = 32.015621
distances[31.0][8.5] = 32.144206
distances[31.0][9.0] = 32.280025
distances[31.0][9.5] = 32.422986
distances[31.0][10.0] = 32.572995
distances[31.0][10.5] = 32.729956
distances[31.0][11.0] = 32.893768
distances[31.0][11.5] = 33.064331
distances[31.0][12.0] = 33.24154
distances[31.0][12.5] = 33.42529
distances[31.0][13.0] = 33.615473
distances[31.0][13.5] = 33.81198
distances[31.0][14.0] = 34.014703
distances[31.0][14.5] = 34.22353
distances[31.0][15.0] = 34.438351
distances[31.0][15.5] = 34.659054
distances[31.0][16.0] = 34.885527
distances[31.0][16.5] = 35.117659
distances[31.0][17.0] = 35.355339
distances[31.0][17.5] = 35.598455
distances[31.0][18.0] = 35.846897
distances[31.0][18.5] = 36.100554
distances[31.0][19.0] = 36.359318
distances[31.0][19.5] = 36.62308
distances[31.0][20.0] = 36.891733
distances[31.0][20.5] = 37.165172
distances[31.0][21.0] = 37.44329
distances[31.0][21.5] = 37.725986
distances[31.0][22.0] = 38.013156
distances[31.0][22.5] = 38.304699
distances[31.0][23.0] = 38.600518
distances[31.0][23.5] = 38.900514
distances[31.0][24.0] = 39.204592
distances[31.0][24.5] = 39.512656
distances[31.0][25.0] = 39.824616
distances[31.0][25.5] = 40.140379
distances[31.0][26.0] = 40.459857
distances[31.0][26.5] = 40.782962
distances[31.0][27.0] = 41.10961
distances[31.0][27.5] = 41.439715
distances[31.0][28.0] = 41.773197
distances[31.0][28.5] = 42.109975
distances[31.0][29.0] = 42.449971
distances[31.0][29.5] = 42.793107
distances[31.0][30.0] = 43.139309
distances[31.0][30.5] = 43.488504
distances[31.0][31.0] = 43.84062
distances[31.5] = {}
distances[31.5][0.0] = 31.5
distances[31.5][0.5] = 31.503968
distances[31.5][1.0] = 31.515869
distances[31.5][1.5] = 31.535694
distances[31.5][2.0] = 31.563428
distances[31.5][2.5] = 31.599051
distances[31.5][3.0] = 31.642535
distances[31.5][3.5] = 31.693848
distances[31.5][4.0] = 31.752953
distances[31.5][4.5] = 31.819805
distances[31.5][5.0] = 31.894357
distances[31.5][5.5] = 31.976554
distances[31.5][6.0] = 32.066337
distances[31.5][6.5] = 32.163644
distances[31.5][7.0] = 32.268406
distances[31.5][7.5] = 32.38055
distances[31.5][8.0] = 32.5
distances[31.5][8.5] = 32.626676
distances[31.5][9.0] = 32.760495
distances[31.5][9.5] = 32.901368
distances[31.5][10.0] = 33.049206
distances[31.5][10.5] = 33.203915
distances[31.5][11.0] = 33.365401
distances[31.5][11.5] = 33.533565
distances[31.5][12.0] = 33.708308
distances[31.5][12.5] = 33.889526
distances[31.5][13.0] = 34.077118
distances[31.5][13.5] = 34.270979
distances[31.5][14.0] = 34.471002
distances[31.5][14.5] = 34.677082
distances[31.5][15.0] = 34.88911
distances[31.5][15.5] = 35.106979
distances[31.5][16.0] = 35.330582
distances[31.5][16.5] = 35.559809
distances[31.5][17.0] = 35.794553
distances[31.5][17.5] = 36.034705
distances[31.5][18.0] = 36.28016
distances[31.5][18.5] = 36.530809
distances[31.5][19.0] = 36.786546
distances[31.5][19.5] = 37.047267
distances[31.5][20.0] = 37.312866
distances[31.5][20.5] = 37.583241
distances[31.5][21.0] = 37.858288
distances[31.5][21.5] = 38.137908
distances[31.5][22.0] = 38.421999
distances[31.5][22.5] = 38.710464
distances[31.5][23.0] = 39.003205
distances[31.5][23.5] = 39.300127
distances[31.5][24.0] = 39.601136
distances[31.5][24.5] = 39.90614
distances[31.5][25.0] = 40.215047
distances[31.5][25.5] = 40.527768
distances[31.5][26.0] = 40.844216
distances[31.5][26.5] = 41.164305
distances[31.5][27.0] = 41.48795
distances[31.5][27.5] = 41.815069
distances[31.5][28.0] = 42.145581
distances[31.5][28.5] = 42.479407
distances[31.5][29.0] = 42.816469
distances[31.5][29.5] = 43.156691
distances[31.5][30.0] = 43.5
distances[31.5][30.5] = 43.846323
distances[31.5][31.0] = 44.195588
distances[31.5][31.5] = 44.547727
distances[32.0] = {}
distances[32.0][0.0] = 32.0
distances[32.0][0.5] = 32.003906
distances[32.0][1.0] = 32.015621
distances[32.0][1.5] = 32.035137
distances[32.0][2.0] = 32.062439
distances[32.0][2.5] = 32.097508
distances[32.0][3.0] = 32.140317
distances[32.0][3.5] = 32.190837
distances[32.0][4.0] = 32.249031
distances[32.0][4.5] = 32.314857
distances[32.0][5.0] = 32.388269
distances[32.0][5.5] = 32.469216
distances[32.0][6.0] = 32.557641
distances[32.0][6.5] = 32.653484
distances[32.0][7.0] = 32.756679
distances[32.0][7.5] = 32.867157
distances[32.0][8.0] = 32.984845
distances[32.0][8.5] = 33.109666
distances[32.0][9.0] = 33.24154
distances[32.0][9.5] = 33.380383
distances[32.0][10.0] = 33.526109
distances[32.0][10.5] = 33.678628
distances[32.0][11.0] = 33.837849
distances[32.0][11.5] = 34.003676
distances[32.0][12.0] = 34.176015
distances[32.0][12.5] = 34.354767
distances[32.0][13.0] = 34.539832
distances[32.0][13.5] = 34.73111
distances[32.0][14.0] = 34.928498
distances[32.0][14.5] = 35.131894
distances[32.0][15.0] = 35.341194
distances[32.0][15.5] = 35.556293
distances[32.0][16.0] = 35.777088
distances[32.0][16.5] = 36.003472
distances[32.0][17.0] = 36.235342
distances[32.0][17.5] = 36.472592
distances[32.0][18.0] = 36.71512
distances[32.0][18.5] = 36.962819
distances[32.0][19.0] = 37.215588
distances[32.0][19.5] = 37.473324
distances[32.0][20.0] = 37.735925
distances[32.0][20.5] = 38.003289
distances[32.0][21.0] = 38.275318
distances[32.0][21.5] = 38.551913
distances[32.0][22.0] = 38.832976
distances[32.0][22.5] = 39.11841
distances[32.0][23.0] = 39.408121
distances[32.0][23.5] = 39.702015
distances[32.0][24.0] = 40.0
distances[32.0][24.5] = 40.301985
distances[32.0][25.0] = 40.607881
distances[32.0][25.5] = 40.9176
distances[32.0][26.0] = 41.231056
distances[32.0][26.5] = 41.548165
distances[32.0][27.0] = 41.868843
distances[32.0][27.5] = 42.193009
distances[32.0][28.0] = 42.520583
distances[32.0][28.5] = 42.851488
distances[32.0][29.0] = 43.185646
distances[32.0][29.5] = 43.522982
distances[32.0][30.0] = 43.863424
distances[32.0][30.5] = 44.2069
distances[32.0][31.0] = 44.553339
distances[32.0][31.5] = 44.902673
distances[32.0][32.0] = 45.254834
distances[32.5] = {}
distances[32.5][0.0] = 32.5
distances[32.5][0.5] = 32.503846
distances[32.5][1.0] = 32.515381
distances[32.5][1.5] = 32.534597
distances[32.5][2.0] = 32.56148
distances[32.5][2.5] = 32.596012
distances[32.5][3.0] = 32.638168
distances[32.5][3.5] = 32.687918
distances[32.5][4.0] = 32.745229
distances[32.5][4.5] = 32.810059
distances[32.5][5.0] = 32.882366
distances[32.5][5.5] = 32.962099
distances[32.5][6.0] = 33.049206
distances[32.5][6.5] = 33.143627
distances[32.5][7.0] = 33.2453
distances[32.5][7.5] = 33.35416
distances[32.5][8.0] = 33.470136
distances[32.5][8.5] = 33.593154
distances[32.5][9.0] = 33.723137
distances[32.5][9.5] = 33.860006
distances[32.5][10.0] = 34.003676
distances[32.5][10.5] = 34.154063
distances[32.5][11.0] = 34.311077
distances[32.5][11.5] = 34.474628
distances[32.5][12.0] = 34.644624
distances[32.5][12.5] = 34.820971
distances[32.5][13.0] = 35.003571
distances[32.5][13.5] = 35.192329
distances[32.5][14.0] = 35.387145
distances[32.5][14.5] = 35.587919
distances[32.5][15.0] = 35.794553
distances[32.5][15.5] = 36.006944
distances[32.5][16.0] = 36.224991
distances[32.5][16.5] = 36.448594
distances[32.5][17.0] = 36.67765
distances[32.5][17.5] = 36.912058
distances[32.5][18.0] = 37.151716
distances[32.5][18.5] = 37.396524
distances[32.5][19.0] = 37.646381
distances[32.5][19.5] = 37.901187
distances[32.5][20.0] = 38.160844
distances[32.5][20.5] = 38.425252
distances[32.5][21.0] = 38.694315
distances[32.5][21.5] = 38.967936
distances[32.5][22.0] = 39.246019
distances[32.5][22.5] = 39.528471
distances[32.5][23.0] = 39.815198
distances[32.5][23.5] = 40.106109
distances[32.5][24.0] = 40.401114
distances[32.5][24.5] = 40.700123
distances[32.5][25.0] = 41.003049
distances[32.5][25.5] = 41.309805
distances[32.5][26.0] = 41.620308
distances[32.5][26.5] = 41.934473
distances[32.5][27.0] = 42.252219
distances[32.5][27.5] = 42.573466
distances[32.5][28.0] = 42.898135
distances[32.5][28.5] = 43.226149
distances[32.5][29.0] = 43.557433
distances[32.5][29.5] = 43.891913
distances[32.5][30.0] = 44.229515
distances[32.5][30.5] = 44.570169
distances[32.5][31.0] = 44.913806
distances[32.5][31.5] = 45.260358
distances[32.5][32.0] = 45.609758
distances[32.5][32.5] = 45.961941
distances[33.0] = {}
distances[33.0][0.0] = 33.0
distances[33.0][0.5] = 33.003788
distances[33.0][1.0] = 33.015148
distances[33.0][1.5] = 33.034073
distances[33.0][2.0] = 33.060551
distances[33.0][2.5] = 33.094561
distances[33.0][3.0] = 33.136083
distances[33.0][3.5] = 33.185087
distances[33.0][4.0] = 33.24154
distances[33.0][4.5] = 33.305405
distances[33.0][5.0] = 33.376639
distances[33.0][5.5] = 33.455194
distances[33.0][6.0] = 33.54102
distances[33.0][6.5] = 33.63406
distances[33.0][7.0] = 33.734256
distances[33.0][7.5] = 33.841543
distances[33.0][8.0] = 33.955854
distances[33.0][8.5] = 34.077118
distances[33.0][9.0] = 34.205263
distances[33.0][9.5] = 34.34021
distances[33.0][10.0] = 34.481879
distances[33.0][10.5] = 34.630189
distances[33.0][11.0] = 34.785054
distances[33.0][11.5] = 34.946388
distances[33.0][12.0] = 35.1141
distances[33.0][12.5] = 35.2881
distances[33.0][13.0] = 35.468296
distances[33.0][13.5] = 35.654593
distances[33.0][14.0] = 35.846897
distances[33.0][14.5] = 36.045111
distances[33.0][15.0] = 36.249138
distances[33.0][15.5] = 36.458881
distances[33.0][16.0] = 36.674242
distances[33.0][16.5] = 36.895122
distances[33.0][17.0] = 37.121422
distances[33.0][17.5] = 37.353045
distances[33.0][18.0] = 37.589892
distances[33.0][18.5] = 37.831865
distances[33.0][19.0] = 38.078866
distances[33.0][19.5] = 38.330797
distances[33.0][20.0] = 38.587563
distances[33.0][20.5] = 38.849067
distances[33.0][21.0] = 39.115214
distances[33.0][21.5] = 39.385911
distances[33.0][22.0] = 39.661064
distances[33.0][22.5] = 39.940581
distances[33.0][23.0] = 40.224371
distances[33.0][23.5] = 40.512344
distances[33.0][24.0] = 40.804412
distances[33.0][24.5] = 41.100487
distances[33.0][25.0] = 41.400483
distances[33.0][25.5] = 41.704316
distances[33.0][26.0] = 42.011903
distances[33.0][26.5] = 42.323162
distances[33.0][27.0] = 42.638011
distances[33.0][27.5] = 42.956373
distances[33.0][28.0] = 43.27817
distances[33.0][28.5] = 43.603326
distances[33.0][29.0] = 43.931765
distances[33.0][29.5] = 44.263416
distances[33.0][30.0] = 44.598206
distances[33.0][30.5] = 44.936066
distances[33.0][31.0] = 45.276926
distances[33.0][31.5] = 45.620719
distances[33.0][32.0] = 45.96738
distances[33.0][32.5] = 46.316844
distances[33.0][33.0] = 46.669048
distances[33.5] = {}
distances[33.5][0.0] = 33.5
distances[33.5][0.5] = 33.503731
distances[33.5][1.0] = 33.514922
distances[33.5][1.5] = 33.533565
distances[33.5][2.0] = 33.559648
distances[33.5][2.5] = 33.593154
distances[33.5][3.0] = 33.63406
distances[33.5][3.5] = 33.68234
distances[33.5][4.0] = 33.737961
distances[33.5][4.5] = 33.800888
distances[33.5][5.0] = 33.871079
distances[33.5][5.5] = 33.94849
distances[33.5][6.0] = 34.033072
distances[33.5][6.5] = 34.124771
distances[33.5][7.0] = 34.22353
distances[33.5][7.5] = 34.329288
distances[33.5][8.0] = 34.44198
distances[33.5][8.5] = 34.561539
distances[33.5][9.0] = 34.687894
distances[33.5][9.5] = 34.820971
distances[33.5][10.0] = 34.960692
distances[33.5][10.5] = 35.106979
distances[33.5][11.0] = 35.25975
distances[33.5][11.5] = 35.418921
distances[33.5][12.0] = 35.584407
distances[33.5][12.5] = 35.756118
distances[33.5][13.0] = 35.933967
distances[33.5][13.5] = 36.117863
distances[33.5][14.0] = 36.307713
distances[33.5][14.5] = 36.503424
distances[33.5][15.0] = 36.704904
distances[33.5][15.5] = 36.912058
distances[33.5][16.0] = 37.12479
distances[33.5][16.5] = 37.343005
distances[33.5][17.0] = 37.566608
distances[33.5][17.5] = 37.795502
distances[33.5][18.0] = 38.029594
distances[33.5][18.5] = 38.268786
distances[33.5][19.0] = 38.512985
distances[33.5][19.5] = 38.762095
distances[33.5][20.0] = 39.016022
distances[33.5][20.5] = 39.274674
distances[33.5][21.0] = 39.537956
distances[33.5][21.5] = 39.805778
distances[33.5][22.0] = 40.078049
distances[33.5][22.5] = 40.354678
distances[33.5][23.0] = 40.635576
distances[33.5][23.5] = 40.920655
distances[33.5][24.0] = 41.209829
distances[33.5][24.5] = 41.503012
distances[33.5][25.0] = 41.80012
distances[33.5][25.5] = 42.101069
distances[33.5][26.0] = 42.405778
distances[33.5][26.5] = 42.714166
distances[33.5][27.0] = 43.026155
distances[33.5][27.5] = 43.341666
distances[33.5][28.0] = 43.660623
distances[33.5][28.5] = 43.982951
distances[33.5][29.0] = 44.308577
distances[33.5][29.5] = 44.637428
distances[33.5][30.0] = 44.969434
distances[33.5][30.5] = 45.304525
distances[33.5][31.0] = 45.642634
distances[33.5][31.5] = 45.983693
distances[33.5][32.0] = 46.327638
distances[33.5][32.5] = 46.674404
distances[33.5][33.0] = 47.02393
distances[33.5][33.5] = 47.376154
distances[34.0] = {}
distances[34.0][0.0] = 34.0
distances[34.0][0.5] = 34.003676
distances[34.0][1.0] = 34.014703
distances[34.0][1.5] = 34.033072
distances[34.0][2.0] = 34.058773
distances[34.0][2.5] = 34.091788
distances[34.0][3.0] = 34.132096
distances[34.0][3.5] = 34.179672
distances[34.0][4.0] = 34.234486
distances[34.0][4.5] = 34.296501
distances[34.0][5.0] = 34.365681
distances[34.0][5.5] = 34.44198
distances[34.0][6.0] = 34.525353
distances[34.0][6.5] = 34.615748
distances[34.0][7.0] = 34.71311
distances[34.0][7.5] = 34.817381
distances[34.0][8.0] = 34.928498
distances[34.0][8.5] = 35.046398
distances[34.0][9.0] = 35.171011
distances[34.0][9.5] = 35.302266
distances[34.0][10.0] = 35.44009
distances[34.0][10.5] = 35.584407
distances[34.0][11.0] = 35.735137
distances[34.0][11.5] = 35.8922
distances[34.0][12.0] = 36.055513
distances[34.0][12.5] = 36.224991
distances[34.0][13.0] = 36.400549
distances[34.0][13.5] = 36.582099
distances[34.0][14.0] = 36.769553
distances[34.0][14.5] = 36.962819
distances[34.0][15.0] = 37.161808
distances[34.0][15.5] = 37.366429
distances[34.0][16.0] = 37.576588
distances[34.0][16.5] = 37.792195
distances[34.0][17.0] = 38.013156
distances[34.0][17.5] = 38.239378
distances[34.0][18.0] = 38.470768
distances[34.0][18.5] = 38.707234
distances[34.0][19.0] = 38.948684
distances[34.0][19.5] = 39.195025
distances[34.0][20.0] = 39.446166
distances[34.0][20.5] = 39.702015
distances[34.0][21.0] = 39.962482
distances[34.0][21.5] = 40.227478
distances[34.0][22.0] = 40.496913
distances[34.0][22.5] = 40.7707
distances[34.0][23.0] = 41.048752
distances[34.0][23.5] = 41.330981
distances[34.0][24.0] = 41.617304
distances[34.0][24.5] = 41.907637
distances[34.0][25.0] = 42.201896
distances[34.0][25.5] = 42.5
distances[34.0][26.0] = 42.801869
distances[34.0][26.5] = 43.107424
distances[34.0][27.0] = 43.416587
distances[34.0][27.5] = 43.729281
distances[34.0][28.0] = 44.045431
distances[34.0][28.5] = 44.364964
distances[34.0][29.0] = 44.687806
distances[34.0][29.5] = 45.013887
distances[34.0][30.0] = 45.343136
distances[34.0][30.5] = 45.675486
distances[34.0][31.0] = 46.010868
distances[34.0][31.5] = 46.349218
distances[34.0][32.0] = 46.69047
distances[34.0][32.5] = 47.034562
distances[34.0][33.0] = 47.381431
distances[34.0][33.5] = 47.731017
distances[34.0][34.0] = 48.083261
distances[34.5] = {}
distances[34.5][0.0] = 34.5
distances[34.5][0.5] = 34.503623
distances[34.5][1.0] = 34.51449
distances[34.5][1.5] = 34.532593
distances[34.5][2.0] = 34.557922
distances[34.5][2.5] = 34.590461
distances[34.5][3.0] = 34.630189
distances[34.5][3.5] = 34.677082
distances[34.5][4.0] = 34.73111
distances[34.5][4.5] = 34.792241
distances[34.5][5.0] = 34.860436
distances[34.5][5.5] = 34.935655
distances[34.5][6.0] = 35.017853
distances[34.5][6.5] = 35.106979
distances[34.5][7.0] = 35.202983
distances[34.5][7.5] = 35.305807
distances[34.5][8.0] = 35.415392
distances[34.5][8.5] = 35.531676
distances[34.5][9.0] = 35.654593
distances[34.5][9.5] = 35.784075
distances[34.5][10.0] = 35.92005
distances[34.5][10.5] = 36.062446
distances[34.5][11.0] = 36.211186
distances[34.5][11.5] = 36.366193
distances[34.5][12.0] = 36.527387
distances[34.5][12.5] = 36.694686
distances[34.5][13.0] = 36.868008
distances[34.5][13.5] = 37.047267
distances[34.5][14.0] = 37.232378
distances[34.5][14.5] = 37.423255
distances[34.5][15.0] = 37.619809
distances[34.5][15.5] = 37.821951
distances[34.5][16.0] = 38.029594
distances[34.5][16.5] = 38.242646
distances[34.5][17.0] = 38.461019
distances[34.5][17.5] = 38.684622
distances[34.5][18.0] = 38.913365
distances[34.5][18.5] = 39.147158
distances[34.5][19.0] = 39.385911
distances[34.5][19.5] = 39.629534
distances[34.5][20.0] = 39.877939
distances[34.5][20.5] = 40.131035
distances[34.5][21.0] = 40.388736
distances[34.5][21.5] = 40.650953
distances[34.5][22.0] = 40.9176
distances[34.5][22.5] = 41.188591
distances[34.5][23.0] = 41.46384
distances[34.5][23.5] = 41.743263
distances[34.5][24.0] = 42.026777
distances[34.5][24.5] = 42.3143
distances[34.5][25.0] = 42.605751
distances[34.5][25.5] = 42.901049
distances[34.5][26.0] = 43.200116
distances[34.5][26.5] = 43.502873
distances[34.5][27.0] = 43.809246
distances[34.5][27.5] = 44.119157
distances[34.5][28.0] = 44.432533
distances[34.5][28.5] = 44.749302
distances[34.5][29.0] = 45.069391
distances[34.5][29.5] = 45.392731
distances[34.5][30.0] = 45.719252
distances[34.5][30.5] = 46.048887
distances[34.5][31.0] = 46.38157
distances[34.5][31.5] = 46.717235
distances[34.5][32.0] = 47.055818
distances[34.5][32.5] = 47.397257
distances[34.5][33.0] = 47.741491
distances[34.5][33.5] = 48.08846
distances[34.5][34.0] = 48.438105
distances[34.5][34.5] = 48.790368
distances[35.0] = {}
distances[35.0][0.0] = 35.0
distances[35.0][0.5] = 35.003571
distances[35.0][1.0] = 35.014283
distances[35.0][1.5] = 35.032128
distances[35.0][2.0] = 35.057096
distances[35.0][2.5] = 35.089172
distances[35.0][3.0] = 35.128336
distances[35.0][3.5] = 35.174565
distances[35.0][4.0] = 35.22783
distances[35.0][4.5] = 35.2881
distances[35.0][5.0] = 35.355339
distances[35.0][5.5] = 35.429507
distances[35.0][6.0] = 35.510562
distances[35.0][6.5] = 35.598455
distances[35.0][7.0] = 35.693137
distances[35.0][7.5] = 35.794553
distances[35.0][8.0] = 35.902646
distances[35.0][8.5] = 36.017357
distances[35.0][9.0] = 36.138622
distances[35.0][9.5] = 36.266376
distances[35.0][10.0] = 36.400549
distances[35.0][10.5] = 36.541073
distances[35.0][11.0] = 36.687873
distances[35.0][11.5] = 36.840874
distances[35.0][12.0] = 37.0
distances[35.0][12.5] = 37.165172
distances[35.0][13.0] = 37.336309
distances[35.0][13.5] = 37.513331
distances[35.0][14.0] = 37.696154
distances[35.0][14.5] = 37.884693
distances[35.0][15.0] = 38.078866
distances[35.0][15.5] = 38.278584
distances[35.0][16.0] = 38.483763
distances[35.0][16.5] = 38.694315
distances[35.0][17.0] = 38.910153
distances[35.0][17.5] = 39.13119
distances[35.0][18.0] = 39.357337
distances[35.0][18.5] = 39.588508
distances[35.0][19.0] = 39.824616
distances[35.0][19.5] = 40.065571
distances[35.0][20.0] = 40.311289
distances[35.0][20.5] = 40.561681
distances[35.0][21.0] = 40.816663
distances[35.0][21.5] = 41.076149
distances[35.0][22.0] = 41.340053
distances[35.0][22.5] = 41.608292
distances[35.0][23.0] = 41.880783
distances[35.0][23.5] = 42.157443
distances[35.0][24.0] = 42.43819
distances[35.0][24.5] = 42.722945
distances[35.0][25.0] = 43.011626
distances[35.0][25.5] = 43.304157
distances[35.0][26.0] = 43.600459
distances[35.0][26.5] = 43.900456
distances[35.0][27.0] = 44.204072
distances[35.0][27.5] = 44.511235
distances[35.0][28.0] = 44.82187
distances[35.0][28.5] = 45.135906
distances[35.0][29.0] = 45.453273
distances[35.0][29.5] = 45.773901
distances[35.0][30.0] = 46.097722
distances[35.0][30.5] = 46.42467
distances[35.0][31.0] = 46.754679
distances[35.0][31.5] = 47.087684
distances[35.0][32.0] = 47.423623
distances[35.0][32.5] = 47.762433
distances[35.0][33.0] = 48.104054
distances[35.0][33.5] = 48.448426
distances[35.0][34.0] = 48.795492
distances[35.0][34.5] = 49.145193
distances[35.0][35.0] = 49.497475
distances[35.5] = {}
distances[35.5][0.0] = 35.5
distances[35.5][0.5] = 35.503521
distances[35.5][1.0] = 35.514082
distances[35.5][1.5] = 35.531676
distances[35.5][2.0] = 35.556293
distances[35.5][2.5] = 35.587919
distances[35.5][3.0] = 35.626535
distances[35.5][3.5] = 35.672118
distances[35.5][4.0] = 35.724641
distances[35.5][4.5] = 35.784075
distances[35.5][5.0] = 35.850384
distances[35.5][5.5] = 35.92353
distances[35.5][6.0] = 36.003472
distances[35.5][6.5] = 36.090165
distances[35.5][7.0] = 36.18356
distances[35.5][7.5] = 36.283605
distances[35.5][8.0] = 36.390246
distances[35.5][8.5] = 36.503424
distances[35.5][9.0] = 36.62308
distances[35.5][9.5] = 36.74915
distances[35.5][10.0] = 36.881567
distances[35.5][10.5] = 37.020265
distances[35.5][11.0] = 37.165172
distances[35.5][11.5] = 37.316216
distances[35.5][12.0] = 37.473324
distances[35.5][12.5] = 37.636419
distances[35.5][13.0] = 37.805423
distances[35.5][13.5] = 37.980258
distances[35.5][14.0] = 38.160844
distances[35.5][14.5] = 38.347099
distances[35.5][15.0] = 38.538941
distances[35.5][15.5] = 38.736288
distances[35.5][16.0] = 38.939055
distances[35.5][16.5] = 39.147158
distances[35.5][17.0] = 39.360513
distances[35.5][17.5] = 39.579035
distances[35.5][18.0] = 39.802638
distances[35.5][18.5] = 40.031238
distances[35.5][19.0] = 40.264749
distances[35.5][19.5] = 40.503086
distances[35.5][20.0] = 40.746165
distances[35.5][20.5] = 40.993902
distances[35.5][21.0] = 41.246212
distances[35.5][21.5] = 41.503012
distances[35.5][22.0] = 41.764219
distances[35.5][22.5] = 42.029751
distances[35.5][23.0] = 42.299527
distances[35.5][23.5] = 42.573466
distances[35.5][24.0] = 42.851488
distances[35.5][24.5] = 43.133514
distances[35.5][25.0] = 43.419466
distances[35.5][25.5] = 43.709267
distances[35.5][26.0] = 44.002841
distances[35.5][26.5] = 44.300113
distances[35.5][27.0] = 44.601009
distances[35.5][27.5] = 44.905456
distances[35.5][28.0] = 45.213383
distances[35.5][28.5] = 45.524719
distances[35.5][29.0] = 45.839394
distances[35.5][29.5] = 46.15734
distances[35.5][30.0] = 46.47849
distances[35.5][30.5] = 46.802778
distances[35.5][31.0] = 47.130139
distances[35.5][31.5] = 47.46051
distances[35.5][32.0] = 47.793828
distances[35.5][32.5] = 48.130032
distances[35.5][33.0] = 48.469062
distances[35.5][33.5] = 48.810859
distances[35.5][34.0] = 49.155366
distances[35.5][34.5] = 49.502525
distances[35.5][35.0] = 49.852282
distances[35.5][35.5] = 50.204581
distances[36.0] = {}
distances[36.0][0.0] = 36.0
distances[36.0][0.5] = 36.003472
distances[36.0][1.0] = 36.013886
distances[36.0][1.5] = 36.031236
distances[36.0][2.0] = 36.055513
distances[36.0][2.5] = 36.086701
distances[36.0][3.0] = 36.124784
distances[36.0][3.5] = 36.169739
distances[36.0][4.0] = 36.221541
distances[36.0][4.5] = 36.28016
distances[36.0][5.0] = 36.345564
distances[36.0][5.5] = 36.417715
distances[36.0][6.0] = 36.496575
distances[36.0][6.5] = 36.582099
distances[36.0][7.0] = 36.674242
distances[36.0][7.5] = 36.772952
distances[36.0][8.0] = 36.878178
distances[36.0][8.5] = 36.989863
distances[36.0][9.0] = 37.107951
distances[36.0][9.5] = 37.232378
distances[36.0][10.0] = 37.363083
distances[36.0][10.5] = 37.5
distances[36.0][11.0] = 37.64306
distances[36.0][11.5] = 37.792195
distances[36.0][12.0] = 37.947332
distances[36.0][12.5] = 38.108398
distances[36.0][13.0] = 38.275318
distances[36.0][13.5] = 38.448017
distances[36.0][14.0] = 38.626416
distances[36.0][14.5] = 38.810437
distances[36.0][15.0] = 39.0
distances[36.0][15.5] = 39.195025
distances[36.0][16.0] = 39.395431
distances[36.0][16.5] = 39.601136
distances[36.0][17.0] = 39.812058
distances[36.0][17.5] = 40.028115
distances[36.0][18.0] = 40.249224
distances[36.0][18.5] = 40.475301
distances[36.0][19.0] = 40.706265
distances[36.0][19.5] = 40.942032
distances[36.0][20.0] = 41.182521
distances[36.0][20.5] = 41.427648
distances[36.0][21.0] = 41.677332
distances[36.0][21.5] = 41.931492
distances[36.0][22.0] = 42.190046
distances[36.0][22.5] = 42.452915
distances[36.0][23.0] = 42.720019
distances[36.0][23.5] = 42.991278
distances[36.0][24.0] = 43.266615
distances[36.0][24.5] = 43.545953
distances[36.0][25.0] = 43.829214
distances[36.0][25.5] = 44.116324
distances[36.0][26.0] = 44.407207
distances[36.0][26.5] = 44.70179
distances[36.0][27.0] = 45.0
distances[36.0][27.5] = 45.301766
distances[36.0][28.0] = 45.607017
distances[36.0][28.5] = 45.915684
distances[36.0][29.0] = 46.227697
distances[36.0][29.5] = 46.542991
distances[36.0][30.0] = 46.861498
distances[36.0][30.5] = 47.183154
distances[36.0][31.0] = 47.507894
distances[36.0][31.5] = 47.835656
distances[36.0][32.0] = 48.166378
distances[36.0][32.5] = 48.5
distances[36.0][33.0] = 48.836462
distances[36.0][33.5] = 49.175705
distances[36.0][34.0] = 49.517674
distances[36.0][34.5] = 49.86231
distances[36.0][35.0] = 50.209561
distances[36.0][35.5] = 50.559371
distances[36.0][36.0] = 50.911688
distances[36.5] = {}
distances[36.5][0.0] = 36.5
distances[36.5][0.5] = 36.503424
distances[36.5][1.0] = 36.513696
distances[36.5][1.5] = 36.530809
distances[36.5][2.0] = 36.554753
distances[36.5][2.5] = 36.585516
distances[36.5][3.0] = 36.62308
distances[36.5][3.5] = 36.667424
distances[36.5][4.0] = 36.718524
distances[36.5][4.5] = 36.776351
distances[36.5][5.0] = 36.840874
distances[36.5][5.5] = 36.912058
distances[36.5][6.0] = 36.989863
distances[36.5][6.5] = 37.07425
distances[36.5][7.0] = 37.165172
distances[36.5][7.5] = 37.262582
distances[36.5][8.0] = 37.366429
distances[36.5][8.5] = 37.476659
distances[36.5][9.0] = 37.593217
distances[36.5][9.5] = 37.716044
distances[36.5][10.0] = 37.845079
distances[36.5][10.5] = 37.980258
distances[36.5][11.0] = 38.121516
distances[36.5][11.5] = 38.268786
distances[36.5][12.0] = 38.421999
distances[36.5][12.5] = 38.581083
distances[36.5][13.0] = 38.745968
distances[36.5][13.5] = 38.916577
distances[36.5][14.0] = 39.092838
distances[36.5][14.5] = 39.274674
distances[36.5][15.0] = 39.462007
distances[36.5][15.5] = 39.65476
distances[36.5][16.0] = 39.852854
distances[36.5][16.5] = 40.056211
distances[36.5][17.0] = 40.264749
distances[36.5][17.5] = 40.478389
distances[36.5][18.0] = 40.697051
distances[36.5][18.5] = 40.920655
distances[36.5][19.0] = 41.149119
distances[36.5][19.5] = 41.382363
distances[36.5][20.0] = 41.620308
distances[36.5][20.5] = 41.862871
distances[36.5][21.0] = 42.109975
distances[36.5][21.5] = 42.361539
distances[36.5][22.0] = 42.617485
distances[36.5][22.5] = 42.877733
distances[36.5][23.0] = 43.142207
distances[36.5][23.5] = 43.410828
distances[36.5][24.0] = 43.683521
distances[36.5][24.5] = 43.960209
distances[36.5][25.0] = 44.240818
distances[36.5][25.5] = 44.525274
distances[36.5][26.0] = 44.813502
distances[36.5][26.5] = 45.105432
distances[36.5][27.0] = 45.400991
distances[36.5][27.5] = 45.700109
distances[36.5][28.0] = 46.002717
distances[36.5][28.5] = 46.308746
distances[36.5][29.0] = 46.61813
distances[36.5][29.5] = 46.9308
distances[36.5][30.0] = 47.246693
distances[36.5][30.5] = 47.565744
distances[36.5][31.0] = 47.88789
distances[36.5][31.5] = 48.213069
distances[36.5][32.0] = 48.54122
distances[36.5][32.5] = 48.872283
distances[36.5][33.0] = 49.206199
distances[36.5][33.5] = 49.542911
distances[36.5][34.0] = 49.882362
distances[36.5][34.5] = 50.224496
distances[36.5][35.0] = 50.569259
distances[36.5][35.5] = 50.916598
distances[36.5][36.0] = 51.266461
distances[36.5][36.5] = 51.618795
distances[37.0] = {}
distances[37.0][0.0] = 37.0
distances[37.0][0.5] = 37.003378
distances[37.0][1.0] = 37.013511
distances[37.0][1.5] = 37.030393
distances[37.0][2.0] = 37.054015
distances[37.0][2.5] = 37.084363
distances[37.0][3.0] = 37.121422
distances[37.0][3.5] = 37.165172
distances[37.0][4.0] = 37.215588
distances[37.0][4.5] = 37.272644
distances[37.0][5.0] = 37.336309
distances[37.0][5.5] = 37.40655
distances[37.0][6.0] = 37.48333
distances[37.0][6.5] = 37.566608
distances[37.0][7.0] = 37.656341
distances[37.0][7.5] = 37.752483
distances[37.0][8.0] = 37.854986
distances[37.0][8.5] = 37.963799
distances[37.0][9.0] = 38.078866
distances[37.0][9.5] = 38.200131
distances[37.0][10.0] = 38.327536
distances[37.0][10.5] = 38.461019
distances[37.0][11.0] = 38.600518
distances[37.0][11.5] = 38.745968
distances[37.0][12.0] = 38.897301
distances[37.0][12.5] = 39.054449
distances[37.0][13.0] = 39.217343
distances[37.0][13.5] = 39.385911
distances[37.0][14.0] = 39.560081
distances[37.0][14.5] = 39.739779
distances[37.0][15.0] = 39.92493
distances[37.0][15.5] = 40.115458
distances[37.0][16.0] = 40.311289
distances[37.0][16.5] = 40.512344
distances[37.0][17.0] = 40.718546
distances[37.0][17.5] = 40.929818
distances[37.0][18.0] = 41.146081
distances[37.0][18.5] = 41.367258
distances[37.0][19.0] = 41.593269
distances[37.0][19.5] = 41.824036
distances[37.0][20.0] = 42.059482
distances[37.0][20.5] = 42.299527
distances[37.0][21.0] = 42.544095
distances[37.0][21.5] = 42.793107
distances[37.0][22.0] = 43.046487
distances[37.0][22.5] = 43.304157
distances[37.0][23.0] = 43.566042
distances[37.0][23.5] = 43.832066
distances[37.0][24.0] = 44.102154
distances[37.0][24.5] = 44.376232
distances[37.0][25.0] = 44.654227
distances[37.0][25.5] = 44.936066
distances[37.0][26.0] = 45.221676
distances[37.0][26.5] = 45.510988
distances[37.0][27.0] = 45.80393
distances[37.0][27.5] = 46.100434
distances[37.0][28.0] = 46.400431
distances[37.0][28.5] = 46.703854
distances[37.0][29.0] = 47.010637
distances[37.0][29.5] = 47.320714
distances[37.0][30.0] = 47.634021
distances[37.0][30.5] = 47.950495
distances[37.0][31.0] = 48.270074
distances[37.0][31.5] = 48.592695
distances[37.0][32.0] = 48.918299
distances[37.0][32.5] = 49.246827
distances[37.0][33.0] = 49.578221
distances[37.0][33.5] = 49.912423
distances[37.0][34.0] = 50.249378
distances[37.0][34.5] = 50.58903
distances[37.0][35.0] = 50.931326
distances[37.0][35.5] = 51.276213
distances[37.0][36.0] = 51.623638
distances[37.0][36.5] = 51.973551
distances[37.0][37.0] = 52.325902
distances[37.5] = {}
distances[37.5][0.0] = 37.5
distances[37.5][0.5] = 37.503333
distances[37.5][1.0] = 37.513331
distances[37.5][1.5] = 37.529988
distances[37.5][2.0] = 37.553295
distances[37.5][2.5] = 37.583241
distances[37.5][3.0] = 37.619809
distances[37.5][3.5] = 37.662979
distances[37.5][4.0] = 37.71273
distances[37.5][4.5] = 37.769035
distances[37.5][5.0] = 37.831865
distances[37.5][5.5] = 37.901187
distances[37.5][6.0] = 37.976967
distances[37.5][6.5] = 38.059164
distances[37.5][7.0] = 38.147739
distances[37.5][7.5] = 38.242646
distances[37.5][8.0] = 38.343839
distances[37.5][8.5] = 38.451268
distances[37.5][9.0] = 38.56488
distances[37.5][9.5] = 38.684622
distances[37.5][10.0] = 38.810437
distances[37.5][10.5] = 38.942265
distances[37.5][11.0] = 39.080046
distances[37.5][11.5] = 39.223717
distances[37.5][12.0] = 39.373214
distances[37.5][12.5] = 39.528471
distances[37.5][13.0] = 39.689419
distances[37.5][13.5] = 39.855991
distances[37.5][14.0] = 40.028115
distances[37.5][14.5] = 40.205721
distances[37.5][15.0] = 40.388736
distances[37.5][15.5] = 40.577087
distances[37.5][16.0] = 40.7707
distances[37.5][16.5] = 40.969501
distances[37.5][17.0] = 41.173414
distances[37.5][17.5] = 41.382363
distances[37.5][18.0] = 41.596274
distances[37.5][18.5] = 41.815069
distances[37.5][19.0] = 42.038673
distances[37.5][19.5] = 42.267008
distances[37.5][20.0] = 42.5
distances[37.5][20.5] = 42.737571
distances[37.5][21.0] = 42.979646
distances[37.5][21.5] = 43.226149
distances[37.5][22.0] = 43.477005
distances[37.5][22.5] = 43.732139
distances[37.5][23.0] = 43.991476
distances[37.5][23.5] = 44.254943
distances[37.5][24.0] = 44.522466
distances[37.5][24.5] = 44.793973
distances[37.5][25.0] = 45.069391
distances[37.5][25.5] = 45.348649
distances[37.5][26.0] = 45.631678
distances[37.5][26.5] = 45.918406
distances[37.5][27.0] = 46.208765
distances[37.5][27.5] = 46.502688
distances[37.5][28.0] = 46.800107
distances[37.5][28.5] = 47.100955
distances[37.5][29.0] = 47.405168
distances[37.5][29.5] = 47.712682
distances[37.5][30.0] = 48.023432
distances[37.5][30.5] = 48.337356
distances[37.5][31.0] = 48.654393
distances[37.5][31.5] = 48.974483
distances[37.5][32.0] = 49.297566
distances[37.5][32.5] = 49.623583
distances[37.5][33.0] = 49.952477
distances[37.5][33.5] = 50.284192
distances[37.5][34.0] = 50.618672
distances[37.5][34.5] = 50.955863
distances[37.5][35.0] = 51.295711
distances[37.5][35.5] = 51.638164
distances[37.5][36.0] = 51.98317
distances[37.5][36.5] = 52.330679
distances[37.5][37.0] = 52.680642
distances[37.5][37.5] = 53.033009
distances[38.0] = {}
distances[38.0][0.0] = 38.0
distances[38.0][0.5] = 38.003289
distances[38.0][1.0] = 38.013156
distances[38.0][1.5] = 38.029594
distances[38.0][2.0] = 38.052595
distances[38.0][2.5] = 38.082148
distances[38.0][3.0] = 38.118237
distances[38.0][3.5] = 38.160844
distances[38.0][4.0] = 38.209946
distances[38.0][4.5] = 38.26552
distances[38.0][5.0] = 38.327536
distances[38.0][5.5] = 38.395963
distances[38.0][6.0] = 38.470768
distances[38.0][6.5] = 38.551913
distances[38.0][7.0] = 38.639358
distances[38.0][7.5] = 38.733061
distances[38.0][8.0] = 38.832976
distances[38.0][8.5] = 38.939055
distances[38.0][9.0] = 39.051248
distances[38.0][9.5] = 39.169503
distances[38.0][10.0] = 39.293765
distances[38.0][10.5] = 39.423977
distances[38.0][11.0] = 39.560081
distances[38.0][11.5] = 39.702015
distances[38.0][12.0] = 39.849718
distances[38.0][12.5] = 40.003125
distances[38.0][13.0] = 40.162171
distances[38.0][13.5] = 40.32679
distances[38.0][14.0] = 40.496913
distances[38.0][14.5] = 40.672472
distances[38.0][15.0] = 40.853396
distances[38.0][15.5] = 41.039615
distances[38.0][16.0] = 41.231056
distances[38.0][16.5] = 41.427648
distances[38.0][17.0] = 41.629317
distances[38.0][17.5] = 41.835989
distances[38.0][18.0] = 42.047592
distances[38.0][18.5] = 42.264051
distances[38.0][19.0] = 42.485292
distances[38.0][19.5] = 42.71124
distances[38.0][20.0] = 42.941821
distances[38.0][20.5] = 43.176961
distances[38.0][21.0] = 43.416587
distances[38.0][21.5] = 43.660623
distances[38.0][22.0] = 43.908997
distances[38.0][22.5] = 44.161635
distances[38.0][23.0] = 44.418465
distances[38.0][23.5] = 44.679414
distances[38.0][24.0] = 44.94441
distances[38.0][24.5] = 45.213383
distances[38.0][25.0] = 45.486262
distances[38.0][25.5] = 45.762976
distances[38.0][26.0] = 46.043458
distances[38.0][26.5] = 46.327638
distances[38.0][27.0] = 46.615448
distances[38.0][27.5] = 46.906823
distances[38.0][28.0] = 47.201695
distances[38.0][28.5] = 47.5
distances[38.0][29.0] = 47.801674
distances[38.0][29.5] = 48.106652
distances[38.0][30.0] = 48.414874
distances[38.0][30.5] = 48.726276
distances[38.0][31.0] = 49.040799
distances[38.0][31.5] = 49.358383
distances[38.0][32.0] = 49.678969
distances[38.0][32.5] = 50.0025
distances[38.0][33.0] = 50.328918
distances[38.0][33.5] = 50.658168
distances[38.0][34.0] = 50.990195
distances[38.0][34.5] = 51.324945
distances[38.0][35.0] = 51.662365
distances[38.0][35.5] = 52.002404
distances[38.0][36.0] = 52.345009
distances[38.0][36.5] = 52.690132
distances[38.0][37.0] = 53.037722
distances[38.0][37.5] = 53.387733
distances[38.0][38.0] = 53.740115
distances[38.5] = {}
distances[38.5][0.0] = 38.5
distances[38.5][0.5] = 38.503247
distances[38.5][1.0] = 38.512985
distances[38.5][1.5] = 38.52921
distances[38.5][2.0] = 38.551913
distances[38.5][2.5] = 38.581083
distances[38.5][3.0] = 38.616706
distances[38.5][3.5] = 38.658764
distances[38.5][4.0] = 38.707234
distances[38.5][4.5] = 38.762095
distances[38.5][5.0] = 38.823318
distances[38.5][5.5] = 38.890873
distances[38.5][6.0] = 38.964728
distances[38.5][6.5] = 39.044846
distances[38.5][7.0] = 39.13119
distances[38.5][7.5] = 39.223717
distances[38.5][8.0] = 39.322385
distances[38.5][8.5] = 39.427148
distances[38.5][9.0] = 39.537956
distances[38.5][9.5] = 39.65476
distances[38.5][10.0] = 39.777506
distances[38.5][10.5] = 39.90614
distances[38.5][11.0] = 40.040604
distances[38.5][11.5] = 40.180841
distances[38.5][12.0] = 40.32679
distances[38.5][12.5] = 40.478389
distances[38.5][13.0] = 40.635576
distances[38.5][13.5] = 40.798284
distances[38.5][14.0] = 40.96645
distances[38.5][14.5] = 41.140005
distances[38.5][15.0] = 41.318882
distances[38.5][15.5] = 41.503012
distances[38.5][16.0] = 41.692325
distances[38.5][16.5] = 41.886752
distances[38.5][17.0] = 42.086221
distances[38.5][17.5] = 42.290661
distances[38.5][18.0] = 42.5
distances[38.5][18.5] = 42.714166
distances[38.5][19.0] = 42.933087
distances[38.5][19.5] = 43.156691
distances[38.5][20.0] = 43.384905
distances[38.5][20.5] = 43.617657
distances[38.5][21.0] = 43.854874
distances[38.5][21.5] = 44.096485
distances[38.5][22.0] = 44.342418
distances[38.5][22.5] = 44.5926
distances[38.5][23.0] = 44.846962
distances[38.5][23.5] = 45.105432
distances[38.5][24.0] = 45.36794
distances[38.5][24.5] = 45.634417
distances[38.5][25.0] = 45.904793
distances[38.5][25.5] = 46.179
distances[38.5][26.0] = 46.456969
distances[38.5][26.5] = 46.738635
distances[38.5][27.0] = 47.02393
distances[38.5][27.5] = 47.312789
distances[38.5][28.0] = 47.605147
distances[38.5][28.5] = 47.900939
distances[38.5][29.0] = 48.200104
distances[38.5][29.5] = 48.502577
distances[38.5][30.0] = 48.808298
distances[38.5][30.5] = 49.117207
distances[38.5][31.0] = 49.429242
distances[38.5][31.5] = 49.744346
distances[38.5][32.0] = 50.062461
distances[38.5][32.5] = 50.383529
distances[38.5][33.0] = 50.707495
distances[38.5][33.5] = 51.034302
distances[38.5][34.0] = 51.363898
distances[38.5][34.5] = 51.696228
distances[38.5][35.0] = 52.031241
distances[38.5][35.5] = 52.368884
distances[38.5][36.0] = 52.709107
distances[38.5][36.5] = 53.051861
distances[38.5][37.0] = 53.397097
distances[38.5][37.5] = 53.744767
distances[38.5][38.0] = 54.094824
distances[38.5][38.5] = 54.447222
distances[39.0] = {}
distances[39.0][0.0] = 39.0
distances[39.0][0.5] = 39.003205
distances[39.0][1.0] = 39.012818
distances[39.0][1.5] = 39.028835
distances[39.0][2.0] = 39.051248
distances[39.0][2.5] = 39.080046
distances[39.0][3.0] = 39.115214
distances[39.0][3.5] = 39.156736
distances[39.0][4.0] = 39.204592
distances[39.0][4.5] = 39.258757
distances[39.0][5.0] = 39.319207
distances[39.0][5.5] = 39.385911
distances[39.0][6.0] = 39.458839
distances[39.0][6.5] = 39.537956
distances[39.0][7.0] = 39.623226
distances[39.0][7.5] = 39.714607
distances[39.0][8.0] = 39.812058
distances[39.0][8.5] = 39.915536
distances[39.0][9.0] = 40.024992
distances[39.0][9.5] = 40.140379
distances[39.0][10.0] = 40.261644
distances[39.0][10.5] = 40.388736
distances[39.0][11.0] = 40.521599
distances[39.0][11.5] = 40.660177
distances[39.0][12.0] = 40.804412
distances[39.0][12.5] = 40.954243
distances[39.0][13.0] = 41.10961
distances[39.0][13.5] = 41.270449
distances[39.0][14.0] = 41.436699
distances[39.0][14.5] = 41.608292
distances[39.0][15.0] = 41.785165
distances[39.0][15.5] = 41.967249
distances[39.0][16.0] = 42.154478
distances[39.0][16.5] = 42.346783
distances[39.0][17.0] = 42.544095
distances[39.0][17.5] = 42.746345
distances[39.0][18.0] = 42.953463
distances[39.0][18.5] = 43.16538
distances[39.0][19.0] = 43.382024
distances[39.0][19.5] = 43.603326
distances[39.0][20.0] = 43.829214
distances[39.0][20.5] = 44.059619
distances[39.0][21.0] = 44.294469
distances[39.0][21.5] = 44.533695
distances[39.0][22.0] = 44.777226
distances[39.0][22.5] = 45.024993
distances[39.0][23.0] = 45.276926
distances[39.0][23.5] = 45.532955
distances[39.0][24.0] = 45.793013
distances[39.0][24.5] = 46.05703
distances[39.0][25.0] = 46.324939
distances[39.0][25.5] = 46.596674
distances[39.0][26.0] = 46.872167
distances[39.0][26.5] = 47.151352
distances[39.0][27.0] = 47.434165
distances[39.0][27.5] = 47.720541
distances[39.0][28.0] = 48.010416
distances[39.0][28.5] = 48.303727
distances[39.0][29.0] = 48.600412
distances[39.0][29.5] = 48.900409
distances[39.0][30.0] = 49.203658
distances[39.0][30.5] = 49.5101
distances[39.0][31.0] = 49.819675
distances[39.0][31.5] = 50.132325
distances[39.0][32.0] = 50.447993
distances[39.0][32.5] = 50.766623
distances[39.0][33.0] = 51.088159
distances[39.0][33.5] = 51.412547
distances[39.0][34.0] = 51.739733
distances[39.0][34.5] = 52.069665
distances[39.0][35.0] = 52.40229
distances[39.0][35.5] = 52.737558
distances[39.0][36.0] = 53.075418
distances[39.0][36.5] = 53.415822
distances[39.0][37.0] = 53.75872
distances[39.0][37.5] = 54.104066
distances[39.0][38.0] = 54.451814
distances[39.0][38.5] = 54.801916
distances[39.0][39.0] = 55.154329
distances[39.5] = {}
distances[39.5][0.0] = 39.5
distances[39.5][0.5] = 39.503164
distances[39.5][1.0] = 39.512656
distances[39.5][1.5] = 39.528471
distances[39.5][2.0] = 39.550601
distances[39.5][2.5] = 39.579035
distances[39.5][3.0] = 39.61376
distances[39.5][3.5] = 39.65476
distances[39.5][4.0] = 39.702015
distances[39.5][4.5] = 39.755503
distances[39.5][5.0] = 39.815198
distances[39.5][5.5] = 39.881073
distances[39.5][6.0] = 39.953098
distances[39.5][6.5] = 40.031238
distances[39.5][7.0] = 40.115458
distances[39.5][7.5] = 40.205721
distances[39.5][8.0] = 40.301985
distances[39.5][8.5] = 40.404208
distances[39.5][9.0] = 40.512344
distances[39.5][9.5] = 40.626346
distances[39.5][10.0] = 40.746165
distances[39.5][10.5] = 40.871751
distances[39.5][11.0] = 41.003049
distances[39.5][11.5] = 41.140005
distances[39.5][12.0] = 41.282563
distances[39.5][12.5] = 41.430665
distances[39.5][13.0] = 41.584252
distances[39.5][13.5] = 41.743263
distances[39.5][14.0] = 41.907637
distances[39.5][14.5] = 42.07731
distances[39.5][15.0] = 42.252219
distances[39.5][15.5] = 42.432299
distances[39.5][16.0] = 42.617485
distances[39.5][16.5] = 42.80771
distances[39.5][17.0] = 43.002907
distances[39.5][17.5] = 43.203009
distances[39.5][18.0] = 43.407949
distances[39.5][18.5] = 43.617657
distances[39.5][19.0] = 43.832066
distances[39.5][19.5] = 44.051107
distances[39.5][20.0] = 44.274711
distances[39.5][20.5] = 44.502809
distances[39.5][21.0] = 44.735333
distances[39.5][21.5] = 44.972214
distances[39.5][22.0] = 45.213383
distances[39.5][22.5] = 45.458773
distances[39.5][23.0] = 45.708314
distances[39.5][23.5] = 45.961941
distances[39.5][24.0] = 46.219585
distances[39.5][24.5] = 46.481179
distances[39.5][25.0] = 46.746658
distances[39.5][25.5] = 47.015955
distances[39.5][26.0] = 47.289005
distances[39.5][26.5] = 47.565744
distances[39.5][27.0] = 47.846107
distances[39.5][27.5] = 48.130032
distances[39.5][28.0] = 48.417456
distances[39.5][28.5] = 48.708316
distances[39.5][29.0] = 49.002551
distances[39.5][29.5] = 49.300101
distances[39.5][30.0] = 49.600907
distances[39.5][30.5] = 49.90491
distances[39.5][31.0] = 50.21205
distances[39.5][31.5] = 50.522272
distances[39.5][32.0] = 50.835519
distances[39.5][32.5] = 51.151735
distances[39.5][33.0] = 51.470866
distances[39.5][33.5] = 51.792857
distances[39.5][34.0] = 52.117655
distances[39.5][34.5] = 52.44521
distances[39.5][35.0] = 52.775468
distances[39.5][35.5] = 53.10838
distances[39.5][36.0] = 53.443896
distances[39.5][36.5] = 53.781967
distances[39.5][37.0] = 54.122546
distances[39.5][37.5] = 54.465585
distances[39.5][38.0] = 54.811039
distances[39.5][38.5] = 55.158861
distances[39.5][39.0] = 55.509008
distances[39.5][39.5] = 55.861436
distances[40.0] = {}
distances[40.0][0.0] = 40.0
distances[40.0][0.5] = 40.003125
distances[40.0][1.0] = 40.012498
distances[40.0][1.5] = 40.028115
distances[40.0][2.0] = 40.049969
distances[40.0][2.5] = 40.078049
distances[40.0][3.0] = 40.112342
distances[40.0][3.5] = 40.152833
distances[40.0][4.0] = 40.199502
distances[40.0][4.5] = 40.252329
distances[40.0][5.0] = 40.311289
distances[40.0][5.5] = 40.376354
distances[40.0][6.0] = 40.447497
distances[40.0][6.5] = 40.524684
distances[40.0][7.0] = 40.607881
distances[40.0][7.5] = 40.697051
distances[40.0][8.0] = 40.792156
distances[40.0][8.5] = 40.893153
distances[40.0][9.0] = 41.0
distances[40.0][9.5] = 41.11265
distances[40.0][10.0] = 41.231056
distances[40.0][10.5] = 41.355169
distances[40.0][11.0] = 41.484937
distances[40.0][11.5] = 41.620308
distances[40.0][12.0] = 41.761226
distances[40.0][12.5] = 41.907637
distances[40.0][13.0] = 42.059482
distances[40.0][13.5] = 42.216703
distances[40.0][14.0] = 42.37924
distances[40.0][14.5] = 42.547033
distances[40.0][15.0] = 42.720019
distances[40.0][15.5] = 42.898135
distances[40.0][16.0] = 43.081318
distances[40.0][16.5] = 43.269504
distances[40.0][17.0] = 43.462628
distances[40.0][17.5] = 43.660623
distances[40.0][18.0] = 43.863424
distances[40.0][18.5] = 44.070965
distances[40.0][19.0] = 44.28318
distances[40.0][19.5] = 44.5
distances[40.0][20.0] = 44.72136
distances[40.0][20.5] = 44.947191
distances[40.0][21.0] = 45.177428
distances[40.0][21.5] = 45.412003
distances[40.0][22.0] = 45.650849
distances[40.0][22.5] = 45.893899
distances[40.0][23.0] = 46.141088
distances[40.0][23.5] = 46.392349
distances[40.0][24.0] = 46.647615
distances[40.0][24.5] = 46.906823
distances[40.0][25.0] = 47.169906
distances[40.0][25.5] = 47.4368
distances[40.0][26.0] = 47.707442
distances[40.0][26.5] = 47.981767
distances[40.0][27.0] = 48.259714
distances[40.0][27.5] = 48.54122
distances[40.0][28.0] = 48.826222
distances[40.0][28.5] = 49.114662
distances[40.0][29.0] = 49.406477
distances[40.0][29.5] = 49.70161
distances[40.0][30.0] = 50.0
distances[40.0][30.5] = 50.30159
distances[40.0][31.0] = 50.606324
distances[40.0][31.5] = 50.914143
distances[40.0][32.0] = 51.224994
distances[40.0][32.5] = 51.53882
distances[40.0][33.0] = 51.855569
distances[40.0][33.5] = 52.175186
distances[40.0][34.0] = 52.497619
distances[40.0][34.5] = 52.822817
distances[40.0][35.0] = 53.150729
distances[40.0][35.5] = 53.481305
distances[40.0][36.0] = 53.814496
distances[40.0][36.5] = 54.150254
distances[40.0][37.0] = 54.488531
distances[40.0][37.5] = 54.82928
distances[40.0][38.0] = 55.172457
distances[40.0][38.5] = 55.518015
distances[40.0][39.0] = 55.865911
distances[40.0][39.5] = 56.216101
distances[40.0][40.0] = 56.568542
distances[40.5] = {}
distances[40.5][0.0] = 40.5
distances[40.5][0.5] = 40.503086
distances[40.5][1.0] = 40.512344
distances[40.5][1.5] = 40.527768
distances[40.5][2.0] = 40.549353
distances[40.5][2.5] = 40.577087
distances[40.5][3.0] = 40.610959
distances[40.5][3.5] = 40.650953
distances[40.5][4.0] = 40.697051
distances[40.5][4.5] = 40.749233
distances[40.5][5.0] = 40.807475
distances[40.5][5.5] = 40.871751
distances[40.5][6.0] = 40.942032
distances[40.5][6.5] = 41.018289
distances[40.5][7.0] = 41.100487
distances[40.5][7.5] = 41.188591
distances[40.5][8.0] = 41.282563
distances[40.5][8.5] = 41.382363
distances[40.5][9.0] = 41.48795
distances[40.5][9.5] = 41.599279
distances[40.5][10.0] = 41.716304
distances[40.5][10.5] = 41.838977
distances[40.5][11.0] = 41.967249
distances[40.5][11.5] = 42.101069
distances[40.5][12.0] = 42.240384
distances[40.5][12.5] = 42.385139
distances[40.5][13.0] = 42.535279
distances[40.5][13.5] = 42.690748
distances[40.5][14.0] = 42.851488
distances[40.5][14.5] = 43.017438
distances[40.5][15.0] = 43.18854
distances[40.5][15.5] = 43.364732
distances[40.5][16.0] = 43.545953
distances[40.5][16.5] = 43.732139
distances[40.5][17.0] = 43.923228
distances[40.5][17.5] = 44.119157
distances[40.5][18.0] = 44.31986
distances[40.5][18.5] = 44.525274
distances[40.5][19.0] = 44.735333
distances[40.5][19.5] = 44.949972
distances[40.5][20.0] = 45.169127
distances[40.5][20.5] = 45.392731
distances[40.5][21.0] = 45.620719
distances[40.5][21.5] = 45.853026
distances[40.5][22.0] = 46.089587
distances[40.5][22.5] = 46.330336
distances[40.5][23.0] = 46.575208
distances[40.5][23.5] = 46.824139
distances[40.5][24.0] = 47.077064
distances[40.5][24.5] = 47.33392
distances[40.5][25.0] = 47.594643
distances[40.5][25.5] = 47.859168
distances[40.5][26.0] = 48.127435
distances[40.5][26.5] = 48.39938
distances[40.5][27.0] = 48.674942
distances[40.5][27.5] = 48.95406
distances[40.5][28.0] = 49.236673
distances[40.5][28.5] = 49.522722
distances[40.5][29.0] = 49.812147
distances[40.5][29.5] = 50.10489
distances[40.5][30.0] = 50.400893
distances[40.5][30.5] = 50.700099
distances[40.5][31.0] = 51.002451
distances[40.5][31.5] = 51.307894
distances[40.5][32.0] = 51.616373
distances[40.5][32.5] = 51.927835
distances[40.5][33.0] = 52.242224
distances[40.5][33.5] = 52.55949
distances[40.5][34.0] = 52.87958
distances[40.5][34.5] = 53.202444
distances[40.5][35.0] = 53.52803
distances[40.5][35.5] = 53.85629
distances[40.5][36.0] = 54.187176
distances[40.5][36.5] = 54.520638
distances[40.5][37.0] = 54.856631
distances[40.5][37.5] = 55.195108
distances[40.5][38.0] = 55.536024
distances[40.5][38.5] = 55.879334
distances[40.5][39.0] = 56.224994
distances[40.5][39.5] = 56.572962
distances[40.5][40.0] = 56.923194
distances[40.5][40.5] = 57.275649
distances[41.0] = {}
distances[41.0][0.0] = 41.0
distances[41.0][0.5] = 41.003049
distances[41.0][1.0] = 41.012193
distances[41.0][1.5] = 41.02743
distances[41.0][2.0] = 41.048752
distances[41.0][2.5] = 41.076149
distances[41.0][3.0] = 41.10961
distances[41.0][3.5] = 41.149119
distances[41.0][4.0] = 41.19466
distances[41.0][4.5] = 41.246212
distances[41.0][5.0] = 41.303753
distances[41.0][5.5] = 41.367258
distances[41.0][6.0] = 41.436699
distances[41.0][6.5] = 41.512046
distances[41.0][7.0] = 41.593269
distances[41.0][7.5] = 41.680331
distances[41.0][8.0] = 41.773197
distances[41.0][8.5] = 41.871828
distances[41.0][9.0] = 41.976184
distances[41.0][9.5] = 42.086221
distances[41.0][10.0] = 42.201896
distances[41.0][10.5] = 42.323162
distances[41.0][11.0] = 42.449971
distances[41.0][11.5] = 42.582273
distances[41.0][12.0] = 42.720019
distances[41.0][12.5] = 42.863154
distances[41.0][13.0] = 43.011626
distances[41.0][13.5] = 43.16538
distances[41.0][14.0] = 43.324358
distances[41.0][14.5] = 43.488504
distances[41.0][15.0] = 43.65776
distances[41.0][15.5] = 43.832066
distances[41.0][16.0] = 44.011362
distances[41.0][16.5] = 44.195588
distances[41.0][17.0] = 44.384682
distances[41.0][17.5] = 44.578582
distances[41.0][18.0] = 44.777226
distances[41.0][18.5] = 44.980551
distances[41.0][19.0] = 45.188494
distances[41.0][19.5] = 45.400991
distances[41.0][20.0] = 45.617979
distances[41.0][20.5] = 45.839394
distances[41.0][21.0] = 46.065171
distances[41.0][21.5] = 46.295248
distances[41.0][22.0] = 46.52956
distances[41.0][22.5] = 46.768045
distances[41.0][23.0] = 47.010637
distances[41.0][23.5] = 47.257275
distances[41.0][24.0] = 47.507894
distances[41.0][24.5] = 47.762433
distances[41.0][25.0] = 48.020829
distances[41.0][25.5] = 48.28302
distances[41.0][26.0] = 48.548944
distances[41.0][26.5] = 48.818542
distances[41.0][27.0] = 49.091751
distances[41.0][27.5] = 49.368512
distances[41.0][28.0] = 49.648766
distances[41.0][28.5] = 49.932454
distances[41.0][29.0] = 50.219518
distances[41.0][29.5] = 50.5099
distances[41.0][30.0] = 50.803543
distances[41.0][30.5] = 51.100391
distances[41.0][31.0] = 51.400389
distances[41.0][31.5] = 51.703482
distances[41.0][32.0] = 52.009614
distances[41.0][32.5] = 52.318735
distances[41.0][33.0] = 52.630789
distances[41.0][33.5] = 52.945727
distances[41.0][34.0] = 53.263496
distances[41.0][34.5] = 53.584046
distances[41.0][35.0] = 53.907328
distances[41.0][35.5] = 54.233292
distances[41.0][36.0] = 54.561891
distances[41.0][36.5] = 54.893078
distances[41.0][37.0] = 55.226805
distances[41.0][37.5] = 55.563027
distances[41.0][38.0] = 55.901699
distances[41.0][38.5] = 56.242777
distances[41.0][39.0] = 56.586217
distances[41.0][39.5] = 56.931977
distances[41.0][40.0] = 57.280014
distances[41.0][40.5] = 57.630287
distances[41.0][41.0] = 57.982756
distances[41.5] = {}
distances[41.5][0.0] = 41.5
distances[41.5][0.5] = 41.503012
distances[41.5][1.0] = 41.512046
distances[41.5][1.5] = 41.5271
distances[41.5][2.0] = 41.548165
distances[41.5][2.5] = 41.575233
distances[41.5][3.0] = 41.608292
distances[41.5][3.5] = 41.647329
distances[41.5][4.0] = 41.692325
distances[41.5][4.5] = 41.743263
distances[41.5][5.0] = 41.80012
distances[41.5][5.5] = 41.862871
distances[41.5][6.0] = 41.931492
distances[41.5][6.5] = 42.005952
distances[41.5][7.0] = 42.086221
distances[41.5][7.5] = 42.172266
distances[41.5][8.0] = 42.264051
distances[41.5][8.5] = 42.361539
distances[41.5][9.0] = 42.464691
distances[41.5][9.5] = 42.573466
distances[41.5][10.0] = 42.68782
distances[41.5][10.5] = 42.80771
distances[41.5][11.0] = 42.933087
distances[41.5][11.5] = 43.063906
distances[41.5][12.0] = 43.200116
distances[41.5][12.5] = 43.341666
distances[41.5][13.0] = 43.488504
distances[41.5][13.5] = 43.640577
distances[41.5][14.0] = 43.797831
distances[41.5][14.5] = 43.960209
distances[41.5][15.0] = 44.127656
distances[41.5][15.5] = 44.300113
distances[41.5][16.0] = 44.477522
distances[41.5][16.5] = 44.659825
distances[41.5][17.0] = 44.846962
distances[41.5][17.5] = 45.038872
distances[41.5][18.0] = 45.235495
distances[41.5][18.5] = 45.436769
distances[41.5][19.0] = 45.642634
distances[41.5][19.5] = 45.853026
distances[41.5][20.0] = 46.067885
distances[41.5][20.5] = 46.287147
distances[41.5][21.0] = 46.510751
distances[41.5][21.5] = 46.738635
distances[41.5][22.0] = 46.970736
distances[41.5][22.5] = 47.206991
distances[41.5][23.0] = 47.447339
distances[41.5][23.5] = 47.691718
distances[41.5][24.0] = 47.940067
distances[41.5][24.5] = 48.192323
distances[41.5][25.0] = 48.448426
distances[41.5][25.5] = 48.708316
distances[41.5][26.0] = 48.971931
distances[41.5][26.5] = 49.239212
distances[41.5][27.0] = 49.5101
distances[41.5][27.5] = 49.784536
distances[41.5][28.0] = 50.062461
distances[41.5][28.5] = 50.343818
distances[41.5][29.0] = 50.628549
distances[41.5][29.5] = 50.916598
distances[41.5][30.0] = 51.20791
distances[41.5][30.5] = 51.502427
distances[41.5][31.0] = 51.800097
distances[41.5][31.5] = 52.100864
distances[41.5][32.0] = 52.404675
distances[41.5][32.5] = 52.711479
distances[41.5][33.0] = 53.021222
distances[41.5][33.5] = 53.333854
distances[41.5][34.0] = 53.649324
distances[41.5][34.5] = 53.967583
distances[41.5][35.0] = 54.288581
distances[41.5][35.5] = 54.61227
distances[41.5][36.0] = 54.938602
distances[41.5][36.5] = 55.267531
distances[41.5][37.0] = 55.599011
distances[41.5][37.5] = 55.932996
distances[41.5][38.0] = 56.269441
distances[41.5][38.5] = 56.608303
distances[41.5][39.0] = 56.949539
distances[41.5][39.5] = 57.293106
distances[41.5][40.0] = 57.638963
distances[41.5][40.5] = 57.987068
distances[41.5][41.0] = 58.337381
distances[41.5][41.5] = 58.689863
distances[42.0] = {}
distances[42.0][0.0] = 42.0
distances[42.0][0.5] = 42.002976
distances[42.0][1.0] = 42.011903
distances[42.0][1.5] = 42.026777
distances[42.0][2.0] = 42.047592
distances[42.0][2.5] = 42.074339
distances[42.0][3.0] = 42.107007
distances[42.0][3.5] = 42.145581
distances[42.0][4.0] = 42.190046
distances[42.0][4.5] = 42.240384
distances[42.0][5.0] = 42.296572
distances[42.0][5.5] = 42.358588
distances[42.0][6.0] = 42.426407
distances[42.0][6.5] = 42.5
distances[42.0][7.0] = 42.579338
distances[42.0][7.5] = 42.664388
distances[42.0][8.0] = 42.755117
distances[42.0][8.5] = 42.851488
distances[42.0][9.0] = 42.953463
distances[42.0][9.5] = 43.061003
distances[42.0][10.0] = 43.174066
distances[42.0][10.5] = 43.292609
distances[42.0][11.0] = 43.416587
distances[42.0][11.5] = 43.545953
distances[42.0][12.0] = 43.680659
distances[42.0][12.5] = 43.820657
distances[42.0][13.0] = 43.965896
distances[42.0][13.5] = 44.116324
distances[42.0][14.0] = 44.271887
distances[42.0][14.5] = 44.432533
distances[42.0][15.0] = 44.598206
distances[42.0][15.5] = 44.768851
distances[42.0][16.0] = 44.94441
distances[42.0][16.5] = 45.124827
distances[42.0][17.0] = 45.310043
distances[42.0][17.5] = 45.5
distances[42.0][18.0] = 45.694639
distances[42.0][18.5] = 45.893899
distances[42.0][19.0] = 46.097722
distances[42.0][19.5] = 46.306047
distances[42.0][20.0] = 46.518813
distances[42.0][20.5] = 46.73596
distances[42.0][21.0] = 46.957428
distances[42.0][21.5] = 47.183154
distances[42.0][22.0] = 47.413078
distances[42.0][22.5] = 47.647141
distances[42.0][23.0] = 47.88528
distances[42.0][23.5] = 48.127435
distances[42.0][24.0] = 48.373546
distances[42.0][24.5] = 48.623554
distances[42.0][25.0] = 48.877398
distances[42.0][25.5] = 49.135018
distances[42.0][26.0] = 49.396356
distances[42.0][26.5] = 49.661353
distances[42.0][27.0] = 49.929951
distances[42.0][27.5] = 50.202092
distances[42.0][28.0] = 50.477718
distances[42.0][28.5] = 50.756773
distances[42.0][29.0] = 51.039201
distances[42.0][29.5] = 51.324945
distances[42.0][30.0] = 51.613952
distances[42.0][30.5] = 51.906165
distances[42.0][31.0] = 52.201533
distances[42.0][31.5] = 52.5
distances[42.0][32.0] = 52.801515
distances[42.0][32.5] = 53.106026
distances[42.0][33.0] = 53.413481
distances[42.0][33.5] = 53.723831
distances[42.0][34.0] = 54.037024
distances[42.0][34.5] = 54.353013
distances[42.0][35.0] = 54.671748
distances[42.0][35.5] = 54.993181
distances[42.0][36.0] = 55.317267
distances[42.0][36.5] = 55.643957
distances[42.0][37.0] = 55.973208
distances[42.0][37.5] = 56.304973
distances[42.0][38.0] = 56.639209
distances[42.0][38.5] = 56.975872
distances[42.0][39.0] = 57.31492
distances[42.0][39.5] = 57.656309
distances[42.0][40.0] = 58.0
distances[42.0][40.5] = 58.345951
distances[42.0][41.0] = 58.694122
distances[42.0][41.5] = 59.044475
distances[42.0][42.0] = 59.39697
distances[42.5] = {}
distances[42.5][0.0] = 42.5
distances[42.5][0.5] = 42.502941
distances[42.5][1.0] = 42.511763
distances[42.5][1.5] = 42.526462
distances[42.5][2.0] = 42.547033
distances[42.5][2.5] = 42.573466
distances[42.5][3.0] = 42.605751
distances[42.5][3.5] = 42.643874
distances[42.5][4.0] = 42.68782
distances[42.5][4.5] = 42.737571
distances[42.5][5.0] = 42.793107
distances[42.5][5.5] = 42.854405
distances[42.5][6.0] = 42.92144
distances[42.5][6.5] = 42.994186
distances[42.5][7.0] = 43.072613
distances[42.5][7.5] = 43.156691
distances[42.5][8.0] = 43.246387
distances[42.5][8.5] = 43.341666
distances[42.5][9.0] = 43.442491
distances[42.5][9.5] = 43.548823
distances[42.5][10.0] = 43.660623
distances[42.5][10.5] = 43.777848
distances[42.5][11.0] = 43.900456
distances[42.5][11.5] = 44.0284
distances[42.5][12.0] = 44.161635
distances[42.5][12.5] = 44.300113
distances[42.5][13.0] = 44.443785
distances[42.5][13.5] = 44.5926
distances[42.5][14.0] = 44.746508
distances[42.5][14.5] = 44.905456
distances[42.5][15.0] = 45.069391
distances[42.5][15.5] = 45.238258
distances[42.5][16.0] = 45.412003
distances[42.5][16.5] = 45.590569
distances[42.5][17.0] = 45.773901
distances[42.5][17.5] = 45.961941
distances[42.5][18.0] = 46.154631
distances[42.5][18.5] = 46.351915
distances[42.5][19.0] = 46.553732
distances[42.5][19.5] = 46.760026
distances[42.5][20.0] = 46.970736
distances[42.5][20.5] = 47.185803
distances[42.5][21.0] = 47.405168
distances[42.5][21.5] = 47.628773
distances[42.5][22.0] = 47.856556
distances[42.5][22.5] = 48.08846
distances[42.5][23.0] = 48.324424
distances[42.5][23.5] = 48.56439
distances[42.5][24.0] = 48.808298
distances[42.5][24.5] = 49.05609
distances[42.5][25.0] = 49.307707
distances[42.5][25.5] = 49.563091
distances[42.5][26.0] = 49.822184
distances[42.5][26.5] = 50.084928
distances[42.5][27.0] = 50.351266
distances[42.5][27.5] = 50.621142
distances[42.5][28.0] = 50.894499
distances[42.5][28.5] = 51.171281
distances[42.5][29.0] = 51.451433
distances[42.5][29.5] = 51.734901
distances[42.5][30.0] = 52.02163
distances[42.5][30.5] = 52.311567
distances[42.5][31.0] = 52.604658
distances[42.5][31.5] = 52.900851
distances[42.5][32.0] = 53.200094
distances[42.5][32.5] = 53.502336
distances[42.5][33.0] = 53.807527
distances[42.5][33.5] = 54.115617
distances[42.5][34.0] = 54.426556
distances[42.5][34.5] = 54.740296
distances[42.5][35.0] = 55.056789
distances[42.5][35.5] = 55.375988
distances[42.5][36.0] = 55.697846
distances[42.5][36.5] = 56.022317
distances[42.5][37.0] = 56.349357
distances[42.5][37.5] = 56.67892
distances[42.5][38.0] = 57.010964
distances[42.5][38.5] = 57.345444
distances[42.5][39.0] = 57.68232
distances[42.5][39.5] = 58.021548
distances[42.5][40.0] = 58.363088
distances[42.5][40.5] = 58.706899
distances[42.5][41.0] = 59.052942
distances[42.5][41.5] = 59.401178
distances[42.5][42.0] = 59.751569
distances[42.5][42.5] = 60.104076
distances[43.0] = {}
distances[43.0][0.0] = 43.0
distances[43.0][0.5] = 43.002907
distances[43.0][1.0] = 43.011626
distances[43.0][1.5] = 43.026155
distances[43.0][2.0] = 43.046487
distances[43.0][2.5] = 43.072613
distances[43.0][3.0] = 43.104524
distances[43.0][3.5] = 43.142207
distances[43.0][4.0] = 43.185646
distances[43.0][4.5] = 43.234824
distances[43.0][5.0] = 43.289722
distances[43.0][5.5] = 43.350317
distances[43.0][6.0] = 43.416587
distances[43.0][6.5] = 43.488504
distances[43.0][7.0] = 43.566042
distances[43.0][7.5] = 43.64917
distances[43.0][8.0] = 43.737855
distances[43.0][8.5] = 43.832066
distances[43.0][9.0] = 43.931765
distances[43.0][9.5] = 44.036916
distances[43.0][10.0] = 44.14748
distances[43.0][10.5] = 44.263416
distances[43.0][11.0] = 44.384682
distances[43.0][11.5] = 44.511235
distances[43.0][12.0] = 44.643029
distances[43.0][12.5] = 44.780018
distances[43.0][13.0] = 44.922155
distances[43.0][13.5] = 45.069391
distances[43.0][14.0] = 45.221676
distances[43.0][14.5] = 45.37896
distances[43.0][15.0] = 45.54119
distances[43.0][15.5] = 45.708314
distances[43.0][16.0] = 45.880279
distances[43.0][16.5] = 46.05703
distances[43.0][17.0] = 46.238512
distances[43.0][17.5] = 46.42467
distances[43.0][18.0] = 46.615448
distances[43.0][18.5] = 46.810789
distances[43.0][19.0] = 47.010637
distances[43.0][19.5] = 47.214934
distances[43.0][20.0] = 47.423623
distances[43.0][20.5] = 47.636646
distances[43.0][21.0] = 47.853944
distances[43.0][21.5] = 48.075462
distances[43.0][22.0] = 48.301139
distances[43.0][22.5] = 48.530918
distances[43.0][23.0] = 48.764741
distances[43.0][23.5] = 49.002551
distances[43.0][24.0] = 49.244289
distances[43.0][24.5] = 49.489898
distances[43.0][25.0] = 49.73932
distances[43.0][25.5] = 49.992499
distances[43.0][26.0] = 50.249378
distances[43.0][26.5] = 50.5099
distances[43.0][27.0] = 50.774009
distances[43.0][27.5] = 51.04165
distances[43.0][28.0] = 51.312766
distances[43.0][28.5] = 51.587305
distances[43.0][29.0] = 51.86521
distances[43.0][29.5] = 52.146428
distances[43.0][30.0] = 52.430907
distances[43.0][30.5] = 52.718593
distances[43.0][31.0] = 53.009433
distances[43.0][31.5] = 53.303377
distances[43.0][32.0] = 53.600373
distances[43.0][32.5] = 53.900371
distances[43.0][33.0] = 54.203321
distances[43.0][33.5] = 54.509174
distances[43.0][34.0] = 54.81788
distances[43.0][34.5] = 55.129393
distances[43.0][35.0] = 55.443665
distances[43.0][35.5] = 55.760649
distances[43.0][36.0] = 56.0803
distances[43.0][36.5] = 56.402571
distances[43.0][37.0] = 56.727418
distances[43.0][37.5] = 57.054798
distances[43.0][38.0] = 57.384667
distances[43.0][38.5] = 57.716982
distances[43.0][39.0] = 58.051701
distances[43.0][39.5] = 58.388783
distances[43.0][40.0] = 58.728187
distances[43.0][40.5] = 59.069874
distances[43.0][41.0] = 59.413803
distances[43.0][41.5] = 59.759936
distances[43.0][42.0] = 60.108236
distances[43.0][42.5] = 60.458664
distances[43.0][43.0] = 60.811183
distances[43.5] = {}
distances[43.5][0.0] = 43.5
distances[43.5][0.5] = 43.502873
distances[43.5][1.0] = 43.511493
distances[43.5][1.5] = 43.525854
distances[43.5][2.0] = 43.545953
distances[43.5][2.5] = 43.57178
distances[43.5][3.0] = 43.603326
distances[43.5][3.5] = 43.640577
distances[43.5][4.0] = 43.683521
distances[43.5][4.5] = 43.732139
distances[43.5][5.0] = 43.786413
distances[43.5][5.5] = 43.846323
distances[43.5][6.0] = 43.911844
distances[43.5][6.5] = 43.982951
distances[43.5][7.0] = 44.059619
distances[43.5][7.5] = 44.141817
distances[43.5][8.0] = 44.229515
distances[43.5][8.5] = 44.32268
distances[43.5][9.0] = 44.421279
distances[43.5][9.5] = 44.525274
distances[43.5][10.0] = 44.634628
distances[43.5][10.5] = 44.749302
distances[43.5][11.0] = 44.869255
distances[43.5][11.5] = 44.994444
distances[43.5][12.0] = 45.124827
distances[43.5][12.5] = 45.260358
distances[43.5][13.0] = 45.400991
distances[43.5][13.5] = 45.546679
distances[43.5][14.0] = 45.697374
distances[43.5][14.5] = 45.853026
distances[43.5][15.0] = 46.013585
distances[43.5][15.5] = 46.179
distances[43.5][16.0] = 46.349218
distances[43.5][16.5] = 46.524187
distances[43.5][17.0] = 46.703854
distances[43.5][17.5] = 46.888165
distances[43.5][18.0] = 47.077064
distances[43.5][18.5] = 47.270498
distances[43.5][19.0] = 47.468411
distances[43.5][19.5] = 47.670746
distances[43.5][20.0] = 47.877448
distances[43.5][20.5] = 48.08846
distances[43.5][21.0] = 48.303727
distances[43.5][21.5] = 48.52319
distances[43.5][22.0] = 48.746795
distances[43.5][22.5] = 48.974483
distances[43.5][23.0] = 49.206199
distances[43.5][23.5] = 49.441885
distances[43.5][24.0] = 49.681485
distances[43.5][24.5] = 49.924944
distances[43.5][25.0] = 50.172203
distances[43.5][25.5] = 50.423209
distances[43.5][26.0] = 50.677904
distances[43.5][26.5] = 50.936235
distances[43.5][27.0] = 51.198144
distances[43.5][27.5] = 51.463579
distances[43.5][28.0] = 51.732485
distances[43.5][28.5] = 52.004807
distances[43.5][29.0] = 52.280493
distances[43.5][29.5] = 52.55949
distances[43.5][30.0] = 52.841745
distances[43.5][30.5] = 53.127206
distances[43.5][31.0] = 53.415822
distances[43.5][31.5] = 53.707541
distances[43.5][32.0] = 54.002315
distances[43.5][32.5] = 54.300092
distances[43.5][33.0] = 54.600824
distances[43.5][33.5] = 54.904462
distances[43.5][34.0] = 55.210959
distances[43.5][34.5] = 55.520267
distances[43.5][35.0] = 55.832338
distances[43.5][35.5] = 56.147128
distances[43.5][36.0] = 56.464591
distances[43.5][36.5] = 56.784681
distances[43.5][37.0] = 57.107355
distances[43.5][37.5] = 57.432569
distances[43.5][38.0] = 57.76028
distances[43.5][38.5] = 58.090447
distances[43.5][39.0] = 58.423026
distances[43.5][39.5] = 58.757978
distances[43.5][40.0] = 59.095262
distances[43.5][40.5] = 59.434838
distances[43.5][41.0] = 59.776668
distances[43.5][41.5] = 60.120712
distances[43.5][42.0] = 60.466933
distances[43.5][42.5] = 60.815294
distances[43.5][43.0] = 61.165758
distances[43.5][43.5] = 61.51829
distances[44.0] = {}
distances[44.0][0.0] = 44.0
distances[44.0][0.5] = 44.002841
distances[44.0][1.0] = 44.011362
distances[44.0][1.5] = 44.025561
distances[44.0][2.0] = 44.045431
distances[44.0][2.5] = 44.070965
distances[44.0][3.0] = 44.102154
distances[44.0][3.5] = 44.138985
distances[44.0][4.0] = 44.181444
distances[44.0][4.5] = 44.229515
distances[44.0][5.0] = 44.28318
distances[44.0][5.5] = 44.342418
distances[44.0][6.0] = 44.407207
distances[44.0][6.5] = 44.477522
distances[44.0][7.0] = 44.553339
distances[44.0][7.5] = 44.634628
distances[44.0][8.0] = 44.72136
distances[44.0][8.5] = 44.813502
distances[44.0][9.0] = 44.911023
distances[44.0][9.5] = 45.013887
distances[44.0][10.0] = 45.122057
distances[44.0][10.5] = 45.235495
distances[44.0][11.0] = 45.354162
distances[44.0][11.5] = 45.478017
distances[44.0][12.0] = 45.607017
distances[44.0][12.5] = 45.741119
distances[44.0][13.0] = 45.880279
distances[44.0][13.5] = 46.02445
distances[44.0][14.0] = 46.173586
distances[44.0][14.5] = 46.327638
distances[44.0][15.0] = 46.486557
distances[44.0][15.5] = 46.650295
distances[44.0][16.0] = 46.8188
distances[44.0][16.5] = 46.992021
distances[44.0][17.0] = 47.169906
distances[44.0][17.5] = 47.352402
distances[44.0][18.0] = 47.539457
distances[44.0][18.5] = 47.731017
distances[44.0][19.0] = 47.927028
distances[44.0][19.5] = 48.127435
distances[44.0][20.0] = 48.332184
distances[44.0][20.5] = 48.54122
distances[44.0][21.0] = 48.754487
distances[44.0][21.5] = 48.971931
distances[44.0][22.0] = 49.193496
distances[44.0][22.5] = 49.419126
distances[44.0][23.0] = 49.648766
distances[44.0][23.5] = 49.882362
distances[44.0][24.0] = 50.119856
distances[44.0][24.5] = 50.361195
distances[44.0][25.0] = 50.606324
distances[44.0][25.5] = 50.855187
distances[44.0][26.0] = 51.107729
distances[44.0][26.5] = 51.363898
distances[44.0][27.0] = 51.623638
distances[44.0][27.5] = 51.886896
distances[44.0][28.0] = 52.153619
distances[44.0][28.5] = 52.423754
distances[44.0][29.0] = 52.697249
distances[44.0][29.5] = 52.97405
distances[44.0][30.0] = 53.254108
distances[44.0][30.5] = 53.53737
distances[44.0][31.0] = 53.823787
distances[44.0][31.5] = 54.113307
distances[44.0][32.0] = 54.405882
distances[44.0][32.5] = 54.701463
distances[44.0][33.0] = 55.0
distances[44.0][33.5] = 55.301447
distances[44.0][34.0] = 55.605755
distances[44.0][34.5] = 55.912879
distances[44.0][35.0] = 56.222771
distances[44.0][35.5] = 56.535387
distances[44.0][36.0] = 56.850682
distances[44.0][36.5] = 57.16861
distances[44.0][37.0] = 57.489129
distances[44.0][37.5] = 57.812196
distances[44.0][38.0] = 58.137767
distances[44.0][38.5] = 58.465802
distances[44.0][39.0] = 58.796258
distances[44.0][39.5] = 59.129096
distances[44.0][40.0] = 59.464275
distances[44.0][40.5] = 59.801756
distances[44.0][41.0] = 60.1415
distances[44.0][41.5] = 60.483469
distances[44.0][42.0] = 60.827625
distances[44.0][42.5] = 61.173932
distances[44.0][43.0] = 61.522354
distances[44.0][43.5] = 61.872853
distances[44.0][44.0] = 62.225397
distances[44.5] = {}
distances[44.5][0.0] = 44.5
distances[44.5][0.5] = 44.502809
distances[44.5][1.0] = 44.511235
distances[44.5][1.5] = 44.525274
distances[44.5][2.0] = 44.544921
distances[44.5][2.5] = 44.570169
distances[44.5][3.0] = 44.601009
distances[44.5][3.5] = 44.637428
distances[44.5][4.0] = 44.679414
distances[44.5][4.5] = 44.726949
distances[44.5][5.0] = 44.780018
distances[44.5][5.5] = 44.838599
distances[44.5][6.0] = 44.902673
distances[44.5][6.5] = 44.972214
distances[44.5][7.0] = 45.047197
distances[44.5][7.5] = 45.127597
distances[44.5][8.0] = 45.213383
distances[44.5][8.5] = 45.304525
distances[44.5][9.0] = 45.400991
distances[44.5][9.5] = 45.502747
distances[44.5][10.0] = 45.609758
distances[44.5][10.5] = 45.721986
distances[44.5][11.0] = 45.839394
distances[44.5][11.5] = 45.961941
distances[44.5][12.0] = 46.089587
distances[44.5][12.5] = 46.222289
distances[44.5][13.0] = 46.360004
distances[44.5][13.5] = 46.502688
distances[44.5][14.0] = 46.650295
distances[44.5][14.5] = 46.802778
distances[44.5][15.0] = 46.960089
distances[44.5][15.5] = 47.122182
distances[44.5][16.0] = 47.289005
distances[44.5][16.5] = 47.46051
distances[44.5][17.0] = 47.636646
distances[44.5][17.5] = 47.817361
distances[44.5][18.0] = 48.002604
distances[44.5][18.5] = 48.192323
distances[44.5][19.0] = 48.386465
distances[44.5][19.5] = 48.584977
distances[44.5][20.0] = 48.787806
distances[44.5][20.5] = 48.994898
distances[44.5][21.0] = 49.206199
distances[44.5][21.5] = 49.421655
distances[44.5][22.0] = 49.641213
distances[44.5][22.5] = 49.864817
distances[44.5][23.0] = 50.092415
distances[44.5][23.5] = 50.323951
distances[44.5][24.0] = 50.559371
distances[44.5][24.5] = 50.798622
distances[44.5][25.0] = 51.04165
distances[44.5][25.5] = 51.2884
distances[44.5][26.0] = 51.53882
distances[44.5][26.5] = 51.792857
distances[44.5][27.0] = 52.050456
distances[44.5][27.5] = 52.311567
distances[44.5][28.0] = 52.576135
distances[44.5][28.5] = 52.84411
distances[44.5][29.0] = 53.11544
distances[44.5][29.5] = 53.390074
distances[44.5][30.0] = 53.667961
distances[44.5][30.5] = 53.94905
distances[44.5][31.0] = 54.233292
distances[44.5][31.5] = 54.520638
distances[44.5][32.0] = 54.811039
distances[44.5][32.5] = 55.104446
distances[44.5][33.0] = 55.400812
distances[44.5][33.5] = 55.70009
distances[44.5][34.0] = 56.002232
distances[44.5][34.5] = 56.307193
distances[44.5][35.0] = 56.614927
distances[44.5][35.5] = 56.92539
distances[44.5][36.0] = 57.238536
distances[44.5][36.5] = 57.554322
distances[44.5][37.0] = 57.872705
distances[44.5][37.5] = 58.193642
distances[44.5][38.0] = 58.517092
distances[44.5][38.5] = 58.843011
distances[44.5][39.0] = 59.171361
distances[44.5][39.5] = 59.502101
distances[44.5][40.0] = 59.83519
distances[44.5][40.5] = 60.170591
distances[44.5][41.0] = 60.508264
distances[44.5][41.5] = 60.848172
distances[44.5][42.0] = 61.190277
distances[44.5][42.5] = 61.534543
distances[44.5][43.0] = 61.880934
distances[44.5][43.5] = 62.229414
distances[44.5][44.0] = 62.579949
distances[44.5][44.5] = 62.932504
distances[45.0] = {}
distances[45.0][0.0] = 45.0
distances[45.0][0.5] = 45.002778
distances[45.0][1.0] = 45.01111
distances[45.0][1.5] = 45.024993
distances[45.0][2.0] = 45.044423
distances[45.0][2.5] = 45.069391
distances[45.0][3.0] = 45.099889
distances[45.0][3.5] = 45.135906
distances[45.0][4.0] = 45.177428
distances[45.0][4.5] = 45.22444
distances[45.0][5.0] = 45.276926
distances[45.0][5.5] = 45.334865
distances[45.0][6.0] = 45.398238
distances[45.0][6.5] = 45.467021
distances[45.0][7.0] = 45.54119
distances[45.0][7.5] = 45.620719
distances[45.0][8.0] = 45.70558
distances[45.0][8.5] = 45.795742
distances[45.0][9.0] = 45.891176
distances[45.0][9.5] = 45.991847
distances[45.0][10.0] = 46.097722
distances[45.0][10.5] = 46.208765
distances[45.0][11.0] = 46.324939
distances[45.0][11.5] = 46.446205
distances[45.0][12.0] = 46.572524
distances[45.0][12.5] = 46.703854
distances[45.0][13.0] = 46.840154
distances[45.0][13.5] = 46.981379
distances[45.0][14.0] = 47.127487
distances[45.0][14.5] = 47.278431
distances[45.0][15.0] = 47.434165
distances[45.0][15.5] = 47.594643
distances[45.0][16.0] = 47.759816
distances[45.0][16.5] = 47.929636
distances[45.0][17.0] = 48.104054
distances[45.0][17.5] = 48.28302
distances[45.0][18.0] = 48.466483
distances[45.0][18.5] = 48.654393
distances[45.0][19.0] = 48.846699
distances[45.0][19.5] = 49.043348
distances[45.0][20.0] = 49.244289
distances[45.0][20.5] = 49.449469
distances[45.0][21.0] = 49.658836
distances[45.0][21.5] = 49.872337
distances[45.0][22.0] = 50.089919
distances[45.0][22.5] = 50.311529
distances[45.0][23.0] = 50.537115
distances[45.0][23.5] = 50.766623
distances[45.0][24.0] = 51.0
distances[45.0][24.5] = 51.237194
distances[45.0][25.0] = 51.478151
distances[45.0][25.5] = 51.722819
distances[45.0][26.0] = 51.971146
distances[45.0][26.5] = 52.223079
distances[45.0][27.0] = 52.478567
distances[45.0][27.5] = 52.737558
distances[45.0][28.0] = 53.0
distances[45.0][28.5] = 53.265843
distances[45.0][29.0] = 53.535035
distances[45.0][29.5] = 53.807527
distances[45.0][30.0] = 54.083269
distances[45.0][30.5] = 54.362211
distances[45.0][31.0] = 54.644304
distances[45.0][31.5] = 54.9295
distances[45.0][32.0] = 55.217751
distances[45.0][32.5] = 55.509008
distances[45.0][33.0] = 55.803226
distances[45.0][33.5] = 56.100357
distances[45.0][34.0] = 56.400355
distances[45.0][34.5] = 56.703175
distances[45.0][35.0] = 57.008771
distances[45.0][35.5] = 57.3171
distances[45.0][36.0] = 57.628118
distances[45.0][36.5] = 57.941781
distances[45.0][37.0] = 58.258047
distances[45.0][37.5] = 58.576873
distances[45.0][38.0] = 58.898217
distances[45.0][38.5] = 59.22204
distances[45.0][39.0] = 59.5483
distances[45.0][39.5] = 59.876957
distances[45.0][40.0] = 60.207973
distances[45.0][40.5] = 60.541308
distances[45.0][41.0] = 60.876925
distances[45.0][41.5] = 61.214786
distances[45.0][42.0] = 61.554854
distances[45.0][42.5] = 61.897092
distances[45.0][43.0] = 62.241465
distances[45.0][43.5] = 62.587938
distances[45.0][44.0] = 62.936476
distances[45.0][44.5] = 63.287044
distances[45.0][45.0] = 63.63961
distances[45.5] = {}
distances[45.5][0.0] = 45.5
distances[45.5][0.5] = 45.502747
distances[45.5][1.0] = 45.510988
distances[45.5][1.5] = 45.524719
distances[45.5][2.0] = 45.543935
distances[45.5][2.5] = 45.56863
distances[45.5][3.0] = 45.598794
distances[45.5][3.5] = 45.634417
distances[45.5][4.0] = 45.675486
distances[45.5][4.5] = 45.721986
distances[45.5][5.0] = 45.773901
distances[45.5][5.5] = 45.831212
distances[45.5][6.0] = 45.893899
distances[45.5][6.5] = 45.961941
distances[45.5][7.0] = 46.035313
distances[45.5][7.5] = 46.113989
distances[45.5][8.0] = 46.197944
distances[45.5][8.5] = 46.287147
distances[45.5][9.0] = 46.38157
distances[45.5][9.5] = 46.481179
distances[45.5][10.0] = 46.585942
distances[45.5][10.5] = 46.695824
distances[45.5][11.0] = 46.810789
distances[45.5][11.5] = 46.9308
distances[45.5][12.0] = 47.055818
distances[45.5][12.5] = 47.185803
distances[45.5][13.0] = 47.320714
distances[45.5][13.5] = 47.46051
distances[45.5][14.0] = 47.605147
distances[45.5][14.5] = 47.754581
distances[45.5][15.0] = 47.908767
distances[45.5][15.5] = 48.067661
distances[45.5][16.0] = 48.231214
distances[45.5][16.5] = 48.39938
distances[45.5][17.0] = 48.572111
distances[45.5][17.5] = 48.749359
distances[45.5][18.0] = 48.931074
distances[45.5][18.5] = 49.117207
distances[45.5][19.0] = 49.307707
distances[45.5][19.5] = 49.502525
distances[45.5][20.0] = 49.70161
distances[45.5][20.5] = 49.90491
distances[45.5][21.0] = 50.112374
distances[45.5][21.5] = 50.323951
distances[45.5][22.0] = 50.539588
distances[45.5][22.5] = 50.759236
distances[45.5][23.0] = 50.98284
distances[45.5][23.5] = 51.210351
distances[45.5][24.0] = 51.441715
distances[45.5][24.5] = 51.676881
distances[45.5][25.0] = 51.915797
distances[45.5][25.5] = 52.158413
distances[45.5][26.0] = 52.404675
distances[45.5][26.5] = 52.654534
distances[45.5][27.0] = 52.907939
distances[45.5][27.5] = 53.164838
distances[45.5][28.0] = 53.425181
distances[45.5][28.5] = 53.688919
distances[45.5][29.0] = 53.956001
distances[45.5][29.5] = 54.226377
distances[45.5][30.0] = 54.5
distances[45.5][30.5] = 54.77682
distances[45.5][31.0] = 55.056789
distances[45.5][31.5] = 55.339859
distances[45.5][32.0] = 55.625983
distances[45.5][32.5] = 55.915114
distances[45.5][33.0] = 56.207206
distances[45.5][33.5] = 56.502212
distances[45.5][34.0] = 56.800088
distances[45.5][34.5] = 57.100788
distances[45.5][35.0] = 57.404268
distances[45.5][35.5] = 57.710484
distances[45.5][36.0] = 58.019393
distances[45.5][36.5] = 58.330952
distances[45.5][37.0] = 58.645119
distances[45.5][37.5] = 58.961852
distances[45.5][38.0] = 59.28111
distances[45.5][38.5] = 59.602852
distances[45.5][39.0] = 59.927039
distances[45.5][39.5] = 60.253631
distances[45.5][40.0] = 60.582588
distances[45.5][40.5] = 60.913874
distances[45.5][41.0] = 61.247449
distances[45.5][41.5] = 61.583277
distances[45.5][42.0] = 61.921321
distances[45.5][42.5] = 62.261545
distances[45.5][43.0] = 62.603914
distances[45.5][43.5] = 62.948392
distances[45.5][44.0] = 63.294945
distances[45.5][44.5] = 63.643539
distances[45.5][45.0] = 63.99414
distances[45.5][45.5] = 64.346717
distances[46.0] = {}
distances[46.0][0.0] = 46.0
distances[46.0][0.5] = 46.002717
distances[46.0][1.0] = 46.010868
distances[46.0][1.5] = 46.02445
distances[46.0][2.0] = 46.043458
distances[46.0][2.5] = 46.067885
distances[46.0][3.0] = 46.097722
distances[46.0][3.5] = 46.13296
distances[46.0][4.0] = 46.173586
distances[46.0][4.5] = 46.219585
distances[46.0][5.0] = 46.270941
distances[46.0][5.5] = 46.327638
distances[46.0][6.0] = 46.389654
distances[46.0][6.5] = 46.456969
distances[46.0][7.0] = 46.52956
distances[46.0][7.5] = 46.607403
distances[46.0][8.0] = 46.69047
distances[46.0][8.5] = 46.778734
distances[46.0][9.0] = 46.872167
distances[46.0][9.5] = 46.970736
distances[46.0][10.0] = 47.074409
distances[46.0][10.5] = 47.183154
distances[46.0][11.0] = 47.296934
distances[46.0][11.5] = 47.415715
distances[46.0][12.0] = 47.539457
distances[46.0][12.5] = 47.668124
distances[46.0][13.0] = 47.801674
distances[46.0][13.5] = 47.940067
distances[46.0][14.0] = 48.083261
distances[46.0][14.5] = 48.231214
distances[46.0][15.0] = 48.383882
distances[46.0][15.5] = 48.54122
distances[46.0][16.0] = 48.703183
distances[46.0][16.5] = 48.869725
distances[46.0][17.0] = 49.040799
distances[46.0][17.5] = 49.216359
distances[46.0][18.0] = 49.396356
distances[46.0][18.5] = 49.580742
distances[46.0][19.0] = 49.769469
distances[46.0][19.5] = 49.962486
distances[46.0][20.0] = 50.159745
distances[46.0][20.5] = 50.361195
distances[46.0][21.0] = 50.566788
distances[46.0][21.5] = 50.776471
distances[46.0][22.0] = 50.990195
distances[46.0][22.5] = 51.20791
distances[46.0][23.0] = 51.429563
distances[46.0][23.5] = 51.655106
distances[46.0][24.0] = 51.884487
distances[46.0][24.5] = 52.117655
distances[46.0][25.0] = 52.35456
distances[46.0][25.5] = 52.595152
distances[46.0][26.0] = 52.839379
distances[46.0][26.5] = 53.087192
distances[46.0][27.0] = 53.338541
distances[46.0][27.5] = 53.593376
distances[46.0][28.0] = 53.851648
distances[46.0][28.5] = 54.113307
distances[46.0][29.0] = 54.378304
distances[46.0][29.5] = 54.646592
distances[46.0][30.0] = 54.918121
distances[46.0][30.5] = 55.192844
distances[46.0][31.0] = 55.470713
distances[46.0][31.5] = 55.751682
distances[46.0][32.0] = 56.035703
distances[46.0][32.5] = 56.322731
distances[46.0][33.0] = 56.612719
distances[46.0][33.5] = 56.905624
distances[46.0][34.0] = 57.201399
distances[46.0][34.5] = 57.5
distances[46.0][35.0] = 57.801384
distances[46.0][35.5] = 58.105507
distances[46.0][36.0] = 58.412327
distances[46.0][36.5] = 58.721802
distances[46.0][37.0] = 59.033889
distances[46.0][37.5] = 59.348547
distances[46.0][38.0] = 59.665736
distances[46.0][38.5] = 59.985415
distances[46.0][39.0] = 60.307545
distances[46.0][39.5] = 60.632087
distances[46.0][40.0] = 60.959003
distances[46.0][40.5] = 61.288253
distances[46.0][41.0] = 61.619802
distances[46.0][41.5] = 61.953612
distances[46.0][42.0] = 62.289646
distances[46.0][42.5] = 62.627869
distances[46.0][43.0] = 62.968246
distances[46.0][43.5] = 63.310742
distances[46.0][44.0] = 63.655322
distances[46.0][44.5] = 64.001953
distances[46.0][45.0] = 64.350602
distances[46.0][45.5] = 64.701236
distances[46.0][46.0] = 65.053824
distances[46.5] = {}
distances[46.5][0.0] = 46.5
distances[46.5][0.5] = 46.502688
distances[46.5][1.0] = 46.510751
distances[46.5][1.5] = 46.524187
distances[46.5][2.0] = 46.542991
distances[46.5][2.5] = 46.567156
distances[46.5][3.0] = 46.596674
distances[46.5][3.5] = 46.631534
distances[46.5][4.0] = 46.671726
distances[46.5][4.5] = 46.717235
distances[46.5][5.0] = 46.768045
distances[46.5][5.5] = 46.824139
distances[46.5][6.0] = 46.885499
distances[46.5][6.5] = 46.952103
distances[46.5][7.0] = 47.02393
distances[46.5][7.5] = 47.100955
distances[46.5][8.0] = 47.183154
distances[46.5][8.5] = 47.270498
distances[46.5][9.0] = 47.36296
distances[46.5][9.5] = 47.46051
distances[46.5][10.0] = 47.563116
distances[46.5][10.5] = 47.670746
distances[46.5][11.0] = 47.783365
distances[46.5][11.5] = 47.900939
distances[46.5][12.0] = 48.023432
distances[46.5][12.5] = 48.150805
distances[46.5][13.0] = 48.28302
distances[46.5][13.5] = 48.420037
distances[46.5][14.0] = 48.561816
distances[46.5][14.5] = 48.708316
distances[46.5][15.0] = 48.859492
distances[46.5][15.5] = 49.015304
distances[46.5][16.0] = 49.175705
distances[46.5][16.5] = 49.340653
distances[46.5][17.0] = 49.5101
distances[46.5][17.5] = 49.684001
distances[46.5][18.0] = 49.86231
distances[46.5][18.5] = 50.04498
distances[46.5][19.0] = 50.231962
distances[46.5][19.5] = 50.423209
distances[46.5][20.0] = 50.618672
distances[46.5][20.5] = 50.818304
distances[46.5][21.0] = 51.022054
distances[46.5][21.5] = 51.229874
distances[46.5][22.0] = 51.441715
distances[46.5][22.5] = 51.657526
distances[46.5][23.0] = 51.877259
distances[46.5][23.5] = 52.100864
distances[46.5][24.0] = 52.328291
distances[46.5][24.5] = 52.55949
distances[46.5][25.0] = 52.794413
distances[46.5][25.5] = 53.033009
distances[46.5][26.0] = 53.275229
distances[46.5][26.5] = 53.521024
distances[46.5][27.0] = 53.770345
distances[46.5][27.5] = 54.023143
distances[46.5][28.0] = 54.27937
distances[46.5][28.5] = 54.538977
distances[46.5][29.0] = 54.801916
distances[46.5][29.5] = 55.06814
distances[46.5][30.0] = 55.3376
distances[46.5][30.5] = 55.610251
distances[46.5][31.0] = 55.886045
distances[46.5][31.5] = 56.164936
distances[46.5][32.0] = 56.446878
distances[46.5][32.5] = 56.731825
distances[46.5][33.0] = 57.019733
distances[46.5][33.5] = 57.310557
distances[46.5][34.0] = 57.604253
distances[46.5][34.5] = 57.900777
distances[46.5][35.0] = 58.200086
distances[46.5][35.5] = 58.502137
distances[46.5][36.0] = 58.806887
distances[46.5][36.5] = 59.114296
distances[46.5][37.0] = 59.424322
distances[46.5][37.5] = 59.736923
distances[46.5][38.0] = 60.052061
distances[46.5][38.5] = 60.369694
distances[46.5][39.0] = 60.689785
distances[46.5][39.5] = 61.012294
distances[46.5][40.0] = 61.337183
distances[46.5][40.5] = 61.664414
distances[46.5][41.0] = 61.993951
distances[46.5][41.5] = 62.325757
distances[46.5][42.0] = 62.659796
distances[46.5][42.5] = 62.996032
distances[46.5][43.0] = 63.33443
distances[46.5][43.5] = 63.674956
distances[46.5][44.0] = 64.017576
distances[46.5][44.5] = 64.362256
distances[46.5][45.0] = 64.708964
distances[46.5][45.5] = 65.057667
distances[46.5][46.0] = 65.408333
distances[46.5][46.5] = 65.760931
distances[47.0] = {}
distances[47.0][0.0] = 47.0
distances[47.0][0.5] = 47.002659
distances[47.0][1.0] = 47.010637
distances[47.0][1.5] = 47.02393
distances[47.0][2.0] = 47.042534
distances[47.0][2.5] = 47.066442
distances[47.0][3.0] = 47.095647
distances[47.0][3.5] = 47.130139
distances[47.0][4.0] = 47.169906
distances[47.0][4.5] = 47.214934
distances[47.0][5.0] = 47.265209
distances[47.0][5.5] = 47.320714
distances[47.0][6.0] = 47.381431
distances[47.0][6.5] = 47.447339
distances[47.0][7.0] = 47.518417
distances[47.0][7.5] = 47.594643
distances[47.0][8.0] = 47.67599
distances[47.0][8.5] = 47.762433
distances[47.0][9.0] = 47.853944
distances[47.0][9.5] = 47.950495
distances[47.0][10.0] = 48.052055
distances[47.0][10.5] = 48.158592
distances[47.0][11.0] = 48.270074
distances[47.0][11.5] = 48.386465
distances[47.0][12.0] = 48.507731
distances[47.0][12.5] = 48.633836
distances[47.0][13.0] = 48.764741
distances[47.0][13.5] = 48.900409
distances[47.0][14.0] = 49.040799
distances[47.0][14.5] = 49.185872
distances[47.0][15.0] = 49.335586
distances[47.0][15.5] = 49.489898
distances[47.0][16.0] = 49.648766
distances[47.0][16.5] = 49.812147
distances[47.0][17.0] = 49.979996
distances[47.0][17.5] = 50.152268
distances[47.0][18.0] = 50.328918
distances[47.0][18.5] = 50.5099
distances[47.0][19.0] = 50.695167
distances[47.0][19.5] = 50.884674
distances[47.0][20.0] = 51.078371
distances[47.0][20.5] = 51.276213
distances[47.0][21.0] = 51.478151
distances[47.0][21.5] = 51.684137
distances[47.0][22.0] = 51.894123
distances[47.0][22.5] = 52.108061
distances[47.0][23.0] = 52.325902
distances[47.0][23.5] = 52.547597
distances[47.0][24.0] = 52.773099
distances[47.0][24.5] = 53.002358
distances[47.0][25.0] = 53.235327
distances[47.0][25.5] = 53.471955
distances[47.0][26.0] = 53.712196
distances[47.0][26.5] = 53.956001
distances[47.0][27.0] = 54.203321
distances[47.0][27.5] = 54.454109
distances[47.0][28.0] = 54.708317
distances[47.0][28.5] = 54.965899
distances[47.0][29.0] = 55.226805
distances[47.0][29.5] = 55.49099
distances[47.0][30.0] = 55.758407
distances[47.0][30.5] = 56.02901
distances[47.0][31.0] = 56.302753
distances[47.0][31.5] = 56.57959
distances[47.0][32.0] = 56.859476
distances[47.0][32.5] = 57.142366
distances[47.0][33.0] = 57.428216
distances[47.0][33.5] = 57.716982
distances[47.0][34.0] = 58.00862
distances[47.0][34.5] = 58.303087
distances[47.0][35.0] = 58.600341
distances[47.0][35.5] = 58.90034
distances[47.0][36.0] = 59.20304
distances[47.0][36.5] = 59.508403
distances[47.0][37.0] = 59.816386
distances[47.0][37.5] = 60.126949
distances[47.0][38.0] = 60.440053
distances[47.0][38.5] = 60.755658
distances[47.0][39.0] = 61.073726
distances[47.0][39.5] = 61.394218
distances[47.0][40.0] = 61.717096
distances[47.0][40.5] = 62.042324
distances[47.0][41.0] = 62.369865
distances[47.0][41.5] = 62.699681
distances[47.0][42.0] = 63.031738
distances[47.0][42.5] = 63.366
distances[47.0][43.0] = 63.702433
distances[47.0][43.5] = 64.041002
distances[47.0][44.0] = 64.381674
distances[47.0][44.5] = 64.724416
distances[47.0][45.0] = 65.069194
distances[47.0][45.5] = 65.415977
distances[47.0][46.0] = 65.764732
distances[47.0][46.5] = 66.115429
distances[47.0][47.0] = 66.468037
distances[47.5] = {}
distances[47.5][0.0] = 47.5
distances[47.5][0.5] = 47.502632
distances[47.5][1.0] = 47.510525
distances[47.5][1.5] = 47.523678
distances[47.5][2.0] = 47.542087
distances[47.5][2.5] = 47.565744
distances[47.5][3.0] = 47.594643
distances[47.5][3.5] = 47.628773
distances[47.5][4.0] = 47.668124
distances[47.5][4.5] = 47.712682
distances[47.5][5.0] = 47.762433
distances[47.5][5.5] = 47.817361
distances[47.5][6.0] = 47.877448
distances[47.5][6.5] = 47.942674
distances[47.5][7.0] = 48.013019
distances[47.5][7.5] = 48.08846
distances[47.5][8.0] = 48.168973
distances[47.5][8.5] = 48.254533
distances[47.5][9.0] = 48.345114
distances[47.5][9.5] = 48.440685
distances[47.5][10.0] = 48.54122
distances[47.5][10.5] = 48.646685
distances[47.5][11.0] = 48.757051
distances[47.5][11.5] = 48.872283
distances[47.5][12.0] = 48.992346
distances[47.5][12.5] = 49.117207
distances[47.5][13.0] = 49.246827
distances[47.5][13.5] = 49.381171
distances[47.5][14.0] = 49.520198
distances[47.5][14.5] = 49.66387
distances[47.5][15.0] = 49.812147
distances[47.5][15.5] = 49.964988
distances[47.5][16.0] = 50.12235
distances[47.5][16.5] = 50.284192
distances[47.5][17.0] = 50.450471
distances[47.5][17.5] = 50.621142
distances[47.5][18.0] = 50.796161
distances[47.5][18.5] = 50.975484
distances[47.5][19.0] = 51.159066
distances[47.5][19.5] = 51.34686
distances[47.5][20.0] = 51.53882
distances[47.5][20.5] = 51.734901
distances[47.5][21.0] = 51.935056
distances[47.5][21.5] = 52.139237
distances[47.5][22.0] = 52.347397
distances[47.5][22.5] = 52.55949
distances[47.5][23.0] = 52.775468
distances[47.5][23.5] = 52.995283
distances[47.5][24.0] = 53.218888
distances[47.5][24.5] = 53.446235
distances[47.5][25.0] = 53.677276
distances[47.5][25.5] = 53.911965
distances[47.5][26.0] = 54.150254
distances[47.5][26.5] = 54.392095
distances[47.5][27.0] = 54.637441
distances[47.5][27.5] = 54.886246
distances[47.5][28.0] = 55.138462
distances[47.5][28.5] = 55.394043
distances[47.5][29.0] = 55.652942
distances[47.5][29.5] = 55.915114
distances[47.5][30.0] = 56.180513
distances[47.5][30.5] = 56.449092
distances[47.5][31.0] = 56.720807
distances[47.5][31.5] = 56.995614
distances[47.5][32.0] = 57.273467
distances[47.5][32.5] = 57.554322
distances[47.5][33.0] = 57.838136
distances[47.5][33.5] = 58.124866
distances[47.5][34.0] = 58.414467
distances[47.5][34.5] = 58.706899
distances[47.5][35.0] = 59.002119
distances[47.5][35.5] = 59.300084
distances[47.5][36.0] = 59.600755
distances[47.5][36.5] = 59.90409
distances[47.5][37.0] = 60.210049
distances[47.5][37.5] = 60.518592
distances[47.5][38.0] = 60.82968
distances[47.5][38.5] = 61.143274
distances[47.5][39.0] = 61.459336
distances[47.5][39.5] = 61.777828
distances[47.5][40.0] = 62.098712
distances[47.5][40.5] = 62.421951
distances[47.5][41.0] = 62.74751
distances[47.5][41.5] = 63.075352
distances[47.5][42.0] = 63.405441
distances[47.5][42.5] = 63.737744
distances[47.5][43.0] = 64.072225
distances[47.5][43.5] = 64.40885
distances[47.5][44.0] = 64.747587
distances[47.5][44.5] = 65.088401
distances[47.5][45.0] = 65.431262
distances[47.5][45.5] = 65.776135
distances[47.5][46.0] = 66.122991
distances[47.5][46.5] = 66.471799
distances[47.5][47.0] = 66.822526
distances[47.5][47.5] = 67.175144
distances[48.0] = {}
distances[48.0][0.0] = 48.0
distances[48.0][0.5] = 48.002604
distances[48.0][1.0] = 48.010416
distances[48.0][1.5] = 48.023432
distances[48.0][2.0] = 48.041649
distances[48.0][2.5] = 48.06506
distances[48.0][3.0] = 48.093659
distances[48.0][3.5] = 48.127435
distances[48.0][4.0] = 48.166378
distances[48.0][4.5] = 48.210476
distances[48.0][5.0] = 48.259714
distances[48.0][5.5] = 48.314077
distances[48.0][6.0] = 48.373546
distances[48.0][6.5] = 48.438105
distances[48.0][7.0] = 48.507731
distances[48.0][7.5] = 48.582404
distances[48.0][8.0] = 48.6621
distances[48.0][8.5] = 48.746795
distances[48.0][9.0] = 48.836462
distances[48.0][9.5] = 48.931074
distances[48.0][10.0] = 49.030603
distances[48.0][10.5] = 49.135018
distances[48.0][11.0] = 49.244289
distances[48.0][11.5] = 49.358383
distances[48.0][12.0] = 49.477268
distances[48.0][12.5] = 49.600907
distances[48.0][13.0] = 49.729267
distances[48.0][13.5] = 49.86231
distances[48.0][14.0] = 50.0
distances[48.0][14.5] = 50.142298
distances[48.0][15.0] = 50.289164
distances[48.0][15.5] = 50.440559
distances[48.0][16.0] = 50.596443
distances[48.0][16.5] = 50.756773
distances[48.0][17.0] = 50.921508
distances[48.0][17.5] = 51.090606
distances[48.0][18.0] = 51.264022
distances[48.0][18.5] = 51.441715
distances[48.0][19.0] = 51.623638
distances[48.0][19.5] = 51.809748
distances[48.0][20.0] = 52.0
distances[48.0][20.5] = 52.194348
distances[48.0][21.0] = 52.392748
distances[48.0][21.5] = 52.595152
distances[48.0][22.0] = 52.801515
distances[48.0][22.5] = 53.011791
distances[48.0][23.0] = 53.225934
distances[48.0][23.5] = 53.443896
distances[48.0][24.0] = 53.665631
distances[48.0][24.5] = 53.891094
distances[48.0][25.0] = 54.120237
distances[48.0][25.5] = 54.353013
distances[48.0][26.0] = 54.589376
distances[48.0][26.5] = 54.82928
distances[48.0][27.0] = 55.072679
distances[48.0][27.5] = 55.319526
distances[48.0][28.0] = 55.569776
distances[48.0][28.5] = 55.823382
distances[48.0][29.0] = 56.0803
distances[48.0][29.5] = 56.340483
distances[48.0][30.0] = 56.603887
distances[48.0][30.5] = 56.870467
distances[48.0][31.0] = 57.140179
distances[48.0][31.5] = 57.412978
distances[48.0][32.0] = 57.68882
distances[48.0][32.5] = 57.967663
distances[48.0][33.0] = 58.249464
distances[48.0][33.5] = 58.534178
distances[48.0][34.0] = 58.821765
distances[48.0][34.5] = 59.112181
distances[48.0][35.0] = 59.405387
distances[48.0][35.5] = 59.70134
distances[48.0][36.0] = 60.0
distances[48.0][36.5] = 60.301327
distances[48.0][37.0] = 60.60528
distances[48.0][37.5] = 60.911822
distances[48.0][38.0] = 61.220911
distances[48.0][38.5] = 61.532512
distances[48.0][39.0] = 61.846584
distances[48.0][39.5] = 62.163092
distances[48.0][40.0] = 62.481997
distances[48.0][40.5] = 62.803264
distances[48.0][41.0] = 63.126856
distances[48.0][41.5] = 63.452738
distances[48.0][42.0] = 63.780875
distances[48.0][42.5] = 64.111231
distances[48.0][43.0] = 64.443774
distances[48.0][43.5] = 64.778469
distances[48.0][44.0] = 65.115282
distances[48.0][44.5] = 65.454182
distances[48.0][45.0] = 65.795137
distances[48.0][45.5] = 66.138113
distances[48.0][46.0] = 66.483081
distances[48.0][46.5] = 66.830008
distances[48.0][47.0] = 67.178866
distances[48.0][47.5] = 67.529623
distances[48.0][48.0] = 67.882251
distances[48.5] = {}
distances[48.5][0.0] = 48.5
distances[48.5][0.5] = 48.502577
distances[48.5][1.0] = 48.510308
distances[48.5][1.5] = 48.52319
distances[48.5][2.0] = 48.54122
distances[48.5][2.5] = 48.56439
distances[48.5][3.0] = 48.592695
distances[48.5][3.5] = 48.626125
distances[48.5][4.0] = 48.664669
distances[48.5][4.5] = 48.708316
distances[48.5][5.0] = 48.757051
distances[48.5][5.5] = 48.810859
distances[48.5][6.0] = 48.869725
distances[48.5][6.5] = 48.933629
distances[48.5][7.0] = 49.002551
distances[48.5][7.5] = 49.076471
distances[48.5][8.0] = 49.155366
distances[48.5][8.5] = 49.239212
distances[48.5][9.0] = 49.327984
distances[48.5][9.5] = 49.421655
distances[48.5][10.0] = 49.520198
distances[48.5][10.5] = 49.623583
distances[48.5][11.0] = 49.731781
distances[48.5][11.5] = 49.844759
distances[48.5][12.0] = 49.962486
distances[48.5][12.5] = 50.084928
distances[48.5][13.0] = 50.21205
distances[48.5][13.5] = 50.343818
distances[48.5][14.0] = 50.480194
distances[48.5][14.5] = 50.621142
distances[48.5][15.0] = 50.766623
distances[48.5][15.5] = 50.916598
distances[48.5][16.0] = 51.071029
distances[48.5][16.5] = 51.229874
distances[48.5][17.0] = 51.393093
distances[48.5][17.5] = 51.560644
distances[48.5][18.0] = 51.732485
distances[48.5][18.5] = 51.908573
distances[48.5][19.0] = 52.088866
distances[48.5][19.5] = 52.27332
distances[48.5][20.0] = 52.461891
distances[48.5][20.5] = 52.654534
distances[48.5][21.0] = 52.851206
distances[48.5][21.5] = 53.051861
distances[48.5][22.0] = 53.256455
distances[48.5][22.5] = 53.464942
distances[48.5][23.0] = 53.677276
distances[48.5][23.5] = 53.893413
distances[48.5][24.0] = 54.113307
distances[48.5][24.5] = 54.336912
distances[48.5][25.0] = 54.564182
distances[48.5][25.5] = 54.795073
distances[48.5][26.0] = 55.029538
distances[48.5][26.5] = 55.267531
distances[48.5][27.0] = 55.509008
distances[48.5][27.5] = 55.753924
distances[48.5][28.0] = 56.002232
distances[48.5][28.5] = 56.253889
distances[48.5][29.0] = 56.508849
distances[48.5][29.5] = 56.767068
distances[48.5][30.0] = 57.028502
distances[48.5][30.5] = 57.293106
distances[48.5][31.0] = 57.560837
distances[48.5][31.5] = 57.831652
distances[48.5][32.0] = 58.105507
distances[48.5][32.5] = 58.38236
distances[48.5][33.0] = 58.662168
distances[48.5][33.5] = 58.94489
distances[48.5][34.0] = 59.230482
distances[48.5][34.5] = 59.518905
distances[48.5][35.0] = 59.810116
distances[48.5][35.5] = 60.104076
distances[48.5][36.0] = 60.400745
distances[48.5][36.5] = 60.700082
distances[48.5][37.0] = 61.002049
distances[48.5][37.5] = 61.306606
distances[48.5][38.0] = 61.613716
distances[48.5][38.5] = 61.92334
distances[48.5][39.0] = 62.23544
distances[48.5][39.5] = 62.54998
distances[48.5][40.0] = 62.866923
distances[48.5][40.5] = 63.186233
distances[48.5][41.0] = 63.507874
distances[48.5][41.5] = 63.83181
distances[48.5][42.0] = 64.158008
distances[48.5][42.5] = 64.486433
distances[48.5][43.0] = 64.81705
distances[48.5][43.5] = 65.149827
distances[48.5][44.0] = 65.484731
distances[48.5][44.5] = 65.821729
distances[48.5][45.0] = 66.160789
distances[48.5][45.5] = 66.50188
distances[48.5][46.0] = 66.84497
distances[48.5][46.5] = 67.190029
distances[48.5][47.0] = 67.537027
distances[48.5][47.5] = 67.885934
distances[48.5][48.0] = 68.23672
distances[48.5][48.5] = 68.589358
distances[49.0] = {}
distances[49.0][0.0] = 49.0
distances[49.0][0.5] = 49.002551
distances[49.0][1.0] = 49.010203
distances[49.0][1.5] = 49.022954
distances[49.0][2.0] = 49.040799
distances[49.0][2.5] = 49.063734
distances[49.0][3.0] = 49.091751
distances[49.0][3.5] = 49.124841
distances[49.0][4.0] = 49.162994
distances[49.0][4.5] = 49.206199
distances[49.0][5.0] = 49.254441
distances[49.0][5.5] = 49.307707
distances[49.0][6.0] = 49.36598
distances[49.0][6.5] = 49.429242
distances[49.0][7.0] = 49.497475
distances[49.0][7.5] = 49.570657
distances[49.0][8.0] = 49.648766
distances[49.0][8.5] = 49.731781
distances[49.0][9.0] = 49.819675
distances[49.0][9.5] = 49.912423
distances[49.0][10.0] = 50.009999
distances[49.0][10.5] = 50.112374
distances[49.0][11.0] = 50.219518
distances[49.0][11.5] = 50.331402
distances[49.0][12.0] = 50.447993
distances[49.0][12.5] = 50.569259
distances[49.0][13.0] = 50.695167
distances[49.0][13.5] = 50.825682
distances[49.0][14.0] = 50.960769
distances[49.0][14.5] = 51.100391
distances[49.0][15.0] = 51.244512
distances[49.0][15.5] = 51.393093
distances[49.0][16.0] = 51.546096
distances[49.0][16.5] = 51.703482
distances[49.0][17.0] = 51.86521
distances[49.0][17.5] = 52.031241
distances[49.0][18.0] = 52.201533
distances[49.0][18.5] = 52.376044
distances[49.0][19.0] = 52.554733
distances[49.0][19.5] = 52.737558
distances[49.0][20.0] = 52.924474
distances[49.0][20.5] = 53.11544
distances[49.0][21.0] = 53.310412
distances[49.0][21.5] = 53.509345
distances[49.0][22.0] = 53.712196
distances[49.0][22.5] = 53.918921
distances[49.0][23.0] = 54.129474
distances[49.0][23.5] = 54.343813
distances[49.0][24.0] = 54.561891
distances[49.0][24.5] = 54.783665
distances[49.0][25.0] = 55.00909
distances[49.0][25.5] = 55.238121
distances[49.0][26.0] = 55.470713
distances[49.0][26.5] = 55.706822
distances[49.0][27.0] = 55.946403
distances[49.0][27.5] = 56.189412
distances[49.0][28.0] = 56.435804
distances[49.0][28.5] = 56.685536
distances[49.0][29.0] = 56.938563
distances[49.0][29.5] = 57.194842
distances[49.0][30.0] = 57.45433
distances[49.0][30.5] = 57.716982
distances[49.0][31.0] = 57.982756
distances[49.0][31.5] = 58.251609
distances[49.0][32.0] = 58.5235
distances[49.0][32.5] = 58.798384
distances[49.0][33.0] = 59.076222
distances[49.0][33.5] = 59.356971
distances[49.0][34.0] = 59.64059
distances[49.0][34.5] = 59.927039
distances[49.0][35.0] = 60.216277
distances[49.0][35.5] = 60.508264
distances[49.0][36.0] = 60.80296
distances[49.0][36.5] = 61.100327
distances[49.0][37.0] = 61.400326
distances[49.0][37.5] = 61.702917
distances[49.0][38.0] = 62.008064
distances[49.0][38.5] = 62.315728
distances[49.0][39.0] = 62.625873
distances[49.0][39.5] = 62.938462
distances[49.0][40.0] = 63.253458
distances[49.0][40.5] = 63.570827
distances[49.0][41.0] = 63.890531
distances[49.0][41.5] = 64.212538
distances[49.0][42.0] = 64.536811
distances[49.0][42.5] = 64.863318
distances[49.0][43.0] = 65.192024
distances[49.0][43.5] = 65.522897
distances[49.0][44.0] = 65.855903
distances[49.0][44.5] = 66.191011
distances[49.0][45.0] = 66.52819
distances[49.0][45.5] = 66.867406
distances[49.0][46.0] = 67.20863
distances[49.0][46.5] = 67.551832
distances[49.0][47.0] = 67.896981
distances[49.0][47.5] = 68.244047
distances[49.0][48.0] = 68.593003
distances[49.0][48.5] = 68.943818
distances[49.0][49.0] = 69.296465
distances[49.5] = {}
distances[49.5][0.0] = 49.5
distances[49.5][0.5] = 49.502525
distances[49.5][1.0] = 49.5101
distances[49.5][1.5] = 49.522722
distances[49.5][2.0] = 49.540388
distances[49.5][2.5] = 49.563091
distances[49.5][3.0] = 49.590826
distances[49.5][3.5] = 49.623583
distances[49.5][4.0] = 49.661353
distances[49.5][4.5] = 49.704125
distances[49.5][5.0] = 49.751884
distances[49.5][5.5] = 49.804618
distances[49.5][6.0] = 49.86231
distances[49.5][6.5] = 49.924944
distances[49.5][7.0] = 49.992499
distances[49.5][7.5] = 50.064958
distances[49.5][8.0] = 50.142298
distances[49.5][8.5] = 50.224496
distances[49.5][9.0] = 50.311529
distances[49.5][9.5] = 50.403373
distances[49.5][10.0] = 50.5
distances[49.5][10.5] = 50.601383
distances[49.5][11.0] = 50.707495
distances[49.5][11.5] = 50.818304
distances[49.5][12.0] = 50.933781
distances[49.5][12.5] = 51.053893
distances[49.5][13.0] = 51.178609
distances[49.5][13.5] = 51.307894
distances[49.5][14.0] = 51.441715
distances[49.5][14.5] = 51.580035
distances[49.5][15.0] = 51.722819
distances[49.5][15.5] = 51.87003
distances[49.5][16.0] = 52.02163
distances[49.5][16.5] = 52.177581
distances[49.5][17.0] = 52.337845
distances[49.5][17.5] = 52.502381
distances[49.5][18.0] = 52.67115
distances[49.5][18.5] = 52.84411
distances[49.5][19.0] = 53.021222
distances[49.5][19.5] = 53.202444
distances[49.5][20.0] = 53.387733
distances[49.5][20.5] = 53.577047
distances[49.5][21.0] = 53.770345
distances[49.5][21.5] = 53.967583
distances[49.5][22.0] = 54.168718
distances[49.5][22.5] = 54.373707
distances[49.5][23.0] = 54.582506
distances[49.5][23.5] = 54.795073
distances[49.5][24.0] = 55.011362
distances[49.5][24.5] = 55.231332
distances[49.5][25.0] = 55.454937
distances[49.5][25.5] = 55.682134
distances[49.5][26.0] = 55.912879
distances[49.5][26.5] = 56.147128
distances[49.5][27.0] = 56.384838
distances[49.5][27.5] = 56.625966
distances[49.5][28.0] = 56.870467
distances[49.5][28.5] = 57.118298
distances[49.5][29.0] = 57.369417
distances[49.5][29.5] = 57.62378
distances[49.5][30.0] = 57.881344
distances[49.5][30.5] = 58.142067
distances[49.5][31.0] = 58.405907
distances[49.5][31.5] = 58.672822
distances[49.5][32.0] = 58.942769
distances[49.5][32.5] = 59.215707
distances[49.5][33.0] = 59.491596
distances[49.5][33.5] = 59.770394
distances[49.5][34.0] = 60.052061
distances[49.5][34.5] = 60.336556
distances[49.5][35.0] = 60.62384
distances[49.5][35.5] = 60.913874
distances[49.5][36.0] = 61.206617
distances[49.5][36.5] = 61.502032
distances[49.5][37.0] = 61.800081
distances[49.5][37.5] = 62.100725
distances[49.5][38.0] = 62.403926
distances[49.5][38.5] = 62.709648
distances[49.5][39.0] = 63.017855
distances[49.5][39.5] = 63.328509
distances[49.5][40.0] = 63.641574
distances[49.5][40.5] = 63.957017
distances[49.5][41.0] = 64.274801
distances[49.5][41.5] = 64.594891
distances[49.5][42.0] = 64.917255
distances[49.5][42.5] = 65.241858
distances[49.5][43.0] = 65.568666
distances[49.5][43.5] = 65.897648
distances[49.5][44.0] = 66.22877
distances[49.5][44.5] = 66.562001
distances[49.5][45.0] = 66.897309
distances[49.5][45.5] = 67.234664
distances[49.5][46.0] = 67.574033
distances[49.5][46.5] = 67.915389
distances[49.5][47.0] = 68.258699
distances[49.5][47.5] = 68.603936
distances[49.5][48.0] = 68.95107
distances[49.5][48.5] = 69.300072
distances[49.5][49.0] = 69.650915
distances[49.5][49.5] = 70.003571
distances[50.0] = {}
distances[50.0][0.0] = 50.0
distances[50.0][0.5] = 50.0025
distances[50.0][1.0] = 50.009999
distances[50.0][1.5] = 50.022495
distances[50.0][2.0] = 50.039984
distances[50.0][2.5] = 50.062461
distances[50.0][3.0] = 50.089919
distances[50.0][3.5] = 50.12235
distances[50.0][4.0] = 50.159745
distances[50.0][4.5] = 50.202092
distances[50.0][5.0] = 50.249378
distances[50.0][5.5] = 50.30159
distances[50.0][6.0] = 50.358713
distances[50.0][6.5] = 50.42073
distances[50.0][7.0] = 50.487622
distances[50.0][7.5] = 50.559371
distances[50.0][8.0] = 50.635956
distances[50.0][8.5] = 50.717354
distances[50.0][9.0] = 50.803543
distances[50.0][9.5] = 50.894499
distances[50.0][10.0] = 50.990195
distances[50.0][10.5] = 51.090606
distances[50.0][11.0] = 51.195703
distances[50.0][11.5] = 51.305458
distances[50.0][12.0] = 51.419841
distances[50.0][12.5] = 51.53882
distances[50.0][13.0] = 51.662365
distances[50.0][13.5] = 51.790443
distances[50.0][14.0] = 51.92302
distances[50.0][14.5] = 52.060061
distances[50.0][15.0] = 52.201533
distances[50.0][15.5] = 52.347397
distances[50.0][16.0] = 52.497619
distances[50.0][16.5] = 52.65216
distances[50.0][17.0] = 52.810984
distances[50.0][17.5] = 52.97405
distances[50.0][18.0] = 53.141321
distances[50.0][18.5] = 53.312756
distances[50.0][19.0] = 53.488316
distances[50.0][19.5] = 53.667961
distances[50.0][20.0] = 53.851648
distances[50.0][20.5] = 54.039338
distances[50.0][21.0] = 54.230987
distances[50.0][21.5] = 54.426556
distances[50.0][22.0] = 54.626001
distances[50.0][22.5] = 54.82928
distances[50.0][23.0] = 55.036352
distances[50.0][23.5] = 55.247172
distances[50.0][24.0] = 55.461698
distances[50.0][24.5] = 55.679889
distances[50.0][25.0] = 55.901699
distances[50.0][25.5] = 56.127088
distances[50.0][26.0] = 56.356011
distances[50.0][26.5] = 56.588426
distances[50.0][27.0] = 56.824291
distances[50.0][27.5] = 57.063561
distances[50.0][28.0] = 57.306195
distances[50.0][28.5] = 57.55215
distances[50.0][29.0] = 57.801384
distances[50.0][29.5] = 58.053854
distances[50.0][30.0] = 58.309519
distances[50.0][30.5] = 58.568336
distances[50.0][31.0] = 58.830264
distances[50.0][31.5] = 59.095262
distances[50.0][32.0] = 59.363288
distances[50.0][32.5] = 59.634302
distances[50.0][33.0] = 59.908263
distances[50.0][33.5] = 60.185131
distances[50.0][34.0] = 60.464866
distances[50.0][34.5] = 60.747428
distances[50.0][35.0] = 61.032778
distances[50.0][35.5] = 61.320877
distances[50.0][36.0] = 61.611687
distances[50.0][36.5] = 61.905169
distances[50.0][37.0] = 62.201286
distances[50.0][37.5] = 62.5
distances[50.0][38.0] = 62.801274
distances[50.0][38.5] = 63.105071
distances[50.0][39.0] = 63.411355
distances[50.0][39.5] = 63.720091
distances[50.0][40.0] = 64.031242
distances[50.0][40.5] = 64.344774
distances[50.0][41.0] = 64.660653
distances[50.0][41.5] = 64.978843
distances[50.0][42.0] = 65.299311
distances[50.0][42.5] = 65.622024
distances[50.0][43.0] = 65.946948
distances[50.0][43.5] = 66.274052
distances[50.0][44.0] = 66.603303
distances[50.0][44.5] = 66.93467
distances[50.0][45.0] = 67.26812
distances[50.0][45.5] = 67.603624
distances[50.0][46.0] = 67.941151
distances[50.0][46.5] = 68.280671
distances[50.0][47.0] = 68.622154
distances[50.0][47.5] = 68.965571
distances[50.0][48.0] = 69.310894
distances[50.0][48.5] = 69.658094
distances[50.0][49.0] = 70.007142
distances[50.0][49.5] = 70.358013
distances[50.0][50.0] = 70.710678
return distances
|
local cjson = require 'cjson'
local torch_utils = {}
function torch_utils.wd_sgd(opfunc, x, config, state)
-- (0) get/update state
local config = config or {}
local state = state or config
local lr = config.learningRate or 1e-3
local lrd = config.learningRateDecay or 0
local wd = config.weightDecay or 0
local mom = config.momentum or 0
local damp = config.dampening or mom
local nesterov = config.nesterov or false
local lrs = config.learningRates
local wds = config.weightDecays
state.evalCounter = state.evalCounter or 0
local nevals = state.evalCounter
assert(not nesterov or (mom > 0 and damp == 0), "Nesterov momentum requires a momentum and zero dampening")
-- (1) evaluate f(x) and df/dx
local fx,dfdx = opfunc(x)
-- (2) weight decay with single or individual parameters
if torch.norm(dfdx) > 1e-8 then
if wd ~= 0 then
dfdx:add(wd, x)
elseif wds then
if not state.decayParameters then
state.decayParameters = torch.Tensor():typeAs(x):resizeAs(dfdx)
end
state.decayParameters:copy(wds):cmul(x)
dfdx:add(state.decayParameters)
end
-- (3) apply momentum
if mom ~= 0 then
if not state.dfdx then
state.dfdx = torch.Tensor():typeAs(dfdx):resizeAs(dfdx):copy(dfdx)
else
state.dfdx:mul(mom):add(1-damp, dfdx)
end
if nesterov then
dfdx:add(mom, state.dfdx)
else
dfdx = state.dfdx
end
end
end
-- (4) learning rate decay (annealing)
local clr = lr / (1 + nevals*lrd)
-- (5) parameter update with single or individual learning rates
if lrs then
if not state.deltaParameters then
state.deltaParameters = torch.Tensor():typeAs(x):resizeAs(dfdx)
end
state.deltaParameters:copy(lrs):cmul(dfdx)
x:add(-clr, state.deltaParameters)
else
x:add(-clr, dfdx)
end
-- (6) update evaluation counter
state.evalCounter = state.evalCounter + 1
-- return x*, f(x) before optimization
return x,{fx}
end
function torch_utils.dir(directory)
local list = paths.dir(directory)
local new_list = {}
for i = 1, #list do
if (list[i] ~= '.' and list[i] ~= '..') then
table.insert(new_list, list[i])
end
end
return new_list
end
-- see if the file exists
function torch_utils.file_exists(file)
local f = io.open(file, "rb")
if f then f:close() end
return f ~= nil
end
function torch_utils.strip_postfix(filename)
local splits = torch_utils.split(filename, '%.')
local num = #splits
local clean_filename
if num > 1 then
clean_filename = table.concat({table.unpack(splits, 1, num-1)})
else
clean_filename = filename
end
return clean_filename
end
function torch_utils.safe_concat(data, dim)
local count = 0
for item_idx, item in ipairs(data) do
count = count + item:size(dim)
end
local data_size = data[1]:size()
data_size[dim] = count
local data_cat = data[1].new():resize(data_size)
local count = 1
for _, item in ipairs(data) do
data_cat:narrow(dim, count, item:size(dim)):copy(item)
count = count + item:size(dim)
end
return data_cat
end
function torch_utils.VOCap(rec, prec)
local mrec = rec.new(rec:nElement()+2)
mrec[1] = 0
mrec[mrec:nElement()] = 1
mrec:narrow(1, 2, mrec:nElement()-2):copy(rec)
local mpre = prec.new(prec:nElement()+2)
mpre[1] = 0
mpre[mpre:nElement()] = 0
mpre:narrow(1, 2, mpre:nElement()-2):copy(prec)
local ap = 0
local N = mpre:nElement()
for _, i in ipairs(torch.range(N-1, 1, -1):totable()) do
mpre[i] = math.max(mpre[i], mpre[i+1])
end
local idx = torch.nonzero((mrec[{{2, N}}]-mrec[{{1, N-1}}]):ne(0))
if idx:nElement() > 0 then
idx = idx:view(-1) + 1
idx = idx:long()
ap = torch.sum(torch.cmul((mrec:index(1, idx) - mrec:index(1, idx-1)), mpre:index(1, idx)))
end
return ap
end
function torch_utils.vector_unique(input_tensor)
input_tensor = input_tensor:contiguous()
local unique_elements = {} --tracking down all unique elements
local output_table = {} --result table/vector
input_tensor = input_tensor:view(-1)
for idx = 1, input_tensor:nElement() do
local val = input_tensor[idx]
unique_elements[val] = idx
end
return unique_elements
end
function torch_utils.capture(cmd, raw)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
if raw then return s end
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
function torch_utils.read_lines_into_tensor(file)
if not torch_utils.file_exists(file) then return {} end
local count, dim = 0, 0
for line in io.lines(file) do
if count == 0 then
dim = #torch_utils.split(line, ' ')
end
count = count + 1
end
local tensor = torch.FloatTensor(count, dim):zero()
local count = 1
for line in io.lines(file) do
local splits = torch_utils.split(line, ' ')
for str_idx, str in ipairs(splits) do
tensor[{count, str_idx}] = tonumber(str)
end
count = count + 1
end
return tensor
end
function torch_utils.sample_from_weights(weights)
local norm_weights = torch.div(weights, torch.sum(weights) + 1e-10)
norm_weights = norm_weights:view(-1)
local cum_weights = torch.cumsum(norm_weights)
local sample_val = torch.rand(1)[1] - 1e-8
local ge_idx = torch.nonzero(cum_weights:ge(sample_val)):view(-1)
ge_idx = ge_idx[1]
return ge_idx
end
-- get all lines from a file, returns an empty
-- list/table if the file does not exist
function torch_utils.lines_from(file)
if not torch_utils.file_exists(file) then return {} end
local lines = {}
for line in io.lines(file) do
lines[#lines + 1] = line
end
return lines
end
function torch_utils.size_string(tensor_input)
assert(torch.isTensor(tensor_input))
local tensor_size = tensor_input:size()
local s = ''
for i = 1, #tensor_size do
if s ~= '' then
s = s .. ',' .. string.format('%d', tensor_size[i])
else
s = string.format('%d', tensor_size[i])
end
end
return s
end
function torch_utils.print_net(net)
for i,module in ipairs(net:listModules()) do
print(module)
end
end
function torch_utils.keys(obj)
local keyset={}
local n=0
for k,v in pairs(obj) do
n=n+1
keyset[n]=k
end
return keyset
end
function torch_utils.charTensor2String(tensor)
local str_table = {}
for idx = 1, tensor:nElement() do
table.insert(str_table, string.format('%c', tensor[idx]))
end
str_table = table.concat(str_table)
return str_table
end
--[[
Utility function to check that a Tensor has a specific shape.
Inputs:
- x: A Tensor object
- dims: A list of integers
--]]
function torch_utils.check_dims(x, dims)
assert(x:dim() == #dims)
for i, d in ipairs(dims) do
local msg = 'Expected %d, got %d'
assert(x:size(i) == d, string.format(msg, d, x:size(i)))
end
end
function torch_utils.get_kwarg(kwargs, name, default)
if kwargs == nil then kwargs = {} end
if kwargs[name] == nil and default == nil then
assert(false, string.format('"%s" expected and not given', name))
elseif kwargs[name] == nil then
return default
else
return kwargs[name]
end
end
function torch_utils.get_size(obj)
local size = 0
for k, v in pairs(obj) do size = size + 1 end
return size
end
function torch_utils.read_json(path)
local f = io.open(path, 'r')
local s = f:read('*all')
f:close()
return cjson.decode(s)
end
function torch_utils.write_json(path, obj)
local s = cjson.encode(obj)
local f = io.open(path, 'w')
f:write(s)
f:close()
end
function torch_utils.db_checkpoint(iter)
local db_stop = 0
if iter % 10 == 0 then
db_stop = 1
end
if iter % 100 == 0 then
db_stop = 1
end
if iter % 30 == 0 then
db_stop = 1
end
if iter % 300 == 0 then
db_stop = 1
end
return db_stop
end
function torch_utils.init_recorder(T)
local recorder = {smoothed_loss_arr = {}, raw_loss_arr = {}, loss_iter_arr = {}, ptr = 1, T = T}
return recorder
end
function torch_utils.retrieve_loss(struct, start_round)
--start_round = start_round or 1
--local loss, iter = {}, {}
--if #struct.smoothed_loss_arr >= start_round then
-- loss = {table.unpack(struct.smoothed_loss_arr, start_round, #struct.smoothed_loss_arr)}
-- iter = {table.unpack(struct.loss_iter_arr, start_round, #struct.loss_iter_arr)}
--end
local loss, iter = struct.smoothed_loss_arr, struct.loss_iter_arr
return loss, iter
end
function torch_utils.update_loss(struct, loss, iter)
local raw_loss_arr = struct.raw_loss_arr
local smoothed_loss_arr = struct.smoothed_loss_arr
local loss_iter_arr = struct.loss_iter_arr
local T = struct.T
local ptr = struct.ptr
local smoothed_loss
if #smoothed_loss_arr > 0 then
smoothed_loss = smoothed_loss_arr[#smoothed_loss_arr]
else
smoothed_loss = 0
end
local cur_len = #raw_loss_arr
if cur_len < T then
smoothed_loss = (smoothed_loss * cur_len + loss) / (cur_len + 1)
else
smoothed_loss = smoothed_loss + (loss - raw_loss_arr[ptr]) / T
end
raw_loss_arr[ptr] = loss
ptr = ptr % T + 1
table.insert(smoothed_loss_arr, smoothed_loss)
table.insert(loss_iter_arr, iter)
struct.ptr = ptr
struct.raw_loss_arr = raw_loss_arr
struct.smoothed_loss_arr = smoothed_loss_arr
struct.loss_iter_arr = loss_iter_arr
return struct
end
function torch_utils.init_html_container(rows, cols)
local im_paths, captions = {}, {}
for row_idx = 1, rows do
im_paths[row_idx] = {}
captions[row_idx] = {}
for col_idx = 1, cols do
im_paths[row_idx][col_idx] = {}
captions[row_idx][col_idx] = {}
end
end
return im_paths, captions
end
-- Determine the longest prefix among a list of strings
-- This function is borrowed from facebook utils at:
-- https://github.com/facebook/fblualib/blob/master/fblualib/util/fb/util/init.lua
function torch_utils.longest_common_prefix(strings)
if #strings == 0 then
return ''
end
local prefix = strings[1]
for i = 2, #strings do
local s = strings[i]
local len = 0
for j = 1, math.min(#s, #prefix) do
if s:sub(j, j) == prefix:sub(j, j) then
len = len + 1
else
break
end
end
prefix = prefix:sub(1, len)
if len == 0 then
break
end
end
return prefix
end
function torch_utils.relative_path(ref_path, target_path)
local common_prefix = torch_utils.longest_common_prefix({ref_path, target_path})
local _, end_str_ptr = string.find(target_path, common_prefix)
local rel_path = string.sub(target_path, end_str_ptr + 1)
return rel_path
end
function torch_utils.write_html(filename, im_paths, captions, height, width)
paths.mkdir(paths.dirname(filename))
local f = io.open(filename, 'w')
io.output(f)
io.write('<!DOCTYPE html>\n')
io.write('<html><body>\n')
io.write('<table>\n')
for row_idx, captions_row in ipairs(captions) do
io.write('<tr>\n')
for col_idx, col in ipairs(captions_row) do
io.write('<td>')
io.write(col)
io.write('</td>')
io.write(' ')
end
io.write('\n</tr>\n')
io.write('<tr>\n')
for col_idx, col in ipairs(im_paths[row_idx]) do
io.write('<td><img src="')
io.write(col)
io.write(string.format('" height=%d width=%d"/></td>', height, width))
io.write(' ')
end
io.write('\n</tr>\n')
io.write('<p></p>')
end
io.write('</table>\n')
io.close()
end
-- Compatibility: Lua-5.1
function torch_utils.split(str, pat)
local t = {} -- NOTE: use {n = 0} in Lua-5.0
local fpat = "(.-)" .. pat
local last_end = 1
local s, e, cap = str:find(fpat, 1)
while s do
if s ~= 1 or cap ~= "" then
table.insert(t,cap)
end
last_end = e+1
s, e, cap = str:find(fpat, last_end)
end
if last_end <= #str then
cap = str:sub(last_end)
table.insert(t, cap)
end
return t
end
return torch_utils
|
local path = require 'pl.path'
return function()
local loadOutputHandler = function(output, opath, options, busted, defaultOutput)
local handler
local success, err = pcall(function()
if output:match('.lua$') or output:match('.moon$') then
handler = loadfile(path.normpath(opath))()
else
handler = require('busted.outputHandlers.'..output)
end
end)
if not success then
busted.publish({ 'error', 'output' }, { descriptor = 'output', name = output }, nil, err, {})
handler = require('busted.outputHandlers.'..defaultOutput)
end
return handler(options, busted)
end
return loadOutputHandler
end
|
-->8
-- game object factories
-- player is represented as the bottom of the falling quad
-- player3
-- player1 player2
-- player0
function new_player_quad()
player = {
y = board_height - 2,
x = 4,
player0 = function(self) return {x = self.x, y = self.y} end,
player1 = function(self) -- todo get all of these back in one method call
return {x = x_for_next_row(self.y, self.x), y = self.y + 1}
end,
player2 = function(self)
return {x = x_for_next_row(self.y, self.x) + 1, y = self.y + 1}
end,
player3 = function(self) return {x = self.x, y = self.y + 2} end,
is_player_piece = function(self, y, x)
local p3 = self:player3()
local p2 = self:player2()
local p1 = self:player1()
local p0 = self:player0()
return (x == p0.x or x == p1.x or x == p2.x or x == p3.x) and
(y == p0.y or y == p1.y or y == p2.y or y == p3.y)
end
}
-- todo add function to player to multi return all current pieces
local p3 = player:player3()
local p2 = player:player2()
local p1 = player:player1()
local p0 = player:player0()
if board[p3.y][p3.x] ~= empty or board[p2.y][p2.x] ~= empty or
board[p1.y][p1.x] ~= empty or board[p0.y][p0.x] ~= empty or
(not block_can_fall_left(p1.y, p1.x) and
not block_can_fall_right(p2.y, p2.x)) then
sfx(24)
game_state = "gameover"
end
board[p3.y][p3.x] = next_quad.p3
board[p2.y][p2.x] = next_quad.p2
board[p1.y][p1.x] = next_quad.p1
board[p0.y][p0.x] = next_quad.p0
speed_timer = 0
make_next_quad()
end
function player_quad_shadow()
local s0 = player:player0()
local s1 = player:player1()
local s2 = player:player2()
local s3 = player:player3()
local next_y = s0.y - 2
local next_x = s0.x
while next_y > 0 and board[next_y][next_x] == empty do
s0 = {y = next_y, x = next_x}
s1.y = next_y + 1
s2.y = next_y + 1
s3 = {y = next_y + 2, x = next_x}
next_y = s0.y - 2
next_x = s0.x
end
return {
s0 = s0,
s1 = s1,
s2 = s2,
s3 = s3,
is_in_shadow = function(self, y, x)
s0 = self.s0
s1 = self.s1
s2 = self.s2
s3 = self.s3
return (y == s0.y and x == s0.x) or (y == s1.y and x == s1.x) or
(y == s2.y and x == s2.x) or (y == s3.y and x == s3.x)
end,
get_corresponding_sprite = function(self, y, x)
local s0 = self.s0
local s1 = self.s1
local s2 = self.s2
local s3 = self.s3
local p0 = player:player0()
local p1 = player:player1()
local p2 = player:player2()
local p3 = player:player3()
if y == s0.y and x == s0.x then
return board[p0.y][p0.x]
elseif y == s1.y and x == s1.x then
return board[p1.y][p1.x]
elseif y == s2.y and x == s2.x then
return board[p2.y][p2.x]
end
return board[p3.y][p3.x]
end,
draw_slide_indicator_arrow = function(self)
if currently_clearing_blocks() or game_state ~= "playing" then
return
end
local s0 = self.s0
local s1 = self.s1
local s2 = self.s2
local next_x = x_for_next_row(s0.y, s0.x)
local next_y = s0.y - 1
local arrow_sprite = 6
local right = can_move_right(s0, s2)
local left = can_move_left(s0, s1)
-- todo this logic is duplicated somewhere else, could dedupe to save tokens
if left and right then
if last_direction_moved == "right" then
-- if they're moving right, they would slide right
left = false
else
-- and vice versa
right = false
end
end
if right then
-- get screen position to draw arrow
local y_pos, x_pos = get_screen_position_for_block(next_y,
next_x + 1)
spr(arrow_sprite, x_pos + 2, y_pos - 2)
end
if left then
-- get screen position to draw arrow
local y_pos, x_pos = get_screen_position_for_block(next_y,
next_x)
spr(arrow_sprite, x_pos - 3, y_pos - 2, 1, 1, true, false)
end
end
}
end
function make_next_quad()
local p0 = random_block()
local p1 = random_block()
local p2 = random_block()
local p3 = random_block()
while p0 == p1 and p1 == p2 and p2 == p3 do p3 = random_block() end
next_quad = {p0 = p0, p1 = p1, p2 = p2, p3 = p3}
end
function random_block()
local val = flr(rnd(4))
if val == 0 then
return white_block
elseif val == 1 then
return red_block
elseif val == 2 then
return yellow_block
end
return blue_block
end
function new_board()
local grid = {}
local y
local x
for y = 1, board_height do
grid[y] = {}
for x = 1, board_width do
local piece = empty
if wall_here(y, x) then piece = wall end
grid[y][x] = piece
end
end
return grid
end
function wall_here(y, x)
-- TODO should still be cleaned up more
return (row_at_beginning_or_end(y, 1) and x ~= 4) or
(row_at_beginning_or_end(y, 2) and (x < 4 or 5 < x)) or
(row_at_beginning_or_end(y, 3) and (x < 3 or 5 < x)) or
(row_at_beginning_or_end(y, 4) and (x < 3 or 6 < x)) or
(row_at_beginning_or_end(y, 5) and (x < 2 or 6 < x)) or
(row_at_beginning_or_end(y, 6) and (x < 2 or 7 < x)) or
(is_odd(y) and x == board_width)
end
function row_at_beginning_or_end(real, expected)
return real == expected or real == board_height - expected + 1
end
|
----------------------------------------------------------------------------------------------------
-- Flower Extentions Library for FSM.
--
-- @author Makoto
-- @release V3.0.0
----------------------------------------------------------------------------------------------------
-- module
local fsm = {}
----------------------------------------------------------------------------------------------------
-- Classes
-- @section Classes
----------------------------------------------------------------------------------------------------
---
-- State Class.
-- @see flower.fsm.State
fsm.State = require "flower.fsm.State"
---
-- StateMachine Class.
-- @see flower.fsm.StateMachine
fsm.StateMachine = require "flower.fsm.StateMachine"
return fsm
|
Ambi.Download = Ambi.Download or {}
-- ---------------------------------------------------------------------------------------------------------------------------------------------------------
local http_fetch, string_gmatch, tostring = http.Fetch, string.gmatch, tostring
-- ---------------------------------------------------------------------------------------------------------------------------------------------------------
function Ambi.Download.GetWorkshopCollection( sWorkshopID, fAction )
if ( sWorkshopID == nil ) then return end
sWorkshopID = tostring( sWorkshopID )
http_fetch( 'https://steamcommunity.com/sharedfiles/filedetails/?id='..sWorkshopID, function( sBody )
if not sBody then return end
local tab = {}
local ex = {}
local final = {}
for v in string_gmatch( sBody, 'SharedFileBindMouseHover%(.-%)' ) do
tab[ #tab + 1 ] = v
end
for i, v in ipairs( tab ) do
final[ i ] = {}
local subtab = final[ i ]
for str in string_gmatch( v, '".-"' ) do
subtab[ #subtab + 1 ] = str
end
end
local tab = {}
for i, v in ipairs( final ) do
tab[ i ] = { title = string.IsValid( v[ 5 ] ) and string.Replace( v[ 5 ], '"', '' ) or 'No Title', id = tonumber( string.Replace( v[ 3 ], '"', '' ) ) }
end
if fAction then fAction( tab, sBody ) end
hook.Call( '[Ambi.Download.GetWorkshopCollection]', sWorkshopID, tab, fAction )
end, function( sCode )
print( '[Download] Error: '..sCode )
end )
end
-- ---------------------------------------------------------------------------------------------------------------------------------------------------------
Ambi.Download.workshop_collections = Ambi.Download.workshop_collections or {}
function Ambi.Download.GetCollection( sWorkshopID )
if not sWorkshopID then return end
return Ambi.Download.workshop_collections[ sWorkshopID ]
end
function Ambi.Download.GetCollections()
return Ambi.Download.workshop_collections
end
|
return "v2.7.6"
|
require 'nn'
rfcn = {}
rfcn.C = require 'rfcn.ffi'
require 'rfcn.PSROIPooling'
return rfcn
|
-- Valid module (exposing data and having a global variable) for utils.load_module_if_exists unit tests.
-- Assert that load_module_if_exists returns a module if it was valid
local _M = {
exposed = "All your base are belong to us."
}
return _M
|
function afunc()
local p = {}
p[1] = "foo"
return p["bar"]
end
|
local DiagnosticSeverity = require('vim.lsp.protocol').DiagnosticSeverity
local trythis = {}
local function suggestions_from(diagnostic)
local trimmed = diagnostic.message:gsub('^.-Try this:%s*', '')
return vim.gsplit(trimmed, 'Try this:')
end
--- Swap the first suggestion from Lean with the word under the cursor.
--
-- Doesn't do any robust error checking, or allow rotating for later results
-- yet.
function trythis.swap()
local diagnostics = vim.lsp.diagnostic.get_line_diagnostics(
0, nil, { severity = DiagnosticSeverity.Information }
)
for _, diagnostic in ipairs(diagnostics) do
-- luacheck: ignore
for each in suggestions_from(diagnostic) do
local command = "normal! ciw" .. vim.trim(each)
vim.api.nvim_command(command)
return
end
end
end
return trythis
|
TOOL.Category = "Construction"
TOOL.Name = "#Tool.textscreen.name"
TOOL.Command = nil
TOOL.ConfigName = ""
local textBox = {}
local lineLabels = {}
local labels = {}
local sliders = {}
for i = 1, 5 do
TOOL.ClientConVar[ "text"..i ] = ""
TOOL.ClientConVar[ "size"..i ] = 20
TOOL.ClientConVar[ "r"..i ] = 255
TOOL.ClientConVar[ "g"..i ] = 255
TOOL.ClientConVar[ "b"..i ] = 255
TOOL.ClientConVar[ "a"..i ] = 255
end
cleanup.Register("textscreens")
if (CLIENT) then
language.Add("Tool.textscreen.name", "3D2D Textscreen")
language.Add("Tool.textscreen.desc", "Create a textscreen with multiple lines, font colours and sizes.")
language.Add("Tool.textscreen.0", "Left Click: Spawn a textscreen Right Click: Update textscreen with settings")
language.Add("Tool_textscreen_0", "Left Click: Spawn a textscreen Right Click: Update textscreen with settings")
language.Add("Undone.textscreens", "Undone textscreen")
language.Add("Undone_textscreens", "Undone textscreen")
language.Add("Cleanup.textscreens", "Textscreens")
language.Add("Cleanup_textscreens", "Textscreens")
language.Add("Cleaned.textscreens", "Cleaned up all textscreens")
language.Add("Cleaned_textscreens", "Cleaned up all textscreens")
language.Add("SBoxLimit.textscreens", "You've hit the textscreen limit!")
language.Add("SBoxLimit_textscreens", "You've hit the textscreen limit!")
end
function TOOL:LeftClick(tr)
if (tr.Entity:GetClass() == "player") then return false end
if (CLIENT) then return true end
local ply = self:GetOwner()
if not (self:GetWeapon():CheckLimit("textscreens")) then return false end
local textScreen = ents.Create("sammyservers_textscreen")
textScreen:SetPos(tr.HitPos)
local angle = tr.HitNormal:Angle()
angle:RotateAroundAxis(tr.HitNormal:Angle():Right(), -90)
angle:RotateAroundAxis(tr.HitNormal:Angle():Forward(), 90)
textScreen:SetAngles(angle)
textScreen:Spawn()
textScreen:Activate()
for i = 1, 5 do
textScreen:SetLine(
i, -- Line
self:GetClientInfo("text"..i), -- text
Color( -- Color
tonumber(self:GetClientInfo("r"..i)),
tonumber(self:GetClientInfo("g"..i)),
tonumber(self:GetClientInfo("b"..i)),
tonumber(self:GetClientInfo("a"..i))
),
tonumber(self:GetClientInfo("size"..i))
)
end
undo.Create("textscreens")
undo.AddEntity(textScreen)
undo.SetPlayer(ply)
undo.Finish()
ply:AddCount("textscreens", textScreen)
ply:AddCleanup("textscreens", textScreen)
return true
end
function TOOL:RightClick(tr)
if (tr.Entity:GetClass() == "player") then return false end
if (CLIENT) then return true end
local TraceEnt = tr.Entity
if (IsValid(TraceEnt) and TraceEnt:GetClass() == "sammyservers_textscreen") then
for i = 1, 5 do
TraceEnt:SetLine(
i, -- Line
tostring(self:GetClientInfo("text"..i)), -- text
Color( -- Color
tonumber(self:GetClientInfo("r"..i)),
tonumber(self:GetClientInfo("g"..i)),
tonumber(self:GetClientInfo("b"..i)),
tonumber(self:GetClientInfo("a"..i))
),
tonumber(self:GetClientInfo("size"..i))
)
end
TraceEnt:Broadcast()
return true
end
end
function TOOL.BuildCPanel(CPanel)
CPanel:AddControl("Header", {Text = "#Tool.textscreen.name", Description = "#Tool.textscreen.desc"})
CPanel:AddControl("Label", {Text = "By NodeCraft.com - affordable, high performance game servers!"})
resetall = vgui.Create("DButton", resetbuttons)
resetall:SetSize(100, 25)
resetall:SetText("Reset all")
resetall.DoClick = function()
local menu = DermaMenu()
menu:AddOption("Reset colors", function()
for i = 1, 5 do
RunConsoleCommand("textscreen_r"..i, 255)
RunConsoleCommand("textscreen_g"..i, 255)
RunConsoleCommand("textscreen_b"..i, 255)
RunConsoleCommand("textscreen_a"..i, 255)
end
end)
menu:AddOption("Reset sizes", function()
for i = 1, 5 do
RunConsoleCommand("textscreen_size"..i, 20)
sliders[i]:SetValue(20)
end
end)
menu:AddOption("Reset textboxes", function()
for i = 1, 5 do
RunConsoleCommand("textscreen_text"..i, "")
textBox[i]:SetValue("")
end
end)
menu:AddOption("Reset everything", function()
for i = 1, 5 do
RunConsoleCommand("textscreen_r"..i, 255)
RunConsoleCommand("textscreen_g"..i, 255)
RunConsoleCommand("textscreen_b"..i, 255)
RunConsoleCommand("textscreen_a"..i, 255)
RunConsoleCommand("textscreen_size"..i, 20)
sliders[i]:SetValue(20)
RunConsoleCommand("textscreen_text"..i, "")
textBox[i]:SetValue("")
end
end)
menu:Open()
end
CPanel:AddItem(resetall)
resetline = vgui.Create("DButton")
resetline:SetSize(100, 25)
resetline:SetText("Reset line")
resetline.DoClick = function()
local menu = DermaMenu()
for i = 1, 5 do
menu:AddOption("Reset line "..i, function()
RunConsoleCommand("textscreen_r"..i, 255)
RunConsoleCommand("textscreen_g"..i, 255)
RunConsoleCommand("textscreen_b"..i, 255)
RunConsoleCommand("textscreen_a"..i, 255)
RunConsoleCommand("textscreen_size"..i, 20)
sliders[i]:SetValue(20)
RunConsoleCommand("textscreen_text"..i, "")
textBox[i]:SetValue("")
end)
end
menu:AddOption("Reset all lines", function()
for i = 1, 5 do
RunConsoleCommand("textscreen_r"..i, 255)
RunConsoleCommand("textscreen_g"..i, 255)
RunConsoleCommand("textscreen_b"..i, 255)
RunConsoleCommand("textscreen_a"..i, 255)
RunConsoleCommand("textscreen_size"..i, 20)
sliders[i]:SetValue(20)
RunConsoleCommand("textscreen_text"..i, "")
textBox[i]:SetValue("")
end
end)
menu:Open()
end
CPanel:AddItem(resetline)
for i = 1, 5 do
lineLabels[i] = CPanel:AddControl("Label", {
Text = "Line "..i,
Description = "Line "..i
})
lineLabels[i]:SetFont("Default")
CPanel:AddControl("Color", {
Label = "Line "..i.." font color",
Red = "textscreen_r"..i,
Green = "textscreen_g"..i,
Blue = "textscreen_b"..i,
Alpha = "textscreen_a"..i,
ShowHSV = 1,
ShowRGB = 1,
Multiplier = 255
})
sliders[i] = vgui.Create("DNumSlider")
sliders[i]:SetText("Font size")
sliders[i]:SetMinMax(20, 100)
sliders[i]:SetDecimals(0)
sliders[i]:SetValue(20)
sliders[i]:SetConVar("textscreen_size"..i)
sliders[i].OnValueChanged = function(panel, value)
labels[i]:SetFont("CV"..math.Round(value))
end
CPanel:AddItem(sliders[i])
textBox[i] = vgui.Create("DTextEntry")
textBox[i]:SetUpdateOnType(true)
textBox[i]:SetEnterAllowed(true)
textBox[i]:SetConVar("textscreen_text"..i)
textBox[i]:SetValue(GetConVarString("textscreen_text"..i))
textBox[i].OnTextChanged = function()
labels[i]:SetText(textBox[i]:GetValue())
end
CPanel:AddItem(textBox[i])
labels[i] = CPanel:AddControl("Label", {
Text = "Line "..i,
Description = "Line "..i
})
labels[i]:SetFont("Default")
labels[i].Think = function()
labels[i]:SetColor(Color(GetConVarNumber("textscreen_r"..i), GetConVarNumber("textscreen_g"..i), GetConVarNumber("textscreen_b"..i), GetConVarNumber("textscreen_a"..i)))
end
end
end
|
return LoadFont("time")..{
BeginCommand=cmd(playcommand,"Set");
CurrentCourseChangedMessageCommand=cmd(playcommand,"Set");
SetCommand=function(self)
local course = GAMESTATE:GetCurrentCourse()
if course then
local style = GAMESTATE:GetCurrentStyle()
local stepsType = style:GetStepsType()
local courseLen = course:GetTotalSeconds(stepsType)
if courseLen then
self:settext( SecondsToMMSSMsMs(courseLen) )
else
self:settext( "xx:xx.xx" )
end
end
end;
};
|
local formatting = require("modules.completion.formatting")
vim.cmd([[packadd nvim-lsp-installer]])
vim.cmd([[packadd lsp_signature.nvim]])
vim.cmd([[packadd lspsaga.nvim]])
vim.cmd([[packadd cmp-nvim-lsp]])
vim.cmd([[packadd lua-dev.nvim]])
vim.cmd([[packadd efmls-configs-nvim]])
vim.cmd([[packadd vim-illuminate]])
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.setup({
ensure_installed = {
"rust_analyzer",
"sumneko_lua",
"bashls",
"tsserver",
"pyright",
"dockerls",
"gopls",
"rnix",
},
automatic_installation = true,
ui = {
icons = {
server_installed = "✓",
server_pending = "➜",
server_uninstalled = "✗",
},
},
})
local saga = require("lspsaga")
-- Override diagnostics symbol
saga.init_lsp_saga({
error_sign = "",
warn_sign = "",
hint_sign = "",
infor_sign = "",
code_action_keys = {
quit = { "q", "<ESC>" },
},
rename_action_keys = {
quit = { "q", "<ESC>" },
},
})
local nvim_lsp = require("lspconfig")
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)
capabilities.textDocument.completion.completionItem.snippetSupport = true
local on_editor_attach = function(client, bufnr)
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
-- Enable completion triggered by <c-x><c-o>
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
require("lsp_signature").on_attach({
bind = true,
use_lspsaga = false,
floating_window = true,
fix_pos = true,
hint_enable = true,
hi_parameter = "Search",
handler_opts = { "double" },
})
require("illuminate").on_attach(client)
end
-- C server
local switch_source_header_splitcmd = function(bufnr, splitcmd)
bufnr = nvim_lsp.util.validate_bufnr(bufnr)
local clangd_client = nvim_lsp.util.get_active_client_by_name(bufnr, "clangd")
local params = { uri = vim.uri_from_bufnr(bufnr) }
if clangd_client then
clangd_client.request("textDocument/switchSourceHeader", params, function(err, result)
if err then
error(tostring(err))
end
if not result then
print("Corresponding file can’t be determined")
return
end
vim.api.nvim_command(splitcmd .. " " .. vim.uri_to_fname(result))
end)
else
print("method textDocument/switchSourceHeader is not supported by any servers active on the current buffer")
end
end
for _, server in ipairs(lsp_installer.get_installed_servers()) do
if server.name == "gopls" then
nvim_lsp.gopls.setup({
on_attach = on_editor_attach,
flags = { debounce_text_changes = 500 },
capabilities = capabilities,
cmd = { "gopls", "-remote=auto" },
settings = {
gopls = {
usePlaceholders = true,
analyses = {
nilness = true,
shadow = true,
unusedparams = true,
unusewrites = true,
},
},
},
})
elseif server.name == "pyright" then
nvim_lsp.pyright.setup({
capabilities = capabilities,
on_attach = on_editor_attach,
flags = { debounce_text_changes = 150 },
filetypes = { "python" },
init_options = {
formatters = {
black = {
command = "black",
args = { "--quiet", "-" },
rootPatterns = { "pyproject.toml" },
},
formatFiletypes = {
python = { "black" },
},
},
},
})
elseif server.name == "clangd" then
local c_capabilities = capabilities
c_capabilities.offsetEncoding = { "utf-16" }
nvim_lsp.clangd.setup({
capabilities = c_capabilities,
single_file_support = true,
on_attach = on_editor_attach,
args = {
"--background-index",
"-std=c++20",
"--pch-storage=memory",
"--clang-tidy",
"--suggest-missing-includes",
},
commands = {
ClangdSwitchSourceHeader = {
function()
switch_source_header_splitcmd(0, "edit")
end,
description = "Open source/header in current buffer",
},
ClangdSwitchSourceHeaderVSplit = {
function()
switch_source_header_splitcmd(0, "vsplit")
end,
description = "Open source/header in a new vsplit",
},
ClangdSwitchSourceHeaderSplit = {
function()
switch_source_header_splitcmd(0, "split")
end,
description = "Open source/header in a new split",
},
},
})
elseif server.name == "sumneko_lua" then
if vim.fn.expand("%:p:h") == vim.fn.stdpath("config") then
local lua_config = require("lua-dev").setup()
nvim_lsp.sumneko_lua.setup(lua_config)
end
elseif server.name == "tsserver" then
nvim_lsp.tsserver.setup({
on_attach = function(client)
client.server_capabilities.document_formatting = false
on_editor_attach(client)
end,
root_dir = nvim_lsp.util.root_pattern("tsconfig.json", "package.json", ".git"),
})
else
nvim_lsp[server.name].setup({
capabilities = capabilities,
on_attach = on_editor_attach,
})
end
end
-- https://github.com/vscode-langservers/vscode-html-languageserver-bin
nvim_lsp.html.setup({
cmd = { "html-languageserver", "--stdio" },
filetypes = { "html" },
init_options = {
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = { css = true, javascript = true },
},
settings = {},
single_file_support = true,
flags = { debounce_text_changes = 500 },
capabilities = capabilities,
on_attach = on_editor_attach,
})
-- Init `efm-langserver` here.
local efmls = require("efmls-configs")
efmls.init({
on_attach = on_editor_attach,
capabilities = capabilities,
init_options = { documentFormatting = true, codeAction = true },
})
-- Require `efmls-configs-nvim`'s config here
local vint = require("efmls-configs.linters.vint")
local clangtidy = require("efmls-configs.linters.clang_tidy")
local eslint = require("efmls-configs.linters.eslint")
local shellcheck = require("efmls-configs.linters.shellcheck")
local pylint = require("efmls-configs.linters.pylint")
local black = require("efmls-configs.formatters.black")
local luafmt = require("efmls-configs.formatters.stylua")
local clangfmt = {
formatCommand = "clang-format -style='{BasedOnStyle: LLVM}'",
formatStdin = true,
}
local prettier = require("efmls-configs.formatters.prettier")
local shfmt = require("efmls-configs.formatters.shfmt")
-- Override default config here
-- Setup formatter and linter for efmls here
efmls.setup({
vim = { formatter = vint },
lua = { formatter = luafmt },
c = { formatter = clangfmt, linter = clangtidy },
cpp = { formatter = clangfmt, linter = clangtidy },
vue = { formatter = prettier },
python = { formatter = black, linter = pylint },
typescript = { formatter = prettier, linter = eslint },
javascript = { formatter = prettier, linter = eslint },
typescriptreact = { formatter = prettier, linter = eslint },
javascriptreact = { formatter = prettier, linter = eslint },
yaml = { formatter = prettier },
html = { formatter = prettier },
css = { formatter = prettier },
scss = { formatter = prettier },
sh = { formatter = shfmt, linter = shellcheck },
markdown = { formatter = prettier },
})
formatting.configure_format_on_save()
|
LinkLuaModifier( "modifier_animation_translate_permanent_string", "libraries/modifiers/modifier_animation_translate_permanent_string.lua", LUA_MODIFIER_MOTION_NONE )
if HeroCosmetics == nil then
DebugPrint ( 'Starting HeroCosmetics' )
HeroCosmetics = class({})
end
function HeroCosmetics:Sohei (hero)
DebugPrint ( 'Starting Sohei Cosmetics' )
--hero.body = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "models/items/juggernaut/thousand_faces_hakama/thousand_faces_hakama.vmdl"})
--hero.hand = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "models/heroes/sohei/so_weapon.vmdl"})
--hero.head = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "models/heroes/sohei/so_head.vmdl"})
--hero.cape = SpawnEntityFromTableSynchronous("prop_dynamic", {model = "models/items/wraith_king/deadreborn_cape/deadreborn_cape.vmdl"})
-- lock to bone
--hero.body:FollowEntity(hero, true)
--hero.hand:FollowEntity(hero, true)
--hero.head:FollowEntity(hero, true)
--hero.cape:FollowEntity(hero, true)
--hero:AddNewModifier(hero, nil, 'modifier_animation_translate_permanent_string', {translate = 'walk'})
--hero:AddNewModifier(hero, nil, 'modifier_animation_translate_permanent_string', {translate = 'odachi'})
--hero:AddNewModifier(hero, nil, 'modifier_animation_translate_permanent_string', {translate = 'aggressive'})
end
|
local _M = {
_NAME = "luanode.path",
_PACKAGE = "luanode."
}
-- Make LuaNode 'public' modules available as globals.
luanode.path = _M
-- TODO: Deberia usar penlight.path y dejarme de joder
local config_regexp = ("([^\n])\n"):rep(5):sub(1, -2)
local dir_sep, path_sep, path_mark, execdir, igmark = package.config:match(config_regexp)
-- funcion sacada de MetaLua (table2.lua)
local function transposeTable(t)
local tt = { }
for a, b in pairs(t) do tt[b] = a end
return tt
end
----------------------------------------------------------------------
-- resc(k) returns "%"..k if it's a special regular expression char,
-- or just k if it's normal.
----------------------------------------------------------------------
local regexp_magic = transposeTable{"^", "$", "(", ")", "%", ".", "[", "]", "*", "+", "-", "?" }
local function resc(k)
return regexp_magic[k] and '%'..k or k
end
_M.dir_sep = dir_sep
function _M.join(...)
local t = {...}
return _M.normalize( table.concat(t, dir_sep) )
end
--
--
function _M.normalizeArray(parts, keepBlanks)
local directories = {}
local prev
for i, directory in ipairs(parts) do
--print(i, directory)
-- if it's blank, but it's not the first thing, and not the last thing, skip it.
if (directory == "" and i ~= 1 and i ~= #parts and not keepBlanks) then
--continue; -- fuck, no continue in Lua
-- if it's a dot, and there was some previous dir already, then skip it.
elseif directory == "." and prev then
-- continue; -- requetefuck, still no continue
-- if it starts with "", and is a . or .., then skip it.
elseif #directories == 1 and directories[1] == "" and (
directory == "." or directory == "..")
then
-- continue; -- yeah...
elseif directory == ".." and
#directories > 0 and
prev ~= ".." and
prev ~= "." and
prev and
(prev ~= "" or keepBlanks)
then
table.remove(directories)
prev = directories[#directories]
else
if prev == "." then table.remove(directories) end
directories[#directories + 1] = directory
prev = directory
end
end
return directories
end
--
--
function _M.normalize(path, keepBlanks)
local paths = {}
--print("normalize", path)
path = path:gsub("[\\/]", dir_sep)
local pattern = ("([^%s]+)"):format( resc(dir_sep) )
for p in path:gmatch(pattern) do
--print("p", p)
paths[#paths + 1] = p
end
paths = _M.normalizeArray(paths, keepBlanks)
if process.platform ~= "windows" then
return dir_sep .. table.concat(paths, dir_sep)
else
return table.concat(paths, dir_sep)
end
end
local function splitpath(path)
local path, file = string.match(path, "^(.*)[/\\]([^/\\]*)$")
if path == "" then
return dir_sep, file
elseif not path then
return "."
end
return path, file
end
--
--
function _M.dirname(path)
local path = splitpath(path)
return path
end
--
--
function _M.basename(path, ext)
local path, file = splitpath(path)
if file and ext then
local file2 = file:match("(.*)"..ext.."$")
if not file2 then
return file
end
return file
end
return file
end
--
--
function _M.extname(path)
-- TODO: implementar
error("not yet implemented")
end
function _M.exists(path, callback)
-- TODO: implementar
error("not yet implemented")
--process.binding('fs').stat(path, function (err, stats) {
-- if (callback) callback(err ? false : true);
-- });
end
function _M.existsSync(path)
-- TODO: implementar
error("not yet implemented")
--process.binding('fs').stat(path)
end
return _M
|
-- use local package; you don't have to use this if the `luacsound` is
-- installed
package.path = package.path .. ';../?/init.lua'
local csd = require 'luacsound'()
local sine = csd:instr( 'sine' )
sine{ freq = 'f6', start = 0, dur = 1, vol = 2 }
sine{ freq = 'f5', start = 1, dur = 1, vol = 2 }
sine{ freq = 'f4', start = 0.5, dur = 1, vol = 2 }
print( csd:output() )
|
--[[
Authors:
insyri; roblox: 145291526, github: insyri
veryunhappydoge; roblox: 1455906620, github: dowoge
]]
function transparencyShift(
targetTransparencyShiftTo: number,
elapsedTimeLength: number,
easingStyle: Enum,
part: BasePart
)
--[[ documentation
REQUIRED | targetTransparencyShiftTo : number [0..1] = the transparency value the object is changing to
REQUIRED | elapsedTimeLength : number = how long it takes to change from the original transparency to the new assigned transparency
OPTIONAL | easingStyle : Enum.EasingStyle = the transparency shift style, if not populated, default is Linear
https://developer.roblox.com/en-us/api-reference/enum/EasingStyle
OPTIONAL | part : BasePart = target part to be applied to; if not populated, default is script parent
]]
-- optional arguments parsing
if easingStyle == nil then
easingStyle = 'Linear'
end
-- return values
local numberLimits = 'parameter must be equal to or lower than 1 AND equal to or higher than 0, type passed: '
local typeNum = 'parameter should be a number'
-- type checking
assert(
type(targetTransparencyShiftTo) == 'number',
'targetTransparencyShiftTo' .. typeNum .. type(targetTransparencyShiftTo)
)
assert(targetTransparencyShiftTo > 1 or targetTransparencyShiftTo < 0, 'targetTransparencyShiftTo' .. numberLimits)
assert(type(elapsedTimeLength) == 'number', 'elapsedTimeLength' .. typeNum .. type(targetTransparencyShiftTo))
-- code
game
:GetService('TweenService')
:Create(
(part == nil and script.Parent or part),
TweenInfo.new(elapsedTimeLength, Enum.EasingStyle[easingStyle], Enum.EasingDirection.Out, 0, false, 0),
{ Transparency = targetTransparencyShiftTo }
)
:Play()
end
|
#!/usr/bin/env luajit
local unpack = unpack or require'table'.unpack
local min, max = require'math'.min, require'math'.max
local floor = require'math'.floor
-- local interval_x = {0, 60}
-- local interval_y = {0, 80}
local interval_x = {-10, 10}
local interval_y = {-10, 10}
local interval_scale = 0.05
local grid_params = {
scale = interval_scale,
xmin = interval_x[1], xmax = interval_x[2],
ymin = interval_y[1], ymax = interval_y[2],
datatype = 'double'
}
local costmap = require'grid'.new(grid_params)
for ind=0, costmap.n_cells-1 do
costmap.grid[ind] = 1
end
local maxvalLine = 1e5--8192 -- 8192 -- 4096 -- 2048 -- 1024 -- 256
local function set_max(map, idx)
map[idx] = maxvalLine
end
costmap:bresenham(
{-7, 7},
{7, -7},
set_max
):bresenham(
{-7+costmap.scale, 7},
{7+costmap.scale, -7},
set_max
):bresenham(
{-7-costmap.scale, 7},
{7-costmap.scale, -7},
set_max
)
local CIRCLE_RADIUS = 2
local maxvalCircle = maxvalLine / 3
local function set_circle(map, idx, r)
-- map[idx] = maxval * (r==0 and 1 or math.sqrt(CIRCLE_RADIUS / r))
map[idx] = maxvalCircle
end
local circles = {
{2, -2, CIRCLE_RADIUS},
{0, 0, CIRCLE_RADIUS},
{-2, 2, CIRCLE_RADIUS},
}
for _,c in ipairs(circles) do
local xc, yc, rc = unpack(c)
costmap:circle(xc, yc, rc, set_circle)
end
assert(costmap:save"/tmp/costmapD")
local nNeighbors = 16
local RADIANS_PER_NEIGHBOR = 2*math.pi / nNeighbors
local planner = require'dijkstra'.new{
costmap = costmap,
neighbors = nNeighbors
}
local start_xy = {-9, -9}
start_xy[3] = math.pi/2
local start_ij = {costmap.xy2ij(unpack(start_xy))}
start_ij[3] = (start_xy[3] - start_xy[3] % RADIANS_PER_NEIGHBOR) / RADIANS_PER_NEIGHBOR
local goal_xy = {9, 9}
goal_xy[3] = 0
local goal_ij = {costmap.xy2ij(unpack(goal_xy))}
goal_ij[3] = (goal_xy[3] - goal_xy[3] % RADIANS_PER_NEIGHBOR) / RADIANS_PER_NEIGHBOR
print("Start_xy", table.concat(start_xy, ','))
print("Goal_xy", table.concat(goal_xy, ','))
print("Start_ij", table.concat(start_ij, ','))
print("Goal_ij", table.concat(goal_ij, ','))
--
local path_ij, err = planner:plan(start_ij, goal_ij)
if planner.cost_to_go then
grid_params.grid = planner.cost_to_go
local c2g = require'grid'.new(grid_params)
assert(c2g:save"/tmp/c2gD")
end
assert(path_ij, err)
print("Path", type(path_ij))
local path_xy = {}
for i, v in ipairs(path_ij) do
local xy = {costmap.ij2xy(unpack(v, 1, 2))}
if v[3] then
xy[3] = v[3] * (2 * math.pi)/ nNeighbors
end
table.insert(path_xy, xy)
path_xy[i] = xy
end
print("saving")
local function color_path(map, idx, i)
map[idx] = path_ij[i][4] and (maxvalLine/4) or (maxvalLine/2)
end
costmap:path(path_xy, color_path)
assert(costmap:save"/tmp/costmapD_path")
|
local status_ok, comment = pcall(require, "Comment")
if not status_ok then
return
end
comment.setup {
pre_hook = function(ctx)
local U = require "Comment.utils"
local location = nil
if ctx.ctype == U.ctype.block then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
return require("ts_context_commentstring.internal").calculate_commentstring {
key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
location = location,
}
end,
padding = true,
ignore = "^$",
mappings = {
basic = true,
extra = false,
},
toggler = {
line = "gcc",
block = "gbc",
},
opleader = {
line = "gc",
block = "gb",
},
post_hook = nil,
}
--[[
This can't be used to comment out top level jsx. It will revert back to js commenting.
https://github.com/JoosepAlviste/nvim-ts-context-commentstring/issues/29
]]
|
--[[
Day 18: Musicy
]]
print("Day 18")
function GetValue(val, vars)
if (type(val) == 'number') then
return val
else
return vars[val] or 0
end
end
MACH = {}
MACH[1] = {vars = {}, count = 1, done = false}
MACH[2] = {vars = {}, count = 1, done = false}
function Run(i, machine)
end
function Day18(input)
local vars = {}
local instr = {}
-- Load instructions...
for _, line in pairs(input) do
local _, endp, inst, reg = line:find('(...) (.)')
local rest = line:sub(endp+2)
if (string.len(rest) > 0) then
rest = tonumber(rest) or rest
end
table.insert(instr, {instruction = inst, register = reg, value = rest})
end
local count = 1
local done = false
while (not done) do
local i = instr[count]
if (not i) then done = true break end
print("inst: " .. i.instruction .. " reg: " .. i.register .. " val: " .. (i.value or "none"))
local instruction = i.instruction
if (instruction == "set") then
vars[i.register] = GetValue(i.value, vars)
count = count + 1
end
if (instruction == "add") then
local val = vars[i.register] or 0
vars[i.register] = val + GetValue(i.value, vars)
count = count + 1
end
if (instruction == "mul") then
local val = vars[i.register] or 0
vars[i.register] = val * GetValue(i.value, vars)
count = count + 1
end
if (instruction == "mod") then
print(instruction, i.register)
local val = vars[i.register] or 0
vars[i.register] = val % GetValue(i.value, vars)
count = count + 1
end
if (instruction == "rcv") then
local val = vars[i.register] or 0
if (val ~= 0) then
-- recovers the frequency of the last sound played?
print('RCV: ' .. gLastSound)
done = true
break
end
count = count + 1
end
if (instruction == "jgz") then
local val = vars[i.register] or 0
if (val > 0) then
count = count + GetValue(i.value, vars)
else
count = count + 1
end
end
if (instruction == "snd") then
print("snd")
print('reg: ' .. i.register)
local val = vars[i.register] or 0
print("Sound Played: " .. val)
gLastSound = val
-- plays sound of frequency of value of register?
count = count + 1
end
end
--for k,v in pairs(vars) do print(k,v) end
print('done')
end
--[[function Day17b(step, last)
local cur, pos1 = 1, 0
for count = 1, last do
cur = (cur+step) % count + 1
if (cur == 1) then pos1 = count end
end
print(pos1)
end
]]
TESTDATA = {}
table.insert(TESTDATA, "set a 1")
table.insert(TESTDATA, "add a 2")
table.insert(TESTDATA, "mul a a")
table.insert(TESTDATA, "mod a 5")
table.insert(TESTDATA, "snd a")
table.insert(TESTDATA, "set a 0")
table.insert(TESTDATA, "rcv a")
table.insert(TESTDATA, "jgz a -1")
table.insert(TESTDATA, "set a 1")
table.insert(TESTDATA, "jgz a -2")
--Day18(TESTDATA) -- Test case
INPUT = {}
for line in io.lines("input") do
table.insert(INPUT, line)
end
Day18(INPUT)
|
util.AddNetworkString("FScript.ChangeCharacter.OpenMenu")
util.AddNetworkString("FScript.ChangeCharacter.Validate")
net.Receive("FScript.ChangeCharacter.Validate", function(lenght, ply)
if not FScript.IsValidPlayer(ply) or lenght == 0 then
return
end
local CanChange, Reason = hook.Run("FScript.CanChangeCharacter", ply)
if CanChange == false then
if Reason then
FScript.SendNotification(ply, 1, Reason)
end
return
end
local CharacterNumber = net.ReadUInt(4)
if isnumber(CharacterNumber) then
FScript.LoadCharacter(ply, CharacterNumber)
else
FScript.ChangeCharacter(ply)
end
hook.Run("FScript.PostChangeCharacter", ply, CharacterNumber)
end)
function FScript.ChangeCharacter(ply, requester)
if not FScript.IsValidPlayer(ply) then
return
end
local CanChange, Reason = hook.Run("FScript.CanChangeCharacter", ply)
if CanChange == false then
if Reason then
FScript.SendNotification(requester or ply, 1, Reason)
end
return
end
if requester then
FScript.SendNotification(requester, 3, FScript.Lang.OperationSuccess)
end
hook.Run("FScript.PreChangeCharacter", ply)
FScript.ResetPlayer(ply)
local PlayerSteamID64 = ply:SteamID64()
local Characters = file.Find("fscript_data/players/" .. PlayerSteamID64 .. "/*", "DATA")
if #Characters == 0 then
FScript.CreateCharacter(ply)
FScript.SendNotification(ply, 1, FScript.Lang.NoDataFound)
return
end
local CharactersData = {}
for k, v in ipairs(Characters) do
file.AsyncRead("fscript_data/players/" .. PlayerSteamID64 .. "/" .. v, "DATA", function(fileName, gamePath, status, data)
if status == FSASYNC_OK then
CharactersData[k] = util.JSONToTable(data)
if #Characters == table.Count(CharactersData) then
net.Start("FScript.ChangeCharacter.OpenMenu")
net.WriteTable(CharactersData)
FScript.ValidateNetworkMessage(ply)
net.Send(ply)
FScript.SendNotification(ply, 3, FScript.Lang.DataFound)
end
end
end)
end
end
|
SoundOptions = {}
SoundOptions.__index = SoundOptions
setmetatable(SoundOptions, {
__index = SoundOptions,
__call = function (cls, ...)
local self = setmetatable({}, cls)
self:_init(...)
return self
end,
})
function SoundOptions:_init()
self.background = love.graphics.newImage("media/menu/darkBackground.png")
self.sfx = "menu"
self.soundOptionsFilename = "soundOptions.dat"
if love.filesystem.exists(self.soundOptionsFilename) then
local videoOptions = love.filesystem.lines(self.soundOptionsFilename)
for line in videoOptions do
local lineTokens = split(line, "[^\t]+")
self.masterVolume = tonumber(lineTokens[1])
self.bgmVolume = tonumber(lineTokens[2])
self.sfxVolume = tonumber(lineTokens[3])
end
else
self.masterVolume = 1.0
self.bgmVolume = 1.0
self.sfxVolume = 1.0
end
self.submenuCount = 4
self.selection = 1
self.menuText = self:generateMenuText()
end
function SoundOptions.generateMenuText(self)
local menuText = ""
menuText = menuText .. "Master: " .. self.masterVolume*10 .. "\n"
menuText = menuText .. "BGM: " .. self.bgmVolume*10 .. "\n"
menuText = menuText .. "SFX: " .. self.sfxVolume*10 .. "\n"
menuText = menuText .. "Back"
return menuText
end
function SoundOptions.draw(self)
--determine scaling for background image
local width = love.graphics.getWidth()
local height = love.graphics.getHeight()
local imageWidth = self.background:getWidth()
local imageHeight = self.background:getHeight()
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(self.background, 0, 0, 0, width / imageWidth, height / imageHeight)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.printf(self.menuText, love.graphics.getWidth()/4, love.graphics.getHeight()/2, love.graphics.getWidth()/2, "center")
screen:drawCursor(295, 270 + 32*self.selection)
end
function SoundOptions.processControls(self, input)
if controls:isUp(input) then
if self.selection > 1 then
self.selection = self.selection - 1
soundEffects:playSoundEffect(self.sfx)
end
elseif controls:isDown(input) then
if self.selection < self.submenuCount then
self.selection = self.selection + 1
soundEffects:playSoundEffect(self.sfx)
end
elseif controls:isLeft(input) then
if self.selection == 1 then
self.masterVolume = self.masterVolume - 0.1
if self.masterVolume < 0.05 then --Use 0.05 instead of 0.0 because FLOATING POINT MATH
self.masterVolume = 0.0
end
elseif self.selection == 2 then
self.bgmVolume = self.bgmVolume - 0.1
if self.bgmVolume < 0.05 then
self.bgmVolume = 0.0
end
elseif self.selection == 3 then
self.sfxVolume = self.sfxVolume - 0.1
if self.sfxVolume < 0.05 then
self.sfxVolume = 0.0
end
end
music:applyVolume()
soundEffects:playSoundEffect(self.sfx)
self.menuText = self:generateMenuText()
elseif controls:isRight(input) then
if self.selection == 1 then
self.masterVolume = self.masterVolume + 0.1
if self.masterVolume >= 1.0 then
self.masterVolume = 1.0
end
elseif self.selection == 2 then
self.bgmVolume = self.bgmVolume + 0.1
if self.bgmVolume >= 1.0 then
self.bgmVolume = 1.0
end
elseif self.selection == 3 then
self.sfxVolume = self.sfxVolume + 0.1
if self.sfxVolume >= 1.0 then
self.sfxVolume = 1.0
end
end
music:applyVolume()
soundEffects:playSoundEffect(self.sfx)
self.menuText = self:generateMenuText()
elseif controls:isMenu(input) or controls:isConfirm(input) then
if self.selection == 4 then
--save changes back to file
local saveData = ""
saveData = saveData .. self.masterVolume .. "\t" .. self.bgmVolume .. "\t" .. self.sfxVolume
love.filesystem.write(self.soundOptionsFilename, saveData)
toState = options
soundEffects:playSoundEffect(self.sfx)
end
else
--
end
end
function SoundOptions.keyreleased(self, key)
--
end
function SoundOptions.mousepressed(self, x, y, button)
--
end
function SoundOptions.update(self, dt)
end
|
slot0 = class("BackYardThemeTemplateDescPage", import("....base.BaseSubView"))
slot1 = 1
slot2 = 2
slot3 = 3
slot4 = {
{
"text_desc",
"text_allin"
},
{
"text_delete",
"text_upload",
"text_cancel_upload"
},
{
"text_desc",
"text_allin"
}
}
function slot5(slot0)
return slot0[slot0]
end
slot0.getUIName = function (slot0)
return "BackYardThemeTemplateDescPage"
end
slot0.ThemeTemplateUpdate = function (slot0, slot1)
if slot0.template and slot0.template.id == slot1.id then
slot0.template = slot1
slot0:Flush()
end
end
slot0.UpdateDorm = function (slot0, slot1)
slot0.dorm = slot1
end
slot0.PlayerUpdated = function (slot0, slot1)
slot0.player = slot1
end
slot0.OnLoaded = function (slot0)
slot0.icon = slot0:findTF("icon/icon"):GetComponent(typeof(Image))
slot0.idTxt = slot0:findTF("ID"):GetComponent(typeof(Text))
slot0.idLabel = slot0:findTF("ID_label"):GetComponent(typeof(Text))
slot0.copyBtn = slot0:findTF("copy")
slot0.nameTxt = slot0:findTF("name/Text"):GetComponent(typeof(Text))
slot0.sortBtn = slot0:findTF("sort")
slot0.sortArr = slot0:findTF("sort/arr")
slot0.sortTxt = slot0:findTF("sort/Text"):GetComponent(typeof(Text))
slot0.filterBtn = slot0:findTF("filter")
slot0.filterTxt = slot0:findTF("filter/Text"):GetComponent(typeof(Text))
setActive(slot0.sortBtn, false)
setActive(slot0.filterBtn, false)
slot0.mainPanel = slot0:findTF("main")
slot0.timeTxt = slot0.mainPanel:Find("time"):GetComponent(typeof(Text))
slot0.btn1 = slot0.mainPanel:Find("desc_btn")
slot0.btn1Txt = slot0.mainPanel:Find("desc_btn/btn_word2"):GetComponent(typeof(Image))
slot0.btn2 = slot0.mainPanel:Find("push_btn")
slot0.btn2Txt = slot0.mainPanel:Find("push_btn/btn_word1"):GetComponent(typeof(Image))
slot0.heart = slot0.mainPanel:Find("heart")
slot0.heartSel = slot0.mainPanel:Find("heart/sel")
slot0.heartTxt = slot0.mainPanel:Find("heart/Text"):GetComponent(typeof(Text))
slot0.collection = slot0.mainPanel:Find("collection")
slot0.collectionSel = slot0.mainPanel:Find("collection/sel")
slot0.collectionTxt = slot0.mainPanel:Find("collection/Text"):GetComponent(typeof(Text))
slot0.label1 = slot0.mainPanel:Find("search1"):GetComponent(typeof(Text))
setActive(slot0.label1.gameObject, false)
slot0.contextData.sortPage.OnChange = function (slot0)
slot0.filterTxt.text = slot0
end
slot0.idLabel.text = i18n("word_theme") .. "ID:"
end
slot0.OnInit = function (slot0)
onButton(slot0, slot0.copyBtn, function ()
if slot0.player then
UniPasteBoard.SetClipBoardString(slot0.template.id)
pg.TipsMgr.GetInstance():ShowTips(i18n("friend_id_copy_ok"))
end
end, SFX_PANEL)
onButton(slot0, slot0.filterBtn, function ()
slot0.contextData.sortPage:ExecuteAction("SetUp")
end, SFX_PANEL)
end
slot0.SetUp = function (slot0, slot1, slot2, slot3, slot4)
slot0.pageType = slot1
slot0.template = slot2
slot0.dorm = slot3
slot0.player = slot4
slot0:RefreshSortBtn()
slot0:Flush()
slot0:Show()
end
slot0.RefreshSortBtn = function (slot0)
slot1, slot2 = nil
if slot0.pageType == BackYardConst.THEME_TEMPLATE_TYPE_CUSTOM then
slot1, slot2 = BackYardConst.ServerIndex2ThemeSortIndex(getProxy(DormProxy).TYPE)
else
slot2 = true
slot1 = 1
end
slot0.filterTxt.text = BackYardThemeTemplateSortPanel.GetChineseByIndex(slot1)
function slot4(slot0)
slot0.sortArr.localScale = Vector3(1, (slot0 and 1) or -1, 1)
slot0.sortTxt.text = (slot0 and i18n("word_asc")) or i18n("word_desc")
end
slot0.sortFlag = slot2
onButton(slot0, slot0.sortBtn, function ()
slot0.sortFlag = not slot0.sortFlag
not slot0.sortFlag(slot0.sortFlag)
if not slot0.sortFlag.OnSortChange then
slot0.OnSortChange(slot0.sortFlag)
end
end, SFX_PANEL)
slot4(slot0.sortFlag)
end
slot0.Flush = function (slot0)
slot0:UpdateWindow()
slot0:UpdatePlayer()
slot0:UpdateLikeInfo()
slot0["Update" .. slot0.pageType](slot0)
end
slot0.Update1 = function (slot0)
onButton(slot0, slot0.btn1, function ()
slot0.contextData.infoPage:ExecuteAction("SetUp", slot0.template, slot0.dorm, slot0.player)
end, SFX_PANEL)
onButton(slot0, slot0.btn2, function ()
slot0.contextData.msgBox:ExecuteAction("SetUp", {
type = BackYardThemeTemplateMsgBox.TYPE_IMAGE,
content = i18n("backyard_theme_apply_tip2"),
srpiteName = slot0.template:GetTextureIconName(),
md5 = slot0.template:GetIconMd5(),
onYes = function ()
slot0:emit(NewBackYardThemeTemplateMediator.ON_APPLY_TEMPLATE, slot0.template, function ()
triggerButton(slot0.btn1)
end)
end
})
end, SFX_PANEL)
end
slot0.Update2 = function (slot0)
onButton(slot0, slot0.btn1, function ()
slot0:emit(NewBackYardThemeTemplateMediator.ON_DELETE_TEMPLATE, slot0)
end, SFX_PANEL)
onButton(slot0, slot0.btn2, function ()
if slot0 then
slot1:emit(NewBackYardThemeTemplateMediator.ON_CANCEL_UPLOAD_TEMPLATE, )
else
slot1:emit(NewBackYardThemeTemplateMediator.ON_UPLOAD_TEMPLATE, )
end
end, SFX_PANEL)
if not slot0.template.IsPushed(slot1) then
slot0.timeTxt.text = i18n("backyard_theme_upload_cnt", getProxy(DormProxy).GetUploadThemeTemplateCnt(slot3), BackYardConst.MAX_UPLOAD_THEME_CNT)
end
end
slot0.Update3 = function (slot0)
slot0:Update1()
slot0.timeTxt.text = i18n("backyard_theme_template_collection_cnt") .. getProxy(DormProxy):GetThemeTemplateCollectionCnt() .. "/" .. BackYardConst.MAX_COLLECTION_CNT
end
slot0.UpdatePlayer = function (slot0)
if not slot0.template:ExistPlayerInfo() then
slot0:emit(NewBackYardThemeTemplateMediator.GET_TEMPLATE_PLAYERINFO, slot0.pageType, slot0.template)
else
slot0.player = slot0.template.player
slot0.nameTxt.text = slot0.template.player.name
slot0.idTxt.text = slot0.template.id
slot0.timeTxt.text = i18n("backyard_theme_upload_time") .. slot0.template:GetUploadTime()
LoadSpriteAsync("qicon/" .. slot0.template.player:getPainting(), function (slot0)
if IsNil(slot0.icon) then
return
end
slot0.icon.sprite = slot0
end)
if slot0.preLoadIcon then
PoolMgr.GetInstance().ReturnPrefab(slot3, "IconFrame/" .. slot2, slot0.preLoadIcon.name, slot0.preLoadIcon)
end
PoolMgr.GetInstance():GetPrefab("IconFrame/" .. slot2, slot2, true, function (slot0)
if slot0.icon then
slot0.name = slot1
findTF(slot0.transform, "icon").GetComponent(slot1, typeof(Image)).raycastTarget = false
setParent(slot0, slot0.icon.gameObject, false)
slot0.preLoadIcon = slot0
end
end)
onButton(slot0, slot0.icon, function ()
if slot0.id == getProxy(PlayerProxy):getRawData().id then
return
end
slot1:emit(NewBackYardThemeTemplateMediator.ON_DISPLAY_PLAYER_INFO, slot0.id, tf(slot1.icon.gameObject).position, slot1.template.id)
end, SFX_PANEL)
end
end
slot0.UpdateLikeInfo = function (slot0)
slot0.heartTxt.text = i18n("backyard_theme_word_like") .. slot0.template.GetLikeCnt(slot1)
slot0.collectionTxt.text = i18n("backyard_theme_word_collection") .. slot0.template:GetCollectionCnt()
slot2 = slot0.pageType == BackYardConst.THEME_TEMPLATE_TYPE_CUSTOM
onButton(slot0, slot0.heart, function ()
if slot0.pageType == BackYardConst.THEME_TEMPLATE_TYPE_CUSTOM then
return
end
if not slot1 then
slot0:emit(NewBackYardThemeTemplateMediator.ON_LIKE_THEME, slot0.template, slot0.template.time)
end
end, SFX_PANEL)
setActive(slot0.heartSel, slot1:IsLiked() or slot2)
onButton(slot0, slot0.collection, function ()
if slot0.pageType == BackYardConst.THEME_TEMPLATE_TYPE_CUSTOM then
return
end
if slot1 then
slot0.contextData.msgBox:ExecuteAction("SetUp", {
content = i18n("backyard_theme_cancel_collection"),
onYes = function ()
slot0:emit(NewBackYardThemeTemplateMediator.ON_COLECT_THEME, slot0.template, true, slot0.template.time)
end
})
else
slot0.emit(slot0, NewBackYardThemeTemplateMediator.ON_COLECT_THEME, slot0.template, false, slot0.template.time)
end
end, SFX_PANEL)
setActive(slot0.collectionSel, slot1:IsCollected() or slot2)
end
slot0.UpdateWindow = function (slot0)
function slot1(slot0)
slot1 = -224
slot2 = -314
slot3 = 0
slot4 = 0
if slot0 == slot0 then
slot4 = 338
slot3 = 580
elseif slot0 == slot1 then
slot4 = 265
slot3 = 505
slot1 = -153
slot2 = -230
elseif slot0 == slot2 then
slot4 = 196
slot3 = 436
slot1 = -145
slot2 = -237
end
setAnchoredPosition(slot3.btn1, {
y = slot1
})
setAnchoredPosition(slot3.btn2, {
y = slot1
})
slot3._tf.sizeDelta = Vector2(slot3._tf.sizeDelta.x, slot3)
slot3.mainPanel.sizeDelta = Vector2(slot3.mainPanel.sizeDelta.x, slot4)
setActive(slot3.heart, slot0 ~= slot2)
setActive(slot3.collection, slot0 ~= slot2)
setAnchoredPosition(slot3.heart, {
y = slot2
})
setAnchoredPosition(slot3.collection, {
y = slot2
})
end
slot2, slot4 = nil
slot4 = slot3(slot0.pageType)
if slot0.pageType == BackYardConst.THEME_TEMPLATE_TYPE_CUSTOM then
slot1((slot0.template.IsPushed(slot5) and slot1) or slot2)
slot2 = slot4[1]
slot3 = (((slot0.template.IsPushed(slot5) and slot1) or slot2) == slot1 and slot4[3]) or slot4[2]
elseif slot0.pageType == BackYardConst.THEME_TEMPLATE_TYPE_COLLECTION then
slot1(slot1)
slot2 = slot4[1]
slot3 = slot4[2]
elseif slot0.pageType == BackYardConst.THEME_TEMPLATE_TYPE_SHOP then
slot1(slot1)
slot2 = slot4[1]
slot3 = slot4[2]
end
slot0.btn1Txt.sprite = GetSpriteFromAtlas("ui/NewBackYardShopUI_atlas", slot2)
slot0.btn1Txt:SetNativeSize()
slot0.btn2Txt.sprite = GetSpriteFromAtlas("ui/NewBackYardShopUI_atlas", slot3)
slot0.btn2Txt:SetNativeSize()
end
slot0.Show = function (slot0)
slot0.super.Show(slot0)
slot0._tf:SetSiblingIndex(3)
end
slot0.OnDestroy = function (slot0)
slot0.contextData.sortPage.OnChange = nil
if slot0.preLoadIcon then
PoolMgr.GetInstance():ReturnPrefab("IconFrame/" .. slot1, slot0.preLoadIcon.name, slot0.preLoadIcon)
end
end
return slot0
|
paradeSlot("dtm4_hw2container_basic", { 1.954785, -10.1566125, 41.17178 }, {0, 0, 1}, {1, 0, 0}, 0);
paradeSlot("misc", {0, 0, 0}, {0, 0, 1}, {1, 0, 0}, 0);
|
ExtraItem.ID = "ZPArmor"
ExtraItem.Name = "ExtraItemArmorName"
ExtraItem.Price = 12
function ExtraItem:OnBuy(ply)
ply:SetArmor(ply:Armor() + 100)
end
|
-- Wireshark PostDissector to ascii decode non-passworded DNScat2 traffic.
-- Based off the dnscat dissector by DiabloHorn https://diablohorn.wordpress.com
-- Currently only performs ascii decode, should be expanded to include the rest of the protocol
-- info
print("dnscat postdissector loading")
dc_udp_dport = Field.new("udp.dstport")
dc_udp_sport = Field.new("udp.srcport")
-- we need these fields from the dns packets
dc_dns_name = Field.new("dns.qry.name")
dc_dns_resp_type = Field.new("dns.resp.type")
dc_dns_resp_cname = Field.new("dns.cname")
dc_dns_resp_mx = Field.new("dns.mx.mail_exchange")
dc_dns_resp_txt = Field.new("dns.txt")
-- declare our postdissector
dnscat = Proto("DNSCat","DNSCat postdissector")
-- our fields
dc_rawrequest = ProtoField.string("dnscat.rawreq","Encoded Dnscat Request")
dc_rawresponse = ProtoField.string("dnscat.rawresp","Encoded Dnscat Response")
dc_data = ProtoField.string("dnscat.data","Decoded Data")
dc_length = ProtoField.uint32("dnscat.len","Length of Decoded Data")
-- add our fields
dnscat.fields = {dc_rawrequest,dc_rawresponse,dc_data,dc_length}
-- dissect each packet
function dnscat.dissector(buffer,pinfo,tree)
local udpsport = dc_udp_sport()
local udpdport = dc_udp_dport()
local dnsqryname = dc_dns_name()
local dnstype = dc_dns_resp_type()
local dnsresp
local length = 0
-- don't parse non-dns data
if not dnsqryname then
return
end
if tostring(dnstype) == "15" then
dnsresp = dc_dns_resp_mx()
end
if tostring(dnstype) == "16" then
dnsresp = dc_dns_resp_txt()
end
if tostring(dnstype) == "5" then
dnsresp = dc_dns_resp_cname()
end
-- Quick sanity check that the query has enough data to be a valid command
local lencheck = getdata(tostring(dnsqryname))
if string.len(lencheck) < 18 then
return
end
local subtree = tree:add(dnscat,"DNSCat Data")
local parsed = {}
if tostring(udpdport) == "53" then
subtree:add(dc_rawrequest,tostring(dnsqryname))
parsed = parseDC(tostring(dnsqryname))
end
if tostring(udpsport) == "53" then
subtree:add(dc_rawresponse,tostring(dnsresp))
parsed = parseDC(tostring(dnsresp))
end
subtree:add(dc_data,tostring(parsed))
length = string.len(parsed)
subtree:add(dc_length,length)
end -- end dissector function
-- Clean up data
function getdata(data)
-- strip off dnscat. prefix if present
data = data:gsub("dnscat.", "")
for sub in data:gmatch("[^%.]+") do
-- return first subdomain only
return sub
end
end
-- decode hex data to ascii
function decodehex(data)
local dec = ""
for sub in data:gmatch("%x%x") do
local decnum = tonumber(sub,16)
if decnum > 31 and decnum < 127 then
dec = dec .. string.char(decnum)
else
dec = dec .. "."
end
end
return dec
end
-- Should be expanded to handle the full protocol, but ascii works
function parseDC(data)
local x = getdata(data)
-- Discard first 19 prococol characters, leaving only ascii commands
cmd = x:sub(19)
return decodehex(cmd)
end
-- register ourselfs
register_postdissector(dnscat)
|
local mode = require "config.modes"
-- common stuff
require 'waffle.core.loadVimOptions'
require 'waffle.core.vimStuff'
require 'waffle.core.bindKeys'
-- mode detction {
if mode.plusplus then
require 'modes.plusplus'
end
if mode.typewriter then
require 'modes.typewriter'
end
if mode.doom then
require 'modes.doom'
end
|
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0204-same-app-from-multiple-devices.md
-- Description:
-- Two mobile applications with the same appNames and different appIds from different mobiles send
-- SubscribeVehicleData requests and receive OnVehicleData notifications.
--
-- Preconditions:
-- 1) SDL and HMI are started
-- 2) Mobiles №1 and №2 are connected to SDL
--
-- Steps:
-- 1) Mobile №1 App1 requested Subscribe on VehicleData("gps")
-- Check:
-- SDL send VeicleInfo.SubscribeVehicleData (appId_1, "gps" = true) to HMI
-- SDL receives VeicleInfo.SubscribeVehicleData("SUCCESS") response from HMI
-- SDL sends SubscribeVehicleData("SUCCESS") response to Mobile №1
-- SDL sends OnHashChange with updated hashId to Mobile №1
-- 2) HMI sent OnVehicleData("gps") notification
-- Check:
-- SDL sends OnVehicleData("gps") notification to Mobile №1
-- SDL does NOT send OnVehicleData to Mobile №2
-- 3) Mobile №2 App2 requested Subscribe on VehicleData("speed", "gps")
-- Check:
-- SDL sends VeicleInfo.SubscribeVehicleData (appId_1, "speed" = true) to HMI
-- SDL receives VeicleInfo.SubscribeVehicleData("SUCCESS") response from HMI
-- SDL sends SubscribeVehicleData("SUCCESS") response to Mobile №2
-- SDL sends OnHashChange with updated hashId to Mobile №2
-- 4) HMI sent OnVehicleData("speed") notification
-- Check:
-- SDL sends OnVehicleData("speed") notification to Mobile №2
-- SDL does NOT send OnVehicleData to Mobile №1
-- 5) HMI sent OnVehicleData("speed", "gps") notification
-- Check:
-- SDL sends OnVehicleData("speed") notification to Mobile №1
-- SDL sends OnVehicleData("speed", "gps") notification to Mobile №2
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/TheSameApp/commonTheSameApp')
--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
--[[ Local Data ]]
local devices = {
[1] = { host = "1.0.0.1", port = config.mobilePort },
[2] = { host = "192.168.100.199", port = config.mobilePort }
}
local appParams = {
[1] = { appName = "Test Application", appID = "0001", fullAppID = "0000001" },
[2] = { appName = "Test Application", appID = "00022", fullAppID = "00000022" }
}
local locationGroup = {
rpcs = {
GetVehicleData = { hmi_levels = {"BACKGROUND", "FULL", "LIMITED"} },
OnVehicleData = { hmi_levels = {"BACKGROUND", "FULL", "LIMITED"} },
SubscribeVehicleData = { hmi_levels = {"BACKGROUND", "FULL", "LIMITED"} },
UnsubscribeVehicleData = { hmi_levels = {"BACKGROUND", "FULL", "LIMITED"} }
}
}
--[[ Local Functions ]]
local function modifyLocationGroupInPT(pt)
pt.policy_table.functional_groupings["DataConsent-2"].rpcs = common.json.null
pt.policy_table.functional_groupings["Location-1"] = locationGroup
pt.policy_table.app_policies[appParams[1].fullAppID] = common.cloneTable(pt.policy_table.app_policies["default"])
pt.policy_table.app_policies[appParams[1].fullAppID].groups = {"Base-4", "Location-1"}
pt.policy_table.app_policies[appParams[2].fullAppID] = common.cloneTable(pt.policy_table.app_policies["default"])
pt.policy_table.app_policies[appParams[2].fullAppID].groups = {"Base-4", "Location-1"}
end
local function subscribeOnSpeed(pAppId, pFirstApp)
local mobSession = common.mobile.getSession(pAppId)
local cid = mobSession:SendRPC("SubscribeVehicleData", { speed = true })
if pFirstApp then
common.hmi.getConnection():ExpectRequest("VehicleInfo.SubscribeVehicleData", { speed = true })
:Do(function(_,data)
local hmiRespParams = {
speed = {
dataType = "VEHICLEDATA_SPEED",
resultCode = "SUCCESS"
}
}
common.hmi.getConnection():SendResponse( data.id, data.method, "SUCCESS", hmiRespParams )
end)
end
mobSession:ExpectResponse( cid, { success = true, resultCode = "SUCCESS" })
mobSession:ExpectNotification( "OnHashChange" )
end
local function subscribeOnSpeedAndGPS(pAppId, pFirstApp)
local mobSession = common.mobile.getSession(pAppId)
local cid = mobSession:SendRPC("SubscribeVehicleData", { speed = true, gps = true })
if pFirstApp then
common.hmi.getConnection():ExpectRequest(
"VehicleInfo.SubscribeVehicleData", { gps = true })
:Do(function(_,data)
local hmiRespParams = {
gps = {
dataType = "VEHICLEDATA_GPS",
resultCode = "SUCCESS"
}
}
common.hmi.getConnection():SendResponse( data.id, data.method, "SUCCESS", hmiRespParams )
end)
end
mobSession:ExpectResponse(cid, { success = true, resultCode = "SUCCESS" })
mobSession:ExpectNotification("OnHashChange")
end
local function sendOnVehicleData1(pAppId1, pAppId2, pData)
local mobSession1 = common.mobile.getSession(pAppId1)
local mobSession2 = common.mobile.getSession(pAppId2)
if "gps" == pData then
common.hmi.getConnection():SendNotification("VehicleInfo.OnVehicleData", {gps = {longitudeDegrees =1.1,
latitudeDegrees = 1.1}} )
mobSession1:ExpectNotification("OnVehicleData",{gps = {longitudeDegrees =1.1, latitudeDegrees = 1.1}})
mobSession2:ExpectNotification("OnVehicleData",{gps = {longitudeDegrees =1.1, latitudeDegrees = 1.1}}):Times(0)
elseif "speed" == pData then
common.hmi.getConnection():SendNotification("VehicleInfo.OnVehicleData", { speed = 60.5 } )
mobSession1:ExpectNotification("OnVehicleData", { speed = 60.5 } )
mobSession2:ExpectNotification("OnVehicleData", { speed = 60.5 } ):Times(0)
end
end
local function sendOnVehicleData2(pAppId1, pAppId2)
local mobSession1 = common.mobile.getSession(pAppId1)
local mobSession2 = common.mobile.getSession(pAppId2)
common.hmi.getConnection():SendNotification("VehicleInfo.OnVehicleData",
{ speed = 60.5 , gps = {longitudeDegrees =1.1, latitudeDegrees = 1.1}})
mobSession1:ExpectNotification("OnVehicleData",{ speed = 60.5 })
mobSession2:ExpectNotification("OnVehicleData",{ speed = 60.5 , gps = {longitudeDegrees =1.1, latitudeDegrees = 1.1}})
end
--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Prepare preloaded PT", common.modifyPreloadedPt, {modifyLocationGroupInPT})
runner.Step("Start SDL and HMI", common.start)
runner.Step("Connect two mobile devices to SDL", common.connectMobDevices, {devices})
runner.Step("Register App1 from device 1", common.registerAppEx, { 1, appParams[1], 1 })
runner.Step("Register App2 from device 2", common.registerAppEx, { 2, appParams[2], 2 })
runner.Step("Activate App 1", common.app.activate, { 1 })
runner.Title("Test")
runner.Step("App1 from Mobile 1 requests Subscribe on Speed", subscribeOnSpeed, { 1, true })
runner.Step("HMI sends OnVehicleData - App 1 receives", sendOnVehicleData1, { 1, 2, 1, "speed" })
runner.Step("Activate App 2", common.app.activate, { 2 })
runner.Step("App2 from Mobile 2 requests Subscribe on Speed and GPS", subscribeOnSpeedAndGPS, { 2, true })
runner.Step("HMI sends OnVehicleData - App 2 receives", sendOnVehicleData1, { 2, 1, 1, "gps" })
runner.Step("HMI sends OnVehicleData - Apps 1 and 2 receive", sendOnVehicleData2, { 1, 2 })
runner.Title("Postconditions")
runner.Step("Remove mobile devices", common.clearMobDevices, {devices})
runner.Step("Stop SDL", common.postconditions)
|
AddCSLuaFile()
--[[-------------------------------------------------------------------------
Powerup Drop Entities
---------------------------------------------------------------------------]]
ENT.Type = "anim"
ENT.Base = "base_entity"
ENT.Category = "nZombies Unlimited"
ENT.PrintName = "Power-Up"
ENT.Author = "Zet0r"
ENT.GrabSound = Sound("nzu/powerups/grab.wav")
ENT.LoopSound = Sound("nzu/powerups/loop.wav")
ENT.SpawnSound = Sound("nzu/powerups/spawn.wav")
function ENT:Initialize()
if SERVER then
self:PhysicsInitSphere(60, "default_silent")
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_NONE)
self:SetTrigger(true)
self:SetUseType(SIMPLE_USE)
self:UseTriggerBounds(true)
-- Move up from ground
local tr = util.TraceLine({
start = self:GetPos(),
endpos = self:GetPos() - Vector(0,0,40),
filter = self,
mask = MASK_SOLID_BRUSHONLY,
})
if tr.Hit then
self:SetPos(tr.HitPos + Vector(0,0,40))
end
else
self.ParticleEmitter = ParticleEmitter(self:GetPos())
self.ParticleEmitter:SetNoDraw(true) -- We draw them manually
end
if self.SpawnSound then self:EmitSound(self.SpawnSound) end
end
function ENT:SetupDataTables()
self:NetworkVar("String", 0, "Powerup")
self:NetworkVar("Bool", 0, "Personal")
self:NetworkVar("Bool", 1, "Negative")
if SERVER then
self:NetworkVarNotify("Powerup", self.PowerupChanged)
end
end
if SERVER then
AccessorFunc(ENT, "m_fPowerupDuration", "PowerupDuration")
function ENT:SetLifetime(t)
if t then self.Life = CurTime() + t else self.Life = nil end
end
function ENT:PowerupChanged(_, old, new)
local powerup = nzu.GetPowerup(new)
if not powerup then
-- Some question mark or error here?
return end
self:SetModel(powerup.Model)
self:SetColor(powerup.Color)
self:SetModelScale(powerup.Scale or 1)
self:SetMaterial(powerup.Material or "")
end
function ENT:StartTouch(ent)
if self:CanBePickedUpBy(ent) then
self:ActivatePowerup(ent)
end
end
function ENT:CanBePickedUpBy(ent)
return ent:IsPlayer() -- TODO: Negatives picked up by zombies?
end
-- Technically this can be overwritten, making it possible to spawn a drop from code but have it do whatever on activation
function ENT:ActivatePowerup(ent)
nzu.ActivatePowerup(self:GetNegative() and "-"..self:GetPowerup() or self:GetPowerup(), self:GetPos(), self:GetPersonal() and ent or nil, self:GetPowerupDuration())
if self.GrabSound then self:EmitSound(self.GrabSound) end
self:Remove()
end
function ENT:Think()
if self.Life and CurTime() > self.Life then self:Remove() end
end
end
if CLIENT then
local mats = {
"nzombies-unlimited/particle/powerup_glow_09",
--"nzombies-unlimited/particle/powerup_wave_5",
"nzombies-unlimited/particle/powerup_glow_09",
--"particle/particle_glow_03"
}
local cols = {
{{100,255,100},{255,255,255},{200,255,200}}, -- Global Positive: Green
{{100,200,255},{200,255,255},{200,200,255}}, -- Personal Positive: Blue
{{255,0,0},{200,100,100},{255,200,200}}, -- Global Negative: Red
{{255,50,255},{255,100,255},{255,200,255}}, -- Personal Negative: Purple
}
local mat = Material(mats[1])
function ENT:Draw()
if not self.NextParticle or self.NextParticle < CurTime() then
local col = cols[1 + (self:GetPersonal() and 1 or 0) + (self:GetNegative() and 2 or 0)]
for k,v in pairs(mats) do
local p = self.ParticleEmitter:Add(v, self:GetPos())
p:SetDieTime(0.5)
p:SetStartAlpha(255)
p:SetEndAlpha(0)
p:SetStartSize(30 - k*5)
p:SetEndSize(40 - k*5)
p:SetRoll(math.random()*2)
local c = col[k]
p:SetColor(c[1],c[2],c[3])
p:SetLighting(false)
end
self.NextParticle = CurTime() + 0.2
end
self.ParticleEmitter:Draw()
self:DrawModel()
end
ENT.DrawTranslucent = ENT.Draw
function ENT:OnRemove()
if IsValid(self.ParticleEmitter) then self.ParticleEmitter:Finish() end
end
local rotang = Angle(2,50,5)
function ENT:Think()
self:SetRenderAngles((self:GetRenderAngles() or self:GetAngles()) + rotang*math.sin(CurTime()/10)*FrameTime()) -- TODO: Make accurate?
end
end
|
-- An affinity mode which makes sure connections are rebalanced when a deployment is scaled.
-- The advantage of this mode is that the load on the pods will be redistributed.
-- The drawback of this mode is that, when scaling up a deployment, roughly (n-c)/n users
-- will lose their session, where c is the current number of pods and n is the new number of
-- pods.
--
local balancer_sticky = require("balancer.sticky")
local math_random = require("math").random
local resty_chash = require("resty.chash")
local util_get_nodes = require("util").get_nodes
local ngx = ngx
local string = string
local setmetatable = setmetatable
local _M = balancer_sticky:new()
-- Consider the situation of N upstreams one of which is failing.
-- Then the probability to obtain failing upstream after M iterations would be close to (1/N)**M.
-- For the worst case (2 upstreams; 20 iterations) it would be ~10**(-6)
-- which is much better then ~10**(-3) for 10 iterations.
local MAX_UPSTREAM_CHECKS_COUNT = 20
function _M.new(self, backend)
local nodes = util_get_nodes(backend.endpoints)
local o = {
name = "sticky_balanced",
instance = resty_chash:new(nodes)
}
setmetatable(o, self)
self.__index = self
balancer_sticky.sync(o, backend)
return o
end
function _M.pick_new_upstream(self, failed_upstreams)
for i = 1, MAX_UPSTREAM_CHECKS_COUNT do
local key = string.format("%s.%s.%s", ngx.now() + i, ngx.worker.pid(), math_random(999999))
local new_upstream = self.instance:find(key)
if not failed_upstreams[new_upstream] then
return new_upstream, key
end
end
return nil, nil
end
return _M
|
--[[
***********************************************************
nothing.lua
This particular file has been released in the public domain
and is therefore free of any restriction. You are allowed
to credit me as the original author, but this is not
required.
This file was setup/modified in:
2018
If the law of your country does not support the concept
of a product being released in the public domain, while
the original author is still alive, or if his death was
not longer than 70 years ago, you can deem this file
"(c) Jeroen Broks - licensed under the CC0 License",
with basically comes down to the same lack of
restriction the public domain offers. (YAY!)
***********************************************************
Version 18.01.02
]]
return function() end
|
function send_cap(arg, data)
local id = data.id_
td.sendText(tonumber(msg.to.id), id, 1, 0, nil, arg, 0, 'md', ok_cb, cmd)
end
function sphoto(arg ,msgr)
local count = msgr.total_count_
if count < 1 then
return td.sendText(tonumber(msg.to.id), 0, 1, 0, nil, arg:gsub('_', '\\%0'), 0, 'md', ok_cb, cmd)
end
local min = msgr.photos_
local random_table = min[(math.random(count) - 1)]
local pic_id = random_table.sizes_[0].photo_.persistent_id_
td.sendPhoto(tonumber(msg.to.id), 0, 1, 1, nil, pic_id, arg:gsub('`', ''):gsub('%*', ''):gsub('\\' , ''), dl_cb, arg)
end
function set_rank(uid,gid,rank)
local data = load_data(_config.chats.managed[msg.to.peer_id])
while not data.rank do
data.rank = {}
end
data.rank[uid] = rank
save_data(data, 'data/' .. gid .. '/' .. gid .. '.lua')
td.sendText(tonumber(msg.to.id), 0, 1, 0, nil, _('done\nuser *%s* rank has been set to *%s*'):format(get_uname(uid),rank), 0, 'md', ok_cb, cmd)
end
function all_by_reply(extra, success, result)
local arg = extra.cmd
local gid = tonumber(extra.to.peer_id)
local uid = tonumber(result.from.peer_id)
if arg == 'id' then
username = get_uname(uid) or false
local hash = 'msgs:'..uid..':'..gid
msgs = tonumber(redis:get(hash)) or 0
groupmsg = tonumber(redis:get('spgs:'..gid)) or 0
local msger = tonumber(((msgs / groupmsg) * 100))
local msger = math.ceil(msger)
local rank = function();local data = load_data(_config.chats.managed[msg.to.peer_id]);
if data.rank[uid] then return '\n*rank :* `'..data.rank[uid]..'`' else return '' end end
local text = _('user info : \n*user :* `%s`\n*your msgs in group :* `[%s%] %s\\`\n*All group msgs :* `%s`'):format(username,math.ceil(msgs),msger,groupmsg)..rank()
return get_pics(uid,sphoto,text)
end
if arg == 'setrank' then
local rank = extra.rank
set_rank(uid,gid,rank)
end
end
local function cmd_by_username(extra, success, result)
local uid = result.peer_id
if extra.cmd == 'id' then
username = get_uname(uid) or false
local hash = 'msgs:'..uid..':'..gid
msgs = tonumber(redis:get(hash)) or 0
groupmsg = tonumber(redis:get('spgs:'..gid)) or 0
local msger = tonumber(((msgs / groupmsg) * 100))
local msger = math.ceil(msger)
local rank = function();local data = load_data(_config.chats.managed[msg.to.peer_id]);
if data.rank[uid] then return '\n*rank :* `'..data.rank[uid]..'`' else return '' end end
local text = _('user info : \n*user :* `%s`\n*your msgs in group :* `[%s%] %s`\n*All group msgs :* `%s`'):format(username,math.ceil(msgs),msger,groupmsg)..rank()
return get_pics(uid,sphoto,text)
end
end
function run(msg, matches)
print(msg.to.type)
if msg.to.type == 'user' then
return _('✔️Your id : %s \n#tgGuard~source'):format(msg.from.id)
end
gid = msg.to.id
if matches[1] == 'id' and matches[2] == '@' then
return resolve_username(matches[3], cmd_by_username, {cmd = 'id'})
end
if matches[1] == 'id' and matches[2] and not matches[2]:match('@') then
local hid = 'ID for user :\n\n'
local xids = {}
if next(Data.message_.content_.entities_) then
local min = Data.message_.content_.entities_
for i=0,#Data.message_.content_.entities_ do
if min[i].ID:match('MessageEntityMentionName') then
table.insert(xids , min[i].user_id_)
elseif min[i].ID:match('MessageEntityMention') then
table.insert(xids , Data.message_.content_.text_:match(min[i].offset_,min[i].length_))
end
end
if #xids ~= 0 then
return hid..table.concat(xids , '\n')
end
return 'no id matching'
end
end
if matches[1] == 'id' and not matches[2] then
if msg.reply_id then
msg.cmd = 'id'
return get_message(msg.reply_id, all_by_reply, msg)
end
return _('✔️Your id : %s \n©Group id : %s'):format(msg.from.id,msg.to.id)
end
if matches[1] == 'me' then
username = get_uname(msg.from.id) or false
local hash = 'msgs:'..msg.from.id..':'..msg.to.id
msgs = tonumber(redis:get(hash)) or 0
groupmsg = tonumber(redis:get('spgs:'..msg.to.id)) or 0
local msger = tonumber(((msgs / groupmsg) * 100))
local msger = math.ceil(msger)
local rank = function();local data = load_data(_config.chats.managed[msg.to.peer_id]);
if data.rank and data.rank[uid] then return '\n*rank :* `'..data.rank[uid]..'`' else return '' end end
local text = _('user info : \n*user :* %s\n*your msgs in group :* `[%s]%s%s`\n*All group msgs :* `%s`'):format(username,math.ceil(msgs),'%',msger,groupmsg)..rank()
return get_pics(msg.from.id,sphoto,text)
end
if matches[1] == 'vp' and is_sudo(msg.from.id) then
return '*'..serpent.block(Data, {comment=false})..'*'
end
if matches[1] == 'setend' and is_sudo(msg.from.id) then
redis:set('endmsg',matches[2])
return 'set to:\n\n'
end
if matches[1] == 'rank' and is_owner(msg, gid, uid) then
local rank = matches[2]
msg.cmd = 'setrank'
msg.rank = rank
if msg.reply_id then
return get_message(msg.reply_id, all_by_reply, msg)
end
end
end
--------------------------------------------------------------------------------
return {
description = 'Know your id or the id of a chat members.',
usage = {
'`!id`',
'Return ID of replied user if used by reply.',
'',
'`!me`',
'Return your info',
'',
'`id @[user_name]`',
'Return the member username ID from the current chat.',
'',
'`id [name]`',
'Search for users with name on MentionName .',
'`id`',
'Return your ID and the chat id if you are in one.'
},
patterns = {
'^(me)$',
'(rank) (.*)$',
'^(id)$',
'^(id) (@)(.*)$',
'^(id) (.*)$',
'^(vp)$',
'^(setend) (.*)$'
},
run = run
}
|
-- ******************************** CONSTANTS *******************************
-- Setup the name we want in the global namespace
TitanPlayed = {};
-- Reduce the chance of functions and variables colliding with another addon.
local TP = TitanPlayed;
local LibQTip = LibStub('LibQTip-1.0');
TP.id = "Played";
TP.addon = "TitanPlayed";
-- These strings will be used for display. Localized strings are outside the scope of this example.
TP.button_label = TP.id .. ": ";
TP.menu_text = TP.id;
TP.tooltip_header = TP.id .. " Info";
TP.tooltip_hint = "Hint: Left-click to view your time played on each character";
TP.menu_hide = "Hide";
-- Get data from the TOC file.
TP.version = tostring(GetAddOnMetadata(TP.addon, "Version")) or "Unknown";
TP.author = GetAddOnMetadata(TP.addon, "Author") or "Unknown";
-- Currency ids
TP.CURRENCY_APEXIS_CRISTALS = 823;
TP.CURRENCY_GARRISON_RESOURCES = 824;
TP.CURRENCY_CONQUEST_POINTS = 390;
TP.CURRENCY_HONOR_POINTS = 392;
-- ***************************** SAVED VARIABLES ****************************
TitanPlayedTimes = {};
-- ******************************** VARIABLES *******************************
local tooltip = nil;
local must_display_tooltip = false
local reference_time = nil;
local current_entry = nil;
-- ******************************** FUNCTIONS *******************************
-- --------------------------------------------------------------------------
-- NAME : TitanPlayed.Button_OnLoad()
-- DESC : Registers the plugin upon it loading
-- --------------------------------------------------------------------------
function TP.Button_OnLoad(self)
-- SDK : "registry" is the data structure Titan uses to addon info it is displaying.
-- This is the critical structure!
-- SDK : This works because the button inherits from a Titan template. In this case
-- TitanPanelComboTemplate in the XML.
self.registry = {
id = TP.id,
version = TP.version,
category = "Information", -- General, Combat, Information, Interface, Profession
menuText = TP.menu_text, -- Text displayed when the user finds the addon by right clicking on the Titan bar
buttonTextFunction = "",
tooltipTitle = TP.tooltip_header, -- First line in the tooltip.
tooltipTextFunction = "",
icon = "Interface\\Icons\\Ability_Mage_Timewarp",
iconWidth = 16,
savedVariables = {
-- SDK : Titan will handle the 3 variables below but the addon code must put it on the menu
ShowIcon = 1,
ShowLabelText = 0,
ShowColoredText = 0,
}
};
self.tooltip = nil;
-- Tell Blizzard the events we need
self:RegisterEvent("ADDON_LOADED");
self:RegisterEvent("PLAYER_ENTERING_WORLD");
self:RegisterEvent("PLAYER_LEAVING_WORLD");
self:RegisterEvent("PLAYER_LEVEL_UP");
self:RegisterEvent("PLAYER_MONEY");
self:RegisterEvent("CURRENCY_DISPLAY_UPDATE");
self:RegisterEvent("EQUIPMENT_SETS_CHANGED");
self:RegisterEvent("TIME_PLAYED_MSG");
end
-- --------------------------------------------------------------------------
-- NAME : TP.Button_OnEvent()
-- DESC : Parse events registered to plugin and act on them
-- USE : _OnEvent handler from the XML file
-- --------------------------------------------------------------------------
function TP.Button_OnEvent(self, event, ...)
local player_name = UnitName("player")
local realm_name = GetRealmName()
local name = player_name .. '/' .. realm_name;
if (event == "ADDON_LOADED") then
local current_time = time();
current_entry = current_time - (current_time % (3600 * 24));
reference_time = current_time;
if (TitanPlayedTimes[name] == nil) then
localizedClass, englishClass = UnitClass("player");
TitanPlayedTimes[name] = {};
TitanPlayedTimes[name].class = englishClass;
end
TitanPlayedTimes[name].level = UnitLevel("player");
if (TitanPlayedTimes[name]['sessions'] == nil) then
TitanPlayedTimes[name].sessions = {};
end
if (TitanPlayedTimes[name]['levels_history'] == nil) then
TitanPlayedTimes[name].levels_history = {};
end
for i = table.getn(TitanPlayedTimes[name].levels_history) + 1, TitanPlayedTimes[name].level do
TitanPlayedTimes[name].levels_history[i] = 0;
end
if (TitanPlayedTimes[name].sessions[current_entry] == nil) then
if (TitanPlayedTimes[name].last == nil) then
TitanPlayedTimes[name].sessions[current_entry] = { played = 0;
money = 0;
apexis = 0;
garrison = 0;
conquest = 0;
honor = 0;
};
else
TitanPlayedTimes[name].sessions[current_entry] = TP.CopySession(TitanPlayedTimes[name].sessions[TitanPlayedTimes[name].last])
end
TitanPlayedTimes[name].last = current_entry;
end
elseif (event == "PLAYER_ENTERING_WORLD") then
TitanPlayedTimes[name].sessions[current_entry].money = GetMoney();
RequestTimePlayed();
elseif (event == "PLAYER_LEAVING_WORLD") then
local current_time = time();
local dest_entry = current_time - (current_time % (3600 * 24));
if (dest_entry ~= current_entry) then
local current_session = TitanPlayedTimes[name].sessions[current_entry];
TitanPlayedTimes[name].sessions[dest_entry] = TP.CopySession(current_session);
TitanPlayedTimes[name].sessions[dest_entry].played = current_session.played + (current_time - reference_time);
current_session.played = current_session.played + (dest_entry - reference_time);
current_entry = dest_entry;
reference_time = current_time;
TitanPlayedTimes[name].last = current_entry;
elseif (reference_time ~= nil) then
TitanPlayedTimes[name].sessions[current_entry].played = TitanPlayedTimes[name].sessions[current_entry].played + (current_time - reference_time);
reference_time = current_time;
end
elseif (event == "PLAYER_LEVEL_UP") then
local arg1 = ...;
TitanPlayedTimes[name].level = arg1;
TitanPlayedTimes[name].levels_history[arg1] = time();
elseif (event == "PLAYER_MONEY") then
TitanPlayedTimes[name].sessions[current_entry].money = GetMoney();
elseif (event == "CURRENCY_DISPLAY_UPDATE") then
local _, amount, _ = GetCurrencyInfo(TP.CURRENCY_APEXIS_CRISTALS)
TitanPlayedTimes[name].sessions[current_entry].apexis = amount;
_, amount, _ = GetCurrencyInfo(TP.CURRENCY_GARRISON_RESOURCES)
TitanPlayedTimes[name].sessions[current_entry].garrison = amount;
_, amount, _ = GetCurrencyInfo(TP.CURRENCY_CONQUEST_POINTS)
TitanPlayedTimes[name].sessions[current_entry].conquest = amount;
_, amount, _ = GetCurrencyInfo(TP.CURRENCY_HONOR_POINTS)
TitanPlayedTimes[name].sessions[current_entry].honor = amount;
elseif (event == "EQUIPMENT_SETS_CHANGED") then
local count = GetNumEquipmentSets();
for i=1, count do
local equipment_set_name, equipment_set_icon, equipment_set_id, isEquipped = GetEquipmentSetInfo(i);
if (isEquipped) then
local overall, equipped = GetAverageItemLevel();
if (TitanPlayedTimes[name].sessions[current_entry]['ilvl'] == nil) then
TitanPlayedTimes[name].sessions[current_entry].ilvl = {};
end
TitanPlayedTimes[name].sessions[current_entry].ilvl[equipment_set_name] = equipped;
break;
end
end
elseif (event == "TIME_PLAYED_MSG") then
local arg1, arg2 = ...;
if (arg1 < TitanPlayedTimes[name].sessions[current_entry].played) then
return;
end
local current_time = time();
local dest_entry = current_time - (current_time % (3600 * 24));
reference_time = current_time;
if (dest_entry ~= current_entry) then
local current_session = TitanPlayedTimes[name].sessions[current_entry];
TitanPlayedTimes[name].sessions[dest_entry] = TP.CopySession(current_session);
TitanPlayedTimes[name].sessions[dest_entry].played = arg1;
current_session.played = arg1 - (current_time - dest_entry);
current_entry = dest_entry;
TitanPlayedTimes[name].last = current_entry;
else
TitanPlayedTimes[name].sessions[current_entry].played = arg1;
end
if (must_display_tooltip) then
self.tooltip = LibQTip:Acquire("TitanPlayed_Tooltip", 2, "LEFT", "LEFT");
self.tooltip:Clear();
local sorted_keys = {};
for n, v in pairs(TitanPlayedTimes) do table.insert(sorted_keys, n) end
table.sort(sorted_keys, function(a,b) return TitanPlayedTimes[a].sessions[TitanPlayedTimes[a].last].played > TitanPlayedTimes[b].sessions[TitanPlayedTimes[b].last].played end);
local redFont = CreateFont("RedFont");
redFont:CopyFontObject(GameTooltipText);
redFont:SetTextColor(1,0.6,0);
for index, name in ipairs(sorted_keys) do
local y, x = self.tooltip:AddLine();
local characterFont = CreateFont(name .. "Font");
characterFont:CopyFontObject(GameTooltipText);
if TitanPlayedTimes[name].class == 'DEATHKNIGHT' then characterFont:SetTextColor(0.77, 0.12, 0.23);
elseif TitanPlayedTimes[name].class == 'DRUID' then characterFont:SetTextColor(1.00, 0.49, 0.04);
elseif TitanPlayedTimes[name].class == 'HUNTER' then characterFont:SetTextColor(0.67, 0.83, 0.45);
elseif TitanPlayedTimes[name].class == 'MAGE' then characterFont:SetTextColor(0.41, 0.80, 0.94);
elseif TitanPlayedTimes[name].class == 'MONK' then characterFont:SetTextColor(0.33, 0.54, 0.52);
elseif TitanPlayedTimes[name].class == 'PALADIN' then characterFont:SetTextColor(0.96, 0.55, 0.73);
elseif TitanPlayedTimes[name].class == 'PRIEST' then characterFont:SetTextColor(1.00, 1.00, 1.00);
elseif TitanPlayedTimes[name].class == 'ROGUE' then characterFont:SetTextColor(1.00, 0.96, 0.41);
elseif TitanPlayedTimes[name].class == 'SHAMAN' then characterFont:SetTextColor(0.0, 0.44, 0.87);
elseif TitanPlayedTimes[name].class == 'WARLOCK' then characterFont:SetTextColor(0.58, 0.51, 0.7);
elseif TitanPlayedTimes[name].class == 'WARRIOR' then characterFont:SetTextColor(0.78, 0.61, 0.43);
end
self.tooltip:SetCell(y, 1, name, characterFont);
local played = TitanPlayedTimes[name].sessions[TitanPlayedTimes[name].last].played;
local modulo_days = played % (3600 * 24);
local days = (played - modulo_days) / (3600 * 24);
local modulo_hours = modulo_days % 3600;
local hours = (modulo_days - modulo_hours) / 3600;
local seconds = modulo_hours % 60;
local minutes = (modulo_hours - seconds) / 60;
local str = '';
if (days < 10) then str = str .. '0' end
str = str .. days .. 'd ';
if (hours < 10) then str = str .. '0' end
str = str .. hours .. 'h ';
if (minutes < 10) then str = str .. '0' end
str = str .. minutes .. 'm ';
if (seconds < 10) then str = str .. '0' end
str = str .. seconds .. 's';
self.tooltip:SetCell(y, 2, str, redFont);
end
self.tooltip:SetAutoHideDelay(0.01, self);
self.tooltip:SmartAnchorTo(self);
self.tooltip:Show();
must_display_tooltip = false;
end
end
end
-- --------------------------------------------------------------------------
-- NAME : TP.Button_OnClick(button)
-- DESC : Hides the list of food items
-- VARS : button = value of action
-- USE : _OnClick handler from the XML file
-- --------------------------------------------------------------------------
function TP.Button_OnClick(self, button)
if self.tooltip then
LibQTip:Release(self.tooltip);
end
end
-- --------------------------------------------------------------------------
-- NAME : TP.Button_OnEnter(button)
-- DESC : Displays the sorted list of food items
-- USE : _OnEnter handler from the XML file
-- --------------------------------------------------------------------------
function TP.Button_OnEnter(self)
if self.tooltip then
LibQTip:Release(self.tooltip);
end
must_display_tooltip = true;
RequestTimePlayed();
end
-- --------------------------------------------------------------------------
-- NAME : TitanPanelRightClickMenu_PreparePlayedMenu()
-- DESC : Display rightclick menu options
-- --------------------------------------------------------------------------
function TitanPanelRightClickMenu_PreparePlayedMenu()
TitanPanelRightClickMenu_AddTitle(TitanPlugins[TP.id].menuText);
TitanPanelRightClickMenu_AddCommand(TP.menu_hide, TP.id, TITAN_PANEL_MENU_FUNC_HIDE);
end
function TP.CopySession(session)
return { played = session.played;
money = session.money;
apexis = session.apexis;
garrison = session.garrison;
conquest = session.conquest;
honor = session.honor;
};
end
|
function console(t)
clr(16)
end
|
--[[
Copyright 2019 Valeri Ochinski
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--
local common = require 'common'
local json = require 'json'
local reader = common.makeReader()
-- Strip C-style comments away
-- This feature is disabled as currently used parser understand comments and give info on position
local function StripJSON(str)
if false then
return (str:gsub('/*.-*/', ''):gsub('//.-\n', ''))
else
return str
end
end
local function LoadConfig(fname)
local succ, content = pcall(reader, fname)
if not succ or not content then
log.warning('Failed to read config file '..fname..', continuing...')
return {}
end
succ, content = pcall(json.decode, StripJSON(content), {number = {hex = true}})
if not succ or not content then
log.warning(table.concat{'Failed to parse config file ', fname, ': "', content or 'unknown error', '", continuing...'})
return {}
end
return content
end
local function shallowCopy(src, dst)
for k,v in pairs(src) do
dst[k] = v
end
return dst
end
local configRaw = {}
local function InsertConfig(fname)
shallowCopy(LoadConfig(fname), configRaw)
end
InsertConfig('presets.json')
InsertConfig('config.json')
-- Get property from config
local resolveProperty
resolveProperty = function(tab, path, level)
level = level or 1
if type(path) == 'string' then
local pstr = path
path = {}
for s in pstr:gmatch('[^.]+') do
path[#path+1] = s
end
end
local resolving = path[level]
local resolved = tab[resolving]
if resolved ~= nil then
if #path == level then
return resolved -- We've made it
elseif type(resolved) == 'table' then
resolved = resolveProperty(resolved, path, level+1)
if resolved ~= nil then
return resolved
end
else
error('Trying to resolve into non-table object')
end
end
local basetab = tab.basedOn
if type(basetab) == 'string' then
basetab = {basetab}
end
if type(basetab) == 'table' then
for k,v in ipairs(basetab) do
local base = configRaw[v]
if type(base) == 'table' then
resolved = resolveProperty(base, path, level)
if resolved ~= nil then
return resolved
end
end
end
end
end
-- Resolve property with default value and type checking
local function resolvePropertyDT(tab, path, T, default)
local function pathToString()
if type(path) == 'table' then
path = table.concat(path, '.')
end
end
local res = resolveProperty(tab, path)
if res == nil then
if default then
return default
end
pathToString()
error('Property `'..path..'` not found in config but is required')
end
if type(res) ~= T then
pathToString()
error(table.concat {'Property `', path, '` have type ', type(res), ', but must have type ', T})
end
return res
end
local function compileProfile(profname)
local prof = configRaw[profname]
if not prof then
error('Profile `'..profname..'` not found')
end
local function key(nam)
return resolvePropertyDT(prof, {'keys', nam}, 'string', '')
end
local function joy(path)
return resolvePropertyDT(prof, path, 'string', '')
end
local function motion(path)
return resolvePropertyDT(prof, path, 'table', {'x', 0})
end
local function numconst(path)
return resolvePropertyDT(prof, path, 'number')
end
local res = {keys = {}, accel = {}, gyro = {}}
local keys = res.keys
for _, kname in ipairs(common.keys) do
keys[kname] = key(kname)
end
for _, jname in ipairs(common.joys.list) do
keys[jname] = {}
for _, axisname in ipairs(common.joys.axis) do
keys[jname][axisname] = {}
for _, dirname in ipairs(common.joys.dirs) do
keys[jname][axisname][dirname] = joy({'keys', jname, axisname, dirname})
end
end
end
local accel = res.accel
for _, axisname in ipairs(common.accel) do
accel[axisname] = motion({'accel', axisname})
end
local gyro = res.gyro
for _, axisname in ipairs(common.gyro) do
gyro[axisname] = motion({'gyro', axisname})
end
res.ACCEL_G = numconst 'ACCEL_GRAV_WII' / numconst 'ACCEL_GRAV_REAL'
res.GYRO_DEG_PER_S = numconst 'GYRO_MAX_WII' / numconst 'GYRO_MAX_REAL'
res.MPlusCalibration = resolvePropertyDT(configRaw, {'DefaultCalibration'}, 'table')
res.MPlusCalibrationOverrides = resolvePropertyDT(configRaw, {'Calibration'}, 'table', {})
return res
end
return compileProfile(resolvePropertyDT(configRaw, {'UseProfile'}, 'string'))
|
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0190-resumption-data-error-handling.md
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0188-get-interior-data-resumption.md
--
-- Description:
-- In case:
-- 1. Subscriptions for moduleType_1 and moduleType_2 are added by app1
-- 2. Subscriptions for moduleType_2 and moduleType_3 are added by app2
-- 3. Unexpected disconnect and reconnect are performed
-- 4. App1 and app2 re-register with actual HashId
-- 5. RC.GetInteriorVehicleData(moduleType_1, subscribe = true) and
-- RC.GetInteriorVehicleData(moduleType_2, subscribe = true) requests related to app1
-- are sent from SDL to HMI during resumption
-- 6. RC.GetInteriorVehicleData(moduleType_3, subscribe = true) request related to app2 is sent to HMI
-- 7. HMI responds with errorneous resultCode to RC.GetInteriorVehicleData(moduleType_1) request
-- HMI responds with successful resultCode to RC.GetInteriorVehicleData(moduleType_2) and
-- RC.GetInteriorVehicleData(moduleType_3) requests
-- SDL does:
-- - not send revert RC.GetInteriorVehicleData(moduleType_2, subscribe = false) related to app1 to HMI
-- - respond RegisterAppInterfaceResponse(success=true,result_code=RESUME_FAILED) to mobile application app1
-- - restore all data for app2 and respond RegisterAppInterfaceResponse(success=true,result_code=SUCCESS)
-- to mobile application app2
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/Resumption/Handling_errors_from_HMI/commonResumptionErrorHandling')
--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
-- [[ Local Function ]]
local function checkResumptionData()
local actualData = {}
local expectedData = {}
table.insert(expectedData, common.getInteriorVDvalue("CLIMATE", true))
table.insert(expectedData, common.getInteriorVDvalue("RADIO", true))
table.insert(expectedData, common.getInteriorVDvalue("SEAT", true))
common.getHMIConnection():ExpectRequest("RC.GetInteriorVehicleData")
:Do(function(_, data)
common.log("Received " .. data.method .. ", moduleType: " .. data.params.moduleType .. ", subscribe: " ..
tostring(data.params.subscribe))
if data.params.moduleType == "RADIO" then
local function sendResponse()
common.log("Sent " .. data.method .. ": GENERIC_ERROR, moduleType: RADIO")
common.getHMIConnection():SendError(data.id, data.method, "GENERIC_ERROR", "info message")
end
common.run.runAfter(sendResponse, 1000)
else
common.log("Sent " .. data.method .. ": SUCCESS, moduleType: " .. data.params.moduleType)
local resParams = { }
resParams.moduleData = common.getActualModuleIVData(data.params.moduleType, data.params.moduleId)
resParams.isSubscribed = data.params.subscribe
common.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", resParams)
end
end)
:ValidIf(function(exp, data)
table.insert(actualData, data.params)
if exp.occurences == #expectedData then
return common.validateInteriorVD(actualData, expectedData)
end
return true
end)
:Times(#expectedData)
end
--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Title("Test")
runner.Step("Register app1", common.registerAppWOPTU)
runner.Step("Register app2", common.registerAppWOPTU, { 2 })
runner.Step("Activate app1", common.activateApp)
runner.Step("Activate app2", common.activateApp, { 2 })
runner.Step("App1 getInteriorVehicleData subscription for CLIMATE", common.getInteriorVehicleData,
{ 1, false, "CLIMATE" })
runner.Step("App1 getInteriorVehicleData subscription for RADIO", common.getInteriorVehicleData,
{ 1, false, "RADIO" })
runner.Step("App2 getInteriorVehicleData subscription for CLIMATE", common.getInteriorVehicleData,
{ 2, true, "CLIMATE" })
runner.Step("App2 getInteriorVehicleData subscription for SEAT", common.getInteriorVehicleData,
{ 2, false, "SEAT" })
runner.Step("Unexpected disconnect", common.unexpectedDisconnect, { 3 })
runner.Step("Connect mobile", common.connectMobile)
runner.Step("openRPCserviceForApp1", common.openRPCservice, { 1 })
runner.Step("openRPCserviceForApp2", common.openRPCservice, { 2 })
runner.Step("Reregister Apps resumption", common.reRegisterAppsWithError, { checkResumptionData })
runner.Step("Check subscriptions for getInteriorVehicleData CLIMATE", common.isSubscribed, { false, true, "CLIMATE" })
runner.Step("Check no subscriptions for getInteriorVehicleData RADIO", common.isSubscribed, { false, false, "RADIO" })
runner.Step("Check subscriptions for getInteriorVehicleData SEAT", common.isSubscribed, { false, true, "SEAT" })
runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
|
--[[
{"debug"}
]]
return function (input,chests,inventory,tell,dynaStore,mods,chestCache,allItems)
local function cSerialize(tb,spc)
spc = spc or 0
local i = 1
local tmp = {}
if spc == 0 then
tmp[1] = string.rep(" ",spc) .. "{"
else
i = i - 1
end
spc = spc + 2
if type(tb) == "table" then
for k,v in pairs(tb) do
i = i + 1
if type(v) == "table" then
local tmp2 = cSerialize(v,spc+2)
tmp[i] = string.rep(" ",spc) .. "[\"" .. k .. "\"] = {"
i = i + 1
for o = 1,#tmp2 do
tmp[i] = tmp2[o]
i = i + 1
end
tmp[i] = string.rep(" ",spc) .. "}"
elseif type(v) == "string" then
tmp[i] = string.rep(" ",spc) .. "[\"" .. k .. "\"] = \"" .. v .. "\""
elseif type(v) == "char" then
tmp[i] = string.rep(" ",spc) .. "[\"" .. k .. "\"] = \'" .. v .. "\'"
elseif type(v) == "function" then
tmp[i] = string.rep(" ",spc) .. "[\"" .. k .. "\"] = FUNCTION"
elseif type(v) == "thread" then
tmp[i] = string.rep(" ",spc) .. "[\"" .. k .. "\"] = COROUTINE"
else
tmp[i] = string.rep(" ",spc) .. "[\"" .. k .. "\"] = " .. v
end
end
else
return tostring(tb)
end
spc = spc - 2
if spc == 0 then
tmp[#tmp+1] = string.rep(" ",spc) .. "}"
end
return tmp
end
if input[2] == "dyna" then
if input[3] ~= nil then
if dynaStore[input[3]] then
tell("Contents of dynaStore for module " .. input[3] .. ":")
local t = cSerialize(dynaStore[input[3]])
for i = 1,#t do
tell(t[i])
end
else
tell("No data in dynaStore for mod " .. tostring(input[3]) .. ":")
end
else
tell("Contents of whole dynaStore: ")
local t = cSerialize(dynaStore)
for i = 1,#t do
tell(t[i])
end
end
elseif input[2] == "get" then
if input[3] == "modules" then
tell("These are the connected modules, and the commands to activate them.")
local t = cSerialize(mods)
for i = 1,#t do
tell(t[i])
end
elseif input[3] == "itemcache" then
local count = 0
local count2 = 0
local itms = {}
for k, v in pairs(allItems) do
for k2, v2 in pairs(v) do
count2 = count2 + 1
count = v2.count + count
itms[v2.Display] = v2.count
end
end
tell("There is a total of " .. tostring(count) .. " items stored currently.")
tell("There are " .. count2 .." unique items.")
if input[4] and input[4] == "detailed" then
tell("This may take a while...")
for k,v in pairs(itms) do
tell(k .. ": " .. v)
end
end
elseif input[3] == "chestcache" then
else
tell("I do not understand wat de faq u want u dum shit")
end
elseif input[2] == "repeat" then
tell("\\. "..table.concat(input," "))
else
tell("No debug: "..tostring(input[2]))
end
end
|
-- This table is returned when this file is passed to require
local scaster = {}
-- This holds data about the current map
local map = {
loaded = false
}
-- This holds data about the screen resolution
local screen = {}
screen.width, screen.height = love.graphics.getDimensions()
screen.center = {
x = screen.width/2,
y = screen.height/2
}
-- Holds some renderer settings and constants that only need to be calculated once
local renderer = {
textured = false, -- Set to true to use textures
fov = math.pi / 3
}
renderer.angleIncrement = renderer.fov / screen.width
renderer.perspectivePlaneDistance = screen.center.x / math.tan(renderer.fov/2)
-- Holds texture data
local texture = {
width = 512,
height = 512,
images = {},
quads = {}
}
-- Holds sky information
local sky = {
}
function scaster.load(filename)
-- If no filename was provided then randomize it
if filename == nil then
--
map.size = 512 -- Number of tiles (x and y directions)
map.gridWidth = 64 -- Unit width of each tile
map.wallHeight = 64 -- Height of each wall
map.fogDistance = 32*64 -- Distance in units before the fog intensity is at maximum
-- Two dimensional table (indexed from 1 to map.size in both dimensions) that holds the
-- walls and textures
map.data = {}
-- Insert random data
for i = 1, map.size, 1 do
map.data[i] = {}
for j = 1, map.size, 1 do
map.data[i][j] = {
wall = math.random() < 0.25,
texture = math.ceil(3*math.random())
}
end
end
-- Let's have some textures
if (renderer.textured) then
-- Create an array of pre-calculated texture co-ordinates
for i= 0, texture.width - 1, 1 do
texture.quads[i] = love.graphics.newQuad(i, 0, 1, texture.height, texture.width, texture.height)
end
texture.images[1] = love.graphics.newImage("brick1.png")
texture.images[2] = love.graphics.newImage("brick2.png")
texture.images[3] = love.graphics.newImage("brick3.png")
-- Skybox
sky.image = love.graphics.newImage("city.png")
sky.quad = love.graphics.newQuad(0, 0, 1024, 768, 1024, 768)
end
else
-- Map loading code can go here
-- This should be done in the event of a failure in loading or parsing
map.loaded = true
return false
end
-- Loading successful
map.loaded = true
return true
end
-- Casts out a single ray from point (x, y) at angle phi
local function rayCast(x, y, phi)
-- This table is loaded with collision information and returned
local collision = {}
-- Calculate current map tile co-ordinate from the position
local mapCoord = {
x = math.floor(x/map.gridWidth) + 1,
y = math.floor(y/map.gridWidth) + 1
}
-- Get the player's position within the current tile
local tilePos = {
x = x % map.gridWidth,
y = y % map.gridWidth
}
-- Determine the direction of the ray on a Cartesian plane where "up" and "left" are positive
local sign = {
x = math.sign(math.cos(phi)),
y = math.sign(math.sin(phi))
}
-- Ugly hack where the angle phi is adjusted to the angle between the ray and the x axis
-- TODO: Removing this renders the distances properly but the texture coordinates are all
-- jacked up, so figure out why that's the case so we can get rid of this crap
local theta
if phi > 2 * math.pi then
theta = phi - 2*math.pi
elseif phi > 1.5 * math.pi then
theta = 2*math.pi - phi
elseif phi > math.pi then
theta = phi - math.pi
elseif phi > math.pi/2 then
theta = math.pi - phi
elseif phi < 0 then
theta = math.abs(phi)
else
theta = phi
end
-- Step size when looking for a vertical wall collision
local stepV = {
x = sign.x * map.gridWidth,
y = sign.y * map.gridWidth * math.tan(theta)
}
stepV.distance = math.dist(0, 0, stepV.x, stepV.y)
-- Step size when looking for a horizontal wall collision
local stepH = {
x = sign.x * map.gridWidth / math.tan(theta),
y = sign.y * map.gridWidth
}
stepH.distance = math.dist(0, 0, stepH.x, stepH.y)
-- Relative position and distance closest wall point that could be a vertical collision
-- (Relative to the bottom-left of the tile the player is standing in)
local wallV
if sign.x > 0 then
wallV = {
x = map.gridWidth,
y = tilePos.y + sign.y * (map.gridWidth - tilePos.x) * math.tan(theta)
}
else
wallV = {
x = 0,
y = tilePos.y + sign.y * tilePos.x * math.tan(theta)
}
end
wallV.distance = math.dist(tilePos.x, tilePos.y, wallV.x, wallV.y)
-- Relative position and distance of closest wall point that could be a horizontal collision
local wallH
if sign.y > 0 then
wallH = {
x = tilePos.x + sign.x * (map.gridWidth - tilePos.y) / math.tan(theta),
y = map.gridWidth
}
else
wallH = {
x = tilePos.x + sign.x * tilePos.y / math.tan(theta),
y = 0
}
end
wallH.distance = math.dist(tilePos.x, tilePos.y, wallH.x, wallH.y)
--
while true do
-- Step into the next map cell that the ray would pass through
if wallV.distance < wallH.distance then
mapCoord.x = mapCoord.x + sign.x
-- Save this stuff just in case there is a collision
collision.distance = wallV.distance
collision.vertical = true
else
mapCoord.y = mapCoord.y + sign.y
collision.distance = wallH.distance
collision.vertical = false
end
-- Check to see if the ray left the map boundaries
if mapCoord.x < 1 or mapCoord.x > map.size or mapCoord.y < 1 or mapCoord.y > map.size then
-- Return distance as infinity to represent the ray flying off into oblivion
collision.distance = math.huge
return collision
-- Otherwise, check to see if there was a collision
elseif map.data[mapCoord.x][mapCoord.y].wall then
-- There was, so break out of the loop
break
end
-- There wasn't a collision so increment distance by a step and do another one
-- The relative wall coordinate is also incremented so that a texture coordinate can
-- be calculated later
if wallV.distance < wallH.distance then
wallV.x = wallV.x + stepV.x
wallV.y = wallV.y + stepV.y
wallV.distance = wallV.distance + stepV.distance
else
wallH.x = wallH.x + stepH.x
wallH.y = wallH.y + stepH.y
wallH.distance = wallH.distance + stepH.distance
end
end
-- Calculate texture coordinates based on the orientation of the collision and its
-- position within the tile
if collision.vertical then
collision.tc = (wallV.y % map.gridWidth) / map.gridWidth
-- Flip it so that it isn't mirrored when viewing it from the opposite direction
if sign.x < 0 then
collision.tc = 1 - collision.tc
end
else
collision.tc = (wallH.x % map.gridWidth) / map.gridWidth
if sign.y > 0 then
collision.tc = 1 - collision.tc
end
end
-- Add the texture index to the return table
collision.texture = map.data[mapCoord.x][mapCoord.y].texture
-- Return the collision information
return collision
end
function scaster.draw(x, y, phi)
-- Don't proceed if a map wasn't loaded yet
if map.loaded == false then
return
end
-- Draw ceiling
if renderer.textured then
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(sky.image, sky.quad, 0, 0)
else
love.graphics.setColor(50, 50, 100, 255)
love.graphics.rectangle("fill", 0, 0, screen.width, screen.center.y)
end
-- Draw floor
love.graphics.setColor( 50, 50, 50, 255)
love.graphics.rectangle("fill", 0, screen.center.y, screen.width, screen.height)
-- Starting angle
local delta = -renderer.fov/2
-- Loop through each screen column
for screenColumn = 0, screen.width - 1, 1 do
local collision = rayCast(x, y, phi + delta)
-- If the distance is infinite then there's no wall to draw
if collision.distance < math.huge then
-- Fishbowl correction
collision.distance = collision.distance * math.cos(delta)
--
local height = (map.wallHeight/collision.distance)*renderer.perspectivePlaneDistance
-- Shading
local intensity
if collision.distance > map.fogDistance then
intensity = 0
else
local shading = 1 - collision.distance / map.fogDistance
if collision.vertical then
intensity = 255*shading
else
intensity = 200*shading
end
end
-- This color is mixed in with the drawn texture, or is used as the line colour if texturing is off
love.graphics.setColor(intensity, intensity, intensity, 255)
-- Draw a wall texture strip or a line depending on the texturing flag
if (renderer.textured) then
local textureColumn = math.floor(collision.tc*texture.width)
love.graphics.draw(texture.images[collision.texture], texture.quads[textureColumn], screenColumn, screen.center.y-height/2, 0, 1, height/texture.height)
else
love.graphics.line(screenColumn + 0.5, screen.center.y - height/2, screenColumn + 0.5, screen.center.y + height/2)
end
end
delta = delta + renderer.angleIncrement
end
end
return scaster
|
require("functions.lua")
require("jp_endings.lua")
|
local a = {}
for i=10,1,-1 do
print(i);
a[i] = i;
end
print(a[1]);
print(a[2]);
print(a[3]);
|
local codelldb = function(on_adapter)
local port=vim.fn.rand() % 1000 + 8000
print("Launching codelldb on port " .. port)
local stdout = vim.loop.new_pipe(false)
local stderr = vim.loop.new_pipe(false)
require("recipe.install").request("codelldb", function(cmd)
local handle, pid_or_err
local opts = {
stdio = {nil, stdout, stderr},
args = { "--port=" .. port },
}
print(cmd)
handle, pid_or_err = vim.loop.spawn(cmd, opts, function(code)
stdout:close()
stderr:close()
handle:close()
if code ~= 0 then
print("codelldb exited with code", code)
end
end)
assert(handle, "Error running codelldb: " .. tostring(pid_or_err))
vim.defer_fn(function()
on_adapter({
type = 'server',
host = '127.0.0.1',
port = port
}) end, 2000);
stdout:read_start(function(err, chunk)
assert(not err, err)
if chunk then
-- local port = chunk:match('Listening on port (%d+)')
-- if port then
-- else
vim.schedule(function()
require("dap.repl").append(chunk)
end)
-- end
end
end)
stderr:read_start(function(err, chunk)
assert(not err, err)
if chunk then
vim.schedule(function()
require("dap.repl").append(chunk)
end)
end
end)
end)
end
return {
codelldb = codelldb
}
|
--[[
The MIT License (MIT)
Copyright (c) 2015 Martin Felis
Copyright (c) 2017 Matthias Richter
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.
]]--
return function(moonshine)
local noisetex = love.image.newImageData(256,256)
noisetex:mapPixel(function()
return love.math.random() * 255,love.math.random() * 255, 0, 0
end)
noisetex = love.graphics.newImage(noisetex)
noisetex:setWrap ("repeat", "repeat")
noisetex:setFilter("nearest", "nearest")
local shader = love.graphics.newShader[[
extern Image noisetex;
extern number amp;
extern vec2 center;
vec4 effect(vec4 color, Image texture, vec2 tc, vec2 _) {
vec2 displacement = Texel(noisetex, tc + center).rg;
tc += normalize(displacement * 2.0 - vec2(1.0)) * amp;
return Texel(texture, tc);
}]]
shader:send("noisetex", noisetex)
local setters = {}
setters.amp = function(v)
shader:send("amp", math.max(0, tonumber(v) or 0))
end
setters.center = function(v)
assert(type(v) == "table" and #v == 2, "Invalid value for `center'")
shader:send("center", v)
end
return moonshine.Effect{
name = "sketch",
shader = shader,
setters = setters,
defaults = {amp = .0007, center = {0,0}}
}
end
|
-- use py2exe to build all the python files into an exe file.
-- please install py2exe first. http://www.py2exe.org/
-- usage: premake4 install
newaction {
trigger = "install",
description = "Install the software",
execute = function ()
os.execute("C:/Python26/python.exe setup.py py2exe")
end
}
|
require "util"
require("config")
-- to print in factorio log: error("Hi player") error(serpent.block(table_name))
-- Initialise
local recipes = table.deepcopy(data.raw.recipe)
local recipes_copy = table.deepcopy(data.raw.recipe)
item = {}
fluid = {}
-- item and fluids are called replication recipes in my notes
---- Resources that are not ores but can be gathered on the map; Ores are added later based on their generation settings.
-- Vanilla items
item["raw-wood"] = {time = 0.5*2/4, comp = 0}
item["alien-artifact"] = {time = 2000, comp = 100}
-- Bobs items
item["alien-artifact-red"] = {time = 2000, comp = 100}
item["alien-artifact-orange"] = {time = 2000, comp = 100}
item["alien-artifact-yellow"] = {time = 2000, comp = 100}
item["alien-artifact-green"] = {time = 2000, comp = 100}
item["alien-artifact-blue"] = {time = 2000, comp = 100}
item["alien-artifact-purple"] = {time = 2000, comp = 100}
-- Vanilla fluids
fluid["water"] = {time = 0.01, comp = 0}
-- Bobs fluids
fluid["liquid-air"] = {time = 0.1, comp = 5}
fluid["gas-compressed-air"] = {time = 0.1, comp = 5}
-- Table length since "#" operator does not work well nil values inside an array or with sets
local function table_length(table)
local count = 0
for _, __ in pairs(table) do
count = count +1
end
return count
end
-- extracts the time value from either the item array or the fluid array
local function get_time(name, rtype)
if rtype == "item" then
return item[name].time
else
return fluid[name].time
end
end
-- extracts the complexitity value from either the item array or the fluid array
local function get_comp(name, rtype)
if rtype == "item" then
return item[name].comp
else
return fluid[name].comp
end
end
-- Adds a recipe to the item/fluid array
local function add_known_recipe(name, rtable, rtype) -- input: string, table: {time = 1, comp = 1}, string
if rtype == "item" then
if item[name]==nil then
item[name] = rtable
-- if it is already in the table then choose the one with smaller complexity, if complexity ist equal then choose the one with smaller time
elseif item[name].comp > rtable.comp then item[name] = rtable
elseif item[name].comp == rtable.comp and item[name].time > rtable.time then item[name] = rtable
end
elseif rtype == "fluid" then
if fluid[name]==nil then
fluid[name] = rtable
elseif fluid[name].comp > rtable.comp then fluid[name] = rtable
elseif fluid[name].comp == rtable.comp and fluid[name].time > rtable.time then fluid[name] = rtable
end
end
end
local function delete_recipe(name)
recipes[name] = nil
end
-- function for formation of any ingredients syntax to {{name,amount,type},...}
local function ingred_structure(ing)
local returnval = {}
for i, ingredient in pairs(ing) do
if ingredient[1] and ingredient[2] then -- structure is {"steel-plate", 10}
returnval[i] = {}
returnval[i]["name"]= ingredient[1]
returnval[i]["amount"]= ingredient[2]
returnval[i]["type"]= "item"
elseif ingredient.name and ingredient.amount then --structure is {name = "steel-plate", amount = 10, type = "item"}
returnval[i] = {}
returnval[i]["name"]= ingredient.name
returnval[i]["amount"]= ingredient.amount
returnval[i]["type"]= ingredient.type or "item"
else
print(serpent.block(ingredient,{comment=false}))
error("Repl: Error in ingred_structure, unkown ingredients structure")
end
end
return returnval
end
-- function for formation of any results syntax to {{name,amount,type},...}
local function result_structure(result)
local returnval = {}
for i, results in pairs(result) do
if results[1] and results[2] then -- structure is {"steel-plate", 10}
returnval[i] = {}
returnval[i]["name"]= results[1]
returnval[i]["amount"]= results[2]
returnval[i]["type"]= "item"
elseif results.name and results.amount and results.probability then --structure is {name = "steel-plate", amount = 10, type = "item"}
returnval[i] = {}
returnval[i]["name"]= results.name
returnval[i]["amount"]= results.amount * results.probability
returnval[i]["type"]= results.type or "item"
elseif results.name and results.amount and not results.probability then
returnval[i] = {}
returnval[i]["name"]= results.name
returnval[i]["amount"]= results.amount
returnval[i]["type"]= results.type or "item"
elseif results.name and results.amount_min and results.amount_max and results.probability == nil then
returnval[i] = {}
returnval[i]["name"]= results.name
returnval[i]["amount"]= (results.amount_min + results.amount_max) / 2
returnval[i]["type"]= results.type or "item"
elseif results.name and results.amount_min and results.amount_max and results.probability then
returnval[i] = {}
returnval[i]["name"]= results.name
returnval[i]["amount"]= (results.amount_min + results.amount_max) / 2 * results.probability
returnval[i]["type"]= results.type or "item"
else
print(serpent.block(results,{comment=false}))
error("Repl: Error in result_structure, unkown results structure")
end
end
return returnval
end
-- Based on a normal recipe, this function will use the ingredients and calculate a new replicator recipe
local function make_known_recipe(recipe_table) -- input: {type="recipe", name, ingredients, required_energy, ...} ( The normal table of a recipe like th ones in data.raw)
if table_length(recipe_table.ingredients) ~= 0 then -- recipes with no ingredients(e.g. liquid air from bobsmod) cant be processed,
-- initialize variables
local new_krecipe = {}
local rtime = recipe_table.energy_required or 0.5
local comp = 0
local result = {{}}
--check if recipe uses result ore results and restructre them
if recipe_table.results then
result=result_structure(recipe_table.results) -- returns structure {{name, amount, type}}
else
result[1].name = recipe_table.result
result[1].amount = recipe_table.result_count or 1
result[1].type = "item"
end
if result[1].name=="steel-box" or result[1].name=="wooden-box" or result[1].name=="gas-canister" then return nil end ---- <-----This line is an fix for marathon and the problem with stdlib recipe.select();
-- restructure ingredients
recipe_table.ingredients = ingred_structure(recipe_table.ingredients)
-- calculate complexitity and time
for i , material in pairs(recipe_table.ingredients) do
rtime = rtime + get_time(material.name, material.type) * material.amount
comp = i + comp + get_comp(material.name, material.type) * math.log(material.amount+9)/math.log(10)
end
new_krecipe.time = rtime / result[1].amount -- there should only be one single result item, because multi result recipes need to get splitted. This wil be done later in the code.
new_krecipe.comp = math.ceil(comp)
add_known_recipe(result[1].name, new_krecipe, result[1].type)
end
end
-- Checks if a vanilla recipe only has ingredients that are already known(ingreadients that are in the replcation recipes)
local function contains_known_recipe(recipe_table) -- input: {type="recipe", name, ingredients, required_energy, ...}, output: true/false
recipe_table.ingredients = ingred_structure(recipe_table.ingredients)
for i, ingredient_table in pairs(recipe_table.ingredients) do -- example ingredient_table={name="steel", amount=10, type="item"}
if ingredient_table.type == "item" then
if item[ingredient_table.name] == nil then
return false
end
end
if ingredient_table.type == "fluid" then
if fluid[ingredient_table.name] == nil then
return false
end
end
end
return true
end
-- extract resources from data.raw, will take multiple resources into account
local resources = {}
for name, res in pairs(data.raw.resource) do
--print(name .. "--" .. serpent.block(res))
--print(name)
if res.autoplace and name ~= "rare-earth" then
local new_hardness = res.minable.hardness
local new_mining_time = res.minable.mining_time
local new_infinite = res.infinite or false
local new_maximum = res.maximum
local new_normal = res.normal
local new_minimum = res.minimum
local new_a_coverage = res.autoplace.coverage or 0.02
local new_a_random_probability_penalty = res.autoplace.random_probability_penalty or 0
local new_a_richness_multiplier
if res.autoplace.richness_multiplier == 0 and (res.category == "basic-fluid" or res.category == "water") then new_a_richness_multiplier = 30000 * 100 --factor 100 because fludis seem to have too long replication times
elseif res.autoplace.richness_multiplier == 0 then new_a_richness_multiplier = 1500
else new_a_richness_multiplier = res.autoplace.richness_multiplier end
local new_a_richness_base
--print(name .. "-.-.-" .. res.autoplace.richness_base)
if res.autoplace.richness_base == 0 and (res.category == "basic-fluid" or res.category == "water") then new_a_richness_base = 6000 * 100
elseif res.autoplace.richness_base == 0 then new_a_richness_base = 500
else new_a_richness_base = res.autoplace.richness_base end
--print(name .. "-" .. new_a_richness_base)
local new_a_max_probability = res.autoplace.max_probability or 1
local result = {{}}
if res.minable.results then
result=result_structure(res.minable.results) -- returns structure {{name, amount, type},...}
for _, resource in pairs(result) do
if not resources[resource.name] then
resources[resource.name] =
{
amount = resource.amount * #result, -- one mining operation gives every item of the result array.
--This aproximation( "* #result" ) is not representive for cases like this: {{name="res 1", amount=20},{name="res 2", amount=1},{name="res 3", amount=1}
hardness = new_hardness,
mining_time = new_mining_time,
infinite = new_infinite,
maximum = new_maximum,
normal = new_normal,
minimum = new_minimum,
a_coverage = new_a_coverage,
a_random_probability_penalty = new_a_random_probability_penalty,
a_richness_multiplier = new_a_richness_multiplier,
a_richness_base = new_a_richness_base,
a_max_probability = new_a_max_probability,
type = resource.type
}
else
if resources[resource.name].maximum then new_maximum = (new_maximum + resources[resource.name].maximum) / 2 else new_maximum = new_maximum end
if resources[resource.name].normal then new_normal = (new_normal + resources[resource.name].normal) / 2 else new_normal = new_normal end
if resources[resource.name].minimum then new_minimum = (new_minimum + resources[resource.name].minimum) / 2 else new_minimum = new_minimum end
resources[resource.name] =
{
amount = (resource.amount + resources[resource.name].amount) / 2,
hardness = (new_hardness + resources[resource.name].hardness) / 2,
mining_time = (new_mining_time + resources[resource.name].mining_time) / 2,
infinite = new_infinite,
maximum = new_maximum,
normal = new_normal,
minimum = new_minimum,
a_coverage = (new_a_coverage + resources[resource.name].a_coverage) / 2,
a_random_probability_penalty = (new_a_random_probability_penalty + resources[resource.name].a_random_probability_penalty) / 2,
a_richness_multiplier = (new_a_richness_multiplier + resources[resource.name].a_richness_multiplier) / 2,
a_richness_base = (new_a_richness_base + resources[resource.name].a_richness_base) / 2,
a_max_probability = (new_a_max_probability + resources[resource.name].a_max_probability) / 2,
type = resource.type,
}
end
end
else
result[1].name = res.minable.result
result[1].amount = res.minable.result_count or 1
result[1].type = "item"
if not resources[result[1].name] then
resources[result[1].name] =
{
amount = result[1].amount,
hardness = new_hardness,
mining_time = new_mining_time,
infinite = new_infinite,
maximum = new_maximum,
normal = new_normal,
minimum = new_minimum,
a_coverage = new_a_coverage,
a_random_probability_penalty = new_a_random_probability_penalty,
a_richness_multiplier = new_a_richness_multiplier,
a_richness_base = new_a_richness_base,
a_max_probability = new_a_max_probability,
type = result[1].type
}
else
--print(serpent.block(resources[result[1].name]))
if resources[result[1].name].maximum then new_maximum = (new_maximum + resources[result[1].name].maximum) / 2 else new_maximum = new_maximum end
if resources[result[1].name].normal then new_normal = (new_normal + resources[result[1].name].normal) / 2 else new_normal = new_normal end
if resources[result[1].name].minimum then new_minimum = (new_minimum + resources[result[1].name].minimum) / 2 else new_minimum = new_minimum end
resources[result[1].name] =
{
amount = (result[1].amount + resources[result[1].name].amount) / 2,
hardness = (new_hardness + resources[result[1].name].hardness) / 2,
mining_time = (new_mining_time + resources[result[1].name].mining_time) / 2,
infinite = new_infinite,
maximum = new_maximum,
normal = new_normal,
minimum = new_minimum,
a_coverage = (new_a_coverage + resources[result[1].name].a_coverage) / 2,
a_random_probability_penalty = (new_a_random_probability_penalty + resources[result[1].name].a_random_probability_penalty) / 2,
a_richness_multiplier = (new_a_richness_multiplier + resources[result[1].name].a_richness_multiplier) / 2,
a_richness_base = (new_a_richness_base + resources[result[1].name].a_richness_base) / 2,
a_max_probability = (new_a_max_probability + resources[result[1].name].a_max_probability) / 2,
type = result[1].type,
}
end
end
end
end
-- Calculates the time of an resources based on their autoplace control settings
for name, res in pairs(resources) do
--print(serpent.block(name) .. res.type)
--print(serpent.block(res))
if not res.a_random_probability_penalty then prob_factor = res.a_max_probability
elseif res.a_max_probability > res.a_random_probability_penalty then prob_factor = res.a_max_probability - 0.5 * res.a_random_probability_penalty
else prob_factor = 0.5 * res.a_max_probability^2 / res.a_random_probability_penalty end -- Yes, this is the correct probabilty calculation
local inf_factor
if res.infinite and res.normal then inf_factor = math.log(res.normal + 800) / math.log(800) else inf_factor = 1 end
--print(inf_factor)
local time = res.hardness * res.mining_time / res.a_coverage / (res.a_richness_multiplier + res.a_richness_base)^(1/2) / prob_factor / res.amount / inf_factor
resources[name].time = time
end
--print(serpent.block(resources))
-- Adds the resources to the replication recipes
for name, tab in pairs(resources) do
if tab.type == "item" and (not item[name]) then
item[name] = {time = tab.time, comp = 0}
elseif tab.type == "fluid" and (not fluid[name]) then
fluid[name] = {time = tab.time, comp = 0}
else
log("Replicators: Missing resource type for: ".. name)
end
end
--bre[1]=1
-- split recipes with multiple outputs into seperate recipes
for name, recipe in pairs(recipes) do
if recipe.results and #recipe.results > 1 then -- checked for multiple results
local recipe_name = recipe.name --name from recpet with multiple results
local results = result_structure(recipe.results) --the multiple results with uniform data structure: no probabilitys, only {name, amount, type}
local ingred = ingred_structure(recipe.ingredients) --ingredients which produce multiple results
local full_result_amount = 0
local new_amount = {}
for i, rtable in pairs(results) do -- example: rtable = {name=, type=, amount=}
full_result_amount = full_result_amount + rtable.amount
end
for i, rtable in pairs(results) do -- example results has 3 entries: heavy oil, light oil, petrol-> i = 1,2,3
recipes[recipe_name .. "--" .. i] = table.deepcopy(recipe) -- copy for each result of recipe_name and write it in initial recipes table
recipes[recipe_name .. "--" .. i].name = recipe_name .. "--" .. i
recipes[recipe_name .. "--" .. i].results = {rtable}
recipes[recipe_name .. "--" .. i].ingredients = table.deepcopy(ingred) -- use uniform data structure
for k, ingredi in pairs(ingred) do -- example ingred { {name="water"....}, {name="oil"....}}-> ingredi = {name="water"....}
new_amount[k] = ingredi.amount * rtable.amount / full_result_amount -- example: basic oil processing: 3 heavy oil, 3 light oil, 4 petrol: rtable for heavy oil--> rtable.amount=4 , full_result_amount=3+3+4=10, ingredi.amount=10 oil-->new_amount=3
recipes[recipe_name .. "--" .. i].ingredients[k].amount = new_amount[k]
end
end
delete_recipe(name) --after adding recipes for alle the diffrent results of recipe, the original can be deleted
end
end
-- deletes blacklisted recipes in recursive blacklist (in config.lua)
for i, name in pairs(recursive_blacklist) do
delete_recipe(name)
end
-- Recursive iteration through the recipe table to gather the new recipes for the recplication recipes
--log(serpent.block(item))
--log(serpent.block(recipes))
local j = table_length(recipes)
local l = j + 1
while j < l do -- l will stop loop if j stops decreasing
for name, recipe_table in pairs(recipes) do
if contains_known_recipe(recipe_table) then
make_known_recipe(recipe_table)
delete_recipe(name)
end
end
j = table_length(recipes)
if j == 0 then break end
l=l-1
end
--log("-------------")
--log(serpent.block(item))
--print("Not recognized recipes: " .. j)
--print(serpent.block(recipes))
-- deletes blacklisted items in endpoint blacklist (in config.lua)
for i, table in pairs(endpoint_blacklist) do
local name = table[1]
if table[2] == "item" then
item[name] = nil
elseif table[2] == "fluid" then
fluid[name] = nil
else
log("wrong type in endpoint blacklist; config.lua")
end
end
-- restructure result node in recipes table; delete multiple results; This is important for the preq: Since replicator only produce single results the technology unlocking would get problems with multi result recipes.
for name, recipe in pairs(recipes_copy) do
if recipe.results and #recipe.results > 1 then -- checked for multiple results
recipes_copy[name] = nil
elseif recipe.result then
recipe.results = {{name = recipe.result, type="item"}}
recipe.result = nil -- restructure result node in recipes table
end
end
-- returns true if technology unlocks the recipe
local function technology_unlock_recipe(technology, recipe_name)
if not technology.effects then return false end
local n = #technology.effects
for i=1,n do
--print(serpent.block(technology.effects[i]))
if technology.effects[i] and technology.effects[i].type == "unlock-recipe" and technology.effects[i].recipe == recipe_name then
return true
end
end
return false
end
-- find preq for the entries in item: Search for recipes with single result->search for technologie which enables this recipe -> add this tech to preq
for name, rtable in pairs(item) do
local recipe_name
for name2, rtable2 in pairs(recipes_copy) do
if name == rtable2.results[1].name then
recipe_name = name2
for tech_name, tech in pairs(data.raw.technology) do
if not tech_name:match("repltech") and technology_unlock_recipe(tech, recipe_name) then
item[name].preq = tech_name
--print(serpent.block(item[name]))
end
end
end
end
end
--[[
for name, rtable in pairs(fluid) do
local recipe_name
for name2, rtable2 in pairs(recipes_copy) do
if name == rtable2.results[1].name then
recipe_name = name2 -- Recept_name for an fluid is know known
for tech_name, tech in pairs(data.raw.technology) do
if not tech_name:match("repltech") and technology_unlock_recipe(tech, recipe_name) then
fluid[name].preq = tech_name
print(name .. "-----" .. serpent.block(fluid[name]))
end
end
end
end
end
local debug1 = 0
local debug2 = 0
for _, tab in pairs(item) do
if tab.preq then debug1=debug1+1 else debug2=debug2+1 end
end
print("debug1: " .. debug1)
print("debug2: " .. debug2)
]]
--print(serpent.block(recipes,{comment=false}))
--print(serpent.block(item,{comment=false}))
--print(serpent.block(fluid,{comment=false}))
--print(table_length(recipes))
---------------------------------------------------------------------------------------------------
----------------Processing of the replcation recipes-----------------------------------------------
---------------------------------------------------------------------------------------------------
item_numbervec = {}
-- puts all non 0 complexity number into an array
for name, rtable in pairs(item) do
if rtable.comp ~= 0 then
item_numbervec[#item_numbervec+1] = rtable.comp
end
end
-- Sums up an number array
local function sum(t)
local sum = 0
for k,v in pairs(t) do
sum = sum + v
end
return sum
end
-- rounding function
function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
-- quantils function: outputs the smallest number that cuts the array in at the length p in percent: quantil(t, 0.5) is the median of t
local function quantil(t, p)
table.sort(t)
local n = table_length(t)
if (n * p) % 1 == 0 then
return (t[n*p]+t[n*p+1])/2
else
return t[round(n*p)]
end
end
-- Array withe 6 diffrent quantiles; needed for the tiers of the replcatior buildings and research
quantiles = {}
quantiles[1] = 0
quantiles[2] = quantil(item_numbervec, 1/5)
quantiles[3] = quantil(item_numbervec, 2/5)
quantiles[4] = quantil(item_numbervec, 3/5)
quantiles[5] = quantil(item_numbervec, 4/5)
quantiles[6] = item_numbervec[table_length(item_numbervec)]+1
entity_set = {}
equipment_set = {}
-- This function finds all entries in data.raw that have an selection box; basically all (relevant) entities
for category, rtable in pairs(data.raw) do
for name, rtable2 in pairs(rtable) do
if rtable2.selection_box then entity_set[name] = true end
end
end
-- This function finds all entries in data.raw that have the property placed_as_equipment_result; basically every (relevant) equipment
for category, rtable in pairs(data.raw) do
for name, rtable2 in pairs(rtable) do
if rtable2.placed_as_equipment_result then equipment_set[name] = true end
end
end
-- the penalty on the time to replcate an item is based median of the complexities of the replicator recipes
pen_factor = quantil(item_numbervec, 0.5)
-- The penalty function
function repl_penalty(arg)
local time
local tier
if (type(arg) == "table") then
time = arg["time"]
tier = arg["tier"] or 0
else
time=arg
tier=0
end
return (time * (1.1 + math.sqrt(tier / pen_factor)) + math.sqrt(tier)) * replcation_time_factor
end
--print(pen_factor)
--print(serpent.block(quantiles))
--it[t]=1
|
function WeaponAmmoPack:GetIsValidRecipient(recipient)
return false
end
RifleAmmo.GetIsValidRecipient = WeaponAmmoPack.GetIsValidRecipient
ShotgunAmmo.GetIsValidRecipient = WeaponAmmoPack.GetIsValidRecipient
FlamethrowerAmmo.GetIsValidRecipient = WeaponAmmoPack.GetIsValidRecipient
GrenadeLauncherAmmo.GetIsValidRecipient = WeaponAmmoPack.GetIsValidRecipient
HeavyMachineGunAmmo.GetIsValidRecipient = WeaponAmmoPack.GetIsValidRecipient
function WeaponAmmoPack:GetIsValidForAmmo(recipient)
local correctWeaponType
for i = 0, recipient:GetNumChildren() - 1 do
local child = recipient:GetChildAtIndex(i)
if child:isa("ClipWeapon") then
correctWeaponType = child and child:isa(self:GetWeaponClassName())
if correctWeaponType then
break
end
end
end
return self.ammoPackSize ~= nil and correctWeaponType
end
RifleAmmo.GetIsValidForAmmo = WeaponAmmoPack.GetIsValidForAmmo
ShotgunAmmo.GetIsValidForAmmo = WeaponAmmoPack.GetIsValidForAmmo
FlamethrowerAmmo.GetIsValidForAmmo = WeaponAmmoPack.GetIsValidForAmmo
GrenadeLauncherAmmo.GetIsValidForAmmo = WeaponAmmoPack.GetIsValidForAmmo
HeavyMachineGunAmmo.GetIsValidForAmmo = WeaponAmmoPack.GetIsValidForAmmo
function WeaponAmmoPack:OnGiveAmmo(recipient)
local consumedSome = false
local consumedAll = false
for i = 0, recipient:GetNumChildren() - 1 do
local child = recipient:GetChildAtIndex(i)
if child:isa(self:GetWeaponClassName()) and child:GetNeedsAmmo(false) then
local missing = child:GetMaxAmmo() - child:GetAmmo()
child:GiveReserveAmmo(self.ammoPackSize, false)
self.ammoPackSize = self.ammoPackSize - missing
consumedSome = true
if self.ammoPackSize <= 0 then
consumedAll = true
break
end
end
end
if consumedPack then
self:TriggerEffects("ammopack_pickup", { effecthostcoords = recipient:GetCoords()})
end
return consumedAll
end
RifleAmmo.OnGiveAmmo = WeaponAmmoPack.OnGiveAmmo
ShotgunAmmo.OnGiveAmmo = WeaponAmmoPack.OnGiveAmmo
FlamethrowerAmmo.OnGiveAmmo = WeaponAmmoPack.OnGiveAmmo
GrenadeLauncherAmmo.OnGiveAmmo = WeaponAmmoPack.OnGiveAmmo
HeavyMachineGunAmmo.OnGiveAmmo = WeaponAmmoPack.OnGiveAmmo
|
--[[ LICENSE HEADER
The MIT License (MIT)
Copyright © 2017-2021 Jordan Irwin (AntumDeluge)
See: LICENSE.txt
--]]
local cotton_aliases = {"thread", "string"}
if core.global_exists("farming") and core.get_modpath("wool") then
-- Craft cotton from wool
antum.registerCraft({
output = "farming:cotton 4",
type = "shapeless",
recipe = {"group:wool"},
})
-- Add aliases for cotton
for alias in pairs(cotton_aliases) do
core.register_alias("farming:" .. alias, "farming:cotton")
end
end
|
--[[
# tableok : unit tests for table
DARE, Copyright (c) 2017, Tim Menzies
All rights reserved, BSD 3-Clause License
Redistribution and use in source and binary forms, with
or without modification, are permitted provided that
the following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the copyright holder nor the names
of its contributors may be used to endorse or promote
products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------
--]]
require "show"
local the= require "config"
local o= require "tests"
local tbl= require "tbl"
local row= require "row"
local function _test1()
local t=tbl.create("data/weather.csv")
print(t.spec)
assert(#t.rows==14)
assert(t.rows[14].cells[1]=="rainy")
assert(o.nstr(t.all.nums[1].mu,4) == o.nstr(73.5714,4))
assert(o.nstr(t.all.nums[1].sd,4) == o.nstr(6.5717,4))
assert(t.x.syms[1].counts["overcast"] == 4)
assert(t.x.syms[2].counts["TRUE"]==6)
end
local function someShow(i,j)
local r=i.rows[j]
local tmp={j,r.dom}
for _,c in pairs(i.goals) do
tmp[#tmp+1] = r.cells[c.pos] end
print(tmp)
end
local function _test3()
local t=tbl.create("data/auto.csv")
tbl.dominates(t)
for j=1,5 do someShow(t,j) end
print(t.spec)
print("...")
for j=#t.rows-5,#t.rows do someShow(t,j) end
--for i=1,250 do row.dominates(t.rows[i],t) print(t.rows[i].dom) end
end
o.k{_test1,_test2,_test3}
|
--[[ Netherstorm -- Shaleskin Flayer.lua
This script was written and is protected
by the GPL v2. This script was released
by BlackHer0 of the BLUA Scripting
Project. Please give proper accredidations
when re-releasing or sharing this script
with others in the emulation community.
~~End of License Agreement
-- BlackHer0, September, 30th, 2008. ]]
function Flayer_OnEnterCombat(Unit,Event)
Unit:RegisterEvent("Flayer_Skin",5000,0)
end
function Flayer_Skin(Unit,Event)
Unit:CastSpell(36576)
end
function Flayer_OnLeaveCombat(Unit,Event)
Unit:RemoveEvents()
end
function Flayer_OnDied(Unit,Event)
Unit:RemoveEvents()
end
RegisterUnitEvent (20210, 1, "Flayer_OnEnterCombat")
RegisterUnitEvent (20210, 2, "Flayer_OnLeaveCombat")
RegisterUnitEvent (20210, 4, "Flayer_OnDied")
|
local h = require("null-ls.helpers")
local methods = require("null-ls.methods")
local FORMATTING = methods.internal.FORMATTING
return h.make_builtin({
name = "gofmt",
meta = {
url = "https://pkg.go.dev/cmd/gofmt",
description = "Formats go programs.",
notes = {
"It uses tabs for indentation and blanks for alignment.",
"Aligntment assumes that the editor is using a fixed-width font.",
},
},
method = FORMATTING,
filetypes = { "go" },
generator_opts = {
command = "gofmt",
to_stdin = true,
},
factory = h.formatter_factory,
})
|
require "util"
require "mod-gui"
require "export_csv"
local function tick_to_timestring(tick)
if not tick then
return "00:00:00"
end
local h = string.format("%02d", math.floor(tick/216000))
local m = string.format("%02d", math.floor(tick%216000/3600))
local s = string.format("%02d", math.floor(tick%3600/60))
-- local ms = string.format("%02d", math.floor(tick%60/60*100.))
return h .. ":" .. m .. ":" .. s
end
local function tick_to_secondstring(tick)
if not tick then
return "00.00"
end
local s = string.format("%02d", math.floor(tick/60))
local ms = string.format("%02d", math.floor(tick%60/60*100.))
return s .. "." .. ms
end
local function page_count(array, page_size)
if not array then
return 1
end
return math.ceil( table_size(array) / page_size )
end
local function sort_by_duration(list)
table.sort(list, function (left, right)
return left.duration > right.duration
end)
return list
end
local function process_stats(player_index)
local log = global.crafting_log[player_index]
if not log.raw then
return
end
local recipe_lookup = {}
log.statistics = {}
for i, item in pairs(log.raw) do
local n = item.name
if not log.statistics[n] then
log.statistics[n] = 0
recipe_lookup[n] = item.recipe
end
log.statistics[n] = log.statistics[n] + 1
end
log.sorted_stats = {}
for name, count in pairs(log.statistics) do
table.insert(log.sorted_stats, {
name = name,
count = count,
duration = count * recipe_lookup[name].energy * 60.,
recipe = recipe_lookup[name]
})
end
log.sorted_stats = sort_by_duration(log.sorted_stats)
end
local function process_smart(player_index)
local log = global.crafting_log[player_index]
if not log.raw then
return
end
log.queue = { }
local q = 0
for i, item in pairs(log.raw) do
local batch = log.queue[q]
local exit_tick = 0
local start_tick = item.tick - (item.recipe.energy*60)
if batch and not (batch.name == 'idle-time') then
batch.duration = batch.count * batch.recipe.energy * 60.
batch.duration = batch.duration + batch.count
exit_tick = batch.start_tick + batch.duration
end
if start_tick > exit_tick then
table.insert(log.queue, {
name = "idle-time",
count = 1,
duration = start_tick - exit_tick,
recipe = nil,
start_tick = exit_tick
})
log.total_times.idle = log.total_times.idle + (start_tick - exit_tick)
if batch and not (batch.name == 'idle-time') then
log.total_times.craft = log.total_times.craft + batch.duration
end
table.insert(log.queue, {
name = item.name,
count = 1,
duration = 0,
recipe = item.recipe,
start_tick = start_tick
})
q = q + 2
elseif batch and batch.name == item.name then
batch.count = batch.count + 1
else
if batch and not (batch.name == 'idle-time') then
log.total_times.craft = log.total_times.craft + batch.duration
end
table.insert(log.queue, {
name = item.name,
count = 1,
duration = 0,
recipe = item.recipe,
start_tick = start_tick
})
q = q + 1
end
end
end
---------
-- GUI --
---------
local list_count = 20
local function get_smart(flow, data)
local frame = flow.add { type="flow", name = "container", direction ="horizontal" }
local colA = frame.add { type="flow", name = "colA", direction = "vertical" }
local colB = frame.add { type="flow", name = "colB", direction = "vertical" }
local colC = frame.add { type="flow", name = "colC", direction = "vertical" }
local from = ((data.page_index-1)*list_count)+1
local to = data.page_index*list_count
for i = from, to, 1 do
local r = data.queue[i]
if r then
local localised = "Idle"
local iconized = ""
if not (r.name == "idle-time") then
localised = game.item_prototypes[r.name].localised_name
iconized = "[item=" .. r.name .. "] " .. r.count .. "x "
end
colA.add{
type = "label",
caption = tick_to_timestring(r.start_tick) .. " (" .. tick_to_secondstring(r.duration-r.count) .. "s) "
}
colB.add{
type = "label",
caption = iconized,
style = "caption_label"
}
colC.add{
type = "label",
caption = localised,
style = "caption_label"
}
end
end
end
local function get_raw(flow, data)
local frame = flow.add { type="flow", name = "container", direction ="horizontal" }
local colA = frame.add { type="flow", name = "colA", direction = "vertical" }
local colB = frame.add { type="flow", name = "colB", direction = "vertical" }
local colC = frame.add { type="flow", name = "colC", direction = "vertical" }
local from = ((data.page_index-1)*list_count)+1
local to = data.page_index*list_count
for i = from, to, 1 do
local r = data.raw[i]
if r then
local localised = game.item_prototypes[r.name].localised_name
colA.add{
type = "label",
caption = "" .. tick_to_timestring(r.tick) .. " "
}
colB.add{
type = "label",
caption = "[item=" .. r.name .. "] ",
style = "caption_label"
}
colC.add{
type = "label",
caption = localised,
style = "caption_label"
}
end
end
end
local function get_statistics(flow, data)
local top = flow.add { type="flow", name = "top", direction="horizontal" }
top.add{ type ="label", caption="Idle time: ", style ="caption_label" }
top.add{ type ="label", caption=tick_to_timestring(data.total_times.idle) .. " "}
top.add{ type ="label", caption="Craft time: ", style ="caption_label" }
top.add{ type ="label", caption=tick_to_timestring(data.total_times.craft) .. " "}
top.add{ type ="label", caption="Game time: ", style ="caption_label" }
top.add{ type ="label", caption=tick_to_timestring(game.ticks_played)}
local frame = flow.add { type="flow", name = "container", direction ="horizontal" }
local colA = frame.add { type="flow", name = "colA", direction = "vertical" }
local colB = frame.add { type="flow", name = "colB", direction = "vertical" }
local colC = frame.add { type="flow", name = "colC", direction = "vertical" }
local colD = frame.add { type="flow", name = "colD", direction = "vertical" }
local from = ((data.page_index-1)*list_count)+1
local to = data.page_index*list_count
for i = from, to, 1 do
local r = data.sorted_stats[i]
if r then
local localised = game.item_prototypes[r.name].localised_name
colA.add{
type = "label",
caption = tick_to_timestring(r.duration) .. " "
}
colB.add{
type = "label",
caption = "(" .. r.count .. ") "
}
colC.add{
type = "label",
caption = "[item=" .. r.name .. "] ",
style = "caption_label"
}
colD.add{
type = "label",
caption = localised,
style = "caption_label"
}
end
end
end
local function get_page(player_index, data)
local flow = data.gui_flow
if flow.container then
flow.container.destroy()
end
if flow.top then
flow.top.destroy()
end
if flow.foot then
flow.foot.destroy()
end
local pcount = 1
if data.selected_mode == 1 then
-- process_smart(player_index)
pcount = page_count(data.queue, list_count)
get_smart(flow, data)
elseif data.selected_mode == 2 then
pcount = page_count(data.raw, list_count)
get_raw(flow, data)
elseif data.selected_mode == 3 then
-- process_smart(player_index)
pcount = page_count(data.sorted_stats, list_count)
get_statistics(flow, data)
end
flow.container.style.height = 480
local foot = flow.add{ type="flow", name="foot", direction = "horizontal" }
foot.style.top_padding = 8
foot.add { type="button", caption ="<<", name = "previous_page", enabled = (data.page_index > 1) }
local pagination = foot.add { type="label", caption = data.page_index .. "/" .. pcount, style = "caption_label" }
pagination.style.width = 230
pagination.style.horizontal_align = "center"
foot.add { type="button", caption =">>", name ="next_page", enabled = (data.page_index < pcount) }
end
local function display_log(event)
local player = game.get_player(event.player_index)
local flow = mod_gui.get_frame_flow(player)
if flow.HandcraftingLog then
flow.HandcraftingLog.destroy()
return
end
process_stats(event.player_index)
process_smart(event.player_index)
local data = global.crafting_log[event.player_index]
local frame = flow.add { type = "frame", name = "HandcraftingLog", direction = "vertical" }
frame.style.width = 480
local head = frame.add { type="flow", name= "head", direction = "horizontal" }
local title = head.add { type="label", caption="Handcrafting Log", style = "caption_label" }
title.style.width = 160
local player_names = {}
for i = 1, table_size(game.players), 1 do
table.insert(player_names, game.get_player(i).name)
end
head.add { type="drop-down", name="player_select", selected_index = global.crafting_log[event.player_index].view_player_index, items = player_names }
head.add { type="drop-down", name="mode_select", selected_index = global.crafting_log[event.player_index].selected_mode, items = { "Queue", "Raw", "Totals" } }
local export_button = head.add { type="button", caption = "CSV", name ="export_csv" }
export_button.style.width = 50
local list = frame.add { type= "flow", name = "list", direction = "vertical" }
data.gui_flow = list
get_page(event.player_index, data)
end
------------
-- EVENTS --
------------
local function gui_click(event)
local player = game.players[event.player_index]
local e = event.element
if e.valid then
if e.name == "next_page" then
local data = global.crafting_log[event.player_index]
data.page_index = data.page_index + 1
get_page(event.player_index, data)
elseif e.name == "previous_page" then
local data = global.crafting_log[event.player_index]
data.page_index = data.page_index - 1
get_page(event.player_index, data)
elseif e.name == "export_csv" then
local data = global.crafting_log[event.player_index]
if data.selected_mode == 1 then
export_smart(data.queue, data.view_player_index, event.player_index)
elseif data.selected_mode == 2 then
export_raw(data.raw, data.view_player_index, event.player_index)
elseif data.selected_mode == 3 then
export_statistics(data.sorted_stats, data.view_player_index, event.player_index)
end
end
end
end
local function gui_selection_state_changed (event)
local player = game.players[event.player_index]
local e = event.element
if e.valid then
if e.name == "mode_select" then
local data = global.crafting_log[event.player_index]
data.page_index = 1
data.selected_mode = e.selected_index
get_page(event.player_index, data)
elseif e.name == "player_select" then
local data = global.crafting_log[event.player_index]
data.page_index = 1
data.view_player_index = e.selected_index
get_page(event.player_index, data)
end
end
end
local function initialize(event)
if not global.crafting_log then
global.crafting_log = {}
end
end
local function player_init(event)
if not global.crafting_log[event.player_index] then
global.crafting_log[event.player_index] = {
raw = {},
queue = {},
statistics = {},
sorted_stats = {},
total_times = {
idle = 0,
craft = 0
},
page_index = 1,
view_player_index = event.player_index,
selected_mode = 1,
gui_flow = nil
}
end
end
local function crafting_complete(event)
local log = global.crafting_log[event.player_index]
local n = event.item_stack.name
table.insert(log.raw,
{
name = event.item_stack.name,
recipe = event.recipe,
tick = event.tick
})
end
script.on_init(initialize)
script.on_event(defines.events.on_gui_click, gui_click)
script.on_event(defines.events.on_gui_selection_state_changed, gui_selection_state_changed)
script.on_event(defines.events.on_player_created, player_init)
script.on_event(defines.events.on_player_crafted_item, crafting_complete)
-- script.on_nth_tick(60, executeQueue)
-- script.on_event(defines.events.on_player_cursor_stack_changed, displayPatrols)
script.on_event("handcrafting-queue-log", display_log)
|
local path = require "nvim-lsp-installer.path"
local platform = require "nvim-lsp-installer.platform"
local installer = require "nvim-lsp-installer.core.installer"
local git = require "nvim-lsp-installer.core.managers.git"
local Optional = require "nvim-lsp-installer.core.optional"
---@async
---@param opts {llvm_dir: string}
return function(opts)
local ctx = installer.context()
local clang_resource_dir = path.concat { ctx.destination_dir, "clang-resource" }
local install_prefix = ctx.cwd:get()
ctx.fs:mkdir "ccls-git"
ctx:chdir("ccls-git", function()
git.clone { "https://github.com/MaskRay/ccls", recursive = true }
ctx.spawn.cmake {
"-DCMAKE_BUILD_TYPE=Release",
"-DUSE_SYSTEM_RAPIDJSON=OFF",
"-DCMAKE_FIND_FRAMEWORK=LAST",
"-Wno-dev",
("-DCMAKE_INSTALL_PREFIX=%s"):format(install_prefix),
Optional.of_nilable(opts.llvm_dir)
:map(function(llvm_dir)
return {
("-DCMAKE_PREFIX_PATH=%s"):format(llvm_dir),
-- On Mac we use Homebrew LLVM which will persist after installation.
-- On Linux, and when a custom llvm_dir is provided, its clang resource dir will be the only
-- artifact persisted after installation, as the locally installed llvm installation will be
-- cleaned up after compilation.
not platform.is_mac and ("-DCLANG_RESOURCE_DIR=%s"):format(clang_resource_dir) or vim.NIL,
}
end)
:or_else(vim.NIL),
platform.is_mac and "-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" or vim.NIL,
}
ctx.spawn.make { "install" }
end)
ctx.fs:rmrf "ccls-git"
end
|
-- This information tells other players more about the mod
name = "Brook"
description = "Dead Bones Brook from One Piece"
author = "kobyov and Dani the Marble"
version = "1.4.0"
-- This is the URL name of the mod's thread on the forum; the part after the ? and before the first & in the url
forumthread = ""
-- This lets other players know if your mod is out of date, update it to match the current version in the game
api_version = 10
-- Compatible with Don't Starve Together
dst_compatible = true
-- Not compatible with Don't Starve
dont_starve_compatible = false
reign_of_giants_compatible = false
-- Character mods need this set to true
all_clients_require_mod = true
icon_atlas = "modicon.xml"
icon = "modicon.tex"
-- The mod's tags displayed on the server list
server_filter_tags = {
"Brook",
"One Piece",
}
--configuration_options = {}
configuration_options =
{
{
name = "BrookHealth",
label = "Health",
options =
{
{description = "50", data = 50},
{description = "60", data = 60},
{description = "70", data = 70},
{description = "80", data = 80},
{description = "90", data = 90},
{description = "100", data = 100},
{description = "110", data = 110},
{description = "120", data = 120},
{description = "130", data = 130},
{description = "140", data = 140},
{description = "150 (default)", data = 150},
{description = "160", data = 160},
{description = "170", data = 170},
{description = "180", data = 180},
{description = "190", data = 190},
{description = "200", data = 200},
},
default = 150,
},
{
name = "BrookSanity",
label = "Sanity",
options =
{
{description = "50", data = 50},
{description = "60", data = 60},
{description = "70", data = 70},
{description = "80", data = 80},
{description = "90", data = 90},
{description = "100", data = 100},
{description = "110", data = 110},
{description = "120", data = 120},
{description = "130 (default)", data = 130},
{description = "140", data = 140},
{description = "150", data = 150},
{description = "160", data = 160},
{description = "170", data = 170},
{description = "180", data = 180},
{description = "190", data = 190},
{description = "200", data = 200},
},
default = 130,
},
{
name = "BrookHunger",
label = "Hunger",
options =
{
{description = "50", data = 50},
{description = "60", data = 60},
{description = "70", data = 70},
{description = "80", data = 80},
{description = "90", data = 90},
{description = "100", data = 100},
{description = "110", data = 110},
{description = "120", data = 120},
{description = "130", data = 130},
{description = "140", data = 140},
{description = "150", data = 150},
{description = "160", data = 160},
{description = "170 (default)", data = 170},
{description = "180", data = 180},
{description = "190", data = 190},
{description = "200", data = 200},
},
default = 170,
},
{
name = "BrookDamage",
label = "Damage",
options =
{
{description = "0.75 (wes)", data = 0.75},
{description = "1.0 (default)", data = 1.0},
{description = "1.25 (wigfrid)", data = 1.25},
},
default = 1.0,
},
{
name = "BrookHypoIns",
label = "Cold Resistance",
options =
{
{description = "Miniscule", data = 30},
{description = "Earmuffs", data = 60},
{description = "Winter(default)", data = 120},
{description = "Winter+Breezy", data = 180},
{description = "Hibearnation", data = 240},
},
default = 120,
},
{
name = "BrookHyperIns",
label = "Heat Resistance",
options =
{
{description = "Miniscule", data = 30},
{description = "Straw Hat", data = 60},
{description = "Frest(default)", data = 120},
{description = "Frest+Straw", data = 180},
{description = "Eyebrella", data = 240},
},
default = 120,
},
}
|
local plpath = require 'pl.path'
local srcdir = "../gen_src/"
local incdir = "../gen_inc/"
if ( not plpath.isdir(srcdir) ) then plpath.mkdir(srcdir) end
if ( not plpath.isdir(incdir) ) then plpath.mkdir(incdir) end
local gen_code = require("Q/UTILS/lua/gen_code")
qtypes = { 'I1', 'I2', 'I4', 'I8','F4', 'F8' }
local sp_fn = require 'Q/OPERATORS/INDEX/lua/index_specialize'
local num_produced = 0
for _, qtype in ipairs(qtypes) do
local status, subs = pcall(sp_fn, qtype)
if ( status ) then
gen_code.doth(subs, incdir)
gen_code.dotc(subs, srcdir)
print("Generated ", subs.fn)
num_produced = num_produced + 1
else
print(subs)
end
end
assert(num_produced > 0)
|
require("Game/builderUpgrader.lua")
require("Game/builderFunctions.lua")
require("Game/mapInfo.lua")
require("NPC/state.lua")
--require("Game/autoBuilder.lua")
--this = BuildNode()
local buildCounter = 0
local readyToPlay = {}
local towerChangeState = 0
local towerBuildInfo = {}
local waveTime = 0
local curentWave = -1
local canBuildInThisWorld = false
--TODO
--In multiplayer add transaction id when buying selling tower, to ensure that towers can only be built in a correct order,
--With this 2 towers cant be buil in the same spot, bechause the user with the higher transaction id can't buil until he got
--The build event from the other user.
local transactionQueue = {wait=0,currentState="build"}
function destroy()
if buildingBillboard then
buildingBillboard:setBool("Ready", false)
end
end
function worldCollision()
--get collision line from camera and mouse pos
local cameraLine = camera:getWorldLineFromScreen(Core.getInput():getMousePos());
--Do collision agains playerWorld and return collided mesh
collisionMesh = playerNode:collisionTree(cameraLine, NodeId.islandMesh);
--Check if collision occured and check that we have an island which the mesh belongs to
if collisionMesh and collisionMesh:findNodeByType(NodeId.island) then
collPos = cameraLine.endPos;
return true;
end
return false;
end
function changeSelectedTower( newTower )
-- if enableTheCrasher then
-- abort()
-- end
if currentTower then
currentTower:setVisible(false);
end
currentTower = newTower;
if currentTower then
currentTower:setVisible(true);
local model = currentTower:findNodeByType(NodeId.model);
if model then
model:setColor(Vec3(1));
end
end
if currentTower then
buildingBillboard:setBool("inBuildMode", true)
else
buildingBillboard:setBool("inBuildMode", false)
end
end
function updateSelectedTowerToBuild()
-- if Core.getInput():getKeyPressed(Key.l) then
-- enableTheCrasher = true
-- end
if canBuildInThisWorld then
for i = 1, 9 do
if keyBind[i] and keyBind[i]:getPressed() then
currentTowerIndex = i;
changeSelectedTower( buildings[i] );
end
end
if (keyDeselect and keyDeselect:getPressed()) or esqKeyBind:getPressed() then
currentTowerIndex = 0;
changeSelectedTower( nil );
end
end
while comUnit:hasMessage() do
local msg = comUnit:popMessage()
if comUnitTable[msg.message] ~= nil then
if msg.message == "NetSellTower" then
transactionQueue[#transactionQueue+1] = {type="sell",parameter=msg.parameter,func=comUnitTable[msg.message]}
elseif msg.message == "NET" then
transactionQueue[#transactionQueue+1] = {type="build",parameter=msg.parameter,func=comUnitTable[msg.message]}
elseif msg.message == "NETWU" then
transactionQueue[#transactionQueue+1] = {type="build",parameter=msg.parameter,func=comUnitTable[msg.message]}
elseif msg.message == "NETTP" then
transactionQueue[#transactionQueue+1] = {type="build",parameter=msg.parameter,func=comUnitTable[msg.message]}
elseif msg.message == "buildingSubUpgrade" then
transactionQueue[#transactionQueue+1] = {type="upgrade",parameter=msg.parameter,func=comUnitTable[msg.message]}
elseif msg.message == "NetUpgradeWallTower" then
--easy protection against tower who is upgraded, sold, upgraded and sold ower and ower again
transactionQueue[#transactionQueue+1] = {type="towerChange"..towerChangeState,parameter=msg.parameter,func=comUnitTable[msg.message]}
towerChangeState = towerChangeState + 1
else
comUnitTable[msg.message](msg.parameter)
end
else
--print("comUnit:hasMessage() == "..tostring(msg).."\n")
-- num = tonumber(msg.parameter)
-- if num and num > 0 and num <= #buildings then
-- currentTowerIndex = num
-- changeSelectedTower( buildings[num] );
-- end
end
end
--print("Wait: "..transactionQueue.wait)
transactionQueue.wait = transactionQueue.wait - 1
local run = #transactionQueue > 0 and transactionQueue.wait < 0
while run do
if transactionQueue.currentState == transactionQueue[1].type then
print("Transaction type: "..transactionQueue[1].type)
transactionQueue[1].func(transactionQueue[1].parameter)
table.remove(transactionQueue, 1)
run = #transactionQueue > 0
else
print("Wait 4 frames")
run = false
transactionQueue.currentState = transactionQueue[1].type
transactionQueue.wait = 4
end
end
--transactionQueue = {frame=0,currentState="build"}
end
function getBuildingId(building)
for i=1, #buildings do
if buildings[i] == building then
return i
end
end
return 0
end
function increaseBuildBuildingCount()
buildingBillboard:setInt( "NumBuildingBuilt", buildingBillboard:getInt("NumBuildingBuilt") + 1 )
end
function changeBuilding(towerId)
local towerId = tonumber(towerId)
if towerId > 0 and towerId <= #buildings then
currentTowerIndex = towerId;
changeSelectedTower( buildings[towerId] );
end
end
function restartMap()
towerBuildInfo = {}
if this:clearBuildings() then
noMoneyIcon:setVisible(false)
buildingBillboard:setInt( "NumBuildingBuilt", 0)
buildingBillboard:setBool("Ready", false)
readyToPlay[0] = false
else
restartListener:pushEvent("reloadeMap")
end
end
--function addHighScore(data)
-- for i=1, #towerBuildInfo do
-- towerBuildInfo[i].restore = nil
-- end
--end
--this function can only be called once
function sendHightScoreToTheServer()
-- for i=1, #towerBuildInfo do
-- towerBuildInfo[i].restore = nil
-- end
local statsBilboard = Core.getBillboard("stats")
local highScore = Core.getHighScore()
local highScoreBillBoard = Core.getGlobalBillboard("highScoreReplay")
highScoreBillBoard:setBool("victory", true)
highScoreBillBoard:setInt("score", statsBilboard:getInt("score"))
highScoreBillBoard:setInt("life", statsBilboard:getInt("life"))
highScoreBillBoard:setDouble("gold", statsBilboard:getInt("gold"))
highScore:addScore( tabToStrMinimal(towerBuildInfo) )
end
function addRebuildTowerEvent(textData)
local tab = totable(textData)
towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=0,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add={para1=tab.upp,func=5},restore={para1=tab.down,func=rebuildSoldTower}}
print("\n\n")
print("---------------------------")
print("---------------------------")
print("---------------------------")
print("\n\n")
print(tostring(towerBuildInfo))
print("\n\n")
end
function addDowngradeTower(textData)
local tab = totable(textData)--{upp=upgradeData,down=downGradeData})
towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=0,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add={para1=tab.upp,func=3},restore={para1=tab.down,func=upgradeWallTower,name="downgradeToWall"}}
end
function setBuildingTargetVec(textData)
towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=0,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add={para1=totable(textData),func=6},restore=nil}
end
function changeArrowTowerRotation(tab)
--{netName=script:getNetworkName(),para=tostring(direction.x)..","..direction.y..","..direction.z}
local script = Core.getScriptOfNetworkName(tab.netName)
comUnit:sendTo(script:getIndex(), "setRotateTarget", tab.para)
end
function addPrioEvent(intabData)
towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=0,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add={para1=totable(intabData),func=7},restore=nil}
end
function callPrioEvent(eventData)
local script = Core.getScriptOfNetworkName(eventData.netName)
if script then
local comIndex = script:getIndex()
if eventData.event == 1 then
comUnit:sendTo(comIndex,"addState",tostring(state.ignore)..";0")
comUnit:sendTo(comIndex,"addState",tostring(state.highPriority)..";1")
else
comUnit:sendTo(comIndex,"addState",tostring(state.highPriority)..";0")
comUnit:sendTo(comIndex,"addState",tostring(state.ignore)..";1")
end
end
end
function DropLatestBuildingEvent(netName)
print("\n\n")
print("netName: " .. netName)
print("---------------------------")
print("---------------------------")
print("---------------------------")
print("\n\n")
print(tostring(towerBuildInfo))
print("\n\n")
-- [3]={
-- restore={
-- func=nil,
-- name="WallTowerupgrade",
-- para1={
-- tName="T0_1",
-- netName="T0_2",
-- playerId=0,
-- buildCost=0,
-- upgToScripName="Tower/WallTower.lua"
-- }
-- }
for i=#towerBuildInfo, 1, -1 do
if towerBuildInfo[i] and towerBuildInfo[i].restore and towerBuildInfo[i].restore.para1 and towerBuildInfo[i].restore.para1.netName == netName then
nameMaping[#nameMaping+1] = {netName.."V3",towerBuildInfo[i].restore.para1.tName}
print("remove index: "..i)
table.remove(towerBuildInfo, i)
i = 0
end
end
print("\n\n")
print("---------------------------")
print("---------------------------")
print("---------------------------")
print("\n\n")
print(tostring(towerBuildInfo))
print("\n\n")
end
function ChangeTowerName(tabString)
local data = totable(tabString)
local script = Core.getScriptOfNetworkName(data.name)
if script then
end
end
function create()
--Protection in multiplayer environment where multiple instances of this script is loaded
local node = this:findNodeByTypeTowardsRoot(NodeId.playerNode)
if node == nil then
return false
end
if this:getNodeType() == NodeId.buildNode then
canBuildInThisWorld = ( node:getClientId() == 0 or node:getClientId() == Core.getNetworkClient():getClientId() )
Core.setScriptNetworkId("Builder"..node:getClientId())
camera = ConvertToCamera( this:getRootNode():findNodeByName("MainCamera") );
--this is the node named "player 1 node"
print("------------------------------\n")
comUnit = Core.getComUnit()
comUnit:setCanReceiveTargeted(true)
comUnit:setName("builder"..node:getClientId())
--functions from autobuilder.lua
comUnitTable = {}
-- comUnitTable["upgradeBuilding"] = upgradeBuilding
comUnitTable["changeBuilding"] = changeBuilding
comUnitTable["damgeTowerBuilt"] = damgeTowerBuilt
comUnitTable["NET"] = syncBuild
comUnitTable["NETWU"] = UpgradeWallBuilding
comUnitTable["NETTP"] = UpgradeWallBuilding
comUnitTable["SELLTOWER"] = sellTower
comUnitTable["NetSellTower"] = netSellTower
comUnitTable["UpgradeWallTower"] = upgradeWallTower
comUnitTable["NetUpgradeWallTower"] = netUpgradeWallTower
comUnitTable["buildingSubUpgrade"] = towerUpgrade
comUnitTable["addDowngradeTower"] = addDowngradeTower
comUnitTable["DropLatestBuildingEvent"] = DropLatestBuildingEvent
comUnitTable["addRebuildTower"] = addRebuildTowerEvent
comUnitTable["sendHightScoreToTheServer"] = sendHightScoreToTheServer
comUnitTable["setBuildingTargetVec"] = setBuildingTargetVec
comUnitTable["addPrioEvent"] = addPrioEvent
comUnitTable["ChangeTowerName"] = ChangeTowerName
functionList = {}
functionList[1] = towerUpgradefunc
functionList[2] = buildTowerNetworkBuild
functionList[3] = uppgradeWallTowerTab
functionList[4] = sellTowerAddNoEvent
functionList[5] = upgradeWallTower
functionList[6] = changeArrowTowerRotation
functionList[7] = callPrioEvent
--used for arrow tower whos building is canceld
nameMaping = {}
replayIndex = 1
towerBuildInfo = {}
restartListener = Listener("Restart")
restartListener:registerEvent("restart", restartMap)
stateBillboard = Core.getGameSessionBillboard("state")
mapInfo = MapInfo.new()
playerCount = Core.isInMultiplayer() and mapInfo.getPlayerCount() or 1
print("test 1\n")
keyBinds = Core.getBillboard("keyBind")
keyBind = {}
for i = 1, 9 do
print("building "..tostring(i).."\n")
keyBind[i] = keyBinds:getKeyBind("Building " .. i)
end
esqKeyBind = KeyBind("Menu", "control", "toogle menu")
esqKeyBind:setKeyBindKeyboard(0, Key.escape)
print("test 2\n")
keyUse = keyBinds:getKeyBind("Place")
keyDeselect = keyBinds:getKeyBind("Deselect")
builderFunctions = BuilderFunctions.new(keyBinds, camera)
rotationTime = 0
print("create\n")
local rootNode = this:getRootNode()
towerWorld = rootNode:addChild(SceneNode())
buildingBillboard = Core.getBillboard("buildings")
buildingBillboard:setInt("NumBuildingBuilt", 0)
buildingBillboard:setBool("inBuildMode", false)
buildingBillboard:setBool("canBuildAndSelect", true)
buildingBillboard:setBool("Ready", false)
soundNode = SoundNode("towerBuild")
soundNode:setLocalSoundPLayLimit(7)
rootNode:addChild(soundNode)
towerBuiltListener = Listener("builder")
restartWaveListener = Listener("RestartWave")
restartWaveListener:registerEvent("restartWave", restartWave)
readyToPlay[0] = false
buildings = {}
local numBuildings = 1
while buildingBillboard:exist(tostring(numBuildings)) do
buildings[numBuildings] = towerWorld:addChild( SceneNode() );
local scriptName = buildingBillboard:getString(tostring(numBuildings));
local luaScript = buildings[numBuildings]:loadLuaScript(scriptName);
if luaScript then
luaScript:setName("tower");
luaScript:setScriptNetworkId("builder_tower_"..numBuildings)
--buildings[numBuildings]:setIsStatic(false)
buildings[numBuildings]:update()
buildings[numBuildings]:setVisible(false)
local canBePlacedHere = this:tryToSnapBuildingInToPlace(buildings[numBuildings], SceneNode(), Vec3(), 0.0 )
else
buildings[numBuildings] = nil;
abort();
end
numBuildings = numBuildings + 1;
end
-- AutoBuilder.setBuildingList(buildings)
currentTower = nil;
rotation = 0;
playerNode = this:getParent();
input = Core.getInput();
noMoneyIcon = Sprite(Core.getTexture("icon_table.tga"))
noMoneyIcon:setUvCoord(Vec2(0.875,0),Vec2(1,0.0625))
noMoneyIcon:setSize(Vec2(0.05) * Core.getScreenResolution().y)
noMoneyIcon:setVisible(false)
noMoneyIcon:setAnchor(Anchor.MIDDLE_CENTER)
if camera then
camera:add2DScene(noMoneyIcon)
local work = this:createWork();
work:setWeight(9)
work:setName("Builder")
work:addDependency(camera:getWork())
else
camera = nil;
print("No camera was found");
end
waveTime = Core.getGameTime()
highScoreReplayBillboard = Core.getGlobalBillboard("highScoreReplay")
isAReplay = highScoreReplayBillboard:getBool("replay")
if isAReplay then
--This is a game is a replay
--this only occure for nowe 2017-07-04 on the server side where top play thrue is tested to detect cheating
towerBuildInfo = totable( highScoreReplayBillboard:getString("replayTableString") )
print("towerBuildInfo: "..tostring(towerBuildInfo))
end
print("BUILDER:::RETURN == true\n")
return true
else
print("------------------------------\n")
--move this script from the current PlayerNode to a BuildNode
local builderNode = this:addChild(BuildNode())
--this:removeScript(this:getCurrentScript():getName());
builderNode:loadLuaScript(this:getCurrentScript():getFileName()):setName("BuilderScript")
print("BUILDER:::RETURN == false\n")
return false
end
end
function getTowerBoundingBoxFromMeshes( tower )
local meshList = currentTower:findAllNodeByTypeTowardsLeaf(NodeId.mesh)
for i = 1, #meshList, 1 do
--meshList:item(i):setColor(color)
Core.addDebugBox(meshList[i]:getGlobalBoundingBox(),0.001,Vec3(1,0,0))
end
end
function syncBuild(param)
buildTowerNetworkCallback(totable(param))
end
function damgeTowerBuilt(param)
if not readyToPlay[tonumber(param)] then
readyToPlay[tonumber(param)] = true
updateIsAllreadyToPlay()
end
end
function netUpgradeWallTower(param)
--print("netUpgradeWallTower()\n")
local tab = totable(param)
local building = Core.getScriptOfNetworkName(tab.netName):getParentNode()
upgradeFromTowerToTower(building, 0, tab.upgToScripName, nil, tab.tName, false, tab.playerId )
comUnit:sendTo("SelectedMenu", "updateSelectedTower", "")
end
function upgradeWallTower(param)
local tab = totable(param)
local script = Core.getScriptOfNetworkName(tab.netName)
if script then
local tName = tab.tName
for i=1, #nameMaping do
if nameMaping[i][1] == tName then
tName = nameMaping[i][2]
table.remove(nameMaping, i)
i = #nameMaping + 2
end
end
local building = script:getParentNode()
upgradeFromTowerToTower(building, 0, tab.upgToScripName, nil, tName, true, tab.playerId )
comUnit:sendTo("SelectedMenu", "updateSelectedTower", "")
if Core.isInMultiplayer() then
comUnit:sendNetworkSyncSafe("NetUpgradeWallTower",param)
end
else
print("---------------------")
print(" Crash information ")
print("---------------------\n")
print(tostring(towerBuildInfo))
print("\n---------------------\n\n")
abort("CRASH: send the white console information bettwen Crash information to me")
end
end
function towerUpgradefunc(tab)
print("\n\ntowerUpgradefunc")
print("NetId: "..tab.netId)
print("comUnit:sendTo("..Core.getScriptOfNetworkName(tab.netId):getIndex()..", "..tab.msg..", "..(tab.param or ""))
print("")
comUnit:sendTo(Core.getScriptOfNetworkName(tab.netId):getIndex(),tab.msg,tab.param or "")
end
function towerUpgrade(param)
--towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=buildCost,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add={para1=buildData,func=uppgradeWallTowerTab},restore={para1=downGradeData,func=upgradeWallTower}}
local tab = totable(param)
local scriptName = Core.getScriptOfNetworkName(tab.netId):getFileName()
print("----- tower Upgrade -----")
print("netId: "..tab.netId)
print("msg: "..tab.msg)
print("param: "..(tab.param or ""))
print("name: "..scriptName)
print("------------------------")
if tab.param and not ( scriptName == "Tower/ArrowTower.lua" and tab.msg == "upgrade6") then
local downGrade = {netId = tab.netId, msg = tab.msg, param = tab.param - 1}
towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=tab.cost,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add={para1=tab,func=1},restore=nil}
else
--TODO not supported
print("NOT supported")
end
towerUpgradefunc(tab)
end
--this function can be called localy or by ower network
function netSellTower(paramNetworkName,doNotReturnMoney)
local buildingScript = Core.getScriptOfNetworkName(paramNetworkName)
local netWorkName = (buildingLastSelected and buildingLastSelected:getScriptByName("tower")) and buildingLastSelected:getScriptByName("tower"):getNetworkName() or ""
if buildingScript then
local netName = buildingScript:getNetworkName()
local billBoard = buildingScript:getBillboard()
local buildingToSell = buildingScript:getParentNode()
local buildingValue = billBoard:getFloat("value")
local buildingValueLost = billBoard:getFloat("totalCost")-billBoard:getFloat("value")
towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=0,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add={para1=paramNetworkName,func=4},restore={para1=netName,func=rebuildWallTower,name="rebuildWallTower"}}
--print("buildingValue == "..buildingValue.."\n")
if this:removeBuilding( buildingToSell ) then
if billBoard:getBool("isNetOwner") and doNotReturnMoney ~= true then
comUnit:sendTo("stats", "addGoldNoScore", tostring(buildingValue))
comUnit:sendTo("stats","addBillboardDouble","goldLostFromSelling;"..tostring(buildingValueLost))
comUnit:sendTo("stats","addTowersSold","")
end
--comUnit:sendTo("builder", "soldTower", tostring(buildingId))
if netWorkName == paramNetworkName then
print("\n\nSelected menu is in hidding because tower was sold\n\n")
form:setVisible(false)
targetArea.hiddeTargetMesh()
end
else
if DEBUG then
error("Removing building failed!!!")
else
print("Removing building failed!!!")
end
end
else
print("No script found for selected building, during remove")
end
end
function sellTowerAddNoEvent(param)
netSellTower(param)--This step adds a restore event
towerBuildInfo[#towerBuildInfo] = nil --remove the restore event
end
--this function is called localy by scripts
function sellTower(param)
netSellTower(param)
if Core.isInMultiplayer() then
comUnit:sendNetworkSyncSafe("NetSellTower",param)
end
end
function UpgradeWallBuilding(param)
local tab = totable(param)
--changeSelectedTower( buildings[tab.buildTowerIndex] )
local buildingToUpgradeScript = Core.getScriptOfNetworkName(tab.netName)
local buildingToUpgrade = buildingToUpgradeScript:getParentNode()
local buildingScript = buildings[tab.buildTowerIndex]:getScriptByName("tower")
local towerBilboard = buildingScript:getBillboard()
--get the cost of the new tower
local buildCost = towerBilboard:getFloat("cost")
--get the script file name
local scriptName = buildingScript:getFileName()
if towerBilboard:getString("Name") ~= "Wall tower" and not readyToPlay[tab.playerId] then
readyToPlay[tab.playerId] = true
updateIsAllreadyToPlay()
end
upgradeFromTowerToTower(buildingToUpgrade, buildCost, scriptName, tab.matrix, tab.tName, false)
end
--"{ buildingId = 2, islandId = 0, localPos = Vec3(6.29053593,0,-6.13610077), rotation = 0}"
function buildTowerNetworkCallback(tab)
--local tab = totable(input)
local towerToBuild = buildings[tab.buildingId]
-- print("Player index: "..fromIndex.." Built a tower <---------------")
building = this:buildFromBuildInfo(towerToBuild, tab)
if building then
local script = building:getScriptByName("tower")
script:setScriptNetworkId(tab.tName)
comUnit:sendTo(script:getIndex(),"NetOwner","NO")
local towerBilboard = script:getBillboard()
building:setSceneName(towerBilboard:getString("Name"))
building:createWork()
increaseBuildBuildingCount()
if towerBilboard:getString("Name") ~= "Wall tower" then
readyToPlay[tab.playerId] = true
end
soundNode:play(1.0, false)
towerBuiltListener:pushEvent("built")
updateIsAllreadyToPlay()
else
error("failed to place building")
end
end
function buildTowerNetworkBuild(tab)
local script = buildings[tab.buildingId]:getScriptByName("tower")
local towerBilboard = script:getBillboard()
local buildCost = towerBilboard:getFloat("cost")
comUnit:sendTo("stats","removeGold",tostring(buildCost))
buildTowerNetworkCallback(tab)
local script = building:getScriptByName("tower")
comUnit:sendTo(script:getIndex(),"NetOwner","YES")
end
function getNewTowerName()
buildCounter = buildCounter + 1
return "T"..Core.getNetworkClient():getClientId().."_"..buildCounter
end
function updateIsAllreadyToPlay()
if not buildingBillboard:getBool("Ready") then
if Core.isInMultiplayer() then
local users = Core.getNetworkClient():getConnected()
print("users: "..tostring(users).."\n")
local allReady = true
for i=1, #users do
if not readyToPlay[users[i].playerId] and users[i].playerId <= playerCount then
allReady = false
end
end
print("Player count: "..playerCount)
print("readyToPlay: "..tostring(readyToPlay).."\n")
buildingBillboard:setBool("Ready", allReady)
elseif readyToPlay[0] == true then
buildingBillboard:setBool("Ready", true)
end
end
end
function restartWave(wave)
-- print("restart Wave: "..wave)
-- print("data: "..tostring(towerBuildInfo))
restoreToWave = wave
local run = true
while run and #towerBuildInfo > 0 do
local index = #towerBuildInfo
if towerBuildInfo[index].wave < wave then
run = false
else
-- print("DO: "..index)
local restorTab = towerBuildInfo[index].restore
if restorTab then
if restorTab.para1 == nil then
restorTab.func()
elseif restorTab.para2 == nil then
restorTab.func(restorTab.para1)
else
restorTab.func(restorTab.para1, restorTab.para2)
end
end
-- print("towerInfo: "..index.." is set to nil")
towerBuildInfo[index] = nil
end
end
--update wave time
waveTime = Core.getGameTime()
end
function isAtowerBuildEvent(index, netName)
local addTab = towerBuildInfo[index].add
return addTab and addTab.para1 and
( addTab.func == 2 and addTab.para1.tName == netName ) or
( addTab.func == 3 and addTab.para1[5] == netName )
end
function rebuildWallTower(netName)
print("Rebuild wall tower: "..netName)
for i=1, #towerBuildInfo do
if towerBuildInfo[i].add and towerBuildInfo[i].add.func == 2 and towerBuildInfo[i].add.para1.tName == netName then
local addData = towerBuildInfo[i].add
functionList[addData.func](addData.para1)
local script = Core.getScriptOfNetworkName(addData.para1.tName)
comUnit:sendTo(script:getIndex(),"NetOwner","YES")
return
elseif towerBuildInfo[i].restore and towerBuildInfo[i].restore.func == rebuildSoldTower and towerBuildInfo[i].restore.para1.wallTowerName == netName then
--this case happens when a tower is directly built en sold of to a wall tower and then sold again
local towerNetName = towerBuildInfo[i].restore.para1.towerName
print("take build info from node: "..towerNetName)
local n=1
while n <= #towerBuildInfo do
print("n: "..n)
if towerBuildInfo[n].add and towerBuildInfo[n].add.func == 2 and towerBuildInfo[n].add.para1.tName == towerNetName then
local addData = towerBuildInfo[n].add
local restoreToName = addData.para1.tName
addData.para1.buildingId = 1
addData.para1.tName = netName
functionList[addData.func](addData.para1)
local script = Core.getScriptOfNetworkName(netName)
comUnit:sendTo(script:getIndex(),"NetOwner","YES")
addData.para1.tName = restoreToName
return
elseif towerBuildInfo[n].add and towerBuildInfo[n].add.func == 3 and towerBuildInfo[n].add.para1[5] == towerNetName then
towerNetName = towerBuildInfo[n].add.para1[1]
print("redo take build info from node: "..towerNetName)
n = 1
else
n = n + 1
end
end
end
end
error("wall tower was newer restored")
end
function rebuildSoldTower(tab)
print("rebuildSoldTower: "..tostring(tab))
local wallTowerNetName = tab.wallTowerName
local towerNetName = tab.towerName
--find the towers origins
local index = 1
local foundStartEvent = false
while index <= #towerBuildInfo and foundStartEvent == false do
if towerBuildInfo[index].add and isAtowerBuildEvent(index, towerNetName) then
foundStartEvent = true
else
index = index + 1
end
end
local ignoreWave = true
if foundStartEvent then
if towerBuildInfo[index].add.func == 2 then
--the wall tower needs to be sold
print("Sell Wall Tower: "..wallTowerNetName)
sellTowerAddNoEvent(wallTowerNetName)
elseif towerBuildInfo[index].add.func == 3 then
--rename wallTower
local script = Core.getScriptOfNetworkName(wallTowerNetName)
script:setScriptNetworkId(towerBuildInfo[index].add.para1[1])
end
--restore building up until wave start
while index < #towerBuildInfo and (ignoreWave or towerBuildInfo[index].wave < restoreToWave) do
local addData = towerBuildInfo[index].add
if addData and (isAtowerBuildEvent(index, towerNetName) or ( addData.func == 1 and addData.para1.netId == towerNetName ) or (addData.func == 4 and addData.para1.netName == towerNetName)) then
ignoreWave = false
functionList[addData.func](addData.para1)
end
index = index + 1
end
end
end
function update()
if canBuildInThisWorld == false then
--update event from other players
updateSelectedTowerToBuild()
return true
end
if curentWave ~= Core.getBillboard("stats"):getInt("wave") then
curentWave = Core.getBillboard("stats"):getInt("wave")
waveTime = Core.getGameTime()
if isAReplay and curentWave == 0 then
waveTime = #towerBuildInfo > 1 and waveTime - towerBuildInfo[1].buildTimeFromBeginingOfWave + 3 or 0
end
-- print("replayData: "..tabToStrMinimal(towerBuildInfo))
local statsBillboard = Core.getBillboard("stats")
local data = {gold=statsBillboard:getDouble("gold"),score=statsBillboard:getDouble("score"),life=statsBillboard:getDouble("life")}
towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=0,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add=nil,restore=nil,data=data}
end
-- if Core.getInput():getKeyDown(Key.y) then
-- sendHightScoreToTheServer()
-- end
if isAReplay then
local timeoffset = (Core.getGameTime()-waveTime)
print("curentWave: "..curentWave.." timeoffset: "..timeoffset)
while towerBuildInfo[replayIndex] and (towerBuildInfo[replayIndex].wave < curentWave or (towerBuildInfo[replayIndex].wave == curentWave and towerBuildInfo[replayIndex].buildTimeFromBeginingOfWave < timeoffset)) do
local addData = towerBuildInfo[replayIndex].add
if addData ~= nil then
functionList[addData.func](addData.para1)
if towerBuildInfo[replayIndex].cost then
comUnit:sendTo("stats","removeGold",towerBuildInfo[replayIndex].cost)
end
end
towerBuildInfo[replayIndex] = nil
replayIndex = replayIndex + 1
end
end
if Core.getInput():getKeyHeld(Key.lshift) or stateBillboard:getBool("inMenu") then
noMoneyIcon:setVisible(false)
builderFunctions.renderTargetArea("",nil,nil)
if currentTower then
currentTower:setVisible(false)
end
builderFunctions.updateSelectedTower(nil)
return true
end
updateSelectedTowerToBuild()
rotation = builderFunctions.updateBuildingRotation(rotation)
--print( "num built tower: "..buildingBillboard:getInt("NumBuildingBuilt").."\n")
if currentTower then
buildingBillboard:setBool("inBuildMode", true)
else
buildingBillboard:setBool("inBuildMode", false)
end
--set outline on the last seleceted tower, this is totaly seperate from selected menu selected tower
--Byt the same tower should be selected
builderFunctions.updateSelectedTower(currentTower)
--currentTower = SceneNode()
if currentTower and worldCollision() then
local island = collisionMesh:findNodeByTypeTowardsRoot(NodeId.island)
local canBePlacedHere = this:tryToSnapBuildingInToPlace(currentTower, collisionMesh, collPos, rotation );
if Core.getPlayerId() ~= island:getPlayerId() and island:getPlayerId() > 0 and Core.getPlayerId() > 0 then
canBePlacedHere = false;
end
local script = currentTower:getScriptByName("tower")
local towerBilboard = script:getBillboard()
local targetAreaName = towerBilboard:getString("TargetArea")
local buildingMatrix = this:getCurrentGlobalTowerMatrix()
local buildCost = towerBilboard:getFloat("cost")
local gold = Core.getBillboard("stats"):getDouble("gold")
comUnit:sendTo(script:getIndex(),"checkRange","")
local towerMatrix = this:getTargetIsland():getGlobalMatrix() * this:getLocalIslandMatrix()
if canBePlacedHere and keyUse and keyUse:getPressed() and buildCost <= gold then
building = this:TryToBuild()
if building then
local script = building:getScriptByName("tower")
local towerName = getNewTowerName()
script:setScriptNetworkId(towerName)
comUnit:sendTo(script:getIndex(),"NetOwner","YES")
--collect build info
local tab = this:getBuildInfo()--{islandId=island:getIslandId(),localPos = island:getGlobalMatrix():inverseM() * collPos, rotation=rotation, buildingId = getBuildingId(currentTower), tName=towerName}
tab.buildingId = getBuildingId(currentTower)
tab.tName=towerName
tab.playerId = Core.getPlayerId()
if Core.isInMultiplayer() then
comUnit:sendNetworkSyncSafe("NET",tabToStrMinimal(tab))
else
towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=0,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add={para1=tab,func=2},restore={para1=towerName,para2=true,func=sellTowerAddNoEvent,name="Sell Building"}}
end
building:setSceneName(towerBilboard:getString("Name"))
building:createWork()
increaseBuildBuildingCount()
--successfully built tower, time to pay
towerBuiltSteamStats(script)
comUnit:sendTo("stats","removeGold",tostring(buildCost))
if targetAreaName == "cone" then
--Add retarget script to building node
building:loadLuaScript("Game/buildRotater.lua")
changeSelectedTower(nil)
end
--make usre that the wav of enemies can start
if towerBilboard:getString("Name") ~= "Wall tower" then
readyToPlay[0] = true
readyToPlay[Core.getPlayerId()] = true
updateIsAllreadyToPlay()
end
soundNode:play(1.0, false)
towerBuiltListener:pushEvent("built")
end
elseif not canBePlacedHere then
local camLine = camera:getWorldLineFromScreen(Core.getInput():getMousePos())
local building = this:getNearestBuildingFromLine(camLine)
if building and Collision.lineSegmentPointLength2(camLine, building:getGlobalPosition()) < 2.0 then
local buildingScript = building and building:getScriptByName("tower") or nil
local buildingBillBoard = buildingScript and buildingScript:getBillboard() or nil
local a=32
if towerBilboard:getString("Name") ~= "Wall tower" and buildingBillBoard and buildingBillBoard:getString("Name") == "Wall tower" and buildingBillBoard:getBool("isNetOwner")==true then
canBePlacedHere = true
local currentMatrix = towerMatrix
towerMatrix = building:getGlobalMatrix()
--Rotate the tower in 90 degrees interval
local dotRightValue = towerMatrix:getRightVec():dot(currentMatrix:getAtVec())
if dotRightValue > 0.5 then
towerMatrix:createMatrix( towerMatrix:getRightVec(), towerMatrix:getUpVec() )
elseif dotRightValue < -0.5 then
towerMatrix:createMatrix( -towerMatrix:getRightVec(), towerMatrix:getUpVec() )
elseif towerMatrix:getAtVec():dot(-currentMatrix:getAtVec()) > 0.0 then
towerMatrix:createMatrix( -towerMatrix:getAtVec(), towerMatrix:getUpVec() )
end
towerMatrix:setPosition(building:getGlobalPosition())
local wallTowerScript = building:getScriptByName("tower")
--Get the cost of the wall tower
local wallTowerCost = wallTowerScript:getBillboard():getFloat("cost")
--update this specific tower location cost
buildCost = buildCost - wallTowerCost
if keyUse and keyUse:getPressed() and buildCost <= gold then
--upgrade the building
-- AutoBuilder.changeBuilding(building, currentTower, building:findNodeByTypeTowardsRoot(NodeId.island):getGlobalMatrix():inverseM() * towerMatrix )
local newBuildingMatrix = building:getParent():getGlobalMatrix():inverseM() * towerMatrix
local curentName = wallTowerScript:getNetworkName()
local tab = {buildTowerIndex=currentTowerIndex, netName=buildingScript:getNetworkName(), matrix=newBuildingMatrix, tName=getNewTowerName()}
local buildingScript = currentTower:getScriptByName("tower")
--get the cost of the new tower
local buildingCost = buildingScript:getBillboard():getFloat("cost")
--get the script file name
local scriptName = buildingScript:getFileName()
upgradeFromTowerToTower(building, buildingCost, scriptName, newBuildingMatrix, tab.tName, true)
readyToPlay[0] = true
readyToPlay[Core.getPlayerId()] = true
updateIsAllreadyToPlay()
if Core.isInMultiplayer() then
tab.playerId = Core.getPlayerId()
comUnit:sendNetworkSyncSafe("NETWU",tabToStrMinimal(tab))
else
local buildData = {curentName, buildingCost, scriptName, newBuildingMatrix, tab.tName, true}
local downGradeData = {netName = tab.tName, upgToScripName = "Tower/WallTower.lua", tName = tab.netName, playerId = Core.getPlayerId(), buildCost=0}
towerBuildInfo[#towerBuildInfo+1] = {wave=curentWave,cost=0,buildTimeFromBeginingOfWave = (Core.getGameTime()-waveTime),add={para1=buildData,func=3},restore={para1=downGradeData,func=upgradeWallTower,name="WallTowerupgrade"}}
end
if targetAreaName == "cone" then
changeSelectedTower(nil)
end
end
end
end
end
--set tower color
builderFunctions.changeColor( currentTower, (canBePlacedHere and buildCost <= gold) and Vec4(1) or Vec4(1.3,0.45,0.45, 1.0))
if this:getTargetIsland() and currentTower then
currentTower:setLocalMatrix(towerMatrix);
towerWorld:update();
end
if currentTower and buildCost > gold then
local screenPos = camera:getScreenCoordFromglobalPos(currentTower:getLocalPosition() + Vec3(0,1.0,0))
noMoneyIcon:setVisible(true)
noMoneyIcon:setLocalPosition(screenPos)
else
noMoneyIcon:setVisible(false)
end
--Render target area
builderFunctions.renderTargetArea(targetAreaName, towerMatrix, towerBilboard)
if currentTower then
currentTower:setVisible(true)
end
else
noMoneyIcon:setVisible(false)
builderFunctions.renderTargetArea("",nil,nil)
if currentTower then
currentTower:setVisible(false)
end
end
if camera and Core.getInput():getMouseDown(MouseKey.left) then
local building = this:getBuldingFromLine(camera:getWorldLineFromScreen(Core.getInput():getMousePos()))
if building then
print("found a building\n")
end
end
-- AutoBuilder.update()
return true
end
|
player_manager.AddValidModel( "PMC5_08", "models/player/PMC_5/PMC__08.mdl" ) list.Set( "PlayerOptionsModel", "PMC5_08", "models/player/PMC_5/PMC__08.mdl" )
|
-- Generated By protoc-gen-lua Do not Edit
local protobuf = require "protobuf"
module('BseConfigData_pb', package.seeall)
local BSECONFIGDATA = protobuf.Descriptor();
local BSECONFIGDATA_VERSION_FIELD = protobuf.FieldDescriptor();
BSECONFIGDATA_VERSION_FIELD.name = "version"
BSECONFIGDATA_VERSION_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseConfigData.version"
BSECONFIGDATA_VERSION_FIELD.number = 1
BSECONFIGDATA_VERSION_FIELD.index = 0
BSECONFIGDATA_VERSION_FIELD.label = 2
BSECONFIGDATA_VERSION_FIELD.has_default_value = false
BSECONFIGDATA_VERSION_FIELD.default_value = 0
BSECONFIGDATA_VERSION_FIELD.type = 5
BSECONFIGDATA_VERSION_FIELD.cpp_type = 1
BSECONFIGDATA.name = "BseConfigData"
BSECONFIGDATA.full_name = ".com.xinqihd.sns.gameserver.proto.BseConfigData"
BSECONFIGDATA.nested_types = {}
BSECONFIGDATA.enum_types = {}
BSECONFIGDATA.fields = {BSECONFIGDATA_VERSION_FIELD}
BSECONFIGDATA.is_extendable = false
BSECONFIGDATA.extensions = {}
BseConfigData = protobuf.Message(BSECONFIGDATA)
_G.BSECONFIGDATA_PB_BSECONFIGDATA = BSECONFIGDATA
|
---------------------------------------------------------------------
-- Manage collection and display of minimap buttons
---------------------------------------------------------------------
local _, ns = ...
local LSM = LibStub and LibStub:GetLibrary("LibSharedMedia-3.0", true)
local FONT = LSM:Fetch(LSM.MediaType.FONT, "Roboto Bold Condensed")
local TEXTURE = LSM:Fetch(LSM.MediaType.STATUSBAR, "Flat")
local DEFAULT_BUTTON_SIZE = 24
local DEFAULT_BUTTON_POSITION = "Bottom"
local DEFAULT_MOUSEOVER_BUTTON_FRAME = true
-- Add a border to the minimap.
-- This is done early so that frames may be positioned against it.
Minimap.background = CreateFrame("frame", "klnMinimap", UIParent)
Minimap.background:SetPoint("CENTER", Minimap, "CENTER", 0, 0)
Minimap.background:SetBackdrop({
bgFile = TEXTURE,
edgeFile = TEXTURE,
edgeSize = 2,
})
Minimap.background:SetBackdropColor(0,0,0,0)
Minimap.background:SetBackdropBorderColor(0,0,0,1)
-- Target existing frames/textures for manipulation
local ignoredFrames = {}
local hideTextures = {}
local manualTarget = {}
manualTarget['MiniMapMailFrame'] = true
ignoredFrames['MinimapBackdrop'] = true
ignoredFrames['GameTimeFrame'] = true
ignoredFrames['MinimapVoiceChatFrame'] = true
ignoredFrames['TimeManagerClockButton'] = true
hideTextures['Interface\\Minimap\\MiniMap-TrackingBorder'] = true
hideTextures['Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight'] = true
hideTextures['Interface\\Minimap\\UI-Minimap-Background'] = true
-- Create a frame for storing minimap buttons
Minimap.buttonFrame = CreateFrame("frame", nil, Minimap)
Minimap.buttonFrame:SetHeight(DEFAULT_BUTTON_SIZE + 10)
Minimap.buttonFrame:SetPoint("TOPLEFT", Minimap.background, "BOTTOMLEFT", 2, -4)
Minimap.buttonFrame:SetPoint("BOTTOMRIGHT", Minimap.background, "BOTTOMRIGHT", 0, -28)
Minimap.buttonFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
Minimap.buttonFrame:RegisterEvent("GARRISON_UPDATE")
Minimap.buttonFrame:RegisterEvent("PLAYER_XP_UPDATE")
Minimap.buttonFrame:RegisterEvent("PLAYER_LEVEL_UP")
Minimap.buttonFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
Minimap.buttonFrame:RegisterEvent("UPDATE_FACTION")
-- Create a minimap button for kln-related configuration
local klnConfigButton = CreateFrame("button","kln_config_button", Minimap.buttonFrame)
klnConfigButton.text = klnConfigButton:CreateFontString(nil, "OVERLAY")
klnConfigButton.text:SetFont(FONT, 14)
klnConfigButton.text:SetTextColor(.4, .6, 1)
klnConfigButton.text:SetText("kln")
klnConfigButton.text:SetJustifyH("CENTER")
klnConfigButton.text:SetPoint("CENTER", klnConfigButton, "CENTER", 1, -1)
klnConfigButton:SetScript("OnEnter", function(self)
self.text:SetTextColor(.6,.8,1)
ShowUIPanel(GameTooltip)
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 6)
GameTooltip:AddLine("KLN Configuration (eventually)")
GameTooltip:Show()
end)
klnConfigButton:SetScript("OnLeave", function(self)
self.text:SetTextColor(.4, .6, 1)
GameTooltip:Hide()
end)
klnConfigButton:SetScript("OnClick", function()
kln.events:Trigger("show_configuration")
end)
-- Show/hide button container on mouseover
local function MinimapMouseover()
local mouseoverButtonFrame = DEFAULT_MOUSEOVER_BUTTON_FRAME
if not mouseoverButtonFrame then
Minimap.buttonFrame:Show();
return true
end
local over = false
if Minimap:IsMouseOver() then over = true end
if Minimap.background:IsMouseOver() then over = true end
if Minimap.buttonFrame:IsMouseOver() then over = true end
if klnXP and klnXP:IsMouseOver() then over = true end
if klnAP and klnAP:IsMouseOver() then over = true end
if (over) then
Minimap.buttonFrame:Show()
else
Minimap.buttonFrame:Hide()
end
return over
end
-- Begin polling for mouseover
local mtotal = 0
Minimap:HookScript("OnUpdate",function(self, elapsed)
mtotal = mtotal + elapsed
if mtotal > .05 then
mtotal = 0;
MinimapMouseover()
end
end)
-- Collect minimap buttons and place them into a frame
local function collectMinimapButtons()
if (InCombatLockdown()) then return end
local buttons = DEFAULT_BUTTON_POSITION
if buttons == "Disable" then return end
-- Stick our "open the configuration" button into the collection
ignoredFrames["kln_config_button"] = nil
klnConfigButton:Show()
local c = {Minimap.buttonFrame:GetChildren()}
local d = {Minimap:GetChildren()}
for _, v in pairs(d) do table.insert(c,v) end
table.insert(c, _G["DugisOnOffButton"]) -- Yay special case
local button_size = DEFAULT_BUTTON_SIZE
local last = nil
for i = 1, #c do
local f = c[i]
local n = f:GetName() or "";
local lc = string.lower(n)
if (manualTarget[n] and f:IsShown()) or (
f:GetName() and
f:IsShown() and
(strfind(lc, "libdb") or strfind(lc, "button") or strfind(lc, "btn")) and
not ignoredFrames[n]
) then
if not f.skinned then
f:SetSize(button_size, button_size)
f:SetParent(Minimap.buttonFrame)
local r = {f:GetRegions()}
for o = 1, #r do
if r[o].GetTexture and r[o]:GetTexture() then
local tex = r[o]:GetTexture()
r[o]:SetAllPoints(f)
if hideTextures[tex] then
r[o]:Hide()
elseif not strfind(tex,"WHITE8x8") then
local coord = table.concat({r[o]:GetTexCoord()})
if (coord == "00011011") then
r[o]:SetTexCoord(0.3, 0.7, 0.3, 0.7)
if (n == "DugisOnOffButton") then
r[o]:SetTexCoord(0.25, 0.75, 0.2, 0.7)
end
end
end
end
end
f.klnBackground = f.klnBackground or CreateFrame("frame",nil,f)
f.klnBackground:SetAllPoints(f)
f.klnBackground:SetFrameStrata("BACKGROUND")
kln.frames.setBackdrop(f.klnBackground)
f:SetHitRectInsets(0, 0, 0, 0)
local oldscript =
f:HookScript("OnEnter",function(self)
local newlines = {}
for l = 1, 10 do
local line = _G["GameTooltipTextLeft"..l]
if line and line:GetText() then
newlines[line:GetText()] = true
end
end
GameTooltip:Hide()
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 6)
for k, v in pairs(newlines) do
GameTooltip:AddLine(k)
end
GameTooltip:Show()
end)
f.skinned = true
end
f:ClearAllPoints()
if buttons == "Top" or buttons == "Bottom" then
if last then
f:SetPoint("LEFT", last, "RIGHT", 6, 0)
else
f:SetPoint("TOPLEFT", Minimap.buttonFrame, "TOPLEFT", 0, 0)
end
end
if (buttons == "Right" or buttons == "Left") then
if (last) then
f:SetPoint("TOP", last, "BOTTOM", 0, -6)
else
f:SetPoint("TOPLEFT", Minimap.buttonFrame, "TOPLEFT", 0, 0)
end
end
last = f
end
end
end
-- Begin polling for minimap button collection
local ctotal = 0
Minimap.buttonFrame:SetScript("OnEvent",moveMinimapButtons)
Minimap.buttonFrame:SetScript("OnUpdate",function(self,elapsed)
ctotal = ctotal + elapsed
if ctotal > .5 then
ctotal = 0
if not InCombatLockdown() then
collectMinimapButtons()
end
end
end)
|
// Wildfire Black Mesa Roleplay
// File description: BMRP developer functionality script
// Copyright (c) 2022 KiwifruitDev
// Licensed under the MIT License.
//*********************************************************************************************
// 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.
//*********************************************************************************************
// BASE FILE HEADER DO NOT MODIFY!! //
local ent = FindMetaTable("Entity") //
local ply = FindMetaTable("Player") //
local vec = FindMetaTable("Vector") //
// ================================ //
// Every file needs this :)
include("autorun/sh_bmrp.lua")
// DEVELOPER FUNCTIONS/COMMANDS, ONLY WORKS IF YOU ARE SET IN THE TABLE //
// Force a payday upon yourself.
concommand.Add("dev_payday", function(ply)
if not ply:IsDeveloper() then return end
if not IsValid(ply) then return end
if ply:IsDeveloper() then
ply:payDay()
end
end)
// Forces yourself into a spectator mode/un-spectator mode.
concommand.Add("dev_roam", function(ply, cmd, args)
if ply:IsDeveloper() then
if ply:GetObserverMode() ~= OBS_MODE_ROAMING then
ply:Spectate(OBS_MODE_ROAMING) // This makes the player a spectator.
else
ply:UnSpectate() // This makes the player a player.
end
end
end)
// Force teleport yourself to a known Map Creation ID.
concommand.Add("dev_gotomcid", function( ply, cmd, args )
if not ply:IsDeveloper() then return end
if IsValid(ply) then
if args[1] ~= nil then
local mcid = args[1]
local ent = ents.GetMapCreatedEntity(mcid)
if IsValid(ent) then
ply:SetPos(ent:GetPos())
ply:ChatPrint("Teleporting to "..mcid.."...")
else
ply:ChatPrint("Invalid entity! "..mcid)
end
end
end
end)
// RESETS EVERY SINGLE DOOR IN THE MAP TO UNOWNABLE. BE CAUTIOUS.
concommand.Add("dev_resetdoors", function(ply, cmd, args)
if not ply:IsDeveloper() then return end
local doors = ents.FindByClass("func_door")
local doors2 = ents.FindByClass("func_door_rotating")
local alldoors = {}
table.Add(alldoors, doors)
table.Add(alldoors, doors2)
for k,v in pairs(alldoors) do
if IsValid(v:getDoorOwner()) then
v:keysUnOwn(v:getDoorOwner())
end
v:setKeysNonOwnable(true)
v:removeAllKeysExtraOwners()
v:removeAllKeysAllowedToOwn()
v:removeAllKeysDoorTeams()
v:setDoorGroup(nil)
v:setKeysTitle(nil)
DarkRP.storeDoorData(v)
DarkRP.storeDoorGroup(v, nil)
DarkRP.storeTeamDoorOwnability(v)
end
hook.Run("SystemMessage", v, "", "Doors have been reset.")
end)
// Displays every piece of entity info for whatever you're looking at.
concommand.Add("dev_entinfo", function( ply, cmd, args )
if not ply:IsDeveloper() then return end
if IsValid(ply) then
local eyetrace = ply:GetEyeTrace()
if eyetrace ~= nil then
if eyetrace.Entity ~= nil then
ply:ChatPrint("Name: "..eyetrace.Entity:GetName())
ply:ChatPrint("Classname: "..eyetrace.Entity:GetClass())
ply:ChatPrint("Model: "..eyetrace.Entity:GetModel())
ply:ChatPrint("Map Creation ID: "..eyetrace.Entity:MapCreationID())
local pos = eyetrace.Entity:GetPos()
ply:ChatPrint("Position: "..pos.x..", "..pos.y..", "..pos.z)
local ang = eyetrace.Entity:GetAngles()
ply:ChatPrint("Angle: "..ang.p..", "..ang.y..", "..ang.r)
local hit = eyetrace.HitPos
ply:ChatPrint("Hit Position: "..hit.x..", "..hit.y..", "..hit.z)
local normal = eyetrace.HitNormal
ply:ChatPrint("Normal: "..normal.x..", "..normal.y..", "..normal.z)
end
end
end
end)
// Gets all entities in range of you.
concommand.Add("dev_getents", function( ply, cmd, args )
if not ply:IsDeveloper() then return end
if IsValid(ply) then
local eyetrace = ply:GetEyeTrace()
if eyetrace ~= nil then
if eyetrace.Entity ~= nil then
local ent = eyetrace.Entity
local ents = ents.FindInSphere(ent:GetPos(), 100)
for k,v in pairs(ents) do
if IsValid(v) then
ply:ChatPrint("Name: "..v:GetName())
ply:ChatPrint("Classname: "..v:GetClass())
ply:ChatPrint("Map Creation ID: "..v:MapCreationID())
end
end
end
end
end
end)
// Force sets your first position for the bounds tool.
concommand.Add( "dev_pos1", function( ply, cmd, args )
if not IsValid(ply) then return end
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
if wep:GetClass() ~= "weapon_bounds" then return end
wep:SetStartPos(ply:EyePos())
end)
// Force sets your second position for the bounds tool.
concommand.Add( "dev_pos2", function( ply, cmd, args )
if not IsValid(ply) then return end
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
if wep:GetClass() ~= "weapon_bounds" then return end
wep:SetManual(true)
local ent = wep:GetBoundingBox()
if not IsValid(ent) then return end
local shootpos = ply:EyePos()
local startpos = wep:GetStartPos()
ent:SetCollisionBoundsWS(startpos, shootpos)
end)
// Teleport yourself to certain Vectors on the map.
// usage: dev_goto <vector> <vector> <vector>
concommand.Add("dev_goto", function( ply, cmd, args )
if not ply:IsDeveloper() then return end
if !IsValid( ply ) then return end
if !ply:IsPlayer() then return end
if !ply:Alive() then return end
local pos = Vector(tonumber(args[1]) or 0, tonumber(args[2]) or 0, tonumber(args[3]) or 0)
ply:SetPos(pos)
end)
// Used to select a Staff door.
concommand.Add("door_select", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local ent = ply:GetEyeTrace().Entity
if not IsValid(ent) then return end
if ent:GetClass() ~= "lab_door" then
ply:ChatPrint("That is not a valid door!")
return
end
ply:SetNWEntity("SelectedDoor", ent)
ply:ChatPrint("Selected targetted door...")
end)
// Used to clear a staff door.
concommand.Add("door_clear", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
ply:SetNWEntity("SelectedDoor", Entity(1))
ply:ChatPrint("Unselected any targetted doors!")
end)
// Used to set the position of a staff door.
concommand.Add("door_setpos", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local ent = ply:GetNWEntity("SelectedDoor")
if not IsValid(ent) then
ply:ChatPrint("No door selected!")
return
end
local pos = ply:GetPos()
local ang = ply:GetAngles()
ent:SetTeleportEnt(pos)
ent:SetTeleportEnt2(ang)
ply:ChatPrint("Set position of selected door to "..pos.x.." "..pos.y.." "..pos.z.." ".." and angles to "..ang.p.." "..ang.y.." "..ang.r)
end)
// Used to create an entity without sv_cheats
concommand.Add("dev_create", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local enti = ents.Create(args[1])
if not IsValid(enti) then return end
enti:SetPos(ply:GetEyeTrace().HitPos)
enti:Spawn()
enti:Activate()
--enti:CPPISetOwner(ply)
DarkRP.notify(ply, 0, 4, "Created "..enti:GetClass())
end)
// create prop_physics
concommand.Add("dev_prop", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local enti = ents.Create("prop_physics")
if not IsValid(enti) then return end
enti:SetPos(ply:GetEyeTrace().HitPos)
enti:SetModel(args[1] or "models/helios/foilage/pine.mdl")
enti:Spawn()
enti:Activate()
--enti:CPPISetOwner(ply)
DarkRP.notify(ply, 0, 4, "Created "..enti:GetClass())
end)
// Used to get the keyvalues of an entity classname
concommand.Add("dev_kv", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
for k,v in pairs(ents.FindByClass(args[1])) do
if v.ClassName == args[1] then
PrintTable(v:GetKeyValues())
end
end
ply:ChatPrint("Printed keyvalues of "..args[1]..".")
end)
// Used to show rubble without activating a cascade
concommand.Add("dev_rubble", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
for k,v in pairs(ents.FindByClass("bmrp_rubble")) do
v:Fire("Visualize")
v:Fire("Reset")
end
end)
// Used to drop an entity to the floor
concommand.Add("dev_drop", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local ent = ply:GetEyeTrace().Entity
if not IsValid(ent) then return end
ent:DropToFloor()
end)
// Give yourself an HEV suit
concommand.Add("dev_hev", function(ent, cmd, args)
if not IsValid(ent) then return end
if not ent:IsDeveloper() then return end
if ent:GetModel() == "models/motorhead/hevscientist.mdl" then
ent:RemoveSuit()
local lgm = ent:GetNWString("LastGoodModel")
if lgm == "" or lgm == nil then
local jobtable = ent:getJobTable()
lgm = jobtable.model
end
ent:SetModel(lgm)
ent:SetNWString("LastGoodModel","")
DarkRP.notify(ent, 0, 4, "[DEV] Removed HEV suit.")
else
ent:SetNWString("LastGoodModel",ent:GetModel())
ent:SetModel("models/motorhead/hevscientist.mdl")
ent:EquipSuit()
DarkRP.notify(ent, 0, 4, "[DEV] Equipped HEV suit.")
end
end)
// Suck everyone into lambda core
concommand.Add("dev_lambda", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
SetGlobalBool("SuckEveryoneIntoLambdaCore", not GetGlobalBool("SuckEveryoneIntoLambdaCore"))
if GetGlobalBool("SuckEveryoneIntoLambdaCore") then
DarkRP.notify(ply, 0, 4, "[DEV] Everyone is now being sucked into the Lambda Core.")
else
DarkRP.notify(ply, 0, 4, "[DEV] Everyone is no longer being sucked into the Lambda Core.")
end
end)
// unparent entity you're looking at
concommand.Add("dev_unparent", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local ent = ply:GetEyeTrace().Entity
if not IsValid(ent) then return end
ent:SetParent(nil)
-- take ownership
ent:CPPISetOwner(ply)
end)
// clean crystal in front of you
concommand.Add("dev_clean", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local ent = ply:GetEyeTrace().Entity
if not IsValid(ent) then return end
if not ent.Clean then return end
ent:Clean()
end)
// clean crystal in front of you
concommand.Add("dev_fix", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local ent = ply:GetEyeTrace().Entity
if not IsValid(ent) then return end
if not ent.SetBroken then return end
ent:SetBroken(false)
end)
// This turns off the lights without triggering any other event.
concommand.Add("dev_lightsoff", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
LightsOff()
end)
// This turns on the lights without triggering any other event.
concommand.Add("dev_lightson", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
LightsOn()
end)
// cycle crystal type
concommand.Add("dev_cycle", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local ent = ply:GetEyeTrace().Entity
if not IsValid(ent) then return end
if not ent:GetClass() == "xen_crystal" then return end
if not ent.CrystalTypes then return end
local type = ent:GetCrystalType()
for k,v in pairs(ent.CrystalTypes) do
local typetable
if k >= #ent.CrystalTypes then
typetable = ent.CrystalTypes[1]
elseif v[1] == type then
typetable = ent.CrystalTypes[k+1]
end
if typetable then
ent:PhysicsInit(SOLID_VPHYSICS)
ent:SetRenderMode(RENDERMODE_NORMAL)
ent:SetRenderFX(kRenderFxNone)
ent:SetCrystalType(typetable[1])
ent:SetCrystalEffect(typetable[3])
ent:SetColor(typetable[2])
break
end
end
DarkRP.notify(ply, 0, 4, "[DEV] Crystal type changed to "..ent:GetCrystalType()..".")
end)
concommand.Add("ams_check", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
ply:ChatPrint(GetGlobalBool("ams_shutdown", false) and "ams_shutdown is true" or "ams_shutdown is false")
ply:ChatPrint(GetGlobalBool("ams_open", false) and "ams_open is true" or "ams_open is false")
ply:ChatPrint(GetGlobalBool("AMSLaserPoll", false) and "AMSLaserPoll is true" or "AMSLaserPoll is false")
ply:ChatPrint(GetGlobalBool("ResonanceCascade", false) and "ResonanceCascade is true" or "ResonanceCascade is false")
end)
// ent_fire basically
concommand.Add("dev_fire", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local ent = ply:GetEyeTrace().Entity
if not IsValid(ent) then return end
ent:Fire(args[1])
end)
-- for k, v in pairs(ents.FindByClass("squidspit")) do v:Remove() end
concommand.Add("server_restartwarning", function(ply, cmd, args)
if IsValid(ply) then return end -- only run from server
local newdelay = tonumber(args[1]) or 1800 -- 30 minutes
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "The server is restarting in "..newdelay.." seconds.")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
timer.Simple(newdelay-600, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Restarting in the server in 10 minutes...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay-300, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Restarting in the server in 5 minutes...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay-60, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Restarting in the server in 1 minute...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay-30, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Restarting in the server in 30 seconds...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay-10, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Restarting in the server in 10 seconds...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay-5, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Restarting in the server in 5 seconds...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay, function()
timer.Remove("RestartNukeTimer")
SetGlobalString("NukeText", "")
SetGlobalBool("NukeEvent", false)
end)
timer.Create("RestartNukeTimer", 1/(1 / engine.TickInterval()), newdelay*(1 / engine.TickInterval()), function()
newdelay = newdelay - 1/(1 / engine.TickInterval())
SetGlobalInt("NukeTimer", newdelay)
end)
SetGlobalBool("NukeEvent", true)
SetGlobalString("NukeText", "Server Restart:")
end)
concommand.Add("server_updatewarning", function(ply, cmd, args)
if IsValid(ply) then return end -- only run from server
local newdelay = tonumber(args[1]) or 600 -- 10 minutes
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "The server is changing level for a major update in "..newdelay.." seconds.")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
timer.Simple(newdelay-300, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Changing level for an update in 5 minutes...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay-60, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Changing level for an update in 1 minute...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay-30, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Changing level for an update in 30 seconds...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay-10, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Changing level for an update in 10 seconds...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay-5, function()
for k, v in pairs(player.GetAll()) do
hook.Run("SystemMessage", v, "", "Changing level for an update in 5 seconds...")
v:SendLua("surface.PlaySound(\"ambient/alarms/klaxon1.wav\")")
end
end)
timer.Simple(newdelay, function()
timer.Remove("UpdateNukeTimer")
SetGlobalString("NukeText", "")
SetGlobalBool("NukeEvent", false)
RunConsoleCommand("changelevel", game.GetMap())
end)
timer.Create("UpdateNukeTimer", 1/(1 / engine.TickInterval()), newdelay*(1 / engine.TickInterval()), function()
newdelay = newdelay - 1/(1 / engine.TickInterval())
SetGlobalInt("NukeTimer", newdelay)
end)
SetGlobalBool("NukeEvent", true)
SetGlobalString("NukeText", "Server Update Level Change:")
end)
-- locations / bounding boxes
concommand.Add("bounds_setlocation", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
if #args < 1 then return end
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
if wep:GetClass() ~= "weapon_bounds" then return end
local ent = wep:GetBoundingBox()
if not IsValid(ent) then
ent = ply:GetNWEntity("BoundingBox")
end
ent:SetLocation(table.concat(args, " "))
ent:SetGeneric(false)
DarkRP.notify(ply, 0, 4, "Location set to "..table.concat(args, " ")..".")
end)
concommand.Add("bounds_select", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
if wep:GetClass() ~= "weapon_bounds" then return end
-- get entities in range (bounding_box)
local ents = ents.FindInSphere(ply:GetPos(), 1000)
for k, v in pairs(ents) do
if LocalToWorld(v:OBBCenter(), Angle(0,0,0), v:GetPos(), Angle(0,0,0)):Distance(ply:EyePos()) <= 100 then
if v:GetClass() == "bounding_box" then
ply:SetNWEntity("BoundingBox", v)
DarkRP.notify(ply, 0, 4, "Bounding box selected. "..v:GetLocation())
return
end
end
end
end)
concommand.Add("bounds_staff", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
if wep:GetClass() ~= "weapon_bounds" then return end
local ent = wep:GetBoundingBox()
if not IsValid(ent) then
ent = ply:GetNWEntity("BoundingBox")
end
ent:SetStaff(ent:GetStaff() == true and false or true)
DarkRP.notify(ply, 0, 4, ent:GetStaff() and "Staff check set to true." or "Staff check set to false.")
end)
concommand.Add("bounds_save", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
if not PermaProps then DarkRP.notify(ply, 1, 4, "ERROR: Lib not found" ) return end
for k, ent in pairs(ents.FindByClass("bounding_box")) do
if not IsValid(ent) then continue end
local mins, maxs = ent:WorldSpaceAABB()
ent:SetBoundsPos1X(mins.x)
ent:SetBoundsPos1Y(mins.y)
ent:SetBoundsPos1Z(mins.z)
ent:SetBoundsPos2X(maxs.x)
ent:SetBoundsPos2Y(maxs.y)
ent:SetBoundsPos2Z(maxs.z)
// permaprops API
if ent.PermaProps then continue end
mins, maxs = ent:GetCollisionBounds()
local content = PermaProps.PPGetEntTable(ent)
if not content then continue end
local max = tonumber(sql.QueryValue("SELECT MAX(id) FROM permaprops;"))
if not max then max = 1 else max = max + 1 end
local new_ent = PermaProps.PPEntityFromTable(content, max)
if !new_ent or !new_ent:IsValid() then continue end
PermaProps.SparksEffect( ent )
PermaProps.SQL.Query("INSERT INTO permaprops (id, map, content) VALUES(NULL, ".. sql.SQLStr(game.GetMap()) ..", ".. sql.SQLStr(util.TableToJSON(content)) ..");")
DarkRP.notify(ply, 0, 4, "Bounding box saved via PermaProps.")
ent:Remove()
new_ent:SetCollisionBounds(mins, maxs)
end
end)
concommand.Add("bounds_delete", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
if wep:GetClass() ~= "weapon_bounds" then return end
local ent = wep:GetBoundingBox()
if not IsValid(ent) then
ent = ply:GetNWEntity("BoundingBox")
end
// permaprops API
if not PermaProps then DarkRP.notify(ply, 1, 4, "ERROR: Lib not found" ) return end
if not ent.PermaProps then ply:ChatPrint( "That is not a PermaProp!" ) return end
if not ent.PermaProps_ID then ply:ChatPrint( "ERROR: ID not found" ) return end
PermaProps.SQL.Query("DELETE FROM permaprops WHERE id = ".. ent.PermaProps_ID ..";")
DarkRP.notify(ply, 0, 4, "Bounding box deleted via PermaProps.")
ent:Remove()
end)
--[[
concommand.Add("bounds_deleteall", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
if wep:GetClass() ~= "weapon_bounds" then return end
for k, ent in pairs(ents.FindByClass("bounding_box")) do
if not IsValid(ent) then continue end
// permaprops API
if not PermaProps then continue end
if not ent.PermaProps then continue end
if not ent.PermaProps_ID then continue end
PermaProps.SQL.Query("DELETE FROM permaprops WHERE id = ".. ent.PermaProps_ID ..";")
ent:Remove()
end
DarkRP.notify(ply, 0, 4, "All Bounding boxes deleted via PermaProps.")
end)
]]--
-- priority
concommand.Add("bounds_priority", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
if wep:GetClass() ~= "weapon_bounds" then return end
local ent = wep:GetBoundingBox()
if not IsValid(ent) then
ent = ply:GetNWEntity("BoundingBox")
end
ent:SetPriority(tonumber(args[1]) or 0)
DarkRP.notify(ply, 0, 4, "Priority set to "..args[1]..".")
end)
-- get every wire convar (sbox_max*) and set them to 0 //
local wireconvars = {
"sbox_maxwire_deployers",
"sbox_maxwire_wheels",
"sbox_maxwire_weights",
"sbox_maxwire_waypoints",
"sbox_maxwire_watersensors",
"sbox_maxwire_vectorthrusters",
"sbox_maxwire_vehicles",
"sbox_maxwire_values",
"sbox_maxwire_users",
"sbox_maxwire_twoway_radios",
"sbox_maxwire_turrets",
"sbox_maxwire_triggers",
"sbox_maxwire_trails",
"sbox_maxwire_thrusters",
"sbox_maxwire_textscreens",
"sbox_maxwire_textreceivers",
"sbox_maxwire_textentrys",
"sbox_maxwire_teleporters",
"sbox_maxwire_target_finders",
"sbox_maxwire_spus",
"sbox_maxwire_speedometers",
"sbox_maxwire_spawners",
"sbox_maxwire_soundemitters",
"sbox_maxwire_simple_explosives",
"sbox_maxwire_sensors",
"sbox_maxwire_screens",
"sbox_maxwire_relays",
"sbox_maxwire_rangers",
"sbox_maxwire_radios",
"sbox_maxwire_pods",
"sbox_maxwire_sockets",
"sbox_maxwire_plugs",
"sbox_maxwire_pixels",
"sbox_maxwire_outputs",
"sbox_maxwire_oscilloscopes",
"sbox_maxwire_numpads",
"sbox_maxwire_nailers",
"sbox_maxwire_motors",
"sbox_maxwire_locators",
"sbox_maxwire_lights",
"sbox_maxwire_levers",
"sbox_maxwire_latchs",
"sbox_maxwire_las_receivers",
"sbox_maxwire_lamps",
"sbox_maxwire_keypads",
"sbox_maxwire_keyboards",
"sbox_maxwire_inputs",
"sbox_maxwire_indicators",
"sbox_maxwire_igniters",
"sbox_maxwire_hydraulics",
"sbox_maxwire_hudindicators",
"sbox_maxwire_hoverballs",
"sbox_maxwire_hologrids",
"sbox_maxwire_holoemitters",
"sbox_maxwire_hdds",
"sbox_maxwire_gyroscopes",
"sbox_maxwire_graphics_tablets",
"sbox_maxwire_grabbers",
"sbox_maxwire_gpulib_controllers",
"sbox_maxwire_gpus",
"sbox_maxwire_gpss",
"sbox_maxwire_gimbals",
"sbox_maxwire_gates",
"sbox_maxwire_fx_emitters",
"sbox_maxwire_friendslists",
"sbox_maxwire_freezers",
"sbox_maxwire_forcers",
"sbox_maxwire_eyepods",
"sbox_maxwire_extbuss",
"sbox_maxwire_expressions",
"sbox_maxwire_explosives",
"sbox_maxwire_exit_points",
"sbox_maxwire_emarkers",
"sbox_maxwire_egps",
"sbox_maxwire_dynamic_buttons",
"sbox_maxwire_dual_inputs",
"sbox_maxwire_digitalscreens",
"sbox_maxwire_dhdds",
"sbox_maxwire_detonators",
"sbox_maxwire_datarates",
"sbox_maxwire_dataports",
"sbox_maxwire_datasockets",
"sbox_maxwire_dataplugs",
"sbox_maxwire_data_transferers",
"sbox_maxwire_data_stores",
"sbox_maxwire_data_satellitedishs",
"sbox_maxwire_damage_detectors",
"sbox_maxwire_cpus",
"sbox_maxwire_consolescreens",
"sbox_maxwire_colorers",
"sbox_maxwire_clutchs",
"sbox_maxwire_cd_locks",
"sbox_maxwire_cd_rays",
"sbox_maxwire_cd_disks",
"sbox_maxwire_cameracontrollers",
"sbox_maxwire_buttons",
"sbox_maxwire_adv_inputs",
"sbox_maxwire_adv_emarkers",
"sbox_maxwire_addressbuss",
}
concommand.Add("dev_doublewireconvars", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
for k,v in pairs(wireconvars) do
local cvar = GetConVar(v)
if cvar then
cvar:SetInt(cvar:GetInt() * 2)
ply:ChatPrint(v.." \""..cvar:GetInt().."\"")
end
end
end)
-- name entity in front of player
concommand.Add("dev_name", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local tr = ply:GetEyeTrace()
if not tr.Hit then return end
local ent = tr.Entity
if not IsValid(ent) then return end
ent:SetName(args[1])
end)
function byedoor(ent, ply)
if not IsValid(ent) then return false end
if ent:GetClass() ~= "func_door" and ent:GetClass() ~= "func_door_rotating" then return false end
ent:SetSolid(SOLID_NONE)
ent:SetNoDraw(true)
ent:Fire("Disable")
local newphysprop = ents.Create("prop_physics")
newphysprop:SetModel(ent:GetModel())
newphysprop:SetPos(ent:GetPos())
newphysprop:SetAngles(ent:GetAngles())
newphysprop:Spawn()
newphysprop:PhysicsInit(SOLID_VPHYSICS)
newphysprop:CPPISetOwner(ply)
local phys = newphysprop:GetPhysicsObject()
if IsValid(phys) then
phys:SetVelocity(ply:GetForward() * -1000)
end
local explosion = ents.Create("env_explosion")
explosion:SetPos(ent:GetPos())
explosion:Spawn()
explosion:SetKeyValue("iMagnitude", "0")
explosion:Fire("Explode", 0, 0)
timer.Simple(10, function()
if IsValid(newphysprop) then
newphysprop:Remove()
end
if IsValid(ent) then
ent:SetSolid(SOLID_BSP)
ent:SetNoDraw(false)
ent:Fire("Enable")
end
end)
return true
end
-- BLOW UP THE DOOR IN FRONT OF YOU
concommand.Add("dev_byedoor", function(ply, cmd, args)
if not IsValid(ply) then return end
if not ply:IsDeveloper() then return end
local tr = ply:GetEyeTrace()
if not tr.Hit then return end
local done = false
for _, ent in pairs(ents.FindInSphere(tr.HitPos, 150)) do
if done == true then
byedoor(ent, ply)
else
done = byedoor(ent, ply)
end
end
if not done then
if IsValid(tr.Entity) then
byedoor(tr.Entity, ply)
end
end
end)
|
--@ componenttypes
-- Drive maintainer module
DriveMaintainer = {}
function DriveMaintainer.new(Direction)
local self = {}
if Direction then
self.Direction = Direction
self.LastDriveMaintainerCount = 0
self.DriveMaintainerIndex = nil
self.LastReading = 0
-- This is private, shouldn't be called outside this module
self.Resolve = DriveMaintainer.Resolve
-- Public methods
self.GetThrottle = DriveMaintainer.GetThrottle
self.SetThrottle = DriveMaintainer.SetThrottle
else
-- Dummy methods for safety. Better to have logic to just not call them.
self.GetThrottle = function (_, _) return 0 end
self.SetThrottle = function (_, _, _) end
end
return self
end
function DriveMaintainer:Resolve(I)
local DriveMaintainerCount = I:Component_GetCount(DRIVEMAINTAINER)
if DriveMaintainerCount ~= self.LastDriveMaintainerCount then
-- Clear cached index
self.DriveMaintainerIndex = nil
self.LastDriveMaintainerCount = DriveMaintainerCount
end
local DriveMaintainerIndex = self.DriveMaintainerIndex
if not DriveMaintainerIndex then
-- Look for the first one facing the direction we want
local Direction = self.Direction
for i = 0,DriveMaintainerCount-1 do
local BlockInfo = I:Component_GetBlockInfo(DRIVEMAINTAINER, i)
if Vector3.Dot(BlockInfo.LocalForwards, Direction) > 0.001 then
DriveMaintainerIndex = i
self.DriveMaintainerIndex = DriveMaintainerIndex
break
end
end
end
return DriveMaintainerIndex
end
function DriveMaintainer:GetThrottle(I)
local DriveMaintainerIndex = self:Resolve(I)
if DriveMaintainerIndex then
-- Update LastReading if we actually have a drive maintainer
self.LastReading = I:Component_GetFloatLogic(DRIVEMAINTAINER, DriveMaintainerIndex)
end
return self.LastReading
end
function DriveMaintainer:SetThrottle(I, Throttle)
local DriveMaintainerIndex = self:Resolve(I)
if DriveMaintainerIndex then
I:Component_SetFloatLogic(DRIVEMAINTAINER, DriveMaintainerIndex, Throttle)
end
end
|
-- ░▀▀█░█▀▀░█▀█░█▀█░░
-- ░░░█░▀▀█░█░█░█░█░░
-- ░▀▀░░▀▀▀░▀▀▀░▀░▀░░
-- This script is from https://gist.github.com/tylerneylon/59f4bcf316be525b30ab
-- License: None. Public Domain
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
* They are not recursive. Such a structure cannot be specified in json.
A Lua table is considered to be an array if and only if its set of keys is a
consecutive sequence of positive integers starting at 1. Arrays are encoded like
so: `[2, 3, false, "hi"]`. Any other type of Lua table is encoded as a json
object, encoded like so: `{"key1": 2, "key2": false}`.
Because the Lua nil value cannot be a key, and as a table value is considerd
equivalent to a missing key, there is no way to express the json "null" value in
a Lua table. The only way this will output "null" is if your entire input obj is
nil itself.
An empty Lua table, {}, could be considered either a json object or array -
it's an ambiguous edge case. We choose to treat this as an object as it is the
more general type.
To be clear, none of the above considerations is a limitation of this code.
Rather, it is what we get when we completely observe the json specification for
as arbitrary a Lua object as json is capable of expressing.
## json.parse:
This function parses json, with the exception that it does not pay attention to
\u-escaped unicode code points in strings.
It is difficult for Lua to return null as a value. In order to prevent the loss
of keys with a null value in a json string, this function uses the one-off
table value json.null (which is just an empty table) to indicate null values.
This way you can check if a value is null with the conditional
`val == json.null`.
If you have control over the data and are using Lua, I would recommend just
avoiding null values in your data to begin with.
--]]
local json = {}
-- Internal functions.
local function kind_of(obj)
if type(obj) ~= 'table' then return type(obj) end
local i = 1
for _ in pairs(obj) do
if obj[i] ~= nil then i = i + 1 else return 'table' end
end
if i == 1 then return 'table' else return 'array' end
end
local function escape_str(s)
local in_char = {'\\', '"', '/', '\b', '\f', '\n', '\r', '\t'}
local out_char = {'\\', '"', '/', 'b', 'f', 'n', 'r', 't'}
for i, c in ipairs(in_char) do
s = s:gsub(c, '\\' .. out_char[i])
end
return s
end
-- Returns pos, did_find; there are two cases:
-- 1. Delimiter found: pos = pos after leading space + delim; did_find = true.
-- 2. Delimiter not found: pos = pos after leading space; did_find = false.
-- This throws an error if err_if_missing is true and the delim is not found.
local function skip_delim(str, pos, delim, err_if_missing)
pos = pos + #str:match('^%s*', pos)
if str:sub(pos, pos) ~= delim then
if err_if_missing then
error('Expected ' .. delim .. ' near position ' .. pos)
end
return pos, false
end
return pos + 1, true
end
-- Expects the given pos to be the first character after the opening quote.
-- Returns val, pos; the returned pos is after the closing quote character.
local function parse_str_val(str, pos, val)
val = val or ''
local early_end_error = 'End of input found while parsing string.'
if pos > #str then error(early_end_error) end
local c = str:sub(pos, pos)
if c == '"' then return val, pos + 1 end
if c ~= '\\' then return parse_str_val(str, pos + 1, val .. c) end
-- We must have a \ character.
local esc_map = {b = '\b', f = '\f', n = '\n', r = '\r', t = '\t'}
local nextc = str:sub(pos + 1, pos + 1)
if not nextc then error(early_end_error) end
return parse_str_val(str, pos + 2, val .. (esc_map[nextc] or nextc))
end
-- Returns val, pos; the returned pos is after the number's final character.
local function parse_num_val(str, pos)
local num_str = str:match('^-?%d+%.?%d*[eE]?[+-]?%d*', pos)
local val = tonumber(num_str)
if not val then error('Error parsing number at position ' .. pos .. '.') end
return val, pos + #num_str
end
-- Public values and functions.
function json.stringify(obj, as_key)
local s = {} -- We'll build the string as an array of strings to be concatenated.
local kind = kind_of(obj) -- This is 'array' if it's an array or type(obj) otherwise.
if kind == 'array' then
if as_key then error('Can\'t encode array as key.') end
s[#s + 1] = '['
for i, val in ipairs(obj) do
if i > 1 then s[#s + 1] = ', ' end
s[#s + 1] = json.stringify(val)
end
s[#s + 1] = ']'
elseif kind == 'table' then
if as_key then error('Can\'t encode table as key.') end
s[#s + 1] = '{'
for k, v in pairs(obj) do
if #s > 1 then s[#s + 1] = ', ' end
s[#s + 1] = json.stringify(k, true)
s[#s + 1] = ':'
s[#s + 1] = json.stringify(v)
end
s[#s + 1] = '}'
elseif kind == 'string' then
return '"' .. escape_str(obj) .. '"'
elseif kind == 'number' then
if as_key then return '"' .. tostring(obj) .. '"' end
return tostring(obj)
elseif kind == 'boolean' then
return tostring(obj)
elseif kind == 'nil' then
return 'null'
else
error('Unjsonifiable type: ' .. kind .. '.')
end
return table.concat(s)
end
json.null = {} -- This is a one-off table to represent the null value.
function json.parse(str, pos, end_delim)
pos = pos or 1
if pos > #str then error('Reached unexpected end of input.') end
local pos = pos + #str:match('^%s*', pos) -- Skip whitespace.
local first = str:sub(pos, pos)
if first == '{' then -- Parse an object.
local obj, key, delim_found = {}, true, true
pos = pos + 1
while true do
key, pos = json.parse(str, pos, '}')
if key == nil then return obj, pos end
if not delim_found then error('Comma missing between object items.') end
pos = skip_delim(str, pos, ':', true) -- true -> error if missing.
obj[key], pos = json.parse(str, pos)
pos, delim_found = skip_delim(str, pos, ',')
end
elseif first == '[' then -- Parse an array.
local arr, val, delim_found = {}, true, true
pos = pos + 1
while true do
val, pos = json.parse(str, pos, ']')
if val == nil then return arr, pos end
if not delim_found then error('Comma missing between array items.') end
arr[#arr + 1] = val
pos, delim_found = skip_delim(str, pos, ',')
end
elseif first == '"' then -- Parse a string.
return parse_str_val(str, pos + 1)
elseif first == '-' or first:match('%d') then -- Parse a number.
return parse_num_val(str, pos)
elseif first == end_delim then -- End of an object or array.
return nil, pos + 1
else -- Parse true, false, or null.
local literals = {['true'] = true, ['false'] = false, ['null'] = json.null}
for lit_str, lit_val in pairs(literals) do
local lit_end = pos + #lit_str - 1
if str:sub(pos, lit_end) == lit_str then return lit_val, lit_end + 1 end
end
local pos_info_str = 'position ' .. pos .. ': ' .. str:sub(pos, pos + 10)
error('Invalid json syntax starting at ' .. pos_info_str)
end
end
return json
|
-- spawn_glow
return {
["spawn_glow"] = {
usedefaultexplosions = false,
groundflash = {
circlealpha = 0.9,
circlegrowth = 1.5,
flashalpha = 1,
flashsize = 30,
ttl = 8,
color = {
[1] = 0,
[2] = 0.60000002384186,
[3] = 0.69999998807907,
},
},
},
}
|
--時花の賢者-フルール・ド・サージュ
--Script by XyLeN
function c100425020.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100425020,0))
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,100425020)
e1:SetTarget(c100425020.destg)
e1:SetOperation(c100425020.desop)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100425020,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1,100425020+100)
e2:SetCondition(c100425020.thcon)
e2:SetTarget(c100425020.thtg)
e2:SetOperation(c100425020.thop)
c:RegisterEffect(e2)
end
function c100425020.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
and Duel.GetMatchingGroupCount(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)>1
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectTarget(tp,nil,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1)
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,g1:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c100425020.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g:GetCount()>0 and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
function c100425020.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c100425020.thfilter(c)
return c:IsLevel(1) and c:IsRace(RACE_PLANT) and c:IsAbleToHand()
end
function c100425020.tdfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToDeck()
end
function c100425020.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c100425020.tdfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c100425020.tdfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler())
and Duel.IsExistingMatchingCard(c100425020.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c100425020.tdfilter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c100425020.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,2,REASON_EFFECT)~=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c100425020.thfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
end
|
--[[
Dungeon generator
Dungeon generator module for Roblox.
@author EgoMoose
@link N/A
@date 12/02/2016
--]]
------------------------------------------------------------------------------------------------------------------------------
--// Setup
local cardinal = {
north = Vector2.new(0, -1);
east = Vector2.new(1, 0);
south = Vector2.new(0, 1);
west = Vector2.new(-1, 0);
};
local enums = {
empty = 0;
hall = 1;
room = 2;
junction = 3;
};
------------------------------------------------------------------------------------------------------------------------------
--// Functions
function contains(tab, element, keys)
local focus = keys or tab;
for key, val in pairs(focus) do
local index = keys and val or key;
if tab[index] == element then
return index;
end;
end;
end;
------------------------------------------------------------------------------------------------------------------------------
--// Classes
function class_tile(pos, enum, region)
local this = {};
-- properties
this.position = pos;
this.enum = enum;
this.region = region;
this.directions = {
north = false;
east = false;
south = false;
west = false;
};
-- return
return this;
end;
function class_tiles()
local this = setmetatable({}, {});
-- private functions
local function init()
-- this table
local mt = getmetatable(this);
mt.__index = function(t, k) return rawget(t, tostring(k)); end;
mt.__newindex = function(t, k, v) rawset(t, tostring(k), v); end;
end;
-- public functions
function this:setTiles(origin, enum, region, width, height)
local width, height = width or 0, height or 0;
for x = 0, width do
for y = 0, height do
local pos = origin + Vector2.new(x, y);
if not this[pos] then
this[pos] = class_tile(pos, enum, region);
else
this[pos].position = pos;
this[pos].enum = enum;
this[pos].region = region;
this[pos].directions = {
north = false;
east = false;
south = false;
west = false;
};
end;
end;
end;
end;
function this:getEnum(pos)
local tile = this[pos];
if tile then
return tile.enum;
end;
end;
function this:getAllTiles(enum)
local tiles = {};
for pos, tile in pairs(this) do
if (type(tile) == "table" and tile.enum == enum) or not enum then
table.insert(tiles, tile);
end;
end;
return tiles;
end;
function this:getAllTilesIgnore(enum)
local tiles = {};
for pos, tile in pairs(this) do
if (type(tile) == "table" and tile.enum ~= enum) then
table.insert(tiles, tile);
end;
end;
return tiles;
end;
-- return
init();
return this;
end;
function class_rectangle(x, y, width, height)
local this = {};
-- properties
this.position = Vector2.new(x, y);
this.size = Vector2.new(width, height);
this.corners = {
this.position;
this.position + Vector2.new(width, 0);
this.position + Vector2.new(0, height);
this.position + this.size;
};
-- private functions
local function dot2d(a, b)
return a.x * b.x + a.y * b.y;
end;
local function getAxis(c1, c2)
local axis = {};
axis[1] = c1[2] - c1[1];
axis[2] = c1[2] - c1[3];
axis[3] = c2[1] - c2[4];
axis[4] = c2[1] - c2[2];
return axis;
end;
-- public functions
function this:collidesWith(other)
-- this method of collision is called separating axis theorem
-- you can read about it here: http://www.dyn4j.org/2010/01/sat/
-- understanding this requires knowledge of the dot product:
-- http://wiki.roblox.com/index.php?title=User:EgoMoose/The_scary_thing_known_as_the_dot_product
local scalars = {};
local axis = getAxis(self.corners, other.corners);
for i = 1, #axis do
for i2, set in pairs({self.corners, other.corners}) do
scalars[i2] = {};
for _, point in pairs(set) do
local v = dot2d(point, axis[i].unit);
table.insert(scalars[i2], v);
end;
end;
local s1max, s1min = math.max(unpack(scalars[1])), math.min(unpack(scalars[1]));
local s2max, s2min = math.max(unpack(scalars[2])), math.min(unpack(scalars[2]));
if s2min > s1max or s2max < s1min then
return false;
end;
end;
return true;
end;
-- return
return this;
end;
function class_dungeonGen()
local this = {};
-- properties
this.roomSize = 3; -- potential size of rooms
this.enums = enums; -- don't change
this.lastSeed = nil; -- don't change
this.windingPercent = 0; -- curvy maze? (0 - 100)
this.attemptRoomNum = 20; -- how many rooms should be attempted to fit in the bounds
this.loadBuffer = math.huge; -- how many actions between every wait (use this to, y'know, not freeze ur computer)
this.genMapDirections = true; -- if not needed turn this off! it saves so much script performance
this.seed = function() return tick(); end; -- returns what's used in randomseed
this.bounds = { -- size of map
width = 100;
height = 100;
};
-- private properties
local currentRegion = 0;
local tiles = class_tiles();
-- private functions
local function newRegion()
currentRegion = currentRegion + 1;
end;
local function boundsContains(pos)
if pos.x > this.bounds.width or pos.y > this.bounds.height or pos.x < 0 or pos.y < 0 then
return false;
end;
return true;
end;
local function canCarve(pos, direction)
if not boundsContains(pos + direction * 3) then
return false;
end;
return tiles:getEnum(pos + direction * 2) == 0;
end;
local function createRooms()
local rooms = {};
-- attempt as many rooms as possible
for i = 1, this.attemptRoomNum do
-- randomly shape the room
local size = math.random(this.roomSize) * 2 + 1;
local rectangularity = math.random(1 + math.floor(size/2)) * 2;
local width, height = size, size;
if math.random(2) == 1 then
width = width + rectangularity;
else
height = height + rectangularity;
end;
-- build room as rectangle class
local x = math.random(math.floor((this.bounds.width - width)/2)) * 2 + 1;
local y = math.random(math.floor((this.bounds.height - height)/2)) * 2 + 1;
local room = class_rectangle(x, y, width, height);
-- check for collisions
local overlapping = false;
for _, other in pairs(rooms) do
if room:collidesWith(other) then
overlapping = true;
break;
end;
end;
-- if no overlap then add as a room
if not overlapping then
newRegion();
table.insert(rooms, room);
tiles:setTiles(room.position, enums.room, currentRegion, room.size.x - 1, room.size.y - 1); -- subtract 1?
end;
end;
end;
local function growMaze(pos)
tiles:setTiles(pos, enums.hall, currentRegion);
local c = 0;
local cells, lastDirection = {tiles[pos]};
-- spanning tree algorithm
while #cells > 0 do
c = c + 1;
local potential = {};
local cell = cells[#cells];
-- check the 4 cardinal directions
for name, direction in pairs(cardinal) do
if canCarve(cell.position, direction) then
table.insert(potential, direction);
end;
end;
-- pick a direction if plausible
if #potential > 0 then
local direction;
if contains(potential, lastDirection) and math.random(100) > this.windingPercent then
direction = lastDirection
else
direction = potential[math.random(#potential)];
end;
-- set the tile
tiles:setTiles(cell.position + direction, enums.hall, currentRegion)
tiles:setTiles(cell.position + direction * 2, enums.hall, currentRegion)
table.insert(cells, tiles[cell.position + direction * 2]);
-- prepare to repeat
lastDirection = direction;
else
table.remove(cells, #cells);
lastDirection = nil;
end;
-- wait buffer
if c % this.loadBuffer == 0 then
wait();
end;
end;
end;
local function connectRegions()
local connectors = {};
local connectedPoints = {};
-- collect regions that can be connected
for _, tile in pairs(tiles:getAllTiles(enums.empty)) do
-- count unqiue regions
local regions, count = {}, 0;
for name, direction in pairs(cardinal) do
local ntile = tiles[tile.position + direction];
if ntile and ntile.enum > 0 and ntile.region then
regions[ntile.region] = true;
end;
end;
local open = {};
for region, _ in pairs(regions) do
count = count + 1;
table.insert(open, region);
end;
-- if two unique regions store as a possible outcome
if count == 2 then
table.insert(connectedPoints, tile);
connectors[tostring(tile.position)] = open;
end;
end;
-- place our connections/smooth
while #connectedPoints > 1 do
-- pick random junction
local index = math.random(#connectedPoints)
local tile = connectedPoints[index];
local region = connectors[tostring(tile.position)];
tiles:setTiles(tile.position, enums.junction, nil);
table.remove(connectedPoints, index);
-- don't remove all similar sources
for i, otile in pairs(connectedPoints) do
if i ~= index then
local open = connectors[tostring(otile.position)];
if contains(open, region[1]) and contains(open, region[2]) then
table.remove(connectedPoints, i);
end;
end;
end;
-- remove tiles that are side by side
for i, otile in pairs(tiles:getAllTiles(enums.junction)) do
if otile.position ~= tile.position then
if (otile.position - tile.position).magnitude < 1.1 then
tiles:setTiles(otile.position, enums.empty, nil);
end;
end
end;
end;
end;
local function removeDeadEnds()
-- collect/set initial data
local done, c = false, 0;
local maze = tiles:getAllTiles(enums.hall);
-- check as long as is needed
while not done do
done = true;
for i, tile in pairs(maze) do
c = c + 1;
local exits = 0;
-- check all potential spaces
for name, direction in pairs(cardinal) do
local ntile = tiles[tile.position + direction];
if ntile and ntile.enum ~= enums.empty then
exits = exits + 1;
end;
end;
if c % this.loadBuffer == 0 then
wait();
end;
-- if only single place to move then it's a dead end
if exits <= 1 then
table.remove(maze, i);
tiles:setTiles(tile.position, enums.empty, nil);
done = false;
break;
end;
end;
end;
end;
local function mapDirections()
local c = 0;
for i, tile in pairs(tiles:getAllTilesIgnore(enums.empty)) do
c = c + 1;
for name, direction in pairs(cardinal) do
local ntile = tiles[tile.position + direction];
if ntile and ntile.enum ~= enums.empty then
tile.directions[name] = true;
end;
end;
if c % this.loadBuffer == 0 then
wait();
end;
end;
end;
-- public functions
function this:generate()
-- set randome seed
this.lastSeed = this.seed();
math.randomseed(this.lastSeed);
-- generate initial
tiles:setTiles(Vector2.new(0, 0), enums.empty, currentRegion, self.bounds.width, self.bounds.height);
createRooms();
newRegion();
-- start maze
for _, tile in pairs(tiles:getAllTiles(enums.empty)) do
-- must be odd number position
local pos = tile.position;
if pos.x % 2 == 1 and pos.y % 2 == 1 and tile.enum == enums.empty then
growMaze(pos);
--break;
end;
end;
-- smooth and get find final
connectRegions();
removeDeadEnds();
if this.genMapDirections then
mapDirections();
end;
-- return tile set
return tiles;
end;
-- return
return this;
end;
------------------------------------------------------------------------------------------------------------------------------
--// Run
return class_dungeonGen;
|
--[[
Librarian is a library used to manage localization, packages, scripts, animations and data embedded
into the SVUI core addon.
It's main purpose is to keep all methods and logic needed to properly keep
core add-ins functioning outside of the core object and away from other libraries like LibStub.
--]]
local _G = getfenv(0)
local assert = _G.assert;
local type = _G.type;
local error = _G.error;
local pairs = _G.pairs;
local tostring = _G.tostring;
local Librarian = _G["Librarian"]
if not Librarian then
Librarian = Librarian or {libs = {}, arrested = {}, warrants = {}}
_G["Librarian"] = Librarian
function Librarian:NewLibrary(libName)
assert(type(libName) == "string", "Missing Library Name")
self.libs[libName] = self.libs[libName] or {}
return self.libs[libName]
end
function Librarian:Fetch(libName, silent)
if not self.libs[libName] and not silent then
error(("Cannot find a library instance of %q."):format(tostring(libName)), 2)
end
return self.libs[libName]
end
local dead = function() return end
function Librarian:LockLibrary(lib)
local LibStub = _G.LibStub;
if((self.warrants[lib]) or (not LibStub) or (not LibStub.libs)) then return end
for libName,libObj in pairs(LibStub.libs) do
if(libName:find(lib) and (not self.arrested[libName])) then
self.warrants[lib] = true
self.arrested[libName] = {}
for k,v in pairs(libObj) do
if(type(v) == 'function') then
self.arrested[libName][k] = v
v = dead
end
end
end
end
end
function Librarian:UnlockLibrary(lib)
local LibStub = _G.LibStub;
if((not LibStub) or (not LibStub.libs)) then return end
for libName,libObj in pairs(LibStub.libs) do
if(libName:find(lib) and (self.arrested[libName])) then
for k,v in pairs(self.arrested[libName]) do
libObj[k] = v
end
self.warrants[lib] = nil
self.arrested[libName] = nil
end
end
end
setmetatable(Librarian, { __call = Librarian.Fetch })
end
|
--[[
File: init.lua
Author: davness
Year: 2019
License: MIT
This file acts as a runtime for the ObjectEvent described in the index file.
--]]
-- Declare existance of our classes
local RBXScriptSignalLike, ObjectEvent, ObjectEventConnection
RBXScriptSignalLike = setmetatable({}, {
__tostring = function()
return "RBXScriptSignalLike"
end
})
RBXScriptSignalLike.__index = RBXScriptSignalLike
function RBXScriptSignalLike.new()
local self = setmetatable({}, RBXScriptSignalLike)
self.SubscribedConnections = {}
self.YieldQueue = {}
return self
end
function RBXScriptSignalLike:Connect(f)
return ObjectEventConnection.new(f, self)
end
function RBXScriptSignalLike:Wait()
table.insert(self.YieldQueue, coroutine.running())
return coroutine.yield()
end
ObjectEvent = setmetatable({}, {
__tostring = function()
return "ObjectEvent"
end
})
ObjectEvent.__index = ObjectEvent
function ObjectEvent.new()
local self = setmetatable({}, ObjectEvent)
self.Event = RBXScriptSignalLike.new()
self.SubscribedConnections = self.Event.SubscribedConnections
return self
end
function ObjectEvent:Connect(f)
return self.Event.Connect(self.Event, f)
end
function ObjectEvent:Wait()
return self.Event.Wait(self.Event)
end
function ObjectEvent:Fire(...)
local args = {...}
-- Activate all listeners
for _, c in pairs(self.Event.SubscribedConnections) do
task.spawn(function()
c.Listener(unpack(args))
end)
end
-- Resume all yielding threads on :Wait()
for _, t in pairs(self.Event.YieldQueue) do
task.spawn(t, unpack(args))
end
-- Reset the yielding queue.
self.YieldQueue = {}
end
ObjectEventConnection = setmetatable({}, {
__tostring = function()
return "EventConnection"
end
})
ObjectEventConnection.__index = ObjectEventConnection
function ObjectEventConnection.new(toConnect, event)
local self = setmetatable({}, ObjectEventConnection)
self.Listener = toConnect
self.Event = event
self.Enabled = false
-- Forcing reconnect should do the trick
self:Reconnect()
return self
end
function ObjectEventConnection:IsConnected()
return self.Enabled;
end
function ObjectEventConnection:Disconnect()
local subscribers = self.Event.SubscribedConnections
local index = table.find(subscribers, self)
if not index then
warn("Attempted to disconnect an event that wasn't connected at all. Exiting.", 0)
return nil
end
table.remove(subscribers, index)
self.Enabled = false
end
function ObjectEventConnection:Reconnect()
local subscribers = self.Event.SubscribedConnections
local index = table.find(subscribers, self)
if index then
warn("Attempted to reconnect an event that is already connected. Exiting.", 0)
return nil
end
table.insert(subscribers, self);
self.Enabled = true;
end
return ObjectEvent
|
local class = require "class"
local Path = class:derive("Path")
local Vec2 = require("Essentials/Vector2")
local SphereChain = require("SphereChain")
local BonusScarab = require("BonusScarab")
function Path:new(map, pathData, dummy)
self.map = map
-- whether it's just a decorative path, if false then it's meant to be playable
self.dummy = dummy
self.nodes = {}
self.brightnesses = {}
self.length = 0
local nodes = {}
for i, node in ipairs(pathData) do
nodes[i] = {pos = Vec2(node.x, node.y), hidden = node.hidden, warp = node.warp}
end
--self:prepareNodes({Vec2(0, 200), Vec2(500, 200), Vec2(515, 200), Vec2(520, 205), Vec2(520, 220), Vec2(520, 400)})
self:prepareNodes(nodes)
self.sphereChains = {}
self.clearOffset = 0
self.bonusScarab = nil
end
function Path:prepareNodes(nodes)
for i, node in ipairs(nodes) do
local length = 0
if nodes[i + 1] and not node.warp then length = (nodes[i + 1].pos - node.pos):len() end
local angle1 = nil
local angle2 = nil
if nodes[i - 1] and not nodes[i - 1].warp then angle1 = (node.pos - nodes[i - 1].pos):angle() end
if nodes[i + 1] and not node.warp then angle2 = (nodes[i + 1].pos - node.pos):angle() end
-- compensation if wraps around 360°
if angle1 and angle2 then
if angle2 - angle1 > math.pi then angle2 = angle2 - 2 * math.pi end
if angle1 - angle2 > math.pi then angle1 = angle1 - 2 * math.pi end
end
local angle = nil
if angle1 then
if angle2 then angle = (angle1 + angle2) / 2 else angle = angle1 end
else
if angle2 then angle = angle2 else angle = 0 end
end
angle = (angle + math.pi / 2) % (math.pi * 2)
self.nodes[i] = {pos = node.pos, hidden = node.hidden, warp = node.warp, length = length, angle = angle}
-- brightnesses stuff
if node.hidden then
if nodes[i - 1] and not nodes[i - 1].hidden then -- visible->hidden
table.insert(self.brightnesses, {distance = self.length - 8, value = 1})
table.insert(self.brightnesses, {distance = self.length + 8, value = 0.5})
end
else
if nodes[i - 1] and nodes[i - 1].hidden then -- hidden->visible
table.insert(self.brightnesses, {distance = self.length - 8, value = 0.5})
table.insert(self.brightnesses, {distance = self.length + 8, value = 1})
end
end
self.length = self.length + length
end
-- if no tunnels we must add a placeholder
if #self.brightnesses == 0 then table.insert(self.brightnesses, {distance = 0, value = 1}) end
end
function Path:update(dt)
for i, sphereChain in ipairs(self.sphereChains) do
if not sphereChain.delQueue then
sphereChain:update(dt)
if i > 1 and
not self.sphereChains[i - 1].delQueue and
sphereChain.sphereGroups[1]:getLastSphereOffset() >= self.sphereChains[i - 1]:getLastSphereGroup():getSphereOffset(1) - 32
then
self.sphereChains[i - 1]:join()
end
end
end
if self:shouldSpawn() then self:spawnChain() end
if self.bonusScarab then self.bonusScarab:update(dt) end
end
function Path:shouldSpawn()
if game:levelExists() and (not game.session.level.started or game.session.level.targetReached or game.session.level.lost) then return false end
for i, sphereChain in ipairs(self.sphereChains) do
if not sphereChain.delQueue and sphereChain.sphereGroups[#sphereChain.sphereGroups].offset < self.length * game.session.level.spawnDistance then return false end
end
return true
end
function Path:spawnChain()
local sphereChain = SphereChain(self)
if game.session.level.controlDelay then sphereChain.sphereGroups[1].speed = game.session.level.speeds[1].speed end
table.insert(self.sphereChains, sphereChain)
game.session.level.sphereChainsSpawned = game.session.level.sphereChainsSpawned + 1
game:playSound("sphere_chain_spawn")
end
function Path:spawnBonusScarab()
self.bonusScarab = BonusScarab(self)
end
function Path:draw(hidden)
-- hidden: with that, you can filter the spheres drawn either to the visible ones or to the invisible ones
for i, sphereChain in pairs(self.sphereChains) do
sphereChain:draw(hidden, true)
sphereChain:draw(hidden, false)
end
if self.bonusScarab then
self.bonusScarab:draw(hidden, true)
self.bonusScarab:draw(hidden, false)
end
--if not hidden then self:drawDebugFill() end
end
function Path:drawDebug()
-- todo: make the mouse position global
--local mx, my = love.mouse.getPosition()
love.graphics.setLineWidth(1)
love.graphics.setColor(0, 1, 1)
for i, node in ipairs(self.nodes) do
love.graphics.rectangle("line", node.pos.x - 4, node.pos.y - 4, 8, 8)
--if mx > node.pos.x - 4 and mx < node.pos.x + 4 and my > node.pos.y - 4 and my < node.pos.y + 4 then
-- love.graphics.print(tostring(node.angle), node.pos.x + 8, node.pos.y)
--end
if i > 1 then love.graphics.line(self.nodes[i - 1].pos.x, self.nodes[i - 1].pos.y, node.pos.x, node.pos.y) end
end
end
function Path:drawDebugBrightness()
for i = 1, 800 do
local h = self:getSpeed(i) / 20
local n, r = self:getNodeID(i)
local t = r < 1
if t then
love.graphics.setColor(0, 1, 1)
love.graphics.rectangle("fill", i, 36, 1, 64)
else
love.graphics.setColor(1, 0, 0)
love.graphics.rectangle("fill", i, 100 - h, 1, h)
end
end
end
function Path:drawDebugLine()
for i = 0, self.length, 5 do
love.graphics.setColor(math.sqrt(self:getSpeed(i)) / 30, 0, 0)
local pos = self:getPos(i)
love.graphics.circle("fill", pos.x, pos.y, 5)
end
end
function Path:drawDebugFill()
love.graphics.setColor(1, 0.2, 0)
local pos = posOnScreen(self:getPos(self:getMaxOffset()))
love.graphics.circle("fill", pos.x, pos.y, 10)
end
function Path:getSphereChainID(sphereChain)
for i, sphereChainT in pairs(self.sphereChains) do if sphereChainT == sphereChain then return i end end
end
function Path:getMaxOffset()
local offset = 0
for i, sphereChain in ipairs(self.sphereChains) do
offset = math.max(offset, sphereChain.maxOffset)
end
return offset
end
function Path:getSpeed(pixels)
local part = pixels / self.length
for i, speed in ipairs(game.session.level.speeds) do
if part < speed.distance then
local prevSpeed = game.session.level.speeds[i - 1]
if prevSpeed and speed.distance - prevSpeed.distance > 0 then
local t = (speed.distance - part) / (speed.distance - prevSpeed.distance)
-- between nodes
if game.session.profile.data.session.ultimatelySatisfyingMode then
return (prevSpeed.speed * t + speed.speed * (1 - t)) * (1 + (game.session.profile.data.session.level - 1) * 0.05)
else
return prevSpeed.speed * t + speed.speed * (1 - t)
end
end
-- at the exact position of node or before first node
if game.session.profile.data.session.ultimatelySatisfyingMode then
return speed.speed * (1 + (game.session.profile.data.session.level - 1) * 0.05)
else
return speed.speed
end
end
end
-- after last node
if game.session.profile.data.session.ultimatelySatisfyingMode then
return game.session.level.speeds[#game.session.level.speeds].speed * (1 + (game.session.profile.data.session.level - 1) * 0.05)
else
return game.session.level.speeds[#game.session.level.speeds].speed
end
end
function Path:getDanger(pixels)
return pixels / self.length >= game.session.level.dangerDistance
end
function Path:getNodeID(pixels)
local nodeID = 0
while pixels > 0 do
nodeID = nodeID + 1
if not self.nodes[nodeID] then break end
pixels = pixels - self.nodes[nodeID].length
end
-- returns a node ID and how many pixels afterwards the given position is
local remainder = 0
if self.nodes[nodeID] then remainder = self.nodes[nodeID].length + pixels end
return nodeID, remainder
end
function Path:getPos(pixels)
if pixels then
local nodeID, remainder = self:getNodeID(pixels)
if nodeID == 0 then return self.nodes[1].pos end
if nodeID > #self.nodes then return self.nodes[#self.nodes].pos end
local part = remainder / self.nodes[nodeID].length
return self.nodes[nodeID].pos * (1 - part) + self.nodes[nodeID + 1].pos * part
else
return nil
end
end
function Path:getAngle(pixels)
if pixels then
local nodeID, remainder = self:getNodeID(pixels)
if nodeID == 0 then return self.nodes[1].angle end
if nodeID > #self.nodes then return self.nodes[#self.nodes].angle end
local part = remainder / self.nodes[nodeID].length
local angle1 = self.nodes[nodeID].angle
local angle2 = self.nodes[nodeID + 1].angle
-- compensation if wraps around 360°
if angle1 - angle2 > math.pi then angle1 = angle1 - 2 * math.pi end
if angle2 - angle1 > math.pi then angle2 = angle2 - 2 * math.pi end
return angle1 * (1 - part) + angle2 * part
else
return nil
end
end
function Path:getHidden(pixels)
local nodeID = self:getNodeID(pixels)
if nodeID == 0 then return self.nodes[1].hidden end
if nodeID > #self.nodes then return self.nodes[#self.nodes].hidden end
return self.nodes[nodeID].hidden
end
function Path:getBrightness(pixels)
for i, brightness in ipairs(self.brightnesses) do
if pixels < brightness.distance then
local prevBrightness = self.brightnesses[i - 1]
if prevBrightness and brightness.distance - prevBrightness.distance > 0 then
local t = (brightness.distance - pixels) / (brightness.distance - prevBrightness.distance)
return prevBrightness.value * t + brightness.value * (1 - t)
end
return brightness.value
end
end
return self.brightnesses[#self.brightnesses].value
end
return Path
|
local player = ...
local pn = ToEnumShortString(player)
local pss = STATSMAN:GetCurStageStats():GetPlayerStageStats(player)
local TapNoteScores = {
Types = { 'W1', 'W2', 'W3', 'W4', 'W5', 'Miss' },
-- x values for P1 and P2
x = { P1=64, P2=94 }
}
local RadarCategories = {
Types = { 'Holds', 'Mines', 'Hands', 'Rolls' },
-- x values for P1 and P2
x = { P1=-180, P2=218 }
}
-----------------------------------------------------------------------------------------------------------------
--AF for the stats to compare to
local percentT = Def.ActorFrame{
InitCommand=function(self)self:zoom(0.8):y(_screen.cy-24) end,
}
local windows = SL.Global.ActiveModifiers.TimingWindows
-- do "regular" TapNotes first
for i=1,#TapNoteScores.Types do
local window = TapNoteScores.Types[i]
--delta between current stats and highscore stats
percentT[#percentT+1] = LoadFont("Wendy/_wendy small")..{
InitCommand=function(self)
self:settext(string.format("%.2f%%", pss:GetPercentageOfTaps( "TapNoteScore_"..window )*100.0))
self:zoom(.5):horizalign(left)
self:x( TapNoteScores.x[pn] -200)
self:y((i-1)*35 -20)
if SL.Global.GameMode ~= "ITG" then
self:diffuse( SL.JudgmentColors[SL.Global.GameMode][i] )
end
-- if some TimingWindows were turned off, the leading 0s should not
-- be colored any differently than the (lack of) JudgmentNumber,
-- so load a unique Metric group.
if not windows[i] and i ~= #TapNoteScores.Types then
self:diffuse(color("#444444"))
end
end,
}
end
local percentLostT = Def.ActorFrame{
InitCommand=function(self)self:zoom(0.8):y(_screen.cy-40) end,
LoadFont("Wendy/_wendy small")..{
Text="LOST %",
InitCommand=function(self)
self:zoom(.5):horizalign(left)
end,
},
LoadFont("Wendy/_wendy small")..{
InitCommand=function(self)
self:zoom(.5):x(150):horizalign(left)
if pss:GetFailed() then
self:settext("FAILED"):x(120)
else
self:settext("100")
end
end,
}
}
local total = {100}
-- do "regular" TapNotes
for i=2,#TapNoteScores.Types do
local window = TapNoteScores.Types[i]
local missingDP = (5 - SL.Metrics.ITG["PercentScoreWeight"..window]) * pss:GetTapNoteScores( "TapNoteScore_"..window ) --TODO only works for ITG weights
local missingPercent = missingDP / pss:GetPossibleDancePoints() * 100
total[#total+1] = total[#total] - missingPercent
--delta between current stats and highscore stats
percentLostT[#percentLostT+1] = LoadFont("Wendy/_wendy small")..{
InitCommand=function(self)
self:settext(string.format("%.2f%%",missingPercent))
self:zoom(.5):horizalign(left)
self:y((i-1)*35)
if SL.Global.GameMode ~= "ITG" then
self:diffuse( SL.JudgmentColors[SL.Global.GameMode][i] )
end
-- if some TimingWindows were turned off, the leading 0s should not
-- be colored any differently than the (lack of) JudgmentNumber,
-- so load a unique Metric group.
if not windows[i] and i ~= #TapNoteScores.Types then
self:diffuse(color("#444444"))
end
end,
}
if not pss:GetFailed() then
percentLostT[#percentLostT+1] = LoadFont("Wendy/_ScreenEvaluation numbers")..{
InitCommand=function(self)
self:settext(string.format("%.2f",total[i]))
self:zoom(.4):x(150):horizalign(left)
self:y((i-1)*35)
if SL.Global.GameMode ~= "ITG" then
self:diffuse( SL.JudgmentColors[SL.Global.GameMode][i] )
end
-- if some TimingWindows were turned off, the leading 0s should not
-- be colored any differently than the (lack of) JudgmentNumber,
-- so load a unique Metric group.
if not windows[i] and i ~= #TapNoteScores.Types then
self:diffuse(color("#444444"))
end
end,
}
end
end
local toReturn = Def.ActorFrame{Name="DeltaT"}
toReturn[#toReturn+1] = percentT
toReturn[#toReturn+1] = percentLostT
return toReturn
|
-- try to run:
-- $ lua arg.lua 1 2 3
--
print(arg)
print(arg[0])
print(arg[1])
|
return function (connection, req, args)
dofile('httpserver-header.lc')(connection, 200, 'html')
if req.method == 'POST' then
local rd = req.getRequestData()
if (rd['data'] ~= nil) then
print("data: ",rd['data'])
ws2812.write(rd['data'])
end
end
collectgarbage()
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.