content
stringlengths 5
1.05M
|
|---|
Physics = Class:extend()
function Physics:init_physics(w, h, centered)
if not self.x or not self.y or not self.w or not self.h then
error('GameObject ~' ..self.class ..'~ has invalid transform properties')
return
end
self.mouse_stay = false
main.current.world:add(self, self.x, self.y, w or self.w, h or self.h)
end
function Physics:move_and_slide(dirx, diry, dt, filter)
local actual_x, actual_y, cols, len = main.current.world:move(self, self.x + dirx * dt, self.y + diry * dt, filter)
self.x, self.y = actual_x, actual_y
if len > 0 then
if self.on_collision_enter then self:on_collision_enter(cols) end
end
if self.check_collisions then self:check_collisions(cols) end
end
function Physics:apply_gravity(dt)
self.y_vel = self.y_vel + 500 * dt
end
function Physics:is_colliding_with_point(px, py)
if px > self.x - self.w/2 and px < self.x + self.w - self.w/2 and py > self.y - self.h/2 and py < self.y + self.h - self.h/2 then return true end
return false
end
function Physics:update_physics(dt)
if self.interact_with_mouse then
local mx, my = get_global_mouse_pos()
if self:is_colliding_with_point(mx, my) then
if not self.mouse_stay then
if self.on_mouse_enter then self:on_mouse_enter() end
self.mouse_stay = true
end
if self.on_mouse_stay then self:on_mouse_stay() end
else
if self.mouse_stay then
self.mouse_stay = false
if self.on_mouse_exit then self:on_mouse_exit() end
end
end
end
end
|
function system_storage(x,y)
interval = 10
font_size = 18
spacing = 1.4
local color = color2
timer = (updates % interval)
if timer == 0 or conky_start == 1 then
result = io.popen("df -h")
ss_t = {}
for line in result:lines() do
table.insert(ss_t, line)
end
result:close()
end
if next(ss_t) == nil then
return
end
n = 1
for i, line in ipairs(ss_t) do
text = line
y = y + font_size*spacing
displaytext(x,y,text,font,font_size,color)
n = n + 1
end
end
|
-- // Wont be documented! Simple and easy to read!
local UW = {}
-- Will be used in future scripts
function UW.ServerHopper(limit)
for i,v in pairs(game.HttpService:JSONDecode(game:HttpGet("https://games.roblox.com/v1/games/" .. game.PlaceId .. "/servers/Public?sortOrder=Asc&limit=" .. limit)).data) do
if v.playing ~= v.maxPlayers then
game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, v.id)
end
end
end
-- Normal roblox noti, smaller cleaner code.
function UW.SendNotification(title, text, duration)
game.StarterGui:SetCore("SendNotification", {
Title = title;
Text = text;
Duration = duration;
})
end
-- Depricated until further notice
-- function UW.GetRBXVer()
-- loadstring(game:HttpGet("https://setup.roblox.com/version"))()
-- end
return UW
|
--[=[
Stack of values that allows multiple systems to enable or disable a state.
```lua
local disabledStack = StateStack.new()
print(disabledStack:GetState()) --> false
disabledStack.Changed:Connect(function()
print("From changed event we have state: ", disabledStack:GetState())
end)
local cancel = disabledStack:PushState() --> From changed event we have state: true
print(disabledStack:GetState()) --> true
cancel() --> From changed event we have state: true
print(disabledStack:GetState()) --> false
disabledStack:Destroy()
```
@class StateStack
]=]
local BaseObject = require(script.Parent.BaseObject)
local ValueObject = require(script.Parent.ValueObject)
local StateStack = setmetatable({}, BaseObject)
StateStack.ClassName = "StateStack"
StateStack.__index = StateStack
--[=[
Constructs a new StateStack.
@return StateStack
]=]
function StateStack.new()
local self = setmetatable(BaseObject.new(), StateStack)
self.State = self.Janitor:Add(ValueObject.new(false), "Destroy")
self.StateStack = {}
--[=[
Fires with the new state
@prop Changed Signal<T>
@within StateStack
]=]
self.Changed = self.State.Changed
return self
end
--[=[
Gets the current state
@return T?
]=]
function StateStack:GetState()
return self.State.Value
end
--[=[
Observes the current value of stack
@return Observable<T?>
]=]
function StateStack:Observe()
return self.State:Observe()
end
--[=[
Pushes the current state onto the stack
@param state T?
@return function -- Cleanup function to invoke
]=]
function StateStack:PushState(State)
if State == nil then
State = true
end
local Data = {State}
table.insert(self.StateStack, Data)
self:UpdateState()
return function()
if self.Destroy then
self:PopState(Data)
end
end
end
function StateStack:PopState(Data)
local Index = table.find(self.StateStack, Data)
if Index then
table.remove(self.StateStack, Index)
self:UpdateState()
else
warn("[StateStack] - Failed to find index")
end
end
function StateStack:UpdateState()
local _, Data = next(self.StateStack)
if Data == nil then
if type(self.State.Value) == "boolean" then
self.State.Value = false
else
self.State.Value = nil
end
else
self.State.Value = Data[1]
end
end
function StateStack:__tostring()
return "StateStack"
end
table.freeze(StateStack)
--[=[
Cleans up the StateStack and sets the metatable to nil.
:::tip
Be sure to call this to clean up the state stack!
:::
@method Destroy
@within StateStack
]=]
return StateStack
|
-- LibMCNet
local component=require('component')
local core=require('mcnet_core')
local mcnetd_version=1
local default_ttl=5
local function NetSendEx(modem,dest,port,...)
local t={}
t.ver=mcnetd_version
t.ttl=default_ttl
t.src=modem.address
t.dest=dest
t.port=port
t.data=table.pack(...)
core.send(t)
end
-- NetSend(component.modem,"dest-uuid",80,"GET / Hello.World")
-- NetSend("dest-uuid",80,"GET / Hello.World")
local function NetSend(a,b,c,...)
if(not a or type(a)=="table") then
NetSendEx(a or component.modem,b,c,...)
else
NetSendEx(component.modem,a,b,c,...)
end
end
local function NetBroadcast(port,...)
local t={}
t.ver=mcnetd_version
t.ttl=default_ttl
t.src=component.modem.address
t.port=port
t.data=table.pack(...)
core.broadcast(t)
end
local function SetTTL(ttl)
default_ttl=ttl
end
return {
send=NetSend,
broadcast=NetBroadcast,
setttl=SetTTL
}
|
-- Connections
--
-- LICENCE: http://opensource.org/licenses/MIT
-- 2016-10-29 tschaban https://github.com/tschaban
local module = {}
local function getIP()
if wifi.sta.getip() == nil then
print("IP unavailable, Waiting...")
else
tmr.stop(1)
print("\n====================================")
print("ID: " .. config.ID)
print("MAC address is: " .. wifi.ap.getmac())
print("IP is " .. wifi.sta.getip())
app.start()
end
end
local function connect()
wifi.setmode(wifi.STATION);
wifi.sta.config(config.WIFI_SSID, config.WIFI_PASSWORD)
wifi.sta.connect()
print("Connecting to " .. config.WIFI_SSID .. " ...")
tmr.alarm(1, 2500, 1, getIP)
end
function module.start()
print("Configuring Wifi ...")
wifi.setmode(wifi.STATION);
wifi.sta.getap(connect)
end
return module
|
-- Config.lua
-- @Author : Dencer (tdaddon@163.com)
-- @Link : https://dengsir.github.io
-- @Date : 8/31/2019, 7:22:32 PM
---@type ns
local ns = select(2, ...)
---@type L
local L = ns.L
local WEAPON = GetItemClassInfo(LE_ITEM_CLASS_WEAPON) -- 武器
local ARMOR = GetItemClassInfo(LE_ITEM_CLASS_ARMOR) -- 护甲
local CONTAINER = GetItemClassInfo(LE_ITEM_CLASS_CONTAINER) -- 容器
local QUIVER = GetItemClassInfo(LE_ITEM_CLASS_QUIVER) -- 箭袋
local RECIPE = GetItemClassInfo(LE_ITEM_CLASS_RECIPE) -- 配方
local TRADEGOODS = GetItemClassInfo(LE_ITEM_CLASS_TRADEGOODS) -- 商品
local CONSUMABLE = GetItemClassInfo(LE_ITEM_CLASS_CONSUMABLE) -- 消耗品
local QUEST = GetItemClassInfo(LE_ITEM_CLASS_QUESTITEM) -- 任务
local MISC = GetItemClassInfo(LE_ITEM_CLASS_MISCELLANEOUS) -- 其它
local PROJECTILE = GetItemClassInfo(LE_ITEM_CLASS_PROJECTILE) -- 弹药
local REAGENT = GetItemClassInfo(LE_ITEM_CLASS_REAGENT) -- 材料
local FISHINGPOLE = GetItemSubClassInfo(LE_ITEM_CLASS_WEAPON, LE_ITEM_WEAPON_FISHINGPOLE) -- 鱼竿
ns.DEFAULT_CUSTOM_ORDER = {
HEARTHSTONE_ITEM_ID, -- 炉石
{rule = 'tip:' .. L.KEYWORD_MOUNT}, -- 坐骑
5060, -- 潜行者工具
2901, -- 矿工锄
5956, -- 铁匠锤
7005, -- 剥皮刀
{rule = 'type:' .. FISHINGPOLE}, -- 鱼竿
{rule = 'type:' .. WEAPON}, -- 武器
{rule = 'type:' .. ARMOR}, -- 护甲
{rule = 'type:' .. CONTAINER}, -- 容器
{rule = 'type:' .. QUIVER}, -- 箭袋
{rule = 'type:' .. PROJECTILE}, -- 弹药
{rule = 'type:' .. RECIPE}, -- 配方
{
rule = 'type:' .. TRADEGOODS,
children = {
{rule = 'tip:' .. L.KEYWORD_CLASS}, -- 职业
},
}, -- 商品
{
rule = 'type:' .. CONSUMABLE,
children = {
{rule = 'tip:' .. L.KEYWORD_CLASS}, -- 职业
{rule = 'tip:' .. L.KEYWORD_FOOD}, -- 食物
{rule = 'tip:' .. L.KEYWORD_WATER}, -- 水
},
}, -- 消耗品
{rule = 'type:' .. MISC}, -- 杂项
{rule = 'type:' .. REAGENT}, -- 材料
{rule = 'type:' .. QUEST}, -- 任务
}
ns.DEFAULT_EQUIP_LOC_ORDER = {
'INVTYPE_2HWEAPON', -- 双手
'INVTYPE_WEAPON', -- 单手
'INVTYPE_WEAPONMAINHAND', -- 主手
'INVTYPE_WEAPONOFFHAND', -- 副手
'INVTYPE_SHIELD', -- 副手
'INVTYPE_HOLDABLE', -- 副手物品
'INVTYPE_RANGED', -- 远程
'INVTYPE_RELIC', -- 圣物
-- 'INVTYPE_RANGEDRIGHT', --远程
-- 'INVTYPE_THROWN', --投掷
'INVTYPE_HEAD', -- 头部
'INVTYPE_SHOULDER', -- 肩部
'INVTYPE_CHEST', -- 胸部
'INVTYPE_ROBE', -- 胸部
'INVTYPE_HAND', -- 手
'INVTYPE_LEGS', -- 腿部
'INVTYPE_WRIST', -- 手腕
'INVTYPE_WAIST', -- 腰部
'INVTYPE_FEET', -- 脚
'INVTYPE_CLOAK', -- 背部
'INVTYPE_NECK', -- 颈部
'INVTYPE_FINGER', -- 手指
'INVTYPE_TRINKET', -- 饰品
'INVTYPE_BODY', -- 衬衣
'INVTYPE_TABARD', -- 战袍
'INVTYPE_WEAPONMAINHAND_PET', -- 主要攻击
'INVTYPE_AMMO', -- 弹药
'INVTYPE_BAG', -- 背包
'INVTYPE_QUIVER', -- 箭袋
}
|
group "Dependencies"
include "Scarlet-OpenGL/Vendor/GLAD"
group ""
group "Scarlet-Additions"
include "Scarlet-Window"
include "Scarlet-GLFW"
include "Scarlet-OpenGL"
include "Scarlet-Vulkan"
include "Scarlet-DirectX"
include "Scarlet-AudioFX"
include "Scarlet-OpenAL"
include "Scarlet-Renderer"
include "Scarlet-Physics"
include "Scarlet-SceneGraph"
group ""
|
local CAT = "100early" -- prkd, hundo, rbo, kpdr25, gtclassic, kpdr21, 14ice, 14speed, allbosskpdr, allbosspkdr, allbossprkd, 100early
local last_state = {} -- holds all state that has been changed up untill last save
local preset_output = ""
local last_step = nil
local MEMTRACK = { -- {{{
{ 0x07C3, 0x6, 'GFX Pointers' },
{ 0x07F3, 0x2, 'Music Bank' },
{ 0x07F5, 0x2, 'Music Track' },
{ 0x078B, 0x2, 'Elevator Index' },
{ 0x078D, 0x2, 'DDB' },
{ 0x078F, 0x2, 'DoorOut Index' },
{ 0x079B, 0x2, 'MDB' },
{ 0x079F, 0x2, 'Region' },
--[[
{ 0x08F7, 0x2, 'How many blocks X the screen is scrolled?' },
{ 0x08F9, 0x2, 'How many blocks Y the screen is scrolled? (up = positive)' },
{ 0x08FB, 0x2, 'How many blocks X Layer 2 is scrolled?' },
{ 0x08FD, 0x2, 'How many blocks Y Layer 2 is scrolled? (up = positive)' },
{ 0x08FF, 0x2, 'How many blocks X the screen was scrolled previously (Checked to know when to update blocks)' },
{ 0x0901, 0x2, 'How many blocks Y the screen was scrolled previously (Checked to know when to update blocks) (up = positive)' },
{ 0x0903, 0x2, 'How many blocks X Layer 2 was scrolled previously (Checked to know when to update blocks)' },
{ 0x0905, 0x2, 'How many blocks Y Layer 2 was scrolled previously (Checked to know when to update blocks) (up = positive)' },
{ 0x0907, 0x2, 'How many blocks X BG1 is scrolled?' },
{ 0x0909, 0x2, 'How many blocks Y BG1 is scrolled? (up = positive)' },
{ 0x090B, 0x2, 'How many blocks X BG2 is scrolled?' },
{ 0x090D, 0x2, 'How many blocks Y BG2 is scrolled? (up = positive)' },
]]
{ 0x090F, 0x2, 'Screen subpixel X position.' },
{ 0x0911, 0x2, 'Screen X position in pixels' },
{ 0x0913, 0x2, 'Screen subpixel Y position' },
{ 0x0915, 0x2, 'Screen Y position in pixels' },
--[[
{ 0x0917, 0x2, 'Layer 2 X scroll in room in pixels?' },
{ 0x0919, 0x2, 'Layer 2 Y scroll in room in pixels? (up = positive)' },
{ 0x091B, 0x2, 'BG2 scroll percent to screen scroll (0 = 100, 1 = ?) (1 byte for X, 1 byte for Y)' },
{ 0x091D, 0x2, 'BG1 X scroll offset due to room transitions (Translates between screen scroll and BG1 scroll)' },
{ 0x091F, 0x2, 'BG1 Y scroll offset due to room transitions (Translates between screen scroll and BG1 scroll)' },
{ 0x0921, 0x2, 'BG2 X scroll offset due to room transitions (Translates between Layer 2 scroll and BG2 scroll)' },
{ 0x0923, 0x2, 'BG2 Y scroll offset due to room transitions (Translates between Layer 2 scroll and BG2 scroll)' },
{ 0x0925, 0x2, 'How many times the screen has scrolled? Stops at 40.' },
{ 0x0927, 0x2, 'X offset of room entrance for room transition (multiple of 100, screens)' },
{ 0x0929, 0x2, 'Y offset of room entrance for room transition (multiple of 100, screens. Adjusted by 20 when moving up)' },
{ 0x092B, 0x2, 'Movement speed for room transitions (subpixels per frame of room transition movement)' },
{ 0x092D, 0x2, 'Movement speed for room transitions (pixels per frame of room transition movement)' },
--]]
{ 0x093F, 0x2, 'Ceres escape flag' },
{ 0x09A2, 0x2, 'Equipped Items' },
{ 0x09A4, 0x2, 'Collected Items' },
{ 0x09A6, 0x2, 'Beams' },
{ 0x09A8, 0x2, 'Beams' },
{ 0x09C0, 0x2, 'Manual/Auto reserve tank' },
{ 0x09C2, 0x2, 'Health' },
{ 0x09C4, 0x2, 'Max helath' },
{ 0x09C6, 0x2, 'Missiles' },
{ 0x09C8, 0x2, 'Max missiles' },
{ 0x09CA, 0x2, 'Supers' },
{ 0x09CC, 0x2, 'Max supers' },
{ 0x09CE, 0x2, 'Pbs' },
{ 0x09D0, 0x2, 'Max pbs' },
-- { 0x09D2, 0x2, 'Current selected weapon' },
{ 0x09D4, 0x2, 'Max reserves' },
{ 0x09D6, 0x2, 'Reserves' },
-- { 0x0A04, 0x2, 'Auto-cancel item' },
{ 0x0A1C, 0x2, 'Samus position/state' },
{ 0x0A1E, 0x2, 'More position/state' },
{ 0x0A68, 0x2, 'Flash suit' },
{ 0x0A76, 0x2, 'Hyper beam' },
{ 0x0AF6, 0x2, 'Samus X' },
{ 0x0AFA, 0x2, 'Samus Y' },
{ 0x0B3F, 0x2, 'Blue suit' },
{ 0xD7C0, 0x60, 'SRAM copy' }, -- Prob not doing much?
{ 0xD820, 0x100, 'Events, Items, Doors' },
-- { 0xD840, 0x40, 'Items' },
-- { 0xD8B0, 0x40, 'Doors' },
-- { 0xD914, 0x2, 'Game mode?' },
} -- }}}
local SEGMENTS = {
["prkd"] = { -- {{{
{ ["name"] = "Bombs", ["steps"] = {} },
{ ["name"] = "Power Bombs", ["steps"] = {} },
{ ["name"] = "Gravity Suit", ["steps"] = {} },
{ ["name"] = "Cathedral", ["steps"] = {} },
{ ["name"] = "Ridley", ["steps"] = {} },
{ ["name"] = "Kraid", ["steps"] = {} },
{ ["name"] = "Draygon", ["steps"] = {} },
{ ["name"] = "Golden 4", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
}, -- }}}
["hundo"] = {
{ ["name"] = "Bombs", ["steps"] = {} },
{ ["name"] = "Kraid", ["steps"] = {} },
{ ["name"] = "Speed Booster", ["steps"] = {} },
{ ["name"] = "Ice Beam", ["steps"] = {} },
{ ["name"] = "Phantoon", ["steps"] = {} },
{ ["name"] = "Gravity", ["steps"] = {} },
{ ["name"] = "Brinstar Cleanup", ["steps"] = {} },
{ ["name"] = "Mama Turtle E-Tank", ["steps"] = {} },
{ ["name"] = "Maridia Cleanup", ["steps"] = {} },
{ ["name"] = "Draygon", ["steps"] = {} },
{ ["name"] = "Maridia Cleanup 2", ["steps"] = {} },
{ ["name"] = "Golden Torizo", ["steps"] = {} },
{ ["name"] = "Ridley", ["steps"] = {} },
{ ["name"] = "Crocomire", ["steps"] = {} },
{ ["name"] = "Brinstar Cleanup", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["rbo"] = {
{ ["name"] = "Bombs", ["steps"] = {} },
{ ["name"] = "Brinstar", ["steps"] = {} },
{ ["name"] = "Norfair (First Visit)", ["steps"] = {} },
{ ["name"] = "Brinstar Cleanup", ["steps"] = {} },
{ ["name"] = "Norfair (Second Visit)", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Norfair Escape", ["steps"] = {} },
{ ["name"] = "Maridia", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Kraid-G4", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["kpdr25"] = {
{ ["name"] = "Bombs", ["steps"] = {} },
{ ["name"] = "Kraid", ["steps"] = {} },
{ ["name"] = "Upper Norfair", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Maridia", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Golden 4", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["gtclassic"] = {
{ ["name"] = "Crateria", ["steps"] = {} },
{ ["name"] = "Brinstar", ["steps"] = {} },
{ ["name"] = "Bootless Upper Norfair", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Maridia", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["kpdr21"] = {
{ ["name"] = "Crateria", ["steps"] = {} },
{ ["name"] = "Brinstar", ["steps"] = {} },
{ ["name"] = "Upper Norfair", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Maridia", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["14ice"] = {
{ ["name"] = "Crateria", ["steps"] = {} },
{ ["name"] = "Brinstar", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Brinstar Revisit", ["steps"] = {} },
{ ["name"] = "Upper Norfair", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Maridia", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["14speed"] = {
{ ["name"] = "Crateria", ["steps"] = {} },
{ ["name"] = "Brinstar", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Brinstar Revisit", ["steps"] = {} },
{ ["name"] = "Upper Norfair", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Maridia", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["allbosskpdr"] = {
{ ["name"] = "Crateria", ["steps"] = {} },
{ ["name"] = "Brinstar", ["steps"] = {} },
{ ["name"] = "Upper Norfair", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Maridia", ["steps"] = {} },
{ ["name"] = "Upper Norfair Revisit", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Spore Spawn", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["allbosspkdr"] = {
{ ["name"] = "Crateria", ["steps"] = {} },
{ ["name"] = "Brinstar", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Upper Norfair", ["steps"] = {} },
{ ["name"] = "Kraids Lair", ["steps"] = {} },
{ ["name"] = "Maridia", ["steps"] = {} },
{ ["name"] = "Upper Norfair Revisit", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Spore Spawn", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["allbossprkd"] = {
{ ["name"] = "Crateria", ["steps"] = {} },
{ ["name"] = "Brinstar", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Upper Norfair", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Upper Norfair Revisit", ["steps"] = {} },
{ ["name"] = "Kraids Lair", ["steps"] = {} },
{ ["name"] = "Maridia", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
["100early"] = {
{ ["name"] = "Crateria", ["steps"] = {} },
{ ["name"] = "Brinstar", ["steps"] = {} },
{ ["name"] = "Upper Norfair", ["steps"] = {} },
{ ["name"] = "Red Tower and Crateria", ["steps"] = {} },
{ ["name"] = "Wrecked Ship", ["steps"] = {} },
{ ["name"] = "Brinstar Cleanup", ["steps"] = {} },
{ ["name"] = "Maridia Pre-Draygon", ["steps"] = {} },
{ ["name"] = "Maridia Post-Draygon", ["steps"] = {} },
{ ["name"] = "Kraid-Ice-Kronic", ["steps"] = {} },
{ ["name"] = "Lower Norfair", ["steps"] = {} },
{ ["name"] = "Final Cleanup", ["steps"] = {} },
{ ["name"] = "Tourian", ["steps"] = {} },
},
}
local STEPS = {
["hundo"] = {
-- Bombs
[1501] = { ["segment_no"] = 1, ["name"] = "Ceres elevator" },
[5280] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 rooms" },
[9201] = { ["segment_no"] = 1, ["name"] = "Ship" },
[9497] = { ["segment_no"] = 1, ["name"] = "Parlor down" },
[12466] = { ["segment_no"] = 1, ["name"] = "Morph" },
[16062] = { ["segment_no"] = 1, ["name"] = "Pit Room" },
[16694] = { ["segment_no"] = 1, ["name"] = "Climb" },
[18258] = { ["segment_no"] = 1, ["name"] = "Parlor up" },
[19958] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
-- Kraid
[22527] = { ["segment_no"] = 2, ["name"] = "Alcatraz" },
[23146] = { ["segment_no"] = 2, ["name"] = "Terminator" },
[24193] = { ["segment_no"] = 2, ["name"] = "Pirates Shaft" },
[25775] = { ["segment_no"] = 2, ["name"] = "Elevator" },
[26857] = { ["segment_no"] = 2, ["name"] = "Early Supers" },
[30136] = { ["segment_no"] = 2, ["name"] = "Reverse Mockball" },
[31884] = { ["segment_no"] = 2, ["name"] = "Dachora Room" },
[32914] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[34754] = { ["segment_no"] = 2, ["name"] = "Green Hill Zone" },
[36413] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[40264] = { ["segment_no"] = 2, ["name"] = "Kraid Entry" },
[42679] = { ["segment_no"] = 2, ["name"] = "Kraid" },
[45270] = { ["segment_no"] = 2, ["name"] = "Leaving Varia" },
[46500] = { ["segment_no"] = 2, ["name"] = "Leaving Kraid Hallway" },
[48342] = { ["segment_no"] = 2, ["name"] = "Kraid Escape" },
-- Speed Booster
[49985] = { ["segment_no"] = 3, ["name"] = "Business Center" },
[50291] = { ["segment_no"] = 3, ["name"] = "Hi Jump" },
[53201] = { ["segment_no"] = 3, ["name"] = "Business Center Climb" },
[53670] = { ["segment_no"] = 3, ["name"] = "Cathedral Entrance" },
[54323] = { ["segment_no"] = 3, ["name"] = "Cathedral" },
[55600] = { ["segment_no"] = 3, ["name"] = "Rising Tide" },
[56280] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain" },
[57070] = { ["segment_no"] = 3, ["name"] = "Bat Cave" },
[59761] = { ["segment_no"] = 3, ["name"] = "Leaving Speed Booster" },
-- Ice Beam
[61212] = { ["segment_no"] = 4, ["name"] = "Single Chamber" },
[61604] = { ["segment_no"] = 4, ["name"] = "Double Chamber" },
[63455] = { ["segment_no"] = 4, ["name"] = "Double Chamber Revisited" },
[64415] = { ["segment_no"] = 4, ["name"] = "Bubble Mountain Revisited" },
[66356] = { ["segment_no"] = 4, ["name"] = "Business Center Climb Ice" },
[66809] = { ["segment_no"] = 4, ["name"] = "Ice Beam Gate Room" },
[67458] = { ["segment_no"] = 4, ["name"] = "Ice Beam Snake Room" },
[68610] = { ["segment_no"] = 4, ["name"] = "Ice Beam Snake Room Revisit" },
[69037] = { ["segment_no"] = 4, ["name"] = "Ice Beam Gate Room Escape" },
[69700] = { ["segment_no"] = 4, ["name"] = "Business Center Elevator" },
-- Phantoon
[70882] = { ["segment_no"] = 5, ["name"] = "Alpha Spark" },
[71983] = { ["segment_no"] = 5, ["name"] = "Red Tower Revisit" },
[73200] = { ["segment_no"] = 5, ["name"] = "Hellway" },
[75757] = { ["segment_no"] = 5, ["name"] = "Leaving Alpha PBs" },
[79320] = { ["segment_no"] = 5, ["name"] = "Kihunter Room" },
[80235] = { ["segment_no"] = 5, ["name"] = "Ocean Fly" },
[84136] = { ["segment_no"] = 5, ["name"] = "Phantoon" },
-- Gravity
[89050] = { ["segment_no"] = 6, ["name"] = "WS Shaft Up 1" },
[89674] = { ["segment_no"] = 6, ["name"] = "WS Right Supers" },
[92911] = { ["segment_no"] = 6, ["name"] = "Spiky Room of Death" },
[94040] = { ["segment_no"] = 6, ["name"] = "WS E-Tank" },
[95743] = { ["segment_no"] = 6, ["name"] = "Spiky Room of Death Revisit" },
[97343] = { ["segment_no"] = 6, ["name"] = "WS Shaft Up 2" },
[98124] = { ["segment_no"] = 6, ["name"] = "Attic" },
[99395] = { ["segment_no"] = 6, ["name"] = "WS Robot Missiles" },
[100842] = { ["segment_no"] = 6, ["name"] = "Attic Revisit" },
[101459] = { ["segment_no"] = 6, ["name"] = "Sky Missiles" },
[104347] = { ["segment_no"] = 6, ["name"] = "Bowling" },
[110601] = { ["segment_no"] = 6, ["name"] = "Leaving Gravity" },
-- Brinstar Cleanup
[112878] = { ["segment_no"] = 7, ["name"] = "Crateria PBs" },
[114860] = { ["segment_no"] = 7, ["name"] = "Ship Room" },
[116854] = { ["segment_no"] = 7, ["name"] = "Gauntlet E-Tank" },
[117904] = { ["segment_no"] = 7, ["name"] = "Green Pirates Shaft" },
[120538] = { ["segment_no"] = 7, ["name"] = "Green Shaft Revisit" },
[121960] = { ["segment_no"] = 7, ["name"] = "Green Brinstar Beetoms" },
[123269] = { ["segment_no"] = 7, ["name"] = "Etecoon Energy Tank Room" },
[124497] = { ["segment_no"] = 7, ["name"] = "Etecoon Room" },
[126363] = { ["segment_no"] = 7, ["name"] = "Dachora Room Revisit" },
[126856] = { ["segment_no"] = 7, ["name"] = "Big Pink Revisit" },
[127971] = { ["segment_no"] = 7, ["name"] = "Mission Impossible PBs" },
[129390] = { ["segment_no"] = 7, ["name"] = "Pink Brinstar E-Tank" },
[131417] = { ["segment_no"] = 7, ["name"] = "Spore Spawn Supers" },
[134690] = { ["segment_no"] = 7, ["name"] = "Waterway E-Tank" },
-- Mama Turtle E-Tank
[136026] = { ["segment_no"] = 8, ["name"] = "Big Pink Charge Escape" },
[136728] = { ["segment_no"] = 8, ["name"] = "Green Hills Revisit" },
[138465] = { ["segment_no"] = 8, ["name"] = "Blockbuster" },
[141348] = { ["segment_no"] = 8, ["name"] = "Main Street" },
[142247] = { ["segment_no"] = 8, ["name"] = "Fish Tank" },
[142968] = { ["segment_no"] = 8, ["name"] = "Mama Turtle E-Tank" },
-- Maridia Cleanup
[144612] = { ["segment_no"] = 9, ["name"] = "Fish Tank Revisit" },
[145345] = { ["segment_no"] = 9, ["name"] = "Crab Supers" },
[146431] = { ["segment_no"] = 9, ["name"] = "Mt Everest" },
[147385] = { ["segment_no"] = 9, ["name"] = "Beach Missiles" },
[148264] = { ["segment_no"] = 9, ["name"] = "Maridia Bug Room" },
[148950] = { ["segment_no"] = 9, ["name"] = "Watering Hole" },
[150524] = { ["segment_no"] = 9, ["name"] = "Maridia Bug Room Revisit" },
[151033] = { ["segment_no"] = 9, ["name"] = "Beach Revisit" },
-- Draygon
[151922] = { ["segment_no"] = 10, ["name"] = "Aqueduct" },
[153180] = { ["segment_no"] = 10, ["name"] = "Botwoon" },
[154555] = { ["segment_no"] = 10, ["name"] = "Full Halfie" },
[155722] = { ["segment_no"] = 10, ["name"] = "Draygon Missiles" },
[156864] = { ["segment_no"] = 10, ["name"] = "Draygon" },
[160569] = { ["segment_no"] = 10, ["name"] = "Draygon Escape" },
-- Maridia Cleanup 2
[163453] = { ["segment_no"] = 11, ["name"] = "Aqueduct Revisit 1" },
[164615] = { ["segment_no"] = 11, ["name"] = "Right Sandpit" },
[167673] = { ["segment_no"] = 11, ["name"] = "Puyo Ice Clip (Springball)" },
[168307] = { ["segment_no"] = 11, ["name"] = "Shaktool" },
[172283] = { ["segment_no"] = 11, ["name"] = "Shaktool Revisit" },
[173306] = { ["segment_no"] = 11, ["name"] = "East Sand Hall" },
[175380] = { ["segment_no"] = 11, ["name"] = "Kassiuz Room" },
[176088] = { ["segment_no"] = 11, ["name"] = "Plasma" },
[177385] = { ["segment_no"] = 11, ["name"] = "Kassiuz Room Revisit" },
[178061] = { ["segment_no"] = 11, ["name"] = "Plasma Spark Room Down" },
[178658] = { ["segment_no"] = 11, ["name"] = "Cac Alley" },
[180242] = { ["segment_no"] = 11, ["name"] = "Aqueduct Revisit 2" },
[182949] = { ["segment_no"] = 11, ["name"] = "Left Sandpit" },
[186584] = { ["segment_no"] = 11, ["name"] = "Thread the Needle Room" },
-- Golden Torizo
[187255] = { ["segment_no"] = 12, ["name"] = "Kraid Entrance Revisit" },
[188216] = { ["segment_no"] = 12, ["name"] = "Kraid Missiles" },
[189312] = { ["segment_no"] = 12, ["name"] = "Kraid Missiles Escape" },
[191250] = { ["segment_no"] = 12, ["name"] = "Ice Missiles" },
[192810] = { ["segment_no"] = 12, ["name"] = "Croc Speedway" },
[194316] = { ["segment_no"] = 12, ["name"] = "Kronic Boost" },
[196389] = { ["segment_no"] = 12, ["name"] = "Blue Fireball" },
[198856] = { ["segment_no"] = 12, ["name"] = "Golden Torizo" },
-- Ridley
[202166] = { ["segment_no"] = 13, ["name"] = "Fast Ripper Room" },
[203324] = { ["segment_no"] = 13, ["name"] = "WRITG" },
[203940] = { ["segment_no"] = 13, ["name"] = "Mickey Mouse Missiles" },
[205458] = { ["segment_no"] = 13, ["name"] = "Amphitheatre" },
[206284] = { ["segment_no"] = 13, ["name"] = "Kihunter Shaft Down" },
[207455] = { ["segment_no"] = 13, ["name"] = "Wasteland Down" },
[209248] = { ["segment_no"] = 13, ["name"] = "Ninja Pirates" },
[210110] = { ["segment_no"] = 13, ["name"] = "Plowerhouse Room" },
[210890] = { ["segment_no"] = 13, ["name"] = "Ridley" },
[214330] = { ["segment_no"] = 13, ["name"] = "Ridley Escape" },
[216087] = { ["segment_no"] = 13, ["name"] = "Wasteland Up" },
[217163] = { ["segment_no"] = 13, ["name"] = "Kihunter Shaft Up" },
[218280] = { ["segment_no"] = 13, ["name"] = "Firefleas Room" },
[220036] = { ["segment_no"] = 13, ["name"] = "Hotarubi Special" },
[223280] = { ["segment_no"] = 13, ["name"] = "3 Muskateers" },
-- Crocomire
[225698] = { ["segment_no"] = 14, ["name"] = "Bubble Mountain Revisit" },
[226184] = { ["segment_no"] = 14, ["name"] = "Norfair Reserve" },
[228929] = { ["segment_no"] = 14, ["name"] = "Bubble Mountain Cleanup" },
[230968] = { ["segment_no"] = 14, ["name"] = "Red Pirate Shaft" },
[231993] = { ["segment_no"] = 14, ["name"] = "Crocomire" },
[237684] = { ["segment_no"] = 14, ["name"] = "Grapple Shaft Down" },
[240288] = { ["segment_no"] = 14, ["name"] = "Grapple Shaft Up" },
[242667] = { ["segment_no"] = 14, ["name"] = "Crocomire Room Revisit" },
[243597] = { ["segment_no"] = 14, ["name"] = "Croc Escape" },
[244449] = { ["segment_no"] = 14, ["name"] = "Business Center Climb Final" },
-- Brinstar Cleanup
[246530] = { ["segment_no"] = 15, ["name"] = "Below Spazer" },
[247086] = { ["segment_no"] = 15, ["name"] = "Red Tower X-Ray" },
[247721] = { ["segment_no"] = 15, ["name"] = "Red Brinstar Firefleas" },
[249555] = { ["segment_no"] = 15, ["name"] = "Red Brinstar Firefleas 2" },
[251220] = { ["segment_no"] = 15, ["name"] = "Reverse Slinky" },
[252203] = { ["segment_no"] = 15, ["name"] = "Retro Brinstar Hoppers" },
[253469] = { ["segment_no"] = 15, ["name"] = "Retro Brinstar E-Tank" },
[254915] = { ["segment_no"] = 15, ["name"] = "Billy Mays" },
[256482] = { ["segment_no"] = 15, ["name"] = "Billy Mays Escape" },
[257731] = { ["segment_no"] = 15, ["name"] = "Retro Brinstar Escape" },
[259284] = { ["segment_no"] = 15, ["name"] = "Pit Room" },
[260575] = { ["segment_no"] = 15, ["name"] = "Climb Supers" },
[263127] = { ["segment_no"] = 15, ["name"] = "The Last Missiles" },
[264203] = { ["segment_no"] = 15, ["name"] = "The Last Missiles Escape" },
-- Tourian
[270498] = { ["segment_no"] = 16, ["name"] = "Metroids 1" },
[271033] = { ["segment_no"] = 16, ["name"] = "Metroids 2" },
[271783] = { ["segment_no"] = 16, ["name"] = "Metroids 3" },
[272287] = { ["segment_no"] = 16, ["name"] = "Metroids 4" },
[273359] = { ["segment_no"] = 16, ["name"] = "Baby Skip" },
[275659] = { ["segment_no"] = 16, ["name"] = "Zeb Skip" },
[287672] = { ["segment_no"] = 16, ["name"] = "Escape Room 3" },
[289942] = { ["segment_no"] = 16, ["name"] = "Escape Parlor" },
},
["prkd"] = { -- {{{
-- Bombs
[1501] = { ["segment_no"] = 1, ["name"] = "Elevator" },
[5280] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 rooms" },
[9200] = { ["segment_no"] = 1, ["name"] = "Ship" },
[9497] = { ["segment_no"] = 1, ["name"] = "Parlor down" },
[12466] = { ["segment_no"] = 1, ["name"] = "Morph" },
[16062] = { ["segment_no"] = 1, ["name"] = "Pit Room" },
[16694] = { ["segment_no"] = 1, ["name"] = "Climb" },
[18258] = { ["segment_no"] = 1, ["name"] = "Parlor up" },
[19958] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
-- PBs
[22527] = { ["segment_no"] = 2, ["name"] = "Alcatraz" },
[23146] = { ["segment_no"] = 2, ["name"] = "Terminator" },
[24193] = { ["segment_no"] = 2, ["name"] = "Pirates Shaft" },
[25775] = { ["segment_no"] = 2, ["name"] = "Elevator" },
[26857] = { ["segment_no"] = 2, ["name"] = "Early Supers" },
[28585] = { ["segment_no"] = 2, ["name"] = "Dachora Room" },
[29701] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[32107] = { ["segment_no"] = 2, ["name"] = "Green Hill Zone" },
[33851] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[34784] = { ["segment_no"] = 2, ["name"] = "Hellway" },
[35265] = { ["segment_no"] = 2, ["name"] = "Caterpillar Room down" },
-- Grav
[36883] = { ["segment_no"] = 3, ["name"] = "Caterpillar Room up" },
[39111] = { ["segment_no"] = 3, ["name"] = "Kihunter Room" },
[40245] = { ["segment_no"] = 3, ["name"] = "Moat" },
[42330] = { ["segment_no"] = 3, ["name"] = "Wrecked Ship Enter" },
[43520] = { ["segment_no"] = 3, ["name"] = "Phantoon" },
[48225] = { ["segment_no"] = 3, ["name"] = "Wrecked Ship Climb" },
[50996] = { ["segment_no"] = 3, ["name"] = "Attic" },
[53119] = { ["segment_no"] = 3, ["name"] = "Bowling Alley farm" },
[57285] = { ["segment_no"] = 3, ["name"] = "Grav" },
-- Cathedral
[58777] = { ["segment_no"] = 4, ["name"] = "Kihunter Room" },
[59709] = { ["segment_no"] = 4, ["name"] = "Caterpillar Room" },
[61221] = { ["segment_no"] = 4, ["name"] = "Red Tower" },
[62460] = { ["segment_no"] = 4, ["name"] = "Bat Room" },
[64934] = { ["segment_no"] = 4, ["name"] = "Glass Tunnel" },
[66100] = { ["segment_no"] = 4, ["name"] = "Business Center" },
[67214] = { ["segment_no"] = 4, ["name"] = "Hi Jump" },
[69710] = { ["segment_no"] = 4, ["name"] = "Business Center climb" },
[71169] = { ["segment_no"] = 4, ["name"] = "Ice Beam Snake Room" },
[73100] = { ["segment_no"] = 4, ["name"] = "Ice Escape" },
[74208] = { ["segment_no"] = 4, ["name"] = "Cathedral Entrance" },
-- Ridley
[74908] = { ["segment_no"] = 5, ["name"] = "Cathedral" },
[76178] = { ["segment_no"] = 5, ["name"] = "Bubble Mountain" },
[77945] = { ["segment_no"] = 5, ["name"] = "Bat Cave" },
[80260] = { ["segment_no"] = 5, ["name"] = "Bat Cave revisited" },
[82762] = { ["segment_no"] = 5, ["name"] = "Single Chamber" },
[83343] = { ["segment_no"] = 5, ["name"] = "Double Chamber" },
[85242] = { ["segment_no"] = 5, ["name"] = "Double Chamber revisited" },
[86792] = { ["segment_no"] = 5, ["name"] = "Volcano Room" },
[88082] = { ["segment_no"] = 5, ["name"] = "Lavaspark" },
[89060] = { ["segment_no"] = 5, ["name"] = "LN Elevator" },
[90538] = { ["segment_no"] = 5, ["name"] = "Fast Pillars" },
[91679] = { ["segment_no"] = 5, ["name"] = "WRITG" },
[92739] = { ["segment_no"] = 5, ["name"] = "Amphitheatre" },
[94150] = { ["segment_no"] = 5, ["name"] = "Kihunter shaft" },
[94961] = { ["segment_no"] = 5, ["name"] = "Wasteland" },
[96756] = { ["segment_no"] = 5, ["name"] = "Metal Pirates" },
[98280] = { ["segment_no"] = 5, ["name"] = "Ridley Farming Room" },
[100442] = { ["segment_no"] = 5, ["name"] = "Ridley" },
-- Kraid
[105917] = { ["segment_no"] = 6, ["name"] = "Ridley Farming Room" },
[107542] = { ["segment_no"] = 6, ["name"] = "Wasteland" },
[108699] = { ["segment_no"] = 6, ["name"] = "Kihunter shaft" },
[110020] = { ["segment_no"] = 6, ["name"] = "Fireflea Room" },
[111280] = { ["segment_no"] = 6, ["name"] = "Three Muskateers Room" },
[112226] = { ["segment_no"] = 6, ["name"] = "Single Chamber" },
[113678] = { ["segment_no"] = 6, ["name"] = "Bubble Mountain" },
[114745] = { ["segment_no"] = 6, ["name"] = "Frog Speedway" },
[116822] = { ["segment_no"] = 6, ["name"] = "Warehouse Entrance" },
[117063] = { ["segment_no"] = 6, ["name"] = "Zeela Room" },
[118110] = { ["segment_no"] = 6, ["name"] = "Baby Kraid" },
[118925] = { ["segment_no"] = 6, ["name"] = "Kraid" },
-- Draygon
[122558] = { ["segment_no"] = 7, ["name"] = "Baby Kraid" },
[123896] = { ["segment_no"] = 7, ["name"] = "Warehouse Entrance" },
[124625] = { ["segment_no"] = 7, ["name"] = "Glass Tunnel" },
[125698] = { ["segment_no"] = 7, ["name"] = "Fish Tank" },
[126840] = { ["segment_no"] = 7, ["name"] = "Crab Shaft" },
[128032] = { ["segment_no"] = 7, ["name"] = "Botwoon Hallway" },
[128624] = { ["segment_no"] = 7, ["name"] = "Botwoon" },
[130882] = { ["segment_no"] = 7, ["name"] = "Halfie Climb" },
[133633] = { ["segment_no"] = 7, ["name"] = "Draygon" },
-- Golden Four
[137206] = { ["segment_no"] = 8, ["name"] = "Precious Room" },
[138261] = { ["segment_no"] = 8, ["name"] = "Halfie Climb" },
[139318] = { ["segment_no"] = 8, ["name"] = "Botwoon Hallway" },
[140401] = { ["segment_no"] = 8, ["name"] = "Crab Shaft" },
[140934] = { ["segment_no"] = 8, ["name"] = "Mt Everest" },
[142279] = { ["segment_no"] = 8, ["name"] = "Caterpillar Room" },
[144090] = { ["segment_no"] = 8, ["name"] = "Kihunter Room" },
[145017] = { ["segment_no"] = 8, ["name"] = "Parlor" },
[145530] = { ["segment_no"] = 8, ["name"] = "Terminator" },
[146715] = { ["segment_no"] = 8, ["name"] = "Golden Four" },
-- Tourian
[150256] = { ["segment_no"] = 9, ["name"] = "Enter Tourian" },
[151618] = { ["segment_no"] = 9, ["name"] = "M1" },
[152430] = { ["segment_no"] = 9, ["name"] = "M2" },
[152908] = { ["segment_no"] = 9, ["name"] = "M3" },
[153822] = { ["segment_no"] = 9, ["name"] = "M4" },
[155354] = { ["segment_no"] = 9, ["name"] = "Baby Skip" },
[158334] = { ["segment_no"] = 9, ["name"] = "Tourian Eye Door" },
[174836] = { ["segment_no"] = 9, ["name"] = "Escape Room 3" },
[177286] = { ["segment_no"] = 9, ["name"] = "Escape Parlor" },
}, -- }}}
["rbo"] = {
-- Bombs
[1501] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[5280] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 rooms" },
[9200] = { ["segment_no"] = 1, ["name"] = "Ship" },
[9497] = { ["segment_no"] = 1, ["name"] = "Parlor Down" },
[12466] = { ["segment_no"] = 1, ["name"] = "Morph" },
[16062] = { ["segment_no"] = 1, ["name"] = "Pit Room" },
[18336] = { ["segment_no"] = 1, ["name"] = "Retro E-Tank" },
[21631] = { ["segment_no"] = 1, ["name"] = "Climb" },
[23162] = { ["segment_no"] = 1, ["name"] = "Parlor Up" },
[24582] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[27038] = { ["segment_no"] = 1, ["name"] = "Alcatraz" },
[27573] = { ["segment_no"] = 1, ["name"] = "Terminator" },
-- Brinstar
[29861] = { ["segment_no"] = 2, ["name"] = "Green Brinstar Elevator" },
[30866] = { ["segment_no"] = 2, ["name"] = "Early Supers Reserve" },
[31992] = { ["segment_no"] = 2, ["name"] = "Early Supers Collection" },
[33375] = { ["segment_no"] = 2, ["name"] = "Dachora Room" },
[34289] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[35924] = { ["segment_no"] = 2, ["name"] = "Green Hill Zone" },
[37508] = { ["segment_no"] = 2, ["name"] = "Red Tower (Up)" },
[38254] = { ["segment_no"] = 2, ["name"] = "Hellway" },
[39099] = { ["segment_no"] = 2, ["name"] = "Alpha PBs" },
[40442] = { ["segment_no"] = 2, ["name"] = "Reverse Hellway" },
[40871] = { ["segment_no"] = 2, ["name"] = "Red Tower Moonfalls" },
[42193] = { ["segment_no"] = 2, ["name"] = "Spazer" },
-- Norfair (First Visit)
[44652] = { ["segment_no"] = 3, ["name"] = "Norfair Elevator" },
[45658] = { ["segment_no"] = 3, ["name"] = "High Jump" },
[47922] = { ["segment_no"] = 3, ["name"] = "Business Center (Up)" },
[48324] = { ["segment_no"] = 3, ["name"] = "First Hell Run" },
[50035] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain" },
[50766] = { ["segment_no"] = 3, ["name"] = "Bat Cave (Speed Farm)" },
[54448] = { ["segment_no"] = 3, ["name"] = "Leaving Speed (Speed Farm 2)" },
[58768] = { ["segment_no"] = 3, ["name"] = "Wave Escape" },
-- Brinstar Cleanup
[62727] = { ["segment_no"] = 4, ["name"] = "Alpha Spark" },
[63984] = { ["segment_no"] = 4, ["name"] = "Red Tower (Up)" },
[64714] = { ["segment_no"] = 4, ["name"] = "Green Brinstar (Backdoor)" },
[66177] = { ["segment_no"] = 4, ["name"] = "Big Pink (Cleanup 1)" },
[66823] = { ["segment_no"] = 4, ["name"] = "Spore Spawn Supers" },
[68130] = { ["segment_no"] = 4, ["name"] = "Spore Spawn Supers (Escape)" },
[68962] = { ["segment_no"] = 4, ["name"] = "Wave Gate E-Tank" },
[71135] = { ["segment_no"] = 4, ["name"] = "Dachora Room 2" },
[71861] = { ["segment_no"] = 4, ["name"] = "Green Shaft (Down)" },
[72552] = { ["segment_no"] = 4, ["name"] = "Etecoon Supers" },
[74122] = { ["segment_no"] = 4, ["name"] = "Etecoon Power Bombs (Optional)" },
[75814] = { ["segment_no"] = 4, ["name"] = "Green Shaft (Up)" },
[78331] = { ["segment_no"] = 4, ["name"] = "Reverse Terminator" },
[79311] = { ["segment_no"] = 4, ["name"] = "Climb Supers Moonfall" },
[82436] = { ["segment_no"] = 4, ["name"] = "Pit Room Shortcharge" },
[83373] = { ["segment_no"] = 4, ["name"] = "Retro Brinstar Powerbombs" },
[86546] = { ["segment_no"] = 4, ["name"] = "Ball Buster" },
-- Norfair (Second Visit)
[90199] = { ["segment_no"] = 5, ["name"] = "Ice Entry" },
[92228] = { ["segment_no"] = 5, ["name"] = "Ice Escape" },
[92895] = { ["segment_no"] = 5, ["name"] = "Ice Escape 2" },
[94465] = { ["segment_no"] = 5, ["name"] = "Croc Shaft Moonfall" },
[94798] = { ["segment_no"] = 5, ["name"] = "Croc Speedway" },
[95550] = { ["segment_no"] = 5, ["name"] = "Croc" },
[101723] = { ["segment_no"] = 5, ["name"] = "Grapple Shaft (Down)" },
[103260] = { ["segment_no"] = 5, ["name"] = "Grapple Escape" },
[103867] = { ["segment_no"] = 5, ["name"] = "Grapple Shaft (Up)" },
[105570] = { ["segment_no"] = 5, ["name"] = "Croc (Re-visit)" },
[107115] = { ["segment_no"] = 5, ["name"] = "Lava Dive (Grapple Room)" },
[107684] = { ["segment_no"] = 5, ["name"] = "Lava Dive (Entry Room)" },
-- Lower Norfair
[110842] = { ["segment_no"] = 6, ["name"] = "Entry Room" },
[111180] = { ["segment_no"] = 6, ["name"] = "Green Gate Glitch" },
[114721] = { ["segment_no"] = 6, ["name"] = "Golden Torizo" },
[118842] = { ["segment_no"] = 6, ["name"] = "Energy Refill (Escape)" },
[119972] = { ["segment_no"] = 6, ["name"] = "Fast Pillars" },
[120780] = { ["segment_no"] = 6, ["name"] = "WRITG" },
[121618] = { ["segment_no"] = 6, ["name"] = "Amphitheater" },
[122517] = { ["segment_no"] = 6, ["name"] = "Firefleas Entry" },
[124760] = { ["segment_no"] = 6, ["name"] = "Kihunter Stairs (Down)" },
[127236] = { ["segment_no"] = 6, ["name"] = "Ninja Pirates" },
[128723] = { ["segment_no"] = 6, ["name"] = "Pre-Ridley" },
[132515] = { ["segment_no"] = 6, ["name"] = "Ridley" },
-- Norfair Escape
[136084] = { ["segment_no"] = 7, ["name"] = "Ridley E-Tank" },
[136334] = { ["segment_no"] = 7, ["name"] = "Post-Ridley" },
[141996] = { ["segment_no"] = 7, ["name"] = "Firefleas" },
[143274] = { ["segment_no"] = 7, ["name"] = "Firefleas Exit (Spikesuit)" },
[144014] = { ["segment_no"] = 7, ["name"] = "3 Musketeers" },
[144911] = { ["segment_no"] = 7, ["name"] = "3 Musketeers Exit" },
[146698] = { ["segment_no"] = 7, ["name"] = "Croc Gate Farm" },
[149891] = { ["segment_no"] = 7, ["name"] = "Business Center (Up)" },
-- Maridia
[151351] = { ["segment_no"] = 8, ["name"] = "Maridia Entry (Spikesuit)" },
[154146] = { ["segment_no"] = 8, ["name"] = "Mt. Everest" },
[155744] = { ["segment_no"] = 8, ["name"] = "Aqueduct" },
[157088] = { ["segment_no"] = 8, ["name"] = "Pre-Botwoon (Ice Clip)" },
[158365] = { ["segment_no"] = 8, ["name"] = "Botwoon" },
[161868] = { ["segment_no"] = 8, ["name"] = "Post-Botwoon (Shinespark)" },
[163506] = { ["segment_no"] = 8, ["name"] = "Colosseum" },
[165132] = { ["segment_no"] = 8, ["name"] = "Draygon" },
[171200] = { ["segment_no"] = 8, ["name"] = "Draygon Escape" },
[172987] = { ["segment_no"] = 8, ["name"] = "Reverse Colosseum" },
[174443] = { ["segment_no"] = 8, ["name"] = "Cac Alley" },
[176524] = { ["segment_no"] = 8, ["name"] = "Plasma Spark Room" },
[177622] = { ["segment_no"] = 8, ["name"] = "Kassiuz Room" },
[178314] = { ["segment_no"] = 8, ["name"] = "Plasma (Screw Attack Strat)" },
[180678] = { ["segment_no"] = 8, ["name"] = "Leaving Maridia" },
-- Wrecked Ship
[183045] = { ["segment_no"] = 9, ["name"] = "Forgotten Highway" },
[184702] = { ["segment_no"] = 9, ["name"] = "East Ocean" },
[185614] = { ["segment_no"] = 9, ["name"] = "Wrecked Ship Backdoor Entry" },
[186893] = { ["segment_no"] = 9, ["name"] = "WS Shaft (Down)" },
[187903] = { ["segment_no"] = 9, ["name"] = "Phantoon" },
[193219] = { ["segment_no"] = 9, ["name"] = "WS Shaft (Up)" },
[194246] = { ["segment_no"] = 9, ["name"] = "West Ocean" },
-- Kraid/G4
[195427] = { ["segment_no"] = 10, ["name"] = "Kihunters Room (Down)" },
[197378] = { ["segment_no"] = 10, ["name"] = "Red Brinstar Elevator (Down)" },
[198173] = { ["segment_no"] = 10, ["name"] = "Red Tower Moonfall (Screw Attack)" },
[200226] = { ["segment_no"] = 10, ["name"] = "Kraid Entry" },
[201585] = { ["segment_no"] = 10, ["name"] = "Kraid Hallway" },
[202531] = { ["segment_no"] = 10, ["name"] = "Kraid" },
[204320] = { ["segment_no"] = 10, ["name"] = "Kraid Hallway (Exit)" },
[205962] = { ["segment_no"] = 10, ["name"] = "Kraid Escape" },
[207604] = { ["segment_no"] = 10, ["name"] = "Red Tower (Up)" },
[210374] = { ["segment_no"] = 10, ["name"] = "Kihunters Room (Up)" },
[211079] = { ["segment_no"] = 10, ["name"] = "Ship Room" },
[211934] = { ["segment_no"] = 10, ["name"] = "Terminator" },
[212977] = { ["segment_no"] = 10, ["name"] = "G4" },
-- Tourian
[217354] = { ["segment_no"] = 11, ["name"] = "Metroids" },
[218246] = { ["segment_no"] = 11, ["name"] = "Metroids 2" },
[218753] = { ["segment_no"] = 11, ["name"] = "Metroids 3" },
[219326] = { ["segment_no"] = 11, ["name"] = "Metroids 4" },
[220322] = { ["segment_no"] = 11, ["name"] = "Baby Skip" },
[223533] = { ["segment_no"] = 11, ["name"] = "Zeb Skip" },
[235467] = { ["segment_no"] = 11, ["name"] = "Escape Room 3" },
[237726] = { ["segment_no"] = 11, ["name"] = "Escape Parlor" },
},
["kpdr25"] = {
-- Bombs
[762] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[4538] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 Rooms" },
[8509] = { ["segment_no"] = 1, ["name"] = "Ship" },
[11482] = { ["segment_no"] = 1, ["name"] = "Morph" },
[15433] = { ["segment_no"] = 1, ["name"] = "Climb" },
[17952] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[21383] = { ["segment_no"] = 1, ["name"] = "Terminator" },
-- Kraid
[23760] = { ["segment_no"] = 2, ["name"] = "Green Brinstar Elevator" },
[29502] = { ["segment_no"] = 2, ["name"] = "Green Hills" },
[32657] = { ["segment_no"] = 2, ["name"] = "Spazer" },
[34553] = { ["segment_no"] = 2, ["name"] = "Warehouse Entrance" },
[36966] = { ["segment_no"] = 2, ["name"] = "Kraid" },
[39995] = { ["segment_no"] = 2, ["name"] = "Baby Kraid (Exiting)" },
[41315] = { ["segment_no"] = 2, ["name"] = "Kraid E-tank" },
-- Upper Norfair
[43662] = { ["segment_no"] = 3, ["name"] = "Business Center" },
[47086] = { ["segment_no"] = 3, ["name"] = "Pre-Cathedral" },
[48890] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain" },
[50118] = { ["segment_no"] = 3, ["name"] = "Speed Hallway" },
[53257] = { ["segment_no"] = 3, ["name"] = "Single Chamber" },
[55338] = { ["segment_no"] = 3, ["name"] = "Leaving Wave" },
[58618] = { ["segment_no"] = 3, ["name"] = "Entering Ice" },
[60840] = { ["segment_no"] = 3, ["name"] = "Ice Escape" },
-- Wrecked Ship
[62610] = { ["segment_no"] = 4, ["name"] = "Alpha Spark" },
[63879] = { ["segment_no"] = 4, ["name"] = "Red Tower" },
[65023] = { ["segment_no"] = 4, ["name"] = "Hellway" },
[66743] = { ["segment_no"] = 4, ["name"] = "Post Power Bombs" },
[68328] = { ["segment_no"] = 4, ["name"] = "Pre-Moat" },
[72548] = { ["segment_no"] = 4, ["name"] = "Phantoon" },
[77598] = { ["segment_no"] = 4, ["name"] = "WS Shaft" },
[79715] = { ["segment_no"] = 4, ["name"] = "Attic" },
[81505] = { ["segment_no"] = 4, ["name"] = "Pre Bowling" },
[86195] = { ["segment_no"] = 4, ["name"] = "Impulse Mockball" },
[88313] = { ["segment_no"] = 4, ["name"] = "Hellway Return" },
-- Maridia
[90414] = { ["segment_no"] = 5, ["name"] = "The Tube" },
[94135] = { ["segment_no"] = 5, ["name"] = "Botwoon" },
[96961] = { ["segment_no"] = 5, ["name"] = "Halfie" },
[98970] = { ["segment_no"] = 5, ["name"] = "Draygon" },
[103545] = { ["segment_no"] = 5, ["name"] = "Whomple Jump" },
[106528] = { ["segment_no"] = 5, ["name"] = "Plasma Spark Room" },
[110042] = { ["segment_no"] = 5, ["name"] = "Plasma Spark Revisit" },
-- Lower Norfair
[114155] = { ["segment_no"] = 6, ["name"] = "Business Center Revisit" },
[115835] = { ["segment_no"] = 6, ["name"] = "Magdollite Tunnel" },
[117490] = { ["segment_no"] = 6, ["name"] = "LN Elevator" },
[118468] = { ["segment_no"] = 6, ["name"] = "Fast Pillars" },
[121340] = { ["segment_no"] = 6, ["name"] = "Kihunter Stairs" },
[123664] = { ["segment_no"] = 6, ["name"] = "Metal Pirates" },
[125273] = { ["segment_no"] = 6, ["name"] = "Ridley" },
[128853] = { ["segment_no"] = 6, ["name"] = "Ridley E-tank" },
[130374] = { ["segment_no"] = 6, ["name"] = "Wasteland Revisit" },
[132663] = { ["segment_no"] = 6, ["name"] = "Fireflea Room" },
[133782] = { ["segment_no"] = 6, ["name"] = "Three Musketeers" },
-- Golden 4
[136713] = { ["segment_no"] = 7, ["name"] = "Frog Speedway" },
[138590] = { ["segment_no"] = 7, ["name"] = "Maridia Tube Revisit" },
[142181] = { ["segment_no"] = 7, ["name"] = "Pre-Moat Revisit" },
[143712] = { ["segment_no"] = 7, ["name"] = "Terminator Revisit" },
[148131] = { ["segment_no"] = 7, ["name"] = "G4 Elevator" },
-- Tourian
[149030] = { ["segment_no"] = 8, ["name"] = "Metroids 1" },
[149589] = { ["segment_no"] = 8, ["name"] = "Metroids 2" },
[150073] = { ["segment_no"] = 8, ["name"] = "Metroids 3" },
[150662] = { ["segment_no"] = 8, ["name"] = "Metroids 4" },
[151795] = { ["segment_no"] = 8, ["name"] = "Baby Skip" },
[155156] = { ["segment_no"] = 8, ["name"] = "Zeb Skip" },
[168154] = { ["segment_no"] = 8, ["name"] = "Escape Room 3" },
[170623] = { ["segment_no"] = 8, ["name"] = "Escape Parlor" },
},
["gtclassic"] = {
-- Crateria
[1011] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[4790] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 Rooms" },
[8675] = { ["segment_no"] = 1, ["name"] = "Ship" },
[11387] = { ["segment_no"] = 1, ["name"] = "Morph" },
[15102] = { ["segment_no"] = 1, ["name"] = "Climb" },
[17301] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[20423] = { ["segment_no"] = 1, ["name"] = "Terminator" },
-- Brinstar
[22816] = { ["segment_no"] = 2, ["name"] = "Green Brinstar Elevator" },
[26409] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[28568] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[29295] = { ["segment_no"] = 2, ["name"] = "Hellway" },
[30835] = { ["segment_no"] = 2, ["name"] = "Leaving Power Bombs" },
[33275] = { ["segment_no"] = 2, ["name"] = "Breaking Tube" },
[35469] = { ["segment_no"] = 2, ["name"] = "Baby Kraid (Entering)" },
[36560] = { ["segment_no"] = 2, ["name"] = "Kraid" },
[39563] = { ["segment_no"] = 2, ["name"] = "Baby Kraid (Exiting)" },
[40917] = { ["segment_no"] = 2, ["name"] = "Kraid E-tank" },
-- Bootless Upper Norfair
[43226] = { ["segment_no"] = 3, ["name"] = "Business Center" },
[44022] = { ["segment_no"] = 3, ["name"] = "Pre-Cathedral" },
[45226] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain" },
[46133] = { ["segment_no"] = 3, ["name"] = "Magdollite Tunnel" },
[47224] = { ["segment_no"] = 3, ["name"] = "Lava Dive" },
[49251] = { ["segment_no"] = 3, ["name"] = "LN Main Hall" },
[50127] = { ["segment_no"] = 3, ["name"] = "Green Gate Glitch" },
[51290] = { ["segment_no"] = 3, ["name"] = "GT Code" },
-- Lower Norfair
[53167] = { ["segment_no"] = 5, ["name"] = "Leaving Golden Torizo" },
[54099] = { ["segment_no"] = 5, ["name"] = "Green Gate Revisit" },
[55266] = { ["segment_no"] = 5, ["name"] = "Worst Room" },
[56718] = { ["segment_no"] = 5, ["name"] = "Kihunter Stairs" },
[58877] = { ["segment_no"] = 5, ["name"] = "Metal Pirates" },
[60266] = { ["segment_no"] = 5, ["name"] = "Ridley" },
[63861] = { ["segment_no"] = 5, ["name"] = "Reverse Plowerhouse" },
[64700] = { ["segment_no"] = 5, ["name"] = "Wasteland Revisit" },
[66832] = { ["segment_no"] = 5, ["name"] = "Fireflea Room" },
[67836] = { ["segment_no"] = 5, ["name"] = "Three Musketeers" },
[69450] = { ["segment_no"] = 5, ["name"] = "Bubble Mountain Revisit" },
-- Maridia
[72222] = { ["segment_no"] = 6, ["name"] = "Entering Maridia" },
[73533] = { ["segment_no"] = 6, ["name"] = "Mt Everest" },
[75546] = { ["segment_no"] = 6, ["name"] = "Botwoon" },
[76913] = { ["segment_no"] = 6, ["name"] = "Halfie" },
[78524] = { ["segment_no"] = 6, ["name"] = "Draygon" },
[81658] = { ["segment_no"] = 6, ["name"] = "Womple Jump" },
[82623] = { ["segment_no"] = 6, ["name"] = "Reverse Botwoon" },
[83681] = { ["segment_no"] = 6, ["name"] = "Aqueduct Revisit" },
[85513] = { ["segment_no"] = 6, ["name"] = "Red Tower Green Gate" },
-- Wrecked Ship
[86986] = { ["segment_no"] = 7, ["name"] = "Pre-Moat" },
[87927] = { ["segment_no"] = 7, ["name"] = "Ocean" },
[90261] = { ["segment_no"] = 7, ["name"] = "Phantoon" },
[93383] = { ["segment_no"] = 7, ["name"] = "WS Shaft" },
[94168] = { ["segment_no"] = 7, ["name"] = "Ocean Revisit" },
[96637] = { ["segment_no"] = 7, ["name"] = "Terminator Revisit" },
[101187] = { ["segment_no"] = 7, ["name"] = "G4 Elevator" },
-- Tourian
[102194] = { ["segment_no"] = 8, ["name"] = "Metroids 1" },
[102902] = { ["segment_no"] = 8, ["name"] = "Metroids 2" },
[103533] = { ["segment_no"] = 8, ["name"] = "Metroids 3" },
[104333] = { ["segment_no"] = 8, ["name"] = "Metroids 4" },
[105135] = { ["segment_no"] = 8, ["name"] = "Baby Skip" },
[108515] = { ["segment_no"] = 8, ["name"] = "Zeb Skip" },
[120378] = { ["segment_no"] = 8, ["name"] = "Escape Room 3" },
[122654] = { ["segment_no"] = 8, ["name"] = "Escape Parlor" },
},
["kpdr21"] = {
-- Crateria
[983] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[4777] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 Rooms" },
[8664] = { ["segment_no"] = 1, ["name"] = "Ship" },
[10274] = { ["segment_no"] = 1, ["name"] = "Pit Room" },
[11628] = { ["segment_no"] = 1, ["name"] = "Morph" },
[14941] = { ["segment_no"] = 1, ["name"] = "Pit Room Revisit" },
[15511] = { ["segment_no"] = 1, ["name"] = "Climb" },
[16504] = { ["segment_no"] = 1, ["name"] = "Parlor" },
[17800] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[21029] = { ["segment_no"] = 1, ["name"] = "Terminator" },
-- Brinstar
[23446] = { ["segment_no"] = 2, ["name"] = "Green Brinstar Elevator" },
[25973] = { ["segment_no"] = 2, ["name"] = "Dachora Room" },
[27014] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[30486] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[32485] = { ["segment_no"] = 2, ["name"] = "Entering Kraids Lair" },
[33900] = { ["segment_no"] = 2, ["name"] = "Baby Kraid (Entering)" },
[34925] = { ["segment_no"] = 2, ["name"] = "Kraid" },
[37893] = { ["segment_no"] = 2, ["name"] = "Baby Kraid (Exiting)" },
-- Upper Norfair
[40530] = { ["segment_no"] = 3, ["name"] = "Business Center" },
[40821] = { ["segment_no"] = 3, ["name"] = "Hi Jump E-tank" },
[42464] = { ["segment_no"] = 3, ["name"] = "Leaving Hi Jump" },
[43915] = { ["segment_no"] = 3, ["name"] = "Pre-Cathedral" },
[45719] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain" },
[49555] = { ["segment_no"] = 3, ["name"] = "Single Chamber" },
[51614] = { ["segment_no"] = 3, ["name"] = "Double Chamber Revisit" },
[52597] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain Revisit" },
[54360] = { ["segment_no"] = 3, ["name"] = "Business Center Revisit" },
-- Wrecked Ship
[55598] = { ["segment_no"] = 4, ["name"] = "Alpha Spark" },
[56984] = { ["segment_no"] = 4, ["name"] = "Red Tower" },
[58105] = { ["segment_no"] = 4, ["name"] = "Hellway" },
[59641] = { ["segment_no"] = 4, ["name"] = "Leaving Power Bombs" },
[61605] = { ["segment_no"] = 4, ["name"] = "Crateria Elevator" },
[63253] = { ["segment_no"] = 4, ["name"] = "Entering Wrecked Ship" },
[64929] = { ["segment_no"] = 4, ["name"] = "Phantoon" },
[68405] = { ["segment_no"] = 4, ["name"] = "Leaving Phantoon" },
[70237] = { ["segment_no"] = 4, ["name"] = "Wrecked Ship Shaft" },
[71222] = { ["segment_no"] = 4, ["name"] = "Attic" },
[72912] = { ["segment_no"] = 4, ["name"] = "Bowling Spark" },
[76760] = { ["segment_no"] = 4, ["name"] = "Leaving Gravity" },
-- Maridia
[79242] = { ["segment_no"] = 5, ["name"] = "Red Tower Elevator" },
[81408] = { ["segment_no"] = 5, ["name"] = "Breaking Tube" },
[83071] = { ["segment_no"] = 5, ["name"] = "Mt Everest" },
[85267] = { ["segment_no"] = 5, ["name"] = "Botwoon" },
[87428] = { ["segment_no"] = 5, ["name"] = "Halfie" },
[88972] = { ["segment_no"] = 5, ["name"] = "Draygon" },
[93550] = { ["segment_no"] = 5, ["name"] = "Womple Jump" },
[94365] = { ["segment_no"] = 5, ["name"] = "Cac Alley" },
[95710] = { ["segment_no"] = 5, ["name"] = "Plasma Spark" },
[97155] = { ["segment_no"] = 5, ["name"] = "Plasma Beam" },
[99116] = { ["segment_no"] = 5, ["name"] = "Plasma Spark Revisit" },
[100390] = { ["segment_no"] = 5, ["name"] = "Sewers" },
-- Lower Norfair
[103371] = { ["segment_no"] = 6, ["name"] = "Ice Beam" },
[105420] = { ["segment_no"] = 6, ["name"] = "Ice Escape" },
[106735] = { ["segment_no"] = 6, ["name"] = "Crocomire Speedway" },
[108267] = { ["segment_no"] = 6, ["name"] = "Kronic Boost" },
[110302] = { ["segment_no"] = 6, ["name"] = "LN Main Hall" },
[111461] = { ["segment_no"] = 6, ["name"] = "Worst Room in the Game" },
[113244] = { ["segment_no"] = 6, ["name"] = "Kihunter Stairs" },
[115593] = { ["segment_no"] = 6, ["name"] = "Metal Pirates" },
[117111] = { ["segment_no"] = 6, ["name"] = "Ridley" },
[120289] = { ["segment_no"] = 6, ["name"] = "Leaving Ridley" },
[121621] = { ["segment_no"] = 6, ["name"] = "Wasteland Revisit" },
[123962] = { ["segment_no"] = 6, ["name"] = "Fire Flea Room" },
[124943] = { ["segment_no"] = 6, ["name"] = "Three Musketeers" },
[126707] = { ["segment_no"] = 6, ["name"] = "Bubble Mountain ReRevisit" },
-- Tourian
[129535] = { ["segment_no"] = 7, ["name"] = "Maridia Passthrough" },
[132975] = { ["segment_no"] = 7, ["name"] = "Crateria Passthrough" },
[134475] = { ["segment_no"] = 7, ["name"] = "Terminator Revisit" },
[139925] = { ["segment_no"] = 7, ["name"] = "Metroids 1" },
[140565] = { ["segment_no"] = 7, ["name"] = "Metroids 2" },
[141075] = { ["segment_no"] = 7, ["name"] = "Metroids 3" },
[141693] = { ["segment_no"] = 7, ["name"] = "Metroids 4" },
[142290] = { ["segment_no"] = 7, ["name"] = "Baby Skip" },
[145847] = { ["segment_no"] = 7, ["name"] = "Zeb Skip" },
[158810] = { ["segment_no"] = 7, ["name"] = "Escape Room 3" },
[161175] = { ["segment_no"] = 7, ["name"] = "Escape Parlor" },
},
["14ice"] = {
-- Crateria
[1020] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[4804] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 Rooms" },
[8691] = { ["segment_no"] = 1, ["name"] = "Ship" },
[11398] = { ["segment_no"] = 1, ["name"] = "Morph" },
[15133] = { ["segment_no"] = 1, ["name"] = "Climb" },
[17304] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[20426] = { ["segment_no"] = 1, ["name"] = "Terminator" },
-- Brinstar
[22824] = { ["segment_no"] = 2, ["name"] = "Green Brinstar Elevator" },
[26416] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[29625] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[30420] = { ["segment_no"] = 2, ["name"] = "Hellway" },
[30899] = { ["segment_no"] = 2, ["name"] = "Caterpillar Room" },
[32048] = { ["segment_no"] = 2, ["name"] = "Leaving Power Bombs" },
[34062] = { ["segment_no"] = 2, ["name"] = "Kihunter Room" },
[34842] = { ["segment_no"] = 2, ["name"] = "Moat" },
[35609] = { ["segment_no"] = 2, ["name"] = "Ocean" },
-- Wrecked Ship
[36907] = { ["segment_no"] = 3, ["name"] = "Wrecked Ship Shaft" },
[38523] = { ["segment_no"] = 3, ["name"] = "Phantoon" },
[42982] = { ["segment_no"] = 3, ["name"] = "Wrecked Ship Supers" },
[44350] = { ["segment_no"] = 3, ["name"] = "Shaft Revisit" },
[45590] = { ["segment_no"] = 3, ["name"] = "Attic" },
[47669] = { ["segment_no"] = 3, ["name"] = "Bowling Alley Path" },
[48218] = { ["segment_no"] = 3, ["name"] = "Bowling Alley" },
[51600] = { ["segment_no"] = 3, ["name"] = "Leaving Gravity" },
-- Brinstar Revisit
[54269] = { ["segment_no"] = 4, ["name"] = "Red Tower Elevator" },
[56851] = { ["segment_no"] = 4, ["name"] = "Breaking Tube" },
[57550] = { ["segment_no"] = 4, ["name"] = "Entering Kraids Lair" },
[58897] = { ["segment_no"] = 4, ["name"] = "Baby Kraid (Entering)" },
[59908] = { ["segment_no"] = 4, ["name"] = "Kraid" },
[62995] = { ["segment_no"] = 4, ["name"] = "Baby Kraid (Exiting)" },
[64557] = { ["segment_no"] = 4, ["name"] = "Kraid E-tank" },
-- Upper Norfair
[66800] = { ["segment_no"] = 5, ["name"] = "Ice Beam" },
[69270] = { ["segment_no"] = 5, ["name"] = "Ice Escape" },
[70310] = { ["segment_no"] = 5, ["name"] = "Pre-Cathedral" },
[71563] = { ["segment_no"] = 5, ["name"] = "Bubble Mountain" },
[73075] = { ["segment_no"] = 5, ["name"] = "Magdollite Room" },
[73593] = { ["segment_no"] = 5, ["name"] = "Kronic Boost" },
-- Lower Norfair
[76217] = { ["segment_no"] = 6, ["name"] = "LN Main Hall" },
[77055] = { ["segment_no"] = 6, ["name"] = "Pillars" },
[78021] = { ["segment_no"] = 6, ["name"] = "Worst Room" },
[79908] = { ["segment_no"] = 6, ["name"] = "Amphitheatre" },
[81144] = { ["segment_no"] = 6, ["name"] = "Kihunter Stairs" },
[82588] = { ["segment_no"] = 6, ["name"] = "Wasteland" },
[84042] = { ["segment_no"] = 6, ["name"] = "Metal Pirates" },
[88973] = { ["segment_no"] = 6, ["name"] = "Ridley" },
[109660] = { ["segment_no"] = 6, ["name"] = "Leaving Ridley" },
[111650] = { ["segment_no"] = 6, ["name"] = "Wasteland Revisit" },
[113044] = { ["segment_no"] = 6, ["name"] = "Kihunter Stairs Revisit" },
[114467] = { ["segment_no"] = 6, ["name"] = "Fireflea Room" },
[115732] = { ["segment_no"] = 6, ["name"] = "Three Musketeers" },
[118232] = { ["segment_no"] = 6, ["name"] = "Bubble Mountain Revisit" },
-- Maridia
[124469] = { ["segment_no"] = 7, ["name"] = "Entering Maridia" },
[126147] = { ["segment_no"] = 7, ["name"] = "Mt Everest" },
[129067] = { ["segment_no"] = 7, ["name"] = "Ice Clip" },
[130185] = { ["segment_no"] = 7, ["name"] = "Botwoon" },
[131695] = { ["segment_no"] = 7, ["name"] = "Botwoon E-tank Room" },
[135121] = { ["segment_no"] = 7, ["name"] = "Colosseum" },
[136900] = { ["segment_no"] = 7, ["name"] = "Draygon" },
[149209] = { ["segment_no"] = 7, ["name"] = "Colosseum Revisit" },
[151050] = { ["segment_no"] = 7, ["name"] = "Reverse Botwoon" },
[152672] = { ["segment_no"] = 7, ["name"] = "Aqueduct Revisit" },
[154044] = { ["segment_no"] = 7, ["name"] = "Everest Revisit" },
[157180] = { ["segment_no"] = 7, ["name"] = "Red Tower Green Gate" },
-- Tourian
[158646] = { ["segment_no"] = 8, ["name"] = "Kihunter Room Revisit" },
[160769] = { ["segment_no"] = 8, ["name"] = "Terminator Revisit" },
[161498] = { ["segment_no"] = 8, ["name"] = "Pirate Shaft Revisit" },
[166683] = { ["segment_no"] = 8, ["name"] = "Metroids 1" },
[167583] = { ["segment_no"] = 8, ["name"] = "Metroids 2" },
[168145] = { ["segment_no"] = 8, ["name"] = "Metroids 3" },
[169241] = { ["segment_no"] = 8, ["name"] = "Metroids 4" },
[170002] = { ["segment_no"] = 8, ["name"] = "Baby" },
[177624] = { ["segment_no"] = 8, ["name"] = "Zeb Skip" },
[205325] = { ["segment_no"] = 8, ["name"] = "Escape Room 3" },
[209282] = { ["segment_no"] = 8, ["name"] = "Escape Parlor" },
},
["14speed"] = {
-- Crateria
[1020] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[4804] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 Rooms" },
[8691] = { ["segment_no"] = 1, ["name"] = "Ship" },
[11398] = { ["segment_no"] = 1, ["name"] = "Morph" },
[15133] = { ["segment_no"] = 1, ["name"] = "Climb" },
[17304] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[20426] = { ["segment_no"] = 1, ["name"] = "Terminator" },
-- Brinstar
[22824] = { ["segment_no"] = 2, ["name"] = "Green Brinstar Elevator" },
[26416] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[29625] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[30420] = { ["segment_no"] = 2, ["name"] = "Hellway" },
[30899] = { ["segment_no"] = 2, ["name"] = "Caterpillar Room" },
[32048] = { ["segment_no"] = 2, ["name"] = "Leaving Power Bombs" },
[34062] = { ["segment_no"] = 2, ["name"] = "Kihunter Room" },
[34842] = { ["segment_no"] = 2, ["name"] = "Moat" },
[35609] = { ["segment_no"] = 2, ["name"] = "Ocean" },
-- Wrecked Ship
[36907] = { ["segment_no"] = 3, ["name"] = "Wrecked Ship Shaft" },
[38523] = { ["segment_no"] = 3, ["name"] = "Phantoon" },
[42982] = { ["segment_no"] = 3, ["name"] = "Wrecked Ship Supers" },
[44350] = { ["segment_no"] = 3, ["name"] = "Shaft Revisit" },
[45590] = { ["segment_no"] = 3, ["name"] = "Attic" },
[47669] = { ["segment_no"] = 3, ["name"] = "Bowling Alley Path" },
[48218] = { ["segment_no"] = 3, ["name"] = "Bowling Alley" },
[51600] = { ["segment_no"] = 3, ["name"] = "Leaving Gravity" },
-- Brinstar Revisit
[54269] = { ["segment_no"] = 4, ["name"] = "Red Tower Elevator" },
[56851] = { ["segment_no"] = 4, ["name"] = "Breaking Tube" },
[57550] = { ["segment_no"] = 4, ["name"] = "Entering Kraids Lair" },
[58897] = { ["segment_no"] = 4, ["name"] = "Baby Kraid (Entering)" },
[59908] = { ["segment_no"] = 4, ["name"] = "Kraid" },
[62995] = { ["segment_no"] = 4, ["name"] = "Baby Kraid (Exiting)" },
[64557] = { ["segment_no"] = 4, ["name"] = "Kraid E-tank" },
-- Upper Norfair
[66800] = { ["segment_no"] = 5, ["name"] = "Pre-Cathedral" },
[69000] = { ["segment_no"] = 5, ["name"] = "Bubble Mountain" },
[73600] = { ["segment_no"] = 5, ["name"] = "Bubble Mountain Revisit" },
[74685] = { ["segment_no"] = 5, ["name"] = "Magdollite Room" },
[76085] = { ["segment_no"] = 5, ["name"] = "Lava Spark" },
-- Lower Norfair
[77830] = { ["segment_no"] = 6, ["name"] = "LN Main Hall" },
[78715] = { ["segment_no"] = 6, ["name"] = "Pillars" },
[79220] = { ["segment_no"] = 6, ["name"] = "Worst Room" },
[82310] = { ["segment_no"] = 6, ["name"] = "Amphitheatre" },
[83825] = { ["segment_no"] = 6, ["name"] = "Kihunter Stairs" },
[85135] = { ["segment_no"] = 6, ["name"] = "Wasteland" },
[86360] = { ["segment_no"] = 6, ["name"] = "Metal Pirates" },
[87878] = { ["segment_no"] = 6, ["name"] = "Ridley Farming Room" },
[90375] = { ["segment_no"] = 6, ["name"] = "Ridley" },
[114930] = { ["segment_no"] = 6, ["name"] = "Leaving Ridley" },
[116915] = { ["segment_no"] = 6, ["name"] = "Wasteland Revisit" },
[118504] = { ["segment_no"] = 6, ["name"] = "Kihunter Stairs Revisit" },
[120050] = { ["segment_no"] = 6, ["name"] = "Fireflea Room" },
[121444] = { ["segment_no"] = 6, ["name"] = "Three Musketeers" },
[124442] = { ["segment_no"] = 6, ["name"] = "Bubble Mountain Revisit" },
-- Maridia
[128535] = { ["segment_no"] = 7, ["name"] = "Entering Maridia" },
[130276] = { ["segment_no"] = 7, ["name"] = "Mt Everest" },
[131315] = { ["segment_no"] = 7, ["name"] = "Aqueduct" },
[132885] = { ["segment_no"] = 7, ["name"] = "Botwoon" },
[134648] = { ["segment_no"] = 7, ["name"] = "Botwoon E-tank Room" },
[136291] = { ["segment_no"] = 7, ["name"] = "Colosseum" },
[138325] = { ["segment_no"] = 7, ["name"] = "Draygon" },
[143586] = { ["segment_no"] = 7, ["name"] = "Colosseum Revisit" },
[144674] = { ["segment_no"] = 7, ["name"] = "Reverse Botwoon" },
[146235] = { ["segment_no"] = 7, ["name"] = "Aqueduct Revisit" },
[147473] = { ["segment_no"] = 7, ["name"] = "Everest Revisit" },
[149644] = { ["segment_no"] = 7, ["name"] = "Red Tower Green Gate" },
-- Tourian
[151139] = { ["segment_no"] = 8, ["name"] = "Kihunter Room Revisit" },
[152980] = { ["segment_no"] = 8, ["name"] = "Terminator Revisit" },
[153889] = { ["segment_no"] = 8, ["name"] = "Pirate Shaft Revisit" },
[159000] = { ["segment_no"] = 8, ["name"] = "Metroids 1" },
[168485] = { ["segment_no"] = 8, ["name"] = "Metroids 2" },
[169499] = { ["segment_no"] = 8, ["name"] = "Metroids 3" },
[179835] = { ["segment_no"] = 8, ["name"] = "Metroids 4" },
[184275] = { ["segment_no"] = 8, ["name"] = "Doors and Refills" },
[188758] = { ["segment_no"] = 8, ["name"] = "Zeb Skip" },
[223868] = { ["segment_no"] = 8, ["name"] = "Escape Room 3" },
[226907] = { ["segment_no"] = 8, ["name"] = "Escape Parlor" },
},
["allbosskpdr"] = {
-- Crateria
[983] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[4777] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 Rooms" },
[8664] = { ["segment_no"] = 1, ["name"] = "Ship" },
[10274] = { ["segment_no"] = 1, ["name"] = "Pit Room" },
[11628] = { ["segment_no"] = 1, ["name"] = "Morph" },
[14941] = { ["segment_no"] = 1, ["name"] = "Pit Room Revisit" },
[15511] = { ["segment_no"] = 1, ["name"] = "Climb" },
[16504] = { ["segment_no"] = 1, ["name"] = "Parlor" },
[17800] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[21029] = { ["segment_no"] = 1, ["name"] = "Terminator" },
-- Brinstar
[23446] = { ["segment_no"] = 2, ["name"] = "Green Brinstar Elevator" },
[25973] = { ["segment_no"] = 2, ["name"] = "Dachora Room" },
[27014] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[30486] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[32485] = { ["segment_no"] = 2, ["name"] = "Entering Kraids Lair" },
[33900] = { ["segment_no"] = 2, ["name"] = "Baby Kraid (Entering)" },
[34925] = { ["segment_no"] = 2, ["name"] = "Kraid" },
[37893] = { ["segment_no"] = 2, ["name"] = "Baby Kraid (Exiting)" },
-- Upper Norfair
[40530] = { ["segment_no"] = 3, ["name"] = "Business Center" },
[40821] = { ["segment_no"] = 3, ["name"] = "Hi Jump E-tank" },
[42464] = { ["segment_no"] = 3, ["name"] = "Leaving Hi Jump" },
[43915] = { ["segment_no"] = 3, ["name"] = "Pre-Cathedral" },
[45719] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain" },
[49555] = { ["segment_no"] = 3, ["name"] = "Single Chamber" },
[51614] = { ["segment_no"] = 3, ["name"] = "Double Chamber Revisit" },
[52597] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain Revisit" },
[54360] = { ["segment_no"] = 3, ["name"] = "Business Center Revisit" },
-- Wrecked Ship
[55598] = { ["segment_no"] = 4, ["name"] = "Alpha Spark" },
[56984] = { ["segment_no"] = 4, ["name"] = "Red Tower" },
[58105] = { ["segment_no"] = 4, ["name"] = "Hellway" },
[59641] = { ["segment_no"] = 4, ["name"] = "Leaving Power Bombs" },
[61605] = { ["segment_no"] = 4, ["name"] = "Crateria Elevator" },
[63253] = { ["segment_no"] = 4, ["name"] = "Entering Wrecked Ship" },
[64929] = { ["segment_no"] = 4, ["name"] = "Phantoon" },
[68405] = { ["segment_no"] = 4, ["name"] = "Leaving Phantoon" },
[70237] = { ["segment_no"] = 4, ["name"] = "Wrecked Ship Shaft" },
[71222] = { ["segment_no"] = 4, ["name"] = "Attic" },
[72912] = { ["segment_no"] = 4, ["name"] = "Bowling Spark" },
[76760] = { ["segment_no"] = 4, ["name"] = "Leaving Gravity" },
-- Maridia
[79242] = { ["segment_no"] = 5, ["name"] = "Red Tower Elevator" },
[81408] = { ["segment_no"] = 5, ["name"] = "Breaking Tube" },
[83071] = { ["segment_no"] = 5, ["name"] = "Mt Everest" },
[85267] = { ["segment_no"] = 5, ["name"] = "Botwoon" },
[87428] = { ["segment_no"] = 5, ["name"] = "Halfie" },
[88972] = { ["segment_no"] = 5, ["name"] = "Draygon" },
[93550] = { ["segment_no"] = 5, ["name"] = "Womple Jump" },
[94365] = { ["segment_no"] = 5, ["name"] = "Cac Alley" },
[95710] = { ["segment_no"] = 5, ["name"] = "Plasma Spark" },
[97155] = { ["segment_no"] = 5, ["name"] = "Plasma Beam" },
[99116] = { ["segment_no"] = 5, ["name"] = "Plasma Spark Revisit" },
[100390] = { ["segment_no"] = 5, ["name"] = "Sewers" },
-- Upper Norfair Revisit
[103371] = { ["segment_no"] = 6, ["name"] = "Ice Beam Hallway" },
[103973] = { ["segment_no"] = 6, ["name"] = "Ice Maze" },
[105610] = { ["segment_no"] = 6, ["name"] = "Ice Escape" },
[107800] = { ["segment_no"] = 6, ["name"] = "Crocomire Speedway" },
[108560] = { ["segment_no"] = 6, ["name"] = "Crocomire" },
[113147] = { ["segment_no"] = 6, ["name"] = "Leaving Crocomire" },
[114130] = { ["segment_no"] = 6, ["name"] = "Kronic Boost" },
-- Lower Norfair
[116215] = { ["segment_no"] = 7, ["name"] = "LN Main Hall" },
[117110] = { ["segment_no"] = 7, ["name"] = "Green Gate Glitch" },
[118090] = { ["segment_no"] = 7, ["name"] = "Golden Torizo" },
[120020] = { ["segment_no"] = 7, ["name"] = "Screw Attack Escape" },
[122161] = { ["segment_no"] = 7, ["name"] = "Worst Room in the Game" },
[123634] = { ["segment_no"] = 7, ["name"] = "Kihunter Stairs" },
[126135] = { ["segment_no"] = 7, ["name"] = "Metal Pirates" },
[128149] = { ["segment_no"] = 7, ["name"] = "Ridley" },
[131720] = { ["segment_no"] = 7, ["name"] = "Leaving Ridley" },
[133128] = { ["segment_no"] = 7, ["name"] = "Wasteland Revisit" },
[136088] = { ["segment_no"] = 7, ["name"] = "Fire Flea Room" },
[137285] = { ["segment_no"] = 7, ["name"] = "Three Musketeers" },
[139256] = { ["segment_no"] = 7, ["name"] = "Bubble Mountain ReRevisit" },
-- Spore Spawn
[142276] = { ["segment_no"] = 8, ["name"] = "Maridia Passthrough" },
[143672] = { ["segment_no"] = 8, ["name"] = "Red Tower" },
[144450] = { ["segment_no"] = 8, ["name"] = "Lower Green Brinstar" },
[145931] = { ["segment_no"] = 8, ["name"] = "Big Pink Up" },
[148132] = { ["segment_no"] = 8, ["name"] = "Spore Spawn" },
[150243] = { ["segment_no"] = 8, ["name"] = "Big Pink Down" },
[151011] = { ["segment_no"] = 8, ["name"] = "Dachora Room Revisit" },
[153011] = { ["segment_no"] = 8, ["name"] = "Crateria" },
-- Tourian
[158215] = { ["segment_no"] = 9, ["name"] = "Metroids 1" },
[158880] = { ["segment_no"] = 9, ["name"] = "Metroids 2" },
[159489] = { ["segment_no"] = 9, ["name"] = "Metroids 3" },
[160837] = { ["segment_no"] = 9, ["name"] = "Metroids 4" },
[161657] = { ["segment_no"] = 9, ["name"] = "Baby Skip" },
[164874] = { ["segment_no"] = 9, ["name"] = "Zeb Skip" },
[178197] = { ["segment_no"] = 9, ["name"] = "Escape Room 3" },
[180624] = { ["segment_no"] = 9, ["name"] = "Escape Parlor" },
},
["allbosspkdr"] = {
-- Crateria
[983] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[4777] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 Rooms" },
[8664] = { ["segment_no"] = 1, ["name"] = "Ship" },
[10274] = { ["segment_no"] = 1, ["name"] = "Pit Room" },
[11628] = { ["segment_no"] = 1, ["name"] = "Morph" },
[14941] = { ["segment_no"] = 1, ["name"] = "Pit Room Revisit" },
[15511] = { ["segment_no"] = 1, ["name"] = "Climb" },
[16504] = { ["segment_no"] = 1, ["name"] = "Parlor" },
[17800] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[21029] = { ["segment_no"] = 1, ["name"] = "Terminator" },
[22222] = { ["segment_no"] = 1, ["name"] = "Green Pirate Shaft" },
-- Brinstar
[23566] = { ["segment_no"] = 2, ["name"] = "Green Brinstar Elevator" },
[26293] = { ["segment_no"] = 2, ["name"] = "Dachora Room" },
[27410] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[30943] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[31729] = { ["segment_no"] = 2, ["name"] = "Hellway" },
[33444] = { ["segment_no"] = 2, ["name"] = "Leaving Power Bombs" },
[35355] = { ["segment_no"] = 2, ["name"] = "Crateria Elevator" },
[36144] = { ["segment_no"] = 2, ["name"] = "Moat" },
[36931] = { ["segment_no"] = 2, ["name"] = "Ocean" },
-- Wrecked Ship
[37814] = { ["segment_no"] = 3, ["name"] = "Entering Wrecked Ship" },
[39821] = { ["segment_no"] = 3, ["name"] = "Phantoon" },
[44232] = { ["segment_no"] = 3, ["name"] = "Leaving Phantoon" },
[46106] = { ["segment_no"] = 3, ["name"] = "Wrecked Ship Shaft" },
[47417] = { ["segment_no"] = 3, ["name"] = "Attic" },
[50126] = { ["segment_no"] = 3, ["name"] = "Bowling Spark" },
[53627] = { ["segment_no"] = 3, ["name"] = "Leaving Gravity" },
[56437] = { ["segment_no"] = 3, ["name"] = "Red Tower Elevator" },
[57154] = { ["segment_no"] = 3, ["name"] = "Red Tower Descent" },
[59140] = { ["segment_no"] = 3, ["name"] = "Breaking Tube" },
-- Upper Norfair
[60863] = { ["segment_no"] = 4, ["name"] = "Business Center" },
[61214] = { ["segment_no"] = 4, ["name"] = "Hi Jump E-tank" },
[63638] = { ["segment_no"] = 4, ["name"] = "Leaving Hi Jump" },
[64066] = { ["segment_no"] = 4, ["name"] = "Pre-Cathedral" },
[65825] = { ["segment_no"] = 4, ["name"] = "Bubble Mountain" },
[70142] = { ["segment_no"] = 4, ["name"] = "Single Chamber" },
[72321] = { ["segment_no"] = 4, ["name"] = "Double Chamber Revisit" },
[73286] = { ["segment_no"] = 4, ["name"] = "Bubble Mountain Revisit" },
[74986] = { ["segment_no"] = 4, ["name"] = "Business Center Revisit" },
-- Kraids Lair
[76267] = { ["segment_no"] = 5, ["name"] = "Entering Kraids Lair" },
[77477] = { ["segment_no"] = 5, ["name"] = "Baby Kraid (Entering)" },
[78565] = { ["segment_no"] = 5, ["name"] = "Kraid" },
[81688] = { ["segment_no"] = 5, ["name"] = "Baby Kraid (Entering)" },
[83726] = { ["segment_no"] = 5, ["name"] = "Leaving Kraids Lair" },
-- Maridia
[85870] = { ["segment_no"] = 6, ["name"] = "Mt Everest" },
[88081] = { ["segment_no"] = 6, ["name"] = "Botwoon" },
[91558] = { ["segment_no"] = 6, ["name"] = "Halfie" },
[93404] = { ["segment_no"] = 6, ["name"] = "Draygon" },
[98180] = { ["segment_no"] = 6, ["name"] = "Womple Jump" },
[99035] = { ["segment_no"] = 6, ["name"] = "Cac Alley" },
[100584] = { ["segment_no"] = 6, ["name"] = "Plasma Spark" },
[102127] = { ["segment_no"] = 6, ["name"] = "Plasma Beam" },
[104286] = { ["segment_no"] = 6, ["name"] = "Plasma Spark Revisit" },
[105528] = { ["segment_no"] = 6, ["name"] = "Sewers" },
-- Upper Norfair Revisit
[108363] = { ["segment_no"] = 7, ["name"] = "Ice Beam Hallway" },
[109176] = { ["segment_no"] = 7, ["name"] = "Ice Maze" },
[110890] = { ["segment_no"] = 7, ["name"] = "Ice Escape" },
[112320] = { ["segment_no"] = 7, ["name"] = "Crocomire Speedway" },
[113084] = { ["segment_no"] = 7, ["name"] = "Crocomire" },
[118541] = { ["segment_no"] = 7, ["name"] = "Leaving Crocomire" },
[119666] = { ["segment_no"] = 7, ["name"] = "Kronic Boost" },
-- Lower Norfair
[121798] = { ["segment_no"] = 8, ["name"] = "LN Main Hall" },
[122523] = { ["segment_no"] = 8, ["name"] = "Green Gate Glitch" },
[123555] = { ["segment_no"] = 8, ["name"] = "Golden Torizo" },
[125378] = { ["segment_no"] = 8, ["name"] = "Screw Attack Escape" },
[127376] = { ["segment_no"] = 8, ["name"] = "Worst Room in the Game" },
[129120] = { ["segment_no"] = 8, ["name"] = "Kihunter Stairs" },
[131409] = { ["segment_no"] = 8, ["name"] = "Metal Pirates" },
[133164] = { ["segment_no"] = 8, ["name"] = "Ridley" },
[136470] = { ["segment_no"] = 8, ["name"] = "Leaving Ridley" },
[137820] = { ["segment_no"] = 8, ["name"] = "Wasteland Revisit" },
[140353] = { ["segment_no"] = 8, ["name"] = "Fire Flea Room" },
[141457] = { ["segment_no"] = 8, ["name"] = "Three Musketeers" },
[143047] = { ["segment_no"] = 8, ["name"] = "Bubble Mountain ReRevisit" },
-- Spore Spawn
[146034] = { ["segment_no"] = 9, ["name"] = "Maridia Passthrough" },
[147515] = { ["segment_no"] = 9, ["name"] = "Red Tower" },
[148267] = { ["segment_no"] = 9, ["name"] = "Lower Green Brinstar" },
[149786] = { ["segment_no"] = 9, ["name"] = "Big Pink Up" },
[151718] = { ["segment_no"] = 9, ["name"] = "Spore Spawn" },
[153924] = { ["segment_no"] = 9, ["name"] = "Big Pink Down" },
[154627] = { ["segment_no"] = 9, ["name"] = "Dachora Room Revisit" },
[156579] = { ["segment_no"] = 9, ["name"] = "Crateria" },
-- Tourian
[161800] = { ["segment_no"] = 10, ["name"] = "Metroids 1" },
[162467] = { ["segment_no"] = 10, ["name"] = "Metroids 2" },
[162983] = { ["segment_no"] = 10, ["name"] = "Metroids 3" },
[163726] = { ["segment_no"] = 10, ["name"] = "Metroids 4" },
[164863] = { ["segment_no"] = 10, ["name"] = "Baby Skip" },
[168195] = { ["segment_no"] = 10, ["name"] = "Zeb Skip" },
[181421] = { ["segment_no"] = 10, ["name"] = "Escape Room 3" },
[183974] = { ["segment_no"] = 10, ["name"] = "Escape Parlor" },
},
["allbossprkd"] = {
-- Crateria
[983] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[4777] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 Rooms" },
[8664] = { ["segment_no"] = 1, ["name"] = "Ship" },
[10274] = { ["segment_no"] = 1, ["name"] = "Pit Room" },
[11628] = { ["segment_no"] = 1, ["name"] = "Morph" },
[14941] = { ["segment_no"] = 1, ["name"] = "Pit Room Revisit" },
[15511] = { ["segment_no"] = 1, ["name"] = "Climb" },
[16504] = { ["segment_no"] = 1, ["name"] = "Parlor" },
[17800] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[21029] = { ["segment_no"] = 1, ["name"] = "Terminator" },
[22222] = { ["segment_no"] = 1, ["name"] = "Green Pirate Shaft" },
-- Brinstar
[23566] = { ["segment_no"] = 2, ["name"] = "Green Brinstar Elevator" },
[26293] = { ["segment_no"] = 2, ["name"] = "Dachora Room" },
[27464] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[28695] = { ["segment_no"] = 2, ["name"] = "Spore Spawn" },
[31755] = { ["segment_no"] = 2, ["name"] = "Sporefall" },
[33750] = { ["segment_no"] = 2, ["name"] = "Big Pink Revisit" },
[37714] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[38498] = { ["segment_no"] = 2, ["name"] = "Hellway" },
[40209] = { ["segment_no"] = 2, ["name"] = "Leaving Power Bombs" },
-- Wrecked Ship
[42875] = { ["segment_no"] = 3, ["name"] = "Moat" },
[43644] = { ["segment_no"] = 3, ["name"] = "Ocean" },
[44700] = { ["segment_no"] = 3, ["name"] = "Entering Wrecked Ship" },
[46835] = { ["segment_no"] = 3, ["name"] = "Phantoon" },
[53030] = { ["segment_no"] = 3, ["name"] = "Wrecked Ship Shaft" },
[54270] = { ["segment_no"] = 3, ["name"] = "Attic" },
[56950] = { ["segment_no"] = 3, ["name"] = "Bowling Alley" },
[60750] = { ["segment_no"] = 3, ["name"] = "Leaving Gravity" },
[63504] = { ["segment_no"] = 3, ["name"] = "Red Tower Elevator" },
[64177] = { ["segment_no"] = 3, ["name"] = "Red Tower Descent" },
[65512] = { ["segment_no"] = 3, ["name"] = "Spazer" },
[67618] = { ["segment_no"] = 3, ["name"] = "Breaking Tube" },
-- Upper Norfair
[69269] = { ["segment_no"] = 4, ["name"] = "Business Center" },
[69565] = { ["segment_no"] = 4, ["name"] = "Hi Jump E-tank" },
[71285] = { ["segment_no"] = 4, ["name"] = "Leaving Hi Jump" },
[72517] = { ["segment_no"] = 4, ["name"] = "Ice Beam Hallway" },
[73344] = { ["segment_no"] = 4, ["name"] = "Ice Maze" },
[75145] = { ["segment_no"] = 4, ["name"] = "Ice Escape" },
[76276] = { ["segment_no"] = 4, ["name"] = "Pre-Cathedral" },
[78024] = { ["segment_no"] = 4, ["name"] = "Bubble Mountain" },
[82680] = { ["segment_no"] = 4, ["name"] = "Single Chamber" },
[84936] = { ["segment_no"] = 4, ["name"] = "Double Chamber Revisit" },
[86400] = { ["segment_no"] = 4, ["name"] = "Volcano Room" },
[87965] = { ["segment_no"] = 4, ["name"] = "Lava Spark" },
-- Lower Norfair
[89827] = { ["segment_no"] = 5, ["name"] = "LN Main Hall" },
[90700] = { ["segment_no"] = 5, ["name"] = "Green Gate Glitch" },
[91730] = { ["segment_no"] = 5, ["name"] = "Golden Torizo" },
[96640] = { ["segment_no"] = 5, ["name"] = "Screw Attack Escape" },
[99200] = { ["segment_no"] = 5, ["name"] = "Worst Room in the Game" },
[100132] = { ["segment_no"] = 5, ["name"] = "Amphitheatre" },
[101325] = { ["segment_no"] = 5, ["name"] = "Kihunter Stairs" },
[102500] = { ["segment_no"] = 5, ["name"] = "Wasteland" },
[103835] = { ["segment_no"] = 5, ["name"] = "Metal Pirates" },
[106173] = { ["segment_no"] = 5, ["name"] = "Ridley" },
[112661] = { ["segment_no"] = 5, ["name"] = "Leaving Ridley" },
[114251] = { ["segment_no"] = 5, ["name"] = "Wasteland Revisit" },
[115972] = { ["segment_no"] = 5, ["name"] = "Kihunter Stairs Revisit" },
[117260] = { ["segment_no"] = 5, ["name"] = "Fire Flea Room" },
[118566] = { ["segment_no"] = 5, ["name"] = "Three Musketeers" },
-- Upper Norfair Revisit
[120382] = { ["segment_no"] = 6, ["name"] = "Bubble Mountain Revisit" },
[121741] = { ["segment_no"] = 6, ["name"] = "Red Pirate Shaft" },
[122172] = { ["segment_no"] = 6, ["name"] = "Acid Snakes Tunnel" },
[123057] = { ["segment_no"] = 6, ["name"] = "Crocomire" },
[128117] = { ["segment_no"] = 6, ["name"] = "Leaving Crocomire" },
[128823] = { ["segment_no"] = 6, ["name"] = "Crocomire Escape" },
[129659] = { ["segment_no"] = 6, ["name"] = "Business Center Revisit" },
-- Kraids Lair
[131235] = { ["segment_no"] = 7, ["name"] = "Entering Kraids Lair" },
[132453] = { ["segment_no"] = 7, ["name"] = "Baby Kraid (Entering)" },
[133427] = { ["segment_no"] = 7, ["name"] = "Kraid" },
[136745] = { ["segment_no"] = 7, ["name"] = "Baby Kraid (Entering)" },
[138800] = { ["segment_no"] = 7, ["name"] = "Leaving Kraids Lair" },
-- Maridia
[140803] = { ["segment_no"] = 8, ["name"] = "Mt Everest" },
[141926] = { ["segment_no"] = 8, ["name"] = "Aqueduct" },
[143286] = { ["segment_no"] = 8, ["name"] = "Botwoon" },
[145500] = { ["segment_no"] = 8, ["name"] = "Halfie" },
[147133] = { ["segment_no"] = 8, ["name"] = "Draygon" },
[150876] = { ["segment_no"] = 8, ["name"] = "Womple Jump" },
[151840] = { ["segment_no"] = 8, ["name"] = "Reverse Botwoon Hallway" },
[153288] = { ["segment_no"] = 8, ["name"] = "Aqueduct Revisit" },
[154457] = { ["segment_no"] = 8, ["name"] = "Mt Everest Revisit" },
[155831] = { ["segment_no"] = 8, ["name"] = "Red Brinstar Gate" },
-- Tourian
[157276] = { ["segment_no"] = 9, ["name"] = "Crateria Kihunters" },
[158764] = { ["segment_no"] = 9, ["name"] = "Terminator Revisit" },
[164897] = { ["segment_no"] = 9, ["name"] = "Metroids 1" },
[165900] = { ["segment_no"] = 9, ["name"] = "Metroids 2" },
[166626] = { ["segment_no"] = 9, ["name"] = "Metroids 3" },
[167327] = { ["segment_no"] = 9, ["name"] = "Metroids 4" },
[168524] = { ["segment_no"] = 9, ["name"] = "Baby Skip" },
[170788] = { ["segment_no"] = 9, ["name"] = "Gedora Room" },
[171985] = { ["segment_no"] = 9, ["name"] = "Zeb Skip" },
[188288] = { ["segment_no"] = 9, ["name"] = "Escape Room 3" },
[190815] = { ["segment_no"] = 9, ["name"] = "Escape Parlor" },
},
["100early"] = {
-- Crateria
[983] = { ["segment_no"] = 1, ["name"] = "Ceres Elevator" },
[4777] = { ["segment_no"] = 1, ["name"] = "Ceres Last 3 Rooms" },
[8664] = { ["segment_no"] = 1, ["name"] = "Ship" },
[10274] = { ["segment_no"] = 1, ["name"] = "Pit Room" },
[11628] = { ["segment_no"] = 1, ["name"] = "Morph" },
[14941] = { ["segment_no"] = 1, ["name"] = "Pit Room Revisit" },
[15540] = { ["segment_no"] = 1, ["name"] = "Climb" },
[16615] = { ["segment_no"] = 1, ["name"] = "Parlor Revisit" },
[17900] = { ["segment_no"] = 1, ["name"] = "Bomb Torizo" },
[20535] = { ["segment_no"] = 1, ["name"] = "Alcatraz" },
[21100] = { ["segment_no"] = 1, ["name"] = "Terminator" },
[22250] = { ["segment_no"] = 1, ["name"] = "Green Pirate Shaft" },
-- Brinstar
[23555] = { ["segment_no"] = 2, ["name"] = "Green Brinstar" },
[24605] = { ["segment_no"] = 2, ["name"] = "Early Supers" },
[27865] = { ["segment_no"] = 2, ["name"] = "Reverse Mockball" },
[29245] = { ["segment_no"] = 2, ["name"] = "Dachora Room" },
[30321] = { ["segment_no"] = 2, ["name"] = "Big Pink" },
[32020] = { ["segment_no"] = 2, ["name"] = "Green Hill Zone" },
[33503] = { ["segment_no"] = 2, ["name"] = "Red Tower" },
[34241] = { ["segment_no"] = 2, ["name"] = "Skree Boost" },
[37045] = { ["segment_no"] = 2, ["name"] = "Kraid Entry" },
[39360] = { ["segment_no"] = 2, ["name"] = "Kraid" },
[41740] = { ["segment_no"] = 2, ["name"] = "Leaving Varia" },
[42950] = { ["segment_no"] = 2, ["name"] = "Leaving Kraid Hallway" },
[44540] = { ["segment_no"] = 2, ["name"] = "Leaving Kraid E-Tank" },
-- Upper Norfair
[46015] = { ["segment_no"] = 3, ["name"] = "Business Center" },
[46308] = { ["segment_no"] = 3, ["name"] = "Hi-Jump" },
[49003] = { ["segment_no"] = 3, ["name"] = "Business Center Climb" },
[49509] = { ["segment_no"] = 3, ["name"] = "Pre-Cathedral" },
[50058] = { ["segment_no"] = 3, ["name"] = "Cathedral" },
[51395] = { ["segment_no"] = 3, ["name"] = "Rising Tide" },
[52060] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain" },
[52773] = { ["segment_no"] = 3, ["name"] = "Bat Cave" },
[55265] = { ["segment_no"] = 3, ["name"] = "Leaving Speed Booster" },
[56555] = { ["segment_no"] = 3, ["name"] = "Single Chamber" },
[56975] = { ["segment_no"] = 3, ["name"] = "Double Chamber" },
[58675] = { ["segment_no"] = 3, ["name"] = "Double Chamber Revisited" },
[59640] = { ["segment_no"] = 3, ["name"] = "Bubble Mountain Revisited" },
[60945] = { ["segment_no"] = 3, ["name"] = "Red Pirate Shaft" },
[61995] = { ["segment_no"] = 3, ["name"] = "Crocomire" },
[67638] = { ["segment_no"] = 3, ["name"] = "Post-Crocomire" },
[68949] = { ["segment_no"] = 3, ["name"] = "Leaving Power Bombs" },
[69699] = { ["segment_no"] = 3, ["name"] = "Post-Crocomire Jump Room" },
[71192] = { ["segment_no"] = 3, ["name"] = "Leaving Grapple" },
[73184] = { ["segment_no"] = 3, ["name"] = "Post-Crocomire Missiles" },
[75300] = { ["segment_no"] = 3, ["name"] = "Crocomire Revisit" },
[76271] = { ["segment_no"] = 3, ["name"] = "Crocomire Escape" },
[77533] = { ["segment_no"] = 3, ["name"] = "Business Center Return" },
-- Red Tower and Crateria
[78969] = { ["segment_no"] = 4, ["name"] = "Warehouse Elevator" },
[80185] = { ["segment_no"] = 4, ["name"] = "Red Tower Climb" },
[81289] = { ["segment_no"] = 4, ["name"] = "Hellway" },
[82094] = { ["segment_no"] = 4, ["name"] = "Alpha Power Bombs" },
[83810] = { ["segment_no"] = 4, ["name"] = "Elevator Room Ascent" },
[84500] = { ["segment_no"] = 4, ["name"] = "Beta Power Bombs" },
[86950] = { ["segment_no"] = 4, ["name"] = "Crateria Kihunters" },
[87615] = { ["segment_no"] = 4, ["name"] = "Oceanfly" },
[87825] = { ["segment_no"] = 4, ["name"] = "The Moat" },
[88610] = { ["segment_no"] = 4, ["name"] = "Ocean Spark" },
-- Wrecked Ship
[89675] = { ["segment_no"] = 5, ["name"] = "Enter Wrecked Ship" },
[92402] = { ["segment_no"] = 5, ["name"] = "Phantoon" },
[96100] = { ["segment_no"] = 5, ["name"] = "Leaving Phantoon" },
[97522] = { ["segment_no"] = 5, ["name"] = "West Supers" },
[100410] = { ["segment_no"] = 5, ["name"] = "Leaving East Supers" },
[101213] = { ["segment_no"] = 5, ["name"] = "Spiky Room of Death" },
[102553] = { ["segment_no"] = 5, ["name"] = "Wrecked Ship E-Tank" },
[104540] = { ["segment_no"] = 5, ["name"] = "Spiky Room Revisit" },
[105569] = { ["segment_no"] = 5, ["name"] = "Shaft Ascent" },
[106409] = { ["segment_no"] = 5, ["name"] = "Attic" },
[107550] = { ["segment_no"] = 5, ["name"] = "Attic Missiles" },
[109115] = { ["segment_no"] = 5, ["name"] = "Attic Revisit" },
[109730] = { ["segment_no"] = 5, ["name"] = "Sky Missiles" },
[112160] = { ["segment_no"] = 5, ["name"] = "Bowling Alley Path" },
[112765] = { ["segment_no"] = 5, ["name"] = "Bowling Alley" },
[119150] = { ["segment_no"] = 5, ["name"] = "Leaving Gravity" },
-- Brinstar Cleanup
[121392] = { ["segment_no"] = 6, ["name"] = "Landing Site" },
[123818] = { ["segment_no"] = 6, ["name"] = "Gauntlet Spark" },
[125123] = { ["segment_no"] = 6, ["name"] = "Gauntlet E-Tank" },
[126863] = { ["segment_no"] = 6, ["name"] = "Leaving Gauntlet" },
[129654] = { ["segment_no"] = 6, ["name"] = "Green Brinstar Elevator" },
[131071] = { ["segment_no"] = 6, ["name"] = "Green Brinstar Beetoms" },
[131427] = { ["segment_no"] = 6, ["name"] = "Etecoon E-Tank Room" },
[133376] = { ["segment_no"] = 6, ["name"] = "Etecoon Room" },
[134628] = { ["segment_no"] = 6, ["name"] = "Dachora Room Revisit" },
[135525] = { ["segment_no"] = 6, ["name"] = "Big Pink Revisit" },
[136680] = { ["segment_no"] = 6, ["name"] = "Big Pink Power Bombs" },
[138264] = { ["segment_no"] = 6, ["name"] = "Big Pink Hopper Room" },
[140508] = { ["segment_no"] = 6, ["name"] = "Spore Spawn Supers" },
[144480] = { ["segment_no"] = 6, ["name"] = "Waterway E-Tank" },
[146809] = { ["segment_no"] = 6, ["name"] = "Green Hills Revisit" },
[148415] = { ["segment_no"] = 6, ["name"] = "Blockbuster" },
-- Maridia Pre-Draygon
[150911] = { ["segment_no"] = 7, ["name"] = "Main Street" },
[152132] = { ["segment_no"] = 7, ["name"] = "Fish Tank" },
[152828] = { ["segment_no"] = 7, ["name"] = "Mama Turtle E-Tank" },
[154704] = { ["segment_no"] = 7, ["name"] = "Fish Tank Revisit" },
[156973] = { ["segment_no"] = 7, ["name"] = "Mt Everest" },
[157631] = { ["segment_no"] = 7, ["name"] = "Beach Missiles" },
[158645] = { ["segment_no"] = 7, ["name"] = "West Beach" },
[159491] = { ["segment_no"] = 7, ["name"] = "Watering Hole" },
[161187] = { ["segment_no"] = 7, ["name"] = "West Beach Revisit" },
[161920] = { ["segment_no"] = 7, ["name"] = "Beach Missiles Revisit" },
[162808] = { ["segment_no"] = 7, ["name"] = "Aqueduct" },
[164035] = { ["segment_no"] = 7, ["name"] = "Botwoon" },
[165227] = { ["segment_no"] = 7, ["name"] = "Full Halfie" },
[166700] = { ["segment_no"] = 7, ["name"] = "Draygon Missiles" },
[167950] = { ["segment_no"] = 7, ["name"] = "Draygon" },
-- Maridia Post-Draygon
[172932] = { ["segment_no"] = 8, ["name"] = "Return Halfie" },
[173805] = { ["segment_no"] = 8, ["name"] = "Reverse Botwoon E-Tank" },
[175385] = { ["segment_no"] = 8, ["name"] = "East Sand Pit" },
[178161] = { ["segment_no"] = 8, ["name"] = "Pants Room" },
[179088] = { ["segment_no"] = 8, ["name"] = "Shaktool" },
[183422] = { ["segment_no"] = 8, ["name"] = "Shaktool Revisit" },
[184712] = { ["segment_no"] = 8, ["name"] = "East Sand Hall" },
[185600] = { ["segment_no"] = 8, ["name"] = "Plasma Spark Room" },
[186875] = { ["segment_no"] = 8, ["name"] = "Kassiuz Room" },
[187655] = { ["segment_no"] = 8, ["name"] = "Plasma" },
[189113] = { ["segment_no"] = 8, ["name"] = "Leaving Plasma" },
[189775] = { ["segment_no"] = 8, ["name"] = "Leaving Kassiuz" },
[190785] = { ["segment_no"] = 8, ["name"] = "Cac Alley" },
[192271] = { ["segment_no"] = 8, ["name"] = "Botwoon E-Tank" },
[194111] = { ["segment_no"] = 8, ["name"] = "Aqueduct Final" },
[196274] = { ["segment_no"] = 8, ["name"] = "West Sand Pit" },
[199955] = { ["segment_no"] = 8, ["name"] = "Thread the Needle" },
-- Ice-Kraid-Kronic
[200605] = { ["segment_no"] = 9, ["name"] = "Kraid Entrance Revisit" },
[201646] = { ["segment_no"] = 9, ["name"] = "Kraid Missiles" },
[202868] = { ["segment_no"] = 9, ["name"] = "Kraid Missiles Escape" },
[204746] = { ["segment_no"] = 9, ["name"] = "Ice Beam Gate Room" },
[205354] = { ["segment_no"] = 9, ["name"] = "Ice Beam Snake Room" },
[206480] = { ["segment_no"] = 9, ["name"] = "Snake Room Revisit" },
[206894] = { ["segment_no"] = 9, ["name"] = "Ice Escape" },
[207781] = { ["segment_no"] = 9, ["name"] = "Crumble Shaft Missiles" },
[208952] = { ["segment_no"] = 9, ["name"] = "Crocomire Speedway" },
[210492] = { ["segment_no"] = 9, ["name"] = "Kronic Boost" },
-- Lower Norfair
[212585] = { ["segment_no"] = 10, ["name"] = "LN Main Hall" },
[214936] = { ["segment_no"] = 10, ["name"] = "Golden Torizo" },
[217583] = { ["segment_no"] = 10, ["name"] = "Leaving Golden Torizo" },
[218467] = { ["segment_no"] = 10, ["name"] = "Fast Ripper Room" },
[219592] = { ["segment_no"] = 10, ["name"] = "Worst Room in the Game" },
[220177] = { ["segment_no"] = 10, ["name"] = "Mickey Mouse Missiles" },
[221863] = { ["segment_no"] = 10, ["name"] = "Amphitheatre" },
[222673] = { ["segment_no"] = 10, ["name"] = "Red Kihunter Shaft" },
[225930] = { ["segment_no"] = 10, ["name"] = "Ninja Pirates" },
[226693] = { ["segment_no"] = 10, ["name"] = "Plowerhouse Room" },
[227471] = { ["segment_no"] = 10, ["name"] = "Ridley" },
[230969] = { ["segment_no"] = 10, ["name"] = "Ridley Escape" },
[232565] = { ["segment_no"] = 10, ["name"] = "Wasteland Revisit" },
[233666] = { ["segment_no"] = 10, ["name"] = "Kihunter Shaft Revisit" },
[234863] = { ["segment_no"] = 10, ["name"] = "Firefleas Room" },
[236879] = { ["segment_no"] = 10, ["name"] = "Springball Maze" },
[240335] = { ["segment_no"] = 10, ["name"] = "Three Muskateers" },
[242849] = { ["segment_no"] = 10, ["name"] = "Bubble Mountain Return" },
[243364] = { ["segment_no"] = 10, ["name"] = "Norfair Reserve" },
[246326] = { ["segment_no"] = 10, ["name"] = "Bubble Mountain Final" },
[249252] = { ["segment_no"] = 10, ["name"] = "Business Center Final" },
-- Final Cleanup
[251238] = { ["segment_no"] = 11, ["name"] = "Below Spazer" },
[251943] = { ["segment_no"] = 11, ["name"] = "Red Tower X-Ray" },
[252642] = { ["segment_no"] = 11, ["name"] = "X-Ray Passage" },
[254669] = { ["segment_no"] = 11, ["name"] = "X-Ray Passage Return" },
[256320] = { ["segment_no"] = 11, ["name"] = "Reverse Slinky" },
[257326] = { ["segment_no"] = 11, ["name"] = "Retro Brinstar Hoppers" },
[258666] = { ["segment_no"] = 11, ["name"] = "Retro Brinstar E-Tank" },
[260295] = { ["segment_no"] = 11, ["name"] = "Boulder Room" },
[261867] = { ["segment_no"] = 11, ["name"] = "Leaving Billy Mays" },
[263181] = { ["segment_no"] = 11, ["name"] = "Retro Brinstar Escape" },
[264872] = { ["segment_no"] = 11, ["name"] = "Old Tourian Missiles" },
[266780] = { ["segment_no"] = 11, ["name"] = "Climb Supers" },
[269066] = { ["segment_no"] = 11, ["name"] = "Parlor Missiles" },
[270179] = { ["segment_no"] = 11, ["name"] = "Leaving Parlor Missiles" },
[271007] = { ["segment_no"] = 11, ["name"] = "Terminator Revisit" },
-- Tourian
[276443] = { ["segment_no"] = 12, ["name"] = "Metroids 1" },
[277088] = { ["segment_no"] = 12, ["name"] = "Metroids 2" },
[277618] = { ["segment_no"] = 12, ["name"] = "Metroids 3" },
[278303] = { ["segment_no"] = 12, ["name"] = "Metroids 4" },
[279441] = { ["segment_no"] = 12, ["name"] = "Baby Skip" },
[282524] = { ["segment_no"] = 12, ["name"] = "Zeb Skip" },
[294786] = { ["segment_no"] = 12, ["name"] = "Escape Room 3" },
[295403] = { ["segment_no"] = 12, ["name"] = "Escape Room 4" },
[297377] = { ["segment_no"] = 12, ["name"] = "Escape Parlor" },
},
}
--
-- Utility
--
-- orderedPairs {{{
function deepcopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[deepcopy(orig_key)] = deepcopy(orig_value)
end
setmetatable(copy, deepcopy(getmetatable(orig)))
else -- number, string, boolean, etc
copy = orig
end
return copy
end
function __genOrderedIndex( t )
local orderedIndex = {}
for key in pairs(t) do
table.insert( orderedIndex, key )
end
table.sort( orderedIndex )
return orderedIndex
end
function orderedNext(t, state)
-- Equivalent of the next function, but returns the keys in the alphabetic
-- order. We use a temporary ordered key table that is stored in the
-- table being iterated.
local key = nil
--print("orderedNext: state = "..tostring(state) )
if state == nil then
-- the first time, generate the index
t.__orderedIndex = __genOrderedIndex( t )
key = t.__orderedIndex[1]
else
-- fetch the next value
for i = 1,table.getn(t.__orderedIndex) do
if t.__orderedIndex[i] == state then
key = t.__orderedIndex[i+1]
end
end
end
if key then
return key, t[key]
end
-- no more value to return, cleanup
t.__orderedIndex = nil
return
end
function orderedPairs(t)
-- Equivalent of the pairs() function on tables. Allows to iterate
-- in order
return orderedNext, t, nil
end
-- }}}
local SLUGS = {}
local function slugify(s)
local slug = string.gsub(string.gsub(s, "[^ A-Za-z0-9]", ""), "[ ]+", "_"):lower()
if not SLUGS[slug] then
SLUGS[slug] = 1
return slug
end
local ret = slug
local i = 2
while SLUGS[ret] do
ret = slug .. '_' .. tostring(i)
i = i + 1
end
SLUGS[ret] = 1
return ret
end
local function ucfirst(s)
return s:sub(1,1):upper() .. s:sub(2):lower()
end
local function draw_lines(x, y, L)
for i, line in ipairs(L) do
gui.text(x, y + ((i - 1) * 8), line)
end
end
local function tohex(n, size)
size = size or 0
return string.format("$%0" .. tostring(size) .. "X", n)
end
local function call_for_each_bank(address, fn, ...)
assert(address < 0x7F0000 or address > 0x7FFFFF)
for i = 0x80, 0xDF do
fn(bit.lshift(i, 16) + bit.band(address, 0xFFFF), unpack(arg))
end
fn(0x7E0000 + address, unpack(arg))
end
-- local debug_file = io.open("debug.txt", "w")
local function debug(...)
-- print(unpack(arg))
-- debug_file:write(table.concat(arg, " ") .. "\n")
-- debug_file:flush()
end
--
-- State
--
local function annotate_address(addr, val)
if addr < 0x7F0000 or addr > 0x7FFFFF then
addr = bit.band(addr, 0xFFFF)
end
for _, mem in pairs(MEMTRACK) do
if mem[1] <= addr and (addr < mem[1] + mem[2]) then
return mem[3]
end
end
return "(" .. tohex(addr, 4) .. ") ??"
end
local function get_current_state()
local state = {}
for _, mem in pairs(MEMTRACK) do
local addr = mem[1]
local size = mem[2]
if mem[1] < 0x10000 then
addr = 0x7E0000 + addr
end
if size > 1 then
assert(bit.band(size, 1) == 0)
for i_addr = addr, addr + size - 1, 2 do
state[i_addr] = {2, memory.readwordunsigned(i_addr)}
end
else
if size == 1 then
state[addr] = {1, memory.readbyte(addr)}
else
state[addr] = {2, memory.readwordunsigned(addr)}
end
end
end
return state
end
local function save_preset(step)
local current_state = get_current_state()
print("saving step " .. step['full_slug'])
preset_output = preset_output .. "\npreset_" .. CAT .. '_' .. step['full_slug'] .. ":\n"
if last_step then
preset_output = preset_output .. " dw #preset_" .. CAT .. '_' .. last_step['full_slug'] .. " ; " .. last_step['full_name'] .. "\n"
else
preset_output = preset_output .. " dw #$0000\n"
end
last_step = step
for addr, size_and_val in orderedPairs(current_state) do
local size = size_and_val[1]
local val = size_and_val[2]
if last_state[addr] ~= val then
last_state[addr] = val
preset_output = preset_output .. " dl " .. tohex(addr, 6) .. " : "
preset_output = preset_output .. "db " .. tohex(size, 2) .. " : "
preset_output = preset_output .. (size == 1 and "db " or "dw ") .. tohex(val, size == 1 and 2 or 4)
preset_output = preset_output .. " ; " .. annotate_address(addr, val) .. "\n"
end
end
preset_output = preset_output .. " dw #$FFFF\n"
preset_output = preset_output .. ".after\n"
end
local function save_preset_file()
local file = io.open('presets_data.asm', 'w')
file:write(preset_output)
file:close()
local file = io.open('presets_menu.asm', 'w')
file:write('PresetsMenu' .. ucfirst(CAT) .. ':\n')
for _, segment in pairs(SEGMENTS[CAT]) do
file:write(' dw #presets_goto_' .. CAT .. '_' .. segment['slug'] .. '\n')
end
file:write(' dw #$0000\n')
file:write(' %cm_header("PRESETS FOR ' .. CAT:upper() .. '")\n')
file:write('\n')
for _, segment in pairs(SEGMENTS[CAT]) do
file:write('presets_goto_' .. CAT .. '_' .. segment['slug'] .. ':\n')
file:write(' %cm_submenu("' .. segment['name'] .. '", #presets_submenu_' .. CAT .. '_' .. segment['slug'] .. ')\n')
file:write('\n')
end
for _, segment in pairs(SEGMENTS[CAT]) do
file:write('presets_submenu_' .. CAT .. '_' .. segment['slug'] .. ':\n')
for _, step in pairs(segment['steps']) do
file:write(' dw #presets_' .. CAT .. '_' .. step['full_slug'] .. '\n')
end
file:write(' dw #$0000\n')
file:write(' %cm_header("' .. segment['name']:upper() .. '")\n')
file:write('\n')
end
for _, segment in pairs(SEGMENTS[CAT]) do
file:write('; ' .. segment['name'] .. '\n')
for _, step in pairs(segment['steps']) do
file:write('presets_' .. CAT .. '_' .. step['full_slug'] .. ':\n')
file:write(' %cm_preset("' .. step['name'] .. '", #preset_' .. CAT .. '_' .. step['full_slug'] .. ')\n\n')
end
file:write("\n")
end
file:close()
end
--
-- Main
--
local function tick()
local frame = emu.framecount()
local step = STEPS[CAT][frame]
if step then
save_preset(step)
save_preset_file()
end
end
local function main()
for _, segment in pairs(SEGMENTS[CAT]) do
segment['slug'] = slugify(segment['name'])
end
for _, step in orderedPairs(STEPS[CAT]) do
segment = SEGMENTS[CAT][step['segment_no']]
step['segment'] = segment
step['slug'] = slugify(step['name'])
step['full_slug'] = segment['slug'] .. "_" .. step['slug']
step['full_name'] = segment['name'] .. ": " .. step['name']
table.insert(segment['steps'], step)
end
while true do
tick()
snes9x.frameadvance()
end
end
main()
|
----------------------------------------->>
-- IGC: International Gaming Community
-- Date: 06 Feb 2017
-- Project: Online Live Map
-- Type: Server Side
-- Author: tcaram
----------------------------------------->>
CACHE = {}
function returnServerData(count)
if (not count or not tonumber(count)) then return {} end
count = tonumber(count);
if (count%5 == 0 or count == 1) then return CACHE; else return {players=CACHE.players} end
end
function refreshCACHE()
local playersData = exports.IGCweb:getPlayersData();
local players_data = {}
for i=1, #playersData do
if (playersData[i].gamemode == "RPG") then
local playerTable = {
account = playersData[i].account,
name = playersData[i].name,
pos = playersData[i].pos,
color = playersData[i].color,
}
table.insert(players_data, playerTable);
end
end
local turf_data = {}
for i, turf in ipairs ( getElementsByType("radararea", getResourceRootElement(getResourceFromName("IGCgangTerritories"))) ) do
local id = getElementData(turf, "id");
local towner = exports.IGCgangTerritories:getTurfData(id, "owner");
local owner = exports.IGCgroups:getGroupName(towner);
local r, g, b = exports.IGCgroups:getGroupColor(towner);
local isFlashing = tostring(isRadarAreaFlashing(turf));
local sX, sY = getRadarAreaSize(turf);
local tX, tY = getElementPosition(turf);
local turfTable = {
owner = owner,
color = { r, g, b },
flashing = isFlashing,
radararea = {string.format("%.2f", tX), string.format("%.2f", tY), string.format("%.2f", sX), string.format("%.2f", sY)},
}
table.insert(turf_data, turfTable);
end
CACHE = {players=players_data, turfs=turf_data}
end
setTimer(refreshCACHE, 15000, 0);
refreshCACHE();
|
local a=1+3
testfunc()
|
local Model = Workspace.DarkShadow6
local CharacterMesh = Instance.new("CharacterMesh")
CharacterMesh.Name = "ROBLOX 2.0 Torso"
CharacterMesh.BodyPart = "Torso"
CharacterMesh.MeshId = "27111894"
CharacterMesh.Parent = Model
local CharacterMesh = Instance.new("CharacterMesh")
CharacterMesh.Name = "ROBLOX 2.0 Torso"
CharacterMesh.BodyPart = "Torso"
CharacterMesh.MeshId = "27111894"
CharacterMesh.Parent = Model
local CharacterMesh = Instance.new("CharacterMesh")
CharacterMesh.Name = "ROBLOX 2.0 Left Arm"
CharacterMesh.BodyPart = "LeftArm"
CharacterMesh.MeshId = "27111419"
CharacterMesh.Parent = Model
local CharacterMesh = Instance.new("CharacterMesh")
CharacterMesh.Name = "ROBLOX 2.0 Right Arm"
CharacterMesh.BodyPart = "RightArm"
CharacterMesh.MeshId = "27111864"
CharacterMesh.Parent = Model
local CharacterMesh = Instance.new("CharacterMesh")
CharacterMesh.Name = "ROBLOX 2.0 Left Leg"
CharacterMesh.BodyPart = "LeftLeg"
CharacterMesh.MeshId = "27111857"
CharacterMesh.Parent = Model
local CharacterMesh = Instance.new("CharacterMesh")
CharacterMesh.Name = "ROBLOX 2.0 Right Leg"
CharacterMesh.BodyPart = "RightLeg"
CharacterMesh.MeshId = "27111882"
CharacterMesh.Parent = Model
|
-----------------------------------
-- Area: Bibiki Bay
-- NPC: Tswe Panipahr
-- Type: Manaclipper
-- !pos 484.604 -4.035 729.671 4
-----------------------------------
local ID = require("scripts/zones/Bibiki_Bay/IDs")
require("scripts/globals/keyitems")
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
local curentticket=0
if (player:hasKeyItem(tpz.ki.MANACLIPPER_TICKET)) then
curentticket=tpz.ki.MANACLIPPER_TICKET
elseif (player:hasKeyItem(tpz.ki.MANACLIPPER_MULTITICKET)) then
curentticket=tpz.ki.MANACLIPPER_MULTITICKET
end
if ( curentticket ~= 0 ) then
player:messageSpecial(ID.text.HAVE_BILLET, curentticket)
else
local gils=player:getGil()
player:startEvent(35, tpz.ki.MANACLIPPER_TICKET, tpz.ki.MANACLIPPER_MULTITICKET , 80, gils, 0, 500)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
if (csid == 35) then
if (option==1) then
player:delGil(80)
player:addKeyItem(tpz.ki.MANACLIPPER_TICKET)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.ki.MANACLIPPER_TICKET)
elseif (option==2) then
player:delGil(500)
player:addKeyItem(tpz.ki.MANACLIPPER_MULTITICKET)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.ki.MANACLIPPER_MULTITICKET)
player:setCharVar("Manaclipper_Ticket", 10)
end
end
end
|
local thread = require("thread")
local computer = require("computer")
local fs = require("filesystem")
local fractalCore = {}
local dirs = {}
function fractalCore.getDir(dirName)
return dirs[string.lower(dirName)]
end
function fractalCore.getInstallPastebin()
return "MtcYnVyp"
end
local keysDown = {}
for i = 0, 255 do
keysDown[i] = false
end
function fractalCore.setKeyDown(keyCode, down)
keysDown[keyCode] = down
end
function fractalCore.keyDown(keyCode)
return keysDown[keyCode]
end
local lowerKeys =
{
["F1"] = 59, ["F2"] = 60, ["F3"] = 61, ["F4"] = 62, ["F5"] = 63, ["F6"] = 64,
["`"] = 41, ["-"] = 12, ["="] = 13, ["BACKSPACE"] = 14,
["TAB"] = 15, ["Q"] = 16, ["W"] = 17, ["E"] = 18, ["R"] = 19, ["T"] = 20, ["Y"] = 21, ["U"] = 22, ["I"] = 23, ["O"] = 24, ["P"] = 25, ["["] = 26, ["]"] = 27, ["\\"] = 43,
["A"] = 30, ["S"] = 31, ["D"] = 32, ["F"] = 33, ["G"] = 34, ["H"] = 35, ["J"] = 36, ["K"] = 37, ["L"] = 38, [";"] = 39, ["'"] = 40, ["RETURN"] = 28,
["Z"] = 44, ["X"] = 45, ["C"] = 46, ["V"] = 47, ["B"] = 48, ["N"] = 49, ["M"] = 50, [","] = 51, ["."] = 52, ["/"] = 53,
["LCONTROL"] = 29, ["LALT"] = 56, [" "] = 57, ["RALT"] = 184, ["RCONTROL"] = 157, ["UP"] = 200, ["LEFT"] = 203, ["RIGHT"] = 205, ["DOWN"] = 208,
["DELETE"] = 211, ["INSERT"] = 210, ["HOME"] = 199, ["PAGEUP"] = 201, ["PAGEDOWN"] = 209, ["END"] = 207, ["NUMLOCK"] = 69,
["1"] = 2, ["2"] = 3, ["3"] = 4, ["4"] = 5, ["5"] = 6, ["6"] = 7, ["7"] = 8, ["8"] = 9, ["9"] = 10, ["0"] = 11
}
function fractalCore.keycode(char)
return lowerKeys[string.upper(char)]
end
-- Clean up nicely
function fractalCore.shutdown()
computer.shutdown(false) -- Shutdown, not restart
end
local function initVals()
dirs["root"] = "/fractal/"
dirs["lib"] = "/lib/"
dirs["libs"] = "/lib/"
dirs["core"] = fractalCore.getDir("root").."core/"
dirs["user"] = fractalCore.getDir("root").."user/"
dirs["apps"] = fractalCore.getDir("root").."apps/"
dirs["localapps"] = fractalCore.getDir("user").."apps/"
dirs["desktop"] = fractalCore.getDir("user").."desktop/"
for k, v in pairs(dirs) do
fs.makeDirectory(v)
end
end
-- File Utils
-- Gets the file extension of any file
function fractalCore.getFileExtension(fileName)
if(fs.isDirectory(fileName)) then
return "/"
end
local subVal = 1
while string.sub(fileName, #fileName - subVal, #fileName - subVal) ~= "." and #fileName - subVal > 0 do
subVal = subVal + 1
end
if #fileName - subVal <= 0 then
return ""
end
return string.sub(fileName, #fileName - subVal + 1, #fileName) -- + 1 to remove the '.' at the beginning
end
-- Util Functions
function fractalCore.tableLength(table)
local count = 0
for _ in pairs(table) do
count = count + 1
end
return count
end
initVals()
return fractalCore
|
require('class.timer')
Animation = Object:extend()
function Animation:new(animationTemplate)
self.frames = animationTemplate.frames
self.loop = animationTemplate.loop
self.isStopped = false
self.speed = 1
self:set_frame_index(1)
end
function Animation:get_quad()
return self.currentFrame.quad
end
function Animation:is_stopped()
return self.isStopped
end
function Animation:set_frame_index(index)
self:play()
self.currentFrame = {index = index,
quad = self.frames[index].quad,
timer = Timer(self.frames[index].delay)}
end
function Animation:rewind()
self:set_frame_index(1)
end
function Animation:play()
self.isStopped = false
end
function Animation:step_forward()
-- If we have not yet gotten to the final frame
if self.currentFrame.index < #self.frames then
self:set_frame_index(self.currentFrame.index + 1)
else
if self.loop then
-- Wrap around to the first frame
self:set_frame_index(1)
else
self:stop()
end
end
end
function Animation:set_speed(value)
self.speed = value
end
function Animation:stop()
self.isStopped = true
end
function Animation:update(dt)
if not self.isStopped then
dt = dt * self.speed
if self.currentFrame.timer:update(dt) then
self:step_forward()
end
end
end
|
local filter = require("kong.plugins.oidc.filter")
local lu = require("luaunit")
TestFilter = {}
ngx = {
var = {
uri = ""
}
}
local config = {
filters = { "^/pattern1$","^/pattern2$"}
}
function TestFilter:testIgnoreRequestWhenMatchingPattern1()
ngx.var.uri = "/pattern1"
lu.assertFalse(filter.shouldProcessRequest(config))
end
function TestFilter:testIgnoreRequestWhenMatchingPattern2()
ngx.var.uri = "/pattern2"
lu.assertFalse(filter.shouldProcessRequest(config))
end
function TestFilter:testProcesseRequestWhenNoMatch()
ngx.var.uri = "/not_matching"
lu.assertTrue(filter.shouldProcessRequest(config))
end
function TestFilter:testProcessRequestWhenTheyAreNoFiltersNil()
ngx.var.uri = "/pattern1"
config.filters= nil
lu.assertTrue(filter.shouldProcessRequest(config))
end
function TestFilter:testProcessRequestWhenTheyAreNoFiltersEmpty()
ngx.var.uri = "/pattern1"
config.filters= {}
lu.assertTrue(filter.shouldProcessRequest(config))
end
lu.run()
|
if not moon or not moon.inject then
module("moon", package.seeall)
end
local util = require("moonscript.util")
dump = util.dump
run_with_scope = function(fn, scope, ...)
local old_env = getfenv(fn)
local env = setmetatable({ }, {
__index = function(self, name)
local val = scope[name]
if val ~= nil then
return val
else
return old_env[name]
end
end
})
setfenv(fn, env)
return fn(...)
end
bind_methods = function(obj)
return setmetatable({ }, {
__index = function(self, name)
local val = obj[name]
if val and type(val) == "function" then
local bound
bound = function(...)
return val(obj, ...)
end
self[name] = bound
return bound
else
return val
end
end
})
end
defaultbl = function(t, fn)
if not fn then
fn = t
t = { }
end
return setmetatable(t, {
__index = function(self, name)
local val = fn(self, name)
rawset(self, name, val)
return val
end
})
end
extend = function(...)
local tbls = {
...
}
if #tbls < 2 then
return
end
for i = 1, #tbls - 1 do
local a = tbls[i]
local b = tbls[i + 1]
setmetatable(a, {
__index = b
})
end
return tbls[1]
end
copy = function(self)
local t = { }
for key, val in pairs(self) do
t[key] = val
end
return t
end
mixin = function(self, cls, ...)
local meta = getmetatable(cls)
for key, val in pairs(meta.__index) do
if not key:match("^__") then
self[key] = val
end
end
return cls.__init(self, ...)
end
mixin_object = function(self, object, methods)
local _list_0 = methods
for _index_0 = 1, #_list_0 do
local name = _list_0[_index_0]
self[name] = function(parent, ...)
return object[name](object, ...)
end
end
end
mixin_table = function(self, tbl, keys)
if keys then
local _list_0 = keys
for _index_0 = 1, #_list_0 do
local key = _list_0[_index_0]
self[key] = tbl[key]
end
else
for key, val in pairs(tbl) do
self[key] = val
end
end
end
|
local constants = require("constants")
local uid = require("uid")
local update_array = require("update_array")
local logger = require("logger")
local node = {}
local recreate_metatables = false
function node:new(entity_id, gui)
new_node = {}
setmetatable(new_node, self)
self.__index = self
new_node.id = uid.generate()
new_node.entity_id = entity_id
new_node.parent = nil
new_node.events_id = {}
new_node.events_params = {}
new_node.events = {}
new_node.gui_element = nil -- Non-persistent Factorio element
new_node.children = {}
new_node.update_logic = nil
new_node.updatable = false
if gui then
new_node.gui = gui
new_node.gui.name = new_node.id
else
new_node.gui = {}
end
return new_node
end
function node:create_from_json(id, json_node, entity_id)
new_node = {}
setmetatable(new_node, self)
self.__index = self
new_node.id = id
new_node.entity_id = entity_id
new_node.parent = nil
new_node.events_id = json_node.events_id
new_node.events_params = json_node.events_params
new_node.events = {}
new_node.gui_element = nil -- Non-persistent Factorio element
new_node.children = {}
new_node.update_logic = json_node.update_logic
new_node.updatable = json_node.updatable
new_node.gui = json_node.gui
return new_node
end
function node.node_to_json(node_param)
local nodes_list = {}
local function recursive_add(param)
nodes_list[param.id] = {
parent_id = param.parent and param.parent.id or nil,
events_id = param.events_id,
events_params = param.events_params,
update_logic = param.update_logic,
updatable = param.updatable,
gui = param.gui
}
for _, child in pairs(param.children) do
recursive_add(child)
end
end
recursive_add(node_param)
return game.table_to_json(nodes_list)
end
function node.node_from_json(json, entity_id)
local nodes_list = game.json_to_table(json)
local new_nodes = {}
local root_node = nil
-- Find and create the root node
for id, json_node in pairs(nodes_list) do
if not json_node.parent_id then
root_node = node:create_from_json(id, json_node, entity_id)
json_node.processed = true
break
end
end
-- Failed to create the root node
if not root_node then
return nil
end
local loop_counter = 1
local processed = 1
local has_elements = true
local nodes_count = table_size(nodes_list)
while has_elements do
for id, json_node in pairs(nodes_list) do
if not json_node.processed and json_node.parent_id then
local parent_node = root_node:recursive_find(json_node.parent_id)
if parent_node then
local new_node = node:create_from_json(id, json_node, entity_id)
new_node.parent = parent_node
parent_node.children[id] = new_node
processed = processed + 1
json_node.processed = true
end
end
end
if processed <= nodes_count then
has_elements = false
end
loop_counter = loop_counter + 1
if loop_counter >= nodes_count then
has_elements = false
end
end
root_node:recursive_setup_events()
return root_node
end
local function simple_deep_copy(object)
if type(object) ~= 'table' then
return object
end
local result = {}
for k, v in pairs(object) do
result[simple_deep_copy(k)] = simple_deep_copy(v)
end
return result
end
function node.deep_copy(entity_id, parent_node, other_node)
local new_node = node:new(entity_id)
new_node.id = other_node.id
new_node.parent = parent_node
new_node.events_id = simple_deep_copy(other_node.events_id)
new_node.events_params = simple_deep_copy(other_node.events_params)
new_node.events = simple_deep_copy(other_node.events)
new_node.gui = simple_deep_copy(other_node.gui)
new_node.update_logic = simple_deep_copy(other_node.update_logic)
new_node.updatable = other_node.updatable
node:setup_events(new_node)
for _, children in pairs(other_node.children) do
local new_child = node.deep_copy(entity_id, new_node, children)
new_node.children[new_child.id] = new_child
end
return new_node
end
function node.recreate_metatables()
if not recreate_metatables then
for _, entity in pairs(global.entities) do
if not entity.node.valid then
node:recursive_create_metatable(entity.node)
end
end
recreate_metatables = true
end
end
function node:create_metatable(node_param)
setmetatable(node_param, self)
self.__index = self
end
function node:recursive_create_metatable(node_param)
node:create_metatable(node_param)
node:setup_events(node_param)
for _, child in pairs(node_param.children) do
node:recursive_create_metatable(child)
end
end
function node:recursive_setup_events()
node:setup_events(self)
for _, child in pairs(self.children) do
child:recursive_setup_events()
end
end
function node:add_child(gui)
new_node = self:new(self.entity_id)
new_node.parent = self
if gui then
new_node.gui = gui
new_node.gui.name = new_node.id
end
self.children[new_node.id] = new_node
return new_node
end
function node:remove_child(id)
if self.children[id] then
self.children[id]:clear_children()
self.children[id]:clear()
self.children[id] = nil
end
end
function node:remove()
if self.parent then
self.parent:remove_child(self.id)
else
self:clear_children()
self:clear()
end
end
function node:clear_children()
for _, child in pairs(self.children) do
child:clear_children()
end
self:clear()
end
function node:clear()
self:update_list_remove()
self.id = nil
self.entity_id = nil
self.parent = nil
self.events_id = {}
self.events_params = {}
self.events = {}
self.gui = {}
self.gui_element = nil
self.children = {}
self.update_logic = nil
self.updatable = false
end
function node:find_child(id)
for _, child in pairs(self.children) do
if child.id == id then
return child
end
end
return nil
end
function node:recursive_find(id)
if self.id == id then
return self
else
for _, child in pairs(self.children) do
local child_node = child:recursive_find(id)
if child_node then
return child_node
end
end
end
return nil
end
function node:valid()
return true
end
function node:root_parent()
if self.parent then
return self.parent:root_parent()
else
return self
end
end
function node:update_list_push()
if not self.updatable then
update_array.add(self)
self.updatable = true
end
end
function node:update_list_remove()
if self.updatable then
update_array.remove(self)
self.updatable = false
end
end
function node:update_list_child_push(parent_node)
if parent_node.updatable then
update_array.add_child(parent_node, self)
end
end
function node:update_list_child_remove(parent_node)
if parent_node.updatable then
update_array.remove_child(parent_node, self)
end
end
function node:debug_print(index)
local debug_string = ""
for i=1,index do
debug_string = debug_string.." "
end
index = index + 1
for _, chilren in pairs(self.children) do
chilren:debug_print(index)
end
end
function node:debug_print_factorio_gui(element, index, max_level)
local str = ""
for i=1,index do
str = str.." "
end
index = index + 1
if index >= max_level then
return
end
str = str.."name: "..element.name..", type: "..element.type
if element.type == "label" and element.caption then
str = str..", caption: "
for i = 1, #element.caption do
str = str.." "..element.caption:sub(i,i)
end
end
str = str.."\n"
for _, child in pairs(element.children) do
str = str..node:debug_print_factorio_gui(child, index, max_level)
end
return str
end
return node
|
--[[
A WordEmbedModule takes two things as input:
1) a lookup-table for word embeddings
It encodes word indices to embeddings which could either be hash
indices or hash + LSTM indices
--]]
local WordEmbedModule = torch.class('dmn.WordEmbedModule')
function WordEmbedModule:__init(config)
-- parameters for lstm cell
assert(config.gpu_mode ~= nil, "Must specify gpu mode")
assert(config.emb_dim ~= nil, "Must specify embed dimensions")
assert(config.num_classes ~= nil, "Must specify number of classes")
assert(config.dropout_prob ~= nil, "Must specify dropout probability")
assert(config.hashing ~= nil, "Must specify whether to hash or not")
assert(config.dropout ~= nil, "Must specify whether to use dropout or not")
self.config = config
self.hashing = config.hashing
self.gpu_mode = config.gpu_mode
self.reverse = false;
local embed_type = self.hashing and dmn.FastHashLayer or dmn.EmbedLayer
self.embed_layer = embed_type{
gpu_mode = config.gpu_mode,
emb_dim = config.emb_dim,
num_classes = config.num_classes,
dropout_prob = config.dropout_prob,
dropout = config.dropout
}
self.modules = nn.Parallel()
add_modules(self.modules, self.embed_layer:getModules())
if self.gpu_mode then
dmn.logger:print("Setting word embed module to gpu mode")
self:set_gpu_mode()
end
self.tot_modules = {}
insert_modules_to_table(self.tot_modules, self.embed_layer:getModules())
--self.params, self.grad_params = self.modules:getParameters()
dmn.logger:print("Modules we're optimizing for word embed module")
dmn.logger:print(self.modules)
end
function WordEmbedModule:share(other, ...)
assert(other ~= nil, "Must specify other embed layer to share")
dmn.logger:print("Sharing word embed module")
self.embed_layer:share_params(other.embed_layer, ...)
end
-- Enable Dropouts
function WordEmbedModule:enable_dropouts()
self.embed_layer:enable_dropouts()
end
-- Disable Dropouts
function WordEmbedModule:disable_dropouts()
self.embed_layer:disable_dropouts()
end
-- Resets depth to 1
function WordEmbedModule:reset_depth()
end
function WordEmbedModule:zeroGradParameters()
self.grad_params:zero()
self.embed_layer:zeroGradParameters()
end
-- Forward propagate.
-- inputs: T x in_dim tensor, where T is the number of time steps.
-- states: hidden, cell states of LSTM if true, read the input from right to left (useful for bidirectional LSTMs).
-- Returns lstm output, class predictions, and error if train, else not error
function WordEmbedModule:forward(inputs)
assert(inputs ~= nil, "Must specify inputs to forward for word embed module")
self.word_embeds = self.embed_layer:forward(inputs)
return self.word_embeds
end
-- Backpropagate: forward() must have been called previously on the same input.
-- inputs: T x in_dim tensor, where T is the number of time steps.
-- hidden_inputs: {hidden_dim, hidden_tim} tensors
-- reverse: True if reverse input, false otherwise
-- errors: T x input_size error
-- class_predictions: T x 1 tensor of predictions
-- labels: actual labels
-- Returns the gradients with respect to the inputs (in the same order as the inputs).
function WordEmbedModule:backward(inputs, errors)
assert(inputs ~= nil, "Must put in gru regular inputs")
assert(errors ~= nil, "must put in lstm outputs")
local emb_errors = self.embed_layer:backward(inputs, errors)
return emb_errors
end
function WordEmbedModule:grad_check()
self.params, self.grad_params = self.modules:getParameters()
local input_indices = torch.IntTensor{1, 2, 3}
local criterion = nn.MSECriterion()
local desired_state = torch.rand(3, self.lstm_layer.mem_dim)
local currIndex = 0
local feval = function(x)
self.grad_params:zero()
local lstm_output = self:forward(input_indices)
local loss = criterion:forward(lstm_output, desired_state)
local errors = criterion:backward(lstm_output, desired_state)
self:backward(input_indices, errors)
currIndex = currIndex + 1
print(currIndex, " of ", self.params:size(1))
return loss, self.grad_params
end
-- check gradients for lstm layer
diff, DC, DC_est = optim.checkgrad(feval, self.params, 1e-7)
print("Gradient error for word embed module network is")
print(diff)
assert(diff < 1e-5, "Gradient is greater than tolerance")
end
-- Sets all networks to gpu mode
function WordEmbedModule:set_gpu_mode()
dmn.logger:print("Setting word embed module to gpu mode")
self.gpu_mode = true
self.config.gpu_mode = true
self.embed_layer.gpu_mode = true
self.embed_layer:set_gpu_mode()
end
-- Sets all networks to cpu mode
function WordEmbedModule:set_cpu_mode()
dmn.logger:print("Setting word embed module to cpu mode")
self.gpu_mode = false
self.config.gpu_mode = false
self.embed_layer.gpu_mode = false
self.embed_layer:set_cpu_mode()
end
function WordEmbedModule:getModules()
return self.tot_modules
end
function WordEmbedModule:getParameters()
return self.params, self.grad_params
end
function WordEmbedModule:getWeights()
return self.params
end
-- Resets depths for lstm
function WordEmbedModule:forget()
end
function WordEmbedModule:print_config()
local num_params = 0 --self.params:size(1)
printf('%-25s = %d\n', 'num params for word embed module', num_params)
printf('%-25s = %s\n', 'gpu mode', self.config.gpu_mode)
printf('%-25s = %s\n', 'use dropout', self.config.dropout)
printf('%-25s = %d\n', 'embed dimension', self.config.emb_dim)
printf('%-25s = %d\n', 'number of classes', self.config.num_classes)
printf('%-25s = %f\n', 'input dropout probability', self.config.dropout_prob)
end
|
--[[
@Authors: Ben Dol (BeniS)
@Details: MoveProcedure class for auto moving things.
]]
if not Procedure then
dofile("procedure.lua")
end
MoveProcedure = extends(Procedure, "MoveProcedure")
MoveProcedure.create = function(thing, position, verify, timeoutTicks)
local proc = MoveProcedure.internalCreate()
proc:setId(thing)
if not Position.isValid(position) then
perror(debug.traceback("position is not valid"))
end
proc.position = position
if timeoutTicks then
proc:setTimeoutTicks(timeoutTicks)
end
proc.tryMoveEvent = nil
proc.verify = verify
if thing then
local class = thing:getClassName()
if type(thing) ~= "userdata" then
perror(debug.traceback("thing provided is not userdata"))
elseif class ~= "Creature" and class ~= "Item" then
perror(debug.traceback("thing provided must be a Creature or Item class"))
end
proc.thing = thing
else
perror(debug.traceback("thing cannot be nil"))
end
return proc
end
-- gets/sets
function MoveProcedure:getThing()
return self.thing
end
function MoveProcedure:setThing(thing)
self.thing = thing
end
function MoveProcedure:getPosition()
return self.position
end
function MoveProcedure:setPosition(position)
self.position = position
end
-- logic
function MoveProcedure:start()
BotLogger.debug("MoveProcedure:start() called")
Procedure.start(self)
-- try move thing
scheduleEvent(function() self:tryMove() end, Helper.safeDelay(800, 1200))
signalcall(self.onStarted, self.id)
end
-- TODO: This needs to be reworked
function MoveProcedure:tryMove()
self:stopTryMove()
if self:isTimedOut() then return end
g_game.move(self.thing, self.position, self.thing:getCount())
-- the move has been called schedule finish
local wait = (g_game.getPing()*1.5)
if wait > 0 then
self.tryMoveEvent = scheduleEvent(function()
if self:isTimedOut() then return end
-- TODO: Fix verification
if not self.verify or self:verifyMoved() then
self:finish()
else
self:tryMove()
end
end, wait)
else
self:finish()
end
end
function MoveProcedure:verifyMoved()
BotLogger.debug("MoveProcedure:verifyMoved() called")
return true
end
function MoveProcedure:stopTryMove()
if self.tryMoveEvent then
self.tryMoveEvent:cancel()
self.tryMoveEvent = nil
end
end
function MoveProcedure:stop()
Procedure.stop(self)
BotLogger.debug("MoveProcedure:stop() called")
self:clean()
signalcall(self.onStopped, self.id)
end
function MoveProcedure:cancel()
Procedure.cancel(self)
BotLogger.debug("MoveProcedure:cancel() called")
self:clean()
signalcall(self.onCancelled, self.id)
end
function MoveProcedure:fail()
Procedure.fail(self)
BotLogger.debug("MoveProcedure:fail() called")
self:clean()
signalcall(self.onFailed, self.id)
end
function MoveProcedure:timeout()
Procedure.timeout(self)
BotLogger.debug("MoveProcedure:timeout() called")
self:clean()
signalcall(self.onTimedOut, self.id)
end
function MoveProcedure:finish()
Procedure.finish(self)
BotLogger.debug("MoveProcedure:finish() called")
self:clean()
signalcall(self.onFinished, self.id)
end
function MoveProcedure:clean()
Procedure.clean(self)
BotLogger.debug("MoveProcedure:clean() called")
self:stopTryMove()
signalcall(self.onCleaned, self.id)
end
|
return {'orwelliaans','orwelliaanse'}
|
--[[
@description Arm tracks for recording
@author Ben Smith
@link
Author https://www.bensmithsound.uk
Repository https://github.com/bsmith96/Reaper-Scripts
@version 1.3
@changelog
# Added user identifier to provided file names
@metapackage
@provides
[main] . > bsmith96_Arm Tracks For Recording.lua
@about
# Arm tracks for recording
Written by Ben Smith - 2021
### Info
* Arm a specific set of tracks for recording – customise a version of this script for use with your project.
* Useful when you are regularly arming and disarming the same group of tracks, but do not want to arm every track in the project (e.g. recording a multitrack performance, and you have groups or folders).
* "Arm all tracks within folders" is more useful, if that is what you need this for.
### User customisation
* tracksToArm
* A list of all tracks you wish to toggle.
* rangeToArm
* A range of tracks which should all be toggled.
]]
-- =========================================================
-- =============== USER CUSTOMISATION AREA ===============
-- =========================================================
tracksToArm = {}
rangeToArm = {} -- list only the first and last track number in the range
--------- End of user customisation area --
-- ===========================================
-- =============== FUNCTIONS ===============
-- ===========================================
-- Toggle record arm on a specific track
function armTrack(track)
track = reaper.GetTrack(0,track-1)
reaper.CSurf_OnRecArmChange(track, -1)
end
-- Toggle record arm on a range of tracks
function armRange(firstTrack, lastTrack)
if firstTrack ~= lastTrack then
for i = lastTrack, firstTrack, -1
do
track = reaper.GetTrack(0,i-1)
reaper.CSurf_OnRecArmChange(track, -1)
end
end
end
-- Toggle record arm on a set of specific tracks
function armTracks(arrayToArm)
armTrackSize = #arrayToArm
for i = armTrackSize, 1, -1
do
trackNum = arrayToArm[i]
track = reaper.GetTrack(0, trackNum-1)
reaper.CSurf_OnRecArmChange(track, -1)
end
end
-- ==============================================
-- =============== MAIN ROUTINE ===============
-- ==============================================
if tracksToArm ~= {} then
armTracks(tracksToArm)
end
armRangeSize = #rangeToArm
armRangeFirst = rangeToArm[1]
armRangeLast = rangeToArm[armRangeSize]
armRange(armRangeFirst, armRangeLast)
|
local moreGames_pin_map = require("qnFiles/qnPlist/hall/moreGames_pin");
local num_download_pin_map = require("qnFiles/qnPlist/hall/num_download_pin");
local num_online_pin_map = require("qnFiles/qnPlist/hall/num_online_pin");
local roomLevels_pin_map = require("qnFiles/qnPlist/hall/roomLevels_pin");
local moreGameListItem=
{
name="moreGameListItem",type=0,typeName="View",time=0,report=0,x=0,y=0,width=317,height=392,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,
{
name="info_view",type=0,typeName="View",time=110978655,x=55,y=0,width=590,height=380,nodeAlign=kAlignLeft,visible=1,fillParentWidth=0,fillParentHeight=0
},
{
name="show_view",type=1,typeName="Image",time=89283560,report=0,x=0,y=0,width=317,height=392,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,file=moreGames_pin_map['games_bg.png'],
{
name="game_icon",type=1,typeName="Image",time=89283588,report=0,x=0,y=0,width=245,height=320,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,file="isolater/bg_blank.png",
{
name="downloading_view",type=0,typeName="View",time=89282354,report=0,x=0,y=0,width=245,height=320,visible=0,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignCenter,
{
name="progress_light",type=1,typeName="Image",time=89266595,report=0,x=0,y=0,width=245,height=86,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignBottom,file=moreGames_pin_map['circle_light.png']
},
{
name="progress",type=0,typeName="View",time=89266888,report=0,x=0,y=0,width=245,height=45,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignBottom,
{
name="num_1",type=1,typeName="Image",time=89267273,report=0,x=-26,y=0,width=30,height=34,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,file="isolater/bg_blank.png"
},
{
name="num_2",type=1,typeName="Image",time=89267275,report=0,x=-8,y=0,width=30,height=34,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,file="isolater/bg_blank.png"
},
{
name="num_3",type=1,typeName="Image",time=89267277,report=0,x=8,y=0,width=30,height=34,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,file="isolater/bg_blank.png"
},
{
name="percent_iocn",type=1,typeName="Image",time=89273054,report=0,x=26,y=0,width=30,height=34,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,file=num_download_pin_map['%.png']
}
}
},
{
name="undownload_view",type=0,typeName="View",time=111004470,x=0,y=0,width=245,height=320,nodeAlign=kAlignTopLeft,visible=0,fillParentWidth=1,fillParentHeight=1,
{
name="undownload",type=1,typeName="Image",time=111002855,report=0,x=0,y=11,width=95,height=23,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignBottom,file=moreGames_pin_map['undownload.png']
}
},
{
name="onlineNumView",type=0,typeName="View",time=88854795,report=0,x=0,y=3,width=245,height=30,visible=0,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignBottom,
{
name="word",type=1,typeName="Image",time=90408443,report=0,x=0,y=0,width=52,height=23,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignLeft,file=num_online_pin_map['word_online.png']
}
},
{
name="gameStatusView",type=0,typeName="View",time=94649113,x=0,y=3,width=245,height=30,nodeAlign=kAlignBottom,visible=1,fillParentWidth=0,fillParentHeight=0,
{
name="newGamesIcon",type=0,typeName="Image",time=94648694,x=0,y=0,width=95,height=23,nodeAlign=kAlignCenter,visible=0,fillParentWidth=0,fillParentHeight=0,file=roomLevels_pin_map['newGamesIcon.png']
}
},
{
name="game_name",type=0,typeName="Image",time=111005665,x=0,y=0,width=245,height=320,nodeAlign=kAlignBottom,visible=1,fillParentWidth=1,fillParentHeight=1,file="isolater/bg_blank.png"
}
}
},
{
name="icon_view",type=0,typeName="View",time=110975039,width=260,height=330,nodeAlign=kAlignCenter,visible=1,fillParentWidth=0,fillParentHeight=0,
{
name="bg_light",type=1,typeName="Image",time=89266125,report=0,x=0,y=0,width=317,height=392,visible=0,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignCenter,file=moreGames_pin_map['download_bg_light.png']
},
{
name="new",type=0,typeName="Image",time=110975090,x=0,y=0,width=120,height=74,nodeAlign=kAlignTopLeft,visible=1,fillParentWidth=0,fillParentHeight=0,file=moreGames_pin_map['icon_new.png']
}
}
}
return moreGameListItem;
|
--[[
User Study - Button Click
v1.1
by: standardcombo
Manages replication of UI button clicks from subjects to observers.
--]]
local API = require( script:GetCustomProperty("UserStudyAPI") )
local CLICK_SFX = script:GetCustomProperty("ClickSFX"):WaitForObject()
local UI_CONTAINER = script:GetCustomProperty("UIContainer"):WaitForObject()
local SUBJECT_CURSOR = script:GetCustomProperty("SubjectCursor"):WaitForObject()
local FEEDBACK_TEXT_TEMPLATE = script:GetCustomProperty("FeedbackTextTemplate")
local FEEDBACK_TEXT_DURATION = script:GetCustomProperty("FeedbackTextDuration")
local buttons = {}
local listeners = {}
-- Observers are notified that their subject clicked on a button
function OnButtonClicked(buttonName, buttonId)
CLICK_SFX:Play()
local button = World.FindObjectById(buttonId)
if Object.IsValid(button) and button:IsA("UIButton") and button:IsVisibleInHierarchy() then
if button.text == "" then
if buttonName ~= "" then
ShowFeedbackText(buttonName .. "\n" .. buttonId)
else
ShowFeedbackText(buttonId)
end
end
if not button.clientUserData.defaultColor then
button.clientUserData.defaultColor = button:GetButtonColor()
end
button:SetButtonColor(button:GetPressedColor())
Task.Wait(0.2)
if Object.IsValid(button) then
button:SetButtonColor(button.clientUserData.defaultColor)
end
else
ShowFeedbackText(buttonName)
end
end
Events.Connect("Study_Btn", OnButtonClicked)
function ShowFeedbackText(message)
local feedback = World.SpawnAsset(FEEDBACK_TEXT_TEMPLATE, {parent = UI_CONTAINER})
feedback.x = SUBJECT_CURSOR.x
feedback.y = SUBJECT_CURSOR.y
feedback.text = message
feedback.lifeSpan = FEEDBACK_TEXT_DURATION
end
function HideFeedbackText()
BUTTON_FEEDBACK_TEXT.visibility = Visibility.FORCE_OFF
end
-- Subject clicked on a button. Tell the observers about it
function OnSubjectButtonClicked(button)
local buttonName = button.text
if buttonName == "" then
buttonName = button.name
if button.parent then
buttonName = button.parent.name .. "/" .. buttonName
end
end
API.BroadcastToObservers("Study_Btn", buttonName, SplitMuid(button.id))
end
-- Subject gets message that their status as subject has changed
function OnLocalPlayerIsSubject(isSubject)
-- They were not a subject, but now they are
if isSubject then
-- Gather buttons and connect to their click events
buttons = World.FindObjectsByType("UIButton")
for _,b in ipairs(buttons) do
local eventListener = b.clickedEvent:Connect(OnSubjectButtonClicked)
table.insert(listeners, eventListener)
end
-- They used to be a subject, but are no longer
else
-- Cleanup
for _,l in ipairs(listeners) do
if l then
l:Disconnect()
end
end
listeners = {}
buttons = {}
end
end
Events.Connect("Study_LocalIsSubject", OnLocalPlayerIsSubject)
-- Eliminate the second half of the MUID, as the first half is enough for identity
function SplitMuid(muid)
local split = { CoreString.Split(muid, ":") }
return split[1]
end
|
return require "loop.component.base"
|
local statistics = {}
local aiStats = {}
if not DEDICATED then
IMAGE_STATS_PICKUP = love.graphics.newImage("Images/StatsIconPickUp.png")
IMAGE_STATS_DROPOFF = love.graphics.newImage("Images/StatsIconDropOff.png")
IMAGE_STATS_DROPOFF_WRONG = love.graphics.newImage("Images/StatsIconDropOffWrong.png")
IMAGE_STATS_CASH = love.graphics.newImage("Images/StatsIconCash.png")
IMAGE_STATS_TIME = love.graphics.newImage("Images/StatsIconTime.png")
end
local statBoxPositive = nil
local statBoxNegative = nil
function statistics.setAIName(aiID, name, owner)
print("OWNER:", aiID, name, owner)
if aiStats[aiID] then
aiStats[aiID].name = name or "Unknown"
aiStats[aiID].owner = owner or "Unknown"
if not DEDICATED then
statistics.setAIColour(aiID, getPlayerColour(aiID))
end
end
end
function statistics.setAIColour(aiID, col)
if aiStats[aiID] then
aiStats[aiID].red = col.r
aiStats[aiID].green = col.g
aiStats[aiID].blue = col.b
end
end
function statistics.addTrain( aiID, train )
aiStats[aiID].trains[train.ID] = train
aiStats[aiID].trains[train.ID].pPickedUp = 0 -- number of passengers which were picked up
aiStats[aiID].trains[train.ID].pDroppedOff = 0 -- number of passengers dropped off
aiStats[aiID].trains[train.ID].pTransported = 0 -- only set if the player has transported the passenger to his/her destination
aiStats[aiID].trains[train.ID].pWronglyDropped = 0
aiStats[aiID].trains[train.ID].timeBlocked = 0
aiStats[aiID].trains[train.ID].pNormal = 0
aiStats[aiID].trains[train.ID].pVIP = 0
aiStats[aiID].numTrains = aiStats[aiID].numTrains + 1
if CL_CHART_DIRECTORY then
if #aiStats[aiID].chartTrains > 0 then -- there's already a point in the list?
aiStats[aiID].chartTrains[#aiStats[aiID].chartTrains+1] = {x=math.floor(curMap.time), y = aiStats[aiID].chartTrains[#aiStats[aiID].chartTrains].y}
end
aiStats[aiID].chartTrains[#aiStats[aiID].chartTrains+1] = {x=math.floor(curMap.time), y = aiStats[aiID].numTrains}
--table.insert(aiStats[aiID].chartTrains, {x=math.floor(curMap.time), y = aiStats[aiID].numTrains})
end
end
function statistics.addMoney( aiID, money )
aiStats[aiID].money = aiStats[aiID].money + money
aiStats[aiID].moneyEarnedTotal = aiStats[aiID].moneyEarnedTotal + money
if aiStats[aiID].money >= TRAIN_COST then
ai.enoughMoney(aiID, aiStats[aiID].money)
end
end
function statistics.subMoney( aiID, money )
if aiStats[aiID].money >= money then
aiStats[aiID].money = aiStats[aiID].money - money
return true
else
return false
end
end
function statistics.getMoney( aiID )
if aiStats[aiID] then
return aiStats[aiID].money
else
return 0
end
end
function statistics.getMoneyAI( aiID )
return function ()
if aiStats[aiID] then
return aiStats[aiID].money
end
end
end
function statistics.getPassengersTransported( aiID )
if aiStats[aiID] then
return (aiStats[aiID].pTransported)
end
return (0)
end
function statistics.passengersPickedUp( aiID, trainID )
aiStats[aiID].pPickedUp = aiStats[aiID].pPickedUp + 1
aiStats[aiID].trains[trainID].pPickedUp = aiStats[aiID].trains[trainID].pPickedUp + 1
end
function statistics.droppedOff( aiID, trainID )
aiStats[aiID].pDroppedOff = aiStats[aiID].pDroppedOff + 1
aiStats[aiID].trains[trainID].pDroppedOff = aiStats[aiID].trains[trainID].pDroppedOff + 1
end
function statistics.broughtToDestination( aiID, trainID, vip )
aiStats[aiID].pTransported = aiStats[aiID].pTransported + 1
aiStats[aiID].trains[trainID].pTransported = aiStats[aiID].trains[trainID].pTransported + 1
if CL_CHART_DIRECTORY then
--if #aiStats[aiID].chartPassengers > 0 then -- there's already a point in the list?
-- aiStats[aiID].chartPassengers[#aiStats[aiID].chartPassengers+1] = {x=math.floor(curMap.time), y = aiStats[aiID].chartPassengers[#aiStats[aiID].chartPassengers].y}
--end
aiStats[aiID].chartPassengers[#aiStats[aiID].chartPassengers+1] = {x=math.floor(curMap.time), y = aiStats[aiID].pTransported}
--table.insert(aiStats[aiID].chartPassengers, {x=math.floor(curMap.time), y = aiStats[aiID].pTransported})
end
if vip then
aiStats[aiID].pVIP = aiStats[aiID].pVIP + 1
aiStats[aiID].trains[trainID].pVIP = aiStats[aiID].trains[trainID].pVIP + 1
else
aiStats[aiID].pNormal = aiStats[aiID].pNormal + 1
aiStats[aiID].trains[trainID].pNormal = aiStats[aiID].trains[trainID].pNormal + 1
end
end
function statistics.broughtToWrongPlace( aiID, trainID )
aiStats[aiID].pWronglyDropped = aiStats[aiID].pWronglyDropped + 1
aiStats[aiID].trains[trainID].pWronglyDropped = aiStats[aiID].trains[trainID].pWronglyDropped + 1
end
function statistics.trainBlockedTime( aiID, trainID, time )
aiStats[aiID].trains[trainID].timeBlocked = aiStats[aiID].trains[trainID].timeBlocked + time
end
function secondsToReadableTime(time) -- convert time given in seconds to a human readable time format (hours, mins, seconds)
local hours = math.floor(time/3600)
local mins = math.floor((time - hours*3600)/60)
local secs = math.ceil(time - hours*3600 - mins*60)
return hours .. "h " .. mins .. "m " .. secs .. "s"
end
function statistics.print()
if curMap or simulationMap then
local t = 0
if curMap then
t = curMap.time
else
t = simulationMap.time
end
print("Time taken: " .. secondsToReadableTime(t)) -- print in readable format
for i = 1,#aiStats do
print(aiStats[i].name .. ":")
print("\tPicked up " .. aiStats[i].pPickedUp .. " passengers.")
print("\tDropped off " .. aiStats[i].pDroppedOff .. " passengers.")
print("\tBrought " .. aiStats[i].pTransported .. " passengers to their destinations.")
print("\tCash: " .. aiStats[i].money)
--[[for j = 1,#stats[i].trains do
print("\t" .. stats[i].trains[j].name .. ":")
print("\t\tPicked up " .. stats[i].trains[j].pPickedUp .. " passengers.")
print("\t\tDropped off " .. stats[i].trains[j].pDroppedOff .. " passengers.")
print("\t\tBrought " .. stats[i].trains[j].pTransported .. " passengers to their destinations.")
end
]]--
end
--[[
for k, p in pairs(passengerStats) do
print("\t" .. k)
printTable(p, 2)
end
]]--
end
end
--------------------------------------------------------------
-- PASSENGER STATS:
--------------------------------------------------------------
function statistics.newPassenger( passenger )
local t = 0
if curMap then t = curMap.time
elseif simulationMap then
t = simulationMap.time
else
t = 0
end
passengerStats[passenger.name] = {}
passengerStats[passenger.name].timeSpawned = t -- save the current time
passengerStats[passenger.name].timeOnRails = 0
passengerStats[passenger.name].timeWaited = 0
end
function statistics.passengerPickedUp( passenger )
local t = 0
if curMap then
t = curMap.time
elseif simulationMap then
t = simulationMap.time
else
t = 0
end
passengerStats[passenger.name].timeWaited = passengerStats[passenger.name].timeWaited + (t - (passengerStats[passenger.name].timeLastDroppedOff or passengerStats[passenger.name].timeSpawned))
if passengerStats[passenger.name].timeFirstPickedUp == nil then -- have I been picked up before?
passengerStats[passenger.name].timeFirstPickedUp = t -- save the current time
passengerStats[passenger.name].timeUntilFirstPickup = t - passengerStats[passenger.name].timeSpawned
end
passengerStats[passenger.name].timeLastPickup = t
end
function statistics.passengerDroppedOff( passenger )
local t = 0
if curMap then
t = curMap.time
elseif simulationMap then
t = simulationMap.time
else
t = 0
end
passengerStats[passenger.name].timeLastDroppedOff = t
passengerStats[passenger.name].timeOnRails = passengerStats[passenger.name].timeOnRails + (t - passengerStats[passenger.name].timeLastPickup)
if passenger.tileX == passenger.destX and passenger.tileY == passenger.destY then
passengerStats[passenger.name].timeTotal = t - passengerStats[passenger.name].timeSpawned
end
end
--------------------------------------------------------------
-- GENERATE STATS DISPLAY:
--------------------------------------------------------------
local numStats = 0
local statWindows = {}
-- ai:
-- most passengers picked up
-- trains:
-- most passengers picked up
-- most passengers dropped off correctly
-- most passengers dropped off wrongly
-- passengers:
-- fastest travel
-- longest time on rails
-- longest wait
-- most dropped off (?)
function statistics.clearWindows()
statWindows = {}
end
function statistics.addStatWindow(newStat)
for i=1,numStats+1 do
if statWindows[i] == nil then
if type(newStat) == "table" then
statWindows[i] = newStat
else
local tbl = seperateStrings(newStat)
printTable(tbl)
TITLE = tbl[1]
TXT = tbl[2]
ID = tonumber(tbl[3])
statWindows[i] = {}
statWindows[i].icons = {}
statWindows[i].title = TITLE
statWindows[i].text = TXT
if ID then
if TITLE == LNG.stat_most_picked_up_title or TITLE == [[Hospitality]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=55, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=IMAGE_STATS_PICKUP,x=24, y=30, shadow=true})
statWindows[i].bg = statBoxPositive
end
if TITLE == LNG.stat_most_trains_title or TITLE == [[Fleetus Maximus]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=55, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=24, y=30, shadow=true})
statWindows[i].bg = statBoxPositive
end
if TITLE == LNG.stat_most_transported_title or TITLE == [[Earned Your Pay]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=25, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=IMAGE_STATS_DROPOFF,x=37, y=30, shadow=true})
statWindows[i].bg = statBoxPositive
end
if TITLE == LNG.stat_most_normal_transported_title or TITLE == [[Socialist]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=25, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=IMAGE_STATS_DROPOFF,x=37, y=30, shadow=true})
statWindows[i].bg = statBoxPositive
end
if TITLE == LNG.stat_dropped_title or TITLE == [[Get lost...]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=25, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=IMAGE_STATS_DROPOFF_WRONG,x=37, y=30, shadow=true})
statWindows[i].bg = statBoxNegative
end
if TITLE == LNG.stat_most_money_title or TITLE == [[Capitalist]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=25, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=IMAGE_STATS_CASH,x=40, y=26, shadow=true})
statWindows[i].bg = statBoxPositive
end
--trains:
if TITLE == LNG.stat_tr_most_picked_up_title or TITLE == [[Busy little Bee!]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=55, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=IMAGE_STATS_PICKUP,x=24, y=30, shadow=true})
statWindows[i].bg = statBoxPositive
end
if TITLE == LNG.stat_tr_most_transported_title or TITLE == [[Home sweet Home]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=25, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=IMAGE_STATS_DROPOFF,x=37, y=30, shadow=true})
statWindows[i].bg = statBoxPositive
end
if TITLE == LNG.stat_tr_dropped_title or TITLE == [[Why don't you walk?]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=25, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=IMAGE_STATS_DROPOFF_WRONG,x=37, y=30, shadow=true})
statWindows[i].bg = statBoxNegative
end
if TITLE == LNG.stat_tr_blocked_title or TITLE == [[Line is busy...]] then
table.insert(statWindows[i].icons, {img=train.getTrainImage(ID),x=25, y=20, shadow=true})
table.insert(statWindows[i].icons, {img=IMAGE_STATS_TIME,x=50, y=20})
statWindows[i].bg = statBoxNegative
end
end
end
statWindows[i].displayTime = i-1
numVertical = math.floor(love.graphics.getHeight()/statWindows[i].bg:getHeight())
yIndex = i-1
xIndex = 0
while yIndex > numVertical do
yIndex = yIndex - numVertical
xIndex = xIndex + 1
end
statWindows[i].x = xIndex*statWindows[i].bg:getWidth()
statWindows[i].y = yIndex*statWindows[i].bg:getHeight()
numStats = numStats + 1
break
end
end
end
function statistics.trainTransportedNum( aiID, ID )
if aiStats[aiID] and aiStats[aiID].trains and aiStats[aiID].trains[ID] then
return aiStats[aiID].trains[ID].pTransported
end
end
function statistics.generateStatWindows()
statistics.clearWindows()
allPossibleStats = {}
numStats = 0
-- ai: most passengers picked up:
local mostPickedUp = 0
local mostPickedUpID = nil
-- ai: most passengers brought to their destination:
local mostTransported = 0
local mostTransportedID = nil
-- ai: most passengers dropped off at wrong position
local mostWrongDestination = 0
local mostWrongDestinationID = nil
-- ai: most money made
local mostMoney = 0
local mostMoneyID = nil
-- ai: most normal transported
local mostNormalTransported = 0
local mostNormalTransportedID = nil
-- ai: largest number of trains:
local mostTrains = 0
local mostTrainsID = nil
-- train: most passengers picked up:
local trMostPickedUp = 0
local trMostPickedUpID = nil
local trMostPickedUpName = nil
-- ai: most passengers brought to their destination:
local trMostTransported = 0
local trMostTransportedID = nil
local trMostTransportedName = nil
-- ai: most passengers dropped off at wrong position
local trMostWrongDestination = 0
local trMostWrongDestinationID = nil
local trMostWrongDestinationName = nil
-- ai: most passengers dropped off at wrong position
local trLongestBlocked = 0
local trLongestBlockedID = nil
local trLongestBlockedName = nil
for i = 1,#aiStats do
if aiStats[i].pPickedUp and aiStats[i].pPickedUp >= mostPickedUp then
mostPickedUpID = i
if mostPickedUp == aiStats[i].pPickedUp then
mostPickedUpID = nil
end
mostPickedUp = aiStats[i].pPickedUp
end
if aiStats[i].pTransported and aiStats[i].pTransported >= mostTransported then
mostTransportedID = i
if mostTransported == aiStats[i].pTransported then
mostTransportedID = nil
end
mostTransported = aiStats[i].pTransported
end
if aiStats[i].pTransported and aiStats[i].pPickedUp and aiStats[i].pWronglyDropped >= mostWrongDestination then
mostWrongDestinationID = i
if mostWrongDestination == aiStats[i].pWronglyDropped then
mostWrongDestinationID = nil
end
mostWrongDestination = aiStats[i].pPickedUp - aiStats[i].pTransported
end
if aiStats[i].moneyEarnedTotal and aiStats[i].moneyEarnedTotal >= mostMoney then
mostMoneyID = i
if mostMoney == aiStats[i].moneyEarnedTotal then
mostMoneyID = nil
end
mostMoney = aiStats[i].moneyEarnedTotal
end
if aiStats[i].pNormal and aiStats[i].pNormal >= mostNormalTransported then
mostNormalTransportedID = i
if mostNormalTransported == aiStats[i].pNormal then
mostNormalTransportedID = nil
end
mostNormalTransported = aiStats[i].pNormal
end
if aiStats[i].numTrains and aiStats[i].numTrains >= mostTrains then
mostTrainsID = i
if mostTrains == aiStats[i].numTrains then
mostTrainsID = nil
end
mostTrains = aiStats[i].numTrains
end
for k, tr in pairs(aiStats[i].trains) do
if tr.pPickedUp and tr.pPickedUp >= trMostPickedUp then
trMostPickedUpID = i
trMostPickedUpName = tr.name
if trMostPickedUp == tr.pPickedUp then
trMostPickedUpID = nil
trMostPickedUpName = nil
end
trMostPickedUp = tr.pPickedUp
end
if tr.pTransported and tr.pTransported >= trMostTransported then
trMostTransportedID = i
trMostTransportedName = tr.name
if trMostTransported == tr.pTransported then
trMostTransportedID = nil
trMostTransportedName = nil
end
trMostTransported = tr.pTransported
end
if tr.pTransported and tr.pPickedUp and tr.pWronglyDropped >= trMostWrongDestination then
trMostWrongDestinationID = i
trMostWrongDestinationName = tr.name
if trMostWrongDestination == tr.pWronglyDropped then
trMostWrongDestinationID = nil
trMostWrongDestinationName = nil
end
trMostWrongDestination = tr.pWronglyDropped
end
if tr.timeBlocked and tr.timeBlocked >= trLongestBlocked then
trLongestBlockedID = i
trLongestBlockedName = tr.name
if trLongestBlocked == tr.timeBlocked then
trLongestBlockedID = nil
trLongestBlockedName = nil
end
trLongestBlocked = tr.timeBlocked
end
end
end
-- calculate ranking and give points accordingly!
lastRank = math.huge
for curPoints = 3,0,-1 do
cur = 0
for i = 1,#aiList do
if aiList[i] and not aiList[i].points then
if aiStats[i].pTransported > cur then
cur = aiStats[i].pTransported
end
end
end
for i = 1,#aiList do
if aiList[i] and aiStats[i].pTransported == cur then
aiList[i].points = curPoints
end
end
end
if mostPickedUpID then
if mostPickedUp ~= 1 then
text = LNG.stat_most_picked_up --"AI " .. aiStats[mostPickedUpID].name .. " picked up " .. mostPickedUp .. " passengers."
else
text = LNG.stat_most_picked_up_sing--"AI " .. aiStats[mostPickedUpID].name .. " picked up " .. mostPickedUp .. " passenger."
end
text = text:gsub("_AINAME_", aiStats[mostPickedUpID].name)
text = text:gsub("_NUMBER_", mostPickedUp)
icons = {}
table.insert(icons, {img=train.getTrainImage(mostPickedUpID),x=55, y=20, shadow=true})
table.insert(icons, {img=IMAGE_STATS_PICKUP,x=24, y=30, shadow=true})
table.insert( allPossibleStats, {title=LNG.stat_most_picked_up_title, text=text, bg=statBoxPositive, icons=icons, ID=mostPickedUpID})
end
if mostTrainsID then
if mostTrains ~= 1 then
text = LNG.stat_most_trains
else
text = LNG.stat_most_trains_sing
end
text = text:gsub("_AINAME_", aiStats[mostTrainsID].name)
text = text:gsub("_NUMBER_", mostTrains)
icons = {}
table.insert(icons, {img=train.getTrainImage(mostTrainsID),x=55, y=20, shadow=true})
table.insert(icons, {img=train.getTrainImage(mostTrainsID),x=24, y=30, shadow=true})
table.insert( allPossibleStats, {title=LNG.stat_most_trains_title, text=text, bg=statBoxPositive, icons=icons, ID=mostTrainsID})
end
if mostTransportedID then
icons = {}
table.insert(icons, {img=train.getTrainImage(mostTransportedID),x=25, y=20, shadow=true})
table.insert(icons, {img=IMAGE_STATS_DROPOFF,x=37, y=30, shadow=true})
if mostTransported ~= 1 then
text = LNG.stat_most_transported
else
text = LNG.stat_most_transported_sing
end
text = text:gsub("_AINAME_", aiStats[mostTransportedID].name)
text = text:gsub("_NUMBER_", mostTransported)
table.insert( allPossibleStats, {title=LNG.stat_most_transported_title, text=text, bg=statBoxPositive, icons=icons, ID=mostTransportedID})
end
if mostNormalTransportedID then
icons = {}
table.insert(icons, {img=train.getTrainImage(mostNormalTransportedID),x=25, y=20, shadow=true})
table.insert(icons, {img=IMAGE_STATS_DROPOFF,x=37, y=30, shadow=true})
if mostNormalTransported ~= 1 then
text = LNG.stat_most_normal_transported
else
text = LNG.stat_most_normal_transported_sing
end
text = text:gsub("_AINAME_", aiStats[mostNormalTransportedID].name)
text = text:gsub("_NUMBER_", mostNormalTransported)
table.insert( allPossibleStats, {title=LNG.stat_most_normal_transported_title, text=text, bg=statBoxPositive, icons=icons, ID=mostNormalTransportedID})
end
if mostWrongDestinationID then
icons = {}
table.insert(icons, {img=train.getTrainImage(mostWrongDestinationID),x=25, y=20, shadow=true})
table.insert(icons, {img=IMAGE_STATS_DROPOFF_WRONG,x=37, y=30, shadow=true})
if mostWrongDestination ~= 1 then
text = LNG.stat_dropped
else
text = LNG.stat_dropped_sing
end
text = text:gsub("_AINAME_", aiStats[mostWrongDestinationID].name)
text = text:gsub("_NUMBER_", mostWrongDestination)
table.insert( allPossibleStats, {title=LNG.stat_dropped_title, text=text, bg=statBoxNegative, icons=icons, ID=mostWrongDestinationID})
end
if mostMoneyID then
icons = {}
table.insert(icons, {img=train.getTrainImage(mostMoneyID),x=25, y=20, shadow=true})
table.insert(icons, {img=IMAGE_STATS_CASH,x=40, y=26, shadow=true})
text = LNG.stat_most_money
text = text:gsub("_AINAME_", aiStats[mostMoneyID].name)
text = text:gsub("_NUMBER_", mostMoney)
table.insert( allPossibleStats, {title=LNG.stat_most_money_title, text=text, bg=statBoxPositive, icons=icons, ID=mostMoneyID})
end
--trains:
if trMostPickedUpID then
icons = {}
table.insert(icons, {img=train.getTrainImage(trMostPickedUpID),x=55, y=20, shadow=true})
table.insert(icons, {img=IMAGE_STATS_PICKUP,x=24, y=30, shadow=true})
text = LNG.stat_tr_most_picked_up
text = text:gsub("_AINAME_", aiStats[trMostPickedUpID].name)
text = text:gsub("_TRAINNAME_", trMostPickedUpName)
table.insert( allPossibleStats, {title=LNG.stat_tr_most_picked_up_title, text=text, bg=statBoxPositive, icons=icons, ID=trMostPickedUpID})
end
if trMostTransportedID then
icons = {}
table.insert(icons, {img=train.getTrainImage(trMostTransportedID),x=25, y=20, shadow=true})
table.insert(icons, {img=IMAGE_STATS_DROPOFF,x=37, y=30, shadow=true})
text = LNG.stat_tr_most_transported
text = text:gsub("_AINAME_", aiStats[trMostTransportedID].name)
text = text:gsub("_TRAINNAME_", trMostTransportedName)
table.insert( allPossibleStats, {title=LNG.stat_tr_most_transported_title, text=text, bg=statBoxPositive, icons=icons, ID=trMostTransportedID})
end
if trMostWrongDestinationID then
icons = {}
table.insert(icons, {img=train.getTrainImage(trMostWrongDestinationID),x=25, y=20, shadow=true})
table.insert(icons, {img=IMAGE_STATS_DROPOFF_WRONG,x=37, y=30, shadow=true})
if trMostWrongDestination ~= 1 then
text = LNG.stat_tr_dropped
else
text = LNG.stat_tr_dropped_sing
end
text = text:gsub("_AINAME_", aiStats[trMostWrongDestinationID].name)
text = text:gsub("_TRAINNAME_", trMostWrongDestinationName)
text = text:gsub("_NUMBER_", trMostWrongDestination)
table.insert( allPossibleStats, {title=LNG.stat_tr_dropped_title, text=text, bg=statBoxNegative, icons=icons, ID=trMostWrongDestinationID})
end
if trLongestBlockedID then
icons = {}
table.insert(icons, {img=train.getTrainImage(trLongestBlockedID),x=25, y=20, shadow=true})
table.insert(icons, {img=IMAGE_STATS_TIME,x=50, y=20})
text = LNG.stat_tr_blocked
text = text:gsub("_AINAME_", aiStats[trLongestBlockedID].name)
text = text:gsub("_TRAINNAME_", trLongestBlockedName)
text = text:gsub("_NUMBER_", math.floor(10*trLongestBlocked)/10)
table.insert( allPossibleStats, {title=LNG.stat_tr_blocked_title, text=text, bg=statBoxNegative, icons=icons, ID=trLongestBlockedID})
end
for k, v in pairs(allPossibleStats) do
print(v.title, v.text)
end
--randomize:
randomizeTable(allPossibleStats)
-- determine the winner:
if mostTransportedID then
winnerID = mostTransportedID -- write to database
print("WINNER FOUND!", winnerID)
end
--
i = 0
for k, v in pairs(allPossibleStats) do
if i >= 4 then
break
end
if DEDICATED then
sendStr = "NEW_STAT:"
sendStr = sendStr .. v.title .. ","
sendStr = sendStr .. v.text .. ","
sendStr = sendStr .. (v.ID or "nil") .. ","
sendMapUpdate(sendStr)
else
statistics.addStatWindow(v)
end
i = i + 1
end
if CL_CHART_DIRECTORY then
for aiID, stat in pairs(aiStats) do
if #aiStats[aiID].chartTrains > 0 then -- there's already a point in the list?
aiStats[aiID].chartTrains[#aiStats[aiID].chartTrains+1] = {x=math.floor(curMap.time), y = aiStats[aiID].chartTrains[#aiStats[aiID].chartTrains].y}
end
aiStats[aiID].chartTrains[#aiStats[aiID].chartTrains+1] = {x=math.floor(curMap.time), y = aiStats[aiID].numTrains}
aiStats[aiID].chartPassengers[#aiStats[aiID].chartPassengers+1] = {x=math.floor(curMap.time), y = aiStats[aiID].pTransported}
end
if not DEDICATED then
statistics.generateChart()
end
end
end
function statistics.generateChallengeResult(msg, winner)
statistics.clearWindows()
allPossibleStats = {}
if winner then
statistics.addStatWindow({title="Challenge completed!", text=msg or "", bg=statBoxPositive, icons={{img=checkmarkImage,x=25, y=30}}})
else
statistics.addStatWindow({title="You failed!", text=msg or "", bg=statBoxNegative, icons={{img=failedImage,x=25, y=30}}})
end
end
function statistics.generateChart()
if CL_CHART_DIRECTORY then
local points = {}
for i = 1,#aiStats do
points[i] = aiStats[i].chartPassengers
points[i].name = aiStats[i].name
end
--printTable(points)
if #points > 0 then
chart1Content = chart.generate(CL_CHART_DIRECTORY .. "/results.svg", 350, 200, points, "seconds", "passengers")
end
points = {}
for i = 1,#aiStats do
points[i] = aiStats[i].chartTrains
points[i].name = aiStats[i].name
end
if #points > 0 then
chart2Content = chart.generate(CL_CHART_DIRECTORY .. "/resultsTrains.svg", 350, 200, points, "seconds", "trAIns")
end
if CL_DIRECTORY then
print("Logging results for individual AIs")
for k = 1, #aiStats do
if aiStats[k].name and aiStats[k].owner then
if chart1Content then
file = io.open(CL_DIRECTORY .. "/" .. aiStats[k].owner .. "/" .. aiStats[k].name .. ".svg", "w")
if file then
file:write(chart1Content)
file:close()
end
end
if chart2Content then
file = io.open(CL_DIRECTORY .. "/" .. aiStats[k].owner .. "/" .. aiStats[k].name .. "_trains.svg", "w")
if file then
file:write(chart2Content)
file:close()
end
end
end
end
end
end
end
--------------------------------------------------------------
-- SHOW STATS:
--------------------------------------------------------------
function statistics.display(globX, globY, dt)
love.graphics.setColor(0,0,0,150)
love.graphics.rectangle("fill", 0,0,love.graphics.getWidth(), love.graphics.getHeight())
love.graphics.setColor(255,255,255,255)
if not msgBox.isVisible() then
for k, s in pairs(statWindows) do
if s.displayTime > 0 then
s.displayTime = s.displayTime - dt
else
x,y = globX + s.x, globY + s.y
love.graphics.draw(s.bg, x, y)
love.graphics.setFont(FONT_STAT_HEADING)
love.graphics.printf(s.title, x, y+8, s.bg:getWidth(), "center")
love.graphics.setFont(FONT_STANDARD)
if s.icons then
for k, icon in pairs(s.icons) do
if icon.shadow then
love.graphics.setColor(0,0,0,150)
love.graphics.draw(icon.img, x+icon.x-3, y+icon.y+7)
love.graphics.setColor(255,255,255,255)
end
love.graphics.draw(icon.img, x+icon.x, y+icon.y)
end
end
love.graphics.printf(s.text, x+96, y+37, s.bg:getWidth()-110, "left")
end
end
end
end
local displayStatusX = 0
local displayStatusY = 0
local displayStatusBoxWidth = 10
function statistics.displayStatus()
if not statBoxStatus then return end
local alpha = 1
if hideAIStatistics then
alpha = .1
end
for i = 1, #aiStats do
if aiStats[i].name ~= "" and train.getTrainImage(i) then -- if the ai has already been loaded and named
x = displayStatusX + (i-1)*displayStatusBoxWidth
love.graphics.setColor(aiStats[i].red,aiStats[i].green,aiStats[i].blue,255*alpha)
love.graphics.draw(statBoxStatus, x, displayStatusY)
love.graphics.setColor(0,0,0,100*alpha)
love.graphics.draw(train.getTrainImage(i), x + 30, displayStatusY + 59) -- shadow of train
love.graphics.setColor(255,255,255,255*alpha)
love.graphics.setFont(FONT_STAT_HEADING)
love.graphics.printf(aiStats[i].name, x, displayStatusY + 7, displayStatusBoxWidth, "center")
love.graphics.setFont(FONT_STAT_MSGBOX)
love.graphics.printf("( " .. LNG.by .. " " .. aiStats[i].owner .. " )", x, displayStatusY + 30, displayStatusBoxWidth, "center")
love.graphics.draw(train.getTrainImage(i), x + 34 , displayStatusY + 55)
love.graphics.print(aiStats[i].numTrains, x + 84 , displayStatusY + 65)
love.graphics.draw(IMAGE_STATS_DROPOFF, x + 24 , displayStatusY + 108)
love.graphics.print(aiStats[i].pTransported, x + 84 , displayStatusY + 110)
end
end
love.graphics.setColor(255,255,255,255)
love.graphics.setFont(FONT_STAT_MSGBOX)
if tutorial and tutorial.roundStats then -- let the tutorial draw the status display
tutorial.roundStats()
elseif challenges.isRunning() then
challenges.roundStats()
else
x = love.graphics.getWidth()-roundStats:getWidth()-20
y = 20
love.graphics.draw(roundStats, x, y)
if GAME_TYPE == GAME_TYPE_TIME then
if not roundEnded then
if curMap then
t = makeTimeReadable(ROUND_TIME - curMap.time)
elseif simulationMap then
t = makeTimeReadable(ROUND_TIME - simulationMap.time)
end
love.graphics.print(LNG.round_ends, x + roundStats:getWidth()/2 - FONT_STAT_MSGBOX:getWidth(LNG.round_ends)/2, y+10)
love.graphics.print(t, x + roundStats:getWidth()/2 - FONT_STAT_MSGBOX:getWidth(t)/2, y+30)
else
love.graphics.print(LNG.end_of_match, x + roundStats:getWidth()/2 - FONT_STAT_MSGBOX:getWidth(LNG.end_of_match)/2, y+10)
end
elseif GAME_TYPE == GAME_TYPE_MAX_PASSENGERS then
if not roundEnded then
t = LNG.transported1 .. numPassengersDroppedOff .. LNG.transported2 .. MAX_NUM_PASSENGERS .. LNG.transported3
love.graphics.print(LNG.transported, x + roundStats:getWidth()/2 - FONT_STAT_MSGBOX:getWidth(LNG.transported)/2, y+10)
love.graphics.print(t, x + roundStats:getWidth()/2 - FONT_STAT_MSGBOX:getWidth(t)/2, y+30)
else
love.graphics.print(LNG.end_of_match, x + roundStats:getWidth()/2 - FONT_STAT_MSGBOX:getWidth(LNG.end_of_match)/2, y+10)
end
end
end
end
function statistics.getAIColor(i)
if aiStats[i] then
return aiStats[i].red,aiStats[i].green,aiStats[i].blue
end
end
local rememberAIs, rememberMinimumMoney
function statistics.start( ais, minimumMoney )
if not ais then ais = rememberAIs end
if not minimumMoney then minimumMoney = rememberMinimumMoney end
rememberAIs = ais
rememberMinimumMoney = minimumMoney
aiStats = {}
passengerStats = {}
for i = 1,ais do
aiStats[i] = {}
aiStats[i].money = minimumMoney or STARTUP_MONEY
aiStats[i].moneyEarnedTotal = 0
aiStats[i].pPickedUp = 0 -- number of passengers which were picked up
aiStats[i].pDroppedOff = 0 -- number of passengers dropped off
aiStats[i].pTransported = 0 -- only set if the player has transported the passenger to his/her destination
aiStats[i].pWronglyDropped = 0
aiStats[i].trains = {}
aiStats[i].name = ""
aiStats[i].owner = ""
aiStats[i].pNormal = 0
aiStats[i].pVIP = 0
aiStats[i].numTrains = 0
aiStats[i].red = 255 -- default colour
aiStats[i].green = 255
aiStats[i].blue = 255
if CL_CHART_DIRECTORY then
aiStats[i].chartPassengers = {}
aiStats[i].chartPassengers[1] = {x=0,y=0}
aiStats[i].chartTrains = {}
aiStats[i].chartTrains[1] = {x=0,y=0}
end
end
if not DEDICATED then
displayStatusBoxWidth = statBoxStatus:getWidth()
displayStatusX = love.graphics.getWidth()/2 - #aiStats/2*displayStatusBoxWidth
displayStatusY = love.graphics.getHeight() - statBoxStatus:getHeight() - 50
end
end
function statistics.init(maxNumThreads)
statBoxNegative = love.graphics.newImage( "Images/statBoxNegative.png" )
statBoxStatus = love.graphics.newImage( "Images/statBoxStatus.png" )
roundStats = love.graphics.newImage( "Images/roundStats.png" )
statBoxPositive = love.graphics.newImage( "Images/statBoxPositive.png" )
end
return statistics
|
local mt = {} -- metatable for complex numbers
mt.__add = function(x, y)
return {
a = x.a + y.a,
b = x.b + y.b
}
end
mt.__sub = function(x, y)
return {
a = x.a - y.a,
b = x.b - y.b
}
end
mt.__mul = function(x, y)
return {
a = x.a * y.a - x.b * y.b,
b = x.b * y.a + x.a * y.b
}
end
mt.__eq = function(x, y)
return x.a == y.a and x.b == y.b
end
mt.__tostring = function(x)
return "(" .. x.a .. " + " .. x.b + "i)"
end
function newComplex(a, b)
t = {a = a, b = b}
setmetatable(t, mt)
return t
end
local function assert(arg)
if not arg then fail() end
end
local c1 = newComplex(3, 5)
local c2 = newComplex(3, 5)
local c3 = newComplex(4, 1)
local c4 = c2 + c3
assert(c1 == c2 and c2 ~= c3)
assert(c4.a == 7 and c4.b == 6)
|
local function _lshift(a, i)
return math.floor(a * 2^i)
end
local function _rshift(a, i)
return math.floor(a / 2^i)
end
local function _band(a, b)
local r = 0
for i = 0, 31 do
if _rshift(a, 31 - i) % 0x2 == 1 and _rshift(b, 31 - i) % 0x2 == 1 then
r = r * 2 + 1
else
r = r * 2
end
end
return r
end
local function _bor(a, b)
local r = 0
for i = 0, 31 do
if _rshift(a, 31 - i) % 0x2 == 1 or _rshift(b, 31 - i) % 0x2 == 1 then
r = r * 2 + 1
else
r = r * 2
end
end
return r
end
local function _bxor(a, b)
local r = 0
for i = 0, 31 do
if _rshift(a, 31 - i) % 0x2 ~= _rshift(b, 31 - i) % 0x2 then
r = r * 2 + 1
else
r = r * 2
end
end
return r
end
local function _bnot(a)
local r = 0
for i = 0, 31 do
if _rshift(a, 31 - i) % 0x2 == 0x0 then
r = r * 2 + 1
else
r = r * 2
end
end
return r
end
local function get_parts_as_number(str)
local t = {}
for part in string.gmatch(str, "%d+") do
table.insert(t, tonumber(part, 10))
end
return t
end
-- ipstr: a.b.c.d
local function ipstr2int(ipstr)
local ip = get_parts_as_number(ipstr)
if #ip == 4 then
return (((ip[1] * 0x100 + ip[2]) * 0x100 + ip[3]) * 0x100 + ip[4])
end
return 0
end
local function int2ipstr(x)
local a = _rshift(x, 24) % 0x100
local b = _rshift(x, 16) % 0x100
local c = _rshift(x, 8) % 0x100
local d = _rshift(x, 0) % 0x100
return string.format("%u.%u.%u.%u", a, b, c, d)
end
-- cidr: n
local function cidr2int(cidr)
if cidr == 0 then return 0 end
local x = 0
for i = 0, cidr - 1 do
x = x + _lshift(1, 31 - i)
end
return x
end
local function int2cidr(x)
for i = 0, 31 do
if _band(x, _lshift(1, 31 - i)) == 0 then
return i
end
end
return 32
end
local function cidr2maskstr(cidr)
return int2ipstr(cidr2int(cidr))
end
local function maskstr2cidr(maskstr)
return int2cidr(ipstr2int(maskstr))
end
-- ipaddr: a.b.c.d, a.b.c.d/cidr
-- return ip_int, mask_int
local function get_ip_and_mask(ipaddr)
local n = get_parts_as_number(ipaddr)
return (((n[1] * 256 + n[2]) * 256 + n[3]) * 256 + n[4]), cidr2int(n[5] or 32)
end
-- return ip_str, mask_str
local function get_ipstr_and_maskstr(ipaddr)
local ip, mask = get_ip_and_mask(ipaddr)
return int2ipstr(ip), int2ipstr(mask)
end
-- netString: ipaddr, a.b.c.d-e.f.g.h, a.b.c.d/m1.m2.m3.m4
-- return: range: [n1, n2] where n1 <= n2
local function netString2range(netString)
ip = get_parts_as_number(netString)
if #ip == 4 then
local i = (((ip[1] * 256 + ip[2]) * 256 + ip[3]) * 256 + ip[4])
return {i, i}
end
if #ip == 5 and ip[5] >= 0 and ip[5] <= 32 then
local i = (((ip[1] * 256 + ip[2]) * 256 + ip[3]) * 256 + ip[4])
local m = cidr2int(ip[5])
local s = _band(i, m)
local e = _bor(i, _bnot(m))
return {s, e}
end
if #ip == 8 then
local i = (((ip[1] * 256 + ip[2]) * 256 + ip[3]) * 256 + ip[4])
local m = (((ip[5] * 256 + ip[6]) * 256 + ip[7]) * 256 + ip[8])
if netString:match('/') then
local s = _band(i, m)
local e = _bor(s, _bnot(m))
if s <= e then
return {s, e}
end
else
if i <= m then
return {i, m}
end
end
end
return nil
end
local function range2netString(range)
if range[1] <= range[2] then
return int2ipstr(range[1]) .. "-" .. int2ipstr(range[2])
end
return nil
end
-- rangeSet: [range, ...]
local function rangeSet_add_range(rangeSet, range)
rangeSet = rangeSet or {}
if not range then
return rangeSet
end
if #rangeSet == 0 then
table.insert(rangeSet, range)
return rangeSet
end
local rangeSet_new = {}
for _, r in ipairs(rangeSet) do
if range[1] < r[1] then
if range[2] < r[1] then
if range[2] + 1 < r[1] then
table.insert(rangeSet_new, range)
range = r
else -- range[2] == r[1]
range = {range[1], r[2]}
end
elseif range[2] <= r[2] then
range = {range[1], r[2]}
end
elseif range[1] <= r[2] then
if range[2] <= r[2] then
range = {r[1], r[2]}
elseif range[2] > r[2] then
range = {r[1], range[2]}
end
elseif range[1] == r[2] + 1 then
range = {r[1], range[2]}
else -- range[1] > r[2] + 1
table.insert(rangeSet_new, r)
end
end
table.insert(rangeSet_new, range)
return rangeSet_new
end
local function rangeSet_del_range(rangeSet, range)
rangeSet = rangeSet or {}
if not range then
return rangeSet
end
if #rangeSet == 0 then
return rangeSet
end
local rangeSet_new = {}
for _, r in ipairs(rangeSet) do
if r[2] < range[1] then
table.insert(rangeSet_new, r)
else --r[2] >= range[1]
if r[1] < range[1] then
table.insert(rangeSet_new, {r[1], range[1] - 1})
--else --r[1] >= range[1]
end
if r[2] > range[2] then
if r[1] > range[2] then
table.insert(rangeSet_new, r)
else --r[1] <= range[2]
table.insert(rangeSet_new, {range[2] + 1, r[2]})
end
--else --r[2] == range[2]
end
end
end
return rangeSet_new
end
local function rangeSet_sub_rangeSet(rangeSetA, rangeSetB)
rangeSetA = rangeSetA or {}
if #rangeSetA == 0 then
return rangeSetA
end
for _, range in ipairs(rangeSetB) do
rangeSetA = rangeSet_del_range(rangeSetA, range)
end
return rangeSetA
end
-- netStringSet: [netString, ...]
local function netStringSet2rangeSet(netStringSet)
local rangeSet = {}
for _, netString in ipairs(netStringSet) do
rangeSet = rangeSet_add_range(rangeSet, netString2range(netString))
end
return rangeSet
end
local function rangeSet2netStringSet(rangeSet)
local netStringSet = {}
for _, range in ipairs(rangeSet) do
table.insert(netStringSet, string.format("%s-%s", int2ipstr(range[1]), int2ipstr(range[2])))
end
return netStringSet
end
--ipcidr: a.b.c.d/cidr
--ipcidrSet: [ipcidr, ...], yes it is a netStringSet
local function rangeSet2ipcidrSet(rangeSet)
local ipcidrSet = {}
for _, range in ipairs(rangeSet) do
while range[1] <= range[2] do
for cidr = 0, 32 do
local m = cidr2int(cidr)
local s = _band(range[1], m)
local e = _bor(s, _bnot(m))
if s == range[1] and e <= range[2] then
table.insert(ipcidrSet, int2ipstr(s) .. '/' .. cidr)
range[1] = e + 1
break
end
end
end
end
return ipcidrSet
end
--[[DEBUG]]
--[[
local netStringSet = {
"1.1.1.1-2.2.2.2",
"192.168.0.0/16",
"192.168.0.1-192.168.0.2",
"192.168.255.254-192.169.0.100",
"172.16.0.1-172.16.0.100",
"172.168.0.0/255.255.0.0",
"192.168.11.6/24",
"192.168.0.1-192.168.0.22",
"192.168.0.33-192.168.0.52",
}
print("dump netStringSet")
for _, netString in ipairs(netStringSet) do
print(netString, range2netString(netString2range(netString)))
end
print("netStringSet to rangeSet")
local rangeSet = netStringSet2rangeSet(netStringSet)
for _, r in ipairs(rangeSet) do
print(r[1], r[2])
end
print("rangeSet to netStringSet")
netStringSet = rangeSet2netStringSet(rangeSet)
for _, netString in ipairs(netStringSet) do
print(netString)
end
print("rangeSet to ipcidrSet")
local ipcidrSet = rangeSet2ipcidrSet(rangeSet)
for _, ipcidr in ipairs(ipcidrSet) do
print(ipcidr)
end
print("ipcidrSet to rangeSet")
rangeSet = netStringSet2rangeSet(ipcidrSet)
for _, r in ipairs(rangeSet) do
print(r[1], r[2])
end
print("rangeSet to netStringSet")
netStringSet = rangeSet2netStringSet(rangeSet)
for _, netString in ipairs(netStringSet) do
print(netString)
end
print("get_ipstr_and_maskstr")
local ip, mask = get_ipstr_and_maskstr("1.2.3.4")
print(ip, mask)
]]
local __func__ = {
ipstr2int = ipstr2int,
int2ipstr = int2ipstr,
cidr2int = cidr2int,
int2cidr = int2cidr,
cidr2maskstr = cidr2maskstr,
maskstr2cidr = maskstr2cidr,
get_ip_and_mask = get_ip_and_mask,
get_ipstr_and_maskstr = get_ipstr_and_maskstr,
lshift = _lshift,
rshift = _rshift,
b32and = _band,
b32or = _bor,
b32xor = _bxor,
b32not = _bnot,
netString2range = netString2range,
netStringSet2rangeSet = netStringSet2rangeSet,
range2netString = range2netString,
rangeSet2netStringSet = rangeSet2netStringSet,
rangeSet2ipcidrSet = rangeSet2ipcidrSet,
rangeSet_add_range = rangeSet_add_range,
rangeSet_del_range = rangeSet_del_range,
rangeSet_sub_rangeSet = rangeSet_sub_rangeSet,
}
-- api for test_func
-- argv = [ "netString,netString" ]
-- return: exit code
-- eg: lua ipops.lua netStrings2ipcidrStrings "1.2.3.4,192.168.1.0/24,192.168.100.100-192.168.200.222"
local function netStrings2ipcidrStrings(argv)
local rangeSet = {}
local netString
local netStrings = argv[1]
if not netStrings then
return -1
end
for netString in netStrings:gmatch("[^,]+") do
rangeSet = rangeSet_add_range(rangeSet, netString2range(netString))
end
local ipcidrSet = rangeSet2ipcidrSet(rangeSet)
print(table.concat(ipcidrSet, ','))
return 0
end
-- eg: lua ipops.lua netStrings_sub_netStrings "0.0.0.0/0" "1.2.3.4,192.168.1.0/24,192.168.100.100-192.168.200.222"
local function netStrings_sub_netStrings(argv)
local netString
local rangeSetA = {}
local rangeSetB = {}
local netStringsA, netStringsB = argv[1], argv[2]
if not netStringsA or not netStringsB then
return -1
end
for netString in netStringsA:gmatch("[^,]+") do
rangeSetA = rangeSet_add_range(rangeSetA, netString2range(netString))
end
for netString in netStringsB:gmatch("[^,]+") do
rangeSetB = rangeSet_add_range(rangeSetB, netString2range(netString))
end
rangeSetA = rangeSet_sub_rangeSet(rangeSetA, rangeSetB)
local ipcidrSet = rangeSet2ipcidrSet(rangeSetA)
print(table.concat(ipcidrSet, ','))
return 0
end
local test_func = {
netStrings2ipcidrStrings = {
argc = 1,
func = netStrings2ipcidrStrings
},
netStrings_sub_netStrings = {
argc = 2,
func = netStrings_sub_netStrings
}
}
function test_main(...)
if arg[1] and test_func[arg[1]] and test_func[arg[1]].func then
local argc = test_func[arg[1]].argc or 0
local func = test_func[arg[1]].func
local argv = {}
if argc > 0 then
for i = 1, argc do
table.insert(argv, arg[1 + i])
end
end
return true, func(argv)
end
return false
end
local test, ret = test_main(...)
if test then
os.exit(ret)
end
return __func__
|
local ChangeBgScreen = Class("ChangeBgScreen")
dir = love.filesystem.getSource()
str = dir.."/res/bg/"
str1 = dir.."/res/bg/xiao/"
function ChangeBgScreen:init(game,bg)
self.game = game
self.bg = bg
self.winWidth = love.graphics.getWidth()
self.dir = "res/bg/xiao"
self.files = love.filesystem.getDirectoryItems(self.dir)
self.back = love.graphics.newImage("res/back.png")
self.imgs = {}
table.insert(self.imgs,love.graphics.newImage("res/xiangji.png"))
for k, file in ipairs(self.files) do
img = love.graphics.newImage(self.dir.."/"..file)
table.insert(self.imgs,img)
end
end
function ChangeBgScreen:draw()
self:useTTFFont("更换背景",self.winWidth/2-70,90,36)
local j = 0
for i=1,#self.imgs do
if i%6==0 then
j = j + 1
end
love.graphics.draw(self.imgs[i],150+120*((i%6)+1),200+120*j)
end
love.graphics.draw(self.back,20,20)
end
function ChangeBgScreen:getRandomNum(x,y)
math.randomseed(tostring(os.time()):reverse():sub(1, 7))
return math.random(x,y)
end
function ChangeBgScreen:update(dt)
end
function ChangeBgScreen:keypressed(key)
end
function ChangeBgScreen:mousepressed(x,y,button,istouch)
local j = 0
for i = 1,#self.imgs do
if i%6==0 then
j = j + 1
end
if x > 150+120*((i%6)+1) and x < 250+120*((i%6)+1) and y > 200+120*j and y < 300+120*j then
if i == 1 then
str = str.."bg"..tostring(#self.imgs-1)..".png"
str1 = str1.."bg"..tostring(#self.imgs-1)..".png"
myLualib.openCamera()
self.files = love.filesystem.getDirectoryItems(self.dir)
table.insert(self.imgs,love.graphics.newImage(self.dir.."/bg"..tostring(#self.imgs-1)..".png"))
elseif i == 2 then
self.bg:setBg("bg.png")
elseif i <= #self.imgs then
self.bg:setBg("bg"..tostring(i-2)..".png")
end
end
end
if x > 20 and x < 70 and y > 20 and y < 70 then
self.game.state = "home"
end
if x > 70 and x < 170 and y > 120 and y < 170 then
myLualib.takePohot()
end
end
function ChangeBgScreen:touchmoved( id, x, y, dx, dy, pressure )
end
function ChangeBgScreen:touchpressed( id, x, y, dx, dy, pressure )
if x > 20 and x < 70 and y > 20 and y < 70 then
self.game.state = "home"
end
end
local isInit=true
function ChangeBgScreen:useTTFFont(text,x,y,size)
if isInit then
local font=love.graphics.newFont("font/cn.ttf",size)
love.graphics.setFont(font)
isInit = false
end
love.graphics.print(text,x,y)
end
return ChangeBgScreen
|
--[[
BY : LuffyTEAM
Channel Files : https://t.me/lllEll2
]]
local function keko_Luffy(data)
local msg = data.message_
redis = (loadfile "./libs/redis.lua")()
database = Redis.connect('127.0.0.1', 6379)
sudos = dofile('sudo.lua')
JSON = (loadfile "./libs/dkjson.lua")()
bot_id_keko = {string.match(token, "^(%d+)(:)(.*)")}
bot_id = tonumber(bot_id_keko[1])
local function openChat(chat_id,dl_cb)
tdcli_function ({
ID = "GetChat",
chat_id_ = chat_id
}, dl_cb, nil)
end
function getUser(user_id, cb)
tdcli_function ({
ID = "GetUser",
user_id_ = user_id
}, cb, nil)
end
function is_creator(msg)
user_id = msg.sender_user_id_
chat_id = msg.chat_id_
local var = false
local creator = database:sismember('Luffy:'..bot_id..'creator:'..chat_id, user_id)
local admin = database:sismember('Luffy:'..bot_id..'admins:', user_id)
if creator then var = true end
if admin then var = true end
for k,v in pairs(sudo_users) do
if user_id == v then var = true end end
local keko_add_sudo = redis:get('Luffy:'..bot_id..'sudoo'..user_id..'')
if keko_add_sudo then var = true end
return var
end
local function getMessage(chat_id, message_id,cb)
tdcli_function ({
ID = "GetMessage",
chat_id_ = chat_id,
message_id_ = message_id
}, cb, nil)
end
function getChatId(id)
local chat = {}
local id = tostring(id)
if id:match('^-100') then
local channel_id = id:gsub('-100', '')
chat = {ID = channel_id, type = 'channel'}
else
local group_id = id:gsub('-', '')
chat = {ID = group_id, type = 'group'}
end
return chat
end
local function send(chat_id, reply_to_message_id, disable_notification, text, disable_web_page_preview, parse_mode)
local TextParseMode = {ID = "TextParseModeMarkdown"}
tdcli_function ({
ID = "SendMessage",
chat_id_ = chat_id,
reply_to_message_id_ = reply_to_message_id,
disable_notification_ = disable_notification,
from_background_ = 1,
reply_markup_ = nil,
input_message_content_ = {
ID = "InputMessageText",
text_ = text,
disable_web_page_preview_ = disable_web_page_preview,
clear_draft_ = 0,
entities_ = {},
parse_mode_ = TextParseMode,
},
}, dl_cb, nil)
end
function resolve_username(username,cb)
tdcli_function ({
ID = "SearchPublicChat",
username_ = username
}, cb, nil)
end
local msg = data.message_
text = msg.content_.text_
if not database:get("Luffy:get:hms:gr:"..bot_id..msg.chat_id_) then
if text and text:match("^اهمس (.*) (.*)") then
text = text:gsub('@',"")
keko_ts = {string.match(text, "اهمس (.*) (.*)")}
function cb_Luffy(t1,t2)
if not t2.id_ then
send(msg.chat_id_, msg.id_, 1, "👤┇لا يوجد هاكذا معرف", 1, 'html')
return "keko"
end
function Luffy_jd(y1,y2)
if (y2 and ((y2.status_ and y2.status_.ID == "ChatMemberStatusLeft") or y2.ID == "Error")) then
send(msg.chat_id_, msg.id_, 1, "👤┇المستخدم ليس في المجموعه", 1, 'html')
return "keko"
end
tdcli_function ({
ID="DeleteMessages",
chat_id_= msg.chat_id_,
message_ids_= {[0] = msg.id_}
},
dl_cb, nil)
database:set("Luffy:get:hms:msg:"..bot_id..msg.chat_id_..msg.id_..t2.id_,keko_ts[1])
function bot_id_get(t11,t22)
bot_username = (t22.username_ or "Luffybot")
function kekko(u1,u2)
local id_send = msg.sender_user_id_
if u2.username_ then
id_send = "@"..u2.username_
end
send(msg.chat_id_, msg.id_, 1, "🔘┇عزيزي ( @["..keko_ts[2].."] )\n📩┇هناك همسه لك من قبل ( ["..id_send.."] )\n📃┇[اضغط هنا لعرض الهمسه](https://t.me/"..bot_username.."?start=hms"..msg.chat_id_..msg.id_.."_"..t2.id_..").", 1, 'html')
end
getUser(msg.sender_user_id_, kekko)
end
getUser(bot_id, bot_id_get)
end
tdcli_function ({
ID = "GetChatMember",
chat_id_ = msg.chat_id_,
user_id_ = t2.id_
}, Luffy_jd, nil)
end
resolve_username(keko_ts[2],cb_Luffy)
end
end
if text and text == "اهمس" then
send(msg.chat_id_, msg.id_, 1, "🏮┇يمكنك عمل همسه\n\n🕹┇اهمس الرساله معرف الشخص\n📥┇مثال : اهمس مرحبا @ikeko ", 1, 'html')
end
if text and text:match("/start hms(.*)_(%d+)") then
keko_ts = {string.match(text, "^/start hms(.*)_(%d+)")}
if tonumber(msg.sender_user_id_) == tonumber(keko_ts[2]) then
kekol = database:get("Luffy:get:hms:msg:"..bot_id..keko_ts[1]..keko_ts[2])
if kekol then
send(msg.chat_id_, msg.id_, 1, "📥┇الهمسه هيه : ["..kekol.."]", 1, 'html')
else
send(msg.chat_id_, msg.id_, 1, "🏮┇ الهمسه ليست لك", 1, 'html')
end
else
send(msg.chat_id_, msg.id_, 1, "🏮┇ الهمسه ليست لك", 1, 'html')
end
end
if is_creator(msg) then
if text and text == "تعطيل اهمس" then
database:set("Luffy:get:hms:gr:"..bot_id..msg.chat_id_,"Luffy")
send(msg.chat_id_, msg.id_, 1, "🔘┇ تم تعطيل اهمس", 1, 'html')
end
if text and text == "تفعيل اهمس" then
database:del("Luffy:get:hms:gr:"..bot_id..msg.chat_id_)
send(msg.chat_id_, msg.id_, 1, "☑️┇ تم تفعيل اهمس ", 1, 'html')
end
end
end
return {
keko_Luffy = keko_Luffy,
}
--[[
BY : LuffyTEAM
Channel Files : https://t.me/lllEll2
]]
|
--ウィッチクラフト・コンフュージョン
--
--Script by Trishula9
function c100285006.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,100285006)
e1:SetTarget(c100285006.target)
e1:SetOperation(c100285006.activate)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,100285006)
e2:SetCondition(c100285006.thcon)
e2:SetTarget(c100285006.thtg)
e2:SetOperation(c100285006.thop)
c:RegisterEffect(e2)
end
function c100285006.filter1(c,e)
return not c:IsImmuneToEffect(e)
end
function c100285006.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c100285006.fcheck(tp,sg,fc)
return sg:IsExists(Card.IsSetCard,1,nil,0x128)
end
function c100285006.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp)
aux.FCheckAdditional=c100285006.fcheck
local res=Duel.IsExistingMatchingCard(c100285006.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
aux.FCheckAdditional=nil
if not res then
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c100285006.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end
end
return res
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c100285006.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp
local mg1=Duel.GetFusionMaterial(tp):Filter(c100285006.filter1,nil,e)
aux.FCheckAdditional=c100285006.fcheck
local sg1=Duel.GetMatchingGroup(c100285006.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
aux.FCheckAdditional=nil
local mg2=nil
local sg2=nil
local ce=Duel.GetChainMaterial(tp)
if ce~=nil then
local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp)
local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c100285006.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
aux.FCheckAdditional=c100285006.fcheck
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
aux.FCheckAdditional=nil
tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2)
end
tc:CompleteProcedure()
end
end
function c100285006.rccfilter(c)
return c:IsFaceup() and c:IsSetCard(0x128)
end
function c100285006.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
and Duel.IsExistingMatchingCard(c100285006.rccfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c100285006.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function c100285006.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
|
local wibox = require ('wibox')
local beautiful = require ('beautiful')
local dpi = beautiful.xresources.apply_dpi
local l = wibox.layout.stack()
local content_views = require ('widget.settings.content_view')
for key,content in ipairs(content_views) do
content.widget.visible = (key == 1)
-- Every widget
awesome.connect_signal('settings::content_view::show', function(view)
content.widget.visible = (content.view == view)
end)
l:add ({
content.widget,
margins = dpi(25),
widget = wibox.container.margin
})
end
return l
|
--[[
KnownPaths.lua
This segment deals with who knows what flight path.
]]
-- Function: Record that the player knows this flight master.
function EFM_KP_AddLocation(myContinent, myNode)
if (EFM_KnownNodes == nil) then
EFM_KnownNodes = {};
end
if (EFM_KnownNodes[myContinent] == nil) then
EFM_KnownNodes[myContinent] = {};
end
if (not EFM_KP_CheckPaths(myContinent, myNode)) then
table.insert(EFM_KnownNodes[myContinent], myNode);
end
end
-- Function: Check if player knows the flight path, return true if known, false otherwise.
function EFM_KP_CheckPaths(myContinent, myNode)
if (EFM_KnownNodes ~= nil) then
if (EFM_KnownNodes[myContinent] ~= nil) then
for key, val in pairs(EFM_KnownNodes[myContinent]) do
if (val == myNode) then
return true;
end
end
end
end
return false;
end
|
--[[remove
__STANDARD_WEBSERVER_LOG_FILE_APPENDER__ - ../logs/rms-webserver
__STANDARD_WHITELIST_FILE__ - ../config/whitelist.txt
__STANDARD_BLACKLIST_FILE__ - ../config/blacklist.txt
__STANDARD_SERVERKEY_FILE__ - ../config/server.key
__STANDARD_SERVERCERT_FILE__ - ../config/server.cert
__STANDARD_WEBROOT_FOLDER__ - ../rms-webroot
remove]]--
configuration=
{
logAppenders=
{
{
name="console appender",
type="coloredConsole",
level=6
},
{
name="file appender",
type="delayedFile",
level=6,
fileName="__STANDARD_WEBSERVER_LOG_FILE_APPENDER__",
newLineCharacters="\n",
fileHistorySize=100,
fileLength=1024*1024,
singleLine=true
},
},
applications=
{
rootDirectory="./",
{
name="webserver",
description="Built-In Web Server",
port=8888,
rmsPort=1113, --should match config.lua's inboundBinVariant acceptor
bindToIP="",
sslMode="disabled", -- always, auto, disabled
maxMemSizePerConnection=32*1024, --32*1024,
maxConcurrentConnections=5000,
connectionTimeout=0, -- 0 - no timeout
maxConcurrentConnectionsSameIP=1000,
threadPoolSize=8,
useIPV6=false,
enableIPFilter=false, --if true, reads white and black lists
whitelistFile="__STANDARD_WHITELIST_FILE__",
blacklistFile="__STANDARD_BLACKLIST_FILE__",
sslKeyFile="__STANDARD_SERVERKEY_FILE__",
sslCertFile="__STANDARD_SERVERCERT_FILE__",
enableCache=false,
cacheSize=1*1024*1024*1024, --1GB
hasGroupNameAliases=false,
webRootFolder="__STANDARD_WEBROOT_FOLDER__",
enableRangeRequests=true,
mediaFileDownloadTimeout=30,
supportedMimeTypes=
{
-- non-streaming
{
extensions="mp4,mp4v,mpg4",
mimeType="video/mp4",
streamType="",
isManifest=false,
},
{
extensions="flv",
mimeType="video/x-flv",
streamType="",
isManifest=false,
},
-- streaming
{
extensions="m3u,m3u8",
mimeType="audio/x-mpegurl",
streamType="hls",
isManifest=true,
},
{
extensions="ts",
mimeType="video/mp2t",
streamType="hls",
isManifest=false,
},
{
extensions="aac",
mimeType="audio/aac",
streamType="hls",
isManifest=false,
},
{
extensions="f4m",
mimeType="application/f4m+xml",
streamType="hds",
isManifest=true,
},
{
extensions="ismc,isma,ismv",
mimeType="application/octet-stream",
streamType="mss",
isManifest=true,
},
{
extensions="fmp4",
mimeType="video/mp4",
streamType="mss",
isManifest=false,
},
{
extensions="mpd",
mimeType="application/dash+xml",
streamType="dash",
isManifest=true,
},
{
extensions="m4s",
mimeType="video/mp4",
streamType="dash",
isManifest=false,
},
{ -- needed for supporting adobe player's crossdomain.xml
extensions="xml",
mimeType="application/xml",
streamType="",
isManifest=false,
},
},
--[[
includeResponseHeaders=
{
{
header="Access-Control-Allow-Origin",
content="*",
override=true,
},
{
header="User-Agent",
content="RDKC",
override=false,
},
},
]]--
--[[
apiProxy=
{
authentication="basic", -- none, basic
pseudoDomain="<domain>",
address="127.0.0.1",
port=7777,
userName="<username>",
password="<password>",
},
]]--
--[[
auth=
{
{
domain="RMS_Web_UI", --the domain folder
digestFile="../rms-webroot/RMS_Web_UI/settings/passwords/.htdigest", --relative path to digest file
enable=false,
},
},
]]--
},
}
}
|
local pickupobjective =
{
Properties =
{
EventName = { default = "ObjectivePickupEvent", description = "The name of the event to broadcast." },
ObjectiveID = { default = -1, description = "The ID of the objective (sent as past of the event when picked up)." },
ShowMarkerMessage = { default = "ShowMarkerEvent", description = "The message to send to \"self\" to control its map marker." },
SetStatusMessage = { default = "SetStatusEvent", description = "The message to send to \"self\" to control its on screen tracking." },
GraphicEntity = {default = EntityId(), description = "The entity used fo the graphical description of the pickup."},
GraphicTurnTime = { default = 3, description = "Time to rotate a full rotation" },
GraphicBobTime = { default = 1, description = "Time to rotate a full bob." },
GraphicBobDist = { default = 0.5, description = "Distacne that the bob moves." },
CollectionSound = { default = "Play_HUD_press_start", description = "Sound to play on collection" },
},
}
function pickupobjective:OnActivate()
-- Make sure the objective has a valid objective ID.
Debug.Assert(self.Properties.ObjectiveID >= 0);
self.triggerAreaHandler = TriggerAreaNotificationBus.Connect(self, self.entityId);
self.tickBusHandler = TickBus.Connect(self);
self.rotateTimer = 0;
self.bobTimer = 0;
self.audioCollectionSound = self.Properties.CollectionSound;
end
function pickupobjective:OnDeactivate()
if(not self.tickBusHandler == nil) then
self.tickBusHandler:Disconnect();
self.tickBusHandler = nil;
end
if(not self.triggerAreaHandler == nil) then
self.triggerAreaHandler:Disconnect();
self.triggerAreaHandler = nil;
end
end
function pickupobjective:OnTick(deltaTime, timePoint)
local twoPi = 6.283185307179586476925286766559;
if(not (self.Properties.GraphicTurnTime == 0)) then
self.rotateTimer = self.rotateTimer + (deltaTime / self.Properties.GraphicTurnTime);
if(self.rotateTimer >= twoPi) then
self.rotateTimer = self.rotateTimer - twoPi;
end
end
if((not (self.Properties.GraphicTurnTime == 0)) and (not (self.Properties.GraphicBobDist == 0))) then
self.bobTimer = self.bobTimer + (deltaTime / self.Properties.GraphicBobTime);
if(self.bobTimer >= twoPi) then
self.bobTimer = self.bobTimer - twoPi;
end
end
--Debug.Log("Pickup graphic values: Rotation: " .. self.rotateTimer .. " Height: " .. self.bobTimer);
local tm = Transform.CreateRotationZ(self.rotateTimer);
tm:SetTranslation(Vector3(0, 0, Math.Sin(self.bobTimer) * self.Properties.GraphicBobDist));
TransformBus.Event.SetLocalTM(self.Properties.GraphicEntity, tm);
end
function pickupobjective:OnTriggerAreaEntered(enteringEntityId)
--Debug.Log("Picked up objective " .. tostring(self.Properties.ObjectiveID) .. ": sending " .. self.Properties.EventName);
AudioTriggerComponentRequestBus.Event.ExecuteTrigger(self.entityId, self.audioCollectionSound);
-- Send a message to whatever picked us up that they picked up an objective.
local notificationId = GameplayNotificationId(enteringEntityId, self.Properties.EventName, "float");
GameplayNotificationBus.Event.OnEventBegin(notificationId, self.Properties.ObjectiveID);
local markernotificationId = GameplayNotificationId(self.entityId, self.Properties.ShowMarkerMessage, "float");
GameplayNotificationBus.Event.OnEventBegin(markernotificationId, 0);
local statusnotificationId = GameplayNotificationId(self.entityId, self.Properties.SetStatusMessage, "float");
GameplayNotificationBus.Event.OnEventBegin(statusnotificationId, 1);
if(not self.triggerAreaHandler == nil) then
self.triggerAreaHandler:Disconnect();
self.triggerAreaHandler = nil;
end
if(not self.tickBusHandler == nil) then
self.tickBusHandler:Disconnect();
self.tickBusHandler = nil;
end
-- disable the emitter particles
ParticleComponentRequestBus.Event.Enable(self.entityId, false);
-- enable the collected particles
ParticleComponentRequestBus.Event.Enable(self.Properties.GraphicEntity, true);
-- hide the graphic
MeshComponentRequestBus.Event.SetVisibility(self.Properties.GraphicEntity, false);
-- Delete the pickup so it can't be acquired again.
-- TODO: Deleting the trigger while something's in it causes the editor to crash so
-- we need to find another way of deleting the pickup. Possibly put the trigger area
-- onto a different entity so that the pickup can be deleted and the trigger area is
-- orphaned?
--GameEntityContextRequestBus.Broadcast.DestroyGameEntity(self.entityId);
end
return pickupobjective;
|
local sql = exports.sql
--------- [ Element Data returns ] ---------
local function getData( theElement, key )
local key = tostring(key)
if isElement(theElement) and (key) then
return exports['[ars]anticheat-system']:callData( theElement, tostring(key) )
else
return false
end
end
local function setData( theElement, key, value, sync )
local key = tostring(key)
if isElement(theElement) and (key) and (value) then
return exports['[ars]anticheat-system']:assignData( theElement, tostring(key), value, sync )
else
return false
end
end
--------- [ Friend System ] ---------
function getPlayerFriends( thePlayer )
if ( thePlayer ) then
local theFriends = { }
local clientFriends = tostring( getData( thePlayer, "friends") )
if ( clientFriends ~= "none" ) then
local country = tostring( exports['[ars]global']:getPlayerCountryByIP( getPlayerIP( thePlayer ), true ) )
local t = split( clientFriends, "," )
for key, value in ipairs ( t ) do
local result = sql:query_fetch_assoc("SELECT `username`, `ip`, DATEDIFF(NOW(), `lastlogin`) as `llastlogin`, `banned` FROM accounts WHERE id=".. sql:escape_string( tonumber( value ) ).."")
if ( result ) then
local username = tostring( result['username'] )
local lastlogin = tostring( result['llastlogin'] )
local banned = tonumber( result['banned'] )
local ip = tostring( result['ip'] )
local friendCountry = tostring( exports['[ars]global']:getPlayerCountryByIP( ip, true ) )
local sameCountry = "false"
if ( country == friendCountry ) then
sameCountry = "true"
end
theFriends[key] = { username, friendCountry, sameCountry, lastlogin, banned }
end
end
end
triggerClientEvent(thePlayer, "showPlayerFriendlist", thePlayer, theFriends )
end
end
addCommandHandler("friends", getPlayerFriends, false, false)
function bindShortcutKey( res )
if ( res ) then
for key, thePlayer in ipairs ( getElementsByType("player") ) do
bindKey(thePlayer, "o", "down", getPlayerFriends)
end
else
bindKey(source, "o", "down", getPlayerFriends)
end
end
addEventHandler("onPlayerJoin", root, bindShortcutKey)
addEventHandler("onResourceStart", resourceRoot, bindShortcutKey)
|
--- Turbo.lua WebSocketClient example.
--
-- Copyright 2013 John Abrahamsen
--
-- 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.
_G.TURBO_SSL = true -- SSL must be enabled for WebSocket support!
local turbo = require "turbo"
turbo.ioloop.instance():add_callback(function()
turbo.websocket.WebSocketClient("ws://127.0.0.1:8888/ws", {
on_headers = function(self, headers)
-- Review headers recieved from the WebSocket server.
-- You can e.g drop the request if the response headers
-- are not satisfactory with self:close().
end,
modify_headers = function(self, headers)
-- Modify outgoing headers before they are sent.
-- headers parameter are a instance of httputil.HTTPHeader.
end,
on_connect = function(self)
-- Called when the client has successfully opened a WebSocket
-- connection to the server.
-- When the connection is established you can write a message:
self:write_message("Hello World!")
end,
on_message = function(self, msg)
-- Print the incoming message.
print(msg)
self:close()
end,
on_close = function(self)
-- I am called when connection is closed. Both gracefully and
-- not gracefully.
end,
on_error = function(self, code, reason)
-- I am called whenever there is a error with the WebSocket.
-- code are defined in turbo.websocket.errors. reason are
-- a string representation of the same error.
end
})
end):start()
|
-- battery widget: http://awesome.naquadah.org/wiki/Closured_Battery_Widget_with_time
local io = io
local math = math
local pairs = pairs
local battery = {}
local limits = {{25, 5},
{12, 3},
{ 7, 1},
{0}}
local function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
local function get_adapters()
local adapters = {'BAT0', 'BAT1'}
local found_adapters = {}
local c = 1
for i=1, #adapters do
if file_exists("/sys/class/power_supply/"..adapters[i].."/status") then
found_adapters[c] = adapters[i]
c = c + 1
end
end
return found_adapters
end
local function get_bat_state (adapter)
local adapter_path = "/sys/class/power_supply/"..adapter
local fprefix = ""
if file_exists(adapter_path.."/energy_now") then
fprefix = "energy"
else
fprefix = "charge"
end
local fcur = io.open(adapter_path.."/"..fprefix.."_now")
local fcap = io.open(adapter_path.."/"..fprefix.."_full")
local fsta = io.open(adapter_path.."/status")
local cur = fcur:read()
local cap = fcap:read()
local sta = fsta:read()
fcur:close()
fcap:close()
fsta:close()
local battery = math.floor(cur * 100 / cap)
if sta:match("Charging") then
dir = 1
elseif sta:match("Discharging") then
dir = -1
else
dir = 0
end
return battery, dir
end
local function get_bat_time ()
local facp = io.popen("acpi -b | grep -Eo '[^ ]* (remaining|until charged)' | cut -d' ' -f1")
local acp = facp:read()
facp:close()
return acp
end
local function getnextlim (num)
for ind, pair in pairs(limits) do
lim = pair[1]; step = pair[2]; nextlim = limits[ind+1][1] or 0
if num > nextlim then
repeat
lim = lim - step
until num > lim
if lim < nextlim then
lim = nextlim
end
return lim
end
end
end
function battery.closure ()
local adapters = get_adapters()
local nextlim = limits[1][1]
return function ()
local prefix = "⚡"
local time = get_bat_time()
local batteries = ""
for i=1, #adapters do
adapter = adapters[i]
local battery, dir = get_bat_state(adapter)
if dir == -1 then
dirsign = "▼"
prefix = "🔋"..time
-- disable battery notification for now
-- if battery <= nextlim then
-- naughty.notify({title = "⚡ Beware! ⚡",
-- text = "Battery charge is low ( ⚡ "..battery.."%)!",
-- timeout = 7,
-- position = "bottom_right",
-- fg = beautiful.fg_focus,
-- bg = beautiful.bg_focus
-- })
-- nextlim = getnextlim(battery)
-- end
elseif dir == 1 then
dirsign = "▲"
nextlim = limits[1][1]
else
dirsign = ""
end
battery = battery.."%"
batteries = batteries..dirsign.." "..battery.." "
end
return prefix.." "..batteries:gsub("%s+$", '')
end
end
return battery
|
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:25' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
--------------------------------------------
--Battleground Scoreboard End Of Game Scene
--------------------------------------------
local LEAVE_BATTLEGROUND_KEYBIND_COOLDOWN_MS = 2000
local KEYBIND_BUTTON_SPACING_X = 10
ZO_Battleground_Scoreboard_End_Of_Game = ZO_Object:Subclass()
function ZO_Battleground_Scoreboard_End_Of_Game:New(...)
local scoreboard = ZO_Object.New(self)
scoreboard:Initialize(...)
return scoreboard
end
function ZO_Battleground_Scoreboard_End_Of_Game:Initialize(control)
self.control = control
self.closingTimerLabel = control:GetNamedChild("ClosingTimer")
self:InitializeKeybinds()
self:InitializePlatformStyle()
BATTLEGROUND_SCOREBOARD_END_OF_GAME_OPTIONS = ZO_HUDFadeSceneFragment:New(control)
BATTLEGROUND_SCOREBOARD_END_OF_GAME_SCENE = ZO_Scene:New("battleground_scoreboard_end_of_game", SCENE_MANAGER)
BATTLEGROUND_SCOREBOARD_END_OF_GAME_SCENE:RegisterCallback("StateChange", function(oldState, newState)
if newState == SCENE_SHOWING then
self:OnShowing()
elseif newState == SCENE_HIDING then
self:OnHiding()
end
end)
-- the loot history fragments may not exist depending on the platform
if GAMEPAD_LOOT_HISTORY_FRAGMENT then
BATTLEGROUND_SCOREBOARD_END_OF_GAME_SCENE:AddFragment(GAMEPAD_LOOT_HISTORY_FRAGMENT)
end
if KEYBOARD_LOOT_HISTORY_FRAGMENT then
BATTLEGROUND_SCOREBOARD_END_OF_GAME_SCENE:AddFragment(KEYBOARD_LOOT_HISTORY_FRAGMENT)
end
local function OnGamepadModeChanged()
self:RefreshMatchInfoFragments()
-- End game doesn't close the UI when gamepad mode switches, but it shares the same fragment is in game,
-- so only in end game do we want to make sure that the match info gets refreshed on switching fragments
BATTLEGROUND_SCOREBOARD_FRAGMENT:RefreshMatchInfoDisplay()
end
local function OnBattlegroundStateChanged(eventId, previousState, currentState)
-- prevent people from accidentally leaving the BG because they are fighting to the bitter end
if currentState == BATTLEGROUND_STATE_POSTGAME and IsInGamepadPreferredMode() then
self.leaveBattlegroundKeybind:SetCooldown(LEAVE_BATTLEGROUND_KEYBIND_COOLDOWN_MS)
end
end
EVENT_MANAGER:RegisterForEvent("BattlegroundScoreboardEndOfGame", EVENT_GAMEPAD_PREFERRED_MODE_CHANGED, OnGamepadModeChanged)
EVENT_MANAGER:RegisterForEvent("BattlegroundScoreboardEndOfGame", EVENT_BATTLEGROUND_STATE_CHANGED, OnBattlegroundStateChanged)
SYSTEMS:RegisterKeyboardRootScene("battleground_scoreboard_end_of_game", BATTLEGROUND_SCOREBOARD_END_OF_GAME_SCENE)
SYSTEMS:RegisterGamepadRootScene("battleground_scoreboard_end_of_game", BATTLEGROUND_SCOREBOARD_END_OF_GAME_SCENE)
self.scene = BATTLEGROUND_SCOREBOARD_END_OF_GAME_SCENE
SCENE_MANAGER:SetSceneRestoresBaseSceneOnGameMenuToggle("battleground_scoreboard_end_of_game", true)
self:UpdateAll()
end
function ZO_Battleground_Scoreboard_End_Of_Game:InitializeKeybinds()
local keybindContainer = self.control:GetNamedChild("KeybindContainer")
self.keybindNameTextMap = {}
self.keybindActionMap = {}
local keybindButtonIndex = 1
local previousKeybindControl
local function CreateKeybindButton(keybind, callbackFunction, text)
-- Make and anchor the button
local keybindControl = CreateControlFromVirtual("$(parent)KeybindButton" .. keybindButtonIndex, keybindContainer, "ZO_KeybindButton")
ZO_KeybindButtonTemplate_Setup(keybindControl, keybind, callbackFunction, text)
if previousKeybindControl then
keybindControl:SetAnchor(LEFT, previousKeybindControl, RIGHT, KEYBIND_BUTTON_SPACING_X, 0)
else
keybindControl:SetAnchor(TOPLEFT)
end
-- Keep track of the control for gamepad switching
keybindControl.nameLabel = keybindControl:GetNamedChild("NameLabel")
self.keybindNameTextMap[keybindControl] = text
-- Keep track of the keybind mapping to handle the key being pressed
self.keybindActionMap[keybind] = keybindControl
keybindButtonIndex = keybindButtonIndex + 1
previousKeybindControl = keybindControl
return keybindControl
end
self.playerOptionsButton = CreateKeybindButton("BATTLEGROUND_SCOREBOARD_PLAYER_OPTIONS", function() BATTLEGROUND_SCOREBOARD_FRAGMENT:ShowGamepadPlayerMenu() end, GetString(SI_BATTLEGROUND_SCOREBOARD_PLAYER_OPTIONS_KEYBIND))
self.leaveBattlegroundKeybind = CreateKeybindButton("LEAVE_BATTLEGROUND", function() self:OnLeaveBattlegroundPressed() end, GetString(SI_BATTLEGROUND_SCOREBOARD_END_OF_GAME_LEAVE_KEYBIND))
self.previousPlayerButton = CreateKeybindButton("BATTLEGROUND_SCOREBOARD_PREVIOUS", function() BATTLEGROUND_SCOREBOARD_FRAGMENT:SelectPreviousPlayerData() end, GetString(SI_BATTLEGROUND_SCOREBOARD_PREVIOUS_PLAYER_KEYBIND))
self.nextPlayerButton = CreateKeybindButton("BATTLEGROUND_SCOREBOARD_NEXT", function() BATTLEGROUND_SCOREBOARD_FRAGMENT:SelectNextPlayerData() end, GetString(SI_BATTLEGROUND_SCOREBOARD_NEXT_PLAYER_KEYBIND))
end
do
local KEYBOARD_PLATFORM_STYLE =
{
timerFont = "ZoFontWinH2",
keybindButtonTemplate = "ZO_KeybindButton_Keyboard_Template",
hasPlayerOptionsButton = false,
}
local GAMEPAD_PLATFORM_STYLE =
{
timerFont = "ZoFontGamepad42",
keybindButtonTemplate = "ZO_KeybindButton_Gamepad_Template",
hasPlayerOptionsButton = true,
}
function ZO_Battleground_Scoreboard_End_Of_Game:InitializePlatformStyle()
self.platformStyle = ZO_PlatformStyle:New(function(style) self:ApplyPlatformStyle(style) end, KEYBOARD_PLATFORM_STYLE, GAMEPAD_PLATFORM_STYLE)
end
end
function ZO_Battleground_Scoreboard_End_Of_Game:ApplyPlatformStyle(style)
self.closingTimerLabel:SetFont(style.timerFont)
for keybindButton, nameText in pairs(self.keybindNameTextMap) do
ApplyTemplateToControl(keybindButton, style.keybindButtonTemplate)
-- We need this because of modifyTextType
keybindButton.nameLabel:SetText(nameText)
end
self.playerOptionsButton:SetHidden(not style.hasPlayerOptionsButton)
if style.hasPlayerOptionsButton then
self.leaveBattlegroundKeybind:SetAnchor(LEFT, self.playerOptionsButton, RIGHT, KEYBIND_BUTTON_SPACING_X, 0)
else
self.leaveBattlegroundKeybind:SetAnchor(TOPLEFT)
end
end
function ZO_Battleground_Scoreboard_End_Of_Game:OnShowing()
self.control:SetHandler("OnUpdate", function() self:UpdateAll() end)
self:RefreshMatchInfoFragments()
end
function ZO_Battleground_Scoreboard_End_Of_Game:OnHiding()
self.control:SetHandler("OnUpdate", nil)
end
function ZO_Battleground_Scoreboard_End_Of_Game:UpdateAll()
local timeLeft = ZO_FormatTimeAsDecimalWhenBelowThreshold(GetCurrentBattlegroundStateTimeRemaining() / 1000)
self.closingTimerLabel:SetText(zo_strformat(SI_BATTLEGROUND_SCOREBOARD_END_OF_GAME_CLOSING_TIME, timeLeft))
end
function ZO_Battleground_Scoreboard_End_Of_Game:RefreshMatchInfoFragments()
local groupToAdd, groupToRemove
if IsInGamepadPreferredMode() then
groupToAdd = FRAGMENT_GROUP.BATTLEGROUND_MATCH_INFO_GAMEPAD_GROUP
groupToRemove = FRAGMENT_GROUP.BATTLEGROUND_MATCH_INFO_KEYBOARD_GROUP
else
groupToAdd = FRAGMENT_GROUP.BATTLEGROUND_MATCH_INFO_KEYBOARD_GROUP
groupToRemove = FRAGMENT_GROUP.BATTLEGROUND_MATCH_INFO_GAMEPAD_GROUP
end
BATTLEGROUND_SCOREBOARD_END_OF_GAME_SCENE:RemoveFragmentGroup(groupToRemove)
BATTLEGROUND_SCOREBOARD_END_OF_GAME_SCENE:AddFragmentGroup(groupToAdd)
end
function ZO_Battleground_Scoreboard_End_Of_Game:OnLeaveBattlegroundPressed()
if self.scene:IsShowing() then
LeaveBattleground()
end
end
function ZO_Battleground_Scoreboard_End_Of_Game:OnKeybindDown(keybind)
if self.scene:IsShowing() then
local keybindButton = self.keybindActionMap[keybind]
if keybindButton and keybindButton:IsEnabled() then
keybindButton:OnClicked()
return true
end
end
return false
end
--[[ xml functions ]]--
function ZO_BattlegroundScoreboardEndOfGameTopLevel_Initialize(control)
BATTLEGROUND_SCOREBOARD_END_OF_GAME = ZO_Battleground_Scoreboard_End_Of_Game:New(control)
end
|
---------------------------------------------------
-- Self-Destruct
--
---------------------------------------------------
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/monstertpmoves")
---------------------------------------------------
function onMobSkillCheck(target,mob,skill)
if (mob:isMobType(MOBTYPE_NOTORIOUS) or mob:getHPP() > 75) then
return 1
end
return 0
end
function onMobWeaponSkill(target, mob, skill)
local dmgmod = 1
BOMB_TOSS_HPP = skill:getMobHPP() / 100
local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*18*BOMB_TOSS_HPP,tpz.magic.ele.FIRE,dmgmod,TP_MAB_BONUS,1)
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,tpz.attackType.MAGICAL,tpz.damageType.FIRE,MOBPARAM_IGNORE_SHADOWS)
mob:setHP(0)
target:takeDamage(dmg, mob, tpz.attackType.MAGICAL, tpz.damageType.FIRE)
return dmg
end
|
local t = require(script.Parent.Parent.lib.t)
local getUserIdCheck = t.instanceOf("Player")
local function getUserId(player)
assert(getUserIdCheck(player))
return tostring(player.UserId)
end
return getUserId
|
return {
gok_fblackdawn = {
buildangle = 8200,
buildcostenergy = 5051,
buildcostmetal = 352,
builder = false,
buildpic = "gok_fblackdawn.dds",
buildtime = 7000,
canattack = true,
canstop = 1,
category = "ALL SURFACE",
collisionvolumeoffsets = "0 0 0",
collisionvolumescales = "30 40 30",
collisionvolumetype = "CylY",
corpse = "dead",
defaultmissiontype = "GUARD_NOMOVE",
description = "Plasma Tower",
explodeas = "MEDIUM_BUILDINGEX",
firestandorders = 1,
footprintx = 3,
footprintz = 3,
icontype = "building",
idleautoheal = 5,
idletime = 1800,
losemitheight = 79,
mass = 352,
maxdamage = 2785,
maxslope = 10,
minwaterdepth = 2,
name = "Black Dawn - Naval Series",
noautofire = false,
objectname = "gok_fblackdawn",
radaremitheight = 79,
seismicsignature = 0,
selfdestructas = "MEDIUM_BUILDING",
sightdistance = 500,
standingfireorder = 2,
turninplaceanglelimit = 140,
turninplacespeedlimit = 0,
turnrate = 0,
unitname = "gok_fblackdawn",
waterline = 0,
yardmap = "wwwwwwwww",
customparams = {
buildpic = "gok_fblackdawn.dds",
faction = "GOK",
},
featuredefs = {
dead = {
blocking = true,
collisionvolumeoffsets = "-0.0445556640625 -0.0718220947266 6.04946899414",
collisionvolumescales = "42.0427246094 74.7609558105 56.8743896484",
collisionvolumetype = "Box",
damage = 2252,
description = "Cobalt Wreckage",
energy = 0,
featuredead = "heap",
footprintx = 2,
footprintz = 2,
metal = 333,
object = "gok_blackdawn_DEAD",
reclaimable = true,
},
heap = {
blocking = false,
damage = 2815,
description = "Cobalt Debris",
energy = 0,
footprintx = 2,
footprintz = 2,
metal = 178,
object = "2X2A",
reclaimable = true,
},
},
sfxtypes = {
pieceexplosiongenerators = {
[1] = "piecetrail0",
[2] = "piecetrail1",
[3] = "piecetrail2",
[4] = "piecetrail3",
[5] = "piecetrail4",
[6] = "piecetrail6",
},
},
sounds = {
canceldestruct = "cancel2",
cloak = "kloak1",
uncloak = "kloak1un",
underattack = "warning1",
cant = {
[1] = "cantdo4",
},
count = {
[1] = "count6",
[2] = "count5",
[3] = "count4",
[4] = "count3",
[5] = "count2",
[6] = "count1",
},
ok = {
[1] = "twractv3",
},
select = {
[1] = "twractv3",
},
},
weapondefs = {
gok_plasma = {
accuracy = 100,
areaofeffect = 96,
avoidfeature = false,
burnblow = true,
cegtag = "gokblaster",
craterareaofeffect = 0,
craterboost = 0,
cratermult = 0,
explosiongenerator = "custom:gokexplosion",
impulseboost = 0.123,
impulsefactor = 0.123,
intensity = 1,
name = "Gok Blaster",
noselfdamage = true,
range = 500,
reloadtime = 1,
rgbcolor = "0.78 0.08 0.52",
size = 0.25,
soundhitdry = "",
soundhitwet = "splssml",
soundhitwetvolume = 0.6,
soundstart = "gokcannon",
turret = true,
weapontype = "Cannon",
weaponvelocity = 350,
damage = {
default = 200,
subs = 5,
},
},
},
weapons = {
[1] = {
badtargetcategory = "TINY",
def = "GOK_PLASMA",
onlytargetcategory = "SURFACE",
},
},
},
}
|
loadstring(game:HttpGet("https://raw.githubusercontent.com/Tescalus/Pendulum-Hubs-Source/main/Reanimation.lua"))()
_G.loop = true
local player = game.Players.LocalPlayer
local char = player.Character
local Align = function(Part0, Part1,Mesh)
local Aligns = {
AlignOrientation = Instance.new("AlignOrientation", Part0),
AlignPosition = Instance.new("AlignPosition", Part0)
}
local Attachments = {
Attach0 = Instance.new("Attachment", Part0),
Attach1 = Instance.new("Attachment", Part1)
}
local m = Part0:FindFirstChildOfClass('SpecialMesh')--This will get the first "SpecialMesh" it finds if it does not find any, then it will return nil
if Mesh and m then --If Mesh is set to true and it finds a mesh it will destroy it
m:Destroy()
end
Part0:BreakJoints()
Aligns.AlignOrientation.Attachment0 = Attachments.Attach0
Aligns.AlignOrientation.Attachment1 = Attachments.Attach1
Aligns.AlignOrientation.Responsiveness = math.huge
Aligns.AlignOrientation.RigidityEnabled = true
Aligns.AlignPosition.Attachment0 = Attachments.Attach0
Aligns.AlignPosition.Attachment1 = Attachments.Attach1
Aligns.AlignPosition.Responsiveness = math.huge
Aligns.AlignPosition.RigidityEnabled = true
Aligns.AlignPosition.MaxForce = 999999999
spawn(function()
while _G.loop do
local mag = (Part0.Position - (Part1.CFrame*Attachments.Attach0.CFrame:Inverse()).p).magnitude--magnitude can get the distance between two cframe or position
if mag >= 5 then
Part0.CFrame = Part1.CFrame*Attachments.Attach0.CFrame:Inverse()
end
Part0.Velocity = Vector3.new(0,35,0)
game['Run Service'].Heartbeat:wait()
end
end)
return {Attachments.Attach0, Attachments, Aligns}
end
local hat = Align(char['4739580137'].Handle,char['Right Arm'],false)
local cf = char['Right Arm'].CFrame*CFrame.new(0.25,0.75,2.5)*CFrame.Angles(math.rad(45),math.rad(90),math.rad(20))
hat[1].CFrame = cf:Inverse() * char['Right Arm'].CFrame
spawn(function()
char.AncestryChanged:wait()--if you respawn, it will stop the loop to avoid lag of using it over and over
_G.loop = false
end)
Player=game:GetService("Players").LocalPlayer
Character=game.Workspace.non
PlayerGui=Player.PlayerGui
Backpack=Player.Backpack
Torso=Character.Torso
Head=Character.Head
Humanoid=Character.Humanoid
LeftArm=Character["Left Arm"]
LeftLeg=Character["Left Leg"]
RightArm=Character["Right Arm"]
RightLeg=Character["Right Leg"]
LS=Torso["Left Shoulder"]
LH=Torso["Left Hip"]
RS=Torso["Right Shoulder"]
Character=Player.Character
PlayerGui=Player.PlayerGui
Backpack=Player.Backpack
Torso=Character.Torso
Head=Character.Head
Humanoid=Character.Humanoid
LeftArm=Character["Left Arm"]
LeftLeg=Character["Left Leg"]
RightArm=Character["Right Arm"]
RightLeg=Character["Right Leg"]
LS=Torso["Left Shoulder"]
LH=Torso["Left Hip"]
RS=Torso["Right Shoulder"]
RH=Torso["Right Hip"]
Face = Head.face
Neck=Torso.Neck
it=Instance.new
attacktype=1
vt=Vector3.new
cf=CFrame.new
euler=CFrame.fromEulerAnglesXYZ
angles=CFrame.Angles
cloaked=false
necko=cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
necko2=cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
LHC0=cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0)
LHC1=cf(-0.5,1,0,-0,-0,-1,0,1,0,1,0,0)
RHC0=cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0)
RHC1=cf(0.5,1,0,0,0,1,0,1,0,-1,-0,-0)
RootPart=Character.HumanoidRootPart
RootJoint=RootPart.RootJoint
RootCF=euler(-1.57,0,3.14)
attack = false
attackdebounce = false
deb=false
equipped=true
hand=false
Mouse=nil
combo=0
mana=0
trispeed=.2
attackmode='none'
local idle=0
local Anim="Idle"
local Effects={}
local gun=false
local shoot=false
player=nil
mana=0
Mouse=Player:GetMouse()
--save shoulders
RSH, LSH=nil, nil
--welds
RW, LW=Instance.new("Weld"), Instance.new("Weld")
RW.Name="Right Shoulder" LW.Name="Left Shoulder"
LH=Torso["Left Hip"]
RH=Torso["Right Hip"]
TorsoColor=Torso.BrickColor
function NoOutline(Part)
Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10
end
player=Player
ch=Character
RSH=ch.Torso["Right Shoulder"]
LSH=ch.Torso["Left Shoulder"]
--
RSH.Parent=nil
LSH.Parent=nil
--
RW.Name="Right Shoulder"
RW.Part0=ch.Torso
RW.C0=cf(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
RW.C1=cf(0, 0.5, 0)
RW.Part1=ch["Right Arm"]
RW.Parent=ch.Torso
--
LW.Name="Left Shoulder"
LW.Part0=ch.Torso
LW.C0=cf(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
LW.C1=cf(0, 0.5, 0)
LW.Part1=ch["Left Arm"]
LW.Parent=ch.Torso
local function weldBetween(a, b)
local weldd = Instance.new("ManualWeld")
weldd.Part0 = a
weldd.Part1 = b
weldd.C0 = CFrame.new()
weldd.C1 = b.CFrame:inverse() * a.CFrame
weldd.Parent = a
return weldd
end
function swait(num)
if num==0 or num==nil then
game:service'RunService'.Heartbeat:wait(0)
else
for i=0,num do
game:service'RunService'.Heartbeat:wait(0)
end
end
end
a = Instance.new("ScreenGui")
a.Name="CooldownGUI"
a.Parent=Player.PlayerGui
b = Instance.new("Frame")
b.Parent=a
b.Visible=true
b.BackgroundTransparency=0.3
b.BackgroundColor3=Color3.fromRGB(0, 0, 0)
b.BorderColor3=Color3.fromRGB(255, 255, 255)
b.BorderSizePixel=3
b.Position=UDim2.new(0.7, 0, 0.75, 0)
b.Size=UDim2.new(0, 200, 0, 100)
c = Instance.new("Frame")
c.Parent=a
c.Visible=true
c.BackgroundTransparency=0.3
c.BorderColor3=Color3.fromRGB(255, 255, 255)
c.BorderSizePixel=3
c.BackgroundColor3=Color3.fromRGB(0, 0, 0)
c.Position=UDim2.new(0.875, 0, 0.75, 0)
c.Size=UDim2.new(0, 200, 0, 100)
d = Instance.new("Frame")
d.Parent=a
d.Visible=true
d.BackgroundTransparency=0.3
d.BorderColor3=Color3.fromRGB(255, 255, 255)
d.BorderSizePixel=3
d.BackgroundColor3=Color3.fromRGB(0, 0, 0)
d.Position=UDim2.new(0.875, 0, 0.95, 0)
d.Size=UDim2.new(0, 200, 0, 100)
e = Instance.new("Frame")
e.Parent=a
e.Visible=true
e.BackgroundTransparency=0.3
e.BorderColor3=Color3.fromRGB(255, 255, 255)
e.BorderSizePixel=3
e.BackgroundColor3=Color3.fromRGB(0, 0, 0)
e.Position=UDim2.new(0.7, 0, 0.95, 0)
e.Size=UDim2.new(0, 200, 0, 100)
f = Instance.new("Frame")
f.Parent=a
f.Visible=true
f.BackgroundTransparency=0.3
f.BorderColor3=Color3.fromRGB(255, 255, 255)
f.BorderSizePixel=3
f.BackgroundColor3=Color3.fromRGB(0, 0, 0)
f.Position=UDim2.new(1.675, 0, 0.95, 0)
f.Size=UDim2.new(0, 200, 0, 100)
g = Instance.new("Frame")
g.Parent=a
g.Visible=true
g.BackgroundTransparency=0.3
g.BorderColor3=Color3.fromRGB(255, 255, 255)
g.BorderSizePixel=3
g.BackgroundColor3=Color3.fromRGB(0, 0, 0)
g.Position=UDim2.new(1.675, 0, 0.75, 0)
g.Size=UDim2.new(0, 200, 0, 100)
b2=Instance.new("TextLabel")
b2.Parent=a
b2.BackgroundTransparency=1
b2.BorderColor3=Color3.fromRGB(139, 139, 139)
b2.BorderSizePixel=3
b2.Position=b.Position
b2.Size=UDim2.new(0, 200, 0, 100)
b2.Visible=true
b2.ZIndex=3
b2.Font="SourceSansItalic"
b2.FontSize="Size32"
b2.TextColor3=Color3.fromRGB(255, 255, 255)
b2.TextScaled=false
b2.TextStrokeColor3=Color3.fromRGB(139, 139, 139)
b2.TextTransparency=0
b2.Text=[[
Shock
(Z)
]]
c2=Instance.new("TextLabel")
c2.Parent=a
c2.BackgroundTransparency=1
c2.BorderColor3=Color3.fromRGB(139, 139, 139)
c2.BorderSizePixel=3
c2.Position=c.Position
c2.Size=UDim2.new(0, 200, 0, 100)
c2.Visible=true
c2.ZIndex=3
c2.Font="SourceSansItalic"
c2.FontSize="Size32"
c2.TextColor3=Color3.fromRGB(255, 255, 255)
c2.TextScaled=false
c2.TextStrokeColor3=Color3.fromRGB(139, 139, 139)
c2.TextTransparency=0
c2.Text=[[
Dominator
(X)
]]
d2=Instance.new("TextLabel")
d2.Parent=a
d2.BackgroundTransparency=1
d2.BorderColor3=Color3.fromRGB(139, 139, 139)
d2.BorderSizePixel=3
d2.Position=d.Position
d2.Size=UDim2.new(0, 200, 0, 100)
d2.Visible=true
d2.ZIndex=3
d2.Font="SourceSansItalic"
d2.FontSize="Size32"
d2.TextColor3=Color3.fromRGB(255, 255, 255)
d2.TextScaled=false
d2.TextStrokeColor3=Color3.fromRGB(139, 139, 139)
d2.TextTransparency=0
d2.Text=[[
Eliminator
(V)
]]
e2=Instance.new("TextLabel")
e2.Parent=a
e2.BackgroundTransparency=1
e2.BorderColor3=Color3.fromRGB(139, 139, 139)
e2.BorderSizePixel=3
e2.Position=e.Position
e2.Size=UDim2.new(0, 200, 0, 100)
e2.Visible=true
e2.ZIndex=3
e2.Font="SourceSansItalic"
e2.FontSize="Size32"
e2.TextColor3=Color3.fromRGB(255, 255, 255)
e2.TextScaled=false
e2.TextStrokeColor3=Color3.fromRGB(139, 139, 139)
e2.TextTransparency=0
e2.Text=[[
Obliteration
(C)
]]
function NoOutline(Part)
Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10
end
function part(formfactor,parent,reflectance,transparency,brickcolor,name,size,material)
local fp = it("Part")
fp.formFactor = formfactor
fp.Parent = parent
fp.Reflectance = reflectance
fp.Transparency = transparency
fp.CanCollide = false
fp.Locked=true
fp.BrickColor = brickcolor
fp.Name = name
fp.Size = size
fp.Position = Torso.Position
NoOutline(fp)
fp.Material=material
fp:BreakJoints()
return fp
end
function mesh(Mesh,part,meshtype,meshid,offset,scale)
local mesh = it(Mesh)
mesh.Parent = part
if Mesh=="SpecialMesh" then
mesh.MeshType = meshtype
mesh.MeshId = meshid
end
mesh.Offset=offset
mesh.Scale=scale
return mesh
end
function weld(parent,part0,part1,c0)
local weld = it("Weld")
weld.Parent = parent
weld.Part0 = part0
weld.Part1 = part1
weld.C0 = c0
return weld
end
local function CFrameFromTopBack(at, top, back)
local right = top:Cross(back)
return CFrame.new(at.x, at.y, at.z,
right.x, top.x, back.x,
right.y, top.y, back.y,
right.z, top.z, back.z)
end
function Triangle(a, b, c)
local edg1 = (c-a):Dot((b-a).unit)
local edg2 = (a-b):Dot((c-b).unit)
local edg3 = (b-c):Dot((a-c).unit)
if edg1 <= (b-a).magnitude and edg1 >= 0 then
a, b, c = a, b, c
elseif edg2 <= (c-b).magnitude and edg2 >= 0 then
a, b, c = b, c, a
elseif edg3 <= (a-c).magnitude and edg3 >= 0 then
a, b, c = c, a, b
else
assert(false, "unreachable")
end
local len1 = (c-a):Dot((b-a).unit)
local len2 = (b-a).magnitude - len1
local width = (a + (b-a).unit*len1 - c).magnitude
local maincf = CFrameFromTopBack(a, (b-a):Cross(c-b).unit, -(b-a).unit)
local list = {}
local Color = BrickColor.new("Dark grey")
if len1 > 0.01 then
local w1 = Instance.new('WedgePart', m)
game:GetService("Debris"):AddItem(w1,5)
w1.Material = "SmoothPlastic"
w1.FormFactor = 'Custom'
w1.BrickColor = BrickColor.new("Really black")
w1.Transparency = 0
w1.Reflectance = 0
w1.Material = "SmoothPlastic"
w1.CanCollide = false
NoOutline(w1)
local sz = Vector3.new(0.2, width, len1)
w1.Size = sz
local sp = Instance.new("SpecialMesh",w1)
sp.MeshType = "Wedge"
sp.Scale = Vector3.new(0,1,1) * sz/w1.Size
w1:BreakJoints()
w1.Anchored = true
w1.Parent = workspace
w1.Transparency = 0.7
table.insert(Effects,{w1,"Disappear",.01})
w1.CFrame = maincf*CFrame.Angles(math.pi,0,math.pi/2)*CFrame.new(0,width/2,len1/2)
table.insert(list,w1)
end
if len2 > 0.01 then
local w2 = Instance.new('WedgePart', m)
game:GetService("Debris"):AddItem(w2,5)
w2.Material = "SmoothPlastic"
w2.FormFactor = 'Custom'
w2.BrickColor = BrickColor.new("Really red")
w2.Transparency = 0
w2.Reflectance = 0
w2.Material = "SmoothPlastic"
w2.CanCollide = false
NoOutline(w2)
local sz = Vector3.new(0.2, width, len2)
w2.Size = sz
local sp = Instance.new("SpecialMesh",w2)
sp.MeshType = "Wedge"
sp.Scale = Vector3.new(0,1,1) * sz/w2.Size
w2:BreakJoints()
w2.Anchored = true
w2.Parent = workspace
w2.Transparency = 0.7
table.insert(Effects,{w2,"Disappear",.01})
w2.CFrame = maincf*CFrame.Angles(math.pi,math.pi,-math.pi/2)*CFrame.new(0,width/2,-len1 - len2/2)
table.insert(list,w2)
end
return unpack(list)
end
so = function(id,par,vol,pit)
coroutine.resume(coroutine.create(function()
local sou = Instance.new("Sound",par or workspace)
sou.Volume=vol
sou.Pitch=pit or 1
sou.SoundId=id
swait()
sou:play()
game:GetService("Debris"):AddItem(sou,6)
end))
end
function clerp(a,b,t)
local qa = {QuaternionFromCFrame(a)}
local qb = {QuaternionFromCFrame(b)}
local ax, ay, az = a.x, a.y, a.z
local bx, by, bz = b.x, b.y, b.z
local _t = 1-t
return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
end
function QuaternionFromCFrame(cf)
local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
local trace = m00 + m11 + m22
if trace > 0 then
local s = math.sqrt(1 + trace)
local recip = 0.5/s
return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
else
local i = 0
if m11 > m00 then
i = 1
end
if m22 > (i == 0 and m00 or m11) then
i = 2
end
if i == 0 then
local s = math.sqrt(m00-m11-m22+1)
local recip = 0.5/s
return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
elseif i == 1 then
local s = math.sqrt(m11-m22-m00+1)
local recip = 0.5/s
return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
elseif i == 2 then
local s = math.sqrt(m22-m00-m11+1)
local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
end
end
end
function QuaternionToCFrame(px, py, pz, x, y, z, w)
local xs, ys, zs = x + x, y + y, z + z
local wx, wy, wz = w*xs, w*ys, w*zs
local xx = x*xs
local xy = x*ys
local xz = x*zs
local yy = y*ys
local yz = y*zs
local zz = z*zs
return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
end
function QuaternionSlerp(a, b, t)
local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
local startInterp, finishInterp;
if cosTheta >= 0.0001 then
if (1 - cosTheta) > 0.0001 then
local theta = math.acos(cosTheta)
local invSinTheta = 1/math.sin(theta)
startInterp = math.sin((1-t)*theta)*invSinTheta
finishInterp = math.sin(t*theta)*invSinTheta
else
startInterp = 1-t
finishInterp = t
end
else
if (1+cosTheta) > 0.0001 then
local theta = math.acos(-cosTheta)
local invSinTheta = 1/math.sin(theta)
startInterp = math.sin((t-1)*theta)*invSinTheta
finishInterp = math.sin(t*theta)*invSinTheta
else
startInterp = t-1
finishInterp = t
end
end
return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
end
--Example: Torso.Weld.C0 = clerp(Torso.Weld.C0, CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.4)
function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants
return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
end
Damagefunc=function(Part,hit,minim,maxim,knockback,Type,Property,Delay,KnockbackType,decreaseblock)
if hit.Parent==nil then
return
end
local h=hit.Parent:FindFirstChild("Humanoid")
for _,v in pairs(hit.Parent:children()) do
if v:IsA("Humanoid") then
h=v
end
end
if hit.Parent.Parent:FindFirstChild("Torso")~=nil then
h=hit.Parent.Parent:FindFirstChild("Humanoid")
end
if hit.Parent.className=="Hat" then
hit=hit.Parent.Parent:findFirstChild("Head")
end
if h~=nil and hit.Parent.Name~=Character.Name and hit.Parent:FindFirstChild("Torso")~=nil then
if hit.Parent:findFirstChild("DebounceHit")~=nil then if hit.Parent.DebounceHit.Value==true then return end end
--[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then
return
end]]
-- hs(hit,1.2)
local c=Instance.new("ObjectValue")
c.Name="creator"
c.Value=game:service("Players").LocalPlayer
c.Parent=h
game:GetService("Debris"):AddItem(c,.5)
local Damage=-math.huge
-- h:TakeDamage(Damage)
local blocked=false
local block=hit.Parent:findFirstChild("Block")
if block~=nil then
print(block.className)
if block.className=="NumberValue" then
if block.Value>0 then
blocked=true
if decreaseblock==nil then
block.Value=block.Value-1
end
end
end
if block.className=="IntValue" then
if block.Value>0 then
blocked=true
if decreaseblock~=nil then
block.Value=block.Value-1
end
end
end
end
if blocked==false then
-- h:TakeDamage(Damage)
h.Health=h.Health-Damage
ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, Part.BrickColor.Color)
else
h.Health=h.Health-(Damage/2)
ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, BrickColor.new("Bright blue").Color)
end
if Type=="Knockdown" then
local hum=hit.Parent.Humanoid
hum.PlatformStand=true
coroutine.resume(coroutine.create(function(HHumanoid)
swait(1)
HHumanoid.PlatformStand=false
end),hum)
local angle=(hit.Position-(Property.Position+Vector3.new(0,0,0))).unit
--hit.CFrame=CFrame.new(hit.Position,Vector3.new(angle.x,hit.Position.y,angle.z))*CFrame.fromEulerAnglesXYZ(math.pi/4,0,0)
local bodvol=Instance.new("BodyVelocity")
bodvol.velocity=angle*knockback
bodvol.P=5000
bodvol.maxForce=Vector3.new(8e+003, 8e+003, 8e+003)
bodvol.Parent=hit
local rl=Instance.new("BodyAngularVelocity")
rl.P=3000
rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000
rl.angularvelocity=Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10))
rl.Parent=hit
game:GetService("Debris"):AddItem(bodvol,.5)
game:GetService("Debris"):AddItem(rl,.5)
elseif Type=="Normal" then
local vp=Instance.new("BodyVelocity")
vp.P=500
vp.maxForce=Vector3.new(math.huge,0,math.huge)
-- vp.velocity=Character.Torso.CFrame.lookVector*Knockback
if KnockbackType==1 then
vp.velocity=Property.CFrame.lookVector*knockback+Property.Velocity/1.05
elseif KnockbackType==2 then
vp.velocity=Property.CFrame.lookVector*knockback
end
if knockback>0 then
vp.Parent=hit.Parent.Torso
end
game:GetService("Debris"):AddItem(vp,.5)
elseif Type=="Up" then
local bodyVelocity=Instance.new("BodyVelocity")
bodyVelocity.velocity=vt(0,60,0)
bodyVelocity.P=5000
bodyVelocity.maxForce=Vector3.new(8e+003, 8e+003, 8e+003)
bodyVelocity.Parent=hit
game:GetService("Debris"):AddItem(bodyVelocity,1)
local rl=Instance.new("BodyAngularVelocity")
rl.P=3000
rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000
rl.angularvelocity=Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30))
rl.Parent=hit
game:GetService("Debris"):AddItem(rl,.5)
elseif Type=="Snare" then
local bp=Instance.new("BodyPosition")
bp.P=2000
bp.D=100
bp.maxForce=Vector3.new(math.huge,math.huge,math.huge)
bp.position=hit.Parent.Torso.Position
bp.Parent=hit.Parent.Torso
game:GetService("Debris"):AddItem(bp,1)
elseif Type=="Target" then
local Targetting = false
if Targetting==false then
ZTarget=hit.Parent.Torso
coroutine.resume(coroutine.create(function(Part)
so("http://www.roblox.com/asset/?id=15666462",Part,1,1.5)
swait(5)
so("http://www.roblox.com/asset/?id=15666462",Part,1,1.5)
end),ZTarget)
local TargHum=ZTarget.Parent:findFirstChild("Humanoid")
local targetgui=Instance.new("BillboardGui")
targetgui.Parent=ZTarget
targetgui.Size=UDim2.new(10,100,10,100)
local targ=Instance.new("ImageLabel")
targ.Parent=targetgui
targ.BackgroundTransparency=1
targ.Image="rbxassetid://4834067"
targ.Size=UDim2.new(1,0,1,0)
local cam = game.Workspace.CurrentCamera
cam.CameraType="Scriptable"
cam.CoordinateFrame=CFrame.new(Head.CFrame.p,ZTarget.Position)
local dir=Vector3.new(cam.CoordinateFrame.lookVector.x,0,cam.CoordinateFrame.lookVector.z)
workspace.CurrentCamera.CoordinateFrame=CFrame.new(Head.CFrame.p,ZTarget.Position)
Targetting=true
RocketTarget=ZTarget
for i=1,Property do
--while Targetting==true and Humanoid.Health>0 and Character.Parent~=nil do
if Humanoid.Health>0 and Character.Parent~=nil and TargHum.Health>0 and TargHum.Parent~=nil and Targetting==true then
swait()
end
--workspace.CurrentCamera.CoordinateFrame=CFrame.new(Head.CFrame.p,Head.CFrame.p+rmdir*100)
cam.CoordinateFrame=CFrame.new(Head.CFrame.p,ZTarget.Position)
dir=Vector3.new(cam.CoordinateFrame.lookVector.x,0,cam.CoordinateFrame.lookVector.z)
cam.CoordinateFrame=CFrame.new(Head.CFrame.p,ZTarget.Position)*cf(0,5,10)*euler(-0.3,0,0)
end
Targetting=false
RocketTarget=nil
targetgui.Parent=nil
cam.CameraType="Custom"
end
end
local debounce=Instance.new("BoolValue")
debounce.Name="DebounceHit"
debounce.Parent=hit.Parent
debounce.Value=true
game:GetService("Debris"):AddItem(debounce,Delay)
c=Instance.new("ObjectValue")
c.Name="creator"
c.Value=Player
c.Parent=h
game:GetService("Debris"):AddItem(c,.5)
end
end
function ShowDamage(Pos, Text, Time, Color)
local Rate = (1 / 30)
local Pos = (Pos or Vector3.new(0, 0, 0))
local Text = (Text or "")
local Time = (Time or 2)
local Color = (Color or Color3.new(1, 0, 0))
local EffectPart=part(1,workspace,0,0,BrickColor.new("Really black"),"Effect",vt(0,0,0),"Granite")
EffectPart.Anchored = true
local BillboardGui = Instance.new("BillboardGui")
BillboardGui.Size = UDim2.new(3, 0, 3, 0)
BillboardGui.Adornee = EffectPart
local TextLabel = Instance.new("TextLabel")
TextLabel.BackgroundTransparency = 1
TextLabel.Size = UDim2.new(1, 0, 1, 0)
TextLabel.Text = Text
TextLabel.TextColor3 = Color
TextLabel.TextScaled = true
TextLabel.Font = Enum.Font.ArialBold
TextLabel.Parent = BillboardGui
BillboardGui.Parent = EffectPart
game.Debris:AddItem(EffectPart, (Time + 0.1))
EffectPart.Parent = game:GetService("Workspace")
Delay(0, function()
local Frames = (Time / Rate)
for Frame = 1, Frames do
wait(Rate)
local Percent = (Frame / Frames)
EffectPart.CFrame = CFrame.new(Pos) + Vector3.new(0, Percent, 0)
TextLabel.TextTransparency = Percent
end
if EffectPart and EffectPart.Parent then
EffectPart:Destroy()
end
end)
end
function MagniDamage(Hit,Part,magni,mindam,maxdam,knock,Type)
for _,c in pairs(workspace:children()) do
local hum=c:findFirstChild("Humanoid")
if hum~=nil then
local head=c:findFirstChild("Torso")
if head~=nil then
local targ=head.Position-Part.Position
local mag=targ.magnitude
if mag<=magni and c.Name~=Player.Name then
Damagefunc(Hit,head,mindam,maxdam,knock,Type,RootPart,.2,1,3)
end
end
end
end
end
mod3 = Instance.new("Model",RightLeg)
function Stomp()
local function fpart(formfactor,parent,reflectance,transparency,brickcolor,name,size,material)
local fp = it("Part")
fp.formFactor = formfactor
fp.Parent = parent
fp.Reflectance = reflectance
fp.Transparency = transparency
fp.CanCollide = false
fp.Locked=true
fp.BrickColor = brickcolor
fp.Name = name
fp.Size = size
fp.Position = Torso.Position
NoOutline(fp)
fp.Material=material
fp:BreakJoints()
return fp
end
local function fmesh(Mesh,part,meshtype,meshid,offset,scale)
local mesh = it(Mesh)
mesh.Parent = part
if Mesh=="SpecialMesh" then
mesh.MeshType = meshtype
mesh.MeshId = meshid
end
mesh.Offset=offset
mesh.Scale=scale
return mesh
end
local part = fpart("Custom",mod3,0,0.7,BrickColor.new("Crimson"),"Wave",vt(0.2,0.2,0.2),"Neon")
part.Anchored = true
local mesh = fmesh("SpecialMesh",part,"FileMesh","http://www.roblox.com/asset/?id=3270017",vt(0,0,0),vt(25,25,25))
local part2 = fpart("Custom",mod3,0,0.7,BrickColor.new("Crimson"),"Wave",vt(0.2,0.2,0.2),"Neon")
part2.Anchored = true
local mesh2 = fmesh("SpecialMesh",part2,"FileMesh","http://www.roblox.com/asset/?id=3270017",vt(0,0,0),vt(15,15,15))
local part3 = fpart("Custom",mod3,0,0.7,BrickColor.new("Crimson"),"Wave",vt(0.2,0.2,0.2),"Neon")
part3.CFrame=RightLeg.CFrame*CFrame.new(0,-3,0)
part3.Anchored = true
local mesh3 = fmesh("SpecialMesh",part3,"FileMesh","http://www.roblox.com/asset/?id=20329976",vt(0,0,0),vt(12,12,12))
MagniDamage(part,part,30,10,15,math.random(10,20),"Knockdown")
coroutine.resume(coroutine.create(function()
for i=0,3.8,0.05 do
wait()
part.CFrame=part.CFrame
part.Transparency=i
mesh.Scale=mesh.Scale+Vector3.new(2.8,2.8,2.8)
part2.CFrame=part2.CFrame
part2.Transparency=i
mesh2.Scale=mesh2.Scale+Vector3.new(1,1,1)
part3.CFrame=part3.CFrame
part3.Transparency=i
mesh3.Scale=mesh3.Scale+Vector3.new(1.5,1.5,1.5)
end
end))
end
model = Instance.new("Model",Character)
model.Name = "Realm"
local handle=part(1,model,0,0,BrickColor.new("Really black"),"Handle",vt(0.2, 1.5, 0.2),"Granite")
local prt1=part(1,model,0,0,BrickColor.new("Really black"),"Part1",vt(1.22, 7.2, 0.22),"Granite")
local prt2=part(1,model,0,0,BrickColor.new("Maroon"),"Part2",vt(0.22, 2.4, 0.22),"Neon")
local prt3=part(1,model,0,0,BrickColor.new("Maroon"),"Part3",vt(0.42, 0.85, 1.05),"Neon")
local prt4=part(1,model,0,0,BrickColor.new("Really black"),"Part4",vt(0.22, 1.5, 0.22),"Granite")
local prt5=part(1,model,0,0,BrickColor.new("Really black"),"Part5",vt(0.44, 0.6, 0.8),"Granite")
local prt6=part(1,model,0,0,BrickColor.new("Maroon"),"Part6",vt(1.6, 1.4, 0.2),"Neon")
local prt7=part(0,model,0,0,BrickColor.new("Really black"),"Part7",vt(0.4, 0.4, 0.4),"Granite")
local prt8=part(1,model,0,0,BrickColor.new("Really black"),"Part8",vt(0.4, 0.3, 0.22),"Granite")
local prt9=part(1,model,0,0,BrickColor.new("Really black"),"Part9",vt(0.4, 1.3, 1.5),"Granite")
local prt10=part(1,model,0,0,BrickColor.new("Maroon"),"Part10",vt(0.3, 1.5, 1.7),"Neon")
local prt11=part(1,model,0,0,BrickColor.new("Maroon"),"Part11",vt(0.4, 1.4, 0.22),"Neon")
local prt13=part(1,model,0,0,BrickColor.new("Maroon"),"Part13",vt(1.3, 7.3, 0.2),"Neon")
local prt15=part(1,model,0,0,BrickColor.new("Maroon"),"Part15",vt(1, 0.5, 0.22),"Neon")
local prt16=part(1,model,0,0,BrickColor.new("Maroon"),"Part16",vt(1, 0.5, 0.22),"Neon")
local handlemesh=mesh("SpecialMesh",handle,"FileMesh","http://www.roblox.com/asset/?id=1033714",vt(0,0,0),vt(0.2,5,0.2))
local msh2=mesh("SpecialMesh",prt2,"FileMesh","http://www.roblox.com/asset/?id=1033714",vt(0,0,0),vt(0.2, 5, 0.2))
local msh3=mesh("SpecialMesh",prt3,"Cylinder","",vt(0,0,0),vt(1,1,2))
local msh4=mesh("SpecialMesh",prt4,"FileMesh","http://www.roblox.com/asset/?id=1033714",vt(0,0,0),vt(0.2, 5, 0.2))
local msh5=mesh("SpecialMesh",prt5,"Cylinder","",vt(0,0,0),vt(1,1,1))
local msh6=mesh("SpecialMesh",prt6,"Sphere","",vt(0,0,0),vt(1,1,1))
local msh8=mesh("SpecialMesh",prt8,"FileMesh","http://www.roblox.com/asset/?id=192551369",vt(0,0,0),vt(0.5, 0.5, 0.2))
local msh9=mesh("SpecialMesh",prt9,"Cylinder","",vt(0,0,0),vt(1, 1, 2))
local msh10=mesh("SpecialMesh",prt10,"Cylinder","",vt(0,0,0),vt(1, 1, 2))
local handleweld=weld(handle,handle,RightArm,euler(89.75, 0, 0)*cf(0,1,0))
local wld1=weld(prt1,prt1,handle,euler(0, 80.1, 0)*cf(-0, 4.95, -0.02))
local wld2=weld(prt2,prt2,handle,euler(0, 80.1, 0)*cf(0.005, 0.15, -0.005))
local wld3=weld(prt3,prt3,handle,euler(0, 12.5, 0)*cf(-0, 1.303, -0.028))
local wld4=weld(prt4,prt4,handle,euler(0, 80.1, 0)*cf(0.005, 0.4, -0.005))
local wld5=weld(prt5,prt5,handle,euler(0, 12.5, 0)*cf(-0, 1.303, -0.028))
local wld6=weld(prt6,prt6,handle,euler(0, 80.1, 0)*cf(-0, 8.8, -0.02))
local wld7=weld(prt7,prt7,handle,euler(0, 80.1, 0)*cf(0.005, -1.8, -0.005))
local wld8=weld(prt8,prt8,handle,euler(0, -80.1, 0)*cf(-0, 1.6, -0.02))
local wld9=weld(prt9,prt9,handle,euler(0, 12.5, 0)*cf(-0, 1.303, -0.028))
local wld10=weld(prt10,prt10,handle,euler(0, 12.5, 0)*cf(-0, 1.303, -0.028))
local wld11=weld(prt11,prt11,handle,euler(0, 80.1, 0)*cf(-0.113, 8.501, -0.01))
local wld13=weld(prt13,prt13,handle,euler(0, 80.1, 0)*cf(-0, 4.95, -0.02))
local wld15=weld(prt15,prt15,handle,euler(0, 80.1, 0)*cf(-0.011, 3.903, 0))
local wld16=weld(prt16,prt16,handle,euler(0, 80.1, 0)*cf(-0.011, 5.903, 0))
function attackone()
attack = true
local hitsounds={"199149137","199149186","199149221","199149235","199149269","199149297"}
local con=prt1.Touched:connect(function(hit)
Damagefunc(prt1,hit,5,13,5,"Normal",RootPart,.2,1,3)
end)
local fx=prt1.Touched:connect(function(part)
local human=part.Parent:findFirstChild("Humanoid")
if human~=nil and bounce==false then
bounce=true
local rndm=math.random(1,#hitsounds)
local r=rndm
so("http://www.roblox.com/asset/?id="..hitsounds[r],part.Parent,1,1)
end
end)
for i = 0,1,0.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(-50)),0.4)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(0),math.rad(0),math.rad(50)),0.4)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(10), math.rad(100)),0.4)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-60)),0.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(120),math.rad(0)),0.4)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(0),math.rad(0)),0.4)
end
so("http://www.roblox.com/asset/?id=199145841",handle,1,.9)
for i = 0,1,0.1 do
swait()
local blcf = prt1.CFrame*CFrame.new(0,.5,0)
if scfr and (prt1.Position-scfr.p).magnitude > .1 then
local h = 10
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(80)),0.4)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(10),math.rad(-10),math.rad(-80)),0.4)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(120), math.rad(90)),0.4)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-30)),0.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(50),math.rad(0)),0.4)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(0)),0.4)
end
attack = false
bounce=false
scfr=nil
fx:disconnect()
con:disconnect()
end
function attacktwo()
attack=true
local hitsounds={"199149137","199149186","199149221","199149235","199149269","199149297"}
local con=prt1.Touched:connect(function(hit)
Damagefunc(prt1,hit,5,15,5,"Normal",RootPart,.2,1,3) end)
local fx=prt1.Touched:connect(function(part)
local human=part.Parent:findFirstChild("Humanoid")
if human~=nil and bounce==false then
bounce=true
local rndm=math.random(1,#hitsounds)
local r=rndm
so("http://www.roblox.com/asset/?id="..hitsounds[r],part.Parent,1,1)
end
end)
for i=0,1,.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(70)),0.4)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(10),math.rad(-10),math.rad(-70)),0.4)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(120), math.rad(90)),0.4)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-30)),0.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(40),math.rad(0)),0.4)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-140),math.rad(-10)),0.4)
end
so("http://www.roblox.com/asset/?id=199145887",handle,1,1)
for i = 0,1,0.1 do
swait()
local blcf = prt1.CFrame*CFrame.new(0,.5,0)
if scfr and (prt1.Position-scfr.p).magnitude > .1 then
local h = 10
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(-80)),0.4)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(10),math.rad(0),math.rad(80)),0.4)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(10), math.rad(90)),0.4)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-90)),0.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(140),math.rad(0)),0.4)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-40),math.rad(-10)),0.4)
end
scfr=nil
attack=false
bounce=false
con:disconnect()
fx:disconnect()
end
function Wave()
local function wpart(formfactor,parent,material,reflectance,transparency,brickcolor,name,size)
local fp=it("Part")
fp.formFactor=formfactor
fp.Parent=parent
fp.Reflectance=reflectance
fp.Transparency=transparency
fp.CanCollide=false
fp.Locked=true
fp.BrickColor=BrickColor.new(tostring(brickcolor))
fp.Name=name
fp.Size=size
fp.Position=Character.Torso.Position
NoOutline(fp)
fp.Material=material
fp:BreakJoints()
return fp
end
attack=true
local hitsounds={"199149137","199149186","199149221","199149235","199149269","199149297"}
local con=prt1.Touched:connect(function(hit)
Damagefunc(prt1,hit,4,31,5,"Normal",RootPart,.2,1,3) end)
local fx=prt1.Touched:connect(function(part)
local human=part.Parent:findFirstChild("Humanoid")
if human~=nil and bounce==false then
bounce=true
local rndm=math.random(1,#hitsounds)
local r=rndm
so("http://www.roblox.com/asset/?id="..hitsounds[r],part.Parent,1,1)
end
end)
for i=0,1,.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(-30)),0.4)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(0),math.rad(0),math.rad(30)),.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(170), math.rad(0), math.rad(20)),0.4)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(25), math.rad(0), math.rad(-30)),0.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(105),math.rad(0)),0.4)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-75),math.rad(-10)),0.4)
end
so("http://www.roblox.com/asset/?id=199145913",handle,1,.9)
local hit,pos=rayCast(prt1.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,100,Character)
if hit~=nil then
local ref=wpart(3,workspace,"SmoothPlastic",0,1,BrickColor.new("Black"),"Effect",vt())
ref.Anchored=true
ref.CFrame=cf(pos)
game:GetService("Debris"):AddItem(ref,3)
local function BlastEffect(brickcolor,cframe,x1,y1,z1,x2,y2,z2)
local prt=wpart(3,workspace,"SmoothPlastic",0,0,brickcolor,"Effect",vt(0.5,0.5,0.5))
prt.Anchored=true
prt.CFrame = cframe
local msh=mesh("SpecialMesh",prt,"FileMesh","http://www.roblox.com/asset/?id=20329976",vt(0,0,0),vt(x1,y1,z1))
coroutine.resume(coroutine.create(function()
for i=0,1,0.05 do
wait()
prt.Transparency=i
msh.Scale=msh.Scale+vt(x2,y2,z2)
end
prt.Parent=nil
end))
end
local function MagicCircle(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=wpart(3,workspace,"SmoothPlastic",0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
local msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,2)
coroutine.resume(coroutine.create(function(Part,Mesh)
local wld=nil
for i=0,1,delay do
wait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)
end
for i = 5,1,-1 do
BlastEffect(BrickColor.new("Maroon"),cf(pos),1,1,1,1,1,1)
MagicCircle(BrickColor.new("Maroon"),cf(pos),3,3,3,5,5,5,0.05)
swait()
end
MagniDamage(ref,ref,13,15,25,math.random(10,20),"Knockdown")
end
for i = 0,1,0.1 do
swait()
local blcf = prt1.CFrame*CFrame.new(0,.5,0)
if scfr and (prt1.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(50)),0.4)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(10),math.rad(0),math.rad(-50)),.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(20), math.rad(0), math.rad(-10)),0.4)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-10)),0.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(80),math.rad(0)),0.4)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-100),math.rad(-10)),0.4)
end
attack=false
bounce=false
scfr=nil
con:disconnect()
fx:disconnect()
end
function Charge()
attack = true
local hitsounds={"199149137","199149186","199149221","199149235","199149269","199149297"}
local con=prt1.Touched:connect(function(hit)
Damagefunc(prt1,hit,10,40,50,"Normal",RootPart,.2,1,3) end)
local fx=prt1.Touched:connect(function(part)
local human=part.Parent:findFirstChild("Humanoid")
if human~=nil and bounce==false then
bounce=true
local rndm=math.random(1,#hitsounds)
local r=rndm
so("http://www.roblox.com/asset/?id="..hitsounds[r],part.Parent,1,1)
end
end)
for i = 0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(10),math.rad(-5),math.rad(-60)),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko *angles(math.rad(-10),math.rad(0),math.rad(60)),.3)
RW.C0=clerp(RW.C0,cf(1.5, 0.8, 0.2) * angles(math.rad(5), math.rad(-15), math.rad(112)), 0.3)
LW.C0=clerp(LW.C0,cf(-1.5, 0.5, 0) * angles(math.rad(30), math.rad(0), math.rad(-20)), 0.3)
RH.C0=clerp(RH.C0,cf(1.1,-1,0)*angles(math.rad(-5),math.rad(120),math.rad(-8)),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(5),math.rad(-60),math.rad(0)),.3)
end
so("http://www.roblox.com/asset/?id=199145433",prt1,1,1.1)
local v=it("BodyVelocity",Torso)
v.maxForce=Vector3.new(4e+005,4e+005,4e+005)*1
v.velocity=RootPart.CFrame.lookVector*100
function ppart(formfactor,parent,material,reflectance,transparency,brickcolor,name,size)
local fp=it("Part")
fp.formFactor=formfactor
fp.Parent=parent
fp.Reflectance=reflectance
fp.Transparency=transparency
fp.CanCollide=false
fp.Locked=true
fp.BrickColor=BrickColor.new(tostring(brickcolor))
fp.Name=name
fp.Size=size
fp.Position=Character.Torso.Position
NoOutline(fp)
fp.Material=material
fp:BreakJoints()
return fp
end
for i=5,1,-1 do
for i=1,4 do
local prt=ppart(3,workspace,"SmoothPlastic",0,0,"Maroon","Effect",vt(0.5,0.5,0.5))
prt.Anchored=true
prt.Position=prt1.Position
local msh=mesh("SpecialMesh",prt,"FileMesh","http://www.roblox.com/asset/?id=3270017",vt(0,0,0),vt(1,1,1))
coroutine.resume(coroutine.create(function(Part,Mesh)
for i=0,1,0.03 do
wait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(1,1,1)
end
Part.Parent=nil
end),prt,msh)
MagniDamage(prt,prt,15,5,15,-10,"Normal")
end
swait(3)
end
local hitbox = prt1.Touched:connect(function(hit)
Damagefunc(prt1,hit,5,10,15,"Normal",RootPart,.2,1,3)
end)
hitbox:disconnect()
for i = 0,1,0.1 do
swait()
local blcf = prt1.CFrame*cf(0,0,0)
if scfr and (prt1.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(5),math.rad(60)),.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(0),math.rad(0),math.rad(-60)),.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(-10), math.rad(60), math.rad(100)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-30), math.rad(0), math.rad(-15)), 0.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(0)),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(0)),.3)
end
v.Parent=nil
scfr=nil
attack = false
bounce=false
con:disconnect()
fx:disconnect()
end
function Execution()
local function spart(formfactor,parent,material,reflectance,transparency,brickcolor,name,size)
local fp=it("Part")
fp.formFactor=formfactor
fp.Parent=parent
fp.Reflectance=reflectance
fp.Transparency=transparency
fp.CanCollide=false
fp.Locked=true
fp.BrickColor=BrickColor.new(tostring(brickcolor))
fp.Name=name
fp.Size=size
fp.Position=Character.Torso.Position
NoOutline(fp)
fp.Material=material
fp:BreakJoints()
return fp
end
attack=true
local con1=prt1.Touched:connect(function(hit)
Damagefunc(prt1,hit,12,25,100,"Normal",RootPart,.2,1)
end)
for i=0,1,0.03 do
swait()
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(60)),.1)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(5),math.rad(0),math.rad(-60)),.1)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(math.rad(0),math.rad(90),math.rad(120)),.1)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(100), math.rad(0), math.rad(0)), 0.1)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(-10)),.1)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(0)),.2)
end
so("http://roblox.com/asset/?id=92597369",prt1,1,0.5)
so("http://roblox.com/asset/?id=28144425",Torso,1,0.5)
hitconasdf = prt1.Touched:connect(function(hit)
local hum12 = hit.Parent:FindFirstChild("Humanoid")
if hum12 and not hum12:IsDescendantOf(Character) then
so('http://roblox.com/asset/?id=154965973',prt1,1,0.8)
hitconasdf:disconnect()
end
end)
for i=0,1,0.03 do
swait()
local blcf = prt1.CFrame*CFrame.new(0,.5,0)
if scfr and (prt1.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(-90)),.2)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(5),math.rad(0),math.rad(60)),.2)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(math.rad(0),math.rad(-20),math.rad(70)),.2)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-40)), 0.2)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(-10)),.2)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(0)),.2)
end
attack=false
con1:disconnect()
scfr = nil
pcall(function()
hitconasdf:disconnect()
end)
end
function Destroyer()
attack=true
local hitsounds={"199149137","199149186","199149221","199149235","199149269","199149297"}
local con=prt1.Touched:connect(function(hit)
Damagefunc(prt1,hit,4,31,5,"Normal",RootPart,.2,1,3) end)
local fx=prt1.Touched:connect(function(part)
local human=part.Parent:findFirstChild("Humanoid")
if human~=nil and bounce==false then
bounce=true
local rndm=math.random(1,#hitsounds)
local r=rndm
so("http://www.roblox.com/asset/?id="..hitsounds[r],part.Parent,1,1)
end
end)
for i=0,1,.1 do
swait()
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(-30)),0.4)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(0),math.rad(0),math.rad(30)),.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(170), math.rad(0), math.rad(20)),0.4)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(25), math.rad(0), math.rad(-30)),0.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(105),math.rad(0)),0.4)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-75),math.rad(-10)),0.4)
end
Stomp()
for i = 0,1,0.1 do
swait()
local blcf = prt1.CFrame*CFrame.new(0,.5,0)
if scfr and (prt1.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(50)),0.4)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(10),math.rad(0),math.rad(-50)),.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(20), math.rad(0), math.rad(-10)),0.4)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-10)),0.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(80),math.rad(0)),0.4)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-100),math.rad(-10)),0.4)
end
attack=false
bounce=false
scfr=nil
con:disconnect()
fx:disconnect()
end
Mouse.Button1Down:connect(function()
if attack==false then
if attacktype==1 then
attack=true
attacktype=2
attackone()
elseif attacktype==2 then
attack=true
attacktype=1
attacktwo()
end
end
end)
skillattack1 = false
skillattack2 = false
skillattack3 = false
skillattack4 = false
Mouse.KeyDown:connect(function(k)
k=k:lower()
if skillattack1 == false and attack == false and k == 'z' then
b.Size=UDim2.new(0, 0, 0, 100)
Wave()
for i = 1, 50 do
skillattack1=true
b.Size=b.Size+UDim2.new(0, 4, 0, 0)
wait()
end
skillattack1=false
elseif skillattack2 == false and attack == false and k == 'v' then
d.Size=UDim2.new(0, 0, 0, 100)
Execution()
for i = 1, 200 do
skillattack2=true
d.Size=d.Size+UDim2.new(0, 1, 0, 0)
wait()
end
skillattack2=false
elseif skillattack3 == false and attack == false and k == 'c' then
e.Size=UDim2.new(0, 0, 0, 100)
Charge()
for i = 1, 50 do
skillattack3=true
e.Size=e.Size+UDim2.new(0, 4, 0, 0)
wait()
end
skillattack3=false
elseif skillattack4 == false and attack == false and k == 'x' then
c.Size=UDim2.new(0, 0, 0, 100)
Destroyer()
for i = 1, 100 do
skillattack4=true
c.Size=c.Size+UDim2.new(0, 2, 0, 0)
wait()
end
skillattack4=false
end
end)
local sine = 0
local change = 1
local val = 0
while true do
swait()
sine = sine + change
local torvel=(RootPart.Velocity*Vector3.new(1,0,1)).magnitude
local velderp=RootPart.Velocity.y
hitfloor,posfloor=rayCast(RootPart.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,4,Character)
if equipped==true or equipped==false then
if attack==false then
idle=idle+1
else
idle=0
end
if idle>=500 then
if attack==false then
--Sheath()
end
end
if RootPart.Velocity.y > 1 and hitfloor==nil then
Anim="Jump"
if attack==false then
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(0)),.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(-1.5),math.rad(0),math.rad(0)),.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(-15), math.rad(0), math.rad(15)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-15), math.rad(0), math.rad(-15)), 0.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(20),math.rad(90),math.rad(-20)),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(-20),math.rad(-90),math.rad(20)),.3)
end
elseif RootPart.Velocity.y < -1 and hitfloor==nil then
Anim="Fall"
if attack==false then
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(0),math.rad(0),math.rad(0)),.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(20),math.rad(0),math.rad(0)),.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(-15), math.rad(0), math.rad(25)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-15), math.rad(0), math.rad(-25)), 0.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(10),math.rad(90),math.rad(20)),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(-10),math.rad(-90),math.rad(-20)),.3)
end
elseif torvel<1 and hitfloor~=nil then
Anim="Idle"
if attack==false then
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(15),math.rad(0),math.rad(-10)),.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(0),math.rad(0),math.rad(0)),.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(40), math.rad(10), math.rad(-10)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(5), math.rad(0), math.rad(-5)), 0.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(80),math.rad(10)),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-70),math.rad(-20)),.3)
end
elseif torvel>2 and hitfloor~=nil then
Anim="Walk"
if attack==false then
change=3
RootJoint.C0 = clerp(RootJoint.C0,RootCF*cf(0,0,0)* angles(math.rad(20),math.rad(0),math.rad(00)),.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0,necko *angles(math.rad(-10),math.rad(0),math.rad(0)),.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(-30), math.rad(0), math.rad(20)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(10), math.rad(0), math.rad(-10)), 0.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(0),math.rad(90),math.rad(10)),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(0),math.rad(-90),math.rad(-10)),.3)
end
end
end
if #Effects>0 then
--table.insert(Effects,{prt,"Block1",delay})
for e=1,#Effects do
if Effects[e]~=nil then
--for j=1,#Effects[e] do
local Thing=Effects[e]
if Thing~=nil then
local Part=Thing[1]
local Mode=Thing[2]
local Delay=Thing[3]
local IncX=Thing[4]
local IncY=Thing[5]
local IncZ=Thing[6]
if Thing[1].Transparency<=1 then
if Thing[2]=="Block1" then
Thing[1].CFrame=Thing[1].CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
Mesh=Thing[1].Mesh
Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Cylinder" then
--local TheCF=Thing[1].CFrame
--Thing[1].CFrame=TheCF
Mesh=Thing[1].Mesh
Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Elec" then
Mesh=Thing[1].Mesh
Mesh.Scale=Mesh.Scale+vt(Thing[7],Thing[8],Thing[9])
--Thing[3]=Thing[3]+Delay
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
--print(Thing[1].Transparency)
--[[local prt=part(3,workspace,0,0,BrickColor.new("White"),"Part",vt(1,1,1))
prt.Anchored=true
game:GetService("Debris"):AddItem(prt,2)
xval=math.random()
yval=math.random()
zval=math.random()
msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(xval,yval,zval))
Effects[#Effects+1]={prt,"Elec",0.05,x,y,z,xval,yval,zval}]]
--[[coroutine.resume(coroutine.create(function(Part,Mesh,Frame,xvaal,yvaal,zvaal)
Part.CFrame=cf(Frame)*cf(math.random(-x,x),math.random(-y,y),math.random(-z,z))
for i=0,1,0.05 do
swait()
xvaal=xvaal-0.1
yvaal=yvaal-0.1
zvaal=zvaal-0.1
Mesh.Scale=vt(xvaal,yvaal,zvaal)
Part.Transparency=i
end
Part.Parent=nil
end),prt,msh,cff,xval,yval,zval)]]
end
else
Part.Parent=nil
table.remove(Effects,e)
end
end
--end
end
end
end
end
|
--------------------------------------------------------------------------------
-- Preconditions before ATF start
--------------------------------------------------------------------------------
local commonPreconditions = require('user_modules/shared_testcases/commonPreconditions')
--------------------------------------------------------------------------------
--Precondition: preparation connecttest_RAIvrUnavailable.lua
commonPreconditions:Connecttest_without_ExitBySDLDisconnect_WithoutOpenConnectionRegisterApp("connecttest_RAIvrUnavailable.lua")
f = assert(io.open('./user_modules/connecttest_RAIvrUnavailable.lua', "r"))
fileContent = f:read("*all")
f:close()
-- update hmiCapabilities in VR.GetLanguage
local pattern1 = 'ExpectRequest%s-%(%s-"%s-VR.GetLanguage%s-".-%{'
local ResultPattern2 = fileContent:match(pattern1)
if ResultPattern2 == nil then
print(" \27[31m ExpectRequest VR.GetLanguage call is not found in /user_modules/connecttest_RAIvrUnavailable.lua \27[0m ")
else
fileContent = string.gsub(fileContent, pattern1, 'ExpectRequest("VR.GetLanguage", false, {')
end
-- update hmiCapabilities in VR.ChangeRegistration
local pattern1 = 'ExpectRequest%s-%(%s-"%s-VR.ChangeRegistration%s-".-%{'
local ResultPattern2 = fileContent:match(pattern1)
if ResultPattern2 == nil then
print(" \27[31m ExpectRequest VR.ChangeRegistration call is not found in /user_modules/connecttest_RAIvrUnavailable.lua \27[0m ")
else
fileContent = string.gsub(fileContent, pattern1, 'ExpectRequest("VR.ChangeRegistration", false, {')
end
-- update hmiCapabilities in VR.GetSupportedLanguages
local pattern1 = 'ExpectRequest%s-%(%s-"%s-VR.GetSupportedLanguages%s-".-%{'
local ResultPattern2 = fileContent:match(pattern1)
if ResultPattern2 == nil then
print(" \27[31m ExpectRequest VR.GetSupportedLanguages call is not found in /user_modules/connecttest_RAIvrUnavailable.lua \27[0m ")
else
fileContent = string.gsub(fileContent, pattern1, 'ExpectRequest("VR.GetSupportedLanguages", false, {')
end
-- update hmiCapabilities in VR.GetCapabilities
local pattern1 = 'ExpectRequest%s-%(%s-"%s-VR.GetCapabilities%s-".-%{'
local ResultPattern2 = fileContent:match(pattern1)
if ResultPattern2 == nil then
print(" \27[31m ExpectRequest VR.GetCapabilities call is not found in /user_modules/connecttest_RAIvrUnavailable.lua \27[0m ")
else
fileContent = string.gsub(fileContent, pattern1, 'ExpectRequest("VR.GetCapabilities", false, {')
end
-- update hmiCapabilities in VR.IsReady
local pattern1 = 'ExpectRequest%s-%(%s-"%s-VR.IsReady%s-".-%{.-%}%s-%)'
local ResultPattern2 = fileContent:match(pattern1)
if ResultPattern2 == nil then
print(" \27[31m ExpectRequest VR.IsReady call is not found in /user_modules/connecttest_RAIvrUnavailable.lua \27[0m ")
else
fileContent = string.gsub(fileContent, pattern1, 'EXPECT_HMICALL("VR.IsReady"):Do(function(_,data) self.hmiConnection:SendError(data.id, data.method, "UNSUPPORTED_RESOURCE", "TTS is not available now") end)')
end
f = assert(io.open('./user_modules/connecttest_RAIvrUnavailable.lua', "w"))
f:write(fileContent)
f:close()
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Test = require('user_modules/connecttest_RAIvrUnavailable')
require('cardinalities')
local events = require('events')
local mobile_session = require('mobile_session')
local hmi_connection = require('hmi_connection')
local websocket = require('websocket_connection')
local module = require('testbase')
local mobile = require('mobile_connection')
local tcp = require('tcp_connection')
local file_connection = require('file_connection')
-- Precondition: removing user_modules/connecttest_RAIvrUnavailable.lua
function Test:Precondition_remove_user_connecttest()
os.execute( "rm -f ./user_modules/connecttest_RAIvrUnavailable.lua" )
end
--Requirement id in JAMA/or Jira ID: SDLAQ-CRS-1328
--Verification criteria: When vrSynonyms are sent and VR isn't avaliable at the moment on current HMI, UNSUPPORTED_RESOURCE is returned as a result of request. Info parameter provides additional information about the case. General request result success=true in case of no errors from other components.
--Begin Test case ResultCodeCheck
--Description: Check UNSUPPORTED_RESOURCE resultCode in case VR isn't avaliable at the moment on current HMI
function module:ConnectMobileStartSession()
local tcpConnection = tcp.Connection(config.mobileHost, config.mobilePort)
local fileConnection = file_connection.FileConnection("mobile.out", tcpConnection)
self.mobileConnection = mobile.MobileConnection(fileConnection)
self.mobileSession= mobile_session.MobileSession(
self,
self.mobileConnection)
event_dispatcher:AddConnection(self.mobileConnection)
self.mobileSession:ExpectEvent(events.connectedEvent, "Connection started")
self.mobileConnection:Connect()
self.mobileSession:StartService(7)
end
function Test:RegisterAppInterface_vrUnavailableUnsupportedResource()
--mobile side: RegisterAppInterface request
local CorIdRAI = self.mobileSession:SendRPC("RegisterAppInterface",
{
syncMsgVersion =
{
majorVersion = 2,
minorVersion = 2,
},
appName ="SyncProxyTester",
ttsName =
{
{
text ="SyncProxyTester",
type ="TEXT",
},
},
ngnMediaScreenAppName ="SPT",
vrSynonyms =
{
"VRSyncProxyTester",
},
isMediaApplication = true,
languageDesired ="EN-US",
hmiDisplayLanguageDesired ="EN-US",
appHMIType =
{
"DEFAULT",
},
appID ="123456",
deviceInfo =
{
hardware = "hardware",
firmwareRev = "firmwareRev",
os = "os",
osVersion = "osVersion",
carrier = "carrier",
maxNumberRFCOMMPorts = 5
}
})
--hmi side: expected BasicCommunication.OnAppRegistered
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered")
--mobile side: RegisterAppInterface response
EXPECT_RESPONSE(CorIdRAI, { success = true, resultCode = "UNSUPPORTED_RESOURCE"})
:Timeout(2000)
end
--End Test case ResultCodeCheck
|
package.path = './?/?.lua;./?/lua.lua;./?.lua;./tests/?.lua;./lua/includes/modules/?.lua;' .. package.path
_G.include = function (path)
return dofile ("lua/" .. path)
end
for k, v in next, require ('test_mock') do
_G[k] = v
end
for k, v in next, require ('test_ext_misc') do
_G[k] = v
end
require ('test_ext_table')
lu = require ('luaunit')
require ('metalog')
function lu.assertIsLessThan (a, b)
if not (a < b) then
return lu.fail (string.format ("expected: %s < %s", lu.private.prettystrPairs (a, b)))
end
end
lu.assertIsTable (metalog)
local function NOT_A_STRING () end
local function MAKE_LOGGING_SINK_NOCOLOR ()
local received
return function() return received end, {
onMessage = function (id, channel, level, ...)
received = {id=id, channel=channel, level=level, ...}
end,
translateColorMessages = true
}
end
local function MAKE_LOGGING_SINK_COLOR ()
local received, receivedColor
return function() return received, receivedColor end, {
onMessage = function (id, channel, level, ...)
received = {id=id, channel=channel, level=level, ...}
end,
onColorMessage = function (id, channel, level, ...)
receivedColor = {id=id, channel=channel, level=level, ...}
end,
}
end
local function MAKE_RANDOM_PAYLOAD ()
return { math.random(), Color (1, 2, 3), math.random(), Color (1, 2, 3), Color (1, 2, 3), math.random() }
end
function lu.assertArrayMatchesSequentially (a, b)
local i = 1
lu.assertIsTable (a)
lu.assertIsTable (b)
if #a ~= #b then
lu.fail (string.format ("expected: array lengths %d == %d", #a, #b))
end
while true do
if a[i] or b[i] then
if a[i] ~= b[i] then
local _a, _b = lu.private.prettystrPairs (a[i], b[i])
return lu.fail (string.format ("expected: %s == %s at array index %d\nExpected = %s\nReceived = %s", _a, _b, i, lu.private.prettystrPairs (a, b)))
end
lu.assertIs (a[i], b[i])
else
return
end
i = i + 1
end
end
function lu.assertArrayMatchesSequentiallyExceptColors (a, b)
local aNoColors, bNoColors = {}, {}
for i = 1, #a do
if not metalog.isColor (a[i]) then
table.insert (aNoColors, a[i])
end
end
for i = 1, #b do
if not metalog.isColor (b[i]) then
table.insert (bNoColors, b[i])
end
end
return lu.assertArrayMatchesSequentially (aNoColors, bNoColors)
end
--
TestLevelInterface = {}
function TestLevelInterface.testLevels ()
lu.assertIsNumber (METALOG_LEVEL_NONE)
lu.assertIsNumber (METALOG_LEVEL_FATAL)
lu.assertIsNumber (METALOG_LEVEL_ERROR)
lu.assertIsNumber (METALOG_LEVEL_WARN)
lu.assertIsNumber (METALOG_LEVEL_INFO)
lu.assertIsNumber (METALOG_LEVEL_DEBUG)
end
function TestLevelInterface.testLevelOrder ()
lu.assertIsLessThan (METALOG_LEVEL_NONE, METALOG_LEVEL_FATAL)
lu.assertIsLessThan (METALOG_LEVEL_FATAL, METALOG_LEVEL_ERROR)
lu.assertIsLessThan (METALOG_LEVEL_ERROR, METALOG_LEVEL_WARN)
lu.assertIsLessThan (METALOG_LEVEL_WARN, METALOG_LEVEL_INFO)
lu.assertIsLessThan (METALOG_LEVEL_INFO, METALOG_LEVEL_DEBUG)
end
function TestLevelInterface.testLevelNames ()
lu.assertIs (metalog.getLevelName (METALOG_LEVEL_NONE), "none")
lu.assertIs (metalog.getLevelName (METALOG_LEVEL_FATAL), "fatal")
lu.assertIs (metalog.getLevelName (METALOG_LEVEL_ERROR), "error")
lu.assertIs (metalog.getLevelName (METALOG_LEVEL_WARN), "warn")
lu.assertIs (metalog.getLevelName (METALOG_LEVEL_INFO), "info")
lu.assertIs (metalog.getLevelName (METALOG_LEVEL_DEBUG), "debug")
end
-- TestSinkInterface
TestSinkInterface = {}
function TestSinkInterface.setUp ()
metalog.unregisterLoggingSinks()
end
function TestSinkInterface.testSetLoggingSinkInvalidTypes ()
lu.assertErrorMsgContains ("Invalid type for sink", metalog.registerLoggingSink, "test")
lu.assertErrorMsgContains ("Invalid type for sink", metalog.registerLoggingSink, "test", false)
lu.assertErrorMsgContains ("Invalid type for sink", metalog.registerLoggingSink, "test", true)
lu.assertErrorMsgContains ("Invalid type for sink", metalog.registerLoggingSink, "test", 123)
lu.assertErrorMsgContains ("Invalid type for sink", metalog.registerLoggingSink, "test", function()end)
local validSink = {onMessage=function()end, onColorMessage=function()end}
lu.assertErrorMsgContains ("Invalid type for id", metalog.registerLoggingSink, nil, validSink)
lu.assertErrorMsgContains ("Invalid type for id", metalog.registerLoggingSink, true, validSink)
lu.assertErrorMsgContains ("Invalid type for id", metalog.registerLoggingSink, false, validSink)
lu.assertErrorMsgContains ("Invalid type for id", metalog.registerLoggingSink, 123, validSink)
lu.assertErrorMsgContains ("Invalid type for id", metalog.registerLoggingSink, function()end, validSink)
lu.assertErrorMsgContains ("Invalid type for id", metalog.registerLoggingSink, {}, validSink)
lu.assertErrorMsgContains ("Invalid type for sink.onMessage", metalog.registerLoggingSink, "test", {onColorMessage=function()end})
lu.assertErrorMsgContains ("Invalid type for sink.translateColorMessage", metalog.registerLoggingSink, "test", {onMessage = function()end, translateColorMessages = "wrong"})
lu.assertErrorMsgContains ("Invalid type for sink.translateColorMessage", metalog.registerLoggingSink, "test", {onMessage = function()end, translateColorMessages = function()end})
lu.assertErrorMsgContains ("Invalid type for sink.translateColorMessage", metalog.registerLoggingSink, "test", {onMessage = function()end, translateColorMessages = 123})
lu.assertErrorMsgContains ("Invalid type for sink.translateColorMessage", metalog.registerLoggingSink, "test", {onMessage = function()end, translateColorMessages = {}})
lu.assertErrorMsgContains ("Invalid sink configuration", metalog.registerLoggingSink, "test", {onMessage = function()end})
lu.assertErrorMsgContains ("Invalid sink configuration", metalog.registerLoggingSink, "test", {onMessage = function()end, translateColorMessages = false})
metalog.registerLoggingSink ("test", validSink)
metalog.registerLoggingSink ("test", {onMessage = function()end, translateColorMessages = true})
end
function TestSinkInterface.testGetLoggingSink ()
local id = string.format ("Rnd%f", math.random())
lu.assertIsNil (metalog.getLoggingSink (id..1))
lu.assertIsNil (metalog.getLoggingSink (id..2))
local sink1 = {onMessage = function()end, translateColorMessages = true}
local sink2 = {onMessage = function()end, translateColorMessages = true}
metalog.registerLoggingSink (id..1, sink1)
metalog.registerLoggingSink (id..2, sink2)
lu.assertIs (metalog.getLoggingSink (id..1), sink1)
lu.assertIs (metalog.getLoggingSink (id..2), sink2)
metalog.unregisterLoggingSink (id..1)
lu.assertIsNil (metalog.getLoggingSink (id..1))
lu.assertIs (metalog.getLoggingSink (id..2), sink2)
metalog.unregisterLoggingSinks()
lu.assertIsNil (metalog.getLoggingSink (id..1))
lu.assertIsNil (metalog.getLoggingSink (id..2))
end
function TestSinkInterface.testErroringLoggingSink ()
lu.assertIsNil (metalog.getLoggingSink ("testing"))
local A, B
local sinkA = { onMessage = function (id) A = id end, translateColorMessages = true }
local sinkB = { onMessage = function (id) B = id end, translateColorMessages = true }
local sinkErr = { onMessage = function () error ("ERROR_ALWAYS") end, translateColorMessages = true }
metalog.registerLoggingSink ("testing1", sinkA)
metalog.registerLoggingSink ("testing2", sinkErr)
metalog.registerLoggingSink ("testing3", sinkB)
lu.assertIs (metalog.getLoggingSink ("testing1"), sinkA)
lu.assertIs (metalog.getLoggingSink ("testing2"), sinkErr)
lu.assertIs (metalog.getLoggingSink ("testing3"), sinkB)
metalog.debug ("example", nil, "An example log message.")
lu.assertIs (metalog.getLoggingSink ("testing1"), sinkA)
lu.assertIsNil (metalog.getLoggingSink ("testing2"))
lu.assertIs (metalog.getLoggingSink ("testing3"), sinkB)
lu.assertIs (A, "example")
lu.assertIs (B, "example")
end
TestLoggingStatic = {}
function TestLoggingStatic.setUp ()
metalog.unregisterLoggingSinks()
end
local function testCaseForLogStatic (testLevel, testChannel)
do -- nocolor sink with translateColorMessages fallback
local get, sink = MAKE_LOGGING_SINK_NOCOLOR()
metalog.registerLoggingSink ("testing", sink)
do -- nocolor message
local payload = MAKE_RANDOM_PAYLOAD()
metalog.log ("test:id", testChannel, testLevel, table.unpack (payload))
lu.assertErrorMsgContains ("Invalid level", metalog.log, "test:id", testChannel, NOT_A_STRING, table.unpack (payload))
lu.assertErrorMsgContains ("Invalid type for channel", metalog.log, "test:id", NOT_A_STRING, testLevel, table.unpack (payload))
local received = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, testLevel)
lu.assertArrayMatchesSequentially (received, payload)
end
do -- color message
local payload = MAKE_RANDOM_PAYLOAD()
metalog.logColor ("test:id", testChannel, testLevel, table.unpack (payload))
lu.assertErrorMsgContains ("Invalid level", metalog.logColor, "test:id", testChannel, NOT_A_STRING, table.unpack (payload))
lu.assertErrorMsgContains ("Invalid type for channel", metalog.logColor, "test:id", NOT_A_STRING, testLevel, table.unpack (payload))
local received = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, testLevel)
lu.assertArrayMatchesSequentiallyExceptColors (received, payload)
end
end
do -- color sink
local get, sink = MAKE_LOGGING_SINK_COLOR()
metalog.registerLoggingSink ("testing", sink)
local payload = MAKE_RANDOM_PAYLOAD()
local payloadColor = MAKE_RANDOM_PAYLOAD()
metalog.log ("test:id", testChannel, testLevel, table.unpack (payload))
metalog.logColor ("test:id", testChannel, testLevel, table.unpack (payloadColor))
local received, receivedColor = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, testLevel)
lu.assertArrayMatchesSequentially (received, payload)
lu.assertIs (receivedColor.id, "test:id")
lu.assertIs (receivedColor.channel, testChannel)
lu.assertIs (receivedColor.level, testLevel)
lu.assertArrayMatchesSequentially (receivedColor, payloadColor)
end
end
function TestLoggingStatic.testLogFatal () testCaseForLogStatic (METALOG_LEVEL_FATAL) end
function TestLoggingStatic.testLogError () testCaseForLogStatic (METALOG_LEVEL_ERROR) end
function TestLoggingStatic.testLogWarn () testCaseForLogStatic (METALOG_LEVEL_WARN) end
function TestLoggingStatic.testLogInfo () testCaseForLogStatic (METALOG_LEVEL_INFO) end
function TestLoggingStatic.testLogDebug () testCaseForLogStatic (METALOG_LEVEL_DEBUG) end
function TestLoggingStatic.testLogFatalChannel () testCaseForLogStatic (METALOG_LEVEL_FATAL, "test_channel") end
function TestLoggingStatic.testLogErrorChannel () testCaseForLogStatic (METALOG_LEVEL_ERROR, "test_channel") end
function TestLoggingStatic.testLogWarnChannel () testCaseForLogStatic (METALOG_LEVEL_WARN , "test_channel") end
function TestLoggingStatic.testLogInfoChannel () testCaseForLogStatic (METALOG_LEVEL_INFO , "test_channel") end
function TestLoggingStatic.testLogDebugChannel () testCaseForLogStatic (METALOG_LEVEL_DEBUG, "test_channel") end
local function testCaseForLevelStatic (func, funcColor, expectedLevel, testChannel)
do -- nocolor sink with translateColorMessages fallback
local get, sink = MAKE_LOGGING_SINK_NOCOLOR()
metalog.registerLoggingSink ("testing", sink)
do -- nocolor message
local payload = MAKE_RANDOM_PAYLOAD()
func ("test:id", testChannel, table.unpack (payload))
lu.assertErrorMsgContains ('Invalid type for channel', func, "test:id", NOT_A_STRING, table.unpack (payload))
local received = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, expectedLevel)
lu.assertArrayMatchesSequentially (received, payload)
end
do -- color message
local payload = MAKE_RANDOM_PAYLOAD()
funcColor ("test:id", testChannel, table.unpack (payload))
lu.assertErrorMsgContains ('Invalid type for channel', funcColor, "test:id", NOT_A_STRING, table.unpack (payload))
local received = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, expectedLevel)
lu.assertArrayMatchesSequentiallyExceptColors (received, payload)
end
end
do -- color sink
local get, sink = MAKE_LOGGING_SINK_COLOR()
metalog.registerLoggingSink ("testing", sink)
local payload = MAKE_RANDOM_PAYLOAD()
local payloadColor = MAKE_RANDOM_PAYLOAD()
func ("test:id", testChannel, table.unpack (payload))
funcColor ("test:id", testChannel, table.unpack (payloadColor))
local received, receivedColor = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, expectedLevel)
lu.assertArrayMatchesSequentially (received, payload)
lu.assertIs (receivedColor.id, "test:id")
lu.assertIs (receivedColor.channel, testChannel)
lu.assertIs (receivedColor.level, expectedLevel)
lu.assertArrayMatchesSequentially (receivedColor, payloadColor)
end
end
function TestLoggingStatic.testFatal () testCaseForLevelStatic (metalog.fatal, metalog.fatalColor, METALOG_LEVEL_FATAL) end
function TestLoggingStatic.testError () testCaseForLevelStatic (metalog.error, metalog.errorColor, METALOG_LEVEL_ERROR) end
function TestLoggingStatic.testWarn () testCaseForLevelStatic (metalog.warn, metalog.warnColor, METALOG_LEVEL_WARN) end
function TestLoggingStatic.testInfo () testCaseForLevelStatic (metalog.info, metalog.infoColor, METALOG_LEVEL_INFO) end
function TestLoggingStatic.testDebug () testCaseForLevelStatic (metalog.debug, metalog.debugColor, METALOG_LEVEL_DEBUG) end
function TestLoggingStatic.testFatalChannel () testCaseForLevelStatic (metalog.fatal, metalog.fatalColor, METALOG_LEVEL_FATAL, "test_channel") end
function TestLoggingStatic.testErrorChannel () testCaseForLevelStatic (metalog.error, metalog.errorColor, METALOG_LEVEL_ERROR, "test_channel") end
function TestLoggingStatic.testWarnChannel () testCaseForLevelStatic (metalog.warn, metalog.warnColor, METALOG_LEVEL_WARN, "test_channel") end
function TestLoggingStatic.testInfoChannel () testCaseForLevelStatic (metalog.info, metalog.infoColor, METALOG_LEVEL_INFO, "test_channel") end
function TestLoggingStatic.testDebugChannel () testCaseForLevelStatic (metalog.debug, metalog.debugColor, METALOG_LEVEL_DEBUG, "test_channel") end
local function testCaseForLogStaticFormat (testLevel, testChannel)
local received
metalog.registerLoggingSink ("testing", {
onMessage = function (id, channel, level, ...)
received = {id=id, channel=channel, level=level, ...}
end,
translateColorMessages = true
})
local payload = { math.random(), math.random(), "this one should be ignored" }
metalog.logFormat ("test:id", testChannel, testLevel, "random numbers: %f %f", table.unpack (payload))
lu.assertErrorMsgContains ("Invalid level", metalog.logFormat, "test:id", testChannel, NOT_A_STRING, "random numbers: %f %f", table.unpack (payload))
lu.assertErrorMsgContains ("Invalid type for channel", metalog.logFormat, "test:id", NOT_A_STRING, testLevel, "random numbers: %f %f", table.unpack (payload))
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, testLevel)
lu.assertIs (received[1], string.format ("random numbers: %f %f", table.unpack (payload)))
lu.assertIsNil (received[2])
lu.assertIsNil (received[3])
end
function TestLoggingStatic.testLogFatalFormat () testCaseForLogStaticFormat (METALOG_LEVEL_FATAL) end
function TestLoggingStatic.testLogErrorFormat () testCaseForLogStaticFormat (METALOG_LEVEL_ERROR) end
function TestLoggingStatic.testLogWarnFormat () testCaseForLogStaticFormat (METALOG_LEVEL_WARN) end
function TestLoggingStatic.testLogInfoFormat () testCaseForLogStaticFormat (METALOG_LEVEL_INFO) end
function TestLoggingStatic.testLogDebugFormat () testCaseForLogStaticFormat (METALOG_LEVEL_DEBUG) end
function TestLoggingStatic.testLogFatalFormatChannel () testCaseForLogStaticFormat (METALOG_LEVEL_FATAL, "test_channel") end
function TestLoggingStatic.testLogErrorFormatChannel () testCaseForLogStaticFormat (METALOG_LEVEL_ERROR, "test_channel") end
function TestLoggingStatic.testLogWarnFormatChannel () testCaseForLogStaticFormat (METALOG_LEVEL_WARN, "test_channel") end
function TestLoggingStatic.testLogInfoFormatChannel () testCaseForLogStaticFormat (METALOG_LEVEL_INFO, "test_channel") end
function TestLoggingStatic.testLogDebugFormatChannel () testCaseForLogStaticFormat (METALOG_LEVEL_DEBUG, "test_channel") end
local function testCaseForLevelStaticFormat (func, expectedLevel, testChannel)
local received
metalog.registerLoggingSink ("testing", {
onMessage = function (id, channel, level, ...)
received = {id=id, channel=channel, level=level, ...}
end,
translateColorMessages = true
})
local payload = { math.random(), math.random(), "this one should be ignored" }
func ("test:id", testChannel, "random numbers: %f %f", table.unpack (payload))
lu.assertErrorMsgContains ("Invalid type for channel", func, "test:id", NOT_A_STRING, table.unpack (payload))
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, expectedLevel)
lu.assertIs (received[1], string.format ("random numbers: %f %f", table.unpack (payload)))
lu.assertIsNil (received[2])
lu.assertIsNil (received[3])
end
function TestLoggingStatic.testFatalFormat () testCaseForLevelStaticFormat (metalog.fatalFormat, METALOG_LEVEL_FATAL) end
function TestLoggingStatic.testErrorFormat () testCaseForLevelStaticFormat (metalog.errorFormat, METALOG_LEVEL_ERROR) end
function TestLoggingStatic.testWarnFormat () testCaseForLevelStaticFormat (metalog.warnFormat, METALOG_LEVEL_WARN) end
function TestLoggingStatic.testInfoFormat () testCaseForLevelStaticFormat (metalog.infoFormat, METALOG_LEVEL_INFO) end
function TestLoggingStatic.testDebugFormat () testCaseForLevelStaticFormat (metalog.debugFormat, METALOG_LEVEL_DEBUG) end
function TestLoggingStatic.testFatalFormatChannel () testCaseForLevelStaticFormat (metalog.fatalFormat, METALOG_LEVEL_FATAL, "test_channel") end
function TestLoggingStatic.testErrorFormatChannel () testCaseForLevelStaticFormat (metalog.errorFormat, METALOG_LEVEL_ERROR, "test_channel") end
function TestLoggingStatic.testWarnFormatChannel () testCaseForLevelStaticFormat (metalog.warnFormat, METALOG_LEVEL_WARN, "test_channel") end
function TestLoggingStatic.testInfoFormatChannel () testCaseForLevelStaticFormat (metalog.infoFormat, METALOG_LEVEL_INFO, "test_channel") end
function TestLoggingStatic.testDebugFormatChannel () testCaseForLevelStaticFormat (metalog.debugFormat, METALOG_LEVEL_DEBUG, "test_channel") end
TestLoggingObject = {}
function TestLoggingObject.setUp ()
metalog.unregisterLoggingSinks()
end
local function testCaseForLevelObject (method, methodColor, expectedLevel, testChannel)
do -- nocolor sink with translateColorMessages fallback
local get, sink = MAKE_LOGGING_SINK_NOCOLOR()
metalog.registerLoggingSink ("testing", sink)
do -- nocolor message
local payload = MAKE_RANDOM_PAYLOAD()
local logger = metalog ("test:id", testChannel)
logger[method] (logger, table.unpack (payload))
local received = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, expectedLevel)
lu.assertArrayMatchesSequentially (received, payload)
end
do -- color message
local payload = MAKE_RANDOM_PAYLOAD()
local logger = metalog ("test:id", testChannel)
logger[methodColor] (logger, table.unpack (payload))
local received = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, expectedLevel)
lu.assertArrayMatchesSequentiallyExceptColors (received, payload)
end
end
do -- color sink
local get, sink = MAKE_LOGGING_SINK_COLOR()
metalog.registerLoggingSink ("testing", sink)
local payload = MAKE_RANDOM_PAYLOAD()
local payloadColor = MAKE_RANDOM_PAYLOAD()
local logger = metalog ("test:id", testChannel)
logger[method] (logger, table.unpack (payload))
logger[methodColor] (logger, table.unpack (payloadColor))
local received, receivedColor = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, expectedLevel)
lu.assertArrayMatchesSequentially (received, payload)
lu.assertIs (receivedColor.id, "test:id")
lu.assertIs (receivedColor.channel, testChannel)
lu.assertIs (receivedColor.level, expectedLevel)
lu.assertArrayMatchesSequentially (receivedColor, payloadColor)
end
end
function TestLoggingObject.testFatal () testCaseForLevelObject ("fatal", "fatalColor", METALOG_LEVEL_FATAL) end
function TestLoggingObject.testError () testCaseForLevelObject ("error", "errorColor", METALOG_LEVEL_ERROR) end
function TestLoggingObject.testWarn () testCaseForLevelObject ("warn", "warnColor", METALOG_LEVEL_WARN) end
function TestLoggingObject.testInfo () testCaseForLevelObject ("info", "infoColor", METALOG_LEVEL_INFO) end
function TestLoggingObject.testDebug () testCaseForLevelObject ("debug", "debugColor", METALOG_LEVEL_DEBUG) end
function TestLoggingObject.testFatalChannel () testCaseForLevelObject ("fatal", "fatalColor", METALOG_LEVEL_FATAL, "test_channel") end
function TestLoggingObject.testErrorChannel () testCaseForLevelObject ("error", "errorColor", METALOG_LEVEL_ERROR, "test_channel") end
function TestLoggingObject.testWarnChannel () testCaseForLevelObject ("warn", "warnColor", METALOG_LEVEL_WARN, "test_channel") end
function TestLoggingObject.testInfoChannel () testCaseForLevelObject ("info", "infoColor", METALOG_LEVEL_INFO, "test_channel") end
function TestLoggingObject.testDebugChannel () testCaseForLevelObject ("debug", "debugColor", METALOG_LEVEL_DEBUG, "test_channel") end
function TestLoggingObject.testInvalidChannel () lu.assertErrorMsgContains ('expected optional string', metalog, "test:id", NOT_A_STRING) end
local function testCaseForLevelObjectFormat (method, expectedLevel, testChannel)
local get, sink = MAKE_LOGGING_SINK_NOCOLOR()
metalog.registerLoggingSink ("testing", sink)
local payload = { math.random(), math.random(), "this one should be ignored" }
local logger = metalog ("test:id", testChannel)
logger[method] (logger, "random numbers: %f %f", table.unpack (payload))
local received = get()
lu.assertIs (received.id, "test:id")
lu.assertIs (received.channel, testChannel)
lu.assertIs (received.level, expectedLevel)
lu.assertIs (received[1], string.format ("random numbers: %f %f", table.unpack (payload)))
lu.assertIsNil (received[2])
lu.assertIsNil (received[3])
end
function TestLoggingObject.testFatalFormat () testCaseForLevelObjectFormat ("fatalFormat", METALOG_LEVEL_FATAL) end
function TestLoggingObject.testErrorFormat () testCaseForLevelObjectFormat ("errorFormat", METALOG_LEVEL_ERROR) end
function TestLoggingObject.testWarnFormat () testCaseForLevelObjectFormat ("warnFormat", METALOG_LEVEL_WARN) end
function TestLoggingObject.testInfoFormat () testCaseForLevelObjectFormat ("infoFormat", METALOG_LEVEL_INFO) end
function TestLoggingObject.testDebugFormat () testCaseForLevelObjectFormat ("debugFormat", METALOG_LEVEL_DEBUG) end
function TestLoggingObject.testFatalFormatChannel () testCaseForLevelObjectFormat ("fatalFormat", METALOG_LEVEL_FATAL, "test_channel") end
function TestLoggingObject.testErrorFormatChannel () testCaseForLevelObjectFormat ("errorFormat", METALOG_LEVEL_ERROR, "test_channel") end
function TestLoggingObject.testWarnFormatChannel () testCaseForLevelObjectFormat ("warnFormat", METALOG_LEVEL_WARN, "test_channel") end
function TestLoggingObject.testInfoFormatChannel () testCaseForLevelObjectFormat ("infoFormat", METALOG_LEVEL_INFO, "test_channel") end
function TestLoggingObject.testDebugFormatChannel () testCaseForLevelObjectFormat ("debugFormat", METALOG_LEVEL_DEBUG, "test_channel") end
function TestLoggingObject.testFatalFormatInvalidChannel () lu.assertErrorMsgContains ('expected optional string', testCaseForLevelObjectFormat, "fatalFormat", METALOG_LEVEL_FATAL, NOT_A_STRING) end
function TestLoggingObject.testErrorFormatInvalidChannel () lu.assertErrorMsgContains ('expected optional string', testCaseForLevelObjectFormat, "errorFormat", METALOG_LEVEL_ERROR, NOT_A_STRING) end
function TestLoggingObject.testWarnFormatInvalidChannel () lu.assertErrorMsgContains ('expected optional string', testCaseForLevelObjectFormat, "warnFormat", METALOG_LEVEL_WARN, NOT_A_STRING) end
function TestLoggingObject.testInfoFormatInvalidChannel () lu.assertErrorMsgContains ('expected optional string', testCaseForLevelObjectFormat, "infoFormat", METALOG_LEVEL_INFO, NOT_A_STRING) end
function TestLoggingObject.testDebugFormatInvalidChannel () lu.assertErrorMsgContains ('expected optional string', testCaseForLevelObjectFormat, "debugFormat", METALOG_LEVEL_DEBUG, NOT_A_STRING) end
TestConsolePrinter = {}
function TestConsolePrinter.setUp ()
_G.__CONSOLE_PRINTER_NONE = false
__MOCK_GMOD_RESET_CONVAR ("metalog_console_log_level")
end
function TestConsolePrinter.testDefaultIsPreserved ()
local ml_console_printer = dofile ("lua/metalog_handlers/ml_console_printer.lua")
local before = CreateConVar ("metalog_console_log_level"):GetString ()
ml_console_printer.onMessage ("test:id", nil, METALOG_LEVEL_DEBUG, "test message")
local after = CreateConVar ("metalog_console_log_level"):GetString ()
lu.assertIs (after, before)
end
function TestConsolePrinter.testValidValueIsPreserved ()
local ml_console_printer = dofile ("lua/metalog_handlers/ml_console_printer.lua")
local default = CreateConVar ("metalog_console_log_level"):GetString ()
CreateConVar ("metalog_console_log_level"):SetString ("warn")
local before = CreateConVar ("metalog_console_log_level"):GetString ()
lu.assertNotIs (before, default)
ml_console_printer.onMessage ("test:id", nil, METALOG_LEVEL_DEBUG, "test message")
local after = CreateConVar ("metalog_console_log_level"):GetString ()
lu.assertIs (after, before)
end
function TestConsolePrinter.testInvalidValueIsResetToDefault ()
local ml_console_printer = dofile ("lua/metalog_handlers/ml_console_printer.lua")
local default = CreateConVar ("metalog_console_log_level"):GetString ()
CreateConVar ("metalog_console_log_level"):SetString ("ThisIsInvalid")
ml_console_printer.onMessage ("test:id", nil, METALOG_LEVEL_DEBUG, "test message")
local after = CreateConVar ("metalog_console_log_level"):GetString ()
lu.assertIs (after, default)
end
function TestConsolePrinter.testPrinting ()
local ml_console_printer = dofile ("lua/metalog_handlers/ml_console_printer.lua")
local old_print = print
local received
print = function (...) received = {...} end -- luacheck: ignore
ml_console_printer.onMessage ("test:id", nil, METALOG_LEVEL_INFO, "test message")
print = old_print -- luacheck: ignore
lu.assertItemsEquals (received, {"test message"})
end
function TestConsolePrinter.tearDown ()
_G.__CONSOLE_PRINTER_NONE = true
__MOCK_GMOD_RESET_CONVAR ("metalog_console_log_level")
end
os.exit (lu.LuaUnit.run())
|
local loaded, scene -- ./ecs/ecs.can:51
if ... then -- ./ecs/ecs.can:52
loaded, scene = pcall(require, (...):match("^(.-)ecs") .. "scene") -- ./ecs/ecs.can:52
end -- ./ecs/ecs.can:52
if not loaded then -- ./ecs/ecs.can:53
scene = nil -- ./ecs/ecs.can:53
end -- ./ecs/ecs.can:53
local ecs -- ./ecs/ecs.can:55
local recDestroySystems -- ./ecs/ecs.can:102
recDestroySystems = function(system) -- ./ecs/ecs.can:102
for i = # system["systems"], 1, - 1 do -- ./ecs/ecs.can:103
local s -- ./ecs/ecs.can:104
s = system["systems"][i] -- ./ecs/ecs.can:104
recDestroySystems(s) -- ./ecs/ecs.can:105
s:onDestroy() -- ./ecs/ecs.can:106
system["systems"][i] = nil -- ./ecs/ecs.can:107
if s["name"] then -- ./ecs/ecs.can:108
system["world"]["s"][s["name"]] = nil -- ./ecs/ecs.can:109
end -- ./ecs/ecs.can:109
end -- ./ecs/ecs.can:109
end -- ./ecs/ecs.can:109
local recCallOnRemoveFromWorld -- ./ecs/ecs.can:114
recCallOnRemoveFromWorld = function(world, systems) -- ./ecs/ecs.can:114
for _, s in ipairs(systems) do -- ./ecs/ecs.can:115
s:clear() -- ./ecs/ecs.can:116
recCallOnRemoveFromWorld(world, s["systems"]) -- ./ecs/ecs.can:117
s:onRemoveFromWorld(world) -- ./ecs/ecs.can:118
end -- ./ecs/ecs.can:118
end -- ./ecs/ecs.can:118
local nextEntity -- ./ecs/ecs.can:123
nextEntity = function(s) -- ./ecs/ecs.can:123
if s[1] then -- ./ecs/ecs.can:124
local var -- ./ecs/ecs.can:125
var = s[1][1] -- ./ecs/ecs.can:125
s[1] = s[1][2] -- ./ecs/ecs.can:126
return var -- ./ecs/ecs.can:127
else -- ./ecs/ecs.can:127
return nil -- ./ecs/ecs.can:129
end -- ./ecs/ecs.can:129
end -- ./ecs/ecs.can:129
local copy -- ./ecs/ecs.can:135
copy = function(a, b, cache) -- ./ecs/ecs.can:135
if cache == nil then cache = {} end -- ./ecs/ecs.can:135
for k, v in pairs(a) do -- ./ecs/ecs.can:136
if type(v) == "table" then -- ./ecs/ecs.can:137
if b[k] == nil then -- ./ecs/ecs.can:138
if cache[v] then -- ./ecs/ecs.can:139
b[k] = cache[v] -- ./ecs/ecs.can:140
else -- ./ecs/ecs.can:140
cache[v] = {} -- ./ecs/ecs.can:142
b[k] = cache[v] -- ./ecs/ecs.can:143
copy(v, b[k], cache) -- ./ecs/ecs.can:144
setmetatable(b[k], getmetatable(v)) -- ./ecs/ecs.can:145
end -- ./ecs/ecs.can:145
elseif type(b[k]) == "table" then -- ./ecs/ecs.can:147
copy(v, b[k], cache) -- ./ecs/ecs.can:148
end -- ./ecs/ecs.can:148
elseif b[k] == nil then -- ./ecs/ecs.can:150
b[k] = v -- ./ecs/ecs.can:151
end -- ./ecs/ecs.can:151
end -- ./ecs/ecs.can:151
end -- ./ecs/ecs.can:151
local system_mt -- ./ecs/ecs.can:217
system_mt = { -- ./ecs/ecs.can:217
["name"] = nil, -- ./ecs/ecs.can:231
["systems"] = nil, -- ./ecs/ecs.can:239
["interval"] = false, -- ./ecs/ecs.can:245
["active"] = true, -- ./ecs/ecs.can:249
["visible"] = true, -- ./ecs/ecs.can:253
["component"] = nil, -- ./ecs/ecs.can:260
["default"] = nil, -- ./ecs/ecs.can:270
["filter"] = function(self, e) -- ./ecs/ecs.can:291
return false -- ./ecs/ecs.can:291
end, -- ./ecs/ecs.can:291
["compare"] = function(self, e1, e2) -- ./ecs/ecs.can:303
return true -- ./ecs/ecs.can:303
end, -- ./ecs/ecs.can:303
["onAdd"] = function(self, e, c) -- ./ecs/ecs.can:309
-- ./ecs/ecs.can:309
end, -- ./ecs/ecs.can:309
["onRemove"] = function(self, e, c) -- ./ecs/ecs.can:314
-- ./ecs/ecs.can:314
end, -- ./ecs/ecs.can:314
["onInstance"] = function(self) -- ./ecs/ecs.can:317
-- ./ecs/ecs.can:317
end, -- ./ecs/ecs.can:317
["onAddToWorld"] = function(self, world) -- ./ecs/ecs.can:321
-- ./ecs/ecs.can:321
end, -- ./ecs/ecs.can:321
["onRemoveFromWorld"] = function(self, world) -- ./ecs/ecs.can:325
-- ./ecs/ecs.can:325
end, -- ./ecs/ecs.can:325
["onDestroy"] = function(self) -- ./ecs/ecs.can:328
-- ./ecs/ecs.can:328
end, -- ./ecs/ecs.can:328
["onUpdate"] = function(self, dt) -- ./ecs/ecs.can:333
-- ./ecs/ecs.can:333
end, -- ./ecs/ecs.can:333
["onDraw"] = function(self) -- ./ecs/ecs.can:337
-- ./ecs/ecs.can:337
end, -- ./ecs/ecs.can:337
["process"] = function(self, e, c, dt) -- ./ecs/ecs.can:344
-- ./ecs/ecs.can:344
end, -- ./ecs/ecs.can:344
["render"] = function(self, e, c) -- ./ecs/ecs.can:350
-- ./ecs/ecs.can:350
end, -- ./ecs/ecs.can:350
["onUpdateEnd"] = function(self, dt) -- ./ecs/ecs.can:355
-- ./ecs/ecs.can:355
end, -- ./ecs/ecs.can:355
["onDrawEnd"] = function(self) -- ./ecs/ecs.can:359
-- ./ecs/ecs.can:359
end, -- ./ecs/ecs.can:359
["world"] = nil, -- ./ecs/ecs.can:369
["w"] = nil, -- ./ecs/ecs.can:373
["entityCount"] = 0, -- ./ecs/ecs.can:377
["s"] = nil, -- ./ecs/ecs.can:381
["_first"] = nil, -- ./ecs/ecs.can:387
["_previous"] = nil, -- ./ecs/ecs.can:391
["_waited"] = 0, -- ./ecs/ecs.can:394
["add"] = function(self, e, ...) -- ./ecs/ecs.can:415
if e ~= nil and not self["_previous"][e] and self:filter(e) then -- ./ecs/ecs.can:416
if self["component"] and self["default"] then -- ./ecs/ecs.can:418
copy({ [self["component"]] = self["default"] }, e) -- ./ecs/ecs.can:419
end -- ./ecs/ecs.can:419
if self["_first"] == nil then -- ./ecs/ecs.can:422
self["_first"] = { -- ./ecs/ecs.can:423
e, -- ./ecs/ecs.can:423
nil -- ./ecs/ecs.can:423
} -- ./ecs/ecs.can:423
self["_previous"][e] = true -- ./ecs/ecs.can:424
elseif self:compare(e, self["_first"][1]) then -- ./ecs/ecs.can:425
local nxt -- ./ecs/ecs.can:426
nxt = self["_first"] -- ./ecs/ecs.can:426
self["_first"] = { -- ./ecs/ecs.can:427
e, -- ./ecs/ecs.can:427
nxt -- ./ecs/ecs.can:427
} -- ./ecs/ecs.can:427
self["_previous"][e] = true -- ./ecs/ecs.can:428
self["_previous"][nxt[1]] = self["_first"] -- ./ecs/ecs.can:429
else -- ./ecs/ecs.can:429
local entity -- ./ecs/ecs.can:431
entity = self["_first"] -- ./ecs/ecs.can:431
while entity[2] ~= nil do -- ./ecs/ecs.can:432
if self:compare(e, entity[2][1]) then -- ./ecs/ecs.can:433
local nxt -- ./ecs/ecs.can:434
nxt = entity[2] -- ./ecs/ecs.can:434
entity[2] = { -- ./ecs/ecs.can:435
e, -- ./ecs/ecs.can:435
nxt -- ./ecs/ecs.can:435
} -- ./ecs/ecs.can:435
self["_previous"][e] = entity -- ./ecs/ecs.can:436
self["_previous"][nxt[1]] = entity[2] -- ./ecs/ecs.can:437
break -- ./ecs/ecs.can:438
end -- ./ecs/ecs.can:438
entity = entity[2] -- ./ecs/ecs.can:440
end -- ./ecs/ecs.can:440
if entity[2] == nil then -- ./ecs/ecs.can:442
entity[2] = { -- ./ecs/ecs.can:443
e, -- ./ecs/ecs.can:443
nil -- ./ecs/ecs.can:443
} -- ./ecs/ecs.can:443
self["_previous"][e] = entity -- ./ecs/ecs.can:444
end -- ./ecs/ecs.can:444
end -- ./ecs/ecs.can:444
self["entityCount"] = self["entityCount"] + (1) -- ./ecs/ecs.can:448
self:onAdd(e, e[self["component"]]) -- ./ecs/ecs.can:449
if self["_previous"][e] then -- ./ecs/ecs.can:451
for _, s in ipairs(self["systems"]) do -- ./ecs/ecs.can:452
s:add(e) -- ./ecs/ecs.can:453
end -- ./ecs/ecs.can:453
end -- ./ecs/ecs.can:453
end -- ./ecs/ecs.can:453
if ... then -- ./ecs/ecs.can:457
return e, self:add(...) -- ./ecs/ecs.can:458
else -- ./ecs/ecs.can:458
return e -- ./ecs/ecs.can:460
end -- ./ecs/ecs.can:460
end, -- ./ecs/ecs.can:460
["remove"] = function(self, e, ...) -- ./ecs/ecs.can:475
if e ~= nil then -- ./ecs/ecs.can:476
if self["_previous"][e] then -- ./ecs/ecs.can:477
for _, s in ipairs(self["systems"]) do -- ./ecs/ecs.can:479
s:remove(e) -- ./ecs/ecs.can:480
end -- ./ecs/ecs.can:480
end -- ./ecs/ecs.can:480
if self["_previous"][e] then -- ./ecs/ecs.can:483
local prev -- ./ecs/ecs.can:485
prev = self["_previous"][e] -- ./ecs/ecs.can:485
if prev == true then -- ./ecs/ecs.can:486
self["_first"] = self["_first"][2] -- ./ecs/ecs.can:487
if self["_first"] then -- ./ecs/ecs.can:488
self["_previous"][self["_first"][1]] = true -- ./ecs/ecs.can:489
end -- ./ecs/ecs.can:489
else -- ./ecs/ecs.can:489
prev[2] = prev[2][2] -- ./ecs/ecs.can:492
if prev[2] then -- ./ecs/ecs.can:493
self["_previous"][prev[2][1]] = prev -- ./ecs/ecs.can:494
end -- ./ecs/ecs.can:494
end -- ./ecs/ecs.can:494
self["_previous"][e] = nil -- ./ecs/ecs.can:498
self["entityCount"] = self["entityCount"] - (1) -- ./ecs/ecs.can:499
self:onRemove(e, e[self["component"]]) -- ./ecs/ecs.can:500
end -- ./ecs/ecs.can:500
end -- ./ecs/ecs.can:500
if ... then -- ./ecs/ecs.can:503
return e, self:remove(...) -- ./ecs/ecs.can:504
else -- ./ecs/ecs.can:504
return e -- ./ecs/ecs.can:506
end -- ./ecs/ecs.can:506
end, -- ./ecs/ecs.can:506
["refresh"] = function(self, e, ...) -- ./ecs/ecs.can:518
if e ~= nil then -- ./ecs/ecs.can:519
if not self["_previous"][e] then -- ./ecs/ecs.can:520
self:add(e) -- ./ecs/ecs.can:521
elseif self["_previous"][e] then -- ./ecs/ecs.can:522
if not self:filter(e) then -- ./ecs/ecs.can:523
self:remove(e) -- ./ecs/ecs.can:524
else -- ./ecs/ecs.can:524
for _, s in ipairs(self["systems"]) do -- ./ecs/ecs.can:526
s:refresh(e) -- ./ecs/ecs.can:527
end -- ./ecs/ecs.can:527
end -- ./ecs/ecs.can:527
end -- ./ecs/ecs.can:527
end -- ./ecs/ecs.can:527
if ... then -- ./ecs/ecs.can:532
return e, self:refresh(...) -- ./ecs/ecs.can:533
else -- ./ecs/ecs.can:533
return e -- ./ecs/ecs.can:535
end -- ./ecs/ecs.can:535
end, -- ./ecs/ecs.can:535
["reorder"] = function(self, e, ...) -- ./ecs/ecs.can:547
if e ~= nil then -- ./ecs/ecs.can:548
if self["_previous"][e] then -- ./ecs/ecs.can:549
local prev -- ./ecs/ecs.can:550
prev = self["_previous"][e] -- ./ecs/ecs.can:550
local next -- ./ecs/ecs.can:551
next = prev == true and self["_first"][2] or prev[2][2] -- ./ecs/ecs.can:551
if prev == true then -- ./ecs/ecs.can:553
self["_first"] = self["_first"][2] -- ./ecs/ecs.can:554
else -- ./ecs/ecs.can:554
prev[2] = next -- ./ecs/ecs.can:556
end -- ./ecs/ecs.can:556
if next then -- ./ecs/ecs.can:558
self["_previous"][next[1]] = prev -- ./ecs/ecs.can:559
end -- ./ecs/ecs.can:559
while prev ~= true and self:compare(e, prev[1]) do -- ./ecs/ecs.can:562
next = prev -- ./ecs/ecs.can:563
prev = self["_previous"][prev[1]] -- ./ecs/ecs.can:564
end -- ./ecs/ecs.can:564
while next ~= nil and not self:compare(e, next[1]) do -- ./ecs/ecs.can:566
prev = next -- ./ecs/ecs.can:567
next = next[2] -- ./ecs/ecs.can:568
end -- ./ecs/ecs.can:568
local new -- ./ecs/ecs.can:571
new = { -- ./ecs/ecs.can:571
e, -- ./ecs/ecs.can:571
next -- ./ecs/ecs.can:571
} -- ./ecs/ecs.can:571
self["_previous"][e] = prev -- ./ecs/ecs.can:572
if next then -- ./ecs/ecs.can:573
self["_previous"][next[1]] = new -- ./ecs/ecs.can:574
end -- ./ecs/ecs.can:574
if prev == true then -- ./ecs/ecs.can:576
self["_first"] = new -- ./ecs/ecs.can:577
else -- ./ecs/ecs.can:577
prev[2] = new -- ./ecs/ecs.can:579
end -- ./ecs/ecs.can:579
for _, s in ipairs(self["systems"]) do -- ./ecs/ecs.can:582
s:reorder(e) -- ./ecs/ecs.can:583
end -- ./ecs/ecs.can:583
end -- ./ecs/ecs.can:583
end -- ./ecs/ecs.can:583
if ... then -- ./ecs/ecs.can:587
return e, self:reorder(...) -- ./ecs/ecs.can:588
else -- ./ecs/ecs.can:588
return e -- ./ecs/ecs.can:590
end -- ./ecs/ecs.can:590
end, -- ./ecs/ecs.can:590
["has"] = function(self, e, ...) -- ./ecs/ecs.can:599
local has -- ./ecs/ecs.can:600
has = e == nil or not not self["_previous"][e] -- ./ecs/ecs.can:600
if ... then -- ./ecs/ecs.can:601
return has and self:has(...) -- ./ecs/ecs.can:602
else -- ./ecs/ecs.can:602
return has -- ./ecs/ecs.can:604
end -- ./ecs/ecs.can:604
end, -- ./ecs/ecs.can:604
["iter"] = function(self) -- ./ecs/ecs.can:609
return nextEntity, { self["_first"] } -- ./ecs/ecs.can:610
end, -- ./ecs/ecs.can:610
["clear"] = function(self) -- ./ecs/ecs.can:613
for e in self:iter() do -- ./ecs/ecs.can:614
self:remove(e) -- ./ecs/ecs.can:615
end -- ./ecs/ecs.can:615
for _, s in ipairs(self["systems"]) do -- ./ecs/ecs.can:617
s:clear() -- ./ecs/ecs.can:618
end -- ./ecs/ecs.can:618
end, -- ./ecs/ecs.can:618
["update"] = function(self, dt) -- ./ecs/ecs.can:625
if self["active"] then -- ./ecs/ecs.can:626
if self["interval"] then -- ./ecs/ecs.can:627
self["_waited"] = self["_waited"] + (dt) -- ./ecs/ecs.can:628
if self["_waited"] < self["interval"] then -- ./ecs/ecs.can:629
return -- ./ecs/ecs.can:630
end -- ./ecs/ecs.can:630
end -- ./ecs/ecs.can:630
self:onUpdate(dt) -- ./ecs/ecs.can:633
if self["process"] ~= system_mt["process"] then -- ./ecs/ecs.can:634
for e in self:iter() do -- ./ecs/ecs.can:635
self:process(e, e[self["component"]], dt) -- ./ecs/ecs.can:636
end -- ./ecs/ecs.can:636
end -- ./ecs/ecs.can:636
for _, s in ipairs(self["systems"]) do -- ./ecs/ecs.can:639
s:update(dt) -- ./ecs/ecs.can:640
end -- ./ecs/ecs.can:640
self:onUpdateEnd(dt) -- ./ecs/ecs.can:642
if self["interval"] then -- ./ecs/ecs.can:643
self["_waited"] = self["_waited"] - (self["interval"]) -- ./ecs/ecs.can:644
end -- ./ecs/ecs.can:644
end -- ./ecs/ecs.can:644
end, -- ./ecs/ecs.can:644
["draw"] = function(self) -- ./ecs/ecs.can:651
if self["visible"] then -- ./ecs/ecs.can:652
self:onDraw() -- ./ecs/ecs.can:653
if self["render"] ~= system_mt["render"] then -- ./ecs/ecs.can:654
for e in self:iter() do -- ./ecs/ecs.can:655
self:render(e, e[self["component"]]) -- ./ecs/ecs.can:656
end -- ./ecs/ecs.can:656
end -- ./ecs/ecs.can:656
for _, s in ipairs(self["systems"]) do -- ./ecs/ecs.can:659
s:draw() -- ./ecs/ecs.can:660
end -- ./ecs/ecs.can:660
self:onDrawEnd() -- ./ecs/ecs.can:662
end -- ./ecs/ecs.can:662
end, -- ./ecs/ecs.can:662
["callback"] = function(self, name, e, ...) -- ./ecs/ecs.can:675
if self["_previous"][e] and self[name] then -- ./ecs/ecs.can:677
self[name](self, e, e[self["component"]], ...) -- ./ecs/ecs.can:678
end -- ./ecs/ecs.can:678
if self["_previous"][e] then -- ./ecs/ecs.can:681
for _, ss in ipairs(self["systems"]) do -- ./ecs/ecs.can:682
ss:callback(name, e, ...) -- ./ecs/ecs.can:683
end -- ./ecs/ecs.can:683
end -- ./ecs/ecs.can:683
end, -- ./ecs/ecs.can:683
["emit"] = function(self, name, ...) -- ./ecs/ecs.can:708
local status -- ./ecs/ecs.can:710
if self[name] then -- ./ecs/ecs.can:711
status = self[name](self, ...) -- ./ecs/ecs.can:712
end -- ./ecs/ecs.can:712
if status ~= "stop" and status ~= "capture" then -- ./ecs/ecs.can:715
for _, s in ipairs(self["systems"]) do -- ./ecs/ecs.can:716
status = s:emit(name, ...) -- ./ecs/ecs.can:717
if status == "capture" then -- ./ecs/ecs.can:718
break -- ./ecs/ecs.can:718
end -- ./ecs/ecs.can:718
end -- ./ecs/ecs.can:718
end -- ./ecs/ecs.can:718
return status -- ./ecs/ecs.can:721
end, -- ./ecs/ecs.can:721
["destroy"] = function(self) -- ./ecs/ecs.can:724
recCallOnRemoveFromWorld(self["world"], { self }) -- ./ecs/ecs.can:725
recDestroySystems({ ["systems"] = { self } }) -- ./ecs/ecs.can:726
end -- ./ecs/ecs.can:726
} -- ./ecs/ecs.can:726
local alwaysTrue -- ./ecs/ecs.can:731
alwaysTrue = function() -- ./ecs/ecs.can:731
return true -- ./ecs/ecs.can:731
end -- ./ecs/ecs.can:731
local alwaysFalse -- ./ecs/ecs.can:732
alwaysFalse = function() -- ./ecs/ecs.can:732
return false -- ./ecs/ecs.can:732
end -- ./ecs/ecs.can:732
local recInstanciateSystems -- ./ecs/ecs.can:737
recInstanciateSystems = function(world, systems) -- ./ecs/ecs.can:737
local t -- ./ecs/ecs.can:738
t = {} -- ./ecs/ecs.can:738
for _, s in ipairs(systems) do -- ./ecs/ecs.can:739
local system -- ./ecs/ecs.can:740
system = setmetatable({ -- ./ecs/ecs.can:742
["systems"] = recInstanciateSystems(world, s["systems"] or {}), -- ./ecs/ecs.can:743
["world"] = world, -- ./ecs/ecs.can:744
["w"] = world, -- ./ecs/ecs.can:745
["s"] = world["s"], -- ./ecs/ecs.can:746
["_previous"] = {} -- ./ecs/ecs.can:747
}, { ["__index"] = function(self, k) -- ./ecs/ecs.can:749
if s[k] ~= nil then -- ./ecs/ecs.can:750
return s[k] -- ./ecs/ecs.can:751
else -- ./ecs/ecs.can:751
return system_mt[k] -- ./ecs/ecs.can:753
end -- ./ecs/ecs.can:753
end }) -- ./ecs/ecs.can:753
if type(s["filter"]) == "string" then -- ./ecs/ecs.can:758
system["filter"] = function(_, e) -- ./ecs/ecs.can:759
return e[s["filter"]] ~= nil -- ./ecs/ecs.can:759
end -- ./ecs/ecs.can:759
elseif type(s["filter"]) == "table" then -- ./ecs/ecs.can:760
system["filter"] = ecs["all"](unpack(s["filter"])) -- ./ecs/ecs.can:761
elseif type(s["filter"]) == "boolean" then -- ./ecs/ecs.can:762
if s["filter"] then -- ./ecs/ecs.can:763
system["filter"] = alwaysTrue -- ./ecs/ecs.can:764
else -- ./ecs/ecs.can:764
system["filter"] = alwaysFalse -- ./ecs/ecs.can:766
end -- ./ecs/ecs.can:766
end -- ./ecs/ecs.can:766
if not s["component"] and s["name"] then -- ./ecs/ecs.can:770
s["component"] = s["name"] -- ./ecs/ecs.can:771
end -- ./ecs/ecs.can:771
table["insert"](t, system) -- ./ecs/ecs.can:774
if s["name"] then -- ./ecs/ecs.can:775
world["s"][s["name"]] = system -- ./ecs/ecs.can:776
end -- ./ecs/ecs.can:776
system:onInstance() -- ./ecs/ecs.can:778
end -- ./ecs/ecs.can:778
return t -- ./ecs/ecs.can:780
end -- ./ecs/ecs.can:780
local recCallOnAddToWorld -- ./ecs/ecs.can:783
recCallOnAddToWorld = function(world, systems) -- ./ecs/ecs.can:783
for _, s in ipairs(systems) do -- ./ecs/ecs.can:784
recCallOnAddToWorld(world, s["systems"]) -- ./ecs/ecs.can:785
s:onAddToWorld(world) -- ./ecs/ecs.can:786
end -- ./ecs/ecs.can:786
end -- ./ecs/ecs.can:786
ecs = { -- ./ecs/ecs.can:792
["world"] = function(...) -- ./ecs/ecs.can:797
local world -- ./ecs/ecs.can:798
world = setmetatable({ -- ./ecs/ecs.can:798
["filter"] = ecs["all"](), -- ./ecs/ecs.can:799
["s"] = {}, -- ./ecs/ecs.can:800
["_previous"] = {} -- ./ecs/ecs.can:801
}, { ["__index"] = system_mt }) -- ./ecs/ecs.can:802
world["world"] = world -- ./ecs/ecs.can:803
world["w"] = world -- ./ecs/ecs.can:804
world["systems"] = recInstanciateSystems(world, { ... }) -- ./ecs/ecs.can:805
recCallOnAddToWorld(world, world["systems"]) -- ./ecs/ecs.can:806
return world -- ./ecs/ecs.can:807
end, -- ./ecs/ecs.can:807
["all"] = function(...) -- ./ecs/ecs.can:813
if ... then -- ./ecs/ecs.can:814
local l -- ./ecs/ecs.can:815
l = { ... } -- ./ecs/ecs.can:815
return function(s, e) -- ./ecs/ecs.can:816
for _, k in ipairs(l) do -- ./ecs/ecs.can:817
if e[k] == nil then -- ./ecs/ecs.can:818
return false -- ./ecs/ecs.can:819
end -- ./ecs/ecs.can:819
end -- ./ecs/ecs.can:819
return true -- ./ecs/ecs.can:822
end -- ./ecs/ecs.can:822
else -- ./ecs/ecs.can:822
return alwaysTrue -- ./ecs/ecs.can:825
end -- ./ecs/ecs.can:825
end, -- ./ecs/ecs.can:825
["any"] = function(...) -- ./ecs/ecs.can:832
if ... then -- ./ecs/ecs.can:833
local l -- ./ecs/ecs.can:834
l = { ... } -- ./ecs/ecs.can:834
return function(s, e) -- ./ecs/ecs.can:835
for _, k in ipairs(l) do -- ./ecs/ecs.can:836
if e[k] ~= nil then -- ./ecs/ecs.can:837
return true -- ./ecs/ecs.can:838
end -- ./ecs/ecs.can:838
end -- ./ecs/ecs.can:838
return false -- ./ecs/ecs.can:841
end -- ./ecs/ecs.can:841
else -- ./ecs/ecs.can:841
return alwaysFalse -- ./ecs/ecs.can:844
end -- ./ecs/ecs.can:844
end, -- ./ecs/ecs.can:844
["scene"] = function(name, systems, entities) -- ./ecs/ecs.can:854
if systems == nil then systems = {} end -- ./ecs/ecs.can:854
if entities == nil then entities = {} end -- ./ecs/ecs.can:854
assert(scene, "ubiquitousse.scene unavailable") -- ./ecs/ecs.can:855
local s -- ./ecs/ecs.can:856
s = scene["new"](name) -- ./ecs/ecs.can:856
local w -- ./ecs/ecs.can:857
s["enter"] = function(self) -- ./ecs/ecs.can:859
w = ecs["world"](unpack(systems)) -- ./ecs/ecs.can:860
w:add(unpack(entities)) -- ./ecs/ecs.can:861
end -- ./ecs/ecs.can:861
s["exit"] = function(self) -- ./ecs/ecs.can:863
w:destroy() -- ./ecs/ecs.can:864
end -- ./ecs/ecs.can:864
s["update"] = function(self, dt) -- ./ecs/ecs.can:866
w:update(dt) -- ./ecs/ecs.can:867
end -- ./ecs/ecs.can:867
s["draw"] = function(self) -- ./ecs/ecs.can:869
w:draw() -- ./ecs/ecs.can:870
end -- ./ecs/ecs.can:870
return s -- ./ecs/ecs.can:873
end -- ./ecs/ecs.can:873
} -- ./ecs/ecs.can:873
return ecs -- ./ecs/ecs.can:877
|
---@meta
---
---@class RemoteDebugUtility
---
local utility = {}
---
---@return string
---获取当前路径
---
function utility.fs_current_path()
end
---
---@return string
---获取exe所在目录
---
function utility.fs_program_path()
end
---
--- * Windows下的行为
--- 1. 向主线程发送WM_QUIT消息。
--- * 非Windows下的行为
--- 1. 什么都不做
---
function utility.closewindow()
end
---
--- 发送SIGINT信号。
---
function utility.closeprocess()
end
---
---@param str string
---@return string
---将utf8字符串转为ansi。
---仅在Windows下有效。
---
function utility.u2a(str)
end
---
---@param str string
---@return string
---将ansi字符串转为utf8。
---仅在Windows下有效。
---
function utility.a2u(str)
end
return utility
|
modifier_mutation_rupture = modifier_mutation_rupture or class({})
function modifier_mutation_rupture:IsDebuff() return true end
function modifier_mutation_rupture:IsPurgable() return false end
function modifier_mutation_rupture:GetTexture()
return "bloodseeker_rupture"
end
if IsServer() then
function modifier_mutation_rupture:OnCreated()
self.caster = self:GetCaster()
self.movedamage = 50 * 0.01
self.attackdamage = 50
self.castdamage = 100
self.damagecap = 1300
self.prevLoc = self:GetParent():GetAbsOrigin()
self:StartIntervalThink(0.25)
EmitSoundOn("hero_bloodseeker.rupture", self:GetParent())
end
function modifier_mutation_rupture:OnIntervalThink()
local game_time = math.min(GameRules:GetDOTATime(false, false) / 60, 30)
self.castdamage = 50 + (game_time * 10)
self.movedamage = (50 + (game_time * 10)) * 0.01
self.attackdamage = 50 + (game_time * 10)
if CalculateDistance(self.prevLoc, self:GetParent()) < self.damagecap then
local move_damage = CalculateDistance(self.prevLoc, self:GetParent()) * self.movedamage
if move_damage > 0 then
ApplyDamage({victim = self:GetParent(), attacker = self.caster, damage = move_damage, damage_type = DAMAGE_TYPE_PURE})
end
end
self.prevLoc = self:GetParent():GetAbsOrigin()
end
function modifier_mutation_rupture:DeclareFunctions()
local funcs = {
MODIFIER_EVENT_ON_ABILITY_START,
MODIFIER_EVENT_ON_ATTACK_START,
}
return funcs
end
function modifier_mutation_rupture:OnAbilityStart(params)
if params.unit == self:GetParent() then
ApplyDamage({victim = self:GetParent(), attacker = self.caster, damage = self.castdamage, damage_type = DAMAGE_TYPE_PURE})
end
end
function modifier_mutation_rupture:OnAttackStart(params)
if params.attacker == self:GetParent() then
ApplyDamage({victim = self:GetParent(), attacker = self.caster, damage = self.castdamage, damage_type = DAMAGE_TYPE_PURE})
end
end
function modifier_mutation_rupture:OnDestroy()
--Stop Meme Sounds
StopSoundEvent("Imba.BloodseekerBadDay", self.parent)
end
end
function modifier_mutation_rupture:GetEffectName()
return "particles/units/heroes/hero_bloodseeker/bloodseeker_rupture.vpcf"
end
|
-- plays only part of the animation, by manually rewinding then played x seconds
b = BinooAPI
b:ClearObjects()
target = "mocapdude"
stringkey = "mybvh"
zisup=true
b:SetWaitForMe(true)
b:LoadStringFromURL("https://gist.githubusercontent.com/unitycoder/cc5e1e171a2218a85dad7ca3bc652bec/raw/5a6629176cf05d808e1c9aae165f8ea13b8ab856/test5.bvh",stringkey)
b:Instantiate("models/lowpolyrig",target)
return function()
while b:WaitForMe()==true do
coroutine.yield(0.2)
end
b:ParseBVHFromString(target,stringkey,false,true)
b:SetPosition(target,-3,0,0)
b:RotateTowardsPlayer(target)
-- get full animation length in seconds
l = b:GetAnimationLength(target)
timeEnd = l/3 -- play only 1/3
while true do
t = b:GetAnimationTime(target)
-- if reach time end, rewind to 0
if t>timeEnd then
b:JumpToAnimationTime(target,0)
end
coroutine.yield(0.16)
end
end
|
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
function ENT:Initialize()
self:SetModel("models/hardbass/bomb_c4.mdl")
end
|
-- Dependencies
require "AI\\USER_AI\\actor"
-- Global
local ST = dofile("./AI/USER_AI/lib/state.lua")
-- Const
-- Custom States
-- Transition Table
local ftran = {}
ftran[ST.follow] = function(me)
local disguised
getActors(function(actor)
if actor == 'player' and actor.canAttack then
disguised = actor
end
end)
if disguised then
return ST.chase, {me, disguised}
end
end
-- Command Handler
local fcmd = 'default'
-- Initializer
local function test_profile(me, ...)
return ftran, fcmd, ST.follow, {me}
end
return test_profile
|
--vim: filetype=lua ts=2 sw=2 sts=2 et :
local eg,shuffle,top,sorted,sort,per,inc,max
-- ### List Functions
function eq(a,b, ta,tb)
ta, tb = type(a), type(b)
if ta ~= tb then return false end
if ta ~= 'table' and tb ~= 'table' then return a == b end
for k,v in pairs(a) do if not eq(v,b[k]) then return false end end
for k,v in pairs(b) do if not eq(v,a[k]) then return false end end
return true
end
-- shuffles, in place the table `a`
function shuffle(a,n, j)
for i = #a, 2, -1 do
j = randi(1,i)
a[i], a[j] = a[j], a[i] end
return n and top(a, n) or a end
function top(a,n, b)
b={}
for i=1, math.min(n,#a) do b[i] = a[i] end
return b end
function sorted(t, i,keys)
i,keys = 0,{}
for k,_ in pairs(t) do keys[1 + #keys] = k end
table.sort(keys)
return function ()
if i < #keys then
i=i+1; return keys[i], t[keys[i]] end end end
function sort(a, f)
f = fun(f)
table.sort(a, function(x,y) return f(x)<f(y) end)
return a end
function per(a,p)
return a[math.max(1,math.floor(#a*(p or .5)))] end
function inc(t,k,n)
t[k] = (t[k] or 0) + (n or 1)
return t[k] end
function max(t,k,n) t[k] = math.max(n or 0, (t[k] or 0)) end
return {
eq=eq, shuffle=shuffle, top=top, sorted=sorted,
sort=sort, per=per, inc=inc, max=max}
|
function handleArguments(functionName, items)
for index, data in pairs(items) do
local badType = true
local typeOrClass
for _, typ in pairs(data.allowedTypes) do
if typeof(data.item) == typ then
typeOrClass = "type"
badType = false
break
elseif data.class and (getmetatable(data.item).__class == typ) then
typeOrClass = "class"
badType = false
break
end
end
if badType then
error("bad argument #"..index.." to '"..functionName.."' ("..data.allowedTypes[1].." expected, got "..(data.class and getmetatable(data.item)._class or type(data.item))..")", 2)
break
end
end
end
function rgbToHex(r, g, b)
local dc = "%x"
return "0x"..dc:format(r*255)..dc:format(g*255)..dc:format(b*255)
end
local Discord = {}
local Message = {}
local Embed = {}
local Footer = {}
local Image = {}
local Thumbnail = {}
local Video = {}
local Provider = {}
local Author = {}
local Field = {}
local Webhook = {}
--// Webhook Constructor
function Discord.newWebhook(url)
handleArguments("newWebhook", {{item = url, allowedTypes = {"string"}}})
local webhook = setmetatable({}, {__index = Webhook, __class = "Webhook"})
webhook.url = url
return webhook
end
--// Webhook Methods
function Webhook:send(message)
handleArguments("send", {{item = message, allowedTypes = {"Message"}, class = true}})
local http = game:GetService("HttpService")
local data = {
content = message:getContent(),
username = message:getUsername(),
avatar_url = message:getAvatarUrl(),
tts = message:getTTS(),
embeds = {}
}
print("hi")
for _, embed in pairs(message:getEmbeds()) do
local fields = {}
for _, field in pairs(embed:getFields()) do
table.insert(fields, {
name = field:getName(),
value = field:getValue(),
inline = field:getInline()
})
end
table.insert(data.embeds, {
title = embed:getTitle(),
description = embed:getDescription(),
url = embed:getUrl(),
color = embed:getColorValue(),
footer = {text = (embed:getFooter() ~= nil and embed:getFooter():getText() or nil), icon_url = (embed:getFooter() ~= nil and embed:getFooter():getIconUrl() or nil)},
image = {url = (embed:getImage() ~= nil and embed:getImage():getUrl() or nil)},
thumbnail = {url = (embed:getThumbnail() ~= nil and embed:getThumbnail():getUrl() or nil)},
video = {url = (embed:getVideo() ~= nil and embed:getVideo():getUrl() or nil)},
provider = {name = (embed:getProvider() ~= nil and embed:getProvider():getName() or nil), url = (embed:getProvider() ~= nil and embed:getProvider():getUrl() or nil)},
author = {name = (embed:getAuthor() ~= nil and embed:getAuthor():getName() or nil), url = (embed:getAuthor() ~= nil and embed:getAuthor():getUrl() or nil), icon_url = (embed:getAuthor() ~= nil and embed:getAuthor():getIconUrl() or nil)},
fields = fields
})
end
local success, err = pcall(function() http:PostAsync(self.url, http:JSONEncode(data)) end)
return success, err
end
--// Message Constructor
function Discord.newMessage()
local self = setmetatable({}, {__index = Message, __class = "Message"})
self.content = ""
self.username = nil
self.avatar_url = nil
self.tts = false
self.embeds = {}
return self
end
--// Message Methods
function Message:setContent(text)
handleArguments("setContent", {{item = text, allowedTypes = {"string", "number"}}})
self.content = tostring(text)
return self
end
function Message:setUsername(username)
handleArguments("setUsername", {{item = username, allowedTypes = {"string", "number"}}})
self.username = tostring(username)
return self
end
function Message:setAvatarUrl(avatarUrl)
handleArguments("setAvatarUrl", {{item = avatarUrl, allowedTypes = {"string"}}})
self.avatar_url = avatarUrl
return self
end
function Message:setTTS(tts)
handleArguments("setTTS", {{item = tts, allowedTypes = {"boolean"}}})
self.tts = tts
return self
end
function Message:getContent()
return self.content
end
function Message:getUsername()
return self.username
end
function Message:getAvatarUrl()
return self.avatar_url
end
function Message:getTTS()
return self.tts
end
function Message:getEmbeds()
return self.embeds
end
--// Embed Constructor
function Message:addEmbed(title, description)
handleArguments("addEmbed", {{item = title, allowedTypes = {"string", "number"}}, {item = description, allowedTypes = {"string", "number", "nil"}}})
local embed = setmetatable({}, {__index = Embed, __class = "Embed"})
embed.title = tostring(title)
embed.description = (description == nil and nil or tostring(description))
embed.url = nil
embed.color = 0xffffff
embed.footer = nil
embed.image = nil
embed.thumbnail = nil
embed.video = nil
embed.provider = nil
embed.author = nil
embed.fields = {}
embed.encodedColor = Color3.new(1, 1, 1)
self.embeds[#self.embeds + 1] = embed
return embed
end
----//// Embed Methods
function Embed:setTitle(title)
handleArguments("setTitle", {{item = title, allowedTypes = {"string", "number"}}})
self.title = tostring(title)
return self
end
function Embed:setDescription(description)
handleArguments("setDescription", {{item = description, allowedTypes = {"string", "number"}}})
self.description = tostring(description)
return self
end
function Embed:setUrl(url)
handleArguments("setTitle", {{item = url, allowedTypes = {"string"}}})
self.url = url
return self
end
function Embed:setColor(color3)
handleArguments("setColor", {{item = color3, allowedTypes = {"Color3"}}})
self.color = tonumber(rgbToHex(color3.r, color3.g, color3.b))
self.encodedColor = color3
return self
end
--// Footer Constructor
function Embed:setFooter(text, iconUrl)
handleArguments("setFooter", {{item = text, allowedTypes = {"string", "number"}}, {item = iconUrl, allowedTypes = {"string", "nil"}}})
local footer = setmetatable({}, {__index = Footer, __class = "Footer"})
footer.text = tostring(text)
footer.icon_url = iconUrl
self.footer = footer
return footer
end
--// Footer Methods
function Footer:setText(text)
handleArguments("setText", {{item = text, allowedTypes = {"string", "number"}}})
self.text = tostring(text)
return self
end
function Footer:setIconUrl(iconUrl)
handleArguments("setIconUrl", {{item = iconUrl, allowedTypes = {"string"}}})
self.icon_url = iconUrl
return self
end
function Footer:getText()
return self.text
end
function Footer:getIconUrl()
return self.icon_url
end
--// Image Constructor
function Embed:setImage(imageUrl)
handleArguments("setImage", {{item = imageUrl, allowedTypes = {"string"}}})
local image = setmetatable({}, {__index = Image, __class = "Image"})
image.url = imageUrl
self.image = image
return image
end
--// Image Methods
function Image:setUrl(url)
handleArguments("setUrl", {{item = url, allowedTypes = {"string"}}})
self.url = url
return self
end
function Image:getUrl()
return self.url
end
--// Thumbnail Constructor
function Embed:setThumbnail(thumbnailUrl)
handleArguments("setThumbnail", {{item = thumbnailUrl, allowedTypes = {"string"}}})
local thumbnail = setmetatable({}, {__index = Thumbnail, __class = "Thumbnail"})
thumbnail.url = thumbnailUrl
self.thumbnail = thumbnail
return thumbnail
end
--// Thumbnail Methods
function Thumbnail:setUrl(url)
handleArguments("setUrl", {{item = url, allowedTypes = {"string"}}})
self.url = url
return self
end
function Thumbnail:getUrl()
return self.url
end
--// Video Constructor
function Embed:setVideo(url)
handleArguments("setVideo", {{item = url, allowedTypes = {"string"}}})
local video = setmetatable({}, {__index = Video, __class = "Video"})
video.url = url
self.video = video
return video
end
--// Video Methods
function Video:setUrl(url)
handleArguments("setUrl", {{item = url, allowedTypes = {"string"}}})
self.url = url
return self
end
function Video:getUrl()
return self.url
end
--// Provider Constructor
function Embed:setProvider(name, url)
handleArguments("setProvider", {{item = name, allowedTypes = {"string", "number"}}, {item = url, allowedTypes = {"string", "nil"}}})
local provider = setmetatable({}, {__index = Provider, __class = "Provider"})
provider.name = tostring(name)
provider.url = url
self.provider = self
return provider
end
--// Provider Methods
function Provider:setName(name)
handleArguments("setName", {{item = name, allowedTypes = {"string", "number"}}})
self.name = tostring(name)
return self
end
function Provider:setUrl(url)
handleArguments("setUrl", {{item = url, allowedTypes = {"string"}}})
self.url = url
return self
end
function Provider:getName()
return self.name
end
function Provider:getUrl()
return self.url
end
--// Author Constructor
function Embed:setAuthor(name, url, iconUrl)
handleArguments("setAuthor", {{item = name, allowedTypes = {"string", "number"}}, {item = url, allowedTypes = {"string", "nil"}}})
local author = setmetatable({}, {__index = Author, __class = "Author"})
author.name = tostring(name)
author.url = url
author.icon_url = iconUrl
self.author = author
return author
end
--// Author Methods
function Author:setName(name)
handleArguments("setName", {{item = name, allowedTypes = {"string", "number"}}})
self.name = tostring(name)
return self
end
function Author:setUrl(url)
handleArguments("setUrl", {{item = url, allowedTypes = {"string"}}})
self.url = url
return self
end
function Author:setIconUrl(iconUrl)
handleArguments("setIconUrl", {{item = iconUrl, allowedTypes = {"string"}}})
self.icon_url = iconUrl
return self
end
function Author:getName()
return self.name
end
function Author:getUrl()
return self.url
end
function Author:getIconUrl()
return self.icon_url
end
--// Field Constructor
function Embed:addField(name, value, inline)
handleArguments("setAuthor", {{item = name, allowedTypes = {"string", "number"}}, {item = value, allowedTypes = {"string", "number"}}, {item = inline, allowedTypes = {"boolean", "nil"}}})
local field = setmetatable({}, {__index = Field, __class = "Field"})
field.name = tostring(name)
field.value = tostring(value)
field.inline = (inline == nil and false or inline)
self.fields[#self.fields + 1] = field
return field
end
--// Field Methods
function Field:setName(name)
handleArguments("setName", {{item = name, allowedTypes = {"string", "number"}}})
self.name = tostring(name)
return self
end
function Field:setValue(value)
handleArguments("setValue", {{item = value, allowedTypes = {"string", "number"}}})
self.value = tostring(value)
return self
end
function Field:setInline(inline)
handleArguments("setInline", {{item = inline, allowedTypes = {"boolean"}}})
self.inline = inline
return self
end
function Field:getName()
return self.name
end
function Field:getValue()
return self.value
end
function Field:getInline()
return self.inline
end
--/
function Embed:getTitle()
return self.title
end
function Embed:getDescription()
return self.description
end
function Embed:getUrl()
return self.url
end
function Embed:getColor()
return self.encodedColor
end
function Embed:getColorValue()
return self.color
end
function Embed:getFooter()
return self.footer
end
function Embed:getImage()
return self.image
end
function Embed:getThumbnail()
return self.thumbnail
end
function Embed:getVideo()
return self.video
end
function Embed:getProvider()
return self.provider
end
function Embed:getAuthor()
return self.author
end
function Embed:getFields()
return self.fields
end
return Discord
|
includeFile("dantooine/abandoned_rebel_private.lua")
includeFile("dantooine/adwan_turoldine.lua")
includeFile("dantooine/ancient_graul.lua")
includeFile("dantooine/baby_bol.lua")
includeFile("dantooine/bek_rabor.lua")
includeFile("dantooine/bile_drenched_quenker.lua")
includeFile("dantooine/bol.lua")
includeFile("dantooine/bol_pack_runner.lua")
includeFile("dantooine/dantari_battlelord.lua")
includeFile("dantooine/dantari_chief.lua")
includeFile("dantooine/dantari_raider.lua")
includeFile("dantooine/dantari_strategist.lua")
includeFile("dantooine/dark_side_savage.lua")
includeFile("dantooine/domestic_bol_mount.lua")
includeFile("dantooine/enraged_defender.lua")
includeFile("dantooine/feral_force_wielder.lua")
includeFile("dantooine/fern_yarrow.lua")
includeFile("dantooine/fierce_piket_protector.lua")
includeFile("dantooine/force_crystal_hunter.lua")
includeFile("dantooine/force_sensitive_crypt_crawler.lua")
includeFile("dantooine/force_sensitive_renegade.lua")
includeFile("dantooine/force_trained_archaist.lua")
includeFile("dantooine/forsaken_force_drifter.lua")
includeFile("dantooine/frenzied_graul.lua")
includeFile("dantooine/grassland_voritor_tracker.lua")
includeFile("dantooine/graul.lua")
includeFile("dantooine/graul_marauder.lua")
includeFile("dantooine/graul_mangler.lua")
includeFile("dantooine/graul_mauler.lua")
includeFile("dantooine/horned_voritor_lizard.lua")
includeFile("dantooine/hostile_thune_mother.lua")
includeFile("dantooine/huurton_bloodhunter.lua")
includeFile("dantooine/huurton_howler.lua")
includeFile("dantooine/huurton_huntress.lua")
includeFile("dantooine/huurton.lua")
includeFile("dantooine/huurton_matron.lua")
includeFile("dantooine/huurton_pup.lua")
includeFile("dantooine/huurton_reaper.lua")
includeFile("dantooine/huurton_stalker.lua")
includeFile("dantooine/infant_graul.lua")
includeFile("dantooine/insurgent.lua")
includeFile("dantooine/janta_clan_leader.lua")
includeFile("dantooine/janta_harvester.lua")
includeFile("dantooine/janta_herbalist.lua")
includeFile("dantooine/janta_hunter.lua")
includeFile("dantooine/janta_loreweaver.lua")
includeFile("dantooine/janta_primalist.lua")
includeFile("dantooine/janta_rockshaper.lua")
includeFile("dantooine/janta_scout.lua")
includeFile("dantooine/janta_shaman.lua")
includeFile("dantooine/janta_soothsayer.lua")
includeFile("dantooine/janta_tribesman.lua")
includeFile("dantooine/janta_warrior.lua")
includeFile("dantooine/juntah_herm.lua")
includeFile("dantooine/kess_yarrow.lua")
includeFile("dantooine/kunga_clan_leader.lua")
includeFile("dantooine/kunga_clan_primalist.lua")
includeFile("dantooine/kunga_harvester.lua")
includeFile("dantooine/kunga_herbalist.lua")
includeFile("dantooine/kunga_hunter.lua")
includeFile("dantooine/kunga_loreweaver.lua")
includeFile("dantooine/kunga_rockshaper.lua")
includeFile("dantooine/kunga_scout.lua")
includeFile("dantooine/kunga_shaman.lua")
includeFile("dantooine/kunga_soothsayer.lua")
includeFile("dantooine/kunga_tribe_member.lua")
includeFile("dantooine/kunga_warrior.lua")
includeFile("dantooine/lesser_plains_bol.lua")
includeFile("dantooine/mammoth_thune.lua")
includeFile("dantooine/mokk_clan_leader.lua")
includeFile("dantooine/mokk_clan_primalist.lua")
includeFile("dantooine/mokk_harvester.lua")
includeFile("dantooine/mokk_herbalist.lua")
includeFile("dantooine/mokk_hunter.lua")
includeFile("dantooine/mokk_loreweaver.lua")
includeFile("dantooine/mokk_rockshaper.lua")
includeFile("dantooine/mokk_scout.lua")
includeFile("dantooine/mokk_shaman.lua")
includeFile("dantooine/mokk_soothsayer.lua")
includeFile("dantooine/mokk_tribesman.lua")
includeFile("dantooine/mokk_warrior.lua")
includeFile("dantooine/novice_force_mystic.lua")
includeFile("dantooine/piket_longhorn_female.lua")
includeFile("dantooine/piket_longhorn.lua")
includeFile("dantooine/piket.lua")
includeFile("dantooine/piket_plains_walker.lua")
includeFile("dantooine/quenker.lua")
includeFile("dantooine/quenker_ravager.lua")
includeFile("dantooine/quenker_relic_reaper.lua")
includeFile("dantooine/rane_yarrow.lua")
includeFile("dantooine/savage_quenker.lua")
includeFile("dantooine/seething_bol_crusher.lua")
includeFile("dantooine/slinking_voritor_hunter.lua")
includeFile("dantooine/spiked_slasher.lua")
includeFile("dantooine/stranded_rebel_scout.lua")
includeFile("dantooine/swift_charging_bol.lua")
includeFile("dantooine/terrible_quenker.lua")
includeFile("dantooine/thune_grassland_guardian.lua")
includeFile("dantooine/thune_herd_leader.lua")
includeFile("dantooine/thune.lua")
includeFile("dantooine/untrained_wielder_of_the_dark_side.lua")
includeFile("dantooine/ussox.lua")
includeFile("dantooine/vexed_voritor_lizard.lua")
includeFile("dantooine/voritor_dasher.lua")
includeFile("dantooine/voritor_lizard.lua")
includeFile("dantooine/yras_shen_jen.lua")
includeFile("dantooine/ytzosh.lua")
includeFile("dantooine/janta_cave_boss.lua")
includeFile("dantooine/janta_chieftain.lua")
---------additions-----------
includeFile("dantooine/mokk_chieftain.lua")
includeFile("dantooine/mokk_guard.lua")
includeFile("dantooine/mokk_sentry.lua")
includeFile("dantooine/mokk_huurton_reaper.lua")
|
--- @author Mercor
include("Scripts/Core/Common.lua")
-------------------------------------------------------------------------------
if PraiseMod == nil then
PraiseMod = EternusEngine.ModScriptClass.Subclass("PraiseMod")
end
-------------------------------------------------------------------------------
-- Create namespace for the mod
if EternusEngine.mods == nil then
EternusEngine.mods = {}
end
if EternusEngine.mods.Praise == nil then
EternusEngine.mods.Praise = {}
end
-------------------------------------------------------------------------------
-- This is called on .new()
function PraiseMod:Constructor()
end
-------------------------------------------------------------------------------
-- Called once from C++ at engine initialization time
function PraiseMod:Initialize()
self.options = {}
self.options.useDebug = false
self:ExtractCredits()
end
-------------------------------------------------------------------------------
-- Called from C++ when the current game enters (on game start: when 100% of world loaded)
function PraiseMod:Enter()
end
-------------------------------------------------------------------------------
-- Called from C++ when the game leaves it current mode
function PraiseMod:Leave()
end
-------------------------------------------------------------------------------
-- Called from C++ every update tick
function PraiseMod:Process(dt)
end
function PraiseMod:loadConfing()
end
-------------------------------------------------------------------------------
-- Read through mods.txt, and extract credits from all mods listed in it, if they have CREDITS.txt.
-- Based on JohnyCilohokla's code in CommonLib mod for TUG
function PraiseMod:ExtractCredits()
self:Debug("Extracting credits from mods\n")
local mods = {}
local file = io.open("Config/mods.txt", "r")
if file then
for line in file:lines() do
line = line:gsub("%s+", "") -- remove whitespace
if (strStartsWith(line,"\"") and strEndsWith(line,"\"")) then -- if line starts and ends with "", a.k.a is a mod path
local modPath = string.sub(line,2,-2)
self:Debug("Loading "..modPath.."\n")
local mod = {}
local nFields = 0
local manifestFile=io.open(modPath.."/Manifest.txt","r") -- load manifest.txt
if manifestFile~=nil then
self:Debug("Found Manifest for "..modPath.."\n")
local majorVersion = nil
local minorVersion = nil
local patchVersion = nil
for manifestLine in manifestFile:lines() do
manifestLine = manifestLine:gsub("%s+", "") -- remove whitespace
if (strStartsWith(manifestLine,"Name=\"") and strEndsWith(manifestLine,"\"")) then
mod.name = string.sub(manifestLine, 7, -2)
self:Debug("Name="..manifestLine.."\n")
nFields = nFields + 1
elseif (strStartsWith(manifestLine,"Description=\"") and strEndsWith(manifestLine,"\"")) then
mod.description = string.sub(manifestLine, 14, -2)
self:Debug("Description="..manifestLine.."\n")
nFields = nFields + 1
elseif (strStartsWith(manifestLine,"MajorVersion=\"") and strEndsWith(manifestLine,"\"")) then
mod.majorVersion = string.sub(manifestLine, 14, -1)
self:Debug("MajorVersion="..manifestLine.."\n")
nFields = nFields + 1
elseif (strStartsWith(manifestLine,"MinorVersion=\"") and strEndsWith(manifestLine,"\"")) then
mod.minorVersion = string.sub(manifestLine, 14, -1)
self:Debug("MinorVersion="..manifestLine.."\n")
nFields = nFields + 1
elseif (strStartsWith(manifestLine,"PatchVersion=\"") and strEndsWith(manifestLine,"\"")) then -- doesn't exist, but it should
mod.patchVersion = string.sub(manifestLine, 14, -1)
self:Debug("PatchVersion="..manifestLine.."\n")
nFields = nFields + 1
elseif (strStartsWith(manifestLine,"ScriptFile=\"") and strEndsWith(manifestLine,"\"")) then
mod.scriptFile = string.sub(manifestLine, 13, -2)
self:Debug("ScriptFile="..manifestLine.."\n")
nFields = nFields + 1
elseif (strStartsWith(manifestLine,"ScriptClass=\"") and strEndsWith(manifestLine,"\"")) then
mod.scriptClass = string.sub(manifestLine, 14, -2)
self:Debug("ScriptClass="..manifestLine.."\n")
nFields = nFields + 1
end
end
majorVersion = mod.majorVersion and mod.majorVersion or "0"
minorVersion = mod.minorVersion and mod.minorVersion or "0"
patchVersion = mod.patchVersion and mod.patchVersion or "0"
mod.version = majorVersion .. "." .. minorVersion .. "." .. patchVersion
end
manifestFile:close()
local creditFile = io.open(modPath.."/CREDITS.txt", "r")
if creditFile~=nil then
self:Debug("Found CREDITS.txt for "..modPath.."\n")
creditString = creditFile:read("*a")
creditFile:close()
tempFile = io.open("Mods/Praise/praise_temporary_file.txt", "w")
tempFile:write(creditString)
tempFile:close()
local credits = NKParseFile("praise_temporary_file.txt")
if (credits~=nil) then
self:Debug("Reading CREDITS.txt with NKParseFile\n")
self:Debug("Syntax: "..(credits["PraiseSyntax"] and credits["PraiseSyntax"] or "not found").."\n")
if (credits["PraiseSyntax"] == "0.0.1") then
self:Debug("Credits syntax version 0.0.1\n")
mod.tinyCredits = credits["TinyCredits"] and string.sub(credits["TinyCredits"], 1, 140) or nil
mod.shortCredits = credits["ShortCredits"] and string.sub(credits["ShortCredits"], 1, 500) or nil
mod.longCredits = credits["LongCredits"] and string.sub(credits["LongCredits"], 1, 1000) or nil
mod.fullCredits = credits["FullCredits"] and credits["FullCredits"] or nil
end
end
end
if (mod.name~=nil) and (mod.scriptFile~=nil) and (mod.scriptClass~=nil) then
table.insert(mods, mod)
end
self:Debug("TinyCredits: " .. (mod.tinyCredits and mod.tinyCredits or "not found") .. "\n")
self:Debug("ShortCredits: " .. (mod.shortCredits and mod.shortCredits or "not found") .. "\n")
self:Debug("LongCredits: " .. (mod.longCredits and mod.longCredits or "not found") .. "\n")
self:Debug("FullCredits: " .. (mod.fullCredits and mod.fullCredits or "not found") .. "\n")
end
end
io.close(file)
local tempFile = io.open("Mods/Praise/praise_temporary_file.txt", "w")
tempFile:write("Praise temp file.")
tempFile:close()
else
self:Debug("Couldn't load Config/mods.txt")
end
EternusEngine.mods.Praise.mods = mods
end
-------------------------------------------------------------------------------
-- Uses NKPrint to print the message given as param
function PraiseMod:Debug(msg)
if self.options.useDebug then
NKPrint(msg)
end
end
EntityFramework:RegisterModScript(PraiseMod)
|
--[[
This module provides literals:
true and false
'c' for chars
"string" for strings
123 for integers
0x123 for hex notation of integers
123.456e78 for doubles
future plans include:
123.456x10^78
some way for verbatim multiline string literals, probably the cpp one
]]
rule([[ Literal <- Boolean / CharLiteral / StringLiteral / NumericLiteral ]], basic.first )
rule([[ Boolean <- "true" / "false" ]], basic.match )
table.insert(keywords, "Boolean")
rule([[ CharLiteral <- '\'' (('\\' .) / .) '\'' ]], basic.match )
rule([[ StringLiteral <- '"' (('\\' .) / (!'"' .))* '"' ]], basic.match )
rule([[ NumericLiteral <- FloatLiteral / HexLiteral / IntegerLiteral ]], basic.first )
rule([[ IntegerLiteral <- [0-9]+ ]], basic.match )
rule([[ FloatLiteral <- [0-9]+ '.' [0-9]+ (('e' / 'E') '-'? [0-9]+)? ]], basic.match )
rule([[ HexLiteral <- '0' ('x' / 'X') [0-9]+ ]], basic.match )
|
--[[ INFO ]]--
--[[
Name: FirstCalc
Version: 0.2.1
Date: 10/08/2013
Author: Alex Crawford
Notes: My first attempt at programming in LUA (and at all really, besides simple HTML and CSS), through ComputerCraft. I used the calculator tutorial on the ComputerCraft wiki as a starting point, and elaborated on that, adding to and modifying it. ]]--
--[[ VARIABLES ]]--
local Memory = {}
local UserOpSel = nil
local Num1 = nil
local Num2 = nil
local Result = nil
local QueryMess = {
[1] = "What operation would you like to perform?",
[2] = "What is the first number?",
[3] = "What is the second number?",
[4] = "Would you like to store the result in the memory?",
[5] = "Which memory bank would you like to store the result in?",
[6] = "Would you like to overwrite the memory bank?",
[7] = "Would you like to do another equation?",
[8] = "Would you like to retrieve a result from memory?",
[9] = "Which memory bank would you like to load for the first number?",
[10] = "Which memory bank would you like to load for the second number?",
}
--[[ FUNCTIONS ]]--
function GetInput() -- -- Gets and returns user input. Useless.
local Input = read()
return Input
end
function DisplayMenu() -- Displays the main menu.
term.clear()
term.setCursorPos(1,2)
print[[
--------------------------------
FirstCalc v0.2.1
--------------------------------
1. Add
2. Subtract
3. Multiply
4. Divide
5. View Memory
6. Exit
--------------------------------
]]
end
function QueryUserMenu() -- Asks the user what operation they'd like to perform.
local OpMess = {
[1] = "You chose addition.",
[2] = "You chose subtraction.",
[3] = "You chose multiplication.",
[4] = "You chose division.",
[5] = "You chose to view the memory.",
[6] = "You chose exit.",
}
print(QueryMess[1] .. "\n")
local x = string.lower(read())
if x == "add" then
UserOpSel = string.gsub(x, "add", 1)
UserOpSel = tonumber(UserOpSel)
elseif x == "subtract" then
UserOpSel = string.gsub(x, "subtract", 2)
UserOpSel = tonumber(UserOpSel)
elseif x == "multiply" then
UserOpSel = string.gsub(x, "multiply", 3)
UserOpSel = tonumber(UserOpSel)
elseif x == "subtract" then
UserOpSel = string.gsub(x, "divide", 4)
UserOpSel = tonumber(UserOpSel)
elseif x == "exit" then
UserOpSel = string.gsub(x, "exit", 5)
UserOpSel = tonumber(UserOpSel)
elseif x == "1" or x == "2" or x == "3" or x == "4" or x == "5" or x == "6" then
UserOpSel = tonumber(x)
else
write("\nInvalid input. Enter 1 - 5.\n\n")
os.pullEvent(key)
CoreFunc()
end
if UserOpSel == 5 then
GetMem()
elseif UserOpSel == 6 then
os.reboot()
end
if UserOpSel ~= nil then
term.clear()
term.setCursorPos(1,1)
write("\n" .. OpMess[UserOpSel] .. "\n\n")
end
end
function GetNum() -- Gets the numbers the user wants to operate on.
write(QueryMess[2] .. "\n\n")
local x = read()
Num1 = x
print("")
write(QueryMess[3] .. "\n\n")
local x = read()
Num2 = x
print("")
end
function DoMath() -- Does the math using the numbers inputted by the user.
term.clear()
term.setCursorPos(1,2)
if UserOpSel == 1 or UserOpSel == "add" then
Result = Num1 + Num2
write(Num1 .. " + " .. Num2 .. " = " .. Result .. "\n\n")
elseif UserOpSel == 2 or UserOpSel == "subtract" then
Result = Num1 - Num2
write(Num1 .. " - " .. Num2 .. " = " .. Result .. "\n\n")
elseif UserOpSel == 3 or UserOpSel == "multiply" then
Result = Num1 * Num2
write(Num1 .. " * " .. Num2 .. " = " .. Result .. "\n\n")
elseif UserOpSel == 4 or UserOpSel == "divide" then
Result = Num1 / Num2
write(Num1 .. " / " .. Num2 .. " = " .. Result .. "\n\n")
end
end
function StoreData() -- Asks the user whether they want to store the result or not, and then does so, or does not.
write(QueryMess[4] .. "\n\n")
local x = string.lower(read())
print("")
if x == "yes" or x == "y" then
write(QueryMess[5] .. "\n")
print("")
local x = tonumber(read())
print("")
if Memory[x] == nil then
Memory[x] = Result
MoreMath()
else
write(QueryMess[6] .. "\n\n")
local x = string.lower(read())
print("")
if x == "yes" or x == "y" then
Memory[x] = Result
MoreMath()
elseif x == "no" or x == "n" then
StoreData()
end
end
elseif x == "no" or x == "n" then
MoreMath()
else
write("Please enter (Y)es or (N)o.\n")
os.pullEvent()
StoreData()
end
end
function CheckMem() -- Checks to see if the memory contains anything.
local Check = #Memory
if Check ~= 0 then
write(QueryMess[8] .. "\n")
local x = string.lower(read())
print("")
if x == "yes" or x == "y" then
write(QueryMess[9] .. "\n")
local x = read()
print("")
Num1 = Memory[x]
write(QueryMess[10] .. "\n")
local x = read()
print("")
Num2 = Memory[x]
elseif x == "no" or x == "n" then
GetNum()
else
write("Invalid input.\n")
CheckMem()
end
else
GetNum()
end
end
function GetMem() -- Displays what's stored in the memory.
term.clear()
term.setCursorPos(1,2)
local x = #Memory
if Memory ~= nil then
for i, v in pairs(Memory) do
print(i, ". ", v)
end
else
write("There is nothing stored in the memory.")
end
os.pullEvent()
CoreFunc()
end
function MoreMath() -- Asks the user whether they would like to perform another equation.
write(QueryMess[7] .. "\n\n")
local x = read()
print("")
if x == "yes" or x == "y" then
CoreFunc()
elseif x == "no" or x == "n" then
os.reboot()
end
end
function CoreFunc () -- All of the functions combined into one function. Why? I don't know.
DisplayMenu()
QueryUserMenu()
CheckMem()
DoMath()
StoreData()
MoreMath()
end
--[[ RUN CORE ]]--
CoreFunc() -- Runs everything.
|
-- This file contains constant definitions (for now, only colors)
module('passion.colors')
-- You can browse these colors here: http://www.w3schools.com/Html/html_colorvalues.asp
aliceBlue = {240,248,255}
antiqueWhite = {250,235,215}
aqua = {0,255,255}
aquamarine = {127,255,212}
azure = {240,255,255}
beige = {245,245,220}
bisque = {255,228,196}
black = {0,0,0}
blanchedAlmond = {255,235,205}
blue = {0,0,255}
blueViolet = {138,43,226}
brown = {165,42,42}
burlyWood = {222,184,135}
cadetBlue = {95,158,160}
chartreuse = {127,255,0}
chocolate = {210,105,30}
coral = {255,127,80}
cornflowerBlue = {100,149,237}
cornsilk = {255,248,220}
crimson = {237,164,61}
cyan = {0,255,255}
darkBlue = {0,0,139}
darkCyan = {0,139,139}
darkGoldenRod = {184,134,11}
darkGray = {169,169,169}
darkGreen = {0,100,0}
darkKhaki = {189,183,107}
darkMagenta = {139,0,139}
darkOliveGreen = {85,107,47}
darkOrange = {255,140,0}
darkOrchid = {153,50,204}
darkRed = {139,0,0}
darkSalmon = {233,150,122}
darkSeaGreen = {143,188,143}
darkSlateBlue = {72,61,139}
darkSlateGray = {47,79,79}
darkTurquoise = {0,206,209}
darkViolet = {148,0,211}
deepPink = {255,20,147}
deepSkyBlue = {0,191,255}
dimGray = {105,105,105}
dodgerBlue = {30,144,255}
fireBrick = {178,34,34}
floralWhite = {255,250,240}
forestGreen = {34,139,34}
fuchsia = {255,0,255}
gainsboro = {220,220,220}
ghostWhite = {248,248,255}
gold = {255,215,0}
goldenRod = {218,165,32}
gray = {128,128,128}
green = {0,128,0}
greenYellow = {173,255,47}
honeyDew = {240,255,240}
hotPink = {255,105,180}
indianRed = {205,92,92}
indigo = {75,0,130}
ivory = {255,255,240}
khaki = {240,230,140}
lavender = {230,230,250}
lavenderBlush = {255,240,245}
lawnGreen = {124,252,0}
lemonChiffon = {255,250,205}
lightBlue = {173,216,230}
lightCoral = {240,128,128}
lightCyan = {224,255,255}
lightGoldenRodYellow = {250,250,210}
lightGrey = {211,211,211}
lightGreen = {144,238,144}
lightPink = {255,182,193}
lightSalmon = {255,160,122}
lightSeaGreen = {32,178,170}
lightSkyBlue = {135,206,250}
lightSlateGray = {119,136,153}
lightSteelBlue = {176,196,222}
lightYellow = {255,255,224}
lime = {0,255,0}
limeGreen = {50,205,50}
linen = {250,240,230}
magenta = {255,0,255}
maroon = {128,0,0}
mediumAquaMarine = {102,205,170}
mediumBlue = {0,0,205}
mediumOrchid = {186,85,211}
mediumPurple = {147,112,219}
mediumSeaGreen = {60,179,113}
mediumSlateBlue = {123,104,238}
mediumSpringGreen = {0,250,154}
mediumTurquoise = {72,209,204}
mediumVioletRed = {199,21,133}
midnightBlue = {25,25,112}
mintCream = {245,255,250}
mistyRose = {255,228,225}
moccasin = {255,228,181}
navajoWhite = {255,222,173}
navy = {0,0,128}
oldLace = {253,245,230}
olive = {128,128,0}
oliveDrab = {107,142,35}
orange = {255,165,0}
orangeRed = {255,69,0}
orchid = {218,112,214}
paleGoldenRod = {238,232,170}
paleGreen = {152,251,152}
paleTurquoise = {175,238,238}
paleVioletRed = {219,112,147}
papayaWhip = {255,239,213}
peachPuff = {255,218,185}
peru = {205,133,63}
pink = {255,192,203}
plum = {221,160,221}
powderBlue = {176,224,230}
purple = {128,0,128}
red = {255,0,0}
rosyBrown = {188,143,143}
royalBlue = {65,105,225}
saddleBrown = {139,69,19}
salmon = {250,128,114}
sandyBrown = {244,164,96}
seaGreen = {46,139,87}
seaShell = {255,245,238}
sienna = {160,82,45}
silver = {192,192,192}
skyBlue = {135,206,235}
slateBlue = {106,90,205}
slateGray = {112,128,144}
snow = {255,250,250}
springGreen = {0,255,127}
steelBlue = {70,130,180}
tan = {210,180,140}
teal = {0,128,128}
thistle = {216,191,216}
tomato = {255,99,71}
turquoise = {64,224,208}
violet = {238,130,238}
wheat = {245,222,179}
white = {255,255,255}
whiteSmoke = {245,245,245}
yellow = {255,255,0}
yellowGreen = {154,205,50}
|
local ffi = require("ffi")
local libc = require("libc")
local putil = require("path-util")
--[[
local function dirent_ensure_type(DIR *d, struct dirent *de)
struct stat st;
assert(d);
assert(de);
if (de.d_type != libc.DT_UNKNOWN)
return 0;
if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0)
return -errno;
de->d_type =
S_ISREG(st.st_mode) ? DT_REG :
S_ISDIR(st.st_mode) ? DT_DIR :
S_ISLNK(st.st_mode) ? DT_LNK :
S_ISFIFO(st.st_mode) ? DT_FIFO :
S_ISSOCK(st.st_mode) ? DT_SOCK :
S_ISCHR(st.st_mode) ? DT_CHR :
S_ISBLK(st.st_mode) ? DT_BLK :
DT_UNKNOWN;
return 0;
end
--]]
local function dirent_is_file(de)
if de == nil then return false; end
if putil.hidden_file(ffi.string(de.d_name)) then
return false;
end
if (de.d_type ~= libc.DT_REG and
de.d_type ~= libc.DT_LNK and
de.d_type ~= libc.DT_UNKNOWN) then
return false;
end
return true;
end
--[[
local function dirent_is_file_with_suffix(const struct dirent *de, const char *suffix)
assert(de);
if (de->d_type != DT_REG &&
de->d_type != DT_LNK &&
de->d_type != DT_UNKNOWN)
return false;
if (hidden_file_allow_backup(de->d_name))
return false;
return endswith(de->d_name, suffix);
end
--]]
local exports = {
dirent_ensure_type = dirent_ensure_type;
dirent_is_file = dirent_is_file;
}
return exports
|
gfx = require 'gfx.js'
-- Plots information about a perceptron classifier on a 2-dimensional dataset.
function plot_perceptron(neg_examples, pos_examples, mistakes0, mistakes1, num_err_history, w, w_dist_history)
--[[%%
% The top-left plot shows the dataset and the classification boundary given by
% the weights of the perceptron. The negative examples are shown as circles
% while the positive examples are shown as squares. If an example is colored
% green then it means that the example has been correctly classified by the
% provided weights. If it is colored red then it has been incorrectly classified.
% The top-right plot shows the number of mistakes the perceptron algorithm has
% made in each iteration so far.
% The bottom-left plot shows the distance to some generously feasible weight
% vector if one has been provided (note, there can be an infinite number of these).
% Points that the classifier has made a mistake on are shown in red,
% while points that are correctly classified are shown in green.
% The goal is for all of the points to be green (if it is possible to do so).
% Inputs:
% neg_examples - The num_neg_examples x 3 matrix for the examples with target 0.
% num_neg_examples is the number of examples for the negative class.
% pos_examples- The num_pos_examples x 3 matrix for the examples with target 1.
% num_pos_examples is the number of examples for the positive class.
% mistakes0 - A vector containing the indices of the datapoints from class 0 incorrectly
% classified by the perceptron. This is a subset of neg_examples.
% mistakes1 - A vector containing the indices of the datapoints from class 1 incorrectly
% classified by the perceptron. This is a subset of pos_examples.
% num_err_history - A vector containing the number of mistakes for each
% iteration of learning so far.
% w - A 3-dimensional vector corresponding to the current weights of the
% perceptron. The last element is the bias.
% w_dist_history - A vector containing the L2-distance to a generously
% feasible weight vector for each iteration of learning so far.
% Empty if one has not been provided.
%%]]
data = {
{
key = 'Negative Examples',
values = neg_examples,
},
{
key = 'Positive Examples',
values = pos_examples,
},
}
gfx.chart(data ,{chart='scatter'}) ;
-- TODO: Plot the decision boundary, w.
-- Not really needed to answer questions though.
end
|
var_1 = {}
function var_1.add(number_1, number_2)
return number_1 + number_2
end
function var_1.hello(text)
return "Sup "..text
end
return var_1
|
local app = require('waffle')
local s3 = require('s3')
local ML = require('ml')
local bucket = s3:connect{
awsId="<Your AWS ID here>",
awsKey="<Your AWS Secret Key here>",
bucket="<target bucket name here>",
}
app.get('/', function(req, res)
res.send('Hello from our LuaJIT/Torch microservice!')
end)
app.post('/train', function(req, res)
if req.body then
if req.body.files and type(req.body.files) == 'table' then
for i, s3file in ipairs(req.body.files) do
-- Training file: s3file
ML.handleTrainFile(s3file, bucket:get(s3file))
end
res.status(200).send("OK")
end
end
res.status(500).send("Bad POST /train request, need 'files : [ <s3 path>, ...]' in the body")
end)
app.post('/input', function(req, res)
if req.body then
if req.body.files and type(req.body.files) == 'table' then
for i, s3file in ipairs(req.body.files) do
-- Input file: s3file
ML.handleInputFile(s3file, bucket:get(s3file))
end
res.status(200).send("OK")
end
end
res.status(500).send("Bad POST /input request, need 'files : [ <s3 path>, ...]' in the body")
end)
app.get('/output', function(req, res)
output = {}
if req.body then
if req.body.files and type(req.body.files) == 'table' then
for i, s3file in ipairs(req.body.files) do
-- Output file: s3file
output = ML.handleOutputFile(s3file, bucket:get(s3file))
end
res.json(output)
end
end
res.status(500).send("Bad POST /output request, need 'files : [ <s3 path>, ...]' in the body")
end)
app.listen({host = '0.0.0.0', port=8080})
|
--action event pack
--O_gate_40102Controller
return
{
}
|
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local wibox = require("wibox")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
panel = { item = {} }
awful.screen.connect_for_each_screen(function(scr)
-- separator
local SP = wibox.widget {
widget = wibox.widget.separator,
forced_width = dpi(10),
opacity = 0
}
-- taglist a.k.a workspaces
awful.tag({"ターミナル", "ミュージック", "ウェブ", "コード"}, scr, awful.layout.layouts[1])
local btn_tag = gears.table.join(
awful.button({}, 1, function(t) t:view_only() end),
awful.button({modkey}, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({}, 3, awful.tag.viewtoggle),
awful.button({modkey}, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({}, 4, function(t) awful.tag.viewnext(t.screen) end),
awful.button({}, 5, function(t) awful.tag.viewprev(t.screen) end)
)
panel.taglist = awful.widget.taglist {
screen = scr,
buttons = btn_tag,
filter = awful.widget.taglist.filter.all,
widget_template = {
{
{
id = "text_role",
widget = wibox.widget.textbox
},
left = 10,
right = 10,
widget = wibox.container.margin
},
id = "background_role",
widget = wibox.container.background
}
}
-- tasklist
local btn_task = gears.table.join(
awful.button({}, 1, function(c)
if c == client.focus then
c.minimized = true
else
c:emit_signal("request::activate", "tasklist", {raise = true})
end
end),
awful.button({}, 4, function() awful.client.focus.byidx(1) end),
awful.button({}, 5, function() awful.client.focus.byidx(-1) end)
)
panel.tasklist = awful.widget.tasklist {
screen = scr,
filter = awful.widget.tasklist.filter.currenttags,
buttons = btn_task,
layout = {
layout = wibox.layout.fixed.horizontal
},
widget_template = {
{
{
{
id = 'text_role',
widget = wibox.widget.textbox
},
left = 10,
right = 10,
bottom = 2,
widget = wibox.container.margin
},
id = 'background_role',
widget = wibox.container.background,
},
top = 5,
bottom = 5,
widget = wibox.container.margin
},
}
-- widget
--! FontAwesome icons
panel.volume = require("widgets.ponymix")
panel.battery = require("widgets.upower")
panel.xbacklight = require("widgets.xbacklight")
-- layouts
panel.left = {
wibox.widget.textclock("%I:%M %p"), SP, panel.taglist, SP,
layout = wibox.layout.fixed.horizontal
}
panel.middle = {
panel.tasklist,
layout = wibox.layout.align.horizontal
}
panel.right = {
SP, panel.xbacklight, SP, panel.volume, SP, panel.battery,
layout = wibox.layout.fixed.horizontal
}
-- setup main wibar
panel.main = awful.wibar {
position = "top",
screen = scr
}
panel.main:setup {
{
panel.left,
panel.middle,
panel.right,
layout = wibox.layout.align.horizontal
},
left = 20,
right = 20,
widget = wibox.container.margin
}
end)
-- dynamic wibar corner radius
local function wibar_shapemanager(c)
panel.main.shape = function(cr, w, h)
if c.fullscreen or c.maximized then
gears.shape.partially_rounded_rect(cr, w, h, false, false, true, true, 0)
else
gears.shape.partially_rounded_rect(cr, w, h, false, false, true, true,
beautiful.wibar_corner_radius or 10)
end
end
end
client.connect_signal("manage", function(c) wibar_shapemanager(c) end)
client.connect_signal("request::geometry", function(c) wibar_shapemanager(c) end)
client.connect_signal("request::activate", function(c) wibar_shapemanager(c) end)
screen.connect_signal("tag::history::update", function(c) wibar_shapemanager(c) end)
|
-- --------------------
-- TellMeWhen
-- Originally by Nephthys of Hyjal <lieandswell@yahoo.com>
-- Other contributions by:
-- Sweetmms of Blackrock, Oozebull of Twisting Nether, Oodyboo of Mug'thol,
-- Banjankri of Blackrock, Predeter of Proudmoore, Xenyr of Aszune
-- Currently maintained by
-- Cybeloras of Aerie Peak/Detheroc/Mal'Ganis
-- --------------------
if not TMW then return end
local TMW = TMW
local L = TMW.L
local print = TMW.print
local floor, min, max, strsub, strfind =
floor, min, max, strsub, strfind
local pairs, ipairs, sort, tremove, CopyTable =
pairs, ipairs, sort, tremove, CopyTable
local CI = TMW.CI
local LSM = LibStub("LibSharedMedia-3.0")
-- GLOBALS: CreateFrame, NORMAL_FONT_COLOR
local EVENTS = TMW.EVENTS
local Sound = TMW.EVENTS:GetEventHandler("Sound")
Sound.handlerName = L["SOUND_TAB"]
Sound.handlerDesc = L["SOUND_TAB_DESC"]
Sound.LSM = LSM
TMW.HELP:NewCode("SND_INVALID_CUSTOM")
TMW:RegisterCallback("TMW_OPTIONS_LOADED", function()
local ConfigContainer = Sound.ConfigContainer
ConfigContainer.SoundList.frames = {}
ConfigContainer.Header:SetText(L["SOUND_SOUNDTOPLAY"])
end)
function Sound:GetFrame(id)
local SoundList = self.ConfigContainer.SoundList
local frames = SoundList.frames
if frames[id] then
return frames[id]
end
local frame = TMW.C.Config_CheckButton:New("CheckButton", nil, SoundList, "TellMeWhen_SoundSelectButton", id)
frames[id] = frame
if id == 1 then
frame:SetPoint("TOP", 0, 0)
else
frame:SetPoint("TOP", frames[id-1], "BOTTOM", 0, 0)
end
return frame
end
---------- Events ----------
function Sound:LoadSettingsForEventID(id)
self:SelectSound(EVENTS:GetEventSettings().Sound)
self.ConfigContainer:RequestReload()
end
function Sound:GetEventDisplayText(eventID)
if not eventID then return end
local name = EVENTS:GetEventSettings(eventID).Sound
if name == "None" then
name = "|cff808080" .. NONE
end
return ("|cffcccccc" .. self.handlerName .. ":|r " .. name)
end
---------- Sounds ----------
local soundSorter = function(a, b)
local TMWa = strsub(a, 1, 3) == "TMW"
local TMWb = strsub(b, 1, 3) == "TMW"
if TMWa or TMWb then
if TMWa and TMWb then
return a < b
else
return TMWa
end
else
return a < b
end
end
function Sound:CompileSoundList()
if not Sound.List or #LSM:List("sound")-1 ~= #Sound.List then
Sound.List = CopyTable(LSM:List("sound"))
-- We'll just put this back at the end instead of trying to sort it.
TMW.tDeleteItem(Sound.List, "None")
sort(Sound.List, soundSorter)
tinsert(Sound.List, 1, "None")
end
end
function Sound:SetupSoundList()
self:CompileSoundList()
for i = 1, #Sound.List do
local soundName = Sound.List[i]
local frame = self:GetFrame(i)
frame.soundName = soundName
frame.Name:SetText(soundName)
frame:SetSetting("Sound", soundName)
frame.soundFile = LSM:Fetch("sound", soundName)
if soundName == "None" then
-- No need to show this if the sound isn't none. None will always be #1.
frame.Play:Hide()
end
frame:Show()
end
local frames = self.ConfigContainer.SoundList.frames
for i = #Sound.List + 1, #frames do
frames[i]:Hide()
end
end
function Sound:SelectSound(name)
if not name then return end
self:SetupSoundList()
local listID = TMW.tContains(Sound.List, name)
if listID then
local soundFrame = self:GetFrame(listID)
self.ConfigContainer.SoundList.ScrollFrame:ScrollToFrame(soundFrame)
end
end
---------- Tests ----------
local soundChannels = {
-- GLOBALS: SOUND_VOLUME, MUSIC_VOLUME, AMBIENCE_VOLUME, DIALOG_VOLUME
SFX = {
text = ENABLE_SOUNDFX,
enableCVar = "Sound_EnableSFX",
volumeCVar = "Sound_SFXVolume",
},
Music = {
text = MUSIC_VOLUME,
enableCVar = "Sound_EnableMusic",
volumeCVar = "Sound_MusicVolume",
},
Ambience = {
text = AMBIENCE_VOLUME,
enableCVar = "Sound_EnableAmbience",
volumeCVar = "Sound_AmbienceVolume",
},
Dialog = {
text = DIALOG_VOLUME,
enableCVar = "Sound_EnableDialog",
volumeCVar = "Sound_DialogVolume",
},
Master = {
text = MASTER_VOLUME,
enableCVar = "Sound_EnableAllSound",
volumeCVar = "Sound_MasterVolume",
},
}
TMW.HELP:NewCode("SOUND_TEST_ERROR", 10, false)
function Sound:TestSound(button, soundFile)
if tonumber(soundFile) then
PlaySoundKitID(soundFile)
else
PlaySoundFile(soundFile, TMW.db.profile.SoundChannel)
end
local error
if GetCVar("Sound_EnableAllSound") == "0" then
error = L["SOUND_ERROR_ALLDISABLED"]
else
local channelData = soundChannels[TMW.db.profile.SoundChannel]
if GetCVar(channelData.enableCVar) == "0" then
error = L["SOUND_ERROR_DISABLED"]:format(channelData.text)
elseif GetCVar(channelData.volumeCVar) == "0" then
error = L["SOUND_ERROR_MUTED"]:format(channelData.text)
end
end
if error then
TMW.HELP:Show{
code = "SOUND_TEST_ERROR",
icon = TMW.CI.icon,
relativeTo = button,
x = 0,
y = 0,
text = format(error)
}
end
end
|
require "spirograph"
pncl("#F0A0A0")
-- +-------------------------- radius of equator circle
-- | +--------------------- radius of the bicycle wheel circle
-- | | +---------------- (optional) position of the drawing point
-- | | | +------------ (optional) resolution of the graph
-- | | | | +------- (optional) delay in seconds
-- | | | | | +- (optional) show spirograph circles
-- v v v v v v
spiro(18, 65, 72, 60, 0.003)
wait()
-- Try varying the radius of the bicycle wheel
-- Try varying the value of the resolution using small numbers (2-20)
|
--***********************************************************
--** THE INDIE STONE **
--** Author: turbotutone **
--***********************************************************
require "ISUI/ISPanel"
---@class ISMoveablesIconToolTip : ISPanel
ISMoveablesIconToolTip = ISPanel:derive("ISMoveablesIconToolTip");
function ISMoveablesIconToolTip:initialise()
ISPanel.initialise(self)
end
function ISMoveablesIconToolTip:createChildren()
self:setWidth(self.marginOffset + getTextManager():MeasureStringX(UIFont.Small, self.subText)+20 )
end
function ISMoveablesIconToolTip:prerender()
ISPanel.prerender(self);
end
function ISMoveablesIconToolTip:render()
ISPanel.render(self);
if getCell():getDrag(0) and getCell():getDrag(0).isMoveableCursor then
self.subText = getText("IGUI_ToggleMode", Keyboard.getKeyName(getCore():getKey("Toggle mode")) ); --"Press '"..Keyboard.getKeyName(getCore():getKey("Toggle mode")).."' to change mode.";
local text = getCell():getDrag(0):getMoveableMode():gsub("^%l", string.upper)
local textY = (self:getHeight() - self.fontheight * 2) / 2
self:drawText(getText("IGUI_" .. text), self.marginOffset+5,textY,1.0,0.85,0.05,1.0,UIFont.Small);
self:drawText(self.subText, self.marginOffset+5,textY+self.fontheight,0.75,0.75,0.75,1.0,UIFont.Small);
end
end
function ISMoveablesIconToolTip:new (x, y, width, height, marginOffset)
local o = ISPanel:new(x, y, width, height);
setmetatable(o, self)
self.__index = self
o.x = x;
o.y = y;
o.marginOffset = marginOffset or 0;
o.background = true;
o.subText = "Press '"..Keyboard.getKeyName(getCore():getKey("Toggle mode")).."' to change mode.";
o.backgroundColor = {r=0, g=0, b=0, a=0.35};
o.borderColor = {r=0.80, g=0.80, b=0.80, a=0};
o.width = width;
o.height = height;
o.anchorLeft = true;
o.anchorRight = false;
o.anchorTop = true;
o.anchorBottom = false;
o.fontheight = getTextManager():MeasureStringY(UIFont.Small, "AbdfghijklpqtyZ")+2;
return o
end
|
object_tangible_collection_rock_burning_05 = object_tangible_collection_shared_rock_burning_05:new {
gameObjectType = 8211,}
ObjectTemplates:addTemplate(object_tangible_collection_rock_burning_05, "object/tangible/collection/rock_burning_05.iff")
|
--
-- Defines which commands are defined in the context player
--
local COMMANDS = require 'scripts.helpers.command'
local PLA = require 'scripts.modules.player.actions'
local PLAYER = {}
PLAYER[#PLAYER + 1] = { COMMANDS.zeroArg("/who"), PLA.who }
PLAYER[#PLAYER + 1] = { COMMANDS.arbyArg("/setName"), PLA.setName }
return PLAYER
|
local vmf = get_mod("VMF")
-- #####################################################################################################################
-- ##### Local functions ###############################################################################################
-- #####################################################################################################################
local function pack_pcall(status, ...)
return status, {n = select('#', ...), ...}
end
local function print_error_callstack(error_message)
if type(error_message) == "table" and error_message.error then
error_message = error_message.error
end
print("Error: " .. tostring(error_message) .. "\n" .. Script.callstack())
return error_message
end
local function show_error(mod, error_prefix_data, error_message)
local error_prefix
if type(error_prefix_data) == "table" then
error_prefix = string.format(error_prefix_data[1], error_prefix_data[2], error_prefix_data[3], error_prefix_data[4])
else
error_prefix = error_prefix_data
end
mod:error("%s: %s", error_prefix, error_message)
end
-- #####################################################################################################################
-- ##### VMFMod ########################################################################################################
-- #####################################################################################################################
function VMFMod:pcall(...)
return vmf.safe_call(self, "(pcall)", ...)
end
function VMFMod:dofile(file_path)
local _, return_values = pack_pcall(vmf.safe_call_dofile(self, "(dofile)", file_path))
return unpack(return_values, 1, return_values.n)
end
-- #####################################################################################################################
-- ##### VMF internal functions and variables ##########################################################################
-- #####################################################################################################################
-- Safe Call
function vmf.safe_call(mod, error_prefix_data, func, ...)
local success, return_values = pack_pcall(xpcall(func, print_error_callstack, ...))
if not success then
show_error(mod, error_prefix_data, return_values[1])
return success
end
return success, unpack(return_values, 1, return_values.n)
end
-- Safe Call [No return values]
function vmf.safe_call_nr(mod, error_prefix_data, func, ...)
local success, error_message = xpcall(func, print_error_callstack, ...)
if not success then
show_error(mod, error_prefix_data, error_message)
end
return success
end
-- Safe Call [No return values and error callstack]
function vmf.safe_call_nrc(mod, error_prefix_data, func, ...)
local success, error_message = pcall(func, ...)
if not success then
show_error(mod, error_prefix_data, error_message)
end
return success
end
-- Safe Call [dofile]
function vmf.safe_call_dofile(mod, error_prefix_data, file_path)
if type(file_path) ~= "string" then
show_error(mod, error_prefix_data, "file path should be a string.")
return false
end
return vmf.safe_call(mod, error_prefix_data, dofile, file_path)
end
-- Format error message and throw error.
function vmf.throw_error(error_message, ...)
error(string.format(error_message, ...), 0)
end
|
local typedefs = require "kong.db.schema.typedefs"
local openssl_pkey = require "resty.openssl.pkey"
local openssl_x509 = require "resty.openssl.x509"
local type = type
return {
name = "certificates",
primary_key = { "id" },
dao = "kong.db.dao.certificates",
workspaceable = true,
fields = {
{ id = typedefs.uuid, },
{ created_at = typedefs.auto_timestamp_s },
{ cert = typedefs.certificate { required = true }, },
{ key = typedefs.key { required = true }, },
{ cert_alt = typedefs.certificate { required = false }, },
{ key_alt = typedefs.key { required = false }, },
{ tags = typedefs.tags },
},
entity_checks = {
{ mutually_required = { "cert_alt", "key_alt" } },
{ custom_entity_check = {
field_sources = { "cert", "key" },
fn = function(entity)
local cert = openssl_x509.new(entity.cert)
local key = openssl_pkey.new(entity.key)
if cert:get_pubkey():to_PEM() ~= key:to_PEM("public") then
return nil, "certificate does not match key"
end
return true
end,
} },
{ custom_entity_check = {
field_sources = { "cert_alt", "key_alt" },
fn = function(entity)
if type(entity.cert_alt) == "string" and type(entity.key_alt) == "string" then
local cert_alt = openssl_x509.new(entity.cert_alt)
local key_alt = openssl_pkey.new(entity.key_alt)
if cert_alt:get_pubkey():to_PEM() ~= key_alt:to_PEM("public") then
return nil, "alternative certificate does not match key"
end
end
return true
end,
} },
{ custom_entity_check = {
field_sources = { "cert", "cert_alt" },
fn = function(entity)
if type(entity.cert) == "string" and type(entity.cert_alt) == "string" then
local cert = openssl_x509.new(entity.cert)
local cert_alt = openssl_x509.new(entity.cert_alt)
local cert_type = cert:get_pubkey():get_key_type()
local cert_alt_type = cert_alt:get_pubkey():get_key_type()
if cert_type.id == cert_alt_type.id then
return nil, "certificate and alternative certificate need to have " ..
"different type (e.g. RSA and ECDSA), the provided " ..
"certificates were both of the same type"
end
end
return true
end,
} },
}
}
|
mapFields = require "lib/mapFields"
target.transfer_field(mapFields.getID("PenguinPort"), 1)
|
project "ImGuizmo"
kind "StaticLib"
language "C++"
cppdialect "C++17"
staticruntime "on"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
files
{
"ImGuizmo.h",
"ImGuizmo.cpp",
"ImSequencer.h",
"ImSequencer.cpp",
"ImGradient.cpp",
"ImGradient.h",
"ImCurveEdit.cpp",
"ImCurveEdit.h",
}
includedirs
{
"../imgui"
}
defines
{
"_CRT_SECURE_NO_WARNINGS"
}
filter "system:windows"
systemversion "latest"
filter "configurations:Debug"
runtime "Debug"
symbols "on" -- debug version --
filter "configurations:Release"
runtime "Release"
optimize "on" -- release version --
|
local Console =
{
Name = "Console",
Type = "System",
Namespace = "C_Console",
Functions =
{
{
Name = "GetAllCommands",
Type = "Function",
Returns =
{
{ Name = "commands", Type = "table", InnerType = "ConsoleCommandInfo", Nilable = false },
},
},
{
Name = "GetColorFromType",
Type = "Function",
Arguments =
{
{ Name = "colorType", Type = "ConsoleColorType", Nilable = false },
},
Returns =
{
{ Name = "color", Type = "table", Mixin = "ColorMixin", Nilable = false },
},
},
{
Name = "GetFontHeight",
Type = "Function",
Returns =
{
{ Name = "fontHeightInPixels", Type = "number", Nilable = false },
},
},
{
Name = "PrintAllMatchingCommands",
Type = "Function",
Arguments =
{
{ Name = "partialCommandText", Type = "string", Nilable = false },
},
},
{
Name = "SetFontHeight",
Type = "Function",
Arguments =
{
{ Name = "fontHeightInPixels", Type = "number", Nilable = false },
},
},
},
Events =
{
{
Name = "ConsoleClear",
Type = "Event",
LiteralName = "CONSOLE_CLEAR",
},
{
Name = "ConsoleColorsChanged",
Type = "Event",
LiteralName = "CONSOLE_COLORS_CHANGED",
},
{
Name = "ConsoleFontSizeChanged",
Type = "Event",
LiteralName = "CONSOLE_FONT_SIZE_CHANGED",
},
{
Name = "ConsoleLog",
Type = "Event",
LiteralName = "CONSOLE_LOG",
Payload =
{
{ Name = "message", Type = "string", Nilable = false },
},
},
{
Name = "ConsoleMessage",
Type = "Event",
LiteralName = "CONSOLE_MESSAGE",
Payload =
{
{ Name = "message", Type = "string", Nilable = false },
{ Name = "colorType", Type = "number", Nilable = false },
},
},
{
Name = "CvarUpdate",
Type = "Event",
LiteralName = "CVAR_UPDATE",
Payload =
{
{ Name = "eventName", Type = "string", Nilable = false },
{ Name = "value", Type = "string", Nilable = false },
},
},
{
Name = "GlueConsoleLog",
Type = "Event",
LiteralName = "GLUE_CONSOLE_LOG",
Payload =
{
{ Name = "message", Type = "string", Nilable = false },
},
},
{
Name = "ToggleConsole",
Type = "Event",
LiteralName = "TOGGLE_CONSOLE",
Payload =
{
{ Name = "showConsole", Type = "bool", Nilable = true },
},
},
},
Tables =
{
{
Name = "ConsoleCategory",
Type = "Enumeration",
NumValues = 11,
MinValue = 0,
MaxValue = 10,
Fields =
{
{ Name = "Debug", Type = "ConsoleCategory", EnumValue = 0 },
{ Name = "Graphics", Type = "ConsoleCategory", EnumValue = 1 },
{ Name = "Console", Type = "ConsoleCategory", EnumValue = 2 },
{ Name = "Combat", Type = "ConsoleCategory", EnumValue = 3 },
{ Name = "Game", Type = "ConsoleCategory", EnumValue = 4 },
{ Name = "Default", Type = "ConsoleCategory", EnumValue = 5 },
{ Name = "Net", Type = "ConsoleCategory", EnumValue = 6 },
{ Name = "Sound", Type = "ConsoleCategory", EnumValue = 7 },
{ Name = "Gm", Type = "ConsoleCategory", EnumValue = 8 },
{ Name = "Reveal", Type = "ConsoleCategory", EnumValue = 9 },
{ Name = "None", Type = "ConsoleCategory", EnumValue = 10 },
},
},
{
Name = "ConsoleColorType",
Type = "Enumeration",
NumValues = 12,
MinValue = 0,
MaxValue = 11,
Fields =
{
{ Name = "DefaultColor", Type = "ConsoleColorType", EnumValue = 0 },
{ Name = "InputColor", Type = "ConsoleColorType", EnumValue = 1 },
{ Name = "EchoColor", Type = "ConsoleColorType", EnumValue = 2 },
{ Name = "ErrorColor", Type = "ConsoleColorType", EnumValue = 3 },
{ Name = "WarningColor", Type = "ConsoleColorType", EnumValue = 4 },
{ Name = "GlobalColor", Type = "ConsoleColorType", EnumValue = 5 },
{ Name = "AdminColor", Type = "ConsoleColorType", EnumValue = 6 },
{ Name = "HighlightColor", Type = "ConsoleColorType", EnumValue = 7 },
{ Name = "BackgroundColor", Type = "ConsoleColorType", EnumValue = 8 },
{ Name = "ClickbufferColor", Type = "ConsoleColorType", EnumValue = 9 },
{ Name = "PrivateColor", Type = "ConsoleColorType", EnumValue = 10 },
{ Name = "DefaultGreen", Type = "ConsoleColorType", EnumValue = 11 },
},
},
{
Name = "ConsoleCommandType",
Type = "Enumeration",
NumValues = 4,
MinValue = 0,
MaxValue = 3,
Fields =
{
{ Name = "Cvar", Type = "ConsoleCommandType", EnumValue = 0 },
{ Name = "Command", Type = "ConsoleCommandType", EnumValue = 1 },
{ Name = "Macro", Type = "ConsoleCommandType", EnumValue = 2 },
{ Name = "Script", Type = "ConsoleCommandType", EnumValue = 3 },
},
},
{
Name = "ConsoleCommandInfo",
Type = "Structure",
Fields =
{
{ Name = "command", Type = "string", Nilable = false },
{ Name = "help", Type = "string", Nilable = false },
{ Name = "category", Type = "ConsoleCategory", Nilable = false },
{ Name = "commandType", Type = "ConsoleCommandType", Nilable = false },
{ Name = "scriptContents", Type = "string", Nilable = false },
{ Name = "scriptParameters", Type = "string", Nilable = false },
},
},
},
};
APIDocumentation:AddDocumentationTable(Console);
|
function setup (thread)
print ("setup >> " .. thread.tindex .. " of " .. thread.tcount)
end
function init(x)
print ("init >> " .. wrk.thread.tindex .. " of " .. wrk.thread.tcount)
end
|
--[[
╔════════════════════════════════════════╗
║ Settings for monsonjeremy/onedark.nvim ║
╚════════════════════════════════════════╝
--]]
require("onedark").setup {
-- Change the 'hint' color to the 'orange' color, and make the 'error' color bright red
colors = { hint = 'orange', error = '#ff0000' },
sidebars = { 'qf', 'vista_kind', 'terminal', 'packer' },
transparent = true,
}
-- Load the colorscheme
vim.cmd [[colorscheme onedark]]
|
-----------------------------------------------------------------------------
-- =x=|DoN|=x= ( 7eJAzZy )
-- Date: 2014/2015
-- Skype: DON.81
-- Please don't remove my rights
-----------------------------------------------------------------------------
local LanguageTableList = {
{"Arabic"},
{"Spanish"},
{"Hindi"},
{"Portuguese"},
{"Russian"},
{"German"},
{"French"},
{"Turkish"},
{"Polish"},
{"Romanian"},
{"Dutch"},
{"Hungarian"},
{"Lithuanian"},
{"Swedish"},
{"Latvian"},
{"Balkan"},
{"Italian"},
}
function isLanguageInTable(language)
for i, v in ipairs(LanguageTableList) do
if language == v[1] then return true end
end
return false
end
WindowLanguage = guiCreateWindow(0.36, 0.16, 0.31, 0.68, "Languages for Language Chat", true)
guiSetVisible ( WindowLanguage, false )
GridlistLanguage = guiCreateGridList(0.04, 0.06, 0.92, 0.69, true, WindowLanguage)
table.sort(LanguageTableList, function(a, b) return a[1]:upper() < b[1]:upper() end)
guiGridListAddColumn(GridlistLanguage, "Languages List", 0.9)
for i,v in ipairs ( LanguageTableList ) do
local Row = guiGridListAddRow( GridlistLanguage )
guiGridListSetItemText( GridlistLanguage, Row, 1, v[1], false, false )
end
setNewLanguage = guiCreateButton(0.04, 0.77, 0.92, 0.09, "Set new Language", true, WindowLanguage)
Close = guiCreateButton(0.04, 0.88, 0.92, 0.09, "Close", true, WindowLanguage)
addEventHandler("onClientGUIClick",resourceRoot,
function ( )
local row, col = guiGridListGetSelectedItem ( GridlistLanguage )
local Group = guiGridListGetItemText(GridlistLanguage,row,1 )
if source == setNewLanguage then
if ( row and col and row ~= -1 and col ~= -1 ) then
setElementData(localPlayer,"Language",Group,true)
outputChatBox("Your new Language chat is "..getElementData(localPlayer,"Language")..". Press R to talk in Language Chat",0,255,0)
triggerServerEvent ( "setNewLanguageBindKey",resourceRoot )
-- Saves selected language locally in a XML file
local languageXML = xmlLoadFile("/settings/language.xml")
local theChild = xmlFindChild(languageXML, "language", 0)
if theChild then
xmlNodeSetValue(theChild, Group)
else
local theNewChild = xmlCreateChild(languageXML, "language")
xmlNodeSetValue(theNewChild, Group)
end
xmlSaveFile(languageXML)
xmlUnloadFile(languageXML)
guiSetVisible( WindowLanguage , not guiGetVisible(WindowLanguage))
showCursor(guiGetVisible(WindowLanguage))
else
outputChatBox("Please choose a langauge",255,0,0)
end
elseif source == Close then
guiSetVisible( WindowLanguage , not guiGetVisible(WindowLanguage))
showCursor(guiGetVisible(WindowLanguage))
end
end )
function OpenWindow( )
guiSetVisible( WindowLanguage , not guiGetVisible(WindowLanguage))
showCursor(guiGetVisible(WindowLanguage))
end
addCommandHandler("language",OpenWindow)
-- Fetches the user's language from the locally XML file
local languageXML = xmlLoadFile("/settings/language.xml")
if not languageXML then
languageXML = xmlCreateFile("/settings/language.xml", "settings")
xmlSaveFile(languageXML)
OpenWindow()
else
local theChild = xmlFindChild(languageXML, "language", 0)
if theChild then
local language = xmlNodeGetValue(theChild)
if isLanguageInTable(language) then
setElementData(localPlayer, "Language", language, true)
triggerServerEvent ( "setNewLanguageBindKey",resourceRoot )
else
OpenWindow()
end
end
end
xmlUnloadFile(languageXML)
|
local L = LibStub("AceLocale-3.0"):GetLocale("MillButton")
local mill = CreateFrame("Button","MillButton",UIParent,"SecureActionButtonTemplate")
mill:SetAttribute("type","macro")
local item_herb = GetItemSubClassInfo(LE_ITEM_CLASS_TRADEGOODS, 9) --Simple way to get ingame localized ItemType "Herb" through Auctionshouseframe translation
msn = 51005
mill_spell = GetSpellInfo(msn) --SpellID for Milling
local function findherb()
for bag=0,4 do --search only in our bags for herbs 0=default bag 1 to 4 additional bagslots
for slot=1,GetContainerNumSlots(bag) do --start at slot 1
local itemID = GetContainerItemID(bag, slot)
local _, count = GetContainerItemInfo(bag, slot)
if itemID then
local itemName, itemLink, _, _, _, _, itemType = GetItemInfo(itemID)
for i = 1, #MillButtonExpansions do
if (MillButtonDB[itemID]) and count >= 5 then
return bag, slot
end
end
for i = 1, #MillButtonExpansions do
if itemType==item_herb and MillButtonDB[itemID]==false and MillButtonSettings.extended==true then
local itemName, itemLink, _, _, _, _, itemType = GetItemInfo(itemID)
DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00MillButton: |r"..count.."x "..itemLink.." "..L["skipped"])
end
end
end
end
end
end
function MillButtonSetup()
local bag, slot = findherb()
if (not bag or not slot) or LootFrame:IsVisible() or CastingBarFrame:IsVisible() or UnitCastingInfo("player") then
-- do nothing if no herb, if looting or casting
MillButton:SetAttribute("macrotext","")
if not bag then
DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00MillButton: |r"..L["error"])
end
else
MillButton:SetAttribute("macrotext","/"..L["macro_cast"].." "..mill_spell.."\n/"..L["macro_use"].." "..bag.." "..slot)
end
end
|
local path = (...):sub(1, #(...) - #(".motion.MotionQueueManager"))
local Luaoop = require(path..".3p.Luaoop")
local MotionQueueEntry = require(path..".motion.MotionQueueEntry")
---@alias L2DF.MotionEventFunction fun(caller: L2DF.MotionQueueManager, eventValue: string, customData)
---@class L2DF.MotionQueueManager
---@field protected userTimeSeconds number
---@field private motions L2DF.MotionQueueEntry[]
---@field private eventCallback L2DF.MotionEventFunction
---@field private eventCustomData any
local MotionQueueManager = Luaoop.class("L2DF.MotionQueueManager")
function MotionQueueManager:__construct()
self.userTimeSeconds = 0
self.motions = {}
self.eventCallback = nil
self.eventCustomData = nil
end
---@param motion L2DF.AMotion
---@param userTimeSeconds number
function MotionQueueManager:startMotion(motion, userTimeSeconds)
if motion == nil then
return nil
end
for _, mqe in ipairs(self.motions) do
mqe:startFadeout(mqe.motion:getFadeOutTime(), userTimeSeconds)
end
local mqe = MotionQueueEntry() ---@type L2DF.MotionQueueEntry
mqe.motion = motion
self.motions[#self.motions + 1] = mqe
return mqe
end
---@param model L2DF.Model
---@param userTimeSeconds number
function MotionQueueManager:doUpdateMotion(model, userTimeSeconds)
local updated = false
local markedForDeletion = {} ---@type number[]
for i, mqe in ipairs(self.motions) do
local motion = mqe.motion
if motion then
motion:updateParameters(model, mqe, userTimeSeconds)
updated = true
local firedList = motion:getFiredEvents(
mqe:getLastCheckedEventTime() - mqe:getStartTime(),
userTimeSeconds - mqe:getStartTime()
)
for _, f in ipairs(firedList) do
self.eventCallback(self, f, self.eventCustomData)
end
mqe:setLastCheckEventTime(userTimeSeconds)
if mqe:isFinished() then
markedForDeletion[#markedForDeletion + 1] = i
end
else
markedForDeletion[#markedForDeletion + 1] = i
end
end
-- Remove from backward
for i = #markedForDeletion, 1, -1 do
table.remove(self.motions, markedForDeletion[i])
end
return updated
end
function MotionQueueManager:isFinished()
for _, mqe in ipairs(self.motions) do
if mqe.motion and mqe:isFinished() == false then
return false
end
end
return true
end
function MotionQueueManager:stopAllMotions()
for i = #self.motions, 1, -1 do
self.motions[i] = nil
end
end
---@param callback L2DF.MotionEventFunction
function MotionQueueManager:setEventCallback(callback, customData)
self.eventCallback = callback
self.eventCustomData = customData
end
return MotionQueueManager
|
bc.private = {}
function bc.private.sendPrivate( chan, from, to, text, noLog )
if not to or not to:IsValid() then return end
if not noLog then
bc.logs.sendLog( bc.defines.channelTypes.PRIVATE, "Private", from, " → ", to, ": ", text )
end
if bc.base.playersEnabled[to] then
net.Start( "BC_PM" )
net.WriteEntity( chan )
net.WriteEntity( from )
net.WriteString( text )
net.Send( to )
else
local recip = chan == from and to or chan
bc.manager.sendNormalClient( to, from, " to ", recip, bc.defines.colors.white, ": ", text )
end
end
function bc.private.allowed( ply )
return bc.settings.isAllowed( ply, "psay" )
end
function bc.private.canMessage( from, to )
if not bc.manager.canMessage( from ) then return false end
return bc.private.allowed( from ) and bc.private.allowed( to )
end
-- Dark rp
local function DarkRP_PM( ply, args )
local namepos = string.find( args, " " )
if not namepos then
DarkRP.notify( ply, 1, 4, DarkRP.getPhrase( "invalid_x", DarkRP.getPhrase( "arguments" ), "" ) )
return ""
end
local name = string.sub( args, 1, namepos - 1 )
local msg = string.sub( args, namepos + 1 )
if msg == "" then
DarkRP.notify( ply, 1, 4, DarkRP.getPhrase( "invalid_x", DarkRP.getPhrase( "arguments" ), "" ) )
return ""
end
local target = DarkRP.findPlayer( name )
if not bc.private.canMessage( ply, target ) then return "" end
if target == ply then
if bc.base.playersEnabled[ply] then
bc.private.sendPrivate( ply, ply, ply, msg )
end
return ""
end
if target then
bc.private.sendPrivate( ply, ply, target, msg, true )
bc.private.sendPrivate( target, ply, ply, msg )
else
DarkRP.notify( ply, 1, 4, DarkRP.getPhrase( "could_not_find", tostring( name ) ) )
end
return ""
end
hook.Add( "PostGamemodeLoaded", "BC_RPOverload", function()
if DarkRP then
local chatcommands = DarkRP.getChatCommands()
if chatcommands and chatcommands["pm"] then
print( "[BetterChat] Found DarkRP PM, replacing with BetterChat PM" )
DarkRP.defineChatCommand( "pm", DarkRP_PM, 1.5 )
end
end
end )
|
--[[
/////// //////////////////
/////// PROJECT: MTA iLife - German Fun Reallife Gamemode
/////// VERSION: 1.7.2
/////// DEVELOPERS: See DEVELOPERS.md in the top folder
/////// LICENSE: See LICENSE.md in the top folder
/////// /////////////////
]]
-- #######################################
-- ## Project: MTA iLife ##
-- ## Name: TuningGarage.lua ##
-- ## Author: Noneatme ##
-- ## Version: 1.0 ##
-- ## License: See top Folder ##
-- #######################################
-- FUNCTIONS / METHODS --
local cFunc = {}; -- Local Functions
local cSetting = {}; -- Local Settings
TuningGarage = {};
TuningGarage.__index = TuningGarage;
--[[
]]
local tuningGarageID = 1;
-- ///////////////////////////////
-- ///// New //////
-- ///// Returns: Object //////
-- ///////////////////////////////
function TuningGarage:New(...)
local obj = setmetatable({}, {__index = self});
if obj.Constructor then
obj:Constructor(...);
end
return obj;
end
-- ///////////////////////////////
-- ///// EnterPlayerGarage //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TuningGarage:EnterPlayerGarage(uPlayer, uVehicle, iDistance)
local uElements = {uPlayer, uVehicle};
--self.dimension = 5;
self.dimension = getEmptyDimension();
for index, ele in pairs(uElements) do
setElementInterior(ele, self.interior);
setElementDimension(ele, self.dimension);
end
setElementPosition(uVehicle, self.carPosition[1], self.carPosition[2], self.carPosition[3], false);
setElementRotation(uVehicle, self.carPosition[4], self.carPosition[5], self.carPosition[6]);
setElementFrozen(uVehicle, true);
toggleAllControls(uPlayer, false)
--[[
local health = getElementHealth(uVehicle)
fixVehicle(uVehicle);
setElementHealth(uVehicle, health)
--]]
triggerClientEvent(uPlayer, "onClientPlayerEnterTuningGarage", uPlayer, self.id, self.interior, self.dimension, self.sLogo)
end
-- ///////////////////////////////
-- ///// ExitPlayerGarage //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TuningGarage:ExitPlayerGarage(uPlayer)
local uVehicle = getPedOccupiedVehicle(uPlayer);
local uElements = {uPlayer, uVehicle};
for index, ele in pairs(uElements) do
setElementInterior(ele, 0);
setElementDimension(ele, 0);
end
toggleAllControls(uPlayer, true)
setElementPosition(uVehicle, self.ausgangsPosition[1], self.ausgangsPosition[2], self.ausgangsPosition[3])
setElementRotation(uVehicle, self.ausgangsPosition[4], self.ausgangsPosition[5], self.ausgangsPosition[6])
setCameraTarget(uPlayer, uPlayer)
setElementFrozen(uVehicle, false);
fadeCamera(uPlayer, true);
if(getVehicleType(uVehicle) == "Bike") or (getVehicleType(uVehicle) == "BMX") or (getVehicleType(uVehicle) == "Quad") then
warpPedIntoVehicle(uPlayer, uVehicle);
end
end
-- ///////////////////////////////
-- ///// MarkerHit //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TuningGarage:MarkerHit(uElement)
if(getElementType(uElement) == "vehicle") and (getVehicleOccupant(uElement)) then
local uPlayer = getVehicleOccupant(uElement);
if(uPlayer) then
local uVehicle = getPedOccupiedVehicle(uPlayer);
if(uVehicle.OwnerName) and (uVehicle.OwnerName == getPlayerName(uPlayer)) then
if(#getVehicleOccupants(uVehicle) == 0) then
fadeCamera(uPlayer, false);
setTimer(function()
if(getVehicleType(uVehicle) == "Bike") or (getVehicleType(uVehicle) == "BMX") or (getVehicleType(uVehicle) == "Quad") then
warpPedIntoVehicle(uPlayer, uVehicle, 1);
end
self:EnterPlayerGarage(uPlayer, uVehicle);
end, 1000, 1)
else
uPlayer:showInfoBox("error", "Dein Auto ist nicht leer!");
end
else
uPlayer:showInfoBox("error", "Dieses Auto gehoert dir nicht!");
end
end
end
end
-- ///////////////////////////////
-- ///// Constructor //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TuningGarage:Constructor(fX, fY, fZ, iGarage, sName, aX, aY, aZ, aRX, aRY, aRZ, sLogo, iChain, iFilliale)
-- Klassenvariablen --
self.fX = fX;
self.fY = fY;
self.fZ = fZ;
self.iGarage = iGarage;
self.sName = sName;
self.sLogo = sLogo;
self.iChain = iChain;
self.iFilliale = iFilliale;
self.ausgangsPosition = {aX, aY, aZ, aRX, aRY, aRZ}
self.id = tuningGarageID;
tuningGarageID = tuningGarageID+1;
self.interior = 17;
self.carPosition = {4645.3178710938, 612.74725341797, 796.22052001953, 0, 0, -180};
self.blip = createBlip(fX, fY, fZ, 27)
if(self.iGarage) then
setGarageOpen(self.iGarage, true);
end
self.marker = createMarker(fX, fY, fZ, "corona", 2.0, 0, 255, 255, 255);
-- Methoden --
self.markerHitFunc = function(...) self:MarkerHit(...) end;
--addCommandHandler("enterdat", function(thePlayer)
-- self:EnterPlayerGarage(thePlayer, getPedOccupiedVehicle(thePlayer));
--end)
-- Events --
addEventHandler("onMarkerHit", self.marker, self.markerHitFunc);
--logger:OutputInfo("[CALLING] TuningGarage: Constructor");
end
-- EVENT HANDLER --
|
--------------------------------------------------------------------------------
-- Панели с реле и контакторами (ПР-143, ПР-144)
--------------------------------------------------------------------------------
Metrostroi.DefineSystem("PR_14X_Panels")
function TRAIN_SYSTEM:Initialize()
----------------------------------------------------------------------------
-- ПР-143
----------------------------------------------------------------------------
-- Контактор включения провода 1 (Р1-Р5)
self.Train:LoadSystem("R1_5","Relay","KPD-110E", { r1_5 = true })
-- Контактор 6-ого провода (К6)
self.Train:LoadSystem("K6","Relay","KPD-110E", { in_cabin = true })
-- Реле времени торможения (РВТ)
self.Train:LoadSystem("RVT","Relay","REV-811T", { rvt = true, open_time = 0.3, close_time = 0.1 })--(self.Train.Electric.TrainSolver:find("81-") and 0.3 or 0.7)
-- Реле педали бдительности (РПБ)
self.Train:LoadSystem("RPB","Relay","REV-813T", { in_cabin = true, open_time = 2.5, rpb = true })
-- РВ-2
self.Train:LoadSystem("RV_2","Relay","REV-813T",{in_cabin = true,close_time = 2.5})
----------------------------------------------------------------------------
-- ПР-144
----------------------------------------------------------------------------
-- Контактор 25ого провода (К25)
self.Train:LoadSystem("K25","Relay","PR-143", { in_cabin = true })
-- Реле-повторитель провода 8 (РП8)
self.Train:LoadSystem("Rp8","Relay","REV-811T")--, { in_cabin = true })
-- Контактор дверей (КД)
self.Train:LoadSystem("KD","Relay","REV-811T", { in_cabin_alt3 = true })
-- Реле освещения (РО)
self.Train:LoadSystem("RO","Relay","KPD-110E", { in_cabin = true })
end
function TRAIN_SYSTEM:Think()
--print("K25",self.Train.K25.Value)
--print("K6",self.Train.K6.Value)
--print("RVT",self.Train.RVT.Value)
if not self.Checked then
if not self.Train.Electric.TrainSolver:find("81") then
self.Train.RVT:TriggerInput("OpenTime",1)
--FailSim.AddParameter(self.Train.RVT,"OpenTime", { value = self.Train.RVT.open_time })--, precision = self.Train.RVT.contactor and 0.35 or 0.10, min = 0.010, varies = true })
end
self.Checked = true
end
if self.Train.KVT then
self.Train.RPB:TriggerInput("Set",(self.Train.PB.Value + self.Train.KVT.Value + self.Train.RV_2.Value)*self.Train.VB.Value)
else
self.Train.RPB:TriggerInput("Set",1)
end
end
|
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
ESX.RegisterUsableItem(Config.itemuse, function(source) --แก้ตรงpickaxe เป็นไอเท็มของคุณ
TriggerClientEvent('renzer_treasure:pickaxe', source)
TriggerClientEvent('esx_inventoryhud:cl', source)
end)
RegisterServerEvent('renzer_treasure:pickedUp')
AddEventHandler('renzer_treasure:pickedUp', function()
local xPlayer = ESX.GetPlayerFromId(source)
local xItem = xPlayer.getInventoryItem(Config.ItemName)
local xItemCount = math.random(Config.ItemCount[1], Config.ItemCount[2])
--
if xItem.limit ~= -1 and xItem.count >= xItem.limit then
TriggerClientEvent("mythic_notify:client:SendAlert", source, {
text = xItem.label..'ของคุณเต็ม',
type = "success",
timeout = 3000,
layout = "bottomCenter",
queue = "global"
})
else
if xItem.limit ~= -1 and (xItem.count + xItemCount) > xItem.limit then
xPlayer.setInventoryItem(xItem.name, xItem.limit)
else
xPlayer.addInventoryItem(xItem.name, xItemCount)
local sendToDiscord = '**' .. xPlayer.name .. '** ได้รับ **' .. xItem.label .. '** จำนวน '..xItemCount..' ชิ้น'
TriggerEvent('azael_discordlogs:sendToDiscord', 'RicePickedUp', sendToDiscord, source, '^2')
ItemBonus()
end
end
end)
function ItemBonus()
local xPlayer = ESX.GetPlayerFromId(source)
local xItem = xPlayer.getInventoryItem(Config.ItemBonus.ItemName2)
local xItemCount = Config.ItemBonus.ItemCount2
if xItem.limit ~= -1 and xItem.count >= xItem.limit then
TriggerClientEvent("mythic_notify:client:SendAlert", source, {
text = xItem.label..'ของคุณเต็ม',
type = "error",
timeout = 3000,
layout = "bottomCenter",
queue = "global"
})
else
if math.random(1, 100) <= Config.ItemBonus.Percent then
xPlayer.addInventoryItem(xItem.name, xItemCount)
local sendToDiscord = '**' .. xPlayer.name .. '** ได้รับโบนัท **' .. xItem.label .. '** จำนวน '..xItemCount..''
TriggerEvent('azael_discordlogs:sendToDiscord', 'RicePickedUp', sendToDiscord, source, '^9')
end
end
end
|
function isempty(s)
return s == nil or s == ''
end
function sendResponse(conn, response)
reponseNiceName = "unknown"
if response.status == nil then
response.status = 200
reponseNiceName = "OK"
end
if response.headers == nil then
response.headers = {}
end
conn:send("HTTP/1.1 " .. response.status .. " " .. reponseNiceName .. " \n")
foundContentType = false;
for k,v in pairs(response.headers) do
conn:send(k .. ":" .. v .. "\n")
if k == "Content-Type" then
foundContentType = true
end
end
if not foundContentType then
conn:send("Content-Type:application/json\n\n")
if response.content ~= nil then
conn:send(json.encode(response.content))
end
else
conn:send(response.content)
conn:send(json.encode(response.content))
end
response = nil
end
function elSplit( value, inSplitPattern, outResults )
if not outResults then
outResults = { }
end
local theStart = 1
local theSplitStart, theSplitEnd = string.find( value, inSplitPattern, theStart )
while theSplitStart do
table.insert( outResults, string.sub( value, theStart, theSplitStart-1 ) )
theStart = theSplitEnd + 1
theSplitStart, theSplitEnd = string.find( value, inSplitPattern, theStart )
end
table.insert( outResults, string.sub( value, theStart ) )
return outResults
end
function createRequest(payload)
local request = {}
local splitPayload = elSplit(payload, "\r\n\r\n")
local httpRequest = elSplit((splitPayload[1]), "\r\n")
if not isempty((splitPayload[2])) then
request.content = json.decode((splitPayload[2]))
end
local splitUp = elSplit((httpRequest[1]), "%s+")
request.method = (splitUp[1])
request.path = (splitUp[2])
request.protocal = (splitUp[3])
local pathParts = elSplit(request.path, "/")
local maybeId = tonumber((pathParts[table.getn(pathParts)]))
if maybeId ~= nil then
request.fullPath = request.url
request.path = string.sub(request.fullPath, 1, string.len(request.fullPath) - string.len("" .. maybeId))
request.id = maybeId
end
--request.headers = {}
--table.remove(httpRequest, 1)
--for idx, line in ipairs(httpRequest) do
--local header = elSplit(line, ":")
--local name = (header[1])
--local value = (header[2])
--request.headers[name] = value
--header = nil
--name = nil
--value = nil
--end
print(node.heap())
httpRequest = nil
splitUp = nil
splitPayload = nil
maybeId = nil
collectgarbage()
print(node.heap())
return request
end
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
print("Got something...")
local request = createRequest(payload)
print("Method: " .. request.method .. " Location: " .. request.path)
if HttpRequests[request.path] ~= nil then
if HttpRequests[request.path][request.method] ~= nil then
print("Executing code")
local response = HttpRequests[request.path][request.method](request)
sendResponse(conn, response)
response = nil
else
sendResponse(conn, {
status = 405,
content = { error = "Method not supported for URL", path = request.path}
});
end
else
if file.open(string.sub(request.path, 2)) ~= nil then
conn:send("HTTP/1.1 200 OK\n")
conn:send("Content-Type: text/html\n\n")
local line = file.readline()
while line ~= nil do
conn:send(line)
line = file.readline()
end
file.close()
else
sendResponse(conn, {
status = 404,
content = { error = "File not found", url = request.path}
})
end
end
conn:close()
request = nil
collectgarbage()
end)
end)
|
--
-- Example for stream compress
--
-- Initialize:
local bzlib = require 'ffi_bzlib.compress'
--[[
local bz = bzlib:new(
compresslevel, -- Optional, default is 9.
workfactor -- Optional, default is 30.
-- In fact, these two are parameters 'blockSize100k'
-- and 'workFactor' of the function 'BZ2_bzCompressInit'
)
]]--
local bz = bzlib:new()
local name = ...
if not name then
print("usage: luajit stream_compress.lua FILENAME")
os.exit(0)
end
local fd1 = io.open(name, 'r')
local fd2 = io.open(name .. '.bz2', 'wb')
-- Append data:
while true do
local ln = fd1:read('*line')
if not ln then
break
end
--[[
local part, err = bz:append(text)
-- Append part of data to this method.
-- In case of failed to compress, it will return
-- nil and a string contains error message.
]]--
local part, err = bz:append(ln .. '\n')
if not part then
print(err)
break
end
--[[
The returned string may be '' because libbz2.so may buffer some data.
In this case, there is no need to write the file.
]]--
if #part > 0 then
fd2:write(part)
end
end
fd1:close()
-- Clean up:
--[[
Use bz:finish() to tell libbz2.so that compress comes to an end.
This method will return all remaining data the libbz2.so has buffered.
]]--
local part, err = bz:finish()
if not part then
print(err)
end
fd2:write(part)
fd2:close()
|
--[[
Variables
]]
local Apartments = {}
--[[
Events
]]
RegisterNetEvent("SpawnEventsServer")
AddEventHandler("SpawnEventsServer", function()
local src = source
local cid = exports["caue-base"]:getChar(src, "id")
local hotel = exports["caue-base"]:getChar(src, "hotel")
local type = hotel
local room = 1
for i, v in ipairs(Apartments[type]) do
if v == 0 then
Apartments[type][i] = {
src = src,
cid = cid,
type = type,
room = i,
}
room = i
break
end
end
TriggerClientEvent("apartments:apartmentSpawn", src, hotel, room)
end)
AddEventHandler("caue-apartments:deSpawn", function(src)
for i, v in ipairs(Apartments) do
for i2, v2 in ipairs(v) do
if v2 ~= 0 then
if v2.src == src then
Apartments[i][i2] = 0
end
end
end
end
end)
AddEventHandler("playerDropped", function()
local src = source
for i, v in ipairs(Apartments) do
for i2, v2 in ipairs(v) do
if v2 ~= 0 then
if v2.src == src then
Apartments[i][i2] = 0
end
end
end
end
end)
--[[
RPCs
]]
RPC.register("GetMotelInformation", function(src, type, room)
return Apartments[type][room]
end)
--[[
Threads
]]
Citizen.CreateThread(function()
for i, v in ipairs(Apart.MaxRooms) do
Apartments[i] = {}
for i2 = 1, v do
table.insert(Apartments[i], 0)
end
end
end)
|
require "strict"
local tiny = require("tiny")
local render = tiny.processingSystem()
render.filter = tiny.requireAll(
"position",
"rotation",
"sprite"
)
function render:process(e, dt)
love.graphics.draw(
assets.sprites[e.sprite],
e.position.x, e.position.y,
-e.rotation
)
end
return render
|
//THIS IS NOT A CONFIG, YOU CAN EDIT THESE
//BUT IT IS NOT RECOMMENDED!
bb_bottles = {}
bb_bottles.colors = {}
bb_bottles.row1 = {}
bb_bottles.row2 = {}
bb_bottles.row3 = {}
function bb_addBottle(name, row, bottleType , bottleMat , glassMat , color , density)
local temp = {}
temp.name = name
temp.row = row
temp.bottleType = bottleType
temp.bottleMat = bottleMat
temp.glassMat = glassMat
if row==1 then
table.insert(bb_bottles.row1 , temp)
elseif row==2 then
table.insert(bb_bottles.row2 , temp)
elseif row==3 then
table.insert(bb_bottles.row3 , temp)
end
bb_bottles.colors[name] = {}
bb_bottles.colors[name].color = color
bb_bottles.colors[name].density = density or 1
end
--Bottled Added Here
bb_addBottle("Lime Juice" , 1 , 3 , "blues-bar/bottle_3_lime_juice" , "blues-bar/bottle_3_glass" , Color(109 , 164 , 32))
bb_addBottle("Orange Juice" , 1 , 3 , "blues-bar/bottle_3_main" , "blues-bar/bottle_3_glass" , Color(246, 159, 1))
bb_addBottle("Tomato Juice" , 1 , 3 , "blues-bar/bottle_3_tomato_juice" , "blues-bar/bottle_3_glass" , Color(188 , 20 , 4) , 2)
bb_addBottle("Grapefruit Juice" , 1 , 3 , "blues-bar/bottle_grapfruit_juice" , "blues-bar/bottle_3_glass" , Color(253,107,48) , 2)
bb_addBottle("Cranberry Juice" , 1 , 3 , "blues-bar/bottle_cranberry_juice" , "blues-bar/bottle_2_glass" , Color(90 , 1 ,0) , 2)
bb_addBottle("Lemon Juice" , 1 , 3 , "blues-bar/bottle_lemon_juice" , "blues-bar/bottle_3_glass" , Color(224,250,179))
bb_addBottle("Pinapple Juice" , 1 , 3 , "blues-bar/bottle_pineapple_juice" , "blues-bar/bottle_3_glass" , Color(253,232,78))
bb_addBottle("Cola" , 1 , 3 , "blues-bar/bottle_cola" , "blues-bar/bottle_3_glass" , Color(10,6,5) , 6)
bb_addBottle("Fresh Cream" , 1 , 3 , "blues-bar/bottle_cream" , "blues-bar/bottle_3_glass" , Color(220,220,200))
bb_addBottle("Soda" , 1 , 3 , "blues-bar/bottle_soda" , "blues-bar/bottle_3_glass" , Color(230,240,250))
bb_addBottle("Triple Sec" , 2 , 2 , "blues-bar/bottle_triple_sec" , "blues-bar/bottle_3_glass" , Color(250,230,220))
bb_addBottle("Tequila" , 2 , 2 , "blues-bar/bottle_tequila" , "blues-bar/bottle_3_glass" , Color(192,131,0))
bb_addBottle("Curacao" , 2 , 2 , "blues-bar/bottle_curacao" , "blues-bar/bottle_3_glass" , Color(10,69,242) , 4)
bb_addBottle("Vodka" , 2 , 2 , "blues-bar/bottle_2_main" , "blues-bar/bottle_3_glass" , Color(238,238,238))
bb_addBottle("Bourbon" , 2 , 2 , "blues-bar/bottle_bourbon" , "blues-bar/bottle_2_glass" , Color(169,42,26) , 8)
bb_addBottle("Cointreau" , 2 , 2 , "blues-bar/bottle_cointreau" , "blues-bar/bottle_3_glass" , Color(216,86,9))
bb_addBottle("Gin" , 2 , 2 , "blues-bar/bottle_gin" , "blues-bar/bottle_3_glass" , Color(190,225,217))
bb_addBottle("Dark Rum" , 3 , 1 , "blues-bar/bottle_dark_rum" , "blues-bar/bottle_1_glass_diff" , Color(134,40,17) , 6)
bb_addBottle("White Rum" , 3 , 1 , "blues-bar/bottle_white_rum" , "blues-bar/bottle_1_glass_diff" , Color(200,200,200))
bb_addBottle("Kahlua" , 3 , 1 , "blues-bar/bottle_kahlua" , "blues-bar/bottle_1_glass_diff" , Color(77,20,20))
bb_addBottle("Italian Vermouth" , 3 , 1 , "blues-bar/bottle_italian_vermouth" , "blues-bar/bottle_1_glass_diff" , Color(116,106,70))
bb_addBottle("French Vermouth" , 3 , 1 , "blues-bar/bottle_french_vermouth" , "blues-bar/bottle_1_glass_diff" , Color(116,106,70))
bb_addBottle("Brandy" , 3 , 1 , "blues-bar/bottle_brandy" , "blues-bar/bottle_1_glass_diff" , Color(150,45,50) , 8)
|
local InfoControl = {}
function InfoControl:AddCategory(control,data,categoryId,typeId,parentId)
if control == nil or data == nil or categoryId == nil then return end
ZO_ScrollList_AddCategory(control,categoryId,parentId)
typeId = data.typeId or typeId or 0
self:AddEntries(control,{data},typeId,parentId)
end
function InfoControl:GetCategoryHidden(control,categoryId)
if control == nil or categoryId == nil then return true end
return ZO_ScrollList_GetCategoryHidden(control,categoryId)
end
function InfoControl:SetCategoryHidden(control,categoryId,hidden)
if control == nil or categoryId == nil or hidden == nil then return end
if hidden == true then
ZO_ScrollList_HideCategory(control,categoryId)
else
ZO_ScrollList_ShowCategory(control,categoryId)
end
end
function InfoControl:Clear(...)
local count = select('#',...)
local control
for i=1,count do
control = select(i,...)
ZO_ScrollList_Clear(control)
end
end
function InfoControl:AddEntries(control,data,typeId,categoryId)
if control == nil or data == nil then return end
local count = #data
if count < 1 then return end
local scrollData = ZO_ScrollList_GetDataList(control)
for i,entry in ipairs(data) do
typeId = entry.typeId or typeId or 1
categoryId = entry.categoryId or categoryId
scrollData[#scrollData+1] = ZO_ScrollList_CreateDataEntry(typeId, entry,categoryId)
end
ZO_ScrollList_Commit(control)
end
function InfoControl:Refresh(...)
local count = select('#',...)
local control
for i=1,count do
control = select(i,...)
ZO_ScrollList_RefreshVisible(control)
end
end
function InfoControl:RowMouseDown(control, button)
if(button == 1) then
control.label:SetAnchor(LEFT, nil, LEFT, control.offsetX or 0, 1)
end
end
function InfoControl:RowMouseUp(control, button, upInside)
if(button == 1) then
control.label:SetAnchor(LEFT, nil, LEFT, control.offsetX or 0, 0)
end
if(upInside) then
local data = ZO_ScrollList_GetData(control)
if data.clicked then
data:clicked(control,button)
self:RowMouseClicked(control,data,button)
end
end
end
function InfoControl:RowMouseClicked(control,data,button)
end
function InfoControl:OnRefreshRow(control,data)
end
function InfoControl:RefreshRow(control,data)
if data ~= nil and data.refresh ~= nil then
data:refresh(control)
end
control.label:SetHidden(data == nil or (data.hidden ~= nil and data.hidden == true))
control.RowMouseDown = function(...) self:RowMouseDown(...) end
control.RowMouseUp = function(...) self:RowMouseUp(...) end
self:OnRefreshRow(control,data)
end
local WorldMapInfoControl = {}
FasterTravel.WorldMapInfoControl = WorldMapInfoControl
function WorldMapInfoControl.Initialise(control)
for k,v in pairs(InfoControl) do
control[k] = v
end
end
|
ExportMetalCommand = Command:extends{}
ExportMetalCommand.className = "ExportMetalCommand"
function ExportMetalCommand:init(path)
self.path = path
end
function ExportMetalCommand:execute()
Spring.CreateDir(Path.GetParentDir(self.path))
local projectPath = SB.project.path
local METAL_RESOLUTION = 16
Log.Notice("Exporting metal with launcher...")
return WG.Connector.Send("TransformSBImage", {
inPath = Path.Join(projectPath, Project.METAL_FILE),
outPath = self.path,
width = Game.mapSizeX / METAL_RESOLUTION,
height = Game.mapSizeZ / METAL_RESOLUTION,
-- FIXME: No idea why we divide by 5 tbh. Experimentally deduced
multiplier = 1.0 / 5.1,
packSize = 'float32',
colorType = 'rgb',
bitDepth = 8
}, {
waitForResult = true
})
end
|
return {
version = "1.1",
luaversion = "5.1",
orientation = "orthogonal",
width = 32,
height = 32,
tilewidth = 16,
tileheight = 16,
properties = {},
tilesets = {
{
name = "tiles",
firstgid = 1,
tilewidth = 64,
tileheight = 64,
spacing = 0,
margin = 0,
image = "../../../../../../tools/tiled/dont_starve/tiles.png",
imagewidth = 512,
imageheight = 384,
properties = {},
tiles = {}
}
},
layers = {
{
type = "tilelayer",
name = "BG_TILES",
x = 0,
y = 0,
width = 32,
height = 32,
visible = true,
opacity = 1,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 29, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 29, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 29, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 29, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 29, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 29, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 29, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 29, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0, 22, 0, 0, 0
}
},
{
type = "objectgroup",
name = "FG_OBJECTS",
visible = true,
opacity = 1,
properties = {},
objects = {}
}
}
}
|
local M = {}
M.config = function()
do
local lsp = vim.lsp
lsp.handlers['textDocument/publishDiagnostics'] = lsp.with(
lsp.diagnostic.on_publish_diagnostics,
{underline = false, virtual_text = false}
)
end
do
local function defsign(name, icon)
vim.fn.sign_define(
'LspDiagnosticsSign'..name,
{text = icon, numhl = 'LspDiagnosticsDefaul'..name}
)
end
defsign('Error', '')
defsign('Hint', '')
defsign('Information', '')
defsign('Warning', '')
end
local caps = vim.lsp.protocol.make_client_capabilities()
caps = require'cmp_nvim_lsp'.update_capabilities(caps)
local oat = function(cli, bufnr)
local map = vim.api.nvim_buf_set_keymap
local opts = {noremap = true, silent = true}
map(bufnr, 'n', '[d', '<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
map(bufnr, 'n', '[D', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
map(bufnr, 'n', ']d', '<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
map(bufnr, 'n', '[D', '<Cmd>lua vim.lsp.buf.workspace_symbol()<CR>', opts)
map(bufnr, 'n', '<C-]>', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
map(bufnr, 'n', 'cr', '<Cmd>lua vim.lsp.buf.rename()<CR>', opts)
map(bufnr, 'n', 'gD', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
map(bufnr, 'n', 'gI', '<Cmd>lua vim.lsp.buf.implementation()<CR>', opts)
map(bufnr, 'n', 'ga', '<Cmd>lua vim.lsp.buf.code_action()<CR>', opts)
map(bufnr, 'n', 'gd', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
map(bufnr, 'n', 'gr', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
map(bufnr, 'n', '<C-h>', '<Cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
map(bufnr, 'n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
map(
bufnr,
'n',
'<C-k>',
'<Cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>',
opts
)
if cli.resolved_capabilities.document_formatting then
map(bufnr, 'n', 'gF', '<Cmd>lua vim.lsp.buf.formatting()<CR>', opts)
elseif cli.resolved_capabilities.document_range_formatting then
map(
bufnr,
'n',
'gF',
'<Cmd>lua vim.lsp.buf.range_formatting()<CR>',
opts
)
end
end
local cfg = {
{capabilities = caps, on_attach = oat},
lua = {
capabilities = caps,
on_attach = oat,
root_dir = vim.loop.cwd,
settings = {
Lua = {
diagnostics = {globals = {'vim'}},
workspace = {
library = {
[vim.fn.expand'$VIMRUNTIME/lua'] = true,
[vim.fn.expand'$VIMRUNTIME/lua/vim/lsp'] = true,
}
},
},
},
},
rust = {
capabilities = caps,
on_attach = oat,
settings = {
['rust-analyzer'] = {
assist = {importGranurality = 'module', importPrefix = 'by_self'},
cargo = {loadOutDirsFromCheck = true},
procMacro = {enable = true},
},
},
},
}
local ins = require'lspinstall'
local lsp = require'lspconfig'
ins.setup()
for _, lang in pairs(ins.installed_servers()) do
if cfg[lang] then lsp[lang].setup(cfg[lang])
else lsp[lang].setup(cfg[1])
end
end
end
return M
|
---------------------------------------------------------------------------------------------------
-- func: delcurrency <currency type> <amount> <target player>
-- desc: Removes the specified currency from the player
---------------------------------------------------------------------------------------------------
cmdprops =
{
permission = 1,
parameters = "sis"
};
function error(player, msg)
player:PrintToPlayer(msg);
player:PrintToPlayer("!delcurrency <currency type> <amount> {player}");
end;
function onTrigger(player,currency,amount,target)
-- validate target
local targ;
if (target == nil) then
targ = player;
else
targ = GetPlayerByName(target);
if (targ == nil) then
error(player, string.format("Player named '%s' not found!", target));
return;
end
end
-- validate currency
-- note: getCurrency does not ever return nil at the moment. will work on this in future update.
if (currency == nil or targ:getCurrency(currency) == nil) then
error(player, "Invalid currency type.");
return;
end
-- validate amount
local currentAmount = targ:getCurrency(currency);
if (amount == nil or amount < 1) then
error(player, "Invalid amount.");
return;
end
if (amount > currentAmount) then
amount = currentAmount;
end
-- delete currency
targ:delCurrency(currency,amount);
local newAmount = targ:getCurrency(currency);
player:PrintToPlayer(string.format("%i %s was taken from %s, for a total of %i.",amount,currency,targ:getName(),newAmount));
end;
|
local M = {}
local M_PI = math.pi
local sqrt = math.sqrt
local floor = math.floor
local tan = math.tan
local function snippet_normalize(cr, width, height)
cr:scale(width, height)
cr:set_line_width(0.04)
end
local function torgb(s)
if not s or s == "" or s == {} then
return 0,0,0
end
if type(s) == "table" then
return s[1]/255, s[2]/255, s[3]/255
end
local r = tonumber(string.sub(s,1,2), 16)/255
local g = tonumber(string.sub(s,3,4), 16)/255
local b = tonumber(string.sub(s,5,6), 16)/255
return r,g,b
end
local X = function(x) return x end
local Y = function(y) return y end
local function svg_polyline(cr, style, verts)
if not verts or verts == "" then return end
local first=true
for x,y in string.gmatch(verts, "%s*([%-%+]?%d+),([%-%+]?%d+)") do
if first then
first = nil
cr:move_to(X(x), Y(y))
else
cr:line_to(X(x), Y(y))
end
end
if style.fill then
cr:set_source_rgb(torgb(style.fill))
end
cr:fill()
end
local function svg_path(cr, style, data)
if not data or data == "" then return end
local function paintpath()
if style.fill then
cr:set_source_rgb ( torgb(style.fill))
--cr:fill ()
end
cr:fill ()
if style.stroke_width then
cr:set_line_width ( style.stroke_width)
end
if style.stroke then
--cr:fill_preserve ();
cr:set_source_rgb (torgb(style.stroke))
--cr:stroke ()
end
cr:stroke ()
end
--cr:save()
local ss = string.gsub(data, "%A", ".")
--wx.wxMessageBox(ss)
local i=1
local oi=1
while true do
i = string.find(ss, "%a", oi+1)
if i == nil then break end
local cmd = string.sub(data, oi, oi)
local dta = string.sub(data, oi+1, i-1)
oi = i
--wx.wxMessageBox(cmd..":"..dta)
if cmd == "M" then --absolute moveto (x y)+
--wx.wxMessageBox("M")
cr.new_path ()
local first=true
for x,y in string.gmatch(dta, "%s*([%-%+]?%d+%.%d+)%s*([%-%+]?%d+%.%d+)") do
--wx.wxMessageBox(tostring(x)..":"..tostring(y))
if first then
first = nil
cr:move_to (X(x), Y(y))
else
cr:line_to (X(x), Y(y))
end
end
elseif cmd == "m" then --relative moveto (x y)+
--wx.wxMessageBox("m")
cr.new_path ()
local first=true
for x,y in string.gmatch(dta, "%s*([%-%+]?%d+%.%d+)%s*([%-%+]?%d+%.%d+)") do
--wx.wxMessageBox(tostring(x)..":"..tostring(y))
if first then
first = nil
cr:move_to (X(x), Y(y))
else
cr:rel_line_to (X(x), Y(y))
end
end
elseif cmd == "L" then --absolute lineto (x y)+
--wx.wxMessageBox("L")
for x,y in string.gmatch(dta, "%s*([%-%+]?%d+%.%d+)%s*([%-%+]?%d+%.%d+)") do
--wx.wxMessageBox(tostring(x)..":"..tostring(y))
cr:line_to (X(x), Y(y))
end
elseif cmd == "l" then --relative lineto (x y)+
--wx.wxMessageBox("l")
for x,y in string.gmatch(dta, "%s*([%-%+]?%d+%.%d+)%s*([%-%+]?%d+%.%d+)") do
--wx.wxMessageBox(tostring(x)..":"..tostring(y))
cr:rel_line_to (X(x), Y(y))
end
elseif cmd == "H" then --absolute horizontal lineto x+
--wx.wxMessageBox("H")
elseif cmd == "h" then --relative horizontal lineto x+
--wx.wxMessageBox("h")
elseif cmd == "V" then --absolute vertical lineto y+
--wx.wxMessageBox("V")
elseif cmd == "v" then --relative vertical lineto y+
--wx.wxMessageBox("v")
elseif cmd == "C" then --absolute curveto (x1 y1 x2 y2 x y)+
--wx.wxMessageBox("C")
for x1,y1,x2,y2,x,y in string.gmatch(dta, "%s*([%-%+]?%d+%.%d+)%s*([%-%+]?%d+%.%d+)%s*([%-%+]?%d+%.%d+)%s*([%-%+]?%d+%.%d+)%s*([%-%+]?%d+%.%d+)%s*([%-%+]?%d+%.%d+)") do
--wx.wxMessageBox(tostring(x)..":"..tostring(y))
cr:curve_to (X(x1), Y(y1), X(x2), Y(y2), X(x), Y(y))
end
elseif cmd == "c" then --relative curveto (x1 y1 x2 y2 x y)+
--wx.wxMessageBox("c")
elseif cmd == "S" then --absolute shorthand/smooth curveto (x2 y2 x y)+
--wx.wxMessageBox("S")
elseif cmd == "s" then --relative shorthand/smooth curveto (x2 y2 x y)+
--wx.wxMessageBox("s")
elseif cmd == "Q" then --absolute quadratic Bézier curveto (x1 y1 x y)+
--wx.wxMessageBox("Q")
elseif cmd == "q" then --relative quadratic Bézier curveto (x1 y1 x y)+
--wx.wxMessageBox("q")
elseif cmd == "T" then --absolute Shorthand/smooth quadratic Bézier curveto (x y)+
--wx.wxMessageBox("T")
elseif cmd == "t" then --relative Shorthand/smooth quadratic Bézier curveto (x y)+
--wx.wxMessageBox("t")
elseif cmd == "A" then --absolute elliptical arc (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+
--wx.wxMessageBox("A")
elseif cmd == "a" then --relative elliptical arc (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+
--wx.wxMessageBox("a")
elseif cmd == "Z" or cmd == "z" then --closepath
--wx.wxMessageBox("Z")
cr:close_path ()
paintpath()
end
end
cr:close_path ()
paintpath()
--cr:restore()
end
function f_lion(cr, width, height)
snippet_normalize (cr, width, height)
cr:set_line_width (0.001)
X = function(x) return .8*x/width end
Y = function(y) return .8*y/height end
svg_polyline(cr, {fill="f2cc99"}, " 69,18 82,8 99,3 118,5 135,12 149,21 156,13 165,9 177,13 183,28 180,50 164,91 155,107 154,114 151,121 141,127 139,136 155,206 157,251 126,342 133,357 128,376 83,376 75,368 67,350 61,350 53,369 4,369 2,361 5,354 12,342 16,321 4,257 4,244 7,218 9,179 26,127 43,93 32,77 30,70 24,67 16,49 17,35 18,23 30,12 40,7 53,7 62,12 69,18 69,18 69,18")
svg_polyline(cr, {fill="e5b27f"}, " 142,79 136,74 138,82 133,78 133,84 127,78 128,85 124,80 125,87 119,82 119,90 125,99 125,96 128,100 128,94 131,98 132,93 135,97 136,93 138,97 139,94 141,98 143,94 144,85 142,79 142,79 142,79")
svg_polyline(cr, {fill="eb8080"}, " 127,101 132,100 137,99 144,101 143,105 135,110 127,101 127,101 127,101")
svg_polyline(cr, {fill="f2cc99"}, " 178,229 157,248 139,296 126,349 137,356 158,357 183,342 212,332 235,288 235,261 228,252 212,250 188,251 178,229 178,229 178,229")
svg_polyline(cr, {fill="9c826b"}, " 56,229 48,241 48,250 57,281 63,325 71,338 81,315 76,321 79,311 83,301 75,308 80,298 73,303 76,296 71,298 74,292 69,293 74,284 78,278 71,278 74,274 68,273 70,268 66,267 68,261 60,266 62,259 65,253 57,258 59,251 55,254 55,248 60,237 54,240 58,234 54,236 56,229 56,229 56,229")
svg_polyline(cr, {}, " 74,363 79,368 81,368 85,362 89,363 92,370 96,373 101,372 108,361 110,371 113,373 116,371 120,358 122,363 123,371 126,371 129,367 132,357 135,361 130,376 127,377 94,378 84,376 76,371 74,363 74,363 74,363")
svg_polyline(cr, {}, " 212,250 219,251 228,258 236,270 235,287 225,304 205,332 177,343 171,352 158,357 166,352 168,346 168,339 165,333 155,327 155,323 161,320 165,316 169,316 167,312 171,313 168,308 173,309 170,306 177,306 175,308 177,311 174,311 176,316 171,315 174,319 168,320 168,323 175,327 179,332 183,326 184,332 189,323 190,328 194,320 194,325 199,316 201,320 204,313 206,316 208,310 211,305 219,298 226,288 229,279 228,266 224,259 217,253 212,250 212,250 212,250")
svg_polyline(cr, {}, " 151,205 151,238 149,252 141,268 128,282 121,301 130,300 126,313 118,324 116,337 120,346 133,352 133,340 137,333 145,329 156,327 153,319 153,291 157,271 170,259 178,277 193,250 174,216 151,205 151,205 151,205")
svg_polyline(cr, {}, " 78,127 90,142 95,155 108,164 125,167 139,175 150,206 152,191 141,140 121,148 100,136 78,127 78,127 78,127")
svg_polyline(cr, {}, " 21,58 35,63 38,68 32,69 42,74 40,79 47,80 54,83 45,94 34,81 32,73 24,66 21,58 21,58 21,58")
svg_polyline(cr, {}, " 71,34 67,34 66,27 59,24 54,17 48,17 39,22 30,26 28,31 31,39 38,46 29,45 36,54 41,61 41,70 50,69 54,71 55,58 67,52 76,43 76,39 68,44 71,34 71,34 71,34")
svg_polyline(cr, {}, " 139,74 141,83 143,89 144,104 148,104 155,106 154,86 157,77 155,72 150,77 144,77 139,74 139,74 139,74")
svg_polyline(cr, {}, " 105,44 102,53 108,58 111,62 112,55 105,44 105,44 105,44")
svg_polyline(cr, {}, " 141,48 141,54 144,58 139,62 137,66 136,59 137,52 141,48 141,48 141,48")
svg_polyline(cr, {}, " 98,135 104,130 105,134 108,132 108,135 112,134 113,137 116,136 116,139 119,139 124,141 128,140 133,138 140,133 139,140 126,146 104,144 98,135 98,135 98,135")
svg_polyline(cr, {}, " 97,116 103,119 103,116 111,118 116,117 122,114 127,107 135,111 142,107 141,114 145,118 149,121 145,125 140,124 127,121 113,125 100,124 97,116 97,116 97,116")
svg_polyline(cr, {}, " 147,33 152,35 157,34 153,31 160,31 156,28 161,28 159,24 163,25 163,21 165,22 170,23 167,17 172,21 174,18 175,23 176,22 177,28 177,33 174,37 176,39 174,44 171,49 168,53 164,57 159,68 156,70 154,60 150,51 146,43 144,35 147,33 147,33 147,33")
svg_polyline(cr, {}, " 85,72 89,74 93,75 100,76 105,75 102,79 94,79 88,76 85,72 85,72 85,72")
svg_polyline(cr, {}, " 86,214 79,221 76,232 82,225 78,239 82,234 78,245 81,243 79,255 84,250 84,267 87,254 90,271 90,257 95,271 93,256 95,249 92,252 93,243 89,253 89,241 86,250 87,236 83,245 87,231 82,231 90,219 84,221 86,214 86,214 86,214")
svg_polyline(cr, {fill="ffcc7f"}, " 93,68 96,72 100,73 106,72 108,66 105,63 100,62 93,68 93,68 93,68")
svg_polyline(cr, {}, " 144,64 142,68 142,73 146,74 150,73 154,64 149,62 144,64 144,64 144,64")
svg_polyline(cr, {fill="9c826b"}, " 57,91 42,111 52,105 41,117 53,112 46,120 53,116 50,124 57,119 55,127 61,122 60,130 67,126 66,134 71,129 72,136 77,130 76,137 80,133 82,138 86,135 96,135 94,129 86,124 83,117 77,123 79,117 73,120 75,112 68,116 71,111 65,114 69,107 63,110 68,102 61,107 66,98 61,103 63,97 57,99 57,91 57,91 57,91")
svg_polyline(cr, {}, " 83,79 76,79 67,82 75,83 65,88 76,87 65,92 76,91 68,96 77,95 70,99 80,98 72,104 80,102 76,108 85,103 92,101 87,98 93,96 86,94 91,93 85,91 93,89 99,89 105,93 107,85 102,82 92,80 83,79 83,79 83,79")
svg_polyline(cr, {}, " 109,77 111,83 109,89 113,94 117,90 117,81 114,78 109,77 109,77 109,77")
svg_polyline(cr, {}, " 122,128 127,126 134,127 136,129 134,130 130,128 124,129 122,128 122,128 122,128")
svg_polyline(cr, {}, " 78,27 82,32 80,33 82,36 78,37 82,40 78,42 81,46 76,47 78,49 74,50 82,52 87,50 83,48 91,46 86,45 91,42 88,40 92,37 86,34 90,31 86,29 89,26 78,27 78,27 78,27")
svg_polyline(cr, {}, " 82,17 92,20 79,21 90,25 81,25 94,28 93,26 101,30 101,26 107,33 108,28 111,40 113,34 115,45 117,39 119,54 121,46 124,58 126,47 129,59 130,49 134,58 133,44 137,48 133,37 137,40 133,32 126,20 135,26 132,19 138,23 135,17 142,18 132,11 116,6 94,6 78,11 92,12 80,14 90,16 82,17 82,17 82,17")
svg_polyline(cr, {}, " 142,234 132,227 124,223 115,220 110,225 118,224 127,229 135,236 122,234 115,237 113,242 121,238 139,243 121,245 111,254 95,254 102,244 104,235 110,229 100,231 104,224 113,216 122,215 132,217 141,224 145,230 149,240 142,234 142,234 142,234")
svg_polyline(cr, {}, " 115,252 125,248 137,249 143,258 134,255 125,254 115,252 115,252 115,252")
svg_polyline(cr, {}, " 114,212 130,213 140,219 147,225 144,214 137,209 128,207 114,212 114,212 114,212")
svg_polyline(cr, {}, " 102,263 108,258 117,257 131,258 116,260 109,265 102,263 102,263 102,263")
svg_polyline(cr, {}, " 51,241 35,224 40,238 23,224 31,242 19,239 28,247 17,246 25,250 37,254 39,263 44,271 47,294 48,317 51,328 60,351 60,323 53,262 47,246 51,241 51,241 51,241")
svg_polyline(cr, {}, " 2,364 9,367 14,366 18,355 20,364 26,366 31,357 35,364 39,364 42,357 47,363 53,360 59,357 54,369 7,373 2,364 2,364 2,364")
svg_polyline(cr, {}, " 7,349 19,345 25,339 18,341 23,333 28,326 23,326 27,320 23,316 25,311 20,298 15,277 12,264 9,249 10,223 3,248 5,261 15,307 17,326 11,343 7,349 7,349 7,349")
svg_polyline(cr, {}, " 11,226 15,231 25,236 18,227 11,226 11,226 11,226")
svg_polyline(cr, {}, " 13,214 19,217 32,227 23,214 16,208 15,190 24,148 31,121 24,137 14,170 8,189 13,214 13,214 13,214")
svg_polyline(cr, {}, " 202,254 195,258 199,260 193,263 197,263 190,268 196,268 191,273 188,282 200,272 194,272 201,266 197,265 204,262 200,258 204,256 202,254 202,254 202,254")
svg_polyline(cr, {fill="845433"}, " 151,213 165,212 179,225 189,246 187,262 179,275 176,263 177,247 171,233 163,230 165,251 157,264 146,298 145,321 133,326 143,285 154,260 153,240 151,213 151,213 151,213")
svg_polyline(cr, {}, " 91,132 95,145 97,154 104,148 107,155 109,150 111,158 115,152 118,159 120,153 125,161 126,155 133,164 132,154 137,163 137,152 142,163 147,186 152,192 148,167 141,143 124,145 105,143 91,132 91,132 91,132")
svg_polyline(cr, {fill="9c826b"}, " 31,57 23,52 26,51 20,44 23,42 21,36 22,29 25,23 24,32 30,43 26,41 30,50 26,48 31,57 31,57 31,57")
svg_polyline(cr, {}, " 147,21 149,28 155,21 161,16 167,14 175,15 173,11 161,9 147,21 147,21 147,21")
svg_polyline(cr, {}, " 181,39 175,51 169,57 171,65 165,68 165,75 160,76 162,91 171,71 180,51 181,39 181,39 181,39")
svg_polyline(cr, {}, " 132,346 139,348 141,346 142,341 147,342 143,355 133,350 132,346 132,346 132,346")
svg_polyline(cr, {}, " 146,355 151,352 155,348 157,343 160,349 151,356 147,357 146,355 146,355 146,355")
svg_polyline(cr, {}, " 99,266 100,281 94,305 86,322 78,332 72,346 73,331 91,291 99,266 99,266 99,266")
svg_polyline(cr, {}, " 20,347 32,342 45,340 54,345 45,350 42,353 38,350 31,353 29,356 23,350 19,353 15,349 20,347 20,347 20,347")
svg_polyline(cr, {}, " 78,344 86,344 92,349 88,358 84,352 78,344 78,344 78,344")
svg_polyline(cr, {}, " 93,347 104,344 117,345 124,354 121,357 116,351 112,351 108,355 102,351 93,347 93,347 93,347")
svg_polyline(cr, {fill="000000"}, " 105,12 111,18 113,24 113,29 119,34 116,23 112,16 105,12 105,12 105,12")
svg_polyline(cr, {}, " 122,27 125,34 127,43 128,34 125,29 122,27 122,27 122,27")
svg_polyline(cr, {}, " 115,13 122,19 122,15 113,10 115,13 115,13 115,13")
svg_polyline(cr, {fill="ffe5b2"}, " 116,172 107,182 98,193 98,183 90,199 89,189 84,207 88,206 87,215 95,206 93,219 91,230 98,216 97,226 104,214 112,209 104,208 113,202 126,200 139,207 132,198 142,203 134,192 142,195 134,187 140,185 130,181 136,177 126,177 125,171 116,180 116,172 116,172 116,172")
svg_polyline(cr, {}, " 74,220 67,230 67,221 59,235 63,233 60,248 70,232 65,249 71,243 67,256 73,250 69,262 73,259 71,267 76,262 72,271 78,270 76,275 82,274 78,290 86,279 86,289 92,274 88,275 87,264 82,270 82,258 77,257 78,247 73,246 77,233 72,236 74,220 74,220 74,220")
svg_polyline(cr, {}, " 133,230 147,242 148,250 145,254 138,247 129,246 142,245 138,241 128,237 137,238 133,230 133,230 133,230")
svg_polyline(cr, {}, " 133,261 125,261 116,263 111,267 125,265 133,261 133,261 133,261")
svg_polyline(cr, {}, " 121,271 109,273 103,279 99,305 92,316 85,327 83,335 89,340 97,341 94,336 101,336 96,331 103,330 97,327 108,325 99,322 109,321 100,318 110,317 105,314 110,312 107,310 113,308 105,306 114,303 105,301 115,298 107,295 115,294 108,293 117,291 109,289 117,286 109,286 118,283 112,281 118,279 114,278 119,276 115,274 121,271 121,271 121,271")
svg_polyline(cr, {}, " 79,364 74,359 74,353 76,347 80,351 83,356 82,360 79,364 79,364 79,364")
svg_polyline(cr, {}, " 91,363 93,356 97,353 103,355 105,360 103,366 99,371 94,368 91,363 91,363 91,363")
svg_polyline(cr, {}, " 110,355 114,353 118,357 117,363 113,369 111,362 110,355 110,355 110,355")
svg_polyline(cr, {}, " 126,354 123,358 124,367 126,369 129,361 129,357 126,354 126,354 126,354")
svg_polyline(cr, {}, " 30,154 24,166 20,182 23,194 29,208 37,218 41,210 41,223 46,214 46,227 52,216 52,227 61,216 59,225 68,213 73,219 70,207 77,212 69,200 77,202 70,194 78,197 68,187 76,182 64,182 58,175 58,185 53,177 50,186 46,171 44,182 39,167 36,172 36,162 30,166 30,154 30,154 30,154")
svg_polyline(cr, {}, " 44,130 41,137 45,136 43,150 48,142 48,157 53,150 52,164 60,156 61,169 64,165 66,175 70,167 74,176 77,168 80,183 85,172 90,182 93,174 98,181 99,173 104,175 105,169 114,168 102,163 95,157 94,166 90,154 87,162 82,149 75,159 72,148 68,155 67,143 62,148 62,138 58,145 56,133 52,142 52,128 49,134 47,125 44,130 44,130 44,130")
svg_polyline(cr, {}, " 13,216 19,219 36,231 22,223 16,222 22,227 12,224 13,220 16,220 13,216 13,216 13,216")
svg_polyline(cr, {}, " 10,231 14,236 25,239 27,237 19,234 10,231 10,231 10,231")
svg_polyline(cr, {}, " 9,245 14,242 25,245 13,245 9,245 9,245 9,245")
svg_polyline(cr, {}, " 33,255 26,253 18,254 25,256 18,258 27,260 18,263 27,265 19,267 29,270 21,272 29,276 21,278 30,281 22,283 31,287 24,288 32,292 23,293 34,298 26,299 37,303 32,305 39,309 33,309 39,314 34,314 40,318 34,317 40,321 34,321 41,326 33,326 40,330 33,332 39,333 33,337 42,337 54,341 49,337 52,335 47,330 50,330 45,325 49,325 45,321 48,321 45,316 46,306 45,286 43,274 36,261 33,255 33,255 33,255")
svg_polyline(cr, {}, " 7,358 9,351 14,351 17,359 11,364 7,358 7,358 7,358")
svg_polyline(cr, {}, " 44,354 49,351 52,355 49,361 44,354 44,354 44,354")
svg_polyline(cr, {}, " 32,357 37,353 40,358 36,361 32,357 32,357 32,357")
svg_polyline(cr, {}, " 139,334 145,330 154,330 158,334 154,341 152,348 145,350 149,340 147,336 141,339 139,345 136,342 136,339 139,334 139,334 139,334")
svg_polyline(cr, {}, " 208,259 215,259 212,255 220,259 224,263 225,274 224,283 220,292 208,300 206,308 203,304 199,315 197,309 195,318 193,313 190,322 190,316 185,325 182,318 180,325 172,321 178,320 176,313 186,312 180,307 188,307 184,303 191,302 186,299 195,294 187,290 197,288 192,286 201,283 194,280 203,277 198,275 207,271 200,269 209,265 204,265 212,262 208,259 208,259 208,259")
svg_polyline(cr, {}, " 106,126 106,131 109,132 111,134 115,132 115,135 119,133 118,137 123,137 128,137 133,134 136,130 136,127 132,124 118,128 112,128 106,126 106,126 106,126")
svg_polyline(cr, {}, " 107,114 101,110 98,102 105,97 111,98 119,102 121,108 118,112 113,115 107,114 107,114 107,114")
svg_polyline(cr, {}, " 148,106 145,110 146,116 150,118 152,111 151,107 148,106 148,106 148,106")
svg_polyline(cr, {}, " 80,55 70,52 75,58 63,57 72,61 57,61 67,66 57,67 62,69 54,71 61,73 54,77 63,78 53,85 60,84 56,90 69,84 63,82 75,76 70,75 77,72 72,71 78,69 72,66 81,67 78,64 82,63 80,60 86,62 80,55 80,55 80,55")
svg_polyline(cr, {}, " 87,56 91,52 96,50 102,56 98,56 92,60 87,56 87,56 87,56")
svg_polyline(cr, {}, " 85,68 89,73 98,76 106,74 96,73 91,70 85,68 85,68 85,68")
svg_polyline(cr, {}, " 115,57 114,64 111,64 115,75 122,81 122,74 126,79 126,74 131,78 130,72 133,77 131,68 126,61 119,57 115,57 115,57 115,57")
svg_polyline(cr, {}, " 145,48 143,53 147,59 151,59 150,55 145,48 145,48 145,48")
svg_polyline(cr, {}, " 26,22 34,15 43,10 52,10 59,16 47,15 32,22 26,22 26,22 26,22")
svg_polyline(cr, {}, " 160,19 152,26 149,34 154,33 152,30 157,30 155,26 158,27 157,23 161,23 160,19 160,19 160,19")
svg_polyline(cr, {fill="000000"}, " 98,117 105,122 109,122 105,117 113,120 121,120 130,112 128,108 123,103 123,99 128,101 132,106 135,109 142,105 142,101 145,101 145,91 148,101 145,105 136,112 135,116 143,124 148,120 150,122 142,128 133,122 121,125 112,126 103,125 100,129 96,124 98,117 98,117 98,117")
svg_polyline(cr, {}, " 146,118 152,118 152,115 149,115 146,118 146,118 146,118")
svg_polyline(cr, {}, " 148,112 154,111 154,109 149,109 148,112 148,112 148,112")
svg_polyline(cr, {}, " 106,112 108,115 114,116 118,114 106,112 106,112 106,112")
svg_polyline(cr, {}, " 108,108 111,110 116,110 119,108 108,108 108,108 108,108")
svg_polyline(cr, {}, " 106,104 109,105 117,106 115,104 106,104 106,104 106,104")
svg_polyline(cr, {}, " 50,25 41,26 34,33 39,43 49,58 36,51 47,68 55,69 54,59 61,57 74,46 60,52 67,42 57,48 61,40 54,45 60,36 59,29 48,38 52,30 47,32 50,25 50,25 50,25")
svg_polyline(cr, {}, " 147,34 152,41 155,49 161,53 157,47 164,47 158,43 168,44 159,40 164,37 169,37 164,33 169,34 165,28 170,30 170,25 173,29 175,27 176,32 173,36 175,39 172,42 172,46 168,49 170,55 162,57 158,63 155,58 153,50 149,46 147,34 147,34 147,34")
svg_polyline(cr, {}, " 155,71 159,80 157,93 157,102 155,108 150,101 149,93 154,101 152,91 151,83 155,79 155,71 155,71 155,71")
svg_polyline(cr, {}, " 112,78 115,81 114,91 112,87 113,82 112,78 112,78 112,78")
svg_polyline(cr, {}, " 78,28 64,17 58,11 47,9 36,10 28,16 21,26 18,41 20,51 23,61 33,65 28,68 37,74 36,81 43,87 48,90 43,100 40,98 39,90 31,80 30,72 22,71 17,61 14,46 16,28 23,17 33,9 45,6 54,6 65,12 78,28 78,28 78,28")
svg_polyline(cr, {}, " 67,18 76,9 87,5 101,2 118,3 135,8 149,20 149,26 144,19 132,12 121,9 105,7 89,8 76,14 70,20 67,18 67,18 67,18")
svg_polyline(cr, {}, " 56,98 48,106 56,103 47,112 56,110 52,115 57,113 52,121 62,115 58,123 65,119 63,125 69,121 68,127 74,125 74,129 79,128 83,132 94,135 93,129 85,127 81,122 76,126 75,121 71,124 71,117 66,121 66,117 62,117 64,112 60,113 60,110 57,111 61,105 57,107 60,101 55,102 56,98 56,98 56,98")
svg_polyline(cr, {}, " 101,132 103,138 106,134 106,139 112,136 111,142 115,139 114,143 119,142 125,145 131,142 135,138 140,134 140,129 143,135 145,149 150,171 149,184 145,165 141,150 136,147 132,151 131,149 126,152 125,150 121,152 117,148 111,152 110,148 105,149 104,145 98,150 96,138 94,132 94,130 98,132 101,132 101,132 101,132")
svg_polyline(cr, {}, " 41,94 32,110 23,132 12,163 6,190 7,217 5,236 3,247 9,230 12,211 12,185 18,160 26,134 35,110 43,99 41,94 41,94 41,94")
svg_polyline(cr, {}, " 32,246 41,250 50,257 52,267 53,295 53,323 59,350 54,363 51,365 44,366 42,360 40,372 54,372 59,366 62,353 71,352 75,335 73,330 66,318 68,302 64,294 67,288 63,286 63,279 59,275 58,267 56,262 50,247 42,235 44,246 32,236 35,244 32,246 32,246 32,246")
svg_polyline(cr, {}, " 134,324 146,320 159,322 173,327 179,337 179,349 172,355 158,357 170,350 174,343 170,333 163,328 152,326 134,329 134,324 134,324 134,324")
svg_polyline(cr, {}, " 173,339 183,334 184,338 191,329 194,332 199,323 202,325 206,318 209,320 213,309 221,303 228,296 232,289 234,279 233,269 230,262 225,256 219,253 208,252 198,252 210,249 223,250 232,257 237,265 238,277 238,291 232,305 221,323 218,335 212,342 200,349 178,348 173,339 173,339 173,339")
svg_polyline(cr, {}, " 165,296 158,301 156,310 156,323 162,324 159,318 162,308 162,304 165,296 165,296 165,296")
svg_polyline(cr, {}, " 99,252 105,244 107,234 115,228 121,228 131,235 122,233 113,235 109,246 121,239 133,243 121,243 110,251 99,252 99,252 99,252")
svg_polyline(cr, {}, " 117,252 124,247 134,249 136,253 126,252 117,252 117,252 117,252")
svg_polyline(cr, {}, " 117,218 132,224 144,233 140,225 132,219 117,218 117,218 117,218")
svg_polyline(cr, {}, " 122,212 134,214 143,221 141,213 132,210 122,212 122,212 122,212")
svg_polyline(cr, {}, " 69,352 70,363 76,373 86,378 97,379 108,379 120,377 128,378 132,373 135,361 133,358 132,366 127,375 121,374 121,362 119,367 117,374 110,376 110,362 107,357 106,371 104,375 97,376 90,375 90,368 86,362 83,364 86,369 85,373 78,370 73,362 71,351 69,352 69,352 69,352")
svg_polyline(cr, {}, " 100,360 96,363 99,369 102,364 100,360 100,360 100,360")
svg_polyline(cr, {}, " 115,360 112,363 114,369 117,364 115,360 115,360 115,360")
svg_polyline(cr, {}, " 127,362 125,364 126,369 128,365 127,362 127,362 127,362")
svg_polyline(cr, {}, " 5,255 7,276 11,304 15,320 13,334 6,348 2,353 0,363 5,372 12,374 25,372 38,372 44,369 42,367 36,368 31,369 30,360 27,368 20,370 16,361 15,368 10,369 3,366 3,359 6,352 11,348 17,331 19,316 12,291 9,274 5,255 5,255 5,255")
svg_polyline(cr, {}, " 10,358 7,362 10,366 11,362 10,358 10,358 10,358")
svg_polyline(cr, {}, " 25,357 22,360 24,366 27,360 25,357 25,357 25,357")
svg_polyline(cr, {}, " 37,357 34,361 36,365 38,361 37,357 37,357 37,357")
svg_polyline(cr, {}, " 49,356 46,359 47,364 50,360 49,356 49,356 49,356")
svg_polyline(cr, {}, " 130,101 132,102 135,101 139,102 143,103 142,101 137,100 133,100 130,101 130,101 130,101")
svg_polyline(cr, {}, " 106,48 105,52 108,56 109,52 106,48 106,48 106,48")
svg_polyline(cr, {}, " 139,52 139,56 140,60 142,58 141,56 139,52 139,52 139,52")
svg_polyline(cr, {}, " 25,349 29,351 30,355 33,350 37,348 42,351 45,347 49,345 44,343 36,345 25,349 25,349 25,349")
svg_polyline(cr, {}, " 98,347 105,351 107,354 109,349 115,349 120,353 118,349 113,346 104,346 98,347 98,347 98,347")
svg_polyline(cr, {}, " 83,348 87,352 87,357 89,351 87,348 83,348 83,348 83,348")
svg_polyline(cr, {}, " 155,107 163,107 170,107 186,108 175,109 155,109 155,107 155,107 155,107")
svg_polyline(cr, {}, " 153,114 162,113 175,112 192,114 173,114 154,115 153,114 153,114 153,114")
svg_polyline(cr, {}, " 152,118 164,120 180,123 197,129 169,123 151,120 152,118 152,118 152,118")
svg_polyline(cr, {}, " 68,109 87,106 107,106 106,108 88,108 68,109 68,109 68,109")
svg_polyline(cr, {}, " 105,111 95,112 79,114 71,116 85,115 102,113 105,111 105,111 105,111")
svg_polyline(cr, {}, " 108,101 98,99 87,99 78,99 93,100 105,102 108,101 108,101 108,101")
svg_polyline(cr, {}, " 85,63 91,63 97,60 104,60 108,62 111,69 112,75 110,74 108,71 103,73 106,69 105,65 103,64 103,67 102,70 99,70 97,66 94,67 97,72 88,67 84,66 85,63 85,63 85,63")
svg_polyline(cr, {}, " 140,74 141,66 144,61 150,61 156,62 153,70 150,73 152,65 150,65 151,68 149,71 146,71 144,66 143,70 143,74 140,74 140,74 140,74")
svg_polyline(cr, {}, " 146,20 156,11 163,9 172,9 178,14 182,18 184,32 182,42 182,52 177,58 176,67 171,76 165,90 157,105 160,92 164,85 168,78 167,73 173,66 172,62 175,59 174,55 177,53 180,46 181,29 179,21 173,13 166,11 159,13 153,18 148,23 146,20 146,20 146,20")
svg_polyline(cr, {}, " 150,187 148,211 150,233 153,247 148,267 135,283 125,299 136,292 131,313 122,328 122,345 129,352 133,359 133,367 137,359 148,356 140,350 131,347 129,340 132,332 140,328 137,322 140,304 154,265 157,244 155,223 161,220 175,229 186,247 185,260 176,275 178,287 185,277 188,261 196,253 189,236 174,213 150,187 150,187 150,187")
svg_polyline(cr, {}, " 147,338 142,341 143,345 141,354 147,343 147,338 147,338 147,338")
svg_polyline(cr, {}, " 157,342 156,349 150,356 157,353 163,346 162,342 157,342 157,342 157,342")
svg_polyline(cr, {}, " 99,265 96,284 92,299 73,339 73,333 87,300 99,265 99,265 99,265")
end
function M.test()
local cairo = require "org.xboot.cairo"
local M_PI = math.pi
local sqrt = math.sqrt
local cs = cairo.image_surface_create(cairo.FORMAT_ARGB32, 400, 400)
local cr = cairo.create(cs)
cr:save()
cr:set_source_rgb(0.9, 0.9, 0.9)
cr:paint()
cr:restore()
f_lion(cr, 400, 400)
cs:show()
collectgarbage("collect")
collectgarbage("step")
end
return M
|
local degHealth = {
["breaks"] = 0,-- has neg effect
["axle"] = 0, -- has neg effect
["radiator"] = 0, -- has neg effect
["clutch"] = 0, -- has neg effect
["transmission"] = 0, -- has neg effect
["electronics"] = 0, -- has neg effect
["fuel_injector"] = 0, -- has neg effect
["fuel_tank"] = 0
}
RegisterNetEvent('veh.examine')
AddEventHandler('veh.examine', function(plate)
local src = source
if plate ~= nil then
exports.ghmattimysql:execute('SELECT * FROM characters_cars WHERE license_plate = ?', {plate}, function(result)
if result[1] ~= nil then
TriggerClientEvent('towgarage:triggermenu', src, result[1].degredation, result[1].engine_damage, result[1].body_damage)
end
end)
end
end)
RegisterNetEvent('scrap:towTake')
AddEventHandler('scrap:towTake', function(degname,itemname,plate, amount, removepart)
local _src = source
local amount = amount*10
exports.ghmattimysql:execute('SELECT * FROM characters_cars WHERE license_plate = @plate', {['@plate'] = plate}, function (result)
local deg = result[1].degredation
degMe = result[1].degredation
local temp = deg:split(",")
if(temp[1] ~= nil) then
for i,v in ipairs(temp) do
if i == 1 then
degHealth.breaks = tonumber(v)
if degHealth.breaks == nil then
degHealth.breaks = 0
end
elseif i == 2 then
degHealth.axle = tonumber(v)
elseif i == 3 then
degHealth.radiator = tonumber(v)
elseif i == 4 then
degHealth.clutch = tonumber(v)
elseif i == 5 then
degHealth.transmission = tonumber(v)
elseif i == 6 then
degHealth.electronics = tonumber(v)
elseif i == 7 then
degHealth.fuel_injector = tonumber(v)
elseif i == 8 then
degHealth.fuel_tank = tonumber(v)
end
end
end
local updateDB = ""
if degname == "breaks" then
degHealth["breaks"] = degHealth["breaks"] + amount
if degHealth["breaks"] > 100 then
degHealth["breaks"] = 100
end
updateDB = degHealth["breaks"]..","..degHealth["axle"]..","..degHealth["radiator"]..","..degHealth["clutch"]..","..degHealth["transmission"]..","..degHealth["electronics"]..","..degHealth["fuel_injector"]..","..degHealth["fuel_tank"]
elseif degname == "axle" then
degHealth["axle"] = degHealth["axle"] + amount
if degHealth["axle"] > 100 then
degHealth["axle"] = 100
end
updateDB = degHealth["breaks"]..","..degHealth["axle"]..","..degHealth["radiator"]..","..degHealth["clutch"]..","..degHealth["transmission"]..","..degHealth["electronics"]..","..degHealth["fuel_injector"]..","..degHealth["fuel_tank"]
elseif degname == "radiator" then
degHealth["radiator"] = degHealth["radiator"] + amount
if degHealth["radiator"] > 100 then
degHealth["radiator"] = 100
end
updateDB = degHealth["breaks"]..","..degHealth["axle"]..","..degHealth["radiator"]..","..degHealth["clutch"]..","..degHealth["transmission"]..","..degHealth["electronics"]..","..degHealth["fuel_injector"]..","..degHealth["fuel_tank"]
elseif degname == "clutch" then
degHealth["clutch"] = degHealth["clutch"] + amount
if degHealth["clutch"] > 100 then
degHealth["clutch"] = 100
end
updateDB = degHealth["breaks"]..","..degHealth["axle"]..","..degHealth["radiator"]..","..degHealth["clutch"]..","..degHealth["transmission"]..","..degHealth["electronics"]..","..degHealth["fuel_injector"]..","..degHealth["fuel_tank"]
elseif degname == "transmission" then
degHealth["transmission"] = degHealth["transmission"] + amount
if degHealth["transmission"] > 100 then
degHealth["transmission"] = 100
end
updateDB = degHealth["breaks"]..","..degHealth["axle"]..","..degHealth["radiator"]..","..degHealth["clutch"]..","..degHealth["transmission"]..","..degHealth["electronics"]..","..degHealth["fuel_injector"]..","..degHealth["fuel_tank"]
elseif degname == "electronics" then
degHealth["electronics"] = degHealth["electronics"] + amount
if degHealth["electronics"] > 100 then
degHealth["electronics"] = 100
end
updateDB = degHealth["breaks"]..","..degHealth["axle"]..","..degHealth["radiator"]..","..degHealth["clutch"]..","..degHealth["transmission"]..","..degHealth["electronics"]..","..degHealth["fuel_injector"]..","..degHealth["fuel_tank"]
elseif degname == "fuel_injector" then
degHealth["fuel_injector"] = degHealth["fuel_injector"] + amount
if degHealth["fuel_injector"] > 100 then
degHealth["fuel_injector"] = 100
end
updateDB = degHealth["breaks"]..","..degHealth["axle"]..","..degHealth["radiator"]..","..degHealth["clutch"]..","..degHealth["transmission"]..","..degHealth["electronics"]..","..degHealth["fuel_injector"]..","..degHealth["fuel_tank"]
elseif degname == "fuel_tank" then
degHealth["fuel_tank"] = degHealth["fuel_tank"] + amount
if degHealth["fuel_tank"] > 100 then
degHealth["fuel_tank"] = 100
end
updateDB = degHealth["breaks"]..","..degHealth["axle"]..","..degHealth["radiator"]..","..degHealth["clutch"]..","..degHealth["transmission"]..","..degHealth["electronics"]..","..degHealth["fuel_injector"]..","..degHealth["fuel_tank"]
end
TriggerClientEvent('mech:tools:cl', _src, itemname, removepart, updateDB, plate)
end)
end)
RegisterNetEvent('veh.callDegredation')
AddEventHandler('veh.callDegredation', function(plate,status)
local _src = source
exports.ghmattimysql:execute('SELECT * FROM characters_cars WHERE license_plate = @plate', {['@plate'] = plate}, function (result)
if result[1] ~= nil then
TriggerClientEvent('veh.getSQL',_src, result[1].degredation)
end
TriggerClientEvent("veh:checkVeh",_src, degration)
end)
end)
RegisterNetEvent('veh.updateVehicleHealth')
AddEventHandler('veh.updateVehicleHealth', function(tempReturn)
local src = source
local plate = ""
local engine_damage = 0
local body_damage = 0
local fuel = 0
for k,v in pairs(tempReturn[1]) do
if k == 1 then
plate = v
elseif k == 2 then
engine_damage = v
elseif k == 3 then
body_damage = v
elseif k == 4 then
fuel = v
end
end
exports.ghmattimysql:execute("UPDATE characters_cars SET engine_damage = @engine_damage, body_damage = @body_damage, fuel = @fuel WHERE license_plate = @plate", {
['@engine_damage'] = engine_damage,
['@body_damage'] = body_damage,
['@fuel'] = fuel,
['plate'] = plate
})
end)
RegisterNetEvent('veh.updateVehicleDegredationServer')
AddEventHandler('veh.updateVehicleDegredationServer', function(plate,br,ax,rad,cl,tra,elec,fi,ft)
exports.ghmattimysql:execute('SELECT license_plate FROM characters_cars WHERE license_plate = @plate', {['@plate'] = plate}, function (result)
if result[1] ~= nil then
local degri = ""..br..","..ax..","..rad..","..cl..","..tra..","..elec..","..fi..","..ft..""
exports.ghmattimysql:execute("UPDATE characters_cars SET degredation = @degredation WHERE license_plate = @plate", {
['@degredation'] = tostring(degri),
['plate'] = plate
})
else
local degri = ""..br..","..ax..","..rad..","..cl..","..tra..","..elec..","..fi..","..ft..""
end
end)
end)
function string:split(delimiter)
local result = {}
local from = 1
local delim_from, delim_to = string.find(self, delimiter, from)
while delim_from do
table.insert( result, string.sub(self, from , delim_from-1))
from = delim_to + 1
delim_from, delim_to = string.find(self, delimiter, from)
end
table.insert( result, string.sub(self, from))
return result
end
|
v=429
txd = engineLoadTXD("banshee.txd")
engineImportTXD(txd, v)
dff = engineLoadDFF("banshee.dff", v)
engineReplaceModel(dff, v)
|
do
local settings_img = "1713705576b.png"
local powers_img = "17136ef539e.png"
local help_img = "17136f9eefd.png"
GameInterface = Interface.new(0, 0, 800, 400, true)
:addImage({
image = settings_img,
target = ":1",
x = 772, y = 32
})
:addTextArea({
text = "<a href='event:settings'><font size='50'> </font></a>",
x = 767, y = 32,
height = 30, width = 32,
alpha = 0
})
:addImage({
canUpdate = true,
image = function(self, player)
local file = players_file[player]
if file.settings[4] == 1 then
return powers_img
elseif file.settings[6] == 1 then
return help_img
else
return "a.png"
end
end,
target = ":1",
x = 744, y = 32
})
:addTextArea({
canUpdate = true,
text = function(self, player)
local file = players_file[player]
if file.settings[4] == 1 then
return "<a href='event:powers'><font size='50'> </font></a>"
elseif file.settings[6] == 1 then
return "<a href='event:help_button'><font size='50'> </font></a>"
else
return ""
end
end,
x = 739, y = 32,
height = 30, width = 32,
alpha = 0
})
:addImage({
canUpdate = true,
image = function(self, player)
local file = players_file[player]
if file.settings[4] == 1 and file.settings[6] == 1 then
return help_img
else
return "a.png"
end
end,
target = ":1",
x = 714, y = 32
})
:addTextArea({
canUpdate = true,
text = function(self, player)
local file = players_file[player]
if file.settings[4] == 1 and file.settings[6] == 1 then
return "<a href='event:help_button'><font size='50'> </font></a>"
else
return ""
end
end,
x = 709, y = 32,
height = 30, width = 32,
alpha = 0
})
end
|
mystical_agriculture.register_normal_ore_crop("silver","moreores:silver_ingot","Silver",3,4,mystical_agriculture.get_inv_image("moreores:silver_ingot"))
mystical_agriculture.register_normal_ore_crop("mithril","moreores:mithril_ingot","Mithril",3,2,mystical_agriculture.get_inv_image("moreores:mithril_ingot"))
|
local tester = require("scripts/tester")
function setup(thread)
return tester.setup(thread)
end
function init(args)
return tester.init(args)
end
function done(summary, latency, requests)
return tester.done(summary, latency, requests)
end
request = function()
return tester.request()
end
response = function(status, headers, body, allheaders)
return tester.response(status, headers, body, allheaders)
end
|
InitUG(2, AlgebraType("CPU", 1));
ug_load_script("ug_util.lua")
ug_load_script("util/refinement_util.lua")
requiredSubsets = {"LIP", "COR", "BOTTOM_SC", "TOP_SC"}
gridName = "skin2d-aniso.ugx"
numRefs = 2
dom = util.CreateDomain(gridName, numRefs, requiredSubsets)
approxSpaceDesc = { fct = "c", type = "Lagrange", order = 1 }
approxSpace = ApproximationSpace(dom)
approxSpace:add_fct(approxSpaceDesc.fct, approxSpaceDesc.type, approxSpaceDesc.order)
approxSpace:init_levels()
approxSpace:init_top_surface()
print("Approximation space:")
approxSpace:print_statistic()
K={
["LIP"] = 1.0, ["COR"] = 1.0,
}
D={
["LIP"] = 1, ["COR"] = 0.01,
}
elemDisc ={}
elemDisc["COR"] = ConvectionDiffusion("c", "COR", "fv1")
elemDisc["COR"]:set_diffusion(K["COR"]*D["COR"])
elemDisc["COR"]:set_mass_scale(K["COR"])
elemDisc["LIP"] = ConvectionDiffusion("c", "LIP", "fv1")
elemDisc["LIP"]:set_diffusion(K["LIP"]*D["LIP"])
elemDisc["LIP"]:set_mass_scale(K["LIP"])
dirichletBnd = DirichletBoundary()
dirichletBnd:add(1.0, "c", "TOP_SC")
dirichletBnd:add(0.0, "c", "BOTTOM_SC")
domainDisc = DomainDiscretization(approxSpace)
domainDisc:add(elemDisc["LIP"])
domainDisc:add(elemDisc["COR"])
domainDisc:add(dirichletBnd)
solver=LU()
u = GridFunction(approxSpace)
u:set(0.0)
local startTime = 0.0
local endTime = 100.0
local dt=0.25
util.SolveLinearTimeProblem(u, domainDisc, solver, VTKOutput(), "vtk/skin",
"ImplEuler", 1, startTime, endTime, dt);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.