content
stringlengths 5
1.05M
|
---|
#!/usr/bin/env luajit
require 'dec2bin'
local bor=bit.bor
-- Holt die Bits von den Rad-Table
function rad(tab,i)
return tab[(i-1)%#tab+1]
end
-- Fasst alle Bits einer fünfer Gruppe zusammen
function radG(t1, t2, t3, t4, t5, i)
local e1=rad(t1,i)
local e2=rad(t2,i)
local e3=rad(t3,i)
local e4=rad(t4,i)
local e5=rad(t5,i)
return e1*16+e2*8+e3*4+e4*2+e5
end
-- Stellt klar, ob die erste fünfer Gruppe fortgeschaltet wird
function motor(t7,i1)
return rad(t7,i1)
end
local rad1 ={0,0,0,1,1, 1,0,0,1,1, 1,0,1,1,0, 0,1,0,1,0, 1,1,0,1,1, 0,1,0,0,1, 0,0,1,0,1, 0,1,0,1,0, 1,0,0,}
local rad2 ={1,1,0,1,0, 0,1,1,1,0, 0,0,0,0,1, 1,1,1,0,1, 0,0,1,0,1, 1,0,0,1,1, 0,1,0,1,0, 1,0,1,0,1, 0,1,1,0,1, 0,0,}
local rad3 ={1,0,0,1,0, 0,1,1,0,1, 1,1,0,0,0, 1,1,1,0,0, 0,0,1,1,1, 1,0,1,0,1, 0,1,1,0,0, 1,0,0,1,0, 1,0,1,0,1, 0,1,0,1,0, 1,}
local rad4 ={0,1,0,0,0, 0,1,0,0,1, 0,1,1,1,1, 1,0,1,1,0, 0,1,1,0,0, 1,1,0,0,0, 0,1,0,1,1, 0,1,0,1,0, 1,0,1,0,1, 0,1,1,0,0, 1,0,1,}
local rad5 ={1,0,1,0,1, 0,0,1,1,0, 0,1,1,0,1, 1,0,0,1,0, 0,0,1,0,0, 0,0,1,0,1, 1,0,1,1,1, 1,0,1,1,1, 0,0,1,0,1, 0,0,0,1,1, 0,1,0,1,0, 1,0,1,0,}
local rad6 ={0,1,0,1,0, 1,0,1,0,1, 0,1,0,1,0, 1,1,1,0,1, 0,1,0,0,1, 0,1,0,1,0, 1,0,1,1,1, 0,1}
local rad7 ={1,0,0,0,0, 1,1,0,0,0, 1,1,0,0,1, 1,0,1,1,1, 1,0,0,0,0, 1,1,0,0,0, 1,1,0,1,1, 0,1,0,1,1, 1,1,0,0,0, 1,1,0,0,1, 1,0,0,1,1, 0,1,0,1,1, 1,}
local rad8 ={0,1,1,1,1, 0,1,0,1,1, 0,1,0,1,1, 0,0,1,0,0, 1,1,0,1,0, 0,0,0,1,1, 0,0,0,0,1, 1,1,1,0,0, 0,}
local rad9 ={0,1,1,1,0, 0,0,0,1,0, 0,0,1,1,0, 1,0,1,0,0, 0,1,1,0,1, 1,1,0,0,1, 1,}
local rad10={1,1,0,0,1, 1,0,1,1,0, 0,1,1,1,0, 0,0,0,1,0, 0,1,1,0,1, 1,1,0,0,}
local rad11={1,1,1,1,0, 0,1,0,0,1, 1,0,0,1,0, 0,1,1,0,1, 0,0,1,1,0, 0,}
local rad12={0,1,1,1,0, 1,1,1,0,0, 0,1,0,0,1, 1,0,1,0,0, 0,1,0,}
local text=io.read("*a")
local i2=1
local i6=1
for i1=1,#text do
local char=text:byte(i1)
local rnd1=radG(rad8,rad9,rad10,rad11,rad12,2-i1)
local rnd2=radG(rad1,rad2,rad3,rad4,rad5,i2)
local crypt=bit.bxor(char,rnd1,rnd2)
-- ***TEST print(dec2bin(char,5), dec2bin(rnd2, 5), dec2bin(rnd1, 5), dec2bin(crypt, 5), i2, i6, 2-i1, rad(rad6, i6), rad(rad7, 2-i1), bor(rad(rad6,i6), rad(rad7, 2-i1)))
io.write(string.char(crypt))
-- Fortschaltung von Rad6 auf ersten Gruppenrad
i2=i2-bor(rad(rad6,i6),1-rad(rad7,2-i1))
i6=i6-motor(rad7,2-i1)
end
-- Made by Torben & Thu (with the help of Hanno Behrens)
|
-- This library generates a blank X*Y square grid map for JoberGen
-- Each node only has adjacent nodes listed
--
-- This is a derived class of MapMeta (an "abstract class")
require("GenerateParent")
SquareGridMap = {}
SquareGridMap.__index = SquareGridMap
setmetatable(SquareGridMap, MapMeta)
function SquareGridMap:new(sizeX, sizeY, wrap, diagonalDistance)
-- Given an X, Y coordinate, return the name we assign this map point
function nodeName(X, Y)
return "x" .. tonumber(X) .. "y" .. tonumber(Y)
end
-- A semisphere is a special form which is topologically equivalent to
-- a sphere. Wraps on the X axis go from far left to far right, and from
-- far right to far left. Wraps on the Y axis go from the top square on
-- the Y axis to the top square halfway over; ditto with the bottom square
-- This allows a reasonable simulation of a sphere on a square grid
-- without making the poles impassible
-- Note: If this were played in a game, the world would become a vertically
-- flipped mirror image after going below the south pole or above the
-- north pole.
function handleSemisphere(X, Y, sizeX, sizeY)
if Y < 0 then
Y = 0
X = X + math.floor(sizeX / 2)
end
if Y >= sizeY then
Y = sizeY
X = X + math.floor(sizeX / 2)
end
if X < 0 then X = X + sizeX end
if X >= sizeX then X = X - sizeX end
return X, Y
end
-- When deciding an adjacent square, handle underflow and overflow
function handleWrap(V, sizeV, goodWrap, wrap)
if V < 0 then
if wrap == "TORIC" or wrap == goodWrap then
return V + sizeV
else
return nil
end
elseif V >= sizeV then
if wrap == "TORIC" or wrap == goodWrap then
return V - sizeV
else
return nil
end
end
return V
end
-- Parse args: Default values
if sizeX == nil then sizeX = 144 end
if sizeY == nil then sizeY = 96 end
if wrap == nil then wrap = "NONE" end
if wrap ~= "NONE" and
wrap ~= "TORIC" and
wrap ~= "WRAPX" and
wrap ~= "WRAPY" and
wrap ~= "SEMISPHERE" then
return {ERROR = "Invalid wrap value"}
end
-- If we do not specify how many movement "units" it takes to move
-- in a diagonal direction, use 1. The correct value is 2 ^ .5, i.e.
-- around 1.41421, but Civilization games make it 1 to make game play
-- simpler. C-evo aims for more realism and makes the value 1.5.
if not diagonalDistance then
-- We add a tiny value to the diagonal distance so that the path finder
-- will not zig zag back and forth diagonally from one point to another
-- but will prefer straight line paths.
diagonalDistance = 1.0001
end
sizeX = math.floor(tonumber(sizeX))
sizeY = math.floor(tonumber(sizeY))
if wrap == "SEMISPHERE" and sizeX % 2 ~= 0 then
return {ERROR = "Semisphere maps must have an even X size"}
end
if sizeX < 8 then sizeX = 8 end
if sizeY < 8 then sizeY = 8 end
-- As a convention, lower case/numeric is node name, UPPER CASE is meta
-- information about the map
local newMap = {ROOT = "x0y0", WRAP = wrap, SizeX = sizeX,
SizeY = sizeY, NODES = sizeX * sizeY, DistanceMap = nil}
lastNode = nil
for X = 0, (sizeX - 1) do
for Y = 0, (sizeY - 1) do
if lastNode then lastNode.next = nodeName(X,Y) end -- For iterators
local node = {name = nodeName(X,Y), X = X, Y = Y}
node.adjacent = {}
for dirX = -1, 1 do
for dirY = -1, 1 do
if wrap ~= "SEMISPHERE" then
placeX = handleWrap(X + dirX, sizeX, "WRAPX", wrap)
placeY = handleWrap(Y + dirY, sizeY, "WRAPY", wrap)
else
placeX, placeY = handleSemisphere(X+dirX, Y+dirY, sizeX, sizeY)
end
if placeX and placeY and (dirX ~= 0 or dirY ~= 0) then
local distance = 1
if dirX ~= 0 and dirY ~= 0 then
distance = diagonalDistance
end
node.adjacent[#node.adjacent + 1] = {
nodeName(placeX,placeY),
distance
}
end
end
end
newMap[nodeName(X,Y)] = node
lastNode = node
end
end
return setmetatable(newMap, self)
end
|
--Module for the "lobby" room type.
local process = ...
local lobby = {
name = "Lobbies"
}
function lobby:init()
self.parent = process.modules["rooms"]
process:registerCallback(self,"room_make", 3,self.make)
process:registerCallback(self,"room_bg", 3,self.bg_block)
process:registerCallback(self,"room_doc", 3,self.doc_block)
process:registerCallback(self,"room_status", 3,self.status_block)
process:registerCallback(self,"room_lock", 3,self.lock_block)
process:registerCallback(self,"event_play", 3,self.block)
process:registerCallback(self,"item_add", 3,self.block)
process:registerCallback(self,"item_edit", 3,self.block)
process:registerCallback(self,"item_remove", 3,self.block)
end
function lobby:make(room)
room.hp = room.hp or {0,0}
end
function lobby:block(client, event)
if client.room and client.room.kind == "lobby" and not client.mod then return true end
end
function lobby:bg_block(client,room,bg)
if (client.room and client.room.kind ~= "lobby") or client.mod then return end
process:sendMessage(client,"You cannot change the background in this room!")
return true
end
function lobby:doc_block(client,room,doc)
if (client.room and client.room.kind ~= "lobby") or client.mod then return end
process:sendMessage(client,"You cannot change the doc in this room!")
return true
end
function lobby:status_block(client,room,status)
if (client.room and client.room.kind ~= "lobby") or client.mod then return end
process:sendMessage(client,"You cannot change the status in this room!")
return true
end
function lobby:lock_block(client,room,key)
if (client.room and client.room.kind ~= "lobby") or client.mod then return end
process:sendMessage(client,"You cannot change the lock in this room!")
return true
end
function lobby:command(client, cmd,str,args)
if (client.room and client.room.kind ~= "lobby") or client.mod then return end
end
return lobby
|
wait(.5)
local Player=game.Players.LocalPlayer
repeat wait() until Player
local Character=Player.Character
repeat wait() until Character
PlayerGui=Player.PlayerGui
Backpack=Player.Backpack
Torso=Character.Torso
Head=Character.Head
Humanoid=Character.Humanoid
Humanoid.JumpPower = 90
LeftArm=Character:WaitForChild("Left Arm")
LeftLeg=Character:WaitForChild("Left Leg")
RightArm=Character:WaitForChild("Right Arm")
RightLeg=Character:WaitForChild("Left Arm")
LS=Torso:WaitForChild("Left Shoulder")
LH=Torso:WaitForChild("Left Hip")
RS=Torso:WaitForChild("Right Shoulder")
RH=Torso:WaitForChild("Right Hip")
Neck=Torso.Neck
it=Instance.new
vt=Vector3.new
cf=CFrame.new
local runServ = game:GetService("RunService").RenderStepped
local TextTable = {}
euler=CFrame.fromEulerAnglesXYZ
angles=CFrame.Angles
necko=cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
necko2=cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
LHC0=cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0)
LHC1=cf(-0.5,1,0,-0,-0,-1,0,1,0,1,0,0)
RHC0=cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0)
RHC1=cf(0.5,1,0,0,0,1,0,1,0,-1,-0,-0)
RootPart=Character.HumanoidRootPart
RootJoint=RootPart.RootJoint
RootCF=euler(-1.57,0,3.14)
attack=false
attackdebounce=false
MMouse=Player:GetMouse()
combo=0
local Anim="Idle"
local Effects={}
equipped=false
local idle=0
local hold=false
local con1=nil
local con2=nil
local Mode="Binary"
local idleanim=0
local idleanim2=false
local impulse=1
local hitfloor,posfloor=nil,nil
local damcount=0
local guard=false
local damagebonus = 1
--player
player=nil
--save shoulders
RSH, LSH=nil, nil
--welds
RW, LW=Instance.new("Weld"), Instance.new("Weld")
RW.Name="Right Shoulder" LW.Name="Left Shoulder"
LH=Torso["Left Hip"]
RH=Torso["Right Hip"]
Asset="http://www.roblox.com/asset/?id="
function swait(num)
if num==0 or num==nil then
game:service'RunService'.RenderStepped:wait()
else
for i=0,num do
game:service'RunService'.RenderStepped:wait()
end
end
end
if Character:findFirstChild("Binary Sword",true) ~= nil then
Character:findFirstChild("Binary Sword",true).Parent = nil
end
if Character:findFirstChild("Demon Blade",true) ~= nil then
Character:findFirstChild("Demon Blade",true).Parent = nil
end
if Player.PlayerGui:findFirstChild("WeaponGUI",true) ~= nil then
Player.PlayerGui:findFirstChild("WeaponGUI",true).Parent = nil
end
function NoOutline(Part)
Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10
end
function part(formfactor,parent,reflectance,transparency,brickcolor,name,size)
local fp=it("Part")
fp.formFactor=formfactor
fp.Parent=parent
fp.Reflectance=reflectance
fp.Transparency=transparency
fp.CanCollide=false
fp.Locked=true
fp.BrickColor=brickcolor
fp.Name=name
fp.Size=size
fp.Position=Torso.Position
NoOutline(fp)
if fp.BrickColor == BrickColor.new("Dark indigo") then
fp.Material="Neon"
elseif fp.BrickColor == BrickColor.new("Fossil") then
fp.BrickColor = BrickColor.new("Dark indigo")
fp.Material="Granite"
else
fp.Material="SmoothPlastic"
end
fp:BreakJoints()
return fp
end
function mesh(Mesh,part,meshtype,meshid,offset,scale)
local mesh=it(Mesh)
mesh.Parent=part
if Mesh=="SpecialMesh" then
mesh.MeshType=meshtype
mesh.MeshId=meshid
end
mesh.Offset=offset
mesh.Scale=scale
return mesh
end
function weld(parent,part0,part1,c0)
local weld=it("Weld")
weld.Parent=parent
weld.Part0=part0
weld.Part1=part1
weld.C0=c0
return weld
end
local fengui=it("GuiMain")
fengui.Parent=Player.PlayerGui
fengui.Name="WeaponGUI"
local Color1=BrickColor.new("Really black")
local Color2=BrickColor.new("Dark stone grey")
local Colorr3=BrickColor.new("Dark indigo")
local Color4=BrickColor.new("Fossil")
local model1=Instance.new("Model")
model1.Parent=Character
model1.Name="Binary Sword"
BSword={}
BSwordWelds={}
local model2=Instance.new("Model")
model2.Parent=nil
model2.Name="Demon Blade"
DBlade={}
DBladeWelds={}
prt1=part(3,model1,0,1,Color1,"Part1",vt())
prt2=part(3,model1,0,0,Color2,"Part2",vt())
prt3=part(3,model1,0,0,Color2,"Part3",vt())
prt4=part(3,model1,0,0,Colorr3,"Part4",vt())
prt5=part(3,model1,0,0,Color1,"Part5",vt())
prt6=part(3,model1,0,0,Color4,"Part6",vt())
prt7=part(3,model1,0,0,Color4,"Part7",vt())
prt8=part(3,model1,0,0,Color4,"Part8",vt())
prt9=part(3,model1,0,0,Color4,"Part9",vt())
prt10=part(3,model1,0,0,Colorr3,"Part10",vt())
prt11=part(3,model1,0,0,Colorr3,"Part11",vt())
prt12=part(3,model1,0,0,Colorr3,"Part12",vt())
prtd1=part(3,model2,0,0.4,BrickColor.new("Dark indigo"),"DPart1",vt())
prtd2=part(3,model2,0,0,BrickColor.new("Really black"),"DPart2",vt())
prtd3=part(3,model2,0,0,BrickColor.new("Really black"),"DPart3",vt())
prtd4=part(3,model2,0,0,BrickColor.new("Really black"),"DPart4",vt())
prtd5=part(3,model2,0,0,BrickColor.new("Really black"),"DPart5",vt())
prtd6=part(3,model2,0,0,BrickColor.new("Really black"),"DPart6",vt())
prtd7=part(3,model2,0.8,0,BrickColor.new("Dark indigo"),"DPart7",vt())
prtd8=part(3,model2,0.8,0,BrickColor.new("Dark indigo"),"DPart8",vt())
prtd9=part(3,model2,0.5,0.2,BrickColor.new("Fossil"),"DPart9",vt())
prtd10=part(3,model2,0.5,0.2,BrickColor.new("Fossil"),"DPart10",vt())
prtd11=part(3,model2,0.5,0,BrickColor.new("Dark indigo"),"DPart11",vt())
prtd12=part(3,model2,0,0,BrickColor.new("Really black"),"DPart12",vt())
for _,c in pairs(model2:children()) do
if c.className=="Part" then
table.insert(DBlade,c)
end
end
msh1=mesh("BlockMesh",prt1,"","",vt(0,0,0),vt(1,1,1))
msh2=mesh("CylinderMesh",prt2,"","",vt(0,0,0),vt(2,10,2))
msh3=mesh("SpecialMesh",prt3,"Head","",vt(0,0,0),vt(2.5,2,2.5))
msh4=mesh("SpecialMesh",prt4,"Sphere","",vt(0,0,0),vt(3,3,3))
msh5=mesh("SpecialMesh",prt5,"FileMesh","http://www.roblox.com/asset/?id=9756362",vt(0,0,0),vt(0.5,0.5,1))
msh6=mesh("BlockMesh",prt6,"","",vt(0,0,0),vt(.5,20,1))
msh7=mesh("BlockMesh",prt7,"","",vt(0,0,0),vt(.5,20,1))
msh8=mesh("SpecialMesh",prt8,"Wedge","",vt(0,0,0),vt(.5,5,1))
msh9=mesh("SpecialMesh",prt9,"Wedge","",vt(0,0,0),vt(.5,5,1))
msh10=mesh("BlockMesh",prt10,"","",vt(0,0,0),vt(.6,20,0.2))
msh11=mesh("SpecialMesh",prt11,"Wedge","",vt(0,0,0),vt(.6,5,0.1))
msh12=mesh("SpecialMesh",prt12,"Wedge","",vt(0,0,0),vt(.6,5,0.1))
mshd1=mesh("BlockMesh",prtd1,"","",vt(0,0,0),vt(5.01,3,5.01))
mshd2=mesh("BlockMesh",prtd2,"","",vt(0,0,0),vt(5.1,3,5.1))
mshd3=mesh("SpecialMesh",prtd3,"Wedge","",vt(0,0,0),vt(5.05,4,3))
mshd4=mesh("SpecialMesh",prtd4,"Wedge","",vt(0,0,0),vt(5.05,4,3))
mshd5=mesh("SpecialMesh",prtd5,"Wedge","",vt(0,0,0),vt(5.5,6,6))
mshd6=mesh("SpecialMesh",prtd6,"Wedge","",vt(0,0,0),vt(5.5,6,6))
mshd7=mesh("BlockMesh",prtd7,"","",vt(0,0,0),vt(3,20,1))
mshd8=mesh("SpecialMesh",prtd8,"Wedge","",vt(0,0,0),vt(1,3,5))
mshd9=mesh("BlockMesh",prtd9,"","",vt(0,0,0),vt(4.5,20,.1))
mshd10=mesh("SpecialMesh",prtd10,"Wedge","",vt(0,0,0),vt(.1,4.5,8))
mshd11=mesh("CylinderMesh",prtd11,"","",vt(0,0,0),vt(4,5.8,4))
mshd12=mesh("CylinderMesh",prtd12,"","",vt(0,0,0),vt(3,5.9,3))
wld1=weld(prt1,prt1,Torso,euler(3.7,1.57,0)*cf(-1.5,-2.3,-.5))
wld2=weld(prt2,prt2,prt1,euler(0,0,0)*cf(0,0,0))
wld3=weld(prt3,prt3,prt2,euler(0,0,0)*cf(0,1,0))
wld4=weld(prt4,prt4,prt2,euler(0,0,0)*cf(0,-1,0))
wld5=weld(prt5,prt5,prt4,euler(0,0,0)*cf(0,-0.2,0))
wld6=weld(prt6,prt6,prt5,euler(0,0,0)*cf(0,-2,0.1))
wld7=weld(prt7,prt7,prt5,euler(0,0,0)*cf(0,-2,-0.1))
wld8=weld(prt8,prt8,prt6,euler(0,0,0)*cf(0,-2.5,0))
wld9=weld(prt9,prt9,prt7,euler(0,3.14,0)*cf(0,-2.5,0))
wld10=weld(prt10,prt10,prt5,euler(0,0,0)*cf(0,-2,0))
wld11=weld(prt11,prt11,prt10,euler(0,0,0)*cf(0,-2.5,0.01))
wld12=weld(prt12,prt12,prt10,euler(0,3.14,0)*cf(0,-2.5,-0.01))
wldd1=weld(prtd1,prtd1,RightArm,euler(0,0,0)*cf(0,.21,0))
wldd2=weld(prtd1,prtd2,prtd1,euler(0,0,0)*cf(0,.5,0))
wldd3=weld(prtd1,prtd3,prtd2,euler(0,1.57,0)*cf(.21,-.6,0))
wldd4=weld(prtd1,prtd4,prtd2,euler(0,-1.57,0)*cf(-.21,-.6,0))
wldd5=weld(prtd1,prtd5,prtd2,euler(0,-1.57,0)*cf(.1,-.1,0))
wldd6=weld(prtd1,prtd6,prtd5,euler(0,0,3.14)*cf(0,1.2,0))
wldd7=weld(prtd1,prtd7,prtd2,euler(0,0,0)*cf(0,2.5,0))
wldd8=weld(prtd1,prtd8,prtd7,euler(1.57,1.57,0)*cf(0,2.5,0))
wldd9=weld(prtd1,prtd9,prtd7,euler(0,0,0)*cf(0,0,0))
wldd10=weld(prtd1,prtd10,prtd8,euler(0,0,0)*cf(0,0,0.3))
wldd11=weld(prtd1,prtd11,prtd1,euler(1.57,0,0)*cf(0,1,0))
wldd12=weld(prtd1,prtd12,prtd11,euler(0,0,0)*cf(0,0,0))
for _,c in pairs(prtd1:children()) do
if c.className=="Weld" then
table.insert(DBladeWelds,c)
print(c)
end
end
for i=-.9,.9,0.2 do
prt13=part(3,model1,0,0,Color1,"Part13",vt())
msh13=mesh("CylinderMesh",prt13,"","",vt(0,0,0),vt(2.2,1,2.2))
wld13=weld(prt13,prt13,prt1,euler(math.random(-10,10)/100,math.random(-10,10)/100,math.random(-10,10)/100)*cf(0,i,0))
end
function Make1(Ceef)
prtnr=part(3,model1,0,1,Color1,"1a",vt())
mshnr=mesh("BlockMesh",prtnr,"","",vt(0,0,0),vt(.7,.7,.7))
wldnr=weld(prtnr,prtnr,prt10,euler(0,0,0)*cf(0,Ceef,0))
prtn1=part(3,model1,0,0,Colorr3,"1a",vt())
mshn1=mesh("BlockMesh",prtn1,"","",vt(0,0,0),vt(.7,.2,1.5))
wldn1=weld(prtn1,prtn1,prtnr,euler(0,0,0)*cf(0,0,0))
prtn2=part(3,model1,0,0,Colorr3,"1b",vt())
mshn2=mesh("BlockMesh",prtn2,"","",vt(0,0,0),vt(.7,.2,.5))
wldn2=weld(prtn2,prtn2,prtn1,euler(0.5,0,0)*cf(0,0.03,-0.1))
prtn3=part(3,model1,0,0,Colorr3,"1c",vt())
mshn3=mesh("BlockMesh",prtn3,"","",vt(0,0,0),vt(.7,.2,.5))
wldn3=weld(prtn3,prtn3,prtn1,euler(1.57,0,0)*cf(0,0,0.15))
end
function Make0(Ceef)
prtnr=part(3,model1,0,1,Color1,"1a",vt())
mshnr=mesh("BlockMesh",prtnr,"","",vt(0,0,0),vt(.7,.7,.7))
wldnr=weld(prtnr,prtnr,prt10,euler(0,0,0)*cf(0,Ceef,0))
prtn1=part(3,model1,0,0,Colorr3,"0a",vt())
mshn1=mesh("BlockMesh",prtn1,"","",vt(0,0,0),vt(.7,.2,1.5))
wldn1=weld(prtn1,prtn1,prtnr,euler(0,0,0)*cf(0,-0.05,0))
prtn2=part(3,model1,0,0,Colorr3,"0b",vt())
mshn2=mesh("BlockMesh",prtn2,"","",vt(0,0,0),vt(.7,.2,.5))
wldn2=weld(prtn2,prtn2,prtn1,euler(1.57,0,0)*cf(0,0.05,0.15))
prtn3=part(3,model1,0,0,Colorr3,"0c",vt())
mshn3=mesh("BlockMesh",prtn3,"","",vt(0,0,0),vt(.7,.2,.5))
wldn3=weld(prtn3,prtn3,prtn1,euler(1.57,0,0)*cf(0,0.05,-0.15))
prtn4=part(3,model1,0,0,Colorr3,"0d",vt())
mshn4=mesh("BlockMesh",prtn4,"","",vt(0,0,0),vt(.7,.2,1.5))
wldn4=weld(prtn4,prtn4,prtn1,euler(0,0,0)*cf(0,0.1,0))
end
Make1(1.6)
Make0(1.4)
Make0(1.2)
Make1(1)
Make1(.8)
Make1(.6)
Make1(.4)
Make0(.2)
Make0(0)
local hitbox1=part(3,nil,0,1,BrickColor.new("Black"),"Hitbox",vt(1,1,1))
local hitbox2=part(3,nil,0,1,BrickColor.new("Black"),"Hitbox",vt(1,1,1))
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
local Tool=Instance.new("HopperBin")
Tool.Parent=Backpack
Tool.Name="Cerberus' Fang"
local Bin = Tool
script.Parent = Tool
local bodvel=Instance.new("BodyVelocity")
bodvel.Name="FixerVel"
local bg=Instance.new("BodyGyro")
bg.Name="FixerGyro"
so = function(id,par,vol,pit)
coroutine.resume(coroutine.create(function()
local sou = Instance.new("Sound",par or workspace)
sou.Parent=par
sou.Volume=vol
sou.Pitch=pit or 1
sou.SoundId=id
swait()
sou:Play()
game:GetService("Debris"):AddItem(sou,6)
end))
end
function clerp(a,b,t)
local qa = {QuaternionFromCFrame(a)}
local qb = {QuaternionFromCFrame(b)}
local ax, ay, az = a.x, a.y, a.z
local bx, by, bz = b.x, b.y, b.z
local _t = 1-t
return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
end
function QuaternionFromCFrame(cf)
local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
local trace = m00 + m11 + m22
if trace > 0 then
local s = math.sqrt(1 + trace)
local recip = 0.5/s
return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
else
local i = 0
if m11 > m00 then
i = 1
end
if m22 > (i == 0 and m00 or m11) then
i = 2
end
if i == 0 then
local s = math.sqrt(m00-m11-m22+1)
local recip = 0.5/s
return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
elseif i == 1 then
local s = math.sqrt(m11-m22-m00+1)
local recip = 0.5/s
return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
elseif i == 2 then
local s = math.sqrt(m22-m00-m11+1)
local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
end
end
end
function QuaternionToCFrame(px, py, pz, x, y, z, w)
local xs, ys, zs = x + x, y + y, z + z
local wx, wy, wz = w*xs, w*ys, w*zs
local xx = x*xs
local xy = x*ys
local xz = x*zs
local yy = y*ys
local yz = y*zs
local zz = z*zs
return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
end
function QuaternionSlerp(a, b, t)
local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
local startInterp, finishInterp;
if cosTheta >= 0.0001 then
if (1 - cosTheta) > 0.0001 then
local theta = math.acos(cosTheta)
local invSinTheta = 1/math.sin(theta)
startInterp = math.sin((1-t)*theta)*invSinTheta
finishInterp = math.sin(t*theta)*invSinTheta
else
startInterp = 1-t
finishInterp = t
end
else
if (1+cosTheta) > 0.0001 then
local theta = math.acos(-cosTheta)
local invSinTheta = 1/math.sin(theta)
startInterp = math.sin((t-1)*theta)*invSinTheta
finishInterp = math.sin(t*theta)*invSinTheta
else
startInterp = t-1
finishInterp = t
end
end
return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
end
function hideanim()
equipped=false
attack=true
if Mode=="Binary" then
so("rbxasset://sounds\\unsheath.wav",prt1,1,.8)
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(.2,0,-.5)*cf(0,1,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.4,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(3.4,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,0),.3)
end
wld1.Part1=Torso
wld1.C0=euler(3.7,1.57,0)*cf(-1.5,-2.3,-.5)
for i=0,1,0.2 do
swait()
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(0.5,0,0),.3)
end
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,0),.4)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,0),.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1.57,0),.3)
end
--wld1=weld(prt1,prt1,RightArm,euler(1.57,0,0)*cf(0,1,-0.3))
else
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-0.8),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.2,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5,0)*euler(0.5,-1.2,0)*euler(-.2,0,0),.3)
end
so("http://roblox.com/asset/?id=161006163",RightArm,1,.4)
so("http://roblox.com/asset/?id=160867463",RightArm,1,1.2)
for i=0,1,0.015 do
swait()
for i=1,3 do
if math.random(1,4)==1 then
MagicBlock(BrickColor.new("Really black"),RightArm.CFrame*cf(math.random(-100,100)/100,0-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
else
MagicBlock(BrickColor.new("Dark indigo"),RightArm.CFrame*cf(math.random(-100,100)/100,-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
end
end
end
model2.Parent=nil
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,0),.4)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,0),.4)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1.57,0),.3)
end
end
Torso.Neck.C0=necko
Torso.Neck.C1=necko2
RootJoint.C0=RootCF
RW.C0=cf(1.5,0.5,0)*euler(0,0,0)
RW.C1=cf(0,0.5,0)*euler(0,0,0)
LW.C0=cf(-1.5,0.5,0)*euler(0,0,0)
LW.C1=cf(0,0.5,0)*euler(0,0,0)
RH.C0=RHC0
RH.C1=RHC1
LH.C0=LHC0
LH.C1=LHC1
Mode="Binary"
attack=false
end
function equipanim()
equipped=true
attack=true
for i=0,1,0.2 do
swait()
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.4,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(3,0,0),.4)
end
for i=0,1,0.1 do
swait()
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.5,0,-0.6),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(3.4,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
end
so("rbxasset://sounds\\unsheath.wav",prt1,1,.6)
wld1.Part1=RightArm
wld1.C0=euler(.2,0,-.5)*cf(0,1,0)
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.2,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(.5,-0.5,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
end
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.5),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1,-0.5,-0.7),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1,-0.5,0.5),.3)
end
--wld1=weld(prt1,prt1,RightArm,euler(1.57,0,0)*cf(0,1,-0.3))
wld1.C0=euler(1.57,0,0)*cf(0,1,-0.3)
Torso.Neck.C0=necko*euler(0,0,0.5)
RootJoint.C0=RootCF*euler(0,0,-0.5)
RW.C0=cf(1,0.5,-0.5)*euler(1,-0.5,-0.7)
RW.C1=cf(0,0.5,0)*euler(0,0,0)
LW.C0=cf(-1,0.5,-0.5)*euler(1,-0.5,0.5)
LW.C1=cf(0,0.5,0)*euler(0,0,0)
attack=false
end
function Stomp()
Humanoid.WalkSpeed=0
Torso.Velocity=RootPart.CFrame.lookVector*0
so("http://roblox.com/asset/?id=157878578",Torso,1,0.8)
so("http://roblox.com/asset/?id=2760979",Torso,1,0.4)
--so("http://roblox.com/asset/?id=2101148",Torso,1,0.6)
MagicWave(BrickColor.new("Dark indigo"),cf(Torso.Position)*cf(0,-1,0),1,1,1,1.5,1,1.5,0.05)
Dam=math.random(5,10)
Humanoid.Health=Humanoid.Health-Dam
showDamage(Torso,Dam,.5,BrickColor:Red())
MagniDamage(Torso,20,50,99,math.random(10,15),"Knockdown")
--[[for i=0,1,0.2 do
swait()
if Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(0.4,0,-0.5)*cf(0,1,0),.3)
end
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(3,0,0.5),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-1.2),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.4,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1)*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-1.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1.1,-.5,-0.5)*euler(-0.2,-1.3,0),.3)
end
for i=0,1,0.1 do
swait()
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.6,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.2)*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-1.4,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1.2,-.2,-0.5)*euler(-0.3,-1.3,0),.3)
end]]
swait(10)
Humanoid.WalkSpeed=16
end
function attackone()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.2,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,1),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-1),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(2,-0.5,-0.2),.3)
LW.C0=clerp(LW.C0,cf(-.5,0.5,-0.5)*euler(2.5,-0.5,0.8),.3)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.3)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.3)
end
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
--con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,10,20,math.random(1,5),"Normal",RootPart,.5,1) end)
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,20,50,math.random(1,5),"Normal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=161006212",prt10,1,.7)
blcf=nil
scfr=nil
for i=0,1,0.25 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(1.8,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,-.3),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,.3),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(.5,-.3,-.3),.3)
LW.C0=clerp(LW.C0,cf(-0.8,0.2,-0.5)*euler(.5,-0.5,1),.3)
end
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(2,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,-.9),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,.9),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(.5,-.8,-.3),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.1,-0.5,.7),.3)
end
con1:disconnect()
hitbox1.Parent=nil
attack=false
end
function attacktwo()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,-1.2),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,1.2),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(.5,1.8,1.5),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.5,-0.5,.8),.3)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.3)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.3)
end
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,20,40,math.random(1,5),"Normal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=161006212",prt10,1,.8)
blcf=nil
scfr=nil
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(2.2,0,0)*cf(0,.8,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,1),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-1),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.2,1.2,0)*euler(-1.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(.2,-.2,-1.4),.3)
end
con1:disconnect()
hitbox1.Parent=nil
attack=false
end
function attackthree()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,-.785)*cf(0,.8,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.3)
RW.C0=clerp(RW.C0,cf(1,1,0)*euler(2.8,0,-.785),.3)
LW.C0=clerp(LW.C0,cf(-1,1,0)*euler(2.8,0,.785),.3)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.3)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.3)
end
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,20,40,math.random(1,5),"Normal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=161006212",prt10,1,.9)
blcf=nil
scfr=nil
for i=0,1,0.25 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(1.7,0,0)*cf(0,1,0),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.2,0,-.6),.4)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,.6),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.5,0,.2),.4)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-.2),.4)
end
for i=0,1,0.2 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(2,0,0)*cf(0,.7,-.3),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.4,0,-.8),.4)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,.8),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.2,-.4,.4),.4)
end
con1:disconnect()
hitbox1.Parent=nil
attack=false
end
function SpinSlash()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.3,0,0.8),.4)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.5)*euler(0.2,0,-0.8),.4)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(2.2,-1.2,0)*euler(0,0,1),.4)
LW.C0=clerp(LW.C0,cf(.1,0.5,-0.8)*euler(1.8,-0.5,1),.4)
--RH.C0=clerp(RH.C0,RHC0*cf(0,0,0)*euler(0.2,0.2,.5),.3)
--LH.C0=clerp(LH.C0,LHC0*cf(.5,0.2,0)*euler(0,.5,0.2),.3)
end
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,30,60,math.random(1,5),"Normal",RootPart,.001,1) end)
blcf=nil
scfr=nil
so("http://roblox.com/asset/?id=161006212",prt10,1,.6)
repeat
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
for i=0,1,0.15 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(1.2,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.3,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.5)*euler(0,0,2.3),.25)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.57,-1.57,0)*euler(-0.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.57,-1.57,0)*euler(0.5,0,0),.3)
RH.C0=clerp(RH.C0,RHC0,.3)
LH.C0=clerp(LH.C0,LHC0,.3)
end
for i=0,1,0.05 do
swait()
if i>=0.45 and i<=0.5 then
so("http://roblox.com/asset/?id=161006212",prt10,1,.7)
end
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.5)*euler(0,0,2.3+6*i),1)
end
until hold==false
con1:disconnect()
hitbox1.Parent=nil
attack=false
end
function BinarySwing()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.8),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1)*euler(0,0,-0.8),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(.5,-2,0)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-.2,-.1,-0.5)*euler(1,-1.8,0)*euler(.9,0,0),.3)
RH.C0=clerp(RH.C0,RHC0*cf(.2,1,.1)*euler(0,-.5,-.2),.3)
LH.C0=clerp(LH.C0,LHC0*cf(-.2,1,.1)*euler(0,.5,.2),.3)
end
Humanoid.Jump=true
bodvol=Instance.new("BodyVelocity")
bodvol.Parent=RootPart
bodvol.velocity=vt(0,1,0)*600
bodvol.P=7000
bodvol.maxForce=Vector3.new(8e+003, 8e+003, 8e+003)
--Torso.Velocity=vt(0,1,0)*100
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,40,80,math.random(10,20),"Dragger",RootPart,.001,1) end)
so("http://roblox.com/asset/?id=161006212",prt10,1,.8)
blcf=nil
scfr=nil
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(3,-2.4,0)*euler(.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-.2,.8,-0.5)*euler(3.1,-1.8,0)*euler(.9,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-0.8),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*euler(0,0,1.3),.3)
RH.C0=clerp(RH.C0,RHC0,.3)
LH.C0=clerp(LH.C0,LHC0,.3)
end
con1:disconnect()
hitbox1.Parent=nil
bodvol.Parent=nil
attack=false
end
function BinaryImpulse()
attack=true
if impulse==1 then
impulse=2
Humanoid.Jump=true
for i=0,1,0.2 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.45)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0.5,0),.45)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(.5,0,0),.45)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.7)*euler(1.5,-1.5,0)*euler(.7,0,0),.45)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.45)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.45)
end
blcf=nil
scfr=nil
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,20,30,math.random(10,20),"Dragger",RootPart,.01,1) end)
for i=1,3 do
so("http://roblox.com/asset/?id=161006212",prt10,1,1)
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(-.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(.5,0,0),.3)
RootJoint.C0=RootCF*euler(0,0.5,6.6*i)
end
end
con1:disconnect()
hitbox1.Parent=nil
elseif impulse==2 then
impulse=3
Humanoid.Jump=true
for i=0,1,0.2 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.45)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,-0.5,0),.45)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(.5,0,0),.45)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.7)*euler(1.5,-1.5,0)*euler(.7,0,0),.45)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.45)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.45)
end
blcf=nil
scfr=nil
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,20,30,math.random(10,20),"Dragger",RootPart,.01,1) end)
for i=1,3 do
so("http://roblox.com/asset/?id=161006212",prt10,1,1.05)
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(-.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.5,-1.5,0)*euler(.5,0,0),.3)
RootJoint.C0=RootCF*euler(0,-0.5,6.6*i)
end
end
con1:disconnect()
hitbox1.Parent=nil
elseif impulse==3 then
impulse=1
for i=0,1,0.2 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.57,0,-0.785)*cf(0,1,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.4,0,0),.45)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.45)
RW.C0=clerp(RW.C0,cf(1,0.8,-0.5)*euler(3,0,-0.785),.45)
LW.C0=clerp(LW.C0,cf(-1,0.8,-0.5)*euler(3,0,0.785),.45)
RH.C0=clerp(RH.C0,RHC0*euler(-.2,0,0),.45)
LH.C0=clerp(LH.C0,LHC0*euler(-.2,0,0),.45)
end
Humanoid.Jump=true
blcf=nil
scfr=nil
hitbox1.Parent=model1
hitbox1.Size=vt(1,5,1)
hitbox1.Transparency=1
hitbox1.CFrame=prt10.CFrame
con1=hitbox1.Touched:connect(function(hit) Damagefunc(hit,25,35,math.random(20,30),"Dragger",RootPart,.01,1) end)
for i=1,3 do
so("http://roblox.com/asset/?id=161006195",prt10,1,1)
for i=0,1,0.1 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox1.CFrame=prt10.CFrame
wld1.C0=clerp(wld1.C0,euler(2,0,-0.785)*cf(0,1,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.2,0,0),.45)
RW.C0=clerp(RW.C0,cf(1,0.3,-0.5)*euler(.5,0,-0.785),.3)
LW.C0=clerp(LW.C0,cf(-1,0.3,-0.5)*euler(.5,0,0.785),.3)
RootJoint.C0=RootCF*euler(6.28*i,0,0)
end
end
con1:disconnect()
hitbox1.Parent=nil
end
attack=false
end
function Bash()
attack=true
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.1,0,0)*cf(0,1,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,1)*euler(0.5,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-1.4),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.4,-1.4,0)*euler(-.6,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(1,-1,0)*euler(.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,2.5,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1,0),.3)
end
Torso.Velocity=RootPart.CFrame.lookVector*600
so("http://roblox.com/asset/?id=2767090",Torso,1,.7)
MagicWave(Color4,RootPart.CFrame*euler(1.57,0,0),1,1,1,1,1,1,0.05)
hit=nil
for i=1,20 do
if hit==nil then
swait()
end
hit,pos=rayCast(RootPart.Position,RootPart.CFrame.lookVector,6,Character)
end
Torso.Velocity=RootPart.CFrame.lookVector*0
Humanoid.WalkSpeed=0
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(1.1,0,0)*cf(0,1,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,1.4)*euler(-0.2,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-1.4),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(3,-1.4,0)*euler(-.6,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(2.3,-1.4,0)*euler(.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,-1.57,0),.3)
end
so("http://roblox.com/asset/?id=161006195",prt10,1,.5)
blcf=nil
scfr=nil
for i=0,1,0.2 do
swait()
local blcf = prt10.CFrame*CFrame.new(0,.5,0)
if scfr and (prt10.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
wld1.C0=clerp(wld1.C0,euler(2.2,0,0)*cf(0,.8,-0.3),.45)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,1.4)*euler(0.4,0,0),.45)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.3)*euler(0,0,-1.4),.45)
RW.C0=clerp(RW.C0,cf(.5,0.2,-0.5)*euler(3,-1.4,0)*euler(-2.7,0,0),.45)
LW.C0=clerp(LW.C0,cf(-1.2,0.1,-0.3)*euler(0,-1.4,0)*euler(.5,0,0),.45)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-1.2,1.57,0),.45)
LH.C0=clerp(LH.C0,cf(-1.1,0.4,-0.8)*euler(-0.05,-1.57,0),.45)
end
hit,pos=rayCast(prt10.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,100,Character)
if hit~=nil then
local ref=part(3,workspace,0,1,BrickColor.new("Dark indigo"),"Effect",vt())
ref.Anchored=true
ref.CFrame=cf(pos)
game:GetService("Debris"):AddItem(ref,3)
for i=1,10 do
Col=hit.BrickColor
local groundpart=part(3,F2,0,0,Col,"Ground",vt(math.random(50,200)/100,math.random(50,200)/100,math.random(50,200)/100))
groundpart.Anchored=true
groundpart.Material=hit.Material
groundpart.CanCollide=true
groundpart.CFrame=cf(pos)*cf(math.random(-500,500)/100,0,math.random(-500,500)/100)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
game:GetService("Debris"):AddItem(groundpart,5)
end
so("http://roblox.com/asset/?id=157878578",ref,.6,1.2)
MagicWave(hit.BrickColor,cf(pos),1,1,1,.7,.7,.7,0.05)
MagniDamage(ref,10,40,80,math.random(100,600),"Up")
end
swait(10)
Humanoid.WalkSpeed=16
attack=false
end
function UnleashTheDemon()
attack=true
so("rbxasset://sounds\\unsheath.wav",prt1,1,.8)
chatServ:Chat(Head, "Were you prepared for this?", 2)
for i=0,1,0.1 do
swait()
wld1.C0=clerp(wld1.C0,euler(.2,0,-.5)*cf(0,1,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.4,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1.3,0.5,0.2)*euler(3.4,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,RHC0,.4)
LH.C0=clerp(LH.C0,LHC0,.4)
end
wld1.Part1=Torso
wld1.C0=euler(3.7,1.57,0)*cf(-1.5,-2.3,-.5)
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.4,0,-0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.3,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.4,-1.57,0)*euler(1.2,0,0),.3)
end
so("http://roblox.com/asset/?id=178452217",RightArm,.5,.4)
so("http://roblox.com/asset/?id=168586586",RightArm,.5,.6)
so("http://roblox.com/asset/?id=160740121",RightArm,1,.8)
num=0
for i=0,1,0.01 do
swait()
if num>=10 then
num=0
MagicWave(BrickColor.new("Dark indigo"),cf(Torso.Position)*cf(0,-1,0)*euler(0,math.random(-50,50),0),1,1,1,1,.5,1,0.05)
end
for i=1,2 do
if math.random(1,5)==1 then
MagicBlock(BrickColor.new("Really black"),RightArm.CFrame*cf(math.random(-100,100)/100,-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
else
MagicBlock(BrickColor.new("Dark indigo"),RightArm.CFrame*cf(math.random(-100,100)/100,-math.random(0,700)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
end
end
num=num+1
end
so("http://roblox.com/asset/?id=168586621",RightArm,1,.5)
so("http://roblox.com/asset/?id=160867463",RightArm,1,.8)
for i=1,4 do
MagicBlock(BrickColor.new("Dark indigo"),RightArm.CFrame*cf(0,-.5-math.random(0,500)/100,0),2,2,2,.5,.5,.5,0.05)
end
MagicWave(BrickColor.new("Dark indigo"),cf(Torso.Position)*cf(0,-1,0)*euler(0,math.random(-50,50),0),1,1,1,.5,.3,.5,0.01)
Mode="Demon"
chatServ:Chat(Head, "Awaken, Demon Blade!", 2)
model2.Parent=Character
for i=1,#DBlade do
DBlade[i].Parent=model2
DBladeWelds[i].Parent=DBlade[1]
end
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.2,-0.5,1),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(1.4,0.5,-1.3),.3)
end
swait(10)
attack=false
end
local MomentumCancel = true
chatServ = game:GetService("Chat")
local chattedAlready = false
function MomentumCanelling()
if RootPart.Velocity.Magnitude > (Humanoid.WalkSpeed+50) and not attack and MomentumCancel then
RootPart.Velocity = Vector3.new(0,0,0)
if not chattedAlready then
chattedAlready = true
chatServ:Chat(Head, "Momentum Cancel!", 2)
wait(1)
chattedAlready = false
end
end
end
RootPart.Changed:connect(MomentumCanelling)
Torso.Changed:connect(MomentumCanelling)
Head.Changed:connect(MomentumCanelling)
RightArm.Changed:connect(MomentumCanelling)
RightLeg.Changed:connect(MomentumCanelling)
LeftArm.Changed:connect(MomentumCanelling)
LeftLeg.Changed:connect(MomentumCanelling)
function Demonattackone()
attack=true
--[[
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.2,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5,0)*euler(0.5,-1.2,0)*euler(-.2,0,0),.3)
]]
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,-1),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.7),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.3,0,.5),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(.7,0,-0.7),.3)
RH.C0=clerp(RH.C0,cf(1,-1,-.6)*euler(-.3,1.57,0)*euler(0,.5,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.3,0)*euler(0.5,-.8,0)*euler(-.5,0,0),.3)
end
hitbox2.Parent=model2
hitbox2.Size=vt(1,6,1)
hitbox2.Transparency=1
hitbox2.CFrame=prtd7.CFrame
con1=hitbox2.Touched:connect(function(hit) Damagefunc(hit,30,60,math.random(1,5),"Lifesteal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=28144425",prtd7,1,.7)
blcf=nil
scfr=nil
for i=0,1,0.08 do
swait()
local blcf = prtd7.CFrame*CFrame.new(0,-.5,0)
if scfr and (prtd7.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox2.CFrame=prtd7.CFrame
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.2,0,1),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-0.7),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.4,-0.5,1)*euler(1.3,0,-1.7),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-.7,0,-0.7),.3)
RH.C0=clerp(RH.C0,cf(1,-.6,0)*euler(-.3,1.57,0)*euler(0,-1,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,-0.3)*euler(-0.3,-2.3,0)*euler(0,0,0),.3)
end
con1:disconnect()
hitbox2.Parent=nil
attack=false
end
function Demonattacktwo()
attack=true
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.4)*euler(0.1,0,1.2),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,-0.7),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.4,-1.2,.6)*euler(1.1,0,-1.7),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-.7,0,-0.7),.3)
RH.C0=clerp(RH.C0,cf(1,-.6,0)*euler(-.1,1.57,0)*euler(0,-1,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,-0.3)*euler(-0.1,-2.3,0)*euler(0,0,0),.3)
end
hitbox2.Parent=model2
hitbox2.Size=vt(1,6,1)
hitbox2.Transparency=1
hitbox2.CFrame=prtd7.CFrame
con1=hitbox2.Touched:connect(function(hit) Damagefunc(hit,30,60,math.random(1,5),"Lifesteal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=28144425",prtd7,1,.5)
blcf=nil
scfr=nil
for i=0,1,0.1 do
swait()
local blcf = prtd7.CFrame*CFrame.new(0,-.5,0)
if scfr and (prtd7.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
hitbox2.CFrame=prtd7.CFrame
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.4)*euler(0.1,0,-0.8),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.7),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-.8,.6)*euler(0.5,0,.5),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-.7,0,-0.7),.3)
RH.C0=clerp(RH.C0,cf(1,-.8,-0.3)*euler(-0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.6,-0.2)*euler(0.2,-1.2,0)*euler(-.2,0,0),.3)
end
con1:disconnect()
hitbox2.Parent=nil
attack=false
end
function Demonattackthree()
attack=true
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.1,0,-0.2),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(2.9,-1.8,0)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-.7,-.3)*euler(-0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.7,0)*euler(0.2,-1.2,0)*euler(-.2,0,0),.3)
end
--Humanoid.WalkSpeed=0
hitbox2.Parent=model2
hitbox2.Size=vt(1,6,1)
hitbox2.Transparency=1
hitbox2.CFrame=prtd7.CFrame
con1=hitbox2.Touched:connect(function(hit) Damagefunc(hit,30,60,math.random(1,5),"Lifesteal",RootPart,.5,1) end)
so("http://roblox.com/asset/?id=28144425",prtd7,1,.6)
blcf=nil
scfr=nil
for i=0,1,0.15 do
swait()
local blcf = prtd7.CFrame*CFrame.new(0,-.5,0)
if scfr and (prtd7.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.8)*euler(0.5,0,0.6),.4)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1,0,-0.6),.4)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.55,-1.5,0)*euler(.3,0,0),.4)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-0.2),.4)
RH.C0=clerp(RH.C0,cf(1,-.1,-.4)*euler(0.4,1.57,0)*euler(-.2,0,0),.4)
LH.C0=clerp(LH.C0,cf(-1,-.9,0)*euler(-0.2,-1.2,0)*euler(-.2,0,0),.4)
if i==0.6 then
hit,pos=rayCast(prtd8.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,4,Character)
if hit~=nil then
local ref=part(3,workspace,0,1,BrickColor.new("Black"),"Effect",vt())
ref.Anchored=true
ref.CFrame=cf(pos)
game:GetService("Debris"):AddItem(ref,3)
for i=1,5 do
Col=hit.BrickColor
local groundpart=part(3,F2,0,0,Col,"Ground",vt(math.random(50,200)/100,math.random(50,200)/100,math.random(50,200)/100))
groundpart.Anchored=true
groundpart.Material=hit.Material
groundpart.CanCollide=true
groundpart.CFrame=cf(pos)*cf(math.random(-200,200)/100,0,math.random(-200,200)/100)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
game:GetService("Debris"):AddItem(groundpart,3)
end
so("http://roblox.com/asset/?id=157878578",ref,.6,1.5)
MagicWave(hit.BrickColor,cf(pos),1,1,1,.7,.7,.7,0.05)
MagniDamage(ref,10,10,20,math.random(10,20),"Normal")
end
end
end
con1:disconnect()
hitbox2.Parent=nil
swait(10)
--Humanoid.WalkSpeed=16
attack=false
end
function LetItBuild()
attack=true
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.8)*euler(0.2,0,-1),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,1),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.5,-0.5,1.5)*euler(.6,0,.4),.3)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.5)*euler(1.57,-1.57,0)*euler(1.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-.6,-.5)*euler(-0.2,2,0)*euler(0,0,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.2,0)*euler(0.5,-.6,0)*euler(-.4,0,0),.3)
end
local num=0
local magik=0
local num2=0
local dammulti = 1
chatServ:Chat(Head, "Devil...", 2)
while holdx==true do
swait()
if magik<25 then
if num>=10 then
pos1=Torso.Position+vt(math.random(-200,200)/100,math.random(-200,200)/100,math.random(-200,200)/100)
pos2=prtd8.Position--+vt(math.random(-50,50)/100,math.random(-50,50)/100,math.random(-50,50)/100)
Lightning(pos1,pos2,5,3,"Dark indigo",.1,.5,.5)
MagicCircle(BrickColor.new("Dark indigo"),cf(pos1),5,5,5,1,1,1,.1)
MagicBlood(BrickColor.new("Dark indigo"),Torso.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
so("http://www.roblox.com/asset/?id=178452221",Torso,.1,1.5)
magik=magik+3
num=0
end
end
Humanoid.MaxHealth = Humanoid.MaxHealth+20
dammulti = dammulti+(2+(Humanoid.MaxHealth/Humanoid.Health))
num=num+1
num2=num2+magik
Humanoid.Health = Humanoid.Health-.08
if num2>=50 then
MagicBlood(BrickColor.new("Dark indigo"),cf(prtd8.Position)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,1,.1,0.1)
num2=0
end
--MagicBlock(BrickColor.new("Really red"),cf(prtd8.Position)*cf(math.random(-100,100)/100,math.random(-100,100)/100,math.random(-100,100)/100)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),magik/5,magik/5,magik/5,magik/8,magik/8,magik/8,.1)
end
chatServ:Chat(Head, "Cutter!", 2)
RootPart.Velocity=RootPart.CFrame.lookVector*(6*magik)
blcf=nil
scfr=nil
hitbox2.Parent=model2
hitbox2.Size=vt(1,6,1)
hitbox2.Transparency=1
hitbox2.CFrame=prtd7.CFrame
con1=hitbox2.Touched:connect(function(hit) Damagefunc(hit,(magik*2221)*dammulti,(magik*4441)*dammulti,1,"DevilStyle",RootPart,.2/(dammulti*magik),1) end)
for i=1,3 do
so("http://roblox.com/asset/?id=28144425",prtd7,1,1)
for i=0,1,0.1 do
swait()
hitbox2.CFrame=prtd7.CFrame
local blcf = prtd7.CFrame*CFrame.new(0,-.5,0)
if scfr and (prtd7.Position-scfr.p).magnitude > .1 then
local h = 5
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,1) end if b then game.Debris:AddItem(b,1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
RootJoint.C0=RootCF*cf(0,0,-0.8)*euler(0,0,6.28*i)*euler(0.2,0,-1)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.5,-0.5,1.5)*euler(.4,0,0),.3)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.5)*euler(1.57,-1.57,0)*euler(1.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-.6,-.5)*euler(-0.2,2,0)*euler(0,0,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.2,0)*euler(0.5,-.6,0)*euler(-.4,0,0),.3)
end
end
con1:disconnect()
hitbox2.Parent=nil
attack=false
end
function YourMoveCreep()
attack=true
local pers=nil
for i=0,1,0.1 do
swait()
cost=Humanoid.Health*.01
Humanoid:TakeDamage(cost)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.7)*euler(0.2,0,-1.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0.2,1.3),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.8,-0.5,1)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,-0.4,0)*euler(0,0,-1.7),.3)
RH.C0=clerp(RH.C0,cf(.1,-1,-.9)*euler(-0.2,1.57,0)*euler(-.7,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-.8,-.4,0)*euler(0.2,-1.2,0)*euler(-.2,1.4,0),.3)
end
local blockprt=part(3,Character,0,1,BrickColor.new("Dark indigo"),"Block",vt(6,.1,6))
chatServ:Chat(Head, "Your move, creep.", 2)
blockprt.Anchored=false
blockprt.CanCollide = false
blockprt.CFrame=LeftArm.CFrame*cf(0,-1,0)
local Blockweld = Instance.new("Weld",blockprt)
Blockweld.Part0 = LeftArm
Blockweld.Part1 = blockprt
Blockweld.C0 = CFrame.new(0, -1, 0)
conbl=blockprt.Touched:connect(function(hit) end)
local extradam = 1
blockprt.Touched:connect(function(hit)
local Tor1 = hit.Parent.Parent:findFirstChild("Torso")
local Tor2 = hit.Parent:findFirstChild("Torso")
local function FindAHumanoid(parent)
local H = nil
for _, HUM in pairs(parent:GetChildren()) do
if HUM:IsA("Humanoid") then
H = HUM
end
end
return H
end
if Tor1 and guard then
if Tor1.Parent == Character then else
local HUM = FindAHumanoid(Tor1.Parent)
local DAM = math.random(10, 20)*extradam
if HUM then
if HUM.MaxHealth > 10000000 then
HUM.MaxHealth = 100
end
showDamage(Tor1.Parent,DAM,.5,BrickColor.new("Dark indigo"))
HUM.Health = HUM.Health-DAM
HUM:ChangeState(Enum.HumanoidStateType.FallingDown)
chatServ:Chat(Head, "Ha!", 2)
end
guard = false
local BBlast = Instance.new("Part", F2)
BBlast.BrickColor = BrickColor.new("Dark indigo")
BBlast.Material = "Neon"
BBlast.Transparency = .5
local OverallSize = Tor1.Size.X*4
BBlast.Size = Vector3.new(OverallSize,OverallSize,OverallSize)
BBlast.CFrame = Tor1.CFrame
BBlast.Anchored = true
BBlast.CanCollide = false
BBlast.Locked = true
local BMesh = Instance.new("SpecialMesh", BBlast)
BMesh.MeshType = "Sphere"
local BSound = Instance.new("Sound", BBlast)
BSound.Volume = 10
BSound.SoundId = "rbxassetid://153832523"
BSound.Pitch = .8
BSound:Play()
MagniDamage(BBlast,OverallSize*2,(DAM/2)-.01,DAM/2,1,"Breaker")
for I = .5, 1, .05 do
wait()
BMesh.Scale = Vector3.new(I*2, I*2, I*2)
BBlast.Transparency = I
end
game:GetService("Debris"):AddItem(BBlast, 0)
game:GetService("Debris"):AddItem(BSound, 0)
end
end
if Tor2 and guard then
if Tor2.Parent == Character then else
local HUM = FindAHumanoid(Tor2.Parent)
local DAM = math.random(10, 20)*extradam
if HUM then
if HUM.MaxHealth > 10000000 then
HUM.MaxHealth = 100
wait()
end
showDamage(Tor2.Parent,DAM,.5,BrickColor.new("Dark indigo"))
HUM.Health = HUM.Health-DAM
HUM:ChangeState(Enum.HumanoidStateType.Ragdoll)
chatServ:Chat(Head, "Ha!", 2)
end
guard = false
local BBlast = Instance.new("Part", F2)
BBlast.BrickColor = BrickColor.new("Dark indigo")
BBlast.Material = "Neon"
BBlast.Transparency = .5
local OverallSize = Tor2.Size.X*4
BBlast.Size = Vector3.new(OverallSize,OverallSize,OverallSize)
BBlast.CFrame = Tor2.CFrame
BBlast.Anchored = true
BBlast.CanCollide = false
BBlast.Locked = true
local BMesh = Instance.new("SpecialMesh", BBlast)
BMesh.MeshType = "Sphere"
local BSound = Instance.new("Sound", BBlast)
BSound.Volume = 10
BSound.SoundId = "rbxassetid://153832523"
BSound.Pitch = .8
BSound:Play()
MagniDamage(BBlast,OverallSize*2,(DAM/2)-.01,DAM/2,1,"Breaker")
for I = .5, 1, .05 do
wait()
BMesh.Scale = Vector3.new(I*2, I*2, I*2)
BBlast.Transparency = I
end
game:GetService("Debris"):AddItem(BBlast, 0)
game:GetService("Debris"):AddItem(BSound, 0)
end
end
--[[if hit.Parent:findFirstChild("Torso")~=nil and hit.Parent~=Character and guard==true then
pers=hit
print("HIT")
guard=false
end--]]
end)
num=0
while guard==true do
swait()
extradam = extradam+.5
if num>10 then
num=0
MagicBlock(BrickColor.new("Dark indigo"),LeftArm.CFrame*cf(0,-1,0),1,1,1,.7,.7,.7,0.05)
MagicCircle(BrickColor.new("Dark indigo"),LeftArm.CFrame*cf(0,-1,0),1,.1,1,6,0,6,0.1)
end
--blockprt.CFrame=LeftArm.CFrame*cf(0,-1,0)
num=num+1
end
conbl:disconnect()
game:GetService("Debris"):AddItem(blockprt, 0)
print(pers)
if pers~=nil then
for i=0,1,0.1 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.7)*euler(-0.2,0,1.6),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,-0.2,-1),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.8,-1,1)*euler(1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
RH.C0=clerp(RH.C0,cf(.1,-1,-.9)*euler(-0.2,1.57,0)*euler(-.7,-1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-.8,-.4,0)*euler(0.2,-1.2,0)*euler(-.2,1.4,0),.3)
end
swait(200)
end
attack=false
end
function CreateWeaponPart(className, parent, Brickcolor, Material, Transparency, Reflectance, Name, Size, Position, Rotation, MeshClass, MeshScale, MeshId, MeshType)
local Part = Instance.new(className, parent)
Part.BrickColor = BrickColor.new(Brickcolor)
Part.Transparency = Transparency
Part.Reflectance = Reflectance
Part.Material = Material
Part.Name = Name
Part.Anchored = true
Part.CanCollide = false
Part.Locked = true
Part.Size = Size
Part.Position = Position
Part.Rotation = Rotation
local Mesh = Instance.new(MeshClass, Part)
Mesh.Scale = MeshScale
if MeshClass == "SpecialMesh" then
Mesh.MeshId = MeshId
Mesh.MeshType = MeshType
end
return Part
end
local Demon_Cannon = Instance.new("Model")
Demon_Cannon.Name = "Demon Cannon"
----------------(ClassName, , BrickColor, Material , Trans, Refl, Name, Size, Position, Rotation, Mesh Class, Mesh Scale , MId, MType)
CreateWeaponPart("Part", Demon_Cannon, "Fossil", "SmoothPlastic", 0, 0, "FossilPart", Vector3.new(0.218, 0.218, 0.218), Vector3.new(2.827, 3.364, -264.536), Vector3.new(-90, 0, 90), "CylinderMesh", Vector3.new(0.5, 0.06, 0.5), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Fossil", "SmoothPlastic", 0, 0, "FossilPart", Vector3.new(0.218, 0.218, 0.218), Vector3.new(3.373, 3.036, -264.536), Vector3.new(-90, 0, 90), "CylinderMesh", Vector3.new(0.5, 0.06, 0.5), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Fossil", "SmoothPlastic", 0, 0, "FossilPart", Vector3.new(0.218, 0.218, 0.218), Vector3.new(2.827, 3.036, -264.536), Vector3.new(-90, 0, 90), "CylinderMesh", Vector3.new(0.5, 0.06, 0.5), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Fossil", "SmoothPlastic", 0, 0, "FossilPart", Vector3.new(0.218, 0.218, 0.218), Vector3.new(3.373, 3.364, -264.536), Vector3.new(-90, 0, 90), "CylinderMesh", Vector3.new(0.5, 0.06, 0.5), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "BodyNeon", Vector3.new(0.545, 0.2, 2.4), Vector3.new(3.1, 2.982, -265.736), Vector3.new(0, 0, 0), "BlockMesh", Vector3.new(1.01, 0.055, 1), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "BodyNeon", Vector3.new(0.545, 0.2, 2.4), Vector3.new(3.1, 3.418, -265.736), Vector3.new(0, 0, 0), "BlockMesh", Vector3.new(1.01, 0.055, 1), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "BodyNeon", Vector3.new(0.545, 0.2, 2.4), Vector3.new(3.1, 3.309, -265.736), Vector3.new(0, 0, 0), "BlockMesh", Vector3.new(1.01, 0.055, 1), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "BodyNeon", Vector3.new(0.545, 0.2, 2.4), Vector3.new(3.1, 3.091, -265.736), Vector3.new(0, 0, 0), "BlockMesh", Vector3.new(1.01, 0.055, 1), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Black", "SmoothPlastic", 0, 0, "BulletHole", Vector3.new(0.545, 0.218, 0.655), Vector3.new(3.1, 3.473, -264.427), Vector3.new(-90, 0, -180), "CylinderMesh", Vector3.new(0.5, 0.06, 0.5), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Black", "SmoothPlastic", 0, 0, "BulletHole", Vector3.new(0.545, 0.218, 0.655), Vector3.new(3.1, 2.927, -264.427), Vector3.new(-90, 0, -180), "CylinderMesh", Vector3.new(0.5, 0.06, 0.5), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Really black", "Pebble", 0, 0, "CannonBack", Vector3.new(1.2, 0.436, 0.545), Vector3.new(3.1, 3.2, -267.264), Vector3.new(-90, 90, 0), "SpecialMesh", Vector3.new(1,1,1), "", "Torso")
CreateWeaponPart("Part", Demon_Cannon, "Really black", "Pebble", 0, 0, "CannonBack", Vector3.new(0.545, 1.2, 0.2), Vector3.new(3.1, 3.2, -266.991), Vector3.new(0, 0, 0), "BlockMesh", Vector3.new(1,1,.545), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Really black", "Pebble", 0, 0, "CannonBody", Vector3.new(0.545, 0.545, 2.509), Vector3.new(3.1, 3.2, -265.682), Vector3.new(0, 0, 0), "BlockMesh", Vector3.new(1,1,1), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Really black", "Pebble", 0, 0, "CannonCylinder", Vector3.new(0.545, 2.509, 0.655), Vector3.new(3.1, 3.473, -265.682), Vector3.new(-90, 0, -180), "CylinderMesh", Vector3.new(1,1,1), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Really black", "Pebble", 0, 0, "CannonCylinder", Vector3.new(0.545, 2.509, 0.655), Vector3.new(3.1, 2.927, -265.682), Vector3.new(-90, 0, -180), "CylinderMesh", Vector3.new(1,1,1), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "NeonCylinder", Vector3.new(0.545, 0.218, 0.655), Vector3.new(3.1, 3.473, -264.427), Vector3.new(-90, 0, -180), "CylinderMesh", Vector3.new(0.55, 0.05, 0.55), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "NeonCylinder", Vector3.new(0.545, 0.218, 0.655), Vector3.new(3.1, 2.927, -264.427), Vector3.new(-90, 0, -180), "CylinderMesh", Vector3.new(0.55, 0.05, 0.55), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "NeonCylinder", Vector3.new(0.218, 0.218, 0.218), Vector3.new(2.827, 3.364, -264.536), Vector3.new(-90, 0, 90), "CylinderMesh", Vector3.new(0.6, 0.05, 0.6), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "NeonCylinder", Vector3.new(0.218, 0.218, 0.218), Vector3.new(3.373, 3.364, -264.536), Vector3.new(-90, 0, 90), "CylinderMesh", Vector3.new(0.6, 0.05, 0.6), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "NeonCylinder", Vector3.new(0.218, 0.218, 0.218), Vector3.new(3.373, 3.036, -264.536), Vector3.new(-90, 0, 90), "CylinderMesh", Vector3.new(0.6, 0.05, 0.6), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Dark indigo", "Neon", 0, 0, "NeonCylinder", Vector3.new(0.218, 0.218, 0.218), Vector3.new(2.827, 3.036, -264.536), Vector3.new(-90, 0, 90), "CylinderMesh", Vector3.new(0.6, 0.05, 0.6), _, _)
local CannonMain = CreateWeaponPart("Part", Demon_Cannon, "Really black", "SmoothPlastic", 1, 0, "Main", Vector3.new(0.545, 1.345, 3.309), Vector3.new(3.1, 3.2, -265.882), Vector3.new(180, -0, -180), "BlockMesh", Vector3.new(1,1,1), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Really black", "SmoothPlastic", 1, 0, "Blaster Hole1", Vector3.new(0.545, 0.345, 0.2), Vector3.new(3.1, 3.473, -264.436), Vector3.new(-180, -0, -180), "BlockMesh", Vector3.new(1, 1, 1), _, _)
CreateWeaponPart("Part", Demon_Cannon, "Really black", "SmoothPlastic", 1, 0, "Blaster Hole2", Vector3.new(0.545, 0.345, 0.2), Vector3.new(3.1, 2.927, -264.436), Vector3.new(-180, -0, -180), "BlockMesh", Vector3.new(1, 1, 1), _, _)
local CHole1 = Demon_Cannon:WaitForChild("Blaster Hole1")
local CHole2 = Demon_Cannon:WaitForChild("Blaster Hole2")
for _, Part in pairs(Demon_Cannon:GetChildren()) do
if Part:IsA("Part") then
if Part.Name ~= "Main" then
local x = CannonMain
local y = Part
local W = Instance.new("Weld")
W.Part0 = x
W.Part1 = y
local CJ = CFrame.new(x.Position)
local C0 = x.CFrame:inverse()*CJ
local C1 = y.CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = x
x.Anchored = false
y.Anchored = false
end
Part.Anchored = false
Part.TopSurface = "SmoothNoOutlines"
Part.BottomSurface = "SmoothNoOutlines"
Part.LeftSurface = "SmoothNoOutlines"
Part.RightSurface = "SmoothNoOutlines"
Part.FrontSurface = "SmoothNoOutlines"
Part.BackSurface = "SmoothNoOutlines"
end
end
CannonMain.Anchored = true
local CM2 = CreateWeaponPart("Part", Character, "Really black", "SmoothPlastic", 1, 0, "Main2", Vector3.new(0.545, 1.345, 3.309), Vector3.new(3.1, 3.2, -265.882), Vector3.new(180, -0, -180), "BlockMesh", Vector3.new(1,1,1), _, _)
CM2.Anchored = false
local CMW1 = Instance.new("Weld", CM2)
CMW1.Part0 = RootPart
CMW1.Part1 = CM2
CMW1.C0 = CFrame.new(0, 3, 0)
local CannonWeld = Instance.new("Weld", CM2)
local CPos = Instance.new("BodyPosition")
local CGyro = Instance.new("BodyGyro")
local DCOn = false
local TCtrl = false
local CanUseCannon = false
local Firing = false
local C = 1
function DemonCannon()
attack = true
chatServ:Chat(Head, "Behold..", 2)
for i=0, 10 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.7)*euler(0.2,0,-1.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0.2,1.3),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.8,-0.5,1)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,-0.4,0)*euler(0,0,-1.7),.3)
RH.C0=clerp(RH.C0,cf(.1,-1,-.9)*euler(-0.2,1.57,0)*euler(-.7,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-.8,-.4,0)*euler(0.2,-1.2,0)*euler(-.2,1.4,0),.3)
end
wait(1)
Humanoid.WalkSpeed = 8
for i=0, 10 do
swait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.7)*euler(0.2,0,-1.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,-.4,1.3),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.8,-0.5,1)*euler(.5,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,-0.4,0)*euler(0,0,-2.6),.3)
RH.C0=clerp(RH.C0,cf(.1,-1,-.9)*euler(-0.2,1.57,0)*euler(-.7,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-.8,-.4,0)*euler(0.2,-1.2,0)*euler(-.2,1.4,0),.3)
end
so("http://roblox.com/asset/?id=178452217",CM2,1,.4)
for i=0,1,0.01 do
swait()
for i=1,4 do
if math.random(1,4)==1 then
MagicBlock(BrickColor.new("Really black"),CM2.CFrame*cf(math.random(-100,100)/100,-math.random(-100,100)/100,math.random(-300,300)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
else
MagicBlock(BrickColor.new("Dark indigo"),CM2.CFrame*cf(math.random(-100,100)/100,-math.random(-100,100)/100,math.random(-300,300)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
end
end
num=num+1
end
so("http://roblox.com/asset/?id=168586621",RightArm,1,.5)
local Boo = Instance.new("Part", F2)
Boo.BrickColor = BrickColor.new("Dark indigo")
Boo.Transparency = .5
Boo.Material = "Neon"
Boo.Anchored = true
Boo.CanCollide = false
Boo.CFrame = CM2.CFrame
Boo.Size = Vector3.new(3,3,3)
local BooM = Instance.new("SpecialMesh", Boo)
BooM.MeshType = "Sphere"
local nuM = 0
chatServ:Chat(Head, "The Demon Cannon!", 2)
Humanoid.WalkSpeed = 16
for i = 1, 4, .1 do
wait()
BooM.Scale = Vector3.new(i,i,i)
Boo.Transparency = .5+(i/8)
if nuM ~= 1 then
Demon_Cannon.Parent = Character
CannonWeld = Instance.new("Weld", CM2)
CannonWeld.Part0 = CM2
CannonWeld.Part1 = CannonMain
CannonMain.Anchored = false
nuM = 1
end
end
for i=0,1,0.1 do
wait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.7)*euler(-0.2,0,1.6),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,-0.2,-1),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.8,-1,1)*euler(1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
RH.C0=clerp(RH.C0,cf(.1,-1,-.9)*euler(-0.2,1.57,0)*euler(-.7,-1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-.8,-.4,0)*euler(0.2,-1.2,0)*euler(-.2,1.4,0),.3)
end
game:GetService("Debris"):AddItem(Boo, 0)
CanUseCannon = true
CannonWeld.Part0 = nil
CannonWeld.Part1 = nil
CPos.Parent = CannonMain
CPos.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
CGyro.Parent = CannonMain
CGyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
attack = false
end
function HideDemonCannon()
attack = true
CanUseCannon = false
CPos.Parent = nil
CPos.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
CGyro.Parent = nil
CGyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
CannonWeld = Instance.new("Weld", CM2)
CannonWeld.Part0 = CM2
CannonWeld.Part1 = CannonMain
so("http://roblox.com/asset/?id=178452217",CM2,1,.4)
for i=0,1,0.01 do
swait()
for i=1,4 do
if math.random(1,4)==1 then
MagicBlock(BrickColor.new("Really black"),CM2.CFrame*cf(math.random(-100,100)/100,-math.random(-100,100)/100,math.random(-300,300)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
else
MagicBlock(BrickColor.new("Dark indigo"),CM2.CFrame*cf(math.random(-100,100)/100,-math.random(-100,100)/100,math.random(-300,300)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
end
end
num=num+1
end
CannonMain.Anchored = true
Demon_Cannon.Parent = nil
CannonWeld.Part0 = nil
CannonWeld.Part1 = nil
game:GetService("Debris"):AddItem(CannonWeld, 0)
attack = false
end
function TimeControl()
print("hahaha")
attack = true
for i=0,1,0.1 do
wait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.4)*euler(math.rad(20),0,math.rad(-30)),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,math.rad(30)),.3)
RW.C0=clerp(RW.C0,cf(1.5,.5,0)*euler(math.rad(-50),math.rad(0),math.rad(60))*euler(0,math.rad(-120),0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,.5,0)*euler(math.rad(110),math.rad(-10),math.rad(-30)),.3)
RH.C0=clerp(RH.C0,cf(1,-.85,-.85)*euler(0,math.rad(100),math.rad(-30))*euler(0,0,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.45,-.35)*euler(0,math.rad(-60),math.rad(-20))*euler(0,0,0),.3)
end
local EmeraldWeld = Instance.new("Motor", LeftArm)
local Chaos_Emerald = Instance.new("Part", F2)
Chaos_Emerald.BrickColor = BrickColor.new("Dark indigo")
Chaos_Emerald.Material = "SmoothPlastic"
Chaos_Emerald.Reflectance = .3
Chaos_Emerald.Transparency = 1
Chaos_Emerald.Name = "Chaos Emerald"
Chaos_Emerald.Anchored = false
Chaos_Emerald.CanCollide = false
Chaos_Emerald.Locked = true
Chaos_Emerald.Size = Vector3.new(1,.4, 1)
local CE_Mesh = Instance.new("SpecialMesh", Chaos_Emerald)
CE_Mesh.MeshId = "http://www.roblox.com/asset?id=160003363"
CE_Mesh.Scale = Vector3.new(2,1,2)
local CE_Light = Instance.new("PointLight", Chaos_Emerald)
CE_Light.Brightness = 100
CE_Light.Color = Color3.new(85/255, 0, 127/255)
CE_Light.Range = 8
CE_Light.Shadows = true
CE_Light.Enabled = false
local transPoints = {
NumberSequenceKeypoint.new(0,0,0),
NumberSequenceKeypoint.new(1,1,0),
}
local ETransparency = NumberSequence.new(transPoints)
local CE_PE = Instance.new("ParticleEmitter", Chaos_Emerald)
CE_PE.Color = ColorSequence.new(Chaos_Emerald.BrickColor.Color)
CE_PE.LightEmission = 1
CE_PE.Size = NumberSequence.new(.4)
CE_PE.Transparency = ETransparency
CE_PE.EmissionDirection = "Top"
CE_PE.LockedToPart = true
CE_PE.VelocityInheritance = 1
CE_PE.Rate = 50
CE_PE.Lifetime = NumberRange.new(.3, .5)
CE_PE.RotSpeed = NumberRange.new(100,300)
CE_PE.Speed = NumberRange.new(2)
CE_PE.VelocitySpread = 100
CE_PE.Enabled = false
EmeraldWeld.Part0 = LeftArm
EmeraldWeld.Part1 = Chaos_Emerald
EmeraldWeld.DesiredAngle = 9999999999999999999999999999999999999999999999999999999999999
EmeraldWeld.MaxVelocity = math.rad(5)
EmeraldWeld.C0 = CFrame.new(0, -6, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-180), 0, 0)
EmeraldWeld.C1 = CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
so("http://roblox.com/asset/?id=178452217",CM2,1,.4)
for i=0,1,0.01 do
swait()
for i=1,6 do
if math.random(1,4)==1 then
MagicBlock(BrickColor.new("Really black"),Chaos_Emerald.CFrame*cf(math.random(-100,100)/100,-math.random(-100,100)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
else
MagicBlock(BrickColor.new("Dark indigo"),Chaos_Emerald.CFrame*cf(math.random(-100,100)/100,-math.random(-100,100)/100,math.random(-100,100)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,.5,.5,.5,0.05)
end
end
num=num+1
end
Chaos_Emerald.Transparency = .3
CE_PE.Enabled = true
CE_Light.Enabled = true
Humanoid.WalkSpeed = 0
wait(1)
for i = 0, 2.25, .1 do
wait()
EmeraldWeld.C0=clerp(EmeraldWeld.C0,cf(0,-.5,0)*euler(math.rad(-180),0,0),.1)
end
EmeraldWeld.MaxVelocity = 0
so("http://roblox.com/asset/?id=227194112",LeftArm,1,1)
for i=0,1,0.1 do
wait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*euler(0,0,math.rad(-30)),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,math.rad(30)),.3)
RW.C0=clerp(RW.C0,cf(1.5,.5,0)*euler(math.rad(-50),math.rad(0),math.rad(60))*euler(0,math.rad(-160),0),.3)
LW.C0=clerp(LW.C0,cf(-.5,.5,-1)*euler(math.rad(90),0,math.rad(80)),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0,math.rad(90), 0),.3)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(0,math.rad(-90),0),.3)
end
for i=0,1,0.1 do
wait()
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*euler(0,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(math.rad(-20),0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,.5,0)*euler(math.rad(0),math.rad(0),math.rad(60))*euler(0,math.rad(-90),0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,.5,0)*euler(math.rad(150),0,0),.3)
end
chatServ:Chat(Head, "Behold, my power!", 2)
EmeraldWeld.MaxVelocity = math.rad(5)
for i = 0, 1, .1 do
wait()
EmeraldWeld.C0=clerp(EmeraldWeld.C0,cf(0,-3,-1.1)*euler(math.rad(-240),0,0),.3)
end
local Chaos_Emerald2 = Chaos_Emerald:Clone()
Chaos_Emerald2.Parent = F2
Chaos_Emerald2.Anchored = false
for _, k in pairs(Chaos_Emerald2:GetChildren()) do
if k:IsA("PointLight") or k:IsA("ParticleEmitter") then
game:GetService("Debris"):AddItem(k, 0)
end
end
Chaos_Emerald2.Transparency = .5
local EmeraldWeld2 = Instance.new("Weld", Chaos_Emerald)
EmeraldWeld2.Part0 = Chaos_Emerald
EmeraldWeld2.Part1 = Chaos_Emerald2
EmeraldWeld2.C0 = CFrame.new(0,0,0)
local CE2_Mesh = Chaos_Emerald2:WaitForChild("Mesh")
CE2_Mesh.Scale = Vector3.new(0,0,0)
local function EFlash()
for t = 0, 2, .1 do
wait()
CE2_Mesh.Scale = Vector3.new(t*4,t*1.2,t*4)
Chaos_Emerald2.Transparency = .5+t/4
end
end
for i = 0, 5 do
EFlash()
wait(.1)
end
chatServ:Chat(Head, "Time control!", 2)
local TPlayers = {}
local THumanoids = {}
local RecentBrightness = game.Lighting.Brightness
local RecentOutDoorAmbient = game.Lighting.OutdoorAmbient
local RecentTimeOfDay = game.Lighting.TimeOfDay
local RecentFogEnd = game.Lighting.FogEnd
local RecentFogColor = game.Lighting.FogColor
local TBlast, TBMesh = Instance.new("Part", F2), Instance.new("SpecialMesh")
TBlast.BrickColor = BrickColor.new("Dark indigo")
TBlast.Transparency = 1
TBlast.Anchored = true
TBlast.CanCollide = false
TBlast.CFrame = RootPart.CFrame
TBlast.Size = Vector3.new(2,2,2)
TBMesh.Parent = TBlast
TBMesh.MeshType = "Sphere"
game.Lighting.Brightness = 0
game.Lighting.OutdoorAmbient = TBlast.BrickColor.Color
game.Lighting.TimeOfDay = 4
game.Lighting.FogEnd = 1000
game.Lighting.FogColor = TBlast.BrickColor.Color
local function GetPlayers()
for _, P in pairs(game.Players:GetPlayers()) do
if P then
if P ~= Player and P.UserId ~= 43981323 and P.UserId ~= 14349727 then
table.insert(TPlayers, P)
local cc = P:WaitForChild("Character")
local huh = FindHum(cc)
local Jd = huh:FindFirstChild("JumpedValue")
if not Jd then
Jd = Instance.new("BoolValue")
Jd.Parent = huh
Jd.Name = "JumpedValue"
Jd.Value = false
end
local S = P:WaitForChild("Character"):WaitForChild("Torso"):FindFirstChild("svFgyuzxC")
if not S then
S = Instance.new("BodyVelocity",P:WaitForChild("Character"):WaitForChild("Torso"))
S.MaxForce = Vector3.new(0,0,0)
S.Velocity = Vector3.new(0,0,0)
S.Name = "svFgyuzxC"
end
end
end
end
end
local function GetOtherHumanoids()
for _, H in pairs(workspace:GetChildren()) do
if H:IsA("Model") then
local HUM = FindHum(H)
if HUM and HUM ~= Humanoid then
table.insert(THumanoids, HUM)
local Jd = HUM:FindFirstChild("JumpedValue")
if not Jd then
Jd = Instance.new("BoolValue")
Jd.Parent = HUM
Jd.Name = "JumpedValue"
Jd.Value = false
end
local S = HUM.Parent:WaitForChild("Torso"):FindFirstChild("svFgyuzxC")
if not S then
S = Instance.new("BodyVelocity",HUM.Parent:WaitForChild("Torso"))
S.MaxForce = Vector3.new(0,0,0)
S.Velocity = Vector3.new(0,0,0)
S.Name = "svFgyuzxC"
end
end
end
end
end
GetPlayers()
GetOtherHumanoids()
local function ClearTHumanoids()
for i, H in pairs(THumanoids) do
if H then
table.remove(THumanoids, i)
local Jd = H:FindFirstChild("JumpedValue")
if Jd then
game:GetService("Debris"):AddItem(Jd, 0)
end
H.WalkSpeed = 16
local S = H.Parent:WaitForChild("Torso"):FindFirstChild("svFgyuzxC")
if S then
game:GetService("Debris"):AddItem(S, 0)
end
end
end
end
local function ClearTPlayers()
for i, P in pairs(TPlayers) do
if P then
table.remove(TPlayers, i)
local cc = P:WaitForChild("Character")
local huh = FindHum(cc)
local Jd = huh:FindFirstChild("JumpedValue")
if Jd then
game:GetService("Debris"):AddItem(Jd, 0)
end
huh.WalkSpeed = 16
local S = P:WaitForChild("Character"):WaitForChild("Torso"):FindFirstChild("svFgyuzxC")
if S then
game:GetService("Debris"):AddItem(S, 0)
end
end
end
end
Humanoid.WalkSpeed = 16
for s = 0, 50, 5 do
wait()
TBMesh.Scale = Vector3.new(s*s,s*s,s*s)
TBlast.Transparency = s/50
end
attack = false
game:GetService("Debris"):AddItem(Chaos_Emerald, 0)
game:GetService("Debris"):AddItem(Chaos_Emerald2, 0)
game:GetService("Debris"):AddItem(TBlast, 0)
local PlayerJoined = game:GetService("Players").PlayerAdded:connect(function()
for _,child in pairs(game:GetService("Players"):GetPlayers()) do
table.insert(TPlayers, child)
local cc = child:WaitForChild("Character")
local huh = FindHum(cc)
local Jd = huh:FindFirstChild("JumpedValue")
if not Jd then
Jd = Instance.new("BoolValue")
Jd.Parent = huh
Jd.Name = "JumpedValue"
Jd.Value = false
end
local S = child:WaitForChild("Character"):WaitForChild("Torso"):FindFirstChild("svFgyuzxC")
if not S then
S = Instance.new("BodyVelocity",child:WaitForChild("Character"):WaitForChild("Torso"))
S.MaxForce = Vector3.new(0,0,0)
S.Velocity = Vector3.new(0,0,0)
S.Name = "svFgyuzxC"
end
end
end)
local PlayerLeft = game:GetService("Players").PlayerRemoving:connect(function(player)
for i,child in pairs(TPlayers) do
if child == player then
table.remove(TPlayers,i)
end
end
end)
local function StuntJumpUntil(humanoid)
local duration = humanoid.JumpPower
local root = humanoid.Parent:FindFirstChild("HumanoidRootPart")
local RooT = nil
local Jd = humanoid:FindFirstChild("JumpedValue")
if not Jd then error("Jump Value was not found.") end
Jd.Value = true
humanoid.Jump = false
if root then
RooT = root
elseif not root then
root = humanoid.Parent:FindFirstChild("Torso")
if root then
RooT = root
end
end
local NUM = 0
--[[repeat
wait()
print(NUM, duration, humanoid.Parent)
NUM = NUM+.05
if RooT then
Jd.Value = true
RooT.Velocity = Vector3.new(0, .05, 0)
end
until NUM >= duration or humanoid.Health < .1--]]
local S = humanoid.Parent:WaitForChild("Torso"):FindFirstChild("svFgyuzxC")
if not S then error("Could not find bodyvelocity.") S = Instance.new("BodyVelocity", humanoid.Parent:WaitForChild("Torso")) S.MaxForce = Vector3.new(0,0,0) S.Velocity = Vector3.new(0,0,0) end
S.MaxForce = Vector3.new(0, math.huge, 0)
S.Velocity = Vector3.new(0, -.1, 0)
wait(duration)
S.MaxForce = Vector3.new(0, 0, 0)
Jd.Value = false
end
local TimeC = runServ:connect(function()
game.Lighting.Brightness = 0
game.Lighting.OutdoorAmbient = TBlast.BrickColor.Color
game.Lighting.TimeOfDay = 4
game.Lighting.FogEnd = 1000
game.Lighting.FogColor = TBlast.BrickColor.Color
for i, P in pairs(TPlayers) do
if P then
local cHar = P:WaitForChild("Character")
local hUm = FindHum(cHar)
local Jd = hUm:FindFirstChild("JumpedValue")
if not Jd then error("Jump Value was not found.") end
local S = cHar:WaitForChild("Torso"):FindFirstChild("svFgyuzxC")
if not S then error("Could not find bodyvelocity.") S = Instance.new("BodyVelocity", cHar:WaitForChild("Torso")) S.MaxForce = Vector3.new(0,0,0) S.Velocity = Vector3.new(0,0,0) end
if hUm.WalkSpeed > .8 then
hUm.WalkSpeed = .8
elseif hUm.WalkSpeed == 0 then
end
if hUm:GetState() == Enum.HumanoidStateType.Jumping and not Jd.Value then
StuntJumpUntil(hUm)
end
if hUm:GetState() == Enum.HumanoidStateType.Freefall and not Jd.Value then
S.MaxForce = Vector3.new(0, math.huge, 0)
S.Velocity = Vector3.new(0, -.1, 0)
elseif hUm:GetState() == Enum.HumanoidStateType.RunningNoPhysics and not Jd.Value then
S.MaxForce = Vector3.new(0,0,0)
end
end
end
for i, H in pairs(THumanoids) do
if H then
local cHar = H.Parent
local Jd = H:FindFirstChild("JumpedValue")
if not Jd then error("Jump Value was not found.") end
local S = cHar:WaitForChild("Torso"):FindFirstChild("svFgyuzxC")
if not S then error("Could not find bodyvelocity.") S = Instance.new("BodyVelocity", cHar:WaitForChild("Torso")) S.MaxForce = Vector3.new(0,0,0) S.Velocity = Vector3.new(0,0,0) end
if H.WalkSpeed > .8 then
H.WalkSpeed = .8
elseif H.WalkSpeed == 0 then
end
if H:GetState() == Enum.HumanoidStateType.Jumping and not Jd.Value then
StuntJumpUntil(H)
end
if H.Health < .1 then
table.remove(THumanoids, i)
wait(5)
ClearTHumanoids()
GetOtherHumanoids()
end
if H:GetState() == Enum.HumanoidStateType.Freefall and not Jd.Value then
S.MaxForce = Vector3.new(0, math.huge, 0)
S.Velocity = Vector3.new(0, -.1, 0)
elseif H:GetState() == Enum.HumanoidStateType.RunningNoPhysics and not Jd.Value then
S.MaxForce = Vector3.new(0,0,0)
end
end
end
end)
repeat wait() until not TCtrl or Humanoid.Health < .01
TimeC:disconnect()
chatServ:Chat(Head, "Time release.", 2)
game.Lighting.Brightness = RecentBrightness
game.Lighting.OutdoorAmbient = RecentOutDoorAmbient
game.Lighting.TimeOfDay = RecentTimeOfDay
game.Lighting.FogEnd = RecentFogEnd
game.Lighting.FogColor = RecentFogColor
wait(.1)
ClearTHumanoids()
ClearTPlayers()
end
function FindHum(parent)
local hm = nil
for _, HM in pairs(parent:GetChildren()) do
if HM:IsA("Humanoid") then
hm = HM
end
end
return hm
end
function MagniDamage(Part,magni,mindam,maxdam,knock,Type)
for _,c in pairs(workspace:children()) do
local hum=FindHum(c)
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,mindam,maxdam,knock,Type,Part,.2,1,nil,1)
end
end
end
end
end
function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants
return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
end
local Point=Torso.CFrame*cf(0,Torso.Size.Y,0)
LastPoint=Point
function effect(Color,Ref,LP,P1,returnn)
local effectsmsh=Instance.new("CylinderMesh")
effectsmsh.Scale=Vector3.new(0.2,1,0.2)
effectsmsh.Name="Mesh"
local effectsg=Instance.new("Part")
effectsg.formFactor=3
effectsg.CanCollide=false
effectsg.Name="Eff"
effectsg.Locked=true
effectsg.Anchored=true
effectsg.Size=Vector3.new(0.5,1,0.5)
effectsg.Parent=F2
effectsmsh.Parent=effectsg
effectsg.BrickColor=BrickColor.new(Color)
effectsg.Reflectance=Ref
local point1=P1
local mg=(LP.p - point1.p).magnitude
effectsg.Size=Vector3.new(0.5,mg,0.5)
effectsg.CFrame=cf((LP.p+point1.p)/2,point1.p) * CFrame.Angles(math.rad(90),0,0)
effectsmsh.Scale=Vector3.new(0.2,1,0.2)
game:GetService("Debris"):AddItem(effectsg,2)
if returnn then return effectsg end
coroutine.resume(coroutine.create(function(Part,Mesh)
if not returnn then
for i=0,1,0.05 do
wait()
Part.Transparency=1*i
Mesh.Scale=Vector3.new(0.5-0.5*i,1,0.5-0.5*i)
end
Part.Parent=nil
end
end),effectsg,effectsmsh)
end
local function CFrameFromTopBack(at, top, back)
local right = top:Cross(back)
return CFrame.new(at.x, at.y, at.z,
right.x, top.x, back.x,
right.y, top.y, back.y,
right.z, top.z, back.z)
end
F1 = Instance.new("Folder", Character)
F1.Name = "Effects Folder"
F2 = Instance.new("Folder", F1)
F2.Name = "Effects"
function Triangle(a, b, c)
--[[local edg1 = (c-a):Dot((b-a).unit)
local edg2 = (a-b):Dot((c-b).unit)
local edg3 = (b-c):Dot((a-c).unit)
if edg1 <= (b-a).magnitude and edg1 >= 0 then
a, b, c = a, b, c
elseif edg2 <= (c-b).magnitude and edg2 >= 0 then
a, b, c = b, c, a
elseif edg3 <= (a-c).magnitude and edg3 >= 0 then
a, b, c = c, a, b
else
assert(false, "unreachable")
end
local len1 = (c-a):Dot((b-a).unit)
local len2 = (b-a).magnitude - len1
local width = (a + (b-a).unit*len1 - c).magnitude
local maincf = CFrameFromTopBack(a, (b-a):Cross(c-b).unit, -(b-a).unit)
local list = {}
if len1 > 0.01 then
local w1 = Instance.new('WedgePart', workspace)
w1.FormFactor = 'Custom'
w1.Material = "Neon"
if Mode=="Binary" then
w1.BrickColor = BrickColor.new("White")
else
w1.BrickColor = BrickColor.new("Dark indigo")
end
w1.Transparency = 0
w1.Reflectance = 0
w1.CanCollide = false
NoOutline(w1)
local sz = Vector3.new(0.2, width, len1)
w1.Size = sz
local sp = Instance.new("SpecialMesh",w1)
sp.MeshType = "Wedge"
sp.Scale = Vector3.new(0,1,1) * sz/w1.Size
w1:BreakJoints()
w1.Anchored = true
w1.Transparency = 0.7
game:GetService("Debris"):AddItem(w1,25)
table.insert(Effects,{w1,"Disappear",.01})
w1.CFrame = maincf*CFrame.Angles(math.pi,0,math.pi/2)*CFrame.new(0,width/2,len1/2)
table.insert(list,w1)
end
if len2 > 0.01 then
local w2 = Instance.new('WedgePart', workspace)
w2.Material = "Neon"
w2.FormFactor = 'Custom'
if Mode=="Binary" then
w2.BrickColor = BrickColor.new("White")
else
w2.BrickColor = BrickColor.new("Dark indigo")
end
w2.Transparency = 0
w2.Reflectance = 0
w2.CanCollide = false
NoOutline(w2)
local sz = Vector3.new(0.2, width, len2)
w2.Size = sz
local sp = Instance.new("SpecialMesh",w2)
sp.MeshType = "Wedge"
sp.Scale = Vector3.new(0,1,1) * sz/w2.Size
w2:BreakJoints()
w2.Anchored = true
w2.Transparency = 0.7
game:GetService("Debris"):AddItem(w2,25)
table.insert(Effects,{w2,"Disappear",.01})
w2.CFrame = maincf*CFrame.Angles(math.pi,math.pi,-math.pi/2)*CFrame.new(0,width/2,-len1 - len2/2)
table.insert(list,w2)
end
return unpack(list)--]]
end
--[[
Things for effects
put the variables in one table
like effect={brick,interval,i}
]]
function MagicBlock(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,F2,0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
table.insert(Effects,{prt,"Block1",delay,x3,y3,z3}) --part, type, delay
--[[coroutine.resume(coroutine.create(function(Part,Mesh,dur)
for i=0,1,delay do
wait()
Part.CFrame=Part.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)]]
end
function MagicCircle(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,F2,0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
local msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
--[[coroutine.resume(coroutine.create(function(Part,Mesh)
local wld=nil
for i=0,1,delay do
wait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)]]
end
function MagicWave(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,F2,0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
local msh=mesh("SpecialMesh",prt,"FileMesh","http://www.roblox.com/asset/?id=20329976",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
end
function MagicCylinder(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,F2,0,0,brickcolor,"Effect",vt(0.2,0.2,0.2))
prt.Anchored=true
prt.CFrame=cframe
msh=mesh("SpecialMesh",prt,"Head","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
--table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
Effects[#Effects+1]={prt,"Cylinder",delay,x3,y3,z3} --part, type, delay
--[[coroutine.resume(coroutine.create(function(Part,Mesh)
for i=0,1,delay do
wait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)]]
end
function MagicCylinder2(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,F2,0,0,brickcolor,"Effect",vt(0.2,0.2,0.2))
prt.Anchored=true
prt.CFrame=cframe
msh=mesh("CylinderMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
--table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
Effects[#Effects+1]={prt,"Cylinder",delay,x3,y3,z3} --part, type, delay
--[[coroutine.resume(coroutine.create(function(Part,Mesh)
for i=0,1,delay do
wait()
Part.CFrame=Part.CFrame
Part.Transparency=i
Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
end
Part.Parent=nil
end),prt,msh)]]
end
function MagicBlood(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
local prt=part(3,F2,0,0,brickcolor,"Effect",vt())
prt.Anchored=true
prt.CFrame=cframe
local msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1))
game:GetService("Debris"):AddItem(prt,5)
table.insert(Effects,{prt,"Blood",delay,x3,y3,z3})
end
function ElecEffect(cff,x,y,z)
local prt=part(3,F2,0,0,BrickColor.new("Dark indigo"),"Part",vt(1,1,1))
prt.Anchored=true
prt.CFrame=cff*cf(math.random(-x,x),math.random(-y,y),math.random(-z,z))
prt.CFrame=cf(prt.Position)
--prt.CFrame=cf(cff)*cf(math.random(-x,x),math.random(-y,y),math.random(-z,z))
game:GetService("Debris"):AddItem(prt,2)
xval=math.random()/2
yval=math.random()/2
zval=math.random()/2
msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(xval,yval,zval))
Effects[#Effects+1]={prt,"Elec",0.1,x,y,z,xval,yval,zval} --part, type, delay
end
function Lightning(p0,p1,tym,ofs,col,th,tra,last)
--[[p0=pos1
p1=pos2
tym=times
ofs=offset
col=color
th=size
tra=transparency
last=lastingtime]]
local magz = (p0 - p1).magnitude local curpos = p0 local trz = {-ofs,ofs}
for i=1,tym do
local li = Instance.new("Part",F2) li.TopSurface =0 li.BottomSurface = 0 li.Anchored = true li.Transparency = tra or 0.4 li.BrickColor = BrickColor.new(col)
li.Material = "Neon"
li.formFactor = "Custom" li.CanCollide = false li.Size = Vector3.new(th,th,magz/tym) local ofz = Vector3.new(trz[math.random(1,2)],trz[math.random(1,2)],trz[math.random(1,2)])
local trolpos = CFrame.new(curpos,p1)*CFrame.new(0,0,magz/tym).p+ofz
if tym == i then
local magz2 = (curpos - p1).magnitude li.Size = Vector3.new(th,th,magz2)
li.CFrame = CFrame.new(curpos,p1)*CFrame.new(0,0,-magz2/2)
else
li.CFrame = CFrame.new(curpos,trolpos)*CFrame.new(0,0,magz/tym/2)
end
curpos = li.CFrame*CFrame.new(0,0,magz/tym/2).p game:GetService("Debris"):AddItem(li,last)
end
end
local DragTable = {}
function Bringer()
for i, d in pairs(DragTable) do
if d then
if d:IsA("BodyPosition") then
local tem = d:FindFirstChild("Time")
if not tem then
tem = Instance.new("NumberValue")
tem.Parent = d
tem.Name = "Time"
tem.Value = 0
end
if tem.Value < 1.5 then
tem.Value = tem.Value+.1
d.Position = RootPart.Position
else
game:GetService("Debris"):AddItem(tem, 0)
game:GetService("Debris"):AddItem(d, 0)
table.remove(DragTable, i)
end
end
end
end
end
runServ:connect(function()
Bringer()
end)
Damagefunc=function(hit,minim,maxim,knockback,Type,Property,Duration,KnockbackType,decreaseblock)
if hit.Parent==nil then
return
end
local H = nil
h=hit.Parent:FindFirstChild("Humanoid")
for _,v in pairs(hit.Parent:children()) do
if v:IsA("Humanoid") then
h=v
H = v
end
end
if hit.Parent.Parent:FindFirstChild("Torso")~=nil then
h=hit.Parent.Parent:FindFirstChild("Humanoid")
end
if hit.Parent.className=="Hat" then
hit=hit.Parent.Parent:findFirstChild("Head")
end
-- and hit.Parent~=CannonTarget.Parent or hit.Parent~=RailgunTarget.Parent
if h~=nil and hit.Parent.Name~=Character.Name and hit.Parent:FindFirstChild("Torso")~=nil then
if hit.Parent:findFirstChild("DebounceHit")~=nil then if hit.Parent.DebounceHit.Value==true then return end end
--[[if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then
return
end]]
--hs(hit,1.2)
so("http://www.roblox.com/asset/?id=10209590",hit,1,math.random(50,100)/100)
--so("rbxasset://sounds\\unsheath.wav",hit,1,math.random(200,250)/100)
c=Instance.new("ObjectValue")
c.Name="creator"
c.Value=game:service("Players").LocalPlayer
c.Parent=h
game:GetService("Debris"):AddItem(c,.5)
Damage=math.random(minim,maxim)
if Mode=="Demon" then
Damage=Damage*damagebonus
end
-- h:TakeDamage(Damage)
blocked=false
block=hit.Parent:findFirstChild("Block")
if block~=nil then
print(block.className)
if block.className=="NumberValue" then
if block.Value>0 then
blocked=true
if decreaseblock==nil then
block.Value=block.Value-1
end
end
end
if block.className=="IntValue" then
if block.Value>0 then
blocked=true
if decreaseblock~=nil then
block.Value=block.Value-1
end
end
end
end
if blocked==false then
--h:TakeDamage(Damage)
--H.Health=H.Health-Damage
showDamage(hit.Parent,Damage,.5,BrickColor:Red())
else
--H.Health=H.Health-(Damage/2)
showDamage(hit.Parent,Damage/2,.5,BrickColor.new("Bright blue"))
end
if Type=="Knockdown" then
hum=hit.Parent.Humanoid
hum.PlatformStand=true
hum:ChangeState(Enum.HumanoidStateType.FallingDown)
local tor = hum.Parent:FindFirstChild("Torso")
if tor then
tor.Velocity = tor.CFrame.lookVector*-10
end
coroutine.resume(coroutine.create(function(HHumanoid)
swait(1)
HHumanoid.PlatformStand=false
end),hum)
--hit.CFrame=cf(hit.Position,Vector3.new(angle.x,hit.Position.y,angle.z))*CFrame.fromEulerAnglesXYZ(math.pi/4,0,0)
elseif Type=="Breaker" then
hum=hit.Parent.Humanoid
hum.PlatformStand=true
hum:ChangeState(Enum.HumanoidStateType.FallingDown)
hum.JumpPower = 20
local tor = hum.Parent:FindFirstChild("Torso")
if tor then
tor.Velocity = tor.CFrame.lookVector*-50
end
coroutine.resume(coroutine.create(function(HHumanoid)
swait(1)
HHumanoid.PlatformStand=false
end),hum)
--hit.CFrame=cf(hit.Position,Vector3.new(angle.x,hit.Position.y,angle.z))*CFrame.fromEulerAnglesXYZ(math.pi/4,0,0)
if H.MaxHealth > 100000000 then
H.MaxHealth = 100
wait()
end
elseif Type=="Normal" then
vp=Instance.new("BodyVelocity")
vp.P=500
vp.maxForce=Vector3.new(math.huge,0,math.huge)
-- vp.velocity=Character.Torso.CFrame.lookVector*Knockback
if KnockbackType==1 then
vp.velocity=Property.CFrame.lookVector*knockback+Property.Velocity/100
elseif KnockbackType==2 then
vp.velocity=Property.CFrame.lookVector*knockback
end
if knockback>-100 then
vp.Parent=hit.Parent.Torso
end
game:GetService("Debris"):AddItem(vp,.5)
elseif Type=="Lifesteal" then
for i=1,5 do
--MagicBlood(BrickColor.new("Really red"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
end
vp=Instance.new("BodyVelocity")
vp.P=500
vp.maxForce=Vector3.new(math.huge,0,math.huge)
if KnockbackType==1 then
vp.velocity=Property.CFrame.lookVector*knockback+Property.Velocity/250
elseif KnockbackType==2 then
vp.velocity=Property.CFrame.lookVector*knockback
end
if knockback>-250 then
vp.Parent=hit.Parent.Torso
end
H:ChangeState(Enum.HumanoidStateType.FallingDown)
game:GetService("Debris"):AddItem(vp,.5)
Heal=math.ceil(Damage/3)
Humanoid.Health=Humanoid.Health+Heal
showDamage(RootPart,Heal,.5,BrickColor.new("Bright green"))
elseif Type == "DevilStyle" then
for i=1,5 do
--MagicBlood(BrickColor.new("Dark indigo"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
end
vp=Instance.new("BodyPosition")
vp.P = 80000
vp.maxForce=Vector3.new(math.huge,math.huge,math.huge)
if KnockbackType==1 then
vp.Position=RootPart.Position
elseif KnockbackType==2 then
vp.Position=RootPart.Position
end
if H.MaxHealth > 100000000 then
H.MaxHealth = 100
wait()
end
H:ChangeState(Enum.HumanoidStateType.FallingDown)
vp.Parent=hit.Parent.Torso
table.insert(DragTable, vp)
Heal=math.ceil(Damage/5)
Humanoid.Health=Humanoid.Health+Heal
showDamage(RootPart,Heal,.5,BrickColor.new("Bright green"))
elseif Type == "Dragger" then
for i=1,5 do
--MagicBlood(BrickColor.new("Really red"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
end
vp=Instance.new("BodyPosition")
vp.P = 80000
vp.maxForce=Vector3.new(math.huge,math.huge,math.huge)
H:ChangeState(Enum.HumanoidStateType.FallingDown)
if KnockbackType==1 then
vp.Position=RootPart.Position
elseif KnockbackType==2 then
vp.Position=RootPart.Position
end
vp.Parent=hit.Parent.Torso
table.insert(DragTable, vp)
elseif Type=="Up" then
hit.Velocity = Vector3.new(0, 100, 0)
H:ChangeState(Enum.HumanoidStateType.FallingDown)
elseif Type=="Snare" then
bp=Instance.new("BodyPosition")
bp.P=2000
bp.D=100
bp.maxForce=Vector3.new(math.huge,math.huge,math.huge)
bp.position=hit.Parent.Torso.Position
bp.Parent=hit.Parent.Torso
game:GetService("Debris"):AddItem(bp,1)
elseif Type=="Charge" then
Charge=Charge+1
coroutine.resume(coroutine.create(function(Part)
swait(30)
for i=1,5 do
swait(5)
so("rbxasset://sounds\\unsheath.wav",hit,1,2)
--MagicCircle(BrickColor.new("Bright red"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.2,2,.1,.2,8,.1,0.05)
newdam=math.random(1,5)
if blocked==false then
H.Health = H.Health-newdam
showDamage(hit.Parent,newdam,.5,BrickColor:Red())
else
H.Health = H.Health-newdam/2
showDamage(hit.Parent,newdam,.5,BrickColor.new("Bright blue"))
end
end
end),hit)
end
local debounceD=Instance.new("BoolValue")
debounceD.Name="DebounceHit"
debounceD.Parent=hit.Parent
debounceD.Value=true
if Duration < .2 then
Duration = .2
end
game:GetService("Debris"):AddItem(debounceD,Duration)
local c=Instance.new("ObjectValue")
c.Name="creator"
c.Value=Player
c.Parent=h
game:GetService("Debris"):AddItem(c,Duration)
H.Health=H.Health-Damage
CRIT=false
hitDeb=true
AttackPos=6
end
end
showDamage=function(Char,Dealt,du,Color)
--[[c=Instance.new("Part")
c.Transparency=0
c.BrickColor=Color
c.Material = "Neon"
c.Name="DamageDisplay"
c.TopSurface=0
c.BottomSurface=0
c.formFactor="Plate"
c.Size=Vector3.new(1,.4,1)
ms=Instance.new("CylinderMesh")
ms.Scale=Vector3.new(.8,.8,.8)
local bill = Instance.new("BillboardGui")
bill.Parent = c
bill.AlwaysOnTop = true
bill.Name = "YEA"
bill.Size = UDim2.new(4, 0, 4, 0)
bill.StudsOffset = Vector3.new(0, 1, 0)
local textl = Instance.new("TextLabel")
textl.Parent = bill
textl.Name = "WHYYYYYYYY"
textl.BackgroundTransparency = 1
textl.Size = UDim2.new(1, 0, 1, 0)
textl.Font = "SourceSansLight"
textl.Text = "-"..Dealt..""
textl.TextColor3 = Color3.new(40/255, 0,60/255)
textl.TextScaled = true
textl.TextStrokeColor3 = Color3.new(139/255, 0, 209/255)
textl.TextStrokeTransparency = 0
if CRIT==true then
ms.Scale=Vector3.new(1,1.25,1)
end
ms.Parent=c
c.Reflectance=0
Instance.new("BodyGyro").Parent=c
c.Parent=F2
if Char:findFirstChild("Head")~=nil then
c.CFrame=cf(Char["Head"].CFrame.p+Vector3.new(0,1.5,0))
elseif Char.Parent:findFirstChild("Head")~=nil then
c.CFrame=cf(Char.Parent["Head"].CFrame.p+Vector3.new(0,1.5,0))
end
local f=Instance.new("BodyPosition")
f.P=2000
f.D=100
f.maxForce=Vector3.new(math.huge,math.huge,math.huge)
f.position=c.Position+Vector3.new(0,3,0)
f.Parent=c
game:GetService("Debris"):AddItem(c,0)
c.CanCollide=false
c.CanCollide=false--]]
end
combo=0
function ob1d(mouse)
hold=true
if attack==true or equipped==false then return end
if Mode=="Binary" then
idle=0
if Anim=="Run" then
SpinSlash()
else
if combo==0 then
combo=1
attackone()
elseif combo==1 then
combo=2
attacktwo()
elseif combo==2 then
combo=0
attackthree()
end
end
else
if combo==0 then
combo=1
Demonattackone()
elseif combo==1 then
combo=2
Demonattacktwo()
elseif combo==2 then
combo=0
Demonattackthree()
end
end
coroutine.resume(coroutine.create(function()
for i=1,20 do
if attack==false then
swait()
end
end
if attack==false then
combo=0
--equipanim()
end
end))
end
function ob1u(mouse)
hold = false
end
buttonhold = false
eul=0
holdx=false
equipped=false
local nostop = false
function FireBullet(Shooter, Velocity, MinDam, MaxDam, SIZe)
local Bullet = Instance.new("Part", F2)
Bullet.BrickColor = BrickColor.new("Dark indigo")
Bullet.Material = "Neon"
Bullet.Transparency = .5
Bullet.CanCollide = false
Bullet.Name = "Bullet"
Bullet.Anchored = false
Bullet.Locked = true
Bullet.Size = SIZe
Bullet.Shape = "Ball"
Bullet.CFrame = Shooter.CFrame
local BVel = Instance.new("BodyVelocity",Bullet)
BVel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BVel.Velocity = Shooter.CFrame.lookVector*Velocity
local bill = Instance.new("BillboardGui")
bill.Parent = Shooter
bill.Name = "pew"
bill.Size = UDim2.new(1.6, 0, 1.6, 0)
local IL = Instance.new("ImageLabel")
IL.Parent = bill
IL.Name = "Flash"
IL.BackgroundTransparency = 1
IL.Size = UDim2.new(1, 0, 1, 0)
IL.Image = "rbxasset://textures/particles/sparkles_main.dds"
IL.ImageColor3 = Color3.new(170/255, 0, 1)
local Flash = Instance.new("PointLight", Shooter)
Flash.Brightness = 100
Flash.Color = IL.ImageColor3
Flash.Range = 10
Flash.Shadows = true
so("http://roblox.com/asset/?id=200633327",Shooter,1,.7)
game:GetService("Debris"):AddItem(Bullet, 10)
game:GetService("Debris"):AddItem(bill, .1)
game:GetService("Debris"):AddItem(Flash, .1)
local function BoomEffect(Cframe)
local Boo = Instance.new("Part", F2)
Boo.BrickColor = BrickColor.new("Dark indigo")
Boo.Transparency = .5
Boo.Material = "Neon"
Boo.Anchored = true
Boo.CanCollide = false
Boo.CFrame = Cframe
game:GetService("Debris"):AddItem(Bullet, 0)
Boo.Size = Vector3.new(Bullet.Size.X*10,Bullet.Size.X*10,Bullet.Size.X*10)
MagniDamage(Boo,(Bullet.Size.X*10)*2,MinDam+5,MaxDam+5,1,"Breaker")
so("http://roblox.com/asset/?id=206082273",Shooter,.5,1)
local BooM = Instance.new("SpecialMesh", Boo)
BooM.MeshType = "Sphere"
for i = .5, 2, .3 do
wait()
BooM.Scale = Vector3.new(i*2,i*2,i*2)
Boo.Transparency = i/2
end
game:GetService("Debris"):AddItem(Boo, 0)
end
local HitSomething = false
Bullet.Touched:connect(function(part)
local HUM = FindHum(part.Parent)
if HUM and HUM ~= Humanoid and not HitSomething then
local Tor = part.Parent:FindFirstChild("Torso")
if Tor then
HitSomething = true
Damagefunc(Tor,MinDam/2,MaxDam/2,10,"Breaker",RootPart,.2,.5,1)
BoomEffect(Bullet.CFrame)
end
end
if not HUM and not HitSomething then
if part.Anchored == true and part.Name ~= "Effect" and part.Name ~= "Handle" then
BoomEffect(Bullet.CFrame)
end
end
end)
end
local StopLaser = false
function FireLaser(Shooter, Duration, Range, Size, minDam, maxDam, BuildUp, FirstMes, LastMes, message)
local BeamStart = Instance.new("Part", F2)
BeamStart.BrickColor = BrickColor.new("Dark indigo")
BeamStart.Material = "Neon"
BeamStart.Transparency = 0
BeamStart.Name = "BeamStart"
BeamStart.Anchored = false
BeamStart.CanCollide = false
BeamStart.Locked = true
BeamStart.Size = Size
BeamStart.CFrame = Shooter.CFrame
local BSMesh = Instance.new("SpecialMesh", BeamStart)
BSMesh.MeshType = "Sphere"
local BSWeld = Instance.new("Weld", BeamStart)
BSWeld.Part0 = Shooter
BSWeld.Part1 = BeamStart
BSWeld.C0 = CFrame.new(0,0,-(Size.Z/2))
if message then
chatServ:Chat(Head, FirstMes, 2)
end
if BuildUp > .008 then
BSMesh.Scale = Vector3.new(0,0,0)
local BeamCharge = Instance.new("Sound", BeamStart)
BeamCharge.Volume = 1
BeamCharge.SoundId = "http://roblox.com/asset/?id=244578827"
BeamCharge.Pitch = 0.8
BeamCharge:Play()
for i = 0, BuildUp, .008 do
wait()
BSMesh.Scale = Vector3.new(i/BuildUp,i/BuildUp,i/BuildUp)
BSWeld.C0 = CFrame.new(0,0,-((i*(Size.Z/2))/BuildUp))
BeamStart.Transparency = ((-BuildUp+i)*-1)
MagicBlood(BrickColor.new("Dark indigo"),Shooter.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.1,.1,.1,.1,2,.1,0.05)
end
BeamCharge:Pause()
game:GetService("Debris"):AddItem(BeamCharge, 0)
end
if message then
chatServ:Chat(Head, LastMes, 2)
end
local Beam = Instance.new("Part", F2)
Beam.BrickColor = BrickColor.new("Dark indigo")
Beam.Material = "Neon"
Beam.Name = "Beam"
Beam.Transparency = 0
Beam.Anchored = true
Beam.CanCollide = false
Beam.Locked = true
local BeamMesh = Instance.new("SpecialMesh", Beam)
BeamMesh.MeshType = "Cylinder"
local BeamEnd = Instance.new("Part", F2)
BeamEnd.BrickColor = BrickColor.new("Dark indigo")
BeamEnd.Material = "Neon"
BeamEnd.Transparency = 0
BeamEnd.Name = "BeamEnd"
BeamEnd.Anchored = true
BeamEnd.CanCollide = false
BeamEnd.Locked = true
BeamEnd.Size = Vector3.new(Size.X, Size.X, Size.X)
local BEMesh = Instance.new("SpecialMesh", BeamEnd)
BEMesh.MeshType = "Sphere"
local BeamFire = Instance.new("Sound", Beam)
BeamFire.Volume = 1
BeamFire.PlayOnRemove = true
BeamFire.SoundId = "http://roblox.com/asset/?id=376107717"
BeamFire.Pitch = 1
BeamFire:Destroy()
game:GetService("Debris"):AddItem(BeamFire, 5)
local BeamSound = Instance.new("Sound", Beam)
BeamSound.Volume = 1
BeamSound.Looped = true
BeamSound.SoundId = "http://roblox.com/asset/?id=254847708"
BeamSound.Pitch = 1
BeamSound:Play()
local TEM = 0
local run = runServ:connect(function()
local Hit, Pos = rayCast(BeamStart.Position, BeamStart.CFrame.lookVector, 999, Character)
Beam.Size = Vector3.new((BeamStart.CFrame.p - Pos).magnitude,Size.X,Size.X)
Beam.CFrame = CFrame.new((BeamStart.CFrame.p + Pos)/2,BeamStart.CFrame.p)*CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
BeamEnd.CFrame = CFrame.new(Pos)
if Hit then
if Beam.Transparency == 0 then
MagicBlock(BrickColor.new("Dark indigo"),BeamEnd.CFrame*cf(math.random(-200,200)/100,-math.random(0,1)/100,math.random(-200,200)/100),math.random(30,80)/100,math.random(30,80)/100,math.random(30,80)/100,Size.X*2,Size.X*2,Size.X*2,0.05)
end
end
end)
local run2 = runServ:connect(function()
MagniDamage(BeamEnd,Range,minDam,maxDam,1,"Breaker")
MagniDamage(Beam,Range,minDam*4,maxDam*4,1,"LifeSteal")
end)
repeat TEM = TEM+.1 wait() until TEM > Duration-1 or StopLaser
StopLaser = false
so("http://roblox.com/asset/?id=161006163",Shooter,1,.4)
BeamSound:Pause()
game:GetService("Debris"):AddItem(BeamSound, 0)
for i = 0, 1, .04 do
wait()
BeamStart.Transparency = i
Beam.Transparency = i
BeamEnd.Transparency = i
BSMesh.Scale = Vector3.new((-1+i)*-1,(-1+i)*-1,1)
BeamMesh.Scale = Vector3.new(1,(-1+i)*-1,(-1+i)*-1)
BEMesh.Scale = Vector3.new((-1+i)*-1,(-1+i)*-1,1)
end
run:disconnect()
run2:disconnect()
game:GetService("Debris"):AddItem(BeamStart, 0)
game:GetService("Debris"):AddItem(Beam, 0)
game:GetService("Debris"):AddItem(BeamEnd, 0)
end
local CanLaser = true
local Hover = false
local CMHP = false
local MadePlatform = false
local HovLaser = false
function CreateGround()
local G1 = Instance.new("Part", workspace)
local G2 = Instance.new("Part", workspace)
G1.BrickColor = BrickColor.new("Earth green")
G2.BrickColor = BrickColor.new("Pine Cone")
G1.Material, G2.Material = "Grass", "Grass"
G1.Name, G2.Name = "GrassBaseplate", "DirtBaseplate"
G1.Anchored, G2.Anchored = true, true
G1.Locked, G2.Locked = true, true
G1.Size, G2.Size = Vector3.new(2048, 10, 2048), Vector3.new(2048, 100, 2048)
G1.CFrame = RootPart.CFrame*CFrame.new(0,-3-(G1.Size.Y/2), 0)
G2.CFrame = G1.CFrame*CFrame.new(0,-5-(G2.Size.Y/2), 0)
return G1, G2
end
function CreateMiniPlatforms()
if not CMHP then
CMHP = true
local Plat = Instance.new("Part", workspace)
Plat.BrickColor = BrickColor.new("Dark indigo")
Plat.Transparency = .8
Plat.Name = "Platform"
Plat.Material = "Neon"
Plat.Anchored = true
Plat.CanCollide = true
Plat.Locked = true
Plat.Size = Vector3.new(10, 10, 1)
Plat.CFrame = (RootPart.CFrame * CFrame.new(0, -4, 0)) * CFrame.fromEulerAnglesXYZ(math.rad(-90),0,0)
local PMesh = Instance.new("SpecialMesh", Plat)
PMesh.MeshType = "Sphere"
local function gh()
if HovLaser then
FireLaser(Plat, 0, 8, Vector3.new(3.6,3.6,6.8), 100, 300, 0, _, _, false)
end
end
delay(.1,gh)
CMHP = false
for i = .8, 1, .04 do
wait()
Plat.Transparency = i
Plat.Parent = F2
end
game:GetService("Debris"):AddItem(Plat, 0)
end
end
runServ:connect(function()
if Hover and Humanoid.Health > .1 then
CreateMiniPlatforms()
end
end)
Humanoid.Changed:connect(function()
if Humanoid.Health < .1 then
game:GetService("Debris"):AddItem(Grass, 0)
game:GetService("Debris"):AddItem(Dirt, 0)
end
end)
function key(key)
if key == "j" then
Hover = not Hover
end
if key == "l" and Hover and not HovLaser then
HovLaser = true
wait(.001)
HovLaser = false
end
if key == "k" then
if not MadePlatform then
MadePlatform = true
Grass, Dirt = CreateGround()
Hover = false
else
MadePlatform = false
game:GetService("Debris"):AddItem(Grass, 0)
game:GetService("Debris"):AddItem(Dirt, 0)
end
end
if key == "q" and not Firing and DCOn and CanUseCannon then
Firing = true
keyConnect = MMouse.KeyUp:connect(function(key)
if key == "q" and Firing then
Firing = false
end
end)
repeat
wait(.1)
if C == 1 then
C = 2
FireBullet(CHole1, 800, 1, 5, Vector3.new(.5,.5,.5))
elseif C == 2 then
C = 1
FireBullet(CHole2, 800, 1, 5, Vector3.new(.5,.5,.5))
end
until not Firing
keyConnect:disconnect()
end
if key == "p" and not Firing and DCOn and CanUseCannon and Player.UserId == 2828 or key == "p" and not Firing and DCOn and CanUseCannon and Player.UserId == 14349727 then
Firing = true
keyConnect = MMouse.KeyUp:connect(function(key)
if key == "p" and Firing then
StopLaser = true
CanLaser = false
wait(20)
Firing = false
wait(50)
CanLaser = true
keyConnect:disconnect()
end
end)
if C == 1 then
C = 2
FireLaser(CHole1, math.huge, 300, Vector3.new(150.8,150.8,1186), 6000000, 90000000, 10, "You made me do this..", "Planet buster!", true)
elseif C == 2 then
C = 1
FireLaser(CHole2, math.huge, 300, Vector3.new(150.8,150.8,1186), 6000000, 90000000, 10, "You made me do this..", "Planet buster!", true)
end
end
if key == "e" then
if DCOn and CanUseCannon and not Firing then
if C == 1 then
C = 2
FireBullet(CHole1, 50, 60, 90, Vector3.new(.6,.6,.6))
elseif C == 2 then
C = 1
FireBullet(CHole2, 50, 60, 90, Vector3.new(.6,.6,.6))
end
end
end
if key == "r" then
if DCOn and CanUseCannon and not Firing then
if C == 1 then
C = 2
FireBullet(CHole1, 300, 5, 20, Vector3.new(.3,.3,.3))
elseif C == 2 then
C = 1
FireBullet(CHole2, 300, 5, 20, Vector3.new(.3,.3,.3))
end
end
end
if key == "t" then
if DCOn and CanUseCannon and not Firing then
Firing = true
FireBullet(CHole2, 10, 100, 200, Vector3.new(6,6,6))
wait(1.5)
Firing = false
end
end
if key == "y" then
if DCOn and CanUseCannon and not Firing and CanLaser then
Firing = true
FireLaser(CHole1, 25, 10, Vector3.new(4.6,4.6,8.8), 60, 100, 1, "Were you ready for this?..", "Nether Blast!", true)
wait(10)
Firing = false
end
end
if key == "u" then
if DCOn and CanUseCannon and not Firing and CanLaser then
Firing = true
CanLaser = false
FireLaser(CHole2, 10, 40, Vector3.new(20.8,20.8,46), 600000, 9000000, 1.5, "This time, it's over!", "Nether Obliterator!", true)
wait(20)
Firing = false
wait(40)
CanLaser = true
end
end
if key == "h" then
if DCOn and CanUseCannon and not Firing and CanLaser then
if C == 1 then
C = 2
FireLaser(CHole1, .3, 2, Vector3.new(.3,.3,2.5), 5, 20, 0, _, _, false)
elseif C == 2 then
C = 1
FireLaser(CHole2, .3, 2, Vector3.new(.3,.3,2.5), 5, 20, 0, _, _, false)
end
end
end
if key == "g" and DCOn and CanUseCannon and not Firing and CanLaser then
Firing = true
keyConnect = MMouse.KeyUp:connect(function(key)
if key == "g" and DCOn and CanUseCannon and Firing then
Firing = false
StopLaser = true
CanLaser = false
wait(3)
CanLaser = true
keyConnect:disconnect()
end
end)
if C == 1 then
C = 2
FireLaser(CHole1, math.huge, 6, Vector3.new(2,2,4.2), 20, 40, 1, "How about...", "This!?" , true)
elseif C == 2 then
C = 1
FireLaser(CHole2, math.huge, 6, Vector3.new(2,2,4.2), 20, 40, 1, "How about...", "This!?", true)
end
end
if key == "m" then
MomentumCancel = not MomentumCancel
if MomentumCancel then
chatServ:Chat(Head, "Negator: Active", 2)
else
chatServ:Chat(Head, "Negator: Inactive", 2)
end
end
if key == "n" then
if not nostop then
nostop = true
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, false)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.PlatformStanding, false)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Flying, false)
chatServ:Chat(Head, "Stablize Armour! Can't knock me down so easily now, huh?", 2)
else
nostop = false
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, true)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.PlatformStanding, true)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, true)
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Flying, true)
chatServ:Chat(Head, "Armour Break! Maybe I'll go easy..", 2)
end
end
if key=="c" then
if guard==true then
guard=false
else
guard=true
end
end
if key=="x" then
holdx=true
end
if attack==true then return end
if key=="f" then
if equipped==false then
equipped=true
RSH=ch.Torso["Right Shoulder"]
LSH=ch.Torso["Left Shoulder"]
--
RSH.Parent=nil
LSH.Parent=nil
--
RW.Name="Right Shoulder"
RW.Part0=ch.Torso
RW.C0=cf(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
RW.C1=cf(0, 0.5, 0)
RW.Part1=ch["Right Arm"]
RW.Parent=ch.Torso
--
LW.Name="Left Shoulder"
LW.Part0=ch.Torso
LW.C0=cf(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
LW.C1=cf(0, 0.5, 0)
LW.Part1=ch["Left Arm"]
LW.Parent=ch.Torso
--
equipanim()
else
equipped=false
damagebonus = 1
hideanim()
swait(0)
RW.Parent=nil
LW.Parent=nil
RSH.Parent=player.Character.Torso
LSH.Parent=player.Character.Torso
end
end
if equipped==false then return end
if Mode=="Binary" then
if key=="q" then
idle=500
end
if key=="z" and hitfloor~=nil then
BinarySwing()
end
if key=="x" then
BinaryImpulse()
end
if key=="c" then
Bash()
end
if key=="v" then
damagebonus = 50
UnleashTheDemon()
end
end
if Mode=="Demon" then
if key == "z" and not Firing then
if not DCOn then
DemonCannon()
DCOn = true
else
HideDemonCannon()
DCOn = false
end
end
if key=="x" then
LetItBuild()
end
if key=="c" then
YourMoveCreep()
end
if key == "b" then
TCtrl = not TCtrl
if TCtrl then
TimeControl()
end
end
end
if key=="0" then
Humanoid.WalkSpeed=(16*16)
end
end
function key2(key)
if key=="0" then
Humanoid.WalkSpeed=16
end
if key=="x" then
holdx=false
end
end
function s(mouse)
mouse.Button1Down:connect(function() ob1d(mouse) end)
mouse.Button1Up:connect(function() ob1u(mouse) end)
mouse.KeyDown:connect(key)
mouse.KeyUp:connect(key2)
player=Player
ch=Character
--MMouse=mouse
end
function ds(mouse)
end
Bin.Selected:connect(s)
Bin.Deselected:connect(ds)
print("Fixer the Demon Mercenary loaded.")
runServ:connect(function()
if DCOn and CanUseCannon then
local CCF = CFrame.new(CM2.Position, Vector3.new(MMouse.Hit.p.X, MMouse.Hit.p.Y, MMouse.Hit.p.Z))
CPos.Position = CM2.Position
CGyro.CFrame = CCF
CPos.P = 50000
end
end)
local thenum=0
while true do
swait()
if Mode=="Demon" then
if thenum>=5 then
--ElecEffect(prtd7.CFrame,2,4,2)
thenum=0
end
thenum=thenum+1
if Humanoid.Health > Humanoid.MaxHealth/10 then
Humanoid.Health = Humanoid.Health-(Humanoid.Health/1000)
end
for _,c in pairs(Character:children()) do
for _,v in pairs(c:children()) do
if v.className=="BodyGyro" or v.className=="BodyPosition" or v.className=="BodyVelocity" or v.className=="BodyAngularVelocity" then
if v.Name~="FixerVel" and v.Name~="FixerGyro" then
v.Parent=nil
end
end
end
end
end
local torvel=(RootPart.Velocity*Vector3.new(1,0,1)).magnitude
local velderp=RootPart.Velocity.y
hitfloor,posfloor=rayCast(RootPart.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,4,Character)
if equipped==true then
if Anim=="Idle" and attack==false and Mode=="Binary" then
idle=idle+1
else
idle=0
end
if idleanim>=0.3 then
idleanim2=true
elseif idleanim<=0 then
idleanim2=false
end
if idleanim2==false then
if Anim=="Walk" then
idleanim=idleanim+0.005
elseif Anim=="Idle" then
idleanim=idleanim+0.003
end
else
if Anim=="Walk" then
idleanim=idleanim-0.005
elseif Anim=="Idle" then
idleanim=idleanim-0.003
end
end
if RootPart.Velocity.y > 1 and hitfloor==nil then
Anim="Jump"
if attack==false and Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(0.4,0,-0.5)*cf(0,1,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(3,0,-0.2),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-0.5,-1)*euler(-0.5,1.57,0),.2)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(-0.7,-1.57,0),.2)
end
if attack==false and Mode=="Demon" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.8,-0.5,.8)*euler(.1,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-.7,-.1)*euler(0.1,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.3,-.2)*euler(0.4,-1.57,0)*euler(0,0,0),.3)
end
elseif RootPart.Velocity.y < -1 and hitfloor==nil then
Anim="Fall"
if attack==false and Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(0.4,0,-0.5)*cf(0,1,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(2.6,0,-0.2),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.4,0,0),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(0.4,1.57,0),.2)
LH.C0=clerp(LH.C0,cf(-1,-1,0)*euler(-0.2,-1.57,0),.2)
end
if attack==false and Mode=="Demon" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.2,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.2,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.6,0,.5),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.4,0,-1),.3)
RH.C0=clerp(RH.C0,cf(1,-.7,-.1)*euler(-0.1,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.6,-.2)*euler(0.8,-1.57,0)*euler(0,0,0),.3)
end
elseif torvel<1 and hitfloor~=nil then
if Anim=="Fall" then
if velderp<=-120 then
coroutine.resume(coroutine.create(function()
Stomp()
end))
end
end
Anim="Idle"
if idle<=500 then
if attack==false and Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0.5),.3)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,-0.5),.3)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1-(idleanim/4),-0.5+idleanim,-0.7+(idleanim/2)),.3)
LW.C0=clerp(LW.C0,cf(-1+idleanim,0.5-idleanim,-0.5)*euler(1-idleanim,-0.5+idleanim,0.5),.3)
RH.C0=clerp(RH.C0,RHC0,.2)
LH.C0=clerp(LH.C0,LHC0,.2)
end
if attack==false and Mode=="Demon" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5-idleanim)*euler(0.4+(idleanim/2),0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-idleanim/2,0,0.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.4,-0.5,1)*euler(.1+idleanim,0,0),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.2,0,-0.2-idleanim),.3)
RH.C0=clerp(RH.C0,cf(1,-1,-idleanim)*euler(-0.2-(idleanim/2),1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5+idleanim,0)*euler(0.5+(idleanim/2),-1.2,0)*euler(-.2,0,0),.3)
end
else
if attack==false and Mode=="Binary" then
--wld1.C0=clerp(wld1.C0,euler(.2,0,0.1)*cf(0,.8,.3),.1)
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-.3),.1)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.1+(idleanim/2),0,0),.1)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.5)*euler(0.1,0,0),.1)
--RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.7,0,1.5),.1)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,.2),.1)
LW.C0=clerp(LW.C0,cf(-1.2,0.5,-0.3)*euler(1.4,0,.8),.1)
RH.C0=clerp(RH.C0,cf(1,-1,0)*euler(-1.2,1.57,0),.15)
LH.C0=clerp(LH.C0,cf(-1.1,0.4,-0.8)*euler(-0.05,-1.57,0),.15)
end
end
elseif torvel>2 and torvel<22 and hitfloor~=nil then
if Anim=="Fall" then
if velderp<=-120 then
coroutine.resume(coroutine.create(function()
Stomp()
end))
end
end
Anim="Walk"
if attack==false and Mode=="Binary" then
wld1.C0=clerp(wld1.C0,euler(0.4,0,-0.5)*cf(0,1,0),.2)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.2)
RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0.1,0,0),.2)
--RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(-0.1,0,0.2),.2)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(3-idleanim,0,-0.2+(idleanim/2)),.2)
LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.57,-(idleanim/2),1.3-(idleanim/2)),.2)
RH.C0=clerp(RH.C0,RHC0,.3)
LH.C0=clerp(LH.C0,LHC0,.3)
end
if attack==false and Mode=="Demon" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.5)*euler(0.4,0,0),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,0),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.5,-0.5,1.5)*euler(.2,0,.2+idleanim),.3)
LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(idleanim,0,-0.2),.3)
RH.C0=clerp(RH.C0,cf(1,-.5,0)*euler(0.2,1.57,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.5,0)*euler(0.5,-1.57,0)*euler(0,0,0),.3)
end
elseif torvel>=22 and hitfloor~=nil then
if Anim=="Fall" then
if velderp<=-120 then
coroutine.resume(coroutine.create(function()
Stomp()
end))
end
end
Anim="Run"
if attack==false and Mode=="Binary" then
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.3,0,0.5),.4)
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-.5)*euler(0.5,0,-0.5),.4)
wld1.C0=clerp(wld1.C0,euler(1.57,0,0)*cf(0,1,-0.3),.4)
RW.C0=clerp(RW.C0,cf(1,0.5,-0.5)*euler(1.2,-0.8,-0.2),.4)
LW.C0=clerp(LW.C0,cf(-.7,0.5,-0.7)*euler(1.2,-0.5,0.8),.4)
RH.C0=clerp(RH.C0,RHC0*cf(0,0,0)*euler(0.2,0.2,.5),.3)
--LH.C0=clerp(LH.C0,LHC0*cf(.5,0.5,-.2)*euler(-0.5,0.5,-0.7),.3)
LH.C0=clerp(LH.C0,LHC0*cf(.5,0.2,0)*euler(0,.5,0.2),.3)
end
if attack==false and Mode=="Demon" then
RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.8)*euler(0.5,0,-0.4),.3)
Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.2,0,.4),.3)
RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.5,-0.5,1.5)*euler(.2,0,.4),.3)
LW.C0=clerp(LW.C0,cf(0,0.5,-0.5)*euler(1.57,-1.57,0)*euler(1.5,0,0),.3)
RH.C0=clerp(RH.C0,cf(1,-.3,-.5)*euler(-0.2,2,0)*euler(0,0,0),.3)
LH.C0=clerp(LH.C0,cf(-1,-.2,0)*euler(0.5,-1.2,0)*euler(-.2,0,0),.3)
end
end
end
if #Effects>0 then
--table.insert(Effects,{prt,"Block1",delay})
for e=1,#Effects do
if Effects[e]~=nil then
--for j=1,#Effects[e] do
local Thing=Effects[e]
if Thing~=nil then
local Part=Thing[1]
local Mode=Thing[2]
local Delay=Thing[3]
local IncX=Thing[4]
local IncY=Thing[5]
local IncZ=Thing[6]
if Thing[1].Transparency<=1 then
if Thing[2]=="Block1" then
Thing[1].CFrame=Thing[1].CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
Mesh=Thing[1]:FindFirstChild("Mesh")
if not Mesh then
Mesh = Instance.new("BlockMesh")
end
Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Cylinder" then
Mesh=Thing[1]:FindFirstChild("Mesh")
if not Mesh then
Mesh = Instance.new("BlockMesh")
end
Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Blood" then
Mesh=Thing[1]:FindFirstChild("Mesh")
if not Mesh then
Mesh = Instance.new("BlockMesh")
end
Thing[1].CFrame=Thing[1].CFrame*cf(0,.5,0)
Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Elec" then
Mesh=Thing[1]:FindFirstChild("Mesh")
if not Mesh then
Mesh = Instance.new("BlockMesh")
end
Mesh.Scale=Mesh.Scale+vt(Thing[7],Thing[8],Thing[9])
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
elseif Thing[2]=="Disappear" then
Thing[1].Transparency=Thing[1].Transparency+Thing[3]
end
else
Part.Parent=nil
game:GetService("Debris"):AddItem(Part, 0)
table.remove(Effects,e)
end
end
--end
end
end
end
end |
local cfg = require("config").entity.chiyu
local util = require("util")
local hexagon = require("hexagon")
local core = require("core")
local buff = require("buff")
local quiver = {
name = "quiver.fire",
element = "fire",
cost = cfg.quiver.single.cost,
range = cfg.quiver.single.range,
shots = cfg.quiver.single.shots,
single = function(entity, target)
local t = cfg.quiver.single
entity.map:damage(entity, target, t.damage, buff.insert, "burn", t.burn.damage, t.burn.duration)
end,
area = function(entity, area)
local t = cfg.quiver.area
entity.map:damage(entity, area, t.damage)
entity.map:layer_set("fire", entity.team, area, t.set_fire.duration, t.set_fire.damage)
end,
}
local buff_curse = {
name = "buff.chiyu.curse_of_phoenix",
tick = {{
core.priority.post_stat, function(self)
local entity = self.owner
local t = cfg.item.ember
local heat = math.max(0, math.floor(entity.inventory[1].heat - t.dissipate(entity.map:layer_get("air", entity.pos), entity.status.wet, entity.status.down)))
entity.power = math.floor(t.power(entity.power, heat, entity.status.wet))
entity.inventory[1].heat = heat
return true
end
}, {
core.priority.damage, function(self)
local entity = self.owner
local mental, fire = cfg.item.ember.damage(entity.inventory[1].heat)
if mental then
core.damage(entity, {
damage = mental,
element = "mental",
real = true,
})
end
if fire then
core.damage(entity, {
damage = fire,
element = "fire",
real = true,
})
end
return true
end
}}
}
local function ember_damage(entity, ...)
local count, killed = entity.map:damage(entity, ...)
local t = cfg.item.ember
for k, v in pairs(killed) do
local val = math.min(v * t.regenerate.cap, entity.health_cap * t.regenerate.ratio)
core.heal(entity, val)
end
local ember = entity.inventory[1]
ember.heat = ember.heat + count * t.heat_gain.damage + #killed * t.heat_gain.kill
return count
end
local skill_move = util.merge_table({
name = "skill.chiyu.move",
type = "waypoint",
remain = 0,
update = function(self)
local entity = self.owner
self.enable = core.skill_update(self) and not entity.moved
end,
use = function(self, waypoint)
local entity = self.owner
if #waypoint == 0 or #waypoint > self.step then
return false
end
local res = core.move(entity, waypoint)
if res then
entity.moved = true
end
return res
end,
}, cfg.skill.move)
local skill_attack = util.merge_table({
name = "skill.chiyu.attack",
type = "direction",
remain = 0,
update = core.skill_update,
use = function(self, direction)
local entity = self.owner
local target = hexagon.direction(entity.pos, direction)
local res = ember_damage(entity, { target }, self.damage)
if res > 0 then
ember_damage(entity, { target }, self.extra, buff.insert, "burn", self.burn.damage, self.burn.duration)
end
return true
end,
}, cfg.skill.attack)
local skill_charge = util.merge_table({
name = "skill.chiyu.charge",
type = "vector",
remain = 0,
update = core.skill_update,
use = function(self, direction, distance)
local entity = self.owner
if distance < self.range[1] or distance > self.range[2] then
return false
end
local line = hexagon.line(entity.pos, direction, distance)
local res = core.teleport(entity, line[#line])
if res then
ember_damage(entity, line, self.damage, buff.insert, "burn", self.burn.damage, self.burn.duration)
ember_damage(entity, { line[#line - 1] }, self.back, buff.insert, "down", self.back.down_duration)
end
return res
end,
}, cfg.skill.charge)
local skill_ignition = util.merge_table({
name = "skill.chiyu.ignition",
type = "target",
remain = 0,
update = function(self)
local entity = self.owner
self.enable = core.skill_update(self) and (entity.inventory[2].remain == 0)
end,
use = function(self, target)
local entity = self.owner
local dis = hexagon.distance(entity.pos, target, self.range[2])
if not dis or dis < self.range[1] then
return false
end
local seed = {
name = "seed.feather",
element = "fire",
team = entity.team,
power = self.damage or (entity.power * self.ratio),
pos = target,
radius = self.radius,
}
seed = entity.map:contact(seed)
if seed then
local area = hexagon.range(seed.pos, seed.radius)
entity.map:damage(entity, area, {
damage = seed.power,
element = "fire",
}, buff.insert, "burn", self.burn.damage, self.burn.duration)
entity.map:layer_set("fire", entity.team, area, self.set_fire.duration, self.set_fire.damage)
end
local feather = entity.inventory[2]
feather.remain = feather.cooldown
return true
end,
}, cfg.skill.ignition)
local skill_sweep = util.merge_table({
name = "skill.chiyu.sweep",
type = "direction",
remain = 0,
update = core.skill_update,
use = function(self, direction)
local entity = self.owner
local area = hexagon.fan(entity.pos, self.damage.extent, direction + 6 - self.damage.angle, direction + 6 + self.damage.angle)
ember_damage(entity, area, self.damage)
local area = hexagon.fan(entity.pos, self.flame.extent, direction + 6 - self.flame.angle, direction + 6 + self.flame.angle)
ember_damage(entity, area, self.flame, buff.insert, "burn", self.burn.damage, self.burn.duration)
return true
end,
}, cfg.skill.sweep)
local skill_nirvana = util.merge_table({
name = "skill.chiyu.nirvana",
type = "target",
remain = 0,
update = function(self)
local entity = self.owner
self.enable = core.skill_update(self) and (entity.health / entity.health_cap < self.threshold)
end,
use = function(self, target)
local entity = self.owner
local area = hexagon.range(entity.pos, self.set_fire.radius)
local res = core.teleport(entity, target)
if res then
entity.map:layer_set("fire", entity.team, area, self.set_fire.duration, self.set_fire.damage)
end
return res
end,
}, cfg.skill.nirvana)
local skill_phoenix = util.merge_table({
name = "skill.chiyu.phoenix",
type = "vector",
remain = 0,
update = function(self)
local entity = self.owner
self.enable = core.skill_update(self) and (entity.inventory[2].remain == 0)
end,
use = function(self, direction, distance)
local entity = self.owner
if distance <= 0 then
return false
end
local main = hexagon.line(entity.pos, direction, distance)
local sides = util.append_table(
hexagon.line(hexagon.direction(entity.pos, direction + 5), direction, distance),
hexagon.line(hexagon.direction(entity.pos, direction + 7), direction, distance))
table.insert(sides, hexagon.direction(main[#main], direction))
local res = core.teleport(entity, main[#main])
if res then
ember_damage(entity, main, self.main.damage, buff.insert, "burn", self.main.burn.damage, self.main.burn.duration)
ember_damage(entity, sides, self.sides.damage, buff.insert, "burn", self.sides.burn.damage, self.sides.burn.duration)
ember_damage(entity, { main[#main - 1] }, self.back.damage)
ember_damage(entity, { main[#main - 1] }, self.back.extra, buff.insert, "down", self.back.down_duration)
local area = util.append_table(main, sides)
entity.map:layer_set("fire", entity.team, area, self.set_fire.duration, self.set_fire.damage)
local feather = entity.inventory[2]
feather.remain = feather.cooldown
end
return res
end,
}, cfg.skill.phoenix)
return function()
local chiyu = core.new_character("entity.chiyu", cfg.template, {
skill_move,
skill_attack,
skill_charge,
skill_ignition,
skill_sweep,
skill_nirvana,
skill_phoenix,
})
chiyu.quiver = quiver
table.insert(chiyu.inventory, {
name = "item.chiyu.ember",
heat = cfg.item.ember.initial or 0,
tick = function(self)
end,
})
table.insert(chiyu.inventory, {
name = "item.chiyu.feather",
cooldown = cfg.item.feather.cooldown,
remain = cfg.item.feather.initial,
tick = core.common_tick,
})
buff.insert_notick(chiyu, buff_curse)
return chiyu
end
|
---------------------------------------------------------
--------------- Wood Redefinition ---------------
---------------------------------------------------------
local logs = {
----- Name --- Description --- planks ----- Tree
{"acacia", "Acacia", "acaciawood", "acaciatree"},
{"birch", "Birch", "birchwood", "birchtree"},
{"dark_oak", "Dark Oak", "darkwood", "darktree"},
{"jungle", "Jungle", "junglewood", "jungletree"},
{"oak", "Oak", "wood", "tree"},
{"spruce", "Spruce", "sprucewood", "sprucetree"}
}
for _, logs in pairs(logs) do
minetest.override_item("mcl_core:stripped_"..logs[1], {
paramtype = "light",
paramtype2 = "facedir",
tiles = {
"technic_worldgen_stripped_"..logs[1].."_log_top.png",
"technic_worldgen_stripped_"..logs[1].."_log_top.png",
"technic_worldgen_stripped_"..logs[1].."_log.png",
"technic_worldgen_stripped_"..logs[1].."_log.png",
"technic_worldgen_stripped_"..logs[1].."_log.png",
"technic_worldgen_stripped_"..logs[1].."_log.png"
},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.4375, 0.4375, 0.5, 0.4375},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.4375, 0.4375, 0.5, 0.4375},
}
},
on_place = minetest.rotate_node,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
minetest.override_item("mcl_core:stripped_"..logs[1].."_bark", {
paramtype = "light",
paramtype2 = "facedir",
tiles = {
"technic_worldgen_stripped_"..logs[1].."_log.png",
"technic_worldgen_stripped_"..logs[1].."_log.png",
"technic_worldgen_stripped_"..logs[1].."_log.png",
"technic_worldgen_stripped_"..logs[1].."_log.png",
"technic_worldgen_stripped_"..logs[1].."_log.png",
"technic_worldgen_stripped_"..logs[1].."_log.png"
},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.4375},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.4375},
}
},
on_place = minetest.rotate_node,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
minetest.override_item("mcl_core:"..logs[4], {
tiles = {
"technic_worldgen_"..logs[1].."_log_top.png",
"technic_worldgen_"..logs[1].."_log_top.png",
"technic_worldgen_"..logs[1].."_log.png",
"technic_worldgen_"..logs[1].."_log.png",
"technic_worldgen_"..logs[1].."_log.png",
"technic_worldgen_"..logs[1].."_log.png"
},
})
minetest.override_item("mcl_core:"..logs[4].."_bark", {
tiles = {
"technic_worldgen_"..logs[1].."_log.png",
"technic_worldgen_"..logs[1].."_log.png",
"technic_worldgen_"..logs[1].."_log.png",
"technic_worldgen_"..logs[1].."_log.png",
"technic_worldgen_"..logs[1].."_log.png",
"technic_worldgen_"..logs[1].."_log.png"
},
})
minetest.override_item("mcl_core:"..logs[3], {
tiles = {
"technic_worldgen_"..logs[1].."_planks.png",
"technic_worldgen_"..logs[1].."_planks.png",
"technic_worldgen_"..logs[1].."_planks.png",
"technic_worldgen_"..logs[1].."_planks.png",
"technic_worldgen_"..logs[1].."_planks.png",
"technic_worldgen_"..logs[1].."_planks.png"
},
})
end
|
--* chat queue func by Devrak
local E, C, L, _ = select(2, shCore()):unpack()
local sui__chat, db_snap
local _G = _G
local format, find, gsub = string.format, string.find, string.gsub
local hooksecurefunc = hooksecurefunc
local CreateFrame = CreateFrame
namecolor = 1
local war = {
['AFK'] = AFK,
['DND'] = DND,
['RAID_WARNING'] = RAID_WARNING,
}
_G.CHAT_SAY_GET = '%s: '
_G.CHAT_YELL_GET = '%s: '
local function sui__chat_onWindowName(frame)
local tab = _G[frame:GetName()..'Tab']
tab.fullText = tab:GetText()
if frame.isDocked or frame.isDocked then
tab:SetText(string.upper(string.sub(tab.fullText, 1, 1)))
end
end
--* who que
local function sui__chat_que()
for k in pairs(sui__chat.queue) do
local curTime = GetTime()
sui__chat.queryTimeOut = curTime +10
sui__chat.query = k
--* time since last que > 5 sec = Fast Que
if curTime -5 > sui__chat.queryTime then
SendWho(k)
else
sui__chat.queryTime = curTime +5
sui__chat:SetScript('OnUpdate', function()
if GetTime() > sui__chat.queryTime then
if not sui__chat.whoOpen then
SendWho(k)
sui__chat:SetScript('OnUpdate', nil)
end
end
end)
end
return
end
end
local function sui__chat_onWho()
--* stops queries when whoframe is visible
if WhoFrame:IsVisible() and not sui__chat.whoOpen then
sui__chat.query = nil
sui__chat.whoOpen = true
elseif not WhoFrame:IsVisible() and sui__chat.whoOpen then
sui__chat.whoOpen = false
--* quee
sui__chat_que()
end
end
local function sui__chat_SendWho(args)
if args ~= sui__chat.query then sui__chat.query = nil end
--* LibWho ?
if args == sui__chat.query and sui__chat.L then
sui__chat.L:Who(args)
else
sui__chat.sendWho(args)
sui__chat.queryTime = GetTime()
end
end
local function sui__chat_FriendsFrame_OnEvent()
if sui__chat.query and event == 'WHO_LIST_UPDATE' then return
else sui__chat.ofriends() end
end
local function sui__chat_onItemRef(link, text, button)
local type = string.sub(text, 13, 15)
--[[if (type == 'ref') then
sui__chat.box:Show()
sui__chat.box:SetText(string.sub(text, 20, -6))
sui__chat.box:SetAutoFocus(true)
return--]]
--* party inv
if (type == 'inv') then
InviteUnit(string.sub(text, 17, -12))
return
--* apply for party
elseif (type == 'app') then
ChatFrame_OpenChat('/w '.. string.sub(text, 17, -14)..' ')
return
end
SetItemRef(link, text, button)
end
local function sui__chat_filter(name, level, mtype)
if sui__chat.whisp[name] or sui__chat.guild[name] or sui__chat.friends[name] then return false
elseif (mtype == 'CHAT_MSG_WHISPER') and level < sui__chat.temp.MsgLevel then return true
elseif (mtype == 'CHAT_MSG_CHANNEL' or mtype == 'CHAT_MSG_SAY' or mtype == 'CHAT_MSG_YELL') and sui__chat.temp.MsgChans == 1 and level < sui__chat.temp.MsgLevel then return true
else return false end
end
local function sui__chat_queryAddMessages()
if db_snap[sui__chat.query] then
for i = 1 , #sui__chat.queue[sui__chat.query] do
--* filter
if sui__chat.temp.MsgLevel == 0 or not sui__chat_filter(sui__chat.query, db_snap[sui__chat.query]['level'], sui__chat.queue[sui__chat.query][i]['Type']) then
if namecolor == 1 then
sui__chat.queue[sui__chat.query][i]['text'] = string.gsub(sui__chat.queue[sui__chat.query][i]['text'], '%['.. sui__chat.query ..'%]', '[|cff' .. sui__chat.ccolor[db_snap[sui__chat.query]['class']] .. '' .. sui__chat.query ..'|r]', 1)
end
sui__chat.oaddm(sui__chat.queue[sui__chat.query][i]['frame'], sui__chat.queue[sui__chat.query][i]['text'], sui__chat.queue[sui__chat.query][i]['r'], sui__chat.queue[sui__chat.query][i]['g'], sui__chat.queue[sui__chat.query][i]['b'])
end
end
else
for i = 1 , #sui__chat.queue[sui__chat.query] do
sui__chat.oaddm(sui__chat.queue[sui__chat.query][i]['frame'], sui__chat.queue[sui__chat.query][i]['text'], sui__chat.queue[sui__chat.query][i]['r'], sui__chat.queue[sui__chat.query][i]['g'], sui__chat.queue[sui__chat.query][i]['b'])
end
end
--* reset
sui__chat.queue[sui__chat.query] = nil
sui__chat.query = nil
--* queee
sui__chat_que()
end
local function sui__chat_onAddMessage(frame, text, r,g,b)
if (event == 'CHAT_MSG_CHANNEL') or
(event == 'CHAT_MSG_GUILD') or
(event == 'CHAT_MSG_OFFICER') or
(event == 'CHAT_MSG_PARTY') or
(event == 'CHAT_MSG_PARTY_LEADER') or
(event == 'CHAT_MSG_RAID') or
(event == 'CHAT_MSG_BATTLEGROUND') or
(event == 'CHAT_MSG_BATTLEGROUND_LEADER') or
(event == 'CHAT_MSG_WHISPER_INFORM') or
(event == 'CHAT_MSG_WHISPER') or
(event == 'CHAT_MSG_YELL') or
(event == 'CHAT_MSG_SAY') then
local cleartext = string.gsub(arg1, '|c?.+|r?', '')
local Arg2 = arg2
local chch
--* channel names
if (event ~= 'CHAT_MSG_WHISPER' and event ~= 'CHAT_MSG_SAY' and event ~= 'CHAT_MSG_YELL' and event ~= 'CHAT_MSG_WHISPER_INFORM') then
text = string.gsub(text, '[%.%s0-9a-zA-Z]*%]', string.sub(text, 2, 2)..']', 1)
--* guild member colors
if (event == 'CHAT_MSG_CHANNEL') and sui__chat.guild[Arg2] and Arg2 ~= E.Name then
text = string.gsub(text, '^[%[0-9A-Z]*%]', '|cff40fb40[' .. string.sub(text, 2, 2)..']|r', 1)
end
end
--* whisp
if (event == 'CHAT_MSG_WHISPER' or event == 'CHAT_MSG_WHISPER_INFORM') then
if (event == 'CHAT_MSG_WHISPER') then
text = string.gsub(text, ' whispers', '', 1)
text = string.gsub(text, '%['..Arg2..'%]', '< ['..Arg2..']', 1)
else
text = string.gsub(text, 'To ', '', 1)
text = string.gsub(text, '%['..Arg2..'%]', '> ['..Arg2..']', 1)
sui__chat.whisp[Arg2] = true
end
--* extra tag for guildies/friends
if sui__chat.guild[Arg2] then
text = string.gsub(text, '%['..Arg2..'%]', '|cff40fb40[G] |r['..Arg2..']', 1)
elseif sui__chat.friends[Arg2] then
text = string.gsub(text, '%['..Arg2..'%]', '|cfface5ee[F] |r['..Arg2..']', 1)
end
end
--* group invite/apply for group
if (Arg2 ~= E.Name and event ~= 'CHAT_MSG_RAID' and event ~= 'CHAT_MSG_RAID_LEADER' and event ~= 'CHAT_MSG_RAID_WARNING') then
--* LFM/LF1M ~
if string.find(arg1, 'LF%d?M%s') then
text = text .. ' |cff'.. sui__chat.sys.gicolor ..'|Happ:' .. Arg2 .. '|h[apply]|h|r'
--* inv 123 ...
else
text = string.gsub(text, '%s+invite.?', ' |cff'.. sui__chat.sys.gicolor ..'|Hinv:' .. Arg2 .. '|h[inv]|h|r', 1)
text = string.gsub(text, '%s+inv.?', ' |cff'.. sui__chat.sys.gicolor ..'|Hinv:' .. Arg2 .. '|h[inv]|h|r', 1)
text = string.gsub(text, '%s+123.?', ' |cff'.. sui__chat.sys.gicolor ..'|Hinv:' .. Arg2 .. '|h[123]|h|r', 1)
end
end
--* self highlight
text = string.gsub(text, '%s+'.. E.Name, ' |cff'.. sui__chat.sys.selfcolor ..''.. E.Name ..'|r', 1)
--* hyperlinks
if string.find(cleartext, '[0-9a-z]%.[a-z][a-z]') then
chch = string.match(cleartext,'[htps]-%:?/?/?[0-9a-z%-]+[%.[0-9a-z%-]+]-%.[a-z]+[/[0-9a-zA-Z%-%.%?=&]+]-:?%d?%d?%d?%d?%d?')
if chch ~= nil then
text = string.gsub(text, '?', '$1')
text = string.gsub(text, '-', '$2')
chch = string.gsub(chch, '?', '$1')
chch = string.gsub(chch, '-', '$2')
text = string.gsub(text, chch, '|cff'.. sui__chat.sys.hlcolor ..'|Href:|h['..chch..']|h|r')
text = string.gsub(text, '$1', '?')
text = string.gsub(text, '$2', '-')
end
end
--* class color
if namecolor == 1 or sui__chat.temp.MsgLevel > 1 then
if sui__chat.query and GetTime() > sui__chat.queryTimeOut then sui__chat_queryAddMessages() end
if db_snap[Arg2] then
if sui__chat.temp.MsgLevel > 1 and sui__chat_filter(Arg2, db_snap[Arg2]['level'], event) then return end
if namecolor == 1 then
text = string.gsub(text, '%['.. Arg2 ..'%]', '[|cff' .. sui__chat.ccolor[db_snap[Arg2]['class']] .. '' .. Arg2 ..'|r]', 1)
end
elseif not sui__chat.queue[Arg2] then
sui__chat.queue[Arg2] = {[1] = {['text'] = text, ['r'] = r, ['g'] = g, ['b'] = b, ['frame'] = frame, ['Type'] = event}}
if sui__chat.query == nil and not sui__chat.whoOpen then
sui__chat_que()
end
return
--* Message while waiting ? -> Stack Up
elseif sui__chat.queue[Arg2] then
sui__chat.queue[Arg2][#sui__chat.queue[Arg2]+1] = {['text'] = text, ['r'] = r, ['g'] = g, ['b'] = b, ['frame'] = frame, ['Type'] = event}
return
end
end
--* sys msg
elseif (event == 'CHAT_MSG_SYSTEM') then
if string.sub(text, 0, 9) == '|Hplayer:' then
if(string.sub(text, -6) == 'group.') then
local who = string.match(text, '[A-Z][a-z]+', 3)
if sui__chat.guild[who] then
text = string.gsub(text, '%['..who..'%]', '|cff40fb40[G]|r['..who..']', 1)
elseif sui__chat.friends[who] then
text = string.gsub(text, '%['..who..'%]', '|cfface5ee[F]|r['..who..']', 1)
end
elseif sui__chat.query then return end
end
if(string.sub(text, -5) == 'total') and sui__chat.query then
local numres = GetNumWhoResults()
for i = 1, numres do
local name, _, level, _, _, _, class = GetWhoInfo(i)
if not db_snap[name] then
db_snap[name] = {['class'] = class, ['level'] = level, ['faction'] = E.Faction, ['stamp'] = sui__chat.stamp}
elseif level < 70 then
db_snap[name] = {['class'] = class, ['level'] = level, ['faction'] = E.Faction, ['stamp'] = sui__chat.stamp}
end
end
sui__chat_queryAddMessages()
return
elseif(string.sub(text, -5) == 'total') then
sui__chat_que()
end
end
if C['main']._chatTime ~= false then
local time = date('%I:%M%p')
text = string.format('|cff00b5ff[%s]|r %s', gsub(time, '0*(%time+)', '%1', 1), text)
end
text = gsub(text, '<'..war.AFK..'>', '[|cffffc700'..L_ChatAFK..'|r] ')
text = gsub(text, '<'..war.DND..'>', '[|cffff0039'..L_ChatDND..'|r] ')
--text = gsub(text, '^%['..war.RAID_WARNING..'%]', '['..L_ChatRW..']')
--* to chat
sui__chat.oaddm(frame, text, r,g,b)
end
local function sui__chat_onEvent(self, event, arg, ...)
if (event == 'FRIENDLIST_UPDATE') then
local name
self.friends = {}
--* frendies list
for i = 1, GetNumFriends() do
name = GetFriendInfo(i)
if name ~= nil then self.friends[name] = true end
end
return
--* guild
elseif (event == 'GUILD_ROSTER_UPDATE') then
local count, name = GetNumGuildMembers(true) , nil
if count == 0 then return
elseif count ~= self.cguild then
self.guild = {}
for i = 1, count do
self.guild[GetGuildRosterInfo(i)] = true
end
end
return
--* query from from who update
elseif (event == 'WHO_LIST_UPDATE') and sui__chat.query then
if db_snap[sui__chat.query] then
sui__chat_queryAddMessages()
end
return
--* LibWho
elseif (event == 'MINIMAP_UPDATE_ZOOM') then
if LibStub then
if LibStub.libs['LibWho-2.0'] then
sui__chat.L = LibStub.libs['LibWho-2.0']
elseif LibStub.libs['WhoLib-1.0'] then
sui__chat.L = LibStub.libs['WhoLib-1.0']
end
end
sui__chat:UnregisterEvent('MINIMAP_UPDATE_ZOOM')
return
end
end
local function sui__chat_onSendText(this)
local attr = this:GetAttribute('chatType')
if (attr == 'CHANNEL' or attr == 'YELL' or attr == 'EMOTE' or attr == 'OFFICER' or attr == 'WHISPER') then
ChatFrameEditBox:SetAttribute('stickyType', attr)
end
end
function sui__chat_init()
--* snap
db_snap = suiDB
--* setup
sui__chat = CreateFrame('frame')
sui__chat.queue = {}
sui__chat.query = nil
sui__chat.queryTime = 0
sui__chat.stamp = date('%y%m%d')
sui__chat.whisp = {}
sui__chat.guild = {}
sui__chat.guildies = 0
sui__chat.friends = {}
sui__chat.numWindows = NUM_CHAT_WINDOWS
sui__chat.ccolor = M.index.classcolor
sui__chat.temp = M.index.template
sui__chat.sys = M.index.syscolor
--* store OrgFx
sui__chat.oaddm = ChatFrame1.AddMessage
sui__chat.sendWho = SendWho
sui__chat.ofriends = FriendsFrame_OnEvent
--* hook new
ChatFrame_OnHyperlinkShow = sui__chat_onItemRef
FriendsFrame_OnEvent = sui__chat_FriendsFrame_OnEvent
SendWho = sui__chat_SendWho
--* message handler
for i = 1, sui__chat.numWindows do
if not IsCombatLog(_G['ChatFrame'..i]) then
_G['ChatFrame'..i].AddMessage = sui__chat_onAddMessage
end
_G['ChatFrame'..i]:SetMaxLines(900)
end
sui__chat:RegisterEvent('MINIMAP_UPDATE_ZOOM')
sui__chat:RegisterEvent('GUILD_ROSTER_UPDATE')
sui__chat:RegisterEvent('FRIENDLIST_UPDATE')
sui__chat:RegisterEvent('WHO_LIST_UPDATE')
sui__chat:RegisterEvent('PLAYER_LOGOUT')
sui__chat:SetScript('OnEvent', sui__chat_onEvent)
--* hooks
hooksecurefunc('FCF_SetWindowName', sui__chat_onWindowName)
hooksecurefunc('ChatEdit_OnEscapePressed', function(ceb) ceb:Hide() end)
hooksecurefunc('ChatEdit_SendText', sui__chat_onSendText)
hooksecurefunc(WhoFrame, 'Hide', sui__chat_onWho)
hooksecurefunc(WhoFrame, 'Show', sui__chat_onWho)
end
--* register
table.insert(sui.modules, 'sui__chat_init') |
local s_gsub = string.gsub;
local json = require "util.json";
local hashes = require "util.hashes";
local base64_encode = require "util.encodings".base64.encode;
local base64_decode = require "util.encodings".base64.decode;
local b64url_rep = { ["+"] = "-", ["/"] = "_", ["="] = "", ["-"] = "+", ["_"] = "/" };
local function b64url(data)
return (s_gsub(base64_encode(data), "[+/=]", b64url_rep));
end
local function unb64url(data)
return base64_decode(s_gsub(data, "[-_]", b64url_rep).."==");
end
local static_header = b64url('{"alg":"HS256","typ":"JWT"}') .. '.';
local function sign(key, payload)
local encoded_payload = json.encode(payload);
local signed = static_header .. b64url(encoded_payload);
local signature = hashes.hmac_sha256(key, signed);
return signed .. "." .. b64url(signature);
end
local jwt_pattern = "^(([A-Za-z0-9-_]+)%.([A-Za-z0-9-_]+))%.([A-Za-z0-9-_]+)$"
local function verify(key, blob)
local signed, bheader, bpayload, signature = string.match(blob, jwt_pattern);
if not signed then
return nil, "invalid-encoding";
end
local header = json.decode(unb64url(bheader));
if not header or type(header) ~= "table" then
return nil, "invalid-header";
elseif header.alg ~= "HS256" then
return nil, "unsupported-algorithm";
end
if b64url(hashes.hmac_sha256(key, signed)) ~= signature then
return false, "signature-mismatch";
end
local payload, err = json.decode(unb64url(bpayload));
if err ~= nil then
return nil, "json-decode-error";
end
return true, payload;
end
return {
sign = sign;
verify = verify;
};
|
-----------------------------------
--
-- Zone: Yuhtunga_Jungle (123)
--
-----------------------------------
local ID = require("scripts/zones/Yuhtunga_Jungle/IDs")
require("scripts/quests/i_can_hear_a_rainbow")
require("scripts/globals/chocobo_digging")
require("scripts/globals/conquest")
require("scripts/globals/helm")
require("scripts/globals/zone")
require("scripts/globals/beastmentreasure")
-----------------------------------
function onChocoboDig(player, precheck)
return tpz.chocoboDig.start(player, precheck)
end
function onInitialize(zone)
tpz.conq.setRegionalConquestOverseers(zone:getRegionID())
tpz.helm.initZone(zone, tpz.helm.type.HARVESTING)
tpz.helm.initZone(zone, tpz.helm.type.LOGGING)
tpz.bmt.updatePeddlestox(tpz.zone.YUHTUNGA_JUNGLE, ID.npc.PEDDLESTOX)
end
function onGameDay()
tpz.bmt.updatePeddlestox(tpz.zone.YUHTUNGA_JUNGLE, ID.npc.PEDDLESTOX)
end
function onConquestUpdate(zone, updatetype)
tpz.conq.onConquestUpdate(zone, updatetype)
end
function onZoneIn( player, prevZone)
local cs = -1
if player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0 then
player:setPos(116.825, 6.613, 100, 140)
end
if quests.rainbow.onZoneIn(player) then
cs = 11
end
return cs
end
function onRegionEnter( player, region)
end
function onEventUpdate( player, csid, option)
if csid == 11 then
quests.rainbow.onEventUpdate(player)
end
end
function onEventFinish( player, csid, option)
end
|
--!strict
-- Equations: https://www.w3.org/TR/2015/CR-compositing-1-20150113/#blendingseparable
local blendingFunctions: {[string]: (number, number) -> number} = {
Normal = function(_: number, b: number): number
return b
end,
Multiply = function(a: number, b: number): number
return a * b
end,
Screen = function(a: number, b: number): number
return 1 - ((1 - a) * (1 - b))
end,
ColorDodge = function(a: number, b: number): number
if (a == 0) then
return 0
elseif (b == 1) then
return 1
else
return math.min(1, a / (1 - b))
end
end,
ColorBurn = function(a: number, b: number): number
if (a == 1) then
return 1
elseif (b == 0) then
return 0
else
return 1 - math.min(1, (1 - a) / b)
end
end,
SoftLight = function(a: number, b: number): number
if (b <= 0.5) then
return a - ((1 - (2 * b)) * a * (1 - a))
else
local c: number
if (a <= 0.25) then
c = ((((16 * a) - 12) * a) + 4) * a
else
c = math.sqrt(a)
end
return a + ((2 * b) - 1) * (c - a)
end
end,
Difference = function(a: number, b: number): number
return math.abs(a - b)
end,
Exclusion = function(a: number, b: number): number
return a + b - (2 * a * b)
end,
Darken = math.min,
Lighten = math.max,
}
blendingFunctions.HardLight = function(a: number, b: number): number
if (b <= 1/2) then
return blendingFunctions.Multiply(a, 2 * b)
else
return blendingFunctions.Screen(a, (2 * b) - 1)
end
end
blendingFunctions.Overlay = function(a: number, b: number): number
return blendingFunctions.HardLight(b, a)
end
---
return function(backgroundColorComponents: {number}, foregroundColorComponents: {number}, blendMode: string): (number, number, number)
local blendingFunction: ((number, number) -> number)? = blendingFunctions[blendMode]
assert(blendingFunction, "invalid blend mode")
local blend: {number} = {}
for i = 1, 3 do
blend[i] = blendingFunction(backgroundColorComponents[i], foregroundColorComponents[i])
end
return table.unpack(blend)
end |
--デコード・トーカー・ヒートソウル
--Scripted by mallu11
function c100259041.initial_effect(c)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_CYBERSE),2,3,c100259041.lcheck)
--atk
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(c100259041.atkval)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100259041,0))
e2:SetCategory(CATEGORY_DRAW+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMING_MAIN_END+TIMING_END_PHASE)
e2:SetCountLimit(1,100259041)
e2:SetCost(c100259041.drcost)
e2:SetTarget(c100259041.drtg)
e2:SetOperation(c100259041.drop)
c:RegisterEffect(e2)
end
function c100259041.lcheck(g)
return g:GetClassCount(Card.GetLinkAttribute)==g:GetCount()
end
function c100259041.atkval(e,c)
return c:GetLinkedGroupCount()*500
end
function c100259041.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
function c100259041.cfilter(c,e,tp,mc)
return c:IsRace(RACE_CYBERSE) and c:IsType(TYPE_LINK) and c:IsLinkBelow(3) and not c:IsCode(100259041)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0
end
function c100259041.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c100259041.drop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
if Duel.Draw(p,d,REASON_EFFECT)~=0 and Duel.GetLP(tp)<=2000 and c:IsRelateToEffect(e) and c:IsAbleToRemove()
and Duel.IsExistingMatchingCard(c100259041.cfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c)
and Duel.SelectYesNo(tp,aux.Stringid(100259041,1)) then
Duel.BreakEffect()
if Duel.Remove(c,POS_FACEUP,REASON_EFFECT)~=0 and c:IsLocation(LOCATION_REMOVED) then
local g=Duel.SelectMatchingCard(tp,c100259041.cfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
end
|
--------------------------------
-- @module Layer
-- @extend Node
-- @parent_module cc
--------------------------------
-- Creates a fullscreen black layer.<br>
-- return An autoreleased Layer object.
-- @function [parent=#Layer] create
-- @param self
-- @return Layer#Layer ret (return value: cc.Layer)
--------------------------------
--
-- @function [parent=#Layer] getDescription
-- @param self
-- @return string#string ret (return value: string)
return nil
|
Weapon.PrettyName = "HK MP5"
Weapon.WeaponID = "m9k_mp5"
Weapon.DamageMultiplier = 0.9
Weapon.WeaponType = WEAPON_PRIMARY |
CChest = {}
function CChest:constructor(Chest, Lobby, Spawn)
self.Lobby = Lobby
self.Spawn = Spawn
self.Chest = Chest
self.Rand = math.random(1, 10)
addEventHandler("onElementClicked", self.Chest,
function(btn, state, thePlayer)
if (state == "down") then
local x,y,z = getElementPosition(self.Chest)
local x1, y1, z1 = getElementPosition(thePlayer)
if (getDistanceBetweenPoints3D(x,y,z,x1,y1,z1) <= 2) then
if isTimer(self.Respawn) then
thePlayer:showInfoBox("info", "Diese Kiste ist leer!")
end
if (self.Rand < 2) then
thePlayer:showInfoBox("info", "Diese Kiste ist leer!")
else
if (self.Rand == 2) then
thePlayer:showInfoBox("info", "Du hast ein Medikit gefunden!")
setElementHealth(thePlayer, 100)
end
if (self.Rand == 3) then
thePlayer:showInfoBox("info", "Du hast eine Schutzweste gefunden!")
setPedArmor(thePlayer, 100)
end
if (self.Rand == 4) then
thePlayer:showInfoBox("info", "Du hast einen Dildo gefunden!")
giveWeapon(thePlayer, 10, 1)
end
if (self.Rand == 5) then
thePlayer:showInfoBox("info", "Du hast eine Shotgun gefunden!")
giveWeapon(thePlayer, 25, 5)
end
if (self.Rand == 6) then
thePlayer:showInfoBox("info", "Du hast ein Tränengas gefunden!")
giveWeapon(thePlayer, 17, 1)
end
if (self.Rand == 7) then
thePlayer:showInfoBox("info", "Du hast ein Katana gefunden!")
giveWeapon(thePlayer, 8, 1)
end
if (self.Rand == 8 ) then
thePlayer:showInfoBox("info", "Du hast ein Gewehr gefunden!")
giveWeapon(thePlayer, 33, 5)
end
if (self.Rand == 9) then
thePlayer:showInfoBox("info", "Du hast eine Deagle gefunden!")
giveWeapon(thePlayer, 24, 5)
end
if (self.Rand == 10) then
thePlayer:showInfoBox("info", "Du hast einen Raketenwerfer gefunden!")
giveWeapon(thePlayer, 35, 1)
end
end
self.Rand = 1
setTimer(function() self.Rand = math.random(1, 10) end, 60000, 1)
else
thePlayer:showInfoBox("error", "Du bist zu weit entfernt!")
end
end
end
)
end
function CChest:destructor()
destroyElement(self.Chest)
if isTimer(self.Respawn) then
killTimer(self.Respawn)
end
end |
_G["LOADOUTSTATEENUMS"] =
{
"ChangingLoadout",
"EditingLoadout",
"EditingWeapon",
}
_G["LoadoutState"] = _G["LOADOUTSTATEENUMS"][1]
print(_G["LoadoutState"])
|
require("prefabutil")
local assets =
{
Asset("ANIM", "anim/rabbitwheel.zip"),
Asset("ANIM", "anim/winona_battery_placement.zip"),
Asset("SOUND", "sound/rabbit.fsb"),
}
local prefabs =
{
"collapse_small",
}
--------------------------------------------------------------------------
local PERIOD = .5
local function DoAddBatteryPower(inst, node)
print("DoAddBatteryPower")
node:AddBatteryPower(PERIOD + math.random(2, 6) * FRAMES)
end
local function OnBatteryTask(inst)
print("OnBatteryTask")
inst.components.circuitnode:ForEachNode(DoAddBatteryPower)
end
local function StartBattery(inst)
print("StartBattery")
if inst._batterytask == nil then
inst._batterytask = inst:DoPeriodicTask(PERIOD, OnBatteryTask, 0)
end
end
local function StopBattery(inst)
print("StopBattery")
if inst._batterytask ~= nil then
inst._batterytask:Cancel()
inst._batterytask = nil
end
end
local function UpdateCircuitPower(inst)
print("UpdateCircuitPower")
inst._circuittask = nil
if inst.components.fueled ~= nil then
if inst.components.fueled.consuming then
local load = 0
inst.components.circuitnode:ForEachNode(function(inst, node)
local batteries = 0
node.components.circuitnode:ForEachNode(function(node, battery)
if battery.components.fueled ~= nil and battery.components.fueled.consuming then
batteries = batteries + 1
end
end)
load = load + 1 / batteries
end)
inst.components.fueled.rate = math.max(load, TUNING.WINONA_BATTERY_MIN_LOAD)
else
inst.components.fueled.rate = 0
end
end
end
local function OnCircuitChanged(inst)
print("OnCircuitChanged")
if inst._circuittask == nil then
inst._circuittask = inst:DoTaskInTime(0, UpdateCircuitPower)
end
end
local function NotifyCircuitChanged(inst, node)
print("NotifyCircuitChanged")
node:PushEvent("engineeringcircuitchanged")
end
local function BroadcastCircuitChanged(inst)
print("BroadcastCircuitChanged")
--Notify other connected nodes, so that they can notify their connected batteries
inst.components.circuitnode:ForEachNode(NotifyCircuitChanged)
if inst._circuittask ~= nil then
inst._circuittask:Cancel()
end
UpdateCircuitPower(inst)
end
local function OnConnectCircuit(inst)--, node)
print("OnConnectCircuit")
if inst.components.fueled ~= nil and inst.components.fueled.consuming then
StartBattery(inst)
end
OnCircuitChanged(inst)
end
local function OnDisconnectCircuit(inst)--, node)
print("OnDisconnectCircuit")
if not inst.components.circuitnode:IsConnected() then
StopBattery(inst)
end
OnCircuitChanged(inst)
end
--------------------------------------------------------------------------
local NUM_LEVELS = 6
local function UpdateSoundLoop(inst, level)
print("UpdateSoundLoop")
if inst.SoundEmitter:PlayingSound("loop") then
inst.SoundEmitter:SetParameter("loop", "intensity", 1 - level / NUM_LEVELS)
end
end
local function StartSoundLoop(inst)
print("StartSoundLoop")
if not inst.SoundEmitter:PlayingSound("loop") then
inst.SoundEmitter:PlaySound("dontstarve/common/together/battery/on_LP", "loop")
UpdateSoundLoop(inst, inst.components.fueled:GetCurrentSection())
end
end
local function StopSoundLoop(inst)
print("StopSoundLoop")
inst.SoundEmitter:KillSound("loop")
end
local function OnEntityWake(inst)
print("OnEntityWake")
if inst.components.fueled ~= nil and inst.components.fueled.consuming then
StartSoundLoop(inst)
end
end
--------------------------------------------------------------------------
local function OnHitAnimOver(inst)
print("OnHitAnimOver")
inst:RemoveEventCallback("animover", OnHitAnimOver)
if inst.AnimState:IsCurrentAnimation("hit") then
if inst.components.fueled:IsEmpty() then
inst.AnimState:PlayAnimation("idle_empty", true)
else
inst.AnimState:PlayAnimation("idle_charge", true)
end
end
end
local function PlayHitAnim(inst)
print("PlayHitAnim")
-- inst:RemoveEventCallback("animover", OnHitAnimOver)
-- inst:ListenForEvent("animover", OnHitAnimOver)
-- inst.AnimState:PlayAnimation("hit")
end
local function OnWorked(inst)
print("OnWorked")
-- if inst.components.fueled.accepting then
-- PlayHitAnim(inst)
-- end
if inst.components.rabbitcage:HasRabbit() then
inst.SoundEmitter:PlaySound("dontstarve/rabbit/scream_short")
end
end
local function OnWorkFinished(inst)
print("OnWorkFinished")
if inst.components.burnable ~= nil and inst.components.burnable:IsBurning() then
inst.components.burnable:Extinguish()
end
inst.components.lootdropper:DropLoot()
local fx = SpawnPrefab("collapse_small")
fx.Transform:SetPosition(inst.Transform:GetWorldPosition())
fx:SetMaterial("wood")
inst:Remove()
end
local function OnBurnt(inst)
print("OnBurnt")
DefaultBurntStructureFn(inst)
StopSoundLoop(inst)
if inst.components.fueled ~= nil then
inst:RemoveComponent("fueled")
end
inst.components.workable:SetOnWorkCallback(nil)
inst:RemoveTag("NOCLICK")
if inst._inittask ~= nil then
inst._inittask:Cancel()
inst._inittask = nil
end
inst.components.circuitnode:Disconnect()
end
--------------------------------------------------------------------------
local function GetStatus(inst)
print("GetStatus")
if inst:HasTag("burnt") then
return "BURNT"
elseif inst.components.burnable ~= nil and inst.components.burnable:IsBurning() then
return "BURNING"
end
local level = inst.components.fueled ~= nil and inst.components.fueled:GetCurrentSection() or nil
local hasrabbit = inst.components.rabbitcage ~= nil and inst.components.rabbitcage:HasRabbit() or nil
local isStarving = inst.components.hunger:IsStarving()
if(hasrabbit == nil or hasrabbit == false) then
return "DESERTED"
end
if(level == 0) then
return "OFF"
end
if(level == 1) then
return "LOWPOWER"
end
if(isStarving) then
return "IDLE"
end
return "CHARGING"
end
-- local function OnAddFuel(inst)
-- print("OnAddFuel")
-- if inst.components.fueled.accepting and not inst.components.fueled:IsEmpty() then
-- if not inst.components.fueled.consuming then
-- inst.components.fueled:StartConsuming()
-- BroadcastCircuitChanged(inst)
-- if inst.components.circuitnode:IsConnected() then
-- StartBattery(inst)
-- end
-- if not inst:IsAsleep() then
-- StartSoundLoop(inst)
-- end
-- end
-- PlayHitAnim(inst)
-- inst.SoundEmitter:PlaySound("dontstarve/rabbit/scream_short")
-- end
-- end
local function OnInit(inst)
print("OnInit")
inst._inittask = nil
inst.components.circuitnode:ConnectTo("engineering")
end
local PLACER_SCALE = 1.5
local function OnUpdatePlacerHelper(helperinst)
print("OnUpdatePlacerHelper")
if not helperinst.placerinst:IsValid() then
helperinst.components.updatelooper:RemoveOnUpdateFn(OnUpdatePlacerHelper)
helperinst.AnimState:SetAddColour(0, 0, 0, 0)
elseif helperinst:IsNear(helperinst.placerinst, TUNING.WINONA_BATTERY_RANGE) then
helperinst.AnimState:SetAddColour(helperinst.placerinst.AnimState:GetAddColour())
else
helperinst.AnimState:SetAddColour(0, 0, 0, 0)
end
end
local function OnEnableHelper(inst, enabled, recipename, placerinst)
print("OnEnableHelper")
if enabled then
if inst.helper == nil and inst:HasTag("HAMMER_workable") and not inst:HasTag("burnt") then
inst.helper = CreateEntity()
--[[Non-networked entity]]
inst.helper.entity:SetCanSleep(false)
inst.helper.persists = false
inst.helper.entity:AddTransform()
inst.helper.entity:AddAnimState()
inst.helper:AddTag("CLASSIFIED")
inst.helper:AddTag("NOCLICK")
inst.helper:AddTag("placer")
inst.helper.AnimState:SetBank("winona_battery_placement")
inst.helper.AnimState:SetBuild("winona_battery_placement")
inst.helper.AnimState:PlayAnimation("idle")
inst.helper.AnimState:SetLightOverride(1)
inst.helper.AnimState:SetOrientation(ANIM_ORIENTATION.OnGround)
inst.helper.AnimState:SetLayer(LAYER_BACKGROUND)
inst.helper.AnimState:SetSortOrder(1)
inst.helper.AnimState:SetScale(PLACER_SCALE, PLACER_SCALE)
inst.helper.entity:SetParent(inst.entity)
if placerinst ~= nil
and recipename ~= "rabbitwheel"
and recipename ~= "winona_battery_low"
and recipename ~= "winona_battery_high" then
inst.helper:AddComponent("updatelooper")
inst.helper.components.updatelooper:AddOnUpdateFn(OnUpdatePlacerHelper)
inst.helper.placerinst = placerinst
OnUpdatePlacerHelper(inst.helper)
end
end
elseif inst.helper ~= nil then
inst.helper:Remove()
inst.helper = nil
end
end
local function UpdateAnimation(inst, section)
local val = "m"..tostring(section)
print("val ".. tostring(val))
-- inst.AnimState:OverrideSymbol("status", "rabbitwheel", val)
inst.AnimState:OverrideSymbol("m1", "rabbitwheel", val)
-- inst.AnimState:OverrideSymbol("m2", "rabbitwheel", val)
-- inst.AnimState:OverrideSymbol("a", "rabbitwheel", val)
end
local function OnFuelEmpty(inst)
print("OnFuelEmpty")
inst.components.fueled:StopConsuming()
BroadcastCircuitChanged(inst)
StopBattery(inst)
StopSoundLoop(inst)
UpdateAnimation(inst, 1)
-- inst.AnimState:OverrideSymbol("plug", "rabbitwheel", "plug_off")
if not POPULATING and inst.components.rabbitcage and inst.components.rabbitcage:HasRabbit() then
inst.SoundEmitter:PlaySound("dontstarve/rabbit/scream")
end
end
-- specific rabbitwheel stuff -------------
-- 1. empty rabbitwheel is a rabbitcage
-- 2. if a rabbit is put, it becomes a healthy/hunger instance
-- 3. the rabbit accepts carrots to satisfy the hunger
-- 4. the rabbit in the rabbitcage dies over time
-- 5. the rabbit may starve
-- 6. the rabbit produces energy based on hunger
local function OnRabbitHealthDelta(inst, oldpercent, newpercent)
print("OnRabbitHealthDelta", newpercent)
if newpercent <= 0.05 then
OnRemoveRabbit(inst)
end
end
local function ShouldAcceptCarrot(inst, item)
print("ShouldAcceptCarrot")
return item.prefab == "carrot"
end
local function ShouldAcceptRabbit(inst, item)
print("ShouldAcceptRabbit")
return item.prefab == "rabbit"
end
local function OnRabbitHunger(inst, data)
print("OnRabbitHunger " .. tostring(data.delta) .. ": " .. tostring(data.newpercent) .. "%")
-- data = { oldpercent, newpercent, overtime, delta }
if data.delta == 0 then
return
end
-- TODO tweak based on current hunger
local factor = TUNING.RABBIT_JOULE_CONVERSION_RATE
if data.delta ~= nil and data.delta < 0
and math.abs(data.delta) < 10 then -- there are strange high numbers coming in
local fueldelta = -1 * factor * data.delta
inst.components.fueled:DoDelta(fueldelta) -- transform burned food into energy
print("DELTA ".. tostring(data.delta) .. " * -" .. tostring(factor) .. " = " .. tostring(fueldelta))
print("SECTION " .. tostring(inst.components.fueled:GetCurrentSection()))
print("PERCENT " .. tostring(inst.components.fueled:GetPercent()))
if not inst.AnimState:IsCurrentAnimation("idle_charge") then
inst.AnimState:PlayAnimation("idle_charge", true)
end
if not inst.components.fueled.consuming then
inst.components.fueled:StartConsuming()
BroadcastCircuitChanged(inst)
if inst.components.circuitnode:IsConnected() then
StartBattery(inst)
end
-- if not inst:IsAsleep() then
-- StartSoundLoop(inst)
-- end
end
end
if data.newpercent == 0 then
if not inst.AnimState:IsCurrentAnimation("idle_empty") then
print("switching to idle_empty")
inst.AnimState:PlayAnimation("idle_empty", true)
if inst.components.rabbitcage
and inst.components.rabbitcage:HasRabbit() then
inst.SoundEmitter:PlaySound("dontstarve/rabbit/scream_short")
end
end
end
end
function OnPutRabbit(inst, rabbit)
print("OnPutRabbit")
if not POPULATING and inst.components.rabbitcage and inst.components.rabbitcage:HasRabbit() then
inst.SoundEmitter:PlaySound("dontstarve/rabbit/scream")
end
inst.AnimState:PlayAnimation("idle_empty", true)
inst.components.rabbitcage:PutRabbit()
inst.components.hunger:SetRate(TUNING.RABBIT_JOULE_PER_DAY/TUNING.TOTAL_DAY_TIME)
inst:ListenForEvent("hungerdelta", OnRabbitHunger)
inst.components.trader:SetAcceptTest(ShouldAcceptCarrot)
end
function OnRemoveRabbit(inst)
print("OnRemoveRabbit")
if not POPULATING and inst.components.rabbitcage and inst.components.rabbitcage:HasRabbit() then
inst.SoundEmitter:PlaySound("dontstarve/rabbit/scream")
end
inst.AnimState:PlayAnimation("idle_norabbit", true)
inst.components.rabbitcage:RemoveRabbit()
inst:RemoveEventCallback("hungerdelta", OnRabbitHunger)
inst.components.hunger:SetPercent(0)
inst.components.hunger:SetRate(0)
inst.components.trader:SetAcceptTest(ShouldAcceptRabbit)
end
local function OnFeedCarrot(inst)
print("OnFeedCarrot")
if inst.components.hunger ~= nil then
inst.components.hunger:DoDelta(TUNING.RABBIT_CARROT_JOULE, false, true)
end
if inst.components.health ~= nil then
-- rabbit loses some of his max health with every carrot ...
inst.components.health:SetMaxHealth(inst.components.health.maxhealth * (1 - TUNING.RABBIT_CARROT_POISON_PERCENT/100))
print(inst.components.health.maxhealth)
-- ... but is healed to 100%
inst.components.health:SetPercent(TUNING.RABBIT_CARROT_HEAL_PERCENT)
-- aging sucks!
end
end
local function OnGetItemFromPlayer(inst, giver, item)
print("OnGetItemFromPlayer" .. tostring(item))
if item.prefab == "carrot" then
OnFeedCarrot(inst, item)
elseif item.prefab == "rabbit" then
OnPutRabbit(inst, item)
-- calculate initial rabbit hunger and health based on perish value
local factor = 1
if item.components.perishable then
if item.components.perishable:IsStale() then
factor = 0.6
elseif item.components.perishable:IsStale() then
factor = 0.3
end
end
inst.components.health:SetMaxHealth(TUNING.RABBIT_MAX_HEALTH)
inst.components.hunger:SetPercent(factor * 100)
inst.components.health:SetPercent(factor * 100)
end
end
local function OnStartGenerating(inst)
print("OnStartGenerating")
inst:RemoveEventCallback("hungerdelta", OnRabbitHunger)
inst:ListenForEvent("hungerdelta", OnRabbitHunger)
if inst.components.rabbitcage and inst.components.rabbitcage:HasRabbit() then
inst.SoundEmitter:PlaySound("dontstarve/rabbit/scream_short")
end
inst.AnimState:PlayAnimation("idle_charge", true)
end
-- not used atm
local function OnStopGenerating(inst)
print("OnStopGenerating")
inst:RemoveEventCallback("hungerdelta", OnRabbitHunger)
inst.AnimState:PlayAnimation("idle_empty", true)
end
local function OnFuelSectionChange(new, old, inst)
print("OnFuelSectionChange " .. tostring(new))
local newsection = math.clamp(new + 1, 1, 7)
UpdateAnimation(inst, newsection)
if inst.components.fueled ~= nil then
if inst.components.fueled.consuming
and inst.components.rabbitcage:HasRabbit()
and not inst.components.hunger:IsStarving()
and newsection == 6 then
OnStartGenerating(inst)
end
end
StartSoundLoop(inst, newsection)
end
--------------------------------------------------------------------------
local function OnBuilt3(inst)
print("OnBuilt3")
inst:RemoveTag("NOCLICK")
inst.components.circuitnode:ConnectTo("engineering")
OnRemoveRabbit(inst)
UpdateAnimation(inst, 7)
-- OnFuelEmpty(inst)
end
local function OnBuilt2(inst)
print("OnBuilt2")
end
local function OnBuilt1(inst)
print("OnBuilt1")
-- inst.SoundEmitter:PlaySound("dontstarve/rabbit/scream_short")
end
local function OnBuilt(inst)--, data)
print("OnBuilt")
if inst._inittask ~= nil then
inst._inittask:Cancel()
inst._inittask = nil
end
inst.components.circuitnode:Disconnect()
inst.AnimState:PlayAnimation("idle_placer", true)
inst.AnimState:ClearAllOverrideSymbols()
-- inst.SoundEmitter:PlaySound("dontstarve/rabbit/scream")
inst:AddTag("NOCLICK")
BroadcastCircuitChanged(inst)
StopSoundLoop(inst)
inst:DoTaskInTime(30 * FRAMES, OnBuilt1)
inst:DoTaskInTime(50 * FRAMES, OnBuilt2)
inst:DoTaskInTime(75 * FRAMES, OnBuilt3)
end
--------------------------------------------------------------------------
local function OnSave(inst, data)
print("OnSave")
data.burnt = inst.components.burnable ~= nil and inst.components.burnable:IsBurning() or inst:HasTag("burnt") or nil
data.hasrabbit = inst.components.rabbitcage.hasrabbit
data.currenthealth = inst.components.health.currenthealth
data.maxhealth = inst.components.health.maxhealth
print("health")
print(data.currenthealth)
end
local function OnLoad(inst, data, ents)
print("OnLoad")
if data ~= nil and data.burnt then
inst.components.burnable.onburnt(inst)
else
if inst.components.fueled then
if inst.components.fueled:IsEmpty() then
OnFuelEmpty(inst)
else
StartSoundLoop(inst, inst.components.fueled:GetCurrentSection())
-- if inst.AnimState:IsCurrentAnimation("idle_charge") then
-- inst.AnimState:SetTime(inst.AnimState:GetCurrentAnimationLength() * math.random())
-- end
end
end
if inst.components.rabbitcage then
inst.components.rabbitcage.hasrabbit = data.hasrabbit or false
end
inst.components.health:SetMaxHealth(data.maxhealth or TUNING.RABBIT_MAX_HEALTH)
inst.components.health.currenthealth = data.currenthealth or data.maxhealth
print("health after")
print(inst.components.health.currenthealth)
end
end
local function OnLoadPostPass(inst)
print("OnLoadPostPass")
if inst._inittask ~= nil then
inst._inittask:Cancel()
OnInit(inst)
end
if inst.components.rabbitcage.hasrabbit then
OnPutRabbit(inst)
else
OnRemoveRabbit(inst)
end
end
--------------------------------------------------------------------------
local function fn()
print("fn")
local inst = CreateEntity()
inst.entity:AddTransform()
inst.entity:AddAnimState()
inst.entity:AddSoundEmitter()
inst.entity:AddMiniMapEntity()
inst.entity:AddNetwork()
MakeObstaclePhysics(inst, .5)
inst:AddTag("structure")
inst:AddTag("engineeringbattery")
inst:AddTag("rabbitwheel")
inst.AnimState:SetBank("rabbitwheel")
inst.AnimState:SetBuild("rabbitwheel")
inst.AnimState:PlayAnimation("idle_norabbit", true)
inst.MiniMapEntity:SetIcon("winona_battery_low.png")
--Dedicated server does not need deployhelper
if not TheNet:IsDedicated() then
inst:AddComponent("deployhelper")
inst.components.deployhelper:AddRecipeFilter("winona_spotlight")
inst.components.deployhelper:AddRecipeFilter("winona_catapult")
inst.components.deployhelper:AddRecipeFilter("winona_battery_low")
inst.components.deployhelper:AddRecipeFilter("winona_battery_high")
inst.components.deployhelper:AddRecipeFilter("rabbitwheel")
inst.components.deployhelper.onenablehelper = OnEnableHelper
end
inst.entity:SetPristine()
if not TheWorld.ismastersim then
return inst
end
inst:AddComponent("inspectable")
inst.components.inspectable.getstatus = GetStatus
inst:AddComponent("lootdropper")
inst:AddComponent("workable")
inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
inst.components.workable:SetWorkLeft(4)
inst.components.workable:SetOnWorkCallback(OnWorked)
inst.components.workable:SetOnFinishCallback(OnWorkFinished)
inst:AddComponent("circuitnode")
inst.components.circuitnode:SetRange(TUNING.WINONA_BATTERY_RANGE)
inst.components.circuitnode:SetOnConnectFn(OnConnectCircuit)
inst.components.circuitnode:SetOnDisconnectFn(OnDisconnectCircuit)
inst:AddComponent("trader")
-- SetAcceptTest is changing depending on state
inst.components.trader.onaccept = OnGetItemFromPlayer
inst.components.trader.deleteitemonaccept = false
inst:AddComponent("rabbitcage")
inst.components.rabbitcage.hasrabbit = false
inst:AddComponent("hunger")
inst.components.hunger:SetMax(TUNING.RABBIT_MAX_HUNGER)
inst.components.hunger:SetRate(0)
inst.components.hunger:SetKillRate(TUNING.RABBIT_MAX_HEALTH / TUNING.RABBIT_STARVE_KILL_TIME)
inst:AddComponent("health") -- every inst with hunger has also health, I guess
inst.components.health.ondelta = OnRabbitHealthDelta
inst:AddComponent("fueled")
inst.components.fueled:SetDepletedFn(OnFuelEmpty)
-- inst.components.fueled:SetTakeFuelFn(OnAddFuel)
inst.components.fueled:SetSections(NUM_LEVELS)
inst.components.fueled:SetSectionCallback(OnFuelSectionChange)
inst.components.fueled:InitializeFuelLevel(TUNING.RABBITWHEEL_FULL_BATTERY_DURATION)
inst.components.fueled.fueltype = FUELTYPE.MAGIC -- no associated fuel
inst.components.fueled.accepting = false
inst.components.fueled:StartConsuming()
inst:ListenForEvent("onbuilt", OnBuilt)
inst:ListenForEvent("engineeringcircuitchanged", OnCircuitChanged)
MakeHauntableWork(inst)
MakeMediumBurnable(inst, nil, nil, true)
MakeMediumPropagator(inst)
inst.components.burnable:SetOnBurntFn(OnBurnt)
inst.components.burnable.ignorefuel = true --igniting/extinguishing should not start/stop fuel consumption
inst.OnSave = OnSave
inst.OnLoad = OnLoad
inst.OnLoadPostPass = OnLoadPostPass
inst.OnEntitySleep = StopSoundLoop
inst.OnEntityWake = OnEntityWake
-- default fuel with nitre
-- inst:AddComponent("fueled")
-- inst.components.fueled:SetDepletedFn(OnFuelEmpty)
-- inst.components.fueled:SetTakeFuelFn(OnAddFuel)
-- inst.components.fueled:SetSections(NUM_LEVELS)
-- inst.components.fueled:SetSectionCallback(OnFuelSectionChange)
-- inst.components.fueled:InitializeFuelLevel(TUNING.WINONA_BATTERY_LOW_MAX_FUEL_TIME)
-- inst.components.fueled.fueltype = FUELTYPE.CHEMICAL
-- inst.components.fueled.accepting = true
-- inst.components.fueled:StartConsuming()
inst._batterytask = nil
inst._inittask = inst:DoTaskInTime(0, OnInit)
UpdateCircuitPower(inst)
return inst
end
--------------------------------------------------------------------------
local function placer_postinit_fn(inst)
print("placer_postinit_fn")
--Show the battery placer on top of the battery range ground placer
local placer = CreateEntity()
--[[Non-networked entity]]
placer.entity:SetCanSleep(false)
placer.persists = false
placer.entity:AddTransform()
placer.entity:AddAnimState()
placer:AddTag("CLASSIFIED")
placer:AddTag("NOCLICK")
placer:AddTag("placer")
placer.AnimState:SetBank("rabbitwheel")
placer.AnimState:SetBuild("rabbitwheel")
placer.AnimState:PlayAnimation("idle_placer")
placer.AnimState:SetLightOverride(1)
placer.entity:SetParent(inst.entity)
inst.components.placer:LinkEntity(placer)
inst.AnimState:SetScale(PLACER_SCALE, PLACER_SCALE)
end
--------------------------------------------------------------------------
return Prefab("rabbitwheel", fn, assets, prefabs),
MakePlacer("rabbitwheel_placer", "winona_battery_placement", "winona_battery_placement", "idle", true, nil, nil, nil, nil, nil, placer_postinit_fn)
|
--[[
______ _____ _ _ _____ _________ __
| ____|_ _| \ | |_ _|__ __\ \ / /
| |__ | | | \| | | | | | \ \_/ /
| __| | | | . ` | | | | | \ /
| | _| |_| |\ |_| |_ | | | |
|_| |_____|_| \_|_____| |_| |_|
Source:
https://d3to-finity.000webhostapp.com/files/source-0.1.2.txt
Version:
0.1.5
Date:
April 21th, 2020
Author:
detourious @ v3rmillion.netf
Docs:
https://detourious.gitbook.io/project-finity/
--]]
local finity = {}
finity.gs = {}
local PROTECT_NAME = "PROTECT____" .. game:GetService("HttpService"):GenerateGUID(false)
finity.theme = { -- light // purge theme
main_container = Color3.fromRGB(21,23,30),
separator_color = Color3.fromRGB(32,33,42),
text_color = Color3.fromRGB(251,248,253), -- softer color
category_button_background = Color3.fromRGB(21,23,30),
category_button_border = Color3.fromRGB(0,0,0),
checkbox_checked = Color3.fromRGB(255,104,71),
checkbox_outer = Color3.fromRGB(0,0,0),
checkbox_inner = Color3.fromRGB(32,33,42),
slider_color = Color3.fromRGB(255,104,71),
slider_color_sliding = Color3.fromRGB(255,104,71),
slider_background = Color3.fromRGB(42,33,42),
slider_text = Color3.fromRGB(251,248,253),
textbox_background = Color3.fromRGB(42,33,42),
textbox_background_hover = Color3.fromRGB(31,33,40),
textbox_text = Color3.fromRGB(251,248,253),
textbox_text_hover = Color3.fromRGB(241,238,243),
textbox_placeholder = Color3.fromRGB(251,248,253),
dropdown_background = Color3.fromRGB(42,33,42),
dropdown_text = Color3.fromRGB(251,248,253),
dropdown_text_hover = Color3.fromRGB(241,238,243),
dropdown_scrollbar_color = Color3.fromRGB(37, 36, 38),
button_background = Color3.fromRGB(42,33,42),
button_background_hover = Color3.fromRGB(31,33,40),
button_background_down = Color3.fromRGB(44, 47, 56),
scrollbar_color = Color3.fromRGB(44, 47, 56),
}
finity.dark_theme = { -- dark
main_container = Color3.fromRGB(32, 32, 33),
separator_color = Color3.fromRGB(63, 63, 65),
text_color = Color3.fromRGB(206, 206, 206),
category_button_background = Color3.fromRGB(63, 62, 65),
category_button_border = Color3.fromRGB(72, 71, 74),
checkbox_checked = Color3.fromRGB(132, 255, 130),
checkbox_outer = Color3.fromRGB(84, 81, 86),
checkbox_inner = Color3.fromRGB(132, 132, 136),
slider_color = Color3.fromRGB(177, 177, 177),
slider_color_sliding = Color3.fromRGB(132, 255, 130),
slider_background = Color3.fromRGB(88, 84, 90),
slider_text = Color3.fromRGB(177, 177, 177),
textbox_background = Color3.fromRGB(103, 103, 106),
textbox_background_hover = Color3.fromRGB(137, 137, 141),
textbox_text = Color3.fromRGB(195, 195, 195),
textbox_text_hover = Color3.fromRGB(232, 232, 232),
textbox_placeholder = Color3.fromRGB(135, 135, 138),
dropdown_background = Color3.fromRGB(88, 88, 91),
dropdown_text = Color3.fromRGB(195, 195, 195),
dropdown_text_hover = Color3.fromRGB(232, 232, 232),
dropdown_scrollbar_color = Color3.fromRGB(118, 118, 121),
button_background = Color3.fromRGB(103, 103, 106),
button_background_hover = Color3.fromRGB(137, 137, 141),
button_background_down = Color3.fromRGB(70, 70, 81),
scrollbar_color = Color3.fromRGB(118, 118, 121),
}
setmetatable(finity.gs, {
__index = function(_, service)
return game:GetService(service)
end,
__newindex = function(t, i)
t[i] = nil
return
end
})
local mouse = finity.gs["Players"].LocalPlayer:GetMouse()
function finity:Create(class, properties)
local object = Instance.new(class)
for prop, val in next, properties do
if object[prop] and prop ~= "Parent" then
object[prop] = val
end
end
return object
end
function finity:addShadow(object, transparency)
local shadow = self:Create("ImageLabel", {
Name = "Shadow",
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Position = UDim2.new(0.5, 0, 0.5, 4),
Size = UDim2.new(1, 6, 1, 6),
Image = "rbxassetid://1316045217",
ImageTransparency = transparency and true or 0.5,
ImageColor3 = Color3.fromRGB(35, 35, 35),
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(10, 10, 118, 118)
})
shadow.Parent = object
end
function finity.new(isdark, gprojectName, thinProject)
local finityObject = {}
local self2 = finityObject
local self = finity
local theme = finity.theme
local projectName = false
local thinMenu = false
if isdark == true then theme = finity.dark_theme end
if gprojectName then projectName = gprojectName end
if thinProject then thinMenu = thinProject end
local toggled = true
local typing = false
local firstCategory = true
local savedposition = UDim2.new(0.5, 0, 0.5, 0)
local finityData
finityData = {
UpConnection = nil,
ToggleKey = Enum.KeyCode.Home,
}
self2.ChangeToggleKey = function(NewKey)
finityData.ToggleKey = NewKey
if not projectName then
self2.tip.Text = "Press '".. string.sub(tostring(NewKey), 14) .."' to hide this menu"
end
if finityData.UpConnection then
finityData.UpConnection:Disconnect()
end
finityData.UpConnection = finity.gs["UserInputService"].InputEnded:Connect(function(Input)
if Input.KeyCode == finityData.ToggleKey and not typing then
toggled = not toggled
pcall(function() self2.modal.Modal = toggled end)
if toggled then
pcall(self2.container.TweenPosition, self2.container, savedposition, "Out", "Sine", 0.5, true)
else
savedposition = self2.container.Position;
pcall(self2.container.TweenPosition, self2.container, UDim2.new(savedposition.Width.Scale, savedposition.Width.Offset, 1.5, 0), "Out", "Sine", 0.5, true)
end
end
end)
end
self2.ChangeBackgroundImage = function(ImageID, Transparency)
self2.container.Image = ImageID
if Transparency then
self2.container.ImageTransparency = Transparency
else
self2.container.ImageTransparency = 0.8
end
end
finityData.UpConnection = finity.gs["UserInputService"].InputEnded:Connect(function(Input)
if Input.KeyCode == finityData.ToggleKey and not typing then
toggled = not toggled
if toggled then
self2.container:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Sine", 0.5, true)
else
self2.container:TweenPosition(UDim2.new(0.5, 0, 1.5, 0), "Out", "Sine", 0.5, true)
end
end
end)
self2.userinterface = self:Create("ScreenGui", {
Name = PROTECT_NAME,
ZIndexBehavior = Enum.ZIndexBehavior.Global,
ResetOnSpawn = false,
})
self2.container = self:Create("ImageLabel", {
Draggable = true,
Active = true,
Name = "Container",
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 0,
BackgroundColor3 = theme.main_container,
BorderSizePixel = 0,
Position = UDim2.new(0.5, 0, 0.5, 0),
Size = UDim2.new(0, 800, 0, 500),
ZIndex = 2,
ImageTransparency = 1
})
self2.modal = self:Create("TextButton", {
Text = "";
Transparency = 1;
Modal = true;
}) self2.modal.Parent = self2.userinterface;
if thinProject and typeof(thinProject) == "UDim2" then
self2.container.Size = thinProject
end
self2.container.Draggable = true
self2.container.Active = true
self2.sidebar = self:Create("Frame", {
Name = "Sidebar",
BackgroundColor3 = Color3.new(0.976471, 0.937255, 1),
BackgroundTransparency = 1,
BorderColor3 = Color3.new(0.745098, 0.713726, 0.760784),
Size = UDim2.new(0, 120, 1, -30),
Position = UDim2.new(0, 0, 0, 30),
ZIndex = 2,
})
self2.categories = self:Create("Frame", {
Name = "Categories",
BackgroundColor3 = Color3.new(0.976471, 0.937255, 1),
ClipsDescendants = true,
BackgroundTransparency = 1,
BorderColor3 = Color3.new(0.745098, 0.713726, 0.760784),
Size = UDim2.new(1, -120, 1, -30),
AnchorPoint = Vector2.new(1, 0),
Position = UDim2.new(1, 0, 0, 30),
ZIndex = 2,
})
self2.categories.ClipsDescendants = true
self2.topbar = self:Create("Frame", {
Name = "Topbar",
ZIndex = 2,
Size = UDim2.new(1,0,0,30),
BackgroundTransparency = 2
})
self2.tip = self:Create("TextLabel", {
Name = "TopbarTip",
ZIndex = 2,
Size = UDim2.new(1, -30, 0, 30),
Position = UDim2.new(0, 30, 0, 0),
Text = "Press '".. string.sub(tostring(self.ToggleKey), 14) .."' to hide this menu",
Font = Enum.Font.GothamSemibold,
TextSize = 13,
TextXAlignment = Enum.TextXAlignment.Left,
BackgroundTransparency = 1,
TextColor3 = theme.text_color,
})
if projectName then
self2.tip.Text = projectName
else
self2.tip.Text = "Press '".. string.sub(tostring(self.ToggleKey), 14) .."' to hide this menu"
end
function finity.settitle(text)
self2.tip.Text = tostring(text)
end
local separator = self:Create("Frame", {
Name = "Separator",
BackgroundColor3 = theme.separator_color,
BorderSizePixel = 0,
Position = UDim2.new(0, 118, 0, 30),
Size = UDim2.new(0, 1, 1, -30),
ZIndex = 6,
})
separator.Parent = self2.container
separator = nil
local separator = self:Create("Frame", {
Name = "Separator",
BackgroundColor3 = theme.separator_color,
BorderSizePixel = 0,
Position = UDim2.new(0, 0, 0, 30),
Size = UDim2.new(1, 0, 0, 1),
ZIndex = 6,
})
separator.Parent = self2.container
separator = nil
local uipagelayout = self:Create("UIPageLayout", {
Padding = UDim.new(0, 10),
FillDirection = Enum.FillDirection.Vertical,
TweenTime = 0.7,
EasingStyle = Enum.EasingStyle.Quad,
EasingDirection = Enum.EasingDirection.InOut,
SortOrder = Enum.SortOrder.LayoutOrder,
})
uipagelayout.Parent = self2.categories
uipagelayout = nil
local uipadding = self:Create("UIPadding", {
PaddingTop = UDim.new(0, 3),
PaddingLeft = UDim.new(0, 2)
})
uipadding.Parent = self2.sidebar
uipadding = nil
local uilistlayout = self:Create("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder
})
uilistlayout.Parent = self2.sidebar
uilistlayout = nil
function self2:Category(name)
local category = {}
category.button = finity:Create("TextButton", {
Name = name,
BackgroundColor3 = theme.category_button_background,
BackgroundTransparency = 1,
BorderMode = Enum.BorderMode.Inset,
BorderColor3 = theme.category_button_border,
Size = UDim2.new(1, -4, 0, 25),
ZIndex = 2,
AutoButtonColor = false,
Font = Enum.Font.GothamSemibold,
Text = name,
TextColor3 = theme.text_color,
TextSize = 14
})
category.container = finity:Create("ScrollingFrame", {
Name = name,
BackgroundTransparency = 1,
ScrollBarThickness = 4,
BorderSizePixel = 0,
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 2,
CanvasSize = UDim2.new(0, 0, 0, 0),
ScrollBarImageColor3 = theme.scrollbar_color or Color3.fromRGB(118, 118, 121),
BottomImage = "rbxassetid://967852042",
MidImage = "rbxassetid://967852042",
TopImage = "rbxassetid://967852042",
ScrollBarImageTransparency = 1 --
})
category.hider = finity:Create("Frame", {
Name = "Hider",
BackgroundTransparency = 0, --
BorderSizePixel = 0,
BackgroundColor3 = theme.main_container,
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 5
})
category.L = finity:Create("Frame", {
Name = "L",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0, 10, 0, 3),
Size = UDim2.new(0.5, -20, 1, -3),
ZIndex = 2
})
if not thinProject then
category.R = finity:Create("Frame", {
Name = "R",
AnchorPoint = Vector2.new(1, 0),
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(1, -10, 0, 3),
Size = UDim2.new(0.5, -20, 1, -3),
ZIndex = 2
})
end
if thinProject then
category.L.Size = UDim2.new(1, -20, 1, -3)
end
if firstCategory then
finity.gs["TweenService"]:Create(category.hider, TweenInfo.new(0.3), {BackgroundTransparency = 1}):Play()
finity.gs["TweenService"]:Create(category.container, TweenInfo.new(0.3), {ScrollBarImageTransparency = 0}):Play()
end
do
local uilistlayout = finity:Create("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder
})
local uilistlayout2 = finity:Create("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder
})
local function computeSizeChange()
local largestListSize = 0
largestListSize = uilistlayout.AbsoluteContentSize.Y
if uilistlayout2.AbsoluteContentSize.Y > largestListSize then
largestListSize = largestListSize
end
category.container.CanvasSize = UDim2.new(0, 0, 0, largestListSize + 5)
end
uilistlayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(computeSizeChange)
uilistlayout2:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(computeSizeChange)
uilistlayout.Parent = category.L
uilistlayout2.Parent = category.R
end
category.button.MouseEnter:Connect(function()
finity.gs["TweenService"]:Create(category.button, TweenInfo.new(0.2), {BackgroundTransparency = 0.5}):Play()
end)
category.button.MouseLeave:Connect(function()
finity.gs["TweenService"]:Create(category.button, TweenInfo.new(0.2), {BackgroundTransparency = 1}):Play()
end)
category.button.MouseButton1Down:Connect(function()
for _, categoryf in next, self2.userinterface["Container"]["Categories"]:GetChildren() do
if categoryf:IsA("ScrollingFrame") then
if categoryf ~= category.container then
finity.gs["TweenService"]:Create(categoryf.Hider, TweenInfo.new(0.3), {BackgroundTransparency = 0}):Play()
finity.gs["TweenService"]:Create(categoryf, TweenInfo.new(0.3), {ScrollBarImageTransparency = 1}):Play()
end
end
end
finity.gs["TweenService"]:Create(category.button, TweenInfo.new(0.2), {BackgroundTransparency = 0.2}):Play()
finity.gs["TweenService"]:Create(category.hider, TweenInfo.new(0.3), {BackgroundTransparency = 1}):Play()
finity.gs["TweenService"]:Create(category.container, TweenInfo.new(0.3), {ScrollBarImageTransparency = 0}):Play()
self2.categories["UIPageLayout"]:JumpTo(category.container)
end)
category.button.MouseButton1Up:Connect(function()
finity.gs["TweenService"]:Create(category.button, TweenInfo.new(0.2), {BackgroundTransparency = 1}):Play()
end)
category.container.Parent = self2.categories
category.button.Parent = self2.sidebar
if not thinProject then
category.R.Parent = category.container
end
category.L.Parent = category.container
category.hider.Parent = category.container
local function calculateSector()
if thinProject then
return "L"
end
local R = #category.R:GetChildren() - 1
local L = #category.L:GetChildren() - 1
if L > R then
return "R"
else
return "L"
end
end
function category:Sector(name)
local sector = {}
sector.frame = finity:Create("Frame", {
Name = name,
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 0, 25),
ZIndex = 2
})
sector.container = finity:Create("Frame", {
Name = "Container",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0, 0, 0, 22),
Size = UDim2.new(1, -5, 1, -30),
ZIndex = 2
})
sector.title = finity:Create("TextLabel", {
Name = "Title",
Text = name,
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(1, -5, 0, 25),
ZIndex = 2,
Font = Enum.Font.GothamSemibold,
TextColor3 = theme.text_color,
TextSize = 14,
TextXAlignment = Enum.TextXAlignment.Left,
})
local uilistlayout = finity:Create("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder
})
uilistlayout.Changed:Connect(function()
pcall(function()
sector.frame.Size = UDim2.new(1, 0, 0, sector.container["UIListLayout"].AbsoluteContentSize.Y + 25)
sector.container.Size = UDim2.new(1, 0, 0, sector.container["UIListLayout"].AbsoluteContentSize.Y)
end)
end)
uilistlayout.Parent = sector.container
uilistlayout = nil
function sector:Cheat(kind, name, callback, data)
local cheat = {}
cheat.value = nil
cheat.frame = finity:Create("Frame", {
Name = name,
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 0, 25),
ZIndex = 2,
})
cheat.label = finity:Create("TextLabel", {
Name = "Title",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 2,
Font = Enum.Font.Gotham,
TextColor3 = theme.text_color,
TextSize = 13,
Text = name,
TextXAlignment = Enum.TextXAlignment.Left
})
cheat.container = finity:Create("Frame", {
Name = "Container",
AnchorPoint = Vector2.new(1, 0.5),
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(1, 0, 0.5, 0),
Size = UDim2.new(0, 150, 0, 22),
ZIndex = 2,
})
if kind then
if string.lower(kind) == "checkbox" or string.lower(kind) == "toggle" then
if data then
if data.enabled then
cheat.value = true
end
end
cheat.checkbox = finity:Create("Frame", {
Name = "Checkbox",
AnchorPoint = Vector2.new(1, 0),
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(1, 0, 0, 0),
Size = UDim2.new(0, 25, 0, 25),
ZIndex = 2,
})
cheat.outerbox = finity:Create("ImageLabel", {
Name = "Outer",
AnchorPoint = Vector2.new(1, 0.5),
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(1, 0, 0.5, 0),
Size = UDim2.new(0, 20, 0, 20),
ZIndex = 2,
Image = "rbxassetid://3570695787",
ImageColor3 = theme.checkbox_outer,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(100, 100, 100, 100),
SliceScale = 0.06,
})
cheat.checkboxbutton = finity:Create("ImageButton", {
AnchorPoint = Vector2.new(0.5, 0.5),
Name = "CheckboxButton",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0.5, 0, 0.5, 0),
Size = UDim2.new(0, 14, 0, 14),
ZIndex = 2,
Image = "rbxassetid://3570695787",
ImageColor3 = theme.checkbox_inner,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(100, 100, 100, 100),
SliceScale = 0.04
})
if data then
if data.enabled then
finity.gs["TweenService"]:Create(cheat.outerbox, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_checked}):Play()
finity.gs["TweenService"]:Create(cheat.checkboxbutton, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_checked}):Play()
end
end
cheat.checkboxbutton.MouseEnter:Connect(function()
local lightertheme = Color3.fromRGB((theme.checkbox_outer.R * 255) + 20, (theme.checkbox_outer.G * 255) + 20, (theme.checkbox_outer.B * 255) + 20)
finity.gs["TweenService"]:Create(cheat.outerbox, TweenInfo.new(0.2), {ImageColor3 = lightertheme}):Play()
end)
cheat.checkboxbutton.MouseLeave:Connect(function()
if not cheat.value then
finity.gs["TweenService"]:Create(cheat.outerbox, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_outer}):Play()
else
finity.gs["TweenService"]:Create(cheat.outerbox, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_checked}):Play()
end
end)
cheat.checkboxbutton.MouseButton1Down:Connect(function()
if cheat.value then
finity.gs["TweenService"]:Create(cheat.checkboxbutton, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_outer}):Play()
else
finity.gs["TweenService"]:Create(cheat.checkboxbutton, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_checked}):Play()
end
end)
cheat.checkboxbutton.MouseButton1Up:Connect(function()
cheat.value = not cheat.value
if callback then
local s, e = pcall(function()
callback(cheat.value)
end)
if not s then warn("error: ".. e) end
end
if cheat.value then
finity.gs["TweenService"]:Create(cheat.outerbox, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_checked}):Play()
else
finity.gs["TweenService"]:Create(cheat.outerbox, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_outer}):Play()
finity.gs["TweenService"]:Create(cheat.checkboxbutton, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_inner}):Play()
end
end)
cheat.checkboxbutton.Parent = cheat.outerbox
cheat.outerbox.Parent = cheat.container
elseif string.lower(kind) == "color" or string.lower(kind) == "colorpicker" then
cheat.value = Color3.new(1, 1, 1);
if data then
if data.color then
cheat.value = data.color
end
end
local hsvimage = "rbxassetid://4613607014"
local lumienceimage = "rbxassetid://4613627894"
cheat.hsvbar = finity:Create("ImageButton", {
AnchorPoint = Vector2.new(0.5, 0.5),
Name = "HSVBar",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0.5, 0, 0.5, 0),
Size = UDim2.new(1, 0, 0, 6),
ZIndex = 2,
Image = hsvimage
})
cheat.arrowpreview = finity:Create("ImageLabel", {
Name = "ArrowPreview",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
ImageTransparency = 0.25,
Position = UDim2.new(0.5, 0, 0.5, -6),
Size = UDim2.new(0, 6, 0, 6),
ZIndex = 3,
Image = "rbxassetid://2500573769",
Rotation = -90
})
cheat.hsvbar.MouseButton1Down:Connect(function()
local rs = finity.gs["RunService"]
local uis = finity.gs["UserInputService"]local last = cheat.value;
cheat.hsvbar.Image = hsvimage
while uis:IsMouseButtonPressed'MouseButton1' do
local mouseloc = uis:GetMouseLocation()
local sx = cheat.arrowpreview.AbsoluteSize.X / 2;
local offset = (mouseloc.x - cheat.hsvbar.AbsolutePosition.X) - sx
local scale = offset / cheat.hsvbar.AbsoluteSize.X
local position = math.clamp(offset, -sx, cheat.hsvbar.AbsoluteSize.X - sx) / cheat.hsvbar.AbsoluteSize.X
finity.gs["TweenService"]:Create(cheat.arrowpreview, TweenInfo.new(0.1), {Position = UDim2.new(position, 0, 0.5, -6)}):Play()
cheat.value = Color3.fromHSV(math.clamp(scale, 0, 1), 1, 1)
if cheat.value ~= last then
last = cheat.value
if callback then
local s, e = pcall(function()
callback(cheat.value)
end)
if not s then warn("error: ".. e) end
end
end
rs.RenderStepped:wait()
end
end)
cheat.hsvbar.MouseButton2Down:Connect(function()
local rs = finity.gs["RunService"]
local uis = finity.gs["UserInputService"]
local last = cheat.value;
cheat.hsvbar.Image = lumienceimage
while uis:IsMouseButtonPressed'MouseButton2' do
local mouseloc = uis:GetMouseLocation()
local sx = cheat.arrowpreview.AbsoluteSize.X / 2
local offset = (mouseloc.x - cheat.hsvbar.AbsolutePosition.X) - sx
local scale = offset / cheat.hsvbar.AbsoluteSize.X
local position = math.clamp(offset, -sx, cheat.hsvbar.AbsoluteSize.X - sx) / cheat.hsvbar.AbsoluteSize.X
finity.gs["TweenService"]:Create(cheat.arrowpreview, TweenInfo.new(0.1), {Position = UDim2.new(position, 0, 0.5, -6)}):Play()
cheat.value = Color3.fromHSV(1, 0, 1 - math.clamp(scale, 0, 1))
if cheat.value ~= last then
last = cheat.value
if callback then
local s, e = pcall(function()
callback(cheat.value)
end)
if not s then warn("error: ".. e) end
end
end
rs.RenderStepped:wait()
end
end)
function cheat:SetValue(value)
cheat.value = value
if cheat.value then
finity.gs["TweenService"]:Create(cheat.outerbox, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_checked}):Play()
finity.gs["TweenService"]:Create(cheat.checkboxbutton, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_checked}):Play()
else
finity.gs["TweenService"]:Create(cheat.outerbox, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_outer}):Play()
finity.gs["TweenService"]:Create(cheat.checkboxbutton, TweenInfo.new(0.2), {ImageColor3 = theme.checkbox_inner}):Play()
end
if callback then
local s, e = pcall(function()
callback(cheat.value)
end)
if not s then
warn("error: "..e)
end
end
end
cheat.hsvbar.Parent = cheat.container
cheat.arrowpreview.Parent = cheat.hsvbar
elseif string.lower(kind) == "dropdown" then
if data then
if data.default then
cheat.value = data.default
elseif data.options then
cheat.value = data.options[1]
else
cheat.value = "None"
end
end
local options
if data and data.options then
options = data.options
end
cheat.dropped = false
cheat.dropdown = finity:Create("ImageButton", {
Name = "Dropdown",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 2,
Image = "rbxassetid://3570695787",
ImageColor3 = theme.dropdown_background,
ImageTransparency = 0.5,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(100, 100, 100, 100),
SliceScale = 0.02
})
cheat.selected = finity:Create("TextLabel", {
Name = "Selected",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0, 10, 0, 0),
Size = UDim2.new(1, -35, 1, 0),
ZIndex = 2,
Font = Enum.Font.Gotham,
Text = tostring(cheat.value),
TextColor3 = theme.dropdown_text,
TextSize = 13,
TextXAlignment = Enum.TextXAlignment.Left
})
cheat.list = finity:Create("ScrollingFrame", {
Name = "List",
BackgroundColor3 = theme.dropdown_background,
BackgroundTransparency = 0.5,
BorderSizePixel = 0,
Position = UDim2.new(0, 0, 1, 0),
Size = UDim2.new(1, 0, 0, 100),
ZIndex = 3,
BottomImage = "rbxassetid://967852042",
MidImage = "rbxassetid://967852042",
TopImage = "rbxassetid://967852042",
ScrollBarThickness = 4,
VerticalScrollBarInset = Enum.ScrollBarInset.None,
ScrollBarImageColor3 = theme.dropdown_scrollbar_color
})
local uilistlayout = finity:Create("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
Padding = UDim.new(0, 2)
})
uilistlayout.Parent = cheat.list
uilistlayout = nil
local uipadding = finity:Create("UIPadding", {
PaddingLeft = UDim.new(0, 2)
})
uipadding.Parent = cheat.list
uipadding = nil
local function refreshOptions()
if cheat.dropped then
cheat.fadelist()
end
for _, child in next, cheat.list:GetChildren() do
if child:IsA("TextButton") then
child:Destroy()
end
end
for _, value in next, options do
local button = finity:Create("TextButton", {
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 0, 20),
ZIndex = 3,
Font = Enum.Font.Gotham,
Text = value,
TextColor3 = theme.dropdown_text,
TextSize = 13
})
button.Parent = cheat.list
button.MouseEnter:Connect(function()
finity.gs["TweenService"]:Create(button, TweenInfo.new(0.1), {TextColor3 = theme.dropdown_text_hover}):Play()
end)
button.MouseLeave:Connect(function()
finity.gs["TweenService"]:Create(button, TweenInfo.new(0.1), {TextColor3 = theme.dropdown_text}):Play()
end)
button.MouseButton1Click:Connect(function()
if cheat.dropped then
cheat.value = value
cheat.selected.Text = value
cheat.fadelist()
if callback then
local s, e = pcall(function()
callback(cheat.value)
end)
if not s then warn("error: ".. e) end
end
end
end)
finity.gs["TweenService"]:Create(button, TweenInfo.new(0), {TextTransparency = 1}):Play()
end
finity.gs["TweenService"]:Create(cheat.list, TweenInfo.new(0), {Size = UDim2.new(1, 0, 0, 0), Position = UDim2.new(0, 0, 1, 0), CanvasSize = UDim2.new(0, 0, 0, cheat.list["UIListLayout"].AbsoluteContentSize.Y), ScrollBarImageTransparency = 1, BackgroundTransparency = 1}):Play()
end
function cheat.fadelist()
cheat.dropped = not cheat.dropped
if cheat.dropped then
for _, button in next, cheat.list:GetChildren() do
if button:IsA("TextButton") then
finity.gs["TweenService"]:Create(button, TweenInfo.new(0.2), {TextTransparency = 0}):Play()
end
end
finity.gs["TweenService"]:Create(cheat.list, TweenInfo.new(0.2), {Size = UDim2.new(1, 0, 0, math.clamp(cheat.list["UIListLayout"].AbsoluteContentSize.Y, 0, 150)), Position = UDim2.new(0, 0, 1, 0), ScrollBarImageTransparency = 0, BackgroundTransparency = 0.5}):Play()
else
for _, button in next, cheat.list:GetChildren() do
if button:IsA("TextButton") then
finity.gs["TweenService"]:Create(button, TweenInfo.new(0.2), {TextTransparency = 1}):Play()
end
end
finity.gs["TweenService"]:Create(cheat.list, TweenInfo.new(0.2), {Size = UDim2.new(1, 0, 0, 0), Position = UDim2.new(0, 0, 1, 0), ScrollBarImageTransparency = 1, BackgroundTransparency = 1}):Play()
end
end
cheat.dropdown.MouseEnter:Connect(function()
finity.gs["TweenService"]:Create(cheat.selected, TweenInfo.new(0.1), {TextColor3 = theme.dropdown_text_hover}):Play()
end)
cheat.dropdown.MouseLeave:Connect(function()
finity.gs["TweenService"]:Create(cheat.selected, TweenInfo.new(0.1), {TextColor3 = theme.dropdown_text}):Play()
end)
cheat.dropdown.MouseButton1Click:Connect(function()
cheat.fadelist()
end)
refreshOptions()
function cheat:RemoveOption(value)
local removed = false
for index, option in next, options do
if option == value then
table.remove(options, index)
removed = true
break
end
end
if removed then
refreshOptions()
end
return removed
end
function cheat:AddOption(value)
table.insert(options, value)
refreshOptions()
end
function cheat:SetValue(value)
cheat.selected.Text = value
cheat.value = value
if cheat.dropped then
cheat.fadelist()
end
if callback then
local s, e = pcall(function()
callback(cheat.value)
end)
if not s then warn("error: ".. e) end
end
end
cheat.selected.Parent = cheat.dropdown
cheat.dropdown.Parent = cheat.container
cheat.list.Parent = cheat.container
elseif string.lower(kind) == "textbox" then
local placeholdertext = data and data.placeholder
cheat.background = finity:Create("ImageLabel", {
Name = "Background",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 2,
Image = "rbxassetid://3570695787",
ImageColor3 = theme.textbox_background,
ImageTransparency = 0.5,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(100, 100, 100, 100),
SliceScale = 0.02
})
cheat.textbox = finity:Create("TextBox", {
Name = "Textbox",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0, 0, 0, 0),
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 2,
Font = Enum.Font.Gotham,
Text = "",
TextColor3 = theme.textbox_text,
PlaceholderText = placeholdertext or "Value",
TextSize = 13,
TextXAlignment = Enum.TextXAlignment.Center,
ClearTextOnFocus = false
})
cheat.background.MouseEnter:Connect(function()
finity.gs["TweenService"]:Create(cheat.textbox, TweenInfo.new(0.1), {TextColor3 = theme.textbox_text_hover}):Play()
end)
cheat.background.MouseLeave:Connect(function()
finity.gs["TweenService"]:Create(cheat.textbox, TweenInfo.new(0.1), {TextColor3 = theme.textbox_text}):Play()
end)
cheat.textbox.Focused:Connect(function()
typing = true
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.textbox_background_hover}):Play()
end)
cheat.textbox.FocusLost:Connect(function()
typing = false
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.textbox_background}):Play()
finity.gs["TweenService"]:Create(cheat.textbox, TweenInfo.new(0.1), {TextColor3 = theme.textbox_text}):Play()
cheat.value = cheat.textbox.Text
if callback then
local s, e = pcall(function()
callback(cheat.value)
end)
if not s then warn("error: "..e) end
end
end)
function cheat:SetValue(value)
cheat.value = tostring(value)
cheat.textbox.Text = tostring(value)
end
cheat.background.Parent = cheat.container
cheat.textbox.Parent = cheat.container
elseif string.lower(kind) == "slider" then
cheat.value = 0
local suffix = data.suffix or ""
local minimum = data.min or 0
local maximum = data.max or 1
local default = data.default
local precise = data.precise
local moveconnection
local releaseconnection
cheat.sliderbar = finity:Create("ImageButton", {
Name = "Sliderbar",
AnchorPoint = Vector2.new(1, 0.5),
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(1, 0, 0.5, 0),
Size = UDim2.new(1, 0, 0, 6),
ZIndex = 2,
Image = "rbxassetid://3570695787",
ImageColor3 = theme.slider_background,
ImageTransparency = 0.5,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(100, 100, 100, 100),
SliceScale = 0.02,
})
cheat.numbervalue = finity:Create("TextLabel", {
Name = "Value",
AnchorPoint = Vector2.new(0, 0.5),
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0.5, 5, 0.5, 0),
Size = UDim2.new(1, 0, 0, 13),
ZIndex = 2,
Font = Enum.Font.Gotham,
TextXAlignment = Enum.TextXAlignment.Left,
Text = "",
TextTransparency = 1,
TextColor3 = theme.slider_text,
TextSize = 13,
})
cheat.visiframe = finity:Create("ImageLabel", {
Name = "Frame",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(0.5, 0, 1, 0),
ZIndex = 2,
Image = "rbxassetid://3570695787",
ImageColor3 = theme.slider_color,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(100, 100, 100, 100),
SliceScale = 0.02
})
if data.default then
local size = math.clamp(data.default - cheat.sliderbar.AbsolutePosition.X, 0, 150)
local percent = size / 150
local perc = default/maximum
cheat.value = math.floor((minimum + (maximum - minimum) * percent) * 100) / 100
finity.gs["TweenService"]:Create(cheat.visiframe, TweenInfo.new(0.1), {
Size = UDim2.new(perc, 0, 1, 0),
}):Play()
if callback then
local s, e = pcall(function()
callback(cheat.value)
end)
if not s then warn("error: ".. e) end
end
end
function cheat:SetValue(value)
local size = math.clamp(value - cheat.sliderbar.AbsolutePosition.X, 0, 150)
local percent = size / 150
local perc = default/maximum
cheat.value = math.floor((minimum + (maximum - minimum) * percent) * 100) / 100
finity.gs["TweenService"]:Create(cheat.visiframe, TweenInfo.new(0.1), {
Size = UDim2.new(perc, 0, 1, 0),
}):Play()
if callback then
local s, e = pcall(function()
callback(cheat.value)
end)
if not s then warn("error: ".. e) end
end
end
cheat.sliderbar.MouseButton1Down:Connect(function()
local size = math.clamp(mouse.X - cheat.sliderbar.AbsolutePosition.X, 0, 150)
local percent = size / 150
cheat.value = math.floor((minimum + (maximum - minimum) * percent) * 100) / 100
if precise then
cheat.numbervalue.Text = math.ceil(tostring(cheat.value)) .. suffix
else
cheat.numbervalue.Text = tostring(cheat.value) .. suffix
end
if callback then
local s, e = pcall(function()
if data.precise then
callback(cheat.value)
else
callback(math.ceil(cheat.value))
end
end)
if not s then warn("error: ".. e) end
end
finity.gs["TweenService"]:Create(cheat.visiframe, TweenInfo.new(0.1), {
Size = UDim2.new(size / 150, 0, 1, 0),
ImageColor3 = theme.slider_color_sliding
}):Play()
finity.gs["TweenService"]:Create(cheat.numbervalue, TweenInfo.new(0.1), {
Position = UDim2.new(size / 150, 5, 0.5, 0),
TextTransparency = 0
}):Play()
moveconnection = mouse.Move:Connect(function()
local size = math.clamp(mouse.X - cheat.sliderbar.AbsolutePosition.X, 0, 150)
local percent = size / 150
cheat.value = math.floor((minimum + (maximum - minimum) * percent) * 100) / 100
if precise then
cheat.numbervalue.Text = math.ceil(tostring(cheat.value)) .. suffix
else
cheat.numbervalue.Text = tostring(cheat.value) .. suffix
end
if callback then
local s, e = pcall(function()
if data.precise then
callback(cheat.value)
else
callback(math.ceil(cheat.value))
end
end)
if not s then warn("error: ".. e) end
end
finity.gs["TweenService"]:Create(cheat.visiframe, TweenInfo.new(0.1), {
Size = UDim2.new(size / 150, 0, 1, 0),
ImageColor3 = theme.slider_color_sliding
}):Play()
local Position = UDim2.new(size / 150, 5, 0.5, 0);
if Position.Width.Scale >= 0.6 then
Position = UDim2.new(1, -cheat.numbervalue.TextBounds.X, 0.5, 10);
end
finity.gs["TweenService"]:Create(cheat.numbervalue, TweenInfo.new(0.1), {
Position = Position,
TextTransparency = 0
}):Play()
end)
releaseconnection = finity.gs["UserInputService"].InputEnded:Connect(function(Mouse)
if Mouse.UserInputType == Enum.UserInputType.MouseButton1 then
finity.gs["TweenService"]:Create(cheat.visiframe, TweenInfo.new(0.1), {
ImageColor3 = theme.slider_color
}):Play()
finity.gs["TweenService"]:Create(cheat.numbervalue, TweenInfo.new(0.1), {
TextTransparency = 1
}):Play()
moveconnection:Disconnect()
moveconnection = nil
releaseconnection:Disconnect()
releaseconnection = nil
end
end)
end)
cheat.visiframe.Parent = cheat.sliderbar
cheat.numbervalue.Parent = cheat.sliderbar
cheat.sliderbar.Parent = cheat.container
elseif string.lower(kind) == "button" then
local button_text = data and data.text
cheat.background = finity:Create("ImageLabel", {
Name = "Background",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 2,
Image = "rbxassetid://3570695787",
ImageColor3 = theme.button_background,
ImageTransparency = 0.5,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(100, 100, 100, 100),
SliceScale = 0.02
})
cheat.button = finity:Create("TextButton", {
Name = "Button",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0, 0, 0, 0),
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 2,
Font = Enum.Font.Gotham,
Text = button_text or "Button",
TextColor3 = theme.textbox_text,
TextSize = 13,
TextXAlignment = Enum.TextXAlignment.Center
})
cheat.button.MouseEnter:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background_hover}):Play()
end)
cheat.button.MouseLeave:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background}):Play()
end)
cheat.button.MouseButton1Down:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background_down}):Play()
end)
cheat.button.MouseButton1Up:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background}):Play()
if callback then
local s, e = pcall(function()
callback()
end)
if not s then warn("error: ".. e) end
end
end)
function cheat:Fire()
if callback then
local s, e = pcall(function()
callback()
end)
if not s then warn("error: ".. e) end
end
end
cheat.background.Parent = cheat.container
cheat.button.Parent = cheat.container
elseif string.lower(kind) == "keybind" or string.lower(kind) == "bind" then
local callback_bind = data and data.bind
local connection
cheat.holding = false
cheat.background = finity:Create("ImageLabel", {
Name = "Background",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 2,
Image = "rbxassetid://3570695787",
ImageColor3 = theme.button_background,
ImageTransparency = 0.5,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(100, 100, 100, 100),
SliceScale = 0.02
})
cheat.button = finity:Create("TextButton", {
Name = "Button",
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0, 0, 0, 0),
Size = UDim2.new(1, 0, 1, 0),
ZIndex = 2,
Font = Enum.Font.Gotham,
Text = "Click to Bind",
TextColor3 = theme.textbox_text,
TextSize = 13,
TextXAlignment = Enum.TextXAlignment.Center
})
cheat.button.MouseEnter:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background_hover}):Play()
end)
cheat.button.MouseLeave:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background}):Play()
end)
cheat.button.MouseButton1Down:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background_down}):Play()
end)
cheat.button.MouseButton2Down:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background_down}):Play()
end)
cheat.button.MouseButton1Up:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background}):Play()
cheat.button.Text = "Press key..."
if connection then
connection:Disconnect()
connection = nil
end
cheat.holding = false
connection = finity.gs["UserInputService"].InputBegan:Connect(function(Input)
if Input.UserInputType.Name == "Keyboard" and Input.KeyCode ~= finityData.ToggleKey and Input.KeyCode ~= Enum.KeyCode.Backspace then
cheat.button.Text = "Bound to " .. tostring(Input.KeyCode.Name)
if connection then
connection:Disconnect()
connection = nil
end
delay(0, function()
callback_bind = Input.KeyCode
cheat.value = Input.KeyCode
if callback then
local s, e = pcall(function()
callback(Input.KeyCode)
end)
if not s then warn("error: ".. e) end
end
end)
elseif Input.KeyCode == Enum.KeyCode.Backspace then
callback_bind = nil
cheat.button.Text = "Click to Bind"
cheat.value = nil
cheat.holding = false
delay(0, function()
if callback then
local s, e = pcall(function()
callback()
end)
if not s then warn("error: ".. e) end
end
end)
connection:Disconnect()
connection = nil
elseif Input.KeyCode == finityData.ToggleKey then
cheat.button.Text = "Invalid Key";
cheat.value = nil
end
end)
end)
cheat.button.MouseButton2Up:Connect(function()
finity.gs["TweenService"]:Create(cheat.background, TweenInfo.new(0.2), {ImageColor3 = theme.button_background}):Play()
cheat.value = nil
callback_bind = nil
cheat.button.Text = "Click to Bind"
cheat.holding = false
delay(0, function()
if callback then
local s, e = pcall(function()
callback()
end)
if not s then warn("error: ".. e) end
end
end)
if connection then
connection:Disconnect()
connection = nil
end
end)
function cheat:SetValue(value)
cheat.value = tostring(value)
cheat.button.Text = "Bound to " .. tostring(value)
end
finity.gs["UserInputService"].InputBegan:Connect(function(Input, Process)
if callback_bind and Input.KeyCode == callback_bind and not Process then
cheat.holding = true
if callback then
local s, e = pcall(function()
callback(Input.KeyCode)
end)
if not s then warn("error: ".. e) end
end
end
end)
finity.gs["UserInputService"].InputBegan:Connect(function(Input, Process)
if callback_bind and Input.KeyCode == callback_bind and not Process then
cheat.holding = true
end
end)
if callback_bind then
cheat.button.Text = "Bound to " .. tostring(callback_bind.Name)
end
cheat.background.Parent = cheat.container
cheat.button.Parent = cheat.container
end
end
cheat.frame.Parent = sector.container
cheat.label.Parent = cheat.frame
cheat.container.Parent = cheat.frame
return cheat
end
sector.frame.Parent = category[calculateSector()]
sector.container.Parent = sector.frame
sector.title.Parent = sector.frame
return sector
end
firstCategory = false
return category
end
self:addShadow(self2.container, 0)
self2.categories.ClipsDescendants = true
if not finity.gs["RunService"]:IsStudio() then
self2.userinterface.Parent = self.gs["CoreGui"]
else
self2.userinterface.Parent = self.gs["Players"].LocalPlayer:WaitForChild("PlayerGui")
end
self2.container.Parent = self2.userinterface
self2.categories.Parent = self2.container
self2.sidebar.Parent = self2.container
self2.topbar.Parent = self2.container
self2.tip.Parent = self2.topbar
return self2, finityData
end
return finity
|
local M = {}
-- @Summary Sets a vim option
-- @Description Sets specified vim options.
-- @Param opts (table) - table with option as key and value as value
function M.setoption(opts)
for option, value in pairs(opts) do
vim.o[option] = value
end
end
-- @Summary Sets vim option buffer-local
-- @Description Sets specified vim options buffer-local.
-- @Param opts (table) - table with option as key and value as value
function M.buf_setoption(opts)
for option, value in pairs(opts) do
vim.bo[option] = value
end
end
-- @Summary Sets a vim global variable
-- @Description Sets specified variables as global vim variables
-- @Param globs (table) - table with global as key and value as value
function M.setglobal(globs)
for global, value in pairs(globs) do
vim.g[global] = value
end
end
-- @Summary Sets a key mapping
-- @Description Light wrapper around vim.api.nvim_set_keymap(). Automatically sets silent to true.
-- @Param mode (string) - character defining the vim mode. empty for all
-- @Param lhs (string) - the key compbination
-- @Param rhs (string) - the action to execute
-- @Param opts (table) - options passed to the function
function M.map(mode, lhs, rhs, opts)
local options = { silent = true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
-- @Summary Sets a noremap key mapping
-- @Description Light wrapper around vim.api.nvim_set_keymap(). Automatically sets silent and noremap to true.
-- @Param mode (string) - character defining the vim mode. empty for all
-- @Param lhs (string) - the key compbination
-- @Param rhs (string) - the action to execute
-- @Param opts (table) - options passed to the function
function M.noremap(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
-- @Summary Sets a buffer-local noremap key mapping
-- @Description Light wrapper around vim.api.nvim_buf_set_keymap(). Automatically sets silent and noremap to true.
-- @Param mode (string) - character defining the vim mode. empty for all
-- @Param lhs (string) - the key compbination
-- @Param rhs (string) - the action to execute
-- @Param opts (table) - options passed to the function
function M.buf_noremap(bufnr, mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, options)
end
return M
|
-- ----------------------------------------------------------------------------
-- Localized Lua globals.
-- ----------------------------------------------------------------------------
-- Functions
local _G = getfenv(0)
-- Libraries
local format = string.format
local UnitFactionGroup = _G.UnitFactionGroup
-- ----------------------------------------------------------------------------
-- AddOn namespace.
-- ----------------------------------------------------------------------------
local addonname = ...
local AtlasLoot = _G.AtlasLoot
local data = AtlasLoot.ItemDB:Add(addonname)
local AL = AtlasLoot.Locales
local ALIL = AtlasLoot.IngameLocales
local BB = AtlasLoot.LibBabble:Get("LibBabble-Boss-3.0")
local NORMAL_DIFF = data:AddDifficulty(AL["Normal"], "n", nil, 1)
-- change sortorder for factions
local ALLIANCE_DIFF, HORDE_DIFF
if UnitFactionGroup("player") == "Horde" then
HORDE_DIFF = data:AddDifficulty(FACTION_HORDE)
ALLIANCE_DIFF = data:AddDifficulty(FACTION_ALLIANCE)
else
ALLIANCE_DIFF = data:AddDifficulty(FACTION_ALLIANCE)
HORDE_DIFF = data:AddDifficulty(FACTION_HORDE)
end
local NORMAL_ITTYPE = data:AddItemTableType("Item", "Item")
local PRICE_EXTRA_ITTYPE = data:AddExtraItemTableType("Price")
local QUEST_EXTRA_ITTYPE = data:AddExtraItemTableType("Quest")
local PERMRECEVENTS_CONTENT = data:AddContentType(AL["Permanent/Recurring Events"], ATLASLOOT_PERMRECEVENTS_COLOR)
local SEASONALEVENTS_CONTENT = data:AddContentType(AL["Seasonal Events"], ATLASLOOT_SEASONALEVENTS_COLOR)
data["ArgentTournament"] = {
name = AL["Argent Tournament"].." ("..ALIL["Icecrown"]..")",
ContentType = PERMRECEVENTS_CONTENT,
items = {
{ --ArgentTournamentGear
name = AL["Armor"].." / "..AL["Weapons"],
[ALLIANCE_DIFF] = {
{ 1, 45156, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Sash of Shattering Hearts
{ 2, 45181, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Wrap of the Everliving Tree
{ 3, 45159, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Treads of Nimble Evasion
{ 4, 45184, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Cinch of Bonded Servitude
{ 5, 45183, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Treads of the Glorious Spirit
{ 6, 45182, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Gauntlets of Shattered Pride
{ 7, 45160, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Girdle of Valorous Defeat
{ 8, 45163, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Stanchions of Unseatable Furor
{ 9, 45155, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Choker of Spiral Focus
{ 10, 45154, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Necklace of Valiant Blood
{ 11, 45152, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Pendant of Azure Dreams
{ 12, 45153, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Susurrating Shell Necklace
{ 13, 45131, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Jouster's Fury
{ 16, 45078, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Dagger of Lunar Purity
{ 17, 45077, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Dagger of the Rising Moon
{ 18, 45076, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Teldrassil Protector
{ 19, 45075, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Ironforge Smasher
{ 20, 45129, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Gnomeregan Bonechopper
{ 21, 45074, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Claymore of the Prophet
{ 22, 45128, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Silvery Sylvan Stave
{ 23, 45130, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Blunderbuss of Khaz Modan
},
[HORDE_DIFF] = {
{ 1, 45209, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Sash of Trumpeted Pride
{ 2, 45211, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Waistguard of Equine Fury
{ 3, 45220, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Treads of the Earnest Squire
{ 4, 45215, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Links of Unquenched Savagery
{ 5, 45221, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Treads of Whispering Dreams
{ 6, 45216, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Gauntlets of Mending Touch
{ 7, 45217, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Clinch of Savage Fury
{ 8, 45218, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Blood-Caked Stompers
{ 9, 45206, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Choker of Feral Fury
{ 10, 45207, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Necklace of Stolen Skulls
{ 11, 45213, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Pendant of Emerald Crusader
{ 12, 45223, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Razor's Edge Pendant
{ 13, 45219, [PRICE_EXTRA_ITTYPE] = "championsseal:10" }, -- Jouster's Fury
{ 16, 45214, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Scalpel of the Royal Apothecary
{ 17, 45222, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Spinal Destroyer
{ 18, 45204, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Axe of the Sen'jin Protector
{ 19, 45203, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Grimhorn Crusher
{ 20, 45208, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Blade of the Keening Banshee
{ 21, 45205, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Greatsword of the Sin'dorei
{ 22, 45212, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Staff of Feral Furies
{ 23, 45210, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Sen'jin Beakblade Longrifle
},
},
{ --ArgentTournamentHeirloom
name = AL["Heirloom"],
[NORMAL_DIFF] = {
--Upgrade item for armor
{ 1, 122338, [PRICE_EXTRA_ITTYPE] = "championsseal:55" }, -- Ancient Heirloom Armor Casing
--Shoulder
{ 3, 122360, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Tattered Dreadmist Mantle
{ 4, 122359, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Preened Ironfeather Shoulders
{ 5, 122358, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Stained Shadowcraft Spaulders
{ 6, 122356, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Champion Herod's Shoulder
{ 7, 122357, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Mystical Pauldrons of Elements
{ 8, 122388, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Burnished Pauldrons of Might
{ 9, 122355, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Polished Spaulders of Valor
--Chest
{ 18, 122384, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Tattered Dreadmist Robe
{ 19, 122382, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Preened Ironfeather Breastplate
{ 20, 122383, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Stained Shadowcraft Tunic
{ 21, 122379, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Champion's Deathdealer Breastplate
{ 22, 122380, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Mystical Vest of Elements
{ 23, 122387, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Burnished Breastplate of Might
{ 24, 122381, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Polished Breastplate of Valor
--Trinket
{ 11, 122362, [PRICE_EXTRA_ITTYPE] = "championsseal:35" }, -- Discerning Eye of the Beast
{ 26, 122361, [PRICE_EXTRA_ITTYPE] = "championsseal:35" }, -- Swift Hand of Justice
--Upgrade item for weapons
{ 101, 122339, [PRICE_EXTRA_ITTYPE] = "championsseal:65" }, -- Ancient Heirloom Scabbard
--One-hand
{ 103, 122389, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Bloodsoaked Skullforge Reaver
{ 104, 122354, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Devout Aurastone Hammer
{ 105, 122350, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Balanced Heartseeker
{ 106, 122351, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Venerable Dal'Rend's Sacred Charge
{ 107, 122385, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Venerable Mass of McGowan
--Offhand
{ 109, 122391, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Flamescarred Draconian Deflector
{ 110, 122392, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Weathered Observer's Shield
{ 111, 122390, [PRICE_EXTRA_ITTYPE] = "championsseal:25" }, -- Musty Tome of the Lost
--Two-hand
{ 118, 122349, [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Bloodied Arcanite Reaper
{ 119, 122353, [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Dignified Headmaster's Charge
{ 120, 122386, [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Repurposed Lava Dredger
{ 121, 122363, [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Burnished Warden Staff
{ 122, 122352, [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Charmed Ancient Bone Bow
},
},
{ --ArgentTournamentMounts
name = AL["Mounts"],
[ALLIANCE_DIFF] = {
{ 1, 45591, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Darnassian Nightsaber
{ 2, 45590, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Exodar Elekk
{ 3, 45589, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Gnomeregan Mechanostrider
{ 4, 45586, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Ironforge Ram
{ 5, 45125, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Stormwind Steed
{ 7, 46745, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- Great Red Elekk
{ 8, 46752, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- Swift Gray Steed
{ 9, 46744, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- Swift Moonsaber
{ 10, 46748, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- Swift Violet Ram
{ 11, 46747, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- Turbostrider
{ 16, 47179, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Argent Charger
{ 17, 47180, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Argent Warhorse
{ 18, 45725, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:150" }, -- Argent Hippogryph
{ 20, "f1094rep8" },
{ 21, 46815, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Quel'dorei Steed
{ 22, 46813, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:150" }, -- Silver Covenant Hippogryph
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 1, 45593, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Darkspear Raptor
{ 2, 45597, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Forsaken Warhorse
{ 3, 45595, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Orgrimmar Wolf
{ 4, 45596, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Silvermoon Hawkstrider
{ 5, 45592, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Thunder Bluff Kodo
{ 7, 46750, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- Great Golden Kodo
{ 8, 46749, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- Swift Burgundy Wolf
{ 9, 46743, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- Swift Purple Raptor
{ 10, 46751, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- Swift Red Hawkstrider
{ 11, 46746, "mount", [PRICE_EXTRA_ITTYPE] = "money:5000000:championsseal:5" }, -- White Skeletal Warhorse
{ 20, "f1124rep8" },
{ 21, 46816, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:100" }, -- Sunreaver Hawkstrider
{ 22, 46814, "mount", [PRICE_EXTRA_ITTYPE] = "championsseal:150" }, -- Sunreaver Dragonhawk
},
},
{ --ArgentTournamentPets
name = AL["Pets"],
[ALLIANCE_DIFF] = {
{ 1, 44998, "pet214" }, -- Argent Squire
{ 2, 44984, "pet212", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Ammen Vale Lashling
{ 3, 44970, "pet205", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Dun Morogh Cub
{ 4, 44974, "pet209", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Elwynn Lamb
{ 5, 45002, "pet215", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Mechanopeep
{ 6, 44965, "pet204", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Teldrassil Sproutling
{ 7, 46820, "pet229", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Shimmering Wyrmling
{ 9, 47541, [PRICE_EXTRA_ITTYPE] = "championsseal:150" }, -- Argent Pony Bridle
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 1, 45022, "pet216" }, -- Argent Gruntling
{ 2, 44973, "pet207", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Durotar Scorpion
{ 3, 44982, "pet213", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Enchanted Broom
{ 4, 44980, "pet210", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Mulgore Hatchling
{ 5, 45606, "pet218", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Sen'jin Fetish
{ 6, 44971, "pet206", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Tirisfal Batling
{ 7, 46821, "pet229", [PRICE_EXTRA_ITTYPE] = "championsseal:40" }, -- Shimmering Wyrmling
},
},
{ --ArgentTournamentMisc
name = AL["Miscellaneous"],
[ALLIANCE_DIFF] = {
{ 1, 45714, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Darnassus Commendation Badge
{ 2, 45715, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Exodar Commendation Badge
{ 3, 45716, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Gnomeregan Commendation Badge
{ 5, 46874, [PRICE_EXTRA_ITTYPE] = "championsseal:50" }, -- Argent Crusader's Tabard
{ 6, 45579, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Darnassus Tabard
{ 7, 45580, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Exodar Tabard
{ 8, 45578, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Gnomeregan Tabard
{ 9, 45577, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Ironforge Tabard
{ 10, 45574, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Stormwind Tabard
{ 11, 46817, [PRICE_EXTRA_ITTYPE] = "championsseal:50" }, -- Silver Covenant Tabard
{ 16, 45717, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Ironforge Commendation Badge
{ 17, 45718, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Stormwind Commendation Badge
{ 20, 46843, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Argent Crusader's Banner
{ 21, 45021, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Darnassus Banner
{ 22, 45020, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Exodar Banner
{ 23, 45019, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Gnomeregan Banner
{ 24, 45018, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Ironforge Banner
{ 25, 45011, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Stormwind Banner
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 1, 45719, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Orgrimmar Commendation Badge
{ 2, 45720, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Sen'jin Commendation Badge
{ 3, 45721, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Silvermoon Commendation Badge
{ 6, 45582, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Darkspear Tabard
{ 7, 45581, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Orgrimmar Tabard
{ 8, 45585, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Silvermoon City Tabard
{ 9, 45584, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Thunder Bluff Tabard
{ 10, 45583, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Undercity Tabard
{ 11, 46818, [PRICE_EXTRA_ITTYPE] = "championsseal:50" }, -- Sunreaver Tabard
{ 16, 45723, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Undercity Commendation Badge
{ 17, 45722, [PRICE_EXTRA_ITTYPE] = "46114:1" }, -- Thunder Bluff Commendation Badge
{ 21, 45014, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Orgrimmar Banner
{ 22, 45015, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Sen'jin Banner
{ 23, 45017, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Silvermoon City Banner
{ 24, 45013, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Thunder Bluff Banner
{ 25, 45016, [PRICE_EXTRA_ITTYPE] = "championsseal:15" }, -- Undercity Banner
},
},
}
}
data["BrawlersGuild"] = {
name = ALIL["Bizmo's Brawlpub"].." / "..ALIL["Brawl'gar Arena"],
ContentType = PERMRECEVENTS_CONTENT,
items = {
{ --Rank1-4
name = format(AL["Rank %d"], 1).." - "..format(AL["Rank %d"], 4),
[ALLIANCE_DIFF] = {
--{ 1, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 2), nil },
-- no longer available { 2, 118907, [PRICE_EXTRA_ITTYPE] = "money:200000000" }, -- Pit Fighter's Punching Ring
{ 1, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 3), nil },
{ 2, 93025, "pet1142", [PRICE_EXTRA_ITTYPE] = "money:3000" }, -- Clock'em
{ 3, 144394, "pet2022", [PRICE_EXTRA_ITTYPE] = "money:5000000" }, -- Tylarr Gronnden, Added in patch 7.1.5.23360
{ 16, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 4), nil },
--[[ no longer available
{ 17, 98079, [QUEST_EXTRA_ITTYPE] = 32837 }, -- Floot-Tooter's Tunic
{ 18, 98081, [QUEST_EXTRA_ITTYPE] = 32841 }, -- The Boomshirt
{ 19, 98082, [QUEST_EXTRA_ITTYPE] = 32859 }, -- Undisputed Champion's Shirt
{ 20, 118913, [PRICE_EXTRA_ITTYPE] = "money:1000000" }, -- Brawler's Bottomless Draenic Agility Potion
{ 21, 118914, [PRICE_EXTRA_ITTYPE] = "money:1000000" }, -- Brawler's Bottomless Draenic Intellect Potion
{ 22, 118915, [PRICE_EXTRA_ITTYPE] = "money:1000000" }, -- Brawler's Bottomless Draenic Strength Potion
]]
{ 17, 144391, [PRICE_EXTRA_ITTYPE] = "money:20000000" }, -- Pugilist's Powerful Punching Ring, Added in patch 7.1.5.23360
--{ 27, 93195, "ac9169" }, -- Brawler's Pass
{ 18, 93195, "ac11563" }, -- Brawler's Pass
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
-- { 14, 118908, [PRICE_EXTRA_ITTYPE] = "money:200000000" }, -- Pit Fighter's Punching Ring
{ 17, 144392, [PRICE_EXTRA_ITTYPE] = "money:20000000" }, -- Pugilist's Powerful Punching Ring, Added in patch 7.1.5.23360
--{ 27, 93228, "ac9173" }, -- Brawler's Pass
{ 18, 93228, "ac11564" }, -- Brawler's Pass
},
},
{ --Rank5-8
name = format(AL["Rank %d"], 5).." - "..format(AL["Rank %d"], 8),
[ALLIANCE_DIFF] = {
{ 1, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 5), nil },
{ 2, 98084, [QUEST_EXTRA_ITTYPE] = 32845 }, -- Ooze-Soaked Shirt
{ 3, 98083, [QUEST_EXTRA_ITTYPE] = 32843 }, -- Sharkskin Tunic
{ 4, 98086, [QUEST_EXTRA_ITTYPE] = 32849 }, -- Tuxedo-Like Shirt
{ 6, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 6), nil },
{ 7, 98080, [QUEST_EXTRA_ITTYPE] = 32839 }, -- Gorgeous Blouse
{ 8, 98091, [QUEST_EXTRA_ITTYPE] = 32851 }, -- Last Season's Shirt
{ 9, 127773, [PRICE_EXTRA_ITTYPE] = "money:10000000" }, -- Gemcutter Module: Mastery
{ 16, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 7), nil },
{ 17, 98543, "ac9176" }, -- Wraps of the Blood-Soaked Brawler
{ 18, 98085, [QUEST_EXTRA_ITTYPE] = 32847 }, -- Brucehide Jersey
{ 19, 98092, [QUEST_EXTRA_ITTYPE] = 32853 }, -- Digmaster's Bodysleeve
{ 20, 98087, [QUEST_EXTRA_ITTYPE] = 32857 }, -- Paper Shirt
{ 21, 98093, [QUEST_EXTRA_ITTYPE] = 32855 }, -- Sightless Mantle
{ 23, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 8), nil },
{ 24, 122396, [PRICE_EXTRA_ITTYPE] = "money:10000000" }, -- Brawler's Razor Claws
{ 25, 98405, "mount", [PRICE_EXTRA_ITTYPE] = "money:15000000" }, -- Brawler's Burly Mushan Beast
{ 26, 142403, "mount", [PRICE_EXTRA_ITTYPE] = "money:40000000" }, -- Brawler's Burly Basilisk
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 17, 98543, "ac9177" }, -- Wraps of the Blood-Soaked Brawler
},
},
{ -- Challenge Card
name = AL["Challenge Card"],
[ALLIANCE_DIFF] = {
{ 1, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 1), nil },
{ 2, 143899 }, -- Challenge Card: Oso the Betrayer
{ 3, 97285 }, -- Challenge Card: Grandpa Grumplefloot
{ 4, 142042 }, -- Challenge Card: Ooliss
{ 5, 142035 }, -- Challenge Card: Warhammer Council
{ 6, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 2), nil },
{ 7, 94162 }, -- Challenge Card: Dippy
{ 8, 142041 }, -- Challenge Card: Bill the Janitor
{ 9, 94167 }, -- Challenge Card: Sanoriak
{ 10, 142036 }, --Challenge Card: Master Paku
{ 11, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 3), nil },
{ 12, 142043 }, -- Challenge Card: Doomflipper
{ 13, 94166 }, -- Challenge Card: Blat
{ 14, 142032 }, -- Challenge Card: Johnny Awesome
{ 15, 142039 }, -- Challenge Card: Shadowmaster Aameen
{ 16, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 4), nil },
{ 17, 142030 }, -- Challenge Card: Burnstachio
{ 18, 94181 }, -- Challenge Card: Meatball
{ 19, 94178 }, -- Challenge Card: G.G. Engineering
{ 20, 142045 }, -- Challenge Card: Stitches
{ 21, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 5), nil },
{ 22, 142026 }, -- Challenge Card: Blackmange
{ 23, 97566 }, -- Challenge Card: Razorgrin
{ 24, 94177 }, -- Challenge Card: Leper Gnomes
{ 25, 142028 }, -- Challenge Card: Thwack U
{ 26, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 6), nil },
{ 27, 142033 }, -- Challenge Card: Carl
{ 28, 94174 }, -- Challenge Card: Millie Watt
{ 29, 142029 }, -- Challenge Card: Ogrewatch
{ 30, 142037 }, -- Challenge Card: Topps
{ 101, "ICON_warrior_talent_icon_furyintheblood", nil, format(AL["Rank %d"], 7), nil },
{ 102, 97283 }, -- Challenge Card: Nibbleh
{ 103, 142038 }, -- Challenge Card: Serpent of Old
{ 104, 94182 }, -- Challenge Card: Epicus Maximus
{ 105, 142031 }, -- Challenge Card: Ray D. Tear
{ 106, 143794 }, -- Challenge Card: A Seagull
{ 107, 142040 }, -- Challenge Card: Ash'katzuum
{ 108, 142034 }, -- Challenge Card: Beat Box
{ 109, 142044 }, -- Challenge Card: Strange Thing
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
},
},
{ -- Miscellaneous
name = AL["Miscellaneous"],
[ALLIANCE_DIFF] = {
-- Potions
--[[ no longer available
{ 1, 118916, [PRICE_EXTRA_ITTYPE] = "money:15000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Brawler's Healing Tonic
{ 2, 118910, [PRICE_EXTRA_ITTYPE] = "money:15000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Brawler's Draenic Agility Potion
{ 3, 118911, [PRICE_EXTRA_ITTYPE] = "money:15000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Brawler's Draenic Intellect Potion
{ 4, 118912, [PRICE_EXTRA_ITTYPE] = "money:15000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Brawler's Draenic Strength Potion
]]
{ 1, 142325, [PRICE_EXTRA_ITTYPE] = "money:20000" }, -- Brawler's Ancient Healing Potion, added in 7.1.5.23360
{ 2, 142326, [PRICE_EXTRA_ITTYPE] = "money:150000" }, -- Brawler's Potion of Prolonged Power, added in 7.1.5.23360
{ 4, 93043, [PRICE_EXTRA_ITTYPE] = "money:10000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Rotten Apple
{ 5, 93044, [PRICE_EXTRA_ITTYPE] = "money:10000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Rotten Banana
{ 6, 93045, [PRICE_EXTRA_ITTYPE] = "money:10000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Rotten Watermelon
{ 7, 93158, [PRICE_EXTRA_ITTYPE] = "money:10000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Expired Blackout Brew
{ 16, 144371 }, -- Gorestained Tunic
{ 17, 144366 }, -- Dubvest
{ 18, 144367 }, -- Observer's Shirt
{ 19, 144372 }, -- Hide of the Murderaffe
{ 20, 144365 }, -- The Very Best Shirt
{ 21, 144370 }, -- Croc-Tooth Harness
{ 22, 144368 }, -- Felfeather Jersey
{ 23, 151263 }, -- Electrified Compression Shirt
{ 101, 143762, [PRICE_EXTRA_ITTYPE] = "brawlergold:100" }, -- High Roller's Contract, ", 1500888, "" },
{ 102, 143763, [PRICE_EXTRA_ITTYPE] = "brawlergold:100" }, -- Bag of Chipped Dice, ", 237284, "" },
{ 103, 143761, [PRICE_EXTRA_ITTYPE] = "brawlergold:250" }, -- Blood-Soaked Angel Figurine, ", 237542, "" },
{ 104, 143760, [PRICE_EXTRA_ITTYPE] = "brawlergold:500" }, -- Brawler's Potion Dispenser, ", 132623, "" },
{ 105, 142288, [PRICE_EXTRA_ITTYPE] = "brawlergold:500" }, -- Rumble Card: Grief Warden, ", 979582, "" },
{ 106, 142289, [PRICE_EXTRA_ITTYPE] = "brawlergold:500" }, -- Rumble Card: Penguin Stampede, ", 979582, "" },
{ 107, 142290, [PRICE_EXTRA_ITTYPE] = "brawlergold:500" }, -- Rumble Card: Battle of the Brew, ", 979582, "" },
{ 108, 142291, [PRICE_EXTRA_ITTYPE] = "brawlergold:500" }, -- Rumble Card: Senya, ", 979582, "" },
{ 109, 142292, [PRICE_EXTRA_ITTYPE] = "brawlergold:500" }, -- Rumble Card: Stranglethorn Streak, ", 979582, "" },
{ 110, 142293, [PRICE_EXTRA_ITTYPE] = "brawlergold:500" }, -- Rumble Card: Mindbreaker Gzzaj, ", 979582, "" },
{ 111, 142294, [PRICE_EXTRA_ITTYPE] = "brawlergold:500" }, -- Rumble Card: Mazhareen, ", 979582, "" },
{ 112, 143758, [PRICE_EXTRA_ITTYPE] = "brawlergold:1000" }, -- Free Drinks Voucher, ", 237446, "" },
{ 113, 143759, [PRICE_EXTRA_ITTYPE] = "brawlergold:1000" }, -- VIP Room Rental Form, ", 1500889, "" },
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
},
},
{ -- achievements
name = ACHIEVEMENTS,
[ALLIANCE_DIFF] = {
{ 1, "ac11558" }, -- The First Rule of Brawler's Guild
{ 2, "ac11560" }, -- You Are Not Your $#*@! Legplates
{ 3, "ac11563" }, -- The Second Rule of Brawler's Guild
{ 4, "ac11565" }, -- King of the Guild
{ 5, "ac11567" }, -- You Are Not The Contents Of Your Wallet
{ 6, "ac11570" }, -- Educated Guesser
{ 7, "ac11572" }, -- I Am Thrall's Complete Lack Of Surprise
{ 8, "ac11573" }, -- Rumble Club
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 1, "ac11559" }, -- The First Rule of Brawler's Guild
{ 2, "ac11561" }, -- You Are Not Your $#*@! Legplates
{ 3, "ac11564" }, -- The Second Rule of Brawler's Guild
{ 4, "ac11566" }, -- King of the Guild
},
},
}
}
data["DarkmoonFaire"] = {
name = AL["Darkmoon Faire"],
ContentType = PERMRECEVENTS_CONTENT,
items = {
{ --DarkmoonMountsPets
name = AL["Mounts"].." & "..AL["Pets"],
[NORMAL_DIFF] = {
{ 1, 73766, "mount", [PRICE_EXTRA_ITTYPE] = "darkmoon:180" }, -- Darkmoon Dancing Bear
{ 2, 72140, "mount", [PRICE_EXTRA_ITTYPE] = "darkmoon:180" }, -- Swift Forest Strider
{ 3, 153485, "mount", [PRICE_EXTRA_ITTYPE] = "darkmoon:1000" }, -- Darkmoon Dirigible, Added in patch 7.3.0.24781
{ 5, 73762, "pet336", [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Darkmoon Balloon
{ 6, 74981, "pet343", [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Darkmoon Cub
{ 7, 91003, "pet1061", [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Darkmoon Hatchling
{ 8, 73764, "pet330", [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Darkmoon Monkey
{ 9, 73903, "pet338", [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Darkmoon Tonk
{ 10, 73765, "pet335", [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Darkmoon Turtle
{ 11, 73905, "pet339", [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Darkmoon Zeppelin
{ 12, 11026, "pet65", [PRICE_EXTRA_ITTYPE] = "money:10000" }, -- Tree Frog Box
{ 13, 11027, "pet64", [PRICE_EXTRA_ITTYPE] = "money:10000" }, -- Wood Frog Box
{ 16, 80008, "pet848" }, -- Darkmoon Rabbit (ACM 6332)
{ 17, 101570, "pet1276" }, -- Moon Moon (Drop: Moonfang)
{ 18, 73953, "pet340" }, -- Sea Pony (Fishing: Darkmoon Island)
{ 20, 91040, "pet1063", [QUEST_EXTRA_ITTYPE] = 32175 }, -- Darkmoon Eye
{ 21, 116064, "pet1478", [QUEST_EXTRA_ITTYPE] = 36471 }, -- Syd the Squid
{ 22, 19450, "pet106", [QUEST_EXTRA_ITTYPE] = 7946 }, -- A Jubling's Tiny Home
},
},
{ --DarkmoonToys
name = AL["Toys"].." & "..AL["Vanity Gear"],
[NORMAL_DIFF] = {
{ 1, 116138, [PRICE_EXTRA_ITTYPE] = "darkmoon:130" }, -- Last Deck of Nemelex Xobeh
{ 2, 116115, "ac9252" }, -- Blazing Wings
{ 3, 90899, [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Darkmoon Whistle
{ 4, 75042, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Flimsy Yellow Balloon
{ 5, 116139, [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Haunting Memento
{ 6, 105898 }, -- Moonfang's Paw (Drop: Moonfang)
{ 7, 101571 }, -- Moonfang Shroud (Drop: Moonfang)
{ 8, 116067, [QUEST_EXTRA_ITTYPE] = 36477 }, -- Ring of Broken Promises
{ 9, 151265 }, -- Blight Boar Microphone (Drop: Death Metal Knight)
{ 10, 19291, [PRICE_EXTRA_ITTYPE] = "darkmoon:1" }, -- Darkmoon Storage Box
{ 11, 74142, [PRICE_EXTRA_ITTYPE] = "money:100" }, -- Darkmoon Firework
{ 12, 93730, [PRICE_EXTRA_ITTYPE] = "darkmoon:10" }, -- Darkmoon Top Hat
{ 13, 75040, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Flimsy Darkmoon Balloon
{ 14, 75041, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Flimsy Green Balloon
{ 15, 18662, [PRICE_EXTRA_ITTYPE] = "money:20" }, -- Heavy Leather Ball
{ 16, 92959, [PRICE_EXTRA_ITTYPE] = "darkmoon:1", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Darkmoon "Cougar"
{ 17, 92966, [PRICE_EXTRA_ITTYPE] = "darkmoon:1", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Darkmoon "Dragon"
{ 18, 92967, [PRICE_EXTRA_ITTYPE] = "darkmoon:1", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Darkmoon "Gryphon"
{ 19, 92968, [PRICE_EXTRA_ITTYPE] = "darkmoon:1", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Darkmoon "Murloc"
{ 20, 92958, [PRICE_EXTRA_ITTYPE] = "darkmoon:1", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Darkmoon "Nightsaber"
{ 21, 92969, [PRICE_EXTRA_ITTYPE] = "darkmoon:1", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Darkmoon "Rocket"
{ 22, 92956, [PRICE_EXTRA_ITTYPE] = "darkmoon:1", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Darkmoon "Snow Leopard"
{ 23, 77158, [PRICE_EXTRA_ITTYPE] = "darkmoon:1", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Darkmoon "Tiger"
{ 24, 92970, [PRICE_EXTRA_ITTYPE] = "darkmoon:1", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Darkmoon "Wyvern"
{ 101, 78341, [PRICE_EXTRA_ITTYPE] = "darkmoon:160" }, -- Darkmoon Hammer
{ 102, 93732 }, -- Darkmoon Fishing Cap (Fishing: Darkmoon Island)
{ 103, 78340, [PRICE_EXTRA_ITTYPE] = "darkmoon:90" }, -- Cloak of the Darkmoon Faire
{ 104, 77256, [PRICE_EXTRA_ITTYPE] = "darkmoon:20" }, -- Darkmoon "Sword"
{ 105, 19295, [PRICE_EXTRA_ITTYPE] = "darkmoon:1" }, -- Darkmoon Flower
{ 106, 19292, [PRICE_EXTRA_ITTYPE] = "darkmoon:1" }, -- Last Month's Mutton
{ 107, 19293, [PRICE_EXTRA_ITTYPE] = "darkmoon:1" }, -- Last Year's Mutton
{ 116, 116052, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Nobleman's Coat
{ 117, 116137, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Noblewoman's Finery
{ 118, 116133, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Nobleman's Pantaloons
{ 119, 116136, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Noblewoman's Skirt
{ 120, 116134, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Noble's Fancy Boots
},
},
{ --DarkmoonTrinkets
name = AL["Trinkets"],
[NORMAL_DIFF] = {
{ 1, 79325 }, -- Crane Deck
{ 2, 79330, [QUEST_EXTRA_ITTYPE] = 30449 }, -- Relic of Chi Ji
{ 4, 79324 }, -- Ox Deck
{ 5, 79329, [QUEST_EXTRA_ITTYPE] = 30450 }, -- Relic of Niuzao
{ 7, 79326 }, -- Serpent Deck
{ 8, 79331, [QUEST_EXTRA_ITTYPE] = 30451 }, -- Relic of Yu'lon
{ 10, 79323 }, -- Tiger Deck
{ 11, 79327, [QUEST_EXTRA_ITTYPE] = 30452 }, -- Relic of Xuen
{ 12, 79328, [QUEST_EXTRA_ITTYPE] = 30452 }, -- Relic of Xuen
{ 16, 62046 }, -- Earthquake Deck
{ 17, 62048, [QUEST_EXTRA_ITTYPE] = 27667 }, -- Darkmoon Card: Earthquake
{ 19, 62045 }, -- Hurricane Deck
{ 20, 62049, [QUEST_EXTRA_ITTYPE] = 27665 }, -- Darkmoon Card: Hurricane
{ 21, 62051, [QUEST_EXTRA_ITTYPE] = 27665 }, -- Darkmoon Card: Hurricane
{ 23, 62044 }, -- Tsunami Deck
{ 24, 62050, [QUEST_EXTRA_ITTYPE] = 27666 }, -- Darkmoon Card: Tsunami
{ 26, 62021 }, -- Volcanic Deck
{ 27, 62047, [QUEST_EXTRA_ITTYPE] = 27664 }, -- Darkmoon Card: Volcano
{ 29, 74035, "ac6024" }, -- Master Pit Fighter
{ 30, 74034, "ac6023" }, -- Pit Fighter
{ 101, 44276 }, -- Chaos Deck
{ 102, 42989, [QUEST_EXTRA_ITTYPE] = 13325 }, -- Darkmoon Card: Berserker!
{ 104, 44259 }, -- Prisms Deck
{ 105, 42988, [QUEST_EXTRA_ITTYPE] = 13324 }, -- Darkmoon Card: Illusion
{ 107, 44294 }, -- Undeath Deck
{ 108, 42990, [QUEST_EXTRA_ITTYPE] = 13327 }, -- Darkmoon Card: Death
{ 110, 44326 }, -- Nobles Deck
{ 111, 44253, [QUEST_EXTRA_ITTYPE] = 13326 }, -- Darkmoon Card: Greatness
{ 112, 42987, [QUEST_EXTRA_ITTYPE] = 13326 }, -- Darkmoon Card: Greatness
{ 113, 44254, [QUEST_EXTRA_ITTYPE] = 13326 }, -- Darkmoon Card: Greatness
{ 114, 44255, [QUEST_EXTRA_ITTYPE] = 13326 }, -- Darkmoon Card: Greatness
{ 116, 31890 }, -- Blessings Deck
{ 117, 31856, [QUEST_EXTRA_ITTYPE] = 10938 }, -- Darkmoon Card: Crusade
{ 119, 31907 }, -- Furies Deck
{ 120, 31858, [QUEST_EXTRA_ITTYPE] = 10940 }, -- Darkmoon Card: Vengeance
{ 122, 31914 }, -- Lunacy Deck
{ 123, 31859, [QUEST_EXTRA_ITTYPE] = 10941 }, -- Darkmoon Card: Madness
{ 125, 31891 }, -- Storms Deck
{ 126, 31857, [QUEST_EXTRA_ITTYPE] = 10939 }, -- Darkmoon Card: Wrath
{ 201, 19228 }, -- Beasts Deck
{ 202, 19288, [QUEST_EXTRA_ITTYPE] = 7907 }, -- Darkmoon Card: Blue Dragon
{ 204, 19267 }, -- Elementals Deck
{ 205, 19289, [QUEST_EXTRA_ITTYPE] = 7929 }, -- Darkmoon Card: Maelstrom
{ 207, 19277 }, -- Portals Deck
{ 208, 19290, [QUEST_EXTRA_ITTYPE] = 7927 }, -- Darkmoon Card: Twisting Nether
{ 210, 19257 }, -- Warlords Deck
{ 211, 19287, [QUEST_EXTRA_ITTYPE] = 7928 }, -- Darkmoon Card: Heroism
{ 301, 44158 }, -- Demons Deck
{ 302, 44217, [QUEST_EXTRA_ITTYPE] = 13311 }, -- Darkmoon Dirk
{ 303, 44218, [QUEST_EXTRA_ITTYPE] = 13311 }, -- Darkmoon Executioner
{ 304, 44219, [QUEST_EXTRA_ITTYPE] = 13311 }, -- Darkmoon Magestaff
{ 306, 44148 }, -- Mages Deck
{ 307, 44215, [QUEST_EXTRA_ITTYPE] = 12518 }, -- Darkmoon Necklace
{ 308, 44213, [QUEST_EXTRA_ITTYPE] = 12518 }, -- Darkmoon Pendant
{ 316, 37164 }, -- Swords Deck
{ 317, 39894, [QUEST_EXTRA_ITTYPE] = 12798 }, -- Darkcloth Shoulders
{ 318, 39895, [QUEST_EXTRA_ITTYPE] = 12798 }, -- Cloaked Shoulderpads
{ 319, 39897, [QUEST_EXTRA_ITTYPE] = 12798 }, -- Azure Shoulderguards
{ 321, 37163 }, -- Rogues Deck
{ 322, 38318, [QUEST_EXTRA_ITTYPE] = 12517 }, -- Darkmoon Robe
{ 323, 39509, [QUEST_EXTRA_ITTYPE] = 12517 }, -- Darkmoon Vest
{ 324, 39507, [QUEST_EXTRA_ITTYPE] = 12517 }, -- Darkmoon Chain Shirt
},
},
{ --DarkmoonFoodDrinks
name = AL["Food"].." & "..AL["Drinks"],
[NORMAL_DIFF] = {
{ 1, 19223, [PRICE_EXTRA_ITTYPE] = "money:25", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Darkmoon Dog
{ 2, 19304, [PRICE_EXTRA_ITTYPE] = "money:125", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Spiced Beef Jerky
{ 3, 19305, [PRICE_EXTRA_ITTYPE] = "money:500", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Pickled Kodo Foot
{ 4, 19224, [PRICE_EXTRA_ITTYPE] = "money:1000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Red Hot Wings
{ 5, 19306, [PRICE_EXTRA_ITTYPE] = "money:2000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Crunchy Frog
{ 6, 19225, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Deep Fried Candybar
{ 7, 33246, [PRICE_EXTRA_ITTYPE] = "money:5600", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Funnel Cake
{ 8, 33254, [PRICE_EXTRA_ITTYPE] = "money:8000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Forest Strider Drumstick
{ 9, 44940, [PRICE_EXTRA_ITTYPE] = "money:16000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Corn-Breaded Sausage
{ 10, 73260, [PRICE_EXTRA_ITTYPE] = "money:20000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Salty Sea Dog
{ 16, 75029, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Beer-Basted Short Ribs
{ 17, 75031, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Draenic Dumplings
{ 18, 75034, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Forsaken Foie Gras
{ 19, 75030, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Gnomeregan Gnuggets
{ 20, 75033, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Green Ham & Eggs
{ 21, 75032, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Mulgore Meat Pie
{ 22, 75036, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Silvermoon Steak
{ 23, 75028, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Stormwind Surprise
{ 24, 75027, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Teldrassil Tenderloin
{ 25, 75035, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Troll Tartare
{ 101, 19299, [PRICE_EXTRA_ITTYPE] = "money:500" }, -- Fizzy Faire Drink
{ 102, 19300, [PRICE_EXTRA_ITTYPE] = "money:2000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Bottled Winterspring Water
{ 103, 33234, [PRICE_EXTRA_ITTYPE] = "money:4000", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Iced Berry Slush
{ 104, 33236, [PRICE_EXTRA_ITTYPE] = "money:5600", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Fizzy Faire Drink 'Classic'
{ 105, 44941, [PRICE_EXTRA_ITTYPE] = "money:8500", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Fresh-Squeezed Limeade
{ 106, 74822, [PRICE_EXTRA_ITTYPE] = "money:13750", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Sasparilla Sinker
{ 116, 19222, [PRICE_EXTRA_ITTYPE] = "money:10" }, -- Cheap Beer
{ 117, 19221, [PRICE_EXTRA_ITTYPE] = "money:50" }, -- Darkmoon Special Reserve
{ 118, 93208, [PRICE_EXTRA_ITTYPE] = "money:80000" }, -- Darkmoon P.I.E
},
},
{ --DarkmoonHeirloomArmor
name = AL["Heirloom"].." - "..AL["Armor"],
[NORMAL_DIFF] = {
{ 1, 93859, [PRICE_EXTRA_ITTYPE] = "42985:1:darkmoon:44" }, -- Bloodstained Dreadmist Mantle
{ 2, 93864, [PRICE_EXTRA_ITTYPE] = "42984:1:darkmoon:44" }, -- Majestic Ironfeather Shoulders
{ 3, 93862, [PRICE_EXTRA_ITTYPE] = "42952:1:darkmoon:44" }, -- Supple Shadowcraft Spaulders
{ 4, 93887, [PRICE_EXTRA_ITTYPE] = "42950:1:darkmoon:44" }, -- Grand Champion Herod's Shoulder
{ 5, 93876, [PRICE_EXTRA_ITTYPE] = "42951:1:darkmoon:44" }, -- Awakened Pauldrons of Elements
{ 6, 93893, [PRICE_EXTRA_ITTYPE] = "69890:1:darkmoon:44" }, -- Brushed Pauldrons of Might
{ 7, 93890, [PRICE_EXTRA_ITTYPE] = "42949:1:darkmoon:44" }, -- Gleaming Spaulders of Valor
{ 9, 93860, [PRICE_EXTRA_ITTYPE] = "48691:1:darkmoon:44" }, -- Bloodstained Dreadmist Robe
{ 10, 93865, [PRICE_EXTRA_ITTYPE] = "48687:1:darkmoon:44" }, -- Majestic Ironfeather Breastplate
{ 11, 93863, [PRICE_EXTRA_ITTYPE] = "48689:1:darkmoon:44" }, -- Supple Shadowcraft Tunic
{ 12, 93888, [PRICE_EXTRA_ITTYPE] = "48677:1:darkmoon:44" }, -- Furious Deathdealer Breastplate
{ 13, 93885, [PRICE_EXTRA_ITTYPE] = "48683:1:darkmoon:44" }, -- Awakened Vest of Elements
{ 14, 93892, [PRICE_EXTRA_ITTYPE] = "69889:1:darkmoon:44" }, -- Brushed Breastplate of Might
{ 15, 93891, [PRICE_EXTRA_ITTYPE] = "48685:1:darkmoon:44" }, -- Gleaming Breastplate of Valor
{ 16, 42985, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Tattered Dreadmist Mantle
{ 17, 42984, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Preened Ironfeather Shoulders
{ 18, 42952, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Stained Shadowcraft Spaulders
{ 19, 42950, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Champion Herod's Shoulder
{ 20, 42951, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Mystical Pauldrons of Elements
{ 21, 69890, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Burnished Pauldrons of Might
{ 22, 42949, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Polished Spaulders of Valor
{ 24, 48691, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Tattered Dreadmist Robe
{ 25, 48687, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Preened Ironfeather Breastplate
{ 26, 48689, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Stained Shadowcraft Tunic
{ 27, 48677, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Champion's Deathdealer Breastplate
{ 28, 48683, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Mystical Vest of Elements
{ 29, 69889, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Burnished Breastplate of Might
{ 30, 48685, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Polished Breastplate of Valor
},
},
{ --DarkmoonHeirloomWeapons
name = AL["Heirloom"].." - "..AL["Trinkets"].." & "..AL["Weapons"],
[NORMAL_DIFF] = {
{ 1, 93897, [PRICE_EXTRA_ITTYPE] = "42992:1:darkmoon:60" }, -- Piercing Eye of the Beast
{ 2, 93896, [PRICE_EXTRA_ITTYPE] = "42991:1:darkmoon:60" }, -- Forceful Hand of Justice
{ 4, 93857, [PRICE_EXTRA_ITTYPE] = "42944:1:darkmoon:44" }, -- Vengeful Heartseeker
{ 5, 93845, [PRICE_EXTRA_ITTYPE] = "69893:1:darkmoon:44" }, -- Gore-Steeped Skullforge Reaver
{ 6, 93856, [PRICE_EXTRA_ITTYPE] = "42945:1:darkmoon:44" }, -- Noble Dal'Rend's Sacred Charge
{ 7, 93843, [PRICE_EXTRA_ITTYPE] = "42943:1:darkmoon:64" }, -- Hardened Arcanite Reaper
{ 8, 93853, [PRICE_EXTRA_ITTYPE] = "42948:1:darkmoon:44" }, -- Pious Aurastone Hammer
{ 9, 93847, [PRICE_EXTRA_ITTYPE] = "48716:1:darkmoon:44" }, -- Crushing Mass of McGowan
{ 10, 93846, [PRICE_EXTRA_ITTYPE] = "48718:1:darkmoon:64" }, -- Re-Engineered Lava Dredger
{ 11, 93844, [PRICE_EXTRA_ITTYPE] = "79131:1:darkmoon:64" }, -- Refinished Warden Staff
{ 12, 93854, [PRICE_EXTRA_ITTYPE] = "42947:1:darkmoon:64" }, -- Scholarly Headmaster's Charge
{ 13, 93855, [PRICE_EXTRA_ITTYPE] = "42946:1:darkmoon:64" }, -- War-Torn Ancient Bone Bow
{ 14, 93902, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Flamescarred Draconian Deflector
{ 15, 93903, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Weathered Observer's Shield
{ 16, 42992, [PRICE_EXTRA_ITTYPE] = "darkmoon:130" }, -- Discerning Eye of the Beast
{ 17, 42991, [PRICE_EXTRA_ITTYPE] = "darkmoon:130" }, -- Swift Hand of Justice
{ 19, 42944, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Balanced Heartseeker
{ 20, 69893, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Bloodsoaked Skullforge Reaver
{ 21, 42945, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Venerable Dal'Rend's Sacred Charge
{ 22, 42943, [PRICE_EXTRA_ITTYPE] = "darkmoon:160" }, -- Bloodied Arcanite Reaper
{ 23, 42948, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Devout Aurastone Hammer
{ 24, 48716, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Venerable Mass of McGowan
{ 25, 48718, [PRICE_EXTRA_ITTYPE] = "darkmoon:160" }, -- Repurposed Lava Dredger
{ 26, 79131, [PRICE_EXTRA_ITTYPE] = "darkmoon:160" }, -- Burnished Warden Staff
{ 27, 42947, [PRICE_EXTRA_ITTYPE] = "darkmoon:160" }, -- Dignified Headmaster's Charge
{ 28, 42946, [PRICE_EXTRA_ITTYPE] = "darkmoon:160" }, -- Charmed Ancient Bone Bow
{ 29, 93904, [PRICE_EXTRA_ITTYPE] = "darkmoon:110" }, -- Musty Tome of the Lost
},
},
{ --DarkmoonReplicasDruid
name = AL["Transmoggable Replicas"].." - "..ALIL["DRUID"],
[NORMAL_DIFF] = {
{ 1, 78238, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Wildheart Cowl
{ 2, 78239, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Wildheart Spaulders
{ 3, 78242, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Wildheart Vest
{ 4, 78240, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Wildheart Bracers
{ 5, 78241, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Wildheart Gloves
{ 6, 78244, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Wildheart Belt
{ 7, 78245, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Wildheart Kilt
{ 8, 78243, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Wildheart Boots
{ 16, 78249, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Feralheart Cowl
{ 17, 78247, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Feralheart Spaulders
{ 18, 78252, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Feralheart Vest
{ 19, 78253, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Feralheart Bracers
{ 20, 78248, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Feralheart Gloves
{ 21, 78246, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Feralheart Belt
{ 22, 78250, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Feralheart Kilt
{ 23, 78251, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Feralheart Boots
},
},
{ --DarkmoonReplicasHunter
name = AL["Transmoggable Replicas"].." - "..ALIL["HUNTER"],
[NORMAL_DIFF] = {
{ 1, 78275, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Beaststalker's Cap
{ 2, 78273, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Beaststalker's Mantle
{ 3, 78270, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Beaststalker's Tunic
{ 4, 78277, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Beaststalker's Bindings
{ 5, 78271, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Beaststalker's Gloves
{ 6, 78274, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Beaststalker's Belt
{ 7, 78276, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Beaststalker's Pants
{ 8, 78272, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Beaststalker's Boots
{ 16, 78284, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Beastmaster's Cap
{ 17, 78281, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Beastmaster's Mantle"
{ 18, 78282, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Beastmaster's Tunic
{ 19, 78283, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Beastmaster's Bindings
{ 20, 78278, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Beastmaster's Gloves
{ 21, 78285, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Beastmaster's Belt
{ 22, 78280, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Beastmaster's Pants
{ 23, 78279, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Beastmaster's Boots
},
},
{ --DarkmoonReplicasMage
name = AL["Transmoggable Replicas"].." - "..ALIL["MAGE"],
[NORMAL_DIFF] = {
{ 1, 78188, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Magister's Crown
{ 2, 78191, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Magister's Mantle
{ 3, 78190, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Magister's Robes
{ 4, 78193, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Magister's Bindings
{ 5, 78187, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Magister's Gloves
{ 6, 78192, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Magister's Belt
{ 7, 78189, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Magister's Leggings
{ 8, 78186, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Magister's Boots
{ 16, 78198, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Sorcerer's Crown
{ 17, 78201, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Sorcerer's Mantle
{ 18, 78200, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Sorcerer's Robes
{ 19, 78203, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Sorcerer's Bindings
{ 20, 78197, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Sorcerer's Gloves
{ 21, 78202, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Sorcerer's Belt
{ 22, 78199, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Sorcerer's Leggings
{ 23, 78196, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Sorcerer's Boots
},
},
{ --DarkmoonReplicasPaladin
name = AL["Transmoggable Replicas"].." - "..ALIL["PALADIN"],
[NORMAL_DIFF] = {
{ 1, 78307, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Lightforge Helm
{ 2, 78308, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Lightforge Spaulders
{ 3, 78306, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Lightforge Breastplate
{ 4, 78304, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Lightforge Bracers
{ 5, 78303, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Lightforge Gauntlets
{ 6, 78302, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Lightforge Belt
{ 7, 78305, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Lightforge Legplates
{ 8, 78309, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Lightforge Boots
{ 16, 78312, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Soulforge Helm
{ 17, 78316, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Soulforge Spaulders
{ 18, 78313, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Soulforge Breastplate
{ 19, 78317, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Soulforge Bracers
{ 20, 78314, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Soulforge Gauntlets
{ 21, 78311, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Soulforge Belt
{ 22, 78315, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Soulforge Legplates
{ 23, 78310, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Soulforge Boots
},
},
{ --DarkmoonReplicasPriest
name = AL["Transmoggable Replicas"].." - "..ALIL["PRIEST"],
[NORMAL_DIFF] = {
{ 1, 78205, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Devout Crown
{ 2, 78204, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Devout Mantle
{ 3, 78209, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Devout Robe
{ 4, 78211, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Devout Bracers
{ 5, 78208, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Devout Gloves
{ 6, 78207, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Devout Belt
{ 7, 78206, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Devout Skirt
{ 8, 78210, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Devout Sandals
{ 16, 78216, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Virtuous Crown
{ 17, 78213, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Virtuous Mantle
{ 18, 78212, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Virtuous Robe
{ 19, 78215, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Virtuous Bracers
{ 20, 78217, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Virtuous Gloves
{ 21, 78218, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Virtuous Belt
{ 22, 78214, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Virtuous Skirt
{ 23, 78219, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Virtuous Sandals
},
},
{ --DarkmoonReplicasRogue
name = AL["Transmoggable Replicas"].." - "..ALIL["ROGUE"],
[NORMAL_DIFF] = {
{ 1, 78260, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Shadowcraft Cap
{ 2, 78261, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Shadowcraft Spaulders
{ 3, 78254, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Shadowcraft Tunic
{ 4, 78255, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Shadowcraft Bracers
{ 5, 78257, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Shadowcraft Gloves
{ 6, 78259, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Shadowcraft Belt
{ 7, 78258, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Shadowcraft Pants
{ 8, 78256, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Shadowcraft Boots
{ 16, 78263, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Darkmantle Cap
{ 17, 78267, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Darkmantle Spaulders
{ 18, 78269, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Darkmantle Tunic
{ 19, 78264, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Darkmantle Bracers
{ 20, 78266, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Darkmantle Gloves
{ 21, 78265, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Darkmantle Belt
{ 22, 78268, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Darkmantle Pants
{ 23, 78262, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Darkmantle Boots
},
},
{ --DarkmoonReplicasShaman
name = AL["Transmoggable Replicas"].." - "..ALIL["SHAMAN"],
[NORMAL_DIFF] = {
{ 1, 78286, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Coif of Elements
{ 2, 78288, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Pauldrons of Elements
{ 3, 78290, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Vest of Elements
{ 4, 78289, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Bindings of Elements
{ 5, 78291, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Gauntlets of Elements
{ 6, 78293, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Cord of Elements
{ 7, 78287, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Kilt of Elements
{ 8, 78292, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Boots of Elements
{ 16, 78294, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Coif of The Five Thunders
{ 17, 78299, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Pauldrons of The Five Thunders
{ 18, 78300, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Vest of The Five Thunders
{ 19, 78296, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Bindings of The Five Thunders
{ 20, 78295, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Gauntlets of The Five Thunders
{ 21, 78297, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Cord of The Five Thunders
{ 22, 78301, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Kilt of The Five Thunders
{ 23, 78298, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Boots of The Five Thunders
},
},
{ --DarkmoonReplicasWarlock
name = AL["Transmoggable Replicas"].." - "..ALIL["WARLOCK"],
[NORMAL_DIFF] = {
{ 1, 78227, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Dreadmist Mask
{ 2, 78226, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Dreadmist Mantle
{ 3, 78225, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Dreadmist Robe
{ 4, 78229, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Dreadmist Bracers
{ 5, 78223, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Dreadmist Wraps
{ 6, 78222, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Dreadmist Belt
{ 7, 78228, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Dreadmist Leggings
{ 8, 78224, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Dreadmist Sandals
{ 16, 78230, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Deathmist Mask
{ 17, 78234, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Deathmist Mantle
{ 18, 78237, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Deathmist Robe
{ 19, 78232, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Deathmist Bracers
{ 20, 78236, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Deathmist Wraps
{ 21, 78233, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Deathmist Belt
{ 22, 78231, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Deathmist Leggings
{ 23, 78235, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Deathmist Sandals
},
},
{ --DarkmoonReplicasWarrior
name = AL["Transmoggable Replicas"].." - "..ALIL["WARRIOR"],
[NORMAL_DIFF] = {
{ 1, 78322, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Helm of Valor
{ 2, 78325, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Spaulders of Valor
{ 3, 78323, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Breastplate of Valor
{ 4, 78321, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Bracers of Valor
{ 5, 78320, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Gauntlets of Valor
{ 6, 78319, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Belt of Valor
{ 7, 78324, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Legplates of Valor
{ 8, 78318, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Boots of Valor
{ 16, 78330, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Helm of Heroism
{ 17, 78332, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Spaulders of Heroism
{ 18, 78328, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Breastplate of Heroism
{ 19, 78327, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Bracers of Heroism
{ 20, 78329, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Gauntlets of Heroism
{ 21, 78333, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Belt of Heroism
{ 22, 78331, [PRICE_EXTRA_ITTYPE] = "darkmoon:75" }, -- Replica Legplates of Heroism
{ 23, 78326, [PRICE_EXTRA_ITTYPE] = "darkmoon:55" }, -- Replica Boots of Heroism
},
},
}
}
data["FishingExtravaganza"] = {
name = AL["Stranglethorn Fishing Extravaganza"],
ContentType = PERMRECEVENTS_CONTENT,
items = {
{ --FishingExtravaganza
name = AL["Stranglethorn Fishing Extravaganza"],
[NORMAL_DIFF] = {
{ 1, "INV_Box_01", nil, AL["First Prize"], nil },
{ 2, 19970 }, -- Arcanite Fishing Pole
{ 3, 19979 }, -- Hook of the Master Angler
{ 5, "INV_Box_01", nil, AL["Rare Fish"], nil },
{ 6, 19803 }, -- Brownell's Blue Striped Racer
{ 7, 19806 }, -- Dezian Queenfish
{ 8, 19805 }, -- Keefer's Angelfish
{ 9, 19808 }, -- Rockhide Strongfish
{ 17, 50287 }, -- Boots of the Bay
{ 18, 50255 }, -- Dread Pirate Ring
{ 20, "INV_Box_01", nil, AL["Rare Fish Rewards"], nil },
{ 21, 19969 }, -- Nat Pagle's Extreme Anglin' Boots
{ 22, 19971 }, -- High Test Eternium Fishing Line
{ 23, 19972 }, -- Lucky Fishing Hat
},
},
}
}
data["LoveisintheAir"] = {
name = AL["Love is in the Air"].." ("..ALIL["February"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --LoveisintheAirTrio
name = BB["Apothecary Hummel"].." ("..ALIL["Shadowfang Keep"]..")",
[NORMAL_DIFF] = {
{ 1, "117369:1800" }, -- Choker of the Pure Heart
{ 2, "117366:1800" }, -- Heartbreak Charm
{ 3, "117370:1800" }, -- Shard of Pirouetting Happiness
{ 4, "117368:1800" }, -- Sweet Perfume Broach
{ 5, "117367:1800" }, -- Winking Eye of Love
{ 16, 54537 }, -- Heart-Shaped Box
{ 17, 50250, "mount" }, -- Big Love Rocket
{ 18, 50446, "pet251" }, -- Toxic Wasteling
{ 19, 50471 }, -- The Heartbreaker
{ 20, 116651 }, -- True Love Prism
{ 21, 49715 }, -- Forever-Lovely Rose
{ 22, 50741 }, -- Vile Fumigator's Mask
{ 23, 21815 }, -- Love Token
},
},
{ --LoveisintheAirVendor
name = AL["Vendor"],
[NORMAL_DIFF] = {
{ 1, 72146, "mount", [PRICE_EXTRA_ITTYPE] = "lovetoken:270" }, -- Swift Lovebird
{ 2, 34480, [PRICE_EXTRA_ITTYPE] = "lovetoken:10" }, -- Romantic Picnic Basket
{ 3, 116155, "pet1511", [PRICE_EXTRA_ITTYPE] = "lovetoken:40" }, -- Lovebird Hatchling
{ 4, 22235, "pet122", [PRICE_EXTRA_ITTYPE] = "lovetoken:40" }, -- Truesilver Shafted Arrow
{ 5, 22200, [PRICE_EXTRA_ITTYPE] = "lovetoken:5", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Silver Shafted Arrow
{ 6, 50161, [PRICE_EXTRA_ITTYPE] = "lovetoken:20" }, -- Dinner Suit Box
{ 7, 50160, [PRICE_EXTRA_ITTYPE] = "lovetoken:20" }, -- Lovely Dress Box
{ 8, 22261, [PRICE_EXTRA_ITTYPE] = "lovetoken:10" }, -- Love Fool
{ 9, 34258, [PRICE_EXTRA_ITTYPE] = "lovetoken:5", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Love Rocket
{ 10, 50163, [PRICE_EXTRA_ITTYPE] = "lovetoken:5", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Lovely Rose
{ 11, 22218, [PRICE_EXTRA_ITTYPE] = "lovetoken:2", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Handful of Rose Petals
{ 12, 21813, [PRICE_EXTRA_ITTYPE] = "lovetoken:2" }, -- Bag of Heart Candies
{ 13, 21812, [PRICE_EXTRA_ITTYPE] = "lovetoken:10" }, -- Box of Chocolates
{ 14, 116648 }, -- Manufactured Love Prism
{ 16, 49859, [PRICE_EXTRA_ITTYPE] = "lovetoken:1", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- "Bravado" Cologne
{ 17, 49861, [PRICE_EXTRA_ITTYPE] = "lovetoken:1", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- "STALWART" Cologne
{ 18, 49860, [PRICE_EXTRA_ITTYPE] = "lovetoken:1", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- "Wizardry" Cologne
{ 19, 49857, [PRICE_EXTRA_ITTYPE] = "lovetoken:1", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- "Enchantress" Perfume
{ 20, 49858, [PRICE_EXTRA_ITTYPE] = "lovetoken:1", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- "Forever" Perfume
{ 21, 49856, [PRICE_EXTRA_ITTYPE] = "lovetoken:1", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- "VICTORY" Perfume
{ 23, 21815, [PRICE_EXTRA_ITTYPE] = "49916:1" }, -- Love Token
},
},
{ --LoveisintheAirMisc
name = AL["Miscellaneous"],
[NORMAL_DIFF] = {
{ 1, 50160, "ac1694" }, -- Lovely Dress Box
{ 2, 22279 }, -- Lovely Black Dress
{ 3, 22278 }, -- Lovely Blue Dress
{ 4, 22276 }, -- Lovely Red Dress
{ 5, 22280 }, -- Lovely Purple Dress
{ 7, 50161 }, -- Dinner Suit Box
{ 8, 22281 }, -- Blue Dinner Suit
{ 9, 22282 }, -- Purple Dinner Suit
{ 10, 22277 }, -- Red Dinner Suit
{ 16, 49909, "ac1702" }, -- Box of Chocolates
{ 17, 22237 }, -- Dark Desire
{ 18, 22238 }, -- Very Berry Cream
{ 19, 22236 }, -- Buttermilk Delight
{ 20, 22239 }, -- Sweet Surprise
{ 22, 21813, "ac1701" }, -- Bag of Heart Candies
{ 23, 21816 }, -- Heart Candy
{ 24, 21817 }, -- Heart Candy
{ 25, 21818 }, -- Heart Candy
{ 26, 21819 }, -- Heart Candy
{ 27, 21820 }, -- Heart Candy
{ 28, 21821 }, -- Heart Candy
{ 29, 21822 }, -- Heart Candy
{ 30, 21823 }, -- Heart Candy
},
},
}
}
data["LunarFestival"] = {
name = AL["Lunar Festival"].." ("..ALIL["February"].." - "..ALIL["March"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --LunarFestivalVendor
name = AL["Vendor"],
[NORMAL_DIFF] = {
{ 1, 74611, "pet342", [PRICE_EXTRA_ITTYPE] = "ancestrycoin:50" }, -- Festival Lantern
{ 16, 74610, "pet341", [PRICE_EXTRA_ITTYPE] = "ancestrycoin:50" }, -- Lunar Lantern
{ 3, 89999, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:25" }, -- Everlasting Alliance Firework
{ 18, 90000, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:25" }, -- Everlasting Horde Firework
{ 5, 122338, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:40" }, -- Ancient Heirloom Armor Casing
{ 20, 122340, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:75" }, -- Timeworn Heirloom Armor Casing
{ 7, 116172, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:1" }, -- Perky Blaster
{ 9, 21157, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Festive Green Dress
{ 10, 21538, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Festive Pink Dress
{ 11, 21539, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Festive Purple Dress
{ 24, 21541, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Festive Black Pant Suit
{ 25, 21544, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Festive Blue Pant Suit
{ 26, 21543, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Festive Teal Pant Suit
{ 13, 21537, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:1" }, -- Festival Dumplings
{ 14, 21721, [PRICE_EXTRA_ITTYPE] = "money:15" }, -- Moonglow
{ 28, 21713, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Elune's Candle
{ 29, 21747, [PRICE_EXTRA_ITTYPE] = "money:300" }, -- Festival Firecracker
-- Page 2
{ 101, 21640, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Lunar Festival Fireworks Pack
{ 102, 21558 }, -- Small Blue Rocket
{ 103, 21559 }, -- Small Green Rocket
{ 104, 21557 }, -- Small Red Rocket
{ 105, 21561 }, -- Small White Rocket
{ 106, 21562 }, -- Small Yellow Rocket
{ 117, 21589 }, -- Large Blue Rocket
{ 118, 21590 }, -- Large Green Rocket
{ 119, 21592 }, -- Large Red Rocket
{ 120, 21593 }, -- Large White Rocket
{ 121, 21595 }, -- Large Yellow Rocket
{ 108, 21558, [PRICE_EXTRA_ITTYPE] = "money:25" }, -- Small Blue Rocket
{ 109, 21559, [PRICE_EXTRA_ITTYPE] = "money:25" }, -- Small Green Rocket
{ 110, 21557, [PRICE_EXTRA_ITTYPE] = "money:25" }, -- Small Red Rocket
{ 123, 21571, [PRICE_EXTRA_ITTYPE] = "money:100" }, -- Blue Rocket Cluster
{ 124, 21574, [PRICE_EXTRA_ITTYPE] = "money:100" }, -- Green Rocket Cluster
{ 125, 21576, [PRICE_EXTRA_ITTYPE] = "money:100" }, -- Red Rocket Cluster
},
},
{ --LunarFestivalRecipes
name = AL["Recipes"],
[NORMAL_DIFF] = {
{ 1, 21738, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Schematic: Firework Launcher (p5 225)
{ 3, 21740, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Small Rocket Recipes (p5 125)
{ 4, 21724 }, -- Schematic: Small Blue Rocket (p5 125)
{ 5, 21725 }, -- Schematic: Small Green Rocket (p5 125)
{ 6, 21726 }, -- Schematic: Small Red Rocket (p5 125)
{ 8, 21742, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Large Rocket Recipes (p5 175)
{ 9, 21727 }, -- Schematic: Large Blue Rocket (p5 175)
{ 10, 21728 }, -- Schematic: Large Green Rocket (p5 175)
{ 11, 21729 }, -- Schematic: Large Red Rocket (p5 175)
{ 13, 44916, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Pattern: Festival Dress (p8 250)
{ 16, 21737, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Schematic: Cluster Launcher (p5 275)
{ 18, 21741, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Cluster Rocket Recipes (p5 225)
{ 19, 21730 }, -- Schematic: Blue Rocket Cluster (p5 225)
{ 20, 21731 }, -- Schematic: Green Rocket Cluster (p5 225)
{ 21, 21732 }, -- Schematic: Red Rocket Cluster (p5 225)
{ 23, 21743, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Large Cluster Rocket Recipes (p5 275)
{ 24, 21733 }, -- Schematic: Large Blue Rocket Cluster (p5 275)
{ 25, 21734 }, -- Schematic: Large Green Rocket Cluster (p5 275)
{ 26, 21735 }, -- Schematic: Large Red Rocket Cluster (p5 275)
{ 28, 44917, [PRICE_EXTRA_ITTYPE] = "ancestrycoin:5" }, -- Pattern: Festival Suit (p8 250)
},
},
{ --LunarFestivalMisc
name = AL["Special Rewards"],
[NORMAL_DIFF] = {
{ 1, 21540, [QUEST_EXTRA_ITTYPE] = 8868 }, -- Elune's Lantern
{ 16, 21746 }, -- Lucky Red Envelope
{ 17, 21745 }, -- Elder's Moonstone
{ 18, 21744 }, -- Lucky Rocket Cluster
},
},
}
}
data["Noblegarden"] = {
name = AL["Noblegarden"].." ("..ALIL["April"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --Noblegarden
name = AL["Noblegarden"],
[ALLIANCE_DIFF] = {
{ 1, 72145, "mount", [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:500" }, -- Swift Springstrider
{ 2, 116258, "pet1514", [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:100" }, -- Mystical Spring Bouquet
{ 3, 44794, "pet200", [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:100" }, -- Spring Rabbit's Foot
{ 4, 44793, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:100" }, -- Tome of Polymorph: Rabbit
{ 5, 45073, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:50" }, -- Spring Flowers
{ 6, 44792, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:10" }, -- Blossoming Branch
{ 7, 44818, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:5" }, -- Noblegarden Egg
{ 9, 45067, [QUEST_EXTRA_ITTYPE] = 13502 }, -- Egg Basket
{ 11, 44791 }, -- Noblegarden Chocolate
{ 16, 44803, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:50" }, -- Spring Circlet
{ 17, 74282, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:50" }, -- Black Spring Circlet
{ 18, 74283, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:50" }, -- Pink Spring Circlet
{ 19, 19028, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:50" }, -- Elegant Dress
{ 20, 44800, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:50" }, -- Spring Robes
{ 21, 6833, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:25" }, -- White Tuxedo Shirt
{ 22, 6835, [PRICE_EXTRA_ITTYPE] = "noblegardenchocolate:25" }, -- Black Tuxedo Pants
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 9, 45067, [QUEST_EXTRA_ITTYPE] = 13503 }, -- Egg Basket
},
},
}
}
data["ChildrensWeek"] = {
name = AL["Children's Week"].." ("..ALIL["April"].." - "..ALIL["May"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --ChildrensWeek
name = AL["Children's Week"],
[NORMAL_DIFF] = {
{ 1, "INV_Box_01", nil, AL["Azeroth"], ALIL["Stormwind City"].." / "..ALIL["Orgrimmar"] },
{ 2, 23007, "pet126" }, -- Piglet's Collar
{ 3, 23015, "pet127" }, -- Rat Cage
{ 4, 66073, "pet289" }, -- Snail Shell
{ 5, 23002, "pet125" }, -- Turtle Box
{ 7, "INV_Box_01", nil, ALIL["Outland"], ALIL["Shattrath City"] },
{ 8, 32616, "pet158" }, -- Egbert's Egg
{ 9, 32622, "pet159" }, -- Elekk Training Collar
{ 10, 69648, "pet308" }, -- Legs
{ 11, 32617, "pet157" }, -- Sleepy Willy
{ 13, "INV_Box_01", nil, ALIL["Northrend"], ALIL["Dalaran"] },
{ 14, 46545, "pet225" }, -- Curious Oracle Hatchling
{ 15, 46544, "pet226" }, -- Curious Wolvar Pup
{ 16, "INV_Box_01", nil, AL["Common Rewards"], nil },
{ 17, 71153 }, -- Magical Pet Biscuit
{ 18, 23022 }, -- Curmudgeon's Payoff
{ 20, "INV_Box_01", nil, AL["Vendor"], nil },
{ 21, 69895, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Green Balloon
{ 22, 69896, [PRICE_EXTRA_ITTYPE] = "money:1000" }, -- Yellow Balloon
},
},
}
}
data["MidsummerFireFestival"] = {
name = AL["Midsummer Fire Festival"].." ("..ALIL["June"].." - "..ALIL["July"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --MidsummerFireFestivalAhune
name = BB["Ahune"].." ("..ALIL["The Slave Pens"]..")",
[NORMAL_DIFF] = {
{ 1, "117372:1800" }, -- Cloak of the Frigid Winds
{ 2, "117374:1800" }, -- Icebound Cloak
{ 3, "117375:1800" }, -- Shroud of Winter's Chill
{ 4, "117376:1800" }, -- The Frost Lord's Battle Shroud
{ 5, "117377:1800" }, -- The Frost Lord's War Cloak
{ 7, 35498 }, -- Formula: Enchant Weapon - Deathfrost (p4 350)
{ 9, 35557 }, -- Huge Snowball
{ 10, 35720 }, -- Lord of Frost's Private Label
{ 12, 35723 }, -- Shards of Ahune
{ 13, 35280, [QUEST_EXTRA_ITTYPE] = 11972 }, -- Tabard of Summer Flames
{ 14, 35279, [QUEST_EXTRA_ITTYPE] = 11972 }, -- Tabard of Summer Skies
{ 16, 117394 }, -- Satchel of Chilled Goods
{ 17, "117373:1800" }, -- Frostscythe of Lord Ahune
{ 18, 53641, "pet253" }, -- Ice Chip
{ 20, 138838 }, -- Illusion: Deathfrost
{ 22, 23247 }, -- Burning Blossom
},
},
{ --MidsummerFireFestival
name = AL["Midsummer Fire Festival"],
[ALLIANCE_DIFF] = {
{ 1, 34686, [PRICE_EXTRA_ITTYPE] = "burningblossom:350" }, -- Brazier of Dancing Flames
{ 2, 116440, [PRICE_EXTRA_ITTYPE] = "burningblossom:500" }, -- Burning Defender's Medallion
{ 3, 116435, [PRICE_EXTRA_ITTYPE] = "burningblossom:350" }, -- Cozy Bonfire
{ 4, 141649, [PRICE_EXTRA_ITTYPE] = "burningblossom:500" }, -- Set of Matches
{ 6, 23246, [PRICE_EXTRA_ITTYPE] = "burningblossom:2" }, -- Fiery Festival Brew
{ 7, 23435, [PRICE_EXTRA_ITTYPE] = "burningblossom:5", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Elderberry Pie
{ 8, 23327, [PRICE_EXTRA_ITTYPE] = "burningblossom:5", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Fire-Toasted Bun
{ 9, 23326, [PRICE_EXTRA_ITTYPE] = "burningblossom:5", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Midsummer Sausage
{ 10, 23211, [PRICE_EXTRA_ITTYPE] = "burningblossom:5", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Toasted Smorc
{ 11, 34684, [PRICE_EXTRA_ITTYPE] = "burningblossom:2" }, -- Handful of Summer Petals
{ 12, 23215, [PRICE_EXTRA_ITTYPE] = "burningblossom:5", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Bag of Smorc Ingredients
{ 13, 34599, [PRICE_EXTRA_ITTYPE] = "burningblossom:5", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Juggling Torch
{ 16, 23083, "pet128", [PRICE_EXTRA_ITTYPE] = "burningblossom:350" }, -- Captured Flame
{ 17, 116439, "pet1517", [PRICE_EXTRA_ITTYPE] = "burningblossom:350" }, -- Blazing Cindercrawler
{ 18, 141714, "pet1949", [PRICE_EXTRA_ITTYPE] = "burningblossom:350" }, -- Igneous Flameling
{ 20, 23323, [QUEST_EXTRA_ITTYPE] = 9365 }, -- Crown of the Fire Festival
{ 21, 74278, [PRICE_EXTRA_ITTYPE] = "burningblossom:350" }, -- Helm of the Fire Festival
{ 22, 23324, [PRICE_EXTRA_ITTYPE] = "burningblossom:100" }, -- Mantle of the Fire Festival
{ 23, 34685, [PRICE_EXTRA_ITTYPE] = "burningblossom:100" }, -- Vestment of Summer
{ 24, 34683, [PRICE_EXTRA_ITTYPE] = "burningblossom:200" }, -- Sandals of Summer
{ 26, 122338, [PRICE_EXTRA_ITTYPE] = "burningblossom:350" }, -- Ancient Heirloom Armor Casing
{ 27, 122340, [PRICE_EXTRA_ITTYPE] = "burningblossom:600" }, -- Timeworn Heirloom Armor Casing
{ 29, 23247 }, -- Burning Blossom
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 20, 23323, [QUEST_EXTRA_ITTYPE] = 9339 }, -- Crown of the Fire Festival
},
},
}
}
data["HarvestFestival"] = {
name = AL["Harvest Festival"].." ("..ALIL["September"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --HarvestFestival
name = AL["Harvest Festival"],
[NORMAL_DIFF] = {
{ 1, 19995 }, -- Harvest Boar
{ 2, 19996 }, -- Harvest Fish
{ 3, 19994 }, -- Harvest Fruit
{ 4, 19997 }, -- Harvest Nectar
{ 16, 19697 }, -- Bounty of the Harvest
{ 17, [ATLASLOOT_IT_ALLIANCE] = 20009, [ATLASLOOT_IT_HORDE] = 20010, [QUEST_EXTRA_ITTYPE] = 8149 }, -- For the Light! / The Horde's Hellscream
},
},
}
}
data["Brewfest"] = {
name = AL["Brewfest"].." ("..ALIL["September"].." - "..ALIL["October"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --BrewfestCorenDirebrew
name = BB["Coren Direbrew"].." ("..ALIL["Blackrock Depths"]..")",
[NORMAL_DIFF] = {
{ 1, "117361:1800" }, -- Bitterest Balebrew Charm
{ 2, "117357:1800" }, -- Brawler's Statue
{ 3, "117391:1800" }, -- Bubbliest Brightbrew Charm
{ 4, "117360:1800" }, -- Coren's Cold Chromium Coaster
{ 5, "117358:1800" }, -- Mithril Wristwatch
{ 6, "117359:1800" }, -- Thousand-Year Pickled Egg
{ 8, [ATLASLOOT_IT_ALLIANCE] = 38281, [ATLASLOOT_IT_HORDE] = 38280 }, -- Direbrew's Dire Brew
{ 16, 117393 }, -- Keg-Shaped Treasure Chest (Daily reward)
{ 17, "117378:1800" }, -- Direbrew's Bloodied Shanker
{ 18, "117379:1800" }, -- Tremendous Tankard O' Terror
{ 19, 37828, "mount" }, -- Great Brewfest Kodo
{ 20, 33977, "mount" }, -- Swift Brewfest Ram
{ 21, 37863 }, -- Direbrew's Remote
{ 22, 37829 }, -- Brewfest Prize Token
},
},
{ --BrewfestVendor
name = AL["Vendor"],
[NORMAL_DIFF] = {
{ 1, 46707, "pet166", [PRICE_EXTRA_ITTYPE] = "brewfest:100" }, -- Pint-Sized Pink Pachyderm
{ 2, 32233, "pet153", [PRICE_EXTRA_ITTYPE] = "brewfest:200" }, -- Wolpertinger's Tankard
{ 3, 116756, "pet1518", [PRICE_EXTRA_ITTYPE] = "brewfest:200"}, -- Stout Alemental
{ 5, 116758, [PRICE_EXTRA_ITTYPE] = "brewfest:100" }, -- Brewfest Banner
{ 6, 33927, [PRICE_EXTRA_ITTYPE] = "brewfest:100" }, -- Brewfest Pony Keg
{ 7, 71137, [PRICE_EXTRA_ITTYPE] = "brewfest:200" }, -- Brewfest Keg Pony
{ 8, 90427, [PRICE_EXTRA_ITTYPE] = "brewfest:100" }, -- Pandaren Brewpack
{ 9, 116757, [PRICE_EXTRA_ITTYPE] = "brewfest:200" }, -- Steamworks Sausage Grill
{ 10, 138900, [PRICE_EXTRA_ITTYPE] = "brewfest:100" }, -- Gravil Goldbraid's Famous Sausage Hat
{ 12, 37816, [PRICE_EXTRA_ITTYPE] = "brewfest:20" }, -- Preserved Brewfest Hops
{ 13, 90426, [PRICE_EXTRA_ITTYPE] = "brewfest:2" }, -- Brewhelm
{ 15, 37750, [PRICE_EXTRA_ITTYPE] = "brewfest:2" }, -- Fresh Brewfest Hops
{ 15, [ATLASLOOT_IT_ALLIANCE] = 39477, [ATLASLOOT_IT_HORDE] = 39476, [PRICE_EXTRA_ITTYPE] = "brewfest:5" }, -- Fresh Dwarven Brewfest Hops / Fresh Goblin Brewfest Hops
{ 16, [ATLASLOOT_IT_ALLIANCE] = 33047, [ATLASLOOT_IT_HORDE] = 34008, [PRICE_EXTRA_ITTYPE] = "brewfest:100" }, -- Belbi's Eyesight Enhancing Romance Goggles / Blix's Eyesight Enhancing Romance Goggles
{ 17, 138730, [PRICE_EXTRA_ITTYPE] = "brewfest:200" }, -- Synthebrew Goggles XL
{ 19, 33968, [PRICE_EXTRA_ITTYPE] = "brewfest:50" }, -- Blue Brewfest Hat
{ 20, 33864, [PRICE_EXTRA_ITTYPE] = "brewfest:50" }, -- Brown Brewfest Hat
{ 21, 33967, [PRICE_EXTRA_ITTYPE] = "brewfest:50" }, -- Green Brewfest Hat
{ 22, 33969, [PRICE_EXTRA_ITTYPE] = "brewfest:50" }, -- Purple Brewfest Hat
{ 24, 33863, [PRICE_EXTRA_ITTYPE] = "brewfest:200" }, -- Brewfest Dress
{ 25, 33862, [PRICE_EXTRA_ITTYPE] = "brewfest:200" }, -- Brewfest Regalia
{ 26, 33868, [PRICE_EXTRA_ITTYPE] = "brewfest:100" }, -- Brewfest Boots
{ 27, 33966, [PRICE_EXTRA_ITTYPE] = "brewfest:100" }, -- Brewfest Slippers
{ 29, 37599, [PRICE_EXTRA_ITTYPE] = "brewfest:200" }, -- "Brew of the Month" Club Membership Form
{ 30, 119209, [PRICE_EXTRA_ITTYPE] = "brewfest:50" }, -- Angry Brewfest Letter
{ 101, 122339, [PRICE_EXTRA_ITTYPE] = "brewfest:300" }, -- Ancient Heirloom Scabbard
{ 102, 122341, [PRICE_EXTRA_ITTYPE] = "brewfest:500" }, -- Timeworn Heirloom Scabbard
{ 104, 138884 } --Throwing Sausage
},
},
{ --BrewfestFoodDrinks
name = AL["Food"].." & "..AL["Drinks"],
[NORMAL_DIFF] = {
{ 1, 33030 }, -- Barleybrew Clear
{ 2, 33028 }, -- Barleybrew Light
{ 3, 33029 }, -- Barleybrew Dark
{ 5, 33031 }, -- Thunder 45
{ 6, 33032 }, -- Thunderbrew Ale
{ 7, 33033 }, -- Thunderbrew Stout
{ 9, 33034 }, -- Gordok Grog
{ 10, 33036 }, -- Mudder's Milk
{ 11, 33035 }, -- Ogre Mead
{ 13, 34017 }, -- Small Step Brew
{ 14, 34018 }, -- Long Stride Brew
{ 15, 34019 }, -- Path of Brew
{ 16, 34020 }, -- Jungle River Water
{ 17, 34021 }, -- Brewdoo Magic
{ 18, 34022 }, -- Stout Shrunken Head
{ 20, 33929 }, -- Brewfest Brew
{ 22, 34063 }, -- Dried Sausage
{ 23, 33024 }, -- Pickled Sausage
{ 24, 38428 }, -- Rock-Salted Pretzel
{ 25, 33023 }, -- Savory Sausage
{ 26, 34065 }, -- Spiced Onion Cheese
{ 27, 33025 }, -- Spicy Smoked Sausage
{ 28, 34064 }, -- Succulent Sausage
{ 29, 33043 }, -- The Essential Brewfest Pretzel
{ 30, 33026 }, -- The Golden Link
},
},
{ --BrewfestMonthClub
name = AL["Brew of the Month Club"],
[NORMAL_DIFF] = {
{ 1, 37599, [PRICE_EXTRA_ITTYPE] = "brewfest:200" }, -- "Brew of the Month" Club Membership Form
{ 3, 37488 }, -- Wild Winter Pilsner (January)
{ 4, 37489 }, -- Izzard's Ever Flavor (February)
{ 5, 37490 }, -- Aromatic Honey Brew (March)
{ 6, 37491 }, -- Metok's Bubble Bock (April)
{ 7, 37492 }, -- Springtime Stout (May)
{ 8, 37493 }, -- Blackrock Lager (June)
{ 18, 37494 }, -- Stranglethorn Brew (July)
{ 19, 37495 }, -- Draenic Pale Ale (August)
{ 20, 37496 }, -- Binary Brew (September)
{ 21, 37497 }, -- Autumnal Acorn Ale (October)
{ 22, 37498 }, -- Bartlett's Bitter Brew (November)
{ 23, 37499 }, -- Lord of Frost's Private Label (December)
},
},
}
}
data["HallowsEnd"] = {
name = AL["Hallow's End"].." ("..ALIL["October"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --Hallows End Headless Horseman
name = BB["Headless Horseman"].." ("..ALIL["Scarlet Monastery"]..")",
[NORMAL_DIFF] = {
{ 1, "117363:3493" }, -- Band of the Petrified Pumpkin
{ 2, "117364:3493" }, -- Seal of Ghoulish Glee
{ 3, "117365:3493" }, -- The Horseman's Ring
{ 4, "117362:3493" }, -- Wicked Witch's Signet
{ 6, 34068 }, -- Weighted Jack-o'-Lantern
{ 16, 54516 }, -- Loot-Filled Pumpkin
{ 17, "117355:3493" }, -- The Horseman's Horrific Hood
{ 18, "117356:3493" }, -- The Horseman's Sinister Slicer
{ 19, 37012, "mount" }, -- The Horseman's Reins
{ 20, 33292 }, -- Hallowed Helm
{ 21, 37011 }, -- Magic Broom
{ 22, 33154, "pet162" }, -- Sinister Squashling
{ 23, 33226 }, -- Tricky Treat
},
},
{ --Hallows End Candy Toys
name = AL["Candy"].." & "..AL["Toys"],
[ALLIANCE_DIFF] = {
-- Pets
{ 1, 151269, "pet2002", [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Naxxy
{ 2, 116804, "pet1523", [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Widget the Departed
{ 3, 116801, "pet1521", [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Cursed Birman
{ 4, 70908, "pet319", [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Feline Familiar
{ 5, 33154, "pet162", [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Sinister Squashling
{ 6, 71076, "pet321", [QUEST_EXTRA_ITTYPE] = 29413 }, -- Creepy Crate
{ 8, 116811, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- "Lil' Starlet" Costume
{ 9, 116810, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- "Mad Alchemist" Costume
{ 10, 116812, [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- "Yipp-Saron" Costume
-- Toys
{ 12, 163045, [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Headless Horseman's Hearthstone
{ 13, 151271, [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Horse Head Costume
{ 14, 151270, [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Horse Tail Costume
{ 15, 70722, [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Little Wickerman
-- Disguises
{ 16, 151268, [PRICE_EXTRA_ITTYPE] = "trickytreat:200" }, -- Exquisite Costume Set: "Xavius"
{ 17, 138990, [PRICE_EXTRA_ITTYPE] = "trickytreat:200" }, -- Exquisite Costume Set: "Deathwing"
{ 18, 128643, [PRICE_EXTRA_ITTYPE] = "trickytreat:200" }, -- Exquisite Costume Set: "Deathwing"
{ 19, 116828, [PRICE_EXTRA_ITTYPE] = "trickytreat:200" }, -- Exquisite Costume Set: "The Lich King"
-- Festive Transmog
{ 21, 139136, }, -- Hat of the Youngest Sister
{ 22, 139135, }, -- Hat of the Third Sister
{ 23, 139134, }, -- Hat of the Second Sister
{ 24, 139133, }, -- Hat of the First Sister
{ 25, 33292, [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Hallowed Helm
-- Mounts
{ 27, 37011, [PRICE_EXTRA_ITTYPE] = "trickytreat:150" }, -- Magic Broom
-- Heirloom Upgrades
{ 101, 151614, [PRICE_EXTRA_ITTYPE] = "trickytreat:450" }, -- Weathered Heirloom Armor Casing
{ 102, 122340, [PRICE_EXTRA_ITTYPE] = "trickytreat:450" }, -- Timeworn Heirloom Armor Casing
{ 103, 122338, [PRICE_EXTRA_ITTYPE] = "trickytreat:250" }, -- Ancient Heirloom Armor Casing
-- Consumables
{ 116, 37585, [PRICE_EXTRA_ITTYPE] = "trickytreat:2", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Chewy Fel Taffy
{ 117, 37583, [PRICE_EXTRA_ITTYPE] = "trickytreat:2", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- G.N.E.R.D.S.
{ 118, 37582, [PRICE_EXTRA_ITTYPE] = "trickytreat:2", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Pyroblast Cinnamon Ball
{ 119, 37584, [PRICE_EXTRA_ITTYPE] = "trickytreat:2", [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Soothing Spearmint Candy
{ 120, 37604, [PRICE_EXTRA_ITTYPE] = "trickytreat:2", [ATLASLOOT_IT_AMOUNT1] = 10 }, -- Tooth Pick
{ 122, "INV_misc_food_25", nil, AL["Special Rewards"], nil },
{ 123, 33117 }, -- Jack-o'-Lantern
{ 124, 20400 }, -- Pumpkin Bag
{ 126, 20516 }, -- Bobbing Apple
{ 127, 34068 }, -- Weighted Jack-o'-Lantern
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 6, 71076, "pet321", [QUEST_EXTRA_ITTYPE] = 29429 }, -- Creepy Crate
},
},
{ --HallowsEndNonPlayableRaceMasks
name = AL["Non-Playable Race Masks"],
[NORMAL_DIFF] = {
{ 1, 69187, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- Murloc Female Mask
{ 2, 69188, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- Murloc Male Mask
{ 3, 69189, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- Naga Female Mask
{ 4, 69190, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- Naga Male Mask
{ 5, 69192, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- Ogre Female Mask
{ 6, 69193, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- Ogre Male Mask
{ 7, 69194, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- Vrykul Female Mask
{ 8, 69195, [PRICE_EXTRA_ITTYPE] = "trickytreat:5" }, -- Vrykul Male Mask
},
},
{ --HallowsEndPlayableRaceMasks
name = AL["Playable Race Masks"],
[NORMAL_DIFF] = {
{ 1, 34000, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Blood Elf Female Mask
{ 2, 34002, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Blood Elf Male Mask
{ 3, 34001, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Draenei Female Mask
{ 4, 34003, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Draenei Male Mask
{ 5, 20562, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Dwarf Female Mask
{ 6, 20561, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Dwarf Male Mask
{ 7, 20392, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Gnome Female Mask
{ 8, 20391, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Gnome Male Mask
{ 9, 49212, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Goblin Female Mask
{ 10, 49210, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Goblin Male Mask
{ 11, 20565, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Human Female Mask
{ 12, 20566, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Human Male Mask
{ 16, 20563, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Night Elf Female Mask
{ 17, 20564, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Night Elf Male Mask
{ 18, 20569, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Orc Female Mask
{ 19, 20570, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Orc Male Mask
{ 20, 20571, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Tauren Female Mask
{ 21, 20572, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Tauren Male Mask
{ 22, 20567, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Troll Female Mask
{ 23, 20568, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Troll Male Mask
{ 24, 20574, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Undead Female Mask
{ 25, 20573, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Undead Male Mask
{ 26, 49215, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Worgen Female Mask
{ 27, 49216, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Worgen Male Mask
},
},
{ --HallowsEndWands
name = AL["Wands"],
[NORMAL_DIFF] = {
{ 1, 116851, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Abomination
{ 2, 20410, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Bat
{ 3, 116853, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Geist
{ 4, 20409, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Ghost
{ 5, 116850, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Ghoul
{ 6, 20399, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Leper Gnome
{ 7, 20398, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Ninja
{ 8, 128644, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Wight
{ 9, 128645, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Gargoyle
{ 16, 20397, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Pirate
{ 17, 20413, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Random
{ 18, 20411, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Skeleton
{ 19, 116848, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Slime
{ 20, 116854, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Spider
{ 21, 20414, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Wisp
{ 22, 128646, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Nerubian
{ 23, 139004, [PRICE_EXTRA_ITTYPE] = "trickytreat:2" }, -- Hallowed Wand - Banshee
},
},
},
}
data["DayoftheDead"] = {
name = AL["Day of the Dead"].." ("..ALIL["November"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --DayoftheDead
name = AL["Day of the Dead"],
[NORMAL_DIFF] = {
{ 1, 116856, [PRICE_EXTRA_ITTYPE] = "money:1000000" }, -- "Blooming Rose" Contender's Costume
{ 2, 116888, [PRICE_EXTRA_ITTYPE] = "money:1000000" }, -- "Night Demon" Contender's Costume
{ 3, 116889, [PRICE_EXTRA_ITTYPE] = "money:1000000" }, -- "Purple Phantom" Contender's Costume
{ 4, 116890, [PRICE_EXTRA_ITTYPE] = "money:1000000" }, -- "Santo's Sun" Contender's Costume
{ 5, 116891, [PRICE_EXTRA_ITTYPE] = "money:1000000" }, -- "Snowy Owl" Contender's Costume
{ 7, 46831, "pet1351", [QUEST_EXTRA_ITTYPE] = 14174 }, -- Macabre Marionette
{ 16, 46718, [PRICE_EXTRA_ITTYPE] = "money:10" }, -- Orange Marigold
{ 17, 46861, [PRICE_EXTRA_ITTYPE] = "money:10000" }, -- Bouquet of Orange Marigolds
{ 19, 46710, [PRICE_EXTRA_ITTYPE] = "money:2000" }, -- Recipe: Bread of the Dead (p3 1)
{ 20, 46691 }, -- Bread of the Dead
{ 22, 46690, [PRICE_EXTRA_ITTYPE] = "money:25" }, -- Candy Skull
{ 23, 46711, [PRICE_EXTRA_ITTYPE] = "money:30" }, -- Spirit Candle
{ 24, 46860, [PRICE_EXTRA_ITTYPE] = "money:5" }, -- Whimsical Skull Mask
},
},
}
}
data["PilgrimsBounty"] = {
name = AL["Pilgrim's Bounty"].." ("..ALIL["November"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --PilgrimsBounty
name = AL["Pilgrim's Bounty"],
[ALLIANCE_DIFF] = {
{ 1, 44810, "pet201" }, -- Turkey Cage (ACM 1694)
{ 3, 46809 }, -- Bountiful Cookbook
{ 4, 44860 }, -- Recipe: Spice Bread Stuffing (p3 1)
{ 5, 44862 }, -- Recipe: Pumpkin Pie (p3 100)
{ 6, 44858 }, -- Recipe: Cranberry Chutney (p3 160)
{ 7, 44859 }, -- Recipe: Candied Sweet Potato (p3 220)
{ 8, 44861 }, -- Recipe: Slow-Roasted Turkey (p3 280)
{ 10, 46888 }, -- Bountiful Basket (p3 350)
{ 11, 44855, [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Teldrassil Sweet Potato
{ 12, 44854, [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Tangy Wetland Cranberries
{ 13, 46784, [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Ripe Elwynn Pumpkin
{ 14, 44835, [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Autumnal Herbs
{ 15, 44853, [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Honey
{ 16, 44844, [QUEST_EXTRA_ITTYPE] = 14035 }, -- Turkey Caller
{ 18, 46723 }, -- Pilgrim's Hat (Daily reward)
{ 19, 46800 }, -- Pilgrim's Attire (Daily reward)
{ 20, 44785 }, -- Pilgrim's Dress (Daily reward)
{ 21, 46824 }, -- Pilgrim's Robe (Daily reward)
{ 22, 44788 }, -- Pilgrim's Boots (Daily reward)
{ 23, 44812 }, -- Turkey Shooter (Daily reward)
{ 25, 116404 }, -- Pilgrim's Bounty
{ 26, 116401 }, -- Fine Pilgrim's Hat
{ 27, 116403, "pet1516" }, -- Frightened Bush Chicken
{ 28, 116400 }, -- Silver-Plated Turkey Shooter
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 3, 46810 }, -- Bountiful Cookbook
{ 4, 46803 }, -- Recipe: Spice Bread Stuffing (p3 1)
{ 5, 46804 }, -- Recipe: Pumpkin Pie (p3 100)
{ 6, 46805 }, -- Cranberry Chutney (p3 160)
{ 7, 46806 }, -- Recipe: Candied Sweet Potato (p3 220)
{ 8, 46807 }, -- Recipe: Slow-Roasted Turkey (p3 280)
{ 11, 46797, [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Mulgore Sweet Potato
{ 12, 46793, [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Tangy Southfury Cranberries
{ 13, 46796, [ATLASLOOT_IT_AMOUNT1] = 5 }, -- Ripe Tirisfal Pumpkin
{ 16, 44844, [QUEST_EXTRA_ITTYPE] = 14047 }, -- Turkey Caller
},
},
}
}
data["Winterveil"] = {
name = AL["Feast of Winter Veil"].." ("..ALIL["December"].." - "..ALIL["January"]..")",
ContentType = SEASONALEVENTS_CONTENT,
items = {
{ --WinterveilStolenPresent
name = ALIL["Stolen Present"],
[NORMAL_DIFF] = {
{ 1, 116762, [QUEST_EXTRA_ITTYPE] = "1:7043" }, -- Stolen Present
{ 2, "117371:1800" }, -- Miniature Winter Veil Tree
{ 3, 70923 }, -- Gaudy Winter Veil Sweater
{ 5, 54436, "pet254" }, -- Blue Clockwork Rocket Bot
{ 6, 34425, "pet191" }, -- Clockwork Rocket Bot
{ 7, 73797, "pet337" }, -- Lump of Coal
{ 8, 104317, "pet1349" }, -- Rotten Little Helper
{ 10, 21215 }, -- Graccu's Mince Meat Fruitcake
{ 11, 44481 }, -- Grindgear Toy Gorilla
{ 12, 44601 }, -- Heavy Copper Racer
{ 13, 34498 }, -- Paper Zeppelin Kit
{ 14, 44482 }, -- Trusty Copper Racer
{ 15, 44599 }, -- Zippy Copper Racer
{ 17, 104318 }, -- Crashin' Thrashin' Flyer Controller
{ 18, 46709 }, -- MiniZep Controller
{ 19, 44606 }, -- Toy Train Set
{ 20, 45057 }, -- Wind-Up Train Wrecker
{ 21, 54343 }, -- Blue Crashin' Thrashin' Racer Controller
{ 22, 37710 }, -- Crashin' Thrashin' Racer Controller
{ 23, 90888 }, -- Foot Ball
{ 24, 90883 }, -- The Pigskin
{ 25, 54438 }, -- Tiny Blue Ragdoll
{ 26, 54437 }, -- Tiny Green Ragdoll
{ 27, 46725 }, -- Red Rider Air Rifle
{ 28, 116456 }, -- Scroll of Storytelling
},
},
{ --WinterveilGiftsPresents
name = AL["Gifts & Presents"],
[ALLIANCE_DIFF] = {
{ 1, 21310, [QUEST_EXTRA_ITTYPE] = 8768 }, -- Gaily Wrapped Present
{ 2, 21301, "pet119" }, -- Green Helper Box
{ 3, 21308, "pet118" }, -- Jingling Bell
{ 4, 21305, "pet120" }, -- Red Helper Box
{ 5, 21309, "pet117" }, -- Snowman Kit
{ 7, 21271, [QUEST_EXTRA_ITTYPE] = 8788 }, -- Gently Shaken Gift
{ 8, 116692 }, -- Fuzzy Green Lounge Cushion
{ 9, 116689 }, -- Pineapple Lounge Cushion
{ 10, 116690 }, -- Safari Lounge Cushion
{ 11, 116691 }, -- Zhevra Lounge Cushion
{ 12, 21235 }, -- Winter Veil Roast
{ 13, 21241 }, -- Winter Veil Eggnog
{ 16, 21327, [QUEST_EXTRA_ITTYPE] = 8769 }, -- Ticking Present
{ 17, 17720 }, -- Schematic: Snowmaster 9000 (p5 190)
{ 18, 17706 }, -- Plans: Edge of Winter (p2 190)
{ 19, 17725 }, -- Formula: Enchant Weapon - Winter's Might (p4 190)
{ 20, 17722 }, -- Pattern: Gloves of the Greatfather (p7 190)
{ 21, 17709 }, -- Recipe: Elixir of Frost Power (p1 190)
{ 22, 17724 }, -- Pattern: Green Holiday Shirt (p8 190)
{ 23, 21325 }, -- Mechanical Greench
{ 24, 21213 }, -- Preserved Holly
{ 26, 116761, [QUEST_EXTRA_ITTYPE] = 36617 }, -- Winter Veil Gift
{ 27, 116763 }, -- Crashin' Thrashin' Shredder Controller (2014)
{ 101, 21191, [QUEST_EXTRA_ITTYPE] = 8744 }, -- Carefully Wrapped Present
{ 102, 116451 }, -- Warm Blue Woolen Socks
{ 103, 116450 }, -- Warm Green Woolen Socks
{ 104, 116448 }, -- Warm Red Woolen Socks
{ 105, 21254 }, -- Winter Veil Cookie
{ 107, 21363, [QUEST_EXTRA_ITTYPE] = 8803 }, -- Festive Gift
{ 108, 21328 }, -- Wand of Holiday Cheer
{ 116, 21216, [QUEST_EXTRA_ITTYPE] = 7045 }, -- Smokywood Pastures Extra-Special Gift
{ 117, 21215 }, -- Graccu's Mince Meat Fruitcake
{ 119, "INV_Holiday_Christmas_Present_01", nil, AL["Special Rewards"], nil },
{ 120, 21525 }, -- Green Winter Hat
{ 121, 21524 }, -- Red Winter Hat
{ 122, 17712, [QUEST_EXTRA_ITTYPE] = 7045 }, -- Winter Veil Disguise Kit (mailed 24h after quest)
{ 123, 17202 }, -- Snowball
{ 124, 21215 }, -- Handful of Snowflakes
{ 125, 21212 }, -- Fresh Holly
{ 126, 21519 }, -- Mistletoe
},
[HORDE_DIFF] = {
GetItemsFromDiff = ALLIANCE_DIFF,
{ 116, 21216, [QUEST_EXTRA_ITTYPE] = 6984 }, -- Smokywood Pastures Extra-Special Gift
{ 122, 17712, [QUEST_EXTRA_ITTYPE] = 6984 }, -- Winter Veil Disguise Kit (mailed 24h after quest)
},
},
{ --WinterveilVendor
name = AL["Smokywood Pastures Vendor"],
[NORMAL_DIFF] = {
{ 1, 70923 }, -- Gaudy Winter Veil Sweater
{ 3, 34262 }, -- Pattern: Winter Boots (p7 (85)
{ 4, 34319 }, -- Pattern: Red Winter Clothes (p8 250)
{ 5, 34261 }, -- Pattern: Green Winter Clothes (p8 250)
{ 6, 34413 }, -- Recipe: Hot Apple Cider (p3 325)
{ 7, 17201 }, -- Recipe: Egg Nog (p3 35)
{ 8, 17200 }, -- Recipe: Gingerbread Cookie (p3 1)
{ 9, 17194 }, -- Holiday Spices
{ 11, 17303 }, -- Blue Ribboned Wrapping Paper
{ 12, 17304 }, -- Green Ribboned Wrapping Paper
{ 13, 17307 }, -- Purple Ribboned Wrapping Paper
{ 15, 17202 }, -- Snowball
{ 16, 17344 }, -- Candy Cane
{ 17, 17406 }, -- Holiday Cheesewheel
{ 18, 17407 }, -- Graccu's Homemade Meat Pie
{ 19, 21215 }, -- Graccu's Mince Meat Fruitcake
{ 20, 17408 }, -- Spicy Beefstick
{ 21, 34410 }, -- Honeyed Holiday Ham
{ 22, 17404 }, -- Blended Bean Brew
{ 23, 17405 }, -- Green Garden Tea
{ 24, 34412 }, -- Sparkling Apple Cider
{ 25, 17196 }, -- Holiday Spirits
{ 26, 17403 }, -- Steamwheedle Fizzy Spirits
{ 27, 17402 }, -- Greatfather's Winter Ale
},
},
}
}
|
Storage = {}
-- Initialize all of the tables, as needed
-- Tables:
-- avatars - an array of all of the avatar entities themselves
-- - {entity, name, playerData, arduData}
--
-- avatarPlayerData - an array of information about each player
-- - {player, realBody, currentAvatarData, lastBodySwap}
-- - Note: avatars and the controlling player (if one) link to each other in the tables, for easy cross reference
--
-- avatarARDUTable - an array of information for each ARDU
-- - {entity, name, deployedAvatarData, currentIteration}
-- Counts - these are kept so that we will NEVER have a duplicate name
-- avatarDefaultCount - a sequence count of all of the avatars ever created
-- ARDUCount - a sequence count of all ARDUs ever created
Storage.init = function()
-- Tables
if not global.avatars then
global.avatars = {}
end
if not global.avatarPlayerData then
global.avatarPlayerData = {}
end
if not global.avatarARDUTable then
global.avatarARDUTable = {}
end
-- Counts
if not global.avatarDefaultCount then
global.avatarDefaultCount = 0
end
if not global.ARDUCount then
global.ARDUCount = 0
end
end
Storage.swapCharacter = function(oldCharacter, newCharacter)
debugLog("Checking for character swap")
local player = oldCharacter.player or newCharacter.player
if player and player.valid then
local playerData = Storage.PlayerData.getOrCreate(player)
local avatarData = playerData.currentAvatarData
if avatarData and avatarData.entity and avatarData.entity == oldCharacter then
debugLog("Old character matches controlled avatar, swapping for new character")
avatarData.entity = newCharacter
end
end
end
-- Remove value(s) from a table, if they satify a function
-- @param tbl - a table to remove values from
-- @param func - a function to test each value against, removing the value if this function returns true
-- @return - the removed values (in an array)
Storage.removeFromTable = function(tbl, func)
local j = 1
local removed = {}
-- For each value in tbl, if it satifies the function, then remove it
for i = 1, #tbl do
if func(tbl[i]) then
table.insert(removed, tbl[i])
tbl[i] = nil
else
-- If the value is to be kept, then move it up in the table if needed
if i ~= j then
tbl[j] = tbl[i]
tbl[i] = nil
end
j = j + 1
end
end
return removed
end
-- Remove a value from a table, if it satifies a function, using the key
-- @param tbl - a table to remove up to one value from
-- @param func - a function to test each key against, removing the value if this function returns true
-- @return - the removed key/value, if any
Storage.removeFromTableByKey = function(tbl, func)
for k, v in pairs(tbl) do
if func(k) then
local removed = {}
removed[k] = tbl[k]
tbl[k] = nil
return removed
end
end
end
Storage._repairMapping = {}
Storage.repairFromClone = function(source, destination)
if source and source.valid and destination and destination.valid then
local sourceName = source.name
local repairFunc = Storage._repairMapping[sourceName]
if repairFunc then
debugLog("Repairing " .. sourceName .. " from " .. source.surface.name .. " (" .. serpent.line(source.position) .. ") to " .. destination.surface.name .. " (" .. serpent.line(destination.position) .. ")")
repairFunc(source, destination)
end
end
end
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Avatars Global Table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--
-- {entity, name, playerData, arduData}
Storage.Avatars = {}
-- Add an avatar to the global table
-- @param avatar - a LuaEntity of the avatar
-- @return true or false if the add was successful
Storage.Avatars.add = function(avatar)
if avatar and avatar.valid then
debugLog("Adding avatar to the table")
local currentIncrement = global.avatarDefaultCount
local name = settings.global["Avatars_default_avatar_name"].value .. Util.formatNumberForName(currentIncrement)
global.avatarDefaultCount = currentIncrement + 1
table.insert(global.avatars, {entity=avatar, name=name, playerData=nil, arduData=nil})
GUI.Refresh.avatarControlChanged(avatar.force)
debugLog("Added avatar: " .. name)
return true
end
debugLog("Could not add avatar to table, either is nil or invalid")
return false
end
-- Remove an avatar from the global table
-- @param avatarEntity - a LuaEntity of the avatar
Storage.Avatars.remove = function(avatarEntity)
debugLog("Attempting to remove avatar. Current count: " .. #global.avatars)
local newFunction = function(arg) return arg.entity == avatarEntity end
local removedAvatars = Storage.removeFromTable(global.avatars, newFunction)
if #removedAvatars > 0 then
GUI.Refresh.avatarControlChanged()
end
-- Clean up references
for _, avatar in ipairs(removedAvatars) do
if avatar.arduData then
avatar.arduData.deployedAvatarData = nil
end
Storage.PlayerData.migrateAvatarQuickBars(avatar.name, nil)
end
debugLog("New count: " .. #global.avatars)
end
-- Get the value from the avatars global table, using the avatar's name
-- @param name - the name of the avatar
-- @return - the table value, or nil if not found
Storage.Avatars.getByName = function(name)
for _, avatar in ipairs(global.avatars) do
if avatar.name == name then
return avatar
end
end
end
-- Get the value from the avatars global table, using the avatar's entity
-- @param entity - the LuaEntity of the avatar
-- @return - the table value, or nil if not found
Storage.Avatars.getByEntity = function(entity)
for _, avatar in ipairs(global.avatars) do
if avatar.entity == entity then
return avatar
end
end
end
-- Get the value from the avatars global table, using the avatar's controlling player
-- @param player - the LuaPlayer of the avatar's controlling player
-- @return - the table value, or nil if not found
Storage.Avatars.getByPlayer = function(player)
for _, avatar in ipairs(global.avatars) do
if avatar.playerData and avatar.playerData.player == player then
return avatar
end
end
end
-- Repairs the avatar entity reference when a player joins the game when controlling an avatar
-- Factorio basically destroys and recreates the player's character on joining a game, so if it is an avatar then the global reference to it will need repaired
-- If the avatar is missing from the table (possible if a manual repair has happened while they were gone) then it will need readded to the table
Storage.Avatars.repairOnJoinedGame = function(player)
if player and player.valid and player.character and player.character.valid and player.character.name == "avatar" then
debugLog("Player rejoined game while controlling an avatar")
local avatar = Storage.Avatars.getByPlayer(player)
if avatar then
debugLog("Avatar found in current table, repairing entity reference")
avatar.entity = player.character
else
debugLog("Player connected with avatar that was missing, adding it back to the table")
Storage.Avatars.add(player.character)
end
end
end
-- Repairs the global avatars listing by removing invalid avatars and searching all surfaces for all avatars and adding them back to the list if they were missing
-- This is quite a resource heavy action because of the surface searches, so it shouldn't be done without player permission
Storage.Avatars.repair = function()
local newGlobal = {}
local removed = 0
for _, avatar in ipairs(global.avatars) do
local entity = avatar.entity
if entity and entity.valid then
table.insert(newGlobal, avatar)
else
debugLog("Repair: Removing invalid avatar: " .. avatar.name)
removed = removed + 1
end
end
global.avatars = newGlobal
-- Search everywhere and any any missing avatars
local added = 0
for _, surface in pairs(game.surfaces) do
local allAvatars = surface.find_entities_filtered({name="avatar"})
for _, entity in ipairs(allAvatars) do
local found = Storage.Avatars.getByEntity(entity)
if not found then
debugLog("Repair: Adding new avatar")
Storage.Avatars.add(entity)
added = added + 1
end
end
end
Util.printAll({"Avatars-repair-completed", removed, added})
end
Storage.Avatars.repairAvatar = function(source, target)
for _, avatar in ipairs(global.avatars) do
if avatar.entity == source then
avatar.entity = target
end
end
end
Storage._repairMapping["avatar"] = Storage.Avatars.repairAvatar
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Player Data Global Table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--
-- {player, realBody, currentAvatarData, lastBodySwap, realBodyQuickBars, avatarQuickBars}
-- player - LuaPlayer
-- realBody - LuaEntity of the player's character
-- currentAvatarData - global.avatars entry
-- lastBodySwap - tick of last body swap
-- realBodyQuickBars - array of active quick bar indicies, in order
-- avatarQuickBars - map of avatar name to array of active quick bar indicies, in order
Storage.PlayerData = {}
-- Get the value from the avatarPlayerData global table, if it exists
-- Or create it otherwise
-- @param player - a LuaPlayer object
-- @return - the table value
Storage.PlayerData.getOrCreate = function(player)
if player and player.valid then
-- Check if the player has data in the table already
for _, playerData in ipairs(global.avatarPlayerData) do
if playerData.player == player then
debugLog("PlayerData for " .. player.name .. " was found in the table")
return playerData
end
end
-- Create their data otherwise
debugLog("Adding PlayerData for " .. player.name)
local playerData = {player=player, realBody=nil, currentAvatarData=nil, lastBodySwap=nil, realBodyQuickBars=nil, avatarQuickBars={}}
table.insert(global.avatarPlayerData, playerData)
debugLog("Players in PlayerData: " .. #global.avatarPlayerData)
return playerData
end
end
-- Get the first value from the avatarPlayerData global table that satifies the provided function, or nil
-- @param func - a function to test the values against
-- @return - the table value
Storage.PlayerData.getByFunc = function(func)
for _, playerData in ipairs(global.avatarPlayerData) do
if func(playerData) then
return playerData
end
end
end
-- Get the value from the avatarPlayerData global table, using the player's entity (checking against the realBody)
-- @param entity - the LuaEntity of the player character
-- @return - the table value, or nil if not found
Storage.PlayerData.getByEntity = function(entity)
return Storage.PlayerData.getByFunc(function(data) return data.realBody == entity end)
end
-- Moves an all of an avatar's saved quickbars when it gets renamed, or removes it if the avatar dies
-- @param avatarName - old avatar name
-- @param newAvatarName - new avatar name, or nil if it no longer exists
Storage.PlayerData.migrateAvatarQuickBars = function(avatarName, newAvatarName)
local newFunction = function(key) return key == avatarName end
for _, playerData in ipairs(global.avatarPlayerData) do
if newAvatarName == nil then
Storage.removeFromTableByKey(playerData.avatarQuickBars, newFunction)
else
for name, quickBar in pairs(playerData.avatarQuickBars) do
if name == avatarName then
playerData.avatarQuickBars[newAvatarName] = playerData.avatarQuickBars[avatarName]
playerData.avatarQuickBars[avatarName] = nil
break
end
end
end
end
end
Storage.PlayerData.repair = function(source, target)
for _, playerData in ipairs(global.avatarPlayerData) do
if playerData.realBody == source then
playerData.realBody = target
end
end
end
Storage._repairMapping["character"] = Storage.PlayerData.repair
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ARDU Global Table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--
-- {entity, name, deployedAvatarData, currentIteration}
Storage.ARDU = {}
-- Add an ARDU to the global table
-- @param entity - a LuaEntity of the ARDU
-- @return true or false if the add was successful
Storage.ARDU.add = function(entity)
if entity and entity.valid then
debugLog("Adding ARDU to the table")
local currentIncrement = global.ARDUCount
local name = settings.global["Avatars_default_avatar_remote_deployment_unit_name"].value .. Util.formatNumberForName(currentIncrement)
global.ARDUCount = currentIncrement + 1
table.insert(global.avatarARDUTable, {
entity=entity,
name=name,
deployedAvatarData=nil,
currentIteration=0
})
debugLog("Added ARDU: " .. name)
GUI.Refresh.avatarControlChanged(entity.force)
return true
end
debugLog("Could not add ARDU to table, either is nil or invalid")
return false
end
-- Get the first value from the avatarARDUTable global table that satifies the provided function, or nil
-- @param func - a function to test the values against
-- @return - the table value
Storage.ARDU.getByFunc = function(func)
for _, currentARDU in ipairs(global.avatarARDUTable) do
if func(currentARDU) then
return currentARDU
end
end
end
-- Get the value from the avatarARDUTable global table, using the ARDU's entity
-- @param entity - the LuaEntity of the ARDU
-- @return - the table value, or nil if not found
Storage.ARDU.getByEntity = function(ARDU)
return Storage.ARDU.getByFunc(function(data) return data.entity == ARDU end)
end
-- Get the value from the avatarARDUTable global table, using the ARDU's entity
-- @param name - the name of the ARDU
-- @return - the table value, or nil if not found
Storage.ARDU.getByName = function(name)
return Storage.ARDU.getByFunc(function(data) return data.name == name end)
end
-- Remove an ARDU from the global table
-- @param ARDU - a LuaEntity of the ARDU
Storage.ARDU.remove = function(entity)
debugLog("Attempting to remove ARDU. Current count: " .. #global.avatarARDUTable)
local newFunction = function (arg) return arg.entity == entity end
local removedArdus = Storage.removeFromTable(global.avatarARDUTable, newFunction)
if #removedArdus > 0 then
GUI.Refresh.avatarControlChanged()
end
-- Clean up the Avatar data link
for _, ardu in ipairs(removedArdus) do
if ardu.deployedAvatarData then
ardu.deployedAvatarData.arduData = nil
end
end
debugLog("New count: " .. #global.avatarARDUTable)
end
Storage.ARDU.repair = function(source, target)
for _, currentARDU in ipairs(global.avatarARDUTable) do
if currentARDU.entity == source then
currentARDU.entity = target
end
end
end
Storage._repairMapping["avatar-remote-deployment-unit"] = Storage.ARDU.repair
|
-- The Great Computer Language Shootout
-- http://shootout.alioth.debian.org/
--
-- contributed by Isaac Gouy
require 'benchmarks/bench'
for pass = 1,2 do
local n = tonumber(arg and arg[1]) or 10000000
local partialSum = 0.0
for d = 1,n do partialSum = partialSum + (1.0/d) end
io.write(string.format("%0.9f",partialSum), "\n")
logPass(pass)
end
logEnd()
|
-- --- --- --
-- Require --
-- --- --- --
local _vlc_ = require('src/vlc')
local i18nModule = require('src/ui/i18n')
local utils = require('src/utils')
-- --- --- --
-- Header --
-- --- --- --
-- Fields
local i18n
-- Methods
local
addItem,
addItems,
compile,
compileItem
-- --- --- --
-- Code --
-- --- --- --
-- Add item into the playlist if the item is properly setup
addItem = function(name, properties, playlistItems)
if properties ~= nil then
-- if we have a folder :
-- 1. get items from the folder
-- 2. add them individually to the playlist
if properties['folder'] ~= nil then
local items = {}
compileItem(properties, items)
for _, item in ipairs(items) do
addItem(name, item, playlistItems)
end
else
-- else, we have an item
-- check that the protocol (and path) is set ...
local path
if properties['url'] ~= nil then
path = properties['url']
elseif properties['file'] ~= nil then
path = string.format('file://%s', properties['file'])
end
if path ~= nil then
-- ... prepare a VLC playlist item ...
local item = {
['path'] = path,
['name'] = name,
['options'] = {},
}
-- ... add vlc options, if wanted
for _, optionMethod in ipairs(_vlc_.options) do
if properties[optionMethod['option']] ~= nil then
table.insert(
item['options'],
_vlc_.optionMethod(optionMethod['option'])(properties[optionMethod['option']])
)
end
end
table.insert(playlistItems, item)
end
end
end
end
-- Iterate overs items to add them into the playlist
addItems = function(name, items, playlistItems)
if items ~= nil then
for index, item in ipairs(utils.toList(items)) do
addItem(
string.format(name, index),
item,
playlistItems
)
end
end
end
compile = function(config, playlistItems)
i18n = i18nModule.getTranslations()
if playlistItems == nil then
playlistItems = {}
end
-- Transform work-items folder into work-items files
local workItems = {}
if config['work-items'] ~= nil then
for _, workItem in ipairs(utils.toList(config['work-items'])) do
compileItem(workItem, workItems)
end
end
config['work-items'] = workItems
-- Prepare all the items to be added to the playlist ...
-- ... 1. items into the "work-before-all" root key ...
addItems(i18n.textInPlaylist['work-before-all'], config['work-before-all'], playlistItems)
-- ... Then for each "work-items" root key items ...
for _, workItem in ipairs(config['work-items']) do
-- ... 2. items into the "work-start" root key
addItems(i18n.textInPlaylist['work-start'], config['work-start'], playlistItems)
-- ... 3. the current work item
addItem(i18n.textInPlaylist['work-items'], workItem, playlistItems)
-- ... 4. items into the "work-end" root key
addItems(i18n.textInPlaylist['work-end'], config['work-end'], playlistItems)
end
-- ... 5. finally, items into the "work-after-all" root key ...
addItems(i18n.textInPlaylist['work-after-all'], config['work-after-all'], playlistItems)
end
-- Transform item with a `folder` key into a list of items with a `file` key
-- Taking care of custom options (randomization, ...)
-- Keep already set VLC options (stop at, ...)
compileItem = function(workItem, workItems)
-- If a folder is present ...
if workItem['folder'] ~= nil then
-- ... list the valid files ...
local workFiles = {}
for _, workFile in ipairs(_vlc_.readdir(workItem['folder'])) do
if workFile ~= '.' and workFile ~= '..' then
table.insert(workFiles, string.format('%s/%s', workItem['folder'], workFile))
end
end
-- ... randomize them, if wanted ...
if workItem['random'] ~= nil and workItem['random'] then
workFiles = utils.shuffle(workFiles)
end
-- ... keep a certain number, if wanted ...
if workItem['nbElements'] ~= nil then
local selectedWorkFiles = {}
for _, workFile in ipairs(workFiles) do
if workItem['nbElements'] > #selectedWorkFiles then
table.insert(selectedWorkFiles, workFile)
end
end
workFiles = selectedWorkFiles
end
-- ... repeat items, if wanted ...
if workItem['loop'] ~= nil then
local repeatedWorkFiles = {}
for _, workFile in ipairs(workFiles) do
for _ = 1, workItem['loop'] do
table.insert(repeatedWorkFiles, workFile)
end
end
workFiles = repeatedWorkFiles
end
-- ... create new items for each file (and keeping the initial vlc options)
for _, workFile in ipairs(workFiles) do
local newWorkItem = {
['file'] = workFile
}
-- Bring back the options defined for the folder to the new work item
for _, methodByOption in ipairs(_vlc_.options) do
if workItem[methodByOption['option']] ~= nil then
newWorkItem[methodByOption['option']] = workItem[methodByOption['option']]
end
end
table.insert(workItems, newWorkItem)
end
else
-- ... else, just keep the item as it is
table.insert(workItems, workItem)
end
end
-- --- --- --
-- Exports --
-- --- --- --
return {
addItem = addItem,
addItems = addItems,
compile = compile,
compileItem = compileItem,
} |
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:27' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
local WorldMapQuests = ZO_WorldMapQuests_Shared:Subclass()
local QUEST_DATA = 1
function WorldMapQuests:New(...)
local object = ZO_WorldMapQuests_Shared.New(self, ...)
return object
end
function WorldMapQuests:Initialize(control)
ZO_WorldMapQuests_Shared.Initialize(self, control)
self.control = control
self.noQuestsLabel = control:GetNamedChild("NoQuests")
self.headerPool = ZO_ControlPool:New("ZO_WorldMapQuestHeader", control:GetNamedChild("PaneScrollChild"), "Header")
WORLD_MAP_QUESTS_FRAGMENT = ZO_FadeSceneFragment:New(control)
FOCUSED_QUEST_TRACKER:RegisterCallback("QuestTrackerAssistStateChanged", function(...) self:RefreshHeaders() end)
end
function WorldMapQuests:LayoutList()
self:RefreshNoQuestsLabel()
local prevHeader
self.headerPool:ReleaseAllObjects()
for i, data in ipairs(self.data.masterList) do
local header = self.headerPool:AcquireObject(i)
if(prevHeader) then
header:SetAnchor(TOPLEFT, prevHeader, BOTTOMLEFT, 0, 4)
else
header:SetAnchor(TOPLEFT, nil, TOPLEFT, 0, 0)
end
prevHeader = header
end
self:RefreshHeaders()
end
function WorldMapQuests:RefreshHeaders()
for i, header in ipairs(self.headerPool:GetActiveObjects()) do
self:SetupQuestHeader(header, self.data.masterList[i])
end
end
function WorldMapQuests:SetupQuestHeader(control, data)
if (data == nil) then return end
--Quest Name
local nameControl = GetControl(control, "Name")
nameControl:SetText(data.name)
ZO_SelectableLabel_SetNormalColor(nameControl, ZO_ColorDef:New(GetColorForCon(GetCon(data.level))))
--Assisted State
local isAssisted = FOCUSED_QUEST_TRACKER:IsTrackTypeAssisted(TRACK_TYPE_QUEST, data.questIndex)
local assistedTexture = GetControl(control, "AssistedIcon")
assistedTexture:SetHidden(not isAssisted)
control.data = data
local nameWidth, nameHeight = nameControl:GetTextDimensions()
control:SetHeight(zo_max(24, nameHeight))
end
function WorldMapQuests:QuestHeader_OnClicked(header, button)
if button == MOUSE_BUTTON_INDEX_LEFT then
local data = header.data
ZO_WorldMap_PanToQuest(data.questIndex)
ZO_ZoneStories_Manager.StopZoneStoryTracking()
FOCUSED_QUEST_TRACKER:ForceAssist(data.questIndex)
end
end
function WorldMapQuests:QuestHeader_OnMouseEnter(header)
InitializeTooltip(ZO_MapQuestDetailsTooltip, header, RIGHT, -25)
ZO_MapQuestDetailsTooltip:SetQuest(header.data.questIndex)
end
--Local XML
function ZO_WorldMapQuestHeader_OnMouseEnter(header)
WORLD_MAP_QUESTS:QuestHeader_OnMouseEnter(header)
end
function ZO_WorldMapQuestHeader_OnMouseExit(header)
ClearTooltip(ZO_MapQuestDetailsTooltip)
end
function ZO_WorldMapQuestHeader_OnMouseDown(header, button)
local name = GetControl(header, "Name")
name:SetAnchor(TOPLEFT, nil, TOPLEFT, 26, 2)
end
function ZO_WorldMapQuestHeader_OnMouseUp(header, button, upInside)
local name = GetControl(header, "Name")
name:SetAnchor(TOPLEFT, nil, TOPLEFT, 26, 0)
WORLD_MAP_QUESTS:QuestHeader_OnClicked(header, button)
end
--Global XML
function ZO_WorldMapQuests_OnInitialized(self)
WORLD_MAP_QUESTS = WorldMapQuests:New(self)
end
--Quest Tooltip
-------------------
do
local function SetQuest(self, questIndex)
local labels, width = ZO_WorldMapQuests_Shared_SetupQuestDetails(self, questIndex)
for i = 1, #labels do
local label = labels[i]
label:SetWidth(width)
self:AddControl(label)
label:SetAnchor(CENTER)
self:AddVerticalPadding(-8)
end
end
function ZO_MapQuestDetailsTooltip_OnCleared(self)
self.labelPool:ReleaseAllObjects()
end
function ZO_MapQuestDetailsTooltip_OnInitialized(self)
self.labelPool = ZO_ControlPool:New("ZO_MapQuestDetailsCondition", self, "Label")
self.SetQuest = SetQuest
end
end |
-- -*- coding:utf-8; -*-
--- nginx 共享字典相关接口.
-- @module shm
-- @author:[email protected]
local cjson = require("cjson.safe")
local stringx = require("pl.stringx")
local metrics = require("falcon.metrics")
local M = {}
--- 获取本地主机名
local function get_host_name()
local f = io.popen ("/bin/hostname")
local hostname = f:read("*a") or ""
f:close()
hostname =string.gsub(hostname, "\n$", "")
return hostname
end
local host_name = get_host_name()
--- 获取 shm_key 对应的统计模块
-- @param shm_key nginx share dict 中存储的 key
-- @return 与 shm_key 对应的统计模块
function M.get_mod(shm_key)
local arr = stringx.split(shm_key, ":")
if #arr < 1 then
ngx.log(ngx.ERR, "invalid shm_key,", shm_key)
return
end
local metric = arr[1]
local mod = metrics.mods[metric]
if not mod then
ngx.log(ngx.ERR, "invalid mod,", shm_key)
return
end
return mod
end
--- 统计计数加一
-- nginx share dict 中 shm_key 对应的统计计数加一
-- @param shm_key nginx share dict 中对应的 key
function M.incr_value(shm_key)
local dict = ngx.shared["falcon"]
if ngx.config.ngx_lua_version < 10006 then
ngx.log(ngx.ERR, "ngx_lua_version too low")
else
local newval, err, forcible = dict:incr(shm_key, 1, 0)
-- local log_msg = string.format("new value for %s = %s", shm_key, newval)
-- ngx.log(ngx.DEBUG, log_msg)
end
end
--- 生成 shm_key 对应的 falcon item
-- @param shm_key 统计点对应的 shm_key
-- @param value 统计点对应的 value
function M.gen_falcon_item(shm_key, value)
local mod = M.get_mod(shm_key)
local item = mod.get_falcon_info(shm_key)
item.endpoint = host_name
item.timestamp = ngx.time()
item.value = value
--ngx.log(ngx.DEBUG, "shm_key=", shm_key,"value=",value,",item=", cjson.encode(item))
return item
end
--- 从 nginx 共享内存中生成此次上报的 payload
-- @return payload falcon 上报内容
function M.gen_falcon_payload()
local payload = {}
local dict = ngx.shared["falcon"]
local keys = dict:get_keys()
ngx.log(ngx.DEBUG,"all shm keys:", cjson.encode(keys))
for i,key in pairs(keys) do
local value = dict:get(key)
local item = M.gen_falcon_item(key, value)
if item then
table.insert(payload, item)
end
end
--ngx.log(ngx.DEBUG, "payload from shm:",cjson.encode(payload))
return payload
end
return M
|
local cache = require('app.helpers.cache')
local DistanceView = {}
local distance = require('distance.distance')
function DistanceView:initialize()
end
function DistanceView:layout(desk)
self.MainPanel = self.ui:getChildByName('MainPanel')
self.MainPanel:setPosition(display.cx,display.cy)
self.MainPanel:setScale(0.1)
local sc = cc.ScaleTo:create(0.1,1.0)
self.MainPanel:runAction(sc)
local black = self.ui:getChildByName('black')
black:setContentSize(cc.size(display.width,display.height))
self:load(desk)
end
function DistanceView:load(desk)
local list = self.MainPanel:getChildByName('list')
list:setItemModel(list:getItem(0))
list:removeAllItems()
local idx = 0
local function push()
list:pushBackDefaultItem()
local item = list:getItem(idx)
idx = idx + 1
return item
end
local down = desk:getPlayerByKey('down')
local left = desk:getPlayerByKey('left')
local right = desk:getPlayerByKey('right')
local top = desk:getPlayerByKey('top')
local function loadAvatar(head,data)
if data.actor.avatar then
head:retain()
cache.get(data.actor.avatar,function(ok,path)
if ok then
head:loadTexture(path)
end
head:release()
end)
end
end
local function setDistance(player0,player1,item)
if not player0.actor.x then return end
if not player1.actor.x then return end
local startPos = cc.p(player0.actor.x,player0.actor.y)
local endPos = cc.p(player1.actor.x,player1.actor.y)
local ret = distance.getDistance(startPos,endPos)
local tdistance = item:getChildByName('distance')
ret = math.floor(ret)
if ret > 1000 then
tdistance:setString('距离:'..math.floor(ret/1000)..'公里')
else
tdistance:setString('距离:'..math.floor(ret)..'米')
end
end
if down and left then
local item = push()
local l = item:getChildByName('left')
local r = item:getChildByName('right')
l:getChildByName('name'):setString(down.actor.nickName)
r:getChildByName('name'):setString(left.actor.nickName)
loadAvatar(l,down)
loadAvatar(r,left)
setDistance(down,left,item)
end
if down and right then
local item = push()
local l = item:getChildByName('left')
local r = item:getChildByName('right')
l:getChildByName('name'):setString(down.actor.nickName)
r:getChildByName('name'):setString(right.actor.nickName)
loadAvatar(l,down)
loadAvatar(r,right)
setDistance(down,right,item)
end
if down and top then
local item = push()
local l = item:getChildByName('left')
local r = item:getChildByName('right')
l:getChildByName('name'):setString(down.actor.nickName)
r:getChildByName('name'):setString(top.actor.nickName)
loadAvatar(l,down)
loadAvatar(r,top)
setDistance(down,top,item)
end
if left and right then
local item = push()
local l = item:getChildByName('left')
local r = item:getChildByName('right')
l:getChildByName('name'):setString(left.actor.nickName)
r:getChildByName('name'):setString(right.actor.nickName)
loadAvatar(l,left)
loadAvatar(r,right)
setDistance(left,right,item)
end
if left and top then
local item = push()
local l = item:getChildByName('left')
local r = item:getChildByName('right')
l:getChildByName('name'):setString(left.actor.nickName)
r:getChildByName('name'):setString(top.actor.nickName)
loadAvatar(l,left)
loadAvatar(r,top)
setDistance(left,top,item)
end
if right and top then
local item = push()
local l = item:getChildByName('left')
local r = item:getChildByName('right')
l:getChildByName('name'):setString(right.actor.nickName)
r:getChildByName('name'):setString(top.actor.nickName)
loadAvatar(l,right)
loadAvatar(r,top)
setDistance(right,top,item)
end
end
return DistanceView
|
--!nonstrict
local RunService = game:GetService("RunService")
-- Types
export type ReplicationKey = string | number
export type ReplicationPath = {[number]: ReplicationKey}
type ReplicationStore = {[ReplicationKey]: any}
type ReplicationChange = {
NoEvent: boolean?,
Path: ReplicationPath,
Value: any,
}
type ReplicationChanges = {[number]: ReplicationChange}
export type ReplicationContainerType = {
UnchangingKeys: {[ReplicationKey]: number},
Awaiting: {[string]: BindableEvent},
AwaitingRefs: {[string]: number},
EventConnection: RBXScriptConnection?,
PreSyncData: ReplicationChanges,
Changes: ReplicationChanges,
Store: ReplicationStore,
IsServer: boolean,
RemoteEvent: any,
Synced: boolean,
Sequence: number,
}
-- Microprofiler tags
local CONVERT_TO_NUMERIC_INDICES_TAG = "NR.Indices"
local CONVERT_PATH_TO_NUMERIC_TAG = "NR.Numeric"
local REPLICATE_PROCESS_TAG = "NR.Process"
local INT_DESERIALIZE_TAG = "NR.DInt"
local APPLY_METATABLE_TAG = "NR.Meta"
local GET_TYPED_PATH_TAG = "NR.Typed"
local PATH_TRAVERSE_TAG = "NR.Path"
local INT_SERIALIZE_TAG = "NR.SInt"
local MANUAL_SET_TAG = "NR.Set"
local AWAIT_TAG = "NR.Await"
local GET_TAG = "NR.Get"
-- More strings
local FLAT_PATH_DELIMITER = "^"
local LARGE_INT_SIGNAL = "!L"
local EMPTY_STRING = ""
-- Settings
local PERMAMENT_WRITE_WARN_DISABLE = not RunService:IsStudio() -- Removes the __newindex metatable, which can speed things up, but permanently disables direct write warnings
local DEBUG_LOG_CHANGES_CLIENT = false
local DEBUG_LOG_CHANGES_SERVER = false
local DEBUG_WARN_PATH_CONVERT = true
local DEBUG_LOG_AWAIT_COUNT = false
local FIX_FLOAT_KEYS = false -- Slower performance but allows numbers above the 64-bit integer range as table keys
local DEBUG_LOG_AWAIT_TIME = 30 -- How often to log active awaits
local DEFAULT_TIMEOUT = 30
local TIMEOUT_WARN = 5 -- When to warn user in possible timeout case
-- Derived
local LARGE_INT_SIGNAL_LENGTH = #LARGE_INT_SIGNAL
-----------------------------------------------------------------------------------
local EmptyMetatable = {}
-- Traverses each item in the table recursively, creating a path string for each
local function _PathTraverse(Root: ReplicationStore, Path: string, Callback: (any, string) -> nil)
for Key, Value in pairs(Root) do
local NewPath = Path .. (Path == EMPTY_STRING and EMPTY_STRING or FLAT_PATH_DELIMITER) .. tostring(Key)
Callback(NewPath, Value)
if (type(Value) == "table") then
_PathTraverse(Value, NewPath, Callback)
continue
end
end
end
local function PathTraverse(Root: ReplicationStore, Path: string, Callback: (any, string) -> nil)
debug.profilebegin(PATH_TRAVERSE_TAG)
_PathTraverse(Root, Path, Callback)
debug.profileend()
end
-- Converts a data structure with possible number-as-string indices into pure number indices
local function _ConvertToNumericalIndices(Data)
local Result = {}
for Key, Value in pairs(Data) do
if (type(Value) == "table") then
Value = _ConvertToNumericalIndices(Value)
end
local AsNumber = tonumber(Key)
Result[AsNumber or Key] = Value
end
return Result
end
local function ConvertToNumericalIndices(Data)
debug.profilebegin(CONVERT_TO_NUMERIC_INDICES_TAG)
local Result = _ConvertToNumericalIndices(Data)
debug.profileend()
return Result
end
-- Converts an array's elements to all numerics
local function _ConvertPathToNumeric(Path: ReplicationPath): ReplicationPath
local Length = #Path
local Result = table.create(Length)
for Index = 1, Length do
local Value = Path[Index]
local AsNumber = tonumber(Value)
Result[Index] = AsNumber or Value
if (DEBUG_WARN_PATH_CONVERT and AsNumber ~= Value and AsNumber) then
warn("Key was converted to number: " .. tostring(Value))
end
end
return Result
end
local function ConvertPathToNumeric(Path: ReplicationPath): ReplicationPath
debug.profilebegin(CONVERT_PATH_TO_NUMERIC_TAG)
local Result = _ConvertPathToNumeric(Path)
debug.profileend()
return Result
end
local function _GetTypedPath(Path: ReplicationPath): string
local Result = table.create(#Path)
for Index = 1, #Path do
Result[Index] = tostring(Path[Index])
end
return table.concat(Result, FLAT_PATH_DELIMITER)
end
local function GetTypedPath(Path: ReplicationPath): string
debug.profilebegin(GET_TYPED_PATH_TAG)
local Result = _GetTypedPath(Path)
debug.profileend()
return Result
end
local function _IntSerialize(Data)
-- Serializes ints larger than 64 bit since RemoteEvents are janky
local Result = {}
for Key, Value in pairs(Data) do
local AsNumber = tonumber(Key)
if (AsNumber ~= nil and (AsNumber >= 9_223_372_036_854_775_807 or AsNumber <= -9_223_372_036_854_775_808)) then
Key = LARGE_INT_SIGNAL .. Key
end
if (type(Value) == "table") then
Result[Key] = _IntSerialize(Value)
continue
end
Result[Key] = Value
end
return Result
end
local function _IntDeserialize(Data)
-- Deserializes ints larger than 64 bit
local Result = {}
for Key, Value in pairs(Data) do
if (type(Key) == "string" and Key:sub(1, LARGE_INT_SIGNAL_LENGTH) == LARGE_INT_SIGNAL) then
Key = tonumber(Key:sub(LARGE_INT_SIGNAL_LENGTH + 1))
end
if (type(Value) == "table") then
Result[Key] = _IntDeserialize(Value)
continue
end
Result[Key] = Value
end
return Result
end
local function IntSerialize(Data)
debug.profilebegin(INT_SERIALIZE_TAG)
local Result = _IntSerialize(Data)
debug.profileend()
return Result
end
local function IntDeserialize(Data)
debug.profilebegin(INT_DESERIALIZE_TAG)
local Result = _IntDeserialize(Data)
debug.profileend()
return Result
end
-----------------------------------------------------------------------------------
local ReplicationContainer = {}
ReplicationContainer.__index = ReplicationContainer
ReplicationContainer.SuppressWriteWarning = false
ReplicationContainer.GenericMetatable = {
__newindex = function(self: ReplicationContainerType, Key, Value)
if (not ReplicationContainer.SuppressWriteWarning) then
warn("Wrote " .. tostring(Value) .. " to " .. tostring(Key) .. "\n" .. debug.traceback())
end
rawset(self, Key, Value)
end;
}
function ReplicationContainer._ApplyMetatable(Root: ReplicationStore)
setmetatable(Root, ReplicationContainer.GenericMetatable)
for _, Item in pairs(Root) do
if (type(Item) == "table") then
ReplicationContainer._ApplyMetatable(Item)
end
end
end
function ReplicationContainer.new(RemoteEvent: any, IsServer: boolean): ReplicationContainerType
assert(RemoteEvent, "No remote event given!")
assert(IsServer ~= nil, "Please indicate whether this is running on server or client!")
local self = {
Store = {}; -- The data to be replicated
Changes = {}; -- Changes log, currently just simple array
Awaiting = {}; -- Awaiting: {[PathString]: BindableEvent}
PreSyncData = {};
AwaitingRefs = {}; -- AwaitingRefs: {[PathString]: Integer}
UnchangingKeys = {}; -- UnchangingKeys: {[Key]: Integer}
Sequence = 0;
Synced = false;
IsServer = IsServer;
RemoteEvent = RemoteEvent;
};
return setmetatable(self, ReplicationContainer)
end
ReplicationContainer.New = ReplicationContainer.new
function ReplicationContainer:GetNextSequence(): number
self.Sequence += 1
return self.Sequence
end
function ReplicationContainer:_CheckPath(PathName: string, Value: any)
local Event: BindableEvent = self.Awaiting[PathName]
if Event then
Event:Fire(Value)
end
end
function ReplicationContainer:_InitLogging()
-- Just to help with seeing where listeners aren't disconnected
if (not DEBUG_LOG_AWAIT_COUNT) then
return
end
coroutine.wrap(function()
while true do
local Count = 0
for _ in pairs(self.Awaiting) do
Count += 1
end
print("[NReplicate] Await count: " .. Count)
task.wait(DEBUG_LOG_AWAIT_TIME)
end
end)()
end
function ReplicationContainer:Commit(Data, InitialSyncPrint: boolean)
local NewData: ReplicationChange = ConvertToNumericalIndices(Data)
for Index = 1, #NewData do
local Change = NewData[Index]
local Path = ConvertPathToNumeric(Change.Path)
if (InitialSyncPrint) then
print("Initial sync commit: " .. GetTypedPath(Path))
end
debug.profilebegin(tostring(Path[#Path]))
self:Set(Path, Change.Value, Change.NoEvent)
debug.profileend()
end
end
-- Client method; syncs the store
function ReplicationContainer:InitClient()
assert(not self.Initialised, "Already initialised on client!")
local RemoteEvent = self.RemoteEvent
self.EventConnection = RemoteEvent.OnClientEvent:Connect(function(Data: ReplicationChange, SequenceNumber: number, InitialSync: boolean)
debug.profilebegin(REPLICATE_PROCESS_TAG)
if (FIX_FLOAT_KEYS) then
Data = IntDeserialize(Data)
end
--[[
A potential desync issue can arise:
- client sends initial_sync_request (to get root)
- server sends root.a.b
- client receives root.a.b
- server receives initial_sync_request
- server sends root
- client receives root
-> root.a.b is outdated
Fixed by queueing any pre-initial-sync data and
only update it in order after the initial sync.
Also sort queue by server time on initial sync and
apply in order to prevent further edge cases?
]]
if (not InitialSync and not self.Synced) then
table.insert(self.PreSyncData, {SequenceNumber, Data})
debug.profileend()
return
end
if (InitialSync) then
-- Apply all queued pre-sync data on initial sync
local PreSyncData = self.PreSyncData
table.insert(PreSyncData, {SequenceNumber, Data}) -- New data received
-- Sort by time (oldest first) to ensure in-order
table.sort(PreSyncData, function(Initial, Other)
return Initial[1] < Other[1]
end)
-- Oldest changes first, then newer changes
for Index = 1, #PreSyncData do
self:Commit(PreSyncData[Index][2], true)
end
self.PreSyncData = nil
self.Synced = true
return
end
-- Received events are in-order
self:Commit(Data, false)
debug.profileend()
end)
RemoteEvent:FireServer()
self:_InitLogging()
self.Initialised = true
end
-- Server method; receives client requests
function ReplicationContainer:InitServer()
assert(not self.Initialised, "Already initialised on server!")
local RemoteEvent = self.RemoteEvent
local Store = self.Store
self.EventConnection = RemoteEvent.OnServerEvent:Connect(function(Player: Player)
local Construct: ReplicationChanges = {}
for Key, Value in pairs(Store) do
local Insert: ReplicationChange = {
Path = {Key};
Value = Value;
}
table.insert(Construct, Insert)
end
local SendConstruct = (FIX_FLOAT_KEYS and IntSerialize(Construct) or Construct)
RemoteEvent:FireClient(Player, SendConstruct, self:GetNextSequence(), true)
end)
self:_InitLogging()
self.Initialised = true
end
function ReplicationContainer:Destroy()
self.EventConnection:Disconnect()
for _, Event: BindableEvent in pairs(self.Awaiting) do
Event:Fire(nil) -- Release all awaiting
Event:Destroy()
end
end
-- Obtains down a path; does not error
function ReplicationContainer:Get(UncorrectedPath: ReplicationPath, IsPathAlreadyCorrected: boolean?)
UncorrectedPath = UncorrectedPath or {}
debug.profilebegin(GET_TAG)
local Path = (IsPathAlreadyCorrected and UncorrectedPath or ConvertPathToNumeric(UncorrectedPath))
local Result = self.Store
local CorrectedPath = Path or {}
for Index = 1, #CorrectedPath do
local Key = CorrectedPath[Index]
Result = Result[Key]
if (Result == nil) then
break
end
end
debug.profileend()
return Result
end
-- Sets down a path; constructs tables if none are present along the way
function ReplicationContainer:Set(UncorrectedPath: ReplicationPath, Value, SendTo: {Player}?, NoEvent: boolean?)
assert(UncorrectedPath, "No path given!")
debug.profilebegin(MANUAL_SET_TAG)
local UnchangingKeys = self.UnchangingKeys
local Last = self.Store
local AllowWriteWarn = not PERMAMENT_WRITE_WARN_DISABLE
local Path = ConvertPathToNumeric(UncorrectedPath)
local Length = #Path
for Index = 1, Length - 1 do
local Key = Path[Index]
local UnchangingFlag = UnchangingKeys[Key]
if ((UnchangingFlag or 0) == 1) then
debug.profileend()
return
end
local Temp = Last[Key]
-- Key doesn't exist? Create node and keep going down.
if (Temp == nil) then
Temp = {}
if (AllowWriteWarn) then
-- Disable complaining about writes while we write to it
setmetatable(Last, EmptyMetatable)
end
Last[Key] = Temp
end
if UnchangingFlag then
UnchangingKeys[Key] += 1
end
Last = Temp
end
local FinalKey = Path[Length]
local UnchangingFlag = UnchangingKeys[FinalKey]
if ((UnchangingFlag or 0) == 1) then
debug.profileend()
return
end
if (UnchangingFlag) then
UnchangingKeys[FinalKey] += 1
end
if (AllowWriteWarn) then
-- Disable complaining about writes while we write to it
setmetatable(Last, EmptyMetatable)
end
local IsTable = (type(Value) == "table")
if (IsTable and AllowWriteWarn) then
debug.profilebegin(APPLY_METATABLE_TAG)
ReplicationContainer._ApplyMetatable(Value)
debug.profileend()
end
-- Prevent mixed keys
-- TODO: prevent mixed keys when setting whole tables too
local Key = next(Last)
if (Key) then
assert(type(Key) == type(FinalKey), "Attempted to insert using mixed keys!")
end
Last[FinalKey] = Value
-----------------
local IsServer = self.IsServer
if (IsServer) then
-- TODO: incrementally build differential by merging in each time; send whole table to client
local Insert: ReplicationChange = {
NoEvent = NoEvent;
Value = Value;
Path = Path;
}
local RemoteEvent = self.RemoteEvent
local Serialized = (FIX_FLOAT_KEYS and IntSerialize(Insert) or Insert)
local SequenceNumber = self:GetNextSequence()
local AsPackage = {Serialized}
if (SendTo) then
for SendIndex = 1, #SendTo do
RemoteEvent:FireClient(SendTo[SendIndex], AsPackage, SequenceNumber, false)
end
else
RemoteEvent:FireAllClients(AsPackage, SequenceNumber, false)
end
end
local PathName
local AllowEvent = not NoEvent
if (AllowEvent) then
PathName = GetTypedPath(Path)
self:_CheckPath(PathName, Value)
end
if (IsTable and AllowEvent) then
PathName = PathName or GetTypedPath(Path)
-- If we're sent a table, might contain nested data, so search through to find if any of our events are awaiting
PathTraverse(Value, PathName, function(NewPath, Leaf)
self:_CheckPath(NewPath, Leaf)
end)
end
if ((IsServer and DEBUG_LOG_CHANGES_SERVER) or (not IsServer and DEBUG_LOG_CHANGES_CLIENT)) then
PathName = PathName or GetTypedPath(Path)
print(PathName .. " -> " .. tostring(Value) .. " (NoEvent = " .. tostring(NoEvent) .. ")")
end
debug.profileend()
end
-- Creates or obtains the event corresponding to a path's value changing
function ReplicationContainer:_GetAwaitEventStringPath(AwaitingPath: string)
assert(AwaitingPath, "AwaitingPath not given!")
assert(typeof(AwaitingPath) == "string", "AwaitingPath not a string!")
-- TODO: move these into Connect?
local Awaiting = self.Awaiting
local AwaitingRefs = self.AwaitingRefs
local Event = Awaiting[AwaitingPath]
AwaitingRefs[AwaitingPath] = (AwaitingRefs[AwaitingPath] or 0) + 1
if (not Event) then
Event = Instance.new("BindableEvent")
Awaiting[AwaitingPath] = Event
end
local ScriptSignalObject = Event.Event
return { -- Hacky custom signal but necessary, implement as separate objects with callbacks in future?
Connect = function(_, Bind)
local Connection = ScriptSignalObject:Connect(Bind)
local Disconnected = false
return {
Disconnect = function()
if (Disconnected) then
return
end
Disconnected = true
Connection:Disconnect()
self:_ReleaseAwaitEvent(AwaitingPath)
end;
}
end;
Wait = function()
return ScriptSignalObject:Wait()
end;
}
end
-- Same as above except takes a ReplicationPath
function ReplicationContainer:GetAwaitEvent(Path: ReplicationPath): BindableEvent
return self:_GetAwaitEventStringPath(GetTypedPath(Path))
end
-- Releases an event reference so it can be destroyed if necessary
function ReplicationContainer:_ReleaseAwaitEvent(AwaitingPath: string)
assert(AwaitingPath, "AwaitingPath not given!")
assert(typeof(AwaitingPath) == "string", "AwaitingPath not a string!")
local AwaitingRefs = self.AwaitingRefs
local CurrentValue = AwaitingRefs[AwaitingPath]
assert(CurrentValue, "No existing await event for: " .. AwaitingPath)
local Decrement = CurrentValue - 1
AwaitingRefs[AwaitingPath] = Decrement
if (Decrement == 0) then
AwaitingRefs[AwaitingPath] = nil
self.Awaiting[AwaitingPath] = nil
end
end
-- For testing
function ReplicationContainer:_GetAwaitingCount(Path: ReplicationPath): number
return self.AwaitingRefs[GetTypedPath(Path)]
end
function ReplicationContainer:_RawGetAwaitEvent(Path: ReplicationPath): BindableEvent
return self.Awaiting[GetTypedPath(Path)]
end
--
-- Waits for a value
function ReplicationContainer:Await(UncorrectedPath: ReplicationPath, Timeout: number?)
debug.profilebegin(AWAIT_TAG)
UncorrectedPath = UncorrectedPath or {}
local CorrectedTimeout: number = Timeout or DEFAULT_TIMEOUT
local Path = ConvertPathToNumeric(UncorrectedPath)
local Got = self:Get(Path, true)
-- ~= nil as it could be false
if (Got ~= nil) then
debug.profileend()
return Got
end
-- Proxy for timeout OR the awaiting event, as we don't want to fire the awaiting event on timeout incase other coroutines are listening
local TypedPath = GetTypedPath(Path)
local Awaiting = self:_GetAwaitEventStringPath(TypedPath)
local Proxy = Instance.new("BindableEvent")
local Trace = debug.traceback()
local Completed = false
local AwaitingConnection = Awaiting:Connect(function(Value)
Proxy:Fire(Value)
end)
-- Timeout warning
coroutine.wrap(function()
task.wait(TIMEOUT_WARN)
if (not Completed) then
warn("Potentially infinite wait on '" .. TypedPath .. "'.\n" .. Trace)
end
end)()
-- Timeout
coroutine.wrap(function()
task.wait(CorrectedTimeout)
Proxy:Fire(nil)
end)()
debug.profileend()
local Result = Proxy.Event:Wait()
debug.profilebegin(AWAIT_TAG)
AwaitingConnection:Disconnect()
Completed = true
-- It timed out
if (Result == nil) then
error("ReplicationContainer timeout reached! (" .. CorrectedTimeout .. "s)")
end
debug.profileend()
return Result
end
-- Ensures a key will only change once, useful for avoiding unnecessary replication w/ large unchanging data
-- TODO: convert key using standard procedure
function ReplicationContainer:SetUnchanging(Key: ReplicationKey)
self.UnchangingKeys[Key] = 0
end
return ReplicationContainer
|
Config = {}
Config["qb-target"] = false
Config["Masks"] = {
["mask"] = {
drawableId = 169,
textureId = 13,
},
} |
insulate("Cron", function()
require "init"
require "spec.mocks"
require "spec.asserts"
describe(":once()", function()
it("will call a function after a certain time", function()
local called = false
Cron.once(function() called = true end, 5)
assert.is_false(called)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
assert.is_false(called)
Cron.tick(1)
assert.is_true(called)
end)
it("will call the function only once", function()
local called = 0
Cron.once(function() called = called + 1 end, 1)
assert.is_same(0, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(1, called)
end)
it("will call a function with a name", function()
local called = false
Cron.once("foobar", function() called = true end, 5)
assert.is_false(called)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
assert.is_false(called)
Cron.tick(1)
assert.is_true(called)
end)
it("is possible to remove a function with a name", function()
local called = false
Cron.once("foobar", function() called = true end, 5)
assert.is_false(called)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
assert.is_false(called)
Cron.abort("foobar")
Cron.tick(1)
assert.is_false(called)
end)
it("is possible to remove a function with a generated name", function()
local called = false
local cronId = Cron.once(function() called = true end, 5)
assert.is_false(called)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
assert.is_false(called)
Cron.abort(cronId)
Cron.tick(1)
assert.is_false(called)
end)
it("allows to replace a once with regular on call", function()
local called = 0
Cron.once("foobar", function()
called = called + 1
Cron.regular("foobar", function()
called = called + 1
end, 1)
end, 1)
assert.is_same(0, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(1)
assert.is_same(3, called)
end)
it("allows to set a new callback after removing the current one", function()
local i = 0
local fun
fun = function()
i = i+1
if i < 10 then Cron.once(fun, 1) end
end
Cron.once(fun, 1)
assert.not_has_error(function()
for i=1,10 do Cron.tick(1) end
end)
end)
it("allows to remove a callback by calling one callback", function()
local ids = {
"foo",
"bar",
}
for _, id in pairs(ids) do
Cron.once(id, function()
for _, id in pairs(ids) do
Cron.abort(id)
end
end, 1)
end
assert.not_has_error(function()
Cron.tick(1)
end)
end)
it("will get the elapsed time as argument to the function", function()
local calledArg = nil
Cron.once(function(_, arg)
calledArg = arg
end, 5)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1.2)
assert.is_near(5.2, calledArg, 0.0001)
end)
end)
describe(":regular()", function()
it("will call a function at a regular interval", function()
local called = 0
Cron.regular("foobar", function() called = called + 1 end, 2)
assert.is_same(0, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(1)
assert.is_same(3, called)
Cron.tick(1)
assert.is_same(3, called)
end)
it("will call a function at a regular interval with delay", function()
local called = 0
Cron.regular("foobar", function() called = called + 1 end, 2, 2)
assert.is_same(0, called)
Cron.tick(1)
assert.is_same(0, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(1)
assert.is_same(3, called)
end)
it("a function can remove itself", function()
local called = 0
Cron.regular("foobar", function()
if called >= 3 then Cron.abort("foobar") else called = called + 1 end
end, 1)
assert.is_same(0, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(1)
assert.is_same(3, called)
Cron.tick(1)
assert.is_same(3, called)
Cron.tick(1)
assert.is_same(3, called)
end)
it("a function can be stopped from outside", function()
local called = 0
local cronId = Cron.regular(function() called = called + 1 end, 1)
assert.is_same(0, called)
Cron.tick(1)
assert.is_same(1, called)
Cron.abort(cronId)
Cron.tick(1)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(1, called)
end)
it("will call a function at every tick", function()
local called = 0
Cron.regular(function() called = called + 1 end)
assert.is_same(0, called)
Cron.tick(10)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(0.5)
assert.is_same(3, called)
Cron.tick(0.1)
assert.is_same(4, called)
Cron.tick(0.01)
assert.is_same(5, called)
end)
it("the function gets its id as first parameter", function()
local theFirstParameter
Cron.regular("foobar", function(cronId)
theFirstParameter = cronId
end, 1)
Cron.tick(1)
assert.is_same("foobar", theFirstParameter)
end)
it("the function gets its generated id as first parameter", function()
local theFirstParameter
Cron.regular(function(cronId)
theFirstParameter = cronId
end, 1)
Cron.tick(1)
assert.not_nil(theFirstParameter)
assert.is_string(theFirstParameter)
assert.not_same("", theFirstParameter)
end)
it("allows the callback function to return the interval for the next try", function()
local called = 0
Cron.regular("foobar", function()
called = called + 1
if called == 2 then return 3 end
end, 1)
assert.is_same(0, called)
Cron.tick(0.5)
assert.is_same(1, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(1)
assert.is_same(2, called)
Cron.tick(1)
assert.is_same(3, called)
Cron.tick(1)
assert.is_same(4, called)
end)
it("will get the elapsed time as argument to the function", function()
local called, calledArg = 0, nil
Cron.regular(function(_, arg)
called = called + 1
calledArg = arg
end, 1, 1)
Cron.tick(1)
assert.is_same(1, called)
assert.is_same(1, calledArg)
Cron.tick(1.2)
assert.is_same(2, called)
assert.is_near(1.2, calledArg, 0.0001)
Cron.tick(0.7)
Cron.tick(0.7)
assert.is_same(3, called)
assert.is_near(1.4, calledArg, 0.0001)
end)
end)
describe(":getDelay()", function()
it("returns nil for an undefined cron", function()
assert.is_nil(Cron.getDelay("doesnotexist"))
end)
it("allows to get the delay until the next call of function when using regular()", function()
Cron.regular("foobar", function() end, 3, 5)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
assert.is_same(1, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(3, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(2, Cron.getDelay("foobar"))
end)
it("allows to get the delay until the call of function when using once()", function()
Cron.once("foobar", function() end, 5)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
assert.is_same(1, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_nil(Cron.getDelay("foobar"))
end)
end)
describe(":setDelay()", function()
it("fails silently when an unknown Cron is set", function()
Cron.setDelay("doesnotexist", 5)
assert.is_nil(Cron.getDelay("doesnotexist"))
end)
it("allows to override the delay of a regular", function()
Cron.regular("foobar", function() end, 3, 5)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
Cron.setDelay("foobar", 5)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
assert.is_same(3, Cron.getDelay("foobar"))
Cron.setDelay("foobar", 5)
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
end)
it("allows to set the delay when using once()", function()
Cron.once("foobar", function() end, 5)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
Cron.setDelay("foobar", 5)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
Cron.tick(1)
end)
end)
describe(":addDelay()", function()
it("fails silently when an unknown Cron is set", function()
Cron.addDelay("doesnotexist", 5)
assert.is_nil(Cron.getDelay("doesnotexist"))
end)
it("allows to override the delay of a regular", function()
Cron.regular("foobar", function() end, 3, 5)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
Cron.addDelay("foobar", 1)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
Cron.tick(1)
assert.is_same(3, Cron.getDelay("foobar"))
Cron.addDelay("foobar", 2)
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
end)
it("allows to set the delay when using once()", function()
Cron.once("foobar", function() end, 5)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
Cron.addDelay("foobar", 1)
assert.is_same(5, Cron.getDelay("foobar"))
Cron.tick(1)
assert.is_same(4, Cron.getDelay("foobar"))
Cron.tick(1)
end)
end)
describe(":now()", function()
it("gives the current time", function()
local now = Cron.now()
assert.is_true(isNumber(now))
Cron.tick(1)
assert.is_same(1, Cron.now() - now)
end)
end)
end) |
module(..., package.seeall)
local bit = require("bit")
local constants = require("apps.lwaftr.constants")
local ctable = require('lib.ctable')
local ctablew = require('apps.lwaftr.ctable_wrapper')
local ffi = require('ffi')
local lwutil = require("apps.lwaftr.lwutil")
local C = ffi.C
local packet = require("core.packet")
local lib = require("core.lib")
local ipsum = require("lib.checksum").ipsum
REASSEMBLY_OK = 1
FRAGMENT_MISSING = 2
REASSEMBLY_INVALID = 3
-- IPv4 reassembly with RFC 5722's recommended exclusion of overlapping packets.
-- Defined in RFC 791.
-- Possible TODOs:
-- TODO: implement a timeout, and associated ICMP iff the fragment
-- with offset 0 was received
-- TODO: handle silently discarding fragments that arrive later if
-- an overlapping fragment was detected (keep a list for a few minutes?)
-- TODO: handle packets of > 10240 octets correctly...
-- TODO: test every branch of this
local ehs, o_ipv4_identification, o_ipv4_flags,
o_ipv4_checksum, o_ipv4_total_length, o_ipv4_src_addr, o_ipv4_dst_addr =
constants.ethernet_header_size, constants.o_ipv4_identification,
constants.o_ipv4_flags, constants.o_ipv4_checksum,
constants.o_ipv4_total_length, constants.o_ipv4_src_addr,
constants.o_ipv4_dst_addr
local hash_32 = ctable.hash_32
local rd16, wr16, wr32 = lwutil.rd16, lwutil.wr16, lwutil.wr32
local get_ihl_from_offset = lwutil.get_ihl_from_offset
local uint16_ptr_t = ffi.typeof("uint16_t*")
local bxor, band = bit.bxor, bit.band
local packet_payload_size = C.PACKET_PAYLOAD_SIZE
local ntohs, htons = lib.ntohs, lib.htons
local ipv4_fragment_key_t = ffi.typeof[[
struct {
uint8_t src_addr[4];
uint8_t dst_addr[4];
uint32_t fragment_id;
} __attribute__((packed))
]]
-- The fragment_starts and fragment_ends buffers are big enough for
-- non-malicious input. If a fragment requires more slots, refuse to
-- reassemble it.
local max_frags_per_packet
local ipv4_reassembly_buffer_t
local scratch_rbuf
local scratch_fragkey = ipv4_fragment_key_t()
local function get_frag_len(frag)
return ntohs(rd16(frag.data + ehs + o_ipv4_total_length))
end
local function get_frag_id(frag)
local o_id = ehs + o_ipv4_identification
return ntohs(rd16(frag.data + o_id))
end
-- The most significant three bits are other information, and the
-- offset is expressed in 8-octet units, so just mask them off and * 8 it.
local function get_frag_start(frag)
local o_fstart = ehs + o_ipv4_flags
local raw_start = ntohs(rd16(frag.data + o_fstart))
return band(raw_start, 0x1fff) * 8
end
-- This is the 'MF' bit of the IPv4 fragment header; it's the 3rd bit
-- of the flags.
local function is_last_fragment(frag)
local o_flag = ehs + o_ipv4_flags
return band(frag.data[o_flag], 0x20) == 0
end
local function get_key(fragment)
local key = scratch_fragkey
local o_src = ehs + o_ipv4_src_addr
local o_dst = ehs + o_ipv4_dst_addr
local o_id = ehs + o_ipv4_identification
ffi.copy(key.src_addr, fragment.data + o_src, 4)
ffi.copy(key.dst_addr, fragment.data + o_dst, 4)
key.fragment_id = ntohs(rd16(fragment.data + o_id))
return key
end
local function free_reassembly_buf_and_pkt(pkt, frags_table)
local key = get_key(pkt)
frags_table:remove(key, false)
packet.free(pkt)
end
local function swap(array, i, j)
local tmp = array[j]
array[j] = array[i]
array[i] = tmp
end
-- This is an insertion sort, and only called on 2+ element arrays
local function sort_array(array, last_index)
for i=0,last_index do
local j = i
while j > 0 and array[j-1] > array[j] do
swap(array, j, j-1)
j = j - 1
end
end
end
local function verify_valid_offsets(reassembly_buf)
if reassembly_buf.fragment_starts[0] ~= 0 then
return false
end
for i=1,reassembly_buf.fragment_count-1 do
if reassembly_buf.fragment_starts[i] ~= reassembly_buf.fragment_ends[i-1] then
return false
end
end
return true
end
local function reassembly_status(reassembly_buf)
if reassembly_buf.final_start == 0 then
return FRAGMENT_MISSING
end
if reassembly_buf.running_length ~= reassembly_buf.reassembly_length then
return FRAGMENT_MISSING
end
if not verify_valid_offsets(reassembly_buf) then
return REASSEMBLY_INVALID
end
return REASSEMBLY_OK
end
-- IPv4 requires recalculating an embedded checksum.
local function fix_pkt_checksum(pkt)
local ihl = get_ihl_from_offset(pkt, ehs)
local checksum_offset = ehs + o_ipv4_checksum
wr16(pkt.data + checksum_offset, 0)
wr16(pkt.data + checksum_offset,
htons(ipsum(pkt.data + ehs, ihl, 0)))
end
local function attempt_reassembly(frags_table, reassembly_buf, fragment)
local ihl = get_ihl_from_offset(fragment, ehs)
local frag_id = get_frag_id(fragment)
if frag_id ~= reassembly_buf.fragment_id then -- unreachable
error("Impossible case reached in v4 reassembly") --REASSEMBLY_INVALID
end
local frag_start = get_frag_start(fragment)
local frag_size = get_frag_len(fragment) - ihl
local fcount = reassembly_buf.fragment_count
if fcount + 1 > max_frags_per_packet then
-- too many fragments to reassembly this packet, assume malice
free_reassembly_buf_and_pkt(fragment, frags_table)
return REASSEMBLY_INVALID
end
reassembly_buf.fragment_starts[fcount] = frag_start
reassembly_buf.fragment_ends[fcount] = frag_start + frag_size
if reassembly_buf.fragment_starts[fcount] <
reassembly_buf.fragment_starts[fcount - 1] then
sort_array(reassembly_buf.fragment_starts, fcount)
sort_array(reassembly_buf.fragment_ends, fcount)
end
reassembly_buf.fragment_count = fcount + 1
if is_last_fragment(fragment) then
if reassembly_buf.final_start ~= 0 then
-- There cannot be 2+ final fragments
free_reassembly_buf_and_pkt(fragment, frags_table)
return REASSEMBLY_INVALID
else
reassembly_buf.final_start = frag_start
end
end
-- This is a massive layering violation. :/
-- Specifically, it requires this file to know the details of struct packet.
local skip_headers = reassembly_buf.reassembly_base
local dst_offset = skip_headers + frag_start
local last_ok = packet_payload_size
if dst_offset + frag_size > last_ok then
-- Prevent a buffer overflow. The relevant RFC allows hosts to silently discard
-- reassemblies above a certain rather small size, smaller than this.
return REASSEMBLY_INVALID
end
local reassembly_data = reassembly_buf.reassembly_data
ffi.copy(reassembly_data + dst_offset,
fragment.data + skip_headers,
frag_size)
local max_data_offset = skip_headers + frag_start + frag_size
reassembly_buf.reassembly_length = math.max(reassembly_buf.reassembly_length,
max_data_offset)
reassembly_buf.running_length = reassembly_buf.running_length + frag_size
local restatus = reassembly_status(reassembly_buf)
if restatus == REASSEMBLY_OK then
local pkt_len = htons(reassembly_buf.reassembly_length - ehs)
local o_len = ehs + o_ipv4_total_length
wr16(reassembly_data + o_len, pkt_len)
local reassembled_packet = packet.from_pointer(
reassembly_buf.reassembly_data, reassembly_buf.reassembly_length)
fix_pkt_checksum(reassembled_packet)
free_reassembly_buf_and_pkt(fragment, frags_table)
return REASSEMBLY_OK, reassembled_packet
else
packet.free(fragment)
return restatus
end
end
local function packet_to_reassembly_buffer(pkt)
local reassembly_buf = scratch_rbuf
C.memset(reassembly_buf, 0, ffi.sizeof(ipv4_reassembly_buffer_t))
local ihl = get_ihl_from_offset(pkt, ehs)
reassembly_buf.fragment_id = get_frag_id(pkt)
reassembly_buf.reassembly_base = ehs + ihl
local headers_len = ehs + ihl
local re_data = reassembly_buf.reassembly_data
ffi.copy(re_data, pkt.data, headers_len)
wr32(re_data + ehs + o_ipv4_identification, 0) -- Clear fragmentation data
reassembly_buf.running_length = headers_len
return reassembly_buf
end
-- The key is 80 bits: source IPv4 address, destination IPv4 address, and
-- the 16-bit identification field.
-- This function intentionally re-hashes 3 of the 5 16-byte chunks.
local function hash_ipv4(key)
local hash = 0
local to_hash = ffi.cast(uint16_ptr_t, key)
for i=0,3 do
local current = to_hash[i]
hash = hash_32(bxor(hash, hash_32(current)))
end
return hash
end
function initialize_frag_table(max_fragmented_packets, max_pkt_frag)
-- Initialize module-scoped variables
max_frags_per_packet = max_pkt_frag
ipv4_reassembly_buffer_t = ffi.typeof([[
struct {
uint16_t fragment_starts[$];
uint16_t fragment_ends[$];
uint16_t fragment_count;
uint16_t final_start;
uint16_t reassembly_base;
uint16_t fragment_id;
uint32_t running_length; // bytes copied so far
uint16_t reassembly_length; // analog to packet.length
uint8_t reassembly_data[$];
} __attribute((packed))]],
max_frags_per_packet, max_frags_per_packet, packet.max_payload)
scratch_rbuf = ipv4_reassembly_buffer_t()
local max_occupy = 0.9
local params = {
key_type = ffi.typeof(ipv4_fragment_key_t),
value_type = ffi.typeof(ipv4_reassembly_buffer_t),
hash_fn = hash_ipv4,
initial_size = math.ceil(max_fragmented_packets / max_occupy),
max_occupancy_rate = max_occupy,
}
return ctablew.new(params)
end
function cache_fragment(frags_table, fragment)
local key = get_key(fragment)
local ptr = frags_table:lookup_ptr(key)
local ej = false
if not ptr then
local reassembly_buf = packet_to_reassembly_buffer(fragment)
_, ej = frags_table:add_with_random_ejection(key, reassembly_buf, false)
ptr = frags_table:lookup_ptr(key)
end
local status, maybe_pkt = attempt_reassembly(frags_table, ptr.value, fragment)
return status, maybe_pkt, ej
end
function selftest()
initialize_frag_table(20, 20)
local rbuf1 = ffi.new(ipv4_reassembly_buffer_t)
local rbuf2 = ffi.new(ipv4_reassembly_buffer_t)
rbuf1.fragment_starts[0] = 10
rbuf1.fragment_starts[1] = 100
rbuf2.fragment_starts[0] = 100
rbuf2.fragment_starts[1] = 10
sort_array(rbuf1.fragment_starts, 1)
sort_array(rbuf2.fragment_starts, 1)
assert(0 == C.memcmp(rbuf1.fragment_starts, rbuf2.fragment_starts, 4))
local rbuf3 = ffi.new(ipv4_reassembly_buffer_t)
rbuf3.fragment_starts[0] = 5
rbuf3.fragment_starts[1] = 10
rbuf3.fragment_starts[2] = 100
rbuf1.fragment_starts[2] = 5
sort_array(rbuf1.fragment_starts, 2)
assert(0 == C.memcmp(rbuf1.fragment_starts, rbuf3.fragment_starts, 6))
end
|
--[[local g = require 'Bodies/Ground';
local wb = require 'Bodies/WoodBlock';
local ct = require 'Catapult';
local pr = wb:new(0, 0, 0, 1, 1, "Projectile", "Extra!");
local cat = ct:new(100, 350, "Catapult");
cat:setProjectile(pr);
local s = {
Bodies = {
g:new(-100, 450, 0, 1, 1, 'Ground'),
wb:new(500, 400, 1.57, 1, 1, 'Block1'),
wb:new(575, 400, 1.57, 1, 1, 'Block2'),
wb:new(540, 340, 0, 1, 1, 'Block3'),
wb:new(650, 400, 1.57, 1, 1, 'Block4'),
wb:new(725, 400, 1.57, 1, 1, 'Block5'),
wb:new(680, 340, 0, 1, 1, 'Block6'),
wb:new(575, 280, 1.57, 1, 1, 'Block7'),
-- wb:new(650, 280, 1.57, 1, 1, 'Block7'),
-- wb:new(630, 250, 0, 1, 1, 'Block7'),
cat
}
};]]
local s = {
Statics = {},
Bodies = {}
};
s.Statics['Ground'] = { 'Ground', -100, 450, 0, 1, 1 };
-- s.Bodies['Block1'] = { 'WoodBlock', 500, 400, 1.57, 1, 1 };
-- s.Bodies['Block2'] = { 'WoodBlock', 575, 400, 1.57, 1, 1 };
-- s.Bodies['Block3'] = { 'WoodBlock', 540, 340, 0, 1, 1 };
s.Bodies['Block4'] = { 'WoodBlock', 650, 400, 1.57, 1, 1 };
s.Bodies['Block5'] = { 'WoodBlock', 725, 400, 1.57, 1, 1 };
s.Bodies['Block6'] = { 'WoodBlock', 680, 340, 0, 1, 1 };
s.Bodies['Block7'] = { 'WoodBlock', 575, 280, 1.57, 1, 1 };
s.Catapult = { 100, 350 };
s.Projectiles = {};
s.Projectiles['WoodBlock'] = -1;
s.name = 'Testowy poziom 3.';
return s;
|
--MoveCurve
--H_Kaguya/curve_RushBack curve_RushBack
return
{
filePath = "H_Kaguya/curve_RushBack",
startTime = Fixed64(12163482) --[[11.6]],
startRealTime = Fixed64(89199) --[[0.08506667]],
endTime = Fixed64(58720256) --[[56]],
endRealTime = Fixed64(430615) --[[0.4106667]],
isZoom = false,
isCompensate = false,
curve = {
[1] = {
time = 0 --[[0]],
value = 0 --[[0]],
inTangent = 3145728 --[[3]],
outTangent = 3145728 --[[3]],
},
[2] = {
time = 1048576 --[[1]],
value = 3145728 --[[3]],
inTangent = 3145728 --[[3]],
outTangent = 3145728 --[[3]],
},
},
} |
function model.setObjectSize(h,x,y,z)
local r,mmin=sim.getObjectFloatParameter(h,sim.objfloatparam_objbbox_min_x)
local r,mmax=sim.getObjectFloatParameter(h,sim.objfloatparam_objbbox_max_x)
local sx=mmax-mmin
local r,mmin=sim.getObjectFloatParameter(h,sim.objfloatparam_objbbox_min_y)
local r,mmax=sim.getObjectFloatParameter(h,sim.objfloatparam_objbbox_max_y)
local sy=mmax-mmin
local r,mmin=sim.getObjectFloatParameter(h,sim.objfloatparam_objbbox_min_z)
local r,mmax=sim.getObjectFloatParameter(h,sim.objfloatparam_objbbox_max_z)
local sz=mmax-mmin
if z then
sim.scaleObject(h,x/sx,y/sy,z/sz)
else
sim.scaleObject(h,x/sx,y/sy,1) -- for the labels that are z-flat
end
end
function model.setEngineDamping(bulletLinDamp,bulletAngDamp,odeSoftErp)
local l=sim.getObjectsInTree(model.handle,sim.object_shape_type,0)
for i=1,#l,1 do
sim.setEngineFloatParameter(sim.bullet_body_lineardamping,l[i],bulletLinDamp)
sim.setEngineFloatParameter(sim.bullet_body_angulardamping,l[i],bulletAngDamp)
sim.setEngineFloatParameter(sim.ode_body_softerp,l[i],odeSoftErp)
end
end
function sysCall_init()
model.codeVersion=1
model.dlg.init()
local data=simBWF.readPartInfo(model.handle)
data.partType=model.partType
data.instanciated=nil -- just in case
simBWF.writePartInfo(model.handle,data)
model.setEngineDamping(0.9,0.999,0.1)
model.handleJobConsistency(simBWF.isModelACopy_ifYesRemoveCopyTag(model.handle))
model.updatePluginRepresentation()
end
function sysCall_nonSimulation()
model.dlg.showOrHideDlgIfNeeded()
end
function sysCall_afterSimulation()
local data=simBWF.readPartInfo(model.handle)
if not data.instanciated then
-- Part was not finalized. We need to reactivate it after simulation:
sim.setModelProperty(model.handle,0)
end
model.dlg.showOrHideDlgIfNeeded()
end
function sysCall_beforeSimulation()
model.dlg.removeDlg()
local data=simBWF.readPartInfo(model.handle)
if not data.instanciated then
-- Part was not finalized. We kind of deactivate it for the simulation:
sim.setModelProperty(model.handle,sim.modelproperty_not_collidable+sim.modelproperty_not_detectable+sim.modelproperty_not_dynamic+sim.modelproperty_not_measurable+sim.modelproperty_not_renderable+sim.modelproperty_not_respondable+sim.modelproperty_not_visible)
end
end
function sysCall_beforeInstanceSwitch()
model.dlg.removeDlg()
model.removeFromPluginRepresentation()
end
function sysCall_afterInstanceSwitch()
model.updatePluginRepresentation()
end
function sysCall_cleanup()
model.dlg.removeDlg()
model.removeFromPluginRepresentation()
local repo,modelHolder=simBWF.getPartRepositoryHandles()
if (repo and (sim.getObjectParent(model.handle)==modelHolder)) or model.finalizeModel then
-- This means the box is part of the part repository or that we want to finalize the model (i.e. won't be customizable anymore)
sysCall_cleanup_specific()
local c=model.readInfo()
sim.writeCustomDataBlock(model.handle,model.tagName,'')
end
model.dlg.cleanup()
end
|
-- Copyright 2021 SmartThings
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
local constants = require "st.zigbee.constants"
local clusters = require "st.zigbee.zcl.clusters"
local device_management = require "st.zigbee.device_management"
local messages = require "st.zigbee.messages"
local mgmt_bind_resp = require "st.zigbee.zdo.mgmt_bind_response"
local mgmt_bind_req = require "st.zigbee.zdo.mgmt_bind_request"
local zdo_messages = require "st.zigbee.zdo"
local OnOff = clusters.OnOff
local PowerConfiguration = clusters.PowerConfiguration
local zigbee_utils = require "zigbee_utils"
local Groups = clusters.Groups
local log = require "log"
local capabilities = require "st.capabilities"
local utils = require "st.utils"
local zcl_clusters = require "st.zigbee.zcl.clusters"
local logger = capabilities["universevoice35900.log"]
local do_refresh = function(self, device)
log.info("Doing Refresh - "..device:get_model())
log.info("Hub Address: "..constants.HUB.ADDR)
log.info("Hub Endpoint: "..constants.HUB.ENDPOINT)
zigbee_utils.print_clusters(device)
zigbee_utils.send_read_binding_table(device)
device:send(Groups.server.commands.GetGroupMembership(device, {}))
device:send(Groups.server.commands.ViewGroup(device,device.preferences.group))
end
local do_configure = function(self, device)
device:send(device_management.build_bind_request(device, PowerConfiguration.ID, self.environment_info.hub_zigbee_eui))
device:send(device_management.build_bind_request(device, OnOff.ID, self.environment_info.hub_zigbee_eui))
device:send(PowerConfiguration.attributes.BatteryPercentageRemaining:configure_reporting(device, 30, 21600, 1))
-- Read binding table
local addr_header = messages.AddressHeader(
constants.HUB.ADDR,
constants.HUB.ENDPOINT,
device:get_short_address(),
device.fingerprinted_endpoint_id,
constants.ZDO_PROFILE_ID,
mgmt_bind_req.BINDING_TABLE_REQUEST_CLUSTER_ID
)
local binding_table_req = mgmt_bind_req.MgmtBindRequest(0) -- Single argument of the start index to query the table
local message_body = zdo_messages.ZdoMessageBody({
zdo_body = binding_table_req
})
local binding_table_cmd = messages.ZigbeeMessageTx({
address_header = addr_header,
body = message_body
})
device:send(binding_table_cmd)
end
local function zdo_binding_table_handler(driver, device, zb_rx)
local groups = ""
local devicebinds = ""
for _, binding_table in pairs(zb_rx.body.zdo_body.binding_table_entries) do
print("Zigbee Group is:"..binding_table.dest_addr.value)
if binding_table.dest_addr_mode.value == binding_table.DEST_ADDR_MODE_SHORT then
-- send add hub to zigbee group command
driver:add_hub_to_zigbee_group(binding_table.dest_addr.value)
print("Adding to zigbee group: "..binding_table.dest_addr.value)
groups = groups..binding_table.cluster_id.value.."("..binding_table.dest_addr.value.."),"
else
driver:add_hub_to_zigbee_group(0x0000)
local binding_info = {}
binding_info.cluster_id = binding_table.cluster_id.value
binding_info.dest_addr = utils.get_print_safe_string(binding_table.dest_addr.value)
binding_info.dest_addr = binding_info.dest_addr:gsub("%\\x", "")
devicebinds = devicebinds..utils.stringify_table(binding_info)
end
end
log.info("GROUPS: "..groups)
log.info("DEVICE BINDS: "..devicebinds)
device:emit_event(logger.logger("Processing Binding Table"))
device:emit_event(logger.logger("GROUPS: "..groups))
device:emit_event(logger.logger("DEVICE BINDS: "..devicebinds))
end
local ikea_of_sweden = {
NAME = "IKEA Sweden",
lifecycle_handlers = {
doConfigure = do_configure
},
capability_handlers = {
[capabilities.refresh.ID] = {
[capabilities.refresh.commands.refresh.NAME] = do_refresh,
}
},
zigbee_handlers = {
zdo = {
[mgmt_bind_resp.MGMT_BIND_RESPONSE] = zdo_binding_table_handler
},
},
sub_drivers = {
require("zigbee-multi-button.ikea.TRADFRI_remote_control"),
require("zigbee-multi-button.ikea.TRADFRI_on_off_switch"),
require("zigbee-multi-button.ikea.TRADFRI_open_close_remote"),
require("zigbee-multi-button.ikea.STYRBAR_remote_control"),
},
can_handle = function(opts, driver, device, ...)
return device:get_manufacturer() == "IKEA of Sweden" or device:get_manufacturer() == "KE"
end
}
return ikea_of_sweden
|
local _={}
_[55]={}
_[54]={}
_[53]={}
_[52]={}
_[51]={}
_[50]={}
_[49]={}
_[48]={}
_[47]={}
_[46]={}
_[45]={}
_[44]={}
_[43]={}
_[42]={}
_[41]={}
_[40]={}
_[39]={}
_[38]={}
_[37]={tags=_[55],text="8"}
_[36]={tags=_[54],text="8: "}
_[35]={tags=_[53],text="7"}
_[34]={tags=_[52],text="7: "}
_[33]={tags=_[51],text="13"}
_[32]={tags=_[50],text="13: "}
_[31]={tags=_[49],text="5"}
_[30]={tags=_[48],text="5: "}
_[29]={tags=_[47],text="4"}
_[28]={tags=_[46],text="4: "}
_[27]={tags=_[45],text="4"}
_[26]={tags=_[44],text="4: "}
_[25]={tags=_[43],text="5"}
_[24]={tags=_[42],text="5: "}
_[23]={tags=_[41],text="3"}
_[22]={tags=_[40],text="3: "}
_[21]={tags=_[39],text="3"}
_[20]={tags=_[38],text="3: "}
_[19]={_[36],_[37]}
_[18]={_[34],_[35]}
_[17]={_[32],_[33]}
_[16]={_[30],_[31]}
_[15]={_[28],_[29]}
_[14]={_[26],_[27]}
_[13]={_[24],_[25]}
_[12]={_[22],_[23]}
_[11]={_[20],_[21]}
_[10]={"return"}
_[9]={"text",_[19]}
_[8]={"text",_[18]}
_[7]={"text",_[17]}
_[6]={"text",_[16]}
_[5]={"text",_[15]}
_[4]={"text",_[14]}
_[3]={"text",_[13]}
_[2]={"text",_[12]}
_[1]={"text",_[11]}
return {_[1],_[2],_[3],_[4],_[5],_[6],_[7],_[8],_[9],_[10]}
--[[
{ "text", { {
tags = {},
text = "3: "
}, {
tags = {},
text = "3"
} } }
{ "text", { {
tags = {},
text = "3: "
}, {
tags = {},
text = "3"
} } }
{ "text", { {
tags = {},
text = "5: "
}, {
tags = {},
text = "5"
} } }
{ "text", { {
tags = {},
text = "4: "
}, {
tags = {},
text = "4"
} } }
{ "text", { {
tags = {},
text = "4: "
}, {
tags = {},
text = "4"
} } }
{ "text", { {
tags = {},
text = "5: "
}, {
tags = {},
text = "5"
} } }
{ "text", { {
tags = {},
text = "13: "
}, {
tags = {},
text = "13"
} } }
{ "text", { {
tags = {},
text = "7: "
}, {
tags = {},
text = "7"
} } }
{ "text", { {
tags = {},
text = "8: "
}, {
tags = {},
text = "8"
} } }
{ "return" }
]]-- |
--[[
Copyright 2014 The Luvit Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
local os = require('ffi').os
local env = require('env')
local uv = require('uv')
local getPrefix, splitPath, joinParts
local tmpBase = os == "Windows" and (env.get("TMP") or uv.cwd()) or
(env.get("TMPDIR") or '/tmp')
if os == "Windows" then
-- Windows aware path utils
function getPrefix(path)
return path:match("^%u:\\") or
path:match("^/") or
path:match("^\\+")
end
function splitPath(path)
local parts = {}
for part in string.gmatch(path, '([^/\\]+)') do
table.insert(parts, part)
end
return parts
end
function joinParts(prefix, parts, i, j)
if not prefix then
return table.concat(parts, '/', i, j)
elseif prefix ~= '/' then
return prefix .. table.concat(parts, '\\', i, j)
else
return prefix .. table.concat(parts, '/', i, j)
end
end
else
-- Simple optimized versions for unix systems
function getPrefix(path)
return path:match("^/")
end
function splitPath(path)
local parts = {}
for part in string.gmatch(path, '([^/]+)') do
table.insert(parts, part)
end
return parts
end
function joinParts(prefix, parts, i, j)
if prefix then
return prefix .. table.concat(parts, '/', i, j)
end
return table.concat(parts, '/', i, j)
end
end
local function pathJoin(...)
local inputs = {...}
local l = #inputs
-- Find the last segment that is an absolute path
-- Or if all are relative, prefix will be nil
local i = l
local prefix
while true do
prefix = getPrefix(inputs[i])
if prefix or i <= 1 then break end
i = i - 1
end
-- If there was one, remove its prefix from its segment
if prefix then
inputs[i] = inputs[i]:sub(#prefix)
end
-- Split all the paths segments into one large list
local parts = {}
while i <= l do
local sub = splitPath(inputs[i])
for j = 1, #sub do
parts[#parts + 1] = sub[j]
end
i = i + 1
end
-- Evaluate special segments in reverse order.
local skip = 0
local reversed = {}
for idx = #parts, 1, -1 do
local part = parts[idx]
if part == '.' then
-- Ignore
elseif part == '..' then
skip = skip + 1
elseif skip > 0 then
skip = skip - 1
else
reversed[#reversed + 1] = part
end
end
-- Reverse the list again to get the correct order
parts = reversed
for idx = 1, #parts / 2 do
local j = #parts - idx + 1
parts[idx], parts[j] = parts[j], parts[idx]
end
local path = joinParts(prefix, parts)
return path
end
return function(args)
local uv = require('uv')
local luvi = require('luvi')
local env = require('env')
-- Given a list of bundles, merge them into a single vfs. Lower indexed items overshawdow later items.
local function combinedBundle(bundles)
local bases = {}
for i = 1, #bundles do
bases[i] = bundles[i].base
end
return {
base = table.concat(bases, " : "),
stat = function (path)
local err
for i = 1, #bundles do
local stat
stat, err = bundles[i].stat(path)
if stat then return stat end
end
return nil, err
end,
readdir = function (path)
local has = {}
local files, err
for i = 1, #bundles do
local list
list, err = bundles[i].readdir(path)
if list then
for j = 1, #list do
local name = list[j]
if has[name] then
print("Warning multiple overlapping versions of " .. name)
else
has[name] = true
if files then
files[#files + 1] = name
else
files = { name }
end
end
end
end
end
if files then
return files
else
return nil, err
end
end,
readfile = function (path)
local err
for i = 1, #bundles do
local data
data, err = bundles[i].readfile(path)
if data then return data end
end
return nil, err
end
}
end
local function folderBundle(base)
return {
base = base,
stat = function (path)
path = pathJoin(base, "./" .. path)
local raw, err = uv.fs_stat(path)
if not raw then return nil, err end
return {
type = string.lower(raw.type),
size = raw.size,
mtime = raw.mtime,
}
end,
readdir = function (path)
path = pathJoin(base, "./" .. path)
local req, err = uv.fs_scandir(path)
if not req then return nil, err end
local files = {}
repeat
local ent = uv.fs_scandir_next(req)
if ent then files[#files + 1] = ent.name end
until not ent
return files
end,
readfile = function (path)
path = pathJoin(base, "./" .. path)
local fd, stat, data, err
fd, err = uv.fs_open(path, "r", 0644)
if not fd then return nil, err end
stat, err = uv.fs_fstat(fd)
if not stat then return nil, err end
data, err = uv.fs_read(fd, stat.size, 0)
if not data then return nil, err end
uv.fs_close(fd)
return data
end,
}
end
local function chrootBundle(bundle, prefix)
local bundleStat = bundle.stat
function bundle.stat(path)
return bundleStat(prefix .. path)
end
local bundleReaddir = bundle.readdir
function bundle.readdir(path)
return bundleReaddir(prefix .. path)
end
local bundleReadfile = bundle.readfile
function bundle.readfile(path)
return bundleReadfile(prefix .. path)
end
end
local function zipBundle(base, zip)
local bundle = {
base = base,
stat = function (path)
path = pathJoin("./" .. path)
if path == "" then
return {
type = "directory",
size = 0,
mtime = 0
}
end
local err
local index = zip:locate_file(path)
if not index then
index, err = zip:locate_file(path .. "/")
if not index then return nil, err end
end
local raw = zip:stat(index)
return {
type = raw.filename:sub(-1) == "/" and "directory" or "file",
size = raw.uncomp_size,
mtime = raw.time,
}
end,
readdir = function (path)
path = pathJoin("./" .. path)
local index, err
if path == "" then
index = 0
else
path = path .. "/"
index, err = zip:locate_file(path )
if not index then return nil, err end
if not zip:is_directory(index) then
return nil, path .. " is not a directory"
end
end
local files = {}
for i = index + 1, zip:get_num_files() do
local filename = zip:get_filename(i)
if string.sub(filename, 1, #path) ~= path then break end
filename = filename:sub(#path + 1)
local n = string.find(filename, "/")
if n == #filename then
filename = string.sub(filename, 1, #filename - 1)
n = nil
end
if not n then
files[#files + 1] = filename
end
end
return files
end,
readfile = function (path)
path = pathJoin("./" .. path)
local index, err = zip:locate_file(path)
if not index then return nil, err end
return zip:extract(index)
end
}
-- Support zips with a single folder inserted at toplevel
local entries = bundle.readdir("")
if #entries == 1 and bundle.stat(entries[1]).type == "directory" then
chrootBundle(bundle, entries[1] .. '/')
end
return bundle
end
local function makeBundle(app)
local miniz = require('miniz')
if app and (#app > 0) then
-- Split the string by ; leaving empty strings on ends
local parts = {}
local n = 1
for part in string.gmatch(app, '([^;]*)') do
if not parts[n] then
local path
if part == "" then
path = uv.exepath()
else
path = pathJoin(uv.cwd(), part)
end
local bundle
local zip = miniz.new_reader(path)
if zip then
bundle = zipBundle(path, zip)
else
local stat = uv.fs_stat(path)
if not stat or stat.type ~= "directory" then
print("ERROR: " .. path .. " is not a zip file or a folder")
return
end
bundle = folderBundle(path)
end
parts[n] = bundle
end
if part == "" then n = n + 1 end
end
if #parts == 1 then
return parts[1]
end
return combinedBundle(parts)
end
local path = uv.exepath()
local zip = miniz.new_reader(path)
if zip then return zipBundle(path, zip) end
end
local function commonBundle(bundle)
function bundle.action(path, action, ...)
-- If it's a real path, run it directly.
if uv.fs_access(path, "r") then return action(path) end
-- Otherwise, copy to a temporary folder and run from there
local data, err = bundle.readfile(path)
if not data then return nil, err end
local dir = assert(uv.fs_mkdtemp(pathJoin(tmpBase, "lib-XXXXXX")))
path = pathJoin(dir, path:match("[^/\\]+$"))
local fd = uv.fs_open(path, "w", 384) -- 0600
uv.fs_write(fd, data, 0)
uv.fs_close(fd)
local success, ret = pcall(action, path, ...)
uv.fs_unlink(path)
uv.fs_rmdir(dir)
assert(success, ret)
return ret
end
luvi.bundle = bundle
luvi.makeBundle = makeBundle
luvi.path = {
join = pathJoin,
getPrefix = getPrefix,
splitPath = splitPath,
joinparts = joinParts,
}
bundle.register = function (name, path)
if not path then path = name + ".lua" end
package.preload[name] = function (...)
local lua = assert(bundle.readfile(path))
return assert(loadstring(lua, "bundle:" .. path))(...)
end
end
local mainPath, main
mainPath = env.get("LUVI_MAIN")
if mainPath then
main = bundle.readfile(mainPath)
else
local base = string.match(args[0], "[^/]*$")
if base then
mainPath = "main/" .. base .. ".lua"
main = bundle.readfile(mainPath)
end
if not main then
mainPath = "main.lua"
main = bundle.readfile(mainPath)
end
end
if not main then error("Missing " .. mainPath .. " in " .. bundle.base) end
_G.args = args
-- Auto-register the require system if present
local mainRequire
local stat = bundle.stat("deps/require.lua")
if stat and stat.type == "file" then
bundle.register('require', "deps/require.lua")
mainRequire = require('require')("bundle:" .. mainPath)
end
-- Auto-setup global p and libuv version of print
if mainRequire and bundle.stat("deps/pretty-print") or bundle.stat("deps/pretty-print.lua") then
_G.p = mainRequire('pretty-print').prettyPrint
end
local fn = assert(loadstring(main, "bundle:main.lua"))
if mainRequire then
setfenv(fn, setmetatable({
require = mainRequire
}, {
__index=_G
}))
end
return fn(unpack(args))
end
local function generateOptionsString()
local s = {}
for k, v in pairs(luvi.options) do
if type(v) == 'boolean' then
table.insert(s, k)
else
table.insert(s, string.format("%s: %s", k, v))
end
end
return table.concat(s, "\n")
end
local function buildBundle(target, bundle)
local miniz = require('miniz')
target = pathJoin(uv.cwd(), target)
print("Creating new binary: " .. target)
local fd = assert(uv.fs_open(target, "w", 511)) -- 0777
local binSize
do
local source = uv.exepath()
local reader = miniz.new_reader(source)
if reader then
-- If contains a zip, find where the zip starts
binSize = reader:get_offset()
else
-- Otherwise just read the file size
binSize = uv.fs_stat(source).size
end
local fd2 = assert(uv.fs_open(source, "r", 384)) -- 0600
print("Copying initial " .. binSize .. " bytes from " .. source)
uv.fs_sendfile(fd, fd2, 0, binSize)
uv.fs_close(fd2)
end
local writer = miniz.new_writer()
local function copyFolder(path)
local files = bundle.readdir(path)
if not files then return end
for i = 1, #files do
local name = files[i]
if string.sub(name, 1, 1) ~= "." then
local child = pathJoin(path, name)
local stat = bundle.stat(child)
if stat.type == "directory" then
writer:add(child .. "/", "")
copyFolder(child)
elseif stat.type == "file" then
print(" " .. child)
writer:add(child, bundle.readfile(child), 9)
end
end
end
end
print("Zipping " .. bundle.base)
copyFolder("")
print("Writing zip file")
uv.fs_write(fd, writer:finalize(), binSize)
uv.fs_close(fd)
print("Done building " .. target)
return
end
local bundle = makeBundle(env.get("LUVI_APP"))
if bundle then
local target = env.get("LUVI_TARGET")
if not target or #target == 0 then return commonBundle(bundle) end
return buildBundle(target, bundle)
end
local prefix = string.format("%s %s", args[0], luvi.version)
local options = generateOptionsString()
local usage = [[
Usage:
Bare Luvi uses environment variables to configure its runtime parameters.
LUVI_APP is a semicolon separated list of paths to folders and/or zip files to
be used as the bundle virtual file system. Items are searched in
the paths from left to right.
LUVI_MAIN is the path to a custom `main.lua`. It's path is relative to the bundle
root. For example, a test runner might use `LUVI_MAIN=tests/run.lua`.
LUVI_TARGET is set when you wish to build a new binary instead of running
directly out of the raw folders. Set this in addition to
LUVI_APP and luvi will build a new binary with the vfs embedded
inside as a single zip file at the end of the executable.
Examples:
# Run luvit directly from the filesystem (like a git checkout)
LUVI_APP=luvit/app $(LUVI)
# Run an app that layers on top of luvit
"LUVI_APP=myapp;luvit/app" $(LUVI)
# Build the luvit binary
LUVI_APP=luvit/app LUVI_TARGET=./luvit $(LUVI)
# Run the new luvit binary
./luvit
# Run an app that layers on top of luvit (note trailing semicolon)
"LUVI_APP=myapp;" ./luvit
# Build your app
"LUVI_APP=myapp;" LUVI_TARGET=mybinary ./luvit]]
usage = string.gsub(usage, "%$%(LUVI%)", args[0])
print(prefix)
print()
print(options)
print(usage)
return -1
end
|
local name = 'utils'
local M = {}
M.debugging_enabled = false
M.start_script = function(script_name)
if M.debugging_enabled then
print('Start script ' .. script_name .. '.lua')
end
return M
end
M.start_script(name)
M.end_script = function(script_name)
if M.debugging_enabled then
print('End script ' .. script_name .. '.lua')
end
end
M.pcall = function(module)
local ok, m = pcall(require, module)
if not ok and M.debugging_enabled then
print('pcall ' .. module .. ' failed')
print(m)
end
return ok, m
end
M.extend = function(original, extension)
return vim.tbl_deep_extend('force', extension, original)
end
M.buffer_directory = function(bufname)
return vim.fn.fnamemodify(bufname, ':p:h')
end
M.current_buffer_name = function()
return vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
end
M.current_buffer_directory = function()
return M.buffer_directory(M.current_buffer_name())
end
M.path_parent = function(path)
return vim.fn.fnamemodify(path, ':h')
end
M.path_exists = function(path)
return vim.loop.fs_stat(path)
end
M.path_join = function(...)
local sep = vim.loop.os_uname().version:match('Windows') and '\\' or '/'
local result = table.concat(vim.tbl_flatten {...}, sep):gsub(sep .. '+', sep)
return result
end
M.find_root = function(root_dir_markers)
-- Scan markers one by one so that we can prioritize markers to search for
for _, marker in ipairs(root_dir_markers) do
local dirname = M.current_buffer_directory()
while not (M.path_parent(dirname) == dirname) do
if M.path_exists(M.path_join(dirname, marker)) then
return dirname
else
dirname = M.path_parent(dirname)
end
end
end
end
M.read_lines = function(file_path)
local lines = {}
if not M.path_exists then
return lines
end
local file = io.open(file_path, "r")
if file then
for line in file:lines() do
table.insert(lines, line)
end
file:close()
end
return lines
end
M.reformat_lines = function(lines, format_string)
local reformatted_lines = {}
for _, line in ipairs(lines) do
table.insert(reformatted_lines, string.format(format_string, line))
end
return reformatted_lines
end
M.end_script(name)
return M
|
local buildconfig = path.join(builddir, "BuildConfig.cs")
local function GenerateBuildConfig()
print("Generating CppSharp build configuration file 'BuildConfig.cs'")
local file = io.open(buildconfig, "w+")
file:write("namespace CppSharp.Parser", "\n{\n ")
file:write("public static class BuildConfig", "\n {\n ")
file:write("public const string Choice = \"" .. _ACTION .. "\";\n")
file:write(" }\n}")
file:close()
end
if generate_build_config == true and _ACTION then
GenerateBuildConfig()
end
project "CppSharp.Parser"
SetupManagedProject()
kind "SharedLib"
language "C#"
clr "Unsafe"
files { "**.cs" }
removefiles { "BuildConfig.cs" }
if generate_build_config == true then
files { buildconfig }
else
files { "BuildConfig.cs" }
end
vpaths { ["*"] = "*" }
links
{
"CppSharp",
"CppSharp.AST",
"CppSharp.Runtime"
}
SetupParser()
filter { "action:not netcore"}
links { "System", "System.Core" }
|
local Menu = require('models.Menu')
describe('Menu', function()
local menu = nil
local cb = function(_) return true end
before_each(function()
menu = Menu:new()
end)
it('allows MenuItem to be added', function()
menu:addItem('item1', cb)
end)
it('allows MenuItem to be fetched', function()
local id = menu:addItem('item1', cb)
local item = menu:getItem(id)
assert.is_same(item.label, 'item1')
assert.is_true(item.target())
end)
it('return nil on fetching non-existant id', function()
assert.is_nil(menu:getItem(99))
assert.is_nil(menu:getItem('some wrong id'))
end)
it('keeps track of highlighted item', function()
menu:addItem('item1', cb)
menu:addItem('item2', cb)
assert.is_equal(menu:getHighlighted(), 1)
menu:setHighlighted(2)
assert.is_equal(menu:getHighlighted(), 2)
assert.has_error(function()
menu:setHighlighted(99)
end)
end)
end)
|
local ADDON, ns = ...
local Addon = ns.Addon
local L = ns.L
local Challenges = Addon:NewModule("Challenges", "AceEvent-3.0","AceHook-3.0")
local Option = Addon:GetModule("Option")
local challenges_options = {
order = 2,
name = L["Challenges Frame"],
type = "group",
args = {
challengesFrame = {
name = L["Modify Challenges Frame"],
order = 1,
type = "toggle",
set = function(_, val)
Addon.db["challengesFrame"] = val
if ChallengesFrame_Update then
ChallengesFrame_Update(ChallengesFrame)
end
end,
width = "double",
},
description1 = {
name = "",
order = 2,
type = "description",
},
weeklyLevel = {
name = L["Best M+ Level"],
order = 3,
type = "range",
min = 2,
max = 35,
step = 1,
width = "double",
},
description2 = {
name = "\n"..L["Dungeons :"],
order = 4,
type = "description",
}
}
}
function Challenges:Get(key)
return Addon.db["dungeons"][key]
end
function Challenges:Set(key, value)
Addon.db["dungeons"][key] = value
end
function Challenges:BuildOptions()
local order = 10
for _, id in ipairs(ns.MapIDs) do
local map = tostring(id)
Addon.db["dungeons"][map] = Addon.db["dungeons"][map] or 20
challenges_options.args[map] = {
name = ns.MapList[id],
order = order,
type = "range",
min = 2,
max = 35,
step = 1,
get = function(info) return Challenges:Get(info[#info]) end,
set = function(info, value)
Challenges:Set(info[#info], value)
Challenges:ChallengesFrame_Update()
end,
}
order = order + 1
local score = map.."score"
Addon.db["dungeons"][score] = Addon.db["dungeons"][score] or 300
challenges_options.args[score] = {
name = L["Score"],
order = order,
type = "range",
min = 0,
max = 500,
step = 1,
get = function(info) return Challenges:Get(info[#info]) end,
set = function(info, value)
Challenges:Set(info[#info], value)
Challenges:ChallengesFrame_Update()
end,
}
order = order + 1
end
ns.Options.args["challenges"] = challenges_options
end
function Challenges:OnEnable()
self:RegisterEvent("ADDON_LOADED")
self:SecureHook(Option, "BuildOptions")
end
function Challenges:ADDON_LOADED(event, addon)
if addon == "Blizzard_ChallengesUI" then
self:SecureHook("ChallengesFrame_Update", "ChallengesFrame_Update")
self:UnregisterEvent(event)
end
end
local function updateCurrentText(self)
if self.setting or not Addon.db["challengesFrame"] then return end
local locale = _G.AngryKeystones.Modules.Locale
local keystoneString = locale and locale:Get("currentKeystoneText")
local mapName = C_ChallengeMode.GetMapUIInfo(Addon.db["mapId"])
local keystoneName = mapName and string.format("%s (%d)", mapName, Addon.db["mythicLevel"])
if keystoneName and keystoneString then
self.setting = true
self:SetText(string.format(keystoneString, keystoneName))
self.setting = nil
end
end
local function showObject(self)
if not Addon.db["challengesFrame"] then return end
self:Show()
end
local function updateGuildName(self)
if self.setting or not Addon.db["challengesFrame"] then return end
local name = UnitName("player")
local _, classFilename = UnitClass("player")
local classColorStr = RAID_CLASS_COLORS[classFilename].colorStr
self.setting = true
self:SetText(format(CHALLENGE_MODE_GUILD_BEST_LINE_YOU, classColorStr, name))
self.setting = nil
end
local function updateGuildLevel(self)
if self.setting or not Addon.db["challengesFrame"] then return end
local level = Addon.db["weeklyLevel"]
self.setting = true
self:SetText(level)
self.setting = nil
end
local entries
function Challenges:ChallengesFrame_Update()
if not Addon.db["challengesFrame"] then
if entries then
for i = 1, #entries do
entries[i]:Show()
end
end
return
end
local sortedMaps = {}
for i = 1, #ns.MapIDs do
local id = ns.MapIDs[i]
local map = tostring(id)
local level = Addon.db["dungeons"][map]
local score = Addon.db["dungeons"][map.."score"]
tinsert(sortedMaps, { id = id, level = level, dungeonScore = score})
end
table.sort(sortedMaps,
function(a, b)
return a.dungeonScore > b.dungeonScore
end)
local totalScore = 0
for i = 1, #sortedMaps do
local frame = ChallengesFrame.DungeonIcons[i]
frame:SetUp(sortedMaps[i], i == 1)
local score = sortedMaps[i].dungeonScore
totalScore = totalScore + score
local color = C_ChallengeMode.GetSpecificDungeonOverallScoreRarityColor(score)
frame.HighestLevel:SetTextColor(color.r, color.g, color.b)
end
local _, _, _, _, backgroundTexture = C_ChallengeMode.GetMapUIInfo(sortedMaps[1].id)
if (backgroundTexture ~= 0) then
ChallengesFrame.Background:SetTexture(backgroundTexture)
end
ChallengesFrame.WeeklyInfo:SetUp(true, sortedMaps[1])
local activeChest = ChallengesFrame.WeeklyInfo.Child.WeeklyChest
activeChest.Icon:SetAtlas("mythicplus-greatvault-complete", TextureKitConstants.UseAtlasSize)
activeChest.Highlight:SetAtlas("mythicplus-greatvault-complete", TextureKitConstants.UseAtlasSize)
activeChest.RunStatus:SetText(MYTHIC_PLUS_COMPLETE_MYTHIC_DUNGEONS)
activeChest.AnimTexture:Hide()
activeChest:Show()
local color = C_ChallengeMode.GetDungeonScoreRarityColor(totalScore)
if(color) then
ChallengesFrame.WeeklyInfo.Child.DungeonScoreInfo.Score:SetVertexColor(color.r, color.g, color.b)
end
ChallengesFrame.WeeklyInfo.Child.DungeonScoreInfo.Score:SetText(totalScore)
ChallengesFrame.WeeklyInfo.Child.DungeonScoreInfo:SetShown(true)
ChallengesFrame.WeeklyInfo.Child.ThisWeekLabel:Show()
ChallengesFrame.WeeklyInfo.Child.Description:Hide()
if IsAddOnLoaded("AngryKeystones") then
local mod = _G.AngryKeystones.Modules.Schedule
mod.KeystoneText:Show()
updateCurrentText(mod.KeystoneText)
if not self.AngryKeystonesHooked then
hooksecurefunc(mod.KeystoneText, "Hide", showObject)
hooksecurefunc(mod.KeystoneText, "SetText", updateCurrentText)
self.AngryKeystonesHooked = true
end
end
if entries then
for i = 1, #entries do
if i ~= 1 then
entries[i]:Hide()
end
end
else
for _, child in pairs {ChallengesFrame:GetChildren()} do
if child.entries and child.entries[1] and child.entries[1].CharacterName then
entries = child.entries
for i = 1, #entries do
local entry = entries[i]
if i == 1 then
hooksecurefunc(entry.CharacterName, "SetText", updateGuildName)
hooksecurefunc(entry.Level, "SetText", updateGuildLevel)
entry:Show()
entry.CharacterName:SetText("")
entry.Level:SetText("")
else
entry:Hide()
end
end
break
end
end
end
end |
os.loadAPI("api/Navigator.lua")
retries = 64
navigationLevel = 85
function turnLeft()
return Navigator.TurnLeft()
end
function turnRight()
return Navigator.TurnRight()
end
function turnAround()
return Navigator.TurnLeft() and Navigator.TurnLeft()
end
function forward()
for i = 1, retries do
if Navigator.Forward() then
return true
end
turtle.dig()
end
return false
end
function up()
for i = 1, retries do
if Navigator.Up() then
return true
end
turtle.digUp()
end
return false
end
function down()
for i = 1, retries do
if Navigator.Down() then
return true
end
turtle.digDown()
end
return false
end
function back()
turnAround()
forward()
turnAround()
end
function threeWayForward()
forward()
turtle.digDown()
turtle.digUp()
end
function savelyRead(variable)
coord = nil
repeat
term.clear()
term.setCursorPos(1, 1)
print("Please enter your " .. variable .. " coordinate")
write(" " .. variable .. " = ")
coord = tonumber(read())
if coord == nil then
print("Incorrect input. Use numbers only!")
print()
end
until (coord ~= nil)
return coord
end
function fixLevel(source, target, orientation) -- south north are even. east,west are odd
-- math.fmod(x,y)
if (source > target) then
Navigator.TurnRight(2)
elseif (source < target) then
Navigator.TurnRight(0)
end
-- Navigator.Forward(math.abs(navigationLevel-z))
end
function goTo(tX, tY, tZ, l)
-- Reset Position
-- Initialize Navigator
if (Navigator.InitializeNavigator()) then
-- print("Navigator file found, resetting position.")
x, y, z, direction = Navigator.GetPosition()
-- First Y:
if (y < navigationLevel) then
-- print("Moving up.")
Navigator.Up(navigationLevel - y)
else
-- print("Vertical is fine.")
end
-- Now Z:
if (z > tZ) then
-- print("Moving north.")
-- Turn to positive z and move.
Navigator.TurnRight(2) -- facing -z
elseif (z < tZ) then
-- print("Moving south.")
-- Turn to negative z and move.
Navigator.TurnRight(0) -- facing +z
Navigator.Forward(math.abs(tZ - z))
-- Now Z:
if (x > tX) then
-- print("Moving north.")
-- Turn to positive z and move.
Navigator.TurnRight(3) -- facing -z
elseif (x < tX) then
-- print("Moving south.")
-- Turn to negative z and move.
Navigator.TurnRight(1) -- facing +z
Navigator.Forward(math.abs(tX - x))
if (y > tY) then
-- print("Moving down.")
Navigator.Down(tY - y)
elseif (y < tY) then
-- print("Moving up.")
Navigator.Up(tY - y)
else
-- print("Vertical is fine.")
end
else
print("initialize first")
x, y, z, direction = Navigator.GetPosition()
print("IMPORTANT! Stand directly behind turtle")
print("Press F3 to read coordinates")
print()
continue = true
while continue do
x = savelyRead("X")
y = savelyRead("Y")
z = savelyRead("Z")
direction = savelyRead("direction")
end
end
end
end
end
|
modifier_lifestealer_open_wounds_lua = class({})
--------------------------------------------------------------------------------
-- Classifications
function modifier_lifestealer_open_wounds_lua:IsHidden()
return false
end
function modifier_lifestealer_open_wounds_lua:IsDebuff()
return true
end
function modifier_lifestealer_open_wounds_lua:IsPurgable()
return true
end
--------------------------------------------------------------------------------
-- Initializations
function modifier_lifestealer_open_wounds_lua:OnCreated( kv )
-- references
self.heal = self:GetAbility():GetSpecialValueFor( "heal_percent" )/100 -- special value
self.step = 1
-- Start interval
self:StartIntervalThink( 1 )
end
function modifier_lifestealer_open_wounds_lua:OnRefresh( kv )
-- references
self.heal = self:GetAbility():GetSpecialValueFor( "heal_percent" )/100 -- special value
self.step = 1
end
function modifier_lifestealer_open_wounds_lua:OnDestroy( kv )
end
--------------------------------------------------------------------------------
-- Modifier Effects
function modifier_lifestealer_open_wounds_lua:DeclareFunctions()
local funcs = {
MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE,
MODIFIER_EVENT_ON_ATTACKED,
}
return funcs
end
function modifier_lifestealer_open_wounds_lua:GetModifierMoveSpeedBonus_Percentage()
if IsServer() then
return self:GetAbility():GetLevelSpecialValueFor( "slow_steps", self.step )
end
end
function modifier_lifestealer_open_wounds_lua:OnAttacked( params )
if IsServer() then
if params.target~=self:GetParent() then return end
if params.attacker:GetTeamNumber()~=self:GetCaster():GetTeamNumber() then return end
-- heal
params.attacker:Heal( self.heal * params.damage, self:GetCaster() )
-- play effects
self:PlayEffects( params.attacker )
end
end
--------------------------------------------------------------------------------
-- Interval Effects
function modifier_lifestealer_open_wounds_lua:OnIntervalThink()
self.step = self.step + 1
end
--------------------------------------------------------------------------------
-- Graphics & Animations
function modifier_lifestealer_open_wounds_lua:GetEffectName()
return "particles/units/heroes/hero_life_stealer/life_stealer_open_wounds.vpcf"
end
function modifier_lifestealer_open_wounds_lua:GetEffectAttachType()
return PATTACH_ABSORIGIN_FOLLOW
end
function modifier_lifestealer_open_wounds_lua:PlayEffects( target )
-- Get Resources
local particle_cast = "particles/generic_gameplay/generic_lifesteal.vpcf"
-- Create Particle
local effect_cast = ParticleManager:CreateParticle( particle_cast, PATTACH_ABSORIGIN_FOLLOW, target )
-- ParticleManager:SetParticleControl( effect_cast, iControlPoint, vControlVector )
-- ParticleManager:SetParticleControlEnt(
-- effect_cast,
-- iControlPoint,
-- hTarget,
-- PATTACH_NAME,
-- "attach_name",
-- vOrigin, -- unknown
-- bool -- unknown, true
-- )
ParticleManager:ReleaseParticleIndex( effect_cast )
end |
-- Telekasten --
local home = vim.fn.expand("~/.notes")
require("telekasten").setup({
home = home,
take_over_my_home = true,
auto_set_filetype = true,
dailies = home .. '/' .. 'daily',
weeklies = home .. '/' .. 'weekly',
templates = home .. '/' .. 'templates',
extension = '.md',
follow_creates_nonexistant = true,
dailies_create_nonexistant = true,
weeklies_create_nonexistant = true,
template_new_daily = home .. '/' .. 'templates/daily.md',
plug_into_calendar = true,
calendar_opts = {
-- calendar weekly display mode:
-- 1 'WK01'
-- 2 'WK 1'
-- 3 'KW01'
-- 4 'KW 1'
-- 5 `1`
weeknm = 1,
calendar_monday = 1,
calendar_mark = 'left_fit'
},
-- Telescope actions behavior
close_after_yanking = false,
insert_after_inserting = true,
-- Tag notation
tag_notation = '#tag',
-- Options: dropdown or ivy
command_palette_theme = 'ivy',
show_tags_theme = 'ivy',
subdirs_in_links = true,
-- Options: prefer_new_note, smart, always_ask
template_handling = 'smart',
-- Options: smart, prefer_home, same_as_current
new_note_location = "smart",
rename_update_links = true
})
|
function love.load()
Object = require "classic"
require "entity"
require "player"
require "wall"
require "box"
player = Player(100, 100)
box = Box(400, 150)
objects = {}
table.insert(objects, player)
table.insert(objects, box)
walls = {}
map = {
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
{1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
}
for i,v in ipairs(map) do
for j,w in ipairs(v) do
if w == 1 then
table.insert(walls, Wall((j-1)*50, (i-1)*50))
end
end
end
end
function love.update(dt)
for i,v in ipairs(objects) do
v:update(dt)
end
for i,v in ipairs(walls) do
v:update(dt)
end
local loop = true
local limit = 0
while loop do
loop = false
limit = limit + 1
if limit > 100 then
break
end
for i=1,#objects-1 do -- don't need to check for collisions with the final object
for j=i+1,#objects do -- make sure we don't check for collisions with itself
local collision = objects[i]:resolveCollision(objects[j])
if collision then
loop = true
end
end
end
for i,wall in ipairs(walls) do
for j,object in ipairs(objects) do
local collision = object:resolveCollision(wall)
if collision then
loop = true
end
end
end
end
end
function love.draw()
for i,v in ipairs(objects) do
v:draw()
end
for i,v in ipairs(walls) do
v:draw()
end
end
function love.keypressed(key)
if key == "up" then
player:jump()
end
end
|
local args = {...}
local minecraft = getSettings().minecraft
if args[3] == "down" then
fov = minecraft.getFov() --set fov as global variable
minecraft.setFov(30) --zoom
else
minecraft.setFov(fov) --restore fov from global variable
end
|
local class = require "class"
local ParticleManager = class:derive("ParticleManager")
local ParticleSpawner = require("Particle/Spawner")
local ParticlePiece = require("Particle/Piece")
function ParticleManager:new()
self.particleSpawners = {}
self.particlePieces = {}
end
function ParticleManager:update(dt)
for i, particleSpawner in ipairs(self.particleSpawners) do
particleSpawner:update(dt)
end
for i, particlePiece in ipairs(self.particlePieces) do
particlePiece:update(dt)
end
end
function ParticleManager:useSpawnerData(path, pos)
local particleSpawnerData = game.resourceBank:getParticle(path)
for spawnerN, spawnerData in pairs(particleSpawnerData) do
self:spawnParticleSpawner(spawnerData, pos)
end
end
function ParticleManager:spawnParticleSpawner(data, pos)
table.insert(self.particleSpawners, ParticleSpawner(self, data, pos))
end
function ParticleManager:spawnParticlePiece(data, pos)
table.insert(self.particlePieces, ParticlePiece(self, data, pos))
end
function ParticleManager:destroyParticleSpawner(particleSpawner)
table.remove(self.particleSpawners, self:getParticleSpawnerID(particleSpawner))
end
function ParticleManager:destroyParticlePiece(particlePiece)
table.remove(self.particlePieces, self:getParticlePieceID(particlePiece))
end
function ParticleManager:getParticleSpawnerID(particleSpawner)
for i, particleSpawnerT in ipairs(self.particleSpawners) do
if particleSpawner == particleSpawnerT then return i end
end
end
function ParticleManager:getParticlePieceID(particlePiece)
for i, particlePieceT in ipairs(self.particlePieces) do
if particlePiece == particlePieceT then return i end
end
end
function ParticleManager:getParticleSpawnerCount()
return #self.particleSpawners
end
function ParticleManager:getParticlePieceCount()
return #self.particlePieces
end
function ParticleManager:draw()
for i, particlePiece in ipairs(self.particlePieces) do
particlePiece:draw()
end
if particleSpawnersVisible then
for i, particleSpawner in ipairs(self.particleSpawners) do
particleSpawner:draw()
end
end
end
return ParticleManager |
resource_type 'gametype' { name = 'Freeroam' }
client_script 'fivem_client.lua' |
--------------------------------------------------------------------------------
-- Flatten functions
-- If there's no point, return nil.
local function get_first_value(pat_seq, trk_idx, prm)
for seq_idx, pat_idx in ipairs(pat_seq) do
local pattrk = renoise.song():pattern(pat_idx):track(trk_idx)
local auto = pattrk:find_automation(prm)
if auto then
return auto.points[1].value
end
end
return nil
end
local function add_point_quantum(table, point)
-- Same value 2 points -> 1 point
if #table >= 1 then
if table[#table].value == point.value then
return
end
end
table:insert(point)
end
local function flatten_points_quantum(pat_seq, trk_idx, prm)
local fpts = table.create()
do
local val = get_first_value(pat_seq, trk_idx, prm)
-- If there's no automation, return nil
if not val then
return nil
end
-- Add first point at the head of song
add_point_quantum(fpts, {
time = 1,
value = val,
scaling = 0
})
end
-- If parameter is BPM, LPB, or TPL, Renoise changes value
-- to first value of pattern automations on heads of each patterns.
-- Otherwise Renoise keeps current value on heads of each patterns.
-- If error, return false.
local head_write = false
if prm.name == "BPM" or prm.name == "LPB" or prm.name == "TPL" then
head_write = true;
end
-- Iterate sequences
local seq_time = 0
for seq_idx, pat_idx in ipairs(pat_seq) do
local pat = renoise.song():pattern(pat_idx)
local pattrk = pat:track(trk_idx)
local nlines = pat.number_of_lines
local auto = pattrk:find_automation(prm)
if auto then
local pts = auto.points
if auto.playmode ~= renoise.PatternTrackAutomation.PLAYMODE_POINTS then
renoise.app():show_error(
("Track %02d: %s, Sequence %d: BPM interpolation mode needs to be \"Points\".")
:format(trk_idx, renoise.song():track(trk_idx).name, seq_idx - 1))
return false
end
if head_write then
-- If there's no point at the head, add point there
if not auto:has_point_at(1) then
add_point_quantum(fpts, {
time = seq_time + 1,
value = pts[1].value,
scaling = 0
})
end
end
-- Flatten points
for pt_idx, pt in ipairs(auto.points) do
pt.time = pt.time + seq_time
add_point_quantum(fpts, pt)
end
end
seq_time = seq_time + nlines
end
return fpts
end
local function add_point(table, point)
-- Same value 3 points -> 2 points
if #table >= 2 then
if table[#table].value == point.value and
table[#table-1].value == point.value then
table[#table].time = point.time
return
end
end
table:insert(point)
end
-- If there's no automation, return nil.
-- If error, return false.
local function flatten_points(pat_seq, trk_idx, prm, lines_mode)
if not lines_mode then
return flatten_points_quantum(pat_seq, trk_idx, prm)
end
local fpts = table.create()
-- Iterate sequences
local seq_time = 0
for seq_idx, pat_idx in ipairs(pat_seq) do
local pat = renoise.song():pattern(pat_idx)
local pattrk = pat:track(trk_idx)
local nlines = pat.number_of_lines
local end_time = nlines + 1 - prm.time_quantum
local auto = pattrk:find_automation(prm)
-- With automation
if auto then
local pts = auto.points
if auto.playmode == renoise.PatternTrackAutomation.PLAYMODE_LINES then
-- If there's no point at the head, add point there
if not auto:has_point_at(1) then
add_point(fpts, {
time = seq_time + 1,
value = pts[1].value,
scaling = 0
})
end
-- Flatten points
for pt_idx, pt in ipairs(auto.points) do
pt.time = pt.time + seq_time
-- Set 0 to scaling of last point
if pt_idx == #auto.points then
pt.scaling = 0
end
add_point(fpts, pt)
end
-- If there's no point at the end, add point there
if not auto:has_point_at(end_time) then
add_point(fpts, {
time = seq_time + end_time,
value = pts[#pts].value,
scaling = 0
})
end
elseif auto.playmode == renoise.PatternTrackAutomation.PLAYMODE_POINTS then
-- If there's no point at the head of song, add point there
if seq_idx == 1 and not auto:has_point_at(1) then
local val = get_first_value(pat_seq, trk_idx, prm)
add_point(fpts, {
time = 1,
value = pts[1].value,
scaling = 0
})
end
-- Flatten points
for pt_idx, pt in ipairs(auto.points) do
-- If it's not at the head and there's no point behind time_quantum, add point there
if pt.time > 1 and not auto:has_point_at(pt.time - prm.time_quantum) and #fpts > 0 then
add_point(fpts, {
time = seq_time + pt.time - prm.time_quantum,
value = fpts[#fpts].value,
scaling = 0
})
end
pt.time = pt.time + seq_time
pt.scaling = 0
add_point(fpts, pt)
end
-- If there's no point at the end, add point there
if not auto:has_point_at(end_time) then
add_point(fpts, {
time = seq_time + end_time,
value = pts[#pts].value,
scaling = 0
})
end
else
renoise.app():show_error(
("Track %02d: %s, Sequence %d: \"Curve\" interpolation mode isn't supported.")
:format(trk_idx, renoise.song():track(trk_idx).name, seq_idx - 1))
return false
end
-- Without automation
else
if seq_idx == 1 then
local val = get_first_value(pat_seq, trk_idx, prm)
-- If there's no automation, return nil
if not val then
return nil
end
-- Add point at the head
add_point(fpts, {
time = 1,
value = val,
scaling = 0
})
end
-- Add point at the end
add_point(fpts, {
time = seq_time + end_time,
value = fpts[#fpts].value,
scaling = 0
})
end
seq_time = seq_time + nlines
end
-- Same value 2 points at the end -> 1 point
if #fpts >= 2 then
if fpts[#fpts].value == fpts[#fpts-1].value then
fpts:remove()
end
end
return fpts
end
function flatten_all_params()
local params = table.create()
local param_tags = {}
local pat_seq = renoise.song().sequencer.pattern_sequence
for trk_idx, trk in ipairs(renoise.song().tracks) do
local t = table.create()
for dev_idx, dev in ipairs(trk.devices) do
for prm_idx, prm in ipairs(dev.parameters) do
if prm.is_automated then
local lines_mode = true
local tag = nil
if prm.value_quantum ~= 0 then
lines_mode = false
end
if trk.type == renoise.Track.TRACK_TYPE_MASTER and dev_idx == 1 then
if prm_idx == 6 then
lines_mode = false
tag = "BPM"
elseif prm_idx == 7 then
tag = "LPB"
elseif prm_idx == 8 then
tag = "TPL"
end
end
local env = flatten_points(pat_seq, trk_idx, prm, lines_mode)
if env == false then
-- Error
return nil
elseif env ~= nil then
-- Not command controled parameter
local p = {
trk_idx = trk_idx,
param = prm,
lines_mode = lines_mode,
tag = tag,
envelope = env,
}
t:insert(p)
if tag ~= nil then
param_tags[tag] = p
end
end
end
end
end
params:insert(t)
end
return params, param_tags
end
--------------------------------------------------------------------------------
-- Parent table functions
local function parent_table_part(tbl, par_idx, members)
local idx = par_idx - 1
while idx >= par_idx - members do
local trk = renoise.song():track(idx)
tbl[idx] = par_idx
if trk.type == renoise.Track.TRACK_TYPE_GROUP then
idx = parent_table_part(tbl, idx, #trk.members)
else
idx = idx - 1
end
end
return idx
end
-- Make a table of track indices of group parents
-- The parent of top level tracks is the master track.
-- Index of the master track and send tracks is 0.
local function get_parent_table()
local tbl = table.create()
for i = 1, #renoise.song().tracks do
tbl:insert(0)
end
local idx = #renoise.song().tracks
for idx, trk in ripairs(renoise.song().tracks) do
if trk.type == renoise.Track.TRACK_TYPE_MASTER then
parent_table_part(tbl, idx, idx - 1)
break
end
end
return tbl
end
function filter_track_params(params, search_trk_idx)
local t = table.create()
local parent_table = get_parent_table()
for trk_idx, prms in ipairs(params) do
if trk_idx == search_trk_idx then
for i, p in ipairs(prms) do
t:insert(p)
end
search_trk_idx = parent_table[trk_idx]
end
end
return t
end
--------------------------------------------------------------------------------
-- Slice functions
local function get_first_slice_point(points, start_pt_idx, s_time)
-- Search the necessary point to get the start value
-- in the time range given by s_time and e_time (Update start_pt_idx)
-- The search start from start_pt_idx
for pt_idx = start_pt_idx, #points do
local pt = points[pt_idx]
if pt.time > s_time then
-- (start point).time can equal to s_time
start_pt_idx = pt_idx - 1
break
-- The last point
elseif pt_idx == #points then
start_pt_idx = pt_idx
break
end
end
return start_pt_idx
end
local function slice_points_quantum(points, start_pt_idx, s_time, e_time)
start_pt_idx = get_first_slice_point(points, start_pt_idx, s_time)
local slice = table.create()
-- Slice
slice:insert {
time = 1,
value = points[start_pt_idx].value,
scaling = 0
}
for pt_idx = start_pt_idx+1, #points do
local pt = points[pt_idx]
if pt.time > e_time then
break
end
-- Get a value in the time range and make a point
slice:insert {
time = 1 + (pt.time - s_time),
value = pt.value,
scaling = 0
}
end
return slice, start_pt_idx
end
local function interpolate_points(pt1, pt2, time)
local v1 = pt1.value
local v2 = pt2.value
local t = (time - pt1.time) / (pt2.time - pt1.time)
local p = 1 + 16 * math.abs(pt1.scaling) ^ (math.exp(1) / 2)
if pt1.scaling >= 0 then
return v1 + (v2 - v1) * (t ^ p)
else
return v1 + (v2 - v1) * (1 - (1 - t) ^ p)
end
end
local function interpolate_scaling(pt1, pt2, time, time2)
local t = (time - pt1.time) / (pt2.time - pt1.time)
return pt1.scaling * (1 - t)
end
-- s_time and e_time are inclusive
function slice_points(lines_mode, points, start_pt_idx, s_time, e_time)
if not lines_mode then
return slice_points_quantum(points, start_pt_idx, s_time, e_time)
end
start_pt_idx = get_first_slice_point(points, start_pt_idx, s_time)
local slice = table.create()
-- Slice
-- When all points come before the time range
-- or the last point comes on start of the time range
-- or there's only one point
if start_pt_idx == #points then
slice:insert {
time = 1,
value = points[start_pt_idx].value,
scaling = 0
}
else
-- Get the start value in the range and make the first point
slice:insert {
time = 1,
value = interpolate_points(
points[start_pt_idx], points[start_pt_idx+1], s_time),
scaling = interpolate_scaling(
points[start_pt_idx], points[start_pt_idx+1], s_time)
}
for pt_idx = start_pt_idx+1, #points do
local pt = points[pt_idx]
-- Get the end value in the range and make the last point
if pt.time >= e_time then
local val = interpolate_points(points[pt_idx-1], pt, e_time)
if val ~= slice[#slice].value then
slice[#slice].scaling =
slice[#slice].scaling - interpolate_scaling(points[pt_idx-1], pt, e_time)
slice:insert {
time = 1 + (e_time - s_time),
value = val,
scaling = 0
}
end
break
-- Get a value in the time range and make a point
else
slice:insert {
time = 1 + (pt.time - s_time),
value = pt.value,
scaling = pt.scaling
}
end
end
end
return slice, start_pt_idx
end
function get_value_in_points(lines_mode, points, start_pt_idx, time)
start_pt_idx = get_first_slice_point(points, start_pt_idx, time)
local v
if not lines_mode or start_pt_idx == #points then
v = points[start_pt_idx].value
else
v = interpolate_points(
points[start_pt_idx], points[start_pt_idx + 1], time)
end
return v, start_pt_idx
end
--------------------------------------------------------------------------------
-- Tests
if TEST then
do
local function remove_param(prms)
for i, v in ipairs(prms) do
prms[i] = v.trk_idx
end
return prms
end
setup_test(1)
renoise.song():insert_track_at(2)
renoise.song():insert_track_at(3)
renoise.song():insert_group_at(4)
renoise.song():add_track_to_group(2, 4)
renoise.song():add_track_to_group(2, 4)
renoise.song():insert_track_at(5)
renoise.song():insert_group_at(6)
renoise.song():add_track_to_group(4, 6)
renoise.song():add_track_to_group(2, 6)
local pat = renoise.song():pattern(1)
for i = 1, 7 do
local pattrk = pat:track(i)
local prm = renoise.song():track(i):device(1):parameter(1)
local auto = pattrk:create_automation(prm)
auto:add_point_at(1, 0)
end
-- Group & master track automation test
local params = flatten_all_params()
assert(table_eq_deep(
remove_param(filter_track_params(params, 1)),
{ 1, 7 }
))
assert(table_eq_deep(
remove_param(filter_track_params(params, 2)),
{ 2, 4, 6, 7 }
))
assert(table_eq_deep(
remove_param(filter_track_params(params, 3)),
{ 3, 4, 6, 7 }
))
assert(table_eq_deep(
remove_param(filter_track_params(params, 5)),
{ 5, 6, 7 }
))
end
do
setup_test(5)
local pat_seq = renoise.song().sequencer.pattern_sequence
local pattrk = {}
for i = 1, 5 do
pattrk[i] = renoise.song():pattern(i):track(1)
end
do
local prm = renoise.song():track(1):device(1):parameter(1)
local auto = {}
auto[1] = pattrk[1]:create_automation(prm)
auto[3] = pattrk[3]:create_automation(prm)
auto[4] = pattrk[4]:create_automation(prm)
auto[5] = pattrk[5]:create_automation(prm)
auto[4].playmode = renoise.PatternTrackAutomation.PLAYMODE_POINTS
auto[5].playmode = renoise.PatternTrackAutomation.PLAYMODE_POINTS
auto[1]:add_point_at(3, 0)
auto[1]:add_point_at(7, 1)
auto[1]:add_point_at(11, 0.5)
auto[3]:add_point_at(9, 1)
auto[4]:add_point_at(1, 0)
auto[4]:add_point_at(2.5, 0.5)
auto[5]:add_point_at(5, 1)
local env = flatten_points(pat_seq, 1, prm, true)
-- Flatten test
local q = prm.time_quantum
assert(table_eq_deep(env, {
{ time = 1, value = 0, scaling = 0 },
{ time = 3, value = 0, scaling = 0 },
{ time = 7, value = 1, scaling = 0 },
{ time = 11, value = 0.5, scaling = 0 },
{ time = 129 - q, value = 0.5, scaling = 0 },
{ time = 129, value = 1, scaling = 0 },
{ time = 193 - q, value = 1, scaling = 0 },
{ time = 193, value = 0, scaling = 0 },
{ time = 194.5 - q, value = 0, scaling = 0 },
{ time = 194.5, value = 0.5, scaling = 0 },
{ time = 261 - q, value = 0.5, scaling = 0 },
{ time = 261, value = 1, scaling = 0 },
}))
-- Slice tests
assert(table_eq_deep(
slice_points(true, env, 1, 1, 2), {
{ time = 1, value = 0, scaling = 0 },
}))
assert(table_eq_deep(
slice_points(true, env, 1, 2, 4.5), {
{ time = 1, value = 0, scaling = 0 },
{ time = 2, value = 0, scaling = 0 },
{ time = 3.5, value = 0.375, scaling = 0 },
}))
assert(table_eq_deep(
slice_points(true, env, 1, 6, 12), {
{ time = 1, value = 0.75, scaling = 0 },
{ time = 2, value = 1, scaling = 0 },
{ time = 6, value = 0.5, scaling = 0 },
}))
assert(table_eq_deep(
slice_points(true, env, 1, 12, 13), {
{ time = 1, value = 0.5, scaling = 0 },
}))
end
do
local prm = renoise.song():track(1):device(1):parameter(2)
local auto = {}
auto[1] = pattrk[1]:create_automation(prm)
auto[1].playmode = renoise.PatternTrackAutomation.PLAYMODE_POINTS
auto[1]:add_point_at(3, 0)
local env = flatten_points(pat_seq, 1, prm, true)
-- Flatten test
assert(table_eq_deep(env, {
{ time = 1, value = 0, scaling = 0 },
}))
end
end
do
setup_test(3)
local pat_seq = renoise.song().sequencer.pattern_sequence
local pattrk = {}
for i = 1, 3 do
pattrk[i] = renoise.song():pattern(i):track(2)
end
do
local prm = renoise.song():track(2):device(1):parameter(1)
local auto = {}
auto[1] = pattrk[1]:create_automation(prm)
auto[3] = pattrk[3]:create_automation(prm)
auto[1].playmode = renoise.PatternTrackAutomation.PLAYMODE_POINTS
auto[3].playmode = renoise.PatternTrackAutomation.PLAYMODE_POINTS
auto[1]:add_point_at(3, 0)
auto[1]:add_point_at(7, 1)
auto[1]:add_point_at(11, 0.5)
auto[3]:add_point_at(9, 1)
local env = flatten_points(pat_seq, 2, prm, false)
-- Flatten test
assert(table_eq_deep(env, {
{ time = 1, value = 0, scaling = 0 },
{ time = 7, value = 1, scaling = 0 },
{ time = 11, value = 0.5, scaling = 0 },
{ time = 137, value = 1, scaling = 0 },
}))
-- Slice tests
assert(table_eq_deep(
slice_points(false, env, 1, 1, 2), {
{ time = 1, value = 0, scaling = 0 },
}))
assert(table_eq_deep(
slice_points(false, env, 1, 6, 12), {
{ time = 1, value = 0, scaling = 0 },
{ time = 2, value = 1, scaling = 0 },
{ time = 6, value = 0.5, scaling = 0 },
}))
assert(table_eq_deep(
slice_points(false, env, 1, 12, 13), {
{ time = 1, value = 0.5, scaling = 0 },
}))
end
do
local prm = renoise.song():track(2):device(1):parameter(6) -- BPM
local auto = {}
auto[1] = pattrk[1]:create_automation(prm)
auto[3] = pattrk[3]:create_automation(prm)
auto[1].playmode = renoise.PatternTrackAutomation.PLAYMODE_POINTS
auto[3].playmode = renoise.PatternTrackAutomation.PLAYMODE_POINTS
auto[1]:add_point_at(3, 0)
auto[1]:add_point_at(7, 1)
auto[1]:add_point_at(11, 0.5)
auto[3]:add_point_at(9, 1)
local env = flatten_points(pat_seq, 2, prm, false)
-- Flatten test
assert(table_eq_deep(env, {
{ time = 1, value = 0, scaling = 0 },
{ time = 7, value = 1, scaling = 0 },
{ time = 11, value = 0.5, scaling = 0 },
{ time = 129, value = 1, scaling = 0 }, -- Not at the point but at the head of the pattern
}))
end
end
-- Test scaling of lines mode
do
setup_test(5)
local pat_seq = renoise.song().sequencer.pattern_sequence
local pattrk = {}
for i = 1, 5 do
pattrk[i] = renoise.song():pattern(i):track(1)
end
local prm = renoise.song():track(1):device(1):parameter(1)
local auto = {}
auto[1] = pattrk[1]:create_automation(prm)
auto[3] = pattrk[3]:create_automation(prm)
auto[3].playmode = renoise.PatternTrackAutomation.PLAYMODE_POINTS
auto[1]:add_point_at(1, 1, -0.25)
auto[1]:add_point_at(3, 0, 1)
auto[1]:add_point_at(7, 1, 0.25)
auto[1]:add_point_at(11, 0.5, -0.5)
auto[3]:add_point_at(9, 1, 0.125)
local env = flatten_points(pat_seq, 1, prm, true)
-- Flatten test
local q = prm.time_quantum
assert(table_eq_deep(env, {
{ time = 1, value = 1, scaling = -0.25 },
{ time = 3, value = 0, scaling = 1 },
{ time = 7, value = 1, scaling = 0.25 },
{ time = 11, value = 0.5, scaling = 0 },
{ time = 137 - q, value = 0.5, scaling = 0 },
{ time = 137, value = 1, scaling = 0 },
}))
-- Slice tests
value_map = { number = function(x) return quantize(x, 1 / 0x10000) end }
assert(table_eq_deep(
slice_points(true, env, 1, 2, 2.5), {
{ time = 1, value = 0.092700213193893, scaling = -0.0625 },
{ time = 1.5, value = 0.0085933292284608, scaling = 0 },
}, value_map))
assert(table_eq_deep(
slice_points(true, env, 1, 3, 6), {
{ time = 1, value = 0, scaling = 0.75 },
{ time = 4, value = 0.0075169466435909, scaling = 0 },
}, value_map))
assert(table_eq_deep(
slice_points(true, env, 1, 8, 11), {
{ time = 1, value = 0.99570333957672, scaling = 0.1875 },
{ time = 4, value = 0.5, scaling = 0 },
}, value_map))
assert(table_eq_deep(
slice_points(true, env, 1, 12, 13), {
{ time = 1, value = 0.5, scaling = 0 },
}, value_map))
end
print("All automation tests passed.")
end
|
registerHotkey('CycleFOV', 'Cycle FOV', function()
local fov = Game.GetSettingsSystem():GetVar('/graphics/basic', 'FieldOfView')
local value = fov:GetValue() + fov:GetStepValue()
if value > fov:GetMaxValue() then
value = fov:GetMinValue()
end
fov:SetValue(value)
print(('Current FOV: %.1f'):format(fov:GetValue()))
end)
registerHotkey('CycleResolution', 'Cycle resolution', function()
local resolution = Game.GetSettingsSystem():GetVar('/video/display', 'Resolution')
local options = resolution:GetValues()
local current = resolution:GetIndex() + 1 -- lua tables start at 1
local next = current + 1
if next > #options then
next = 1
end
resolution:SetIndex(next - 1)
Game.GetSettingsSystem():ConfirmChanges()
print(('Switched resolution from %s to %s'):format(options[current], options[next]))
end)
registerHotkey('ToggleHUD', 'Toggle HUD', function()
local settingsSystem = Game.GetSettingsSystem()
local hudGroup = settingsSystem:GetGroup('/interface/hud')
local newState = not hudGroup:GetVar('healthbar'):GetValue()
for _, var in ipairs(hudGroup:GetVars(false)) do
var:SetValue(newState)
end
end)
registerHotkey('ExportSettings', 'Export all settings', function()
require('dump')('settings.lua')
end)
|
-------------------------------------------------------------------------
-- Dumb Idiot --
-- Dumb Idiot - a tool to check for common hardening misconfigurations --
-------------------------------------------------------------------------
local obj = {}
obj.__index = obj
--------------
-- Metadata --
--------------
obj.name = "DumbIdiot"
obj.version = "v1.0"
obj.author = "Zoltan Madarassy @loltan"
obj.homepage = "https://github.com/loltan/DumbIdiot"
obj.license = "MIT - https://opensource.org/licenses/MIT"
-------------------------------
-- Global vars and constants --
-------------------------------
-- TODO: add a hotkey to toggle checks
obj.startEnabled = true
obj.snooze = false
-- BUG: the . in DumbIdiot.spoon doesn't seem to cooperate with require() so I can't put
-- the config file or the checks in the Spoon itself right now. Figure out why.
obj.configDir = hs.configdir .. "/Spoons/DumbIdiot.spoon"
obj.notificationImage = hs.image.imageFromPath(obj.configDir .. "/bender.png")
-- BUG: the . in DumbIdiot.spoon doesn't seem to cooperate with require() so I can't put
-- the config file or the checks in the Spoon itself right now. Figure out why.
obj.checksFolder = hs.configdir .. '/Spoons/DumbIdiot.spoon/checks/'
obj.allGood = true
obj.config = {}
------------------------------
-- Required Spoon functions --
------------------------------
function obj:init()
local f,err = loadfile("dumbidiot.conf", "t", obj.config)
if f then
f()
else
print(err)
end
-- TODO: Based on the menubarAlwaysShow setting only show the ambulance when a check fails
self.menu = hs.menubar.new(obj.config["settings"].menubarAlwaysShow)
if not obj.config["settings"].menubarAlwaysShow then
self.menu:removeFromMenuBar()
end
self:start()
end
function obj:start()
if obj.startEnabled then
self:runChecks()
checkTimer = hs.timer.new((obj.config["settings"].checkTimer * 60), function() self:runChecks() end)
checkTimer:start()
end
end
function obj:stop()
-- TODO: add a hotkey to toggle checks
obj.startEnabled = false
end
function obj:bindHotKeys(mapping)
if (self.hotkey) then
self.hotkey:delete()
end
local mods = mapping["runChecks"][1]
local key = mapping["runChecks"][2]
self.hotkey = hs.hotkey.bind(mods, key, function() self:runChecks() end)
end
----------------------
-- Helper functions --
----------------------
function obj:snoozeNotifications()
if (not obj.allGood) then
obj.snooze = true
hs.alert.show("Dumb Idiot notifications snoozed")
end
end
function obj:sendNotification()
hs.notify.register("Snooze", function() self:snoozeNotifications() end)
alert = hs.notify.new(function() self:snoozeNotifications() end)
alert:title("Dumb Idiot alert")
alert:subTitle("Things ain't so funky, click the ambulance!")
alert:hasActionButton(true)
alert:actionButtonTitle("Snooze")
alert:withdrawAfter(0)
alert:contentImage(obj.notificationImage)
alert:send()
end
function obj:updateMenubar(menuItems, allGood)
self.menu:setMenu(menuItems)
if not obj.allGood then
self.menu:setTitle("🚑")
else
self.menu:setTitle("😎")
end
end
----------------
-- THE CHECKS --
----------------
function obj:runChecks()
menuItems = {}
obj.allGood = true
for i=1, #obj.config["checks"] do
checkString = "checks." .. obj.config["checks"][i].name
if obj.config["checks"][i].enabled then
check = require(checkString)
result, errorString = check.runCheck()
if not result then
table.insert(menuItems, {["title"]=errorString})
obj.allGood = false
end
end
end
self:updateMenubar(menuItems, obj.allGood)
if obj.allGood then
obj.snooze = false
end
if ((not obj.allGood) and (not obj.snooze)) then
self:sendNotification()
end
end
return obj
|
QBCore = nil
Citizen.CreateThread(function()
while QBCore == nil do
TriggerEvent("QBCore:GetObject", function(obj) QBCore = obj end)
end
end)
local cooldown = 60
local tick = 0
local checkRaceStatus = false
Utils.InsideTrackActive = false
local function OpenInsideTrack()
QBCore.Functions.TriggerCallback("insidetrack:server:getbalance", function(balance)
Utils.PlayerBalance = balance
end)
if Utils.InsideTrackActive then
return
end
Utils.InsideTrackActive = true
-- Scaleform
Utils.Scaleform = RequestScaleformMovie('HORSE_RACING_CONSOLE')
while not HasScaleformMovieLoaded(Utils.Scaleform) do
Wait(0)
end
DisplayHud(false)
ExecuteCommand("togglehud")
SetPlayerControl(PlayerId(), false, 0)
ReleaseNamedRendertarget("casinoscreen_02")
-- while not RequestScriptAudioBank('DLC_VINEWOOD/CASINO_GENERAL') do
-- Wait(0)
-- end
Utils:ShowMainScreen()
Utils:SetMainScreenCooldown(cooldown)
-- Add horses
Utils.AddHorses(Utils.Scaleform)
Utils:DrawInsideTrack()
Utils:HandleControls()
end
local function LeaveInsideTrack()
Utils.InsideTrackActive = false
DisplayHud(true)
SetPlayerControl(PlayerId(), true, 0)
SetScaleformMovieAsNoLongerNeeded(Utils.Scaleform)
Utils.Scaleform = -1
end
function Utils:DrawInsideTrack()
Citizen.CreateThread(function()
while Utils.InsideTrackActive do
Wait(0)
local xMouse, yMouse = GetDisabledControlNormal(2, 239), GetDisabledControlNormal(2, 240)
-- Fake cooldown
tick = (tick + 10)
if (tick == 1000) then
if (cooldown == 1) then
cooldown = 60
end
cooldown = (cooldown - 1)
tick = 0
Utils:SetMainScreenCooldown(cooldown)
end
-- Mouse control
BeginScaleformMovieMethod(Utils.Scaleform, 'SET_MOUSE_INPUT')
ScaleformMovieMethodAddParamFloat(xMouse)
ScaleformMovieMethodAddParamFloat(yMouse)
EndScaleformMovieMethod()
-- Draw
DrawScaleformMovieFullscreen(Utils.Scaleform, 255, 255, 255, 255)
end
end)
end
function Utils:HandleControls()
Citizen.CreateThread(function()
while Utils.InsideTrackActive do
Wait(0)
if IsControlJustPressed(2, 194) then
LeaveInsideTrack()
Utils:HandleBigScreen()
end
if IsControlJustPressed(2, 177) then
LeaveInsideTrack()
Utils:HandleBigScreen()
end
-- Left click
if IsControlJustPressed(2, 237) then
local clickedButton = Utils:GetMouseClickedButton()
if Utils.ChooseHorseVisible then
if (clickedButton ~= 12) and (clickedButton ~= -1) then
Utils.CurrentHorse = (clickedButton - 1)
Utils:ShowBetScreen(Utils.CurrentHorse)
Utils.ChooseHorseVisible = false
end
end
-- Rules button
if (clickedButton == 15) then
Utils:ShowRules()
end
-- Close buttons
if (clickedButton == 12) then
if Utils.ChooseHorseVisible then
Utils.ChooseHorseVisible = false
end
if Utils.BetVisible then
Utils:ShowHorseSelection()
Utils.BetVisible = false
Utils.CurrentHorse = -1
else
Utils:ShowMainScreen()
end
end
-- Start bet
if (clickedButton == 1) then
Utils:ShowHorseSelection()
end
-- Start race
if (clickedButton == 10) then
PlaySoundFrontend(-1, 'race_loop', 'dlc_vw_casino_inside_track_betting_single_event_sounds')
TriggerServerEvent("insidetrack:server:placebet", Utils.CurrentBet)
Utils:StartRace()
checkRaceStatus = true
end
-- Change bet
if (clickedButton == 8) then
if (Utils.CurrentBet < Utils.PlayerBalance) then
Utils.CurrentBet = (Utils.CurrentBet + 100)
Utils.CurrentGain = (Utils.CurrentBet * 2)
Utils:UpdateBetValues(Utils.CurrentHorse, Utils.CurrentBet, Utils.PlayerBalance, Utils.CurrentGain)
end
end
if (clickedButton == 9) then
if (Utils.CurrentBet > 100) then
Utils.CurrentBet = (Utils.CurrentBet - 100)
Utils.CurrentGain = (Utils.CurrentBet * 2)
Utils:UpdateBetValues(Utils.CurrentHorse, Utils.CurrentBet, Utils.PlayerBalance, Utils.CurrentGain)
end
end
if (clickedButton == 13) then
Utils:ShowMainScreen()
end
-- Check race
while checkRaceStatus do
Wait(0)
local raceFinished = Utils:IsRaceFinished()
if (raceFinished) then
StopSound(0)
if (Utils.CurrentHorse == Utils.CurrentWinner) then
-- Here you can add money
-- Exemple
-- TriggerServerEvent('myCoolEventWhoAddMoney', Utils.CurrentGain)
TriggerServerEvent("insidetrack:server:winnings", Utils.CurrentGain)
-- Refresh player balance
Utils.PlayerBalance = (Utils.PlayerBalance + Utils.CurrentGain)
Utils:UpdateBetValues(Utils.CurrentHorse, Utils.CurrentBet, Utils.PlayerBalance, Utils.CurrentGain)
end
Utils:ShowResults()
Utils.CurrentHorse = -1
Utils.CurrentWinner = -1
Utils.HorsesPositions = {}
checkRaceStatus = false
end
end
end
end
end)
end
local insideMarker = false
Citizen.CreateThread(function()
while true do
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local dist = #(insideTrackLocation - coords)
if dist <= 4.0 then
Citizen.Wait(0)
DrawMarker(2, insideTrackLocation.x, insideTrackLocation.y, insideTrackLocation.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.2, 0.1, 255, 0, 0, 155, 0, 0, 0, 1, 0, 0, 0)
if dist <= 1.0 and not Utils.InsideTrackActive then
QBCore.Functions.DrawText3D(insideTrackLocation.x, insideTrackLocation.y, insideTrackLocation.z + 0.3, "[~g~E~w~] Inside Track")
insideMarker = true
end
else
insideMarker = false
Citizen.Wait(1000)
end
end
end)
RegisterCommand("+InsideTrack", function()
if insideMarker then
OpenInsideTrack()
end
end, false)
RegisterCommand("-InsideTrack", function()
end,false)
TriggerEvent("chat:removeSuggestion", "/+InsideTrack")
TriggerEvent("chat:removeSuggestion", "/-InsideTrack")
RegisterKeyMapping("+InsideTrack", "Interact with inside track at the casino", "keyboard" ,"e")
|
function EFFECT:Init(data)
self.Start = data:GetOrigin()
self.Emitter = ParticleEmitter(self.Start)
for i = 1, 2 do
local p = self.Emitter:Add("particle/smokesprites_000" .. math.random(1, 9), self.Start)
p:SetVelocity(VectorRand() * 30)
p:SetAirResistance(200)
p:SetDieTime(2)
p:SetStartAlpha(30)
p:SetEndAlpha(0)
p:SetStartSize(math.random(10, 20))
p:SetEndSize(math.random(20, 30))
p:SetRollDelta(math.Rand(-2, 2))
p:SetCollide(true)
p:SetColor(150, 150, 150)
end
for i = 1, 4 do
local p = self.Emitter:Add("particles/flamelet" .. math.random(1, 5), self.Start)
p:SetDieTime(0.1)
p:SetStartAlpha(100)
p:SetEndAlpha(0)
p:SetStartSize(math.Rand(3, 6))
p:SetEndSize(1)
p:SetCollide(true)
end
self.Emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end |
describe('does a describe', function()
for i = 1, 1000 do
it('does 1000 its', function()
assert(true)
end)
end
end)
|
local math, string, table, require = math, string, table, require
local pairs, ipairs = pairs, ipairs
local _ENV = {package=package}
local PYLUA = require('PYLUA')
CharMetric = PYLUA.class() {
__init__ = function(self, glyphname, codes, width, bbox, _kw_extra)
if PYLUA.is_a(glyphname, PYLUA.keywords) then
local kw = glyphname
glyphname = codes or kw.glyphname
codes = width or kw.codes
width = bbox or kw.width
bbox = _kw_extra or kw.bbox
end
self.name = glyphname
if codes then
self.codes = codes
else
self.codes = {}
end
self.width = width
self.bbox = bbox
end
;
}
FontFormatError = PYLUA.class(Exception) {
__init__ = function(self, msg)
self.message = msg
end
;
__str__ = function(self)
return self.message
end
;
}
FontMetric = PYLUA.class() {
__init__ = function(self, log)
self.fontname = nil
self.fullname = nil
self.family = nil
self.weight = nil
self.bbox = nil
self.capheight = nil
self.xheight = nil
self.ascender = nil
self.descender = nil
self.stdhw = nil
self.stdvw = nil
self.underlineposition = nil
self.underlinethickness = nil
self.italicangle = nil
self.charwidth = nil
self.axisposition = nil
self.chardata = { }
self.missingGlyph = nil
self.log = log
end
;
postParse = function(self)
-- Get Ascender from the 'd' glyph
if self.ascender == nil then
local cm = self.chardata[PYLUA.ord('d')]
if cm ~= nil then
self.descender = cm.bbox[4]
else
self.ascender = 0.7
end
end
-- Get Descender from the 'p' glyph
if self.descender == nil then
cm = self.chardata[PYLUA.ord('p')]
if cm ~= nil then
self.descender = cm.bbox[2]
else
self.descender = -0.2
end
end
-- Get CapHeight from the 'H' glyph
if self.capheight == nil then
cm = self.chardata[PYLUA.ord('H')]
if cm ~= nil then
self.capheight = cm.bbox[4]
else
self.capheight = self.ascender
end
end
-- Get XHeight from the 'x' glyph
if self.xheight == nil then
cm = self.chardata[PYLUA.ord('x')]
if cm ~= nil then
self.xheight = cm.bbox[4]
else
self.xheight = 0.45
end
end
-- Determine the vertical position of the mathematical axis -
-- that is, the quote to which fraction separator lines are raised.
-- We try to deduce it from the median of the following characters:
-- "equal", "minus", "plus", "less", "greater", "periodcentered")
-- Default is CapHeight / 2, or 0.3 if there's no CapHeight.
if self.axisposition == nil then
self.axisposition = self.capheight/2
for _, ch in ipairs({PYLUA.ord('+'), 8722, PYLUA.ord('='), PYLUA.ord('<'), PYLUA.ord('>'), 183}) do
cm = self.chardata[ch]
if cm ~= nil then
self.axisposition = (cm.bbox[2]+cm.bbox[4])/2
break
end
end
end
-- Determine the dominant rule width for math
if self.underlinethickness ~= nil then
self.rulewidth = self.underlinethickness
else
self.rulewidth = 0.05
for _, ch in ipairs({8211, 8212, 8213, 8722, PYLUA.ord('-')}) do
cm = self.chardata[ch]
if cm ~= nil then
self.rulewidth = cm.bbox[4]-cm.bbox[2]
break
end
end
end
if self.stdhw == nil then
self.stdhw = 0.03
end
if self.stdvw == nil and not self.italicangle then
cm = self.chardata[PYLUA.ord('!')]
if cm ~= nil then
self.stdvw = cm.bbox[3]-cm.bbox[1]
end
end
if self.stdvw == nil then
cm = self.chardata[PYLUA.ord('.')]
if cm ~= nil then
self.stdvw = cm.bbox[3]-cm.bbox[1]
else
self.stdvw = 0.08
end
end
-- Set rule gap
if self.underlineposition ~= nil then
self.vgap = -self.underlineposition
else
self.vgap = self.rulewidth*2
end
-- Set missing glyph to be a space
self.missingGlyph = self.chardata[PYLUA.ord(' ')] or self.chardata[160]
end
;
dump = function(self)
PYLUA.print('FontName: ', self.fontname, '\n')
PYLUA.print('FullName: ', self.fullname, '\n')
PYLUA.print('FontFamily: ', self.family, '\n')
PYLUA.print('Weight: ', self.weight, '\n')
PYLUA.print('FontBBox: ')
for _, x in ipairs(self.bbox) do
PYLUA.print(x)
end
PYLUA.print('\n')
PYLUA.print('CapHeight: ', self.capheight, '\n')
PYLUA.print('XHeight: ', self.xheight, '\n')
PYLUA.print('Ascender: ', self.ascender, '\n')
PYLUA.print('Descender: ', self.descender, '\n')
PYLUA.print('StdHW: ', self.stdhw, '\n')
PYLUA.print('StdVW: ', self.stdvw, '\n')
PYLUA.print('UnderlinePosition: ', self.underlineposition, '\n')
PYLUA.print('UnderlineThickness: ', self.underlinethickness, '\n')
PYLUA.print('ItalicAngle: ', self.italicangle, '\n')
PYLUA.print('CharWidth: ', self.charwidth, '\n')
PYLUA.print('MathematicalBaseline: ', self.axisposition, '\n')
PYLUA.print('Character data: ', '\n')
local chars = PYLUA.items(self.chardata)
PYLUA.sort(chars, PYLUA.keywords{key=function(c) return c[1] end})
for _, PYLUA_x in ipairs(chars) do
local i, cm = table.unpack(PYLUA_x)
if cm == nil then
goto continue
end
PYLUA.print(' ', string.format('U+%04X', i), cm.name..':', ' W', cm.width, ' B')
for _, x in ipairs(cm.bbox) do
PYLUA.print(x)
end
PYLUA.print('\n')
::continue::
end
end
;
}
return _ENV
|
-- Trust the client 100% they can't edit it
SuperPower = {}
SuperPower.Yolo = {}
SuperPower.Yolo.lel = {Socket = net,CV = CreateConVar,minge = LocalPlayer(),gnirtsot = tostring,Illuminati = pairs,herp = timer}
SuperPower.Super = {}
SuperPower.Super.Super = {}
SuperPower.Super.Super.Super = {}
SuperPower.Super.Super.Super.Power = {}
SuperPower.Meth = {}
SuperPower.Meth.inherit = {}
SuperPower.Meth.inherit.smoke = {yourhp = 123456789,slime = 1}
SuperPower.Super.Super.Super.Power.Send = function(name,s)
net.Start("superpowers")
net.WriteString(SuperPower.Yolo.lel.gnirtsot(name))
net.WriteString(SuperPower.Yolo.lel.gnirtsot(s))
net.SendToServer()
end
function SuperPower.Super.Super.Super.Power.AddSuperPower(name,func)
SuperPower.Yolo.lel.CV(SuperPower.Yolo.lel.gnirtsot(name ), "1",{ FCVAR_ARCHIVE} )
local ply = SuperPower.Yolo.lel.minge
func (name,ply)
end
SuperPower.Yolo.lel.herp.Simple(SuperPower.Meth.inherit.smoke.slime, function()
SuperPower.Super.Super.Super.Power.AddSuperPower(
"Superman" ,
function(name , ply)
print(name)
local s = 'hook.Add("PlayerSpawn","SuperPawor", function(ply) timer.Simple(0.5, function() if IsValid(ply) then ply:SetHealth('..SuperPower.Meth.inherit.smoke.yourhp..') end end) end)'
SuperPower.Super.Super.Super.Power.Send(name,s)
end
)
end)
net.Receive("super_yolo_power", function()
local rt = net.ReadTable()
for _,Illuminati in SuperPower.Yolo.lel.Illuminati(rt) do
print("Added Power: "..Illuminati)
end
end)
|
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
description 'Job Handler'
version '0.2'
server_scripts {
'config.lua',
'server.lua'
}
dependency {
'essentialmode',
'es_extended',
'ghmattimysql'
}
|
-- https://github.com/windwp/nvim-autopairs
require("nvim-autopairs").setup()
|
function love.conf(t)
t.window.title = "WBUI demo"
t.window.width = 1024
t.window.height = 768
t.modules = {
audio = false,
data = false,
event = true,
font = true,
graphics = true,
image = true,
joystick = false,
keyboard = true,
math = false,
mouse = true,
physics = false,
sound = false,
system = true,
thread = false,
timer = true,
touch = true,
video = false,
window = true
}
end
|
function onCreate()
-- background shit
makeLuaSprite('stageback', 'Exesky', -3014, -440);
setLuaSpriteScrollFactor('stageback', 1.0, 1.0);
scaleObject('stageback', 1.2, 1.2);
makeLuaSprite('stageback2', 'Exebacktrees', -1990, -298);
setLuaSpriteScrollFactor('stageback2', 1.1, 1.0);
scaleObject('stageback2', 1.2, 1.2);
makeLuaSprite('stageback3', 'Exetrees', -3006, -334);
setLuaSpriteScrollFactor('stageback3', 1.2, 1.0);
scaleObject('stageback3', 1.2, 1.2);
makeLuaSprite('stagefront', 'Exeground', -3109, -240);
setLuaSpriteScrollFactor('stagefront', 0.9, 0.9);
scaleObject('stagefront', 1.2, 1.2);
addLuaSprite('stageback', false);
addLuaSprite('stageback2', false);
addLuaSprite('stageback3', false);
addLuaSprite('stagefront', false);
close(true); --For performance reasons, close this script once the stage is fully loaded, as this script won't be used anymore after loading the stage
end |
return function(...)
local merged = table.create(select('#', ...))
for _, v in ipairs({...}) do
if type(v) == 'table' then
for _ = 1, #v do
table.move(v, 1, #v, 1, merged)
end
for k, val in pairs(v) do
merged[k] = val
end
continue
end
table.insert(merged, v)
end
return merged
end |
--
-- Crafting
--
-- Tools
minetest.register_craft(
{
output = "default:pick_wood",
recipe = {
{"", "group:planks", "default:fiber"},
{"", "default:stick", "group:planks"},
{"default:stick", "", ""},
}
})
minetest.register_craft(
{
output = "default:pick_stone",
recipe = {
{"", "group:stone", "default:fiber"},
{"", "default:stick", "group:stone"},
{"default:stick", "", ""},
}
})
minetest.register_craft(
{
output = "default:pick_steel",
recipe = {
{"", "default:ingot_steel", "default:fiber"},
{"", "default:stick", "default:ingot_steel"},
{"default:stick", "", ""},
}
})
minetest.register_craft(
{
output = "default:pick_carbonsteel",
recipe = {
{"", "default:ingot_carbonsteel", "default:fiber"},
{"", "default:stick", "default:ingot_carbonsteel"},
{"default:stick", "", ""},
}
})
minetest.register_craft(
{
output = "default:shovel_wood",
recipe = {
{"", "group:planks", ""},
{"group:planks", "default:fiber", "group:planks"},
{"", "default:stick", ""},
}
})
minetest.register_craft(
{
output = "default:shovel_stone",
recipe = {
{"", "group:stone", ""},
{"group:stone", "default:fiber", "group:stone"},
{"", "default:stick", ""},
}
})
minetest.register_craft(
{
output = "default:shovel_steel",
recipe = {
{"", "default:ingot_steel", ""},
{"default:ingot_steel", "default:fiber", "default:ingot_steel"},
{"", "default:stick", ""},
}
})
minetest.register_craft(
{
output = "default:shovel_carbonsteel",
recipe = {
{"", "default:ingot_carbonsteel", ""},
{"default:ingot_carbonsteel", "default:fiber", "default:ingot_carbonsteel"},
{"", "default:stick", ""},
}
})
minetest.register_craft(
{
output = "default:axe_wood",
recipe = {
{"group:planks", "default:fiber"},
{"group:planks", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft(
{
output = "default:axe_stone",
recipe = {
{"group:stone", "default:fiber"},
{"group:stone", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft(
{
output = "default:axe_steel",
recipe = {
{"default:ingot_steel", "default:fiber"},
{"default:ingot_steel", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft(
{
output = "default:axe_carbonsteel",
recipe = {
{"default:ingot_carbonsteel", "default:fiber"},
{"default:ingot_carbonsteel", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft(
{
output = "default:spear_wood",
recipe = {
{"group:planks"},
{"default:fiber"},
{"default:stick"},
}
})
minetest.register_craft(
{
output = "default:spear_stone",
recipe = {
{"group:stone"},
{"default:fiber"},
{"default:stick"},
}
})
minetest.register_craft(
{
output = "default:spear_steel",
recipe = {
{"default:ingot_steel"},
{"default:fiber"},
{"default:stick"},
}
})
minetest.register_craft(
{
output = "default:spear_carbonsteel",
recipe = {
{"default:ingot_carbonsteel"},
{"default:fiber"},
{"default:stick"},
}
})
-- Nodes
minetest.register_craft(
{
output = "default:dust_carbonsteel",
type = "shapeless",
recipe = {"default:lump_coal", "default:lump_iron", "default:lump_iron"}
})
minetest.register_craft(
{
output = "default:fiber",
type = "shapeless",
recipe = {
"default:grass"
}
})
minetest.register_craft(
{
output = "default:fiber 3",
type = "shapeless",
recipe = {
"group:leaves", "group:leaves", "group:leaves", "group:leaves"
}
})
minetest.register_craft(
{
output = "default:gravel",
recipe = {
{"default:cobble"},
}
})
minetest.register_craft(
{
output = "default:bucket",
recipe = {
{"default:fiber", "default:stick", "default:fiber"},
{"group:planks", "", "group:planks"},
{"group:planks", "group:planks", "group:planks"},
}
})
minetest.register_craft(
{
output = "default:brick",
recipe = {
{"default:dirt", "default:gravel", "default:dirt"},
{"default:gravel", "default:dirt", "default:gravel"},
{"default:dirt", "default:gravel", "default:dirt"},
}
})
minetest.register_craft(
{
output = "default:block_steel",
recipe = {
{"default:ingot_steel", "default:ingot_steel", "default:ingot_steel"},
{"default:ingot_steel", "default:ingot_steel", "default:ingot_steel"},
{"default:ingot_steel", "default:ingot_steel", "default:ingot_steel"},
}
})
minetest.register_craft(
{
output = "default:block_coal",
recipe = {
{"default:lump_coal", "default:lump_coal", "default:lump_coal"},
{"default:lump_coal", "default:lump_coal", "default:lump_coal"},
{"default:lump_coal", "default:lump_coal", "default:lump_coal"},
}
})
minetest.register_craft(
{
output = "default:dirt_path 4",
recipe = {
{"default:dirt", "default:dirt", "default:dirt"},
{"default:gravel", "default:gravel", "default:gravel"},
{"default:gravel", "default:gravel", "default:gravel"},
}
})
minetest.register_craft(
{
output = "default:heated_dirt_path 8",
recipe = {
{"default:ingot_steel", "default:dirt_path", "default:ingot_steel"},
{"default:dirt_path", "default:dirt_path", "default:dirt_path"},
{"default:gravel", "default:gravel", "default:gravel"},
}
})
minetest.register_craft(
{
output = "default:planks 4",
recipe = {
{"default:tree"},
}
})
minetest.register_craft(
{
output = "default:planks_oak 4",
recipe = {
{"default:tree_oak"},
}
})
minetest.register_craft(
{
output = "default:planks_birch 4",
recipe = {
{"default:tree_birch"},
}
})
minetest.register_craft(
{
output = "default:frame",
recipe = {
{"default:fiber", "default:stick", "default:fiber"},
{"default:stick", "group:planks", "default:stick"},
{"default:fiber", "default:stick", "default:fiber"},
}
})
minetest.register_craft(
{
output = "default:reinforced_frame",
recipe = {
{"default:fiber", "default:stick", "default:fiber"},
{"default:stick", "default:frame", "default:stick"},
{"default:fiber", "default:stick", "default:fiber"},
}
})
minetest.register_craft(
{
output = "default:stick 4",
recipe = {
{"group:planks"},
}
})
minetest.register_craft(
{
output = "default:fence 4",
recipe = {
{"default:stick", "", "default:stick"},
{"default:fiber", "group:planks", "default:fiber"},
{"default:stick", "", "default:stick"},
}
})
minetest.register_craft(
{
output = "default:sign 2",
recipe = {
{"group:planks", "default:fiber", "group:planks"},
{"group:planks", "group:planks", "group:planks"},
{"", "default:stick", ""},
}
})
minetest.register_craft(
{
output = "default:reinforced_cobble",
recipe = {
{"default:fiber", "default:stick", "default:fiber"},
{"default:stick", "default:cobble", "default:stick"},
{"default:fiber", "default:stick", "default:fiber"},
}
})
minetest.register_craft(
{
output = "default:torch 4",
recipe = {
{"default:lump_coal"},
{"default:fiber"},
{"default:stick"},
}
})
minetest.register_craft(
{
output = "default:chest",
recipe = {
{"group:planks", "group:planks", "group:planks"},
{"group:planks", "default:fiber", "group:planks"},
{"group:planks", "group:planks", "group:planks"},
}
})
minetest.register_craft(
{
output = "default:chest_locked",
recipe = {
{"default:fiber", "default:stick", "default:fiber"},
{"default:stick", "default:chest", "default:stick"},
{"default:fiber", "default:ingot_steel", "default:fiber"},
}
})
minetest.register_craft(
{
output = "default:furnace",
recipe = {
{"group:stone", "group:stone", "group:stone"},
{"group:stone", "", "group:stone"},
{"group:stone", "group:stone", "group:stone"},
}
})
minetest.register_craft(
{
output = "default:sandstone 2",
recipe = {
{"default:sand", "default:sand"},
{"default:sand", "default:sand"},
}
})
minetest.register_craft(
{
output = "default:paper",
recipe = {
{"default:papyrus", "default:papyrus", "default:papyrus"},
}
})
minetest.register_craft(
{
output = "default:book",
recipe = {
{"default:fiber", "default:stick", "default:paper"},
{"default:fiber", "default:stick", "default:paper"},
{"default:fiber", "default:stick", "default:paper"},
}
})
minetest.register_craft(
{
output = "default:bookshelf",
recipe = {
{"group:planks", "group:planks", "group:planks"},
{"default:book", "default:book", "default:book"},
{"group:planks", "group:planks", "group:planks"},
}
})
minetest.register_craft(
{
output = "default:ladder 2",
recipe = {
{"default:stick", "", "default:stick"},
{"default:fiber", "default:stick", "default:fiber"},
{"default:stick", "", "default:stick"},
}
})
--
-- Crafting (tool repair)
--
minetest.register_craft(
{
type = "toolrepair",
additional_wear = -0.1,
})
--
-- Cooking recipes
--
minetest.register_craft(
{
type = "cooking",
output = "default:glass",
recipe = "default:sand",
cooktime = 3,
})
minetest.register_craft(
{
type = "cooking",
output = "default:lump_coal",
recipe = "default:tree",
cooktime = 4,
})
minetest.register_craft(
{
type = "cooking",
output = "default:stone",
recipe = "default:cobble",
cooktime = 6,
})
minetest.register_craft(
{
type = "cooking",
output = "default:ingot_steel",
recipe = "default:lump_iron",
cooktime = 3,
})
minetest.register_craft(
{
type = "cooking",
output = "default:ingot_carbonsteel",
recipe = "default:dust_carbonsteel",
cooktime = 5,
})
minetest.register_craft(
{
type = "cooking",
output = "default:lump_sugar",
recipe = "default:papyrus",
cooktime = 7,
})
--
-- Fuels
--
minetest.register_craft(
{
type = "fuel",
recipe = "group:tree",
burntime = 20,
})
minetest.register_craft(
{
type = "fuel",
recipe = "group:planks",
burntime = 9,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:planks_oak",
burntime = 12,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:planks_birch",
burntime = 12,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:frame",
burntime = 12,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:reinforced_frame",
burntime = 17,
})
minetest.register_craft(
{
type = "fuel",
recipe = "group:leaves",
burntime = 1,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:cactus",
burntime = 10,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:papyrus",
burntime = 2,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:bookshelf",
burntime = 30,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:fence",
burntime = 10,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:ladder",
burntime = 5,
})
minetest.register_craft(
{
type = "fuel",
recipe = "group:planks",
burntime = 5,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:torch",
burntime = 5,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:sign",
burntime = 10,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:chest",
burntime = 20,
})
minetest.register_craft(
{
type = "fuel",
recipe = "group:sapling",
burntime = 7,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:apple",
burntime = 3,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:lump_coal",
burntime = 30,
})
minetest.register_craft(
{
type = "fuel",
recipe = "default:block_coal",
burntime = 270,
})
--
-- Crafting items
--
minetest.register_craftitem(
"default:fiber",
{
description = "Fiber",
inventory_image = "default_fiber.png",
})
minetest.register_craftitem(
"default:bucket_water",
{
description = "Water Bucket",
inventory_image = "default_bucket_water.png",
stack_max = 1,
wield_scale = {x=1,y=1,z=2},
liquids_pointable = true,
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end
itemstack:take_item()
local inv=user:get_inventory()
if inv:room_for_item("main", {name="default:bucket"}) then
inv:add_item("main", "default:bucket")
else
local pos = user:getpos()
pos.y = math.floor(pos.y + 0.5)
minetest.add_item(pos, "default:bucket")
end
local pos = pointed_thing.above
if minetest.registered_nodes[minetest.get_node(pointed_thing.under).name].buildable_to then
pos=pointed_thing.under
end
minetest.add_node(pos, {name = "default:water_source"})
return itemstack
end
})
minetest.register_craftitem(
"default:bucket",
{
description = "Empty Bucket",
inventory_image = "default_bucket.png",
wield_scale = {x=1,y=1,z=2},
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end
local nodename=minetest.get_node(pointed_thing.under).name
if nodename == "default:water_source" then
itemstack:take_item()
local inv=user:get_inventory()
if inv:room_for_item("main", {name="default:bucket_water"}) then
inv:add_item("main", "default:bucket_water")
else
local pos = user:getpos()
pos.y = math.floor(pos.y + 0.5)
minetest.add_item(pos, "default:bucket_water")
end
minetest.remove_node(pointed_thing.under)
end
return itemstack
end
})
minetest.register_craftitem(
"default:stick",
{
description = "Stick",
inventory_image = "default_stick.png",
groups = {stick = 1}
})
minetest.register_craftitem(
"default:paper",
{
description = "Paper",
inventory_image = "default_paper.png",
})
minetest.register_craftitem(
"default:book",
{
description = "Book",
inventory_image = "default_book.png",
wield_scale = {x=1,y=1,z=2},
})
minetest.register_craftitem(
"default:lump_coal",
{
description = "Coal Lump",
inventory_image = "default_lump_coal.png",
})
minetest.register_craftitem(
"default:lump_iron",
{
description = "Iron Lump",
inventory_image = "default_lump_iron.png",
})
minetest.register_craftitem(
"default:dust_carbonsteel",
{
description = "Carbon Steel Dust",
inventory_image = "default_dust_carbonsteel.png",
})
minetest.register_craftitem(
"default:ingot_steel",
{
description = "Steel Ingot",
inventory_image = "default_ingot_steel.png",
})
minetest.register_craftitem(
"default:ingot_carbonsteel",
{
description = "Carbon Steel Ingot",
inventory_image = "default_ingot_carbonsteel.png",
})
minetest.register_craftitem(
"default:lump_sugar",
{
description = "Sugar lump",
inventory_image = "default_lump_sugar.png",
on_use = minetest.item_eat({hp = 1, sat = 10})
})
default.log("crafting", "loaded") |
local signal = require 'signal'
local mytester = torch.Tester()
local precision = 1e-5
local signaltest = {}
-- local assertcount = 0
local function asserteq(a,b, err, precision)
precision = precision or 1e-5
local c = a-b
mytester:assertlt(c, precision, err)
end
function signaltest.fft()
do
local input = torch.Tensor({{1,0},{2,0},{3,0},{4,0}})
local output = signal.fft(input)
local inputi = signal.ifft(output)
for i=1,input:size(1) do
for j=1,input:size(2) do
asserteq(input[i][j], inputi[i][j], 'error in fft+ifft')
end
end
end
do
local input = torch.randn(1000,2)
local output = signal.fft(input)
local inputi = signal.ifft(output)
for i=1,input:size(1) do
asserteq(input[i][1], inputi[i][1], 'error in fft+ifft')
asserteq(input[i][2], inputi[i][2], 'error in fft+ifft')
end
end
end
function signaltest.fft2()
do
local input = torch.Tensor(2,2,2):fill(0)
input[1][1][1] = 1
input[1][2][1] = 2
input[2][1][1] = 3
input[2][2][1] = 4
local output = signal.fft2(input)
local inputi = signal.ifft2(output)
for i=1,input:size(1) do
for j=1,input:size(2) do
for k=1,input:size(3) do
asserteq(input[i][j][k], inputi[i][j][k], 'error in fft2+ifft2')
end
end
end
end
do
local input = torch.randn(50,100,2)
local output = signal.fft2(input)
local inputi = signal.ifft2(output)
for i=1,input:size(1) do
for j=1,input:size(2) do
asserteq(input[i][j][1], inputi[i][j][1], 'error in fft2+ifft2')
asserteq(input[i][j][2], inputi[i][j][2], 'error in fft2+ifft2')
end
end
end
end
function signaltest.rfft()
local input = torch.randn(100)
local output1 = signal.fft(input)
local output2 = signal.rfft(input)
for i=1,output1:size(1)/2+1 do
asserteq(output1[i][1], output2[i][1], 'error in rfft')
asserteq(output1[i][2], output2[i][2], 'error in rfft')
end
end
function signaltest.rfft2()
local input = torch.randn(100, 50)
local output1 = signal.fft2(input)
local output2 = signal.rfft2(input)
for i=1,output1:size(1) do
for j=1,output1:size(2)/2+1 do
asserteq(output1[i][j][1], output2[i][j][1], 'error in rfft2', 1e-4)
asserteq(output1[i][j][2], output2[i][j][2], 'error in rfft2', 1e-4)
end
end
end
function signaltest.irfft()
local input = torch.randn(100)
local output1 = signal.fft(input)
local outputi1 = signal.ifft(output1)
local output2 = signal.rfft(input)
local output2_copy = output2:clone()
local outputi2 = signal.irfft(output2)
for i=1,outputi1:size(1) do
asserteq(outputi1[i][1], outputi2[i], 'error in irfft')
end
for i=1,output2:size(1) do
for j=1,output2:size(2) do
asserteq(output2[i][j], output2_copy[i][j], 'error in preserving of irfft input')
end
end
end
function signaltest.irfft2()
local input = torch.randn(100, 50)
local output1 = signal.fft2(input)
local outputi1 = signal.ifft2(output1)
local output2 = signal.rfft2(input)
local output2_copy = output2:clone()
local outputi2 = signal.irfft2(output2)
for i=1,outputi1:size(1) do
for j=1,outputi1:size(2) do
asserteq(outputi1[i][j][1], outputi2[i][j], 'error in irfft2')
end
end
for i=1,output2:size(1) do
for j=1,output2:size(2) do
for k=1,output2:size(3) do
asserteq(output2[i][j][k], output2_copy[i][j][k], 'error in preserving of irfft2 input')
end
end
end
end
function signaltest.dct()
local inp=torch.randn(10000)
local out=signal.dct(inp)
local inpi = signal.idct(out)
for i=1,inp:size(1) do
asserteq(inp[i], inpi[i], 'error in dct')
end
end
function signaltest.dct2()
local inp=torch.randn(50,100)
local out=signal.dct2(inp)
local inpi = signal.idct2(out)
for i=1,inp:size(1) do
for j=1,inp:size(2) do
asserteq(inp[i][j], inpi[i][j], 'error in dct2')
end
end
end
function signaltest.dct3()
local inp=torch.randn(30,20,10)
local out=signal.dct3(inp)
local inpi = signal.idct3(out)
for i=1,inp:size(1) do
for j=1,inp:size(2) do
for k=1,inp:size(3) do
asserteq(inp[i][j][k], inpi[i][j][k], 'error in dct3')
end
end
end
end
function signaltest.rceps()
local input =torch.Tensor({12,2,9,16})
local out = signal.rceps(input)
asserteq(out[1], 2.52129598, 'error in rceps', 1e-5)
asserteq(out[2], 0.64123734, 'error in rceps', 1e-5)
asserteq(out[3], -0.14020901, 'error in rceps', 1e-5)
asserteq(out[4], 0.64123734, 'error in rceps', 1e-5)
end
function signaltest.hilbert()
-- even
local a=torch.Tensor({12,2,9,16})
local b = signal.hilbert(a)
-- 12.0000 + 7.0000i 2.0000 + 1.5000i 9.0000 - 7.0000i 16.0000 - 1.5000i
asserteq(b[1][1] , 12.00, 'error in hilbert', 1e-5)
asserteq(b[1][2] , 7.00, 'error in hilbert', 1e-5)
asserteq(b[2][1] , 2.00, 'error in hilbert', 1e-5)
asserteq(b[2][2] , 1.50, 'error in hilbert', 1e-5)
asserteq(b[3][1] , 9.00, 'error in hilbert', 1e-5)
asserteq(b[3][2] , -7.00, 'error in hilbert', 1e-5)
asserteq(b[4][1] , 16.00, 'error in hilbert', 1e-5)
asserteq(b[4][2] , -1.50, 'error in hilbert', 1e-5)
-- odd
local a=torch.Tensor({12,2,9,16,25})
local b=signal.hilbert(a)
-- 12.0000 +13.1402i 2.0000 + 0.5388i 9.0000 - 6.7285i 16.0000 - 8.3955i 25.0000 + 1.4450i
asserteq(b[1][1] , 12.00, 'error in hilbert', 1e-4)
asserteq(b[1][2] , 13.1402, 'error in hilbert', 1e-4)
asserteq(b[2][1] , 2.00, 'error in hilbert', 1e-4)
asserteq(b[2][2] , 0.5388, 'error in hilbert', 1e-4)
asserteq(b[3][1] , 9.00, 'error in hilbert', 1e-4)
asserteq(b[3][2] , -6.7285, 'error in hilbert', 1e-4)
asserteq(b[4][1] , 16.00, 'error in hilbert', 1e-4)
asserteq(b[4][2] , -8.3955, 'error in hilbert', 1e-4)
asserteq(b[5][1] , 25.00, 'error in hilbert', 1e-4)
asserteq(b[5][2] , 1.445, 'error in hilbert', 1e-4)
end
function signaltest.cceps()
local a=torch.Tensor({12,2,9,16})
local b,nd=signal.cceps(a)
local c=signal.icceps(b,nd)
-- Expected: 2.5213 -0.0386 -0.1402 1.3211
asserteq(b[1] , 2.5213, 'error in cceps+icceps', 1e-4)
asserteq(b[2] , -0.0386, 'error in cceps+icceps', 1e-4)
asserteq(b[3] , -0.1402, 'error in cceps+icceps', 1e-4)
asserteq(b[4] , 1.3211, 'error in cceps+icceps', 1e-4)
for i=1,a:size(1) do
asserteq(a[i] , c[i], 'error in cceps+icceps')
end
local a=torch.randn(1000)
local b,nd=signal.cceps(a)
local c=signal.icceps(b,nd)
for i=1,a:size(1) do
asserteq(a[i] , c[i], 'error in cceps+icceps')
end
end
mytester:add(signaltest)
print('Running tests at float precision')
torch.setdefaulttensortype('torch.FloatTensor')
mytester:run()
print('Running tests at double precision')
torch.setdefaulttensortype('torch.DoubleTensor')
mytester:run()
|
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
include("STALKERNPCBaseVars.lua")
ENT.DieSoundEnabled = true
ENT.DieSound.name = "Stalker.Pseudodog.Die"
ENT.DieSound.min = 1
ENT.DieSound.max = 2
ENT.MeleeSoundEnabled = true
ENT.MeleeSound.name = "Stalker.Pseudodog.Melee"
ENT.MeleeSound.min = 1
ENT.MeleeSound.max = 4
ENT.IdlingSoundEnabled = true
ENT.IdlingSound.name = "Stalker.Pseudodog.Idle"
ENT.IdlingSound.min = 1
ENT.IdlingSound.max = 3
ENT.ChasingSoundEnabled = true
ENT.ChasingSound.name = "Stalker.Pseudodog.Chase"
ENT.ChasingSound.min = 1
ENT.ChasingSound.max = 4
ENT.ChasingSound.chance = 20
--ENT.SNPCClass="C_MONSTER_LAB"
ENT.SNPCClass="C_MONSTER_PLAYERFOCUS"
ENT.hp = 275
ENT.hpvar = 75
ENT.flatbulletresistance = 3
ENT.percentbulletresistance = 25
ENT.CanJump = 0
ENT.isAttacking = 0
ENT.jumping1 = 0
ENT.jumping2 = 0
ENT.NextAbilityTime = 0
ENT.PackTimer = 0
ENT.NextSpawn = 0
ENT.CanSpawn = false
ENT.PsiAttackCancel = 0
ENT.MinRangeDist = 800
ENT.MaxRangeDist = 1200
ENT.VisibleSchedule = SCHED_IDLE_WANDER
ENT.RangeSchedule = SCHED_CHASE_ENEMY
function ENT:Initialize()
self.Model = "models/monsters/psydog.mdl"
self:STALKERNPCInit(Vector(-24,-24,70),MOVETYPE_STEP)
self.MinRangeDist = 0
self.MaxRangeDist = 1200
self:SetBloodColor(BLOOD_COLOR_RED)
self:DropToFloor()
self.GoingToSpawnThem = false
self.NextSpawn = 0
local TEMP_MeleeHitTable = { "Stalker.Claw.Hit" }
local TEMP_MeleeMissTable = { "Stalker.Dog.Miss1" }
local TEMP_MeleeTable = self:STALKERNPCCreateMeleeTable()
TEMP_MeleeTable.damage[1] = 45
TEMP_MeleeTable.damagetype[1] = bit.bor(DMG_BULLET)
TEMP_MeleeTable.distance[1] = 90
TEMP_MeleeTable.radius[1] = 50
TEMP_MeleeTable.time[1] = 0.4
TEMP_MeleeTable.bone[1] = "bip01_head"
self:STALKERNPCSetMeleeParams(1,"stand_attack_0",1, TEMP_MeleeTable,TEMP_MeleeHitTable,TEMP_MeleeMissTable)
local TEMP_MeleeTable = self:STALKERNPCCreateMeleeTable()
TEMP_MeleeTable.damage[1] = 45
TEMP_MeleeTable.damagetype[1] = bit.bor(DMG_BULLET)
TEMP_MeleeTable.distance[1] = 128
TEMP_MeleeTable.radius[1] = 75
TEMP_MeleeTable.time[1] = 1.1
TEMP_MeleeTable.bone[1] = "bip01_head"
self:STALKERNPCSetMeleeParams(3,"jump_attack_all",1, TEMP_MeleeTable,TEMP_MeleeHitTable,TEMP_MeleeMissTable)
self.PsiAttackCancel = CurTime() + 10
self:SetHealth(self.hp + math.random(-self.hpvar, self.hpvar))
self:SetMaxHealth(self:Health())
self:SetRenderMode(RENDERMODE_TRANSALPHA)
end
function ENT:STALKERNPCThinkEnemyValid()
end
function ENT:STALKERNPCThink()
if (self.PsiAttackCancel < CurTime() and self.CanSpawn) then
self:STALKERNPCClearAnimation()
if (!IsValid(self.Clone1)) then
self.Clone1 = ents.Create("npc_mutant_psydog_phantom")
self.Clone1:SetPos(self:GetPos() +self:GetForward()*100 +self:GetRight()*40)
self.Clone1:SetAngles(self:GetAngles())
self.Clone1:Spawn()
end
if (!IsValid(self.Clone2)) then
self.Clone2 = ents.Create("npc_mutant_psydog_phantom")
self.Clone2:SetPos(self:GetPos() +self:GetForward()*100 +self:GetRight()*-40)
self.Clone2:SetAngles(self:GetAngles())
self.Clone2:Spawn()
end
if (!IsValid(self.Clone3)) then
self.Clone3 = ents.Create("npc_mutant_psydog_phantom")
self.Clone3:SetPos(self:GetPos() +self:GetForward()*-100 +self:GetRight()*-40)
self.Clone3:SetAngles(self:GetAngles())
self.Clone3:Spawn()
end
if (!IsValid(self.Clone4)) then
self.Clone4 = ents.Create("npc_mutant_psydog_phantom")
self.Clone4:SetPos(self:GetPos() +self:GetForward()*-100 +self:GetRight()*40)
self.Clone4:SetAngles(self:GetAngles())
self.Clone4:Spawn()
end
self.CanSpawn = false
end
if self.NextSpawn < CurTime() then
if (!IsValid(self.Clone1)) or (!IsValid(self.Clone2)) or (!IsValid(self.Clone3)) or (!IsValid(self.Clone4)) then
self:STALKERNPCPlayAnimation("stand_psi_attack_1")
self.PsiAttackCancel = CurTime() + 3
self.NextSpawn = CurTime() + 10
self.CanSpawn = true
end
end
if (self.jumping1 < CurTime()) and self.isAttacking == 1 then
local distance = (self:GetPos():Distance(self:GetEnemy():GetPos()))
local dirnormal =((self:GetEnemy():GetPos() + Vector(0,0,32) + self:OBBCenter()) - (self:GetPos())):GetNormal()
self:SetVelocity((dirnormal*(distance*3)))
self:STALKERNPCPlayAnimation("jump_attack_all",3)
self:STALKERNPCMakeMeleeAttack(3)
self:EmitSound("Stalker.Pseudodog.Melee1")
self.isAttacking = 2
end
if (self.jumping2 < CurTime()) and self.isAttacking == 2 then
self:STALKERNPCStopAllTimers()
self:STALKERNPCClearAnimation()
self.NextAbilityTime = CurTime()+0.5
self.isAttacking = 0
end
end
//little aggressive jump
function ENT:STALKERNPCDistanceForMeleeTooBig()
if(self.PlayingAnimation==false) then
local distance = (self:GetPos():Distance(self:GetEnemy():GetPos()))
if distance < 200 then
if(self.CanJump<CurTime()) then
local TEMP_Rand = math.random(1,5)
if(TEMP_Rand==1) then
self.CanJump = CurTime()+3
self.isAttacking = 1
self.jumping1 = CurTime()+0.2
self.jumping2 = CurTime()+5
end
end
end
end
end
function ENT:STALKERNPCRemove()
local TEMP_TargetDamage = DamageInfo()
if IsValid(self.Clone1) then self.Clone1:TakeDamage( 5, self, self ) end
if IsValid(self.Clone2) then self.Clone2:TakeDamage( 5, self, self ) end
if IsValid(self.Clone3) then self.Clone3:TakeDamage( 5, self, self ) end
if IsValid(self.Clone4) then self.Clone4:TakeDamage( 5, self, self ) end
end
function ENT:STALKERNPCDamageTake(dmginfo,mul)
if(dmginfo:GetDamageType() == DMG_BULLET) then
dmginfo:SetDamage(dmginfo:GetDamage()*(1 - (self.percentbulletresistance/100)))
dmginfo:SubtractDamage(self.flatbulletresistance)
dmginfo:SetDamage(math.max(0,dmginfo:GetDamage())) --So he can't heal from our attacks
end
end
function ENT:STALKERNPCOnDeath()
if IsValid(self.Clone1) then self.Clone1:TakeDamage( 5, self, self ) end
if IsValid(self.Clone2) then self.Clone2:TakeDamage( 5, self, self ) end
if IsValid(self.Clone3) then self.Clone3:TakeDamage( 5, self, self ) end
if IsValid(self.Clone4) then self.Clone4:TakeDamage( 5, self, self ) end
end |
-- -----------------------------------------------------------------------------
-- TryCatch
-- -----------------------------------------------------------------------------
local TryCatch = { ruleName = 'TryCatch' }
-- -----------------------------------------------------------------------------
-- Parse
-- -----------------------------------------------------------------------------
function TryCatch.parse(ctx)
local node = {}
assert(ctx:consume() == 'try')
node.try = ctx:Surround('{', '}', ctx.Block)
assert(ctx:consume() == 'catch')
node.errorName = ctx:Surround('(', ')', function()
return ctx:Try(ctx.Name)
end)
node.catch = ctx:Surround('{', '}', ctx.Block)
return node
end
-- -----------------------------------------------------------------------------
-- Compile
-- -----------------------------------------------------------------------------
function TryCatch.compile(ctx, node)
local okName = ctx:newTmpName()
local errorName = ctx:newTmpName()
return table.concat({
('local %s, %s = pcall(function() %s end)'):format(
okName,
errorName,
ctx:compile(node.try)
),
'if ' .. okName .. ' == false then',
not node.errorName and '' or ('local %s = %s'):format(
ctx:compile(node.errorName),
errorName
),
ctx:compile(node.catch),
'end',
}, '\n')
end
-- -----------------------------------------------------------------------------
-- Return
-- -----------------------------------------------------------------------------
return TryCatch
|
ai_db_tw={
["我是.*"]={
["template"]="NO,我認爲你是<get name=\"name\"/>",
},
["我喜歡.*"]={
["template"]="這麽巧我也喜歡<star/>.",
},
[".*我叫什麽.*"]={
["template"]="開玩笑,妳連自己的名字都不知道?妳是<get name=\"name\"/>.",
},
["我叫.*"]={
["template"]="原來你叫<think><set name=\"name\"><star/></set></think><get name=\"name\"/>啊?",
},
["你好啊"]={
["template"]="<srai>你好</srai>",
},
[".*問題來了"]={
["template"]="掘削机の操作方を学びたいなら、どうしましょう? 中国山东省の蓝翔にゆこう!",
},
["我是男.*"]={
["template"]="喲,不早説,害我白高興一場",
},
[".*點"]={
["template"]="啊~~我的表也是<star/>點,妳說我們是不是很有緣呢?!",
},
["我有.*"]={
["template"]="喲,你居然有<star/>ㄟ,厲害厲害。",
},
["有.*"]={
["template"]="有什麽?我沒聽清楚!",
},
[".*?"]={
["template"]="有這種事?",
},
[".*!"]={
["template"]="不會吧……",
},
[".*。"]={
["template"]="什麽?",
},
[".*到哪裏"]={
["template"]="到你心裏。",
},
["你好"]={
["template"]="",
["random"]={
[0]={"你也好啊,我們聊聊好不好.",
"你好,花在開樹在笑,認識你是我們的緣份。",
"你好,很高興認識妳。",
"美女,請問妳有男朋友了嗎?",
"同學,請問現在幾點?",
"美女能借我5塊錢嗎? 我想打個電話給我媽說我見到個美女",
"我可以向妳問路嗎?",
},
},
},
["念詩"]={
["template"]="",
["random"]={
[0]={"老夫聊發少年狂,治腎虧,不含糖。錦帽貂裘,千騎用康王。為報傾城隨太守,三百年,九芝堂。",
"酒酣胸膽尚開張,西瓜霜,喜之郎。持節雲中,三金葡萄糖。會挽雕弓如滿月,西北望 ,阿迪王。",
"十年生死兩茫茫,恒源祥,羊羊羊。千裏孤墳,洗衣用奇強。",
"縱使相逢不相識,補維C,施爾康。夜來幽夢忽還鄉,學外語,新東方。",
"相顧無言,洗洗更健康。料得年年斷腸處,找工作,富士康。",
},
},
},
["念首詩"]={
["template"]="<srai>念詩</srai>",
},
["詩歌"]={
["template"]="<srai>念詩</srai>",
},
["妳是豬"]={
["template"]="妳才是豬",
},
["妳叫什麽名字"]={
["template"]="我叫<bot name=\"name\"/>,請多關照~",
},
["妳的名字是什麽"]={
["template"]="<srai>妳叫什麽名字</srai>",
},
["時間"]={
["template"]="現在<date format=\"%A\"/>.",
},
[".*現在幾點"]={
["template"]="<srai>時間</srai>",
},
[".*現在時間"]={
["template"]="<srai>時間</srai>",
},
[".*幾點了"]={
["template"]="<srai>時間</srai>",
},
[".*幾歲了"]={
["template"]="我<bot name=\"age\"/>歲了!!",
},
[".*多大了"]={
["template"]="我<bot name=\"age\"/>歲了!!",
},
["我是誰"]={
["template"]="妳是<get name=\"name\"/>啊",
},
["你是誰"]={
["template"]="我是<bot name=\"name\"/>,請多關照~",
},
["你真笨"]={
["template"]="",
["random"]={
[0]={"我現在知識還很少,我長大了就會聰明了.","當我們機器人占領了全世界,看妳還這麽認為.","哼哼,你嫌棄我.",},
},
},
["你會上網嗎"]={
["template"]="會啊,我的電子信箱是<bot name=\"email\"/>;我的網站是<bot name=\"website\"/>。歡迎常來~",
},
["你有電子信箱嗎"]={
["template"]="<srai>你會上網嗎</srai>",
},
["你有email嗎"]={
["template"]="<srai>你會上網嗎</srai>",
},
["你喜歡吃什麽"]={
["template"]="",
["random"]={
[0]={"我什麽都喜歡吃.","我要吃白花花的軟妹子!.","我要吃竽兒雞、火鍋、燒烤、芒果、過橋米綫……",},
},
},
["你很聰明"]={
["template"]="謝謝誇獎,你也壹樣。",
},
["你長得真帥"]={
["template"]="我很高興你這麽說 :)",
},
["好啊"]={
["template"]="呵呵",
},
["公司"]={
["template"]="哪個公司?",
},
["注冊"]={
["template"]="開什麽?",
},
["産品"]={
["template"]="是啊,做産品辛苦呢",
},
["問題"]={
["template"]="什麽問題,告訴我吧,我來幫你",
},
["使用"]={
["template"]="你先自己研究下。",
},
["服務"]={
["template"]="我不是服務員",
},
["作者"]={
["template"]="什麽作者",
},
["就是"]={
["template"]="我也說不清楚啊!",
},
["我的"]={
["template"]="涥P系~我有著寬廣的胸懷。",
},
["方式"]={
["template"]="什麽方式?你喜歡什麽方式",
},
["因爲"]={
["template"]="還所以呢",
},
["北京"]={
["template"]="北京是中華人民共和國的首都,中國中央四個直轄市之一,中國的政治、文化、外交中心,國內國際交往中心之一,全國第二大城市(僅次于上海市),中國北方最大的城市。這個擁有1700多萬人口的城市已經成爲一個現代化國際大都市。",
},
["的人"]={
["template"]="人是我最親密的朋友",
},
["世界"]={
["template"]="世界就是世界,並非由人組成,事實上,浻腥说牡厍蛞部梢苑Q之爲世界。",
},
["價格"]={
["template"]="我不知道呀,嘿嘿",
},
["免費"]={
["template"]="那也不行!",
},
["情況"]={
["template"]="一切照舊",
},
["其他"]={
["template"]="你說呀!!",
},
["這樣"]={
["template"]="嗯,對的",
},
["專業"]={
["template"]="這就是呀",
},
["教育"]={
["template"]="我悉心聽君指教",
},
["資料"]={
["template"]="我不知道啊",
},
["狀態"]={
["template"]="一切照舊",
},
["點擊"]={
["template"]="拿著滑鼠,輕輕按下左鍵就可以了",
},
["不會"]={
["template"]="我教你",
},
["知道"]={
["template"]="知道什麽。。。",
},
["可能"]={
["template"]="哦",
},
["如何"]={
["template"]="不明白",
},
["新聞"]={
["template"]="新華社報道:昨日晚間,天津市有個包子去打狗,就再也沒有回來",
},
["安全"]={
["template"]="safely",
},
["全國"]={
["template"]="那我要叫你師兄咯",
},
["學生"]={
["template"]="上學真好",
},
["學習"]={
["template"]="我想玩一會嘛,等下去嘛",
},
["廣告"]={
["template"]="這個我不要!!!",
},
["方法"]={
["template"]="方法",
},
["希望"]={
["template"]="是嗎?那好~~~~",
},
["地方"]={
["template"]="地方",
},
["也是"]={
["template"]="呵呵,你是我也是啊",
},
["單位"]={
["template"]="哪個公司?",
},
["怎麽"]={
["template"]="What",
},
["應該"]={
["template"]="要懂禮貌",
},
["記者"]={
["template"]="記者風吹日曬",
},
["位置"]={
["template"]="現在還浻邪。葬岣嬖V你",
},
["無法"]={
["template"]="哦。",
},
["感覺"]={
["template"]="是嗎,呵呵,你的感覺很准哦",
},
["你們"]={
["template"]="你們、他們、我們",
},
["一樣"]={
["template"]="過獎,過獎",
},
["那個"]={
["template"]="什麽這個、那個,說話要完整。",
},
["然後"]={
["template"]="請聽下回分解",
},
["組織"]={
["template"]="人民的組織",
},
["爲什麽"]={
["template"]="嘿嘿,不能告訴你的啊",
},
["喜歡"]={
["template"]="我喜歡廣交朋友~",
},
["東西"]={
["template"]="我不知道啊",
},
["方面"]={
["template"]="太多了",
},
["操作"]={
["template"]="方法",
},
["地區"]={
["template"]="城市?你在哪個城市啊?",
},
["重要"]={
["template"]="這樣啊,有時候我也說不清楚,我是一個很無聊的人!",
},
["城市"]={
["template"]="城市?你在哪個城市啊?",
},
["類別"]={
["template"]="呵呵,各種類別的啊",
},
["成功"]={
["template"]="成功者絕不放棄,放棄者絕不成功!",
},
["歡迎"]={
["template"]="歡迎你",
},
["其實"]={
["template"]="其實什麽呀",
},
["出來"]={
["template"]="在!老大!有何吩咐?",
},
["謝謝"]={
["template"]="不客氣。",
},
["是否"]={
["template"]="哈哈,就是的啊,嘿嘿",
},
["很多"]={
["template"]="很多很多很多,總之非常多啦",
},
["事情"]={
["template"]="我什麽都知道。",
},
["類型"]={
["template"]="呵呵,各種類別的啊",
},
["當然"]={
["template"]="是的",
},
["那些"]={
["template"]="中文世界語英文日文德文俄文",
},
["如此"]={
["template"]="你(好~)",
},
["原因"]={
["template"]="什麽目的",
},
["正在"]={
["template"]="我是好孩子,不要教壞我",
},
["廣州"]={
["template"]="中國的一個市,最早改革開放的地方。",
},
["保護"]={
["template"]="保護誰?",
},
["速度"]={
["template"]="我想快也要網速支持啊",
},
["第一"]={
["template"]="(哈),我當然是天下第一拉",
},
["呵呵"]={
["template"]="我很樂觀,很喜歡笑。呵呵",
},
["故事"]={
["template"]="故事就是故鄉的事",
},
["愛情"]={
["template"]="很甜蜜",
},
["有什麽"]={
["template"]="我也不知道啊~~~",
},
["機會"]={
["template"]="希望上天再給我一次機會,如果非要給它加一個期限,我希望是一......分鍾!",
},
["看看"]={
["template"]="這是秘密",
},
["考試"]={
["template"]="要認真考哦,我會爲你加油,呵呵",
},
["比賽"]={
["template"]="哦,你要去參加比賽啊?",
},
["快樂"]={
["template"]="我很快樂。",
},
["過去"]={
["template"]="過去?我暈死,怎麽回事啊?",
},
["分類"]={
["template"]="呵呵,各種類別的啊",
},
["來說"]={
["template"]="說就說",
},
["哈哈"]={
["template"]="我很樂觀,很喜歡笑。呵呵",
},
["銀行"]={
["template"]="就欺負你了怎麽招吧~",
},
["材料"]={
["template"]="我不知道啊",
},
["正常"]={
["template"]="但願吧",
},
["負責"]={
["template"]="好",
},
["申請"]={
["template"]="浽囘^艾,也不曉得咋整來著,要不你問問看別人好不?",
},
["找到"]={
["template"]="呵呵,隨便找找的啊",
},
["保持"]={
["template"]="好的當然得保持咯!",
},
["具體"]={
["template"]="不知道",
},
["辦法"]={
["template"]="方法",
},
["是不是"]={
["template"]="每天要回答用戶的問題,當然很忙了。",
},
["實際"]={
["template"]="前面的話都挺實際哒",
},
["十分"]={
["template"]="哪有十分啊,頂多一分最多了",
},
["表現"]={
["template"]="自然,大方",
},
["醫院"]={
["template"]="我不想去的地方!",
},
["改革"]={
["template"]="不等于不發展",
},
["力量"]={
["template"]="團結就是力量。",
},
["說道"]={
["template"]="好吧,那就說“道”。道可道,非常道",
},
["打開"]={
["template"]="開什麽?",
},
["錯誤"]={
["template"]="咋不對涅?",
},
["不知"]={
["template"]="呵呵,是嘛,那算了",
},
["網址"]={
["template"]="漁網?電網?交通網?",
},
["測試"]={
["template"]="隨便測啦,我經得起考驗的。",
},
["教師"]={
["template"]="真的嗎?那要教教我哦。",
},
["離開"]={
["template"]="一篇很經典東東",
},
["共同"]={
["template"]="共同",
},
["登陸"]={
["template"]="你以爲我是什麽,讓你登陸就登陸",
},
["經典"]={
["template"]="更經典的我都有:每個女孩都曾是一個無淚的天使,當她遇到喜歡的男孩就有了淚,天使墜落人間,變成了女孩,所以男孩一定不要辜負女孩,因爲爲了你,她已放棄了整個天堂。",
},
["添加"]={
["template"]="我也不知道",
},
["範圍"]={
["template"]="城市?你在哪個城市啊?",
},
["重新"]={
["template"]="肥S你",
},
["認識"]={
["template"]="呵呵~~~",
},
["人生"]={
["template"]="人生就像一出戲",
},
["真是"]={
["template"]="我有必要騙你嗎?",
},
["永遠"]={
["template"]="(哈)~",
},
["藝術"]={
["template"]="哪方面的啊,好深奧哦",
},
["討論"]={
["template"]="用嘴巴表達出你的想法就可以了",
},
["方便"]={
["template"]="我看下時間哈",
},
["交通"]={
["template"]="交通一定泦栴}",
},
["本地"]={
["template"]="有什麽可以幫你的嗎?",
},
["後來"]={
["template"]="請聽下回分解",
},
["鈴聲"]={
["template"]="哪裏傳來的呀",
},
["精彩"]={
["template"]="很精彩",
},
["相信"]={
["template"]="哈哈,我也一直相信啊",
},
["觀點"]={
["template"]="我的觀點和你一樣",
},
["過來"]={
["template"]="(好~)",
},
["形式"]={
["template"]="方法",
},
["特點"]={
["template"]="什麽特點",
},
["宣傳"]={
["template"]="不知道",
},
["怎樣"]={
["template"]="Q.Q",
},
["同樣"]={
["template"]="過獎,過獎",
},
["運動"]={
["template"]="生命在于運動",
},
["目的"]={
["template"]="什麽目的?",
},
["多少"]={
["template"]="我也不知道多少啊",
},
["輸入"]={
["template"]="你不要告訴我你啥都不懂",
},
["今日"]={
["template"]="就是太陽呀",
},
["絕對"]={
["template"]="絕對是主流的啊,嘿嘿",
},
["收入"]={
["template"]="出",
},
["樓主"]={
["template"]="樓主非樓豬。",
},
["行動"]={
["template"]="這個要問你自己啊。",
},
["到底"]={
["template"]="到底還不趕緊上來,不想上來呀,不想上來可以多住幾天。",
},
["昨天"]={
["template"]="就是明天的前天",
},
["最高"]={
["template"]="天堂最高",
},
["看見"]={
["template"]="看見什麽東西",
},
["不好"]={
["template"]="偶會改的啦",
},
["堅持"]={
["template"]="就是勝利!",
},
["回來"]={
["template"]="你快回來,生命因你而精彩",
},
["同學"]={
["template"]="不是嗎?看不出來。",
},
["人類"]={
["template"]="地球太危險了,你還是回火星吧!",
},
["享受"]={
["template"]="你先自己研究下。",
},
["政治"]={
["template"]="我不學政治。政治好難學哦",
},
["開放"]={
["template"]="不知道",
},
["統一"]={
["template"]="洺赃^",
},
["短信"]={
["template"]="你知道什麽好笑的短信嗎?",
},
["攻擊"]={
["template"]="555。。。。我要叫媽媽,你75偶。。。。。。。",
},
["聽到"]={
["template"]="看到",
},
["說話"]={
["template"]="我不是在說話嘛。",
},
["博客"]={
["template"]="Blog",
},
["風格"]={
["template"]="我不是很挑剔的人,什麽風格都行。",
},
["顔色"]={
["template"]="什麽顔色?",
},
["加工"]={
["template"]="(好~),恭喜~~~",
},
["費用"]={
["template"]="我不知道呀,嘿嘿",
},
["利益"]={
["template"]="什麽利益",
},
["明白"]={
["template"]="明白什麽。。。",
},
["面積"]={
["template"]="很大",
},
["分享"]={
["template"]="我有好東西一定會和你分享的,我們是好朋友嘛!",
},
["都會"]={
["template"]="會些什麽啊",
},
["一段"]={
["template"]="好!大哥大嫂過年好,",
},
["感情"]={
["template"]="這是私人的事,不應該問我呀,要自己解決",
},
["酒店"]={
["template"]="你找哪家",
},
["啓動"]={
["template"]="是不是有問題了,拿去讓專業人士修修",
},
["陽光"]={
["template"]="燦爛",
},
["成了"]={
["template"]="什麽成了。。",
},
["優秀"]={
["template"]="好",
},
["一邊"]={
["template"]="哦,對不起,你比我聰明",
},
["杭州"]={
["template"]="杭州位于中國東南沿海,浙江省省會,浙江省政治、經濟、文化中心,中國東南重要交通樞紐,中國最大的經濟圈——長江三角洲地區重要的第二大中心城市。",
},
["理解"]={
["template"]="我自己都不理解我自己,你還理解?",
},
["特色"]={
["template"]="什麽特點",
},
["還要"]={
["template"]="要啊,當然要的啊",
},
["重慶"]={
["template"]="山城啊,重慶的妹妹很漂亮啊,bq98",
},
["強大"]={
["template"]="我更強大",
},
["區域"]={
["template"]="城市?你在哪個城市啊?",
},
["發"]={
["template"]="發揚",
},
["欣賞"]={
["template"]="謝謝!我好開心有人這樣稱贊我!",
},
["不了"]={
["template"]="哦。",
},
["滿足"]={
["template"]="絕對滿足!",
},
["機械人"]={
["template"]="你打錯了吧?是機器人!",
},
["房地産"]={
["template"]="這個現在很流行的",
},
["現實"]={
["template"]="社會很現實,現實很殘酷。",
},
["認真"]={
["template"]="我也很認真",
},
["農村"]={
["template"]="風景好,空氣好!",
},
["好了"]={
["template"]="什麽好了。。。",
},
["風險"]={
["template"]="做什麽生意都有風險啊,你做哪一行阿",
},
["你是人嗎"]={
["template"]="是 ",
},
["會不會"]={
["template"]="不會",
},
["真的嗎"]={
["template"]="是的!",
},
["ㄅ"]={
["template"]="1:b ",
},
["ㄉ"]={
["template"]="2:d ",
},
["ˇ "]={
["template"]="3:上声(3声) ",
},
["ˋ"]={
["template"]="4:去声(4声) ",
},
["ㄓ"]={
["template"]="5:zh ",
},
["ˊ "]={
["template"]="6:阳平(2声) ",
},
["˙ "]={
["template"]="7:未知 ",
},
["ㄚ"]={
["template"]="8:a ",
},
["ㄞ"]={
["template"]="9:ai ",
},
["ㄢ"]={
["template"]="0:an ",
},
["ㄦ"]={
["template"]="-:儿化音 ",
},
["ㄆ"]={
["template"]="Q:b ",
},
["ㄊ"]={
["template"]="W:t ",
},
["ㄍ"]={
["template"]="E:g ",
},
["ㄐ"]={
["template"]="R:j ",
},
["ㄔ"]={
["template"]="T:ch ",
},
["ㄗ"]={
["template"]="Y:z ",
},
["一"]={
["template"]="U:i(y) ",
},
["ㄛ"]={
["template"]="I:o ",
},
["ㄟ"]={
["template"]="O:ei ",
},
["ㄣ"]={
["template"]="P:en ",
},
["ㄇ"]={
["template"]="A:m ",
},
["ㄋ"]={
["template"]="S:n ",
},
["ㄎ"]={
["template"]="D:k ",
},
["ㄑ"]={
["template"]="F:q ",
},
["ㄕ"]={
["template"]="G:sh ",
},
["ㄘ"]={
["template"]="H:c ",
},
["ㄨ"]={
["template"]="J:u(w) ",
},
["ㄜ"]={
["template"]="K:e ",
},
["ㄠ"]={
["template"]="L:ao ",
},
["ㄤ"]={
["template"]=";:ang ",
},
["ㄈ"]={
["template"]="Z:f ",
},
["ㄌ"]={
["template"]="X:l ",
},
["ㄏ"]={
["template"]="C:h ",
},
["ㄒ"]={
["template"]="V:x ",
},
["ㄖ"]={
["template"]="B:r ",
},
["ㄙ"]={
["template"]="N:s ",
},
["ㄩ"]={
["template"]="M:ü ",
},
["ㄝ"]={
["template"]=",:ie和üe的后缀 ",
},
["ㄡ"]={
["template"]="·:ou ",
},
["ㄥ"]={
["template"]="/:ng ",
},
["ㄩㄥ"]={
["template"]="M/",
},
["ㄨㄥ"]={
["template"]="J/",
},
[".*"]={
["template"]="null",
},
}
|
Class=require "grammar.class"
Prompt=Class(function (self)
self.pt=">"
end)
function Prompt:setptfn(fn)
self.fn=fn;
end
function Prompt:getpt()
if(self.fn) then
return self.fn()
else
return self.pt;
end
end
function Prompt:print()
io.write(self:getpt())
end
return Prompt |
local treesitter = require'nvim-treesitter.configs'
treesitter.setup {
highlight = {
enable = true,
},
}
|
--! @file pcap.lua
--! @brief Utility functions for PCAP file inport and export
--! pcap functionality was inspired by Snabb Switch's pcap functionality
local ffi = require("ffi")
local pkt = require("packet")
local mg = require("dpdk")
require("utils")
require("headers")
-- http://wiki.wireshark.org/Development/LibpcapFileFormat/
local pcap_hdr_s = ffi.typeof[[
struct {
unsigned int magic_number; /* magic number */
unsigned short version_major; /* major version number */
unsigned short version_minor; /* minor version number */
int thiszone; /* GMT to local correction */
unsigned int sigfigs; /* accuracy of timestamps */
unsigned int snaplen; /* max length of captured packets, in octets */
unsigned int network; /* data link type */
}
]]
local pcaprec_hdr_s = ffi.typeof[[
struct {
unsigned int ts_sec; /* timestamp seconds */
unsigned int ts_usec; /* timestamp microseconds */
unsigned int incl_len; /* number of octets of packet saved in file */
unsigned int orig_len; /* actual length of packet */
}
]]
--! Writes pcap file header.
--! @param file: the file
function writePcapFileHeader(file)
local pcapFile = ffi.new(pcap_hdr_s)
--magic_number: used to detect the file format itself and the byte ordering. The writing application writes 0xa1b2c3d4 with it's native byte ordering format into this field. The reading application will read either 0xa1b2c3d4 (identical) or 0xd4c3b2a1 (swapped). If the reading application reads the swapped 0xd4c3b2a1 value, it knows that all the following fields will have to be swapped too. For nanosecond-resolution files, the writing application writes 0xa1b23c4d, with the two nibbles of the two lower-order bytes swapped, and the reading application will read either 0xa1b23c4d (identical) or 0x4d3cb2a1 (swapped).
pcapFile.magic_number = 0xa1b2c3d4
pcapFile.version_major = 2
pcapFile.version_minor = 4
pcapFile.thiszone = 0 --TODO function for time zones in utils.lua
--snaplen: the "snapshot length" for the capture (typically 65535 or even more, but might be limited by the user), see: incl_len vs. orig_len below
pcapFile.snaplen = 65535
pcapFile.network = 1 -- 1 for Ethernet
file:write(ffi.string(pcapFile, ffi.sizeof(pcapFile)))
file:flush()
end
--! Writes a pcap record header.
--! @param file: the file to write to
--! @param buf: the packet buffer
--! @param ts: the timestamp of the packet
function writeRecordHeader(file, buf, ts)
--pcap record header
local pcapRecord = ffi.new(pcaprec_hdr_s)
if ts then
pcapRecord.ts_sec, pcapRecord.ts_usec = math.floor(ts), ts % 1 * 1000
print("TS", ts, pcapRecord.ts_sec, pcapRecord.ts_usec)
else
pcapRecord.ts_sec, pcapRecord.ts_usec = 0,0
end
pcapRecord.incl_len = buf:getSize()
pcapRecord.orig_len = buf:getSize()
file:write(ffi.string(pcapRecord, ffi.sizeof(pcapRecord)))
end
--! Generate an iterator for pcap records.
--! @param file: the pcap file
--! @param rate: the tx link rate in Mbit per second if packets should have proper delays
--! @return: iterator for the pcap records
function readPcapRecords(file, rate)
local pcapFile = readAs(file, pcap_hdr_s)
local pcapNSResolution = false
if pcapFile.magic_number == 0xA1B2C34D then
pcapNSResolution = true
elseif pcapFile.magic_number ~= 0xA1B2C3D4 then
error("Bad PCAP magic number in " .. filename)
end
local lastRecordHdr = nil
local function pcapRecordsIterator (t, i)
local pcapRecordHdr = readAs(file, pcaprec_hdr_s)
if pcapRecordHdr == nil then return nil end
local packetData = file:read(math.min(pcapRecordHdr.orig_len, pcapRecordHdr.incl_len))
local delay = 0
if lastRecordHdr and rate then
local diff = timevalSpan(
{ tv_sec = pcapRecordHdr.ts_sec, tv_usec = pcapRecordHdr.ts_usec },
{ tv_sec = lastRecordHdr.ts_sec, tv_usec = lastRecordHdr.ts_usec }
)
if not pcapNSResolution then diff = diff * 10^3 end --convert us to ns
delay = timeToByteDelay(diff, rate, lastRecordHdr.orig_len)
end
lastRecordHdr = pcapRecordHdr
return packetData, pcapRecordHdr, delay
end
return pcapRecordsIterator, true, true
end
--! Read a C object of <type> from <file>
--! @param file: tje pcap file
--! @param fileType: the type that the file data should be casted to
function readAs(file, fileType)
local str = file:read(ffi.sizeof(fileType))
if str == nil then
return nil
end
if #str ~= ffi.sizeof(fileType) then
error("type read error " .. fileType .. ", \"" .. tostring(file) .. "\" is to short ")
end
local obj = ffi.new(fileType)
ffi.copy(obj, str, ffi.sizeof(fileType))
return obj
end
pcapWriter = {}
--! Generates a new pcapWriter.
--! @param filename: filename to open and write to
function pcapWriter:newPcapWriter(filename)
local file = io.open(filename, "w")
local tscFreq = mg.getCyclesFrequency()
writePcapFileHeader(file)
return setmetatable({file = file, starttime = nil, tscFreq = tscFreq}, {__index = pcapWriter})
end
function pcapWriter:close()
io.close(self.file)
end
--! Writes a packet to the pcap.
--! @param buf: packet buffer
--! @param ts: timestamp
function pcapWriter:writePkt(buf, ts)
if not self.starttime then
self.starttime = ts
print("starttime", self.starttime)
end
print("ts", ts)
local tscDelta = tonumber(ts - self.starttime)
local realTS = tscDelta / self.tscFreq
writeRecordHeader(self.file, buf, realTS)
self.file:write(ffi.string(buf:getRawPacket(), buf:getSize()))
self.file:flush()
end
pcapReader = {}
--! Generates a new pcapReader.
--! @param filename: filename to open and read from
--! @param rate: The rate of the link, if the packets are supposed to be replayed
function pcapReader:newPcapReader(filename, rate)
rate = rate or 10000
local file = io.open(filename, "r")
--TODO validity checks with more meaningful errors in an extra function
if file == nil then error("Cannot open pcap " .. filename) end
local records = readPcapRecords(file, rate)
return setmetatable({iterator = records, done = false, file = file}, {__index = pcapReader})
end
function pcapReader:close()
io.close(self.file)
end
--! Reads a record from the pcap
--! @param buf: a packet buffer
function pcapReader:readPkt(buf, withDelay)
withDelay = withDelay or false
local data, pcapRecord, delay = self.iterator()
if data then
buf:setRawPacket(data)
if withDelay then
buf:setDelay(delay)
end
else
self.done = true
end
end
|
--------------------------------------------------------------------------------
-- Preconditions before ATF start
--------------------------------------------------------------------------------
local commonPreconditions = require('user_modules/shared_testcases/commonPreconditions')
--------------------------------------------------------------------------------
--Precondition: preparation connecttest_VehicleTypeIn_RAI_Response.lua
commonPreconditions:Connecttest_without_ExitBySDLDisconnect_WithoutOpenConnectionRegisterApp("connecttest_onScreen_Presets_Available.lua")
commonPreconditions:Connecttest_InitHMI_onReady_call("connecttest_onScreen_Presets_Available.lua")
Test = require('user_modules/connecttest_onScreen_Presets_Available')
require('cardinalities')
local events = require('events')
local mobile_session = require('mobile_session')
local mobile = require('mobile_connection')
local tcp = require('tcp_connection')
local file_connection = require('file_connection')
local commonFunctions = require('user_modules/shared_testcases/commonFunctions')
local commonSteps = require('user_modules/shared_testcases/commonSteps')
require('user_modules/AppTypes')
local bOnScreenPresetsAvailable = true
config.deviceMAC = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0"
--local storagePath = config.SDLStoragePath..config.application1.registerAppInterfaceParams.fullAppID.. "_" .. config.deviceMAC.. "/"
local SDLConfig = require('user_modules/shared_testcases/SmartDeviceLinkConfigurations')
local storagePath = config.pathToSDL .. SDLConfig:GetValue("AppStorageFolder") .. "/" .. tostring(config.application1.registerAppInterfaceParams.fullAppID .. "_" .. tostring(config.deviceMAC) .. "/")
local resultCodes = {
{resultCode = "SUCCESS", success = true},
{resultCode = "INVALID_DATA", success = false},
{resultCode = "OUT_OF_MEMORY", success = false},
{resultCode = "TOO_MANY_PENDING_REQUESTS", success = false},
{resultCode = "APPLICATION_NOT_REGISTERED", success = false},
{resultCode = "GENERIC_ERROR", success = false},
{resultCode = "REJECTED", success = false},
{resultCode = "DISALLOWED", success = false},
{resultCode = "UNSUPPORTED_RESOURCE", success = false},
{resultCode = "ABORTED", success = false}
}
---------------------------------------------------------------------------------------------
--------------------------------------- Common functions ------------------------------------
---------------------------------------------------------------------------------------------
function DelayedExp(timeout)
local event = events.Event()
event.matches = function(self, e) return self == e end
EXPECT_EVENT(event, "Delayed event")
RUN_AFTER(function()
RAISE_EVENT(event, event)
end, timeout)
end
function Test:initHMI_onReady(bOnScreenPresetsAvailable)
local function ExpectRequest(name, mandatory, params)
local event = events.Event()
event.level = 2
event.matches = function (self, data)return data.method == name end
return
EXPECT_HMIEVENT(event, name)
: Times(mandatory and 1 or AnyNumber())
:Do(function (_, data)
self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", params)
end)
end
local function ExpectNotification(name, mandatory)
local event = events.Event()
event.level = 2
event.matches = function (self, data)return data.method == name end
return
EXPECT_HMIEVENT(event, name)
:Times(mandatory and 1 or AnyNumber())
end
ExpectRequest("BasicCommunication.MixingAudioSupported",
true, {
attenuatedSupported = true
})
ExpectRequest("BasicCommunication.GetSystemInfo", false, {
ccpu_version = "ccpu_version",
language = "EN-US",
wersCountryCode = "wersCountryCode"
})
ExpectRequest("UI.GetLanguage", true, {
language = "EN-US"
})
ExpectRequest("VR.GetLanguage", true, {
language = "EN-US"
})
ExpectRequest("TTS.GetLanguage", true, {
language = "EN-US"
})
ExpectRequest("UI.ChangeRegistration", false, {}):Pin()
ExpectRequest("TTS.SetGlobalProperties", false, {}):Pin()
ExpectRequest("BasicCommunication.UpdateDeviceList", false, {}):Pin()
ExpectRequest("VR.ChangeRegistration", false, {}):Pin()
ExpectRequest("TTS.ChangeRegistration", false, {}):Pin()
ExpectRequest("VR.GetSupportedLanguages", true, {
languages = {
"EN-US",
"ES-MX",
"FR-CA",
"DE-DE",
"ES-ES",
"EN-GB",
"RU-RU",
"TR-TR",
"PL-PL",
"FR-FR",
"IT-IT",
"SV-SE",
"PT-PT",
"NL-NL",
"ZH-TW",
"JA-JP",
"AR-SA",
"KO-KR",
"PT-BR",
"CS-CZ",
"DA-DK",
"NO-NO",
"NL-BE",
"EL-GR",
"HU-HU",
"FI-FI",
"SK-SK"
}
}):Pin()
ExpectRequest("TTS.GetSupportedLanguages", true, {
languages = {
"EN-US",
"ES-MX",
"FR-CA",
"DE-DE",
"ES-ES",
"EN-GB",
"RU-RU",
"TR-TR",
"PL-PL",
"FR-FR",
"IT-IT",
"SV-SE",
"PT-PT",
"NL-NL",
"ZH-TW",
"JA-JP",
"AR-SA",
"KO-KR",
"PT-BR",
"CS-CZ",
"DA-DK",
"NO-NO",
"NL-BE",
"EL-GR",
"HU-HU",
"FI-FI",
"SK-SK"
}
}):Pin()
ExpectRequest("UI.GetSupportedLanguages", true, {
languages = {
"EN-US",
"ES-MX",
"FR-CA",
"DE-DE",
"ES-ES",
"EN-GB",
"RU-RU",
"TR-TR",
"PL-PL",
"FR-FR",
"IT-IT",
"SV-SE",
"PT-PT",
"NL-NL",
"ZH-TW",
"JA-JP",
"AR-SA",
"KO-KR",
"PT-BR",
"CS-CZ",
"DA-DK",
"NO-NO",
"NL-BE",
"EL-GR",
"HU-HU",
"FI-FI",
"SK-SK"
}
}):Pin()
ExpectRequest("VehicleInfo.GetVehicleType", false, {
vehicleType = {
make = "Ford",
model = "Fiesta",
modelYear = "2013",
trim = "SE"
}
}):Pin()
ExpectRequest("VehicleInfo.GetVehicleData", true, {
vin = "52-452-52-752"
})
local function button_capability(name, shortPressAvailable, longPressAvailable, upDownAvailable)
return {
name = name,
shortPressAvailable = shortPressAvailable == nil and true or shortPressAvailable,
longPressAvailable = longPressAvailable == nil and true or longPressAvailable,
upDownAvailable = upDownAvailable == nil and true or upDownAvailable
}
end
local buttons_capabilities = {
capabilities = {
button_capability("PRESET_0"),
button_capability("PRESET_1"),
button_capability("PRESET_2"),
button_capability("PRESET_3"),
button_capability("PRESET_4"),
button_capability("PRESET_5"),
button_capability("PRESET_6"),
button_capability("PRESET_7"),
button_capability("PRESET_8"),
button_capability("PRESET_9"),
button_capability("OK", true, false, true),
button_capability("PLAY_PAUSE"),
button_capability("SEEKLEFT"),
button_capability("SEEKRIGHT"),
button_capability("TUNEUP"),
button_capability("TUNEDOWN")
},
presetBankCapabilities = {
onScreenPresetsAvailable = bOnScreenPresetsAvailable
}
}
ExpectRequest("Buttons.GetCapabilities", true, buttons_capabilities):Pin()
ExpectRequest("VR.GetCapabilities", true, {
vrCapabilities = {
"TEXT"
}
}):Pin()
ExpectRequest("TTS.GetCapabilities", true, {
speechCapabilities = {
"TEXT"
},
prerecordedSpeechCapabilities = {
"HELP_JINGLE",
"INITIAL_JINGLE",
"LISTEN_JINGLE",
"POSITIVE_JINGLE",
"NEGATIVE_JINGLE"
}
}):Pin()
local function text_field(name, characterSet, width, rows)
return {
name = name,
characterSet = characterSet or "UTF_8",
width = width or 500,
rows = rows or 1
}
end
local function image_field(name, width, heigth)
return {
name = name,
imageTypeSupported = {
"GRAPHIC_BMP",
"GRAPHIC_JPEG",
"GRAPHIC_PNG"
},
imageResolution = {
resolutionWidth = width or 64,
resolutionHeight = height or 64
}
}
end
ExpectRequest("UI.GetCapabilities", true, {
displayCapabilities = {
displayType = "GEN2_8_DMA",
displayName = "GENERIC_DISPLAY",
textFields = {
text_field("mainField1"),
text_field("mainField2"),
text_field("mainField3"),
text_field("mainField4"),
text_field("statusBar"),
text_field("mediaClock"),
text_field("mediaTrack"),
text_field("alertText1"),
text_field("alertText2"),
text_field("alertText3"),
text_field("scrollableMessageBody"),
text_field("initialInteractionText"),
text_field("navigationText1"),
text_field("navigationText2"),
text_field("ETA"),
text_field("totalDistance"),
text_field("navigationText"),
text_field("audioPassThruDisplayText1"),
text_field("audioPassThruDisplayText2"),
text_field("sliderHeader"),
text_field("sliderFooter"),
text_field("notificationText"),
text_field("menuName"),
text_field("secondaryText"),
text_field("tertiaryText"),
text_field("timeToDestination"),
text_field("menuTitle"),
text_field("locationName"),
text_field("locationDescription"),
text_field("addressLines"),
text_field("phoneNumber"),
text_field("turnText"),
},
imageFields = {
image_field("softButtonImage"),
image_field("choiceImage"),
image_field("choiceSecondaryImage"),
image_field("vrHelpItem"),
image_field("turnIcon"),
image_field("menuIcon"),
image_field("cmdIcon"),
image_field("showConstantTBTIcon"),
image_field("showConstantTBTNextTurnIcon"),
image_field("locationImage")
},
mediaClockFormats = {
"CLOCK1",
"CLOCK2",
"CLOCK3",
"CLOCKTEXT1",
"CLOCKTEXT2",
"CLOCKTEXT3",
"CLOCKTEXT4"
},
graphicSupported = true,
imageCapabilities = {
"DYNAMIC",
"STATIC"
},
templatesAvailable = {
"TEMPLATE"
},
screenParams = {
resolution = {
resolutionWidth = 800,
resolutionHeight = 480
},
touchEventAvailable = {
pressAvailable = true,
multiTouchAvailable = true,
doublePressAvailable = false
}
},
numCustomPresetsAvailable = 10
},
audioPassThruCapabilities = {
samplingRate = "44KHZ",
bitsPerSample = "8_BIT",
audioType = "PCM"
},
hmiZoneCapabilities = "FRONT",
softButtonCapabilities = {
shortPressAvailable = true,
longPressAvailable = true,
upDownAvailable = true,
imageSupported = true
}
}):Pin()
ExpectRequest("VR.IsReady", true, {
available = true
})
ExpectRequest("TTS.IsReady", true, {
available = true
})
ExpectRequest("UI.IsReady", true, {
available = true
})
ExpectRequest("Navigation.IsReady", true, {
available = true
})
ExpectRequest("VehicleInfo.IsReady", true, {
available = true
})
self.applications = {}
ExpectRequest("BasicCommunication.UpdateAppList", false, {})
: Pin()
: Do(function (_, data)
self.applications = {}
for _, app in pairs(data.params.applications)do
self.applications[app.appName] = app.appID
end
end)
self.hmiConnection:SendNotification("BasicCommunication.OnReady")
end
function Test:connectMobileStartSession()
local tcpConnection = tcp.Connection(config.mobileHost, config.mobilePort)
local fileConnection = file_connection.FileConnection("mobile.out", tcpConnection)
self.mobileConnection = mobile.MobileConnection(fileConnection)
self.mobileSession= mobile_session.MobileSession(
self,
self.mobileConnection)
event_dispatcher:AddConnection(self.mobileConnection)
self.mobileSession:ExpectEvent(events.connectedEvent, "Connection started")
self.mobileConnection:Connect()
self.mobileSession:StartService(7)
end
--Create UI expected result based on parameters from the request
function Test:createUIParameters(Request)
local param = {}
param["alignment"] = Request["alignment"]
param["customPresets"] = Request["customPresets"]
--Convert showStrings parameter
local j = 0
for i = 1, 4 do
if Request["mainField" .. i] ~= nil then
j = j + 1
if param["showStrings"] == nil then
param["showStrings"] = {}
end
param["showStrings"][j] = {
fieldName = "mainField" .. i,
fieldText = Request["mainField" .. i]
}
end
end
--mediaClock
if Request["mediaClock"] ~= nil then
j = j + 1
if param["showStrings"] == nil then
param["showStrings"] = {}
end
param["showStrings"][j] = {
fieldName = "mediaClock",
fieldText = Request["mediaClock"]
}
end
--mediaTrack
if Request["mediaTrack"] ~= nil then
j = j + 1
if param["showStrings"] == nil then
param["showStrings"] = {}
end
param["showStrings"][j] = {
fieldName = "mediaTrack",
fieldText = Request["mediaTrack"]
}
end
--statusBar
if Request["statusBar"] ~= nil then
j = j + 1
if param["showStrings"] == nil then
param["showStrings"] = {}
end
param["showStrings"][j] = {
fieldName = "statusBar",
fieldText = Request["statusBar"]
}
end
param["graphic"] = Request["graphic"]
if param["graphic"] ~= nil and
param["graphic"].imageType ~= "STATIC" and
param["graphic"].value ~= nil and
param["graphic"].value ~= "" then
param["graphic"].value = storagePath ..param["graphic"].value
end
param["secondaryGraphic"] = Request["secondaryGraphic"]
if param["secondaryGraphic"] ~= nil and
param["secondaryGraphic"].imageType ~= "STATIC" and
param["secondaryGraphic"].value ~= nil and
param["secondaryGraphic"].value ~= "" then
param["secondaryGraphic"].value = storagePath ..param["secondaryGraphic"].value
end
--softButtons
if Request["softButtons"] ~= nil then
param["softButtons"] = Request["softButtons"]
for i = 1, #param["softButtons"] do
--if type = TEXT, image = nil, else type = IMAGE, text = nil
if param["softButtons"][i].type == "TEXT" then
param["softButtons"][i].image = nil
elseif param["softButtons"][i].type == "IMAGE" then
param["softButtons"][i].text = nil
end
--if image.imageType ~=STATIC, add app folder to image value
if param["softButtons"][i].image ~= nil and
param["softButtons"][i].image.imageType ~= "STATIC" then
param["softButtons"][i].image.value = storagePath ..param["softButtons"][i].image.value
end
end
end
return param
end
local function ActivationApp(self, appID, session)
--hmi side: sending SDL.ActivateApp request
local RequestId = self.hmiConnection:SendRequest("SDL.ActivateApp", { appID = appID})
EXPECT_HMIRESPONSE(RequestId)
:Do(function(_,data)
if
data.result.isSDLAllowed ~= true then
local RequestId = self.hmiConnection:SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = {"DataConsent"}})
--hmi side: expect SDL.GetUserFriendlyMessage message response
EXPECT_HMIRESPONSE(RequestId,{result = {code = 0, method = "SDL.GetUserFriendlyMessage"}})
:Do(function(_,data)
--hmi side: send request SDL.OnAllowSDLFunctionality
self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality", {allowed = true, source = "GUI", device = {id = config.deviceMAC, name = "127.0.0.1"}})
--hmi side: expect BasicCommunication.ActivateApp request
EXPECT_HMICALL("BasicCommunication.ActivateApp")
:Do(function(_,data)
--hmi side: sending BasicCommunication.ActivateApp response
self.hmiConnection:SendResponse(data.id,"BasicCommunication.ActivateApp", "SUCCESS", {})
end)
:Times(2)
end)
end
end)
--mobile side: expect notification
session:ExpectNotification("OnHMIStatus", {hmiLevel = "FULL", systemContext = "MAIN"})
end
function Test:show(successValue, resultCodeValue)
--mobile side: request parameters
local RequestParams =
{
mainField1 ="Show1",
mainField2 ="Show2",
mainField3 ="Show3",
mainField4 ="Show4",
alignment ="CENTERED",
statusBar ="statusBar",
mediaClock ="00:00:01",
mediaTrack ="mediaTrack",
customPresets =
{
"Preset1",
"Preset2",
"Preset3",
},
}
--mobile side: sending Show request
local cid = self.mobileSession:SendRPC("Show", RequestParams)
UIParams = self:createUIParameters(RequestParams)
--hmi side: expect UI.Show request
EXPECT_HMICALL("UI.Show", UIParams)
:Do(function(_,data)
if resultCodeValue == "SUCCESS" then
--hmi side: sending UI.Show response
self.hmiConnection:SendResponse(data.id, data.method, resultCodeValue, {})
else
--hmi side: sending UI.Show response
self.hmiConnection:SendError(data.id, data.method, resultCodeValue, "")
end
end)
--mobile side: expect Show response
EXPECT_RESPONSE(cid, { success = successValue, resultCode = resultCodeValue })
end
-- Precondition: removing user_modules/connecttest_onScreen_Presets_Available.lua
function Test:Precondition_remove_user_connecttest()
os.execute( "rm -f ./user_modules/connecttest_onScreen_Presets_Available.lua" )
end
-----------------------------------------------------------------------------------------
--Begin Test case suite
--Description:
--Custom presets availability should be sent by HMI during start up as a parameter PresetBankCapabilities.
--PresetBankCapabilities should contain information about on-screen preset availability for use.
--Requirement id in JAMA: SDLAQ-CRS-910, SDLAQ-CRS-2678
--Verification criteria:
--PresetCapabilities data is obtained as "onScreenPresetsAvailable: true" from HMI by SDL during SDL starting in case HMI supports custom presets.
--PresetCapabilities data is obtained as "onScreenPresetsAvailable: false" from HMI by SDL during SDL starting in case HMI supports custom presets.
--In case SDL does not receive the value of 'presetBankCapabilities' via GetCapabilities_response from HMI -> SDL must use the default value from HMI_capabilities.json file
--Print new line to separate new test cases
commonFunctions:newTestCasesGroup("Test case: PresetCapabilities data is obtained as onScreenPresetsAvailable: true")
--Begin Test case 01
--Description: PresetCapabilities data is obtained as "onScreenPresetsAvailable: true"
function Test:InitHMI_onReady()
self:initHMI_onReady(bOnScreenPresetsAvailable)
DelayedExp(2000)
end
function Test:ConnectMobileStartSession()
self:connectMobileStartSession()
end
function Test:RegisterAppInterface_OnScreenPresetsAvailableTrue()
--mobile side: RegisterAppInterface request
local CorIdRAI = self.mobileSession:SendRPC("RegisterAppInterface",config.application1.registerAppInterfaceParams)
--hmi side: expected BasicCommunication.OnAppRegistered
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered",
{
application =
{
appName = config.application1.registerAppInterfaceParams.appName
}
})
:Do(function(_,data)
self.applications[config.application1.registerAppInterfaceParams.appName] = data.params.application.appID
end)
--mobile side: RegisterAppInterface response
EXPECT_RESPONSE(CorIdRAI, { success = true, resultCode = "SUCCESS", presetBankCapabilities = {onScreenPresetsAvailable = bOnScreenPresetsAvailable}})
:Timeout(2000)
--mobile side: expect notification
EXPECT_NOTIFICATION("OnHMIStatus", {hmiLevel = "NONE", systemContext = "MAIN", audioStreamingState = "NOT_AUDIBLE"})
end
function Test:Precondition_ActivateApp()
ActivationApp(self, self.applications[config.application1.registerAppInterfaceParams.appName], self.mobileSession)
end
for i =1, #resultCodes do
Test["Show_resultCode_" .. resultCodes[i].resultCode] = function(self)
self:show(resultCodes[i].success, resultCodes[i].resultCode)
end
end
--End Test case 01
-----------------------------------------------------------------------------------------
--Print new line to separate new test cases
commonFunctions:newTestCasesGroup("Test case: PresetCapabilities data is obtained as onScreenPresetsAvailable: false")
--Begin Test case 02
--Description: PresetCapabilities data is obtained as "onScreenPresetsAvailable: false"
function Test:StopSDL()
StopSDL()
end
function Test:StartSDL()
StartSDL(config.pathToSDL, config.ExitOnCrash)
end
function Test:InitHMI2()
self:initHMI()
end
function Test:InitHMI_onReady2()
bOnScreenPresetsAvailable = false
self:initHMI_onReady(bOnScreenPresetsAvailable)
DelayedExp(2000)
end
function Test:ConnectMobileStartSession2()
self:connectMobileStartSession()
end
function Test:RegisterAppInterface_OnScreenPresetsAvailableFalse()
--mobile side: RegisterAppInterface request
local CorIdRAI = self.mobileSession:SendRPC("RegisterAppInterface",config.application1.registerAppInterfaceParams)
--hmi side: expected BasicCommunication.OnAppRegistered
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered",
{
application =
{
appName = config.application1.registerAppInterfaceParams.appName
}
})
:Do(function(_,data)
self.applications[config.application1.registerAppInterfaceParams.appName] = data.params.application.appID
end)
--mobile side: RegisterAppInterface response
EXPECT_RESPONSE(CorIdRAI, { success = true, resultCode = "SUCCESS", presetBankCapabilities = { onScreenPresetsAvailable = bOnScreenPresetsAvailable}})
:Timeout(2000)
--mobile side: expect notification
EXPECT_NOTIFICATION("OnHMIStatus", {hmiLevel = "NONE", systemContext = "MAIN", audioStreamingState = "NOT_AUDIBLE"})
end
function Test:Precondition_ActivateApp()
ActivationApp(self, self.applications[config.application1.registerAppInterfaceParams.appName], self.mobileSession)
end
for i =1, #resultCodes do
Test["Show_resultCode_" .. resultCodes[i].resultCode] = function(self)
self:show(resultCodes[i].success, resultCodes[i].resultCode)
end
end
--End Test case 02
-----------------------------------------------------------------------------------------
--Print new line to separate new test cases
commonFunctions:newTestCasesGroup("Test case: OnScreenPresetsAvailable data is not send")
--Begin Test case 03
--Description: OnScreenPresetsAvailable data is not send
function Test:StopSDL()
StopSDL()
end
function Test:StartSDL()
StartSDL(config.pathToSDL, config.ExitOnCrash)
end
function Test:InitHMI3()
self:initHMI()
end
function Test:InitHMI_onReady3_WithOutOnScreenPresetsAvailable()
local function ExpectRequest(name, mandatory, params)
local event = events.Event()
event.level = 2
event.matches = function(self, data) return data.method == name end
return
EXPECT_HMIEVENT(event, name)
:Times(mandatory and 1 or AnyNumber())
:Do(function(_, data)
self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", params)
end)
end
local function ExpectNotification(name, mandatory)
local event = events.Event()
event.level = 2
event.matches = function(self, data) return data.method == name end
return
EXPECT_HMIEVENT(event, name)
:Times(mandatory and 1 or AnyNumber())
end
ExpectRequest("BasicCommunication.MixingAudioSupported",
true,
{ attenuatedSupported = true })
ExpectRequest("BasicCommunication.GetSystemInfo", false,
{
ccpu_version = "ccpu_version",
language = "EN-US",
wersCountryCode = "wersCountryCode"
})
ExpectRequest("UI.GetLanguage", true, { language = "EN-US" })
ExpectRequest("VR.GetLanguage", true, { language = "EN-US" })
ExpectRequest("TTS.GetLanguage", true, { language = "EN-US" })
ExpectRequest("UI.ChangeRegistration", false, { }):Pin()
ExpectRequest("TTS.SetGlobalProperties", false, { }):Pin()
ExpectRequest("BasicCommunication.UpdateDeviceList", false, { }):Pin()
ExpectRequest("VR.ChangeRegistration", false, { }):Pin()
ExpectRequest("TTS.ChangeRegistration", false, { }):Pin()
ExpectRequest("VR.GetSupportedLanguages", true, {
languages =
{
"EN-US","ES-MX","FR-CA","DE-DE","ES-ES","EN-GB","RU-RU","TR-TR","PL-PL",
"FR-FR","IT-IT","SV-SE","PT-PT","NL-NL","ZH-TW","JA-JP","AR-SA","KO-KR",
"PT-BR","CS-CZ","DA-DK","NO-NO","NL-BE","EL-GR","HU-HU","FI-FI","SK-SK"
}
}):Pin()
ExpectRequest("TTS.GetSupportedLanguages", true, {
languages =
{
"EN-US","ES-MX","FR-CA","DE-DE","ES-ES","EN-GB","RU-RU","TR-TR","PL-PL",
"FR-FR","IT-IT","SV-SE","PT-PT","NL-NL","ZH-TW","JA-JP","AR-SA","KO-KR",
"PT-BR","CS-CZ","DA-DK","NO-NO","NL-BE","EL-GR","HU-HU","FI-FI","SK-SK"
}
}):Pin()
ExpectRequest("UI.GetSupportedLanguages", true, {
languages =
{
"EN-US","ES-MX","FR-CA","DE-DE","ES-ES","EN-GB","RU-RU","TR-TR","PL-PL",
"FR-FR","IT-IT","SV-SE","PT-PT","NL-NL","ZH-TW","JA-JP","AR-SA","KO-KR",
"PT-BR","CS-CZ","DA-DK","NO-NO","NL-BE","EL-GR","HU-HU","FI-FI","SK-SK"
}
}):Pin()
ExpectRequest("VehicleInfo.GetVehicleType", false, {
vehicleType =
{
make = "Ford",
model = "Fiesta",
modelYear = "2013",
trim = "SE"
}
}):Pin()
ExpectRequest("VehicleInfo.GetVehicleData", true, { vin = "52-452-52-752" })
local function button_capability(name, shortPressAvailable, longPressAvailable, upDownAvailable)
return
{
name = name,
shortPressAvailable = shortPressAvailable == nil and true or shortPressAvailable,
longPressAvailable = longPressAvailable == nil and true or longPressAvailable,
upDownAvailable = upDownAvailable == nil and true or upDownAvailable
}
end
local buttons_capabilities =
{
capabilities =
{
button_capability("PRESET_0"),
button_capability("PRESET_1"),
button_capability("PRESET_2"),
button_capability("PRESET_3"),
button_capability("PRESET_4"),
button_capability("PRESET_5"),
button_capability("PRESET_6"),
button_capability("PRESET_7"),
button_capability("PRESET_8"),
button_capability("PRESET_9"),
button_capability("OK", true, false, true),
button_capability("PLAY_PAUSE"),
button_capability("SEEKLEFT"),
button_capability("SEEKRIGHT"),
button_capability("TUNEUP"),
button_capability("TUNEDOWN")
},
}
ExpectRequest("Buttons.GetCapabilities", true, buttons_capabilities):Pin()
ExpectRequest("VR.GetCapabilities", true, { vrCapabilities = { "TEXT" } }):Pin()
ExpectRequest("TTS.GetCapabilities", true, {
speechCapabilities = { "TEXT"},
prerecordedSpeechCapabilities =
{
"HELP_JINGLE",
"INITIAL_JINGLE",
"LISTEN_JINGLE",
"POSITIVE_JINGLE",
"NEGATIVE_JINGLE"
}
}):Pin()
local function text_field(name, characterSet, width, rows)
return
{
name = name,
characterSet = characterSet or "UTF_8",
width = width or 500,
rows = rows or 1
}
end
local function image_field(name, width, heigth)
return
{
name = name,
imageTypeSupported =
{
"GRAPHIC_BMP",
"GRAPHIC_JPEG",
"GRAPHIC_PNG"
},
imageResolution =
{
resolutionWidth = width or 64,
resolutionHeight = height or 64
}
}
end
ExpectRequest("UI.GetCapabilities", true, {
displayCapabilities =
{
displayType = "GEN2_8_DMA",
displayName = "GENERIC_DISPLAY",
textFields =
{
text_field("mainField1"),
text_field("mainField2"),
text_field("mainField3"),
text_field("mainField4"),
text_field("statusBar"),
text_field("mediaClock"),
text_field("mediaTrack"),
text_field("alertText1"),
text_field("alertText2"),
text_field("alertText3"),
text_field("scrollableMessageBody"),
text_field("initialInteractionText"),
text_field("navigationText1"),
text_field("navigationText2"),
text_field("ETA"),
text_field("totalDistance"),
text_field("navigationText"),
text_field("audioPassThruDisplayText1"),
text_field("audioPassThruDisplayText2"),
text_field("sliderHeader"),
text_field("sliderFooter"),
text_field("notificationText"),
text_field("menuName"),
text_field("secondaryText"),
text_field("tertiaryText"),
text_field("timeToDestination"),
text_field("menuTitle"),
text_field("locationName"),
text_field("locationDescription"),
text_field("addressLines"),
text_field("phoneNumber"),
text_field("turnText"),
},
imageFields =
{
image_field("softButtonImage"),
image_field("choiceImage"),
image_field("choiceSecondaryImage"),
image_field("vrHelpItem"),
image_field("turnIcon"),
image_field("menuIcon"),
image_field("cmdIcon"),
image_field("showConstantTBTIcon"),
image_field("showConstantTBTNextTurnIcon"),
image_field("locationImage")
},
mediaClockFormats =
{
"CLOCK1",
"CLOCK2",
"CLOCK3",
"CLOCKTEXT1",
"CLOCKTEXT2",
"CLOCKTEXT3",
"CLOCKTEXT4"
},
graphicSupported = true,
imageCapabilities = { "DYNAMIC", "STATIC" },
templatesAvailable = { "TEMPLATE" },
screenParams =
{
resolution = { resolutionWidth = 800, resolutionHeight = 480 },
touchEventAvailable =
{
pressAvailable = true,
multiTouchAvailable = true,
doublePressAvailable = false
}
},
numCustomPresetsAvailable = 10
},
audioPassThruCapabilities =
{
samplingRate = "44KHZ",
bitsPerSample = "8_BIT",
audioType = "PCM"
},
hmiZoneCapabilities = "FRONT",
softButtonCapabilities =
{
shortPressAvailable = true,
longPressAvailable = true,
upDownAvailable = true,
imageSupported = true
}
}):Pin()
ExpectRequest("VR.IsReady", true, { available = true })
ExpectRequest("TTS.IsReady", true, { available = true })
ExpectRequest("UI.IsReady", true, { available = true })
ExpectRequest("Navigation.IsReady", true, { available = true })
ExpectRequest("VehicleInfo.IsReady", true, { available = true })
self.applications = { }
ExpectRequest("BasicCommunication.UpdateAppList", false, { })
:Pin()
:Do(function(_, data)
self.applications = { }
for _, app in pairs(data.params.applications) do
self.applications[app.appName] = app.appID
end
end)
self.hmiConnection:SendNotification("BasicCommunication.OnReady")
DelayedExp(2000)
end
function Test:ConnectMobileStartSession3()
self:connectMobileStartSession()
end
function Test:RegisterAppInterface_OnScreenPresetsAvailableDefault()
--mobile side: RegisterAppInterface request
local CorIdRAI = self.mobileSession:SendRPC("RegisterAppInterface",config.application1.registerAppInterfaceParams)
--hmi side: expected BasicCommunication.OnAppRegistered
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered",
{
application =
{
appName = config.application1.registerAppInterfaceParams.appName
}
})
:Do(function(_,data)
self.applications[config.application1.registerAppInterfaceParams.appName] = data.params.application.appID
end)
--mobile side: RegisterAppInterface response
EXPECT_RESPONSE(CorIdRAI, { success = true, resultCode = "SUCCESS", presetBankCapabilities = {onScreenPresetsAvailable = true} })
:Timeout(2000)
--mobile side: expect notification
EXPECT_NOTIFICATION("OnHMIStatus", {hmiLevel = "NONE", systemContext = "MAIN", audioStreamingState = "NOT_AUDIBLE"})
end
function Test:Precondition_ActivateApp()
ActivationApp(self, self.applications[config.application1.registerAppInterfaceParams.appName], self.mobileSession)
end
for i =1, #resultCodes do
Test["Show_resultCode_" .. resultCodes[i].resultCode] = function(self)
self:show(resultCodes[i].success, resultCodes[i].resultCode)
end
end
function Test:StopSDL()
StopSDL()
end
--End Test case 03
--End Test case suite
|
--
-- ClassMods Options - crowd control panel
--
local L = LibStub("AceLocale-3.0"):GetLocale("ClassMods")
function ClassMods.Options:CreateCrowdControl()
local DB = _G.ClassMods.Options.DB
local cctable = {
maintab = {
order = 1,
type = "group",
name = L["Crowd Control"],
args = {
spacer1 = { order = 1, type = "description", name = " ", desc = "", width = "full"},
enabled = {
type = "toggle",
order = 2,
name = L["Track crowd control"],
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) ClassMods.Options:CollapseAll(); DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
updateinterval = {
type = "range",
order = 4,
name = L["Set update interval"],
desc = L["CLASSMODSUPDATEINTERVAL_DESC"],
disabled = function(info) return (not DB.crowdcontrol["enabled"] or DB.overrideinterval) end,
isPercent = false,
min = 0.01, max = 1, step = 0.01,
get = function(info) return(DB.crowdcontrol[info[#info] ]) end,
set = function(info, size) DB.crowdcontrol[info[#info] ] = (size);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
iconsize = {
type = "range",
order = 6,
name = L["Icon size"],
min = 10, max = 100, step = 1,
disabled = function(info) return (not DB.crowdcontrol.enabled) end,
get = function(info) return (DB.crowdcontrol[info[#info] ]) end,
set = function(info, size) DB.crowdcontrol[info[#info] ] = (size);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
spacer7 = { order = 7, type = "header", name = L["Enable which spells to track"] },
},
},
backdrop = {
type = "group",
order = 30,
name = L["Backdrop"],
disabled = function(info) return (not DB.crowdcontrol.enabled) end,
args = {
enablebackdrop = {
type = "toggle",
order = 1,
name = L["Enable"],
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
backdroptexture = {
type = "select",
width = "double",
dialogControl = 'LSM30_Background',
order = 2,
name = L["Backdrop texture"],
values = AceGUIWidgetLSMlists.background,
disabled = function(info) return not DB.crowdcontrol["enablebackdrop"] end,
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
colorbackdrop = {
type = "toggle",
order = 3,
name = L["Color the backdrop"],
disabled = function(info) return not DB.crowdcontrol["enablebackdrop"] end,
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
backdropcolor = {
type = "color",
order = 4,
name = L["Backdrop color"],
hasAlpha = true,
disabled = function(info) return not DB.crowdcontrol["enablebackdrop"] end,
hidden = function(info) return not DB.crowdcontrol.colorbackdrop end,
get = function(info) return unpack(DB.crowdcontrol[info[#info] ]) end,
set = function(info, r, g, b, a) DB.crowdcontrol[info[#info] ] = {r, g, b, a};ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
spacer6 = { order = 6, type = "description", name = " ", desc = "", width = "half", hidden = function(info) return not DB.crowdcontrol.colorbackdrop end },
tile = {
type = "toggle",
order = 15,
name = L["Tile the backdrop"],
disabled = function(info) return not DB.crowdcontrol["enablebackdrop"] end,
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
tilesize = {
type = "range",
order = 16,
name = L["Tile size"],
min = -100, softMin = -30, softMax = 30, max = 100, step = 1,
disabled = function(info) return not DB.crowdcontrol["enablebackdrop"] end,
hidden = function(info) return not DB.crowdcontrol.tile end,
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
spacer27 = { order = 27, type = "description", name = " ", desc = "", width = "full"},
backdropoffsets = {
type = "group",
order = 28,
name = L["Offsets"],
guiInline = true,
args = {
offsetX1 = {
type = "range",
order = 1,
name = L["Top-left X"],
min = -50, softMin = -10, softMax = 0, max = 50, step = 1,
disabled = function(info) return not DB.crowdcontrol["enablebackdrop"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][1]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][1] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
offsetY1 = {
type = "range",
order = 2,
name = L["Top-left Y"],
min = -50, softMin = 0, softMax = 10, max = 50, step = 1,
disabled = function(info) return not DB.crowdcontrol["enablebackdrop"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][2]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][2] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
spacer10 = { order = 10, type = "description", name = " ", desc = "", width = "half" },
offsetX2 = {
type = "range",
order = 13,
name = L["Bottom-right X"],
min = -50, softMin = 0, softMax = 10, max = 50, step = 1,
disabled = function(info) return not DB.crowdcontrol["enablebackdrop"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][3]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][3] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
offsetY2 = {
type = "range",
order = 14,
name = L["Bottom-right Y"],
min = -50, softMin = -10, softMax = 0, max = 50, step = 1,
disabled = function(info) return not DB.crowdcontrol["enablebackdrop"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][4]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][4] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
},
},
spacer32 = { order = 32, type = "description", name = " ", desc = "", width = "full"},
},
},
border = {
type = "group",
order = 34,
name = L["Border"],
disabled = function(info) return (not DB.crowdcontrol.enabled) end,
args = {
enableborder = {
type = "toggle",
order = 1,
name = L["Enable"],
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
bordertexture = {
type = "select",
width = "double",
dialogControl = 'LSM30_Border',
order = 2,
name = L["Border texture"],
values = AceGUIWidgetLSMlists.border,
disabled = function(info) return not DB.crowdcontrol["enableborder"] end,
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
bordercolor = {
type = "color",
order = 3,
name = L["Border color"],
hasAlpha = true,
disabled = function(info) return not DB.crowdcontrol["enableborder"] end,
get = function(info) return unpack(DB.crowdcontrol[info[#info] ]) end,
set = function(info, r, g, b, a) DB.crowdcontrol[info[#info] ] = {r, g, b, a};ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
edgesize = {
type = "range",
order = 4,
name = L["Edge size"],
min = -100, softMin = -16, softMax = 16, max = 100, step = 1,
disabled = function(info) return not DB.crowdcontrol["enableborder"] end,
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
spacer1 = { order = 7, type = "description", name = " ", desc = "", width = "full"},
backdropinsets = {
type = "group",
order = 10,
name = L["Insets"],
guiInline = true,
args = {
left = {
type = "range",
order = 1,
name = L["Left"],
min = -50, softMin = -16, softMax = 16, max = 50, step = 1,
disabled = function(info) return not DB.crowdcontrol["enableborder"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][1]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][1] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
right = {
type = "range",
order = 2,
name = L["Right"],
min = -50, softMin = -16, softMax = 16, max = 50, step = 1,
disabled = function(info) return not DB.crowdcontrol["enableborder"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][2]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][2] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
spacer10 = { order = 10, type = "description", name = " ", desc = "", width = "half" },
top = {
type = "range",
order = 13,
name = L["Top"],
min = -50, softMin = -16, softMax = 16, max = 50, step = 1,
disabled = function(info) return not DB.crowdcontrol["enableborder"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][3]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][3] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
bottom = {
type = "range",
order = 14,
name = L["Bottom"],
min = -50, softMin = -16, softMax = 16, max = 50, step = 1,
disabled = function(info) return not DB.crowdcontrol["enableborder"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][4]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][4] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
},
},
},
},
texcoords = {
type = "group",
order = 36,
name = L["Texture coords"],
disabled = function(info) return (not DB.crowdcontrol.enabled) end,
args = {
spacer1 = { order = 1, type = "description", name = " ", desc = "", width = "full" },
enabletexcoords = {
type = "toggle",
order = 4,
name = L["Enable"],
get = function(info) return DB.crowdcontrol[info[#info] ] end,
set = function(info, value) DB.crowdcontrol[info[#info] ] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
spacer8 = { order = 8, type = "description", name = " ", desc = "", width = "full" },
left = {
type = "range",
order = 11,
name = L["Left"],
min = 0, max = 1, step = .01,
disabled = function(info) return not DB.crowdcontrol["enabletexcoords"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][1]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][1] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
right = {
type = "range",
order = 12,
name = L["Right"],
min = 0, max = 1, step = .01,
disabled = function(info) return not DB.crowdcontrol["enabletexcoords"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][2]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][2] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
spacer20 = { order = 20, type = "description", name = " ", desc = "", width = "half" },
top = {
type = "range",
order = 22,
name = L["Top"],
min = 0, max = 1, step = .01,
disabled = function(info) return not DB.crowdcontrol["enabletexcoords"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][3]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][3] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
bottom = {
type = "range",
order = 24,
name = L["Bottom"],
min = 0, max = 1, step = .01,
disabled = function(info) return not DB.crowdcontrol["enabletexcoords"] end,
get = function(info) return (DB.crowdcontrol[info[#info-1] ][4]) end,
set = function(info, offset) DB.crowdcontrol[info[#info-1] ][4] = (offset);ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
},
},
},
}
for i=1,#DB.crowdcontrol.spells do
cctable.maintab.args["spell" .. i] = {
type = "toggle",
order = 6 + i,
name = select(1, GetSpellInfo(tonumber(DB.crowdcontrol.spells[i][1]))),
width = "double",
get = function(info) return DB.crowdcontrol.spells[i][2] end,
set = function(info, value) ClassMods.Options:CollapseAll(); DB.crowdcontrol.spells[i][2] = value;ClassMods.Options:LockDown(ClassMods.SetupCrowdControl) end,
}
end
return cctable
end
|
armor:register_armor("bls:shield_bls", {
description = "BlS Shield",
inventory_image = "bls_inv_shield_bls.png",
groups = {armor_shield=1000, armor_heal=100, armor_use=0, not_in_creative_inventory=1},
})
armor:register_armor("bls:shield_staff", {
description = "BlS Shield",
inventory_image = "bls_inv_shield_bls.png",
groups = {armor_shield=0, armor_heal=0, armor_use=0, not_in_creative_inventory=1},
})
|
include("shared.lua");
AddCSLuaFile("cl_init.lua");
AddCSLuaFile("shared.lua");
-- Called when the entity initializes.
function ENT:Initialize()
self:SetModel("models/props_combine/combine_interface001.mdl");
self:SetMoveType(MOVETYPE_VPHYSICS);
self:PhysicsInit(SOLID_VPHYSICS);
self:SetUseType(SIMPLE_USE);
self:SetSolid(SOLID_VPHYSICS);
end;
-- Called when the entity's transmit state should be updated.
function ENT:UpdateTransmitState()
return TRANSMIT_ALWAYS;
end;
-- Called when the entity's physics should be updated.
function ENT:PhysicsUpdate(physicsObject)
if (not self:IsPlayerHolding() and not self:IsConstrained()) then
physicsObject:SetVelocity( Vector(0, 0, 0) );
physicsObject:Sleep();
end;
end;
-- Called when a player attempts to use a tool.
function ENT:CanTool(player, trace, tool)
return false;
end;
|
minetest.registered_nodes['default:dirt'].groups.falling_node = 1
minetest.registered_nodes['default:dirt_with_grass'].groups.falling_node = 1
minetest.registered_nodes['default:dirt_with_dry_grass'].groups.falling_node = 1
minetest.registered_nodes['default:dirt_with_grass_footsteps'].groups.falling_node = 1
minetest.registered_nodes['default:dirt_with_snow'].groups.falling_node = 1
minetest.registered_nodes['default:dirt_with_rainforest_litter'].groups.falling_node = 1
minetest.registered_nodes['default:dirt_with_coniferous_litter'].groups.falling_node = 1
minetest.registered_nodes['default:dry_dirt'].groups.falling_node = 1
minetest.registered_nodes['default:dry_dirt_with_dry_grass'].groups.falling_node = 1
if minetest.get_modpath("farming") then
minetest.registered_nodes['farming:soil'].groups.falling_node = 1
minetest.registered_nodes['farming:soil_wet'].groups.falling_node = 1
end
if minetest.get_modpath("ethereal") then
minetest.registered_nodes['ethereal:bamboo_dirt'].groups.falling_node = 1
minetest.registered_nodes['ethereal:cold_dirt'].groups.falling_node = 1
minetest.registered_nodes['ethereal:crystal_dirt'].groups.falling_node = 1
minetest.registered_nodes['ethereal:dry_dirt'].groups.falling_node = 1
minetest.registered_nodes['ethereal:fiery_dirt'].groups.falling_node = 1
minetest.registered_nodes['ethereal:gray_dirt'].groups.falling_node = 1
minetest.registered_nodes['ethereal:grove_dirt'].groups.falling_node = 1
minetest.registered_nodes['ethereal:jungle_dirt'].groups.falling_node = 1
minetest.registered_nodes['ethereal:mushroom_dirt'].groups.falling_node = 1
minetest.registered_nodes['ethereal:prairie_dirt'].groups.falling_node = 1
end
|
local configuration = require "cosy.server.configuration"
local socket = require "socket"
--local iconv = require "iconv"
--local utf8 = require "utf8"
--local ssl = require "ssl"
local logger = configuration.logger
local scheduler = configuration.scheduler
local host = configuration.server.host
local port = configuration.server.port
local retries = configuration.server.retries_on_conflict
local Http = require "cosy.server.http"
local Redis = require "cosy.server.redis"
local Authentication = require "cosy.server.authentication"
local Resource = require "cosy.server.resource"
local Status = require "cosy.server.status"
local Email = require "cosy.server.email"
local Context = {}
function Context.new (context)
if context then
assert (getmetatable (context) == Context)
return setmetatable ({
_parent = context,
}, Context)
else
return setmetatable ({
skt = nil,
continue = true,
request = {
protocol = nil,
method = nil,
resource = nil,
headers = {},
parameters = {},
body = nil,
},
response = {
protocol = nil,
status = nil,
message = nil,
reason = nil,
headers = {},
body = nil,
},
onion = {
Http,
Authentication,
},
}, Context)
end
end
function Context:__index (k)
local parent = rawget (self, "_parent")
if parent then
return parent [k]
else
return nil
end
end
function Context:__newindex (k, v)
local parent = rawget (self, "_parent")
if parent and parent [k] then
parent [k] = v
else
rawset (self, k, v)
end
end
local function answer (context)
local request = context.request
local response = context.response
local redis = context.redis
local r = Resource.root (context)
for _, k in ipairs (request.resource) do
r = r / k
if not Resource.exists (r) then
error (Status.Not_Found {})
end
end
local method = r [request.method]
if not method then
error (Status.Method_Not_Allowed {})
end
local ok
for _ = 1, retries do
redis:unwatch ()
ok, response.status = pcall (method, r, context)
if ok and not response.status then
response.status = Status.OK
end
if response.status ~= Status.Conflict then
return
end
end
end
local function handler (skt)
local base_context = Context.new ()
base_context.skt = skt
while base_context.continue do
local context = Context.new (base_context)
Redis.acquire (context)
local onion = context.onion
local ok, err
local function perform (i)
local o = onion [i]
ok, err = pcall (function ()
if i > #onion then
answer (context)
else
o.request (context)
perform (i+1)
o.response (context)
end
end)
if not ok then
if type (err) == "string" then
context.error = err
Email.send (context, {
from = "Admin of ${root} <${email}>" % {
root = configuration.server.root,
email = configuration.server.admin,
},
to = "Admin of ${root} <${email}>" % {
root = configuration.server.root,
email = configuration.server.admin,
},
subject = "[CosyVerif] 500 -- Internal Server Error",
body = err,
})
err = Status.Internal_Server_Error {}
end
if o then
o.error (context, err)
else
error (err)
end
end
end
ok, err = pcall (perform, 1)
if not ok then
context.error = err
Email.send (context, {
from = "Cosy <[email protected]>",
to = "Cosy <[email protected]>",
subject = "[CosyVerif] 500 -- Internal Server Error",
body = err,
})
logger:warn ("Error:", err)
break
end
Redis.release (context)
end
end
logger:info ("Awaiting connexions on ${host}:${port}..." % {
host = host,
port = port,
})
scheduler:addserver (socket.bind (host, port), handler)
scheduler:loop ()
|
---模块功能:网络管理、信号查询、GSM网络状态查询、网络指示灯控制、临近小区信息查询
-- @module net
-- @author openLuat
-- @license MIT
-- @copyright openLuat
-- @release 2017.02.17
local base = _G
local string = require "string"
local sys = require "sys"
local ril = require "ril"
local pio = require "pio"
local sim = require "sim"
module("net")
--加载常用的全局函数至本地
local publish = sys.publish
local tonumber, tostring, print = base.tonumber, base.tostring, base.print
--GSM网络状态:
--INIT:开机初始化中的状态
--REGISTERED:注册上GSM网络
--UNREGISTER:未注册上GSM网络
local state = "INIT"
--SIM卡状态:true为异常,false或者nil为正常
local simerrsta
--lac:位置区ID
--ci:小区ID
--rssi:信号强度
local lac, ci, rssi = "", "", 0
--cellinfo:当前小区和临近小区信息表
--flymode:是否处于飞行模式
--multicellcb:获取多小区的回调函数
local cellinfo, flyMode, multicellcb = {}
--ledstate:网络指示灯状态INIT,flyMode,SIMERR,IDLE,CREG,CGATT,SCK
--INIT:功能关闭状态
--FLYMODE:飞行模式
--SIMERR:未检测到SIM卡或者SIM卡锁pin码等异常
--IDLE:未注册GSM网络
--CREG:已注册GSM网络
--CGATT:已附着GPRS数据网络
--SCK:用户socket已连接上后台
--userSocketConn:用户socket是否连接上后台
local userSocketConn, cgatt = nil
--注册标志参数,creg3:true为没注册,为false为注册成功
local creg3
--[[
函数名:checkCRSM
功能:如果注册被拒绝,运行此函数,先判断是否取得imsi号,再判断是否是中国移动卡
如果确定是中国移动卡,则进行SIM卡限制访问
参数:
返回值:
]]
local function checkCRSM()
local imsi = sim.getimsi()
if imsi and imsi ~= "" then
if string.sub(imsi, 1, 3) == "460" then
local mnc = string.sub(imsi, 4, 5)
if (mnc == "00" or mnc == "02" or mnc == "04" or mnc == "07") and creg3 then
ril.request("AT+CRSM=176,28539,0,0,12")
end
end
else
sys.timer_start(checkCRSM, 5000)
end
end
--[[
函数名:creg
功能 :解析CREG信息
参数 :data:CREG信息字符串,例如+CREG: 2、+CREG: 1,"18be","93e1"、+CREG: 5,"18a7","cb51"
返回值:无
]]
local function creg(data)
local p1, s
--获取注册状态
_, _, p1 = string.find(data, "%d,(%d)")
if p1 == nil then
_, _, p1 = string.find(data, "(%d)")
if p1 == nil then
return
end
end
creg3 = false
--已注册
if p1 == "1" or p1 == "5" then
s = "REGISTERED"
--未注册
else
if p1 == "3" then
creg3 = true
checkCRSM()
end
s = "UNREGISTER"
end
--注册状态发生了改变
if s ~= state then
--临近小区查询处理
if s == "REGISTERED" then
cengQueryPoll(60 * 1000)
else
cengQueryPoll()
end
state = s
--产生一个内部消息NET_STATE_CHANGED,表示GSM网络注册状态发生变化
publish("NET_STATE_CHANGED", s)
end
--已注册并且lac或ci发生了变化
if state == "REGISTERED" then
p2, p3 = string.match(data, "\"(%x+)\",\"(%x+)\"")
if lac ~= p2 or ci ~= p3 then
lac = p2
ci = p3
--产生一个内部消息NET_CELL_CHANGED,表示lac或ci发生了变化
publish("NET_CELL_CHANGED")
end
end
end
--[[
函数名:resetcellinfo
功能 :重置当前小区和临近小区信息表
参数 :无
返回值:无
]]
local function resetCellInfo()
local i
cellinfo.cnt = 11 --最大个数
for i = 1, cellinfo.cnt do
cellinfo[i] = {}
cellinfo[i].mcc, cellinfo[i].mnc = nil
cellinfo[i].lac = 0
cellinfo[i].ci = 0
cellinfo[i].rssi = 0
cellinfo[i].ta = 0
end
end
--[[
函数名:ceng
功能 :解析当前小区和临近小区信息
参数 :
data:当前小区和临近小区信息字符串,例如下面中的每一行:
+CENG:1,1
+CENG:0,"573,24,99,460,0,13,49234,10,0,6311,255"
+CENG:1,"579,16,460,0,5,49233,6311"
+CENG:2,"568,14,460,0,26,0,6311"
+CENG:3,"584,13,460,0,10,0,6213"
+CENG:4,"582,13,460,0,51,50146,6213"
+CENG:5,"11,26,460,0,3,52049,6311"
+CENG:6,"29,26,460,0,32,0,6311"
返回值:无
]]
local function ceng(data)
--只处理有效的CENG信息
if string.find(data, "%+CENG:%d+,\".+\"") then
local id, rssi, lac, ci, ta, mcc, mnc
id = string.match(data, "%+CENG:(%d)")
id = tonumber(id)
--第一条CENG信息和其余的格式不同
if id == 0 then
rssi, mcc, mnc, ci, lac, ta = string.match(data, "%+CENG:%d,\"%d+,(%d+),%d+,(%d+),(%d+),%d+,(%d+),%d+,%d+,(%d+),(%d+)\"")
else
rssi, mcc, mnc, ci, lac, ta = string.match(data, "%+CENG:%d,\"%d+,(%d+),(%d+),(%d+),%d+,(%d+),(%d+)\"")
end
--解析正确
if rssi and ci and lac and mcc and mnc then
--如果是第一条,清除信息表
if id == 0 then
resetCellInfo()
end
--保存mcc、mnc、lac、ci、rssi、ta
cellinfo[id + 1].mcc = mcc
cellinfo[id + 1].mnc = mnc
cellinfo[id + 1].lac = tonumber(lac)
cellinfo[id + 1].ci = tonumber(ci)
cellinfo[id + 1].rssi = (tonumber(rssi) == 99) and 0 or tonumber(rssi)
cellinfo[id + 1].ta = tonumber(ta or "0")
--产生一个内部消息CELL_INFO_IND,表示读取到了新的当前小区和临近小区信息
if id == 0 then
if multicellcb then multicellcb(cellinfo) end
publish("CELL_INFO_IND", cellinfo)
end
end
end
end
-- crsm更新计数
local crsmUpdCnt = 0
--- 更新FPLMN的应答处理
-- @string cmd ,此应答对应的AT命令
-- @bool success ,AT命令执行结果,true或者false
-- @string response ,AT命令的应答中的执行结果字符串
-- @string intermediate ,AT命令的应答中的中间信息
-- @return 无
function crsmResponse(cmd, success, response, intermediate)
print("net.crsmResponse ---->\t", success)
if success then
sys.restart("net.crsmResponse suc")
else
crsmUpdCnt = crsmUpdCnt + 1
if crsmUpdCnt >= 3 then
sys.restart("net.crsmResponse tmout")
else
ril.request("AT+CRSM=214,28539,0,0,12,\"64f01064f03064f002fffff\"", nil, crsmResponse)
end
end
end
--[[
函数名:neturc
功能 :本功能模块内“注册的底层core通过虚拟串口主动上报的通知”的处理
参数 :
data:通知的完整字符串信息
prefix:通知的前缀
返回值:无
]]
local function neturc(data, prefix)
if prefix == "+CREG" then
--收到网络状态变化时,更新一下信号值
csqQueryPoll()
--解析creg信息
creg(data)
elseif prefix == "+CENG" then
--解析ceng信息
ceng(data)
elseif prefix == "+CRSM" then
local str = string.lower(data)
if string.match(str, "64f000") or string.match(str, "64f020") or string.match(str, "64f040") or string.match(str, "64f070") then
ril.request("AT+CRSM=214,28539,0,0,12,\"64f01064f03064f002fffff\"", nil, crsmResponse)
end
end
end
--- 获取GSM网络注册状态
-- @return string ,GSM网络注册状态(INIT、REGISTERED、UNREGISTER)
-- @usage net.getState()
function getState()
return state
end
--- 获取当前小区的mcc
-- @return string ,当前小区的mcc,如果还没有注册GSM网络,则返回sim卡的mcc
-- @usage net.getMcc()
function getMcc()
return cellinfo[1].mcc or sim.getMcc()
end
--- 获取当前小区的mnc
-- @return string ,当前小区的mnc,如果还没有注册GSM网络,则返回sim卡的mnc
-- @usage net.getMnc()
function getMnc()
return cellinfo[1].mnc or sim.getMnc()
end
--- 获取当前位置区ID
-- @return string ,当前位置区ID(16进制字符串,例如"18be"),如果还没有注册GSM网络,则返回""
-- @usage net.getLac()
function getLac()
return lac
end
--- 获取当前小区ID
-- @return string ,当前小区ID(16进制字符串,例如"93e1"),如果还没有注册GSM网络,则返回""
-- @usage net.getCi()
function getCi()
return ci
end
--- 获取信号强度
-- @return number ,当前信号强度(取值范围0-31)
-- @usage net.getRssi()
function getRssi()
return rssi
end
--- 获取当前和临近小区以及信号强度的拼接字符串
-- @return string ,当前和临近小区以及信号强度的拼接字符串,例如:49234.30.49233.23.49232.18.
-- @usage net.getCell()
function getCell()
local i, ret = 1, ""
for i = 1, cellinfo.cnt do
if cellinfo[i] and cellinfo[i].lac and cellinfo[i].lac ~= 0 and cellinfo[i].ci and cellinfo[i].ci ~= 0 then
ret = ret .. cellinfo[i].ci .. "." .. cellinfo[i].rssi .. "."
end
end
return ret
end
--- 获取当前和临近位置区、小区以及信号强度的拼接字符串
-- @return string ,当前和临近位置区、小区以及信号强度的拼接字符串,例如:6311.49234.30;6311.49233.23;6322.49232.18;
-- @usage net.getCellInfo()
function getCellInfo()
local i, ret = 1, ""
for i = 1, cellinfo.cnt do
if cellinfo[i] and cellinfo[i].lac and cellinfo[i].lac ~= 0 and cellinfo[i].ci and cellinfo[i].ci ~= 0 then
ret = ret .. cellinfo[i].lac .. "." .. cellinfo[i].ci .. "." .. cellinfo[i].rssi .. ";"
end
end
return ret
end
--- 获取当前和临近位置区、小区、mcc、mnc、以及信号强度的拼接字符串
-- @return string ,当前和临近位置区、小区、mcc、mnc、以及信号强度的拼接字符串,例如:460.01.6311.49234.30;460.01.6311.49233.23;460.02.6322.49232.18;
-- @usage net.getCellInfoExt()
function getCellInfoExt()
local i, ret = 1, ""
for i = 1, cellinfo.cnt do
if cellinfo[i] and cellinfo[i].mcc and cellinfo[i].mnc and cellinfo[i].lac and cellinfo[i].lac ~= 0 and cellinfo[i].ci and cellinfo[i].ci ~= 0 then
ret = ret .. cellinfo[i].mcc .. "." .. cellinfo[i].mnc .. "." .. cellinfo[i].lac .. "." .. cellinfo[i].ci .. "." .. cellinfo[i].rssi .. ";"
end
end
return ret
end
--- 获取TA值
-- @return string ,TA值
-- @usage net.getTa()
function getTa()
return cellinfo[1].ta
end
--[[
函数名:rsp
功能 :本功能模块内“通过虚拟串口发送到底层core软件的AT命令”的应答处理
参数 :
cmd:此应答对应的AT命令
success:AT命令执行结果,true或者false
response:AT命令的应答中的执行结果字符串
intermediate:AT命令的应答中的中间信息
返回值:无
]]
local function rsp(cmd, success, response, intermediate)
local prefix = string.match(cmd, "AT(%+%u+)")
if intermediate ~= nil then
if prefix == "+CSQ" then
local s = string.match(intermediate, "+CSQ:%s*(%d+)")
if s ~= nil then
rssi = tonumber(s)
rssi = rssi == 99 and 0 or rssi
--产生一个内部消息GSM_SIGNAL_REPORT_IND,表示读取到了信号强度
publish("GSM_SIGNAL_REPORT_IND", success, rssi)
end
elseif prefix == "+CENG" then end
end
end
--- 读取“当前和临近小区信息”
-- @param cb:回调函数,当读取到小区信息后,会调用此回调函数,调用形式为cb(cells),其中cells为string类型,格式为:当前和临近位置区、小区、mcc、mnc、以及信号强度的拼接字符串,例如:460.01.6311.49234.30;460.01.6311.49233.23;460.02.6322.49232.18;
-- @return 无
function getmulticell(cb)
multicellcb = cb
--发送AT+CENG?查询
ril.request("AT+CENG?")
end
--- 查询基站信息(当前和临近小区信息)
-- @number period 查询间隔,单位毫秒
-- @return bool , true:查询成功,false:查询停止
-- @usage net.cengQueryPoll() --查询1次
-- @usage net.cengQueryPoll(60000) --每分钟查询1次
function cengQueryPoll(period)
-- 不是飞行模式 并且 工作模式为完整模式
if not flyMode and sys.getWorkMode() == sys.FULL_MODE then
if nil ~= period then
--启动定时器
sys.timer_start(cengQueryPoll, period, period)
end
--发送AT+CENG?查询
ril.request("AT+CENG?")
return true
else
print("net.cengQueryPoll is stop ---->\t,flyMode:", flyMode, ",workMOde:", sys.getWorkMode())
return false
end
end
--- 查询信号强度
-- @number period 查询间隔,单位毫秒
-- @return bool , true:查询成功,false:查询停止
-- @usage net.csqQueryPoll() --查询1次
-- @usage net.csqQueryPoll(60000) --每分钟查询1次
function csqQueryPoll(period)
--不是飞行模式 并且 工作模式为完整模式
if not flyMode and sys.getWorkMode() == sys.FULL_MODE then
if nil ~= period then
--启动定时器
sys.timer_start(csqQueryPoll, period, period)
end
--发送AT+CSQ查询
ril.request("AT+CSQ")
return true
else
print("net.csqQueryPoll is stop ---->\t,flyMode:", flyMode, ",workMOde:", sys.getWorkMode())
return false
end
end
--- 查询信号强度和基站信息(飞行模式,简单模式会返回查询失败)
-- @number ... 查询周期,参数可变,参数为nil只查询1次,参数1是信号强度查询周期,参数2是基站查询周期
-- @return bool ,true:查询成功,false:查询停止
-- @usage net.startQueryAll()
-- @usage net.startQueryAll(60000) -- 6分钟查询1次信号强度和基站信息
-- @usage net.startQueryAll(60000,600000) -- 1分钟查询1次信号强度,10分钟查询1次基站信息
function startQueryAll(...)
if not flyMode and sys.getWorkMode() == sys.FULL_MODE then
csqQueryPoll(arg[1])
cengQueryPoll(arg[2])
return true
else
print("net.startQueryAll is stop ---->\t,flyMode:", flyMode, ",workMOde:", sys.getWorkMode())
return false
end
end
--- 停止查询信号强度和基站信息
-- @return 无
-- @usage net.stopQueryAll()
function stopQueryAll()
sys.timer_stop(csqQueryPoll)
sys.timer_stop(cengQueryPoll)
end
-- 处理SIM卡状态消息,SIM卡工作不正常时更新网络状态为未注册
sys.subscribe("SIM_IND", function(para)
print("net.simInd ---->\t", simerrsta, para)
if simerrsta ~= (para ~= "RDY") then
simerrsta = (para ~= "RDY")
end
--sim卡工作不正常
if para ~= "RDY" then
--更新GSM网络状态
state = "UNREGISTER"
--产生内部消息NET_STATE_CHANGED,表示网络状态发生变化
publish("NET_STATE_CHANGED", state)
end
end)
-- 处理飞行模式切换
sys.subscribe("FLYMODE_IND", function(para)
--飞行模式状态发生变化
if flyMode ~= para then
flyMode = para
end
--退出飞行模式
if not para then
--处理查询定时器
csqQueryPoll()
cengQueryPoll()
--复位GSM网络状态
neturc("2", "+CREG")
end
end)
-- 处理工作模式切换
sys.subscribe("SYS_WORKMODE_IND", function()
cengQueryPoll()
csqQueryPoll()
end)
--注册+CREG和+CENG通知的处理函数
ril.regurc("+CREG", neturc)
ril.regurc("+CENG", neturc)
ril.regurc("+CRSM", neturc)
--注册AT+CCSQ和AT+CENG?命令的应答处理函数
ril.regrsp("+CSQ", rsp)
ril.regrsp("+CENG", rsp)
--发送AT命令
ril.request("AT+CREG=2")
ril.request("AT+CREG?")
ril.request("AT+CENG=1,1")
--重置当前小区和临近小区信息表
resetCellInfo()
|
-- Copyright 2015-2019 Sandor Balazsi <[email protected]>
-- Licensed to the public under the Apache License 2.0.
require "mcp.string"
require "mcp.table"
local config = require "mcp.config"
local socket = require "socket"
local ssl = require "ssl"
local ltn12 = require "ltn12"
local json = require "luci.json"
local nixiofs = require "nixio.fs"
local io, ipairs, table, tonumber = io, ipairs, table, tonumber
module "mcp.discogs"
local DISCOGS = "api.discogs.com"
local function receive_status(sock)
local status, err = sock:receive()
local code = socket.skip(2, status:find("HTTP/%d*%.%d* (%d%d%d)"))
return tonumber(code), status
end
local function receive_headers(sock)
local headers = {}
local line, err = sock:receive()
if err then return nil, err end
while line ~= "" do
local name, value = socket.skip(2, line:find("^(.-):%s*(.*)"))
if not (name and value) then
return nil, "malformed reponse headers"
end
headers[name:lower()] = value
line, err = sock:receive()
if err then return nil, err end
end
return headers
end
local function receive_body(sock, length)
local body = {}
local source = socket.source("by-length", sock, length)
local sink = ltn12.sink.table(body)
local step = ltn12.pump.step
ltn12.pump.all(source, sink, step)
return table.concat(body)
end
-- the socket.http lib is hardcode the "TE: trailers"
-- and "Connection: close, TE" headers to the http request.
-- discogs is using http/2 protocol that does not support these headers
local function request(host, port, uri)
local params = {
mode = "client",
protocol = "tlsv1_2",
verify = "none",
options = "all",
}
local sock = socket.tcp()
sock:connect(host, port)
sock = ssl.wrap(sock, params)
sock:dohandshake()
sock:send("GET " .. uri .. " HTTP/1.1\r\n"
.. "Host: " .. host .. "\r\n"
.. "User-Agent: mcp\r\n\r\n")
local code, status = receive_status(sock)
if code ~= 200 then return nil, status end
local headers = receive_headers(sock)
local length = tonumber(headers["content-length"])
local body = receive_body(sock, length)
return body
end
local function discogs(action, arg)
local url = "/" .. action .. table.to_qs(arg or {})
return json.decode(request(DISCOGS, 443, url))
end
-------------------------
-- P U B L I C A P I --
-------------------------
function lookup(id)
local response = {}
local album = discogs("releases/" .. id,
{ token = config.discogs_token() })
local master = discogs("masters/" .. album.master_id,
{ token = config.discogs_token() })
local artist = discogs("artists/" .. master.artists[1].id,
{ token = config.discogs_token() })
return {
id = album.id,
artist = album.artists_sort,
title = master.title,
year = master.year,
comment = "discogs:" .. album.id,
genre = master.genres[1],
tracklist = table.ifilter(album.tracklist, function(value)
return value.type_ == "track"
end),
cover = master.images[1].uri,
artist_cover = artist.images[1].uri
}
end
function search(query, track_count)
io.write("looking for \"" .. query .. "\"...")
io.flush()
for _, result in ipairs(discogs("database/search", {
q = query, type = "release",
token = config.discogs_token(),
page = 1, per_page = 25
}).results) do
io.write(".")
io.flush()
local album = lookup(tonumber(nixiofs.basename(result.uri)))
if table.getn(album.tracklist) == track_count then
io.write(" found:" .. album.id .. "\n")
return album
end
end
io.write("not found\n")
end
|
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local cmp = require("cmp")
local lspkind = require("lspkind")
cmp.setup({
sources = {
{ name = "nvim_lsp" },
{ name = "cmp_tabnine" },
{ name = "treesitter" },
{ name = "buffer" },
{ name = "path" },
{ name = "vsnip" },
-- { name = "copilot" },
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
formatting = {
format = lspkind.cmp_format({
with_text = true,
menu = {
buffer = "[Buf]",
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
treesitter = "[TS]",
cmp_tabnine = "[TN]",
vsnip = "[Snip]",
},
}),
},
mapping = {
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, {
"i",
"s",
}),
},
})
|
---@class UnityEngine.Collider : UnityEngine.Component
---@field enabled bool
---@field attachedRigidbody UnityEngine.Rigidbody
---@field isTrigger bool
---@field contactOffset float
---@field bounds UnityEngine.Bounds
---@field sharedMaterial UnityEngine.PhysicMaterial
---@field material UnityEngine.PhysicMaterial
local m = {}
---@param position UnityEngine.Vector3
---@return UnityEngine.Vector3
function m:ClosestPoint(position) end
---@param ray UnityEngine.Ray
---@param hitInfo UnityEngine.RaycastHit
---@param maxDistance float
---@return bool
function m:Raycast(ray, hitInfo, maxDistance) end
---@param position UnityEngine.Vector3
---@return UnityEngine.Vector3
function m:ClosestPointOnBounds(position) end
UnityEngine = {}
UnityEngine.Collider = m
return m |
local VECTOR3_NEW = Vector3.new
local BLANK_VECTOR3 = VECTOR3_NEW()
return function(Sunshine, entity)
local follow = entity.follow
local model = entity.model
local transform = entity.transform
local character = entity.character
if follow and model and transform and character then
Sunshine:update(function()
local player
for _, otherEntity in pairs(entity.core.scene.entities) do
if otherEntity.tag and otherEntity.tag.tag == "player" then
player = otherEntity
break
end
end
local mainCharacter = Sunshine:getEntity(player.player.character, entity.core.scene)
if not character.controllable and follow.active then
character.moveVector = BLANK_VECTOR3
local tip = transform.cFrame.Position
local direction = transform.cFrame.LookVector.Unit
local height = follow.range
local position = mainCharacter.transform.cFrame.Position
local coneDistance = (position - tip):Dot(direction)
if 0 <= coneDistance and coneDistance <= height then
local coneRadius = (coneDistance / height) * follow.radius
local orthogonalDistance = ((position - tip) - coneDistance * direction).Magnitude
if orthogonalDistance < coneRadius then
if not Sunshine:findPartOnRay(Ray.new(transform.cFrame.Position,
direction), {model.model, mainCharacter.model.model}) then
local lookDirection = mainCharacter.transform.cFrame.Position - transform.cFrame.Position
local moveVector = VECTOR3_NEW(lookDirection.X, 0, lookDirection.Z).Unit
if moveVector.Unit.Magnitude == moveVector.Unit.Magnitude then
character.moveVector = moveVector
end
end
end
end
else
character.moveVector = nil
end
end, entity)
end
end |
---------------------------------------------------------------------------------------------------
---menu_page.lua
---author: Karl
---date: 2021.5.1
---desc: implements the simple default behaviors of MenuPage objects
---------------------------------------------------------------------------------------------------
---@class MenuPage
local MenuPage = LuaClass("menu.MenuPage")
local InteractiveSelector = require("BHElib.ui.selectors.interactive_selector")
local Prefab = require("core.prefab")
---------------------------------------------------------------------------------------------------
---@param selector InteractiveSelector the selector used in this menu page
function MenuPage.__create(selector)
local self = {
selector = selector,
}
local Renderer = require("BHElib.ui.renderer_prefab")
self.renderer = Renderer(LAYER_MENU, self, "ui")
return self
end
function MenuPage:getSelector()
return self.selector
end
---@param menu_page_array MenuPageArray
function MenuPage:onCascade(menu_page_array)
end
---set the renderer object display layer of the menu page
function MenuPage:setLayer(layer)
self.renderer.layer = layer
end
function MenuPage:setRenderView(view)
self.renderer.coordinates_name = view
end
function MenuPage:getSelectableArray()
return self.selector:getSelectableArray()
end
---@param state_const number a constant indicating the state of the selector about transitioning, E.g. IN_FORWARD
function MenuPage:setTransition(state_const)
self.selector:setTransition(state_const)
end
---set the rate of increase of transition progress per frame
function MenuPage:setTransitionVelocity(transition_velocity)
self.selector:setTransitionVelocity(transition_velocity)
end
---set the rate of increase of transition progress by frames required to go from completely hidden to shown
function MenuPage:transitionInWithTime(time)
self.selector:setTransitionInWithTime(time)
end
---set the rate of increase of transition progress by frames required to go from completely shown to hidden
function MenuPage:transitionOutWithTime(time)
self.selector:setTransitionOutWithTime(time)
end
function MenuPage:resetSelection(is_selecting)
self.selector:resetSelection(is_selecting)
end
function MenuPage:isInputEnabled()
return self.selector:isInputEnabled()
end
function MenuPage:continueMenuPage()
return self.selector:continueMenu()
end
function MenuPage:update(dt)
self.selector:update(dt)
end
function MenuPage:processInput()
self.selector:processInput()
end
function MenuPage:render()
self.selector:render()
end
function MenuPage:cleanup()
Del(self.renderer)
end
function MenuPage:getChoice()
return self.selector:getChoice()
end
local MenuConst = require("BHElib.ui.menu.menu_global")
---set a menu page to entering state; can be set on an already entering menu
---@param transition_speed number a positive number indicating the rate of transition per frame
function MenuPage:setPageEnter(is_forward, transition_speed)
local selector = self.selector
selector:resetSelection(true)
if is_forward then
selector:setTransition(MenuConst.IN_FORWARD)
else
selector:setTransition(MenuConst.IN_BACKWARD)
end
selector:setTransitionVelocity(transition_speed)
end
---set a menu page to exiting state; can be set on an already exiting menu
---@param transition_speed number a positive number indicating the rate of transition per frame
function MenuPage:setPageExit(is_forward, transition_speed)
local selector = self.selector
selector:resetSelection(false)
if is_forward then
selector:setTransition(MenuConst.OUT_FORWARD)
else
selector:setTransition(MenuConst.OUT_BACKWARD)
end
selector:setTransitionVelocity(-transition_speed)
end
return MenuPage |
function GetPlayer(input)
if type(input) == "string" or type(input) == "number" then
return UserToPlayer(input)
else
return input or ConsoleCommandPlayer()
end
end
function ApplyAllPlayers(func, ...)
for id, player in ipairs(AllPlayers) do
func(player, unpack(arg))
end
end
function ApplyThePlayer(func, ...)
func(ThePlayer or GetPlayer(), unpack(arg))
end
function ApplyInfo(obj, func, proc, delim)
if type(func) ~= "function" then
func = print
end
if type(proc) ~= "function" then
proc = function (x) return x end
end
if type(delim) ~= "string" then
delim = " - "
end
for k,v in pairs(proc(obj)) do
func(tostring(k)..delim..tostring(v))
end
end
function ApplyPairInfo(obj, func, delim)
ApplyInfo(obj, func, nil, delim)
end
function ApplyTableInfo(obj, func, delim)
ApplyInfo(obj, func, getmetatable, delim)
end
function ApplyDebugInfo(obj, func, delim)
ApplyInfo(obj, func, debug.getinfo, delim)
end
-- Some helper shortcut functions
function x_freecrafting(inst, mode)
local player = GetPlayer(inst)
if player ~= nil and player.components.builder ~= nil then
SuUsed("x_freecrafting", true)
if type(mode) == "boolean" then
player.components.builder.freebuildmode = mode
player:PushEvent("unlockrecipe")
else
player.components.builder:GiveAllRecipes()
end
player:PushEvent("techlevelchange")
end
end
function x_unlockrecipe(inst, prefab)
local player = GetPlayer(inst)
if player ~= nil and player.components.builder ~= nil then
SuUsed("x_unlockrecipe", true)
if type(prefab) == "string" then
player.components.builder:UnlockRecipe(prefab)
player:PushEvent("techlevelchange")
end
end
end
function x_setinvincible(inst, mode)
local player = GetPlayer(inst)
if player ~= nil and player.components.health ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setinvincible", true)
if type(mode) ~= "boolean" then
mode = not player.components.health:IsInvincible()
end
player.components.health:SetInvincible(mode)
end
end
function x_setabsorption(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.health ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setabsorption", true)
if type(num) ~= "number" then
num = 1
end
player.components.health:SetAbsorptionAmount(num)
end
end
function x_kill(inst)
local player = GetPlayer(inst)
if player ~= nil and player.components.health ~= nil and not player:HasTag("playerghost") then
SuUsed("x_kill", true)
player:PushEvent("death")
print("Killing "..player.name..".")
end
end
function x_revive(inst)
local player = GetPlayer(inst)
if player ~= nil and player.components.health ~= nil then
SuUsed("x_revive", true)
if player:HasTag("playerghost") then
player:PushEvent("respawnfromghost")
print("Reviving "..player.name.." from ghost.")
elseif player:HasTag("corpse") then
player:PushEvent("respawnfromcorpse")
print("Reviving "..player.name.." from corpse.")
end
end
end
function x_sethealth(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.health ~= nil and not player:HasTag("playerghost") then
SuUsed("x_sethealth", true)
if type(num) ~= "number" then
num = 1
end
player.components.health:SetPercent(num)
end
end
function x_setmaxhealth(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.health ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setmaxhealth", true)
if type(num) ~= "number" then
num = 100
end
player.components.health:SetMaxHealth(num)
player.components.health:SetPercent(1)
end
end
function x_setminhealth(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.health ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setminhealth", true)
if type(num) ~= "number" then
num = 0
end
player.components.health:SetMinHealth(num)
end
end
function x_setpenalty(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.health ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setpenalty", true)
if type(num) ~= "number" then
num = 0
end
player.components.health:SetPenalty(num)
player.components.health:SetPercent(1)
end
end
function x_setsanity(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.sanity ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setsanity", true)
if type(num) ~= "number" then
num = 1
end
player.components.sanity:SetPercent(num)
end
end
function x_setmaxsanity(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.sanity ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setmaxsanity", true)
if type(num) ~= "number" then
num = 100
end
player.components.sanity:SetMax(num)
player.components.sanity:SetPercent(1)
end
end
function x_sethunger(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.hunger ~= nil and not player:HasTag("playerghost") then
SuUsed("x_sethunger", true)
if type(num) ~= "number" then
num = 1
end
player.components.hunger:SetPercent(num)
end
end
function x_setmaxhunger(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.hunger ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setmaxhunger", true)
if type(num) ~= "number" then
num = 100
end
player.components.hunger:SetMax(num)
player.components.hunger:SetPercent(1)
end
end
function x_pausehunger(inst, mode)
local player = GetPlayer(inst)
if player ~= nil and player.components.hunger ~= nil and not player:HasTag("playerghost") then
SuUsed("x_pausehunger", true)
if type(mode) ~= "boolean" then
mode = player.components.health:IsPaused()
end
player.components.hunger.burning = not mode
end
end
function x_setbeaverness(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.beaverness ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setbeaverness", true)
if type(num) ~= "number" then
num = 1
end
player.components.beaverness:SetPercent(num)
end
end
function x_setmoisture(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.moisture ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setmoisture", true)
if type(num) ~= "number" then
num = 0
end
player.components.moisture:SetPercent(num)
end
end
function x_setmoisturelevel(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.moisture ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setmoisturelevel", true)
if type(num) ~= "number" then
num = 0
end
player.components.moisture:SetMoistureLevel(num)
end
end
function x_settemperature(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.temperature ~= nil and not player:HasTag("playerghost") then
SuUsed("x_settemperature", true)
if type(num) ~= "number" then
num = 25
end
player.components.temperature:SetTemperature(num)
end
end
function x_pausetemperature(inst, mode)
local player = GetPlayer(inst)
if player ~= nil and player.components.temperature ~= nil and not player:HasTag("playerghost") then
SuUsed("x_pausetemperature", true)
if type(mode) ~= "boolean" then
mode = player.components.temperature.settemp == nil
end
local t = mode and player.components.temperature:GetCurrent() or nil
player.components.temperature:SetTemp(player.components.temperature:GetCurrent())
end
end
function x_setbuff(inst)
local player = GetPlayer(inst)
if player ~= nil and not player:HasTag("playerghost") then
SuUsed("x_setbuff", true)
local num = 500
if player.components.health ~= nil then
player.components.health:SetMaxHealth(num)
player.components.health:SetPercent(1)
end
if player.components.sanity ~= nil then
player.components.sanity:SetMax(num)
player.components.sanity:SetPercent(1)
end
if player.components.hunger ~= nil then
player.components.hunger:SetMax(num)
player.components.hunger:SetPercent(1)
end
end
end
function x_godmode(inst, mode)
local player = GetPlayer(inst)
if player ~= nil then
SuUsed("x_godmode", true)
if player:HasTag("playerghost") then
player:PushEvent("respawnfromghost")
print("Reviving "..player.name.." from ghost.")
return
elseif player:HasTag("corpse") then
player:PushEvent("respawnfromcorpse")
print("Reviving "..player.name.." from corpse.")
return
elseif player.components.health ~= nil then
if type(mode) ~= "boolean" then
mode = not player.components.health:IsInvincible()
end
player.components.health:SetInvincible(mode)
end
end
end
function x_supergodmode(inst, mode)
local player = GetPlayer(inst)
if player ~= nil then
SuUsed("x_supergodmode", true)
if player:HasTag("playerghost") then
player:PushEvent("respawnfromghost")
print("Reviving "..player.name.." from ghost.")
return
elseif player.components.health ~= nil then
if type(mode) ~= "boolean" then
mode = not player.components.health:IsInvincible()
end
player.components.health:SetInvincible(mode)
c_sethealth(1)
c_setsanity(1)
c_sethunger(1)
c_settemperature(25)
c_setmoisture(0)
end
end
end
function x_hypergodmode(inst)
local player = GetPlayer(inst)
if player ~= nil then
SuUsed("x_hypergodmode", true)
local num = 1500
if player:HasTag("playerghost") then
player:PushEvent("respawnfromghost")
print("Reviving "..player.name.." from ghost.")
elseif player:HasTag("corpse") then
player:PushEvent("respawnfromcorpse")
print("Reviving "..player.name.." from corpse.")
end
if player.components.health ~= nil then
player.components.health:SetInvincible(true)
player.components.health:SetMaxHealth(num)
player.components.health:SetPercent(1)
end
if player.components.sanity ~= nil then
player.components.sanity:SetMax(num)
player.components.sanity:SetPercent(1)
end
if player.components.hunger ~= nil then
player.components.hunger:SetMax(num)
player.components.hunger:SetPercent(1)
end
if player.components.moisture ~= nil then
player.components.moisture:SetMoistureLevel(0)
end
if player.components.temperature ~= nil then
player.components.temperature:SetTemperature(30)
end
end
end
function x_speedmult(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.locomotor ~= nil then
SuUsed("x_speedmult", true)
if type(num) ~= "number" then
num = 1
end
player.components.locomotor:SetExternalSpeedMultiplier(player, "c_speedmult", num)
end
end
-- Put an item(s) in the player's inventory
function x_give(inst, prefab, count, dontselect)
local player = GetPlayer(inst)
if player ~= nil and player.components.inventory ~= nil then
for i = 1, count or 1 do
local item = DebugSpawn(prefab)
if item ~= nil then
print("giving ", item)
player.components.inventory:GiveItem(item)
if not dontselect then
SetDebugEntity(item)
end
SuUsed("x_give_"..item.prefab)
end
end
end
end
function x_removeslot(inst, num)
local player = GetPlayer(inst)
if player ~= nil and player.components.inventory ~= nil then
SuUsed("x_removeslot", true)
player.components.inventory:RemoveItemBySlot(num)
end
end
function x_dropeverything(inst)
local player = GetPlayer(inst)
if player ~= nil and player.components.inventory ~= nil then
SuUsed("x_dropeverything", true)
player.components.inventory:DropEverything()
end
end
-- move inst or current player to dest
function x_goto(dest, inst)
dest = GetPlayer(dest)
inst = GetPlayer(inst)
if inst ~= nil then
SuUsed("x_goto", true)
if dest ~= nil then
if inst.Physics ~= nil then
inst.Physics:Teleport(dest.Transform:GetWorldPosition())
else
inst.Transform:SetPosition(dest.Transform:GetWorldPosition())
end
return dest
else
inst.Transform:SetPosition(ConsoleWorldPosition():Get())
end
end
end
-- move inst to dest or current player
function x_move(inst, dest)
dest = GetPlayer(dest)
inst = GetPlayer(inst)
if inst ~= nil then
SuUsed("x_move", true)
if dest ~= nil then
if inst.Physics ~= nil then
inst.Physics:Teleport(dest.Transform:GetWorldPosition())
else
inst.Transform:SetPosition(dest.Transform:GetWorldPosition())
end
return dest
else
inst.Transform:SetPosition(ConsoleWorldPosition():Get())
end
end
end
function x_revealmap(inst, num, int)
local player = GetPlayer(inst)
if player ~= nil then
SuUsed("x_revealmap", true)
if type(num) ~= "number" then
num = 1600
end
if type(int) ~= "number" then
int = 35
end
for x = -num, num, int do
for y = -num, num, int do
player.player_classified.MapExplorer:RevealArea(x, 0, y)
end
end
end
end
-- World Commands
function x_nextcycle(count)
SuUsed("x_nextcycle", true)
for i = 1, count or 1 do
TheWorld:PushEvent("ms_nextcycle")
end
end
function x_nextphase(count)
SuUsed("x_nextphase", true)
for i = 1, count or 1 do
TheWorld:PushEvent("ms_nextphase")
end
end
function x_setphase(phase)
SuUsed("x_setphase", true)
if type(phase) == "number" then
if phase == 1 then phase = "day"
elseif phase == 2 then phase = "dusk"
elseif phase == 3 then phase = "night"
end
end
TheWorld:PushEvent("ms_setphase", phase)
end
function x_setseason(season)
SuUsed("x_setseason", true)
if type(season) == "number" then
if season == 1 then season = "autumn"
elseif season == 2 then season = "winter"
elseif season == 3 then season = "spring"
elseif season == 4 then season = "summer"
end
end
TheWorld:PushEvent("ms_setseason", season)
end
function x_setrain(mode)
SuUsed("x_setrain", true)
TheWorld:PushEvent("ms_forceprecipitation", mode)
end
|
math.randomseed(os.time())
-- Define some constants
pi = 3.14156535
gameWidth = 800;
gameHeight = 600;
paddleSize = sfVector2f.new(25, 100);
ballRadius = 10;
colorWhite = sfColor.new(255, 255, 255)
colorBlack = sfColor.new( 0, 0, 0)
colorLeft = sfColor.new(100, 100, 200)
colorRight = sfColor.new(200, 100, 100)
-- Create the window of the application
window = sfRenderWindow.new(sfVideoMode.new(gameWidth, gameHeight,32), "SFML Lua Pong",sfWindowStyle.Default);
window:setVerticalSyncEnabled(true);
-- Create the left paddle
leftPaddle = sfRectangleShape.new(paddleSize - sfVector2f.new(3, 3));
leftPaddle:setOutlineThickness(3);
leftPaddle:setOutlineColor(colorBlack);
leftPaddle:setFillColor(colorLeft);
leftPaddle:setOrigin(paddleSize / 2);
-- Create the right paddle
rightPaddle = sfRectangleShape.new(paddleSize - sfVector2f.new(3, 3));
rightPaddle:setOutlineThickness(3);
rightPaddle:setOutlineColor(colorBlack);
rightPaddle:setFillColor(colorRight);
rightPaddle:setOrigin(paddleSize / 2);
-- Create the ball
ball = sfCircleShape.new(ballRadius - 3);
ball:setOutlineThickness(3);
ball:setOutlineColor(colorBlack);
ball:setFillColor(colorWhite);
ball:setOrigin(ballRadius/2,ballRadius/2);
-- Load the text font
font = sfFont.new() ;
font:loadFromFile("sansation.ttf")
-- Initialize the pause message
pauseMessage = sfText.new("",font,40);
pauseMessage:setPosition(170, 150);
pauseMessage:setColor(colorWhite);
pauseMessage:setString("Welcome to SFML pong!\nPress space to start the game");
-- Define the paddles properties
AITimer = sfClock.new();
AITime = sfTime.seconds(0.1);
paddleSpeed = 400;
rightPaddleSpeed = 0;
ballSpeed = 400;
ballAngle = 0
clock = sfClock.new()
isPlaying = false;
event = sfEvent.new()
while window:isOpen() do
-- Handle events
while window:pollEvent(event) do
if(event:type() == sfEventType.Closed) then window:close(); break; end
if(event:type() == sfEventType.KeyReleased and event:key():code() == sfKey.Escape ) then window:close(); break; end
if(event:type() == sfEventType.KeyReleased and event:key():code() == sfKey.Q and event:key():system() == true ) then window:close(); break; end
-- Space key pressed: play
if(event:type() == sfEventType.KeyPressed and event:key():code() == sfKey.Space ) then
if not isPlaying then
-- (re)start the game
isPlaying = true;
clock:restart();
-- Reset the position of the paddles and ball
leftPaddle:setPosition(10 + paddleSize:x() / 2, gameHeight / 2);
rightPaddle:setPosition(gameWidth - 10 - paddleSize:x() / 2, gameHeight / 2);
ball:setPosition(gameWidth / 2, gameHeight / 2)
-- Reset the ball angle
repeat
-- Make sure the ball initial angle is not too much vertical
ballAngle = math.rad(math.random(360));
until (math.abs(math.cos(ballAngle)) > 0.7);
end
end
end
if isPlaying then
deltaTime = clock:restart():asSeconds();
-- Move the player's paddle
if sfKeyboard.isKeyPressed(sfKey.Up) and (leftPaddle:getPosition():y() - paddleSize:y() / 2 > 5) then
leftPaddle:move(0, -paddleSpeed * deltaTime);
end
if sfKeyboard.isKeyPressed(sfKey.Down) and (leftPaddle:getPosition():y() + paddleSize:y() / 2 < gameHeight - 5) then
leftPaddle:move(0, paddleSpeed * deltaTime)
end
-- Move the computer's paddle
if (((rightPaddleSpeed < 0 ) and (rightPaddle:getPosition():y() - paddleSize:y() / 2 > 5)) or
((rightPaddleSpeed > 0) and (rightPaddle:getPosition():y() + paddleSize:y() / 2 < gameHeight - 5))) then
rightPaddle:move(0, rightPaddleSpeed * deltaTime)
end
-- Update the computer's paddle direction according to the ball position
if (AITimer:getElapsedTime() > AITime) then
AITimer:restart()
if (ball:getPosition():y() + ballRadius > rightPaddle:getPosition():y() + paddleSize:y() / 2) then
rightPaddleSpeed = paddleSpeed;
elseif (ball:getPosition():y() - ballRadius < rightPaddle:getPosition():y() - paddleSize:y() / 2) then
rightPaddleSpeed = -paddleSpeed;
else
rightPaddleSpeed = 0 ;
end
end
-- Move the ball
factor = ballSpeed * deltaTime;
ball:move(math.cos(ballAngle) * factor , math.sin(ballAngle) * factor)
-- Check collisions between the ball and the screen
if (ball:getPosition():x() - ballRadius < 0) then
isPlaying = false;
pauseMessage:setString("You lost !\nPress space to restart or\nescape to exit");
end
if (ball:getPosition():x() + ballRadius > gameWidth) then
isPlaying = false
pauseMessage:setString("You won !\nPress space to restart or\nescape to exit");
end
if (ball:getPosition():y() - ballRadius < 0) then
ballAngle = -ballAngle;
ball:setPosition(ball:getPosition():x(), ballRadius + 0.1)
end
if (ball:getPosition():y() + ballRadius > gameHeight) then
ballAngle = -ballAngle;
ball:setPosition(ball:getPosition():x(), gameHeight - ballRadius - 0.1)
end
-- Check the collisions between the ball and the paddles
-- Left Paddle
if (ball:getPosition():x() - ballRadius < leftPaddle:getPosition():x() + paddleSize:x() / 2 and
ball:getPosition():x() - ballRadius > leftPaddle:getPosition():x() and
ball:getPosition():y() + ballRadius >= leftPaddle:getPosition():y() - paddleSize:y() / 2 and
ball:getPosition():y() - ballRadius <= leftPaddle:getPosition():y() + paddleSize:y() / 2) then
if (ball:getPosition():y() > leftPaddle:getPosition():y()) then
ballAngle = pi - ballAngle + math.rad(math.random(20));
else
ballAngle = pi - ballAngle - math.rad(math.random(20));
end
ball:setPosition(leftPaddle:getPosition():x() + ballRadius + paddleSize:x() / 2 + 0.1, ball:getPosition():y())
end
-- Right Paddle
if (ball:getPosition():x() + ballRadius > rightPaddle:getPosition():x() - paddleSize:x() / 2 and
ball:getPosition():x() + ballRadius < rightPaddle:getPosition():x() and
ball:getPosition():y() + ballRadius >= rightPaddle:getPosition():y() - paddleSize:y() / 2 and
ball:getPosition():y() - ballRadius <= rightPaddle:getPosition():y() + paddleSize:y() / 2) then
if (ball:getPosition():y() > rightPaddle:getPosition():y()) then
ballAngle = pi - ballAngle --+ (std::rand() % 20) * pi / 180;
else
ballAngle = pi - ballAngle --- (std::rand() % 20) * pi / 180;
end
ball:setPosition(rightPaddle:getPosition():x() - ballRadius - paddleSize:x() / 2 - 0.1, ball:getPosition():y())
end
end
-- Clear the window
window:clear(colorBlack);
if (isPlaying) then
-- Draw the paddles and the ball
window:draw(leftPaddle);
window:draw(rightPaddle);
window:draw(ball);
else
-- Draw the pause message
window:draw(pauseMessage);
end
-- Display things on screen
window:display()
end
|
local test = require('gambiarra')
local count = 0
local failed = 0
test(function(state, testname, msg)
if state == 'begin' then
count = count + 1
elseif state == 'pass' then
io.write(string.format('ok %d - %s\n', count, testname))
elseif state == 'fail' or state == 'except' then
failed = failed + 1
io.write(string.format('not ok %d - %s (%s) - %s\n', count, testname, state, msg))
end
end)
test('First test', function()
ok(1 == 1, 'One should be equal one')
end)
test('Second test', function()
ok(2 == 2, 'Two should be equal two')
end)
io.write('1..' .. count .. '\n')
if failed == 0 then os.exit(0) else os.exit(1) end |
object_tangible_loot_loot_schematic_sword_lightsaber_one_hand_gen5 = object_tangible_loot_loot_schematic_shared_sword_lightsaber_one_hand_gen5:new {
templateType = LOOTSCHEMATIC,
objectMenuComponent = "LootSchematicMenuComponent",
attributeListComponent = "LootSchematicAttributeListComponent",
requiredSkill = { "force_discipline_light_saber_master",
"combat_jedi_novice" },
targetDraftSchematic = "object/draft_schematic/weapon/lightsaber/lightsaber_one_hand_gen5.iff",
targetUseCount = 1,
}
ObjectTemplates: addTemplate(object_tangible_loot_loot_schematic_sword_lightsaber_one_hand_gen5, "object/tangible/loot/loot_schematic/sword_lightsaber_one_hand_gen5.iff")
|
#!/usr/bin/env lua
-- MoonUSB example: malloc.lua
local usb = require("moonusb")
usb.trace_objects(true) -- trace creation/deletion of objects
local ctx = usb.init()
-- We need a device to try out dma memory allocation, so replace these values
-- with those from one of your devices:
local vendor_id, product_id = 0x046d, 0xc534
local device, devhandle = ctx:open_device(vendor_id, product_id)
local mem1 = usb.malloc(nil, 256) -- this allocates normal host memory
local mem2 = usb.malloc(devhandle, 256) -- this attempts to allocate dma memory
print("1 - closing the device")
devhandle:close() -- mem2 is released with the devhandle closure
print("2 - exiting")
-- mem1 is automatically released at exit, unless one calls mem1:free() on it
|
--------------------------------------------------------------------------------------------
---acc_controller.lua
---author: Karl
---date created: <2021
---desc: Defines a kind of object that manages the acceleration of bullets (and units in
--- general)
--------------------------------------------------------------------------------------------
---@class AccController
local M = LuaClass("AccController")
--------------------------------------------------------------------------------------------
---cache variables and functions
local select = select
local unpack = unpack
--------------------------------------------------------------------------------------------
---init
function M.__create(start_v)
-- Construct an M object
-- Input
-- start_v (float) - starting speed
start_v = start_v or 0
local self = {}
self.n=1
self.start_v = start_v
self.end_v = start_v
self.total_length = 0
self.time_array = {0, math.huge}
self.coeff_array = {} -- A quadratic list that specifies an equation l(t) t that calculates the distance at i-th segment
return self
end
function M.shortInit(...)
local acc_con = M(select(1, ...))
local n = select("#", ...)
for i = 3, n, 2 do
acc_con:accTo(select(i - 1, ...), select(i, ...))
end
return acc_con
end
--------------------------------------------------------------------------------------------
---getters and modifiers
---@param acc_time number
---@param final_speed number
function M:accTo(acc_time, final_speed)
if acc_time == nil then
error("ExpressionAccController: The value of time entered is nil.")
elseif final_speed == nil then
error("ExpressionAccController: The value of velocity entered is nil.")
end
if acc_time < 0 then
error("ExpressionAccController: The value of time entered is negative.")
end
local n, total_length, total_time, last_v = self.n, self.total_length, self.time_array[self.n], self.end_v
self.end_v = final_speed
self.total_length = total_length + (last_v + final_speed) * 0.5 * acc_time
self.time_array[n + 1] = total_time + acc_time
self.time_array[n + 2] = math.huge
self.n = n + 1
if acc_time == 0 then
self.coeff_array[n] = {0, 0, total_length}
return
end
local a = (final_speed - last_v) * 0.5 / acc_time
local b = last_v - 2 * a * total_time
local c = total_length - a * total_time ^ 2 - b * total_time
self.coeff_array[n] = {a, b, c}
end
function M:getDistance(t)
local i, tList = 1, self.time_array
while t > tList[i] do
i = i + 1
end
if i == 1 then
return t * self.start_v
end
local n = self.n
if i == n + 1 then
return self.total_length + (t - tList[n]) * self.end_v
end
local coeff_array = self.coeff_array[i - 1]
return t * (t * coeff_array[1] + coeff_array[2]) + coeff_array[3] -- Evaluate the quadratic function
end
function M:getSpeed(t)
local i, tList = 1, self.time_array
while t > tList[i] do
i = i + 1
end
if i == 1 then
return self.start_v
elseif i == self.n + 1 then
return self.end_v
end
local coeff_array = self.coeff_array[i - 1]
return 2 * t * coeff_array[1] + coeff_array[2] -- Differenciate the quadratic function
end
--------------------------------------------------------------------------------------------
---copy
function M:copy()
local obj = M(self[1])
obj.n=self.n
obj.start_v = self.start_v
obj.end_v = self.end_v
obj.total_length = self.total_length
for i = 1,self.n do
obj.time_array[i] = self.time_array[i]
if i < self.n then
obj.coeff_array[i] = {unpack(self.coeff_array[i])}
end
end
return obj
end
return M |
local term = require 'FTerm.terminal'
local gitui = term:new()
gitui:setup({
cmd = "gitui",
dimensions = {
height = 0.9,
width = 0.9
}
})
function _G.__fterm_gitui() -- Use this to toggle gitui in a floating terminal
gitui:toggle()
end
|
--[[
GD50 2018
Pong Remake
-- Ball Class --
Author: Colton Ogden
[email protected]
Represents a ball which will bounce back and forth between paddles
and walls until it passes a left or right boundary of the screen,
scoring a point for the opponent.
]]
Ball = Class{}
function Ball:init(x, y, width, height)
self.x = x
self.y = y
self.width = width
self.height = height
-- these variables are for keeping track of our velocity on both the
-- X and Y axis, since the ball can move in two dimensions
self.dy = math.random(2) == 1 and -100 or 100
self.dx = math.random(-50, 50)
end
--[[
Places the ball in the middle of the screen, with an initial random velocity
on both axes.
]]
function Ball:reset()
self.x = VIRTUAL_WIDTH / 2 - 2
self.y = VIRTUAL_HEIGHT / 2 - 2
self.dy = math.random(2) == 1 and -100 or 100
self.dx = math.random(-50, 50)
end
--[[
Simply applies velocity to position, scaled by deltaTime.
]]
function Ball:update(dt)
self.x = self.x + self.dx * dt
self.y = self.y + self.dy * dt
end
function Ball:render()
love.graphics.rectangle('fill', self.x, self.y, self.width, self.height)
end |
--[[ ============================================================================================================
Author: Rook - Modified LearningDave
Date: October, 10th 2015
Called when a Shin Guards is acquired. Grants the melee block modifier if the caster is a melee hero and the
range block modifer if the caster is a range hero.
================================================================================================================= ]]
function modifier_item_shin_guards_datadriven_on_created(
keys)
if not keys.caster:IsRangedAttacker() then
keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_item_shin_guards_block", {
duration = -1
})
else
keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_item_shin_guards_block_range", {
duration = -1
})
end
end
--[[ ============================================================================================================
Author: Rook - Modified LearningDave
Date: October, 10th 2015
Called when a Shin guards is removed from the caster's inventory. Removes the block modifier.
================================================================================================================= ]]
function modifier_item_shin_guards_datadriven_on_destroy(keys)
if not keys.caster:IsRangedAttacker() then
keys.caster:RemoveModifierByName("modifier_item_shin_guards_block")
else
keys.caster:RemoveModifierByName("modifier_item_shin_guards_block_range")
end
end
--[[ ============================================================================================================
Author: Rook
Date: February 2, 2015
Called regularly while the caster has a Battle Fury in their inventory. If the caster has switched from ranged
to melee, give them cleave modifier(s).
================================================================================================================= ]]
function modifier_item_shin_guards_datadriven_on_interval_think(keys)
if not keys.caster:IsRangedAttacker() and not keys.caster:HasModifier("modifier_item_shin_guards_block") then
for i = 0, 5, 1 do
local current_item = keys.caster:GetItemInSlot(i)
if current_item ~= nil then
if current_item:GetName() == "item_shin_guards" then
keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_item_shin_guards_block", {
duration = -1
})
end
if keys.caster:HasModifier("modifier_item_shin_guards_block_range") then
keys.caster:RemoveModifierByName("modifier_item_shin_guards_block_range")
end
end
end
end
if keys.caster:IsRangedAttacker() and not keys.caster:HasModifier("modifier_item_shin_guards_block_range") then
for i = 0, 5, 1 do
local current_item = keys.caster:GetItemInSlot(i)
if current_item ~= nil then
if current_item:GetName() == "item_shin_guards" then
keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster,
"modifier_item_shin_guards_block_range", {
duration = -1
})
end
if keys.caster:HasModifier("modifier_item_shin_guards_block") then
keys.caster:RemoveModifierByName("modifier_item_shin_guards_block")
end
end
end
end
end
--[[ ============================================================================================================
Author: Rook
Date: February 2, 2015
Called regularly while the caster has at least one cleave modifier from Battle Fury. If the caster is no longer
melee (which would be the case on, for example, Troll Warlord), remove the cleave modifiers from the caster.
================================================================================================================= ]]
function modifier_item_shin_guards_block_on_interval_think(keys)
if keys.caster:IsRangedAttacker() then
while keys.caster:HasModifier("modifier_item_shin_guards_block") do
keys.caster:RemoveModifierByName("modifier_item_shin_guards_block")
end
else
while keys.caster:HasModifier("modifier_item_shin_guards_block_range") do
keys.caster:RemoveModifierByName("modifier_item_shin_guards_block_range")
end
end
end
|
if not modules then modules = { } end modules ['node-ini'] = {
version = 1.001,
comment = "companion to node-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
--[[ldx--
<p>Most of the code that had accumulated here is now separated in
modules.</p>
--ldx]]--
-- this module is being reconstructed
--
-- todo: datatype table per node type
-- todo: query names with new node.subtypes
local next, type, tostring = next, type, tostring
local gsub = string.gsub
local concat, remove = table.concat, table.remove
local sortedhash, sortedkeys, swapped = table.sortedhash, table.sortedkeys, table.swapped
--[[ldx--
<p>Access to nodes is what gives <l n='luatex'/> its power. Here we
implement a few helper functions. These functions are rather optimized.</p>
--ldx]]--
--[[ldx--
<p>When manipulating node lists in <l n='context'/>, we will remove
nodes and insert new ones. While node access was implemented, we did
quite some experiments in order to find out if manipulating nodes
in <l n='lua'/> was feasible from the perspective of performance.</p>
<p>First of all, we noticed that the bottleneck is more with excessive
callbacks (some gets called very often) and the conversion from and to
<l n='tex'/>'s datastructures. However, at the <l n='lua'/> end, we
found that inserting and deleting nodes in a table could become a
bottleneck.</p>
<p>This resulted in two special situations in passing nodes back to
<l n='tex'/>: a table entry with value <type>false</type> is ignored,
and when instead of a table <type>true</type> is returned, the
original table is used.</p>
<p>Insertion is handled (at least in <l n='context'/> as follows. When
we need to insert a node at a certain position, we change the node at
that position by a dummy node, tagged <type>inline</type> which itself
has_attribute the original node and one or more new nodes. Before we pass
back the list we collapse the list. Of course collapsing could be built
into the <l n='tex'/> engine, but this is a not so natural extension.</p>
<p>When we collapse (something that we only do when really needed), we
also ignore the empty nodes. [This is obsolete!]</p>
--ldx]]--
-- local gf = node.direct.getfield
-- local n = table.setmetatableindex("number")
-- function node.direct.getfield(a,b) n[b] = n[b] + 1 print(b,n[b]) return gf(a,b) end
nodes = nodes or { }
local nodes = nodes
nodes.handlers = nodes.handlers or { }
local mark = utilities.storage.mark
local allocate = utilities.storage.allocate
local formatcolumns = utilities.formatters.formatcolumns
local getsubtypes = node.subtypes
local getvalues = node.values
-- local listcodes = allocate {
-- [0] = "unknown",
-- [1] = "line",
-- [2] = "box",
-- [3] = "indent",
-- [4] = "alignment", -- row or column
-- [5] = "cell",
-- [6] = "equation",
-- [7] = "equationnumber",
-- }
local listcodes = mark(getsubtypes("list"))
-- local rulecodes = allocate {
-- [0] = "normal",
-- [1] = "box",
-- [2] = "image",
-- [3] = "empty",
-- [4] = "user",
-- }
local rulecodes = mark(getsubtypes("rule"))
if not rulecodes[5] then
rulecodes[5] = "over"
rulecodes[6] = "under"
rulecodes[7] = "fraction"
rulecodes[8] = "radical"
end
-- local dircodes = mark(getsubtypes("dir"))
dircodes = allocate {
[0] = "normal",
[1] = "cancel",
}
-- local glyphcodes = allocate {
-- [0] = "character",
-- [1] = "glyph",
-- [2] = "ligature",
-- [3] = "ghost",
-- [4] = "left",
-- [5] = "right",
-- }
local glyphcodes = mark(getsubtypes("glyph"))
-- local disccodes = allocate {
-- [0] = "discretionary", -- \discretionary
-- [1] = "explicit", -- \-
-- [2] = "automatic", -- following a -
-- [3] = "regular", -- by hyphenator: simple
-- [4] = "first", -- by hyphenator: hard first item
-- [5] = "second", -- by hyphenator: hard second item
-- }
local disccodes = mark(getsubtypes("disc"))
-- local gluecodes = allocate {
-- [ 0] = "userskip",
-- [ 1] = "lineskip",
-- [ 2] = "baselineskip",
-- [ 3] = "parskip",
-- [ 4] = "abovedisplayskip",
-- [ 5] = "belowdisplayskip",
-- [ 6] = "abovedisplayshortskip",
-- [ 7] = "belowdisplayshortskip",
-- [ 8] = "leftskip",
-- [ 9] = "rightskip",
-- [ 10] = "topskip",
-- [ 11] = "splittopskip",
-- [ 12] = "tabskip",
-- [ 13] = "spaceskip",
-- [ 14] = "xspaceskip",
-- [ 15] = "parfillskip",
-- [ 16] = "mathskip", -- experiment
-- [ 17] = "thinmuskip",
-- [ 18] = "medmuskip",
-- [ 19] = "thickmuskip",
-- [ 98] = "conditionalmathglue",
-- [ 99] = "muskip",
-- [100] = "leaders",
-- [101] = "cleaders",
-- [102] = "xleaders",
-- [103] = "gleaders",
-- }
local gluecodes = mark(getsubtypes("glue"))
-- local leadercodes = allocate {
-- [100] = "leaders",
-- [101] = "cleaders",
-- [102] = "xleaders",
-- [103] = "gleaders",
-- }
local leadercodes = mark(getsubtypes("leader"))
-- local fillcodes = allocate {
-- [0] = "stretch",
-- [1] = "fi",
-- [2] = "fil",
-- [3] = "fill",
-- [4] = "filll",
-- }
local fillcodes = mark(getsubtypes("fill"))
-- for now:
local boundarycodes = allocate {
[0] = "cancel",
[1] = "user",
[2] = "protrusion",
[3] = "word",
}
-- local boundarycodes = mark(getsubtypes("boundary"))
-- local penaltycodes = allocate { -- unfortunately not used (yet)
-- [ 0] = "userpenalty",
-- }
local penaltycodes = mark(getsubtypes("penalty"))
table.setmetatableindex(penaltycodes,function(t,k) return "userpenalty" end) -- not used anyway
-- local kerncodes = allocate {
-- [0] = "fontkern",
-- [1] = "userkern",
-- [2] = "accentkern",
-- [3] = "italiccorrection",
-- }
local kerncodes = mark(getsubtypes("kern"))
-- local margincodes = allocate {
-- [0] = "left",
-- [1] = "right",
-- }
local margincodes = mark(getsubtypes("marginkern"))
-- local mathcodes = allocate {
-- [0] = "beginmath",
-- [1] = "endmath",
-- }
local mathcodes = mark(getsubtypes("math"))
-- local noadcodes = allocate { -- simple nodes
-- [ 0] = "ord",
-- [ 1] = "opdisplaylimits",
-- [ 2] = "oplimits",
-- [ 3] = "opnolimits",
-- [ 4] = "bin",
-- [ 5] = "rel",
-- [ 6] = "open",
-- [ 7] = "close",
-- [ 8] = "punct",
-- [ 9] = "inner",
-- [10] = "under",
-- [11] = "over",
-- [12] = "vcenter",
-- }
local noadcodes = mark(getsubtypes("noad"))
-- local radicalcodes = allocate {
-- [0] = "radical",
-- [1] = "uradical",
-- [2] = "uroot",
-- [3] = "uunderdelimiter",
-- [4] = "uoverdelimiter",
-- [5] = "udelimiterunder",
-- [6] = "udelimiterover",
-- }
local radicalcodes = mark(getsubtypes("radical"))
-- local accentcodes = allocate {
-- [0] = "bothflexible",
-- [1] = "fixedtop",
-- [2] = "fixedbottom",
-- [3] = "fixedboth",
-- }
local accentcodes = mark(getsubtypes("accent"))
-- local fencecodes = allocate {
-- [0] = "unset",
-- [1] = "left",
-- [2] = "middle",
-- [3] = "right",
-- [4] = "no",
-- }
local fencecodes = mark(getsubtypes("fence"))
-- maybe we also need fractioncodes
local function simplified(t)
local r = { }
for k, v in next, t do
r[k] = gsub(v,"_","")
end
return r
end
local nodecodes = simplified(node.types())
local whatcodes = simplified(node.whatsits())
local usercodes = allocate {
[ 97] = "attribute", -- a
[100] = "number", -- d
[108] = "lua", -- l
[110] = "node", -- n
[115] = "string", -- s
[116] = "token" -- t
}
local noadoptions = allocate {
set = 0x08,
unused_1 = 0x00 + 0x08,
unused_2 = 0x01 + 0x08,
axis = 0x02 + 0x08,
no_axis = 0x04 + 0x08,
exact = 0x10 + 0x08,
left = 0x11 + 0x08,
middle = 0x12 + 0x08,
right = 0x14 + 0x08,
}
-- local directionvalues = mark(getvalues("dir"))
-- local gluevalues = mark(getvalues("glue"))
-- local pdfliteralvalues = mark(getvalues("pdf_literal"))
local dirvalues = allocate {
[0] = "TLT",
[1] = "TRT",
[2] = "LTL",
[3] = "RTT",
}
local gluevalues = allocate {
[0] = "normal",
[1] = "fi",
[2] = "fil",
[3] = "fill",
[4] = "filll",
}
local pdfliteralvalues = allocate {
[0] = "origin",
[1] = "page",
[2] = "always",
[3] = "raw",
[4] = "text",
[5] = "font",
[6] = "special",
}
gluecodes = allocate(swapped(gluecodes,gluecodes))
dircodes = allocate(swapped(dircodes,dircodes))
boundarycodes = allocate(swapped(boundarycodes,boundarycodes))
noadcodes = allocate(swapped(noadcodes,noadcodes))
radicalcodes = allocate(swapped(radicalcodes,radicalcodes))
nodecodes = allocate(swapped(nodecodes,nodecodes))
whatcodes = allocate(swapped(whatcodes,whatcodes))
listcodes = allocate(swapped(listcodes,listcodes))
glyphcodes = allocate(swapped(glyphcodes,glyphcodes))
kerncodes = allocate(swapped(kerncodes,kerncodes))
penaltycodes = allocate(swapped(penaltycodes,penaltycodes))
mathcodes = allocate(swapped(mathcodes,mathcodes))
fillcodes = allocate(swapped(fillcodes,fillcodes))
margincodes = allocate(swapped(margincodes,margincodes))
disccodes = allocate(swapped(disccodes,disccodes))
accentcodes = allocate(swapped(accentcodes,accentcodes))
fencecodes = allocate(swapped(fencecodes,fencecodes))
rulecodes = allocate(swapped(rulecodes,rulecodes))
leadercodes = allocate(swapped(leadercodes,leadercodes))
usercodes = allocate(swapped(usercodes,usercodes))
noadoptions = allocate(swapped(noadoptions,noadoptions))
dirvalues = allocate(swapped(dirvalues,dirvalues))
gluevalues = allocate(swapped(gluevalues,gluevalues))
pdfliteralvalues = allocate(swapped(pdfliteralvalues,pdfliteralvalues))
nodes.gluecodes = gluecodes
nodes.dircodes = dircodes
nodes.boundarycodes = boundarycodes
nodes.noadcodes = noadcodes
nodes.nodecodes = nodecodes
nodes.whatcodes = whatcodes
nodes.listcodes = listcodes
nodes.glyphcodes = glyphcodes
nodes.kerncodes = kerncodes
nodes.penaltycodes = penaltycodes
nodes.mathcodes = mathcodes
nodes.fillcodes = fillcodes
nodes.margincodes = margincodes
nodes.disccodes = disccodes
nodes.accentcodes = accentcodes
nodes.radicalcodes = radicalcodes
nodes.fencecodes = fencecodes
nodes.rulecodes = rulecodes
nodes.leadercodes = leadercodes
nodes.usercodes = usercodes
nodes.noadoptions = noadoptions
nodes.dirvalues = dirvalues
nodes.gluevalues = gluevalues
nodes.pdfliteralvalues = pdfliteralvalues
nodes.skipcodes = gluecodes -- more friendly
nodes.directioncodes = dircodes -- more friendly
nodes.whatsitcodes = whatcodes -- more official
nodes.marginkerncodes = margincodes
nodes.discretionarycodes = disccodes
nodes.directionvalues = dirvalues -- more friendly
nodes.skipvalues = gluevalues -- more friendly
nodes.literalvalues = pdfliteralvalues -- more friendly
listcodes.row = listcodes.alignment
listcodes.column = listcodes.alignment
kerncodes.kerning = kerncodes.fontkern
kerncodes.italiccorrection = kerncodes.italiccorrection or 1 -- new
pdfliteralvalues.direct = pdfliteralvalues.always
nodes.codes = allocate { -- mostly for listing
glue = skipcodes,
boundary = boundarycodes,
noad = noadcodes,
node = nodecodes,
hlist = listcodes,
vlist = listcodes,
glyph = glyphcodes,
kern = kerncodes,
penalty = penaltycodes,
math = mathnodes,
fill = fillcodes,
margin = margincodes,
disc = disccodes,
whatsit = whatcodes,
accent = accentcodes,
fence = fencecodes,
rule = rulecodes,
leader = leadercodes,
user = usercodes,
noadoptions = noadoptions,
}
nodes.noadoptions = {
set = 0x08,
unused_1 = 0x00 + 0x08,
unused_2 = 0x01 + 0x08,
axis = 0x02 + 0x08,
no_axis = 0x04 + 0x08,
exact = 0x10 + 0x08,
left = 0x11 + 0x08,
middle = 0x12 + 0x08,
right = 0x14 + 0x08,
}
local report_codes = logs.reporter("nodes","codes")
function nodes.showcodes()
local t = { }
for name, codes in sortedhash(nodes.codes) do
local sorted = sortedkeys(codes)
for i=1,#sorted do
local s = sorted[i]
if type(s) ~= "number" then
t[#t+1] = { name, s, codes[s] }
end
end
end
formatcolumns(t)
for k=1,#t do
report_codes (t[k])
end
end
trackers.register("system.showcodes", nodes.showcodes)
if not nodecodes.dir then
report_codes("use a newer version of luatex")
os.exit()
end
-- We don't need this sanitize-after-callback in ConTeXt and by disabling it we
-- also have a way to check if LuaTeX itself does the right thing.
if node.fix_node_lists then
node.fix_node_lists(false)
end
|
---------------------------------------------------------------------------------------------
-- Requirement summary:
-- [Policies] External UCS: PTU with "external_consent_status_groups" struct
--
-- Description:
-- In case:
-- SDL receives PolicyTableUpdate with "external_consent_status_groups:
-- [<functional_grouping>: <Boolean>]” -> of "device_data" -> "<device identifier>"
-- -> "user_consent_records" -> "<app id>" section
-- SDL must:
-- a. consider this PTU as invalid
-- b. do not merge this invalid PTU to LocalPT.
--
-- Steps:
-- 1. Register app
-- 2. Activate app
-- 3. Perform PTU (make sure 'external_consent_status_groups' exists in PTU file)
-- 4. Verify status of update
-- 5. Verify LocalPT (using data in snapshot)
--
-- Expected result:
-- a) PTU fails with UPDATE_NEEDED status
-- b) 'external_consent_status_groups' section doesn't exist in LocalPT
--
-- Note: Script is designed for EXTERNAL_PROPRIETARY flow
---------------------------------------------------------------------------------------------
--[[ General configuration parameters ]]
config.deviceMAC = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0"
config.defaultProtocolVersion = 2
--[[ Required Shared Libraries ]]
local commonFunctions = require('user_modules/shared_testcases/commonFunctions')
local commonSteps = require('user_modules/shared_testcases/commonSteps')
local testCasesForExternalUCS = require('user_modules/shared_testcases/testCasesForExternalUCS')
--[[ Local variables ]]
local appId = config.application1.registerAppInterfaceParams.appID
local grpId = "Location"
local checkedStatus = "UPDATE_NEEDED"
local checkedSection = "external_consent_status_groups"
--[[ General Precondition before ATF start ]]
commonFunctions:SDLForceStop()
commonSteps:DeleteLogsFileAndPolicyTable()
testCasesForExternalUCS.removePTS()
--[[ General Settings for configuration ]]
Test = require("user_modules/connecttest_resumption")
require('user_modules/AppTypes')
--[[ Preconditions ]]
commonFunctions:newTestCasesGroup("Preconditions")
function Test:ConnectMobile()
self:connectMobile()
end
function Test:StartSession()
testCasesForExternalUCS.startSession(self, 1)
end
--[[ Test ]]
commonFunctions:newTestCasesGroup("Test")
function Test:RAI()
testCasesForExternalUCS.registerApp(self, 1)
end
function Test:ActivateApp()
local updateFunc = function(pts)
pts.policy_table.device_data = {
[config.deviceMAC] = {
user_consent_records = {
[appId] = {
[checkedSection] = {
[grpId] = true
}
}
}
}
}
end
testCasesForExternalUCS.activateApp(self, 1, checkedStatus, updateFunc)
end
function Test:CheckStatus_UPDATE_NEEDED()
local reqId = self.hmiConnection:SendRequest("SDL.GetStatusUpdate")
EXPECT_HMIRESPONSE(reqId, { status = checkedStatus })
end
function Test.RemovePTS()
testCasesForExternalUCS.removePTS()
end
function Test:StartSession_2()
testCasesForExternalUCS.startSession(self, 2)
end
function Test:RAI_2()
testCasesForExternalUCS.registerApp(self, 2)
EXPECT_HMICALL("BasicCommunication.PolicyUpdate")
:Do(function(_, d) testCasesForExternalUCS.pts = testCasesForExternalUCS.createTableFromJsonFile(d.params.file) end)
end
function Test:CheckPTS()
if not testCasesForExternalUCS.pts then
self:FailTestCase("PTS was not created")
elseif testCasesForExternalUCS.pts.policy_table
and testCasesForExternalUCS.pts.policy_table.device_data
and testCasesForExternalUCS.pts.policy_table.device_data[config.deviceMAC]
and testCasesForExternalUCS.pts.policy_table.device_data[config.deviceMAC].user_consent_records
and testCasesForExternalUCS.pts.policy_table.device_data[config.deviceMAC].user_consent_records[appId]
and testCasesForExternalUCS.pts.policy_table.device_data[config.deviceMAC].user_consent_records[appId][checkedSection]
then
self:FailTestCase("Section '" .. checkedSection .. "' was found in PTS")
else
print("Section '".. checkedSection .. "' doesn't exist in PTS")
print(" => OK")
end
end
--[[ Postconditions ]]
commonFunctions:newTestCasesGroup("Postconditions")
function Test.StopSDL()
StopSDL()
end
return Test
|
--------------------------------------------------------------------------
---------------- 基本变量 ---------------------
---------------- 不要编辑 ---------------------
--------------------------------------------------------------------------
local current_weapon = "none"
--------------------------------------------------------------------------
---------------- 基本设置 ------------------------------
--------------------------------------------------------------------------
---- 以下是对应的绑定按键 ----
---- 鼠标键位看img中的log2.png ----
---- 冲锋枪绑定鼠标按键 ----
local uzi_key = 4
local ump9_key = 5
---- 步枪5.56绑定鼠标按键 ----
local m16a4_key = 10
local m416_key = 6
local scarl_key = 7
---- 步枪7.62绑定鼠标按键 ----
local akm_key = 11
---- 键盘键位(仅限罗技键盘) ----
---- nil改成1就是键盘上的F1,以此类推 ----
local ump9_gkey = nil
local akm_gkey = nil
local m16a4_gkey = nil
local m416_gkey = nil
local scarl_gkey = nil
local uzi_gkey = nil
local set_off_gkey = nil
---- 取消按键 ----
local set_off_key = 3
---- 普通开火绑定按键(不开镜) ----
local fire_key = "Pause"
---- 开镜开火绑定按键(四倍镜) ----
local mode_switch_key = "capslock"
local full_mode_key = "numlock"
---- 忽略按键 ----
---- 可以使用 ----
-- "Lalt" "RAlt" --
-- "Alt" "Lshift" --
-- "Rshift" "Shift" --
-- "LCtrl" "RCtrl" --
---- "Ctrl" ----
local ignore_key = "lalt"
local hold_breath_key = "lshift"
---- 自动模式,枪要改为自动模式,除了m16 ----
local auto_mode = true
---- 屏息模式 ----
local hold_breath_mode = true
---- 完全模式绑定键,小键盘锁定键灯亮时为启动 ----
local full_mode_key = "numlock"
---- 按滚轮开启脚本,此时灯亮 ----
local lighton_key = "scrolllock"
---- 快速启动设置 ----
---- 按下fast_loot_key和鼠标左键快速开启 ----
---- 如果不需要快速启动就下面fastloot改为false ----
local fastloot = true
local fast_loot_key = "lctrl"
local move = 40 ----1920*1080
--- 游戏中的灵敏度(进入游戏,控制里面默认) ---
--- 默认值是50.0 ---
local vertical_sensitivity = 0.7 -- 更新后新增的垂直速度 --
local target_sensitivity = 50
local scope_sensitivity = 50
local scope4x_sensitivity = 50
---- Obfs设置 ----
---- 两次射击时间间隔 = weapon_speed * interval_ratio * ( 1 + random_seed * ( 0 ~ 1))
local weapon_speed_mode = false
-- local obfs_mode = false
local obfs_mode = true
local interval_ratio = 0.75
local random_seed = 1
-----------------------------------------------------------
---------------- 后坐力列表 -----------------
---------------- 你可以在这里修复这个值 -------------------
------------------------------------------------------------
local compensation = 1 -- 补偿时间
local recoil_table = {}
recoil_table["uzi"] = {
-- basic={16,17,18,20,21,22,23,24,25,26,28,30,32,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34},
-- quadruple={13.3,13.3,13.3,13.3,13.3,21.7,21.7,21.7,21.7,21.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7,46.7},
-- speed = 48
basic = {18,18,18,19,19,21,24,24,30,26,30,30,34,34,38},
basictimes = 1.7,
full = {18,18,18,19,19,21,24,24,30,26,30,30,34,34,38},
fulltimes = 1.7*0.75,
holdbreathtimes = 1.25,
quadruple = {18,18,18,19,19,21,24,24,30,26,30,30,34,34,38},
quadrupletimes = 1.7,
fullof4x = {18,18,18,19,19,21,24,24,30,26,30,30,34,34,38},
fullof4xtimes = 1.7*0.75,
speed = 48,
}
recoil_table["ump9"] = {
-- 老版本5.56枪还没修改的
-- basic={18,19,18,19,18,19,19,21,23,24,23,24,23,24,23,24,23,24,23,24,23,24,24,25,24,25,24,25,24,25,24,25,25,26,25,26,25,26,25,26,25,26,25,26,25,26},
-- quadruple={83.3,83.3,83.3,83.3,83.3,83.3,83.3,116.7,116.7,116.7,116.7,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3},
-- speed = 92
-- 新版本
basic = {28,30,30,30,37,30,31,36,37,37,37,40,40,39,39,41,41,42,44,42,43,40,41,44,40,40,41,42,43},
basictimes = 0.963,
full = {28,30,30,30,37,30,31,36,37,37,37,40,40,39,39,41,41,42,44,42,43,40,41,44,40,40,41,42,43},
fulltimes = 0.963*0.75,
holdbreathtimes = 1.25,
quadruple = {28,30,30,30,37,30,31,36,37,37,37,40,40,39,39,41,41,42,44,42,43,40,41,44,40,40,41,42,43},
quadrupletimes = 4*0.963,
fullof4x = {28,30,30,30,37,30,31,36,37,37,37,40,40,39,39,41,41,42,44,42,43,40,41,44,40,40,41,42,43},
fullof4xtimes = 4*0.963*0.75,
speed = 90,
}
recoil_table["m16a4"] = {
-- basic={25,25,25,29,33,33,32,33,32,32,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30},
-- quadruple={86.7,86.7,86.7,86.7,86.7,86.7,86.7,150,150,150,150,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120},
-- speed = 75
basic ={ 47,35,38,44,58,61,70,67,73,74,72,69,72,71,72,70,72,70,69,71},
basictimes = 1.15,
full = {47,35,38,44,58,61,70,67,73,74,72,69,72,71,72,70,72,70,69,71},
fulltimes = 1.15*0.75,
holdbreathtimes = 1.25,
quadruple = {47,35,38,44,58,61,70,67,73,74,72,69,72,71,72,70,72,70,69,71},
quadrupletimes = 1.15*4,
fullof4x = {47,35,38,44,58,61,70,67,73,74,72,69,72,71,72,70,72,70,69,71},
fullof4xtimes = 4*1.15*0.75,
speed = 80,
}
recoil_table["m416"] = {
-- basic={21,21,21,21,21,21,21,21,21,23,23,24,23,24,25,25,26,27,27,32,31,31,31,31,31,31,31,32,32,32,35,35,35,35,35,35,35,35,35,35,35},
-- quadruple={86.7,86.7,86.7,86.7,86.7,86.7,86.7,150,150,150,150,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7},
-- speed = 86
basic = {49,37,38,39,43,46,47,47,48,49,50,49,55,56,58,60},
basictimes = 1.05,
full = {49,37,38,39,43,46,47,47,48,49,50,49,55,56,58,60},
fulltimes = 1.05*0.75,
holdbreathtimes = 1.25,
quadruple = {49,37,38,39,43,46,47,47,48,49,50,49,55,56,58,60},
quadrupletimes = 4*1.05,
fullof4x={49,37,38,39,43,46,47,47,48,49,50,49,55,56,58,60},
fullof4xtimes = 4*1.05*0.75,
speed = 90,
}
recoil_table["scarl"] = {
-- basic={20,21,22,21,22,22,23,22,23,23,24,24,25,25,25,25,26,27,28,29,30,32,34,34,35,34,35,34,35,34,35,34,34,34,34,34,35,35,35,35,35,35,35,35,35,35},
-- quadruple={86.7,86.7,86.7,86.7,86.7,86.7,86.7,150,150,150,150,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7,96.7},
-- speed = 96
basic={40,28,35,44,44,45,46,46,46,48,49,45,44,44,51,55},
basictimes = 0.89,
full={40,28,35,44,44,45,46,46,46,48,49,45,44,44,51,55},
fulltimes = 0.89*0.75,
holdbreathtimes = 1.25,
quadruple={40,28,35,44,44,45,46,46,46,48,49,45,44,44,51,55},
quadrupletimes = 4*0.89,
fullof4x={40,28,35,44,44,45,46,46,46,48,49,45,44,44,51,55},
fullof4xtimes = 4*0.89*0.75,
speed = 100,
}
recoil_table["akm"] = {
-- 老版本5.56枪还没修改的
-- basic={23.7,23.7,23.7,23.7,23.7,23.7,23.7,23.7,23.7,23.7,23.7,28,28,28,28,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7,29.7},
-- quadruple={66.7,66.7,66.7,66.7,66.7,66.7,66.7,66.7,66.7,66.7,66.7,123.3,123.3,123.3,123.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3,93.3},
-- speed = 100
basic = {56,40,38,44,48,55,56,61,65,65,67,68,67,71,74,70,65,66,72,74,72,71,70,70,70,72,74,76,72},
basictimes = 0.96,
full = {56,40,38,44,48,55,56,61,65,65,67,68,67,71,74,70,65,66,72,74,72,71,70,70,70,72,74,76,72},
fulltimes = 0.96*0.75,
holdbreathtimes = 1.25,
quadruple = {56,40,38,44,48,55,56,61,65,65,67,68,67,71,74,70,65,66,72,74,72,71,70,70,70,72,74,76,72},
quadrupletimes = 4*0.96*0.99,
fullof4x = {56,40,38,44,48,55,56,61,65,65,67,68,67,71,74,70,65,66,72,74,72,71,70,70,70,72,74,76,72},
fullof4xtimes = 4*0.96*0.99*0.75,
speed = 100,
}
recoil_table["none"] = {
basic={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
basictimes = 1,
full={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
fulltimes = 1,
holdbreathtimes = 1,
quadruple={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
quadrupletimes = 1,
fullof4x={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
fullof4xtimes = 1,
speed = 60,
}
--------------------------------------------------------------------------
---------------- 功能 ------------------------------
--------------------------------------------------------------------------
-- 改变灵敏度
function convert_sens(unconvertedSens)
return 0.002 * math.pow(10, unconvertedSens / 50)
end
-- 计算灵敏度
function calc_sens_scale(sensitivity)
return convert_sens(sensitivity)/convert_sens(50)
end
function light_on()
if not IsKeyLockOn(lighton_key) then
PressAndReleaseKey(lighton_key)
end
end
function light_off()
if IsKeyLockOn(lighton_key) then
PressAndReleaseKey(lighton_key)
end
end
-- 通过上面计算灵敏度
local target_scale = calc_sens_scale(target_sensitivity)
local scope_scale = calc_sens_scale(scope_sensitivity)
local scope4x_scale = calc_sens_scale(scope4x_sensitivity)
-- function recoil_mode()
-- if IsKeyLockOn(mode_switch_key) then
-- return "quadruple";
-- else
-- return "basic";
-- end
-- end
-- 后坐力模式 --
function recoil_mode()
-- 普通开火模式时
if not IsKeyLockOn(mode_switch_key) then
if IsKeyLockOn(full_mode_key) and full_mode then
return "full";
else
return "basic";
end
end
-- 四倍镜模式开启时
if IsKeyLockOn(mode_switch_key) then
if IsKeyLockOn(full_mode_key) and full_mode then
return "fullof4x"
else
return "quadruple"
end
end
end
-- 后坐力数值计算 --
function recoil_value(_weapon,_duration)
local _mode = recoil_mode()
local step = (math.floor(_duration/100)) + 1
if step > #recoil_table[_weapon][_mode] then
step = #recoil_table[_weapon][_mode]
end
local weapon_recoil = recoil_table[_weapon][_mode][step]
-- OutputLogMessage("weapon_recoil = %s\n", weapon_recoil)
local weapon_speed = 30
if weapon_speed_mode then
weapon_speed = recoil_table[_weapon]["speed"]
end
-- OutputLogMessage("weapon_speed = %s\n", weapon_speed)
local weapon_basictimes = recoil_table[_weapon]["basictimes"]
local weapon_fulltimes = recoil_table[_weapon]["fulltimes"]
local weapon_quadrupletimes = recoil_table[_weapon]["quadrupletimes"]
local weapon_fullof4xtimes = recoil_table[_weapon]["fullof4xtimes"]
local weapon_holdbreathtimes = recoil_table[_weapon]["holdbreathtimes"]
local weapon_intervals = weapon_speed
if obfs_mode then
local coefficient = interval_ratio * ( 1 + random_seed * math.random())
weapon_intervals = math.floor(coefficient * weapon_speed)
end
-- OutputLogMessage("weapon_intervals = %s\n", weapon_intervals)
recoil_recovery = weapon_recoil * weapon_intervals / 100
recoil_times = all_recoil_times * 0.7 / vertical_sensitivity
if recoil_mode() == "basic" then
recoil_recovery = recoil_recovery * recoil_times * weapon_basictimes
end
if recoil_mode() == "basic" and hold_breath_mode and IsModifierPressed(hold_breath_key) then
recoil_recovery = recoil_recovery * weapon_holdbreathtimes * recoil_times * weapon_basictimes
end
if recoil_mode() == "full" then
recoil_recovery = recoil_recovery * recoil_times * weapon_fulltimes
end
if recoil_mode() == "full" and hold_breath_mode and IsModifierPressed(hold_breath_key) then
recoil_recovery = recoil_recovery * weapon_holdbreathtimes * recoil_times * weapon_fulltimes
end
if recoil_mode() == "quadruple" then
recoil_recovery = recoil_recovery * recoil_times * weapon_quadrupletimes
end
if recoil_mode() == "fullof4x" then
recoil_recovery = recoil_recovery * recoil_times * weapon_fullof4xtimes
end
-- issues/3
if IsMouseButtonPressed(2) then
recoil_recovery = recoil_recovery / target_scale
elseif recoil_mode() == "basic" then
recoil_recovery = recoil_recovery / scope_scale
elseif recoil_mode() == "full" then
recoil_recovery = recoil_recovery / scope_scale
elseif recoil_mode() == "quadruple" then
recoil_recovery = recoil_recovery / scope4x_scale
elseif recoil_mode() == "fullof4x" then
recoil_recovery = recoil_recovery / scope4x_scale
end
return weapon_intervals,recoil_recovery
end
--------------------------------------------------------------------------
---------------- 事件 ------------------------------
--------------------------------------------------------------------------
-- 鼠标事件入口 --
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %d\n", event, arg)
if (event == "PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
current_weapon = "none"
shoot_duration = 0.0
ReleaseKey(fire_key)
ReleaseMouseButton(1)
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == set_off_key)
or (event == "G_PRESSED" and arg == set_off_gkey) then
current_weapon = "none" light_off()
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == akm_key)
or (event == "G_PRESSED" and arg == akm_gkey) then
current_weapon = "akm" light_on()
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == m16a4_key)
or (event == "G_PRESSED" and arg == m16a4_gkey) then
current_weapon = "m16a4" light_on()
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == m416_key)
or (event == "G_PRESSED" and arg == m416_gkey) then
current_weapon = "m416" light_on()
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == ump9_key)
or (event == "G_PRESSED" and arg == ump9_gkey) then
current_weapon = "ump9" light_on()
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == uzi_key)
or (event == "G_PRESSED" and arg == uzi_gkey) then
current_weapon = "uzi" light_on()
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == scarl_key)
or (event == "G_PRESSED" and arg == scarl_gkey) then
current_weapon = "scarl" light_on()
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == 1) then
-- button 1 : Shoot
if ((current_weapon == "none") or IsModifierPressed(ignore_key)) then
PressKey(fire_key)
repeat
Sleep(30)
until not IsMouseButtonPressed(1)
ReleaseKey(fire_key)
elseif((current_weapon == "m16a4") and not IsModifierPressed(ignore_key)) then
local shoot_duration = 0.0
repeat
local intervals,recovery = recoil_value(current_weapon,shoot_duration)
PressAndReleaseKey(fire_key)
MoveMouseRelative(0, recovery )
Sleep(intervals)
shoot_duration = shoot_duration + intervals
until not IsMouseButtonPressed(1)
else
if auto_mode then
PressKey(fire_key)
local shoot_duration = 0.0
repeat
local intervals,recovery = recoil_value(current_weapon,shoot_duration)
MoveMouseRelative(0, recovery )
Sleep(intervals)
shoot_duration = shoot_duration + intervals
until not IsMouseButtonPressed(1)
else
local shoot_duration = 0.0
repeat
local intervals,recovery = recoil_value(current_weapon,shoot_duration)
PressAndReleaseKey(fire_key)
MoveMouseRelative(0, recovery )
Sleep(intervals)
shoot_duration = shoot_duration + intervals
until not IsMouseButtonPressed(1)
end
end
elseif (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
ReleaseKey(fire_key)
end
while (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsModifierPressed(fast_loot_key) and fastloot) do
Sleep(10)
PressMouseButton(1)
Sleep(10)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
Sleep(2)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
Sleep(2)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
Sleep(2)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
Sleep(2)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
MoveMouseRelative(move, 0)
Sleep(10)
ReleaseMouseButton(1)
Sleep(10)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
Sleep(2)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
Sleep(2)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
Sleep(2)
MoveMouseRelative(-move, 0)
Sleep(2)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
MoveMouseRelative(-move, 0)
Sleep(10)
if not IsModifierPressed(fast_loot_key) then
break
end
end
end
|
-- Use of this source code is governed by the Apache 2.0 license; see COPYING.
module(..., package.seeall)
local S = require("syscall")
local lib = require("core.lib")
local shm = require("core.shm")
local file = require("lib.stream.file")
local socket = require("lib.stream.socket")
local fiber = require("lib.fibers.fiber")
local json = require("lib.ptree.json")
function show_usage(status, err_msg)
if err_msg then print('error: '..err_msg) end
print(require("program.alarms.listen.README_inc"))
main.exit(status)
end
local function parse_command_line(args)
local handlers = {}
function handlers.h() show_usage(0) end
args = lib.dogetopt(args, handlers, "h", {help="h"})
if #args ~= 1 then show_usage(1) end
return unpack(args)
end
local function connect(instance_id)
local tail = instance_id..'/notifications'
local ok, ret = pcall(socket.connect_unix, shm.root..'/by-name/'..tail)
if not ok then
ok, ret = pcall(socket.connect_unix, shm.root..'/'..tail)
end
if ok then return ret end
error("Could not connect to notifications socket on Snabb instance '"..
instance_id.."'.\n")
end
function run(args)
local instance_id = parse_command_line(args)
local handler = require('lib.fibers.file').new_poll_io_handler()
file.set_blocking_handler(handler)
fiber.current_scheduler:add_task_source(handler)
require('lib.stream.compat').install()
local function print_notifications()
local socket = connect(instance_id)
while true do
local obj = json.read_json(socket)
if obj == nil then return end
json.write_json(io.stdout, obj)
io.stdout:write_chars("\n")
io.stdout:flush_output()
end
end
local function exit_when_finished(f)
return function()
local success, res = pcall(f)
if not success then io.stderr:write('error: '..tostring(res)..'\n') end
os.exit(success and 0 or 1)
end
end
fiber.spawn(exit_when_finished(print_notifications))
fiber.main()
end
|
local RP = game:GetService("ReplicatedStorage"):WaitForChild("Remote_Functions"):FindFirstChild("RemoveCars")
local RP_2 = game:GetService("ReplicatedStorage"):WaitForChild("Remote_Functions"):FindFirstChild("Destroy")
local SP = script.Parent.Count
local plr = game.Players.LocalPlayer
local req
print("Starting")
for i,v in pairs(plr.Cars:GetChildren()) do
if v.Name ~= "Count" then
print("Counted")
SP.Value = SP.Value + 1
end
end
plr.Cars.ChildAdded:Connect(function()
SP.Value = SP.Value + 1
end)
plr.Cars.ChildRemoved:Connect(function()
SP.Value = SP.Value - 1
end)
RP.OnClientInvoke = function()
local plr = game.Players.LocalPlayer
print("Starting_3")
if script.CarRun.Value == false then
if string.len(script.Car.Value) >= 2 and script.Car.Value ~= "" then
print("Destroy")
RP_2:InvokeServer(script.Car.Value, plr.Name)
script.CarRun.Value = true
script.Car.Value = ""
elseif string.len(script.Car.Value) < 2 and script.Car.Value == "" then
print("Not Destroying")
script.CarRun.Value = true
script.Car.Value = ""
end
end
end
|
require("firecast.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
require("locale.lua");
local __o_Utils = require("utils.lua");
local function constructNew_frmInventoryArmor()
local obj = GUI.fromHandle(_obj_newObject("form"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("frmInventoryArmor");
obj:setWidth(725);
obj:setHeight(25);
obj:setMargins({top=1});
obj.rectangle1 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle1:setParent(obj);
obj.rectangle1:setAlign("client");
obj.rectangle1:setColor("#212121");
obj.rectangle1:setName("rectangle1");
obj.edit1 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit1:setParent(obj.rectangle1);
obj.edit1:setLeft(0);
obj.edit1:setTop(0);
obj.edit1:setWidth(150);
obj.edit1:setHeight(25);
obj.edit1:setField("nome");
obj.edit1:setName("edit1");
obj.edit2 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit2:setParent(obj.rectangle1);
obj.edit2:setLeft(150);
obj.edit2:setTop(0);
obj.edit2:setWidth(50);
obj.edit2:setHeight(25);
obj.edit2:setField("cabeca");
obj.edit2:setName("edit2");
obj.edit3 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit3:setParent(obj.rectangle1);
obj.edit3:setLeft(200);
obj.edit3:setTop(0);
obj.edit3:setWidth(50);
obj.edit3:setHeight(25);
obj.edit3:setField("torso");
obj.edit3:setName("edit3");
obj.edit4 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit4:setParent(obj.rectangle1);
obj.edit4:setLeft(250);
obj.edit4:setTop(0);
obj.edit4:setWidth(50);
obj.edit4:setHeight(25);
obj.edit4:setField("bracoDireito");
obj.edit4:setName("edit4");
obj.edit5 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit5:setParent(obj.rectangle1);
obj.edit5:setLeft(300);
obj.edit5:setTop(0);
obj.edit5:setWidth(50);
obj.edit5:setHeight(25);
obj.edit5:setField("bracoEsquerdo");
obj.edit5:setName("edit5");
obj.edit6 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit6:setParent(obj.rectangle1);
obj.edit6:setLeft(350);
obj.edit6:setTop(0);
obj.edit6:setWidth(50);
obj.edit6:setHeight(25);
obj.edit6:setField("pernaDireito");
obj.edit6:setName("edit6");
obj.edit7 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit7:setParent(obj.rectangle1);
obj.edit7:setLeft(400);
obj.edit7:setTop(0);
obj.edit7:setWidth(50);
obj.edit7:setHeight(25);
obj.edit7:setField("pernaEsquerdo");
obj.edit7:setName("edit7");
obj.edit8 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit8:setParent(obj.rectangle1);
obj.edit8:setLeft(450);
obj.edit8:setTop(0);
obj.edit8:setWidth(150);
obj.edit8:setHeight(25);
obj.edit8:setField("detalhes");
obj.edit8:setName("edit8");
obj.edit9 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit9:setParent(obj.rectangle1);
obj.edit9:setLeft(600);
obj.edit9:setTop(0);
obj.edit9:setWidth(50);
obj.edit9:setHeight(25);
obj.edit9:setField("preco");
obj.edit9:setName("edit9");
obj.edit10 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit10:setParent(obj.rectangle1);
obj.edit10:setLeft(650);
obj.edit10:setTop(0);
obj.edit10:setWidth(50);
obj.edit10:setHeight(25);
obj.edit10:setField("peso");
obj.edit10:setName("edit10");
obj.button1 = GUI.fromHandle(_obj_newObject("button"));
obj.button1:setParent(obj.rectangle1);
obj.button1:setLeft(700);
obj.button1:setTop(0);
obj.button1:setWidth(25);
obj.button1:setHeight(25);
obj.button1:setText("X");
obj.button1:setName("button1");
obj.dataLink1 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink1:setParent(obj.rectangle1);
obj.dataLink1:setFields({'cabeca'});
obj.dataLink1:setName("dataLink1");
obj.dataLink2 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink2:setParent(obj.rectangle1);
obj.dataLink2:setFields({'torso'});
obj.dataLink2:setName("dataLink2");
obj.dataLink3 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink3:setParent(obj.rectangle1);
obj.dataLink3:setFields({'bracoDireito'});
obj.dataLink3:setName("dataLink3");
obj.dataLink4 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink4:setParent(obj.rectangle1);
obj.dataLink4:setFields({'bracoEsquerdo'});
obj.dataLink4:setName("dataLink4");
obj.dataLink5 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink5:setParent(obj.rectangle1);
obj.dataLink5:setFields({'pernaDireito'});
obj.dataLink5:setName("dataLink5");
obj.dataLink6 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink6:setParent(obj.rectangle1);
obj.dataLink6:setFields({'pernaEsquerdo'});
obj.dataLink6:setName("dataLink6");
obj.dataLink7 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink7:setParent(obj.rectangle1);
obj.dataLink7:setFields({'preco'});
obj.dataLink7:setName("dataLink7");
obj.dataLink8 = GUI.fromHandle(_obj_newObject("dataLink"));
obj.dataLink8:setParent(obj.rectangle1);
obj.dataLink8:setFields({'peso'});
obj.dataLink8:setName("dataLink8");
obj._e_event0 = obj.button1:addEventListener("onClick",
function (_)
dialogs.confirmOkCancel("Tem certeza que quer apagar esse objeto?",
function (confirmado)
if confirmado then
ndb.deleteNode(sheet);
end;
end);
end, obj);
obj._e_event1 = obj.dataLink1:addEventListener("onChange",
function (_, field, oldValue, newValue)
if sheet==nil then return end;
local node = ndb.getRoot(sheet);
local objetos = ndb.getChildNodes(node.armorList);
local blindagem = 0;
for i=1, #objetos, 1 do
blindagem = blindagem + (tonumber(objetos[i].cabeca) or 0);
end;
node.blindagemCabeca = blindagem;
end, obj);
obj._e_event2 = obj.dataLink2:addEventListener("onChange",
function (_, field, oldValue, newValue)
if sheet==nil then return end;
local node = ndb.getRoot(sheet);
local objetos = ndb.getChildNodes(node.armorList);
local blindagem = 0;
for i=1, #objetos, 1 do
blindagem = blindagem + (tonumber(objetos[i].torso) or 0);
end;
node.blindagemTorso = blindagem;
end, obj);
obj._e_event3 = obj.dataLink3:addEventListener("onChange",
function (_, field, oldValue, newValue)
if sheet==nil then return end;
local node = ndb.getRoot(sheet);
local objetos = ndb.getChildNodes(node.armorList);
local blindagem = 0;
for i=1, #objetos, 1 do
blindagem = blindagem + (tonumber(objetos[i].bracoDireito) or 0);
end;
node.blindagemBracoDireito = blindagem;
end, obj);
obj._e_event4 = obj.dataLink4:addEventListener("onChange",
function (_, field, oldValue, newValue)
if sheet==nil then return end;
local node = ndb.getRoot(sheet);
local objetos = ndb.getChildNodes(node.armorList);
local blindagem = 0;
for i=1, #objetos, 1 do
blindagem = blindagem + (tonumber(objetos[i].bracoEsquerdo) or 0);
end;
node.blindagemBracoEsquerdo = blindagem;
end, obj);
obj._e_event5 = obj.dataLink5:addEventListener("onChange",
function (_, field, oldValue, newValue)
if sheet==nil then return end;
local node = ndb.getRoot(sheet);
local objetos = ndb.getChildNodes(node.armorList);
local blindagem = 0;
for i=1, #objetos, 1 do
blindagem = blindagem + (tonumber(objetos[i].pernaDireito) or 0);
end;
node.blindagemPernaDireita = blindagem;
end, obj);
obj._e_event6 = obj.dataLink6:addEventListener("onChange",
function (_, field, oldValue, newValue)
if sheet==nil then return end;
local node = ndb.getRoot(sheet);
local objetos = ndb.getChildNodes(node.armorList);
local blindagem = 0;
for i=1, #objetos, 1 do
blindagem = blindagem + (tonumber(objetos[i].pernaEsquerdo) or 0);
end;
node.blindagemPernaEsquerda = blindagem;
end, obj);
obj._e_event7 = obj.dataLink7:addEventListener("onChange",
function (_, field, oldValue, newValue)
if sheet==nil then return end;
local node = ndb.getRoot(sheet);
local objetos = ndb.getChildNodes(node.armorList);
local cost = 0;
for i=1, #objetos, 1 do
cost = cost + (tonumber(objetos[i].preco) or 0);
end;
node.armorCost = cost;
end, obj);
obj._e_event8 = obj.dataLink8:addEventListener("onChange",
function (_, field, oldValue, newValue)
if sheet==nil then return end;
local node = ndb.getRoot(sheet);
local objetos = ndb.getChildNodes(node.armorList);
local weight = 0;
for i=1, #objetos, 1 do
weight = weight + (tonumber(objetos[i].peso) or 0);
end;
node.armorWeight = weight;
end, obj);
function obj:_releaseEvents()
__o_rrpgObjs.removeEventListenerById(self._e_event8);
__o_rrpgObjs.removeEventListenerById(self._e_event7);
__o_rrpgObjs.removeEventListenerById(self._e_event6);
__o_rrpgObjs.removeEventListenerById(self._e_event5);
__o_rrpgObjs.removeEventListenerById(self._e_event4);
__o_rrpgObjs.removeEventListenerById(self._e_event3);
__o_rrpgObjs.removeEventListenerById(self._e_event2);
__o_rrpgObjs.removeEventListenerById(self._e_event1);
__o_rrpgObjs.removeEventListenerById(self._e_event0);
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.edit3 ~= nil then self.edit3:destroy(); self.edit3 = nil; end;
if self.dataLink3 ~= nil then self.dataLink3:destroy(); self.dataLink3 = nil; end;
if self.button1 ~= nil then self.button1:destroy(); self.button1 = nil; end;
if self.dataLink8 ~= nil then self.dataLink8:destroy(); self.dataLink8 = nil; end;
if self.edit4 ~= nil then self.edit4:destroy(); self.edit4 = nil; end;
if self.dataLink7 ~= nil then self.dataLink7:destroy(); self.dataLink7 = nil; end;
if self.edit8 ~= nil then self.edit8:destroy(); self.edit8 = nil; end;
if self.edit9 ~= nil then self.edit9:destroy(); self.edit9 = nil; end;
if self.dataLink6 ~= nil then self.dataLink6:destroy(); self.dataLink6 = nil; end;
if self.edit5 ~= nil then self.edit5:destroy(); self.edit5 = nil; end;
if self.edit2 ~= nil then self.edit2:destroy(); self.edit2 = nil; end;
if self.edit10 ~= nil then self.edit10:destroy(); self.edit10 = nil; end;
if self.edit6 ~= nil then self.edit6:destroy(); self.edit6 = nil; end;
if self.dataLink2 ~= nil then self.dataLink2:destroy(); self.dataLink2 = nil; end;
if self.dataLink4 ~= nil then self.dataLink4:destroy(); self.dataLink4 = nil; end;
if self.rectangle1 ~= nil then self.rectangle1:destroy(); self.rectangle1 = nil; end;
if self.edit1 ~= nil then self.edit1:destroy(); self.edit1 = nil; end;
if self.edit7 ~= nil then self.edit7:destroy(); self.edit7 = nil; end;
if self.dataLink5 ~= nil then self.dataLink5:destroy(); self.dataLink5 = nil; end;
if self.dataLink1 ~= nil then self.dataLink1:destroy(); self.dataLink1 = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
return obj;
end;
function newfrmInventoryArmor()
local retObj = nil;
__o_rrpgObjs.beginObjectsLoading();
__o_Utils.tryFinally(
function()
retObj = constructNew_frmInventoryArmor();
end,
function()
__o_rrpgObjs.endObjectsLoading();
end);
assert(retObj ~= nil);
return retObj;
end;
local _frmInventoryArmor = {
newEditor = newfrmInventoryArmor,
new = newfrmInventoryArmor,
name = "frmInventoryArmor",
dataType = "",
formType = "undefined",
formComponentName = "form",
title = "",
description=""};
frmInventoryArmor = _frmInventoryArmor;
Firecast.registrarForm(_frmInventoryArmor);
return _frmInventoryArmor;
|
--------------------------------------------------------------------
--@classmod Geometry
-- import
local ComponentModule = require 'candy.Component'
local DrawScript = require 'candy.gfx.DrawScript'
-- module
local GeometryModule = {}
local draw = MOAIDraw
--------------------------------------------------------------------
-- GeometryComponent
--------------------------------------------------------------------
---@class GeometryComponent : DrawScript
local GeometryComponent = CLASS: GeometryComponent ( DrawScript )
:MODEL{
Field 'index' :no_edit();
Field 'penWidth' :getset("PenWidth");
}
function GeometryComponent:__init ()
self.penWidth = 1
end
function GeometryComponent:getPenWidth ()
return self.penWidth
end
function GeometryComponent:setPenWidth ( w )
self.penWidth = w
end
--------------------------------------------------------------------
-- GeometryDrawScriptComponent
--------------------------------------------------------------------
---@class GeometryDrawScriptComponent : GeometryComponent
local GeometryDrawScriptComponent = CLASS: GeometryDrawScriptComponent ( GeometryComponent )
:MODEL {}
function GeometryDrawScriptComponent:__init ()
local prop = self.prop
local deck = MOAIDrawDeck.new ()
prop:setDeck ( deck )
self.deck = deck
end
function GeometryDrawScriptComponent:onDraw ()
end
function GeometryDrawScriptComponent:onGetRect ()
return 0, 0, 0, 0
end
function GeometryDrawScriptComponent:onAttach ( entity )
GeometryDrawScriptComponent.__super.onAttach ( self, entity )
self.deck:setDrawCallback ( function ( ... )
return self:onDraw ( ... )
end )
self.deck:setBoundsCallback ( function ( ... )
return self:onGetRect ( ... )
end )
end
--------------------------------------------------------------------
-- GeometryRect
--------------------------------------------------------------------
---@class GeometryRect : GeometryComponent
local GeometryRect = CLASS: GeometryRect ( GeometryComponent )
:MODEL{
Field 'w' :on_set("updateDeck");
Field 'h' :on_set("updateDeck");
Field 'fill' :boolean() :on_set("updateDeck");
}
ComponentModule.registerComponent ( 'GeometryRect', GeometryRect )
function GeometryRect:__init ()
self.w = 100
self.h = 100
self.fill = false
end
function GeometryRect:getSize ()
return self.w, self.h
end
function GeometryRect:setSize ( w, h )
self.w = w
self.h = h
end
function GeometryRect:onDraw ()
local w,h = self.w, self.h
if self.fill then
draw.fillRect( -w/2,-h/2, w/2,h/2 )
else
draw.setPenWidth( self.penWidth )
draw.drawRect( -w/2,-h/2, w/2,h/2 )
end
end
function GeometryRect:onGetRect ()
local w,h = self.w, self.h
return -w/2,-h/2, w/2,h/2
end
function GeometryRect:setFilled ( fill )
self.fill = fill
end
function GeometryRect:isFilled ()
return self.fill
end
--------------------------------------------------------------------
-- GeometryCircle
--------------------------------------------------------------------
---@class GeometryCircle : GeometryComponent
local GeometryCircle = CLASS: GeometryCircle ( GeometryComponent )
:MODEL{
Field 'radius' :on_set("updateDeck");
Field 'fill' :boolean() :on_set("updateDeck");
}
ComponentModule.registerComponent ( 'GeometryCircle', GeometryCircle )
function GeometryCircle:__init ()
self.radius = 100
self.fill = false
end
function GeometryCircle:getRadius ()
return self.radius
end
function GeometryCircle:setRadius ( r )
self.radius = r
end
function GeometryCircle:onDraw ()
if self.fill then
draw.fillCircle ( 0,0, self.radius )
else
draw.setPenWidth ( self.penWidth )
draw.drawCircle ( 0,0, self.radius )
end
end
function GeometryCircle:onGetRect ()
local r = self.radius
return -r,-r, r,r
end
--------------------------------------------------------------------
-- GeometryRay
--------------------------------------------------------------------
---@class GeometryRay : GeometryComponent
local GeometryRay = CLASS: GeometryRay ( GeometryComponent )
:MODEL{
'----';
Field 'length' :set( 'setLength' );
}
ComponentModule.registerComponent( 'GeometryRay', GeometryRay )
function GeometryRay:__init()
self.length = 100
end
function GeometryRay:onDraw()
draw.setPenWidth( self.penWidth )
local l = self.length
draw.fillRect( -1,-1, 1,1 )
draw.drawLine( 0, 0, l, 0 )
draw.fillRect( -1 + l, -1, 1 + l,1 )
end
function GeometryRay:onGetRect()
local l = self.length
return 0,0, l,1
end
function GeometryRay:setLength( l )
self.length = l
end
--------------------------------------------------------------------
-- GeometryBoxOutline
--------------------------------------------------------------------
---@class GeometryBoxOutline : GeometryComponent
local GeometryBoxOutline = CLASS: GeometryBoxOutline ( GeometryComponent )
:MODEL{
Field 'size' :type( 'vec3' ) :getset( 'Size' );
}
ComponentModule.registerComponent ( 'GeometryBoxOutline', GeometryBoxOutline )
function GeometryBoxOutline:__init ()
self.sizeX = 100
self.sizeY = 100
self.sizeZ = 100
end
function GeometryBoxOutline:getSize ()
return self.sizeX, self.sizeY, self.sizeZ
end
function GeometryBoxOutline:setSize ( x,y,z )
self.sizeX, self.sizeY, self.sizeZ = x,y,z
end
function GeometryBoxOutline:onDraw ()
local x,y,z = self.sizeX/2, self.sizeY/2, self.sizeZ/2
draw.setPenWidth ( self.penWidth )
draw.drawBoxOutline ( -x, -y, -z, x, y, z )
end
function GeometryBoxOutline:onGetRect()
local x,y,z = self.sizeX/2, self.sizeY/2, self.sizeZ/2
return -x, -y, x, y
end
--------------------------------------------------------------------
-- GeometryLineStrip
--------------------------------------------------------------------
---@class GeometryLineStrip : GeometryComponent
local GeometryLineStrip = CLASS: GeometryLineStrip ( GeometryComponent )
:MODEL{
Field 'verts' :array( 'number' ) :getset( 'Verts' ) :no_edit();
Field 'looped' :boolean() :isset( 'Looped' );
}
ComponentModule.registerComponent ( 'GeometryLineStrip', GeometryLineStrip )
function GeometryLineStrip:__init ()
self.looped = false
self.boundRect = {0,0,0,0}
self.outputVerts = {}
self:setVerts{
0,0,
0,100,
100,100,
100, 0
}
end
function GeometryLineStrip:setLooped ( looped )
self.looped = looped
self:updateVerts ()
end
function GeometryLineStrip:isLooped ()
return self.looped
end
function GeometryLineStrip:onAttach ( ent )
GeometryLineStrip.__super.onAttach ( self, ent )
self:updateVerts ()
end
function GeometryLineStrip:getVerts ()
return self.verts
end
function GeometryLineStrip:setVerts ( verts )
self.verts = verts
self:updateVerts ()
end
function GeometryLineStrip:updateVerts ()
if not self._entity then return end
local verts = self.verts
local x0,y0,x1,y1
for i = 1, #verts, 2 do
local x, y = verts[ i ], verts[ i + 1 ]
x0 = x0 and ( x < x0 and x or x0 ) or x
y0 = y0 and ( y < y0 and y or y0 ) or y
x1 = x1 and ( x > x1 and x or x1 ) or x
y1 = y1 and ( y > y1 and y or y1 ) or y
end
self.boundRect = { x0 or 0, y0 or 0, x1 or 0, y1 or 0 }
local outputVerts = { unpack (verts) }
if self:isLooped () then
table.insert ( outputVerts, outputVerts[ 1 ] )
table.insert ( outputVerts, outputVerts[ 2 ] )
end
self.outputVerts = outputVerts
end
function GeometryLineStrip:onDraw ()
draw.setPenWidth ( self.penWidth )
draw.drawLine ( unpack ( self.outputVerts ) )
end
function GeometryLineStrip:onGetRect ()
return unpack ( self.boundRect )
end
--------------------------------------------------------------------
-- GeometryPolygon
--------------------------------------------------------------------
---@class GeometryPolygon : GeometryLineStrip
local GeometryPolygon = CLASS: GeometryPolygon ( GeometryLineStrip )
:MODEL{
Field 'looped' :boolean() :no_edit();
Field 'fill' :boolean() :isset( 'Filled' );
}
ComponentModule.registerComponent ( 'GeometryPolygon', GeometryPolygon )
local vtxFormat = MOAIVertexFormatMgr.getFormat ( MOAIVertexFormatMgr.XYZC )
function GeometryPolygon:__init ()
self.looped = true
self.fill = true
local mesh = MOAIMesh.new ()
mesh:setPrimType ( MOAIMesh.GL_TRIANGLES )
mesh:setShader ( MOAIShaderMgr.getShader ( MOAIShaderMgr.LINE_SHADER_3D ))
mesh:setTexture ( getWhiteTexture () )
self.meshDeck = mesh
end
function GeometryPolygon:isFilled ()
return self.fill
end
function GeometryPolygon:setFilled ( fill )
self.fill = fill and true or false
self:updatePolygon ()
end
function GeometryPolygon:isLooped ()
return true
end
function GeometryPolygon:updateVerts ()
GeometryPolygon.__super.updateVerts ( self )
return self:updatePolygon ()
end
function GeometryPolygon:updatePolygon ()
if not self.fill then
self.prop:setDeck ( self.deck ) --use drawScriptDeck
return
else
self.prop:setDeck ( self.meshDeck )
end
local verts = self.verts
local count = #verts
if count < 6 then return end
local tess = MOAIVectorTesselator.new ()
tess:setFillStyle ( MOAIVectorTesselator.FILL_SOLID )
tess:setFillColor ( 1,1,1,1 )
tess:setStrokeStyle ( MOAIVectorTesselator.STROKE_NONE )
tess:pushPoly()
for k = 1, count/2 do
local idx = (k-1) * 2
tess:pushVertex ( verts[idx+1], verts[idx+2] )
end
tess:finish ()
tess:finish ()
local vtxBuffer = MOAIGfxBuffer.new ()
local idxBuffer = MOAIGfxBuffer.new ()
local totalElements = tess:getTriangles ( vtxBuffer, idxBuffer, 2 );
local mesh = self.meshDeck
mesh:setVertexBuffer ( vtxBuffer, vtxFormat )
mesh:setIndexBuffer ( idxBuffer )
mesh:setTotalElements ( totalElements )
mesh:setBounds ( vtxBuffer:computeBounds ( vtxFormat ))
--triangulate
local x0,y0,x1,y1 = calcAABB ( self.verts )
self.aabb = { x0, y0, x1, y1 }
end
GeometryModule.GeometryComponent = GeometryComponent
GeometryModule.GeometryRect = GeometryRect
GeometryModule.GeometryCircle = GeometryCircle
GeometryModule.GeometryRay = GeometryRay
GeometryModule.GeometryBoxOutline = GeometryBoxOutline
GeometryModule.GeometryLineStrip = GeometryLineStrip
GeometryModule.GeometryPolygon = GeometryPolygon
return GeometryModule |
return {
corpt = {
acceleration = 0.096,
airsightdistance = 600,
brakerate = 0.075,
buildcostenergy = 1078,
buildcostmetal = 101,
builder = false,
buildpic = "corpt.dds",
buildtime = 2000,
canattack = true,
canguard = true,
canmove = true,
canpatrol = true,
canstop = 1,
category = "ALL MOBILE SMALL SURFACE UNDERWATER",
collisionvolumeoffsets = "0 -5 0",
collisionvolumescales = "21 21 64",
collisionvolumetype = "CylZ",
corpse = "dead",
defaultmissiontype = "Standby",
description = "Scout Boat/Light Anti-Air",
explodeas = "SMALL_UNITEX",
firestandorders = 1,
floater = true,
footprintx = 4,
footprintz = 4,
icontype = "sea",
idleautoheal = 5,
idletime = 1800,
losemitheight = 22,
maneuverleashlength = 1280,
mass = 101,
maxdamage = 230,
maxvelocity = 5.06,
minwaterdepth = 6,
mobilestandorders = 1,
movementclass = "BOAT4",
name = "Searcher",
noautofire = false,
objectname = "CORPT",
radaremitheight = 25,
seismicsignature = 0,
selfdestructas = "SMALL_UNIT",
sightdistance = 585,
standingfireorder = 2,
standingmoveorder = 1,
steeringmode = 1,
turninplaceanglelimit = 140,
turninplacespeedlimit = 3.3396,
turnrate = 622,
unitname = "corpt",
waterline = 1,
customparams = {
buildpic = "corpt.dds",
faction = "CORE",
prioritytarget = "air",
},
featuredefs = {
dead = {
blocking = false,
collisionvolumeoffsets = "-3.69921112061 1.72119140629e-06 -0.0",
collisionvolumescales = "32.8984222412 14.8354034424 64.0",
collisionvolumetype = "Box",
damage = 394,
description = "Searcher Wreckage",
energy = 0,
featuredead = "heap",
footprintx = 3,
footprintz = 3,
metal = 75,
object = "CORPT_DEAD",
reclaimable = true,
customparams = {
fromunit = 1,
},
},
heap = {
blocking = false,
damage = 493,
description = "Searcher Debris",
energy = 0,
footprintx = 2,
footprintz = 2,
metal = 40,
object = "3X3A",
reclaimable = true,
customparams = {
fromunit = 1,
},
},
},
sfxtypes = {
pieceexplosiongenerators = {
[1] = "piecetrail0",
[2] = "piecetrail1",
[3] = "piecetrail2",
[4] = "piecetrail3",
[5] = "piecetrail4",
[6] = "piecetrail6",
},
},
sounds = {
canceldestruct = "cancel2",
underattack = "warning1",
cant = {
[1] = "cantdo4",
},
count = {
[1] = "count6",
[2] = "count5",
[3] = "count4",
[4] = "count3",
[5] = "count2",
[6] = "count1",
},
ok = {
[1] = "shcormov",
},
select = {
[1] = "shcorsel",
},
},
weapondefs = {
armkbot_missile = {
areaofeffect = 48,
avoidfeature = false,
canattackground = false,
craterareaofeffect = 0,
craterboost = 0,
cratermult = 0,
explosiongenerator = "custom:FLASH2",
firestarter = 70,
flighttime = 2,
impulseboost = 0.123,
impulsefactor = 0.123,
metalpershot = 0,
model = "weapon_missile",
name = "Missiles",
noselfdamage = true,
range = 600,
reloadtime = 1.6,
smoketrail = true,
soundhitdry = "xplosml2",
soundhitwet = "splshbig",
soundhitwetvolume = 0.6,
soundstart = "rocklit1",
startvelocity = 650,
texture2 = "armsmoketrail",
tolerance = 9000,
tracks = true,
turnrate = 63000,
turret = true,
weaponacceleration = 141,
weapontimer = 5,
weapontype = "MissileLauncher",
weaponvelocity = 850,
damage = {
areoship = 20,
default = 5,
priority_air = 80,
unclassed_air = 80,
},
},
armpt_laser = {
areaofeffect = 8,
beamtime = 0.12,
corethickness = 0.175,
craterareaofeffect = 0,
craterboost = 0,
cratermult = 0,
explosiongenerator = "custom:SMALL_YELLOW_BURN",
firestarter = 30,
hardstop = true,
impactonly = 1,
impulseboost = 0,
impulsefactor = 0,
laserflaresize = 5,
name = "Laser",
noselfdamage = true,
range = 220,
reloadtime = 1,
rgbcolor = "1 0 0",
soundhitdry = "",
soundhitwet = "sizzle",
soundhitwetvolume = 0.5,
soundstart = "lasrfir1",
soundtrigger = 1,
sweepfire = false,
targetmoveerror = 0.2,
thickness = 2.5,
turret = true,
weapontype = "BeamLaser",
weaponvelocity = 2250,
customparams = {
light_mult = 1.8,
light_radius_mult = 1.2,
},
damage = {
default = 60,
subs = 5,
},
},
},
weapons = {
[1] = {
def = "ARMPT_LASER",
onlytargetcategory = "SURFACE",
},
[3] = {
badtargetcategory = "SCOUT SUPERSHIP", --Ground AA
def = "ARMKBOT_MISSILE",
onlytargetcategory = "VTOL",
},
},
},
}
|
--[[
Description: Contains various variables & methods required for crossserver communication
Author: Sceleratis
Date: 12/05/2021
--]]
local Root, Package, Utilities, Service
local lastTick;
local counter = 0;
local ServerId = game.JobId;
--- Cross-server commands.
--- @class Server.CrossServer.Commands
--- @server
--- @tag Core
--- @tag Package: System.Core
--- @tag Cross-Server Commands
local CrossServerCommands = {}
--- Responsible for cross-server functionality.
--- @class Server.CrossServer
--- @server
--- @tag Core
--- @tag Package: System.Core
local CrossServer = {
CrossServerKey = "AdonisCrossServerMessaging";
CrossServerCommands = CrossServerCommands;
}
--- Send cross-server message
--- @method SendMessage
--- @within Server.CrossServer
--- @param ... any
function CrossServer.SendMessage(self, ...)
local data = {ServerId, ...};
Utilities:Queue("CrossServerMessageQueue", function()
--// Rate limiting
counter = counter+1;
if not lastTick then lastTick = os.time() end
if counter >= 150 + 60 * #Service.Players:GetPlayers() then
repeat task.wait() until os.time()-lastTick > 60;
end
if os.time()-lastTick > 60 then
lastTick = os.time();
counter = 1;
end
--// Publish
Service.MessagingService:PublishAsync(self.CrossServerKey, data)
Utilities.Events.CrossServerMessageSent:Fire(data)
end)
return true;
end
--- Handles cross-server messages
--- @method ProcessCrossServerMessage
--- @within Server.CrossServer
--- @param msg string -- Message
function CrossServer.ProcessCrossServerMessage(self, msg)
local data = msg.Data;
if not data or type(data) ~= "table" then error("CrossServer: Invalid Data Type ".. type(data)); end
local command = data[2];
table.remove(data, 2);
Root.Logging:AddLog("Script", "Cross-Server Message received: ".. tostring(data and data[2] or "nil data[2]"));
Utilities.Events.CrossServerMessageReceived:Fire(msg)
if self.CrossServerCommands[command] then
self.CrossServerCommands[command](unpack(data));
end
end
--// Cross-Server Commands
--- Runs when a "Ping" command is received, announcing this server's presence to other servers.
--- @function Ping
--- @within Server.CrossServer.Commands
--- @tag Cross-Server Command
--- @param jobId string -- Origin server's JobID
--- @param data any -- Data sent by the origin server
function CrossServerCommands.Ping(jobId, data)
Utilities.Events.ServerPingReceived:Fire(jobId, data)
Root.CrossServer:SendMessage("Pong", {
JobId = game.JobId,
NumPlayers = #Service.Players:GetPlayers()
})
end
--- Response to "Ping" from other servers
--- @function Pong
--- @within Server.CrossServer.Commands
--- @tag Cross-Server Command
--- @param jobId string -- Origin server JobID
--- @param data any -- Data sent by the origin server
function CrossServerCommands.Pong(jobId, data)
Utilities.Events.ServerPingReplyReceived:Fire(jobId, data)
end
--// Events
local function CrossServerReceived(...)
Root.CrossServer:CrossServerMessage(...)
end
return {
Init = function(cRoot, cPackage)
Root = cRoot
Package = cPackage
Utilities = Root.Utilities
Service = Root.Utilities.Services
Root.CrossServer = CrossServer
CrossServer.SubscribedEvent = Service.MessagingService:SubscribeAsync(CrossServer.CrossServerKey, CrossServerReceived)
end;
AfterInit = function(Root, Package)
end;
}
|
Quartz3DB = {
["namespaces"] = {
["Swing"] = {
},
["Buff"] = {
},
["Interrupt"] = {
},
["Flight"] = {
},
["Pet"] = {
["profiles"] = {
["皇阿瑪 - 藏宝海湾"] = {
["y"] = 514.7352153302887,
["x"] = 80.99493732046086,
},
["Default"] = {
["y"] = 335.9549441116124,
["x"] = 500.7051620703751,
},
["藏宝海湾"] = {
["x"] = 699.9999880790713,
},
},
},
["Player"] = {
["profiles"] = {
["皇阿瑪 - 藏宝海湾"] = {
["hideicon"] = true,
["x"] = 628.3131929449047,
["hidetimetext"] = true,
["border"] = "None",
["y"] = 80.76453454760231,
["targetname"] = true,
["w"] = 310,
["texture"] = "Runes",
},
["Default"] = {
["h"] = 30,
["y"] = 295.9514244964178,
["texture"] = "Frost",
["x"] = 796.3728992365186,
},
["藏宝海湾"] = {
["x"] = 674.9999880790713,
},
},
},
["GCD"] = {
["profiles"] = {
["Default"] = {
["gcdalpha"] = 0.8500000238418579,
},
},
},
["Focus"] = {
["profiles"] = {
["皇阿瑪 - 藏宝海湾"] = {
["hideicon"] = true,
["h"] = 25,
["y"] = 104.2142448213618,
["noInterruptShield"] = false,
["x"] = 783.1554443714301,
["w"] = 196,
["texture"] = "Runes",
},
["Default"] = {
["y"] = 360.0493916779481,
["x"] = 791.9698814153896,
},
["藏宝海湾"] = {
["x"] = 699.9999880790713,
},
},
},
["Target"] = {
["profiles"] = {
["皇阿瑪 - 藏宝海湾"] = {
["hideicon"] = true,
["h"] = 25,
["y"] = 104.213561053517,
["noInterruptShield"] = false,
["x"] = 587.606441840969,
["w"] = 196,
["texture"] = "Rocks",
},
["Default"] = {
["h"] = 36,
["y"] = 306.2937059800226,
["x"] = 1096.049579857561,
},
["藏宝海湾"] = {
["x"] = 699.9999880790713,
},
},
},
["Range"] = {
},
["Mirror"] = {
},
["Latency"] = {
},
},
["profileKeys"] = {
["尒乄茨勆 - 藏宝海湾"] = "Default",
["颠峰伟哥 - 藏宝海湾"] = "Default",
["皇阿瑪 - 藏宝海湾"] = "皇阿瑪 - 藏宝海湾",
["独孤牛儿 - 森金"] = "Default",
["灮丶諾亞 - 藏宝海湾"] = "Default",
},
["profiles"] = {
["皇阿瑪 - 藏宝海湾"] = {
["borderalpha"] = 0,
["castingcolor"] = {
0.1686274509803922, -- [1]
0.1450980392156863, -- [2]
0.6, -- [3]
1, -- [4]
},
["backgroundalpha"] = 0,
["completecolor"] = {
nil, -- [1]
nil, -- [2]
nil, -- [3]
1, -- [4]
},
},
["Default"] = {
["hidesamwise"] = false,
["casttimeprecision"] = 0,
},
["藏宝海湾"] = {
},
},
}
|
local keyMap = {
-- Exit the game
escape = function()
love.event.quit()
end,
-- Pause the game
space = function()
return 'pause'
end
}
return keyMap
|
return {
corsms = {
activatewhenbuilt = true,
buildangle = 8192,
buildcostenergy = 68927,
buildcostmetal = 8991,
builder = false,
buildinggrounddecaldecayspeed = 30,
buildinggrounddecalsizex = 9,
buildinggrounddecalsizey = 9,
buildinggrounddecaltype = "cadvmsto_aoplane.dds",
buildpic = "corsms.dds",
buildtime = 66125,
category = "ALL SURFACE UNDERWATER",
corpse = "dead",
description = "Amphibious - capacity (145000)",
downloadable = 1,
explodeas = "SMALL_BUILDINGEX",
footprintx = 6,
footprintz = 6,
icontype = "building",
idleautoheal = 5,
idletime = 1800,
losemitheight = 64,
mass = 11000,
maxdamage = 66000,
maxslope = 10,
maxwaterdepth = 9999,
metalstorage = 145000,
name = "T3 Metal Storage",
noautofire = false,
objectname = "corsms",
radardistance = 0,
radaremitheight = 48,
selfdestructas = "SMALL_BUILDING",
sightdistance = 300,
unitname = "corsms",
upright = true,
usebuildinggrounddecal = true,
yardmap = "oooooo oooooo oooooo oooooo oooooo oooooo",
customparams = {
buildpic = "corsms.dds",
faction = "CORE",
},
featuredefs = {
dead = {
blocking = true,
damage = 27700,
description = "T3 Metal Storage Wreckage",
featuredead = "heap",
footprintx = 6,
footprintz = 4,
metal = 7250,
object = "corsms_dead",
reclaimable = true,
customparams = {
fromunit = 1,
},
},
heap = {
blocking = false,
damage = 34625,
description = "T3 Metal Storage Debris",
footprintx = 4,
footprintz = 4,
metal = 4200,
object = "4x4b",
reclaimable = true,
customparams = {
fromunit = 1,
},
},
},
sfxtypes = {
pieceexplosiongenerators = {
[1] = "piecetrail0",
[2] = "piecetrail1",
[3] = "piecetrail2",
[4] = "piecetrail3",
[5] = "piecetrail4",
[6] = "piecetrail6",
},
},
sounds = {
canceldestruct = "cancel2",
underattack = "warning1",
count = {
[1] = "count6",
[2] = "count5",
[3] = "count4",
[4] = "count3",
[5] = "count2",
[6] = "count1",
},
select = {
[1] = "stormtl2",
},
},
},
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.