content
stringlengths 5
1.05M
|
|---|
Locales['es'] = {
['attempt'] = 'Intentando vender droga',
['police'] = 'Han llamado a la policía porque el comprador no está interesado, ¡cuidado!',
['blip'] = 'Venta de drogas',
['press'] = 'Presiona [~r~Y~w~] para vender drogas',
['advise'] = 'Hay una persona vendiendo drogas en la zona, ¡hemos marcado el punto en tu gps!',
['not_interested'] = 'La persona no se encuentra interesada',
}
|
paradeSlot("Vgr_Scout",{
-859,
-143,
2622,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_Interceptor",{
-1065,
-95,
2265,
},{
0,
0,
1,
},{
-1,
0,
0,
},400)
paradeSlot("Vgr_Bomber",{
-1325,
-50,
1868,
},{
0,
0,
1,
},{
-1,
0,
0,
},400)
paradeSlot("Vgr_LanceFighter",{
-1538,
0,
1480,
},{
0,
0,
1,
},{
-1,
0,
0,
},400)
paradeSlot("Vgr_MissileCorvette",{
-1572,
87,
578,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_LaserCorvette",{
-1360,
0,
989,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("vgr_assaultcorvette",{
-1240,
-165,
1235,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_CommandCorvette",{
-1836,
170,
178,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_ADVCommandCorvette",{
-1558,
-105,
-105,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_MinelayerCorvette",{
-2125,
305,
-292,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_HeavyMissileFrigate",{
985,
30,
1987,
},{
0,
0,
1,
},{
1,
0,
0,
},0)
paradeSlot("Vgr_ArtilleryFrigate",{
1160,
-74,
1538,
},{
0,
0,
1,
},{
1,
0,
0,
},0)
paradeSlot("vgr_EWfighter",{
910,
-10,
765,
},{
0,
0,
1,
},{
1,
0,
0,
},0)
paradeSlot("Vgr_AssaultFrigate",{
759,
-148,
2519,
},{
0,
0,
1,
},{
1,
0,
0,
},0)
paradeSlot("Vgr_InfiltratorFrigate",{
1532,
-5,
1184,
},{
0,
0,
1,
},{
1,
0,
0,
},0)
paradeSlot("Vgr_TransportFrigate",{
1862,
111,
434,
},{
0,
0,
1,
},{
1,
0,
0,
},0)
paradeSlot("Vgr_Carrier",{
0,
-371,
2782,
},{
0,
0,
1,
},{
0,
1,
0,
},1000)
paradeSlot("vgr_defenseCruiser",{
0,
200,
2782,
},{
0,
0,
1,
},{
0,
1,
0,
},1000)
paradeSlot("Vgr_BattleCruiser",{
2078,
392,
-2041,
},{
0,
0,
1,
},{
1,
0,
0,
},400)
paradeSlot("Vgr_Destroyer",{
2129,
216,
-568,
},{
0,
0,
1,
},{
1,
0,
0,
},400)
paradeSlot("Vgr_ShipYard",{
1121,
-424,
-5023,
},{
0,
0,
1,
},{
1,
0,
0,
},0)
paradeSlot("Vgr_WeaponPlatform_gun",{
-213,
-306,
1685,
},{
0,
0,
1,
},{
0,
1,
0,
},0)
paradeSlot("Vgr_WeaponPlatform_missile",{
243,
-306,
1689,
},{
0,
0,
1,
},{
0,
1,
0,
},0)
paradeSlot("Vgr_HyperSpace_Platform",{
-1162,
183,
-2233,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_ResourceCollector",{
-1768,
350,
-1397,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_ResourceController",{
-1507,
267,
-1801,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_Probe",{
-737,
0,
-3097,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_Probe_ECM",{
-981,
0,
-2674,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("Vgr_Probe_Prox",{
-580,
0,
-3518,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
paradeSlot("misc",{
5208,
0,
-2878,
},{
0,
0,
1,
},{
-1,
0,
0,
},0)
|
local com = require("component")
local event = require("event")
local fs = require("filesystem")
local term = require("term")
local charts = require("charts")
local gpu = com.gpu
do
if not fs.exists("/etc/railtank.cfg") then
local file = io.open("/etc/railtank.cfg", "w")
file:write([[
-- Fluid colors
-- ["fluid id"] = color
colors = {
["water"] = 0x20afff,
["lava"] = 0xff2020,
["creosote"] = 0xcfaf20,
["seedoil"] = 0xffdf20,
}
-- Default color
colors[1] = 0x808080
-- Graph update interval
histUpdateInterval = 5
-- How many tanks to monitor.
-- To support more than 3 tanks, you'll need a T3 screen and GPU.
tankAmount = 4
-- The background color
bg = 0xe1e1e1
-- The text color
fg = 0x2d2d2d
-- The background color of graphs
graphBG = 0xffffff
]])
file:close()
end
end
local function loadConfig()
local base = {}
local default = {
colors = {
["water"] = 0x20afff,
["lava"] = 0xff2020,
["creosote"] = 0xcfaf20,
["seedoil"] = 0xffdf20,
0xffffff
},
histUpdateInterval = 5,
tankAmount = 4,
bg = 0xe1e1e1,
fg = 0x2d2d2d,
graphBG = 0xffffff
}
local config = {}
local function deepCopy(value)
if type(value) ~= "table" then
return value
end
local result = {}
for k, v in pairs(value) do
result[k] = deepCopy(v)
end
return result
end
local function createEnv(base, default, config)
return setmetatable({}, {
__newindex = function(self, k, v)
if base[k] then
return nil
end
if default[k] then
config[k] = v
end
return nil
end,
__index = function(self, k)
if base[k] then
config[k] = config[k] or {}
return createEnv({}, default[k], config[k])
end
if default[k] then
return config[k] or deepCopy(default[k])
end
end
})
end
local env = createEnv(base, default, config)
loadfile("/etc/railtank.cfg", "t", env)()
local function setGet(base, default, config)
return setmetatable({}, {
__index = function(self, k)
if base[k] then
config[k] = config[k] or {}
return setGet(base[k], default[k], config[k])
elseif config[k] then
return config[k]
elseif default[k] then
return default[k]
end
end
})
end
return setGet(base, default, config)
end
local cfg = loadConfig()
local colors = cfg.colors
local histUpdateInterval = cfg.histUpdateInterval
local tankAmount = cfg.tankAmount
local bg = cfg.bg
local fg = cfg.fg
local graphBG = cfg.graphBG
tankAmount = math.min(math.floor((gpu.maxResolution() - 5) / 25), tankAmount)
local oldW, oldH = gpu.getResolution()
local w, h = 5 + 25 * tankAmount, 25
gpu.setResolution(w, h)
local tanks = {}
local function newTank(pos)
tanks[pos] = {
bar = {},
hist = {},
x = (pos - 1) * 25 + 1 + 5
}
local tank = tanks[pos]
tank.bar.container = charts.Container()
tank.bar.container.x = tank.x
tank.bar.container.y = 6
tank.bar.container.width = 20
tank.bar.container.height = 9
tank.bar.container.fg = colors[1]
tank.bar.container.bg = graphBG
tank.bar.payload = charts.ProgressBar()
tank.bar.payload.direction = charts.sides.TOP
tank.bar.container.payload = tank.bar.payload
tank.hist.container = charts.Container()
tank.hist.container.x = tank.x
tank.hist.container.y = 16
tank.hist.container.width = 20
tank.hist.container.height = 9
tank.hist.container.fg = colors[1]
tank.hist.container.bg = graphBG
tank.hist.payload = charts.Histogram()
tank.hist.payload.align = charts.sides.RIGHT
tank.hist.payload.min = 0
tank.hist.payload.colorFunc = function()
return tank.hist.container.fg, tank.hist.container.bg
end
tank.hist.container.payload = tank.hist.payload
end
local function center(str, len)
if #str >= len then
return str
end
local lhw = math.floor(len / 2)
local shw = math.floor(#str / 2)
return ("%-" .. len .. "s"):format(("%" .. (#str + (lhw - shw)) .. "s"):format(str))
end
local oldBG = gpu.setBackground(bg)
local oldFG = gpu.setForeground(fg)
os.sleep(0)
gpu.fill(1, 1, w, h, " ")
local cycle = 0
while true do
do
local clear = false
for pos = #tanks, 1, -1 do
if not com.proxy(tanks[pos].addr) then
table.remove(tanks, pos)
clear = true
end
end
if clear then
gpu.fill(1, 1, w, h, " ")
end
local i = #tanks + 1
for addr in com.list("tank_controller") do
for side = 0, 5, 1 do
if i > tankAmount then
break
end
local found = false
for _, tank in pairs(tanks) do
if tank.addr == addr then
found = true
break
end
end
if not found then
if com.proxy(addr) and com.invoke(addr, "getFluidInTank", side).n == 1 then
newTank(i)
tanks[i].proxy = com.proxy(addr)
tanks[i].addr = addr
tanks[i].side = side
i = i + 1
end
end
end
end
end
for i = 1, tankAmount, 1 do
local tank = tanks[i]
if tank then
tank.x = (i - 1) * 25 + 5
tank.hist.container.x = tank.x
tank.bar.container.x = tank.x
local data = {}
if com.proxy(tank.addr) then
data = tank.proxy.getFluidInTank(tank.side)
end
if data[1] then
if cycle % (histUpdateInterval * 2) == 0 then
tank.hist.payload.max = math.max(tank.hist.payload.max, data[1].capacity)
table.insert(tank.hist.payload.values, data[1].amount)
if #tank.hist.payload.values > tank.hist.container.width then
table.remove(tank.hist.payload.values, 1)
end
end
tank.bar.payload.max = data[1].capacity
tank.bar.payload.value = data[1].amount
gpu.set(tank.x, 3, center(data[1].amount .. "mB", 20))
gpu.set(tank.x, 4, center(data[1].capacity .. "mB", 20))
gpu.set(tank.x, 5, center(("%6.2f"):format(100 * data[1].amount / data[1].capacity) .. "%", 20))
if data[1].label then
tank.bar.container.fg = colors[data[1].name] or colors[1]
if tank.hist.container.fg ~= tank.bar.container.fg then
tank.hist.payload.values = {}
end
tank.hist.container.fg = tank.bar.container.fg
gpu.set(tank.x, 2, center(data[1].label, 20))
else
tank.bar.container.fg = colors[1]
tank.hist.container.fg = colors[1]
gpu.set(tank.x, 2, center("Empty", 20))
end
end
tank.hist.container:draw()
tank.bar.container:draw()
else
gpu.set(25 * (i - 1) + 5 + 1, 12, "Connect a tank")
end
end
if event.pull(.5, "interrupted") then
break
end
cycle = cycle + 1
end
gpu.setBackground(oldBG)
gpu.setForeground(oldFG)
gpu.setResolution(oldW, oldH)
gpu.fill(1, 1, oldW, oldH, " ")
term.clear()
|
--[[
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the license found in the
LICENSE-examples file in the root directory of this source tree.
--]]
require('nn')
require('paths')
local tnt = require('torchnet')
-- use GPU or not:
local cmd = torch.CmdLine()
cmd:option('-usegpu', false, 'use gpu for training')
cmd:option('-seed', 1111, 'use gpu for training')
local config = cmd:parse(arg)
print(string.format('running on %s', config.usegpu and 'GPU' or 'CPU'))
local mpi = require('torchmpi')
-- The model we use for GPU + MPI is 1 Lua/Terra process for 1 GPU
-- mpi.start sets the GPU automatically
mpi.start(config.usegpu)
local mpinn = require('torchmpi.nn')
-- Set the random seed manually for reproducibility.
torch.manualSeed(config.seed)
-- set up logistic regressor:
local net = nn.Sequential():add(nn.Linear(784,10))
local criterion = nn.CrossEntropyCriterion()
-- set up training engine:
local engine = tnt.SGDEngine()
local meter = tnt.AverageValueMeter()
local clerr = tnt.ClassErrorMeter{topk = {1}}
engine.hooks.onStartEpoch = function(state)
meter:reset()
clerr:reset()
end
local correctnessCheck = true
engine.hooks.onForwardCriterion = function(state)
if correctnessCheck then mpinn.checkWithAllreduce(state.network) end
meter:add(state.criterion.output)
clerr:add(state.network.output, state.sample.target)
if state.training then
print(string.format('[%d/%d] avg. loss: %2.4f; avg. error: %2.4f',
mpi.rank() + 1, mpi.size(), meter:value(), clerr:value{k = 1}))
end
end
engine.hooks.onBackward = function(state)
mpinn.synchronizeGradients(state.network)
end
-- set up GPU training:
if config.usegpu then
cutorch.manualSeed(config.seed)
-- copy model to GPU:
require('cunn')
net = net:cuda()
criterion = criterion:cuda()
-- copy sample to GPU buffer:
local igpu, tgpu = torch.CudaTensor(), torch.CudaTensor()
engine.hooks.onSample = function(state)
igpu:resize(state.sample.input:size() ):copy(state.sample.input)
tgpu:resize(state.sample.target:size()):copy(state.sample.target)
state.sample.input = igpu
state.sample.target = tgpu
end -- alternatively, this logic can be implemented via a TransformDataset
end
-- Perform weight and bias synchronization before starting training
if config.usegpu then
mpi.async.initStreams(true)
end
mpinn.synchronizeParameters(net)
for _, v in pairs(net:parameters()) do mpi.checkWithAllreduce(v, 'initialParameters') end
local makeIterator = paths.dofile('makeiterator.lua')
-- train the model:
engine:train{
network = net,
iterator = makeIterator('train'),
criterion = criterion,
lr = 0.2,
maxepoch = 5,
}
-- measure test loss and error:
meter:reset()
clerr:reset()
engine:test{
network = net,
iterator = makeIterator('test'),
criterion = criterion,
}
-- Sanity check, paramMean for all processes should be the same, this may diverge
-- a bit in the absence of double precision
for _, v in pairs(net:parameters()) do mpi.checkWithAllreduce(v, 'final parameters') end
local loss = meter:value()
local err = clerr:value{k = 1}
print(string.format('[%d/%d] test loss: %2.4f; test error: %2.4f',
mpi.rank() + 1, mpi.size(), loss, err))
mpi.checkWithAllreduce(loss, 'final loss')
mpi.stop()
|
local GameSettings={}
local GameSettingsByIndex={}
function LoadGameSettings()
print("LoadGameSettings()")
local xml=CreateXML()
-- попыта загрузить файл с настройками
if not(xml.Load("data/GameSettings.xml")) then
-- загружаем файл настроек по умолчанию
xml.Load("data/Default_GameSettings.xml")
end
local index=1
local function LoadSetting(xml)
--загрузка отдельной настройки
local setting={}
setting.Name=xml.ReadStringByName("Name")
setting.Type=xml.ReadStringByName("Type")
if setting.Type=="Number" then
setting.Value=xml.ReadNumberByName("Value")
else
setting.Value=xml.ReadStringByName("Value")
end
GameSettings[setting.Name]=setting
GameSettingsByIndex[index]=setting
index=index+1
end
xml.ForEachChildByName("Setting", LoadSetting)
end
function SaveGameSettings()
print("SaveGameSettings() - saving..")
local xml=CreateXML()
xml.SetName("GameSettings")
local function SaveSetting(setting)
local sxml=CreateXML()
sxml.SetName("Setting")
sxml.WriteStringWithName("Name", setting.Name)
sxml.WriteStringWithName("Value", setting.Value)
sxml.WriteStringWithName("Type", setting.Type)
xml.AddChild(sxml)
end
ForEachInTable(GameSettingsByIndex, SaveSetting)
xml.Save("data/GameSettings.xml")
end
function GetGameSetting(name)
assert(name,"ERROR: GetGameSetting(name) - name is nil")
assert(GameSettings[name], "ERROR: GetGameSetting("..name..") - no such setting")
return GameSettings[name].Value
end
function SetGameSetting(name, value)
assert(name,"ERROR: SetGameSetting(name, value) - name is nil")
assert(GameSettings[name], "ERROR: SetGameSetting("..name..") - no such setting")
assert(value,"ERROR: SetGameSetting(name, value) - value is nil")
GameSettings[name].Value=value
end
|
--[[
© CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
Clockwork.config:Add("stam_regen_scale", 0.1, true);
Clockwork.config:Add("stam_drain_scale", 0.2, true);
Clockwork.config:Add("breathing_volume", 1, true);
|
-----------------------------------
-- Area: Al'Taieu
-- NPC: ??? (Jailer of Prudence Spawn)
-- Allows players to spawn the Jailer of Prudence by trading the Third Virtue, Deed of Sensibility, and High-Quality Hpemde Organ to a ???.
-- !pos , 706 -1 22
-----------------------------------
local ID = require("scripts/zones/AlTaieu/IDs");
-----------------------------------
function onTrade(player,npc,trade)
-- JAILER OF PRUDENCE
if (
not GetMobByID(ID.mob.JAILER_OF_PRUDENCE_1):isSpawned() and
not GetMobByID(ID.mob.JAILER_OF_PRUDENCE_2):isSpawned() and
trade:hasItemQty(1856,1) and -- third_virtue
trade:hasItemQty(1870,1) and -- deed_of_sensibility
trade:hasItemQty(1871,1) and -- high-quality_hpemde_organ
trade:getItemCount() == 3
) then
player:tradeComplete();
SpawnMob(ID.mob.JAILER_OF_PRUDENCE_1):updateClaim(player); -- Spawn Jailer of Prudence 1
SpawnMob(ID.mob.JAILER_OF_PRUDENCE_2); -- Spawn Jailer of Prudence 2 unclaimed
end
end;
function onTrigger(player,npc)
end;
function onEventUpdate(player,csid,option)
-- printf("onUpdate CSID: %u",csid);
-- printf("onUpdate RESULT: %u",option);
end;
function onEventFinish(player,csid,option)
-- printf("onFinish CSID: %u",csid);
-- printf("onFinish RESULT: %u",option);
end;
|
local S = ethereal.intllib
-- Strawberry (can also be planted as seed)
minetest.register_craftitem("ethereal:strawberry", {
description = S("Strawberry"),
inventory_image = "strawberry.png",
wield_image = "strawberry.png",
groups = {food_strawberry = 1, food_berry = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "ethereal:strawberry_1")
end,
on_use = minetest.item_eat(1),
})
-- Define Strawberry Bush growth stages
local crop_def = {
drawtype = "plantlike",
tiles = {"strawberry_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
},
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
}
--stage 1
minetest.register_node("ethereal:strawberry_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"strawberry_2.png"}
minetest.register_node("ethereal:strawberry_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"strawberry_3.png"}
minetest.register_node("ethereal:strawberry_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"strawberry_4.png"}
minetest.register_node("ethereal:strawberry_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"strawberry_5.png"}
minetest.register_node("ethereal:strawberry_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"strawberry_6.png"}
crop_def.drop = {
items = {
{items = {"ethereal:strawberry 1"},rarity = 2},
{items = {"ethereal:strawberry 2"},rarity = 3},
}
}
minetest.register_node("ethereal:strawberry_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"strawberry_7.png"}
crop_def.drop = {
items = {
{items = {"ethereal:strawberry 1"},rarity = 1},
{items = {"ethereal:strawberry 2"},rarity = 3},
}
}
minetest.register_node("ethereal:strawberry_7", table.copy(crop_def))
-- stage 8
crop_def.tiles = {"strawberry_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {"ethereal:strawberry 2"},rarity = 1},
{items = {"ethereal:strawberry 3"},rarity = 3},
}
}
minetest.register_node("ethereal:strawberry_8", table.copy(crop_def))
-- growing routine if farming redo isn't present
if not farming or not farming.mod or farming.mod ~= "redo" then
minetest.register_abm({
label = "Ethereal grow strawberry",
nodenames = {
"ethereal:strawberry_1", "ethereal:strawberry_2", "ethereal:strawberry_3",
"ethereal:strawberry_4", "ethereal:strawberry_5", "ethereal:strawberry_6",
"ethereal:strawberry_7"
},
neighbors = {"farming:soil_wet"},
interval = 9,
chance = 20,
catch_up = false,
action = function(pos, node)
-- are we on wet soil?
pos.y = pos.y - 1
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
return
end
pos.y = pos.y + 1
-- do we have enough light?
local light = minetest.get_node_light(pos)
if not light
or light < 13 then
return
end
-- grow to next stage
local num = node.name:split("_")[2]
node.name = "ethereal:strawberry_" .. tonumber(num + 1)
minetest.swap_node(pos, node)
end
})
end -- END IF
|
project "shader_editor"
libType()
files {
"src/**.c",
"src/**.cpp",
"src/**.h",
"genie.lua"
}
defines { "BUILDING_SHADER_EDITOR" }
links { "engine" }
useLua()
defaultConfigurations()
linkPlugin("shader_editor")
|
object_tangible_component_armor_armor_core_enhancement_assault = object_tangible_component_armor_shared_armor_core_enhancement_assault:new {
}
ObjectTemplates:addTemplate(object_tangible_component_armor_armor_core_enhancement_assault, "object/tangible/component/armor/armor_core_enhancement_assault.iff")
|
#!/usr/bin/env tarantool
test = require("sqltester")
test:plan(9)
--!./tcltestrunner.lua
-- 2012 April 02
--
-- The author disclaims copyright to this source code. In place of
-- a legal notice, here is a blessing:
--
-- May you do good and not evil.
-- May you find forgiveness for yourself and forgive others.
-- May you share freely, never taking more than you give.
--
-------------------------------------------------------------------------
-- The tests in this file were used while developing the sql 4 code.
--
-- ["set","testdir",[["file","dirname",["argv0"]]]]
-- ["source",[["testdir"],"\/tester.tcl"]]
testprefix = "tkt-385a5b56b9"
test:do_execsql_test(
1.0,
[[
CREATE TABLE t1(id INT primary key, x INT, y INT);
INSERT INTO t1 VALUES(1, 1, NULL);
INSERT INTO t1 VALUES(2, 2, NULL);
INSERT INTO t1 VALUES(3, 1, NULL);
]])
test:do_execsql_test(
1.1,
[[
SELECT DISTINCT x, y FROM t1
]], {
-- <1.1>
1, "", 2, ""
-- </1.1>
})
test:do_execsql_test(
1.2,
[[
CREATE UNIQUE INDEX i1 ON t1(x, y)
]])
test:do_execsql_test(
1.3,
[[
SELECT DISTINCT x, y FROM t1
]], {
-- <1.3>
1, "", 2, ""
-- </1.3>
})
---------------------------------------------------------------------------
test:do_execsql_test(
2.0,
[[
CREATE TABLE t2(x INT primary key, y INT NOT NULL);
CREATE UNIQUE INDEX t2x ON t2(x);
CREATE UNIQUE INDEX t2y ON t2(y);
]])
test:do_eqp_test(
2.1,
" SELECT DISTINCT x FROM t2 ", {
-- <2.1>
{0, 0, 0, "SCAN TABLE T2"}
-- </2.1>
})
test:do_eqp_test(
2.2,
" SELECT DISTINCT y FROM t2 ", {
-- <2.2>
-- changed after reordering indexes
-- actually it does not matter, because each y val is
-- distinct even in pk
--{0, 0, 0, "SCAN TABLE t2 USING COVERING INDEX t2y"}
{0, 0, 0, "SCAN TABLE T2"}
-- </2.2>
})
test:do_eqp_test(
2.3,
" SELECT DISTINCT x, y FROM t2 WHERE y=10 ", {
-- <2.3>
{0, 0, 0, "SEARCH TABLE T2 USING COVERING INDEX T2Y (Y=?)"}
-- </2.3>
})
test:do_eqp_test(
2.4,
" SELECT DISTINCT x, y FROM t2 WHERE x=10 ", {
-- <2.4>
-- changed after reordering indexes + add pk to x affected
-- actually it does not matter
--{0, 0, 0, "SEARCH TABLE t2 USING INDEX t2x (x=?)"}
{0, 0, 0, "SEARCH TABLE T2 USING PRIMARY KEY (X=?)"}
-- </2.4>
})
test:finish_test()
|
template = [[
public void RegisterCallback($WrappedCallback callback) {
Start(); // make sure the interface is initialized.
if (null == $WrappedList) {
$WrappedList = callback;
raw$WrappedCallback = new OSVR.ClientKit.$RawCallbackType($RawCallback);
iface.registerCallback (raw$WrappedCallback, System.IntPtr.Zero);
} else {
$WrappedList += callback;
}
}
private OSVR.ClientKit.$RawCallbackType raw$WrappedCallback;
private $WrappedCallback $WrappedList;
]]
function generate(data)
s = string.gsub(template, "$(%w+)", function (n)
return data[n]
end)
return s
end
print "/* BEGIN GENERATED CODE - unity-generate.lua */"
print(generate{
WrappedCallback = "PoseMatrixCallback";
WrappedList = "poseMatrixCallbacks";
RawCallback = "PoseMatrixCb";
RawCallbackType = "PoseCallback";
})
for _, v in ipairs{"Pose", "Position", "Orientation", "Button", "Analog"} do
local CapsName = v
local nocapsName = v:sub(1, 1):lower() .. v:sub(2)
local vals = {
WrappedCallback = CapsName .. "Callback";
WrappedList = nocapsName .. "Callbacks";
RawCallback = CapsName .. "Cb";
RawCallbackType = CapsName .. "Callback";
}
print(generate(vals))
end
print "/* END GENERATED CODE - unity-generate.lua */"
|
return {
version = "1.2",
luaversion = "5.1",
tiledversion = "1.3.1",
orientation = "orthogonal",
renderorder = "right-down",
width = 32,
height = 32,
tilewidth = 32,
tileheight = 32,
nextlayerid = 5,
nextobjectid = 20,
properties = {},
tilesets = {},
layers = {
{
type = "objectgroup",
id = 2,
name = "solids",
visible = true,
opacity = 1,
offsetx = -4,
offsety = 6,
draworder = "topdown",
properties = {},
objects = {
{
id = 2,
name = "",
type = "",
shape = "rectangle",
x = 4.49982,
y = -6.72267,
width = 57.6713,
height = 1026.67,
rotation = 0,
visible = true,
properties = {}
},
{
id = 3,
name = "",
type = "",
shape = "rectangle",
x = 63.0039,
y = 961.278,
width = 2103.3,
height = 57.3333,
rotation = 0,
visible = true,
properties = {}
},
{
id = 7,
name = "",
type = "",
shape = "rectangle",
x = 415.771,
y = 863.257,
width = 95.6463,
height = 29.3305,
rotation = 0,
visible = true,
properties = {}
},
{
id = 16,
name = "",
type = "",
shape = "rectangle",
x = 670.438,
y = 867.257,
width = 95.6463,
height = 29.3305,
rotation = 0,
visible = true,
properties = {}
},
{
id = 17,
name = "",
type = "",
shape = "rectangle",
x = 2222.44,
y = 833.257,
width = 95.6463,
height = 29.3305,
rotation = 0,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
id = 3,
name = "Spawn",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 9,
name = "",
type = "",
shape = "rectangle",
x = 98.1197,
y = 898.413,
width = 30.4962,
height = 62.4979,
rotation = 0,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
id = 4,
name = "Enemy Spawns",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 18,
name = "",
type = "",
shape = "rectangle",
x = 442.667,
y = 804,
width = 28.6667,
height = 38,
rotation = 0,
visible = true,
properties = {}
},
{
id = 19,
name = "",
type = "",
shape = "rectangle",
x = 695.667,
y = 805.667,
width = 28.6667,
height = 38,
rotation = 0,
visible = true,
properties = {}
}
}
}
}
}
|
-- _.reduceRight.lua
--
-- This method is like _.reduce except that it iterates over elements
-- of collection from right to left.
-- @usage local array = {0, 1, 2, 3, 4, 5};
-- _.print(_.reduceRight(array, function(str, other)
-- return str .. other
-- end, ''))
-- --> 543210
--
-- @param collection The collection to iterate over.
-- @param[opt=_.identity] iteratee The function invoked per iteration.
-- @param[opt=<first element>] accumulator The initial value.
-- @param[opt] selfArg The self binding of predicate.
-- @return Returns the accumulated value.
_.reduceRight = function (collection, iteratee, accumulator, selfArg)
local accumulator = accumulator
for k, v in _.iterRight(collection) do
if _.isNil(accumulator) then
accumulator = v
else
accumulator = callIteratee(iteratee, selfArg, accumulator, v, k, collection)
end
end
return accumulator
end
|
local base = require('imgui.widgets.TabItem')
---@class xe.TabContent:im.TabItem
local M = class('xe.TabContent', base)
local im = imgui
local wi = require('imgui.Widget')
function M:ctor(title)
base.ctor(self, title)
end
function M:addContent(icon, tooltip, cb)
local sp = icon
local btn, btn_disable = require('xe.util').createButton(sp, 2)
self:addChild(btn):addChild(btn_disable)
if cb then
btn:setOnClick(cb)
end
if tooltip then
self:addChild(function()
if im.isItemHovered() then
im.setTooltip(tooltip)
end
end)
end
return btn, btn_disable
end
return M
|
data:extend(
{
-- Solid Fuel Engine
{
type = "assembling-machine",
name = "y-sfe",
icon_size = 32, icon = "__yi_engines__/graphics/entity/energy2/sfe-icon.png",
flags = {"placeable-neutral","placeable-player", "player-creation"},
minable = {hardness = 0.2, mining_time = 0.5, result = "y-sfe"},
max_health = 250,
corpse = "big-remnants",
resistances = {{type = "physical",percent = 60},},
fluid_boxes =
{
{
production_type = "output",
base_area = 2,
base_level = 1,
pipe_connections = {
{type="output", position = {0, 2}},
}
},
{
production_type = "input",
base_area = 20,
base_level = -1,
pipe_connections = {
{ type="input", position = { 1, -2}},
}
},
{
production_type = "input",
base_area = 20,
base_level = -1,
pipe_connections = {
{ type="input", position = { -1, -2}},
}
},
},
collision_box = {{-1.4, -1.4}, {1.4, 1.4}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
fast_replaceable_group = "assembling-machine",
animation =
{
north= {
filename = "__yi_engines__/graphics/entity/energy2/sfe-nord.png",
width = 112,
height = 128,
shift = {0.2, -0.1},
frame_count = 12,
line_length = 12,
},
east= {
filename = "__yi_engines__/graphics/entity/energy2/sfe-west.png",
width = 128,
height = 112,
shift = {0.25, 0.2},
frame_count = 12,
line_length = 12,
},
south= {
filename = "__yi_engines__/graphics/entity/energy2/sfe-sued.png",
width = 112,
height = 128,
shift = {0.2, 0.3},
frame_count = 12,
line_length = 12,
},
west= {
filename = "__yi_engines__/graphics/entity/energy2/sfe-ost.png",
width = 128,
height = 112,
shift = {0.25, 0.2},
frame_count = 12,
line_length = 12,
},
},
crafting_categories = {"yrcat-mf1a"},
crafting_speed = 1,
energy_source =
{
type = "burner",
fuel_category = "chemical",
effectivity = 0.85,
fuel_inventory_size = 1,
emissions_per_minute = 60,
smoke =
{
{
name = "smoke",
deviation = {0.65, -0.2},
frequency = 1
}
}
},
energy_usage = "3000kW",
ingredient_count = 3,
order="a[atomics]",
subgroup = "yie-engines",
},
{
type = "assembling-machine",
name = "y-ffe",
icon_size = 32, icon = "__yi_engines__/graphics/entity/energy2/ffe-icon.png",
flags = {"placeable-neutral","placeable-player", "player-creation"},
minable = {hardness = 0.2, mining_time = 0.5, result = "y-ffe"},
max_health = 250,
corpse = "big-remnants",
resistances = {{type = "physical",percent = 60},},
fluid_boxes =
{
{
production_type = "output",
base_area = 3,
base_level = 1,
pipe_connections = {
{type="output", position = {0, 2}},
}
},
{
production_type = "input",
base_area = 30,
base_level = -1,
pipe_connections = {
{ type="input", position = { 0, -2}},
}
},
{
production_type = "input",
base_area = 30,
base_level = -1,
pipe_connections = {
{ type="input", position = { -1, -2}},
}
},
{
production_type = "input",
base_area = 30,
base_level = -1,
pipe_connections = {
{ type="input", position = { 1, -2}},
}
},
},
collision_box = {{-1.4, -1.4}, {1.4, 1.4}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
fast_replaceable_group = "assembling-machine",
animation =
{
north= {
filename = "__yi_engines__/graphics/entity/energy2/ffe-sa.png",
width = 128,
height = 112,
shift = {0.4, -0.1},
frame_count = 15,
line_length = 15,
},
east= {
filename = "__yi_engines__/graphics/entity/energy2/ffe-wa.png",
width = 128,
height = 128,
shift = {0.15, -0.2},
frame_count = 15,
line_length = 15,
},
south= {
filename = "__yi_engines__/graphics/entity/energy2/ffe-na.png",
width = 128,
height = 128,
shift = {0.4, 0.0},
frame_count = 15,
line_length = 15,
},
west= {
filename = "__yi_engines__/graphics/entity/energy2/ffe-oa.png",
width = 128,
height = 112,
shift = {0.25, 0.0},
frame_count = 15,
line_length = 15,
},
animation_speed = 0.8,
},
crafting_categories = {"yrcat-mf1b"},
crafting_speed = 1,
energy_source = {
type = "electric",
usage_priority = "primary-input",
emissions_per_minute = 0.03,
},
energy_usage = "100kW",
ingredient_count = 3,
--module_slots = 2,
--allowed_effects = {"speed", "productivity", "pollution"},
order="a[atomics]",
subgroup = "yie-engines",
},
-- A(Tiny) Stirling Engine
{
type = "assembling-machine",
name = "y-1stirling-engine",
icon_size = 32, icon = "__yi_engines__/graphics/entity/energy2/ast-icon.png",
flags = {"placeable-neutral","placeable-player", "player-creation"},
minable = {hardness = 0.2, mining_time = 0.5, result = "y-1stirling-engine"},
max_health = 150,
corpse = "small-remnants",
resistances = {{type = "physical",percent = 60},},
fluid_boxes =
{
{
production_type = "output",
base_area = 5,
base_level = 1,
pipe_connections = {
{type="output", position = {0.5, 1.5}},
}
},
},
collision_box = {{-0.7, -0.8}, {0.7, 0.8}},
selection_box = {{-1.0, -1.0}, {1.0, 1.0}},
fast_replaceable_group = "assembling-machine",
animation =
{
filename = "__yi_engines__/graphics/entity/energy2/stir-sheet.png",
width = 96,
height = 96,
shift = {0.6, -0.25},
frame_count = 18,
line_length = 18,
},
crafting_categories = {"yrcat-mf1c"},
crafting_speed = 1,
energy_source =
{
type = "burner",
fuel_category = "chemical",
effectivity = 0.7,
fuel_inventory_size = 1,
emissions_per_minute = 15,
smoke =
{
{
name = "smoke",
deviation = {0.65, -0.2},
frequency = 0.25
}
}
},
energy_usage = "300kW",
ingredient_count = 1,
order="a",
group = "yi_engines",
subgroup = "yie-engines",
},
})
|
include("shared.lua")
local Laws = {}
ENT.DrawPos = Vector(1, -111, 58)
local color_navy_200 = Color(0, 0, 70, 200)
local color_red = Color(255, 0, 0, 255)
local color_white = color_white
function ENT:Draw()
self:DrawModel()
local DrawPos = self:LocalToWorld(self.DrawPos)
local DrawAngles = self:GetAngles()
DrawAngles:RotateAroundAxis(self:GetAngles():Forward(), 90)
DrawAngles:RotateAroundAxis(self:GetAngles():Up(), 90)
cam.Start3D2D(DrawPos, DrawAngles, 0.4)
surface.SetDrawColor(0, 0, 0, 255)
surface.DrawRect(0, 0, 558, 290)
draw.RoundedBox(4, 0, 0, 558, 30, color_navy_200)
draw.DrawNonParsedSimpleText(DarkRP.getPhrase("laws_of_the_land"), "Roboto20", 279, 5, color_red, TEXT_ALIGN_CENTER)
local lastHeight = 0
for k, v in ipairs(Laws) do
draw.DrawNonParsedText(string.format("%u. %s", k, v), "Roboto20", 5, 35 + lastHeight, color_white)
lastHeight = lastHeight + (fn.ReverseArgs(string.gsub(v, "\n", "")) + 1) * 21
end
cam.End3D2D()
end
local function addLaw(inLaw)
local law = DarkRP.textWrap(inLaw, "Roboto20", 522)
local lawNumber = table.insert(Laws, law)
hook.Run("addLaw", lawNumber, inLaw)
end
local function umAddLaw(um)
local law = um:ReadString()
timer.Simple(0, fn.Curry(addLaw, 2)(law))
end
usermessage.Hook("DRP_AddLaw", umAddLaw)
local function umRemoveLaw(um)
local i = um:ReadShort()
local removed = table.remove(Laws, i)
hook.Run("removeLaw", i, removed)
end
usermessage.Hook("DRP_RemoveLaw", umRemoveLaw)
local function umResetLaws(um)
Laws = {}
fn.Foldl(function(val,v) addLaw(v) end, nil, GAMEMODE.Config.DefaultLaws)
hook.Run("resetLaws")
end
usermessage.Hook("DRP_ResetLaws", umResetLaws)
function DarkRP.getLaws()
return Laws
end
timer.Simple(0, function()
fn.Foldl(function(val,v) addLaw(v) end, nil, GAMEMODE.Config.DefaultLaws)
end)
|
local sounds = {}
local function sfx(name)
sounds[name] = love.audio.newSource("res/sfx/"..name..".wav", 'static')
end
sfx('hit')
sfx('shoot')
sfx('slash')
sfx('kill')
sfx('slime_call')
return sounds
|
return {
version = "1.5",
luaversion = "5.1",
tiledversion = "1.7.1",
orientation = "orthogonal",
renderorder = "right-down",
width = 16,
height = 15,
tilewidth = 16,
tileheight = 16,
nextlayerid = 3,
nextobjectid = 23,
backgroundcolor = { 0, 0, 0 },
properties = {},
tilesets = {
{
name = "sprites",
firstgid = 1,
tilewidth = 16,
tileheight = 16,
spacing = 0,
margin = 0,
columns = 16,
image = "assets/graphics/sprites.png",
imagewidth = 256,
imageheight = 256,
objectalignment = "unspecified",
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 16,
height = 16
},
properties = {},
wangsets = {},
tilecount = 256,
tiles = {}
},
{
name = "tiles",
firstgid = 257,
tilewidth = 16,
tileheight = 16,
spacing = 0,
margin = 0,
columns = 16,
image = "assets/graphics/tiles.png",
imagewidth = 256,
imageheight = 224,
objectalignment = "unspecified",
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 16,
height = 16
},
properties = {},
wangsets = {},
tilecount = 224,
tiles = {}
}
},
layers = {
{
type = "objectgroup",
draworder = "topdown",
id = 2,
name = "Sprites",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 1,
name = "",
type = "coin",
shape = "rectangle",
x = 64,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 9,
name = "",
type = "coin",
shape = "rectangle",
x = 80,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 10,
name = "",
type = "coin",
shape = "rectangle",
x = 96,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 11,
name = "",
type = "coin",
shape = "rectangle",
x = 112,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 12,
name = "",
type = "coin",
shape = "rectangle",
x = 128,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 13,
name = "",
type = "coin",
shape = "rectangle",
x = 144,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 14,
name = "",
type = "coin",
shape = "rectangle",
x = 160,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 2,
name = "",
type = "coin",
shape = "rectangle",
x = 64,
y = 128,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 3,
name = "",
type = "coin",
shape = "rectangle",
x = 80,
y = 128,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 15,
name = "",
type = "coin",
shape = "rectangle",
x = 80,
y = 96,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 16,
name = "",
type = "coin",
shape = "rectangle",
x = 96,
y = 96,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 17,
name = "",
type = "coin",
shape = "rectangle",
x = 112,
y = 96,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 18,
name = "",
type = "coin",
shape = "rectangle",
x = 128,
y = 96,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 19,
name = "",
type = "coin",
shape = "rectangle",
x = 144,
y = 96,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 4,
name = "",
type = "coin",
shape = "rectangle",
x = 96,
y = 128,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 5,
name = "",
type = "coin",
shape = "rectangle",
x = 112,
y = 128,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 6,
name = "",
type = "coin",
shape = "rectangle",
x = 128,
y = 128,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 7,
name = "",
type = "coin",
shape = "rectangle",
x = 144,
y = 128,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 8,
name = "",
type = "coin",
shape = "rectangle",
x = 160,
y = 128,
width = 16,
height = 16,
rotation = 0,
gid = 272,
visible = true,
properties = {
["collision"] = "cross"
}
},
{
id = 21,
name = "mario",
type = "",
shape = "rectangle",
x = 24,
y = 16,
width = 16,
height = 16,
rotation = 0,
gid = 97,
visible = true,
properties = {}
},
{
id = 22,
name = "pipeexit",
type = "",
shape = "rectangle",
x = 204,
y = 208,
width = 16,
height = 16,
rotation = 0,
gid = 393,
visible = true,
properties = {}
}
}
},
{
type = "tilelayer",
x = 0,
y = 0,
width = 16,
height = 15,
id = 1,
name = "Collisions",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {
["collidable"] = true
},
encoding = "base64",
compression = "zlib",
data = "eJxTYmRAAUqMuDE6SMYhTiwY1T+qH10/pemPGP3mQLYFEFuSqd8dyPYAYk8gVhxgDADdgQ+u"
}
}
}
|
--[[
This file is part of 'Masque', an add-on for World of Warcraft. For license information,
please see the included License.txt file or visit https://github.com/StormFX/Masque.
* File...: Core\Regions\NewItem.lua
* Author.: StormFX
'NewItem' Region
* See Skins\Default.lua for region defaults.
]]
local _, Core = ...
----------------------------------------
-- WoW API
---
local hooksecurefunc = hooksecurefunc
----------------------------------------
-- Internal
---
-- @ Skins\Default
local Default = Core.Skins.Default.NewItem
-- @ Core\Utility
local GetSize, SetPoints = Core.GetSize, Core.SetPoints
local GetColor, GetTexCoords = Core.GetColor, Core.GetTexCoords
----------------------------------------
-- Locals
---
local DEF_ATLAS = Default.Atlas
local Colors = {
["bags-glow-white"] = {1, 1, 1, 1},
["bags-glow-green"] = {0.12, 1, 0, 1},
["bags-glow-blue"] = {0, 0.44, 0.87, 1},
["bags-glow-purple"] = {0.64, 0.21, 0.93, 1},
["bags-glow-orange"] = {1, 0.5, 0, 1},
["bags-glow-artifact"] = {0.9, 0.8, 0.5, 1},
["bags-glow-heirloom"] = {0, 0.8, 1, 1},
}
----------------------------------------
-- Hook
---
-- Counters atlas changes when using a static skin texture.
local function Hook_SetAtlas(Region, Atlas)
if not Region.__MSQ_Skin then return end
Atlas = Atlas or DEF_ATLAS
Region.__MSQ_Atlas = Atlas
local Skin = Region.__MSQ_Skin
Region:SetTexture(Skin.Texture)
Region:SetTexCoord(GetTexCoords(Skin.TexCoords))
Region:SetVertexColor(GetColor(Colors[Atlas]))
end
----------------------------------------
-- Core
---
-- Skins the 'NewItem' region of a button.
function Core.SkinNewItem(Region, Button, Skin, xScale, yScale)
local Atlas = Region.__MSQ_Atlas or Region:GetAtlas() or DEF_ATLAS
local Texture = Skin.Texture
if Texture then
Region.__MSQ_Skin = Skin
Region.__MSQ_Atlas = Atlas
Region:SetTexture(Texture)
Region:SetTexCoord(GetTexCoords(Skin.TexCoords))
Region:SetVertexColor(GetColor(Colors[Atlas]))
if not Region.__MSQ_Hooked then
hooksecurefunc(Region, "SetAtlas", Hook_SetAtlas)
Region.__MSQ_Hooked = true
end
else
Region.__MSQ_Skin = nil
Region.__MSQ_Atlas = nil
Region:SetAtlas(Atlas)
Region:SetVertexColor(1, 1, 1, 1)
end
Region:SetBlendMode(Skin.BlendMode or "ADD")
Region:SetDrawLayer(Skin.DrawLayer or "OVERLAY", Skin.DrawLevel or 2)
Region:SetSize(GetSize(Skin.Width, Skin.Height, xScale, yScale))
SetPoints(Region, Button, Skin, nil, Skin.SetAllPoints)
end
|
--[=[
Add another layer of effects that can be faded in/out
@class FadingCamera
]=]
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Spring = require(ReplicatedStorage.Knit.Util.Additions.Physics.Spring)
local SummedCamera = require(script.Parent.SummedCamera)
local FadingCamera = {}
FadingCamera.ClassName = "FadingCamera"
--[=[
@param camera CameraEffect
]=]
function FadingCamera.new(camera)
local self = setmetatable({}, FadingCamera)
self.Spring = Spring.new(0)
self.Camera = camera or error("No camera")
self.Damper = 1
self.Speed = 15
return self
end
function FadingCamera:__add(other)
return SummedCamera.new(self, other)
end
function FadingCamera:__newindex(index, value)
if index == "Damper" then
self.Spring:SetDamper(value)
elseif index == "Value" or index == "Position" then
self.Spring:SetPosition(value)
elseif index == "Speed" then
self.Spring:SetSpeed(value)
elseif index == "Target" then
self.Spring:SetTarget(value)
elseif index == "Spring" or index == "Camera" then
rawset(self, index, value)
else
error(index .. " is not a valid member of fading camera")
end
end
--[=[
The current state.
@readonly
@prop CameraState CameraState
@within FadingCamera
]=]
function FadingCamera:__index(index)
if index == "CameraState" then
return (self.Camera.CameraState or self.Camera) * self.Spring:GetPosition()
elseif index == "Damper" then
return self.Spring.Damper
elseif index == "Position" or index == "Value" then
return self.Spring:GetPosition()
elseif index == "Speed" then
return self.Spring.Speed
elseif index == "Target" then
return self.Spring.Target
elseif index == "Velocity" then
return self.Spring:GetVelocity()
elseif index == "HasReachedTarget" then
return math.abs(self.Value - self.Target) < 1E-4 and math.abs(self.Velocity) < 1E-4
else
return FadingCamera[index]
end
end
function FadingCamera:__tostring()
return "FadingCamera"
end
table.freeze(FadingCamera)
return FadingCamera
|
require "log"
log.debug("********************* ydwe initialize start *********************")
do
local real_require = require
require = function (str, ...)
if not package.loaded[str] then
log.trace("Initializing '" .. str .. "'")
end
return real_require(str, ...)
end
end
require "utiliy"
local function compiler_searcher(name)
local filename
if name == 'slk' then
filename = fs.ydwe_devpath() / 'compiler' / 'script' / 'slk.lua'
elseif name == 'compiler' then
filename = fs.ydwe_devpath() / 'compiler' / 'script' / 'init.lua'
elseif name:sub(1, 9) == 'compiler.' then
filename = fs.ydwe_devpath() / 'compiler' / 'script' / (name:sub(10):gsub('%.', '/') .. '.lua')
else
return ("\n\tno file '%s'"):format(name)
end
local f, err = io.open(filename, 'r')
if f then
local str = f:read 'a'
f:close()
f, err = load(str, '@' .. filename:string())
end
if not f then
error(("error loading module '%s' from file '%s':\n\t%s"):format(name, filename:string(), err))
end
return f, filename:string()
end
table.insert(package.searchers, compiler_searcher)
require "filesystem"
require "event"
require "virtual_mpq"
require "version"
require "localization"
require "config"
require "plugin"
require "ffi.loadlibrary"
require "ffi.gui"
require "ydwe_on_menu"
require "ydwe_on_save"
require "ydwe_on_test"
require "ydwe_on_startup"
require "ydwe_on_dialog_message"
require "ydwe_on_new_object_id"
log.debug("********************* ydwe initialize end *********************")
|
--[[
Name: civilian.lua
For: TalosLife
By: TalosLife
]]--
local Job = {}
Job.ID = 22
Job.Enum = "JOB_BANKER"
Job.TeamColor = Color( 255, 255, 255, 255 )
Job.Name = "Banqueiro"
Job.Cat = "Civis"
Job.Pay = {
{ PlayTime = 0, Pay = 15 },
{ PlayTime = 0, Pay = 15 },
{ PlayTime = 0, Pay = 15 },
{ PlayTime = 0, Pay = 15 },
}
Job.Text = [[Sempre muito bom com números faz o que há de melhor para si mesmo.
OBJETIVOS:
x Criar o Banco Central
x Gerar uma economia grande com seu trabalho
x Ser conhecido pela cidade inteira
REGRAS:
x So pode fazer grupo com seguranças do banco
x Não pode cometer atos ilícitos
x Pode ter apenas armas de pequeno porte
[x] OBRIGATORIO dar dinheiro dos clientes
[x] OBRIGATORIO cobrar para guardar bitminers/printers
[x] Nao pode passar longos periodos fora do banco.]];
function Job:OnPlayerJoinJob( pPlayer )
end
function Job:OnPlayerQuitJob( pPlayer )
end
function Job:GetPlayerModel( pPlayer )
local base, overload
if SERVER then
base = GAMEMODE.Player:GetGameVar( pPlayer, "char_model_base", nil )
overload = GAMEMODE.Player:GetGameVar( pPlayer, "char_model_overload", nil )
else
base = GAMEMODE.Player:GetGameVar( "char_model_base", nil )
overload = GAMEMODE.Player:GetGameVar( "char_model_overload", nil )
end
if util.IsValidModel( overload or "" ) then
return overload
else
return base
end
end
function Job:PlayerSetModel( pPlayer )
local mdl = self:GetPlayerModel(pPlayer)
if mdl then
pPlayer:SetModel( mdl )
pPlayer:SetSkin( GAMEMODE.Player:GetGameVar(pPlayer, "char_skin", 0) )
end
end
function Job:PlayerLoadout( pPlayer )
end
GM.Jobs:Register( Job )
|
local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end
ShopObjectsCached = { }
ShopTable = {
{
items = {
water_bottle = 5,
apple = 5,
donut = 5,
repair_kit = 50,
health_kit = 50,
lockpick = 500,
pickaxe = 20,
jerican = 50
},
location = {
{ 128748, 77622, 1576, 90 },
{ 42694, 137926, 1581, 90 },
{ -15402, -2773, 2065, 90 },
{ -169093, -39441, 1149, 90 },
{ 171131, 203562, 1413, -180 }
},
npc = {},
},
{
items = {
weapon_2 = 5000,
weapon_3 = 5000,
weapon_4 = 5000,
weapon_5 = 5000,
weapon_6 = 15000,
weapon_7 = 15000,
weapon_8 = 10000,
weapon_9 = 10000,
weapon_10 = 20000,
weapon_11 = 20000,
weapon_12 = 30000,
weapon_13 = 20000,
weapon_14 = 20000,
weapon_15 = 20000,
weapon_16 = 20000,
weapon_17 = 20000,
weapon_18 = 20000,
weapon_19 = 20000,
weapon_20 = 30000
},
location = {
{ -181943, -40882, 1163, 90 },
{ 206071, 193057, 1357, 180 }
},
npc = {},
},
--[[ {
items = {
processed_weed = 4000,
processed_meth = 4000,
processed_coke = 4000,
processed_heroin = 4000
},
location = {
{ -177344, 3673, 1992, 0 }
},
npc = {},
}, ]]
{
items = {
processed_rock = 160,
},
location = {
{ 67862, 184741, 535, 90 }
},
npc = {},
}
}
AddEvent("OnPackageStart", function()
for k,v in pairs(ShopTable) do
for i,j in pairs(v.location) do
v.npc[i] = CreateNPC(v.location[i][1], v.location[i][2], v.location[i][3], v.location[i][4])
CreateText3D(_("shop").."\n".._("press_e"), 18, v.location[i][1], v.location[i][2], v.location[i][3] + 120, 0, 0, 0)
table.insert(ShopObjectsCached, v.npc[i])
end
end
end)
AddEvent("OnPlayerJoin", function(player)
CallRemoteEvent(player, "shopSetup", ShopObjectsCached)
end)
AddRemoteEvent("shopInteract", function(player, shopobject)
local shop, npcid = GetShopByObject(shopobject)
if shop then
local x, y, z = GetNPCLocation(shop.npc[npcid])
local x2, y2, z2 = GetPlayerLocation(player)
local dist = GetDistance3D(x, y, z, x2, y2, z2)
if dist < 250 then
for k,v in pairs(ShopTable) do
if shopobject == v.npc[npcid] then
CallRemoteEvent(player, "openShop", PlayerData[player].inventory, v.items, v.npc[npcid])
end
end
end
end
end)
function GetShopByObject(shopobject)
for k,v in pairs(ShopTable) do
for i,j in pairs(v.npc) do
if j == shopobject then
return v,i
end
end
end
return nil
end
function getPrice(shop, item)
for k,v in pairs(ShopTable) do
for i,j in pairs(v.npc) do
if j == shop then
return v.items[item]
end
end
end
return 0
end
AddRemoteEvent("ShopBuy", function(player, shopid, item, amount)
local price = getPrice(shopid, item) * amount
if PlayerData[player].cash < price then
AddPlayerChat(player, _("not_enought_cash") )
else
PlayerData[player].cash = PlayerData[player].cash - price
AddPlayerChat(player, _("shop_success_buy", _(item), price, _("currency")))
AddInventory(player, item, amount)
end
end)
AddRemoteEvent("ShopSell", function(player, shopid, item, amount)
local price = getPrice(shopid, item) * amount * 0.25
if price == 0 then
return
end
if tonumber(PlayerData[player].inventory[item]) < tonumber(amount) then
AddPlayerChat(player, _("not_enough_item"))
else
PlayerData[player].cash = PlayerData[player].cash + math.ceil(price)
AddPlayerChat(player, _("shop_success_sell", _(item), price, _("currency")))
RemoveInventory(player, item, amount)
end
end)
AddEvent("OnNPCDamage", function(npc)
SetNPCHealth( npc, 100 )
end)
|
if engine.ActiveGamemode() ~= "terrortown" then return end
---
-- @module draw
-- @author Bull
-- @author Alf21
--
-- @desc A Simple Garry's mod drawing library
-- Copyright (C) 2016 Bull [STEAM_0:0:42437032] [76561198045139792]
-- Freely acquirable at https://github.com/bull29/b_draw-lib
-- You can use this anywhere for any purpose as long as you acredit the work to the original author with this notice.
-- Optionally, if you choose to use this within your own software, it would be much appreciated if you could inform me of it.
-- I love to see what people have done with my code! :)
--
-- This code got fixed and modified by the TTT2 dev group, ty for the lib @Bull !
file.CreateDir("downloaded_assets")
local exists = file.Exists
local write = file.Write
local fetch = http.Fetch
local white = Color(255, 255, 255)
local surface = surface
local crc = util.CRC
local _error = Material("error")
local math = math
local mats = {}
local fetchedavatars = {}
local function fetch_asset(url, fallback)
if not url then
return _error
end
if mats[url] then
return mats[url]
end
local crcUrl = crc(url)
if exists("downloaded_assets/" .. crcUrl .. ".png", "DATA") then
mats[url] = Material("data/downloaded_assets/" .. crcUrl .. ".png")
return mats[url]
end
mats[url] = fallback or _error
fetch(url, function(data)
write("downloaded_assets/" .. crcUrl .. ".png", data)
mats[url] = Material("data/downloaded_assets/" .. crcUrl .. ".png")
end)
return mats[url]
end
local function fetchAvatarAsset(id64, size, onFetched)
id64 = id64 or "BOT"
size = size == "medium" and "medium" or size == "small" and "" or size == "large" and "full" or ""
if fetchedavatars[id64 .. " " .. size] then
return fetchedavatars[id64 .. " " .. size]
end
fetchedavatars[id64 .. " " .. size] = id64 == "BOT" and "http://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/09/09962d76e5bd5b91a94ee76b07518ac6e240057a_full.jpg" or "http://i.imgur.com/uaYpdq7.png"
if id64 == "BOT" then
if isfunction(onFetched) then
onFetched(fetchedavatars[id64 .. " " .. size])
end
return
end
fetch("http://steamcommunity.com/profiles/" .. id64 .. "/?xml=1", function(body)
local link = body:match("https://steamcdn%-a%.akamaihd%.net/steamcommunity/public/images/avatars/.-%.jpg") -- fix this with new https and gmod regex
if not link then return end
fetchedavatars[id64 .. " " .. size] = link:Replace(".jpg", (size ~= "" and "_" .. size or "") .. ".jpg")
if isfunction(onFetched) then
onFetched(fetchedavatars[id64 .. " " .. size])
end
end)
end
---
-- Cache an avatar for later use
-- @param string id64 the steamid64
-- @param number size the avatar's size, this can be <code>medium</code>, <code>small</code> and <code>large</code>
function draw.CacheAvatar(id64, size)
fetch_asset(fetchAvatarAsset(id64, size, function(url)
fetch_asset(url)
end))
end
---
-- Draws an WebImage
-- @param string url the url to the WebImage
-- @param number x
-- @param number y
-- @param number width
-- @param number height
-- @param Color color
-- @param Angle angle
-- @param boolean cornerorigin if it is set to <code>true</code>, the WebImage will be centered based on the x- and y-coordinate
function draw.WebImage(url, x, y, width, height, color, angle, cornerorigin)
color = color or white
surface.SetDrawColor(color.r, color.g, color.b, color.a)
surface.SetMaterial(fetch_asset(url))
if not angle then
surface.DrawTexturedRect(x, y, width, height)
else
if not cornerorigin then
surface.DrawTexturedRectRotated(x, y, width, height, angle)
else
surface.DrawTexturedRectRotated(x + width / 2, y + height / 2, width, height, angle)
end
end
end
---
-- @todo description
-- @param string url
-- @param number parentwidth
-- @param number parentheight
-- @param number xrep
-- @param number yrep
-- @param Color color
function draw.SeamlessWebImage(url, parentwidth, parentheight, xrep, yrep, color)
color = color or white
local xiwx, yihy = math.ceil(parentwidth / xrep), math.ceil(parentheight / yrep)
for x = 0, xrep - 1 do
for y = 0, yrep - 1 do
draw.WebImage(url, x * xiwx, y * yihy, xiwx, yihy, color)
end
end
end
---
-- Draws a SteamAvatar while caching it before
-- @param string id64 the steamid64
-- @param number size
-- @param number x
-- @param number y
-- @param number width
-- @param number height
-- @param Color color
-- @param Angle ang
-- @param boolean corner
function draw.SteamAvatar(id64, size, x, y, width, height, color, ang, corner)
draw.WebImage(fetchAvatarAsset(id64, size), x, y, width, height, color, ang, corner)
end
---
-- Returns the cached avatar material for a steamid64
-- @param string id64 the steamid64
-- @param number size
-- @param Material fallback material if downloading failed or the resource is missing
-- @return Material
function draw.GetAvatarMaterial(id64, size, fallback)
return fetch_asset(fetchAvatarAsset(id64, size), fallback)
end
|
local playsession = {
{"mewmew", {1669923}},
{"NekoBaron", {284461}},
{"Tony_2083", {202919}},
{"MontrealCrook", {567795}},
{"iSTEVE", {189735}},
{"Xoxlohunter", {7686}},
{"realDonaldTrump", {133307}},
{"ETK03", {717780}},
{"zwierzak40", {14539}},
{"RebuffedBrute44", {157346}},
{"xxsevenevesxx", {253990}},
{"Pallando", {298864}},
{"ksb4145", {51193}},
{"amgonakilyou", {954}},
{"Aaryan", {6836}},
{"robodino3", {8400}},
{"moocat12", {186852}},
{"xferfer", {237662}},
{"spinxt", {379761}},
{"Hiero", {882645}},
{"jtmanders", {111433}},
{"Menander", {41660}},
{"KSolo", {14472}},
{"boxofsalmon", {8995}},
{"mars_precision", {1477}},
{"IsThisNameTakenAlready", {534963}},
{"tmoneyfizzle", {2522}},
{"Chevalier1200", {477549}},
{"CrazyAmphibian", {609651}},
{"VorceShard", {55250}},
{"roosterbrewster", {3272}},
{"DaBigEd", {1014008}},
{"Apocalypticoreo", {4655}},
{"dawsontyler02", {3133}},
{"Taylor3", {304051}},
{"Deadbees", {4743}},
{"Pickleman", {4164}},
{"MuddledBox", {244332}},
{"Mullacs", {6151}},
{"RES231", {17265}},
{"kevinma", {8327}},
{"Wiedrock", {586996}},
{"vertron47", {341450}},
{"Miguel724", {159673}},
{"kokos1457", {7053}},
{"Camo5", {1045825}},
{"Roufails", {947047}},
{"JinNJuice", {8308}},
{"arisgr", {25623}},
{"firstandlast", {437069}},
{"S2", {8641}},
{"Tracolix", {444266}},
{"951545075", {11261}},
{"Spatzz", {25109}},
{"BravePotato", {647744}},
{"lukasz_liberda", {28678}},
{"Reyand", {132535}},
{"chrisisthebe", {472767}},
{"anghelnicky", {187976}},
{"redlabel", {1302217}},
{"XaLpHa1989", {23433}},
{"ulmen", {6925}},
{"Joplaya", {280679}},
{"A-l-a-n", {154087}},
{"brftjx", {28563}},
{"Whouser", {52482}},
{"liqwid", {18560}},
{"Thex2001", {2237}},
{"nik12111", {788}},
{"helenohyeah", {8440}},
{"jer93", {9470}},
{"4yDo", {17644}},
{"p27", {227391}},
{"mad58max", {2262182}},
{"Mokomi", {1093}},
{"saltlands", {503309}},
{"steve3024", {860}},
{"corbin9228", {6461}},
{"abrown4521", {13854}},
{"StormBreaker", {714}},
{"therv", {4550}}
}
return playsession
|
package.path = "../../types.lua;" .. package.path
local name = "predicate"
local function generate_predicate_named(type, name)
local name = name:gsub("^%l", string.upper)
io.write(string.format("\n// %s represents a function that accepts a %s and returns a bool if the predicate is validated.\n", name, type))
io.write(string.format("type %s func(%s) bool\n", name, type))
end
local function generate_predicate(type)
generate_predicate_named(type, type)
end
local function generate_predicates_named(type, name)
local name = name:gsub("^%l", string.upper) .. "s"
io.write(string.format("\n// %s represents a function that accepts a []%s and returns a bool if the predicate is validated.\n", name, type))
io.write(string.format("type %s func([]%s) bool\n", name, type))
end
local function generate_predicates(type)
generate_predicates_named(type, type)
end
file = io.open(name .. ".go", "w+")
io.output(file)
io.write("package " .. name .. "\n")
for _, v in ipairs(require("types")) do
generate_predicate(v)
end
generate_predicate_named("interface{}", "Interface")
for _, v in ipairs(require("types")) do
generate_predicates(v)
end
generate_predicates_named("interface{}", "Interface")
file:close()
io.output(io.stdout)
|
-- Fields with `nil` should be initialized in Rust
-- Internal --
local internal = {
paths = {},
sealed = false,
source = nil,
package = {
loaded = {},
preload = {},
searchers = nil,
},
}
-- Hive table --
local function register(path, handler)
assert(
not internal.sealed,
"cannot call `hive.register` from places other than the top level of `main.lua`"
)
local type_handler = type(handler)
if type_handler ~= "function" then
if type_handler == "table" then
local mt = getmetatable(handler)
if type(mt) == "table" and type(mt.__call) == "function" then
goto ok
end
end
error "handler must either be a function or a callable table"
end
::ok::
table.insert(internal.paths, { path, handler })
end
local function require(modname)
local modname_type = type(modname)
assert(
modname_type == "string",
"bad argument #1 to 'require' (string expected, got " .. modname_type .. ")"
)
local package = internal.package;
local error_msgs = {}
if package.loaded[modname] then
return table.unpack(package.loaded[modname])
else
for _, searcher in ipairs(package.searchers) do
local loader, data = searcher(modname)
if loader then
local result = { loader(modname, data) }
package.loaded[modname] = result
return table.unpack(result)
else
table.insert(error_msgs, data)
end
end
end
error("module '" .. modname .. "' not found:\n\t" .. table.concat(error_msgs, "\n"))
end
-- Local env --
local local_env = {
hive = {
register = register,
context = nil,
permission = nil,
current_worker = current_worker,
Error = hive_Error,
},
require = require,
}
-- Searchers --
local preload = internal.package.preload
local function preload_searcher(modname)
local loader = preload[modname]
if loader then
return loader, "<preload>"
else
return nil, "preload '" .. modname .. "' not found"
end
end
local function source_searcher(modname)
local source = internal.source
local path = ""
for str in string.gmatch(modname, "([^%.]+)") do
path = path .. "/" .. str
end
local file_exists = source:exists(path .. ".lua")
local init_exists = source:exists(path .. "/init.lua")
if file_exists and init_exists then
return nil, "file '@source:" .. path .. ".lua' and '@source:" .. path .. "/init.lua' conflicts"
elseif not file_exists and not init_exists then
return nil, "no file '@source:" .. path .. ".lua'\n\tno file 'source:" .. path .. "/init.lua'"
else
path = path .. (file_exists and ".lua" or "/init.lua")
local function source_loader(modname, path)
return source:load(path, local_env)()
end
return source_loader, path
end
end
internal.package.searchers = { preload_searcher, source_searcher }
-- Standard library whitelist --
local whitelist = {
[false] = {
"assert", "ipairs", "next", "pairs",
"pcall", "print", "rawequal", "select",
"setmetatable", "tonumber", "tostring", "type",
"warn", "xpcall", "_VERSION",
},
math = {
"abs", "acos", "asin", "atan",
"atan2", "ceil", "cos", "deg",
"exp", "floor", "fmod", "frexp",
"huge", "ldexp", "log", "log10",
"max", "maxinteger", "min", "mininteger",
"modf", "pi", "pow", "rad", "random",
"sin", "sinh", "sqrt", "tan",
"tanh", "tointeger", "type", "ult",
},
os = {
"clock", "difftime", "time",
},
string = {
"byte", "char", "find", "format",
"gmatch", "gsub", "len", "lower",
"match", "reverse", "sub", "upper",
},
table = {
"remove", "sort", "concat", "pack",
"unpack",
},
coroutine = {
"close", "create", "isyieldable", "resume",
"running", "status", "wrap", "yield",
},
}
local monkey_patch = {
[false] = {
"error",
},
table = {
"insert", "dump", "scope"
},
routing = "*"
}
local function apply_whitelist(whitelist)
for module, fields in pairs(whitelist) do
local from_module, to_module
if module then
from_module = _G[module]
to_module = {}
local_env[module] = to_module
else
from_module = _G
to_module = local_env
end
if fields == "*" then
for k, v in pairs(from_module) do
to_module[k] = v
end
else
for _, field in ipairs(fields) do
to_module[field] = from_module[field]
end
end
end
end
apply_whitelist(whitelist)
apply_whitelist(monkey_patch)
local_env.getmetatable = safe_getmetatable
return local_env, internal
|
---@diagnostic disable: undefined-global
local palette = require 'nord-palette'
local base = require 'base'
-- JavaScript
-- > pangloss/vim-javascript
local clrs = palette.clrs
local spec = palette.spec
local pkg = function()
return {
jsGlobalNodeObjects {fg = clrs.nord8, gui = spec.italic},
hjsBrackets {base.Delimiter},
jsFuncCall {base.Function},
jsFuncParens {base.Delimiter},
jsThis {base.Keyword},
jsNoise {base.Delimiter},
jsPrototype {base.Keyword},
jsRegexpString {base.SpecialChar},
}
end
return pkg
-- vi:nowrap
|
--====================================================================--
-- Async Sockets Basic
--
-- Tests the Sockets library, async style
--
-- Sample code is MIT licensed, the same license which covers Lua itself
-- http://en.wikipedia.org/wiki/MIT_License
-- Copyright (C) 2014-2015 David McCuskey. All Rights Reserved.
--====================================================================--
print("\n===================================================================\n")
--===================================================================--
--== Imports
local Sockets = require 'lua_sockets'
local Utils = require 'lua_utils'
--====================================================================--
--== Setup, Constants
local host, port = 'docs.davidmccuskey.com', 80
local sock
--====================================================================--
--== Support Functions
-- make up a generic request for the web server
--
local function sendRequest()
local req_t, req
local bytes, err
local req_t = {
"GET / HTTP/1.1\r\n",
"Host: " .. host .. "\r\n",
"User-Agent: DMC Sockets " .. Sockets.VERSION .. "\r\n",
"\r\n"
}
req = table.concat( req_t, "" )
bytes, err = sock:send( req )
end
--====================================================================--
--== Main
--====================================================================--
local function main()
local onConnect, dataCallback, newlineCallback
onConnect = function( event )
if event.status == sock.CONNECTED then
print("=== Connection Established ===")
sendRequest()
print("Reading Data\n\n")
-- sock:receive( '*l', dataCallback )
sock:receiveUntilNewline( newlineCallback )
elseif event.status == sock.CLOSED then
print("=== Connection Closed ===\n\n")
timer.performWithDelay( 4000, function() print("Reconnecting\n\n") ; sock:reconnect( { onConnect=onConnect } ) end )
else
print("=== Connection Error ===")
print( event.status, event.emsg )
end
end
dataCallback = function( event )
print("== Data Handler ==")
print( '>>', event.data, event.emsg )
end
newlineCallback = function( event )
print("== Newline Handler ==")
event = event or {}
if not event.data then
print( 'error', event.emsg )
else
print("Received Data:\n")
for i,v in ipairs( event.data ) do
print(i,v)
end
print("\n")
end
end
print("Starting Connection")
sock = Sockets:create( Sockets.ATCP )
sock:connect( host, port, { onConnect=onConnect, onData=dataCallback } )
end
main()
|
-- This walks an AST, making back references to the parent node.
--
-- This shouldn't be a separate step, but that's premature optimization.
-- This is conceptually simple:
-- Take the tree, add a parent reference that points to itself.
-- Take all child members, if they're nodes, call the function recursively with the parent and nodes as argument.
-- This is the usual recursive function wrapped in pre and post matter.
-- Now that I've added an index, I'm considering a cleaner parent implementation, where the parent is simply a number
-- which must be looked up against the index. To completely eliminate back references, the index might be a closure
-- which returns the table given the argument, thus `index(i)` rather than `index[i]`.
--
-- It would be useful for our decorated AST to have no cycles, since we're guaranteed to traverse it in linear time
-- with no cycle checking.
local util = require "util"
local backwalk = {}
local function make_backref (ast)
return function() return ast end
end
local function index_gen ()
local first = {}
local last = {}
local closed = {}
local depth = {}
local length = 0
local meta = util.F()
meta.__call = function(_, ordinal)
return first[ordinal], last[ordinal], depth[ordinal]
end
-- This override requires 5.2
meta.__len = function() return length end
closed.len = function() return length end
closed.add = function(table, deep)
length = length+1
first[length] = table
first[table] = length -- Janus table!
depth[length] = deep
depth[table] = deep
end
closed.close = function(table)
last[first[table]] = length
last[table] = length
end
setmetatable(closed,meta)
return closed
end
local function lift(ast, str)
--lifts all spans as literal values under the tree.
--decorator: does not copy. Returns nothing.
-- should not exist.
local function lifter(ast,str)
if not str then str = ast:root().str end
for i,v in ipairs(ast) do
if type(v) == "table" and v.span then
ast.val = str:sub(v[1],v[2])
ast.first = v[1]
ast.last = v[2]
elseif type(v) == "table" and v.isnode then
lifter(v,str)
elseif type(v) == "string" then
error "raw string capture found in AST"
-- implement a sensible strategy
-- or forbid outright?
end
end
end
if not ast.lifted then lifter(ast,str) end
end
function backwalk.walk_ast (ast)
local index = index_gen()
local str = ast.str
local function walker (ast, parent, deep)
deep = deep + 1
if ast.isnode then
index.add(ast,deep)
for i, v in ipairs(ast) do
if type(v) == "table" and v.isnode then
walker(v,ast, deep)
-- elseif type(v) == "string" then
-- ast.val = v
-- table.remove(ast,i)
end
end
ast.parent = make_backref(parent)
index.close(ast)
end
end
walker(ast,ast,0)
ast.index = index
lift(ast)
walker(ast,ast,0)
ast.lifted = true
-- print("index length is now: ", #index)
return ast
end
return backwalk
|
-- Gaster <3
-- Condolences To Asriel And Fang (sexy Mofo's)
wait(0.016666666666667)
Effects = {}
local Player = game.Players.localPlayer
local Character = Player.Character
local Humanoid = Character.Humanoid
local mouse = Player:GetMouse()
local m = Instance.new("Model", Character)
m.Name = "WeaponModel"
local effect = Instance.new("Model", Character)
effect.Name = "Effects"
local LeftArm = Character["Left Arm"]
local RightArm = Character["Right Arm"]
local LeftLeg = Character["Left Leg"]
local RightLeg = Character["Right Leg"]
local Head = Character.Head
local Torso = Character.Torso
local cam = game.Workspace.CurrentCamera
local RootPart = Character.HumanoidRootPart
local RootJoint = RootPart.RootJoint
local equipped = false
local attack = false
local Anim = "Idle"
vt = Vector3.new
local idle = 0
local attacktype = 1
local Torsovelocity = RootPart.Velocity * Vector3.new(1, 0, 1).magnitude
local velocity = RootPart.Velocity.y
local sine = 0
local change = 1
local mana = 100
local mananum = 0
local it = Instance.new
xenabled = true
cenabled = true
venabled = true
zenabled = true
local grabbed = false
local cf = CFrame.new
local mr = math.rad
local angles = CFrame.Angles
local ud = UDim2.new
local c3 = Color3.new
local NeckCF = cf(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
local RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
local RHCF = CFrame.fromEulerAnglesXYZ(0, 1.6, 0)
local LHCF = (CFrame.fromEulerAnglesXYZ(0, -1.6, 0))
RSH = nil
RW = Instance.new("Weld")
LW = Instance.new("Weld")
RH = Torso["Right Hip"]
LH = Torso["Left Hip"]
RSH = Torso["Right Shoulder"]
LSH = Torso["Left Shoulder"]
RSH.Parent = nil
LSH.Parent = nil
RW.Name = "RW"
RW.Part0 = Torso
RW.C0 = cf(1.5, 0.5, 0)
RW.C1 = cf(0, 0.5, 0)
RW.Part1 = RightArm
RW.Parent = Torso
LW.Name = "LW"
LW.Part0 = Torso
LW.C0 = cf(-1.5, 0.5, 0)
LW.C1 = cf(0, 0.5, 0)
LW.Part1 = LeftArm
LW.Parent = Torso
clerp = function(a, b, t)
return a:lerp(b, t)
end
local RbxUtility = LoadLibrary("RbxUtility")
local Create = RbxUtility.Create
RemoveOutlines = function(part)
part.TopSurface = 10
end
CreatePart = function(Parent, Material, Reflectance, Transparency, BColor, Name, Size)
local Part = Create("Part")({Parent = Parent, Reflectance = Reflectance, Transparency = Transparency, CanCollide = false, Locked = true, BrickColor = BrickColor.new(tostring(BColor)), Name = Name, Size = Size, Material = Material})
RemoveOutlines(Part)
return Part
end
CreateMesh = function(Mesh, Part, MeshType, MeshId, OffSet, Scale)
local Msh = Create(Mesh)({Parent = Part, Offset = OffSet, Scale = Scale})
if Mesh == "SpecialMesh" then
Msh.MeshType = MeshType
Msh.MeshId = MeshId
end
return Msh
end
ArtificialHB = Instance.new("BindableEvent", script)
ArtificialHB.Name = "Heartbeat"
script:WaitForChild("Heartbeat")
frame = 0.033333333333333
tf = 0
allowframeloss = false
tossremainder = false
lastframe = tick()
script.Heartbeat:Fire()
game:GetService("RunService").Heartbeat:connect(function(s, p)
tf = tf + s
if frame <= tf then
if allowframeloss then
script.Heartbeat:Fire()
lastframe = tick()
else
for i = 1, math.floor(tf / frame) do
script.Heartbeat:Fire()
end
lastframe = tick()
end
if tossremainder then
tf = 0
else
tf = tf - frame * math.floor(tf / frame)
end
end
end
)
swait = function(num)
if num == 0 or num == nil then
ArtificialHB.Event:wait()
else
for i = 0, num do
ArtificialHB.Event:wait()
end
end
end
CreateWeld = function(Parent, Part0, Part1, C0, C1)
local Weld = Create("Weld")({Parent = Parent, Part0 = Part0, Part1 = Part1, C0 = C0, C1 = C1})
return Weld
end
rayCast = function(Position, Direction, Range, Ignore)
return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
end
CreateSound = 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
local getclosest = function(obj, distance)
local last, lastx = distance + 1, nil
for i,v in pairs(workspace:GetChildren()) do
if v:IsA("Model") and v ~= Character and v:findFirstChild("Humanoid") and v:findFirstChild("Torso") and v:findFirstChild("Humanoid").Health > 0 then
local t = v.Torso
local dist = t.Position - obj.Position.magnitude
if dist <= distance and dist < last then
last = dist
lastx = v
end
end
end
return lastx
end
Damagefunc = function(Part, hit, minim, maxim, knockback, Type, Property, Delay, HitSound, HitPitch)
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 h ~= nil and hit.Parent.Name ~= Character.Name and hit.Parent:FindFirstChild("Torso") ~= nil then
if hit.Parent:findFirstChild("DebounceHit") ~= nil and hit.Parent.DebounceHit.Value == true then
return
end
local c = Create("ObjectValue")({Name = "creator", Value = game:service("Players").LocalPlayer, Parent = h})
game:GetService("Debris"):AddItem(c, 0.5)
if HitSound ~= nil and HitPitch ~= nil then
CreateSound(HitSound, hit, 1, HitPitch)
end
local Damage = math.random(minim, maxim)
local blocked = false
local block = hit.Parent:findFirstChild("Block")
if block ~= nil and block.className == "IntValue" and block.Value > 0 then
blocked = true
block.Value = block.Value - 1
print(block.Value)
end
if blocked == false then
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, Part.BrickColor.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
local bodvol = Create("BodyVelocity")({velocity = angle * knockback, P = 5000, maxForce = Vector3.new(8000, 8000, 8000), Parent = hit})
local rl = Create("BodyAngularVelocity")({P = 3000, maxTorque = Vector3.new(500000, 500000, 500000) * 50000000000000, angularvelocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10)), Parent = hit})
game:GetService("Debris"):AddItem(bodvol, 0.5)
game:GetService("Debris"):AddItem(rl, 0.5)
else
do
if Type == "Debuff" then
print'hi'
else
if Type == "Up" then
local bodyVelocity = Create("BodyVelocity")({velocity = vt(0, 20, 0), P = 5000, maxForce = Vector3.new(8000, 8000, 8000), Parent = hit})
game:GetService("Debris"):AddItem(bodyVelocity, 0.5)
else
do
if Type == "DarkUp" then
coroutine.resume(coroutine.create(function()
for i = 0, 1, 0.1 do
swait()
BlockEffect(BrickColor.new("Black"), hit.Parent.Torso.CFrame, 5, 5, 5, 1, 1, 1, 0.08, 1)
end
end
))
local bodyVelocity = Create("BodyVelocity")({velocity = vt(0, 20, 0), P = 5000, maxForce = Vector3.new(8000, 8000, 8000), Parent = hit})
game:GetService("Debris"):AddItem(bodyVelocity, 1)
else
do
if Type == "Snare" then
local bp = Create("BodyPosition")({P = 2000, D = 100, maxForce = Vector3.new(math.huge, math.huge, math.huge), position = hit.Parent.Torso.Position, Parent = hit.Parent.Torso})
game:GetService("Debris"):AddItem(bp, 1)
else
do
if Type == "Freeze" then
local BodPos = Create("BodyPosition")({P = 50000, D = 1000, maxForce = Vector3.new(math.huge, math.huge, math.huge), position = hit.Parent.Torso.Position, Parent = hit.Parent.Torso})
local BodGy = Create("BodyGyro")({maxTorque = Vector3.new(400000, 400000, 400000) * math.huge, P = 20000, Parent = hit.Parent.Torso, cframe = hit.Parent.Torso.CFrame})
hit.Parent.Torso.Anchored = true
coroutine.resume(coroutine.create(function(Part)
swait(1.5)
Part.Anchored = false
end
), hit.Parent.Torso)
game:GetService("Debris"):AddItem(BodPos, 3)
game:GetService("Debris"):AddItem(BodGy, 3)
end
do
local debounce = Create("BoolValue")({Name = "DebounceHit", Parent = hit.Parent, 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, 0.5)
end
end
end
end
end
end
end
end
end
end
end
end
ShowDamage = function(Pos, Text, Time, Color)
local Rate = 0.033333333333333
if not Pos then
local Pos = Vector3.new(0, 0, 0)
end
local Text = Text or ""
local Time = Time or 2
if not Color then
local Color = Color3.new(1, 0, 1)
end
local EffectPart = CreatePart(workspace, "SmoothPlastic", 0, 1, BrickColor.new(Color), "Effect", vt(0, 0, 0))
EffectPart.Anchored = true
local BillboardGui = Create("BillboardGui")({Size = UDim2.new(3, 0, 3, 0), Adornee = EffectPart, Parent = EffectPart})
local TextLabel = Create("TextLabel")({BackgroundTransparency = 1, Size = UDim2.new(1, 0, 1, 0), Text = Text, TextColor3 = Color, TextScaled = true, Font = Enum.Font.ArialBold, Parent = BillboardGui})
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
MagniDamage = function(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(head, head, mindam, maxdam, knock, Type, RootPart, 0.1, "http://www.roblox.com/asset/?id=231917784", 1)
end
end
end
end
end
BlockEffect = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, Type)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
prt.Anchored = true
prt.CFrame = cframe
local msh = CreateMesh("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
game:GetService("Debris"):AddItem(prt, 10)
if Type == 1 or Type == nil then
table.insert(Effects, {prt, "Block1", delay, x3, y3, z3, msh})
else
if Type == 2 then
table.insert(Effects, {prt, "Block2", delay, x3, y3, z3, msh})
end
end
end
it = Instance.new
local fengui = it("GuiMain")
fengui.Parent = Player.PlayerGui
fengui.Name = "WeaponGUI"
local fenframe = it("Frame")
fenframe.Parent = fengui
fenframe.BackgroundColor3 = Color3.new(255, 255, 255)
fenframe.BackgroundTransparency = 1
fenframe.BorderColor3 = Color3.new(17, 17, 17)
fenframe.Size = UDim2.new(0.0500000007, 0, 0.100000001, 0)
fenframe.Position = UDim2.new(0.4, 0, 0.1, 0)
local fenbarmana1 = it("TextLabel")
fenbarmana1.Parent = fenframe
fenbarmana1.Text = " "
fenbarmana1.BackgroundTransparency = 0
fenbarmana1.BackgroundColor3 = Color3.new(0, 0, 0)
fenbarmana1.SizeConstraint = "RelativeXY"
fenbarmana1.TextXAlignment = "Center"
fenbarmana1.TextYAlignment = "Center"
fenbarmana1.Position = UDim2.new(0, 0, 0, 0)
fenbarmana1.Size = UDim2.new(4, 0, 0.2, 0)
local fenbarmana2 = it("TextLabel")
fenbarmana2.Parent = fenframe
fenbarmana2.Text = " "
fenbarmana2.BackgroundTransparency = 0
fenbarmana2.BackgroundColor3 = Torso.Color
fenbarmana2.SizeConstraint = "RelativeXY"
fenbarmana2.TextXAlignment = "Center"
fenbarmana2.TextYAlignment = "Center"
fenbarmana2.Position = UDim2.new(0, 0, 0, 0)
fenbarmana2.Size = UDim2.new(4 * mana / 100, 0, 0.2, 0)
local fenbarmana3 = it("TextLabel")
fenbarmana3.Parent = fenframe
fenbarmana3.Text = " "
fenbarmana3.BackgroundTransparency = 0
fenbarmana3.BackgroundColor3 = BrickColor.new("Magenta").Color
fenbarmana3.SizeConstraint = "RelativeXY"
fenbarmana3.TextXAlignment = "Center"
fenbarmana3.TextYAlignment = "Center"
fenbarmana3.Position = UDim2.new(0, 0, 0, 0)
fenbarmana3.Size = UDim2.new(0, 0, 0.2, 0)
local fenbarmana4 = it("TextLabel")
fenbarmana4.Parent = fenframe
fenbarmana4.Text = "Energy(" .. mana .. ")"
fenbarmana4.BackgroundTransparency = 1
fenbarmana4.BackgroundColor3 = Color3.new(0, 0, 0)
fenbarmana4.SizeConstraint = "RelativeXY"
fenbarmana4.TextXAlignment = "Center"
fenbarmana4.TextYAlignment = "Center"
fenbarmana4.Position = UDim2.new(0, 0, -0.3, 0)
fenbarmana4.Size = UDim2.new(4, 0, 0.2, 0)
fenbarmana4.FontSize = "Size9"
fenbarmana4.TextStrokeTransparency = 0
fenbarmana4.TextColor = BrickColor.new("White")
local fengui = it("GuiMain")
fengui.Parent = Player.PlayerGui
fengui.Name = "WeaponGUI"
local fenframe1 = it("TextLabel")
fenframe1.Parent = fengui
fenframe1.BackgroundColor3 = Color3.new(0.19607843137255, 0.19607843137255, 0.19607843137255)
fenframe1.BackgroundTransparency = 0.3
fenframe1.BorderSizePixel = 5
fenframe1.BorderColor3 = Color3.new(1, 1, 1)
fenframe1.Size = UDim2.new(0.05, 0, 0.1, 0)
fenframe1.Position = UDim2.new(0.325, 0, 0.7, 0)
fenframe1.Text = "Z"
fenframe1.TextWrapped = true
fenframe1.FontSize = 7
fenframe1.TextColor3 = Color3.new(1, 1, 1)
local fenframe1a = it("TextLabel")
fenframe1a.Parent = fengui
fenframe1a.BackgroundColor3 = Color3.new(0.7843137254902, 0.7843137254902, 0.7843137254902)
fenframe1a.BackgroundTransparency = 0.3
fenframe1a.BorderSizePixel = 5
fenframe1a.BorderColor3 = Color3.new(1, 1, 1)
fenframe1a.Size = UDim2.new(0.05, 0, 0.1, 0)
fenframe1a.Position = UDim2.new(0.325, 0, 0.7, 0)
fenframe1a.Text = ""
local fenframe2 = it("TextLabel")
fenframe2.Parent = fengui
fenframe2.BackgroundColor3 = Color3.new(0.19607843137255, 0.19607843137255, 0.19607843137255)
fenframe2.BackgroundTransparency = 0.3
fenframe2.BorderSizePixel = 5
fenframe2.BorderColor3 = Color3.new(1, 1, 1)
fenframe2.Size = UDim2.new(0.05, 0, 0.1, 0)
fenframe2.Position = UDim2.new(0.425, 0, 0.7, 0)
fenframe2.Text = "X"
fenframe2.TextWrapped = true
fenframe2.FontSize = 7
fenframe2.TextColor3 = Color3.new(1, 1, 1)
local fenframe2a = it("TextLabel")
fenframe2a.Parent = fengui
fenframe2a.BackgroundColor3 = Color3.new(0.7843137254902, 0.7843137254902, 0.7843137254902)
fenframe2a.BackgroundTransparency = 0.3
fenframe2a.BorderSizePixel = 5
fenframe2a.BorderColor3 = Color3.new(1, 1, 1)
fenframe2a.Size = UDim2.new(0.05, 0, 0.1, 0)
fenframe2a.Position = UDim2.new(0.425, 0, 0.7, 0)
fenframe2a.Text = ""
local fenframe3 = it("TextLabel")
fenframe3.Parent = fengui
fenframe3.BackgroundColor3 = Color3.new(0.19607843137255, 0.19607843137255, 0.19607843137255)
fenframe3.BackgroundTransparency = 0.3
fenframe3.BorderSizePixel = 5
fenframe3.BorderColor3 = Color3.new(1, 1, 1)
fenframe3.Size = UDim2.new(0.05, 0, 0.1, 0)
fenframe3.Position = UDim2.new(0.525, 0, 0.7, 0)
fenframe3.Text = "C"
fenframe3.TextWrapped = true
fenframe3.FontSize = 7
fenframe3.TextColor3 = Color3.new(1, 1, 1)
local fenframe3a = it("TextLabel")
fenframe3a.Parent = fengui
fenframe3a.BackgroundColor3 = Color3.new(0.7843137254902, 0.7843137254902, 0.7843137254902)
fenframe3a.BackgroundTransparency = 0.3
fenframe3a.BorderSizePixel = 5
fenframe3a.BorderColor3 = Color3.new(1, 1, 1)
fenframe3a.Size = UDim2.new(0.05, 0, 0.1, 0)
fenframe3a.Position = UDim2.new(0.525, 0, 0.7, 0)
fenframe3a.Text = ""
local fenframe4 = it("TextLabel")
fenframe4.Parent = fengui
fenframe4.BackgroundColor3 = Color3.new(0.19607843137255, 0.19607843137255, 0.19607843137255)
fenframe4.BackgroundTransparency = 0.3
fenframe4.BorderSizePixel = 5
fenframe4.BorderColor3 = Color3.new(1, 1, 1)
fenframe4.Size = UDim2.new(0.05, 0, 0.1, 0)
fenframe4.Position = UDim2.new(0.625, 0, 0.7, 0)
fenframe4.Text = "V"
fenframe4.TextWrapped = true
fenframe4.FontSize = 7
fenframe4.TextColor3 = Color3.new(1, 1, 1)
local fenframe4a = it("TextLabel")
fenframe4a.Parent = fengui
fenframe4a.BackgroundColor3 = Color3.new(0.7843137254902, 0.7843137254902, 0.7843137254902)
fenframe4a.BackgroundTransparency = 0.3
fenframe4a.BorderSizePixel = 5
fenframe4a.BorderColor3 = Color3.new(1, 1, 1)
fenframe4a.Size = UDim2.new(0.05, 0, 0.1, 0)
fenframe4a.Position = UDim2.new(0.625, 0, 0.7, 0)
fenframe4a.Text = ""
fenframe1a.Size = UDim2.new(0, 0, 0.1, 0)
fenframe2a.Size = UDim2.new(0, 0, 0.1, 0)
fenframe3a.Size = UDim2.new(0, 0, 0.1, 0)
fenframe4a.Size = UDim2.new(0, 0, 0.1, 0)
MagicCylinder2 = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", vt(0.2, 0.2, 0.2))
prt.Anchored = true
prt.CFrame = cframe
msh = CreateMesh("CylinderMesh", prt, "", "", vt(0, 0, 0), vt(x1, y1, z1))
game:GetService("Debris"):AddItem(prt, 5)
Effects[#Effects + 1] = {prt, "Cylinder", delay, x3, y3, z3}
end
SphereEffect = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
prt.Anchored = true
prt.CFrame = cframe
local msh = CreateMesh("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
game:GetService("Debris"):AddItem(prt, 10)
table.insert(Effects, {prt, "Cylinder", delay, x3, y3, z3, msh})
end
RingEffect = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", vt(0.5, 0.5, 0.5))
prt.Anchored = true
prt.CFrame = cframe
msh = CreateMesh("SpecialMesh", prt, "FileMesh", "http://www.roblox.com/asset/?id=3270017", vt(0, 0, 0), vt(x1, y1, z1))
game:GetService("Debris"):AddItem(prt, 2)
coroutine.resume(coroutine.create(function(Part, Mesh, num)
for i = 0, 1, delay do
swait()
Part.Transparency = i
Mesh.Scale = Mesh.Scale + vt(x3, y3, z3)
end
Part.Parent = nil
end
), prt, msh, (math.random(0, 1) + math.random()) / 5)
end
SlashEffect = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", vt(0.5, 0.5, 0.5))
prt.Anchored = true
prt.CFrame = cframe
msh = CreateMesh("SpecialMesh", prt, "FileMesh", "http://www.roblox.com/asset/?id=448386996", vt(0, 0, 0), vt(x1, y1, z1))
game:GetService("Debris"):AddItem(prt, 2)
coroutine.resume(coroutine.create(function(Part, Mesh, num)
for i = 0, 1, delay do
swait()
Part.Transparency = i
Mesh.Scale = Mesh.Scale + vt(x3, y3, z3)
end
Part.Parent = nil
end
), prt, msh, (math.random(0, 1) + math.random()) / 5)
end
CylinderEffect = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
prt.Anchored = true
prt.CFrame = cframe
local msh = CreateMesh("CylinderMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
game:GetService("Debris"):AddItem(prt, 10)
table.insert(Effects, {prt, "Cylinder", delay, x3, y3, z3, msh})
end
HeadEffect = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
prt.Anchored = true
prt.CFrame = cframe
local msh = CreateMesh("CylinderMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
game:GetService("Debris"):AddItem(prt, 10)
table.insert(Effects, {prt, "Cylinder", delay, x3, y3, z3, msh})
end
WaveEffect = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
prt.Anchored = true
prt.CFrame = cframe
local msh = CreateMesh("SpecialMesh", prt, "FileMesh", "rbxassetid://20329976", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
game:GetService("Debris"):AddItem(prt, 10)
table.insert(Effects, {prt, "Cylinder", delay, x3, y3, z3, msh})
end
SpecialEffect = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
prt.Anchored = true
prt.CFrame = cframe
local msh = CreateMesh("SpecialMesh", prt, "FileMesh", "rbxassetid://24388358", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
game:GetService("Debris"):AddItem(prt, 10)
table.insert(Effects, {prt, "Cylinder", delay, x3, y3, z3, msh})
end
BreakEffect = function(brickcolor, cframe, x1, y1, z1)
local prt = CreatePart(effect, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new(0.5, 0.5, 0.5))
prt.Anchored = true
prt.CFrame = cframe * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
local msh = CreateMesh("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
local num = math.random(10, 50) / 1000
game:GetService("Debris"):AddItem(prt, 10)
table.insert(Effects, {prt, "Shatter", num, prt.CFrame, math.random() - math.random(), 0, math.random(50, 100) / 100})
end
Handle = CreatePart(m, Enum.Material.SmoothPlastic, 0, 1, "Really black", "FakeHandle", Vector3.new(1.49999952, 0.219999999, 0.25999999))
HandleWeld = CreateWeld(m, Character["Right Arm"], Handle, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.00998926163, -1.0048238, -0.00521278381, -3.05175781e-005, 3.05175781e-005, -1, 3.05175781e-005, -1, -3.05185094e-005, -1, -3.05185094e-005, 3.05166468e-005))
FakeHandle = CreatePart(m, Enum.Material.SmoothPlastic, 0, 1, "Really black", "FakeHandle", Vector3.new(1.49999952, 0.219999999, 0.25999999))
FakeHandleWeld = CreateWeld(m, Handle, FakeHandle, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.200000003, 1.00999999, 0.860000014))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-3.85998917, -0.0150715113, 4.76837158e-005, 1, 0, 0, 0, 1, 0, 0, 0, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Magenta", "Part", Vector3.new(0.200000003, 1.00999999, 0.790000081))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-3.69999313, -0.0150667429, 0.00504493713, 1, 0, 0, 0, 1, 0, 0, 0, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0.5, "Bright violet", "Part", Vector3.new(0.800000012, 0.800000012, 0.800000012))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-5.1099968, -0.020236969, 0.0101566315, 1, 0, 0, 0, 1, 0, 0, 0, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Sphere, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.Plastic, 0, 0, "Really black", "Part", Vector3.new(0.599999905, 0.299999952, 0.399999976))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.0196530819, -1.10002947, 0.00994300842, 3.05195063e-005, -1, 2.14517786e-006, 1, 3.05193462e-005, -7.3674797e-005, 7.36747315e-005, 2.14742613e-006, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.FileMesh, "http://www.roblox.com/asset/?id=3270017", Vector3.new(0, 0, 0), Vector3.new(0.800000012, 0.800000012, 2))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Plum", "Part", Vector3.new(0.200000003, 0.709999979, 0.720000029))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(6.67572021e-005, -1.10500383, -0.0198179483, -6.10337593e-005, -6.10356219e-005, -1, 1, 4.65618655e-010, -6.10337593e-005, 4.1909658e-009, -1, 6.10356219e-005))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.400000036, 1.00999999, 0.699999988))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-3.29998541, -0.0150543451, 3.43322754e-005, 1, 0, 0, 0, 1, 0, 0, 0, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(1.49999952, 0.219999999, 0.25999999))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(1.71999991, 0.319999993, 0.359999985))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(1.86998796, 0.160014272, 0.0100288391, 1, 1.86264515e-009, -6.10351563e-005, -5.58793545e-009, 1, -6.10351563e-005, 6.10351563e-005, 6.10351563e-005, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.200000003, 1.00999999, 0.790000081))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0150831938, -4.23999023, 0.00506019592, 9.31322575e-010, -1, 0, 1, 9.31322575e-010, 0, 0, 0, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.FileMesh, "rbxassetid://448386996", Vector3.new(0, 0, 0), Vector3.new(0.0120000001, 0.0120000001, 0.0120000001))
Part = CreatePart(m, Enum.Material.Plastic, 0, 0, "Black", "Part", Vector3.new(1.19999993, 1.29999995, 0.399999976))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0803631544, 3.18995714, 0.300125122, 3.05195063e-005, -1, 2.14517786e-006, 1, 3.05193462e-005, -7.3674797e-005, 7.36747315e-005, 2.14742613e-006, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.FileMesh, "http://www.roblox.com/asset/?id=3270017", Vector3.new(0, 0, 0), Vector3.new(1.10000002, 1.10000002, 1))
Part = CreatePart(m, Enum.Material.Plastic, 0, 0, "Black", "Part", Vector3.new(1.19999993, 1.29999995, 0.399999976))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0803436041, 3.18998289, -0.299877167, 3.05195063e-005, -1, 2.14517786e-006, 1, 3.05193462e-005, -7.3674797e-005, 7.36747315e-005, 2.14742613e-006, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.FileMesh, "http://www.roblox.com/asset/?id=3270017", Vector3.new(0, 0, 0), Vector3.new(1.10000002, 1.10000002, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.200000003, 1.00999999, 0.790000081))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.00506019592, -4.23999023, 0.0150831938, 0, 0, -1, 1, 9.31322575e-010, 0, 9.31322575e-010, -1, 0))
CreateMesh("SpecialMesh", Part, Enum.MeshType.FileMesh, "rbxassetid://448386996", Vector3.new(0, 0, 0), Vector3.new(0.0120000001, 0.0120000001, 0.0120000001))
Part = CreatePart(m, Enum.Material.Plastic, 0, 0, "Bright violet", "Part", Vector3.new(1.19999993, 1.29999995, 0.399999976))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0803533792, 3.18997002, 0.00012588501, 3.05195063e-005, -1, 2.14517786e-006, 1, 3.05193462e-005, -7.3674797e-005, 7.36747315e-005, 2.14742613e-006, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.FileMesh, "http://www.roblox.com/asset/?id=3270017", Vector3.new(0, 0, 0), Vector3.new(1.10000002, 1.10000002, 1))
Part = CreatePart(m, Enum.Material.Plastic, 0, 0, "Really black", "Part", Vector3.new(1.19999993, 1.29999995, 0.399999976))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0803533792, 3.18997002, 0.00012588501, 3.05195063e-005, -1, 2.14517786e-006, 1, 3.05193462e-005, -7.3674797e-005, 7.36747315e-005, 2.14742613e-006, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.FileMesh, "http://www.roblox.com/asset/?id=3270017", Vector3.new(0, 0, 0), Vector3.new(1, 1, 5))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Black", "Part", Vector3.new(0.609999955, 0.319999993, 0.359999985))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.094997406, -0.959980011, 0.00995254517, 1.264202e-005, 1, 6.31808798e-005, -1, 1.26400919e-005, 3.05188951e-005, 3.05180947e-005, -6.31812654e-005, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(2.49999952, 0.219999999, 0.25999999))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-2.71000099, -6.74724579e-005, 8.20159912e-005, 1, 0, 0, 0, 1, 0, 0, 0, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.319999874, 0.319999993, 0.359999985))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(1.56999588, -0.260039806, 0.0099811554, 1, 1.86264515e-009, -6.10351563e-005, -5.58793545e-009, 1, -6.10351563e-005, 6.10351563e-005, 6.10351563e-005, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.319999874, 0.319999993, 0.359999985))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(1.3599968, -0.260046244, 0.009973526, 1, 1.86264515e-009, -6.10351563e-005, -5.58793545e-009, 1, -6.10351563e-005, 6.10351563e-005, 6.10351563e-005, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Sphere, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.599999905, 0.519999981, 0.560000002))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.0999407768, 0.959987402, -3.81469727e-005, -1.26400264e-005, -1, 2.14649481e-006, 1, -1.26400919e-005, -3.05170342e-005, 3.05170615e-005, 2.14610918e-006, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.319999874, 0.319999993, 0.359999985))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.0300308466, -1.36999273, 0.00995635986, 1.264202e-005, 1, 6.31808798e-005, -1, 1.26400919e-005, 3.05188951e-005, 3.05180947e-005, -6.31812654e-005, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.200000003, 1.00999999, 0.860000014))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-3.53999329, -0.0150617361, 3.81469727e-005, 1, 0, 0, 0, 1, 0, 0, 0, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Bright violet", "Part", Vector3.new(0.819999874, 0.25, 0.359999985))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(2.01999855, -0.260010839, 0.00999450684, 1, 1.86264515e-009, -6.10351563e-005, -5.58793545e-009, 1, -6.10351563e-005, 6.10351563e-005, 6.10351563e-005, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Part = CreatePart(m, Enum.Material.SmoothPlastic, 0, 0, "Really black", "Part", Vector3.new(0.319999874, 0.319999993, 0.359999985))
PartWeld = CreateWeld(m, FakeHandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(2.56999779, -0.260009289, 0.010011673, 1, 1.86264515e-009, -6.10351563e-005, -5.58793545e-009, 1, -6.10351563e-005, 6.10351563e-005, 6.10351563e-005, 1))
CreateMesh("SpecialMesh", Part, Enum.MeshType.Cylinder, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
Tip = CreatePart(m, Enum.Material.Neon, 0, 0.5, "Really black", "Tip", Vector3.new(1, 1, 1))
TipWeld = CreateWeld(m, FakeHandle, Tip, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-5.1099968, -0.020236969, 0.0101566315, 1, 0, 0, 0, 1, 0, 0, 0, 1))
CreateMesh("SpecialMesh", Tip, Enum.MeshType.Sphere, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
IceMortar = function()
local dacf = Tip.CFrame * angles(-1.57 + math.random(40, 80) / 100, 0, math.random(-80, 80) / 100)
local icepart1 = CreatePart(effect, "SmoothPlastic", 0, 1, BrickColor.new("Cyan"), "Ice", vt())
icepart1.Anchored = true
i1msh = CreateMesh("SpecialMesh", icepart1, "Sphere", "", vt(0, 0, 0), vt(5, 5, 5))
icepart1.CFrame = dacf
for i = 0, 1, 0.1 do
swait()
icepart1.CFrame = dacf
end
local cfinc = 99999
icepart1.Transparency = 1
CreateSound("rbxassetid://192410089", icepart1, 1, 1)
game:GetService("Debris"):AddItem(icepart1, 1)
local spread = vt((math.random(-1, 0) + math.random()) * 16, (math.random(-1, 0) + math.random()) * 16, (math.random(-1, 0) + math.random()) * 16) * (icepart1.Position - (icepart1.Position + vt(0, -1, 0))).magnitude / 100
local TheHit = mouse.Hit.p
local MouseLook = cf((icepart1.Position + TheHit) / 2, TheHit + spread)
local hit, pos = rayCast(icepart1.Position, MouseLook.lookVector, 999, Character)
local target1, distance1 = rayCast(icepart1.Position, MouseLook.lookVector, 999, Character)
local test1, dist1 = mouse.Hit.p, nil
if target1 ~= nil then
cfda = target1.Position + vt(math.random(-3000, 3000) / 100, 10, math.random(-3000, 3000) / 100)
local hit2, pos2 = rayCast(icepart1.Position, MouseLook.lookVector, 999, Character)
local d1 = CreatePart(effect, "SmoothPlastic", 0, 0.5, BrickColor.new("Magenta"), "Effect", vt())
d1.Anchored = true
d1.CFrame = cf(pos2)
MagniDamage(d1, 20, 2, 5, -10, "Debuff")
SphereEffect(BrickColor.new("Black"), cf(pos2), 100, 100, 100, 10, 10, 10, 0.07)
msh = CreateMesh("CylinderMesh", d1, "", "", vt(0, 0, 0), vt(200, 5, 200))
d2 = d1:Clone()
d2.Parent = d1
d2.CFrame = cf(d1.Position)
d2.BrickColor = BrickColor.new("Black")
d2.Mesh.Scale = vt(0, 5, 0)
table.insert(Effects, {d1, "SatelliteStrike", d2, d2.Mesh, 0})
end
end
local nr = NumberRange.new
local ns = NumberSequence.new
local cs = ColorSequence.new
local nsk = NumberSequenceKeypoint.new
particle = function(parent, col1, col2, lightemis, size, texture, transparency, zoffset, accel, drag, ltp, velinher, emisdir, enabled, lifetime, rate, rotation, rotspeed, speed, velspread)
local fp = it("ParticleEmitter")
fp.Parent = parent
fp.Color = cs(col1, col2)
fp.LightEmission = lightemis
fp.Size = size
fp.Texture = texture
fp.Transparency = transparency
fp.ZOffset = zoffset
fp.Acceleration = accel
fp.Drag = drag
fp.LockedToPart = ltp
fp.VelocityInheritance = velinher
fp.EmissionDirection = emisdir
fp.Enabled = enabled
fp.Lifetime = lifetime
fp.Rate = rate
fp.Rotation = rotation
fp.RotSpeed = rotspeed
fp.Speed = speed
fp.VelocitySpread = velspread
return fp
end
sizeseq = ns({nsk(0, 4), nsk(0.027, 8.5), nsk(0.184, 9), nsk(1, 10)})
transseq = ns({nsk(0, 0.375), nsk(0.4, 1), nsk(1, 1)})
local icicleparti1 = particle(Torso, Color3.new(1, 1, 1), Color3.new(0.3921568627451, 0.3921568627451, 1), 0.2, sizeseq, "http://www.roblox.com/asset/?id=329766994", transseq, 0, vt(0, -0.5, 0), 0, false, 0, "Bottom", false, nr(7, 10), 15, nr(-360, 360), nr(-30, 30), nr(3), 20)
sizeseq = ns({nsk(0, 5), nsk(0.025, 7.7), nsk(0.192, 9), nsk(1, 10)})
transseq = ns({nsk(0, 0.8), nsk(0.3, 1), nsk(1, 1)})
local icicleparti2 = particle(Torso, Color3.new(1, 1, 1), Color3.new(0.3921568627451, 0.3921568627451, 1), 0.3, sizeseq, "http://www.roblox.com/asset/?id=241594419", transseq, 0, vt(0, -0.5, 0), 0, false, 0, "Bottom", false, nr(7, 10), 80, nr(-360, 360), nr(-30, 30), nr(3), 20)
sizeseq = ns({nsk(0, 0.328), nsk(0.075, 3.11), nsk(0.206, 4.97), nsk(1, 10)})
transseq = ns({nsk(0, 0.363), nsk(0.107, 1), nsk(1, 1)})
DarkMortar = function()
for i = 1, math.random(3, 5) do
local dacf = Tip.CFrame * angles(-1.57 + math.random(40, 80) / 100, 0, math.random(-80, 80) / 100)
local icepart1 = CreatePart(effect, "SmoothPlastic", 0, 1, BrickColor.new("Cyan"), "Ice", vt())
icepart1.Anchored = true
i1msh = CreateMesh("SpecialMesh", icepart1, "Sphere", "", vt(0, 0, 0), vt(5, 5, 5))
icepart1.CFrame = dacf
for i = 0, 1, 0.1 do
swait()
icepart1.CFrame = dacf
end
local cfinc = 99999
icepart1.Transparency = 1
CreateSound("rbxassetid://192410089", icepart1, 1, 1.5)
game:GetService("Debris"):AddItem(icepart1, 1)
local spread = vt((math.random(-5, 5) + math.random()) * 16, (math.random(-5, 5) + math.random()) * 16, (math.random(-5, 5) + math.random()) * 16) * (icepart1.Position - (icepart1.Position + vt(0, -1, 0))).magnitude / 100
local TheHit = mouse.Hit.p
local MouseLook = cf((icepart1.Position + TheHit) / 2, TheHit + spread)
local hit, pos = rayCast(icepart1.Position, MouseLook.lookVector, 999, Character)
local target1, distance1 = rayCast(icepart1.Position, MouseLook.lookVector, 999, Character)
local test1, dist1 = mouse.Hit.p, nil
if target1 ~= nil then
cfda = target1.Position + vt(math.random(-3000, 3000) / 100, 10, math.random(-3000, 3000) / 100)
local hit2, pos2 = rayCast(icepart1.Position, MouseLook.lookVector, 999, Character)
BlockEffect(BrickColor.new("Black"), LeftArm.CFrame * cf(0, -1, 0), 12, 12, 12, 0.5, 0.5, 0.5, 0.05)
SphereEffect(BrickColor.new("Black"), LeftArm.CFrame * cf(0, -1, 0), 12, 12, 12, 0.5, 0.5, 0.5, 0.05)
local d1 = CreatePart(effect, "SmoothPlastic", 0, 0.5, BrickColor.new("Magenta"), "Effect", vt())
d1.Anchored = true
d1.CFrame = cf(pos2)
MagniDamage(d1, 20, 2, 5, -10, "Normal")
SphereEffect(BrickColor.new("Black"), cf(pos2), 10, 10, 10, 10, 10, 10, 0.07)
msh = CreateMesh("CylinderMesh", d1, "", "", vt(0, 0, 0), vt(50, 5, 50))
d2 = d1:Clone()
d2.Parent = d1
d2.CFrame = cf(d1.Position)
d2.BrickColor = BrickColor.new("Black")
d2.Mesh.Scale = vt(0, 5, 0)
table.insert(Effects, {d1, "MiniStrike", d2, d2.Mesh, 0})
end
end
end
Ravage = function()
attack = true
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(0)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-10), math.rad(0), math.rad(0)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(100), math.rad(0), math.rad(0)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-20), math.rad(0), math.rad(-20)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(30), math.rad(0), math.rad(0)), 0.3)
end
IceMortar()
SphereEffect(BrickColor.new("Black"), Tip.CFrame, 10, 10, 10, 5, 5, 5, 0.07)
RingEffect(BrickColor.new("Black"), Tip.CFrame * angles(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)), 10, 10, 2, 0.5, 0.5, 0, 0.07)
RingEffect(BrickColor.new("Black"), Tip.CFrame * angles(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)), 10, 10, 2, 0.5, 0.5, 0, 0.08)
end
attackone = function()
attack = true
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(-70)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(70)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(80), math.rad(0), math.rad(-20)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(-30)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(0), math.rad(50), math.rad(-70)), 0.3)
end
for i = 0, 1, 0.5 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(0)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(90), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(80), math.rad(0), math.rad(-20)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(0), math.rad(50), math.rad(0)), 0.3)
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(70)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(-70)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(80), math.rad(0), math.rad(-20)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(30)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(0), math.rad(50), math.rad(70)), 0.3)
end
CreateSound("rbxassetid://241816017", Tip, 1, 1)
MagniDamage(Tip, 10, 7, 10, 1, "Normal")
SphereEffect(BrickColor.new("Black"), Tip.CFrame, 10, 10, 10, 5, 5, 5, 0.07)
RingEffect(BrickColor.new("Black"), Tip.CFrame * angles(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)), 10, 10, 2, 0.5, 0.5, 0, 0.07)
RingEffect(BrickColor.new("Black"), Tip.CFrame * angles(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)), 10, 10, 2, 0.5, 0.5, 0, 0.08)
attack = false
end
Nightmare = function()
attack = true
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(-70)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(70)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(180), math.rad(0), math.rad(0)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(-70)), 0.3)
end
BlockEffect(BrickColor.new("Black"), LeftArm.CFrame * cf(0, -1, 0), 12, 12, 12, 0.5, 0.5, 0.5, 0.05)
DarkMortar()
end
attacktwo = function()
attack = true
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(-90)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(90)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-90)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(-70)), 0.3)
end
CreateSound("rbxassetid://241816017", Tip, 1, 1.5)
MagniDamage(LeftArm, 3, 7, 12, 1, "Normal")
BlockEffect(BrickColor.new("Black"), LeftArm.CFrame * cf(0, -1, 0), 12, 12, 12, 0.5, 0.5, 0.5, 0.05)
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(-90)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(90)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-130)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(-70)), 0.3)
end
attack = false
end
local grabbing = false
Finale = function()
attack = true
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(90)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(-90)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(0)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(-70)), 0.3)
end
local ef = CreatePart(workspace, "SmoothPlastic", 0, 1, BrickColor.new("Black"), "ef", vt(0.5, 0.5, 0.5))
con1 = LeftArm.Touched:connect(function(hit)
local ht = hit.Parent
coroutine.resume(coroutine.create(function()
while grabbing do
swait()
ef.CFrame = LeftArm.CFrame * cf(0, -0.5, 0) * angles(1.57, 0, 1.57)
end
end
))
local hum1 = ht:FindFirstChild("Humanoid")
if hum1 ~= nil then
grabbing = true
coroutine.resume(coroutine.create(function()
hum1.PlatformStand = true
wait(3)
hum1.PlatformStand = false
end
))
local asd = CreateWeld(ef, ef, ht:FindFirstChild("Torso"), CFrame.new(0, 0, 0), CFrame.new(0, 0, 0))
asd.Parent = ef
asd.Name = "asd"
asd.C0 = asd.C0 * CFrame.Angles(math.rad(0), 0, 0)
else
do
if hum1 == nil then
con1:disconnect()
wait()
return
end
end
end
end
)
if grabbing == false then
for i = 0, 1, 0.05 do
swait()
Torso.Velocity = RootPart.CFrame.lookVector * 30
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(-90)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(90)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(0)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-90)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(0)), 0.3)
end
end
do
if grabbing == true then
for i = 0, 1, 0.05 do
swait()
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(-90)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-20), math.rad(0), math.rad(90)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(0)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(-120)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(0)), 0.3)
BlockEffect(BrickColor.new("Black"), LeftArm.CFrame, 10, 10, 10, -0.5, -0.5, -0.5, 0.07, 1)
end
mana = mana
CreateSound("rbxassetid://188959258", LeftArm, 0.5, 1)
for i = 0, 1 do
BlockEffect(BrickColor.new("Black"), LeftArm.CFrame, 50, 50, 50, -0.5, -0.5, -0.5, 0.07, 1)
end
MagniDamage(LeftArm, 15, 20, 30, 1, "Normal")
coroutine.resume(coroutine.create(function()
for i = 0, 3 do
swait()
WaveEffect(BrickColor.new("Black"), RootPart.CFrame * cf(0, -1, 0) * angles(0, math.random(-50, 50), 0), 1, 1, 1, 1, 1, 1, 0.05)
end
end
))
end
grabbing = false
con1:disconnect()
ef.Parent = nil
attack = false
end
end
attackthree = function()
attack = true
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(-90)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(90)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(0)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(-70)), 0.3)
end
MagniDamage(LeftArm, 5, 10, 10, 1, "Normal")
CreateSound("rbxassetid://241816017", LeftArm, 1, 0.8)
SlashEffect(BrickColor.new("Black"), RootPart.CFrame * cf(0, 1, -5) * angles(math.rad(90), math.rad(-50, 50), 0), 0.001, 0.1, 0.1, 0, 0.001, 0.001, 0.05)
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(0)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(0)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(-90)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(-70)), 0.3)
end
attack = false
end
ShootCannon = function(asd, mindam, maxdam, x, y, z, magn)
CreateSound("rbxassetid://263623156", asd, 0.5, 1)
CreateSound("rbxassetid://263610152", asd, 0.5, 1)
CreateSound("rbxassetid://263623139", asd, 0.5, 1)
local MainPos = asd.Position
local MainPos2 = mouse.Hit.p
local MouseLook = cf((MainPos + MainPos2) / 2, MainPos2)
num = 30
coroutine.resume(coroutine.create(function()
repeat
wait()
local hit, pos = rayCast(MainPos, MouseLook.lookVector, 10, Character)
local mag = (MainPos - pos).magnitude
MagicCylinder2(BrickColor.new("Magenta"), CFrame.new((MainPos + pos) / 2, pos) * angles(1.57, 0, 0), 0.1, mag * 5, 0.1, 0.2, 0, 0.2, 0.03)
MainPos = MainPos + MouseLook.lookVector * 10
num = num - 1
if hit ~= nil then
num = 0
local ref = CreatePart(effect, "SmoothPlastic", 0, 1, BrickColor.new("Magenta"), "Reference", vt())
ref.Anchored = true
ref.CFrame = cf(pos)
game.Debris:AddItem(ref, 3)
MagniDamage(ref, mag, mindam, maxdam, 1, "Normal")
CreateSound("rbxassetid://263610039", ref, 1, 1)
CreateSound("rbxassetid://263610111", ref, 1, 1)
BlockEffect(BrickColor.new("Magenta"), cf(pos), 5, 5, 5, 0.5, 0.5, 0.5, 0.05)
game:GetService("Debris"):AddItem(ref, 1)
MagniDamage(ref, magn, mindam, maxdam, 10, "Normal")
end
until num <= 0
end
))
end
Debuff = function()
attack = true
for i = 0, 1, 0.1 do
swait()
BlockEffect(BrickColor.new("Black"), Tip.CFrame, 10, 10, 10, -0.5, -0.5, -0.5, 0.07, 1)
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(-90)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(90)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(0)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(-70)), 0.3)
end
SphereEffect(BrickColor.new("Black"), Tip.CFrame, 10, 10, 10, 0.5, 0.5, 0.5, 0.07)
ShootCannon(Tip, 10, 15, 5, 5, 5, 2)
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(-90)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos(sine / 9)), math.rad(0), math.rad(90)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(90)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(90), math.rad(0), math.rad(-90)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(80), math.rad(50), math.rad(-70)), 0.3)
end
attack = false
end
ob1u = function()
end
ob1d = function()
if attack == false and attacktype == 1 then
attacktype = 2
attackone()
else
if attack == false and attacktype == 2 then
attacktype = 3
attacktwo()
else
if attack == false and attacktype == 3 then
attacktype = 1
attackthree()
end
end
end
end
key = function(k)
k = k:lower()
if attack == false and k == "z" and mana >= 10 and zenabled == true then
zenabled = false
mana = mana
coroutine.resume(coroutine.create(function()
for i = 1, 0, -0.01 do
swait()
fenframe1a.Size = UDim2.new(0.05 * i, 0, 0.1, 0)
end
zenabled = true
fenframe1a.Size = UDim2.new(0, 0, 0.1, 0)
end
))
Debuff()
else
if attack == false and k == "x" and mana >= 20 and xenabled == true then
mana = mana
xenabled = false
Ravage()
else
if attack == false and k == "c" and mana >= 30 and cenabled == true then
cenabled = false
mana = mana
coroutine.resume(coroutine.create(function()
for i = 1, 0, -0.003 do
swait()
fenframe3a.Size = UDim2.new(0.05 * i, 0, 0.1, 0)
end
cenabled = true
fenframe3a.Size = UDim2.new(0, 0, 0.1, 0)
end
))
Nightmare()
else
if attack == false and k == "v" and mana >= 45 and venabled == true then
venabled = false
coroutine.resume(coroutine.create(function()
for i = 1, 0, -0.005 do
swait()
fenframe4a.Size = UDim2.new(0.05 * i, 0, 0.1, 0)
end
venabled = true
fenframe4a.Size = UDim2.new(0, 0, 0.1, 0)
end
))
Finale()
end
end
end
end
end
Bin = Instance.new("HopperBin", Player.Backpack)
ds = function(mouse)
end
s = function(mouse)
print("Selected")
mouse.Button1Down:connect(function()
ob1d(mouse)
end
)
mouse.Button1Up:connect(function()
ob1u(mouse)
end
)
mouse.KeyDown:connect(key)
end
Bin.Selected:connect(s)
Bin.Deselected:connect(ds)
coroutine.resume(coroutine.create(function()
while 1 do
for i = 0, 1, 0.1 do
swait()
end
BlockEffect(BrickColor.new("Black"), LeftArm.CFrame * cf(0, -1, 0), 2, 2, 2, 0.5, 0.5, 0.5, 0.05)
end
end
))
while 1 do
while 1 do
while 1 do
swait()
Torsovelocity = RootPart.Velocity * Vector3.new(1, 0, 1).magnitude
velocity = RootPart.Velocity.y
sine = sine + change
local hit, pos = 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 1 < RootPart.Velocity.y and hit == 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)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-20), math.rad(0), math.rad(0)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(50)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-20), math.rad(0), math.rad(-10)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(-80), math.rad(50), math.rad(80)), 0.3)
end
else
if RootPart.Velocity.y < -1 and hit == 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)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(20), math.rad(0), math.rad(0)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(80)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-40), math.rad(0), math.rad(-20)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(-80), math.rad(50), math.rad(80)), 0.3)
end
else
if Torsovelocity.x < 1 or Torsovelocity.z < 1 and hit ~= nil then
Anim = "Idle"
if attack == false then
change = 1
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0 - 0.1 * math.cos((sine) / 9)) * angles(math.rad(0), math.rad(0), math.rad(-40)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(-1 + 1 * math.cos((sine) / 9)), math.rad(0), math.rad(40)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(70)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5 - 0.1 * math.cos((sine) / 9), 0) * angles(math.rad(20), math.rad(0), math.rad(-20)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1 + 0.1 * math.cos((sine) / 9), 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1 + 0.1 * math.cos((sine) / 9), 0) * LHCF * angles(math.rad(0), math.rad(30), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(-70), math.rad(50), math.rad(80)), 0.3)
end
else
if 2 < Torsovelocity.x or 2 < Torsovelocity.z and hit ~= nil then
Anim = "Walk"
if attack == false then
RootJoint.C0 = clerp(RootJoint.C0, RootCF * cf(0, 0, 0) * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
Torso.Neck.C0 = clerp(Torso.Neck.C0, NeckCF * angles(math.rad(10), math.rad(0), math.rad(0)), 0.3)
RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(0), math.rad(0), math.rad(70)), 0.3)
LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-20), math.rad(0), math.rad(-20)), 0.3)
RH.C0 = clerp(RH.C0, cf(1, -1, 0) * RHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
LH.C0 = clerp(LH.C0, cf(-1, -1, 0) * LHCF * angles(math.rad(0), math.rad(0), math.rad(0)), 0.3)
FakeHandleWeld.C0 = clerp(FakeHandleWeld.C0, cf(0, 0, 0) * angles(math.rad(-80), math.rad(50), math.rad(80)), 0.3)
end
end
end
end
end
end
if 0 < #Effects then
for e = 1, #Effects do
if Effects[e] ~= nil then
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] == "MiniStrike" then
if Thing[5] < 50 then
Thing[5] = Thing[5] + 1
Thing[4].Scale = vt(Thing[5], 5, Thing[5])
else
refda = CreatePart(effect, "SmoothPlastic", 0, 1, BrickColor.new("Black"), "Reference", vt())
refda.Anchored = true
refda.CFrame = cf(Thing[1].Position)
game:GetService("Debris"):AddItem(refda, 1)
CreateSound("rbxassetid://334325056", refda, 1, 1.5)
CreateSound("rbxassetid://243711369", refda, 0.8, 2)
MagniDamage(refda, 20, 8, 10, 0, "Normal.")
HeadEffect(BrickColor.new("Black"), cf(refda.Position), 20, 99999, 20, -4, 1, -4, 0.1)
BlockEffect(BrickColor.new("Black"), cf(refda.Position), 80, 80, 80, -5, -5, -5, 0.07, 1)
RingEffect(BrickColor.new("Black"), cf(refda.Position) * angles(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)), 3, 3, 0, 3, 3, 0, 0.07)
attack = false
Thing[1].Parent = nil
table.remove(Effects, e)
end
end
if Thing[2] == "SatelliteStrike" then
if Thing[5] < 200 then
Thing[5] = Thing[5] + 2
Thing[4].Scale = vt(Thing[5], 5, Thing[5])
else
refda = CreatePart(effect, "SmoothPlastic", 0, 1, BrickColor.new("Black"), "Reference", vt())
refda.Anchored = true
refda.CFrame = cf(Thing[1].Position)
game:GetService("Debris"):AddItem(refda, 1)
CreateSound("rbxassetid://334325056", refda, 1, 1)
CreateSound("rbxassetid://243711369", refda, 0.8, 1)
MagniDamage(refda, 20, 20, 30, 0, "Debuff")
HeadEffect(BrickColor.new("Black"), cf(refda.Position), 50, 99999, 50, -4, 1, -4, 0.1)
BlockEffect(BrickColor.new("Black"), cf(refda.Position), 120, 120, 120, -5, -5, -5, 0.07, 1)
RingEffect(BrickColor.new("Black"), cf(refda.Position) * angles(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)), 10, 10, 0, 3, 3, 0, 0.07)
coroutine.resume(coroutine.create(function()
for i = 1, 0, -0.0075 do
swait()
fenframe2a.Size = UDim2.new(0.05 * i, 0, 0.1, 0)
end
xenabled = true
fenframe2a.Size = UDim2.new(0, 0, 0.1, 0)
end
))
attack = false
Thing[1].Parent = nil
table.remove(Effects, e)
end
end
if Thing[2] == "Block1" then
Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
Mesh = Thing[1].Mesh
Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
else
if Thing[2] == "Block2" then
Thing[1].CFrame = Thing[1].CFrame
Mesh = Thing[7]
Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
else
if Thing[2] == "Cylinder" then
Mesh = Thing[1].Mesh
Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
else
if Thing[2] == "Blood" then
Mesh = Thing[7]
Thing[1].CFrame = Thing[1].CFrame * Vector3.new(0, 0.5, 0)
Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
else
if Thing[2] == "Elec" then
Mesh = Thing[1].Mesh
Mesh.Scale = Mesh.Scale + Vector3.new(Thing[7], Thing[8], Thing[9])
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
else
if Thing[2] == "Disappear" then
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
else
if Thing[2] == "Shatter" then
Thing[1].Transparency = Thing[1].Transparency + Thing[3]
Thing[4] = Thing[4] * CFrame.new(0, Thing[7], 0)
Thing[1].CFrame = Thing[4] * CFrame.fromEulerAnglesXYZ(Thing[6], 0, 0)
Thing[6] = Thing[6] + Thing[5]
end
end
end
end
end
end
end
else
Part.Parent = nil
table.remove(Effects, e)
end
end
end
end
end
do
fenbarmana2:TweenSize((UDim2.new(4 * mana / 100, 0, 0.2, 0)), nil, 1, 0.4, true)
fenbarmana4.Text = "[Mana] <{[ " .. mana .. " ]}> [Mana]"
if 100 <= mana then
mana = 100
end
end
end
if attack == false then
if mananum <= 8 then
mananum = mananum + 1
end
end
end
mananum = 0
mana = mana + 1
end
|
--***********************************************************
--** ROBERT JOHNSON **
--** Class wich help you to drag an item over the world, it display a ghost render of the item
--** You can either press R or let the left mouse btn down and drag the mouse around to rotate the item **
--***********************************************************
require "ISBaseObject"
---@class ISBuildingObject : ISBaseObject
ISBuildingObject = ISBaseObject:derive("ISBuildingObject");
local function predicateNotBroken(item)
return not item:isBroken()
end
--************************************************************************--
--** ISBuildingObject:initialise
--**
--************************************************************************--
function ISBuildingObject:initialise()
end
--************************************************************************--
--** ISBuildingObject:new
--**
--************************************************************************--
--~ function ISBuildingObject:derive (type)
--~ local o = {}
--~ setmetatable(o, self)
--~ self.__index = self
--~ o.Type= type;
--~ return o
--~ end
function ISBuildingObject:setCanPassThrough(passThrough)
self.canPassThrough = passThrough;
end
function ISBuildingObject:setNorthSprite(sprite)
self.northSprite = sprite;
end
function ISBuildingObject:setEastSprite(sprite)
self.eastSprite = sprite;
end
function ISBuildingObject:setSouthSprite(sprite)
self.southSprite = sprite;
end
function ISBuildingObject:setSprite(sprite)
self.sprite = sprite;
self.choosenSprite = sprite;
end
function ISBuildingObject:setOpenNailsBox(openNailsBox)
self.openNailsBox = openNailsBox;
end
function ISBuildingObject:setDragNilAfterPlace(nilAfter)
self.dragNilAfterPlace = nilAfter;
end
function ISBuildingObject.onDestroy(thump, player)
if thump:getContainer() and thump:getContainer():getItems() then
local items = thump:getContainer():getItems()
for i=0,items:size()-1 do
thump:getSquare():AddWorldInventoryItem(items:get(i), 0.0, 0.0, 0.0)
end
end
if camping.isTentObject(thump) then
camping.destroyTent(thump)
return
end
for index, value in pairs(thump:getModData()) do
if luautils.stringStarts(index, "need:") then
local itemFullType = luautils.split(index, ":")[2];
for i=1,tonumber(value) do
if ZombRand(2) == 0 then
-- item destroyed
elseif player then
player:getInventory():AddItem(itemFullType);
else
thump:getSquare():AddWorldInventoryItem(itemFullType, 0.0, 0.0, 0.0);
end
end
end
end
-- ISBuildingObject.removeFromGround(thump:getSquare());
local stairObjects = buildUtil.getStairObjects(thump)
if #stairObjects > 0 then
for i=1,#stairObjects do
stairObjects[i]:getSquare():transmitRemoveItemFromSquare(stairObjects[i])
end
else
thump:getSquare():transmitRemoveItemFromSquare(thump)
end
end
function ISBuildingObject.removeFromGround(square)
if square then
for i = 0, square:getSpecialObjects():size() - 1 do
local thump = square:getSpecialObjects():get(i);
if instanceof(thump, "IsoThumpable") then
square:transmitRemoveItemFromSquare(thump);
break;
end
end
end
end
local function isMouseOverUI()
local uis = UIManager.getUI()
for i=1,uis:size() do
local ui = uis:get(i-1)
if ui:isMouseOver() then
return true
end
end
return false
end
-- render the item on the ground or launch the build
function DoTileBuilding(draggingItem, isRender, x, y, z, square)
local spriteName = nil;
if not draggingItem.player then print('ERROR: player not set in DoTileBuilding'); draggingItem.player = 0 end;
-- if the square is nil we have to create it (for example, the 2nd floor square are nil)
if square == nil and getWorld():isValidSquare(x, y, z) then
--~ print("create new square : " .. x .. " " .. y);
square = getCell():createNewGridSquare(x, y, z, true);
--~ print("square created : " .. newSq:getX() .. " " .. newSq:getY());
end
--~ print("dragging : " .. x .. " " .. y);
--~ print("square is : " .. square:getX() .. " " .. square:getY());
-- get the sprite we have to display
if draggingItem.player == 0 and wasMouseActiveMoreRecentlyThanJoypad() then
local mouseOverUI = isMouseOverUI();
if Mouse:isLeftDown() then
if not draggingItem.isLeftDown then
draggingItem.clickedUI = mouseOverUI;
draggingItem.isLeftDown = true;
end
if draggingItem.clickedUI then return end
draggingItem:rotateMouse(x, y);
else
if draggingItem.isLeftDown then
draggingItem.isLeftDown = false;
draggingItem.build = draggingItem.canBeBuild and not mouseOverUI and not draggingItem.clickedUI;
draggingItem.clickedUI = false;
end
if mouseOverUI then return end
end
end
spriteName = draggingItem:getSprite();
-- if we have the left mouse button down, we fix the item to the square we clicked
-- so while we have the left button down, we can drag the mouse to change the direction of the item (like in the Sims..)
if (draggingItem.isLeftDown or draggingItem.build) and draggingItem.square then
square = draggingItem.square;
x = square:getX();
y = square:getY();
else -- else, the square is the one our mouse is on
draggingItem.square = square;
end
-- There may be no square if we are at the edge of the map.
if not square then
draggingItem.canBeBuild = false
return
end
-- render our item on the ground, if it can be placed we render it with a bit of red over it
if isRender then
-- we first call the isValid function of our item
draggingItem.canBeBuild = draggingItem:isValid(square, draggingItem.north)
-- we call the render function of our item, because for stairs (for example), we drag only 1 item : the 1st part of the stairs
-- so in the :render function is ISWoodenStair, we gonna display the 2 other part of the stairs, depending on his direction
draggingItem:render(x, y, z, square)
end
-- finally build our item !
if draggingItem.canBeBuild and draggingItem.build then
draggingItem:tryBuild(x, y, z)
end
if draggingItem.build and not draggingItem.dragNilAfterPlace then
draggingItem:reinit();
end
end
function ISBuildingObject:tryBuild(x, y, z)
local square = getCell():getGridSquare(x, y, z)
local playerObj = getSpecificPlayer(self.player)
local playerInv = playerObj:getInventory()
if ISBuildMenu.cheat or self:walkTo(x, y, z) or ((self.Type == "fishingNet") and (self:isValid(square, true))) then
if self.dragNilAfterPlace then
getCell():setDrag(nil, self.player)
end
-- if you give a custom maxTime, if not it's calculated with the carpentry level
local maxTime = (200 - (playerObj:getPerkLevel(Perks.Woodwork) * 5))
if self.maxTime then
maxTime = self.maxTime
end
if playerObj:isTimedActionInstant() then
maxTime = 1
end
if self.skipBuildAction then
-- farmingPlot doesn't need another action
self:create(x, y, z, self.north, self:getSprite())
else
if not self.noNeedHammer and not ISBuildMenu.cheat then
local hammer = playerInv:getFirstTagEvalRecurse("Hammer", predicateNotBroken)
if hammer then
ISInventoryPaneContextMenu.equipWeapon(hammer, true, false, self.player)
end
end
if not ISBuildMenu.cheat then
if self.equipBothHandItem then
if luautils.haveToBeTransfered(playerObj, self.equipBothHandItem) then
ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, self.equipBothHandItem, self.equipBothHandItem:getContainer(), playerInv));
end
ISInventoryPaneContextMenu.equipWeapon(self.equipBothHandItem, true, true, self.player)
end
if self.firstItem then
local item = playerInv:getItemFromType(self.firstItem, true, true)
if self.firstPredicate then
item = playerInv:getFirstTypeEvalArgRecurse(self.firstItem, self.firstPredicate, self.firstArg)
end
ISInventoryPaneContextMenu.equipWeapon(item, true, false, self.player)
end
if self.secondItem then
local item = playerInv:getItemFromType(self.secondItem, true, true)
if instanceof(item, "Clothing") then
if not item:isEquipped() then
ISInventoryPaneContextMenu.wearItem(item, self.player)
end
else
ISInventoryPaneContextMenu.equipWeapon(item, false, false, self.player)
end
end
end
-- Pass a copy of this object to ISBuildAction to avoid issues with changing this object
-- before the action completes, such as rotating it with the 'Rotate Building' key.
local selfCopy = copyTable(self)
setmetatable(selfCopy, getmetatable(self, true))
ISTimedActionQueue.add(ISBuildAction:new(playerObj, selfCopy, x, y, z, self.north, self:getSprite(), maxTime))
end
end
end
-- Override this to change the position the player walks to.
function ISBuildingObject:walkTo(x, y, z)
local square = getCell():getGridSquare(x, y, z)
local playerObj = getSpecificPlayer(self.player)
if self.isWallLike then
return luautils.walkAdjWall(playerObj, square, self.north)
end
return luautils.walkAdj(playerObj, square)
end
-- Called in ISBuildAction:start().
-- Override this to call setOverrideHandModels() and/or player:SetVariable().
function ISBuildingObject:onTimedActionStart(action)
local actionAnim = CharacterActionAnims.Build
if self.actionAnim then
actionAnim = self.actionAnim
elseif self.firstItem == "BlowTorch" then
actionAnim = "BlowTorch"
if self.buildLow then
actionAnim = "BlowTorchFloor"
end
else
if self.buildLow then
actionAnim = CharacterActionAnims.BuildLow
end
end
action:setActionAnim(actionAnim)
if action.character:isPrimaryEquipped("Base.BlowTorch") then
action:setOverrideHandModels(action.character:getPrimaryHandItem(), nil)
end
end
-- Called in ISBuildAction:stop().
function ISBuildingObject:onTimedActionStop(action)
end
function ISBuildingObject:haveMaterial(square)
if ISBuildMenu.cheat then
return true;
end
local groundItems = buildUtil.getMaterialOnGround(square);
local groundItemCounts = buildUtil.getMaterialOnGroundCounts(groundItems)
local groundItemUses = buildUtil.getMaterialOnGroundUses(groundItems)
local dragItem = self
local modData = dragItem.modData;
local playerObj = getSpecificPlayer(dragItem.player)
local playerInv = playerObj:getInventory()
if modData ~= nil then
for index, value in pairs(modData) do
if luautils.stringStarts(index, "need:") then
local itemFullType = luautils.split(index, ":")[2];
local nbOfItem = playerInv:getCountTypeEvalRecurse(itemFullType, buildUtil.predicateMaterial)
-- if the build recipe requires nails, check the player's inventory for boxes of nails, and add them to the count
if itemFullType == "Base.Nails" then
nbOfItem = nbOfItem + playerInv:getCountTypeEvalRecurse("Base.NailsBox", buildUtil.predicateMaterial)*100;
if groundItemCounts["Base.NailsBox"] then
nbOfItem = nbOfItem + playerInv:getCountTypeEvalRecurse("Base.NailsBox", buildUtil.predicateMaterial)*100;
end
end
if groundItemCounts[itemFullType] then
nbOfItem = nbOfItem + groundItemCounts[itemFullType];
end
if nbOfItem < tonumber(value) then
return false;
end
end
if luautils.stringStarts(index, "use:") then
local itemFullType = luautils.split(index, ":")[2];
local nbOfUse = playerInv:getUsesTypeRecurse(itemFullType)
if groundItemUses[itemFullType] then
nbOfUse = nbOfUse + groundItemUses[itemFullType];
end
if nbOfUse < tonumber(value) then
return false;
end
end
end
end
if not self.noNeedHammer and not ISBuildMenu.cheat then
local hammer = playerInv:getFirstTagEvalRecurse("Hammer", predicateNotBroken);
if not hammer then
return false;
end
end
return true;
end
function ISBuildingObject:reinit()
--~ ISBuildingObject.nSprite = 1;
self.isLeftDown = false;
self.clickedUI = false;
self.canBeBuild = false;
self.build = false;
self.square = nil;
--~ ISBuildingObject.north = false;
end
function ISBuildingObject:reset()
-- getCell():setDrag(nil);
self.northSprite = nil;
self.sprite = nil;
self.southSprite = nil;
self.eastSprite = nil;
self.nSprite = 1;
self.isLeftDown = false;
self.clickedUI = false;
self.canBeBuild = false;
self.build = false;
self.square = nil;
self.north = false;
self.south = false;
self.east = false;
self.west = false;
self.choosenSprite = nil;
self.dragNilAfterPlace = false;
self.xJoypad = -1;
self.yJoypad = -1;
self.zJoypad = -1;
self.isWallLike = false;
self.isCorner = false;
end
function ISBuildingObject:init()
self:reset();
self.canBeAlwaysPlaced = false;
self.isContainer = false;
self.canPassThrough = false;
self.canBarricade = false;
self.thumpDmg = 8;
self.isDoor = false;
self.isDoorFrame = false;
self.crossSpeed = 1.0;
self.blockAllTheSquare = false;
self.dismantable = false;
self.canBePlastered = false;
self.hoppable = false;
self.isThumpable = true;
self.modData = {};
end
-- get the sprite depending on the position of the mouse and if the player press "r" or not
function ISBuildingObject:getSprite()
self.north = false;
self.south = false;
self.east = false;
self.west = false;
self.choosenSprite = self.sprite;
if self.nSprite == 1 then
self.west = true;
self.choosenSprite = self.sprite;
elseif self.nSprite == 2 then
self.north = true;
self.choosenSprite = self.northSprite;
elseif self.nSprite == 3 then
if self.eastSprite then
self.choosenSprite = self.eastSprite;
self.east = true;
else
self.west = true;
self.choosenSprite = self.sprite;
end
elseif self.nSprite == 4 then
if self.southSprite then
self.south = true;
self.choosenSprite = self.southSprite;
else
self.north = true;
self.choosenSprite = self.northSprite;
end
end
return self.choosenSprite;
end
function ISBuildingObject:isValid(square)
if self.notExterior and not square:Is(IsoFlagType.exterior) then return false end
if not self:haveMaterial(square) then return false end
if square:isVehicleIntersecting() then return false end
if self.canBeAlwaysPlaced then
-- even if we can place this item everywhere, we can't place 2 same objects on the same tile
for i=0,square:getObjects():size()-1 do
local obj = square:getObjects():get(i);
if self:getSprite() == obj:getTextureName() then
return false
end
end
return true
end
local blockedByCharacters = self.isWallLike ~= true
return buildUtil.canBePlace(self, square) and square:isFreeOrMidair(blockedByCharacters)
end
function ISBuildingObject:render(x, y, z, square)
-- ghost sprite is a blueprint of what we're currently building
if self.ghostSprite then
self.ghostSprite:RenderGhostTile(self.ghostSpriteX, self.ghostSpriteY, self.ghostSpriteZ);
return;
end
-- optionally draw a floor tile to aid placement (stacked wooden crates for example)
if self.renderFloorHelper then
if not self.RENDER_SPRITE_FLOOR then
self.RENDER_SPRITE_FLOOR = IsoSprite.new()
self.RENDER_SPRITE_FLOOR:LoadFramesNoDirPageSimple('carpentry_02_56')
end
self.RENDER_SPRITE_FLOOR:RenderGhostTile(x, y, z)
end
local spriteName = self:getSprite()
if not self.RENDER_SPRITE then
self.RENDER_SPRITE = IsoSprite.new()
end
if self.RENDER_SPRITE_NAME ~= spriteName then
self.RENDER_SPRITE:LoadFramesNoDirPageSimple(spriteName)
self.RENDER_SPRITE_NAME = spriteName
end
local sharedSprite = getSprite(self.RENDER_SPRITE_NAME)
if square and sharedSprite and sharedSprite:getProperties():Is("IsStackable") then
local props = ISMoveableSpriteProps.new(self.RENDER_SPRITE)
local offsetY = props:getTotalTableHeight(square)
local r,g,b,a = 1,1,1,0.6
if not self:isValid(square) then
r,g,b,a = 0.65,0.2,0.2,0.6
end
self.RENDER_SPRITE:RenderGhostTileColor(x, y, z, 0, offsetY * Core.getTileScale(), r, g, b, a)
return
end
-- if the square is free and our item can be build
if self:isValid(square) then
self.RENDER_SPRITE:RenderGhostTile(x, y, z);
else
self.RENDER_SPRITE:RenderGhostTileRed(x, y, z);
end
end
function ISBuildingObject:rotateKey(key)
if key == getCore():getKey("Rotate building") then
self.nSprite = self.nSprite + 1;
if self.nSprite > 4 then
self.nSprite = 1;
end
end
end
local function rotateKey(key)
if getCell() and getCell():getDrag(0) then
getCell():getDrag(0):rotateKey(key)
end
end
-- we gonna rotate our building depending on the position of the mouse
function ISBuildingObject:rotateMouse(x, y)
if self.square then
-- we start to get the direction the mouse is compared to the selected square for the item
local difx = x - self.square:getX();
local dify = y - self.square:getY();
-- west
if difx < 0 and math.abs(difx) > math.abs(dify) then
self.nSprite = 1;
end
-- east
if difx > 0 and math.abs(difx) > math.abs(dify) then
self.nSprite = 3;
end
-- north
if dify < 0 and math.abs(difx) < math.abs(dify) then
self.nSprite = 2;
end
-- south
if dify > 0 and math.abs(difx) < math.abs(dify) then
self.nSprite = 4;
end
end
end
-- Called by Java in IsoCell.setDrag(). Can be overridden to do stuff.
function ISBuildingObject:deactivate()
end
function ISBuildingObject:onJoypadPressButton(joypadIndex, joypadData, button)
local playerObj = getSpecificPlayer(joypadData.player)
if button == Joypad.AButton then
if self.canBeBuild then
self:tryBuild(self.xJoypad, self.yJoypad, self.zJoypad)
end
end
if button == Joypad.BButton then
getCell():setDrag(nil, joypadData.player);
end
if button == Joypad.YButton then
if self.isYButtonResetCursor then
self.xJoypad = self.character:getCurrentSquare():getX()
self.yJoypad = self.character:getCurrentSquare():getY()
end
end
if button == Joypad.RBumper then
self.nSprite = self.nSprite + 1;
if self.nSprite > 4 then
self.nSprite = 1;
end
end
if button == Joypad.LBumper then
self.nSprite = self.nSprite - 1;
if self.nSprite < 1 then
self.nSprite = 4;
end
end
end
function ISBuildingObject:onJoypadDirDown(joypadData)
self.yJoypad = self.yJoypad + 1;
end
function ISBuildingObject:onJoypadDirUp(joypadData)
self.yJoypad = self.yJoypad - 1;
end
function ISBuildingObject:onJoypadDirRight(joypadData)
self.xJoypad = self.xJoypad + 1;
end
function ISBuildingObject:onJoypadDirLeft(joypadData)
self.xJoypad = self.xJoypad - 1;
end
function ISBuildingObject:getAPrompt()
if self.canBeBuild then
return getText("ContextMenu_Build")
end
return nil
end
function ISBuildingObject:getYPrompt()
if self.isYButtonResetCursor then
return getText("IGUI_SetCursorToPlayerLocation")
end
return nil
end
function ISBuildingObject:getLBPrompt()
return getText("IGUI_Controller_RotateLeft")
end
function ISBuildingObject:getRBPrompt()
return getText("IGUI_Controller_RotateRight")
end
function DoTileBuildingJoyPad(draggingItem, isRender, x, y, z)
if draggingItem.xJoypad == -1 then
draggingItem.xJoypad = x;
draggingItem.yJoypad = y;
-- local buts = getButtonPrompts(playerIndex);
-- if buts ~= nil then
-- buts:getBestLBButtonAction(nil);
-- buts:getBestRBButtonAction(nil);
-- end
end
draggingItem.zJoypad = z;
local square = getCell():getGridSquare(draggingItem.xJoypad, draggingItem.yJoypad, draggingItem.zJoypad);
DoTileBuilding(draggingItem, isRender, draggingItem.xJoypad, draggingItem.yJoypad, draggingItem.zJoypad, square);
end
Events.OnDoTileBuilding2.Add(DoTileBuilding);
Events.OnDoTileBuilding3.Add(DoTileBuildingJoyPad);
Events.OnKeyPressed.Add(rotateKey);
Events.OnDestroyIsoThumpable.Add(ISBuildingObject.onDestroy);
|
-- Author: Hua Liang[Stupid ET] <et@everet.org>
local TileMap2Scene = class("TileMap2Scene", function()
local scene = cc.TestMapScene:create()
return scene
end)
return TileMap2Scene
|
local protocol = require "miio.protocol"
local util = require "util"
local xpcall = xpcall
local traceback = debug.traceback
local assert = assert
local type = type
local tunpack = table.unpack
local tinsert = table.insert
local M = {}
---@class MiotIID: table MIOT instance ID.
---
---@field siid integer Service instance ID.
---@field piid integer Property instance ID.
---@class MiioDeviceNetIf:table Device network interface.
---
---@field gw string gateway IP.
---@field localIp string local IP.
---@field mask string mask of the network.
---@class MiioDeviceInfo:table Device information.
---
---@field model string Model, format: "{mfg}.{product}.{submodel}".
---@field mac string MAC address.
---@field fw_ver string Firmware version.
---@field hw_ver string Hardware version.
---@field netif MiioDeviceNetIf Network interface.
---@class MiioDevice:MiioDevicePriv Device object.
local device = setmetatable({}, {
__index = function (_, k)
return function (self, ...)
return self.pcb:request(self.timeout, k, ...)
end
end
})
---Get properties.
---@param obj MiioDevice
local function getProps(obj)
local names = obj.names
obj.names = {}
local success, result = xpcall(obj.get_prop, traceback, obj, tunpack(names))
if success == false then
obj.mq:send(success, result)
return
end
local props = {}
for i, value in ipairs(result) do
props[names[i]] = value
end
obj.mq:send(success, props)
end
---Get properties(MIOT).
---@param obj MiioDevice
local function getPropsMiot(obj)
local mapping = obj.mapping
local params = {}
for _, name in ipairs(obj.names) do
tinsert(params, {
did = name,
siid = mapping[name].siid,
piid = mapping[name].piid,
})
end
obj.names = {}
local success, result = xpcall(obj.get_properties, traceback, obj, tunpack(params))
if success == false then
obj.mq:send(success, result)
return
end
local props = {}
for _, prop in ipairs(result) do
props[prop.did] = prop.value
end
obj.mq:send(success, props)
end
---Set MIOT property mapping.
---@param mapping table<string, MiotIID> Property name -> MIOT instance ID mapping.
function device:setMapping(mapping)
self.mapping = mapping
self.timer = core.createTimer(getPropsMiot, self)
end
---Get property.
---@param name string Property name.
---@return string|number|boolean value Property value.
---@nodiscard
function device:getProp(name)
assert(type(name) == "string")
local names = self.names
if #names == 0 then
self.timer:start(0)
else
for _, _name in ipairs(names) do
if name == _name then
goto recv
end
end
end
tinsert(names, name)
::recv::
local success, result = self.mq:recv()
if success == false then
self.logger:error(result)
error("failed to get property")
end
if result[name] == nil then
goto recv
end
return result[name]
end
---Set property.
---@param name string Property name.
---@param value string|number|boolean Property value.
function device:setProp(name, value)
assert(type(name) == "string")
if self.mapping then
assert(self:set_properties({
did = name,
siid = self.mapping[name].siid,
piid = self.mapping[name].piid,
value = value
})[1].code == 0)
else
assert(self["set_" .. name](self, value)[1] == "ok")
end
end
---Get device information.
---@return MiioDeviceInfo info
---@nodiscard
function device:getInfo()
return self["miIO.info"](self)
end
---Create a device object.
---@param addr string Device address.
---@param token string Device token.
---@return MiioDevice obj Device object.
---@nodiscard
function M.create(addr, token)
assert(type(addr) == "string")
assert(type(token) == "string")
assert(#token == 32)
---@class MiioDevicePriv
local o = {
logger = log.getLogger("miio.device:" .. addr),
pcb = protocol.create(addr, util.hex2bin(token)),
mapping = false,
addr = addr,
timeout = 5000,
mq = core.createMQ(1),
names = {}, ---@type string[]
}
o.timer = core.createTimer(getProps, o)
setmetatable(o, {
__index = device
})
return o
end
return M
|
local util = require("scripts.util")
return function(recipe_book, dictionaries)
for name, prototype in pairs(global.prototypes.recipe_category) do
recipe_book.recipe_category[name] = {
class = "recipe_category",
enabled_at_start = true,
fluids = util.unique_obj_array{},
items = util.unique_obj_array{},
prototype_name = name,
recipes = util.unique_obj_array{},
}
dictionaries.recipe_category:add(name, prototype.localised_name)
dictionaries.recipe_category_description:add(name, prototype.localised_description)
end
end
|
--[[
Name: "sh_auto.lua".
Product: "titan".
--]]
titan = {
nextCheckCreated = 0,
onCreatedQueue = {},
ignoredKeys = {},
quickTimers = {},
entityMeta = FindMetaTable("Entity"),
varClasses = {},
longTimers = {},
slowTimers = {},
netVars = {}
};
if (SERVER) then
include("sv_enums.lua");
include("sv_auto.lua");
else
include("cl_auto.lua");
end;
g_Player = player;
g_Timer = timer;
g_Hook = hook;
g_Team = team;
g_File = file;
if (!titan.originalSetGlobalVar) then
titan.originalSetGlobalVar = _G["SetGlobalVar"];
end;
if (!titan.originalSetNWVar) then
titan.originalSetNWVar = titan.entityMeta["SetNetworkedVar"];
end;
titan.entityMeta["SetNetworkedVarProxy"] = function(entity, key, callback)
if (!entity.fn_Proxies) then
entity.fn_Proxies = {};
end;
entity.fn_Proxies[key] = callback;
end;
titan.entityMeta["SetNetworkedVar"] = function(entity, key, value)
if ( titan:IsKeyIgnored(key) ) then
return titan.originalSetNWVar(entity, key, value);
else
local class = titan:GetVarClass( type(value) );
if (class) then
entity["SetNetworked"..class.varType](entity, key, value);
end;
end;
end;
titan.entityMeta["GetNetworkedVar"] = function(entity, key)
local entIndex = entity:EntIndex();
if ( titan.netVars[entIndex] ) then
return titan.netVars[entIndex][key];
end;
end;
_G["SetGlobalVar"] = function(key, value)
if ( titan:IsKeyIgnored(key) ) then
return titan.originalSetGlobalVar(key, value);
else
local class = titan:GetVarClass( type(value) );
if (class) then
entity["SetGlobal"..class.varType](key, value);
end;
end;
end;
_G["GetGlobalVar"] = function(key)
local entIndex = GetWorldEntity():EntIndex();
if ( titan.netVars[entIndex] ) then
return titan.netVars[entIndex][key];
end;
end;
-- A function to get a variable class table.
function titan:GetVarClass(value, forceType)
local realType = forceType or type(value);
if ( realType == "number" and string.find(tostring(value), "%.") ) then
return self:GetVarClass(value, "float");
else
local varClasses = self:GetVarClasses();
if ( varClasses[realType] ) then
return varClasses[realType];
end;
end;
end;
-- A function to get the variable classes.
function titan:GetVarClasses()
return self.varClasses;
end;
-- A function to add an ignored key.
function titan:AddIgnoredKey(key)
self.ignoredKeys[key] = true;
end;
titan:AddIgnoredKey("SprintSpeed");
titan:AddIgnoredKey("ServerName");
titan:AddIgnoredKey("WalkSpeed");
titan:AddIgnoredKey("JumpPower");
-- A function to get whether an entity is valid.
function titan:IsValidEntity(entity)
return IsValid(entity) or entity == GetWorldEntity();
end;
-- A function to get whether a key is ignored.
function titan:IsKeyIgnored(key)
return self.ignoredKeys[key];
end;
-- A function to register a class.
function titan:RegisterClass(varType, realType, masterDefault)
local originalSet = self.entityMeta["SetNW"..varType];
local originalGet = self.entityMeta["GetNW"..varType];
local entIndex;
if (type(realType) != "table") then
realType = {realType};
end;
for k, v in ipairs(realType) do
self.varClasses[v] = {
default = masterDefault,
varType = varType
};
end;
self.entityMeta["SetNW"..varType] = function(entity, key, value)
local entIndex = entity:EntIndex();
if ( self:IsKeyIgnored(key) ) then
return originalSet(entity, key, value);
end;
if ( !entity.fn_IsReady or !self.netVars[entIndex] ) then
self.netVars[entIndex] = {};
entity.fn_IsReady = true;
end;
if (value == nil) then
value = masterDefault;
end;
if (self.netVars[entIndex][key] != value) then
self.netVars[entIndex][key] = value;
if (SERVER) then
self:UpdateVar(entity, key, value);
end;
end;
end;
self.entityMeta["GetNW"..varType] = function(entity, key, default)
local entIndex = entity:EntIndex();
if ( self:IsKeyIgnored(key) ) then
return originalGet(entity, key, default);
end
if (self.netVars[entIndex] and self.netVars[entIndex][key] != nil) then
return self.netVars[entIndex][key];
else
return masterDefault;
end;
end;
self.entityMeta["SetNetworked"..varType] = self.entityMeta["SetNW"..varType];
self.entityMeta["GetNetworked"..varType] = self.entityMeta["GetNW"..varType];
_G["SetGlobal"..varType] = function(key, value)
local worldEntity = GetWorldEntity();
if (worldEntity) then
worldEntity["SetNetworked"..varType](worldEntity, key, value);
end;
end
_G["GetGlobal"..varType] = function(key, default)
local worldEntity = GetWorldEntity();
if (worldEntity) then
return worldEntity["GetNetworked"..varType](worldEntity, key, default);
end;
end;
end;
hook.Add("EntityRemoved", "titan.EntityRemoved", function(entity)
local entIndex = entity:EntIndex();
if (CLIENT) then
if (entity == g_LocalPlayer) then
titan.nextFullUpdate = nil;
titan.timedOut = true;
end;
else
for k, v in ipairs( g_Player.GetAll() ) do
if (v.fn_Initialized) then
v.fn_Vars[entIndex] = nil;
end;
end;
titan.netVars[entIndex] = nil;
end;
end);
titan:RegisterClass("Entity", {"NPC", "Entity", "Player", "Vehicle", "Weapon"}, NULL);
titan:RegisterClass( "Vector", "Vector", Vector(0, 0, 0) );
titan:RegisterClass("Number", "number", 0);
titan:RegisterClass("String", "string", "")
titan:RegisterClass( "Angle", "Angle", Angle(0, 0, 0) );
titan:RegisterClass("Float", "float", 0.0);
titan:RegisterClass("Bool", "boolean", false);
titan:RegisterClass("Int", "number", 0);
|
return {
summary = 'Set the components of the quaternion.',
description = [[
Sets the components of the quaternion. There are lots of different ways to specify the new
components, the summary is:
- Four numbers can be used to specify an angle/axis rotation, similar to other LÖVR functions.
- Four numbers plus the fifth `raw` flag can be used to set the raw values of the quaternion.
- An existing quaternion can be passed in to copy its values.
- A single direction vector can be specified to turn its direction (relative to the default
forward direction of "negative z") into a rotation.
- Two direction vectors can be specified to set the quaternion equal to the rotation between the
two vectors.
- A matrix can be passed in to extract the rotation of the matrix into a quaternion.
]],
arguments = {
angle = {
default = '0',
description = 'The angle to use for the rotation, in radians.'
},
ax = {
type = 'number',
default = '0',
description = 'The x component of the axis of rotation.'
},
ay = {
type = 'number',
default = '0',
description = 'The y component of the axis of rotation.'
},
az = {
type = 'number',
default = '0',
description = 'The z component of the axis of rotation.'
},
raw = {
type = 'boolean',
default = 'false',
description = 'Whether the components should be interpreted as raw `(x, y, z, w)` components.'
},
v = {
type = 'vec3',
description = 'A normalized direction vector.'
},
u = {
type = 'vec3',
description = 'Another normalized direction vector.'
},
r = {
type = 'quat',
description = 'An existing quaternion to copy the values from.'
},
m = {
type = 'mat4',
description = 'A matrix to use the rotation from.'
}
},
returns = {
q = {
type = 'quat',
description = 'The original quaternion.'
}
},
variants = {
{
arguments = { 'angle', 'ax', 'ay', 'az', 'raw' },
returns = { 'q' }
},
{
arguments = { 'r' },
returns = { 'q' }
},
{
description = 'Sets the values from a direction vector.',
arguments = { 'v' },
returns = { 'q' }
},
{
description = 'Sets the values to represent the rotation between two vectors.',
arguments = { 'v', 'u' },
returns = { 'q' }
},
{
arguments = { 'm' },
returns = { 'q' }
},
{
description = 'Reset the quaternion to the identity (0, 0, 0, 1).',
arguments = {},
returns = { 'q' }
}
},
related = {
'Quat:unpack'
}
}
|
love.filesystem.setRequirePath("?.lua;lua_modules/share/lua/5.3/?.lua;lua_modules/share/lua/5.3/?/?.lua;?/init.lua")
State = require "hump.gamestate"
GAMESTATE = nil
local virus = {}
local mainMenu = require "menu"
local optionsMenu = require "menu"
function love.load()
State.registerEvents()
State.switch(mainMenu)
end
function StartGame()
print("Starting game...")
State.switch(virus)
end
function virus:enter()
GAMESTATE = "virus"
end
function virus:update(dt)
print("update" .. dt)
end
function virus:draw()
end
|
cc = cc or {}
---EaseQuadraticActionOut object
---@class EaseQuadraticActionOut : ActionEase
local EaseQuadraticActionOut = {}
cc.EaseQuadraticActionOut = EaseQuadraticActionOut
--------------------------------
--
---@param action ActionInterval
---@return EaseQuadraticActionOut
function EaseQuadraticActionOut:create(action) end
--------------------------------
--
---@return EaseQuadraticActionOut
function EaseQuadraticActionOut:clone() end
--------------------------------
--
---@param time float
---@return EaseQuadraticActionOut
function EaseQuadraticActionOut:update(time) end
--------------------------------
--
---@return ActionEase
function EaseQuadraticActionOut:reverse() end
--------------------------------
--
---@return EaseQuadraticActionOut
function EaseQuadraticActionOut:EaseQuadraticActionOut() end
return EaseQuadraticActionOut
|
local hp = {
max_width = 50,
}
function hp:init (actor, max_hp, props)
self.actor = actor
self.value = max_hp
self.max = max_hp
props = props or {}
if props.ui then
local element = {}
element.column = self.actor.side
element.align = 1
element.size = point(self.max_width + 5, 20)
function element.draw (_, pos)
love.graphics.setColor(0,0,0)
love.graphics.rectangle('fill', pos.x, pos.y, element.size:unpack())
love.graphics.setColor(1,1,1)
local hpstr = tostring(math.floor(self.value))
love.graphics.printf(hpstr, pos.x, pos.y, self.max_width, 'center')
end
self.actor:add_ui_element(element)
end
if not props.hidden then
self.draw = function ()
local pos = self.actor:screen_pos()
local panel_height = self.actor.battle.panel_size.y
pos = pos - point(self.max_width/2, panel_height/2)
local hpstr = tostring(math.floor(self.value))
love.graphics.printf(hpstr, pos.x, pos.y, self.max_width, 'center')
end
end
end
function hp:set (value)
self.value = math.max(math.min(value, self.max), 0)
end
function hp:adjust (value)
self:set(self.value + value)
end
function hp:get ()
return self.value
end
function hp:is_zero ()
return self.value == 0
end
return hp
|
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0188-get-interior-data-resumption.md
--
-- Description: SDL does not send OnHashChange notification to mobile app in case HMI responds with successful response
-- but without isSubscribed parameter
--
-- Precondition:
-- 1. HMI and SDL are started
-- 2. Mobile app with REMOTE_CONTROL hmi type is registered and activated
-- 3. App is not subscribed to module_1
--
-- Sequence:
-- 1. GetInteriorVehicleData(module_1, subscribe = true) is requested
-- SDL does:
-- - a. send RC.GetInteriorVehicleData(module_1, subscribe = true) request to HMI
-- 2. HMI sends RC.GetInteriorVehicleData(SUCCESS, without isSubscribed)
-- SDL does:
-- - a. process successful responses from HMI
-- - b. not send OnHashChange notification to mobile app
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/Resumption/InteriorVehicleData/commonResumptionsInteriorVD')
--[[ Local Variables ]]
local isSubscribedReq = true
local isSubscribedRes = nil
--[[ Scenario ]]
common.Title("Preconditions")
common.Step("Clean environment", common.preconditions)
common.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.Step("App registration", common.registerAppWOPTU)
common.Step("App activation", common.activateApp)
common.Title("Test")
for _, moduleName in pairs(common.modules)do
common.Step("Absence OnHashChange after GetInteriorVD without subscribe to " .. moduleName,
common.getIVDCustomSubscribe, { moduleName, isSubscribedReq, isSubscribedRes })
end
common.Title("Postconditions")
common.Step("Stop SDL", common.postconditions)
|
-----------------------------------------
-- ID: 4937
-- Scroll of Doton: Ichi
-- Teaches the ninjutsu Doton: Ichi
-----------------------------------------
function onItemCheck(target)
return target:canLearnSpell(329)
end
function onItemUse(target)
target:addSpell(329)
end
|
--[[UDF which performs arithmetic operation on bin containing
integer value.
--]]
function bin_udf_operation_integer(record, bin_name, x, y)
record[bin_name] = (record[bin_name] + x) + y
if aerospike:exists(record) then
aerospike:update(record)
else
aerospike:create(record)
end
return record[bin_name]
end
--[[UDF which performs concatenation operation on bin containing
string.
--]]
function bin_udf_operation_string(record, bin_name, str)
if (type(record[bin_name]) == "string" or type(record[bin_name]) == "number") and
(type(str) == "string" or type(str) == "number") then
record[bin_name] = record[bin_name] .. str
end
if aerospike:exists(record) then
aerospike:update(record)
else
aerospike:create(record)
end
return record[bin_name]
end
function bin_udf_operation_bool(record , bin_name)
return record[bin_name]
end
--[[UDF which modifies element of list.--]]
function list_iterate(record, bin, index_of_ele)
local get_list = record[bin]
list.append(get_list, 58)
get_list[index_of_ele] = 222;
record[bin] = get_list;
if aerospike:exists(record) then
aerospike:update(record)
else
aerospike:create(record)
end
end
--[[UDF which modifies list and returns a list.--]]
function list_iterate_returns_list(record, bin, index_of_ele)
local get_list = record[bin]
list.append(get_list, 58)
get_list[index_of_ele] = 222;
record[bin] = get_list;
if aerospike:exists(record) then
aerospike:update(record)
else
aerospike:create(record)
end
return record[bin]
end
--[[UDF which sets value of each key in the map by
set_value which is given by user.--]]
function map_iterate(record, bin, set_value)
local put_map = record[bin]
for key,value in map.pairs(put_map) do
put_map[key] = set_value;
end
record[bin] = put_map;
if aerospike:exists(record) then
aerospike:update(record)
else
aerospike:create(record)
end
end
--[[UDF which sets value of each key in the map by
set_value which is given by user, And returns map--]]
function map_iterate_returns_map(record, bin, set_value)
local put_map = record[bin]
for key,value in map.pairs(put_map) do
put_map[key] = set_value;
end
record[bin] = put_map;
if aerospike:exists(record) then
aerospike:update(record)
else
aerospike:create(record)
end
return record[bin]
end
--[[UDF which returns a whole record--]]
function udf_returns_record(rec)
local mapped = map()
for i, bin_name in ipairs(record.bin_names(rec)) do
mapped[bin_name] = rec[bin_name];
end
return mapped
end
--[[UDF which accepts nothing and returns nothing--]]
function udf_without_arg_and_return(record)
end
--[[UDF which will put bytes array in DB.--]]
function udf_put_bytes(record, bin)
local put_bytes = bytes(18)
put_bytes[1] = 10
put_bytes[2] = 85
record[bin] = put_bytes
if aerospike:exists(record) then
aerospike:update(record)
else
aerospike:create(record)
end
end
|
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule('DataTexts')
--[[This file is a blank datatext example template, this file will not be loaded.]]
local function Update(self, t)
end
local function OnEvent(self, event, ...)
end
local function Click()
end
local function OnEnter(self)
DT:SetupTooltip(self)
DT.tooltip:Show()
end
--[[
DT:RegisterDatatext(name, events, eventFunc, updateFunc, clickFunc, onEnterFunc, onLeaveFunc, localizedName)
name - name of the datatext (required)
events - must be a table with string values of event names to register
eventFunc - function that gets fired when an event gets triggered
updateFunc - onUpdate script target function
click - function to fire when clicking the datatext
onEnterFunc - function to fire OnEnter
onLeaveFunc - function to fire OnLeave, if not provided one will be set for you that hides the tooltip.
localizedName - localized name of the datetext
]]
DT:RegisterDatatext('DTName', {'PLAYER_ENTERING_WORLD'}, OnEvent, Update, Click, OnEnter)
|
dofile("GameUtil.lua");
dofile("GameWorld.lua");
GameAgentFactory=dofile("GameAgent.lua");
--train to obtain Saved.lua file;
local dummy=GameAgentFactory.create("dummy agent");
initializeAgent(dummy);
trainAgent(dummy);
--test accuracy of the training
local records=dofile("data.lua");
for recordIndex = 1, (# records) do
local agent=GameAgentFactory.create(records[recordIndex]:getAgentId() .. "X");
initializeAgent(agent);
processAgent(agent);
print("recorded: " .. records[recordIndex]:getCurrentAction());
print("predict: " .. agent:getCurrentAction());
end
|
-- prevent luarocks-installed fennel from overriding
package.loaded.fennel = dofile("fennel.lua")
table.insert(package.loaders or package.searchers, package.loaded.fennel.searcher)
package.loaded.fennelview = package.loaded.fennel.dofile("fennelview.fnl")
local lu, outputType = require('luaunit'), os.getenv('FNL_TEST_OUTPUT') or 'tap'
local runner = lu.LuaUnit:new()
runner:setOutputType(outputType)
-- attach test modules (which export k/v tables of test fns) as alists
local function addModule(instances, moduleName)
for k, v in pairs(require(moduleName)) do
instances[#instances + 1] = {k, v}
end
end
local function testAll(testModules)
local instances = {}
for _, module in ipairs(testModules) do
addModule(instances, module)
end
return runner:runSuiteByInstances(instances)
end
testAll({
-- these tests need to be in Lua; if anything here breaks
-- we can't even load our tests that are written in Fennel.
'test.core',
'test.mangling',
'test.quoting',
'test.misc',
-- these can be in fennel
'test.docstring',
'test.fennelview',
'test.failures',
'test.repl',
'test.cli',
})
os.exit(runner.result.notSuccessCount == 0 and 0 or 1)
|
{$lua}
-- Prevent execution of Lua in aasm scripts during syntax check
if syntaxcheck then
return
end
local asm = require "modules/asm"
local SCRIPTNAME = "freeze_position"
local FILE = "asm/position/freeze_position.asm"
setGlobalDelayBetweenHotkeyActivation(500) -- 500 ms
[ENABLE]
local enableInfo = {
scriptName = SCRIPTNAME,
asmPath = FILE,
enable = true,
}
asm.execute(enableInfo)
[DISABLE]
local disableInfo = {
scriptName = SCRIPTNAME,
asmPath = FILE,
enable = false,
}
asm.execute(disableInfo)
|
return {
tag = 'graphicsState',
summary = 'Get whether alpha sampling is enabled.',
description = [[
Returns whether or not alpha sampling is enabled. Alpha sampling is also known as
alpha-to-coverage. When it is enabled, the alpha channel of a pixel is factored into how
antialiasing is computed, so the edges of a transparent texture will be correctly antialiased.
]],
arguments = {},
returns = {
{
name = 'enabled',
type = 'boolean',
description = 'Whether or not alpha sampling is enabled.'
}
},
notes = [[
- Alpha sampling is disabled by default.
- This feature can be used for a simple transparency effect, pixels with an alpha of zero will
have their depth value discarded, allowing things behind them to show through (normally you
have to sort objects or write a shader for this).
]]
}
|
local node = require('lib4/node')
local node2d = require('lib4/node/node2d')
local phys2d = require('lib4/node/phys2d')
local rect = require('lib4/node/node2d/rect')
local cpml = require('cpml')
local player = {}
function player:_load()
self.speed = 220
self.shooting = 0
end
local bullet = function(pos, vx, vy)
local r
if vx ~= 0 then
r = rect.new({0, 0, 12, 4}, {127, 0, 255})
else
r = rect.new({0, 0, 4, 12}, {127, 0, 255})
end
local b = phys2d.new(r)
b.position.x = pos.x
b.position.y = pos.y
b.velocity.x = vx
b.velocity.y = vy
return b
end
function player:_phys_update(dt)
if self.shooting > 0 then
self.shooting = self.shooting - dt
end
local vx, vy = 0, 0
local sx, sy = 0, 0
if love.keyboard.isScancodeDown('h') then
vx = vx - self.speed
end
if love.keyboard.isScancodeDown('l') then
vx = vx + self.speed
end
if love.keyboard.isScancodeDown('k') then
vy = vy - self.speed
end
if love.keyboard.isScancodeDown('j') then
vy = vy + self.speed
end
if love.keyboard.isScancodeDown('a') then
sx = -self.speed*10
elseif love.keyboard.isScancodeDown('f') then
sx = self.speed*10
elseif love.keyboard.isScancodeDown('d') then
sy = -self.speed*10
elseif love.keyboard.isScancodeDown('s') then
sy = self.speed*10
end
if (sx ~= 0 or sy ~= 0) and self.shooting <= 0 then
lib4.root.children.camera:add(bullet(self.position, sx, sy))
self.shooting = 1
end
if vx == 0 and vy == 0 then
self.deceleration = self.velocity:normalize() * self.speed
end
self.acceleration = cpml.vec2(vx, vy)
self.velocity.x = util.clamp(self.velocity.x, -self.speed, self.speed)
self.velocity.y = util.clamp(self.velocity.y, -self.speed, self.speed)
end
return player
|
function o(self) print("o", #self) end
function x() print("x") return {z=o} end
x():z(x)
|
local PANEL = {};
local wantedX, wantedY = 5, 5
function PANEL:Init ( )
self.ourItemSlots = {};
for x = 1, wantedX do
self.ourItemSlots[x] = {};
for y = 1, wantedY do
self.ourItemSlots[x][y] = vgui.Create("perp2_shop_store_block", self);
end
end
self.Description = true;
self:SetSkin("ugperp")
end
function PANEL:PerformLayout ( )
local buffer = 5;
local xPer = (self:GetWide() - (buffer * (wantedX + 1))) / wantedX
local yPer = (self:GetTall() - (buffer * (wantedY + 1))) / wantedY
for x = 1, wantedX do
for y = 1, wantedY do
self.ourItemSlots[x][y]:SetSize(xPer, yPer);
self.ourItemSlots[x][y]:SetPos(buffer * x + xPer * (x - 1), buffer * y + yPer * (y - 1));
end
end
end
function PANEL:Paint ( )
SKIN:PaintFrame(self, true);
end
function PANEL:PushItem ( itemTable )
for y = 1, wantedY do
for x = 1, wantedX do
if (!self.ourItemSlots[x][y].itemTable) then
self.ourItemSlots[x][y]:GrabItem(itemTable);
return;
end
end
end
end
function PANEL:SetDescription ( itemTable )
self:GetParent():SetDescription(itemTable);
end
vgui.Register("perp2_shop_store", PANEL);
|
local SpatialAveragePooling, parent = torch.class('nn.SpatialAveragePooling', 'nn.Module')
function SpatialAveragePooling:__init(kW, kH, dW, dH, padW, padH)
parent.__init(self)
self.kW = kW
self.kH = kH
self.dW = dW or 1
self.dH = dH or 1
self.padW = padW or 0
self.padH = padH or 0
self.ceil_mode = false
self.count_include_pad = true
self.divide = true
end
function SpatialAveragePooling:ceil()
self.ceil_mode = true
return self
end
function SpatialAveragePooling:floor()
self.ceil_mode = false
return self
end
function SpatialAveragePooling:setCountIncludePad()
self.count_include_pad = true
return self
end
function SpatialAveragePooling:setCountExcludePad()
self.count_include_pad = false
return self
end
local function backwardCompatible(self)
if self.ceil_mode == nil then
self.ceil_mode = false
self.count_include_pad = true
self.padH = 0
self.padW = 0
end
end
function SpatialAveragePooling:updateOutput(input)
input.nn.SpatialAveragePooling_updateOutput(self, input)
return self.output
end
function SpatialAveragePooling:__tostring__()
local s = string.format('%s(%dx%d, %d,%d', torch.type(self),
self.kW, self.kH, self.dW, self.dH)
if (self.padW or self.padH) and (self.padW ~= 0 or self.padH ~= 0) then
s = s .. ', ' .. self.padW .. ','.. self.padH
end
s = s .. ')'
return s
end
|
do
local google_config = load_from_file('data/google.lua')
local function httpsRequest(url)
print(url)
local res,code = https.request(url)
if code ~= 200 then return nil end
return json:decode(res)
end
local function searchYoutubeVideos(text)
local url = 'https://www.googleapis.com/youtube/v3/search?'
url = url..'part=snippet'..'&maxResults=4'..'&type=video'
url = url..'&q='..URL.escape(text)
if google_config.api_keys then
local i = math.random(#google_config.api_keys)
local api_key = google_config.api_keys[i]
if api_key then
url = url.."&key="..api_key
end
end
local data = httpsRequest(url)
if not data then
print("HTTP Error")
return nil
elseif not data.items then
return nil
end
return data.items
end
local function run(msg, matches)
local text = ''
local items = searchYoutubeVideos(matches[1])
if not items then
return "Error!"
end
for k,item in pairs(items) do
text = text..'http://youtu.be/'..item.id.videoId..' '..
item.snippet.title..'\n\n'
end
return text
end
return {
description = "Search video on youtube and send it.",
usage = "!youtube [term]: Search for a youtube video and send it.",
patterns = {
"^!youtube (.*)"
},
run = run
}
end
|
return {
postgres = {
up = [[
CREATE TABLE IF NOT EXISTS "unique_foreigns" (
"id" UUID PRIMARY KEY,
"name" TEXT
);
CREATE TABLE IF NOT EXISTS "unique_references" (
"id" UUID PRIMARY KEY,
"note" TEXT,
"unique_foreign_id" UUID UNIQUE REFERENCES "unique_foreigns" ("id") ON DELETE CASCADE
);
]],
},
cassandra = {
up = [[
CREATE TABLE IF NOT EXISTS unique_foreigns (
id uuid PRIMARY KEY,
name text
);
CREATE TABLE IF NOT EXISTS unique_references (
id uuid PRIMARY KEY,
note text,
unique_foreign_id uuid
);
CREATE INDEX IF NOT EXISTS ON unique_references(unique_foreign_id);
]],
},
}
|
local awful = require('awful')
local wibox = require('wibox')
local gears = require('gears')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local button_container = require('ui.widgets.button')
local notifbox_core = require('ui.notifs.notif-center.build-notifbox')
local reset_notifbox_layout = notifbox_core.reset_notifbox_layout
local clear_all_icon = wibox.widget {
{
markup = "",
font = beautiful.icon_font_name .. "Round 16",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
layout = wibox.layout.fixed.horizontal
}
local clear_all_button = wibox.widget {
{
clear_all_icon,
margins = dpi(7),
widget = wibox.container.margin
},
widget = button_container
}
clear_all_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
reset_notifbox_layout()
end
)
)
)
local clear_all_button_wrapped = wibox.widget {
nil,
{
clear_all_button,
bg = beautiful.xcolor0,
shape = gears.shape.circle,
widget = wibox.container.background
},
nil,
expand = 'none',
layout = wibox.layout.align.vertical
}
return clear_all_button_wrapped
|
-----------------------------------
-- Area: Northern San d'Oria
-- NPC: Attarena
-- Only sells when San d'Oria controlls Li'Telor Region
-----------------------------------
local ID = require("scripts/zones/Northern_San_dOria/IDs")
require("scripts/globals/events/harvest_festivals")
require("scripts/globals/shop")
-----------------------------------
function onTrade(player, npc, trade)
onHalloweenTrade(player, trade, npc)
end
function onTrigger(player, npc)
if GetRegionOwner(tpz.region.LITELOR) ~= tpz.nation.SANDORIA then
player:showText(npc, ID.text.ATTARENA_CLOSED_DIALOG)
else
local stock =
{
623, 119, -- Bay Leaves
4154, 6440, -- Holy Water
}
player:showText(npc, ID.text.ATTARENA_OPEN_DIALOG)
tpz.shop.general(player, stock, SANDORIA)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
|
-- 定义为全局模块,整个lua程序的入口类
GameMain = {};
--设置游戏帧率
CS.UnityEngine.Application.targetFrameRate = 60
local function OnApplicationQuit()
-- 模块注销
if LogicUpdateManagerInst then
LogicUpdateManagerInst:Dispose()
end
if UpdateManagerInst then
UpdateManagerInst:Dispose()
end
if TimerManagerInst then
TimerManagerInst:Dispose()
end
if GAME_EVENT_CENTER_DISPOSE then
GAME_EVENT_CENTER_DISPOSE()
end
print("Game OnApplicationQuit ...lua")
end
local function StartGame()
require("Updater.UpdateMain")
end
-- GameMain公共接口,其它的一律为私有接口,只能在本模块访问
GameMain.OnApplicationQuit = OnApplicationQuit
local gamePlatform = CS.UnityEngine.Application.platform
local RuntimePlatform = CS.UnityEngine.RuntimePlatform
--错误回调
function __G__TRACKBACK__(errorMessage)
printInfo("----------------------------------------")
printInfo("[LUA ERROR]: " .. tostring(errorMessage) .. "\n")
printInfo(debug.traceback("", 2))
printInfo("----------------------------------------")
if not gamePlatform or gamePlatform == RuntimePlatform.OSXEditor or gamePlatform == RuntimePlatform.OSXPlayer
or gamePlatform == RuntimePlatform.WindowsPlayer or gamePlatform == RuntimePlatform.WindowsEditor then
-- Windows/Mac平台下直接暂停,以查看出错堆栈
-- os.execute 'pause'
end
return errorMessage
end
xpcall(function()
StartGame()
end, __G__TRACKBACK__)
|
local M = {}
local memory = _G.memory
local luap = require 'luap'
local config = require 'config'
local draw = require 'draw'
local smw = require 'game.smw'
local u8 = memory.readbyte
local s8 = memory.readsbyte
local s16 = memory.readsword
local OPTIONS = config.OPTIONS
local screen_coordinates = smw.screen_coordinates
local WRAM = smw.WRAM
local SMW = smw.constant
-- sprite_table environment
do
local xText, yText, height, xCam, yCam, xPos, yPos, number
local color = 0xff4410
local function draw_near_sprite(slot)
local x, y = screen_coordinates(xPos, yPos, xCam, yCam)
draw.Font = 'Uzebox6x8'
draw.text(draw.AR_x * x, draw.AR_y * y, '#' .. slot, color, 0x000060)
end
local function sprite_info(slot)
local xLow = u8('WRAM', WRAM.coinspr_x_low + slot)
local xHigh = u8('WRAM', WRAM.coinspr_x_high + slot)
local yLow = u8('WRAM', WRAM.coinspr_y_low + slot)
local yHigh = u8('WRAM', WRAM.coinspr_y_high + slot)
local ySub = u8('WRAM', WRAM.coinspr_y_sub + slot)
local ySpeed = s8('WRAM', WRAM.coinspr_y_speed + slot)
xPos = luap.signed16(0x100 * xHigh + xLow)
yPos = luap.signed16(0x100 * yHigh + yLow)
local text = string.format('#%x: %.2x (%x, %x.%.2x %+d)', slot, number, xPos, yPos, ySub,
ySpeed)
draw.Font = 'Uzebox8x12'
draw.text(xText, yText, text, color, 0x000030)
draw_near_sprite(slot)
end
function M.sprite_table()
if not OPTIONS.display_coin_sprite_info then return end
draw.Font = 'Uzebox8x12'
height = draw.font_height()
xText = draw.AR_x * (-100)
yText = draw.AR_y * 248
xCam = s16('WRAM', WRAM.camera_x)
yCam = s16('WRAM', WRAM.camera_y)
draw.text(xText, yText, 'Coin sprites:', color, 0x000030)
yText = yText + height
for slot = 0, SMW.coin_sprite_max - 1 do
number = u8('WRAM', WRAM.coinspr_number + slot)
if number ~= 0 then
sprite_info(slot)
yText = yText + height
end
end
end
end
return M
|
local tbl = { two = 2, one = 1, "alpha", "bravo", [3] = "charlie", [5] = "echo", [6] = "foxtrot" }
print( "pairs:" )
for k, v in pairs( tbl ) do
print( k, v )
end
print( "\nipairs:" )
for k, v in ipairs( tbl ) do
print( k, v )
end
/*
pairs:
1 alpha
2 bravo
3 charlie
5 echo
6 foxtrot
one 1
two 2
ipairs:
1 alpha
2 bravo
3 charlie
*/
|
-- 获取方法签名特征
local methodKey = KEYS[1]
redis.log(redis.LOG_DEBUG,'key is',methodKey)
-- 调用脚本传入的限流大小
local limit = tonumber(ARGV[1])
-- 获取当前流量大小
local count = tonumber(redis.call('get',methodKey) or "0")
--是否超出限流值
if count + 1 >limit then
-- 拒绝访问
return false
else
-- 没有超过阈值
-- 设置当前访问数量+1
redis.call('INCRBY',methodKey,1)
-- 设置过期时间
redis.call('EXPIRE',methodKey,1)
-- 放行
return true
end
|
local t = Def.ActorFrame{};
if not GAMESTATE:IsCourseMode() then return t; end;
t[#t+1] = Def.Sprite {
InitCommand=function(self) self:xy(SCREEN_CENTER_X,SCREEN_CENTER_Y) end,
BeforeLoadingNextCourseSongMessageCommand=function(self) self:LoadFromSongBackground( SCREENMAN:GetTopScreen():GetNextCourseSong() ) end,
ChangeCourseSongInMessageCommand=function(self) self:scale_or_crop_background() end,
StartCommand=function(self) self:diffusealpha(0):decelerate(0.6):diffusealpha(1) end,
FinishCommand=function(self) self:linear(0.3):diffusealpha(0) end
}
return t;
|
local game = require 'game'
local Timer = require 'vendor/timer'
return{
name = 'lightning',
type = 'projectile',
friction = 1,
width = 100,
height = 30,
frameWidth = 100,
frameHeight = 30,
solid = true,
lift = game.gravity,
playerCanPickUp = false,
enemyCanPickUp = false,
canPlayerStore = false,
velocity = { x = 0, y = 0 }, --initial velocity
throwVelocityX = 600,
throwVelocityY = 0,
offset = { x = 15, y = -15},
thrown = false,
damage = 4,
special_damage = {lightning = 4},
max_damage = 20,
horizontalLimit = 600,
animations = {
default = {'loop', {'1-3,1'}, 0.1},
thrown = {'loop', {'1-3,1'}, 0.1},
finish = {'once', {'1,1'}, 1},
},
collide = function(node, dt, mtv_x, mtv_y,projectile)
if node.isPlayer or node.isInteractive then return end
if node.hurt then
-- If the projectile node doesn't have the max_damage attribute yet, set the default
-- Don't change the projectile.props, since that will change the node for the rest of the lightning nodes.
if not projectile.max_damage then
projectile.max_damage = projectile.props.max_damage
end
if projectile.max_damage > 0 then
node:hurt(projectile.damage, projectile.special_damage, 0)
projectile.max_damage = projectile.max_damage - projectile.props.damage
else
projectile:die()
end
end
end,
}
|
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
test_run:cmd("push filter 'Failed to allocate [0-9]+' to 'Failed to allocate <NUM>'")
test_run:cmd("push filter '"..engine.."_max_tuple_size' to '<ENGINE>_max_tuple_size'")
-- https://github.com/tarantool/tarantool/issues/2667
-- Allow to insert tuples bigger than `max_tuple_size'
s = box.schema.space.create('test', { engine = engine })
_ = s:create_index('primary')
engine_max_tuple_size = engine ..'_max_tuple_size'
engine_tuple_size = engine == 'memtx' and 16 or 32
box.cfg{[engine_max_tuple_size] = 1024 * 1024}
-- check max_tuple_size limit
max_tuple_size = box.cfg[engine_max_tuple_size]
_ = s:replace({1, string.rep('x', max_tuple_size)})
-- check max_tuple_size dynamic configuration
box.cfg { [engine_max_tuple_size] = 2 * max_tuple_size }
_ = s:replace({1, string.rep('x', max_tuple_size)})
-- check tuple sie
box.cfg { [engine_max_tuple_size] = engine_tuple_size + 2 }
_ = s:replace({1})
-- check large tuples allocated on malloc
box.cfg { [engine_max_tuple_size] = 32 * 1024 * 1024 }
_ = s:replace({1, string.rep('x', 32 * 1024 * 1024 - engine_tuple_size - 8)})
-- decrease max_tuple_size limit
box.cfg { [engine_max_tuple_size] = 1 * 1024 * 1024 }
_ = s:replace({1, string.rep('x', 2 * 1024 * 1024 )})
_ = s:replace({1, string.rep('x', 1 * 1024 * 1024 - engine_tuple_size - 8)})
-- gh-2698 Tarantool crashed on 4M tuple
max_item_size = 0
test_run:cmd("setopt delimiter ';'")
for _, v in pairs(box.slab.stats()) do
max_item_size = math.max(max_item_size, v.item_size)
end;
test_run:cmd("setopt delimiter ''");
box.cfg { [engine_max_tuple_size] = max_item_size + engine_tuple_size + 8 }
_ = box.space.test:replace{1, 1, string.rep('a', max_item_size)}
-- reset to original value
box.cfg { [engine_max_tuple_size] = max_tuple_size }
s:drop();
collectgarbage('collect') -- collect all large tuples
box.snapshot() -- discard xlogs with large tuples
test_run:cmd("clear filter")
--
-- gh-1014: tuple field names.
--
format = {}
format[1] = {name = 'field1', type = 'unsigned'}
format[2] = {name = 'field2', type = 'string'}
format[3] = {name = 'field3', type = 'array'}
format[4] = {name = 'field4', type = 'number'}
format[5] = {name = 'field5', type = 'integer'}
format[6] = {name = 'field6', type = 'scalar'}
format[7] = {name = 'field7', type = 'map'}
format[8] = {name = 'field8', type = 'any'}
format[9] = {name = 'field9'}
format[10] = {name = 'bsize'}
format[11] = {name = 'totable'}
format[12] = {name = 'longlonglonglonglonglongname'}
s = box.schema.space.create('test', {engine = engine, format = format})
pk = s:create_index('pk')
t = {1, '2', {3, 3}, 4.4, -5, true, {key = 7}, 8, 9, 10, 11, 12}
t = s:replace(t)
t
t.field1, t.field2, t.field3, t.field4, t.field5, t.field6, t.field7, t.field8, t.field9, t.bsize, t.totable
t.longlonglonglonglonglongname
box.tuple.bsize(t)
box.tuple.totable(t)
s:drop()
--
-- Increase collisions number and make juajit use second hash
-- function.
--
format = {}
for i = 1, 100 do format[i] = {name = "skwjhfjwhfwfhwkhfwkjh"..i.."avjnbknwkvbwekjf"} end
s = box.schema.space.create('test', { engine = engine, format = format })
p = s:create_index('pk')
to_insert = {}
for i = 1, 100 do to_insert[i] = i end
t = s:replace(to_insert)
format = nil
name = nil
s = nil
p = nil
to_insert = nil
collectgarbage('collect')
-- Print many many strings (> 40 to reach max_collisions limit in luajit).
t.skwjhfjwhfwfhwkhfwkjh01avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh02avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh03avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh04avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh05avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh06avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh07avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh08avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh09avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh10avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh11avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh12avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh13avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh14avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh15avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh16avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh17avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh18avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh19avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh20avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh21avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh22avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh23avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh24avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh25avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh26avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh27avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh28avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh29avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh30avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh31avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh32avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh33avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh34avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh35avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh36avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh37avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh38avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh39avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh40avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh41avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh42avjnbknwkvbwekjf
t.skwjhfjwhfwfhwkhfwkjh43avjnbknwkvbwekjf
box.space.test:drop()
--
-- gh-2773: correctly reset max tuple size on restart.
--
box.cfg{[engine_max_tuple_size] = 1024 * 1024 * 100}
s = box.schema.space.create('test', {engine = engine})
pk = s:create_index('pk')
_ = s:replace({1, string.rep('*', 1024 * 1024)})
_ = s:replace({2, string.rep('*', 1024 * 1024 * 2)})
pk:count()
test_run:cmd('restart server default')
engine = test_run:get_cfg('engine')
s = box.space.test
s:count()
s:drop()
--
-- gh-2821: tuple:tomap().
--
format = {}
format[1] = {'field1', 'unsigned'}
format[2] = {'field2', 'unsigned'}
format[3] = {'field3', 'unsigned'}
format[4] = {'field4', 'array'}
s = box.schema.space.create('test', {format = format, engine = engine})
pk = s:create_index('pk')
t1 = s:replace{1, 2, 3, {'a', 'b', 'c'}}
t1map = t1:tomap()
function maplen(map) local count = 0 for _ in pairs(map) do count = count + 1 end return count end
maplen(t1map), t1map.field1, t1map.field2, t1map.field3, t1map.field4
t1map[1], t1map[2], t1map[3], t1map[4]
-- Fields with table type are stored once for name and for index.
t1map[4] == t1map.field4
t2 = s:replace{4, 5, 6, {'a', 'b', 'c'}, 'extra1'}
t2map = t2:tomap()
maplen(t2map), t2map.field1, t2map.field2, t2map.field3, t2map.field4
t1map[1], t1map[2], t1map[3], t2map[4], t2map[5]
-- Use box.tuple.tomap alias.
t3 = s:replace{7, 8, 9, {'a', 'b', 'c'}, 'extra1', 'extra2'}
t3map = box.tuple.tomap(t3)
maplen(t3map), t3map.field1, t3map.field2, t3map.field3, t3map.field4
t1map[1], t1map[2], t1map[3], t3map[4], t3map[5], t3map[6]
-- Invalid arguments.
t3.tomap('123')
box.tuple.tomap('456')
s:drop()
-- No names, no format.
s = box.schema.space.create('test', { engine = engine })
pk = s:create_index('pk')
t1 = s:replace{1, 2, 3}
t1map = t1:tomap()
maplen(t1map), t1map[1], t1map[2], t1map[3]
s:drop()
--
-- gh-2821: tuple:tomap() names_only feature.
--
format = {}
format[1] = {name = 'field1', type = 'unsigned' }
format[2] = {name = 'field2', type = 'unsigned' }
s = box.schema.create_space('test', {format = format})
pk = s:create_index('pk')
t = s:replace{100, 200, 300 }
t:tomap({names_only = false})
t:tomap({names_only = true})
t:tomap({names_only = 'text'})
t:tomap({names_only = true}, {dummy = true})
t:tomap({})
s:drop()
s = box.schema.create_space('test')
pk = s:create_index('pk')
t = s:replace{1,2,3,4,5,6,7}
t:tomap({names_only = true})
s:drop()
format = {}
format[1] = {name = 'field1', type = 'unsigned'}
format[2] = {name = 'field2', type = 'array'}
format[3] = {name = 'field3', type = 'map'}
format[4] = {name = 'field4', type = 'string' }
format[5] = {name = "[2][6]['привет中国world']['中国a']", type = 'string'}
format[6] = {name = '[1]', type = 'any'}
s = box.schema.space.create('test', {format = format})
pk = s:create_index('pk')
field2 = {1, 2, 3, "4", {5,6,7}, {привет中国world={中国="привет"}, key="value1", value="key1"}}
field3 = {[10] = 100, k1 = 100, k2 = {1,2,3}, k3 = { {a=1, b=2}, {c=3, d=4} }, [-1] = 200}
t = s:replace{1, field2, field3, "123456", "yes, this", {key = 100}}
t[1]
t[2]
t[3]
t[4]
t[2][1]
t["[2][1]"]
t[2][5]
t["[2][5]"]
t["[2][5][1]"]
t["[2][5][2]"]
t["[2][5][3]"]
t["[2][6].key"]
t["[2][6].value"]
t["[2][6]['key']"]
t["[2][6]['value']"]
t[2][6].привет中国world.中国
t["[2][6].привет中国world"].中国
t["[2][6].привет中国world.中国"]
t["[2][6]['привет中国world']"]["中国"]
t["[2][6]['привет中国world']['中国']"]
t["[2][6]['привет中国world']['中国a']"]
t["[3].k3[2].c"]
t["[4]"]
t.field1
t.field2[5]
t[".field1"]
t["field1"]
t["[3][10]"]
t["[1]"]
t["['[1]'].key"]
-- Not found.
t[0]
t["[0]"]
t["[1000]"]
t.field1000
t["not_found"]
t["[2][5][10]"]
t["[2][6].key100"]
t["[2][0]"] -- 0-based index in array.
t["[4][3]"] -- Can not index string.
t["[4]['key']"]
-- Not found 'a'. Return 'null' despite of syntax error on a
-- next position.
t["a.b.c d.e.f"]
-- Sytax errors.
t["[2].[5]"]
t["[-1]"]
t[".."]
t["[["]
t["]]"]
t["{"]
s:drop()
engine = nil
test_run = nil
|
package.path='/opt/tarantool/?.lua;/opt/tarantool/?/init.lua;/opt/TarantoolModules/?.lua;/opt/TarantoolModules/?/init.lua;'..package.path
local function DoPercentEncoding(s)
local function char_to_hex(c)
return string.format("%%%02X",string.byte(c))
end
return s and s:gsub("\n", "\r\n"):gsub("([^%w ])",char_to_hex):gsub(" ", "+")
end
box.cfg{
listen=3301,
work_dir='/var/lib/tarantool',
wal_dir = 'WAL',
memtx_dir = 'MemTX',
vinyl_dir = 'Vinyl'
}
local Cfg=require("Config")
local console=require('console')
console.listen('/var/lib/tarantool/admin.sock')
local log=require('log')
local json=require('json')
local crypto=require('crypto')
local clock=require('clock')
local http_client=require('http.client').new({max_connections=5})
--local string=require('string')
local base58=require("base58")
--Spaces
local Users=box.space.Users
local UsersEx=box.space.UsersEx
local UsersOAuth=box.space.UsersOAuth
local Decks=box.space.Decks
local DeckCards=box.space.DeckCards
--functions
local function MkUser(MainRecord,SecondaryRecord)
return {
ID=MainRecord[1],
Name=MainRecord[2],
Email=MainRecord[3],
TrueUser=MainRecord[5]=='Admin' or MainRecord[5]=='Test',
IsAdmin=MainRecord[5]=='Admin',
Enabled=MainRecord[6],
Mailing=MainRecord[7],
Session=MainRecord[8],
--=SecondaryRecord[],
}
end
local function VerifyAdmin(Session)
local Res=Users.index.Session:select(Session)
return #Res==1 and Res[1][6] and Res[1][5]=='Admin'
end
local function GenPassword()
return
end
local Salt=tostring(clock.time64())
local function MkSession()
return base58.encode_base58(crypto.digest.sha512(tostring(clock.time64())..Salt))
end
local function CryptoPassword(Password)
return crypto.digest.sha512(Password..'-1022ee7c9ea5781e58d16bef46d10a3be6b8d226d14186f3810fcfc3250a68ed75c0fec80020cc55b4105d700ef8cefbe70508f8e4c1c40c90d4b599b3a90ae6')
end
box.once("schema",function()
-- основной пользователь
box.schema.user.passwd(Cfg.Tarantool.AdminPassword)
-- настроить пользователя для репликации
box.schema.user.create('replicator', {password = 'password'})
box.schema.user.grant('replicator', 'replication')
Users=box.schema.space.create('Users',{engine="vinyl",format={
{name='ID',type='unsigned'},
{name='Name',type='string'},
{name='Email',type='string'},
{name='Password',type='string'},
{name='Type',type='string',is_nullable=true}, --Admin|Test|nil
{name='Enabled',type='boolean'},
{name='Mailing',type='boolean'},
{name='Session',type='string',is_nullable=true},
{name='Code',type='string',is_nullable=true}
--unsigned|string|integer|number|boolean|array|scalar
}})
box.schema.sequence.create('UsersSeq')
Users:create_index('primary',{unique=true,parts={{1,"unsigned"}},sequence='UsersSeq'})
Users:create_index('Login',{unique=true,parts={{3,"string"},{4,"string"}}})
Users:create_index('Email',{unique=true,parts={{3,"string"}}})
Users:create_index('Mailing',{unique=false,parts={{7,"boolean"}}})
Users:create_index('Session',{unique=true,parts={{8,"string"}}})
Users:create_index('Code',{unique=true,parts={{9,"string"}}})
UsersEx=box.schema.space.create('UsersEx',{engine="vinyl",format={
{name='ID',type='unsigned'},
{name='Image',type='string',is_nullable=true},
{name='Website',type='string',is_nullable=true}
}})
UsersEx:create_index('primary',{unique=true,parts={{1,"unsigned"}}})
local U=Users:insert({nil,'UberAdmin','teamfnd@yandex.ru',CryptoPassword('yz9zkq'),'Admin',true,false,'AdminTestSession',nil})
UsersEx:insert({U[1]})
UsersOAuth=box.schema.space.create('UsersOAuth',{engine="vinyl",format={
{name='UserID',type='unsigned'},
{name='OAuth',type='string'},
{name='OAuthID',type='unsigned'}
}})
UsersOAuth:create_index('primary',{unique=true,parts={{2,"string"},{3,"unsigned"}}})
Decks=box.schema.space.create('Decks',{engine="vinyl",format={
{name='UserID',type='unsigned'},
{name='ID',type='unsigned'},
{name='Name',type='string'},
{name='Class',type='unsigned'},
{name='Type',type='unsigned'}
}})
box.schema.sequence.create('DecksSeq')
Decks:create_index('primary',{unique=true,parts={{2,"unsigned"}},sequence='DecksSeq'})
Decks:create_index('Text',{unique=true,parts={{1,"unsigned"},{3,"string"}}})
Decks:create_index('User',{unique=false,parts={{1,"unsigned"}}})
DeckCards=box.schema.space.create('DeckCards',{engine="vinyl",format={
{name='DeckID',type='unsigned'},
{name='CardSet',type='string'},
{name='CardName',type='string'}
}})
DeckCards:create_index('primary',{unique=true,parts={{1,"unsigned"},{2,"string"},{3,"string"}}})
DeckCards:create_index('ID',{unique=false,parts={{1,"unsigned"}}})
end)
function VerifyEmail(Code)
if #Users.index.Code:select(Code)==1 then
Users.index.Code:update(Code,{{'=',6,true},{'#',9,1}})
return 200
else
return 404
end
end
function CheckEmail(Email)
return #Users.index.Email:select(Email)>0 and 409 or 200
end
function RegisterUser(UserName,Email,Password,Mailing)
local Result
if Users.index.Email:get(Email) then
return 409
elseif pcall(function()
Result=Users:insert{nil,UserName,Email,CryptoPassword(Password),nil,false,Mailing,nil,MkSession()}
UsersEx:insert{Result[1]}
end)then
local link=[[https://languagerobbers.ru/VerifyEmail?Code=]]..Result[9]
local r=http_client:get([[https://languagerobbers.ru/SendMail?Key=]]..Cfg.InternalKey.."&Email="..DoPercentEncoding(Email).."&Subject="..DoPercentEncoding("Подтверждение регитсрации на Language Robbers").."&Body="..
DoPercentEncoding("Уважемый "..UserName..
'<p>Спасибо за регистрацию на languagerobbers.ru!<p>Для подтверждения вашего email адреса перейдите по следующей ссылке:'..
'<p><a href="'..link..'">'..link..'</a>'))
log.error(r.status)
log.error(r.body)
log.error(r.reason)
return r.status
else
return 500
end
end
function RegisterUserOAuth(key,UserName,Email,ServiceName,ServiceID)
if key==Cfg.InternalKey then
local Result
if Users.index.Email:get(Email) then
return 409
elseif pcall(function()
Result=Users:insert{nil,UserName,Email,'',nil,false,false,nil,MkSession()}
UsersEx:insert{Result[1]}
UsersOAuth:insert{Result[1],ServiceName,ServiceID}
end)then
return 200,Result[9]
else
return 500
end
else
return 200
end
end
function RegisterUserOAuthVerify(Code,Password,Mailing)
if Users.index.Code:get(Code) then
local Session=MkSession()
Users.index.Code:update(Code,{{'=',4,CryptoPassword(Password)},{'=',6,true},{'=',7,Mailing},{'=',8,Session},{'#',9,1}})
return 200,Session
else
return 404
end
end
function GetCurrUser(Session)
local Res=Users.index.Session:select(Session)
if #Res==1 and Res[1][6] then
return 200,MkUser(Res[1],UsersEx:get(Res[1][1]))
else
return 404
end
end
function Login(Email,Password)
local Res=Users.index.Login:select({Email,CryptoPassword(Password)})
local Session=MkSession()
if #Res==1 and Res[1][6] and pcall(function()
Users.index.Login:update({Email,CryptoPassword(Password)},{{'=',8,Session}})
end) then
return 200,Session
else
return 404
end
end
function LoginOAuth(key,ServiceName,ServiceID)
if key==Cfg.InternalKey then
local Res=UsersOAuth:get{ServiceName,ServiceID}
if Res then
Res=Users:get(Res[1])
local Session=MkSession()
if Res and Res[6] and pcall(function()
Users:update(Res[1],{{'=',8,Session}})
end)then
return 200,Session
else
return 404
end
else
return 404
end
else
return 404
end
end
function MkMailingList(key)
if key==Cfg.InternalKey then
local Data={}
for _,i in Users.index.Mailing:pairs(true) do
Data[#Data+1]=i[7]
end
log.error(Data)
return 200,Data
else
return 200
end
end
function ResetPassword(Email)
local Password
if Users.index.Email:get(Email) then
if pcall(function()
Password=GenPassword()
Users.index.Email:update(Email,{{'=',4,Password}})
end)then
local link=[[https://languagerobbers.ru/VerifyEmail?Code=]]..Password
local r=http_client:get([[https://languagerobbers.ru/SendMail?Key=]]..Cfg.InternalKey.."&Email="..DoPercentEncoding(Email).."&Subject="..DoPercentEncoding(
"Подтверждение регитсрации на Language Robbers").."&Body="..
DoPercentEncoding("Уважемый "..UserName..
'<p>Спасибо за регистрацию на languagerobbers.ru!<p>Для подтверждения вашего email адреса перейдите по следующей ссылке:'..
'<p><a href="'..link..'">'..link..'</a>'))
log.error(r.status)
log.error(r.body)
log.error(r.reason)
return r.status
else
return 500
end
else
return 404
end
end
function GetServerDate()
return 200,math.floor(tonumber(clock.time64())/1000000000/60/60/24)
end
function GetServerTime()
return 200,tonumber(clock.time64())
end
--Decks
local MaxCardsInDeck=50
function GetDeckList(Session)
local Res=Users.index.Session:get(Session)
if #Res==1 and Res[6] then
Result={}
for _,i in Decks.index.User:pairs(Res[1]) do
Result[i[3]]=i
end
return 200,Result
else
return 404
end
end
function GetDeck(Session,DeckID)
local Res=Users.index.Session:get(Session)
if #Res==1 and Res[6] then
local Res2=Decks:get(DeckID)
if Res2 and Res[1]==Res2[1] then
return 200,DeckCards:select(DeckID)
end
return 403
else
return 404
end
end
function NewDeck(Session,Name,Class,Type)
local Res=Users.index.Session:get(Session)
if #Res==1 and Res[6] then
local Result=Decks:insert{Res[1],nil,Name,Class,Type}
return 200,Result[2]
else
return 404
end
end
function DelDeck(Session,DeckID)
local Res=Users.index.Session:get(Session)
if #Res==1 and Res[6] then
local Res2=Decks:get(DeckID)
if Res2 and Res[1]==Res2[1] then
Decks:delete{DeckID}
for _,i in pairs(DeckCards.index.ID:select(DeckID)) do
DeckCards:delete(i)
end
return 200
end
return 403
else
return 404
end
end
--CardsInDecks
function AddCardToDeck(Session,DeckID,CardSet,CardName)
local Res=Users.index.Session:get(Session)
if #Res==1 and Res[6] then
local Res2=Decks:get(DeckID)
if Res2 and Res[1]==Res2[1] then
if DeckCards.Decks.ID:count(DeckID)<MaxCardsInDeck then
for _,i in pairs(DeckCards.index.ID:select(DeckID)) do
DeckCards:delete(i)
end
end
return 409
end
return 403
else
return 404
end
end
end
--[[Decks=box.schema.space.create('Decks',{engine="vinyl",format={
{name='UserID',type='unsigned'},
{name='ID',type='unsigned'},
{name='Name',type='string'},
{name='Class',type='unsigned'},
{name='Type',type='unsigned'}
}})
box.schema.sequence.create('DecksSeq')
Decks:create_index('primary',{unique=true,parts={{1,"unsigned"},{3,"string"}}})
Decks:create_index('User',{unique=false,parts={{1,"unsigned"}}})
Decks:create_index('ID',{unique=true,parts={{2,"unsigned"}},sequence='DecksSeq'})
DeckCards=box.schema.space.create('DeckCards',{engine="vinyl",format={
{name='DeckID',type='unsigned'},
{name='CardSet',type='string'},
{name='CardName',type='string'}
}})
DeckCards:create_index('primary',{unique=true,parts={{1,"unsigned"},{2,"string"},{3,"string"}}})
DeckCards:create_index('ID',{unique=false,parts={{1,"unsigned"}}})]]
|
local NotificationBindable = Instance.new("BindableFunction")
NotificationBindable.OnInvoke = callback
--
game.StarterGui:SetCore("SendNotification", {
Title = "Dynamic Client";
Text = "ESP Activated.";
Icon = "rbxassetid://5631279864";
Duration = 3;
Callback = NotificationBindable;
})
local Aimware = Instance.new("ScreenGui")
local AimwareTitle = Instance.new("Frame")
local AimwareArrayPage = Instance.new("Frame")
local ToggleArray = Instance.new("TextButton")
local ARRAYBind = Instance.new("TextBox")
local ToggleRainbow = Instance.new("TextButton")
local AimwareTop2 = Instance.new("TextLabel")
local NextPage = Instance.new("TextButton")
local AimwareESPPage = Instance.new("Frame")
local ToggleESP = Instance.new("TextButton")
local ESPBind = Instance.new("TextBox")
local AimwareGRAVPage = Instance.new("Frame")
local ToggleGRAV = Instance.new("TextButton")
local GRAVBind = Instance.new("TextBox")
local AimwareSINKPage = Instance.new("Frame")
local ToggleSINK = Instance.new("TextButton")
local SINKBind = Instance.new("TextBox")
local AimwareArray = Instance.new("Frame")
local ESPD = Instance.new("TextLabel")
local ESPE = Instance.new("TextLabel")
local AimwareTop1 = Instance.new("TextLabel")
local GRAVD = Instance.new("TextLabel")
local GRAVE = Instance.new("TextLabel")
local SINKE = Instance.new("TextLabel")
local SINKD = Instance.new("TextLabel")
local AimwareIntro = Instance.new("TextLabel")
local AimwareIntro2 = Instance.new("TextLabel")
Aimware.Name = "Aimware"
Aimware.Parent = game.CoreGui
Aimware.ResetOnSpawn = false
ESPTOGGLE = false
MENUTOGGLE = false
ARRAYTOGGLE = false
RAINBOWTOGGLE = false
GRAVTOGGLE = false
SINKTOGGLE = false
AimwareTitle.Name = "AimwareTitle"
AimwareTitle.Parent = Aimware
AimwareTitle.Active = true
AimwareTitle.BackgroundColor3 = Color3.new(1, 0, 0)
AimwareTitle.BorderColor3 = Color3.new(1.17647, 0, 0)
AimwareTitle.BorderSizePixel = 0
AimwareTitle.Draggable = true
AimwareTitle.Position = UDim2.new(0.300000012, 0, 0.300000012, 0)
AimwareTitle.Selectable = true
AimwareTitle.Size = UDim2.new(0, 500, 0, 25)
AimwareTitle.Visible = false
AimwareArrayPage.Name = "AimwareArrayPage"
AimwareArrayPage.Parent = AimwareTitle
AimwareArrayPage.BackgroundColor3 = Color3.new(1, 1, 1)
AimwareArrayPage.BackgroundTransparency = 0.5
AimwareArrayPage.BorderColor3 = Color3.new(1, 1, 1)
AimwareArrayPage.BorderSizePixel = 0
AimwareArrayPage.Position = UDim2.new(0, 0, 0, 25)
AimwareArrayPage.Size = UDim2.new(0, 500, 0, 200)
ToggleArray.Name = "ToggleArray"
ToggleArray.Parent = AimwareArrayPage
ToggleArray.BackgroundColor3 = Color3.new(1, 1, 1)
ToggleArray.BackgroundTransparency = 1
ToggleArray.BorderSizePixel = 0
ToggleArray.Position = UDim2.new(0, 0, 0, 5)
ToggleArray.Size = UDim2.new(0, 500, 0, 25)
ToggleArray.Font = Enum.Font.Code
ToggleArray.FontSize = Enum.FontSize.Size24
ToggleArray.Text = "Toggle Array List"
ToggleArray.TextColor3 = Color3.new(1, 1, 1)
ToggleArray.TextSize = 22
ToggleArray.MouseButton1Down:connect(function()
if ARRAYTOGGLE == false then
AimwareArray.Visible = true
ARRAYTOGGLE = true
else
AimwareArray.Visible = false
ARRAYTOGGLE = false
end
end)
ARRAYBind.Name = "ARRAYBind"
ARRAYBind.Parent = AimwareArrayPage
ARRAYBind.BackgroundColor3 = Color3.new(1, 1, 1)
ARRAYBind.BackgroundTransparency = 1
ARRAYBind.BorderSizePixel = 0
ARRAYBind.Position = UDim2.new(0, 0, 0, 65)
ARRAYBind.Size = UDim2.new(0, 500, 0, 25)
ARRAYBind.Font = Enum.Font.Code
ARRAYBind.FontSize = Enum.FontSize.Size24
ARRAYBind.Text = "Keybind"
ARRAYBind.TextColor3 = Color3.new(1, 1, 1)
ARRAYBind.TextSize = 22
ToggleRainbow.Name = "ToggleRainbow"
ToggleRainbow.Parent = AimwareArrayPage
ToggleRainbow.BackgroundColor3 = Color3.new(1, 1, 1)
ToggleRainbow.BackgroundTransparency = 1
ToggleRainbow.BorderSizePixel = 0
ToggleRainbow.Position = UDim2.new(0, 0, 0, 35)
ToggleRainbow.Size = UDim2.new(0, 500, 0, 25)
ToggleRainbow.Font = Enum.Font.Code
ToggleRainbow.FontSize = Enum.FontSize.Size24
ToggleRainbow.Text = "Toggle Rainbow Array"
ToggleRainbow.TextColor3 = Color3.new(1, 1, 1)
ToggleRainbow.TextSize = 22
ToggleRainbow.MouseButton1Down:connect(function()
if RAINBOWTOGGLE == true then
RAINBOWTOGGLE = false
wait(0.35)
AimwareTop1.TextColor3 = Color3.new(1, 0, 0)
ESPD.TextColor3 = Color3.new(1, 0, 0)
ESPE.TextColor3 = Color3.new(0, 1, 0.0980392)
GRAVD.TextColor3 = Color3.new(1, 0, 0)
GRAVE.TextColor3 = Color3.new(0, 1, 0.0980392)
SINKD.TextColor3 = Color3.new(1, 0, 0)
SINKE.TextColor3 = Color3.new(0, 1, 0.0980392)
else
RAINBOWTOGGLE = true
end
while RAINBOWTOGGLE == true do
AimwareTop1.TextColor3 = Color3.new(1, 0, 0)
ESPD.TextColor3 = Color3.new(1, 0, 0)
ESPE.TextColor3 = Color3.new(1, 0, 0)
GRAVD.TextColor3 = Color3.new(1, 0, 0)
GRAVE.TextColor3 = Color3.new(1, 0, 0)
SINKD.TextColor3 = Color3.new(1, 0, 0)
SINKE.TextColor3 = Color3.new(1, 0, 0)
wait(0.13)
AimwareTop1.TextColor3 = Color3.new(1, 0.333333, 0)
ESPD.TextColor3 = Color3.new(1, 0.333333, 0)
ESPE.TextColor3 = Color3.new(1, 0.333333, 0)
GRAVD.TextColor3 = Color3.new(1, 0.333333, 0)
GRAVE.TextColor3 = Color3.new(1, 0.333333, 0)
SINKD.TextColor3 = Color3.new(1, 0.333333, 0)
SINKE.TextColor3 = Color3.new(1, 0.333333, 0)
wait(0.13)
AimwareTop1.TextColor3 = Color3.new(1, 1, 0)
ESPD.TextColor3 = Color3.new(1, 1, 0)
ESPE.TextColor3 = Color3.new(1, 1, 0)
GRAVD.TextColor3 = Color3.new(1, 1, 0)
GRAVE.TextColor3 = Color3.new(1, 1, 0)
SINKD.TextColor3 = Color3.new(1, 1, 0)
SINKE.TextColor3 = Color3.new(1, 1, 0)
wait(0.13)
AimwareTop1.TextColor3 = Color3.new(0, 1, 0)
ESPD.TextColor3 = Color3.new(0, 1, 0)
ESPE.TextColor3 = Color3.new(0, 1, 0)
GRAVD.TextColor3 = Color3.new(0, 1, 0)
GRAVE.TextColor3 = Color3.new(0, 1, 0)
SINKD.TextColor3 = Color3.new(0, 1, 0)
SINKE.TextColor3 = Color3.new(0, 1, 0)
wait(0.13)
AimwareTop1.TextColor3 = Color3.new(0, 0.333333, 1)
ESPD.TextColor3 = Color3.new(0, 0.333333, 1)
ESPE.TextColor3 = Color3.new(0, 0.333333, 1)
GRAVD.TextColor3 = Color3.new(0, 0.333333, 1)
GRAVE.TextColor3 = Color3.new(0, 0.333333, 1)
SINKD.TextColor3 = Color3.new(0, 0.333333, 1)
SINKE.TextColor3 = Color3.new(0, 0.333333, 1)
wait(0.13)
AimwareTop1.TextColor3 = Color3.new(0.333333, 0, 0.498039)
ESPD.TextColor3 = Color3.new(0.333333, 0, 0.498039)
ESPE.TextColor3 = Color3.new(0.333333, 0, 0.498039)
GRAVD.TextColor3 = Color3.new(0.333333, 0, 0.498039)
GRAVE.TextColor3 = Color3.new(0.333333, 0, 0.498039)
SINKD.TextColor3 = Color3.new(0.333333, 0, 0.498039)
SINKE.TextColor3 = Color3.new(0.333333, 0, 0.498039)
wait(0.13)
end
end)
AimwareTop2.Name = "AimwareTop2"
AimwareTop2.Parent = AimwareTitle
AimwareTop2.BackgroundColor3 = Color3.new(1, 1, 1)
AimwareTop2.BackgroundTransparency = 1
AimwareTop2.BorderSizePixel = 0
AimwareTop2.Position = UDim2.new(0, 4, 0, 0)
AimwareTop2.Size = UDim2.new(0, 132, 0, 25)
AimwareTop2.Font = Enum.Font.Code
AimwareTop2.FontSize = Enum.FontSize.Size24
AimwareTop2.Text = "Aimware v0.6.1"
AimwareTop2.TextColor3 = Color3.new(1, 1, 1)
AimwareTop2.TextSize = 22
AimwareTop2.TextXAlignment = Enum.TextXAlignment.Left
NextPage.Name = "NextPage"
NextPage.Parent = AimwareTitle
NextPage.BackgroundColor3 = Color3.new(1, 1, 1)
NextPage.BackgroundTransparency = 1
NextPage.BorderSizePixel = 0
NextPage.Position = UDim2.new(0, 390, 0, 0)
NextPage.Size = UDim2.new(0, 100, 0, 25)
NextPage.Font = Enum.Font.Code
NextPage.FontSize = Enum.FontSize.Size24
NextPage.Text = "Next Page"
NextPage.TextColor3 = Color3.new(1, 1, 1)
NextPage.TextSize = 22
NextPage.TextXAlignment = Enum.TextXAlignment.Right
NextPage.MouseButton1Down:connect(function()
if AimwareArrayPage.Visible == true then
AimwareArrayPage.Visible = false
AimwareGRAVPage.Visible = false
AimwareSINKPage.Visible = false
AimwareESPPage.Visible = true
elseif AimwareESPPage.Visible == true then
AimwareGRAVPage.Visible = false
AimwareESPPage.Visible = false
AimwareSINKPage.Visible = true
AimwareArrayPage.Visible = false
elseif AimwareSINKPage.Visible == true then
AimwareGRAVPage.Visible = true
AimwareESPPage.Visible = false
AimwareArrayPage.Visible = false
AimwareSINKPage.Visible = false
else
AimwareGRAVPage.Visible = false
AimwareESPPage.Visible = false
AimwareArrayPage.Visible = true
AimwareSINKPage.Visible = false
end
end)
AimwareESPPage.Name = "AimwareESPPage"
AimwareESPPage.Parent = AimwareTitle
AimwareESPPage.BackgroundColor3 = Color3.new(1, 1, 1)
AimwareESPPage.BackgroundTransparency = 0.5
AimwareESPPage.BorderColor3 = Color3.new(1, 1, 1)
AimwareESPPage.BorderSizePixel = 0
AimwareESPPage.Position = UDim2.new(0, 0, 0, 25)
AimwareESPPage.Size = UDim2.new(0, 500, 0, 200)
AimwareESPPage.Visible = false
ToggleESP.Name = "ToggleESP"
ToggleESP.Parent = AimwareESPPage
ToggleESP.BackgroundColor3 = Color3.new(1, 1, 1)
ToggleESP.BackgroundTransparency = 1
ToggleESP.BorderSizePixel = 0
ToggleESP.Position = UDim2.new(0, 0, 0, 5)
ToggleESP.Size = UDim2.new(0, 500, 0, 25)
ToggleESP.Font = Enum.Font.Code
ToggleESP.FontSize = Enum.FontSize.Size24
ToggleESP.Text = "Toggle ESP"
ToggleESP.TextColor3 = Color3.new(1, 1, 1)
ToggleESP.TextSize = 22
ToggleESP.MouseButton1Down:connect(function()
if ESPTOGGLE == false then
ESPTOGGLE = true
ESPD.Visible = false
ESPE.Visible = true
for i,v in pairs(game.Players:GetChildren()) do
if v.Character ~= game.Players.LocalPlayer.Character and v.Character.Head:FindFirstChild('ScreenGui') == nil then
if v.Character:FindFirstChild('Head') then
local bill = Instance.new('BillboardGui',v.Character.Head)
bill.Name = "thingyye"
bill.AlwaysOnTop = true
bill.Size = UDim2.new(2,1,2)
bill.Adornee = v.Character.Head
local txt = Instance.new('TextLabel',bill)
txt.Text = v.Name
txt.BackgroundTransparency = 1
txt.Size = UDim2.new(1,0,1,0)
txt.TextColor3 = v.TeamColor.Color
end
for a,c in pairs(v.Character:GetChildren()) do
if c.ClassName == "MeshPart" and c.Transparency ~= 1 then
doit(c)
elseif c.ClassName == "Part" and c.Transparency ~= 1 then
doit(c)
end
end
end
end
else
ESPTOGGLE = false
ESPD.Visible = true
ESPE.Visible = false
for i,v in pairs(game.Players:GetChildren()) do
undo(v.Character)
end
end
end)
ESPBind.Name = "ESPBind"
ESPBind.Parent = AimwareESPPage
ESPBind.BackgroundColor3 = Color3.new(1, 1, 1)
ESPBind.BackgroundTransparency = 1
ESPBind.BorderSizePixel = 0
ESPBind.Position = UDim2.new(0, 0, 0, 35)
ESPBind.Size = UDim2.new(0, 500, 0, 25)
ESPBind.Font = Enum.Font.Code
ESPBind.FontSize = Enum.FontSize.Size24
ESPBind.Text = "Keybind"
ESPBind.TextColor3 = Color3.new(1, 1, 1)
ESPBind.TextSize = 22
AimwareGRAVPage.Name = "AimwareGRAVPage"
AimwareGRAVPage.Parent = AimwareTitle
AimwareGRAVPage.BackgroundColor3 = Color3.new(1, 1, 1)
AimwareGRAVPage.BackgroundTransparency = 0.5
AimwareGRAVPage.BorderColor3 = Color3.new(1, 1, 1)
AimwareGRAVPage.BorderSizePixel = 0
AimwareGRAVPage.Position = UDim2.new(0, 0, 0, 25)
AimwareGRAVPage.Size = UDim2.new(0, 500, 0, 200)
AimwareGRAVPage.Visible = false
ToggleGRAV.Name = "ToggleGRAV"
ToggleGRAV.Parent = AimwareGRAVPage
ToggleGRAV.BackgroundColor3 = Color3.new(1, 1, 1)
ToggleGRAV.BackgroundTransparency = 1
ToggleGRAV.BorderSizePixel = 0
ToggleGRAV.Position = UDim2.new(0, 0, 0, 5)
ToggleGRAV.Size = UDim2.new(0, 500, 0, 25)
ToggleGRAV.Font = Enum.Font.Code
ToggleGRAV.FontSize = Enum.FontSize.Size24
ToggleGRAV.Text = "Toggle Low Gravity"
ToggleGRAV.TextColor3 = Color3.new(1, 1, 1)
ToggleGRAV.TextSize = 22
ToggleGRAV.MouseButton1Down:connect(function()
if GRAVTOGGLE == false then
GRAVD.Visible = false
GRAVE.Visible = true
GRAVTOGGLE = true
game.workspace.Gravity = 45
else
GRAVD.Visible = true
GRAVE.Visible = false
GRAVTOGGLE = false
game.workspace.Gravity = 196.2
end
end)
GRAVBind.Name = "GRAVBind"
GRAVBind.Parent = AimwareGRAVPage
GRAVBind.BackgroundColor3 = Color3.new(1, 1, 1)
GRAVBind.BackgroundTransparency = 1
GRAVBind.BorderSizePixel = 0
GRAVBind.Position = UDim2.new(0, 0, 0, 35)
GRAVBind.Size = UDim2.new(0, 500, 0, 25)
GRAVBind.Font = Enum.Font.Code
GRAVBind.FontSize = Enum.FontSize.Size24
GRAVBind.Text = "Keybind"
GRAVBind.TextColor3 = Color3.new(1, 1, 1)
GRAVBind.TextSize = 22
AimwareSINKPage.Name = "AimwareSINKPage"
AimwareSINKPage.Parent = AimwareTitle
AimwareSINKPage.BackgroundColor3 = Color3.new(1, 1, 1)
AimwareSINKPage.BackgroundTransparency = 0.5
AimwareSINKPage.BorderColor3 = Color3.new(1, 1, 1)
AimwareSINKPage.BorderSizePixel = 0
AimwareSINKPage.Position = UDim2.new(0, 0, 0, 25)
AimwareSINKPage.Size = UDim2.new(0, 500, 0, 200)
AimwareSINKPage.Visible = false
ToggleSINK.Name = "ToggleSINK"
ToggleSINK.Parent = AimwareSINKPage
ToggleSINK.BackgroundColor3 = Color3.new(1, 1, 1)
ToggleSINK.BackgroundTransparency = 1
ToggleSINK.BorderSizePixel = 0
ToggleSINK.Position = UDim2.new(0, 0, 0, 5)
ToggleSINK.Size = UDim2.new(0, 500, 0, 25)
ToggleSINK.Font = Enum.Font.Code
ToggleSINK.FontSize = Enum.FontSize.Size24
ToggleSINK.Text = "Toggle Sink"
ToggleSINK.TextColor3 = Color3.new(1, 1, 1)
ToggleSINK.TextSize = 22
ToggleSINK.MouseButton1Down:connect(function()
if SINKTOGGLE == false then
SINKD.Visible = false
SINKE.Visible = true
SINKTOGGLE = true
game.Players.LocalPlayer.Character.Humanoid.Sit = true
else
SINKD.Visible = true
SINKE.Visible = false
SINKTOGGLE = false
game.Players.LocalPlayer.Character.Humanoid.Sit = false
end
end)
SINKBind.Name = "SINKBind"
SINKBind.Parent = AimwareSINKPage
SINKBind.BackgroundColor3 = Color3.new(1, 1, 1)
SINKBind.BackgroundTransparency = 1
SINKBind.BorderSizePixel = 0
SINKBind.Position = UDim2.new(0, 0, 0, 35)
SINKBind.Size = UDim2.new(0, 500, 0, 25)
SINKBind.Font = Enum.Font.Code
SINKBind.FontSize = Enum.FontSize.Size24
SINKBind.Text = "Keybind"
SINKBind.TextColor3 = Color3.new(1, 1, 1)
SINKBind.TextSize = 22
AimwareArray.Name = "AimwareArray"
AimwareArray.Parent = Aimware
AimwareArray.BackgroundColor3 = Color3.new(1.17647, 0, 0)
AimwareArray.BackgroundTransparency = 1
AimwareArray.BorderColor3 = Color3.new(1, 1, 1)
AimwareArray.BorderSizePixel = 0
AimwareArray.Size = UDim2.new(0, 138, 0, 25)
AimwareArray.Visible = false
ESPD.Name = "ESPD"
ESPD.Parent = AimwareArray
ESPD.BackgroundColor3 = Color3.new(1, 1, 1)
ESPD.BackgroundTransparency = 1
ESPD.BorderSizePixel = 0
ESPD.Position = UDim2.new(0, 4, 0, 25)
ESPD.Size = UDim2.new(0, 200, 0, 25)
ESPD.Font = Enum.Font.Code
ESPD.FontSize = Enum.FontSize.Size24
ESPD.Text = "ESP Disabled"
ESPD.TextColor3 = Color3.new(1, 0, 0)
ESPD.TextSize = 20
ESPD.TextXAlignment = Enum.TextXAlignment.Left
ESPE.Name = "ESPE"
ESPE.Parent = AimwareArray
ESPE.BackgroundColor3 = Color3.new(1, 1, 1)
ESPE.BackgroundTransparency = 1
ESPE.BorderSizePixel = 0
ESPE.Position = UDim2.new(0, 4, 0, 25)
ESPE.Size = UDim2.new(0, 200, 0, 25)
ESPE.Visible = false
ESPE.Font = Enum.Font.Code
ESPE.FontSize = Enum.FontSize.Size24
ESPE.Text = "ESP Enabled"
ESPE.TextColor3 = Color3.new(0, 1, 0.0980392)
ESPE.TextSize = 20
ESPE.TextXAlignment = Enum.TextXAlignment.Left
AimwareTop1.Name = "AimwareTop1"
AimwareTop1.Parent = AimwareArray
AimwareTop1.BackgroundColor3 = Color3.new(1, 1, 1)
AimwareTop1.BackgroundTransparency = 1
AimwareTop1.BorderSizePixel = 0
AimwareTop1.Position = UDim2.new(0, 4, 0, 0)
AimwareTop1.Size = UDim2.new(0, 132, 0, 25)
AimwareTop1.Font = Enum.Font.Code
AimwareTop1.FontSize = Enum.FontSize.Size24
AimwareTop1.Text = "Aimware v0.6.1"
AimwareTop1.TextColor3 = Color3.new(1, 0, 0)
AimwareTop1.TextSize = 22
AimwareTop1.TextXAlignment = Enum.TextXAlignment.Left
GRAVD.Name = "GRAVD"
GRAVD.Parent = AimwareArray
GRAVD.BackgroundColor3 = Color3.new(1, 1, 1)
GRAVD.BackgroundTransparency = 1
GRAVD.BorderSizePixel = 0
GRAVD.Position = UDim2.new(0, 4, 0, 65)
GRAVD.Size = UDim2.new(0, 200, 0, 25)
GRAVD.Font = Enum.Font.Code
GRAVD.FontSize = Enum.FontSize.Size24
GRAVD.Text = "Low Gravity Disabled"
GRAVD.TextColor3 = Color3.new(1, 0, 0)
GRAVD.TextSize = 20
GRAVD.TextXAlignment = Enum.TextXAlignment.Left
GRAVE.Name = "GRAVE"
GRAVE.Parent = AimwareArray
GRAVE.BackgroundColor3 = Color3.new(1, 1, 1)
GRAVE.BackgroundTransparency = 1
GRAVE.BorderSizePixel = 0
GRAVE.Position = UDim2.new(0, 4, 0, 65)
GRAVE.Size = UDim2.new(0, 200, 0, 25)
GRAVE.Visible = false
GRAVE.Font = Enum.Font.Code
GRAVE.FontSize = Enum.FontSize.Size24
GRAVE.Text = "Low Gravity Enabled"
GRAVE.TextColor3 = Color3.new(0, 1, 0.0980392)
GRAVE.TextSize = 20
GRAVE.TextXAlignment = Enum.TextXAlignment.Left
SINKE.Name = "SINKE"
SINKE.Parent = AimwareArray
SINKE.BackgroundColor3 = Color3.new(1, 1, 1)
SINKE.BackgroundTransparency = 1
SINKE.BorderSizePixel = 0
SINKE.Position = UDim2.new(0, 4, 0, 45)
SINKE.Size = UDim2.new(0, 200, 0, 25)
SINKE.Visible = false
SINKE.Font = Enum.Font.Code
SINKE.FontSize = Enum.FontSize.Size24
SINKE.Text = "Sink Enabled"
SINKE.TextColor3 = Color3.new(0, 1, 0.0980392)
SINKE.TextSize = 20
SINKE.TextXAlignment = Enum.TextXAlignment.Left
SINKD.Name = "SINKD"
SINKD.Parent = AimwareArray
SINKD.BackgroundColor3 = Color3.new(1, 1, 1)
SINKD.BackgroundTransparency = 1
SINKD.BorderSizePixel = 0
SINKD.Position = UDim2.new(0, 4, 0, 45)
SINKD.Size = UDim2.new(0, 200, 0, 25)
SINKD.Font = Enum.Font.Code
SINKD.FontSize = Enum.FontSize.Size24
SINKD.Text = "Sink Disabled"
SINKD.TextColor3 = Color3.new(1, 0, 0)
SINKD.TextSize = 20
SINKD.TextXAlignment = Enum.TextXAlignment.Left
AimwareIntro.Name = "AimwareIntro"
AimwareIntro.Parent = Aimware
AimwareIntro.BackgroundColor3 = Color3.new(1, 1, 1)
AimwareIntro.BackgroundTransparency = 1
AimwareIntro.BorderSizePixel = 0
AimwareIntro.Position = UDim2.new(0.449999988, 4, 0.400000006, 0)
AimwareIntro.Size = UDim2.new(0, 132, 0, 25)
AimwareIntro.Visible = false
AimwareIntro.Font = Enum.Font.Code
AimwareIntro.FontSize = Enum.FontSize.Size28
AimwareIntro.Text = "Aimware"
AimwareIntro.TextColor3 = Color3.new(1, 0, 0)
AimwareIntro.TextSize = 26
AimwareIntro.TextWrapped = true
AimwareIntro2.Name = "AimwareIntro2"
AimwareIntro2.Parent = Aimware
AimwareIntro2.BackgroundColor3 = Color3.new(1, 1, 1)
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro2.BorderSizePixel = 0
AimwareIntro2.Position = UDim2.new(0.379999995, 4, 0.430000007, 0)
AimwareIntro2.Size = UDim2.new(0, 300, 0, 25)
AimwareIntro2.Visible = false
AimwareIntro2.Font = Enum.Font.Code
AimwareIntro2.FontSize = Enum.FontSize.Size24
AimwareIntro2.Text = "One Step Ahead Of The Game"
AimwareIntro2.TextColor3 = Color3.new(1, 0, 0)
AimwareIntro2.TextSize = 22
AimwareIntro2.TextWrapped = true
wait(0.3)
AimwareIntro.Transparency = 1
AimwareIntro.BackgroundTransparency = 1
AimwareIntro.Visible = true
wait(0.1)
AimwareIntro.Transparency = 0.9
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro.Transparency = 0.8
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro.Transparency = 0.7
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro.Transparency = 0.6
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro.Transparency = 0.5
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro.Transparency = 0.4
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro.Transparency = 0.3
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro.Transparency = 0.2
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro.Transparency = 0.1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro.Transparency = 0
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 1
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro2.Visible = true
wait(0.1)
AimwareIntro2.Transparency = 0.9
AimwareIntro2.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.8
AimwareIntro2.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.7
AimwareIntro2.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.6
AimwareIntro2.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.5
AimwareIntro2.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.4
AimwareIntro2.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.3
AimwareIntro2.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.2
AimwareIntro2.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.1
AimwareIntro2.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0
AimwareIntro2.BackgroundTransparency = 1
wait(2)
AimwareIntro2.Transparency = 0.1
AimwareIntro.Transparency = 0.1
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.2
AimwareIntro.Transparency = 0.2
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.3
AimwareIntro.Transparency = 0.3
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.4
AimwareIntro.Transparency = 0.4
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.5
AimwareIntro.Transparency = 0.5
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.6
AimwareIntro.Transparency = 0.6
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.7
AimwareIntro.Transparency = 0.7
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.8
AimwareIntro.Transparency = 0.8
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 0.9
AimwareIntro.Transparency = 0.9
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
wait(0.1)
AimwareIntro2.Transparency = 1
AimwareIntro.Transparency = 1
AimwareIntro2.BackgroundTransparency = 1
AimwareIntro.BackgroundTransparency = 1
Key = game.Players.LocalPlayer:GetMouse()
function EnableMENU(key)
if (key == "=") then
if MENUTOGGLE == false then
AimwareTitle.Visible = true
MENUTOGGLE = true
else
AimwareTitle.Visible = false
MENUTOGGLE = false
end
end
end
Key.KeyDown:connect(EnableMENU)
function EnableSINK(key)
if (key == SINKBind.Text) then
if SINKTOGGLE == false then
SINKD.Visible = false
SINKE.Visible = true
SINKTOGGLE = true
game.Players.LocalPlayer.Character.Humanoid.Sit = true
else
SINKD.Visible = true
SINKE.Visible = false
SINKTOGGLE = false
game.Players.LocalPlayer.Character.Humanoid.Sit = false
end
end
end
Key.KeyDown:connect(EnableSINK)
function EnableGRAV(key)
if (key == GRAVBind.Text) then
if GRAVTOGGLE == false then
GRAVD.Visible = false
GRAVE.Visible = true
GRAVTOGGLE = true
game.workspace.Gravity = 45
else
GRAVD.Visible = true
GRAVE.Visible = false
GRAVTOGGLE = false
game.workspace.Gravity = 196.2
end
end
end
Key.KeyDown:connect(EnableGRAV)
function EnableARRAY(key)
if (key == ARRAYBind.Text) then
if ARRAYTOGGLE == false then
AimwareArray.Visible = true
ARRAYTOGGLE = true
else
AimwareArray.Visible = false
ARRAYTOGGLE = false
end
end
end
Key.KeyDown:connect(EnableARRAY)
function EnableESP(key)
if (key == ESPBind.Text) then
if ESPTOGGLE == false then
ESPTOGGLE = true
ESPD.Visible = false
ESPE.Visible = true
for i,v in pairs(game.Players:GetChildren()) do
if v.Character ~= game.Players.LocalPlayer.Character and v.Character.Head:FindFirstChild('ScreenGui') == nil then
if v.Character:FindFirstChild('Head') then
local bill = Instance.new('BillboardGui',v.Character.Head)
bill.Name = "thingyye"
bill.AlwaysOnTop = true
bill.Size = UDim2.new(2,1,2)
bill.Adornee = v.Character.Head
local txt = Instance.new('TextLabel',bill)
txt.Text = v.Name
txt.BackgroundTransparency = 1
txt.Size = UDim2.new(1,0,1,0)
txt.TextColor3 = v.TeamColor.Color
end
for a,c in pairs(v.Character:GetChildren()) do
if c.ClassName == "MeshPart" and c.Transparency ~= 1 then
doit(c)
elseif c.ClassName == "Part" and c.Transparency ~= 1 then
doit(c)
end
end
end
end
else
ESPTOGGLE = false
ESPD.Visible = true
ESPE.Visible = false
for i,v in pairs(game.Players:GetChildren()) do
undo(v.Character)
end
end
end
end
Key.KeyDown:connect(EnableESP)
function doit(hey)
local t1 = Instance.new('SurfaceGui',hey)
t1.AlwaysOnTop = true
local t1g = Instance.new('Frame',t1)
t1g.Size = UDim2.new(1,0,1,0)
t1g.BackgroundColor3 = t1.Parent.BrickColor.Color
local t2 = Instance.new('SurfaceGui',hey)
t2.AlwaysOnTop = true
t2.Face = Enum.NormalId.Right
local t2g = Instance.new('Frame',t2)
t2g.Size = UDim2.new(1,0,1,0)
t2g.BackgroundColor3 = t2.Parent.BrickColor.Color
local t3 = Instance.new('SurfaceGui',hey)
t3.AlwaysOnTop = true
t3.Face = Enum.NormalId.Left
local t3g = Instance.new('Frame',t3)
t3g.Size = UDim2.new(1,0,1,0)
t3g.BackgroundColor3 = t3.Parent.BrickColor.Color
local t4 = Instance.new('SurfaceGui',hey)
t4.AlwaysOnTop = true
t4.Face = Enum.NormalId.Back
local t4g = Instance.new('Frame',t4)
t4g.Size = UDim2.new(1,0,1,0)
t4g.BackgroundColor3 = t4.Parent.BrickColor.Color
local t5 = Instance.new('SurfaceGui',hey)
t5.AlwaysOnTop = true
t5.Face = Enum.NormalId.Top
local t5g = Instance.new('Frame',t5)
t5g.Size = UDim2.new(1,0,1,0)
t5g.BackgroundColor3 = t5.Parent.BrickColor.Color
local t6 = Instance.new('SurfaceGui',hey)
t6.AlwaysOnTop = true
t6.Face = Enum.NormalId.Bottom
local t6g = Instance.new('Frame',t6)
t6g.Size = UDim2.new(1,0,1,0)
t6g.BackgroundColor3 = t6.Parent.BrickColor.Color
end
function undo(chr)
for i,v in pairs(chr:GetChildren()) do
if v.ClassName == "Part" or v.ClassName == "MeshPart" then
for a,c in pairs(v:GetChildren()) do
if c.ClassName == "SurfaceGui" then
c:Destroy()
end
if c.ClassName == "BillboardGui" and c.Name == "thingyye" then
c:Destroy()
end
end
end
end
end
|
bristleback_bristleback_lua = class({})
LinkLuaModifier( "modifier_bristleback_bristleback_lua", "lua_abilities/bristleback_bristleback_lua/modifier_bristleback_bristleback_lua", LUA_MODIFIER_MOTION_NONE )
--------------------------------------------------------------------------------
-- Passive Modifier
function bristleback_bristleback_lua:GetIntrinsicModifierName()
return "modifier_bristleback_bristleback_lua"
end
|
-----------------------------------
-- Area: Dynamis - Xarcabard
-- Mob: Animated Spear
-----------------------------------
require("scripts/globals/status")
local ID = require("scripts/zones/Dynamis-Xarcabard/IDs")
-----------------------------------
function onMobEngaged(mob, target)
if (mob:AnimationSub() == 3) then
SetDropRate(114, 1578, 1000)
else
SetDropRate(114, 1578, 0)
end
target:showText(mob, ID.text.ANIMATED_SPEAR_DIALOG)
SpawnMob(17330423):updateEnmity(target)
SpawnMob(17330424):updateEnmity(target)
SpawnMob(17330425):updateEnmity(target)
SpawnMob(17330435):updateEnmity(target)
SpawnMob(17330436):updateEnmity(target)
SpawnMob(17330437):updateEnmity(target)
end
function onMobFight(mob, target)
-- TODO: add battle dialog
end
function onMobDisengage(mob)
mob:showText(mob, ID.text.ANIMATED_SPEAR_DIALOG+2)
end
function onMobDeath(mob, player, isKiller)
player:showText(mob, ID.text.ANIMATED_SPEAR_DIALOG+1)
DespawnMob(17330423)
DespawnMob(17330424)
DespawnMob(17330425)
DespawnMob(17330435)
DespawnMob(17330436)
DespawnMob(17330437)
end
|
local EnterName, EnterPassword, EnterSecurityQuestionAnswer
Citizen.CreateThread(function() --Login Menu
local SelectedSecurityQuestion = 1
while true do
local SecurityQuestions = {SecurityQuestion1, SecurityQuestion2, SecurityQuestion3, SecurityQuestion4}
if loginMenu then
if not IsDisabledControlPressed(1, 173) and not IsDisabledControlPressed(1, 172) then
currentOption = lastSelectionloginMenu
else
lastSelectionloginMenu = currentOption
end
TriggerEvent("FMODT:Title", "~y~" .. LoginMenuTitle)
TriggerEvent("FMODT:Option", "~y~" .. UsernameTitle .. ": ~s~" .. Username, function(cb)
if (cb) then
EnterName = true
end
end)
TriggerEvent("FMODT:Option", "~y~" .. PasswordTitle .. ": ~s~" .. Password, function(cb)
if (cb) then
EnterPassword = true
end
end)
TriggerEvent("FMODT:Option", LoginMenuTitle, function(cb)
if (cb) then
if Username ~= "" and Password ~= "" then
TriggerServerEvent("FMODT:Login", Username, Password)
else
drawNotification("~r~" .. LoginErrorMessage .. "!")
end
end
end)
TriggerEvent("FMODT:Option", "~r~" .. ResetPasswordTitle, function(cb)
if (cb) then
if Username ~= "" then
TriggerServerEvent("FMODT:ResetPassword", false, Username, "")
else
drawNotification("~r~" .. ResetPasswordErrorMessage .. "!")
end
end
end)
TriggerEvent("FMODT:Option", "~y~>> ~s~" .. RegisterMenuTitle, function(cb)
if (cb) then
loginMenu = false
Username = ""
Password = ""
registerMenu = true
end
end)
TriggerEvent("FMODT:StringArray", LanguageTitle .. ": ", Languages, SelectedLanguage, function(cb)
SelectedLanguage = cb
end)
TriggerEvent("FMODT:Update")
elseif registerMenu then
if not IsDisabledControlPressed(1, 173) and not IsDisabledControlPressed(1, 172) then
currentOption = lastSelectionregisterMenu
else
lastSelectionregisterMenu = currentOption
end
TriggerEvent("FMODT:Title", "~y~" .. RegisterMenuTitle)
TriggerEvent("FMODT:Option", "~y~" .. UsernameTitle .. ": ~s~" .. Username, function(cb)
if (cb) then
EnterName = true
end
end)
TriggerEvent("FMODT:Option", "~y~" .. PasswordTitle .. ": ~s~" .. Password, function(cb)
if (cb) then
EnterPassword = true
end
end)
TriggerEvent("FMODT:Int", SecurityQuestions[SelectedSecurityQuestion], SelectedSecurityQuestion, 1, tablelength(SecurityQuestions), function(cb)
SelectedSecurityQuestion = cb
end)
TriggerEvent("FMODT:Option", "~y~" .. SecurityQuestionAnswerTitle .. ": ~s~" .. SecurityQuestionAnswer, function(cb)
if (cb) then
EnterSecurityQuestionAnswer = true
end
end)
TriggerEvent("FMODT:Option", RegisterMenuTitle, function(cb)
if (cb) then
if Username ~= "" and Password ~= "" and SecurityQuestionAnswer ~= "" then
TriggerServerEvent("FMODT:Register", Username, Password, SecurityQuestions[SelectedSecurityQuestion], SecurityQuestionAnswer)
else
drawNotification("~r~" .. LoginRegisterErrorMessage .. "!")
end
end
end)
TriggerEvent("FMODT:Option", "~y~>> ~s~" .. LoginMenuTitle, function(cb)
if (cb) then
registerMenu = false
Username = ""
Password = ""
loginMenu = true
end
end)
TriggerEvent("FMODT:StringArray", LanguageTitle .. ": ", Languages, SelectedLanguage, function(cb)
SelectedLanguage = cb
end)
TriggerEvent("FMODT:Update")
end
Citizen.Wait(0)
end
end)
Citizen.CreateThread(function() --Enter Name / Password
local result
while true do
Citizen.Wait(0)
if EnterName then
local result = KeyboardInput(UsernameTitle, Username, 16, false)
if result ~= nil then
if result:len() >= 3 and not result:match("%W") then
Username = result
EnterName = false
else
drawNotification("~r~" .. NameInvalidMessage .. "!")
end
else
EnterName = false
end
elseif EnterPassword then
local result = KeyboardInput(PasswordTitle, Password, 30, false)
if result ~= nil then
if result:len() >= 6 then
Password = result
EnterPassword = false
else
drawNotification("~r~" .. PasswordTooShortMessage .. "!")
end
else
EnterPassword = false
end
elseif EnterSecurityQuestionAnswer then
local result = KeyboardInput(SecurityQuestionAnswerKeyboardMessage, SecurityQuestionAnswer, 16, false)
if result ~= nil then
if result:len() >= 3 then
SecurityQuestionAnswer = result
EnterSecurityQuestionAnswer = false
end
else
EnterSecurityQuestionAnswer = false
end
end
end
end)
AddEventHandler("FMODT:RegisterClient", function(Registered)
if Registered then
drawNotification("~g~" .. RegisterSuccessMessage .. "!")
registerMenu = false
lastSelectionloginMenu = 3
loginMenu = true
else
drawNotification("~r~" .. RegisterFailMessage .. "!")
end
end)
AddEventHandler("FMODT:LoginClient", function(LoggedIn)
if LoggedIn then
TriggerServerEvent("FMODT:RecoverOldSaves")
TriggerServerEvent("FMODT:GetOutfitNames")
TriggerServerEvent("FMODT:GetVehicleNames")
TriggerServerEvent("FMODT:LoadSettings")
TriggerServerEvent("FMODT:GetAddOnVehicles")
drawNotification("~g~" .. LoginSuccessMessage .. "!")
loggedIn = true
loginMenu = false
mainMenu = true
else
drawNotification("~r~" .. LoginFailMessage .. "!")
end
end)
AddEventHandler("FMODT:GotSecurityQuestion", function(SecurityQuestion)
local SecurityQuestionAnswer = ""
local result = KeyboardInput(SecurityQuestion, SecurityQuestionAnswer, 16, false)
if result ~= nil then
if not result:match("%W") then
SecurityQuestionAnswer = result
TriggerServerEvent("FMODT:ResetPassword", true, Username, SecurityQuestionAnswer)
EnterSecurityQuestionAnswer = false
end
else
EnterSecurityQuestionAnswer = false
end
end)
AddEventHandler("FMODT:ChangingPasswordClient", function(State)
if State then
local Password = ""
local result = KeyboardInput(ChangePasswordKeyboardMessage, Password, 30, false)
if result ~= nil then
if result:len() >= 6 then
Password = result
drawNotification("~g~" .. ChangePasswordSuccessMessage .. "!")
ChangePassword = false
TriggerServerEvent("FMODT:ChangePassword", Password)
else
drawNotification("~r~" .. PasswordTooShortMessage .. "!")
end
else
ChangePassword = false
end
else
drawNotification("~r~" .. SecurityQuestionAnswerWrongMessage .. "!")
end
end)
|
local Class = require("lib.class")
local Lovox = require("lib.lovox")
local Entity = require("src.entity")
local World = require("src.world")
local Chain = Class("Chain", Entity)
Chain.batch = require("src.wallprop")
function Chain:initialize(...)
Entity.initialize(self, ...)
self.id = Chain.batch:add(self.position.x, self.position.y, self.position.z, self.rotation, 2)
end
function Chain.render()
Chain.batch:draw()
end
return Chain
|
setreadonly(math, false)
function send(msg)
local args = {
[1] = tostring(msg), -- just in case trol
[2] = "All"
}
game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(unpack(args))
end
function ShutdownServer(msg)
game:Shutdown(tostring(msg))
end
function GetFreeAdmin()
while true do end
end
function BanPlayer()
local LocalPlayer = game.Players.LocalPlayer
LocalPlayer:Kick("You have been banned from this game: We have detected hacks in your client.")
end
function GetBraincells()
print("Braincells:" .. tostring(math.random(1, 3)))
end
function LoadDislike()
loadstring(game:HttpGet(('https://raw.githubusercontent.com/jnz-dev/leaks_and_whatnot/main/Leaks-Loader.lua'),true))()
end
function GetLocalPlayer()
return game.Players.LocalPlayer
end
function GetALife()
error("Not possible.")
end
function HowBadIsMyExploit()
if not syn then return "dogwater exploit" else return "good exploit" end
end
function math.IcePools(age)
if age <= 13 and age > 0 then
return "Good, You have identified the minor."
elseif age < 0 then
return "Way too minor."
else
return "Return, We are pedophiles, not idiots."
end
function __secureeq(a,b)
return (a == b) and (b == a) and (b == b) and (a == a)
print("Made by Thurau#1307 !!! nobody else made this so secure thing")
end
end
function MoonsecDeobfuscator(script)
print("Deobfuscated & copied to clipboard")
setclipboard("buy LD for cheap deobfuscation")
end
|
-- MIT License
--
-- Copyright (c) 2021 mmoole.
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
Importer{
version = 0.10,
format = "CSV (MoneyWallet)",
fileExtension = "csv",
description = MM.localizeText("Import CSV file exported from MoneyWallet App")
}
-- needs these columns in any order in the CSV file - leave empty if n/a, can have additional columns, and , as delimiter:
-- the format that gets exported from MoneyWallet:
-- "wallet","currency","category","datetime","money","description","event","people","place","note"
-- datetime (String) (mandatory value): is in yyyy-MM-DD hh:mm:ss by default
-- category (String): category name - only the displayed sub-category (i.e. if you have astructure like `assets - money1 then just `money1`). If you want to create categories quickly, then export, edit and then import a csv file using the default im/exporter of MM. You can specify hierachical categories with `- `as delimiter.
-- if using subcategories, then `:` is interpreted as delimiter (this means that : can no longer be used in titles of categories).
-- Example: `Expenses:category1:Eating out` -> only `Eating out` is treated as category for import.
-- people (String): name of the sender/payee
-- money (Number) (mandatory value): amount of transfer in numbers, decimal marker must be . (not ,)
-- currency (String): currency
-- description (String): purpose text, multiple lines can be created by using line breaks ("\n"), usually up to 140 characters
-- event (String): event field
-- place (String): place field
-- note (String): note field
-- these fields would be fine if they existed in MoneyWallet:
-- accountNumber (String): account number or IBAN of the sender/payee,
-- bankCode (String): bank code or BIC of sender/payee, usually 8 or 11 characters
-- bookingText (String): kind of booking, can be one similar to: Überweisung, Lastschrift, Dauerauftrag, Lohn/Gehalt/Rente, Dividende, Kartenzahlung V Pay // english: Credit transfer, Direct debit, standing order, Card payment, ...
-- include https://github.com/FourierTransformer/ftcsv (MIT License)
local ftcsv = require('ftcsv')
-- inspect only used for dev / debug
-- local inspect = require('inspect')
-- print(inspect(line))
local function strToDate (str)
-- Helper function for converting localized date strings to timestamps.
-- print("strToDate from: ", str)
local y, m, d, H, M, S = string.match(str, "(%d%d%d%d)-(%d%d)-(%d%d) (%d%d):(%d%d):(%d%d)")
if (d and m and y) then
return os.time({year = y, month = m, day = d, hour = H, minute = M, seconds = S })
else
print("could not parse date from string: ", str)
return nil
end
end
function numbercomma_to_value(n)
-- print("n is: ", n)
local numberdot = string.gsub(n, '%,', '.')
return numberdot
end
function trimcategory(cat)
-- print("cat is: ", cat)
local trimmed = cat
if string.match(cat, '.*%:.*') then
trimmed = string.match(cat, '.*%:(.*)$')
end
return trimmed
end
function ReadTransactions (account)
print("import script CSV (MoneyWallet) importing whole file to the account, reading: ", io.filename)
print("this script requires ftcsv.lua from https://github.com/FourierTransformer/ftcsv (MIT License)")
-- declare the table for MM
local transactions = {}
-- Read transactions from a file with the delimiter as specified
for i, line in ftcsv.parseLine(io.filename, ",") do
-- debug / info output
-- print("debugline: ", inspect(line))
print("line: ", line.wallet, line.category, line.datetime, numbercomma_to_value(line.money), line.currency, line.description )
-- wallet,currency,category,datetime,money,description,event,people,place,note
comment_full = ''
if line.note ~= "" then
comment_full = comment_full .. line.note
end
if line.event ~= "" then
comment_full = comment_full .. " Event: " .. line.event
end
if line.place ~= "" then
comment_full = comment_full .. " Place: " .. line.place
end
local transaction = {
amount = numbercomma_to_value(line.money),
bookingDate = strToDate(line.datetime),
category = trimcategory(line.category),
comment = comment_full,
currency = line.currency,
name = line.people,
purpose = line.description
-- bookingText = line.bookingText,
-- accountNumber = line.accountNumber,
-- bankCode = line.bankCode
}
--print("debugtransaction: ", inspect(transaction))
table.insert(transactions, transaction)
end
print("import script finished.")
return transactions
end
|
local AddonName, AddonTable = ...
AddonTable.enchanting = {
-- Reagents
172437, -- Enchanted Elethium Bar
172438, -- Enchanted Heavy Callous Hide
172439, -- Enchanted Lightless Silk
-- Materials
172230, -- Soul Dust
172231, -- Sacred Shard
172232, -- Eternal Crystal
-- Ring Enchants
172362, -- Enchant Ring - Tenet of Haste
172364, -- Enchant Ring - Tenet of Versatility
-- Weapon Enchants
172366, -- Enchant Weapon - Celestial Guidance
172368, -- Enchant Weapon - Sinful Revelation
-- Glove Enchants
172407, --Enchant Gloves - Strength of Soul
-- Wands
172462, -- Enchanted Twilight Wand
-- Enchanted Vellums
172358, -- Enchant Ring - Bargain of Haste
172360, -- Enchant Ring - Bargain of Versatility
177716, -- Enchant Chest - Sacred Stats
177660, -- Enchant Cloak - Soul Vitality
183738, -- Enchant Chest - Eternal Insight
}
|
local AddonName, AddonTable = ...
-- BfA Herbalism
AddonTable.herbalism = {
152505, -- Riverbud
152506, -- Star Moss
152507, -- Akunda's Bite
152508, -- Winter's Kiss
152509, -- Siren's Pollen
152510, -- Anchor Weed
152511, -- Sea Stalk
-- 8.3
168487, -- Zin'anthid
}
|
local uri = {}
local urifuncs = {}
local urimt = {}
local php
local util = require 'libraryUtil'
local checkType = util.checkType
local checkTypeForIndex = util.checkTypeForIndex
function uri.setupInterface( options )
-- Boilerplate
uri.setupInterface = nil
php = mw_interface
mw_interface = nil
-- Store options
php.options = options
-- Register this library in the "mw" global
mw = mw or {}
mw.uri = uri
package.loaded['mw.uri'] = uri
end
local function rawencode( s, space )
space = space or '%20'
local ret = string.gsub( s, '([^a-zA-Z0-9_.~-])', function ( c )
if c == ' ' then
return space
else
return string.format( '%%%02X', string.byte( c, 1, 1 ) )
end
end );
return ret
end
local function wikiencode( s )
local ret = string.gsub( s, '([^a-zA-Z0-9!$()*,./:;@~_-])', function ( c )
if c == ' ' then
return '_'
else
return string.format( '%%%02X', string.byte( c, 1, 1 ) )
end
end );
return ret
end
local function rawdecode( s )
local ret = string.gsub( s, '%%(%x%x)', function ( hex )
return string.char( tonumber( hex, 16 ) )
end );
return ret
end
function uri.encode( s, enctype )
checkType( 'encode', 1, s, 'string' )
enctype = string.upper( enctype or 'QUERY' )
if enctype == 'QUERY' then
return rawencode( s, '+' )
elseif enctype == 'PATH' then
return rawencode( s, '%20' )
elseif enctype == 'WIKI' then
return wikiencode( s )
else
error( "bad argument #2 to 'encode' (expected QUERY, PATH, or WIKI)", 2 )
end
end
function uri.decode( s, enctype )
checkType( 'decode', 1, s, 'string' )
enctype = string.upper( enctype or 'QUERY' )
if enctype == 'QUERY' then
return rawdecode( string.gsub( s, '%+', ' ' ) )
elseif enctype == 'PATH' then
return rawdecode( s )
elseif enctype == 'WIKI' then
return rawdecode( string.gsub( s, '_', ' ' ) )
else
error( "bad argument #2 to 'decode' (expected QUERY, PATH, or WIKI)", 2 )
end
end
function uri.anchorEncode( s )
checkType( 'anchorEncode', 1, s, 'string' )
return php.anchorEncode( s )
end
function uri.localUrl( page, query )
checkType( 'localurl', 1, page, 'string' )
if query ~= nil and type( query ) ~= 'string' and type( query ) ~= 'table' then
checkType( 'localurl', 2, query, 'string or table' )
end
local url = php.localUrl( page, query )
if not url then
return nil
end
return uri.new( url )
end
function uri.fullUrl( page, query )
checkType( 'fullurl', 1, page, 'string' )
if query ~= nil and type( query ) ~= 'string' and type( query ) ~= 'table' then
checkType( 'fullurl', 2, query, 'string or table' )
end
local url = php.fullUrl( page, query )
if not url then
return nil
end
return uri.new( url )
end
function uri.canonicalUrl( page, query )
checkType( 'canonicalurl', 1, page, 'string' )
if query ~= nil and type( query ) ~= 'string' and type( query ) ~= 'table' then
checkType( 'canonicalurl', 2, query, 'string or table' )
end
local url = php.canonicalUrl( page, query )
if not url then
return nil
end
return uri.new( url )
end
function uri.new( s )
if s == nil or type( s ) == 'string' then
local obj = {
-- Yes, technically all this does nothing.
protocol = nil,
user = nil,
password = nil,
host = nil,
port = nil,
path = nil,
query = nil,
fragment = nil,
}
setmetatable( obj, urimt )
obj:parse( s or php.options.defaultUrl )
return obj
elseif type( s ) == 'table' then
local obj = {
protocol = s.protocol,
user = s.user,
password = s.password,
host = s.host,
port = s.port,
path = s.path,
query = mw.clone( s.query ),
fragment = s.fragment,
}
setmetatable( obj, urimt )
return obj
else
checkType( 'new', 1, s, 'string or table or nil' )
end
end
function uri.validate( obj )
checkType( 'validate', 1, obj, 'table' )
local err = {}
if obj.protocol then
if type( obj.protocol ) ~= 'string' then
err[#err+1] = '.protocol must be a string, not ' .. type( obj.protocol )
elseif not string.match( obj.protocol, '^[^:/?#]+$' ) then
err[#err+1] = 'invalid .protocol'
end
end
if obj.user then
if type( obj.user ) ~= 'string' then
err[#err+1] = '.user must be a string, not ' .. type( obj.user )
elseif not string.match( obj.user, '^[^:@/?#]*$' ) then
err[#err+1] = 'invalid .user'
end
end
if obj.password then
if type( obj.password ) ~= 'string' then
err[#err+1] = '.password must be a string, not ' .. type( obj.password )
elseif not string.match( obj.password, '^[^:@/?#]*$' ) then
err[#err+1] = 'invalid .password'
end
end
if obj.host then
if type( obj.host ) ~= 'string' then
err[#err+1] = '.host must be a string, not ' .. type( obj.host )
elseif not string.match( obj.host, '^[^:/?#]*$' ) then
err[#err+1] = 'invalid .host'
end
end
if obj.port then
if type( obj.port ) ~= 'number' or math.floor( obj.port ) ~= obj.port then
err[#err+1] = '.port must be an integer, not ' .. type( obj.port )
elseif obj.port < 1 or obj.port > 65535 then
err[#err+1] = 'invalid .port'
end
end
local authority = obj.user or obj.password or obj.host or obj.port
if not obj.path then
err[#err+1] = 'missing .path'
elseif type( obj.path ) ~= 'string' then
err[#err+1] = '.path must be a string, not ' .. type( obj.path )
elseif authority and not ( obj.path == '' or string.match( obj.path, '^/[^?#]*$' ) ) then
err[#err+1] = 'invalid .path'
elseif not authority and not (
obj.path == '' or
obj.path == '/' or
string.match( obj.path, '^/[^?#/][^?#]*$' ) or
obj.protocol and string.match( obj.path, '^[^?#/][^?#]*$' ) or
not obj.protocol and string.match( obj.path, '^[^?#/:]+$' ) or
not obj.protocol and string.match( obj.path, '^[^?#/:]+/[^?#]*$' )
) then
err[#err+1] = 'invalid .path'
end
if obj.query and type( obj.query ) ~= 'table' then
err[#err+1] = '.query must be a table, not ' .. type( obj.query )
end
if obj.fragment and type( obj.fragment ) ~= 'string' then
err[#err+1] = '.fragment must be a string, not ' .. type( obj.fragment )
end
return #err == 0, table.concat( err, '; ' )
end
-- Lua tables are unsorted, but we want to preserve the insertion order.
-- So, track the insertion order explicitly.
local function makeQueryTable()
local ret = {}
local keys = {}
local seenkeys = {}
setmetatable( ret, {
__newindex = function ( t, k, v )
if seenkeys[k] and not t[k] then
for i = 1, #keys do
if keys[i] == k then
table.remove( keys, i )
break
end
end
end
seenkeys[k] = 1
keys[#keys+1] = k
rawset( t, k, v )
end,
__pairs = function ( t )
local i, l = 0, #keys
return function ()
while i < l do
i = i + 1
local k = keys[i]
if t[k] ~= nil then
return k, t[k]
end
end
return nil
end
end
} )
return ret
end
function uri.parseQueryString( s, i, j )
checkType( 'parseQueryString', 1, s, 'string' )
checkType( 'parseQueryString', 2, i, 'number', true )
checkType( 'parseQueryString', 3, j, 'number', true )
s = string.gsub( string.sub( s, i or 1, j or -1 ), '%+', ' ' )
i = 1
j = string.len( s )
local qs = makeQueryTable()
if string.sub( s, i, 1 ) == '?' then
i = i + 1
end
while i <= j do
local amp = string.find( s, '&', i, true )
if not amp or amp > j then
amp = j + 1
end
local eq = string.find( s, '=', i, true )
local k, v
if not eq or eq > amp then
k = rawdecode( string.sub( s, i, amp - 1 ) )
v = false
else
k = rawdecode( string.sub( s, i, eq - 1 ) )
v = rawdecode( string.sub( s, eq + 1, amp - 1 ) )
end
if qs[k] then
if type( qs[k] ) ~= 'table' then
qs[k] = { qs[k], v }
else
table.insert( qs[k], v )
end
else
qs[k] = v
end
i = amp + 1
end
return qs
end
function uri.buildQueryString( qs )
checkType( 'buildQueryString', 1, qs, 'table' )
local t = {}
for k, v in pairs( qs ) do
if type( v ) ~= 'table' then
v = { v }
end
for i = 1, #v do
t[#t+1] = '&'
t[#t+1] = rawencode( k, '+' )
if v[i] then
t[#t+1] = '='
t[#t+1] = rawencode( v[i], '+' )
end
end
end
return table.concat( t, '', 2 )
end
-- Fields mapped to whether they're handled by __index
local knownFields = {
protocol = false,
user = false,
password = false,
host = false,
port = false,
path = false,
query = false,
fragment = false,
userInfo = true,
hostPort = true,
authority = true,
queryString = true,
relativePath = true,
}
local function pairsfunc( t, k )
local v, f
repeat
k, f = next( knownFields, k )
if k == nil then
return nil
end
if f then
v = t[k]
else
v = rawget( t, k )
end
until v ~= nil
return k, v
end
function urimt:__pairs()
return pairsfunc, self, nil
end
function urimt:__index( key )
if urifuncs[key] then
return urifuncs[key]
end
if key == 'userInfo' then
local user = rawget( self, 'user' )
local password = rawget( self, 'password' )
if user and password then
return user .. ':' .. password
else
return user
end
end
if key == 'hostPort' then
local host = rawget( self, 'host' )
local port = rawget( self, 'port' )
if port then
return ( host or '' ) .. ':' .. port
else
return host
end
end
if key == 'authority' then
local info = self.userInfo
local hostPort = self.hostPort
if info then
return info .. '@' .. ( hostPort or '' )
else
return hostPort
end
end
if key == 'queryString' then
local query = rawget( self, 'query' )
if not query then
return nil
end
return uri.buildQueryString( query )
end
if key == 'relativePath' then
local ret = rawget( self, 'path' ) or ''
local qs = self.queryString
if qs then
ret = ret .. '?' .. qs
end
local fragment = rawget( self, 'fragment' )
if fragment then
ret = ret .. '#' .. fragment
end
return ret
end
return nil
end
function urimt:__newindex( key, value )
if key == 'userInfo' then
local user, password = nil, nil
if value then
checkTypeForIndex( key, value, 'string' )
local i = string.find( value, ':', 1, true )
if i then
user = string.sub( value, 1, i - 1 )
password = string.sub( value, i + 1 )
else
user = value
end
end
rawset( self, 'user', user )
rawset( self, 'password', password )
return
end
if key == 'hostPort' then
local host, port = nil, nil
if value then
checkTypeForIndex( key, value, 'string' )
local i = string.find( value, ':', 1, true )
if i then
host = string.sub( value, 1, i - 1 )
port = tonumber( string.sub( value, i + 1 ) )
if not port then
error( string.format( "Invalid port in '%s'", value ), 2 )
end
else
host = value
end
end
rawset( self, 'host', host )
rawset( self, 'port', port )
return
end
if key == 'authority' then
if value then
checkTypeForIndex( key, value, 'string' )
local i = string.find( value, '@', 1, true )
if i then
self.userInfo = string.sub( value, 1, i - 1 )
self.hostPort = string.sub( value, i + 1 )
else
self.userInfo = nil
self.hostPort = value
end
else
self.userInfo = nil
self.hostPort = nil
end
return
end
if key == 'queryString' then
if value then
checkTypeForIndex( key, value, 'string' )
rawset( self, 'query', uri.parseQueryString( value ) )
else
rawset( self, 'query', nil )
end
return
end
if key == 'relativePath' then
local path, query, fragment = nil, nil, nil
if value then
checkTypeForIndex( key, value, 'string' )
local i, j = nil, string.len( value )
i = string.find( value, '#', 1, true )
if i and i <= j then
fragment = string.sub( value, i + 1, j )
j = i - 1
end
i = string.find( value, '?', 1, true )
if i and i <= j then
query = uri.parseQueryString( string.sub( value, i + 1, j ) )
j = i - 1
end
path = string.sub( value, 1, j )
end
rawset( self, 'path', path )
rawset( self, 'query', query )
rawset( self, 'fragment', fragment )
return
end
if knownFields[key] then
error( "index '" .. key .. "' is read only", 2 )
end
-- Default behavior
knownFields[key] = false
rawset( self, key, value )
end
function urimt:__tostring()
local ret = ''
local protocol = self.protocol
local authority = self.authority
if protocol then
ret = protocol .. ':'
end
if authority then
ret = ret .. '//' .. authority
end
return ret .. self.relativePath
end
urifuncs.validate = uri.validate
function urifuncs:parse( s )
checkType( 'uri:parse', 1, s, 'string' )
-- Since Lua's patterns can't do (...)?, we have to try with and without each part.
local protocol, authority, relativePath = string.match( s, '^([^:/?#]+)://([^/?#]*)(.*)$' )
if not ( protocol or authority or relativePath ) then
authority, relativePath = string.match( s, '^//([^/?#]*)(.*)$' )
end
if not ( protocol or authority or relativePath ) then
protocol, relativePath = string.match( s, '^([^:/?#]+):(.*)$' )
end
if not ( protocol or authority or relativePath ) then
relativePath = s
end
-- Parse it into a temporary object, so if there's an error we didn't break the real one
local tmp = { protocol = protocol }
setmetatable( tmp, urimt )
if not pcall( urimt.__newindex, tmp, 'authority', authority ) then
error( 'Invalid port number in string', 2 )
end
tmp.relativePath = relativePath
-- Check for validity
local ok, err = uri.validate( tmp )
if not ok then
error( err, 2 )
end
-- Merge in fields
if tmp.protocol then
self.protocol = tmp.protocol
end
if tmp.user or tmp.password then
self.user, self.password = tmp.user, tmp.password
end
if tmp.host then
self.host = tmp.host
end
if tmp.port then
self.port = tmp.port
end
if tmp.path then
self.path = tmp.path
end
if tmp.query then
self.query = tmp.query
end
if tmp.fragment then
self.fragment = tmp.fragment
end
return self
end
function urifuncs:clone()
return uri.new( self )
end
function urifuncs:extend( parameters )
checkType( 'uri:extend', 1, parameters, 'table' )
local query = self.query
if not query then
query = makeQueryTable()
self.query = query
end
for k, v in pairs( parameters ) do
query[k] = v
end
return self
end
-- Add all urifuncs as known fields
for k in pairs( urifuncs ) do
knownFields[k] = true
end
return uri
|
class("ExerciseCountRecoverUpCommand", pm.SimpleCommand).execute = function (slot0, slot1)
slot3 = getProxy(MilitaryExerciseProxy)
slot4 = slot3.getSeasonInfo(slot3)
slot4:updateResetTime(slot2() + pg.TimeMgr.GetInstance():GetServerTime())
slot4:updateExerciseCount(SeasonInfo.RECOVER_UP_COUNT)
slot3:updateSeasonInfo(slot4)
slot3:addRefreshCountTimer()
end
return class("ExerciseCountRecoverUpCommand", pm.SimpleCommand)
|
local Browser =
{
Name = "Browser",
Type = "System",
Namespace = "C_Browser",
Functions =
{
},
Events =
{
{
Name = "SimpleBrowserWebError",
Type = "Event",
LiteralName = "SIMPLE_BROWSER_WEB_ERROR",
Payload =
{
{ Name = "errorCode", Type = "number", Nilable = false },
},
},
{
Name = "SimpleBrowserWebProxyFailed",
Type = "Event",
LiteralName = "SIMPLE_BROWSER_WEB_PROXY_FAILED",
},
{
Name = "SimpleCheckoutClosed",
Type = "Event",
LiteralName = "SIMPLE_CHECKOUT_CLOSED",
},
},
Tables =
{
},
};
APIDocumentation:AddDocumentationTable(Browser);
|
--甲板守卫者
local m=14010084
local cm=_G["c"..m]
function cm.initial_effect(c)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,cm.matfilter,1,1)
--cannot attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetTarget(cm.catg)
e1:SetValue(1)
c:RegisterEffect(e1)
--Shuffle your Deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(cm.shcon)
e2:SetOperation(cm.shop)
c:RegisterEffect(e2)
end
function cm.matfilter(c)
return c:IsDefensePos() and c:IsFaceup()
end
function cm.catg(e,c)
return e:GetHandler()==c or e:GetHandler():GetLinkedGroup():IsContains(c)
end
function cm.shcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function cm.shop(e,tp,eg,ep,ev,re,r,rp)
Duel.ShuffleDeck(tp)
end
|
laser = class:new()
function laser:init(x, y, dir)
self.x = x-1/8
self.y = y-1/8
self.dir = dir
self.active = true
self.static = false
self.gravity = 0
self.speedy = 0
self.speedx = 0
self.width = 1/4
self.height = 1/4
if self.dir == "right" then
self.speedx = laserspeed
self.width = 1
self.x = self.x - 3/8
elseif self.dir == "left" then
self.speedx = -laserspeed
self.width = 1
self.x = self.x - 3/8
elseif self.dir == "down" then
self.speedy = laserspeed
self.height = 1
self.y = self.y - 3/8
elseif self.dir == "up" then
self.speedy = -laserspeed
self.height = 1
self.y = self.y - 3/8
end
self.mask = {true, false, true, true}
self.colortimer = 0
self.colortable = {{1, 0, 0}, {1, 1, 1}, {1, 1, 0}}
self.lasercolor = 1
playsound(lasersound)
end
function laser:update(dt)
if self.x > xscroll+width*2 or self.x < xscroll-width then
self.kill = true
end
if self.y > yscroll+height*2 or self.y < yscroll-height then
self.kill = true
end
self.colortimer = self.colortimer + dt
while self.colortimer > lasercolordelay do
self.colortimer = self.colortimer - lasercolordelay
self.lasercolor = self.lasercolor + 1
if self.lasercolor > #self.colortable then
self.lasercolor = 1
end
end
return self.kill
end
function laser:draw()
love.graphics.setColor(self.colortable[self.lasercolor])
love.graphics.rectangle("fill", math.floor(((self.x-xscroll)*tilewidth)*scale), math.floor(((self.y-yscroll)*tilewidth)*scale), self.width*tilewidth*scale, self.height*tilewidth*scale)
love.graphics.setColor(1, 1, 1)
end
function laser:globalcollide(a, b, c, d, dir)
if b.hurt then
b:hurt(10)
damageinworld(b.x+b.width/2, b.y, 10)
end
self.kill = true
end
function laser:leftcollide(a, b)
self:globalcollide(a, b, c, d, "left")
return false
end
function laser:rightcollide(a, b)
self:globalcollide(a, b, c, d, "right")
return false
end
function laser:ceilcollide(a, b)
self:globalcollide(a, b, c, d, "ceil")
return false
end
function laser:floorcollide(a, b)
self:globalcollide(a, b, c, d, "floor")
return false
end
|
local fs = require 'luarocks.fs'
local modules = {}
function modules.build(parser)
parser:description(
"Enumerates lua modules available in a project. " ..
"In the case of no options, all modules are enumerated.\n" ..
"NOTE: No guarantees are made about order, and duplicates may occur.")
parser:flag "-r" "--rocks"
:description
"Enumerate modules installed using LOVErocks."
parser:flag "-s" "--system"
:description
"Enumerate modules shipped with Lua/LOVE."
parser:flag "-l" "--local"
:description
"Enumerate project-local modules."
end
function modules.file_to_module(path)
local sep = "/"
local no_ext = path
:gsub(".init%.lua$",""):gsub("%.lua$","")
:gsub("%.dll$", ""):gsub("%.so$","")
if no_ext:match("%.") then
return nil, "path has invalid character"
end
return (no_ext:gsub(sep, "."))
end
local function p(...)
local t = {}
for i=1, select('#', ...) do
local v = select(i, ...)
if v then table.insert(t, v) end
end
return table.concat(t, "/")
end
function modules.list_modules(fn, prefix, inner)
local dir = p(prefix, inner)
for f in fs.dir(dir) do
local path = p(prefix, inner, f)
if fs.is_dir(path) then
modules.list_modules(fn, prefix, p(inner, f))
else
if f:match("%.lua$") or f:match("%.dll$") or f:match("%.so$") then
local mod = modules.file_to_module(p(inner, f))
if mod then
fn(mod)
end
end
end
end
end
function modules.run(conf, args)
local provided = require 'loverocks.module_data'
if not args.love and not args['local'] and not args.rocks then
args.love = true
args['local'] = true
args.rocks = true
end
if args.love then
for _, v in ipairs(provided.lua["5.1"]) do print(v) end
for _, v in ipairs(provided.luajit["2.1"]) do print(v) end
for _, v in ipairs(provided.love["0.9.2"]) do print(v) end
end
if args['local'] then
modules.list_modules(print, ".")
end
if args.rocks then
local rocks_tree = "rocks"
if conf and conf.rocks_tree then
rocks_tree = conf.rocks_tree
end
if fs.exists(rocks_tree .. "/share/lua/5.1") then
modules.list_modules(print, rocks_tree .. "/share/lua/5.1")
end
if fs.exists(rocks_tree .. "/lib/lua/5.1") then
modules.list_modules(print, rocks_tree .. "/lib/lua/5.1")
end
end
end
return modules
|
--[=[-------------------------------------------------------------------------------------------
║ Trouble in Terrorist Town Commands ║
║ By: Skillz and Bender180 ║
║ ╔═════════╗╔═════════╗╔═════════╗ ║
║ ║ ╔═╗ ╔═╗ ║║ ╔═╗ ╔═╗ ║║ ╔═╗ ╔═╗ ║ ║
║ ╚═╝ ║ ║ ╚═╝╚═╝ ║ ║ ╚═╝╚═╝ ║ ║ ╚═╝ ║
║──────────────────────────────────║ ║────────║ ║────────║ ║───────────────────────────────────║
║──────────────────────────────────║ ║────────║ ║────────║ ║───────────────────────────────────║
║──────────────────────────────────╚═╝────────╚═╝────────╚═╝───────────────────────────────────║
║ All code included is completely original or extracted ║
║ from the base ttt files that are provided with the ttt gamemode. ║
║ ║
---------------------------------------------------------------------------------------------]=]
local CATEGORY_NAME = "TTT 管理员"
local gamemode_error = "The current gamemode is not trouble in terrorist town!"
--[Ulx Completes]------------------------------------------------------------------------------
ulx.target_role = {}
function updateRoles()
table.Empty( ulx.target_role )
table.insert(ulx.target_role,"traitor")
table.insert(ulx.target_role,"detective")
table.insert(ulx.target_role,"innocent")
end
hook.Add( ULib.HOOK_UCLCHANGED, "ULXRoleNamesUpdate", updateRoles )
updateRoles()
--[End]----------------------------------------------------------------------------------------
--[Global Helper Functions][Used by more than one command.]------------------------------------
--[[send_messages][Sends messages to player(s)]
@param {[PlayerObject]} v [The player(s) to send the message to.]
@param {[String]} message [The message that will be sent.]
--]]
function send_messages(v, message)
if type(v) == "Players" then
v:ChatPrint(message)
elseif type(v) == "table" then
for i=1, #v do
v[i]:ChatPrint(message)
end
end
end
--[[corpse_find][Finds the corpse of a given player.]
@param {[PlayerObject]} v [The player that to find the corpse for.]
--]]
function corpse_find(v)
for _, ent in pairs( ents.FindByClass( "prop_ragdoll" )) do
if ent.uqid == v:UniqueID() and IsValid(ent) then
return ent or false
end
end
end
--[[corpse_remove][removes the corpse given.]
@param {[Ragdoll]} corpse [The corpse to be removed.]
--]]
function corpse_remove(corpse)
CORPSE.SetFound(corpse, false)
if string.find(corpse:GetModel(), "zm_", 6, true) then
player.GetByUniqueID( corpse.uqid ):SetNWBool( "body_found", false )
corpse:Remove()
SendFullStateUpdate()
elseif corpse.player_ragdoll then
player.GetByUniqueID( corpse.uqid ):SetNWBool( "body_found", false )
corpse:Remove()
SendFullStateUpdate()
end
end
--[[corpse_identify][identifies the given corpse.]
@param {[Ragdoll]} corpse [The corpse to be identified.]
--]]
function corpse_identify(corpse)
if corpse then
local ply = player.GetByUniqueID(corpse.uqid)
ply:SetNWBool("body_found", true)
CORPSE.SetFound(corpse, true)
end
end
--[End]----------------------------------------------------------------------------------------
--[Force role]---------------------------------------------------------------------------------
--[[ulx.force][Forces <target(s)> to become a specified role.]
@param {[PlayerObject]} calling_ply [The player who used the command.]
@param {[PlayerObject]} target_plys [The player(s) who will have the effects of the command applied to them.]
@param {[Number]} target_role [The role that target player(s) will have there role set to.]
@param {[Boolean]} should_silent [Hidden, determines weather the output will be silent or not.]
--]]
function ulx.slaynr( calling_ply, target_ply, num_slay, should_slaynr )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
local affected_plys = {}
local slays_left = tonumber(target_ply:GetPData("slaynr_slays")) or 0
local current_slay
local new_slay
if ulx.getExclusive( target_ply, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( target_ply, calling_ply ), true )
elseif num_slay < 0 then
ULib.tsayError( calling_ply, "无效整数:\"" .. num_slay .. "\" specified.", true )
else
current_slay = tonumber(target_ply:GetPData("slaynr_slays")) or 0
if not should_slaynr then
new_slay = current_slay + num_slay
else
new_slay = current_slay - num_slay
end
--local slay_reason = reason
--if slay_reason == "reason" then
-- slay_reason = false
--end
if new_slay > 0 then
target_ply:SetPData("slaynr_slays", new_slay)
--target_ply:SetPData("slaynr_reason", slay_reason)
else
target_ply:RemovePData("slaynr_slays")
--target_ply:RemovePData("slaynr_reason")
end
local slays_left = tonumber(target_ply:GetPData("slaynr_slays")) or 0
local slays_removed = ( current_slay - slays_left ) or 0
if slays_removed==0 then
chat_message = ("#T 下一轮不会被杀死.")
elseif slays_removed > 0 then
chat_message = ("#A 移除 ".. slays_removed .." 一轮杀戮 #T.")
elseif slays_left == 1 then
chat_message = ("#A 将在下一轮杀死 #T.")
elseif slays_left > 1 then
chat_message = ("#A 将在下一个杀死 #T ".. tostring(slays_left) .." 回合.")
end
ulx.fancyLogAdmin( calling_ply, chat_message, target_ply, reason )
end
end
end
local slaynr = ulx.command( CATEGORY_NAME, "ulx slaynr", ulx.slaynr, "!slaynr" )
slaynr:addParam{ type=ULib.cmds.PlayerArg }
slaynr:addParam{ type=ULib.cmds.NumArg, max=100, default=1, hint="回合", ULib.cmds.optional, ULib.cmds.round }
--slaynr:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional}
slaynr:addParam{ type=ULib.cmds.BoolArg, invisible=true }
slaynr:defaultAccess( ULib.ACCESS_ADMIN )
slaynr:help( "在数回合内杀死目标" )
slaynr:setOpposite( "ulx rslaynr", {_, _, _, true}, "!rslaynr" )
--[Helper Functions]---------------------------------------------------------------------------
hook.Add("TTTBeginRound", "SlayPlayersNextRound", function()
local affected_plys = {}
for _,v in pairs(player.GetAll()) do
local slays_left = tonumber(v:GetPData("slaynr_slays")) or 0
if v:Alive() and slays_left > 0 then
local slays_left=slays_left -1
if slays_left == 0 then
v:RemovePData("slaynr_slays")
v:RemovePData("slaynr_reason")
else
v:SetPData("slaynr_slays", slays_left)
end
v:StripWeapons()
table.insert( affected_plys, v )
timer.Create("check" .. v:SteamID(), 0.1, 0, function() --workaround for issue with tommys damage log
v:Kill()
GAMEMODE:PlayerSilentDeath(v)
local corpse = corpse_find(v)
if corpse then
v:SetNWBool("body_found", true)
SendFullStateUpdate()
if string.find(corpse:GetModel(), "zm_", 6, true) then
corpse:Remove()
elseif corpse.player_ragdoll then
corpse:Remove()
end
end
v:SetTeam(TEAM_SPEC)
if v:IsSpec() then timer.Destroy("check" .. v:SteamID()) return end
end)
timer.Create("traitorcheck" .. v:SteamID(), 1, 0, function() --have to wait for gamemode before doing this
if v:GetRole() == ROLE_TRAITOR then
SendConfirmedTraitors( GetInnocentFilter( false ) ) -- Update innocent's list of traitors.
SCORE:HandleBodyFound( v, v )
end
end)
end
end
local slay_message
for i=1, #affected_plys do
local v = affected_plys[ i ]
local string_inbetween
if i > 1 and #affected_plys == i then
string_inbetween=" and "
elseif i > 1 then
string_inbetween=", "
end
string_inbetween = string_inbetween or ""
slay_message = ( ( slay_message or "") .. string_inbetween )
slay_message = ( ( slay_message or "") .. v:Nick() )
end
local slay_message_context
if #affected_plys == 1 then slay_message_context ="was" else slay_message_context ="were" end
if #affected_plys ~= 0 then
ULib.tsay(_, slay_message .. " ".. slay_message_context .." slain.")
end
end)
hook.Add("PlayerSpawn", "Inform" , function(ply)
local slays_left = tonumber(ply:GetPData("slaynr_slays")) or 0
local slay_reason = false
if ply:Alive() and slays_left > 0 then
local chat_message = ""
if slays_left > 0 then
chat_message = (chat_message .. "你会在这一轮被杀")
end
if slays_left > 1 then
chat_message = (chat_message .. " 和 ".. (slays_left - 1) .." 当前回合之后的回合")
end
if slay_reason then
chat_message = (chat_message .. " 给予 \"".. slays_reason .."\".")
else
chat_message = (chat_message .. ".")
end
ply:ChatPrint(chat_message)
end
end)
--[End]----------------------------------------------------------------------------------------
--[Force role]---------------------------------------------------------------------------------
--[[ulx.force][Forces <target(s)> to become a specified role.]
@param {[PlayerObject]} calling_ply [The player who used the command.]
@param {[PlayerObject]} target_plys [The player(s) who will have the effects of the command applied to them.]
@param {[Number]} target_role [The role that target player(s) will have there role set to.]
@param {[Boolean]} should_silent [Hidden, determines weather the output will be silent or not.]
--]]
function ulx.force( calling_ply, target_plys, target_role, should_silent )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
local affected_plys = {}
local starting_credits=GetConVarNumber("ttt_credits_starting")
local role
local role_grammar
local role_string
local role_credits
if target_role == "traitor" or target_role == "t" then role, role_grammar, role_string, role_credits = ROLE_TRAITOR, "a ", "traitor", starting_credits end
if target_role == "detective" or target_role == "d" then role, role_grammar, role_string, role_credits = ROLE_DETECTIVE, "a ", "detective", starting_credits end
if target_role == "innocent" or target_role == "i" then role, role_grammar, role_string, role_credits = ROLE_INNOCENT, "an ", "innocent", 0 end
for i=1, #target_plys do
local v = target_plys[ i ]
local current_role = v:GetRole()
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif GetRoundState() == 1 or GetRoundState() == 2 then
ULib.tsayError( calling_ply, "回合还未开始!", true )
elseif role == nil then
ULib.tsayError( calling_ply, "无效角色 :\"" .. target_role .. "\" 指定的", true )
elseif not v:Alive() then
ULib.tsayError( calling_ply, v:Nick() .. " 死了!", true )
elseif current_role == role then
ULib.tsayError( calling_ply, v:Nick() .. " 已经 " .. role_string, true )
else
v:ResetEquipment()
RemoveLoadoutWeapons(v)
RemoveBoughtWeapons(v)
v:SetRole(role)
v:SetCredits(role_credits)
SendFullStateUpdate()
GiveLoadoutItems(v)
GiveLoadoutWeapons(v)
table.insert( affected_plys, v )
end
end
ulx.fancyLogAdmin( calling_ply, should_silent, "#A 强迫 #T 成为角色 " .. role_grammar .."#s.", affected_plys, role_string )
send_messages(affected_plys, "您的角色已设置为 " .. role_string .. "." )
end
end
local force = ulx.command( CATEGORY_NAME, "ulx force", ulx.force, "!force" )
force:addParam{ type=ULib.cmds.PlayersArg }
force:addParam{ type=ULib.cmds.StringArg, completes=ulx.target_role, hint="角色" }
force:addParam{ type=ULib.cmds.BoolArg, invisible=true }
force:defaultAccess( ULib.ACCESS_SUPERADMIN )
force:setOpposite( "ulx sforce", {_, _, _, true}, "!sforce", true )
force:help( "强制 <target(s)> 成为指定角色." )
--[Helper Functions]---------------------------------------------------------------------------
--[[GetLoadoutWeapons][Returns the loadout weapons ]
@param {[Number]} r [The role of the loadout weapons to be returned]
@return {[table]} [A table of loadout weapons for the given role.]
--]]
function GetLoadoutWeapons(r)
local tbl = {
[ROLE_INNOCENT] = {},
[ROLE_TRAITOR] = {},
[ROLE_DETECTIVE]= {}
};
for k, w in pairs(weapons.GetList()) do
if w and type(w.InLoadoutFor) == "table" then
for _, wrole in pairs(w.InLoadoutFor) do
table.insert(tbl[wrole], WEPS.GetClass(w))
end
end
end
return tbl[r]
end
--[[RemoveBoughtWeapons][Removes previously bought weapons from the shop.]
@param {[PlayerObject]} ply [The player who will have their bought weapons removed.]
--]]
function RemoveBoughtWeapons(ply)
for _, wep in pairs(weapons.GetList()) do
local wep_class = WEPS.GetClass(wep)
if wep and type(wep.CanBuy) == "table" then
for _, weprole in pairs(wep.CanBuy) do
if weprole == ply:GetRole() and ply:HasWeapon(wep_class) then
ply:StripWeapon(wep_class)
end
end
end
end
end
--[[RemoveLoadoutWeapons][Removes all loadout weapons for the given player.]
@param {[PlayerObject]} ply [The player who will have their loadout weapons removed.]
--]]
function RemoveLoadoutWeapons(ply)
local weps = GetLoadoutWeapons( GetRoundState() == ROUND_PREP and ROLE_INNOCENT or ply:GetRole() )
for _, cls in pairs(weps) do
if ply:HasWeapon(cls) then
ply:StripWeapon(cls)
end
end
end
--[[GiveLoadoutWeapons][Gives the loadout weapons for that player.]
@param {[PlayerObject]} ply [The player who will have their loadout weapons given.]
--]]
function GiveLoadoutWeapons(ply)
local r = GetRoundState() == ROUND_PREP and ROLE_INNOCENT or ply:GetRole()
local weps = GetLoadoutWeapons(r)
if not weps then return end
for _, cls in pairs(weps) do
if not ply:HasWeapon(cls) then
ply:Give(cls)
end
end
end
--[[GiveLoadoutItems][Gives the default loadout items for that role.]
@param {[PlayerObject]} ply [The player who the equipment will be given to.]
--]]
function GiveLoadoutItems(ply)
local items = EquipmentItems[ply:GetRole()]
if items then
for _, item in pairs(items) do
if item.loadout and item.id then
ply:GiveEquipmentItem(item.id)
end
end
end
end
--[End]----------------------------------------------------------------------------------------
--[Respawn]------------------------------------------------------------------------------------
--[[ulx.respawn][Respawns <target(s)>]
@param {[PlayerObject]} calling_ply [The player who used the command.]
@param {[PlayerObject]} target_plys [The player(s) who will have the effects of the command applied to them.]
@param {[Boolean]} should_silent [Hidden, determines weather the output will be silent or not.]
--]]
function ulx.respawn( calling_ply, target_plys, should_silent )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif GetRoundState() == 1 then
ULib.tsayError( calling_ply, "等待玩家!", true )
elseif v:Alive() and v:IsSpec() then -- players arent really dead when they are spectating, we need to handle that correctly
timer.Destroy("traitorcheck" .. v:SteamID())
v:ConCommand("ttt_spectator_mode 0") -- just incase they are in spectator mode take them out of it
timer.Create("respawndelay", 0.1, 0, function() --seems to be a slight delay from when you leave spec and when you can spawn this should get us around that
local corpse = corpse_find(v) -- run the normal respawn code now
if corpse then corpse_remove(corpse) end
v:SpawnForRound( true )
v:SetCredits( ( (v:GetRole() == ROLE_INNOCENT) and 0 ) or GetConVarNumber("ttt_credits_starting") )
table.insert( affected_plys, v )
ulx.fancyLogAdmin( calling_ply, should_silent ,"#A 重生 #T!", affected_plys )
send_messages(affected_plys, "你重生了.")
if v:Alive() then timer.Destroy("respawndelay") return end
end)
elseif v:Alive() then
ULib.tsayError( calling_ply, v:Nick() .. " 已经活着!", true )
else
timer.Destroy("traitorcheck" .. v:SteamID())
local corpse = corpse_find(v)
if corpse then corpse_remove(corpse) end
v:SpawnForRound( true )
v:SetCredits( ( (v:GetRole() == ROLE_INNOCENT) and 0 ) or GetConVarNumber("ttt_credits_starting") )
table.insert( affected_plys, v )
end
end
ulx.fancyLogAdmin( calling_ply, should_silent ,"#A 重生 #T!", affected_plys )
send_messages(affected_plys, "你重生了.")
end
end
local respawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.respawn, "!respawn")
respawn:addParam{ type=ULib.cmds.PlayersArg }
respawn:addParam{ type=ULib.cmds.BoolArg, invisible=true }
respawn:defaultAccess( ULib.ACCESS_SUPERADMIN )
respawn:setOpposite( "ulx srespawn", {_, _, true}, "!srespawn", true )
respawn:help( "重生 <target(s)>." )
--[End]----------------------------------------------------------------------------------------
--[Respawn teleport]---------------------------------------------------------------------------
--[[ulx.respawntp][Respawns <target(s)>]
@param {[PlayerObject]} calling_ply [The player who used the command.]
@param {[PlayerObject]} target_ply [The player who will have the effects of the command applied to them.]
@param {[Boolean]} should_silent [Hidden, determines weather the output will be silent or not.]
--]]
function ulx.respawntp( calling_ply, target_ply, should_silent )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
local affected_ply = {}
if not calling_ply:IsValid() then
Msg( "你是控制台,你不能传送或传送别人,因为你看不到世界!\n" )
return
elseif ulx.getExclusive( target_ply, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( target_ply, calling_ply ), true )
elseif GetRoundState() == 1 then
ULib.tsayError( calling_ply, "等待玩家!", true )
elseif target_ply:Alive() and target_ply:IsSpec() then
timer.Destroy("traitorcheck" .. target_ply:SteamID())
target_ply:ConCommand("ttt_spectator_mode 0")
timer.Create("respawntpdelay", 0.1, 0, function() --have to wait for gamemode before doing this
local t = {}
t.start = calling_ply:GetPos() + Vector( 0, 0, 32 ) -- Move them up a bit so they can travel across the ground
t.endpos = calling_ply:GetPos() + calling_ply:EyeAngles():Forward() * 16384
t.filter = target_ply
if target_ply ~= calling_ply then
t.filter = { target_ply, calling_ply }
end
local tr = util.TraceEntity( t, target_ply )
local pos = tr.HitPos
local corpse = corpse_find(target_ply)
if corpse then corpse_remove(corpse) end
target_ply:SpawnForRound( true )
target_ply:SetCredits( ((target_ply:GetRole() == ROLE_INNOCENT) and 0) or GetConVarNumber("ttt_credits_starting") )
target_ply:SetPos( pos )
table.insert( affected_ply, target_ply )
ulx.fancyLogAdmin( calling_ply, should_silent ,"#A 重生和传送 #T!", affected_ply )
send_messages(target_ply, "你被重生和传送.")
if target_ply:Alive() then timer.Destroy("respawntpdelay") return end
end)
elseif target_ply:Alive() then
ULib.tsayError( calling_ply, target_ply:Nick() .. " 已经活着!", true )
else
timer.Destroy("traitorcheck" .. target_ply:SteamID())
local t = {}
t.start = calling_ply:GetPos() + Vector( 0, 0, 32 ) -- Move them up a bit so they can travel across the ground
t.endpos = calling_ply:GetPos() + calling_ply:EyeAngles():Forward() * 16384
t.filter = target_ply
if target_ply ~= calling_ply then
t.filter = { target_ply, calling_ply }
end
local tr = util.TraceEntity( t, target_ply )
local pos = tr.HitPos
local corpse = corpse_find(target_ply)
if corpse then corpse_remove(corpse) end
target_ply:SpawnForRound( true )
target_ply:SetCredits( ((target_ply:GetRole() == ROLE_INNOCENT) and 0) or GetConVarNumber("ttt_credits_starting") )
target_ply:SetPos( pos )
table.insert( affected_ply, target_ply )
end
ulx.fancyLogAdmin( calling_ply, should_silent ,"#A 重生和传送 #T!", affected_ply )
send_messages(affected_plys, "你被重生和传送.")
end
end
local respawntp = ulx.command( CATEGORY_NAME, "ulx respawntp", ulx.respawntp, "!respawntp")
respawntp:addParam{ type=ULib.cmds.PlayerArg }
respawntp:addParam{ type=ULib.cmds.BoolArg, invisible=true }
respawntp:defaultAccess( ULib.ACCESS_SUPERADMIN )
respawntp:setOpposite( "ulx srespawntp", {_, _, true}, "!srespawntp", true )
respawntp:help( "将 <target> 重生到特定位置." )
--[End]----------------------------------------------------------------------------------------
--[Karma]--------------------------------------------------------------------------------------
--[[ulx.karma][Sets the <target(s)> karma to a given amount.]
@param {[PlayerObject]} calling_ply [The player who used the command.]
@param {[PlayerObject]} target_plys [The player(s) who will have the effects of the command applied to them.]
@param {[Number]} amount [The number the target's karma will be set to.]
--]]
function ulx.karma( calling_ply, target_plys, amount )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
for i=1, #target_plys do
target_plys[ i ]:SetBaseKarma( amount )
target_plys[ i ]:SetLiveKarma( amount )
end
end
ulx.fancyLogAdmin( calling_ply, "#A 设置业力值 #T 为 #i", target_plys, amount )
end
local karma = ulx.command( CATEGORY_NAME, "ulx karma", ulx.karma, "!karma" )
karma:addParam{ type=ULib.cmds.PlayersArg }
karma:addParam{ type=ULib.cmds.NumArg, min=0, max=10000, default=1000, hint="业力值", ULib.cmds.optional, ULib.cmds.round }
karma:defaultAccess( ULib.ACCESS_ADMIN )
karma:help( "改变 <target(s)> 业力值." )
--[End]----------------------------------------------------------------------------------------
--[Toggle spectator]---------------------------------------------------------------------------
--[[ulx.spec][Forces <target(s)> to and from spectator.]
@param {[PlayerObject]} calling_ply [The player who used the command.]
@param {[PlayerObject]} target_plys [The player(s) who will have the effects of the command applied to them.]
--]]
function ulx.tttspec( calling_ply, target_plys, should_unspec )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
for i=1, #target_plys do
local v = target_plys[ i ]
if should_unspec then
v:ConCommand("ttt_spectator_mode 0")
else
v:Kill()
v:SetForceSpec(true)
v:SetTeam(TEAM_SPEC)
v:ConCommand("ttt_spectator_mode 1")
v:ConCommand("ttt_cl_idlepopup")
end
end
if should_unspec then
ulx.fancyLogAdmin( calling_ply, "#A 已经迫使 #T 加入下一轮的活人世界.", target_plys )
else
ulx.fancyLogAdmin( calling_ply, "#A 迫使 #T 旁观.", target_plys )
end
end
end
local tttspec = ulx.command( CATEGORY_NAME, "ulx fspec", ulx.tttspec, "!fspec" )
tttspec:addParam{ type=ULib.cmds.PlayersArg }
tttspec:addParam{ type=ULib.cmds.BoolArg, invisible=true }
tttspec:defaultAccess( ULib.ACCESS_ADMIN )
tttspec:setOpposite( "ulx unspec", {_, _, true}, "!unspec" )
tttspec:help( "强制 <target(s)> 进入/离开旁观者." )
--[End]----------------------------------------------------------------------------------------
------------------------------ Next Round ------------------------------
ulx.next_round = {}
local function updateNextround()
table.Empty( ulx.next_round ) -- Don't reassign so we don't lose our refs
table.insert(ulx.next_round,"traitor") -- Add "traitor" to the table.
table.insert(ulx.next_round,"detective") -- Add "detective" to the table.
table.insert(ulx.next_round,"unmark") -- Add "unmark" to the table.
end
hook.Add( ULib.HOOK_UCLCHANGED, "ULXNextRoundUpdate", updateNextround )
updateNextround() -- Init
local PlysMarkedForTraitor = {}
local PlysMarkedForDetective = {}
function ulx.nextround( calling_ply, target_plys, next_round )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
local affected_plys = {}
local unaffected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
local ID = v:UniqueID()
if next_round == "traitor" then
if PlysMarkedForTraitor[ID] == true or PlysMarkedForDetective[ID] == true then
ULib.tsayError( calling_ply, "该玩家已经被标记为下一轮", true )
else
PlysMarkedForTraitor[ID] = true
table.insert( affected_plys, v )
end
end
if next_round == "detective" then
if PlysMarkedForTraitor[ID] == true or PlysMarkedForDetective[ID] == true then
ULib.tsayError( calling_ply, "该玩家已经被标记为下一轮!", true )
else
PlysMarkedForDetective[ID] = true
table.insert( affected_plys, v )
end
end
if next_round == "unmark" then
if PlysMarkedForTraitor[ID] == true then
PlysMarkedForTraitor[ID] = false
table.insert( affected_plys, v )
end
if PlysMarkedForDetective[ID] == true then
PlysMarkedForDetective[ID] = false
table.insert( affected_plys, v )
end
end
end
if next_round == "unmark" then
ulx.fancyLogAdmin( calling_ply, true, "#A 没有标记 #T ", affected_plys )
else
ulx.fancyLogAdmin( calling_ply, true, "#A 标记为 #T 将成为下一轮 #s.", affected_plys, next_round )
end
end
end
local nxtr= ulx.command( CATEGORY_NAME, "ulx forcenr", ulx.nextround, "!nr" )
nxtr:addParam{ type=ULib.cmds.PlayersArg }
nxtr:addParam{ type=ULib.cmds.StringArg, completes=ulx.next_round, hint="下一轮", error="指定的角色 \"%s\" 无效", ULib.cmds.restrictToCompletes }
nxtr:defaultAccess( ULib.ACCESS_SUPERADMIN )
nxtr:help( "强制目标在下一轮成为侦探/叛徒." )
local function TraitorMarkedPlayers()
for k, v in pairs(PlysMarkedForTraitor) do
if v then
ply = player.GetByUniqueID(k)
ply:SetRole(ROLE_TRAITOR)
ply:AddCredits(GetConVarNumber("ttt_credits_starting"))
ply:ChatPrint("你在这一轮被管理员当成了叛徒.")
PlysMarkedForTraitor[k] = false
end
end
end
hook.Add("TTTBeginRound", "Admin_Round_Traitor", TraitorMarkedPlayers)
local function DetectiveMarkedPlayers()
for k, v in pairs(PlysMarkedForDetective) do
if v then
ply = player.GetByUniqueID(k)
ply:SetRole(ROLE_DETECTIVE)
ply:AddCredits(GetConVarNumber("ttt_credits_starting"))
ply:Give("weapon_ttt_wtester")
ply:ChatPrint("你在这一轮被管理员任命为侦探.")
PlysMarkedForDetective[k] = false
end
end
end
hook.Add("TTTBeginRound", "Admin_Round_Detective", DetectiveMarkedPlayers)
---[Identify Corpse Thanks Neku]----------------------------------------------------------------------------
function ulx.identify( calling_ply, target_ply, unidentify )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
body = corpse_find( target_ply )
if not body then ULib.tsayError( calling_ply, "该玩家的尸体不存在!", true ) return end
if not unidentify then
ulx.fancyLogAdmin( calling_ply, "#A 识别出 #T 的身体!", target_ply )
CORPSE.SetFound( body, true )
target_ply:SetNWBool("body_found", true)
if target_ply:GetRole() == ROLE_TRAITOR then
-- update innocent's list of traitors
SendConfirmedTraitors(GetInnocentFilter(false))
SCORE:HandleBodyFound( calling_ply, target_ply )
end
else
ulx.fancyLogAdmin( calling_ply, "#A 取消识别出 #T 的身体!", target_ply )
CORPSE.SetFound( body, false )
target_ply:SetNWBool("body_found", false)
SendFullStateUpdate()
end
end
end
local identify = ulx.command( CATEGORY_NAME, "ulx identify", ulx.identify, "!identify")
identify:addParam{ type=ULib.cmds.PlayerArg }
identify:addParam{ type=ULib.cmds.BoolArg, invisible=true }
identify:defaultAccess( ULib.ACCESS_SUPERADMIN )
identify:setOpposite( "ulx unidentify", {_, _, true}, "!unidentify", true )
identify:help( "识别目标的身体." )
---[Remove Corpse Thanks Neku]----------------------------------------------------------------------------
function ulx.removebody( calling_ply, target_ply )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
body = corpse_find( target_ply )
if not body then ULib.tsayError( calling_ply, "该玩家的尸体不存在!", true ) return end
ulx.fancyLogAdmin( calling_ply, "#A 移除 #T 的身体!", target_ply )
if string.find( body:GetModel(), "zm_", 6, true ) then
body:Remove()
elseif body.player_ragdoll then
body:Remove()
end
end
end
local removebody = ulx.command( CATEGORY_NAME, "ulx removebody", ulx.removebody, "!removebody")
removebody:addParam{ type=ULib.cmds.PlayerArg }
removebody:defaultAccess( ULib.ACCESS_SUPERADMIN )
removebody:help( "移除目标的身体." )
---[Impair Next Round - Concpet and some code from Decicus next round slap]----------------------------------------------------------------------------
function ulx.inr( calling_ply, target_ply, amount )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
local ImpairBy = target_ply:GetPData("ImpairNR", 0 )
if amount == 0 then
target_ply:RemovePData("ImpairNR")
chat_message = "#A 不会损害 #T 下一轮的生命值."
else
if amount == ImpairBy then
ULib.tsayError( calling_ply, calling_ply:Nick() .. " 将已经因该数量的生命值而受损." )
else
target_ply:SetPData( "ImpairNR", amount )
chat_message = "#A 将使 #T 受到以下因素的影响 " .. amount .. " 健康下一轮."
end
end
end
ulx.fancyLogAdmin( calling_ply, chat_message, target_ply )
end
local impair = ulx.command( CATEGORY_NAME, "ulx impairnr", ulx.inr, "!impairnr" )
impair:addParam{ type=ULib.cmds.PlayerArg }
impair:addParam{ type=ULib.cmds.NumArg, min=0, max=99, default=5, hint="要移除的生命值.", ULib.cmds.optional, ULib.cmds.round }
impair:defaultAccess( ULib.ACCESS_ADMIN )
impair:help( "在下一轮削弱目标的生命值.设置为 0 以消除损伤" )
---[impair Next Round Helper Functions ]----------------------------------------------------------------------------
hook.Add("PlayerSpawn", "InformImpair" , function(ply)
local ImpairDamage = tonumber(ply:GetPData("ImpairNR")) or 0
if ply:Alive() and ImpairDamage > 0 then
local chat_message = ""
if ImpairDamage > 0 then
chat_message = (chat_message .. "你会受到损害 " ..ImpairDamage.. "本轮生命值")
end
ply:ChatPrint(chat_message)
end
end)
function ImpairPlayers()
for _, ply in ipairs( player.GetAll() ) do
local impairDamage = tonumber( ply:GetPData( "ImpairNR" ) ) or 0
if ply:Alive() and impairDamage > 0 then
local name = ply:Nick()
ply:TakeDamage(impairDamage)
ply:EmitSound("player/pl_pain5.wav")
ply:ChatPrint("你受到了损害 " ..impairDamage.. " 本轮生命值")
ply:RemovePData( "ImpairNR" )
ULib.tsay(nil, name .. " 受到损害 ".. impairDamage .." 本轮生命值.", false)
end
end
end
hook.Add( "TTTBeginRound", "ImpairPlayers", ImpairPlayers )
---[Round Restart]-------------------------------------------------------------------------
function ulx.roundrestart( calling_ply )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
ULib.consoleCommand( "ttt_roundrestart" .. "\n" )
ulx.fancyLogAdmin( calling_ply, "#A 已重新开始回合." )
end
end
local restartround = ulx.command( CATEGORY_NAME, "ulx roundrestart", ulx.roundrestart )
restartround:defaultAccess( ULib.ACCESS_SUPERADMIN )
restartround:help( "重新开始回合." )
---[End]----------------------------------------------------------------------------------------
|
object_mobile_azure_cabal_nikto_fanatic = object_mobile_shared_azure_cabal_nikto_fanatic:new {
}
ObjectTemplates:addTemplate(object_mobile_azure_cabal_nikto_fanatic, "object/mobile/azure_cabal_nikto_fanatic.iff")
|
EditUnitEditableGui = EditUnitEditableGui or class(EditUnit)
function EditUnitEditableGui:editable(unit) return self.super.editable(self, unit) and unit:editable_gui() ~= nil end
function EditUnitEditableGui:build_menu(units)
local gui_options = self:Group("EditableGui")
self._element_guis = {}
self._fonts = {
"core/fonts/diesel",
tweak_data.menu.pd2_small_font,
tweak_data.menu.pd2_medium_font,
tweak_data.menu.pd2_large_font,
tweak_data.menu.pd2_massive_font,
}
self._aligns = {
horizontal = {
"left",
"center",
"right",
"justified"
},
vertical = {
"top",
"center",
"bottom"
}
}
self._blend_modes = {
"normal",
"add",
"mul",
"mulx2",
"sub",
"darken",
"lighten"
}
self._render_templates = {
"diffuse_vc_decal",
"Text",
"OverlayVertexColorTextured",
"TextDistanceField",
"diffuse_vc_decal_distance_field"
}
local font_options = clone(self._fonts)
local default_font = units[1]:editable_gui():default_font()
if not table.contains(self._fonts, default_font) then
BeardLibEditor:log("Detected new font in editable gui! font name = %s", default_font)
table.insert(self._fonts, default_font)
end
self._colour_btn = self:Button("ChooseColor", callback(self, self, "show_color_dialog"), {group = light_options})
self._text = self:TextBox("Text", callback(self._parent, self._parent, "set_unit_data"), units[1]:editable_gui():text())
self._font = self:ComboBox("Font", callback(self._parent, self._parent, "set_unit_data"), self._fonts, table.get_key(self._fonts, units[1]:editable_gui():font()), {help = "Select a font from the combobox"})
self._font_size = self:Slider("FontSize", callback(self._parent, self._parent, "set_unit_data"), units[1]:editable_gui():font_size(), {floats = 2, min = 0.1, max = 10, help = "Set the font size using the slider"})
self._horizontal_align = self:ComboBox("HorizontalAlign", callback(self._parent, self._parent, "set_unit_data"), self._aligns.horizontal, table.get_key(self._aligns.horizontal, units[1]:editable_gui():align()), {help = "Select an align from the combobox"})
self._vertical_align = self:ComboBox("VerticalAlign", callback(self._parent, self._parent, "set_unit_data"), self._aligns.vertical, table.get_key(self._aligns.vertical, units[1]:editable_gui():vertical()), {help = "Select an align from the combobox"})
self._wrapping = self:Toggle("TextWrapping", callback(self._parent, self._parent, "set_unit_data"), units[1]:editable_gui():wrap())
self._word_wrapping = self:Toggle("TextWordWrapping", callback(self._parent, self._parent, "set_unit_data"), units[1]:editable_gui():word_wrap(), {enabled = units[1]:editable_gui():wrap()}) --
self._debug = self:Toggle("Debug", callback(self._parent, self._parent, "set_unit_data"))
self._render_template = self:ComboBox("RenderTemplate", callback(self._parent, self._parent, "set_unit_data"), self._render_templates, table.get_key(self._render_templates, units[1]:editable_gui():render_template()), {help = "Select a Render Template from the combobox"})
self._blend_mode = self:ComboBox("BlendMode", callback(self._parent, self._parent, "set_unit_data"), self._blend_modes, table.get_key(self._blend_modes, units[1]:editable_gui():blend_mode()), {
help = "Select a Blend Mode from the combobox",
enabled = units[1]:editable_gui():render_template() == "Text",
})
self._alpha = self:Slider("Alpha", callback(self._parent, self._parent, "set_unit_data"), units[1]:editable_gui():alpha(), {floats = 2, min = 0, max = 1, help = "Set the alpha using the slider"})
self._shapes = {}
for i, s in ipairs({"x", "y", "w", "h"}) do
local shape = units[1]:editable_gui():shape()
self._shapes[i] = self:Slider(s:upper(), callback(self._parent, self._parent, "set_unit_data"), shape[i], {floats = 2, min = 0, max = 1, help = "Set shape using the slider"})
end
end
function EditUnitEditableGui:set_unit_data()
local unit = self:selected_unit()
unit:editable_gui():set_debug(self._debug:Value())
unit:editable_gui():set_shape({self._shapes[1]:Value(), self._shapes[2]:Value(), self._shapes[3]:Value(), self._shapes[4]:Value()})
unit:editable_gui():set_alpha(self._alpha:Value())
local render_template = self._render_template:SelectedItem()
self._blend_mode:SetEnabled(render_template == "Text")
unit:editable_gui():set_render_template(render_template)
unit:editable_gui():set_blend_mode(self._blend_mode:SelectedItem())
local wrap = self._wrapping:Value()
self._word_wrapping:SetEnabled(wrap)
unit:editable_gui():set_wrap(wrap)
unit:editable_gui():set_word_wrap(self._word_wrapping:Value())
unit:editable_gui():set_align(self._horizontal_align:SelectedItem())
unit:editable_gui():set_vertical(self._vertical_align:SelectedItem())
unit:editable_gui():set_font(self._font:SelectedItem())
unit:editable_gui():set_text(utf8.from_latin1(self._text:Value()))
unit:editable_gui():set_font_size(self._font_size:Value())
end
function EditUnitEditableGui:update_positions()
self:set_unit_data()
end
function EditUnitEditableGui:show_color_dialog()
local unit = self:selected_unit()
local vc = unit:editable_gui():font_color()
BeardLibEditor.managers.ColorDialog:Show({color = Color(vc.x, vc.y, vc.z), callback = function(color)
unit:editable_gui():set_font_color(Vector3(color.red, color.green, color.blue))
end})
end
|
local vim = vim
local api = vim.api
local u = require 'vimwiki_server/lib/utils'
local M = {}
-- Builds a new GraphQL query
function M.query(s, vars)
local query = u.interpolate_vars(u.compress(s), vars or {})
-- If not prefixed with query keyword, we make one
if query and string.sub(query, 1, 1) == '{' then
query = 'query VimQuery'..query
end
return query
end
-- Builds a new GraphQL mutation
function M.mutation(s, vars)
local mutation = u.interpolate_vars(u.compress(s), vars or {})
-- If not prefixed with mutation keyword, we make one
if mutation and string.sub(mutation, 1, 1) == '{' then
mutation = 'mutation VimMutation'..mutation
end
return mutation
end
-- Builds a new GraphQL subscription
function M.subscription(s, vars)
local subscription = u.interpolate_vars(u.compress(s), vars or {})
-- If not prefixed with subscription keyword, we make one
if subscription and string.sub(subscription, 1, 1) == '{' then
subscription = 'subscription VimSubscription'..subscription
end
return subscription
end
return M
|
local shortport = require "shortport"
local http = require "http"
local stdnse = require "stdnse"
local string = require "string"
local vulns = require "vulns"
local rand = require "rand"
description = [[
Checks for a remote code execution vulnerability (MS15-034) in Microsoft Windows systems (CVE2015-2015-1635).
The script sends a specially crafted HTTP request with no impact on the system to detect this vulnerability.
The affected versions are Windows 7, Windows Server 2008 R2, Windows 8, Windows Server 2012, Windows 8.1,
and Windows Server 2012 R2.
References:
* https://technet.microsoft.com/library/security/MS15-034
]]
---
-- @usage nmap -sV --script vuln <target>
-- @usage nmap -p80 --script http-vuln-cve2015-1635.nse <target>
-- @usage nmap -sV --script http-vuln-cve2015-1635 --script-args uri='/anotheruri/' <target>
-- @output
-- PORT STATE SERVICE REASON
-- 80/tcp open http syn-ack
-- | http-vuln-cve2015-1635:
-- | VULNERABLE:
-- | Remote Code Execution in HTTP.sys (MS15-034)
-- | State: VULNERABLE (Exploitable)
-- | IDs: CVE:CVE-2015-1635
-- | A remote code execution vulnerability exists in the HTTP protocol stack (HTTP.sys) that is
-- | caused when HTTP.sys improperly parses specially crafted HTTP requests. An attacker who
-- | successfully exploited this vulnerability could execute arbitrary code in the context of the System account.
-- |
-- | Disclosure date: 2015-04-14
-- | References:
-- | https://technet.microsoft.com/en-us/library/security/ms15-034.aspx
-- |_ http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-1635
-- @args http-vuln-cve2015-1635.uri URI to use in request. Default: /
---
author = {"Kl0nEz", "Paulino <calderon()websec.mx>"}
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"vuln", "safe"}
portrule = shortport.http
local VULNERABLE = "Requested Range Not Satisfiable"
local PATCHED = "The request has an invalid header name"
action = function(host, port)
local uri = stdnse.get_script_args(SCRIPT_NAME..".uri") or "/"
local vuln_report = vulns.Report:new(SCRIPT_NAME, host, port)
local vuln = {
title = 'Remote Code Execution in HTTP.sys (MS15-034)',
state = vulns.STATE.NOT_VULN,
description = [[
A remote code execution vulnerability exists in the HTTP protocol stack (HTTP.sys) that is
caused when HTTP.sys improperly parses specially crafted HTTP requests. An attacker who
successfully exploited this vulnerability could execute arbitrary code in the context of the System account.
]],
IDS = {CVE = 'CVE-2015-1635'},
references = {
'https://technet.microsoft.com/en-us/library/security/ms15-034.aspx'
},
dates = {
disclosure = {year = '2015', month = '04', day = '14'},
}
}
local options = {header={}}
options['header']['Host'] = rand.random_alpha(8)
options['header']['Range'] = "bytes=0-18446744073709551615"
local response = http.get(host, port, uri, options)
if response.status and response.body then
if response.status == 416 and string.find(response.body, VULNERABLE) ~= nil
and string.find(response.header["server"], "Microsoft") ~= nil then
vuln.state = vulns.STATE.VULN
end
if response.body and string.find(response.body, PATCHED) ~= nil then
stdnse.debug2("System is patched!")
vuln.state = vulns.STATE.NOT_VULN
end
end
return vuln_report:make_output(vuln)
end
|
--item.lua
local cobbleWall = table.deepcopy(data.raw["wall"]["stone-wall"])
cobbleWall.name = "cobblestone-wall"
cobbleWall.max_health = 20
cobbleWall.minable.result = "cobblestone-wall"
local recipe = table.deepcopy(data.raw.recipe["stone-wall"])
recipe.enabled = false
recipe.name = "cobblestone-wall"
recipe.ingredients = {{"stone",10},}
recipe.result = "cobblestone-wall"
data:extend{cobbleWall,recipe}
local cobbleWall = util.table.deepcopy(data.raw["item"]["stone-wall"])
cobbleWall.name = "cobblestone-wall"
cobbleWall.place_result = "cobblestone-wall"
data:extend({cobbleWall})
table.insert(data.raw["technology"]["basic-mining"].effects, {type="unlock-recipe", recipe="cobblestone-wall"})
data.raw["technology"]["basic-mining"].hidden=true
|
MaskModule = MaskModule or class(ItemModuleBase)
MaskModule.type_name = "Mask"
function MaskModule:init(...)
self.clean_table = table.add(clone(self.clean_table), {
{param = "pcs", action = "no_number_indexes"},
{param = "offsets", action = function(tbl)
for _, v in pairs(tbl) do
v[2] = BeardLib.Utils:normalize_string_value(v[2])
end
end}
})
return MaskModule.super.init(self, ...)
end
function MaskModule:RegisterHook()
self._config.default_amount = self._config.default_amount and tonumber(self._config.default_amount) or 1
Hooks:PostHook(BlackMarketTweakData, "_init_masks", self._config.id .. "AddMaskData", function(bm_self)
if bm_self.masks[self._config.id] then
self:Err("Mask with id '%s' already exists!", self._config.id)
return
end
local data = table.merge({
name_id = "bm_msk_" .. self._config.id,
desc_id = "bm_msk_" .. self._config.id .. "_desc",
dlc = self.defaults.dlc,
pcs = {},
value = 0,
texture_bundle_folder = "mods",
global_value = self.defaults.global_value,
mod_path = self._mod.ModPath,
custom = true
}, self._config.item or self._config)
if self._config.guess_unit ~= false then
data.unit = data.unit or "units/mods/masks/msk_"..self._config.id.."/msk_"..self._config.id
end
bm_self.masks[self._config.id] = data
if data.drop ~= false and data.dlc then
TweakDataHelper:ModifyTweak({{
type_items = "masks",
item_entry = self._config.id,
amount = self._config.default_amount,
global_value = data.global_value
}}, "dlc", data.dlc, "content", "loot_drops")
end
end)
end
BeardLib:RegisterModule(MaskModule.type_name, MaskModule)
|
--- Example for common use
-- @module main
include("lib2.lua");
--include("classes/node.class.lua")
function macro.init()
-- Now those object are there by default make things easier
--tasktimer = CTaskTimer.new();
--taskstack = CTaskStack.new();
tasktimer:registerTask("test1",secondsToTimer(1),function() print("Hello") return STATE_SUCCESS end );
tasktimer:registerTask("test2",secondsToTimer(2.5),function() print("How") return STATE_SUCCESS end );
tasktimer:registerTask("test3",secondsToTimer(4.5),function() print("Are") return STATE_SUCCESS end );
tasktimer:registerTask("test4",secondsToTimer(4.5),function() print("You") return STATE_SUCCESS end);
tasktimer:registerTask("test1",secondsToTimer(5),function() print("Spam") return STATE_SUCCESS end);
-- The little simpler alternative is :
-- timerFactory("test1",secondsToTimer(5),function() print("Spam") return STATE_SUCCESS end)
taskstack:push_state("testx",function() print("Hello") return STATE_SUCCESS end);
--The more simpler alternative is :
-- taskFactory("STRING_PRINT",function(string) print(string) return STATE_SUCCESS end, string);
-- It easier because you need in the simple case no second call to push the args
-- and you can return direktly out of the function/task by: return taskFactory(..) because
-- it return STATE_PENNDING,
-- load XML data from file "test.xml" into local table xfile
-- if(filesystem.fileExists("p1.xml")) then
-- print("yo");
-- current_dir = filesystem.getCWD();
-- local num = string.find(current_dir,"scripts",1,true) or string.find(current_dir,"lib",1,true)
-- local sestring = string.sub(current_dir,1,num-2);
-- print(current_dir);
-- print(sestring.." w "..num);
-- end
--validXML("p1.xml");
--local node = xml.load("ks-last-ks.xml");
--__WPL = CWaypointList();
--__WPL:load("ks-last-ks.xml");
--table.show(xfile); print_r(xfile);
--table.save(xfile,"new.lua");
--database.skills[name]
end
function macro.main()
taskstack:run();
tasktimer:timed_run();
--[[
I also implemented yrestTask(msec) and restTaks(msec) if you need to wait for something
they behave like the taskFactory or timerFactory means you can jump out directly of the
function/task by return yrestTask(..).
If everything break yrest and rest also avaible but the use isn't recommended.
]]--
--[[
The (new) format for task functions is:
function mytask(task, arg1, arg2,..argN)
How can I save vars to the task longer than the run?!:
task:setVar("myvar",var);
You get them back this way:
local myvar = task:getVar("mayVar");
Depending what you want you need return one of those 3:
local SomeoneOfThese = STATE_PENNDING STATE_FAILED STATE_SUCCESS
return SomeoneOfThese, arg1 , arg2 ,...argN;
end
--]]
return true;
end
function macro.event()
end
|
-- Converted API
if not wmbapi then -- Use wmbapi variable to detect whether MiniBot's API is fully loaded
return
end
__LB__ = wmbapi
lb = wmbapi
CancelPendingSpells = CancelPendingSpell
ClickPosition = ClickPosition
CreateDirectory = CreateDirectory
DirectoryExists = DirectoryExists
FileExists = FileExists
GetBaseDirectory = GetAppDirectory
GetCameraPosition = GetCameraPosition
GetDirectories = GetDirectoryFolders
GetFiles = GetDirectoryFiles
GetGameDirectory = GetWoWDirectory
GetKeyState = GetKeyState
GetMapId = GetCurrentMapInfo
GetObjects = function()
local objects = {}
for i=1,wmbapi.GetObjectCount() do
tinsert(objects,wmbapi.GetObjectWithIndex(i))
end
return objects
end
GetPlayerCorpsePosition = GetCorpsePosition
GetWindowSize = function()
return GetScreenWidth(), GetScreenHeight()
end
NavMgr_GetPath = FindPath
IsAoEPending = IsAoEPending
MoveTo = MoveTo
ObjectCreator = UnitCreator
ObjectDynamicFlags = ObjectDynamicFlags
ObjectExists = ObjectExists
ObjectFacing = ObjectFacing
ObjectId = function(...) return ... and tonumber(string.match(UnitGUID(...), "-(%d+)-%x+$"), 10) end
ObjectInteract = InteractUnit
ObjectPitch = UnitPitch
ObjectPointer = function(...)
if not UnitIsVisible(...) then
return
end
local pointer = nil
for i=1,wmbapi.GetObjectCount() do
pointer = wmbapi.GetObjectWithIndex(i)
if UnitIsVisible(pointer) and UnitIsUnit(pointer,...) then
return pointer
end
end
end
ObjectPosition = ObjectPosition
Raycast = TraceLine
ReadFile = ReadFile
SetPlayerAngles = FaceDirection
UnitBoundingRadius = UnitBoundingRadius
UnitCastingInfo = function(...) return select(7,GetSpellInfo(UnitCastingInfo(...))), wmbapi.UnitCastingTarget end
UnitChannelInfo = function(...) return select(7,GetSpellInfo(UnitChannelInfo(...))), wmbapi.UnitCastingTarget end
UnitCombatReach = UnitCombatReach
UnitFlags = UnitFlags
UnitIsLootable = UnitIsLootable
UnitMovementFlags = GetUnitMovementFlagsTable
UnitTarget = UnitTarget
UpdateAFK = ResetAfk
WriteFile = WriteFile
-- Missing API
UpdatePlayerMovement = nil
Unlock = nil
UnitTagHandler = nil
UnitNpcFlags = nil
UnitHasMovementFlag = nil
UnitHasNpcFlag = nil
UnitHasFlag = nil
UnitHasFlag2 = nil
UnitFlags2 = nil
UnitAuras = nil
SetDevMode = nil
SetCameraAngles = nil
RunString = nil
PlayerSpecializationId = nil
ObjectRawFacing = nil
ObjectLocked = nil
ObjectHasDynamicFlag = nil
GameObjectHasLockType = nil
GameObjectLockTypes = nil
GameObjectType = nil
GetCameraAngles = nil
GetClientType = nil
GetClockTime = nil
GetDevMode = nil
GetGameAccountName = nil
GetDistance3D = nil
GetLastWorldClickPosition = nil
Navigator.GetDestination = nil
Navigator.MoveTo = nil
Navigator.Stop = nil
NavMgr_GetClosestPointOnMesh = nil
NavMgr_GetClosestPointInCubes = nil
NavMgr_GetMeshState = nil
NavMgr_GetNavConnection = nil
NavMgr_GetPathIndex = nil
NavMgr_GetRandomPoint = nil
NavMgr_GetRandomPointInCircle = nil
NavMgr_GetThresholds = nil
NavMgr_IsPositionOnMesh = nil
NavMgr_IsReachable = nil
NavMgr_IsUIVisible = nil
NavMgr_MoveTo = nil
NavMgr_SetPathIndex = nil
NavMgr_Stop = nil
NavMgr_ToggleUI = nil
--Modified API
request = SendHttpRequest(info)
-- The request info.
info = {
-- string: The request URL.
Url = "https://www.microsoft.com/",
-- string: The request method, can be "GET", "POST", "PUT" or "DELETE".
Method = "POST",
-- string: The additional request headers.
Headers = "Content-Type: application/json\r\nX-Custom: test",
-- string: The request body, only used Method is "POST" or "PUT".
Body = "{\"test\": 123}",
-- string: The pinned HTTPs server certificate as a protection for packet sniffing. If provided, the server certificate must match it or the HTTP request would fail with status "INVALID_CERTIFICATE".
Certificate = "PINNED CERTIFICATE"
}
-- Returns the HTTP request ID if sent successfully, for querying HTTP response later.
request = "abc123"
--New API
status[, response] = ReceiveHttpResponse(request)
-- The HTTP request ID previously sent.
request = "abc123"
-- The current status of the HTTP request, can be:
-- "REQUESTING": The request is still on the way.
-- "REQUEST_FAILED": The request is terminated due to failures.
-- "INVALID_CERTIFICATE": The request is terminated due to invalid HTTPs certificate.
-- "RESPONDING": Downloading response after the request is sent.
-- "RESPONSE_HEADERS_FAILED": The response download is terminated while fetching response headers.
-- "RESPONSE_BODY_FAILED": The response download is terminated while fetching response body.
-- "SUCCESS": The response is received and everything about the HTTP request is done.
status = "CONNECTING"
-- The response data, available if status is "SUCCESS"
response = {
-- number: The HTTP response status code.
Code = 200,
-- string: The HTTP response headers.
Headers = "HTTP/1.1 200 OK...",
-- string: The HTTP response body.
Body = "...",
-- string: The actual server certificate if the request is HTTPs, which can be used for pinning.
Certificate = "SERVER CERTIFICATE",
}
object = GetObjectWithGUID(guid)
--Gets the object by its GUID.
distance = GetDistanceBetweenObjects(object1, object2)
--Gets the distance between two objects in 3D.
facing, pitch = GetAnglesBetweenObjects(object1, object2)
--Gets the angles (facing & pitch) between two objects.
isOrNot = ObjectIsFacing(object1, object2[, tolerance = PI/2])
--Checks if an object is facing another object.
isOrNot = ObjectIsBehind(object1, object2)
--Checks if an object is behind another object.
transport = UnitTransport(unit)
--Gets the transport object of a unit.
path = GetAppStorageDirectory()
--Gets the base directory path of app storage.
value = SetSystemVar(name, value)
--Sets a system variable.
--The standard Lua environment gets reset after screen switch including /reload. All Lua variables get lost because of this.
--In this way, we provide "System Variables" that allow you to persist information across different screens in the current game session. This is similar as the game "Console Variable", consisting of a name-value pair.
value = GetSystemVar(name)
--Gets the value of the system variable previously set by SetSystemVar. nil if it does not exist.
centers = GetAllSpanningCircles(radius, minWeight, points)
--Gets all spanning circles of a specific radius over certain weighted points.
success = PlaySoundFile(path)
--Plays a specific sound WAV/MP3 file once.
SetCustomScript(name, script)
--Add a custom script (indexed by name) that gets loaded side by side with the engine modules (Primary and Secondary). Notice that such script also gets loaded in GLUE screen.
count = GetMissileCount()
--Gets the count of the flying missiles.
spellId, spellVisualId, x, y, z, sourceObject, sourceX, sourceY, sourceZ, targetObject, targetX, targetY, targetZ = GetMissileWithIndex(index)
--Gets the info of a specific missile.
success = LoadMap(mapId)
--Loads a navigation map.
success = UnloadMap(mapId)
--Unloads a navigation map.
isOrNot = IsMapLoaded(mapId)
--Checks if a navigation map is loaded.
scale = ObjectScale(object)
--Gets the scale of an object.
fields = GetObjectFieldsTable()
--Gets the table that contains all object field offsets.
value = ObjectField(object, offset, type)
--Gets a field value of an object.
descriptors = GetObjectDescriptorsTable()
--Gets the table that contains all object descriptor offsets.
value = ObjectDescriptor(object, offset, type)
--Gets a descriptor value of an object.
flags = ObjectTypeFlags(object)
--Gets the type flags of an object.
isOrNot = ObjectIsType(object, type)
--Checks if an object is of specific type.
value = UnitMovementField(unit, offset, type)
--Gets the field value of a unit's movement struct.
isOrNot = UnitIsMounted(unit)
--Gets whether a unit is mounted.
isOrNot = UnitIsSkinnable(unit)
--Gets whether a unit is skinnable.
count = GetNpcCount([center | x, y, z][, range][, option])
--Gets the count of specific NPCs.
npc = GetNpcWithIndex(index)
--Gets a specific NPC by its index.
count = GetPlayerCount([center | x, y, z][, range][, option])
--Gets the count of specific players.
player = GetPlayerWithIndex(index)
--Gets a specific player by its index.
count = GetGameObjectCount([center | x, y, z][, range][, option])
--Gets the count of specific game objects.
gameObject = GetGameObjectWithIndex(index)
--Gets a specific game object by its index.
count = GetDynamicObjectCount([center | x, y, z][, range][, option])
--Gets the count of specific dynamic objects.
dynamicObject = GetDynamicObjectWithIndex(index)
--Gets a specific dynamic object by its index.
count = GetAreaTriggerCount([center | x, y, z][, range][, option])
--Gets the count of specific area triggers.
areaTrigger = GetAreaTriggerWithIndex(index)
--Gets a specific area trigger by its index.
SetCameraDistanceMax([distance])
--Sets the current camera distance maximum. If nil, restore original setting.
SetClimbAngle([angle])
--Sets the engine allowed climb angle, in radian. If nil, restore original setting.
isOnScreen, x, y = WorldToScreen(object | x, y, z)
--Projects a world position to the screen NDC position.
x, y, z[, object] = ScreenToWorld(x, y)
--Projects a screen NDC position to a world object or a terrain position.
success = SetCVarEx(name, value)
--Sets a CVar without system limitation.
StopFalling()
--Stops the current falling of the character right now.
SetNameplateDistanceMax([distance])
--Sets the current nameplate visible distance maximum. If nil, restore original setting.
EnableFlyingMode(enabled)
--Enable/Disable flying mode (slow mode falls) of the character. (DO NOT enable flying while falling or you would get disconnected)
isFlying = IsFlyingModeEnabled()
--Gets whether flying mode is enabled for the character.
SetNoClipModes(modes)
--Sets the current no-clip mode flags: 0: none 1: building 2: static object 4: dynamic object
modes = GetNoClipModes()
--Gets the current no-clip mode flags
--ObjectTypes
wmbapi.GetObjectTypeFlagsTable().Object
wmbapi.GetObjectTypeFlagsTable().Item
wmbapi.GetObjectTypeFlagsTable().Container
wmbapi.GetObjectTypeFlagsTable().AzeriteEmpoweredItem
wmbapi.GetObjectTypeFlagsTable().AzeriteItem
wmbapi.GetObjectTypeFlagsTable().Unit
wmbapi.GetObjectTypeFlagsTable().Player
wmbapi.GetObjectTypeFlagsTable().ActivePlayer
wmbapi.GetObjectTypeFlagsTable().GameObject
wmbapi.GetObjectTypeFlagsTable().DynamicObject
wmbapi.GetObjectTypeFlagsTable().Corpse
wmbapi.GetObjectTypeFlagsTable().AreaTrigger
wmbapi.GetObjectTypeFlagsTable().SceneObject
wmbapi.GetObjectTypeFlagsTable().Conversation
--MovementFlags
wmbapi.GetUnitMovementFlagsTable().Forward
wmbapi.GetUnitMovementFlagsTable().Backward
wmbapi.GetUnitMovementFlagsTable().StrafeLeft
wmbapi.GetUnitMovementFlagsTable().StrafeRight
wmbapi.GetUnitMovementFlagsTable().TurnLeft
wmbapi.GetUnitMovementFlagsTable().TurnRight
wmbapi.GetUnitMovementFlagsTable().PitchUp
wmbapi.GetUnitMovementFlagsTable().PitchDown
wmbapi.GetUnitMovementFlagsTable().Walking
wmbapi.GetUnitMovementFlagsTable().Immobilized
wmbapi.GetUnitMovementFlagsTable().Falling
wmbapi.GetUnitMovementFlagsTable().FallingFar
wmbapi.GetUnitMovementFlagsTable().Swimming
wmbapi.GetUnitMovementFlagsTable().Ascending
wmbapi.GetUnitMovementFlagsTable().Descending
wmbapi.GetUnitMovementFlagsTable().CanFly
wmbapi.GetUnitMovementFlagsTable().Flying
--Types
wmbapi.GetValueTypesTable().Bool
wmbapi.GetValueTypesTable().Char
wmbapi.GetValueTypesTable().Byte
wmbapi.GetValueTypesTable().Short
wmbapi.GetValueTypesTable().UShort
wmbapi.GetValueTypesTable().Int
wmbapi.GetValueTypesTable().UInt
wmbapi.GetValueTypesTable().Long
wmbapi.GetValueTypesTable().ULong
wmbapi.GetValueTypesTable().Float
wmbapi.GetValueTypesTable().Double
wmbapi.GetValueTypesTable().String
wmbapi.GetValueTypesTable().GUID
--HitFlags
M2Collision = 0x1
M2Render = 0x2
WMOCollision = 0x10
WMORender = 0x20
Terrain = 0x100
WaterWalkableLiquid = 0x10000
Liquid = 0x20000
EntityCollision = 0x100000
|
--- Wrapper over [Spot](https://github.com/r-lyeh/spot)'s image class.
--
-- Spot images implement the [ByteReader protocol](https://ggcrunchy.github.io/corona-plugin-docs/DOCS/ByteReader/policy.html). By
-- default they send RGBA image data, but the raw floating-point data may be used instead, cf. @{SpotImage:set_reader_mode}.
--
-- The **Bytes** type—specified below—may be any object that implements said protocol, including strings.
--
-- **NOTE** Spot image support is still experimental.
--
-- ==============================================
--
-- **(The comments that follow were adapted from Spot's README.)**
--
-- - Spot is a compact and embeddable pixel / image library.
-- - Spot supports both RGBA / HSLA pixel types.
-- - Spot provides both pixel and image algebra for pixel / image manipulation.
-- - Spot loads WEBP, JPG, progressive JPG, PNG, TGA, DDS DXT1/2/3/4/5, BMP, PSD, GIF, PVR2/3 (ETC1/PVRTC), KTX (ETC1/PVRTC), PKM (ETC1), HDR, PIC, PNM (PPM/PGM), CRN, PUG, FLIF, CCZ, EXR and vectorial SVG files.
-- - Spot saves WEBP, JPG, PNG, TGA, BMP, DDS, PVR3 (PVRTC), KTX (ETC1), PKM (ETC1), CCZ and PUG files.
--
-- (**N.B.** ETC and FLIF are disabled on iOS until some issues are resolved.)
--
-- **Licenses**
--
-- - [spot](https://github.com/r-lyeh/spot) (ZLIB license).
-- - [crn2dds](redist/deps/crn2dds) by r-lyeh, SpartanJ and Evan Parker (Public Domain).
-- - [crnlib](https://code.google.com/p/crunch/), by Rich Geldreich (ZLIB license).
-- - [DDS writer](http://www.lonesock.net/soil.html) by Jonathan Dummer (Public Domain).
-- - [etc1utils](redist/deps/soil2/etc1_utils.h) by Google Inc (Apache 2.0 license).
-- - [etcpak](https://bitbucket.org/wolfpld/etcpak/wiki/Home) by Bartosz Taudul (BSD-3 license).
-- - [flif](https://github.com/flif-hub/flif) by Jon Sneyers and Pieter Wuille (Apache 2.0 license).
-- - [jpge](https://code.google.com/p/jpeg-compressor/) by Rich Geldreich (Public Domain).
-- - [libwebp](https://code.google.com/p/webp/) by Google Inc (BSD license).
-- - [lodepng](http://lodev.org/lodepng/) by Lode Vandevenne (ZLIB license).
-- - [nanosvg](https://github.com/memononen/nanosvg/) by Mikko Mononen (ZLIB license).
-- - [pngrim](https://github.com/fgenesis/pngrim) alpha bleeding algorithm by F-Genesis (Public Domain).
-- - [pug](https://github.com/r-lyeh/pug) (Public Domain).
-- - [pvrtccompressor](https://bitbucket.org/jthlim/pvrtccompressor/) by Jeffrey Lim (BSD-3 license).
-- - [rg_etc1](https://code.google.com/p/rg-etc1/) by Rich Geldreich (ZLIB license).
-- - [soil2](https://bitbucket.org/SpartanJ/soil2/) by Martin Lucas Golini and Jonathan Dummer (Public Domain).
-- - [stb_image](http://github.com/nothings/stb) by Sean Barrett (Public Domain).
-- - [tinyexr](https://github.com/syoyo/tinyexr) by Syoyo Fujita (BSD3 license).
-- - [unifont](https://github.com/r-lyeh/unifont) (ZLIB license).
--
-- ===============================================
-- @classmod SpotImage
--
-- Permission is hereby granted, free of charge, to any person obtaining
-- a copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
-- without limitation the rights to use, copy, modify, merge, publish,
-- distribute, sublicense, and/or sell copies of the Software, and to
-- permit persons to whom the Software is furnished to do so, subject to
-- the following conditions:
--
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--
-- [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
--
--- Metamethod.
--
-- The right-hand argument must be a **SpotColor**, and is added to each pixel.
--
-- Any errors are propagated.
-- @function SpotImage:__add
-- @treturn SpotImage The post-addition image.
--- Modify this image by adding a color to each pixel.
-- @function SpotImage:add_mutate
-- @tparam SpotColor color Color to add.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Create a new image with this image's pixels run through a blank filter.
-- @function SpotImage:blank
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Create a new image with this image's pixels run through a bleed filter.
-- @function SpotImage:bleed
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Create a new image with this image's pixels run through a checker filter.
-- @function SpotImage:checkered
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Create a new image with all pixels' color components clamped to [0, 1].
-- @function SpotImage:clamp
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Copy a region of this image, given an offset and optional size.
-- @function SpotImage:copy
-- @uint x Horizontal offset of region, ≥ 1...
-- @uint y ...and vertical offset, ≥ 1.
-- @tparam ?uint w Width of new image... (If absent, the rest of the width, given _x_.)
-- @tparam ?uint h ...and height. (If absent, the rest of the height, given _y_.)
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Copy a region of this image, given the edge offsets.
-- @function SpotImage:crop
-- @uint l Left-hand edge, ≥ 1...
-- @uint r ...and right-hand edge, between _l_ and the width, inclusive.
-- @uint t Top edge, ≥ 1...
-- @uint b ...and bottom edge, between _t_ and the height, inclusive.
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Metamethod.
--
-- The right-hand argument must be a **SpotColor**, and each pixel is divided by it.
--
-- Any errors are propagated.
-- @function SpotImage:__div
-- @treturn SpotImage The post-division image.
--- Modify this image by dividing each pixel by a color.
-- @function SpotImage:div_mutate
-- @tparam SpotImage color Color to divide by.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error mesage.
--- Save this image out to memory, in the requested format.
-- @function SpotImage:encode
-- @string format One of **"PNG"**, **"JPG"**, **"PUG"**, **"WEBP"**, **"KTX"**, **"PVR"**, **"CCZ"**, or **"PKM"**,
-- corresponding to the encoding format.
-- @tparam ?table opts Encoding options, which include:
--
-- * **channels**: Number of channels in the output, an integer from 1 to 4 (by default, 4). At the moment, this only
-- applies to the PNG format.
-- * **quality**: A value between 1 and 100 (by default, 90) that describes the requested encoding quality. This is
-- available to all formats except PNG.
-- @treturn[1] string On success, the encoded image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Create a new image with all this image's pixels' rows flipped.
-- @function SpotImage:flip_h
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Create a new image with all this image's pixels' columns flipped.
-- @function SpotImage:flip_w
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Get a color from the first row of this image.
-- @function SpotImage:get
-- @uint x Horizontal offset, from 1 to the width.
-- @treturn[1] SpotColor On success, a copy of the color.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Get a color from this image.
-- @function SpotImage:get
-- @uint x Horizontal offset, from 1 to the width...
-- @uint y ...and vertical offset, from 1 to the height.
-- @treturn[1] SpotColor On success, a copy of the color.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Get a color from this image, allowing for depth.
-- @function SpotImage:get
-- @uint x Horizontal offset, from 1 to the width...
-- @uint y ...vertical offset, from 1 to the height...
-- @uint z ...and depth-wise offset, from 1 to the depth.
-- @treturn[1] SpotColor On success, a copy of the color.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Get a color from the first row of this image, using normalized coordinates.
-- @function SpotImage:getf
-- @number x Horizontal offset, in [0, 1].
-- @treturn[1] SpotColor On success, a copy of the color.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Get a color from this image, using normalized coordinates.
-- @function SpotImage:getf
-- @uint x Horizontal offset, in [0, 1]...
-- @uint y ...and vertical offset, ditto.
-- @treturn[1] SpotColor On success, a copy of the color.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Get a color from this image, using normalized coordinates and allowing for depth.
-- @function SpotImage:getf
-- @uint x Horizontal offset, in [0, 1]...
-- @uint y ...and vertical offset, ditto...
-- @number z ...and depth-wise offset, ditto.
-- @treturn[1] SpotColor On success, a copy of the color.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Create a new image with this image's pixels run through a glow filter.
-- @function SpotImage:glow
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Populate this image from an image file.
-- @function SpotImage:load
-- @param[opt=system.ResourceDirectory] baseDir (**WIP**) Directory to search, as per
-- [system.pathForFile](https://docs.coronalabs.com/api/library/system/pathForFile.html).
-- @string filename Name of file.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- (**WIP**) Alternate method overload.
-- @function SpotImage:load
-- @ptable params Info parameters. This must include **filename** and may have a **baseDir** field, with meanings as in
-- the other overload.
--
-- If an **is\_absolute** is present and true, _filename_ is interpreted as an absolute path (any _baseDir_ is ignored). On
-- non-desktop platforms, this raises an error.
-- @return As per the other overload.
--- Populate this image from an in-memory image.
-- @function SpotImage:load_from_memory
-- @tparam Bytes bytes Undecoded image contents.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Populate this image from an HDR image file.
-- @function SpotImage:load_hdr
-- @string filename Name of file.
-- @param[opt=system.ResourceDirectory] baseDir (**WIP**) Directory to search, as per
-- [system.pathForFile](https://docs.coronalabs.com/api/library/system/pathForFile.html).
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- (**WIP**) Alternate method overload.
-- @function SpotImage:load_hdr
-- @ptable params Load parameters. See the table overload of @{SpotImage:load} for details.
-- @return As per the other overload.
--- Populate this image from an in-memory HDR image.
-- @function SpotImage:load_hdr_from_memory
-- @tparam Bytes bytes Undecoded image contents.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Did the most recent load operation succeed?
-- @function SpotImage:loaded
-- @treturn boolean Load was successful?
--- Metamethod.
--
-- The right-hand argument must be a **SpotColor**, and each pixel is multiplied by it.
--
-- Any errors are propagated.
-- @function SpotImage:__mul
-- @treturn SpotImage The post-multiplication image.
--- Modify this image by multiplying each pixel by a color.
-- @function SpotImage:mul_mutate
-- @tparam SpotColor color Color to multiply by.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error mesage.
--- Paste an image (or part of one, if too large) into this image at an offset.
-- @function SpotImage:paste
-- @uint x Horizontal offset , ≥ 1...
-- @uint y ...and vertical offset, ≥ 1.
-- @tparam SpotImage image Image to add.
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- (**WIP**) Create a new image with alpha premultiplied into all this image's pixel colors.
-- @function SpotImage:premultiply
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
-- @see SpotColor:premultiply
--- (**WIP**) Modify this image by premultiplying alpha into all pixels.
-- @function SpotImage:premultiply_mutate
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error mesage.
-- @see SpotColor:premultiply
--- Get the image contents in RGBA byte form.
-- @function SpotImage:rgba
-- @treturn[1] string The image as bytes.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Create a new image with this image's contents rotated left 90°.
-- @function SpotImage:rotate_left
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Create a new image with this image's contents rotated right 90°.
-- @function SpotImage:rotate_right
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Save this image to a file.
-- @function SpotImage:save
-- @string filename Name of file.
-- @param[opt=system.DocumentsDirectory] baseDir (**WIP**) Directory in which to save, as per
-- [system.pathForFile](https://docs.coronalabs.com/api/library/system/pathForFile.html).
-- @tparam ?table opts Save options.
--
-- In addition to the choices available in @{SpotImage:encode}, a **format** may be provided with any of
-- **"BMP"**, **"DDS"**, **"TGA"**, **"PNG"**, **"JPG"**, **"PUG"**, **"WEBP"**, **"KTX"**, **"PVR"**,
-- **"CCZ"**, or **"PKM"**, to explicitly save in the given format (by default, the method expects one of
-- these as _filename_'s extension).
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Set a color in the first row of this image.
-- @function SpotImage:set
-- @uint x Horizontal offset, from 1 to the width.
-- @tparam SpotColor color Color to assign.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Set a color in this image.
-- @function SpotImage:set
-- @uint x Horizontal offset, from 1 to the width...
-- @uint y ...and vertical offset, from 1 to the height.
-- @tparam SpotColor color Color to assign.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Set a color in this image, allowing for depth.
-- @function SpotImage:set
-- @uint x Horizontal offset, from 1 to the width...
-- @uint y ...vertical offset, from 1 to the height.
-- @uint z ...and depth-wise offset, from 1 to the depth.
-- @tparam SpotColor color Color to assign.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Set a color in the first row of this image, using normalized coordinates.
-- @function SpotImage:setf
-- @number x Horizontal offset, in [0, 1].
-- @tparam SpotColor color Color to assign.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Set a color in this image, using normalized coordinates.
-- @function SpotImage:setf
-- @number x Horizontal offset, in [0, 1]...
-- @number y ...and vertical offset, ditto.
-- @tparam SpotColor color Color to assign.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Set a color in this image, using normalized coordinates and allowing for depth.
-- @function SpotImage:setf
-- @number x Horizontal offset, in [0, 1]...
-- @number y ...and vertical offset, ditto.
-- @number z ...and depth-wise offset, ditto.
-- @tparam SpotColor color Color to assign.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error message.
--- Set the mode used when bytes are read from the image, cf. the summary above.
-- @function SpotImage:set_reader_mode
-- @param mode If this is **"raw"**, the image will expose its bytes directly, in floating-point form.
--
-- Otherwise, something like `result = image:rgba()` is performed, with _result_ used instead. This is
-- the default behavior.
-- @see SpotImage:rgba
--- Metamethod.
--
-- The right-hand argument must be a **SpotColor**, and is subtracted from each pixel.
--
-- Any errors are propagated.
-- @function SpotImage:__sub
-- @treturn SpotImage The post-subtraction image.
--- Modify this image by subtracting a color from each pixel.
-- @function SpotImage:sub_mutate
-- @tparam SpotColor color Color to subtract.
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error mesage.
--- Create a clone of this image with components in HSLA form.
-- @function SpotImage:to_hsla
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- Create a clone of this image with components in RGBA form.
-- @function SpotImage:to_rbga
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
--- (**WIP**) Create a new image with alpha un-premultiplied from all this image's pixel colors.
-- @function SpotImage:unpremultiply
-- @treturn[1] SpotImage New image.
-- @return[2] **nil**, meaning failure.
-- @treturn[2] string Error message.
-- @see SpotColor:unpremultiply
--- (**WIP**) Modify this image by un-premultiplying alpha from all pixels.
-- @function SpotImage:unpremultiply_mutate
-- @return[1] **true**, indicating success.
-- @return[2] **false**, meaning failure.
-- @treturn[2] string Error mesage.
-- @see SpotColor:unpremultiply
|
local _M = require 'resty.http_ng.backend.cache'
local fake_backend = require 'fake_backend_helper'
local spy = require 'luassert.spy'
local cache_store = require 'resty.http_ng.cache_store'
local http_response = require 'resty.http_ng.response'
local http_request = require 'resty.http_ng.request'
local test_backend_client = require 'resty.http_ng.backend.test'
describe('cache backend', function()
local test_backend
before_each(function() test_backend = test_backend_client.new() end)
after_each(function() test_backend.verify_no_outstanding_expectations() end)
describe('GET method', function()
local function cache(res, options)
local fake = fake_backend.new(res)
return _M.new(fake, options or { cache_store = cache_store.new() })
end
it('accesses the url', function()
local res = spy.new(function(req) return http_response.new(req, 200, { }, 'ok') end)
local request = http_request.new{method = 'GET', url = 'http://example.com/' }
local response, err = cache(res):send(request)
assert.falsy(err)
assert.truthy(response)
assert.spy(res).was.called(1)
assert.equal('ok', response.body)
assert.equal('MISS', response.headers.x_cache_status)
end)
it('works with etag and must-revalidate', function()
local request = http_request.new{method = 'GET', url = 'http://example.com/test' }
local backend = _M.new(test_backend, { cache_store = cache_store.new() })
local headers = {
ETag = 'etag-value', ['Cache-Control'] = 'max-age=0, private, must-revalidate', Vary = 'Accept-Encoding'
}
test_backend.expect{ url = 'http://example.com/test', headers = { via = '1.1 APIcast'} }.respond_with{ status = 200, body = 'ok', headers = headers }
test_backend.expect{ url = 'http://example.com/test', headers = { if_none_match = 'etag-value', via = '1.1 APIcast' } }
.respond_with{ status = 304, headers = headers }
local miss_response = assert(backend:send(request))
local hit_response = assert(backend:send(request))
assert.equal('MISS', miss_response.headers.x_cache_status)
assert.equal('REVALIDATED', hit_response.headers.x_cache_status)
assert.equal('ok', miss_response.body)
assert.equal('ok', hit_response.body)
end)
it('works with etag and must-revalidate and backend responds something else', function()
local request = http_request.new{method = 'GET', url = 'http://example.com/test' }
local backend = _M.new(test_backend, { cache_store = cache_store.new() })
local headers = {
ETag = 'etag-value', ['Cache-Control'] = 'max-age=0, private, must-revalidate', Vary = 'Accept-Encoding'
}
test_backend.expect{ url = 'http://example.com/test', headers = { via = '1.1 APIcast'} }.respond_with{ status = 200, body = 'ok', headers = headers }
test_backend.expect{ url = 'http://example.com/test', headers = { if_none_match = 'etag-value', via = '1.1 APIcast' } }
.respond_with{ status = 200, body = 'foo' }
local miss_response = assert(backend:send(request))
local hit_response = assert(backend:send(request))
assert.equal('MISS', miss_response.headers.x_cache_status)
assert.equal('MISS', hit_response.headers.x_cache_status)
assert.equal('ok', miss_response.body)
assert.equal('foo', hit_response.body)
end)
it('works with max-age', function()
local request = http_request.new{method = 'GET', url = 'http://example.com/test' }
local backend = _M.new(test_backend, { cache_store = cache_store.new() })
local headers = {
['Cache-Control'] = 'max-age=0, private'
}
test_backend.expect{ url = 'http://example.com/test', headers = { via = '1.1 APIcast'} }.respond_with{ status = 200, body = 'ok', headers = headers }
test_backend.expect{ url = 'http://example.com/test', headers = { via = '1.1 APIcast' } }.respond_with{ status = 200, body = 'foo' }
local miss_response = assert(backend:send(request))
local hit_response = assert(backend:send(request))
assert.equal('MISS', miss_response.headers.x_cache_status)
assert.equal('MISS', hit_response.headers.x_cache_status)
assert.equal('ok', miss_response.body)
assert.equal('foo', hit_response.body)
end)
it('accesses caches the call', function()
local server = spy.new(function(req)
assert.match('1.1 APIcast', req.headers.via)
return http_response.new(req, 200, {
cache_control = 'private, max-age=10'
}, 'ok')
end)
local backend = cache(server)
local request = http_request.new{method = 'GET', url = 'http://example.com/' }
local function response(req)
local res, err = backend:send(req)
assert.spy(server).was.called(1)
assert.truthy(res)
assert.falsy(err)
assert.equal('ok', res.body)
return res
end
local miss = response(request)
local hit = response(request)
assert.equal('MISS', miss.headers.x_cache_status)
assert.equal('HIT', hit.headers.x_cache_status)
assert.equal(0, hit.headers.age)
end)
end)
end)
|
--[[
Meta Portal Minimap - README
v0.1.0 - 2021/5/27
Contributors:
=============
Morticai (META) (https://www.coregames.com/user/d1073dbcc404405cbef8ce728e53d380)
Ooccoo (META) (https://www.coregames.com/user/a136c0d1d9454d539c9932354198fc29)
Divided (META) (https://www.coregames.com/user/eaba4947069846dbb72fc5efb0f04f47)
blaking707 (META) (https://www.coregames.com/user/0ea6612ceab7456a8a3a963a94808295)
Chris (Manticore) (https://www.coregames.com/user/d97586e1f850481da13ee26d5cbddc02)
Waffle (Manticore) (https://www.coregames.com/user/581ff579fd864966aec56450754db1fb)
Description:
============
Meta Portal Minimap is a component that allows creators to place high-quailty screenshots as a minimap backdrop, through the use of portals.
Getting an Image
================
1. Navigate to the "3D" group in the hierarchy under "Minimap Image". Within this group you will find a single Plane object and some World Text objects.
NOTE: The world text objects can be deleted if you don't want to have any labels on your minimap.
2. Select the Plane. Set it's position and scale so that it covers the entire area of what your minimap image will be.
3. Find the "MinimapSetup" group. Make sure that the "IsDevMode" property is checked.
4. Click the "Play" button and hit the zero key to go into capture mode. Also, make sure to hit F11 to go into fullscreen.
5. Using the 7 key (zoom in) and 8 key (zoom out), adjust the camera zoom until the panel is fills the screen as much as possible.
NOTE: It's okay if there is empty space on the top/bottom or left/right of the panel.
6. Hit the 5 key to hide the panel. Take a screen shot by hitting ALT + Print Screen.
7. Open MS Paint and paste your screen shot image. Save the image.
Publish the Image
=================
1. Save your current project and return to the Create tab in Core.
2. Create a blank project.
3. Once the editor opens for the new project, click on File->Publish Game.
4. Fill out the required information. Under "Screenshots" add your saved minimap image.
5. Publish the project as "Unlisted".
6. Once the "Success" window appears, click on the "Copy Link" button. Paste this game link somewhere so you don't lose it!
7. You should have a link such as: https://www.coregames.com/games/1b3aa6/meta-portal-image-examples
8. You will only need the Game ID portion which is: 1b3aa6/meta-portal-image-examples
Setup the Game Portal
=====================
1. Return to your original project.
2. Locate the "Game Portal" which is a child of "MapImageObjectGroup".
3. With the game portal selected, scroll down to the "Game ID" property and paste your game ID.
4. Just below that property you will see "Screenshot Index". Make sure this is set to 1.
5. Click the play button. You should see your minimap image overlayed by a UI rectangle.
6. If the portal image is not scaled correctly, then adjust the "ScaleMultiplier" property on "MinimapSetup".
7. If the portal image position is not alligned with the UI rectangle then adjust the position of the "Game Portal".
NOTE: Both of these adjustments can be made at run time when in Local Player Preview.
However, any changes made at run time are not saved so you need to either copy/paste
or take note of the changes you make so you can do them again when not in play mode.
Final Adjustments
=================
1. You can now uncheck "IsDevMode" on the "MinimapSetup" group.
2. Navigate to the "Minimap" script and uncheck the "EnableShapes" property.
You can also disable "EnableLabels" if you are not using labels for your minimap.
3. If you want to have the minimap in a different corner of the screen you can change the Dock property of the
Minimap Panel and then change it's position accordingly.
]]
|
-- ===========================================================================
-- Base File
-- ===========================================================================
include("TopPanel_Expansion1.lua");
include("toppanel_CQUI.lua");
|
data:extend{
{
type = "shortcut",
name = "moc-toggle",
icon = {
filename = "__MouseOverConstruction__/graphics/shortcut-x32.png",
y = 0,
size = 32,
mipmap_count = 2,
flags = {"icon"}
},
disabled_icon = {
filename = "__MouseOverConstruction__/graphics/shortcut-x32.png",
y = 32,
size = 32,
mipmap_count = 2,
flags = {"icon"}
},
small_icon = {
filename = "__MouseOverConstruction__/graphics/shortcut-x24.png",
y = 0,
size = 24,
mipmap_count = 2,
flags = {"icon"}
},
disabled_small_icon = {
filename = "__MouseOverConstruction__/graphics/shortcut-x24.png",
y = 24,
size = 24,
mipmap_count = 2,
flags = {"icon"}
},
action = "lua",
toggleable = true,
associated_control_input = "moc-toggle"
}
}
|
--
-- exit.lua
-- exit screen component
--
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful")
local helpers = require("helpers")
local keys = require("keys")
-- ========================================
-- Config
-- ========================================
-- icons path
local icons_path = beautiful.icons_path .. "exit_screen/"
-- buttons list
local buttons = {
{ name = "poweroff", caption = "Poweroff", icon = "exit_screen_poweroff" },
{ name = "reboot" , caption = "Reboot" , icon = "exit_screen_reboot" },
{ name = "suspend" , caption = "Suspend" , icon = "exit_screen_suspend" },
{ name = "logout" , caption = "Logout" , icon = "exit_screen_logout" },
{ name = "lock" , caption = "Lock" , icon = "exit_screen_lock" },
{ name = "cancel" , caption = "Cancel" , icon = "exit_screen_cancel" },
}
-- callback function for each button
local commands = {
poweroff = function ()
awful.spawn.with_shell("poweroff")
end,
reboot = function ()
awful.spawn.with_shell("reboot")
end,
suspend = function ()
awesome.emit_signal("exit_screen::hide")
awful.spawn.with_shell("systemctl suspend")
end,
logout = function ()
awesome.quit()
end,
lock = function ()
awesome.emit_signal("exit_screen::hide")
awesome.emit_signal("lock_screen::show")
end,
cancel = function ()
awesome.emit_signal("exit_screen::hide")
end,
}
-- map keybinds to functions
local keybindings = {
p = commands.poweroff,
r = commands.reboot,
s = commands.suspend,
e = commands.logout,
l = commands.lock,
q = commands.cancel,
x = commands.cancel,
Escape = commands.cancel,
}
-- ========================================
-- Logic
-- ========================================
-- Define a new class
local ExitScreen = {}
ExitScreen.__index = ExitScreen
-- Class constructor
function ExitScreen:new (screen)
-- create new class instance
local exit_screen = {}
setmetatable(exit_screen, ExitScreen)
-- screen instance
exit_screen.screen = screen
-- screen grabber instance
exit_screen.screen_grabber = nil
-- create widget components
exit_screen.widget = exit_screen:create_widget()
exit_screen:init_signals()
return exit_screen
end
-- create the widget
function ExitScreen:create_widget ()
-- Build buttons
local button_widgets = {}
for i, button in ipairs(buttons) do
button_widgets[i] = self:create_button(
button.caption,
button.icon,
commands[button.name]
)
end
local widget = wibox {
screen = self.screen,
x = self.screen.geometry.x,
y = self.screen.geometry.y,
height = self.screen.geometry.height,
width = self.screen.geometry.width,
visible = false,
ontop = true,
type = "splash",
bg = beautiful.exit_screen_bg,
}
widget:setup {
layout = wibox.layout.align.vertical,
expand = "none",
nil,
{
layout = wibox.layout.align.horizontal,
expand = "none",
nil,
{
layout = wibox.layout.fixed.horizontal,
spacing = beautiful.exit_screen_button_spacing,
table.unpack(button_widgets),
},
},
}
-- Define mouse bindings
widget:buttons(self.get_mousebindings())
return widget
end
-- build button widget
function ExitScreen:create_button (name, icon, cmd)
local button = wibox.widget {
layout = wibox.layout.fixed.vertical,
spacing = beautiful.exit_screen_caption_spacing,
{
id = "icon_wrapper",
layout = wibox.layout.align.horizontal,
expand = "none",
nil,
require("widgets.clickable_container")({
widget = wibox.widget.imagebox,
resize = true,
image = icons_path .. icon .. ".svg",
forced_height = beautiful.exit_screen_icon_size,
}),
},
{
widget = wibox.widget.textbox,
text = name,
align = "center",
valign = "center",
},
}
button.icon_wrapper.second:connect_signal("button::release", cmd)
button.icon_wrapper.second:set_shape(helpers.rrect)
return button
end
-- Init signals
function ExitScreen:init_signals ()
-- show the exit screen when signal is broadcasted
awesome.connect_signal("exit_screen::show", function()
if (awful.screen.focused() ~= self.screen) then return end
self:show()
self:activate_keybindings()
end)
-- hide the exit screen when signal is broadcasted
awesome.connect_signal("exit_screen::hide", function()
self:hide()
self:deactivate_keybindings()
end)
end
-- Get mousebindings
function ExitScreen:get_mousebindings ()
return gears.table.join(
-- Middle click - Hide exit_screen
awful.button({}, keys.midclick, commands.cancel),
-- Right click - Hide exit_screen
awful.button({}, keys.rightclick, commands.cancel)
)
end
-- Activate keybindings
function ExitScreen:activate_keybindings ()
self.screen_grabber = awful.keygrabber.run(function(_, key, event)
if event == "release" then return end
local cmd = keybindings[key]
if cmd ~= nil then cmd() end
end)
end
-- Deactivate keybindings
function ExitScreen:deactivate_keybindings ()
awful.keygrabber.stop(self.screen_grabber)
end
-- Show exit screen
function ExitScreen:show ()
self.widget.visible = true
end
-- Hide exit screen
function ExitScreen:hide ()
self.widget.visible = false
end
-- ========================================
-- Initialization
-- ========================================
awful.screen.connect_for_each_screen(function (s)
s.exit_screen = ExitScreen:new(s)
end)
|
return {
tag = 'mathOther',
summary = 'Create a new Curve.',
description = 'Creates a new `Curve` from a list of control points.',
arguments = {
n = {
type = 'number',
description = 'The number of points to reserve for the Curve.'
},
x = {
type = 'number',
description = 'The x coordinate of the first control point.'
},
y = {
type = 'number',
description = 'The y coordinate of the first control point.'
},
z = {
type = 'number',
description = 'The z coordinate of the first control point.'
},
['...'] = {
type = '*',
description = 'Additional control points.'
},
points = {
type = 'table',
description = 'A table of points, as above.'
}
},
returns = {
curve = {
type = 'Curve',
description = 'The new Curve.'
}
},
variants = {
{
description = 'Create a Curve from a set of initial control points.',
arguments = { 'x', 'y', 'z', '...' },
returns = { 'curve' }
},
{
description = 'Create a Curve from a (flat) table of points.',
arguments = { 'points' },
returns = { 'curve' }
},
{
description = [[
Create an empty Curve, reserving space ahead of time for a certain number of control points.
]],
arguments = { 'n' },
returns = { 'curve' }
}
}
}
|
--
-- Copyright 2017 Alibaba Group
-- License: MIT
-- Website: https://alibaba.github.io/LuaViewSDK
-- User: tuoli
-- Date: 17/3/30
--
Navigation:title("Playground")
local meta = object:new()
function meta:onCreate(args)
self.views = pica:getInstance():render("app.xml")
self.widgetList = self.views["widgetTableView"]
self.sampleList = self.views["sampleTableView"]
self.aboutView = self.views["aboutView"]
self.widgetTab = self.views["widgetTab"]
self.sampleTab = self.views["sampleTab"]
self.aboutTab = self.views["aboutTab"]
self.aboutInfo = self.views["info"]
if (sys.android) then
self.aboutInfo:nativeView():setLineSpacing(10*sys.scale,1)
end
self.widgetData = Json:toTable(' ["Label", "Button", "Image", "TextField", "Loading", "List", "PagerView", "HScrollView", "WebView", "Animation"] ')
self.sampleData = Json:toTable(' ["Douban", "GitHub"] ')
self.sampleSpec = Json:toTable(' ["Get movie information from Douban.", "Search repositories from GitHub."] ')
self:handle()
end
function meta:handle()
self.widgetList:initParams({
Section = {
SectionCount = function()
return 1
end,
RowCount = function(section)
return table.getn(self.widgetData)
end
},
Cell = {
Id = function(section, row)
return "SampleCell"
end,
SampleCell = {
Size = function(section, row)
return sys.contW, sys.contH/8
end,
Init = function(cell, section, row)
cell.window:backgroundColor(0xffffff)
cell.label = Label()
cell.label:frame(15*sys.scale, 15*sys.scale, sys.contW-15*2*sys.scale, (sys.contH/8-15*2*sys.scale))
end,
Layout = function(cell, section, row)
local style = StyledString(self.widgetData[row], { fontSize = 25*sys.scale, fontColor = 0x000000})
cell.label:text(style)
end,
Callback = function(cell, section, row)
Bridge:require({page="widget/" .. self.widgetData[row]})
end
}
}
})
self.widgetList:reload()
self.sampleList:initParams({
Section = {
SectionCount = function()
return 1
end,
RowCount = function(section)
return table.getn(self.sampleData)
end
},
Cell = {
Id = function(section, row)
return "SampleCell"
end,
SampleCell = {
Size = function(section, row)
return sys.contW, sys.contH/5
end,
Init = function(cell, section, row)
cell.objs = pica:getInstance():render("demo.xml")
end,
Layout = function(cell, section, row)
cell.objs["item"]:text(self.sampleData[row])
cell.objs["subitem"]:text(self.sampleSpec[row])
end,
Callback = function(cell, section, row)
Bridge:require({page="sample/" .. self.sampleData[row]})
end
}
}
})
self.sampleList:reload()
self.widgetTab:callback(function()
self.widgetTab:textColor(0xEB3131)
self.sampleTab:textColor(0x000000)
self.aboutTab:textColor(0x000000)
self.widgetList:show()
self.sampleList:hide()
self.aboutView:hide()
end)
self.sampleTab:callback(function()
self.widgetTab:textColor(0x000000)
self.sampleTab:textColor(0xEB3131)
self.aboutTab:textColor(0x000000)
self.sampleList:show()
self.widgetList:hide()
self.aboutView:hide()
end)
self.aboutTab:callback(function()
self.widgetTab:textColor(0x000000)
self.sampleTab:textColor(0x000000)
self.aboutTab:textColor(0xEB3131)
self.aboutView:show()
self.widgetList:hide()
self.sampleList:hide()
end)
end
return meta
|
data.raw["gui-style"].default["blueprint_button_style"] =
{
type = "button_style",
parent = "button_style",
top_padding = 1,
right_padding = 5,
bottom_padding = 1,
left_padding = 5,
left_click_sound =
{
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
}
data.raw["gui-style"].default["blueprint_sprite_button"] =
{
type = "button_style",
parent = "blueprint_button_style",
width = 32,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
left_click_sound =
{
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
}
data:extend({
{
type="sprite",
name="settings_sprite",
filename = "__core__/graphics/favourite-grey.png",
priority = "extra-high-no-scale",
width = 128,
height = 128,
},
{
type="sprite",
name="load_sprite",
filename = "__Foreman__/graphics/load_icon.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
},
{
type="sprite",
name="add_book_sprite",
filename = "__Foreman__/graphics/add_book.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
},
{
type="sprite",
name="load_book_sprite",
filename = "__Foreman__/graphics/load_book.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
},
{
type="sprite",
name="main_button_sprite",
filename = "__Foreman__/graphics/mainbutton.png",
priority = "extra-high-no-scale",
width = 128,
height = 128,
},
{
type="sprite",
name="mirror_sprite",
filename = "__Foreman__/graphics/mirror_icon.png",
priority = "extra-high-no-scale",
width = 64,
height = 64,
},
})
data.raw["gui-style"].default["blueprint_main_button"] =
{
type = "button_style",
parent = "blueprint_sprite_button",
width = 33,
height = 33,
}
data.raw["gui-style"].default["blueprint_thin_flow"] =
{
type = "flow_style",
horizontal_spacing = 0,
vertical_spacing = 0,
max_on_row = 0,
resize_row_to_width = true,
}
data.raw["gui-style"].default["blueprint_scroll_style"] =
{
type = "scroll_pane_style",
vertical_scroll_bar_spacing = 5,
horizontal_scroll_bar_spacing = 5,
}
data.raw["gui-style"].default["blueprint_thin_frame"] =
{
type = "frame_style",
parent="frame_style",
top_padding = 2,
bottom_padding = 2,
}
data.raw["gui-style"].default["blueprint_button_flow"] =
{
type = "flow_style",
parent="flow_style",
horizontal_spacing=1,
}
data.raw["gui-style"].default["blueprint_info_button_flow"] =
{
type = "flow_style",
parent="blueprint_button_flow",
top_padding = 4,
}
data.raw["gui-style"].default["blueprint_label_style"] =
{
type = "label_style",
font = "default",
font_color = {r=1, g=1, b=1},
top_padding = 7,
bottom_padding = 0,
}
|
DEFINE_BASECLASS( "player_element" )
local player = {}
player.WalkSpeed = 200
player.Icon = Material("element/classes/earth.png", "unlitgeneric")
player.Color = _COLOR.BROWN
player.Sound = "taikos0"
player.Track = "heavy"
player.Health = 250
player.skills = {}
player.skills[KEY_Q] = "earth_bust"
player.skills[KEY_E] = "earth_wall"
player.skills[KEY_LSHIFT] = "earth_boost"
player.skills[MOUSE_LEFT] = "earth_blast"
player.skills[MOUSE_RIGHT] = "earth_push"
if SERVER then
resource.AddWorkshop( 176540879 ) --guards
resource.AddWorkshop( 1359912576 ) --jedi
end
player.models = {}
table.insert(player.models, {model = "models/player/guard_whiterun.mdl"})
table.insert(player.models, {model = "models/gonzo/femalejedi/padawan/padawan.mdl", details = {body = { id = 1, value = 1 }}})
player_manager.RegisterClass("player_earth", player, "player_element")
|
return {
-- Description can be found in Shared > Weapon
CritChance = 25;
CritBonus = 100;
BaseDamage = 15;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.