content
stringlengths 5
1.05M
|
|---|
ev3=require "ev3"
plop=TachoMotor:new("plop")
|
object_tangible_furniture_city_road_torch_12x32_03 = object_tangible_furniture_city_shared_road_torch_12x32_03:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_city_road_torch_12x32_03, "object/tangible/furniture/city/road_torch_12x32_03.iff")
|
local local0 = 0.3
local local1 = 0.3 - local0
local local2 = 0.3 - local0
local local3 = 0.3 - local0
local local4 = 3.2 - local0
local local5 = 0.3 - local0
local local6 = 0.3 - local0
local local7 = 0.3 - local0
local local8 = 0.3 - local0
local local9 = 0.3 - local0
function OnIf_263005(arg0, arg1, arg2)
if arg2 == 0 then
CrowdA263005_ActAfter_RealTime(arg0, arg1)
end
return
end
function CrowdA263005Battle_Activate(arg0, arg1)
local local0 = {}
local local1 = {}
local local2 = {}
Common_Clear_Param(local0, local1, local2)
local local3 = arg0:GetDist(TARGET_ENE_0)
local local4 = arg0:GetEventRequest()
local local5 = arg0:GetRandam_Int(1, 100)
local local6 = arg0:GetExcelParam(AI_EXCEL_THINK_PARAM_TYPE__thinkAttr_doAdmirer)
if arg0:GetNpcThinkParamID() == 263756 and arg0:GetNumber(5) == 0 then
local0[12] = 100
elseif arg0:GetEventRequest(2) == 100 and arg0:GetNumber(5) == 0 then
local0[21] = 100
elseif local6 == 1 and arg0:GetTeamOrder(ORDER_TYPE_Role) == ROLE_TYPE_Kankyaku then
local0[9] = 50
local0[10] = 20
local0[11] = 30
elseif arg0:GetNpcThinkParamID() == 102015 then
local0[9] = 50
local0[10] = 20
local0[11] = 30
elseif local6 == 1 and arg0:GetTeamOrder(ORDER_TYPE_Role) == ROLE_TYPE_Torimaki then
local0[1] = 5
local0[5] = 5
local0[7] = 5
local0[9] = 20
local0[10] = 35
local0[11] = 30
elseif arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_B, 90) then
local0[20] = 100
elseif arg0:GetNpcThinkParamID() == 102003 then
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_F, 90) and local3 <= 1 and local5 <= 40 then
local0[6] = 100
elseif 5.5 <= local3 then
local0[1] = 5
local0[2] = 5
local0[3] = 0
local0[4] = 20
local0[11] = 70
elseif 3.5 <= local3 then
local0[1] = 5
local0[2] = 0
local0[3] = 0
local0[4] = 15
local0[5] = 5
local0[7] = 5
local0[11] = 70
elseif 2.5 <= local3 then
local0[1] = 5
local0[2] = 15
local0[3] = 5
local0[5] = 0
local0[7] = 5
local0[11] = 70
elseif 1.5 <= local3 then
local0[1] = 5
local0[2] = 5
local0[3] = 5
local0[5] = 5
local0[6] = 5
local0[7] = 5
local0[11] = 70
else
local0[1] = 5
local0[2] = 0
local0[3] = 0
local0[5] = 5
local0[6] = 10
local0[7] = 10
local0[11] = 70
end
elseif arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_F, 90) and local3 <= 1 and local5 <= 40 then
local0[6] = 100
elseif 5.5 <= local3 then
local0[1] = 15
local0[2] = 20
local0[3] = 0
local0[4] = 40
local0[5] = 5
local0[7] = 10
local0[11] = 10
elseif 3.5 <= local3 then
local0[1] = 15
local0[2] = 20
local0[3] = 0
local0[4] = 30
local0[5] = 10
local0[7] = 15
local0[11] = 10
elseif 2.5 <= local3 then
local0[1] = 20
local0[2] = 35
local0[3] = 10
local0[5] = 5
local0[7] = 20
local0[11] = 10
elseif 1.5 <= local3 then
local0[1] = 15
local0[2] = 15
local0[3] = 20
local0[5] = 15
local0[6] = 10
local0[7] = 15
local0[11] = 10
else
local0[1] = 10
local0[2] = 15
local0[3] = 15
local0[5] = 20
local0[6] = 25
local0[7] = 15
local0[11] = 0
end
local1[1] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act01)
local1[2] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act02)
local1[3] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act03)
local1[4] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act04)
local1[5] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act05)
local1[6] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act06)
local1[7] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act07)
local1[8] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act08)
local1[9] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act09)
local1[10] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act10)
local1[11] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act11)
local1[12] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act12)
local1[20] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act20)
local1[21] = REGIST_FUNC(arg0, arg1, CrowdA263005_Act21)
Common_Battle_Activate(arg0, arg1, local0, local1, REGIST_FUNC(arg0, arg1, CrowdA263005_ActAfter_AdjustSpace), local2)
return
end
local0 = 4.1 - local0
function CrowdA263005_Act01(arg0, arg1, arg2)
local local0 = UPVAL0
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, UPVAL0 + 0.3, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3000, TARGET_ENE_0, UPVAL0, 0, 0)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 3.7 - local0
function CrowdA263005_Act02(arg0, arg1, arg2)
local local0 = arg0:GetRandam_Int(1, 100)
local local1 = UPVAL0
local local2 = UPVAL0
if local2 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local2, UPVAL0 + 0.9, 0, 3)
end
if arg0:GetRandam_Int(1, 100) <= 40 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3001, TARGET_ENE_0, local1, 0, 0)
else
arg1:AddSubGoal(GOAL_COMMON_ComboAttackTunableSpin, 10, 3001, TARGET_ENE_0, local1, 0, 0)
arg1:AddSubGoal(GOAL_COMMON_ComboFinal, 10, 3002, TARGET_ENE_0, local1, 0)
end
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 4.8 - local0
function CrowdA263005_Act03(arg0, arg1, arg2)
local local0 = UPVAL0
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, UPVAL0 + 0.8, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3003, TARGET_ENE_0, UPVAL0, 0, 0)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 5 - local0
function CrowdA263005_Act04(arg0, arg1, arg2)
local local0 = UPVAL0
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, UPVAL0, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3004, TARGET_ENE_0, UPVAL0, 0, 0)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 2.6 - local0
function CrowdA263005_Act05(arg0, arg1, arg2)
local local0 = UPVAL0
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, UPVAL0 + 1.4, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3005, TARGET_ENE_0, UPVAL0, 0, 0)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 1.3 - local0
function CrowdA263005_Act06(arg0, arg1, arg2)
local local0 = UPVAL0
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, UPVAL0 + 1.5, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3006, TARGET_ENE_0, UPVAL0, 0, 0)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 2.5 - local0
function CrowdA263005_Act07(arg0, arg1, arg2)
local local0 = UPVAL0
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, UPVAL0 + 1, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3007, TARGET_ENE_0, UPVAL0, 0, 0)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
function CrowdA263005_Act08(arg0, arg1, arg2)
arg1:AddSubGoal(GOAL_COMMON_Attack, 10, 3008, TARGET_ENE_0, DIST_None, 0)
GetWellSpace_Odds = 0
return GetWellSpace_Odds
end
function CrowdA263005_Act09(arg0, arg1, arg2)
arg1:AddSubGoal(GOAL_COMMON_Attack, 10, 3009, TARGET_ENE_0, DIST_None, 0)
GetWellSpace_Odds = 0
return GetWellSpace_Odds
end
function CrowdA263005_Act10(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = 10
if local1 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local1, 12, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_LeaveTarget, 5, TARGET_ENE_0, 10, TARGET_ENE_0, true, -1)
return
end
function CrowdA263005_Act11(arg0, arg1, arg2)
arg1:AddSubGoal(GOAL_COMMON_SidewayMove, 4, TARGET_ENE_0, arg0:GetRandam_Int(0, 1), arg0:GetRandam_Int(30, 45), true, true, -1)
return
end
function CrowdA263005_Act12(arg0, arg1, arg2)
arg1:AddSubGoal(GOAL_COMMON_Attack, 10, 3018, TARGET_ENE_0, DIST_None, 0)
arg0:SetNumber(5, 1)
GetWellSpace_Odds = 0
return GetWellSpace_Odds
end
function CrowdA263005_Act20(arg0, arg1, arg2)
arg1:AddSubGoal(GOAL_COMMON_Turn, 2, TARGET_ENE_0, 0, 0, 0)
GetWellSpace_Odds = 0
return GetWellSpace_Odds
end
function CrowdA263005_Act21(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = arg0:GetRandam_Int(1, 100)
local local2 = 0
local local3 = 0
local local4 = 0
arg1:AddSubGoal(GOAL_COMMON_ApproachTarget, 10, POINT_EVENT, 0, TARGET_SELF, Walk, Guard)
arg1:AddSubGoal(GOAL_COMMON_Wait, 5, TARGET_ENE_0, 0, 0, 0)
arg0:SetNumber(5, 1)
GetWellSpace_Odds = 0
return GetWellSpace_Odds
end
function CrowdA263005_ActAfter_AdjustSpace(arg0, arg1, arg2)
arg1:AddSubGoal(GOAL_COMMON_If, 10, 0)
return
end
function CrowdA263005_ActAfter_RealTime(arg0, arg1)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = arg0:GetRandam_Int(1, 100)
local local2 = arg0:GetRandam_Int(1, 100)
local local3 = arg0:GetRandam_Int(0, 1)
local local4 = 0
local local5 = 0
if arg0:GetNpcThinkParamID() == 102003 then
local4 = arg0:GetRandam_Float(2.5, 3)
local5 = arg0:GetRandam_Float(3, 3.5)
else
local4 = arg0:GetRandam_Float(1, 1.5)
local5 = arg0:GetRandam_Float(1.5, 2.5)
end
if arg0:GetTeamOrder(ORDER_TYPE_Role) == ROLE_TYPE_Attack then
if local0 <= 1.5 then
if local1 <= 30 then
arg1:AddSubGoal(GOAL_COMMON_LeaveTarget, local4, TARGET_ENE_0, 3, TARGET_ENE_0, true, -1)
end
elseif local0 <= 2.5 then
if local1 <= 40 then
arg1:AddSubGoal(GOAL_COMMON_LeaveTarget, local4, TARGET_ENE_0, 3, TARGET_ENE_0, true, -1)
end
elseif local0 <= 3.5 then
if local1 <= 50 then
arg1:AddSubGoal(GOAL_COMMON_SidewayMove, local5, TARGET_ENE_0, local3, arg0:GetRandam_Int(45, 60), true, true, -1)
end
elseif local0 <= 5.5 then
if local1 <= 50 then
arg1:AddSubGoal(GOAL_COMMON_SidewayMove, local5, TARGET_ENE_0, local3, arg0:GetRandam_Int(45, 60), true, true, -1)
elseif local1 <= 80 then
arg1:AddSubGoal(GOAL_COMMON_ApproachTarget, 10, TARGET_ENE_0, 3, TARGET_SELF, true, -1)
end
elseif local1 <= 70 then
arg1:AddSubGoal(GOAL_COMMON_ApproachTarget, 10, TARGET_ENE_0, 5.5, TARGET_SELF, false, -1)
else
arg1:AddSubGoal(GOAL_COMMON_SidewayMove, local5, TARGET_ENE_0, local3, arg0:GetRandam_Int(45, 60), true, true, -1)
end
elseif arg0:GetTeamOrder(ORDER_TYPE_Role) == ROLE_TYPE_Torimaki then
if local0 <= 6 then
arg1:AddSubGoal(GOAL_COMMON_LeaveTarget, local4, TARGET_ENE_0, 8, TARGET_ENE_0, true, -1)
else
arg1:AddSubGoal(GOAL_COMMON_SidewayMove, local5, TARGET_ENE_0, local3, arg0:GetRandam_Int(45, 60), true, true, -1)
end
elseif arg0:GetTeamOrder(ORDER_TYPE_Role) == ROLE_TYPE_Kankyaku then
if local0 <= 6 then
arg1:AddSubGoal(GOAL_COMMON_LeaveTarget, local4, TARGET_ENE_0, 8, TARGET_ENE_0, true, -1)
else
arg1:AddSubGoal(GOAL_COMMON_SidewayMove, local5, TARGET_ENE_0, local3, arg0:GetRandam_Int(45, 60), true, true, -1)
end
end
return
end
function CrowdA263005Battle_Update(arg0, arg1)
return GOAL_RESULT_Continue
end
function CrowdA263005Battle_Terminate(arg0, arg1)
return
end
function CrowdA263005Battle_Interupt(arg0, arg1)
if arg0:IsLadderAct(TARGET_SELF) then
return false
else
return false
end
end
return
|
print(0.0)
print(-0.0)
|
--[[
Frame class - Frame()
table<GUIObject> getChildren()
void setSize(Vector2D offset, Vector2D scale)
void setPosition(Vector2D offset, Vector2D scale)
Vector2D, Vector2D getSize()
Vector2D, Vector2D getPosition()
]]--
local Event = require("core/Event")
local RGBColor = require("datatypes/RGBColor")
local Vector2D = require("datatypes/Vector2D")
local GUIObject = require("objects/GUIObject")
local Frame = {}
Frame.__index = Frame
setmetatable(Frame, {
__index = GUIObject, -- this is what makes the inheritance work
__call = function (cls, ...)
local self = setmetatable({}, cls)
self:_init(...)
return self
end,
})
function Frame:_init()
GUIObject._init(self) -- call the base class constructor
table.insert(self.__inheritance, "Frame")
self.children = {}
self.mouseIn = false
-- public variables
self.parent = nil
self.backgroundColor = RGBColor.new(255,255,255)
self.border = 2
self.borderColor = RGBColor.new(0,0,0)
self.sizeOffset = Vector2D.new(300,150)
self.sizeScale = Vector2D.new(0,0)
self.positionOffset = Vector2D.new(50,50)
self.positionScale = Vector2D.new(0,0)
self.absoluteSize = Vector2D.new(0,0)
self.absolutePosition = Vector2D.new(0,0)
self.mouseEnterEvent = Event.initialize()
self.mouseLeaveEvent = Event.initialize()
end
function Frame:render()
-- border
love.graphics.setColor(self.borderColor:toTable())
love.graphics.rectangle("fill", self.absolutePosition.x-self.border, self.absolutePosition.y-self.border, self.absoluteSize.x+self.border*2, self.absoluteSize.y+self.border*2)
-- background
love.graphics.setColor(self.backgroundColor:toTable())
love.graphics.rectangle("fill", self.absolutePosition.x, self.absolutePosition.y, self.absoluteSize.x, self.absoluteSize.y)
self:renderchildren()
end
function Frame:calculateAbsolutes()
self.absoluteSize = Vector2D.new(
self.sizeOffset.x + (self.parent.absoluteSize.x * self.sizeScale.x),
self.sizeOffset.y + (self.parent.absoluteSize.y * self.sizeScale.y)
)
self.absolutePosition = Vector2D.new(
self.parent.absolutePosition.x + self.positionOffset.x + (self.parent.absoluteSize.x * self.positionScale.x),
self.parent.absolutePosition.y + self.positionOffset.y + (self.parent.absoluteSize.y * self.positionScale.y)
)
end
function Frame:checkMouse()
local mX, mY = love.mouse.getX(), love.mouse.getY()
local sX, sY, sW, sH = self.absolutePosition.x, self.absolutePosition.y, self.absoluteSize.x, self.absoluteSize.y
if (mX > sX and mX < (sX + sW)) and (mY > sY and mY < (sY + sH)) then
if self.mouseIn == false then
self.mouseIn = true
self.mouseEnterEvent:fire()
end
else
if self.mouseIn == true then
self.mouseIn = false
self.mouseLeaveEvent:fire()
end
end
end
function Frame:update(dt)
self:calculateAbsolutes()
self:checkMouse()
self:updatechildren(dt)
end
function Frame:getBackgroundColor()
return self.backgroundColor
end
function Frame:getBorder()
return self.border
end
function Frame:getBorderColor()
return self.borderColor
end
function Frame:getPosition()
return self.sizeOffset, self.sizeScale
end
function Frame:getSize()
return self.sizeOffset, self.sizeScale
end
function Frame:setBackgroundColor(color)
self.backgroundColor = color
end
function Frame:setBorder(px)
self.border = px
end
function Frame:setBorderColor(color)
self.borderColor = color
end
function Frame:setPosition(offset, scale)
self.positionOffset = offset
self.positionScale = scale
end
function Frame:setSize(offset, scale)
self.sizeOffset = offset
self.sizeScale = scale
end
return Frame
|
local widget = require( "widget" )
local composer = require( "composer" )
local json = require ("json")
local myData = require ("mydata")
local upgrades = require("upgradeName")
local loadsave = require( "loadsave" )
local terminalScene = composer.newScene()
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
--> GENERAL FUNCTIONS
---------------------------------------------------------------------------------
function goBackTerminal(event)
if (tutOverlay == false) then
if (myData.manualInput) then
myData.manualInput:removeSelf()
myData.manualInput=nil
end
backSound()
composer.removeScene( "terminalScene" )
composer.gotoScene("homeScene", {effect = "fade", time = 0})
end
end
function goBackScan(event)
if (scanOverlay == true) then
if (attackerLine) then
attackerLine:removeSelf()
attackerLine = newLine
end
backSound()
scanOverlay=false
composer.hideOverlay( "fade", 100 )
end
end
function goBackAddEdit(event)
if (addTargetOverlay == true) then
addTargetOverlay=false
backSound()
composer.hideOverlay( "fade", 100 )
end
end
local function onAlert( event )
if ( event.action == "clicked" ) then
if system.getInfo("platformName")=="Android" then
native.requestExit()
else
os.exit()
end
end
end
function closeTL( event )
backSound()
myData.backButton:setLabel("Back")
myData.targetsListRect:removeSelf()
myData.targetsListRect=nil
myData.closeTLBtn:removeSelf()
myData.closeTLBtn=nil
myData.targetsListTable:removeSelf()
myData.targetsListTable=nil
myData.addTargetButton:removeSelf()
myData.addTargetButton=nil
myData.attacker.alpha=1
myData.refreshButton.alpha=1
myData.globalButton.alpha=1
targetListOverlay=false
end
function goBack (event)
if (event.phase == "ended") then
if (targetListOverlay==false) then
if (myData.manualInput) then
myData.manualInput:removeSelf()
myData.manualInput=nil
end
backSound()
composer.removeScene( "terminalScene" )
composer.gotoScene("homeScene", {effect = "fade", time = 300})
else
closeTL()
end
end
end
local function manualScanListener( event )
if ( event.isError ) then
print( "Network error: ", event.response )
local alert = native.showAlert( "EliteHax", "Oops.. A network error occured...", { "Close" }, onAlert )
else
print ( "RESPONSE: " .. event.response )
local t = json.decode( base64Decode(event.response) )
if ( t == nil ) then
print ("EMPTY T")
local alert = native.showAlert( "EliteHax", "Oops.. A network error occured...", { "Close" }, onAlert )
end
if (t.status == "KO") then
if (typewriterTimer) then
timer.cancel(typewriterTimer)
end
local sceneOverlayOptions =
{
time = 300,
effect = "crossFade",
params = {
manual=true,
target="NO"
},
isModal = true
}
composer.showOverlay( "scanAttackScene", sceneOverlayOptions)
else
if (typewriterTimer) then
timer.cancel(typewriterTimer)
end
local sceneOverlayOptions =
{
time = 300,
effect = "crossFade",
params = {
manual=true,
target=t.id
},
isModal = true
}
composer.showOverlay( "scanAttackScene", sceneOverlayOptions)
end
scanOverlay = true
manualScanRx = true
end
end
function manualScan( event )
if (scanOverlay==true) then
if (attackerLine) then
attackerLine:removeSelf()
attackerLine = newLine
end
if (typewriterTimer) then
timer.cancel(typewriterTimer)
end
scanOverlay=false
composer.hideOverlay( "fade", 0 )
end
if ((event.phase == "ended") and (manualScanRx == true) and (addTargetOverlay==false) and (targetListOverlay==false)) then
if (isIpAddress(myData.manualInput.text)) then
local headers = {}
local body = "id="..string.urlEncode(loginInfo.token).."&target="..myData.manualInput.text
local params = {}
params.headers = headers
params.body = body
tapSound()
network.request( host().."getUuid.php", "POST", manualScanListener, params )
manualScanRx=false
end
end
end
local function detectTarget(x,y)
if ((x > myData.fw1.x) and (x < myData.fw1.x+myData.fw1.width) and (y>myData.fw1.y) and (y<myData.fw1.y+myData.fw1.height)) then
targetSound()
local imageA = { type="image", filename="img/firewall.png" }
myData.fw1.fill = imageA
myData.fw1.txtb.alpha=1
myData.fw1.txt.alpha=1
myData.fw1.ip.alpha=1
return "fw1"
elseif ((x > myData.fw2.x) and (x < myData.fw2.x+myData.fw2.width) and (y>myData.fw2.y) and (y<myData.fw2.y+myData.fw2.height)) then
targetSound()
local imageA = { type="image", filename="img/firewall.png" }
myData.fw2.fill = imageA
myData.fw2.txtb.alpha=1
myData.fw2.txt.alpha=1
myData.fw2.ip.alpha=1
return "fw2"
elseif ((x > myData.fw3.x) and (x < myData.fw3.x+myData.fw3.width) and (y>myData.fw3.y) and (y<myData.fw3.y+myData.fw3.height)) then
targetSound()
local imageA = { type="image", filename="img/firewall.png" }
myData.fw3.fill = imageA
myData.fw3.txtb.alpha=1
myData.fw3.txt.alpha=1
myData.fw3.ip.alpha=1
return "fw3"
elseif ((x > myData.fw4.x) and (x < myData.fw4.x+myData.fw4.width) and (y>myData.fw4.y) and (y<myData.fw4.y+myData.fw4.height)) then
targetSound()
local imageA = { type="image", filename="img/firewall.png" }
myData.fw4.fill = imageA
myData.fw4.txtb.alpha=1
myData.fw4.txt.alpha=1
myData.fw4.ip.alpha=1
return "fw4"
elseif ((x > myData.fw5.x) and (x < myData.fw5.x+myData.fw5.width) and (y>myData.fw5.y) and (y<myData.fw5.y+myData.fw5.height)) then
targetSound()
local imageA = { type="image", filename="img/firewall.png" }
myData.fw5.fill = imageA
myData.fw5.txtb.alpha=1
myData.fw5.txt.alpha=1
myData.fw5.ip.alpha=1
return "fw5"
elseif ((x > myData.fw6.x) and (x < myData.fw6.x+myData.fw6.width) and (y>myData.fw6.y) and (y<myData.fw6.y+myData.fw6.height)) then
targetSound()
local imageA = { type="image", filename="img/firewall.png" }
myData.fw6.fill = imageA
myData.fw6.txtb.alpha=1
myData.fw6.txt.alpha=1
myData.fw6.ip.alpha=1
return "fw6"
elseif ((x > myData.fw7.x) and (x < myData.fw7.x+myData.fw7.width) and (y>myData.fw7.y) and (y<myData.fw7.y+myData.fw7.height)) then
targetSound()
local imageA = { type="image", filename="img/firewall.png" }
myData.fw7.fill = imageA
myData.fw7.txtb.alpha=1
myData.fw7.txt.alpha=1
myData.fw7.ip.alpha=1
return "fw7"
elseif ((x > myData.fw8.x) and (x < myData.fw8.x+myData.fw8.width) and (y>myData.fw8.y) and (y<myData.fw8.y+myData.fw8.height)) then
targetSound()
local imageA = { type="image", filename="img/firewall.png" }
myData.fw8.fill = imageA
myData.fw8.txtb.alpha=1
myData.fw8.txt.alpha=1
myData.fw8.ip.alpha=1
return "fw8"
else
targetAudio=true
local imageA = { type="image", filename="img/terminal_unknown.png" }
for i=1,8 do
local cur = "fw"..i
if (myData[cur].scan ~= true) then
myData[cur].fill = imageA
myData[cur].txtb.alpha=0
myData[cur].txt.alpha=0
myData[cur].ip.alpha=0
changeImgColor(myData[cur])
end
end
return "None"
end
end
local function onAttackerTouch( event )
if ( event.phase == "began" ) then
display.getCurrentStage():setFocus( myData.attacker )
myData.attacker.isFocus = true
elseif ( event.phase == "moved" ) then
if (attackerLine) then
attackerLine:removeSelf()
attackerLine = nil
end
local dX = myData.attacker.x+(event.x - myData.attacker.x)
local dY = myData.attacker.y+(event.y - myData.attacker.y+20)
attackerLine = display.newLine( dX,dY, myData.attacker.x, myData.attacker.y+20 )
attackerLine:setStrokeColor( 0.7, 0, 0, 1 )
attackerLine.strokeWidth = 10
group:insert(attackerLine)
group:insert(myData.attacker)
detectTarget(dX,dY)
elseif ( event.phase == "ended" ) then
display.getCurrentStage():setFocus( nil )
myData.attacker.isFocus = nil
local dX = myData.attacker.x+(event.x - myData.attacker.x)
local dY = myData.attacker.y+(event.y - myData.attacker.y+20)
local visualTarget = detectTarget(dX,dY)
if (visualTarget ~= "None") then
myData[visualTarget].scan=true
myData.manualInput.text=myData[visualTarget].ip.text
local sceneOverlayOptions =
{
time = 300,
effect = "crossFade",
params = {
manual=false,
target=myData[visualTarget].id,
fw=visualTarget,
attacked=myData[visualTarget].atk
},
isModal = true
}
composer.showOverlay( "scanAttackScene", sceneOverlayOptions)
scanOverlay=true
else
if (attackerLine) then
attackerLine:removeSelf()
attackerLine = newLine
end
end
end
return true
end
local function terminalNetworkListener( event )
if ( event.isError ) then
print( "Network error: ", event.response )
local alert = native.showAlert( "EliteHax", "Oops.. A network error occured...", { "Close" }, onAlert )
else
print ( "RESPONSE: " .. event.response )
local t = json.decode( base64Decode(event.response) )
if ( t == nil ) then
print ("EMPTY T")
local alert = native.showAlert( "EliteHax", "Oops.. A network error occured...", { "Close" }, onAlert )
end
for i in pairs( t.targets ) do
if (i < 9) then
local cur = "fw"..i
myData[cur].id = t.targets[i].id
myData[cur].txt.text=t.targets[i].firewall
local digit = string.len(tostring(myData[cur].txt.text))
myData[cur].txtb.width=70+(30*digit)
if (t.targets[i].attacked == "Y") then
myData[cur].atk=true
myData[cur].txt:setFillColor( 0.84,0.15,0.15 )
myData[cur].txtb:setStrokeColor( 0.84, 0.15, 0.15 )
myData[cur].ip:setFillColor( 0.84,0.15,0.15 )
end
myData[cur].ip.text=t.targets[i].ip
end
end
refreshTargetsRx = true
manualScanRx = true
--Money
myData.moneyTextTerminal.text = format_thousand(t.money)
--Player
if (string.len(t.user)>15) then myData.playerTextTerminal.size = fontSize(42) end
myData.playerTextTerminal.text = t.user
end
end
local function refreshTargets(event)
if ((event.phase == "ended") and (refreshTargetsRx == true)) then
tapSound()
myData.manualInput.text=""
myData.fw1.x, myData.fw1.y = horizontalDiff+myData.targetsRect.x-myData.targetsRect.width/2+40+math.random(100),myData.targetsRect.y+fontSize(170)+fontSize(math.random(130))
myData.fw2.x, myData.fw2.y = horizontalDiff*2+myData.targetsRect.x-myData.targetsRect.width/2+iconSize+140+math.random(120),myData.targetsRect.y+fontSize(170)+fontSize(math.random(170))
myData.fw3.x, myData.fw3.y = horizontalDiff*3+myData.targetsRect.x-myData.targetsRect.width/2+iconSize*2+260+math.random(100),myData.targetsRect.y+fontSize(170)+fontSize(math.random(130))
myData.fw4.x, myData.fw4.y = horizontalDiff+myData.targetsRect.x-myData.targetsRect.width/2+40+math.random(100),myData.targetsRect.y+fontSize(310)+iconSize+fontSize(math.random(170))
myData.fw5.x, myData.fw5.y = horizontalDiff*3+myData.targetsRect.x-myData.targetsRect.width/2+iconSize*2+300+math.random(100),myData.targetsRect.y+fontSize(300)+iconSize+fontSize(math.random(170))
myData.fw6.x, myData.fw6.y = horizontalDiff+myData.targetsRect.x-myData.targetsRect.width/2+40+math.random(100),myData.targetsRect.y+fontSize(300)+iconSize*2+fontSize(180)+fontSize(math.random(110))
myData.fw7.x, myData.fw7.y = horizontalDiff*2+myData.targetsRect.x-myData.targetsRect.width/2+iconSize+140+math.random(120),myData.targetsRect.y+fontSize(300)+iconSize*2+fontSize(120)+fontSize(math.random(170))
myData.fw8.x, myData.fw8.y = horizontalDiff*3+myData.targetsRect.x-myData.targetsRect.width/2+iconSize*2+260+math.random(100),myData.targetsRect.y+fontSize(300)+iconSize*2+fontSize(180)+fontSize(math.random(110))
local imageA = { type="image", filename="img/terminal_unknown.png" }
for i=1,8 do
local cur = "fw"..i
myData[cur].fill = imageA
myData[cur].scan = false
myData[cur].atk = false
myData[cur].txtb.alpha=0
myData[cur].txt.alpha=0
myData[cur].ip.alpha=0
myData[cur].txtb:setStrokeColor(0,0.7,0)
myData[cur].txt:setFillColor(0,0.7,0)
myData[cur].ip:setFillColor(textColor1[1],textColor1[2],textColor1[3])
myData[cur].txtb.x,myData[cur].txtb.y = myData[cur].x+myData[cur].width/2,myData[cur].y
myData[cur].txt.x,myData[cur].txt.y = myData[cur].x+myData[cur].width/2,myData[cur].txtb.y-10
myData[cur].ip.x,myData[cur].ip.y = myData[cur].x+myData[cur].width/2,myData[cur].y+myData[cur].height+10
changeImgColor(myData[cur])
end
local isOn = "false"
if (myData.globalButton.isOn == true) then isOn="true" end
local headers = {}
local body = "id="..string.urlEncode(loginInfo.token).."&global="..isOn.."&data="..string.urlEncode(generateNonce())
local params = {}
params.headers = headers
params.body = body
network.request( host().."getTargets.php", "POST", terminalNetworkListener, params )
refreshTargetsRx = false
end
end
local function scanFromList( event )
myData.manualInput.text=event.target.ip
if (isIpAddress(event.target.ip)) then
closeTL()
manualScanRx=false
local headers = {}
local body = "id="..string.urlEncode(loginInfo.token).."&target="..event.target.ip
print("Scanning: "..myData.manualInput.text)
local params = {}
params.headers = headers
params.body = body
network.request( host().."getUuid.php", "POST", manualScanListener, params )
end
end
local function targetListListener( event )
if ( event.isError ) then
print( "Network error: ", event.response )
local alert = native.showAlert( "EliteHax", "Oops.. A network error occured...", { "Close" }, onAlert )
else
print ( "RESPONSE: " .. event.response )
local t = json.decode( base64Decode(event.response) )
if ( t == nil ) then
print ("EMPTY T")
local alert = native.showAlert( "EliteHax", "Oops.. A network error occured...", { "Close" }, onAlert )
end
for i in pairs( t.targets ) do
local color = tableColor1
if (math.mod(i, 2) == 0) then
rowColor = tableColor2
end
rowColor = {
default = { 0, 0, 0, 0 }
}
lineColor = {
default = { 1, 1, 0.17 }
}
myData.targetsListTable:insertRow(
{
isCategory = isCategory,
rowHeight = fontSize(230),
rowColor = rowColor,
lineColor = lineColor,
params = {
name=t.targets[i].name,
color=color,
ip=t.targets[i].ip,
desc=t.targets[i].desc
}
}
)
end
end
end
function refreshTargetList(event)
myData.targetsListTable:deleteAllRows()
local headers = {}
local body = "id="..string.urlEncode(loginInfo.token)
local params = {}
params.headers = headers
params.body = body
network.request( host().."getTargetList.php", "POST", targetListListener, params )
end
local function removeFromTargetListListener( event )
if ( event.isError ) then
print( "Network error: ", event.response )
local alert = native.showAlert( "EliteHax", "Oops.. A network error occured...", { "Close" }, onAlert )
else
print ( "RESPONSE: " .. event.response )
local t = json.decode( base64Decode(event.response) )
if ( t == nil ) then
print ("EMPTY T")
local alert = native.showAlert( "EliteHax", "Oops.. A network error occured...", { "Close" }, onAlert )
end
if (t.status == "OK") then
refreshTargetList()
end
end
end
local function editTargetList(event)
local sceneOverlayOptions =
{
time = 100,
effect = "crossFade",
params = {
name=event.target.name,
ip=event.target.ip,
desc=event.target.desc
},
isModal = true
}
tapSound()
composer.showOverlay( "editTargetListScene", sceneOverlayOptions)
addTargetOverlay=true
end
local function removeFromTargetList( ip )
return function(event)
local i = event.index
if ( i == 1 ) then
local headers = {}
local body = "id="..string.urlEncode(loginInfo.token).."&ip="..ip
local params = {}
params.headers = headers
params.body = body
tapSound()
network.request( host().."removeFromTargetList.php", "POST", removeFromTargetListListener, params )
elseif ( i == 2 ) then
backSound()
end
end
end
local function removeFromTargetListAlert( event )
tapSound()
local alert = native.showAlert( "EliteHax", "Do you want to remove this target from the list?", { "Yes", "No"}, removeFromTargetList(event.target.ip) )
end
local function onRowRender( event )
local row = event.row
local params = event.row.params
row.rowRectangle = display.newRoundedRect( row, 0, 0, row.width-20, row.height-fontSize(10), 60 )
row.rowRectangle.strokeWidth = 0
row.rowRectangle.anchorX=0
row.rowRectangle.anchorY=0
row.rowRectangle.x,row.rowRectangle.y=10,5
row.rowRectangle:setFillColor(params.color.default[1],params.color.default[2],params.color.default[3])
row.rowTitle = display.newText( row, params.name.."\n"..params.ip, 0, 0, native.systemFont, fontSize(52) )
row.rowTitle.anchorX=0
row.rowTitle.anchorY=0
row.rowTitle.x = 40
row.rowTitle.y = fontSize(15)
row.rowTitle:setTextColor( 0, 0, 0 )
row.rowDesc = display.newText( row, params.desc.."\n", 0, 0, row.width-40, 0, native.systemFont, fontSize(46) )
row.rowDesc.anchorX = 0
row.rowDesc.anchorY = 0
row.rowDesc.x = 40
row.rowDesc.y = row.rowTitle.y+row.rowTitle.height+3
row.rowDesc:setTextColor( 0, 0, 0 )
row.editListBtn = display.newImageRect( "img/edit.png",iconSize/2.2,iconSize/2.2 )
row.editListBtn.name=params.name
row.editListBtn.ip=params.ip
row.editListBtn.desc=params.desc.."\n"
row.editListBtn.anchorX = 0
row.editListBtn.anchorY = 0.5
row.editListBtn.x, row.editListBtn.y = row.x+row.width-(iconSize/2.2)*3-60, row.height/2-20
changeImgColor(row.editListBtn)
row.editListBtn:addEventListener("tap",editTargetList)
row.removeBtn = display.newImageRect( "img/delete.png",iconSize/2.2,iconSize/2.2 )
row.removeBtn.ip = params.ip
row.removeBtn.anchorX = 0
row.removeBtn.anchorY = 0.5
row.removeBtn.x, row.removeBtn.y = row.editListBtn.x+row.editListBtn.width+20, row.height/2-20
row.removeBtn:addEventListener("tap",removeFromTargetListAlert)
row.listScanBtn = display.newImageRect( "img/scan.png",iconSize/2.2,iconSize/2.2 )
row.listScanBtn.ip = params.ip
row.listScanBtn.anchorX = 0
row.listScanBtn.anchorY = 0.5
row.listScanBtn.x, row.listScanBtn.y = row.removeBtn.x+row.removeBtn.width+20, row.height/2-20
changeImgColor(row.listScanBtn)
row.listScanBtn:addEventListener("tap",scanFromList)
row:insert(row.editListBtn)
row:insert(row.removeBtn)
row:insert(row.listScanBtn)
end
local function addTargetBtn(event)
if (event.phase == "ended") then
local sceneOverlayOptions =
{
time = 300,
effect = "crossFade",
params = {
},
isModal = true
}
tapSound()
composer.showOverlay( "addTargetListScene", sceneOverlayOptions)
addTargetOverlay=true
end
end
function targetListOpen(event)
if (scanOverlay==true) then
if (attackerLine) then
attackerLine:removeSelf()
attackerLine = newLine
end
if (typewriterTimer) then
timer.cancel(typewriterTimer)
end
scanOverlay=false
composer.hideOverlay( "fade", 400 )
end
if (event.phase == "ended") and (targetListOverlay==false) then
tapSound()
targetListOverlay=true
myData.backButton:setLabel("Close")
myData.attacker.alpha=0
myData.refreshButton.alpha=0
myData.globalButton.alpha=0
myData.targetsListRect = display.newImageRect( "img/terminal_targets_list.png",display.contentWidth-20,fontSize(1300) )
myData.targetsListRect.anchorX = 0.5
myData.targetsListRect.anchorY = 0
myData.targetsListRect.x, myData.targetsListRect.y = display.contentWidth/2,myData.top_background.y+myData.top_background.height
changeImgColor(myData.targetsListRect)
-- Close Button
myData.closeTLBtn = display.newImageRect( "img/x.png",iconSize/2.5,iconSize/2.5 )
myData.closeTLBtn.anchorX = 0
myData.closeTLBtn.anchorY = 0
myData.closeTLBtn.x, myData.closeTLBtn.y = myData.targetsListRect.x+myData.targetsListRect.width/2-iconSize/2.5-40, myData.targetsListRect.y+fontSize(80)
changeImgColor(myData.closeTLBtn)
myData.closeTLBtn:addEventListener("tap",closeTL)
--Target Table
myData.targetsListTable = widget.newTableView(
{
left = myData.targetsListRect.x,
top = myData.closeTLBtn.y+myData.closeTLBtn.height+10,
height = fontSize(960),
width = myData.targetsListRect.width-60,
onRowRender = onRowRender,
--onRowTouch = onRowTouch,
listener = scrollListener,
hideBackground = true
}
)
myData.targetsListTable.anchorX=0.5
myData.targetsListTable.x=myData.targetsListRect.x
myData.addTargetButton = widget.newButton(
{
left = 20,
top = myData.targetsListTable.y+myData.targetsListTable.height/2+20,
width = display.contentWidth - 80,
height = display.actualContentHeight/15-5,
defaultFile = buttonColor1080,
-- overFile = "buttonOver.png",
fontSize = fontSize(80),
label = "Add Target",
labelColor = tableColor1,
onEvent = addTargetBtn
})
myData.addTargetButton.anchorX=0.5
myData.addTargetButton.x=myData.targetsListRect.x
myData.addTargetButton:addEventListener("tap",addTargetBtn)
group:insert(myData.targetsListRect)
group:insert(myData.closeTLBtn)
group:insert(myData.targetsListTable)
group:insert(myData.addTargetButton)
--Get Target List
local headers = {}
local body = "id="..string.urlEncode(loginInfo.token)
local params = {}
params.headers = headers
params.body = body
network.request( host().."getTargetList.php", "POST", targetListListener, params )
end
end
local function onSwitchPress(event)
if (event.target.isOn==true) then
tapSound()
else
backSound()
end
end
---------------------------------------------------------------------------------
--> SCENE EVENTS
---------------------------------------------------------------------------------
-- Scene Creation
function terminalScene:create(event)
group = self.view
loginInfo = localToken()
scanOverlay=false
targetListOverlay=false
addTargetOverlay=false
iconSize=fontSize(220)
horizontalDiff=(200-iconSize)/2
--Top Money/Name Background
myData.top_background = display.newImageRect( "img/top_background.png",display.contentWidth-40, fontSize(100))
myData.top_background.anchorX = 0.5
myData.top_background.anchorY = 0
myData.top_background.x, myData.top_background.y = display.contentWidth/2,5+topPadding()
changeImgColor(myData.top_background)
--Money
myData.moneyTextTerminal = display.newText("",115,myData.top_background.y+myData.top_background.height/2,native.systemFont, fontSize(48))
myData.moneyTextTerminal.anchorX = 0
myData.moneyTextTerminal.anchorY = 0.5
myData.moneyTextTerminal:setFillColor( 0.9,0.9,0.9 )
--Player Name
myData.playerTextTerminal = display.newText("",display.contentWidth-250,myData.top_background.y+myData.top_background.height/2,native.systemFont, fontSize(48))
myData.playerTextTerminal.anchorX = 0.5
myData.playerTextTerminal.anchorY = 0.5
myData.playerTextTerminal:setFillColor( 0.9,0.9,0.9 )
myData.targetsRect = display.newImageRect( "img/terminal_targets.png",display.contentWidth-20,fontSize(1300) )
myData.targetsRect.anchorX = 0.5
myData.targetsRect.anchorY = 0
myData.targetsRect.x, myData.targetsRect.y = display.contentWidth/2,myData.top_background.y+myData.top_background.height
changeImgColor(myData.targetsRect)
-- Global Checkbox
myData.globalT = display.newText("Global",50,myData.targetsRect.y+fontSize(80),native.systemFont, fontSize(65))
myData.globalT.anchorX = 0
myData.globalT.anchorY = 0
myData.globalT:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
local options = {
width = 200,
height = 200,
numFrames = 2,
sheetContentWidth = 400,
sheetContentHeight = 200
}
local checkboxSheet = graphics.newImageSheet( checkboxColor, options )
myData.globalButton = widget.newSwitch(
{
left = myData.globalT.x+200,
top = myData.globalT.y+5,
width = fontSize(80),
height = fontSize(80),
style = "checkbox",
id = "Checkbox",
onPress = onSwitchPress,
sheet = checkboxSheet,
frameOff = 1,
frameOn = 2
}
)
-- Refresh
myData.refreshButton = widget.newButton(
{
left = display.contentWidth-150,
top = myData.targetsRect.y+fontSize(80),
width = fontSize(80),
height = fontSize(80),
defaultFile = refreshColor,
-- overFile = "buttonOver.png",
onEvent = refreshTargets
})
myData.attacker = display.newImageRect( "img/attacker.png",iconSize*1.3,iconSize*1.3 )
myData.attacker.id="attacker"
myData.attacker.anchorX = 0.5
myData.attacker.anchorY = 0.5
myData.attacker.x, myData.attacker.y = display.contentWidth/2,myData.targetsRect.y+myData.targetsRect.height/2+fontSize(80)
myData.fw1 = display.newImageRect( "img/terminal_unknown.png",iconSize,iconSize )
myData.fw1.id="fw1"
myData.fw1.anchorX = 0
myData.fw1.anchorY = 0
myData.fw1.x, myData.fw1.y = horizontalDiff+myData.targetsRect.x-myData.targetsRect.width/2+40+math.random(100),myData.targetsRect.y+fontSize(170)+fontSize(math.random(130))
changeImgColor(myData.fw1)
myData.fw1.txtb = display.newRoundedRect(myData.fw1.x+myData.fw1.width/2,myData.fw1.y,70,70,12)
myData.fw1.txtb.anchorX=0.5
myData.fw1.txtb.anchorY=0
myData.fw1.txtb.strokeWidth = 5
myData.fw1.txtb:setFillColor( 0,0,0 )
myData.fw1.txtb:setStrokeColor( 0,0.7,0 )
myData.fw1.txtb.alpha=0
myData.fw1.txt = display.newText("",myData.fw1.x+myData.fw1.width/2,myData.fw1.txtb.y-10 ,native.systemFont, fontSize(72))
myData.fw1.txt:setFillColor( 0,0.7,0 )
myData.fw1.txt.anchorY=0
myData.fw1.txt.alpha=0
myData.fw1.ip = display.newText("",myData.fw1.x+myData.fw1.width/2,myData.fw1.y+myData.fw1.height+10,native.systemFont, fontSize(32))
myData.fw1.ip:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
myData.fw1.ip.alpha=0
myData.fw2 = display.newImageRect( "img/terminal_unknown.png",iconSize,iconSize )
myData.fw2.id="fw2"
myData.fw2.anchorX = 0
myData.fw2.anchorY = 0
myData.fw2.x, myData.fw2.y = horizontalDiff*2+myData.targetsRect.x-myData.targetsRect.width/2+iconSize+140+math.random(120),myData.targetsRect.y+fontSize(170)+fontSize(math.random(170))
changeImgColor(myData.fw2)
myData.fw2.txtb = display.newRoundedRect(myData.fw2.x+myData.fw2.width/2,myData.fw2.y,70,70,12)
myData.fw2.txtb.anchorX=0.5
myData.fw2.txtb.anchorY=0
myData.fw2.txtb.strokeWidth = 5
myData.fw2.txtb:setFillColor( 0,0,0 )
myData.fw2.txtb:setStrokeColor( 0,0.7,0 )
myData.fw2.txtb.alpha=0
myData.fw2.txt = display.newText("",myData.fw2.x+myData.fw2.width/2,myData.fw2.txtb.y-10 ,native.systemFont, fontSize(72))
myData.fw2.txt:setFillColor( 0,0.7,0 )
myData.fw2.txt.anchorY=0
myData.fw2.txt.alpha=0
myData.fw2.ip = display.newText("",myData.fw2.x+myData.fw2.width/2,myData.fw2.y+myData.fw2.height+10 ,native.systemFont, fontSize(32))
myData.fw2.ip:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
myData.fw2.ip.alpha=0
myData.fw3 = display.newImageRect( "img/terminal_unknown.png",iconSize,iconSize )
myData.fw3.id="fw3"
myData.fw3.anchorX = 0
myData.fw3.anchorY = 0
myData.fw3.x, myData.fw3.y = horizontalDiff*3+myData.targetsRect.x-myData.targetsRect.width/2+iconSize*2+260+math.random(100),myData.targetsRect.y+fontSize(170)+fontSize(math.random(130))
changeImgColor(myData.fw3)
myData.fw3.txtb = display.newRoundedRect(myData.fw3.x+myData.fw3.width/2,myData.fw3.y,70,70,12)
myData.fw3.txtb.anchorX=0.5
myData.fw3.txtb.anchorY=0
myData.fw3.txtb.strokeWidth = 5
myData.fw3.txtb:setFillColor( 0,0,0 )
myData.fw3.txtb:setStrokeColor( 0,0.7,0 )
myData.fw3.txtb.alpha=0
myData.fw3.txt = display.newText("",myData.fw3.x+myData.fw3.width/2,myData.fw3.txtb.y-10 ,native.systemFont, fontSize(72))
myData.fw3.txt:setFillColor( 0,0.7,0 )
myData.fw3.txt.anchorY=0
myData.fw3.txt.alpha=0
myData.fw3.ip = display.newText("",myData.fw3.x+myData.fw3.width/2,myData.fw3.y+myData.fw3.height+10 ,native.systemFont, fontSize(32))
myData.fw3.ip:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
myData.fw3.ip.alpha=0
myData.fw4 = display.newImageRect( "img/terminal_unknown.png",iconSize,iconSize )
myData.fw4.id="fw4"
myData.fw4.anchorX = 0
myData.fw4.anchorY = 0
myData.fw4.x, myData.fw4.y = horizontalDiff+myData.targetsRect.x-myData.targetsRect.width/2+40+math.random(100),myData.targetsRect.y+fontSize(310)+iconSize+fontSize(math.random(170))
changeImgColor(myData.fw4)
myData.fw4.txtb = display.newRoundedRect(myData.fw4.x+myData.fw4.width/2,myData.fw4.y,70,70,12)
myData.fw4.txtb.anchorX=0.5
myData.fw4.txtb.anchorY=0
myData.fw4.txtb.strokeWidth = 5
myData.fw4.txtb:setFillColor( 0,0,0 )
myData.fw4.txtb:setStrokeColor( 0,0.7,0 )
myData.fw4.txtb.alpha=0
myData.fw4.txt = display.newText("",myData.fw4.x+myData.fw4.width/2,myData.fw4.txtb.y-10 ,native.systemFont, fontSize(72))
myData.fw4.txt:setFillColor( 0,0.7,0 )
myData.fw4.txt.anchorY=0
myData.fw4.txt.alpha=0
myData.fw4.ip = display.newText("",myData.fw4.x+myData.fw4.width/2,myData.fw4.y+myData.fw4.height+10 ,native.systemFont, fontSize(32))
myData.fw4.ip:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
myData.fw4.ip.alpha=0
myData.fw5 = display.newImageRect( "img/terminal_unknown.png",iconSize,iconSize )
myData.fw5.id="fw5"
myData.fw5.anchorX = 0
myData.fw5.anchorY = 0
myData.fw5.x, myData.fw5.y = horizontalDiff*3+myData.targetsRect.x-myData.targetsRect.width/2+iconSize*2+300+math.random(100),myData.targetsRect.y+fontSize(310)+iconSize+fontSize(math.random(170))
changeImgColor(myData.fw5)
myData.fw5.txtb = display.newRoundedRect(myData.fw5.x+myData.fw5.width/2,myData.fw5.y,70,70,12)
myData.fw5.txtb.anchorX=0.5
myData.fw5.txtb.anchorY=0
myData.fw5.txtb.strokeWidth = 5
myData.fw5.txtb:setFillColor( 0,0,0 )
myData.fw5.txtb:setStrokeColor( 0,0.7,0 )
myData.fw5.txtb.alpha=0
myData.fw5.txt = display.newText("",myData.fw5.x+myData.fw5.width/2,myData.fw5.txtb.y-10 ,native.systemFont, fontSize(72))
myData.fw5.txt:setFillColor( 0,0.7,0 )
myData.fw5.txt.anchorY=0
myData.fw5.txt.alpha=0
myData.fw5.ip = display.newText("",myData.fw5.x+myData.fw5.width/2,myData.fw5.y+myData.fw5.height+10 ,native.systemFont, fontSize(32))
myData.fw5.ip:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
myData.fw5.ip.alpha=0
myData.fw6 = display.newImageRect( "img/terminal_unknown.png",iconSize,iconSize )
myData.fw6.id="fw6"
myData.fw6.anchorX = 0
myData.fw6.anchorY = 0
myData.fw6.x, myData.fw6.y = horizontalDiff+myData.targetsRect.x-myData.targetsRect.width/2+40+math.random(100),myData.targetsRect.y+fontSize(310)+iconSize*2+fontSize(180)+fontSize(math.random(80))
changeImgColor(myData.fw6)
myData.fw6.txtb = display.newRoundedRect(myData.fw6.x+myData.fw6.width/2,myData.fw6.y,70,70,12)
myData.fw6.txtb.anchorX=0.5
myData.fw6.txtb.anchorY=0
myData.fw6.txtb.strokeWidth = 5
myData.fw6.txtb:setFillColor( 0,0,0 )
myData.fw6.txtb:setStrokeColor( 0,0.7,0 )
myData.fw6.txtb.alpha=0
myData.fw6.txt = display.newText("",myData.fw6.x+myData.fw6.width/2,myData.fw6.txtb.y-10 ,native.systemFont, fontSize(72))
myData.fw6.txt:setFillColor( 0,0.7,0 )
myData.fw6.txt.anchorY=0
myData.fw6.txt.alpha=0
myData.fw6.ip = display.newText("",myData.fw6.x+myData.fw6.width/2,myData.fw6.y+myData.fw6.height+10 ,native.systemFont, fontSize(32))
myData.fw6.ip:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
myData.fw6.ip.alpha=0
myData.fw7 = display.newImageRect( "img/terminal_unknown.png",iconSize,iconSize )
myData.fw7.id="fw7"
myData.fw7.anchorX = 0
myData.fw7.anchorY = 0
myData.fw7.x, myData.fw7.y = horizontalDiff*2+myData.targetsRect.x-myData.targetsRect.width/2+iconSize+140+math.random(120),myData.targetsRect.y+fontSize(310)+iconSize*2+fontSize(120)+fontSize(math.random(140))
changeImgColor(myData.fw7)
myData.fw7.txtb = display.newRoundedRect(myData.fw7.x+myData.fw7.width/2,myData.fw7.y,70,70,12)
myData.fw7.txtb.anchorX=0.5
myData.fw7.txtb.anchorY=0
myData.fw7.txtb.strokeWidth = 5
myData.fw7.txtb:setFillColor( 0,0,0 )
myData.fw7.txtb:setStrokeColor( 0,0.7,0 )
myData.fw7.txtb.alpha=0
myData.fw7.txt = display.newText("",myData.fw7.x+myData.fw7.width/2,myData.fw7.txtb.y-10 ,native.systemFont, fontSize(72))
myData.fw7.txt:setFillColor( 0,0.7,0 )
myData.fw7.txt.anchorY=0
myData.fw7.txt.alpha=0
myData.fw7.ip = display.newText("",myData.fw7.x+myData.fw7.width/2,myData.fw7.y+myData.fw7.height+10 ,native.systemFont, fontSize(32))
myData.fw7.ip:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
myData.fw7.ip.alpha=0
myData.fw8 = display.newImageRect( "img/terminal_unknown.png",iconSize,iconSize )
myData.fw8.id="fw8"
myData.fw8.anchorX = 0
myData.fw8.anchorY = 0
myData.fw8.x, myData.fw8.y = horizontalDiff*3+myData.targetsRect.x-myData.targetsRect.width/2+iconSize*2+260+math.random(100),myData.targetsRect.y+fontSize(310)+iconSize*2+fontSize(180)+fontSize(math.random(80))
changeImgColor(myData.fw8)
myData.fw8.txtb = display.newRoundedRect(myData.fw8.x+myData.fw8.width/2,myData.fw8.y,70,70,12)
myData.fw8.txtb.anchorX=0.5
myData.fw8.txtb.anchorY=0
myData.fw8.txtb.strokeWidth = 5
myData.fw8.txtb:setFillColor( 0,0,0 )
myData.fw8.txtb:setStrokeColor( 0,0.7,0 )
myData.fw8.txtb.alpha=0
myData.fw8.txt = display.newText("",myData.fw8.x+myData.fw8.width/2,myData.fw8.txtb.y-10,native.systemFont, fontSize(72))
myData.fw8.txt:setFillColor( 0,0.7,0 )
myData.fw8.txt.anchorY=0
myData.fw8.txt.alpha=0
myData.fw8.ip = display.newText("",myData.fw8.x+myData.fw8.width/2,myData.fw8.y+myData.fw8.height+10 ,native.systemFont, fontSize(32))
myData.fw8.ip:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
myData.fw8.ip.alpha=0
myData.manualScanRect = display.newImageRect( "img/terminal_manualscan.png",display.contentWidth-20,fontSize(400) )
myData.manualScanRect.anchorX = 0.5
myData.manualScanRect.anchorY = 0
myData.manualScanRect.x, myData.manualScanRect.y = display.contentWidth/2,myData.targetsRect.y+myData.targetsRect.height-10
changeImgColor(myData.manualScanRect)
--Manual IP Insert
myData.manualT = display.newText("IP:",60,myData.manualScanRect.y+fontSize(140),native.systemFont, fontSize(60))
myData.manualT.anchorX = 0
myData.manualT.anchorY = 0
myData.manualT:setFillColor( textColor1[1],textColor1[2],textColor1[3] )
myData.manualInput = native.newTextField( myData.manualT.x+130, myData.manualT.y+myData.manualT.height/2, 540, fontSize(75))
myData.manualInput.anchorX = 0
myData.manualInput.anchorY = 0.5
myData.manualInput.placeholder = "IP Address";
myData.manualScanButton = widget.newButton(
{
left = myData.manualInput.x+myData.manualInput.width+20,
top = myData.manualInput.y-myData.manualInput.height/2-fontSize(10),
width = display.contentWidth/4,
height = fontSize(90),
defaultFile = buttonColor400,
-- overFile = "buttonOver.png",
fontSize = fontSize(80),
label = "Scan",
labelColor = tableColor1,
onEvent = manualScan
})
myData.manualScanButton.anchorX=0.5
myData.targetListButton = widget.newButton(
{
left = 35,
top = myData.manualT.y+myData.manualT.height+30,
width = display.contentWidth - 80,
height = display.actualContentHeight/15-5,
defaultFile = buttonColor1080,
-- overFile = "buttonOver.png",
fontSize = fontSize(80),
label = "Target List",
labelColor = tableColor1,
onEvent = targetListOpen
})
myData.targetListButton.anchorX=0.5
myData.backButton = widget.newButton(
{
left = 20,
top = display.actualContentHeight - (display.actualContentHeight/15) + topPadding(),
width = display.contentWidth - 40,
height = display.actualContentHeight/15-5,
defaultFile = buttonColor1080,
-- overFile = "buttonOver.png",
fontSize = fontSize(80),
label = "Back",
labelColor = tableColor1,
onEvent = goBack
})
-- Background
myData.background = display.newImage("img/background.jpg")
myData.background:scale(4,8)
myData.background.alpha = 0.3
changeImgColor(myData.background)
-- Show HUD
group:insert(myData.background)
group:insert(myData.top_background)
group:insert(myData.moneyTextTerminal)
group:insert(myData.playerTextTerminal)
group:insert(myData.targetsRect)
group:insert(myData.globalT)
group:insert(myData.globalButton)
group:insert(myData.refreshButton)
group:insert(myData.manualScanRect)
group:insert(myData.manualT)
group:insert(myData.manualInput)
group:insert(myData.manualScanButton)
group:insert(myData.targetListButton)
group:insert(myData.attacker)
group:insert(myData.fw1)
group:insert(myData.fw2)
group:insert(myData.fw3)
group:insert(myData.fw4)
group:insert(myData.fw5)
group:insert(myData.fw6)
group:insert(myData.fw7)
group:insert(myData.fw8)
group:insert(myData.fw1.txtb)
group:insert(myData.fw2.txtb)
group:insert(myData.fw3.txtb)
group:insert(myData.fw4.txtb)
group:insert(myData.fw5.txtb)
group:insert(myData.fw6.txtb)
group:insert(myData.fw7.txtb)
group:insert(myData.fw8.txtb)
group:insert(myData.fw1.txt)
group:insert(myData.fw2.txt)
group:insert(myData.fw3.txt)
group:insert(myData.fw4.txt)
group:insert(myData.fw5.txt)
group:insert(myData.fw6.txt)
group:insert(myData.fw7.txt)
group:insert(myData.fw8.txt)
group:insert(myData.fw1.ip)
group:insert(myData.fw2.ip)
group:insert(myData.fw3.ip)
group:insert(myData.fw4.ip)
group:insert(myData.fw5.ip)
group:insert(myData.fw6.ip)
group:insert(myData.fw7.ip)
group:insert(myData.fw8.ip)
group:insert(myData.backButton)
-- Button Listeners
myData.attacker:addEventListener( "touch", onAttackerTouch )
myData.refreshButton:addEventListener("tap",refreshTargets)
myData.manualScanButton:addEventListener("tap",manualScan)
myData.backButton:addEventListener("tap",goBack)
end
-- Home Show
function terminalScene:show(event)
local taskGroup = self.view
if event.phase == "will" then
local tutCompleted = loadsave.loadTable( "terminalTutorialStatus.json" )
if (tutCompleted == nil) or (tutCompleted.tutTerminal ~= true) then
tutOverlay = true
local sceneOverlayOptions =
{
time = 0,
effect = "crossFade",
params = { },
isModal = true
}
composer.showOverlay( "terminalTutScene", sceneOverlayOptions)
else
tutOverlay = false
end
local headers = {}
local body = "id="..string.urlEncode(loginInfo.token).."&data="..string.urlEncode(generateNonce())
local params = {}
params.headers = headers
params.body = body
network.request( host().."getTargets.php", "POST", terminalNetworkListener, params )
end
if event.phase == "did" then
--
end
end
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
--> Listener setup
---------------------------------------------------------------------------------
terminalScene:addEventListener( "create", terminalScene )
terminalScene:addEventListener( "show", terminalScene )
---------------------------------------------------------------------------------
return terminalScene
|
-- Copyright 2022 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.
-- Mock out globals
local test = require "integration_test"
local clusters = require "st.zigbee.zcl.clusters"
local OnOff = clusters.OnOff
local Level = clusters.Level
local capabilities = require "st.capabilities"
local zigbee_test_utils = require "integration_test.zigbee_test_utils"
local base64 = require "st.base64"
local t_utils = require "integration_test.utils"
local mock_simple_device = test.mock_device.build_test_zigbee_device(
{ profile = t_utils.get_profile_definition("on-off-level-intensity.yml") }
)
zigbee_test_utils.prepare_zigbee_env_info()
local function test_init()
test.mock_device.add_test_device(mock_simple_device)
zigbee_test_utils.init_noop_health_check_timer()
end
test.set_test_init_function(test_init)
test.register_message_test(
"Reported level should be handled",
{
{
channel = "zigbee",
direction = "receive",
message = {
mock_simple_device.id,
Level.attributes.CurrentLevel:build_test_attr_report(mock_simple_device,
math.floor(83 / 100 * 254))
}
},
{
channel = "capability",
direction = "send",
message = mock_simple_device:generate_test_message("main", capabilities.switchLevel.level(83))
}
}
)
test.register_message_test(
"Reported on off status should be handled: on",
{
{
channel = "zigbee",
direction = "receive",
message = { mock_simple_device.id, OnOff.attributes.OnOff:build_test_attr_report(mock_simple_device,
true) }
},
{
channel = "capability",
direction = "send",
message = mock_simple_device:generate_test_message("main", capabilities.switch.switch.on())
}
}
)
test.register_message_test(
"Reported on off status should be handled: off",
{
{
channel = "zigbee",
direction = "receive",
message = { mock_simple_device.id, OnOff.attributes.OnOff:build_test_attr_report(mock_simple_device,
false) }
},
{
channel = "capability",
direction = "send",
message = mock_simple_device:generate_test_message("main", capabilities.switch.switch.off())
}
}
)
test.register_message_test(
"Capability command setLevel should be handled",
{
{
channel = "capability",
direction = "receive",
message = { mock_simple_device.id, { capability = "switchLevel", component = "main", command = "setLevel", args = { 57, 0 } } }
},
{
channel = "zigbee",
direction = "send",
message = { mock_simple_device.id, Level.server.commands.MoveToLevelWithOnOff(mock_simple_device,
math.floor(57 * 0xFE / 100),
0) }
}
}
)
test.register_coroutine_test(
"doConfigure lifecycle should configure device",
function()
test.socket.device_lifecycle:__queue_receive({mock_simple_device.id, "doConfigure"})
test.socket.zigbee:__set_channel_ordering("relaxed")
test.socket.zigbee:__expect_send({
mock_simple_device.id,
OnOff.attributes.OnOff:read(mock_simple_device)
})
test.socket.zigbee:__expect_send({
mock_simple_device.id,
Level.attributes.CurrentLevel:read(mock_simple_device)
})
test.socket.zigbee:__expect_send({
mock_simple_device.id,
zigbee_test_utils.build_bind_request(mock_simple_device,
zigbee_test_utils.mock_hub_eui,
OnOff.ID)
})
test.socket.zigbee:__expect_send({
mock_simple_device.id,
OnOff.attributes.OnOff:configure_reporting(mock_simple_device, 0, 300)
})
test.socket.zigbee:__expect_send({
mock_simple_device.id,
zigbee_test_utils.build_bind_request(mock_simple_device,
zigbee_test_utils.mock_hub_eui,
Level.ID)
})
test.socket.zigbee:__expect_send({
mock_simple_device.id,
Level.attributes.CurrentLevel:configure_reporting(mock_simple_device,
1,
3600,
1)
})
mock_simple_device:expect_metadata_update({provisioning_state = "PROVISIONED"})
end
)
test.register_coroutine_test(
"health check coroutine",
function()
test.wait_for_events()
test.mock_time.advance_time(10000)
test.socket.zigbee:__set_channel_ordering("relaxed")
test.socket.zigbee:__expect_send({ mock_simple_device.id, OnOff.attributes.OnOff:read(mock_simple_device) })
test.socket.zigbee:__expect_send({ mock_simple_device.id, Level.attributes.CurrentLevel:read(mock_simple_device) })
test.wait_for_events()
end,
{
test_init = function()
test.mock_device.add_test_device(mock_simple_device)
test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "health_check")
end
}
)
test.run_registered_tests()
|
local keys_helper = require('apicast.policy.3scale_batcher.keys_helper')
local setmetatable = setmetatable
local ipairs = ipairs
local insert = table.insert
local resty_lock = require 'resty.lock'
local _M = {}
local mt = { __index = _M }
local lock_timeout = 10
local lock_options = { timeout = lock_timeout }
-- Note: storage needs to implement shdict interface.
function _M.new(storage, lock_shdict_name)
local self = setmetatable({}, mt)
self.storage = storage
self.lock_shdict_name = lock_shdict_name
return self
end
-- Note: When the lock cannot be acquired, the report will be lost.
-- The timeout is high, that means that if it could not be acquired, there's
-- probably a problem in the system.
-- TODO: Find a solution for this.
function _M:add(transaction)
local deltas = transaction.usage.deltas
local lock, new_lock_err = resty_lock:new(self.lock_shdict_name, lock_options)
if not lock then
ngx.log(ngx.ERR, 'failed to create lock: ', new_lock_err)
return
end
local elapsed, lock_err = lock:lock(transaction.service_id)
if not elapsed then
ngx.log(ngx.ERR, "failed to acquire the lock: ", lock_err)
return
end
for _, metric in ipairs(transaction.usage.metrics) do
local key = keys_helper.key_for_batched_report(
transaction.service_id, transaction.credentials, metric)
-- There is not a 'safe_incr'. In order to avoid overriding batched
-- reports, we call `safe_add` and call incr only when there was not an
-- error because the dict ran out of memory.
local add_ok, add_err = self.storage:safe_add(key, deltas[metric])
if not add_ok then
if add_err == 'no memory' then
ngx.log(ngx.ERR,
'Reports batching storage ran out of memory. ',
'Will lose a report of ', deltas[metric], ' to metric ', metric)
elseif add_err == 'exists' then
self.storage:incr(key, deltas[metric])
else
ngx.log(ngx.ERR, 'Error while batching report: ', add_err)
end
end
end
local ok, unlock_err = lock:unlock()
if not ok then
ngx.log(ngx.ERR, 'failed to unlock: ', unlock_err)
return
end
end
function _M:get_all(service_id)
local cached_reports = {}
local cached_report_keys = self.storage:get_keys()
local lock, new_lock_err = resty_lock:new(self.lock_shdict_name, lock_options)
if not lock then
ngx.log(ngx.ERR, 'failed to create lock: ', new_lock_err)
return {}
end
local elapsed, lock_err = lock:lock(service_id)
if not elapsed then
ngx.log(ngx.ERR, "failed to acquire the lock: ", lock_err)
return {}
end
for _, key in ipairs(cached_report_keys) do
local value = self.storage:get(key)
local report, err = keys_helper.report_from_key_batched_report(key, value)
if not err then
if value > 0 and report and report.service_id == service_id then
insert(cached_reports, report)
self.storage:delete(key)
end
else
ngx.log(ngx.WARN, 'failed to get report for key ', key, ' err: ', err)
end
end
local ok, unlock_err = lock:unlock()
if not ok then
ngx.log(ngx.ERR, 'failed to unlock: ', unlock_err)
return cached_reports
end
return cached_reports
end
return _M
|
local BF_NIL = "BF_NIL"
local realmName
local reseverdata={};
local AllReseverData={};
local BankSaveData;
local function BigFootBank_SendData(sender)
local completely = true
local Str="BigFootBankData:";
local SayTab={}
local ii =0;
if BankSaveData[realmName].bankData then
if BankSaveData[realmName].bankData.numItems and BankSaveData[realmName].bankData.numItems>0 then
Str = Str..BankSaveData[realmName].bankData.time.."#"..GetRealmName().."#"..BankSaveData[realmName].bankData.numItems.."#";
for k,v in pairs(BankSaveData[realmName].bankData.Items) do
for i,j in pairs(v) do
if string.len(Str)+string.len(tostring(j)..",")>250 then
if ii >0 then
Str = Str.."&&";
end
ii =ii+1;
table.insert(SayTab,Str)
Str =tostring(j)..",";
else
Str =Str..tostring(j)..",";
end
end
Str =Str..";";
end
if string.len(Str)+string.len("BigFootBankDataend&&")>250 then
table.insert(SayTab,Str.."&&")
table.insert(SayTab,"BigFootBankDataend&&")
else
Str =Str.."BigFootBankDataend&&";
table.insert(SayTab,Str)
end
end
end
for k,v in pairs (SayTab) do
if string.find(v,BF_NIL) then
-- print("send nil")
completely = false
end
end
if completely then
for k,v in pairs (SayTab) do
-- SendAddonMessage("BigFootBankData",v,'WHISPER',target)
if sender then
C_ChatInfo.SendAddonMessage("BigFootBankData",v,'WHISPER',sender)
-- print("send",v)
else
if IsInGroup() then
C_ChatInfo.SendAddonMessage("BigFootBankData",v,"RAID");
end
if IsInGuild() then
C_ChatInfo.SendAddonMessage("BigFootBankData",v,"GUILD");
end
-- print("send",v)
end
end
end
end
local function BigFootBank_GetData()
BankSaveData[realmName].bankData.numItems = C_BlackMarket.GetNumItems();
if BankSaveData[realmName].bankData.numItems and BankSaveData[realmName].bankData.numItems >0 then
local name, texture, quantity, itemType, usable, level, levelType, sellerName, minBid, minIncrement, currBid, youHaveHighBid, numBids, timeLeft, link, marketID
name, texture, quantity, itemType, usable, level, levelType, sellerName, minBid, minIncrement, currBid, youHaveHighBid, numBids, timeLeft, link, marketID = C_BlackMarket.GetHotItem();
BankSaveData[realmName].bankData.HotItem={name, texture, quantity, itemType, usable, level, levelType, sellerName, minBid, minIncrement, currBid, youHaveHighBid, numBids, timeLeft, link, marketID};
BankSaveData[realmName].bankData.Items={}
local hour, minute = GetGameTime();
local date = C_Calendar.GetDate();
local month, day, year = date.month, date.monthDay, date.year
BankSaveData[realmName].bankData.time= year.."-"..month.."-"..day.."-"..hour.."-"..minute
for index =1,BankSaveData[realmName].bankData.numItems do
name, texture, quantity, itemType, usable, level, levelType, sellerName, minBid, minIncrement, currBid, youHaveHighBid, numBids, timeLeft, link, marketID = C_BlackMarket.GetItemInfoByIndex(index);
if not string.find(link,"|")then
link = BF_NIL
-- print(BF_NIL)
end
table.insert(BankSaveData[realmName].bankData.Items,{name or false, texture or false, quantity or false, itemType or false, usable or false, level or false, levelType or false, sellerName or false, minBid or false, minIncrement or false, currBid or false, youHaveHighBid or false, numBids or false, timeLeft or false, link or false, marketID or false})
end
BigFootBank_SendData()
end
end
------------返回1 自己的时间比对方的新。返回0 对方比自己新。返回-1 比较失败------------------------
local function BigFootBank_IsTimeNew(selfTime,OtherTime)
-- local hour, minute = GetGameTime();
-- local weekday, month, day, year = CalendarGetDate();
-- BankSaveData[realmName].bankData.time= year.."-"..month.."-"..day.."-"..hour.."-"..minute
if not selfTime then
return 0;
end
if not OtherTime then
return 1;
end
local myear,mmonth,mday,mhour,mminute = 0,0,0,0,0;
selfTime =selfTime.."-";
local i =0;
for s in string.gmatch(selfTime, "(.-)%-") do
i =i+1;
if i==1 then
myear = tonumber(s) or 0;
elseif i==2 then
mmonth = tonumber(s) or 0;
elseif i==3 then
mday = tonumber(s) or 0;
elseif i==4 then
mhour = tonumber(s) or 0;
elseif i==5 then
mminute = tonumber(s) or 0;
end
end
i=0;
local yyear,ymonth,yday,yhour,yminute = 0,0,0,0,0;
OtherTime = OtherTime.."-";
for s in string.gmatch(OtherTime, "(.-)%-") do
i =i+1;
if i==1 then
yyear =tonumber(s) or 0;
elseif i==2 then
ymonth =tonumber(s) or 0;
elseif i==3 then
yday =tonumber(s) or 0;
elseif i==4 then
yhour =tonumber(s) or 0;
elseif i==5 then
yminute =tonumber(s) or 0;
end
end
if yyear and ymonth and yday and yhour and yminute and myear and mmonth and mday and mhour and mminute then
if myear> yyear then
return 1;
elseif myear < yyear then
return 0;
end
if mmonth> ymonth then
return 1;
elseif mmonth < ymonth then
return 0;
end
if mday> yday then
return 1;
elseif mday < yday then
return 0;
end
if mhour> yhour then
return 1;
elseif mhour < yhour then
return 0;
end
if mminute> yminute then
return 1;
elseif mminute < yminute then
return 0;
end
end
return -1;
end
local function BigFootBank_CheckDataTime(itemTime,sender)
local selfTime=BankSaveData[realmName].bankData.time;
-- print(selfTime,itemTime,sender,BigFootBank_IsTimeNew(selfTime,itemTime))
local checkdata = BigFootBank_IsTimeNew(selfTime,itemTime);
if checkdata==1 then
-- print("回调 send")
BigFootBank_SendData(sender) --自己的数据比对方新 用自己的更新对方的数据
reseverdata={};
elseif checkdata==0 then
BankSaveData[realmName].bankData ={} -- 对方 比自己新 用对方的数据更新自己的数据。
BankSaveData[realmName].bankData =reseverdata;
-- BigFootBankCheck_SelfData()
reseverdata={};
local m_time =time()
if m_time -laseShoeTime >=60*30 then
if not BSay then
BigFootBank_SayEvent();
end
laseShoeTime = m_time;
end
else
reseverdata={}; ---比较失败 放弃接受的数据。
end
collectgarbage("collect");
end
local function BigFootBank_CheckResiveData(reseverStr,sender)
if InCombatLockdown() then return end
local itemServer=""
local itemnumber;
local itemTime="";
local checkStr="";
local itemnumber1 =0;
local onedata;
if reseverStr and reseverStr~="" then
reseverStr = reseverStr.."#"
for s in string.gmatch(reseverStr, "(.-)%#") do
itemnumber1 =itemnumber1+1;
if itemnumber1==1 then
itemTime =s;
elseif itemnumber1==2 then
itemServer =s;
elseif itemnumber1==3 then
itemnumber =tonumber(s);
elseif itemnumber1==4 then
checkStr =s;
end
end
if itemnumber then
reseverdata.time =itemTime;
reseverdata.numItems =itemnumber;
itemnumber1 =0
reseverdata.Items={}
for s in string.gmatch(checkStr, "(.-);") do
itemnumber1 =itemnumber1 +1;
onedata={};
for w in string.gmatch(s, "(.-),") do
if tonumber(w) then
table.insert(onedata,tonumber(w));
elseif w=="true" then
table.insert(onedata,true);
elseif w=="false" then
table.insert(onedata,false);
else
table.insert(onedata,w);
end
end
table.insert(reseverdata.Items,onedata);
end
local Bok =true
if itemServer ~=GetRealmName() then
Bok =false
end
if itemnumber1 ~=itemnumber then
-- print(itemnumber1,itemnumber)
Bok =false
end
for k,v in pairs(reseverdata.Items) do
if #v ~=16 then --------一件物品有16个信息
Bok =false;
end
end
if Bok then
BigFootBank_CheckDataTime(itemTime,sender)
end
end
end
end
local function table2json(t)
local function serialize(tbl)
local tmp = {}
for k, v in pairs(tbl) do
local k_type = type(k)
local v_type = type(v)
local key = (k_type == "string" and "\"" .. k .. "\":")
or (k_type == "number" and "")
local value = (v_type == "table" and serialize(v))
or (v_type == "boolean" and tostring(v))
or (v_type == "string" and "\"" .. v .. "\"")
or (v_type == "number" and v)
tmp[#tmp + 1] = key and value and tostring(key) .. tostring(value) or nil
end
if table.maxn(tbl) == 0 then
return "{" .. table.concat(tmp, ",") .. "}"
else
return "[" .. table.concat(tmp, ",") .. "]"
end
end
assert(type(t) == "table")
return serialize(t)
end
local function BigFootBank_OnEvent(self, event, ...)
if event == "ADDON_LOADED" and select(1,...) == "EuiScript" then
realmName = GetRealmName()
BankSaveData = BankSaveData or {}
if not BankSaveData[realmName] then
BankSaveData[realmName] = {}
BankSaveData[realmName].bankData ={};
end
C_ChatInfo.RegisterAddonMessagePrefix("BigFootBankData");
self:UnregisterEvent("ADDON_LOADED");
elseif ( event == "BLACK_MARKET_BID_RESULT" or event == "BLACK_MARKET_OUTBID" or event == "BLACK_MARKET_ITEM_UPDATE" ) then
C_Timer.After(1, function() BigFootBank_GetData(); end);
elseif ( event == "CHAT_MSG_ADDON" ) then
local prefix,message,channel,sender = ...;
if prefix ~="BigFootBankData" then return end
-- print(channel,sender)
if (not AllReseverData[sender]) or AllReseverData[sender].BresiveData then
local ben =false
if string.find(message,"BigFootBankData:") then
-- print("begin")
AllReseverData[sender] ={};
AllReseverData[sender].BresiveData =true
AllReseverData[sender].channel= channel;
AllReseverData[sender].reseverStr="";
AllReseverData[sender].reseverStr=string.sub(message,17,-1);
ben =true;
-- print("CHAT_MSG_ADDON",string.sub(message,17,-1))
end
if AllReseverData[sender] and AllReseverData[sender].channel == channel and string.find(message,"BigFootBankDataend") then
AllReseverData[sender].BresiveData =false;
AllReseverData[sender].reseverStr =AllReseverData[sender].reseverStr..string.sub(message,0,-3);
BigFootBank_CheckResiveData(AllReseverData[sender].reseverStr,sender)
AllReseverData[sender] =nil;
end
if not ben and string.find(message,"&&") then
if AllReseverData[sender] and AllReseverData[sender].BresiveData and AllReseverData[sender].channel == channel then
AllReseverData[sender].reseverStr =AllReseverData[sender].reseverStr..string.sub(message,0,-3);
end
end
end
elseif (event == "PLAYER_CAMPING" or event == "PLAYER_QUITING") then
BankSaveDataJSON = table2json(BankSaveData);
end
end
local BigFootBank = CreateFrame("Frame")
BigFootBank:RegisterEvent("BLACK_MARKET_ITEM_UPDATE");
BigFootBank:RegisterEvent("BLACK_MARKET_BID_RESULT");
BigFootBank:RegisterEvent("BLACK_MARKET_OUTBID");
BigFootBank:RegisterEvent("CHAT_MSG_ADDON");
BigFootBank:RegisterEvent("PLAYER_CAMPING");
BigFootBank:RegisterEvent("PLAYER_QUITING");
BigFootBank:RegisterEvent("ADDON_LOADED")
BigFootBank:SetScript("OnEvent", BigFootBank_OnEvent)
|
return {
source = {
type = 'dist',
location = 'https://www.gnupg.org/ftp/gcrypt/gpgme/gpgme-1.5.1.tar.bz2',
sha256sum = '6c2f3af8ceeb303277d44ec0216d9a1271701f65b91d5942264cf7cefb4a11e3'
},
build = {
type = 'gnu',
options = {
'--includedir=/include',
'--disable-glibtest',
'--enable-fixed-path=/bin',
'--disable-gpgconf-test',
'--disable-gpg-test',
'--disable-gpgsm-test',
'--disable-g13-test',
'--with-libgpg-error-prefix=$pkg_install_root',
'--with-libassuan-prefix=$pkg_install_root'
},
},
install = {
libs = { 'gpgme' }
},
requires = { 'libassuan' }
}
|
require('components/boss/items')
require('components/boss/ai')
require('components/boss/bosses')
require('components/boss/spawn')
require('components/boss/ngp')
|
require "prototypes.technologies.satellite-telemetry"
local text ={
type = "flying-text",
name = "introspection-flying_text",
flags = {"placeable-off-grid", "not-on-map"},
time_to_live = 60,
speed = 0.05
}
data:extend{text}
|
fcEmptyAnimations = {--luacheck: allow defined top
filename = "__TheFatController__/graphics/trans1.png",
priority = "medium",
width = 1,
height = 1,
direction_count = 18,
frame_count = 1,
animation_speed = 0.15,
shift = {0.0, 0.0},
axially_symmetrical = true
}
fcEmptyLevel = {--luacheck: allow defined top
idle = fcEmptyAnimations,
idle_with_gun = fcEmptyAnimations,
running = fcEmptyAnimations,
running_with_gun = fcEmptyAnimations,
mining_with_tool = fcEmptyAnimations,
}
fcanimations = {--luacheck: ignore
level1 = fcEmptyLevel,
level2addon = nil,
level3addon = nil
}
|
data:extend(
{
{
type = "virtual-signal",
name = "counting-signal",
icon = "__UsefulCombinators__/graphics/icons/signal/counting-signal.png",
subgroup = "virtual-signal",
order = "z[counting]"
},
{
type = "virtual-signal",
name = "time-mod-signal",
icon = "__UsefulCombinators__/graphics/icons/signal/time-mod-signal.png",
subgroup = "virtual-signal",
order = "z[time-mod]"
},
{
type = "virtual-signal",
name = "divisor-signal",
icon = "__UsefulCombinators__/graphics/icons/signal/divisor-signal.png",
subgroup = "virtual-signal",
order = "z[divisor]"
},
{
type = "virtual-signal",
name = "interval-signal",
icon = "__UsefulCombinators__/graphics/icons/signal/interval-signal.png",
subgroup = "virtual-signal",
order = "z[interval]"
},
{
type = "virtual-signal",
name = "plus-one-signal",
icon = "__UsefulCombinators__/graphics/icons/signal/plus-one-signal.png",
subgroup = "virtual-signal",
order = "z[plus-one]"
},
{
type = "virtual-signal",
name = "output-signal",
icon = "__UsefulCombinators__/graphics/icons/signal/output-signal.png",
subgroup = "virtual-signal",
order = "z[output]"
},
{
type = "virtual-signal",
name = "reset-signal",
icon = "__UsefulCombinators__/graphics/icons/signal/reset-signal.png",
subgroup = "virtual-signal",
order = "z[reset]"
}
})
|
---------------------------------------------------------------------------------------------------
---main_menu_manager.lua
---author: Karl
---date: 2021.5.9
---desc: implements a menu manager object that initializes menu pages and handles menu exit for the
--- main menus
---------------------------------------------------------------------------------------------------
local MenuManager = require("BHElib.ui.menu.menu_manager")
---@class MainMenuManager:MenuManager
local M = LuaClass("menu.MainMenuManager", MenuManager)
local SceneTransition = require("BHElib.scenes.game_scene_transition")
local _init_callbacks = require("BHElib.scenes.main_menu.main_menu_page_init_callbacks")
---------------------------------------------------------------------------------------------------
---cache variables and functions
local TaskNew = task.New
local TaskDo = task.Do
local TaskWait = task.Wait
---------------------------------------------------------------------------------------------------
---create a main menu manager
---specifying the replay saving/loading paths should probably be done in the menu code,
---so I put these parameters below
---
---possible tasks formats:
---1.{"no_task"}
---2.{"save_replay"}
---
function M.__create(task_spec, temp_replay_path, replay_folder_path)
local self = MenuManager.__create()
self.task_spec = task_spec
self.temp_replay_path = temp_replay_path
self.replay_folder_path = replay_folder_path
return self
end
---@return string path of temporary replay writing slot
function M:getTempReplayPath()
return self.temp_replay_path
end
---@return string path of replay folder
function M:getReplayFolderPath()
return self.replay_folder_path
end
function M:setMenuScene(scene)
self.scene = scene
end
function M:initMenuPages()
local task_name = self.task_spec[1]
local menu_pages
if task_name == "no_task" then
menu_pages = {
{_init_callbacks.Title, "main_menu"},
}
elseif task_name == "save_replay" then
menu_pages = {
{_init_callbacks.Title, "main_menu"},
{_init_callbacks.ReplaySaver, "replay_saver"},
}
else
error("Error: Invalid menu task name: "..tostring(task_name))
end
for i = 1, #menu_pages do
local init_callback, menu_id = unpack(menu_pages[i])
self:setupMenuPageAtPos(init_callback, menu_id, i)
end
local menu_page_array = self.menu_page_array
-- simulate choices
if task_name == "save_replay" then
menu_page_array:setChoice(1, "go_to_menus", {menu_pages[2]})
menu_page_array:setChoice(1, "num_finished_menus", 1)
end
for i = 1, #menu_pages do
local init_callback, menu_id = unpack(menu_pages[i])
local cur_menu_page = self.menu_page_pool:getMenuFromPool(menu_id)
if i == #menu_pages then
cur_menu_page:setPageEnter(true, self.transition_speed)
else
cur_menu_page:setPageExit(true, self.transition_speed)
end
end
end
function M:update(dt)
MenuManager.update(self, dt)
TaskDo(self)
end
function M:onMenuExit()
self:setAllPageExit()
-- use task to implement waiting; requires calling task.Do in update function
TaskNew(self, function()
-- fade out menu page
TaskWait(math.ceil(1 / self.transition_speed))
-- start stage or exit game, depending on the state set by createNextGameScene
SceneTransition.transitionAtStartOfNextFrame(self.scene)
end)
end
return M
|
place = {"унутар", "ван"}
|
--// Fast table restore
--// Add your default values to the LoaderHead
--// You can add your hook on the someone scene: AddLoaderHook("FunctionName")
function LoaderHead()
Font["Name"] = "Arial"
Font["Text"] = "Arial"
Font["TextColor"] = "white"
Font["NameColor"] = "red"
end
|
object_tangible_quest_som_jedi_two_glyph_03 = object_tangible_quest_shared_som_jedi_two_glyph_03:new {
}
ObjectTemplates:addTemplate(object_tangible_quest_som_jedi_two_glyph_03, "object/tangible/quest/som_jedi_two_glyph_03.iff")
|
OpenNefia.Prototypes.Elona.EquipSlot.Elona = {
Head = {
Name = "頭",
},
Neck = {
Name = "首",
},
Back = {
Name = "背中",
},
Body = {
Name = "胴体",
},
Hand = {
Name = "手",
},
Ring = {
Name = "指",
},
Arm = {
Name = "腕",
},
Waist = {
Name = "腰",
},
Leg = {
Name = "足",
},
Ranged = {
Name = "遠隔",
},
Ammo = {
Name = "矢弾",
},
}
|
function EventHorizon:InitializeClass()
self.config.gcdSpellID = 118 -- Polymorph
self.config.hastedSpellID = {118,1.7}
self.config.past = -1 -- Number of seconds to show in the past. Default = -1
self.config.future = 9 -- Number of seconds to show in the future. Default = 9
-- Arcane
-- Clearcasting proc, Touch of the Magi CD, at half height and spell casts. *Note: I removed Arcane Barrage CD as it seemed pointless.
self:newSpell({
requiredTree = 1,
requiredLevel = 10,
cast = {116, 118, 759, 30451, 116011, 190336, 321507},
channel = {5143, 5},
playerbuff = 276743,
cooldown = 321507,
smallCooldown = true,
channel = {5143, 5},
barcolors = {
cooldown = {171/255, 191/255, 181/255, 0.6},
},
})
-- Nether Tempest
self:newSpell({
requiredTree = 1,
requiredTalent = {12,16},
debuff = {114923, 1},
barcolors = {
debuffmine = {252/255, 212/255, 252/255, 0.7},
},
})
-- Nether Tempest with Arcane Orb CD at half height, if both talents are taken.
self:newSpell({
requiredTree = 1,
requiredTalent = {12,17},
cooldown = 153626,
smallCooldown = true,
debuff = {114923, 1},
barcolors = {
debuffmine = {252/255, 212/255, 252/255, 0.7},
cooldown = {121/255, 141/255, 131/255, 0.9},
},
})
-- Nether Tempest with Supernova at half height, if both talents are taken.
self:newSpell({
requiredTree = 1,
requiredTalent = {12,18},
cooldown = 157980,
smallCooldown = true,
debuff = {114923, 1},
barcolors = {
debuffmine = {252/255, 212/255, 252/255, 0.7},
cooldown = {121/255, 141/255, 131/255, 0.9},
},
})
-- Arcane Orb
self:newSpell({
requiredTree = 1,
requiredTalent = 17,
requiredTalentUnselected = 12,
cooldown = 153626,
barcolors = {
cooldown = {242/255, 161/255, 252/255, 0.65},
},
})
-- Supernova
self:newSpell({
requiredTree = 1,
requiredTalent = 18,
requiredTalentUnselected = 12,
cooldown = 157980,
})
-- Rune of Power
self:newSpell({
requiredTree = 1,
requiredTalent = 9,
recharge = 116011,
playerbuff = 116011,
cast = 116011,
barcolors = {
playerbuff = {171/255, 070/255, 171/255, 0.5},
recharge = {171/255, 191/255, 181/255, 0.4}
},
})
-- Presence of Mind
self:newSpell({
requiredTree = 1,
requiredLevel = 42,
cooldown = 205025,
playerbuff = 205025,
barcolors = {
cooldown = {171/255, 191/255, 181/255, 0.6},
},
})
--Arcane Power
self:newSpell({
requiredTree = 1,
requiredLevel = 29,
cooldown = 12042,
playerbuff = 12042,
barcolors = {
playerbuff = {000/255, 000/255, 232/255, 0.6},
},
})
-- Evocate
self:newSpell({
requiredTree = 1,
requiredLevel = 27,
channel = {12051, 3},
recharge = 12051,
barcolors = {
recharge = {202/255, 161/255, 252/255, 0.5}
},
})
-- Fire
-- Heating up with casts and Fireblast recharge.
self:newSpell({
requiredTree = 2,
requiredLevel = 10,
cast = {133, 116, 118, 2120, 2948, 11366, 116011, 190336},
playerbuff = 48107,
recharge = 108853,
barcolors = {
playerbuff = {212/255, 111/255, 010/255, 0.7},
recharge = {171/255, 191/255, 181/255, 0.4},
},
})
-- Hot Streak! and Phoenix's Flames recharge.
self:newSpell({
requiredTree = 2,
requiredLevel = 14,
recharge = 257541,
playerbuff = 48108,
barcolors = {
playerbuff = {252/255, 020/255, 080/255, 0.6},
recharge = {202/255, 161/255, 050/255, 0.4},
},
})
-- Ignite and Dragon's Breath CD at half height.
self:newSpell({
requiredTree = 2,
requiredLevel = 14,
debuff = {12654, 1},
cooldown = 31661,
smallCooldown = true,
barcolors = {
debuffmine = {202/255, 030/255, 000/255, 0.7},
cooldown = {171/255, 191/255, 181/255, 0.6}
},
})
-- Living Bomb
self:newSpell({
requiredTree = 2,
requiredTalent = 18,
cooldown = 44457,
debuff = 44457,
barcolors = {
debuffmine = {252/255, 161/255, 040/255, 0.7},
cooldown = {171/255, 191/255, 181/255, 0.6}
},
})
-- Meteor
self:newSpell({
requiredTree = 2,
requiredTalent = 21,
cooldown = 153561,
barcolors = {
cooldown = {222/255, 060/255, 010/255, 0.4},
},
})
-- Rune of Power
self:newSpell({
requiredTree = 2,
requiredTalent = 9,
recharge = 116011,
playerbuff = {116011,18},
cast = 116011,
barcolors = {
playerbuff = {171/255, 070/255, 171/255, 0.5},
recharge = {151/255, 191/255, 252/255, 0.4}
},
})
-- Combustion
self:newSpell({
requiredTree = 2,
requiredLevel = 29,
cooldown = 190319,
playerbuff = 190319,
barcolors = {
playerbuff = {191/255, 191/255, 010/255, 0.6},
cooldown = {171/255, 171/255, 171/255, 0.4},
},
})
-- Pyroclasm
self:newSpell({
requiredTree = 2,
requiredTalent = 20,
playerbuff = 269650,
})
-- Frost
-- Brain Freeze with spell casts and Blizzard CD at half height.
self:newSpell({
requiredTree = 3,
requiredLevel = 10,
playerbuff = 190447,
icon = 190447,
cooldown = 190356,
smallCooldown = true,
cast = {116, 31687, 190336, 190356, 199786, 257537, 319836},
barcolors = {
playerbuff = {252/255, 232/255, 252/255, 0.5},
cooldown = {030/255, 030/255, 252/255, 0.9},
},
})
-- Fingers of Frost with Frozen Orb CD at half height.
self:newSpell({
requiredTree = 3,
requiredLevel = 13,
playerbuff = 112965,
cooldown = 84714,
smallCooldown = true,
barcolors = {
playerbuff = {030/255, 101/255, 191/255, 0.6},
cooldown = {171/255, 191/255, 181/255, 0.7},
},
})
-- Bone Chilling buff with Freeze CD at half height (pet ability), if you don't want to track the pet CD put -- infront of cooldown. It doesn't add an extra bar with this talent so I thought it was worthwhile.
self:newSpell({
requiredTree = 3,
requiredTalent = 1,
playerbuff = 205766,
cooldown = 33395,
smallCooldown = true,
})
--[[
-- Chain Reaction - I tried tracking this to see if you can keep it up by holding FoF procs but it's just too random, uncomment this spell if you'd like to try.
self:newSpell({
requiredTree = 3,
requiredTalent = 11,
playerbuff = 278309,
smallCooldown = true,
})
]]--
-- Ice Nova
self:newSpell({
requiredTree = 3,
requiredTalent = 3,
debuff = 157997,
cooldown = 157997,
barcolors = {
cooldown = {212/255, 222/255, 232/255, 0.4},
},
})
-- Comet Storm
self:newSpell({
requiredTree = 3,
requiredTalent = 18,
cooldown = 153595,
})
-- Ebonbolt
self:newSpell({
requiredTree = 3,
requiredTalent = 12,
requiredTalentUnselected = 21,
cooldown = 257537,
barcolors = {
cooldown = {040/255, 252/255, 252/255, 0.6},
},
})
-- Icicles, so we get a count for using Glacial Spike without Ebonbolt.
self:newSpell({
requiredTree = 3,
requiredTalent = 21,
requiredTalentUnselected = 12,
playerbuff = 205473,
icon = 205473,
barcolors = {
playerbuff = {242/255, 212/255, 252/255, 0.5},
},
})
-- Icicles, so we get a count for using Glacial Spike, with Ebonbolt CD at half height, if chosen.
self:newSpell({
requiredTree = 3,
requiredTalent = {12, 21},
playerbuff = 205473,
icon = 205473,
cooldown = 257537,
smallCooldown = true,
barcolors = {
playerbuff = {242/255, 212/255, 252/255, 0.5},
cooldown = {040/255, 252/255, 252/255, 0.6},
},
})
-- Rune of Power
self:newSpell({
requiredTree = 3,
requiredTalent = 9,
recharge = 116011,
playerbuff = 116011,
cast = 116011,
barcolors = {
playerbuff = {171/255, 070/255, 171/255, 0.5},
recharge = {171/255, 191/255, 181/255, 0.4}
},
})
-- Ray of Frost
self:newSpell({
requiredTree = 3,
requiredTalent = 20,
debuff = {205021, 1},
cooldown = 205021,
channel = 205021,
barcolors = {
cooldown = {040/255, 040/255, 232/255, 0.4},
},
})
-- Ice Veins
self:newSpell({
requiredTree = 3,
requiredLevel = 40,
cooldown = 12472,
playerbuff = 12472,
barcolors = {
playerbuff = {030/255, 040/255, 252/255, 0.6},
cooldown = {171/255, 191/255, 181/255, 0.6},
},
})
-- Ice Flows
self:newSpell({
requiredTree = 3,
requiredTalent = 6,
recharge = 108839,
barcolors = {
recharge = {101/255, 202/255, 242/255, 0.6},
},
})
end
|
local function rot9r(n, m)
local a,b,c,d,e,f,g,h,i=1,2,3,4,5,6,7,8,9
local s = ""
for x=1,n do
a,b,c,d,e,f,g,h,i=i,a,b,c,d,e,f,g,h
if x == m then s = table.concat{a,b,c,d,e,f,g,h,i} end
c,d = d,c
end
return table.concat{a,b,c,d,e,f,g,h,i, s}
end
assert(rot9r(0,0) == "123456789")
assert(rot9r(10,0) == "893124567")
assert(rot9r(105,0) == "913245678")
assert(rot9r(105,90) == "913245678891324567")
assert(rot9r(0,0) == "123456789")
assert(rot9r(1,0) == "913245678")
assert(rot9r(2,0) == "893124567")
assert(rot9r(1,1) == "913245678912345678")
assert(rot9r(2,1) == "893124567912345678")
assert(rot9r(2,2) == "893124567891324567")
|
-- Databox
-- This library automatically loads and saves it's storage into databox.json inside Documents directory.
-- And it uses iCloud KVS storage on iOS and tvOS.
-- It uses metatables to do it's job.
-- Require the library and call it with a table of default values. Only 1 level deep table is supported.
-- supported values are strings, numbers and booleans.
-- It will create and populate the file on the first run. If file already exists, it will load it's content into the data table.
-- Accessing data is simple like databox.someKey
-- Saving data is automatic on key change, you only need to set a value like databox.someKey = 'someValue'
-- If you update default values, all new values will be added into the existing file.
local json = require('json')
local iCloud
local data = {}
local defaultData = {}
local path = system.pathForFile('databox.json', system.DocumentsDirectory)
local isiOS = system.getInfo('platformName') == 'iPhone OS'
local istvOS = system.getInfo('platformName') == 'tvOS'
local isOSX = system.getInfo('platformName') == 'Mac OS X'
if isiOS or istvOS or isOSX then
iCloud = require('plugin.iCloud')
end
-- Copy tables by value
-- Nested tables are not supported, because iCloud
local function shallowcopy(t)
local copy = {}
for k, v in pairs(t) do
if type(k) == 'string' then
if type(v) == 'number' or type(v) == 'string' or type(v) == 'boolean' then
copy[k] = v
else
print('databox: Values of type "' .. type(v) .. '" are not supported.')
end
end
end
return copy
end
-- When saving, upload to iCloud and save to disk
local function saveData()
if iCloud then
iCloud.set('databox', data)
end
if not istvOS then
local file = io.open(path, 'w')
if file then
file:write(json.encode(data))
io.close(file)
end
end
end
-- When loading, try iCloud first and only then attempt reading from disk
-- If no file or no iCloud data - load defaults
local function loadData()
local iCloudData
if iCloud then
iCloudData = iCloud.get('databox')
end
if iCloudData then
data = iCloudData
else
if istvOS then
data = shallowcopy(defaultData)
saveData()
else
local file = io.open(path, 'r')
if file then
data = json.decode(file:read('*a'))
io.close(file)
else
data = shallowcopy(defaultData)
saveData()
end
end
end
end
-- If you update your app and set new defaults, check if an old file has all the keys
local function patchIfNewDefaultData()
local isPatched = false
for k, v in pairs(defaultData) do
if data[k] == nil then
data[k] = v
isPatched = true
end
end
if isPatched then
saveData()
end
end
-- Metatables action!
local mt = {
__index = function(t, k) -- On indexing, just return a field from the data table
return data[k]
end,
__newindex = function(t, k, value) -- On setting an index, save the data table automatically
data[k] = value
saveData()
end,
__call = function(t, value) -- On calling, initiate with defaults
if type(value) == 'table' then
defaultData = shallowcopy(value)
end
loadData()
patchIfNewDefaultData()
end
}
local _M = {}
setmetatable(_M, mt)
return _M
|
-- This tests the format, not the randomness
-- https://tools.ietf.org/html/rfc4122#section-4.4
local pattern = "^" .. table.concat({
string.rep("%x", 8),
string.rep("%x", 4),
"4" .. -- version
string.rep("%x", 3),
"[89ab]" .. -- reserved bits of 1 and 0
string.rep("%x", 3),
string.rep("%x", 12),
}, "%-") .. "$";
function generate(generate)
for _ = 1, 100 do
assert_is(generate():match(pattern));
end
end
function seed(seed)
assert_equal(seed("random string here"), nil, "seed doesn't return anything");
end
|
resource_manifest_verion '44febabe-d386-4d18-afbe-5e627f4af937'
game 'gta5'
author 'Ardavan81'
description 'Fix & Clean Command For Staff Team'
client_script 'client.lua'
server_script 'server.lua'
|
veermok_hunter = Creature:new {
objectName = "@mob/creature_names:veermok_hunter",
socialGroup = "veermok",
faction = "",
level = 17,
chanceHit = 0.32,
damageMin = 160,
damageMax = 170,
baseXp = 1257,
baseHAM = 3500,
baseHAMmax = 4300,
armor = 0,
resists = {115,-1,5,5,5,5,5,-1,-1},
meatType = "meat_carnivore",
meatAmount = 150,
hideType = "hide_bristley",
hideAmount = 150,
boneType = "bone_mammal",
boneAmount = 60,
milk = 0,
tamingChance = 0.25,
ferocity = 7,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + KILLER + STALKER,
optionsBitmask = AIENABLED,
diet = CARNIVORE,
templates = {"object/mobile/veermok_hue.iff"},
hues = { 16, 17, 18, 19, 20, 21, 22, 23 },
controlDeviceTemplate = "object/intangible/pet/veermok_hue.iff",
scale = 1.15,
lootGroups = {},
weapons = {},
conversationTemplate = "",
attacks = {
{"blindattack",""},
{"stunattack",""}
}
}
CreatureTemplates:addCreatureTemplate(veermok_hunter, "veermok_hunter")
|
require "oil"
oil.main(function()
local orb = oil.init()
------------------------------------------------------------------------------
orb:loadidl [[
module Adaptation {
interface Server {
boolean do_something_for(in long seconds);
};
interface Adaptor {
void update_definition(in string definition);
};
};
]]
------------------------------------------------------------------------------
local server_impl = {}
function server_impl:do_something_for(seconds)
print("about to sleep for "..seconds.." seconds")
oil.sleep(seconds)
return true
end
local adaptor_impl = {}
function adaptor_impl:update_definition(definition)
orb:loadidl(definition)
end
------------------------------------------------------------------------------
local server = orb:newservant(server_impl, nil, "IDL:Adaptation/Server:1.0")
local adaptor = orb:newservant(adaptor_impl, nil, "IDL:Adaptation/Adaptor:1.0")
------------------------------------------------------------------------------
oil.writeto("server.ior", orb:tostring(server))
oil.writeto("serveradaptor.ior", orb:tostring(adaptor))
------------------------------------------------------------------------------
orb:run()
end)
|
local serialize = require "serialize"
local t = require "testhelper"
local function reco( v )
return load( 'return ' .. serialize( v ) )()
end
-- Simple values
t( reco( nil ), nil, t.deepsame )
t( reco( true ), true, t.deepsame )
t( reco( 1 ), 1, t.deepsame )
t( reco( "hi" ), "hi", t.deepsame )
t( reco( {} ), {}, t.deepsame )
t( serialize( "\n" ), '"\\n"' )
t( serialize( "\r" ), '"\\13"' )
-- Table with values
t( reco( { a = true, b = { "c", 1, { d = "e" } }, } ),
{ a = true, b = { "c", 1, { d = "e" } }, },
t.deepsame )
-- Table table key
t( reco( { [ { ok = "ok" } ] = "ok", } ),
{ [ { ok = "ok" } ] = "ok", },
t.deepsame )
-- Multiple table values
t( reco( { ["a"] = { [ "a" ] = "a", }, ["b"] = { [ "b" ] = "b", }, } ),
{ ["a"] = { [ "a" ] = "a", }, ["b"] = { [ "b" ] = "b", }, },
t.deepsame )
-- Mixed key/value Table
t( reco( { ["ok"] = { [ { ok = "ok" } ] = "ok", }, } ),
{ ["ok"] = { [ { ok = "ok" } ] = "ok", }, },
t.deepsame )
-- Sequence
t( reco( { 'a','b',{'c','d'},'e'} ),
{ 'a','b',{'c','d'},'e'},
t.deepsame )
-- Sequence with holes
t( reco( { nil,nil,nil,'a',{'c','d'},} ),
{ nil,nil,nil,'a',{'c','d'},},
t.deepsame )
-- Table with reference
local atab = { a = "a" }
t( reco( { atab, a = atab, } ),
{ atab, a = atab, },
t.deepsame )
-- Sequence with tables
local atab = {}
t( reco( { 1, atab, 2, atab, 3,} ),
{ 1, atab, 2, atab, 3,},
t.deepsame )
-- Table with cycle
atab = {}
atab.a = {}
atab.a.a = atab
t( reco( atab ), atab, t.deepsame )
-- Table with multiple cycle
atab = {}
atab.kv = {}
atab[atab.kv] = atab.kv
atab[atab.kv][atab.kv] = atab[atab.kv]
t( reco( atab ), atab, t.deepsame )
-- Too deep table
local cur = atab
for n = 1, 200 do
cur.q = {}
cur = cur.q
end
t( reco( atab ), atab, t.deepsame )
-- Output function
local atab = {'a',2,[{}]={},}
local exp = serialize(atab)
local got = ''
t( serialize(atab, function(d) got = got .. d end), nil )
t( got, exp )
t.test_embedded_example()
t()
|
local playsession = {
{"ZeroBeta", {1081206}},
{"ManuelG", {1056004}},
{"cogito123", {1102163}},
{"Edyconex", {367832}},
{"yulingqixiao", {777960}},
{"captnemo", {287204}},
{"Kiwicake", {275970}},
{"kendoctor", {1059509}},
{"TheLeu", {539017}},
{"Lucasuper32", {291238}},
{"tykak", {387916}},
{"jackazzm", {992654}},
{"Nikkichu", {906643}},
{"GuidoCram", {183937}},
{"Pucio", {678159}},
{"Ruslan_kc", {30648}},
{"avatarlinux", {591065}},
{"PurpleLuk", {143566}},
{"2387354150", {514780}},
{"pwoland", {860312}},
{"ryanwilliams83", {18381}},
{"andrekoul", {707889}},
{"KingCoolICE", {8986}},
{"OmegaLunch", {781054}},
{"Zorin862", {733251}},
{"Boagguy10", {30447}},
{"KIRkomMAX", {86743}},
{"Tribbiani", {38655}},
{"Raijin-Kizuku", {245403}},
{"Aspin", {264227}},
{"kuumottaja", {600221}},
{"glenneaux", {39559}},
{"banakeg", {5551}},
{"FAChyba", {235451}},
{"TheWickedMaster", {24678}},
{"unixfreak", {233167}},
{"Sneakypoop", {326287}},
{"WoodShock", {183272}},
{"Arusu", {22684}},
{"darklight720", {159111}},
{"Manski666", {2393}},
{"he-duun", {6695}},
{"Silverwolf9300", {5287}},
{"Muppet123", {75208}},
{"EmuLegs", {10885}},
{"meinswank", {473284}},
{"kevinma", {20791}},
{"honoka-", {42905}},
{"Igorree", {53931}},
{"Hutspovian", {51642}},
{"AmiloPL", {34784}},
{"McC1oud", {392815}},
{"pedpenguins", {19792}},
{"MovingMike", {2491}},
{"Malorie_sXy", {199821}},
{"theheez", {145137}},
{"Dinnopum", {43899}}
}
return playsession
|
--------------------------------------------------------------------------------
-- 81-722 I/O module
--------------------------------------------------------------------------------
-- Copyright (C) 2013-2018 Metrostroi Team & FoxWorks Aerospace s.r.o.
-- Contains proprietary code. See license.txt for additional information.
--------------------------------------------------------------------------------
Metrostroi.DefineSystem("81_722_UPI")
TRAIN_SYSTEM.DontAccelerateSimulation = false
function TRAIN_SYSTEM:Initialize()
self.ChangeTimer = CurTime()
self.ControllerPosition = 0
self.TControllerPosition = 0
self.Emergency = 0
self.Cache = {}
self.OldTime = 0
end
function TRAIN_SYSTEM:Inputs()
return { }
end
function TRAIN_SYSTEM:Outputs()
return { "Emergency", "ControllerPosition" }
end
--if not TURBOSTROI then return end
function TRAIN_SYSTEM:TriggerInput(name,value)
end
function TRAIN_SYSTEM:Think()
local Train = self.Train
local CPos = Train.Panel.Controller
if self.TControllerPosition ~= CPos then
if self.TControllerPosition<CPos and CPos>0 or self.TControllerPosition>CPos and CPos<0 or CPos==0 then
table.insert(self.Cache,{CPos,CurTime()+0.2})
else
table.insert(self.Cache,{CPos,CurTime()+0.05})
end
self.TControllerPosition = CPos
end
if #self.Cache>0 and CurTime()-self.Cache[1][2] > 0 then
self.ControllerPosition = self.Cache[1][1] or 0
table.remove(self.Cache,1)
end
self.Emergency = CPos == -3 and 1 or 0
end
|
local Terminal = require('opus.terminal')
local trace = require('opus.trace')
local Util = require('opus.util')
local colors = _G.colors
local os = _G.os
local printError = _G.printError
local term = _G.term
local window = _G.window
local UID = 0
local multishell = { }
local processes = { }
local parentTerm = term.current()
local sessionFile = 'usr/config/twm'
local running
local parentMon = term.current()
local defaultEnv = Util.shallowCopy(_ENV)
defaultEnv.multishell = multishell
local monDim, termDim = { }, { }
monDim.width, monDim.height = parentMon.getSize()
termDim.width, termDim.height = parentTerm.getSize()
-- even though the monitor window is set to visible
-- the canvas is not (possibly change default in terminal.lua)
-- canvas is not visible so that redraws
-- are done once in the event loop
local monitor = Terminal.window(parentMon, 1, 1, monDim.width, monDim.height, true)
monitor.setBackgroundColor(colors.gray)
monitor.clear()
local function nextUID()
UID = UID + 1
return UID
end
local function xprun(env, path, ...)
setmetatable(env, { __index = _G })
local fn, m = loadfile(path, env)
if fn then
return trace(fn, ...)
end
return fn, m
end
local function write(win, x, y, text)
win.setCursorPos(x, y)
win.write(text)
end
local function redraw()
monitor.canvas:dirty()
monitor.canvas:clear(colors.gray)
for _, process in ipairs(processes) do
process.container.canvas:dirty()
end
end
local function getProcessAt(x, y)
for k = #processes, 1, -1 do
local process = processes[k]
if x >= process.x and
y >= process.y and
x <= process.x + process.width - 1 and
y <= process.y + process.height - 1 then
return k, process
end
end
end
--[[ A runnable process ]]--
local Process = { }
function Process:new(args)
args.env = args.env or Util.shallowCopy(defaultEnv)
args.width = args.width or math.floor(termDim.width * .75)
args.height = args.height or math.floor(termDim.height * .75)
-- TODO: randomize start position
local self = setmetatable({
uid = nextUID(),
x = args.x or 1,
y = args.y or 1,
width = args.width,
height = args.height + 1,
path = args.path,
args = args.args or { },
title = args.title or 'shell',
timestamp = os.clock(),
isMoving = false,
isResizing = false,
}, { __index = Process })
self:adjustDimensions()
if not args.x then
self.x = math.random(1, monDim.width - self.width + 1)
self.y = math.random(1, monDim.height - self.height + 1)
end
self.container = Terminal.window(monitor, self.x, self.y, self.width, self.height, true)
self.window = window.create(self.container, 1, 2, args.width, args.height, true)
self.terminal = self.window
self.container.canvas.parent = monitor.canvas
table.insert(monitor.canvas.layers, 1, self.container.canvas)
self.container.canvas:setVisible(true)
--self.container.getSize = self.window.getSize
self.co = coroutine.create(function()
local result, err
if args.fn then
result, err = Util.runFunction(args.env, args.fn, table.unpack(self.args))
elseif args.path then
result, err = xprun(args.env, args.path, table.unpack(self.args))
end
if not result and err and err ~= 'Terminated' then
printError('\n' .. tostring(err))
os.pullEventRaw('terminate')
end
multishell.removeProcess(self)
end)
self:focus(false)
return self
end
function Process:focus(focused)
self.container.setBackgroundColor(focused and colors.yellow or colors.lightGray)
self.container.setTextColor(colors.black)
write(self.container, 1, 1, string.rep(' ', self.width))
write(self.container, 2, 1, self.title)
write(self.container, self.width - 1, 1, '*')
write(self.container, self.width - 3, 1, '\029')
end
function Process:drawSizers()
self.container.setBackgroundColor(colors.black)
self.container.setTextColor(colors.yellow)
local str = string.format('%d x %d', self.width - 2, self.height - 3)
write(self.container, (self.width - #str) / 2, 1, str)
end
function Process:adjustDimensions()
self.width = math.min(self.width, monDim.width)
self.height = math.min(self.height, monDim.height)
self.x = math.max(1, self.x)
self.y = math.max(1, self.y)
self.x = math.min(self.x, monDim.width - self.width + 1)
self.y = math.min(self.y, monDim.height - self.height + 1)
end
function Process:reposition(resizing)
self:adjustDimensions()
self.container.reposition(self.x, self.y, self.width, self.height)
self.window.reposition(1, 2, self.width, self.height - 1)
if self.window ~= self.terminal then
if self.terminal.reposition then -- ??
self.terminal.reposition(1, 1, self.width, self.height - 1)
end
end
if resizing then
self:focus(self == processes[#processes])
end
redraw()
end
function Process:click(x, y, rx, ry)
if y == 1 then -- title bar
if x == self.width - 1 then
self:resume('terminate')
elseif x == self.width - 3 then
self.isResizing = { x = rx, y = ry, h = self.height, w = self.width }
else
self.isMoving = { x = rx, y = ry, ox = self.x, oy = self.y }
end
else
if self.isMoving then
self.isMoving = false
end
self:resume('mouse_click', 1, x, y - 1)
self:resume('mouse_up', 1, x, y - 1)
end
end
function Process:resize(x, y)
self.height = y - self.isResizing.y + self.isResizing.h
self.width = x - self.isResizing.x + self.isResizing.w
self:reposition(true)
self:resume('term_resize')
self:drawSizers()
multishell.saveSession(sessionFile)
end
function Process:resume(event, ...)
if coroutine.status(self.co) == 'dead' then
return
end
if not self.filter or self.filter == event or event == "terminate" then
--term.redirect(self.terminal)
local previousTerm = term.redirect(self.terminal)
local previous = running
running = self -- stupid shell set title
local ok, result = coroutine.resume(self.co, event, ...)
running = previous
self.terminal = term.current()
term.redirect(previousTerm)
if ok then
self.filter = result
else
printError(result)
end
return ok, result
end
end
--[[ Install a multishell manager for the monitor ]]--
function multishell.getFocus()
return processes[#processes].uid
end
function multishell.setFocus(uid)
local process = Util.find(processes, 'uid', uid)
if process then
local lastFocused = processes[#processes]
if lastFocused ~= process then
if lastFocused then
lastFocused:focus(false)
end
Util.removeByValue(processes, process)
table.insert(processes, process)
process.container.canvas:raise()
process:focus(true)
process.container.canvas:dirty()
process.window.restoreCursor()
end
return true
end
return false
end
function multishell.getTitle(uid)
local process = Util.find(processes, 'uid', uid)
if process then
return process.title
end
end
function multishell.setTitle(uid, title)
local process = Util.find(processes, 'uid', uid)
if process then
process.title = title or ''
process:focus(process == processes[#processes])
end
end
function multishell.getCurrent()
if running then
return running.uid
end
end
function multishell.getCount()
return #processes
end
function multishell.getTabs()
return processes
end
function multishell.launch(env, file, ...)
return multishell.openTab({
path = file,
env = env,
title = 'shell',
args = { ... },
})
end
function multishell.openTab(tabInfo)
local process = Process:new(tabInfo)
table.insert(processes, 1, process)
--local previousTerm = term.current()
process:resume()
--term.redirect(previousTerm)
multishell.saveSession(sessionFile)
return process.uid
end
function multishell.removeProcess(process)
Util.removeByValue(processes, process)
process.container.canvas:removeLayer()
multishell.saveSession(sessionFile)
redraw()
end
function multishell.saveSession(filename)
local t = { }
for _,process in ipairs(processes) do
if process.path then
table.insert(t, {
x = process.x,
y = process.y,
width = process.width,
height = process.height - 1,
path = process.path,
args = process.args,
})
end
end
Util.writeTable(filename, t)
end
function multishell.loadSession(filename)
local config = Util.readTable(filename)
if config then
for k = #config, 1, -1 do
multishell.openTab(config[k])
end
end
end
function multishell.stop()
multishell._stop = true
end
function multishell.start()
while not multishell._stop do
local event = { os.pullEventRaw() }
if event[1] == 'terminate' then
local focused = processes[#processes]
if focused then
focused:resume('terminate')
if #processes == 0 then
break
end
end
elseif event[1] == 'monitor_touch' or event[1] == 'mouse_click' then --or event[1] == 'mouse_up' then
local x, y = event[3], event[4]
local key, process = getProcessAt(x, y)
if process then
if key ~= #processes then
multishell.setFocus(process.uid)
multishell.saveSession(sessionFile)
end
process:click(x - process.x + 1, y - process.y + 1, x, y)
end
elseif event[1] == 'mouse_up' then
local focused = processes[#processes]
if focused and (focused.isResizing or focused.isMoving) then
multishell.saveSession(sessionFile)
if focused.isResizing then
focused:focus(true)
end
end
if focused then
focused.isResizing = nil
focused.isMoving = false
end
elseif event[1] == 'mouse_drag' then
local focused = processes[#processes]
if focused then
if focused.isResizing then
focused:resize(event[3], event[4])
elseif focused.isMoving then
focused.x = event[3] - focused.isMoving.x + focused.isMoving.ox
focused.y = event[4] - focused.isMoving.y + focused.isMoving.oy
focused:reposition(false)
end
end
elseif event[1] == 'char' or
event[1] == 'key' or
event[1] == 'key_up' or
event[1] == 'paste' or
event[1] == 'mouse_scroll' then
local focused = processes[#processes]
if focused then
focused:resume(table.unpack(event))
end
else
for _,process in pairs(Util.shallowCopy(processes)) do
process:resume(table.unpack(event))
end
end
monitor.canvas:render(parentMon)
local focused = processes[#processes]
if focused then
focused.window.restoreCursor()
end
end
end
multishell.loadSession(sessionFile)
if #processes == 0 then
multishell.openTab({
path = 'sys/apps/shell.lua',
title = 'shell',
})
end
processes[#processes]:focus(true)
multishell.start()
term.redirect(parentTerm)
parentTerm.clear()
parentTerm.setCursorPos(1, 1)
|
if not modules then modules = { } end modules ['font-otj'] = {
version = 1.001,
comment = "companion to font-lib.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files",
}
-- This property based variant is not faster but looks nicer than the attribute one. We
-- need to use rawget (which is about 4 times slower than a direct access but we cannot
-- get/set that one for our purpose! This version does a bit more with discretionaries
-- (and Kai has tested it with his collection of weird fonts.)
-- There is some duplicate code here (especially in the the pre/post/replace branches) but
-- we go for speed. We could store a list of glyph and mark nodes when registering but it's
-- cleaner to have an identification pass here. Also, I need to keep tracing in mind so
-- being too clever here is dangerous.
-- As we have a rawget on properties we don't need one on injections.
-- The use_advance code was just a test and is meant for testing and manuals. There is no
-- performance (or whatever) gain and using kerns is somewhat cleaner (at least for now).
-- An alternative is to have a list per base of all marks and then do a run over the node
-- list that resolves the accumulated l/r/x/y and then do an inject pass.
-- if needed we can flag a kern node as immutable
-- The thing with these positioning options is that it is not clear what Uniscribe does with
-- the 2rl flag and we keep oscillating a between experiments.
if not nodes.properties then return end
local next, rawget, tonumber = next, rawget, tonumber
local fastcopy = table.fastcopy
local registertracker = trackers.register
local registerdirective = directives.register
local trace_injections = false registertracker("fonts.injections", function(v) trace_injections = v end)
local trace_marks = false registertracker("fonts.injections.marks", function(v) trace_marks = v end)
local trace_cursive = false registertracker("fonts.injections.cursive", function(v) trace_cursive = v end)
local trace_spaces = false registertracker("fonts.injections.spaces", function(v) trace_spaces = v end)
-- local fix_cursive_marks = false
--
-- registerdirective("fonts.injections.fixcursivemarks", function(v)
-- fix_cursive_marks = v
-- end)
local report_injections = logs.reporter("fonts","injections")
local report_spaces = logs.reporter("fonts","spaces")
local attributes, nodes, node = attributes, nodes, node
fonts = fonts
local hashes = fonts.hashes
local fontdata = hashes.identifiers
local fontmarks = hashes.marks
----- parameters = fonts.hashes.parameters -- not in generic
----- resources = fonts.hashes.resources -- not in generic
nodes.injections = nodes.injections or { }
local injections = nodes.injections
local tracers = nodes.tracers
local setcolor = tracers and tracers.colors.set
local resetcolor = tracers and tracers.colors.reset
local nodecodes = nodes.nodecodes
local glyph_code = nodecodes.glyph
local disc_code = nodecodes.disc
local kern_code = nodecodes.kern
local glue_code = nodecodes.glue
local nuts = nodes.nuts
local nodepool = nuts.pool
local tonode = nuts.tonode
local tonut = nuts.tonut
local setfield = nuts.setfield
local getnext = nuts.getnext
local getprev = nuts.getprev
local getid = nuts.getid
local getfont = nuts.getfont
local getchar = nuts.getchar
local getoffsets = nuts.getoffsets
local getboth = nuts.getboth
local getdisc = nuts.getdisc
local setdisc = nuts.setdisc
local setoffsets = nuts.setoffsets
local ischar = nuts.ischar
local getkern = nuts.getkern
local setkern = nuts.setkern
local setlink = nuts.setlink
local setwidth = nuts.setwidth
local getwidth = nuts.getwidth
----- traverse_id = nuts.traverse_id
----- traverse_char = nuts.traverse_char
local nextchar = nuts.traversers.char
local nextglue = nuts.traversers.glue
local insert_node_before = nuts.insert_before
local insert_node_after = nuts.insert_after
local properties = nodes.properties.data
local fontkern = nuts.pool and nuts.pool.fontkern -- context
local italickern = nuts.pool and nuts.pool.italickern -- context
local useitalickerns = false
directives.register("fonts.injections.useitalics", function(v)
if v then
report_injections("using italics for space kerns (tracing only)")
end
useitalickerns = v
end)
do if not fontkern then -- generic
local thekern = nuts.new("kern",0) -- fontkern
local setkern = nuts.setkern
local copy_node = nuts.copy_node
fontkern = function(k)
local n = copy_node(thekern)
setkern(n,k)
return n
end
end end
do if not italickern then -- generic
local thekern = nuts.new("kern",3) -- italiccorrection
local setkern = nuts.setkern
local copy_node = nuts.copy_node
italickern = function(k)
local n = copy_node(thekern)
setkern(n,k)
return n
end
end end
function injections.installnewkern() end -- obsolete
local nofregisteredkerns = 0
local nofregisteredpositions = 0
local nofregisteredmarks = 0
local nofregisteredcursives = 0
local keepregisteredcounts = false
function injections.keepcounts()
keepregisteredcounts = true
end
function injections.resetcounts()
nofregisteredkerns = 0
nofregisteredpositions = 0
nofregisteredmarks = 0
nofregisteredcursives = 0
keepregisteredcounts = false
end
-- We need to make sure that a possible metatable will not kick in unexpectedly.
function injections.reset(n)
local p = rawget(properties,n)
if p then
p.injections = false -- { } -- nil should work too as we use rawget
else
properties[n] = false -- { injections = { } } -- nil should work too as we use rawget
end
end
function injections.copy(target,source)
local sp = rawget(properties,source)
if sp then
local tp = rawget(properties,target)
local si = sp.injections
if si then
si = fastcopy(si)
if tp then
tp.injections = si
else
properties[target] = {
injections = si,
}
end
elseif tp then
tp.injections = false -- { }
else
properties[target] = { injections = { } }
end
else
local tp = rawget(properties,target)
if tp then
tp.injections = false -- { }
else
properties[target] = false -- { injections = { } }
end
end
end
function injections.setligaindex(n,index) -- todo: don't set when 0
local p = rawget(properties,n)
if p then
local i = p.injections
if i then
i.ligaindex = index
else
p.injections = {
ligaindex = index
}
end
else
properties[n] = {
injections = {
ligaindex = index
}
}
end
end
function injections.getligaindex(n,default)
local p = rawget(properties,n)
if p then
local i = p.injections
if i then
return i.ligaindex or default
end
end
return default
end
function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext,r2lflag)
-- The standard says something about the r2lflag related to the first in a series:
--
-- When this bit is set, the last glyph in a given sequence to which the cursive
-- attachment lookup is applied, will be positioned on the baseline.
--
-- But it looks like we don't need to consider it.
local dx = factor*(exit[1]-entry[1])
local dy = -factor*(exit[2]-entry[2])
local ws = tfmstart.width
local wn = tfmnext.width
nofregisteredcursives = nofregisteredcursives + 1
if rlmode < 0 then
dx = -(dx + wn)
else
dx = dx - ws
end
if dx == 0 then
-- get rid of funny -0
dx = 0
end
--
local p = rawget(properties,start)
if p then
local i = p.injections
if i then
i.cursiveanchor = true
else
p.injections = {
cursiveanchor = true,
}
end
else
properties[start] = {
injections = {
cursiveanchor = true,
},
}
end
local p = rawget(properties,nxt)
if p then
local i = p.injections
if i then
i.cursivex = dx
i.cursivey = dy
else
p.injections = {
cursivex = dx,
cursivey = dy,
}
end
else
properties[nxt] = {
injections = {
cursivex = dx,
cursivey = dy,
},
}
end
return dx, dy, nofregisteredcursives
end
-- kind: 0=single 1=first of pair, 2=second of pair
function injections.setposition(kind,current,factor,rlmode,spec,injection)
local x = factor * (spec[1] or 0)
local y = factor * (spec[2] or 0)
local w = factor * (spec[3] or 0)
local h = factor * (spec[4] or 0)
if x ~= 0 or w ~= 0 or y ~= 0 or h ~= 0 then -- okay?
local yoffset = y - h
local leftkern = x -- both kerns are set in a pair kern compared
local rightkern = w - x -- to normal kerns where we set only leftkern
if leftkern ~= 0 or rightkern ~= 0 or yoffset ~= 0 then
nofregisteredpositions = nofregisteredpositions + 1
if rlmode and rlmode < 0 then
leftkern, rightkern = rightkern, leftkern
end
if not injection then
injection = "injections"
end
local p = rawget(properties,current)
if p then
local i = p[injection]
if i then
if leftkern ~= 0 then
i.leftkern = (i.leftkern or 0) + leftkern
end
if rightkern ~= 0 then
i.rightkern = (i.rightkern or 0) + rightkern
end
if yoffset ~= 0 then
i.yoffset = (i.yoffset or 0) + yoffset
end
elseif leftkern ~= 0 or rightkern ~= 0 then
p[injection] = {
leftkern = leftkern,
rightkern = rightkern,
yoffset = yoffset,
}
else
p[injection] = {
yoffset = yoffset,
}
end
elseif leftkern ~= 0 or rightkern ~= 0 then
properties[current] = {
[injection] = {
leftkern = leftkern,
rightkern = rightkern,
yoffset = yoffset,
},
}
else
properties[current] = {
[injection] = {
yoffset = yoffset,
},
}
end
return x, y, w, h, nofregisteredpositions
end
end
return x, y, w, h -- no bound
end
-- The next one is used for simple kerns coming from a truetype kern table. The r2l
-- variant variant needs checking but it is unlikely that a r2l script uses thsi
-- feature.
function injections.setkern(current,factor,rlmode,x,injection)
local dx = factor * x
if dx ~= 0 then
nofregisteredkerns = nofregisteredkerns + 1
local p = rawget(properties,current)
if not injection then
injection = "injections"
end
if p then
local i = p[injection]
if i then
i.leftkern = dx + (i.leftkern or 0)
else
p[injection] = {
leftkern = dx,
}
end
else
properties[current] = {
[injection] = {
leftkern = dx,
},
}
end
return dx, nofregisteredkerns
else
return 0, 0
end
end
-- This one is an optimization of pairs where we have only a "w" entry. This one is
-- potentially different from the previous one wrt r2l. It needs checking. The
-- optimization relates to smaller tma files.
function injections.setmove(current,factor,rlmode,x,injection)
local dx = factor * x
if dx ~= 0 then
nofregisteredkerns = nofregisteredkerns + 1
local p = rawget(properties,current)
if not injection then
injection = "injections"
end
if rlmode and rlmode < 0 then
-- we need to swap with a single so then we also need to to it here
-- as move is just a simple single
if p then
local i = p[injection]
if i then
i.rightkern = dx + (i.rightkern or 0)
else
p[injection] = {
rightkern = dx,
}
end
else
properties[current] = {
[injection] = {
rightkern = dx,
},
}
end
else
if p then
local i = p[injection]
if i then
i.leftkern = dx + (i.leftkern or 0)
else
p[injection] = {
leftkern = dx,
}
end
else
properties[current] = {
[injection] = {
leftkern = dx,
},
}
end
end
return dx, nofregisteredkerns
else
return 0, 0
end
end
function injections.setmark(start,base,factor,rlmode,ba,ma,tfmbase,mkmk,checkmark) -- ba=baseanchor, ma=markanchor
local dx = factor*(ba[1]-ma[1])
local dy = factor*(ba[2]-ma[2])
nofregisteredmarks = nofregisteredmarks + 1
if rlmode >= 0 then
dx = tfmbase.width - dx -- see later commented ox
end
local p = rawget(properties,start)
-- hm, dejavu serif does a sloppy mark2mark before mark2base
if p then
local i = p.injections
if i then
if i.markmark then
-- out of order mkmk: yes or no or option
else
-- if dx ~= 0 then
-- i.markx = dx
-- end
-- if y ~= 0 then
-- i.marky = dy
-- end
-- if rlmode then
-- i.markdir = rlmode
-- end
i.markx = dx
i.marky = dy
i.markdir = rlmode or 0
i.markbase = nofregisteredmarks
i.markbasenode = base
i.markmark = mkmk
i.checkmark = checkmark
end
else
p.injections = {
markx = dx,
marky = dy,
markdir = rlmode or 0,
markbase = nofregisteredmarks,
markbasenode = base,
markmark = mkmk,
checkmark = checkmark,
}
end
else
properties[start] = {
injections = {
markx = dx,
marky = dy,
markdir = rlmode or 0,
markbase = nofregisteredmarks,
markbasenode = base,
markmark = mkmk,
checkmark = checkmark,
},
}
end
return dx, dy, nofregisteredmarks
end
local function dir(n)
return (n and n<0 and "r-to-l") or (n and n>0 and "l-to-r") or "unset"
end
local function showchar(n,nested)
local char = getchar(n)
report_injections("%wfont %s, char %U, glyph %c",nested and 2 or 0,getfont(n),char,char)
end
local function show(n,what,nested,symbol)
if n then
local p = rawget(properties,n)
if p then
local i = p[what]
if i then
local leftkern = i.leftkern or 0
local rightkern = i.rightkern or 0
local yoffset = i.yoffset or 0
local markx = i.markx or 0
local marky = i.marky or 0
local markdir = i.markdir or 0
local markbase = i.markbase or 0
local cursivex = i.cursivex or 0
local cursivey = i.cursivey or 0
local ligaindex = i.ligaindex or 0
local cursbase = i.cursiveanchor
local margin = nested and 4 or 2
--
if rightkern ~= 0 or yoffset ~= 0 then
report_injections("%w%s pair: lx %p, rx %p, dy %p",margin,symbol,leftkern,rightkern,yoffset)
elseif leftkern ~= 0 then
report_injections("%w%s kern: dx %p",margin,symbol,leftkern)
end
if markx ~= 0 or marky ~= 0 or markbase ~= 0 then
report_injections("%w%s mark: dx %p, dy %p, dir %s, base %s",margin,symbol,markx,marky,markdir,markbase ~= 0 and "yes" or "no")
end
if cursivex ~= 0 or cursivey ~= 0 then
if cursbase then
report_injections("%w%s curs: base dx %p, dy %p",margin,symbol,cursivex,cursivey)
else
report_injections("%w%s curs: dx %p, dy %p",margin,symbol,cursivex,cursivey)
end
elseif cursbase then
report_injections("%w%s curs: base",margin,symbol)
end
if ligaindex ~= 0 then
report_injections("%w%s liga: index %i",margin,symbol,ligaindex)
end
end
end
end
end
local function showsub(n,what,where)
report_injections("begin subrun: %s",where)
for n in nextchar, n do
showchar(n,where)
show(n,what,where," ")
end
report_injections("end subrun")
end
local function trace(head,where)
report_injections()
report_injections("begin run %s: %s kerns, %s positions, %s marks and %s cursives registered",
where or "",nofregisteredkerns,nofregisteredpositions,nofregisteredmarks,nofregisteredcursives)
local n = head
while n do
local id = getid(n)
if id == glyph_code then
showchar(n)
show(n,"injections",false," ")
show(n,"preinjections",false,"<")
show(n,"postinjections",false,">")
show(n,"replaceinjections",false,"=")
show(n,"emptyinjections",false,"*")
elseif id == disc_code then
local pre, post, replace = getdisc(n)
if pre then
showsub(pre,"preinjections","pre")
end
if post then
showsub(post,"postinjections","post")
end
if replace then
showsub(replace,"replaceinjections","replace")
end
show(n,"emptyinjections",false,"*")
end
n = getnext(n)
end
report_injections("end run")
end
local function show_result(head)
local current = head
local skipping = false
while current do
local id = getid(current)
if id == glyph_code then
local w = getwidth(current)
local x, y = getoffsets(current)
report_injections("char: %C, width %p, xoffset %p, yoffset %p",getchar(current),w,x,y)
skipping = false
elseif id == kern_code then
report_injections("kern: %p",getkern(current))
skipping = false
elseif not skipping then
report_injections()
skipping = true
end
current = getnext(current)
end
report_injections()
end
-- G +D-pre G
-- D-post+
-- +D-replace+
--
-- G +D-pre +D-pre
-- D-post +D-post
-- +D-replace +D-replace
local function inject_kerns_only(head,where)
if trace_injections then
trace(head,"kerns")
end
local current = head
local prev = nil
local next = nil
local prevdisc = nil
-- local prevglyph = nil
local pre = nil -- saves a lookup
local post = nil -- saves a lookup
local replace = nil -- saves a lookup
local pretail = nil -- saves a lookup
local posttail = nil -- saves a lookup
local replacetail = nil -- saves a lookup
while current do
local next = getnext(current)
local char, id = ischar(current)
if char then
local p = rawget(properties,current)
if p then
local i = p.injections
if i then
-- left|glyph|right
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
head = insert_node_before(head,current,fontkern(leftkern))
end
end
if prevdisc then
local done = false
if post then
local i = p.postinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
setlink(posttail,fontkern(leftkern))
done = true
end
end
end
if replace then
local i = p.replaceinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
setlink(replacetail,fontkern(leftkern))
done = true
end
end
else
local i = p.emptyinjections
if i then
-- glyph|disc|glyph (special case)
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
replace = fontkern(leftkern)
done = true
end
end
end
if done then
setdisc(prevdisc,pre,post,replace)
end
end
end
prevdisc = nil
-- prevglyph = current
elseif char == false then
-- other font
prevdisc = nil
-- prevglyph = current
elseif id == disc_code then
pre, post, replace, pretail, posttail, replacetail = getdisc(current,true)
local done = false
if pre then
-- left|pre glyphs|right
for n in nextchar, pre do
local p = rawget(properties,n)
if p then
local i = p.injections or p.preinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
pre = insert_node_before(pre,n,fontkern(leftkern))
done = true
end
end
end
end
end
if post then
-- left|post glyphs|right
for n in nextchar, post do
local p = rawget(properties,n)
if p then
local i = p.injections or p.postinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
post = insert_node_before(post,n,fontkern(leftkern))
done = true
end
end
end
end
end
if replace then
-- left|replace glyphs|right
for n in nextchar, replace do
local p = rawget(properties,n)
if p then
local i = p.injections or p.replaceinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
replace = insert_node_before(replace,n,fontkern(leftkern))
done = true
end
end
end
end
end
if done then
setdisc(current,pre,post,replace)
end
-- prevglyph = nil
prevdisc = current
else
-- prevglyph = nil
prevdisc = nil
end
prev = current
current = next
end
--
if keepregisteredcounts then
keepregisteredcounts = false
else
nofregisteredkerns = 0
end
if trace_injections then
show_result(head)
end
return head
end
local function inject_positions_only(head,where)
if trace_injections then
trace(head,"positions")
end
local current = head
local prev = nil
local next = nil
local prevdisc = nil
local prevglyph = nil
local pre = nil -- saves a lookup
local post = nil -- saves a lookup
local replace = nil -- saves a lookup
local pretail = nil -- saves a lookup
local posttail = nil -- saves a lookup
local replacetail = nil -- saves a lookup
while current do
local next = getnext(current)
local char, id = ischar(current)
if char then
local p = rawget(properties,current)
if p then
local i = p.injections
if i then
-- left|glyph|right
local yoffset = i.yoffset
if yoffset and yoffset ~= 0 then
setoffsets(current,false,yoffset)
end
local leftkern = i.leftkern
local rightkern = i.rightkern
if leftkern and leftkern ~= 0 then
if rightkern and leftkern == -rightkern then
setoffsets(current,leftkern,false)
rightkern = 0
else
head = insert_node_before(head,current,fontkern(leftkern))
end
end
if rightkern and rightkern ~= 0 then
insert_node_after(head,current,fontkern(rightkern))
end
else
local i = p.emptyinjections
if i then
-- glyph|disc|glyph (special case)
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
if next and getid(next) == disc_code then
if replace then
-- error, we expect an empty one
else
-- KE setfield(next,"replace",fontkern(rightkern)) -- maybe also leftkern
replace = fontkern(rightkern) -- maybe also leftkern
done = true --KE
end
end
end
end
end
if prevdisc then
local done = false
if post then
local i = p.postinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
setlink(posttail,fontkern(leftkern))
done = true
end
end
end
if replace then
local i = p.replaceinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
setlink(replacetail,fontkern(leftkern))
done = true
end
end
else
local i = p.emptyinjections
if i then
-- new .. okay?
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
replace = fontkern(leftkern)
done = true
end
end
end
if done then
setdisc(prevdisc,pre,post,replace)
end
end
end
prevdisc = nil
prevglyph = current
elseif char == false then
prevdisc = nil
prevglyph = current
elseif id == disc_code then
pre, post, replace, pretail, posttail, replacetail = getdisc(current,true)
local done = false
if pre then
-- left|pre glyphs|right
for n in nextchar, pre do
local p = rawget(properties,n)
if p then
local i = p.injections or p.preinjections
if i then
local yoffset = i.yoffset
if yoffset and yoffset ~= 0 then
setoffsets(n,false,yoffset)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
pre = insert_node_before(pre,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
insert_node_after(pre,n,fontkern(rightkern))
done = true
end
end
end
end
end
if post then
-- left|post glyphs|right
for n in nextchar, post do
local p = rawget(properties,n)
if p then
local i = p.injections or p.postinjections
if i then
local yoffset = i.yoffset
if yoffset and yoffset ~= 0 then
setoffsets(n,false,yoffset)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
post = insert_node_before(post,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
insert_node_after(post,n,fontkern(rightkern))
done = true
end
end
end
end
end
if replace then
-- left|replace glyphs|right
for n in nextchar, replace do
local p = rawget(properties,n)
if p then
local i = p.injections or p.replaceinjections
if i then
local yoffset = i.yoffset
if yoffset and yoffset ~= 0 then
setoffsets(n,false,yoffset)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
replace = insert_node_before(replace,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
insert_node_after(replace,n,fontkern(rightkern))
done = true
end
end
end
end
end
if prevglyph then
if pre then
local p = rawget(properties,prevglyph)
if p then
local i = p.preinjections
if i then
-- glyph|pre glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
pre = insert_node_before(pre,pre,fontkern(rightkern))
done = true
end
end
end
end
if replace then
local p = rawget(properties,prevglyph)
if p then
local i = p.replaceinjections
if i then
-- glyph|replace glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
replace = insert_node_before(replace,replace,fontkern(rightkern))
done = true
end
end
end
end
end
if done then
setdisc(current,pre,post,replace)
end
prevglyph = nil
prevdisc = current
else
prevglyph = nil
prevdisc = nil
end
prev = current
current = next
end
--
if keepregisteredcounts then
keepregisteredcounts = false
else
nofregisteredpositions = 0
end
if trace_injections then
show_result(head)
end
return head
end
local function showoffset(n,flag)
local x, y = getoffsets(n)
if x ~= 0 or y ~= 0 then
setcolor(n,"darkgray")
end
end
local function inject_everything(head,where)
if trace_injections then
trace(head,"everything")
end
local hascursives = nofregisteredcursives > 0
local hasmarks = nofregisteredmarks > 0
--
local current = head
local last = nil
local prev = nil
local next = nil
local prevdisc = nil
local prevglyph = nil
local pre = nil -- saves a lookup
local post = nil -- saves a lookup
local replace = nil -- saves a lookup
local pretail = nil -- saves a lookup
local posttail = nil -- saves a lookup
local replacetail = nil -- saves a lookup
--
local cursiveanchor = nil
local minc = 0
local maxc = 0
local glyphs = { }
local marks = { }
local nofmarks = 0
--
-- local applyfix = hascursives and fix_cursive_marks
--
-- move out
--
local function processmark(p,n,pn) -- p = basenode
local px, py = getoffsets(p)
local nx, ny = getoffsets(n)
local ox = 0
local rightkern = nil
local pp = rawget(properties,p)
if pp then
pp = pp.injections
if pp then
rightkern = pp.rightkern
end
end
local markdir = pn.markdir
if rightkern then -- x and w ~= 0
ox = px - (pn.markx or 0) - rightkern
if markdir and markdir < 0 then
-- kern(w-x) glyph(p) kern(x) mark(n)
if not pn.markmark then
ox = ox + (pn.leftkern or 0)
end
else
-- kern(x) glyph(p) kern(w-x) mark(n)
--
-- According to Kai we don't need to handle leftkern here but I'm
-- pretty sure I've run into a case where it was needed so maybe
-- some day we need something more clever here.
--
-- maybe we need to apply both then
--
if false then
-- a mark with kerning (maybe husayni needs it )
local leftkern = pp.leftkern
if leftkern then
ox = ox - leftkern
end
end
end
else
ox = px - (pn.markx or 0)
if markdir and markdir < 0 then
if not pn.markmark then
local leftkern = pn.leftkern
if leftkern then
ox = ox + leftkern -- husayni needs it
end
end
end
if pn.checkmark then
local wn = getwidth(n) -- in arial marks have widths
if wn and wn ~= 0 then
wn = wn/2
if trace_injections then
report_injections("correcting non zero width mark %C",getchar(n))
end
-- -- bad: we should center
--
-- pn.leftkern = -wn
-- pn.rightkern = -wn
--
-- -- we're too late anyway as kerns are already injected so we do it the
-- -- ugly way (no checking if the previous is already a kern) .. maybe we
-- -- should fix the font instead
--
-- todo: head and check for prev / next kern
--
insert_node_before(n,n,fontkern(-wn))
insert_node_after(n,n,fontkern(-wn))
end
end
end
local oy = ny + py + (pn.marky or 0)
if not pn.markmark then
local yoffset = pn.yoffset
if yoffset then
oy = oy + yoffset -- husayni needs it
end
end
setoffsets(n,ox,oy)
if trace_marks then
showoffset(n,true)
end
end
-- begin of temp fix --
-- local base = nil -- bah, some arabic fonts have no mark anchoring
-- end of temp fix --
while current do
local next = getnext(current)
local char, id = ischar(current)
if char then
local p = rawget(properties,current)
-- begin of temp fix --
-- if applyfix then
-- if not p then
-- local m = fontmarks[getfont(current)]
-- if m and m[char] then
-- if base then
-- p = { injections = { markbasenode = base } }
-- nofmarks = nofmarks + 1
-- marks[nofmarks] = current
-- properties[current] = p
-- hasmarks = true
-- end
-- else
-- base = current
-- end
-- end
-- end
-- end of temp fix
if p then
local i = p.injections
-- begin of temp fix --
-- if applyfix then
-- if not i then
-- local m = fontmarks[getfont(current)]
-- if m and m[char] then
-- if base then
-- i = { markbasenode = base }
-- nofmarks = nofmarks + 1
-- marks[nofmarks] = current
-- p.injections = i
-- hasmarks = true
-- end
-- else
-- base = current
-- end
-- end
-- end
-- end of temp fix --
if i then
local pm = i.markbasenode
-- begin of temp fix --
-- if applyfix then
-- if not pm then
-- local m = fontmarks[getfont(current)]
-- if m and m[char] then
-- if base then
-- pm = base
-- i.markbasenode = pm
-- hasmarks = true
-- end
-- else
-- base = current
-- end
-- else
-- base = current
-- end
-- end
-- end of temp fix --
if pm then
nofmarks = nofmarks + 1
marks[nofmarks] = current
else
local yoffset = i.yoffset
if yoffset and yoffset ~= 0 then
setoffsets(current,false,yoffset)
end
if hascursives then
local cursivex = i.cursivex
if cursivex then
if cursiveanchor then
if cursivex ~= 0 then
i.leftkern = (i.leftkern or 0) + cursivex
end
if maxc == 0 then
minc = 1
maxc = 1
glyphs[1] = cursiveanchor
else
maxc = maxc + 1
glyphs[maxc] = cursiveanchor
end
properties[cursiveanchor].cursivedy = i.cursivey -- cursiveprops
last = current
else
maxc = 0
end
elseif maxc > 0 then
local nx, ny = getoffsets(current)
for i=maxc,minc,-1 do
local ti = glyphs[i]
ny = ny + properties[ti].cursivedy
setoffsets(ti,false,ny) -- why not add ?
if trace_cursive then
showoffset(ti)
end
end
maxc = 0
cursiveanchor = nil
end
if i.cursiveanchor then
cursiveanchor = current -- no need for both now
else
if maxc > 0 then
local nx, ny = getoffsets(current)
for i=maxc,minc,-1 do
local ti = glyphs[i]
ny = ny + properties[ti].cursivedy
setoffsets(ti,false,ny) -- why not add ?
if trace_cursive then
showoffset(ti)
end
end
maxc = 0
end
cursiveanchor = nil
end
end
-- left|glyph|right
local leftkern = i.leftkern
local rightkern = i.rightkern
if leftkern and leftkern ~= 0 then
if rightkern and leftkern == -rightkern then
setoffsets(current,leftkern,false)
rightkern = 0
else
head = insert_node_before(head,current,fontkern(leftkern))
end
end
if rightkern and rightkern ~= 0 then
insert_node_after(head,current,fontkern(rightkern))
end
end
else
local i = p.emptyinjections
if i then
-- glyph|disc|glyph (special case)
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
if next and getid(next) == disc_code then
if replace then
-- error, we expect an empty one
else
replace = fontkern(rightkern)
done = true
end
end
end
end
end
if prevdisc then
if p then
local done = false
if post then
local i = p.postinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
setlink(posttail,fontkern(leftkern))
done = true
end
end
end
if replace then
local i = p.replaceinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
setlink(replacetail,fontkern(leftkern))
done = true
end
end
else
local i = p.emptyinjections
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
replace = fontkern(leftkern)
done = true
end
end
end
if done then
setdisc(prevdisc,pre,post,replace)
end
end
end
else
-- cursive
if hascursives and maxc > 0 then
local nx, ny = getoffsets(current)
for i=maxc,minc,-1 do
local ti = glyphs[i]
ny = ny + properties[ti].cursivedy
local xi, yi = getoffsets(ti)
setoffsets(ti,xi,yi + ny) -- can be mark, we could use properties
end
maxc = 0
cursiveanchor = nil
end
end
prevdisc = nil
prevglyph = current
elseif char == false then
-- base = nil
prevdisc = nil
prevglyph = current
elseif id == disc_code then
-- base = nil
pre, post, replace, pretail, posttail, replacetail = getdisc(current,true)
local done = false
if pre then
-- left|pre glyphs|right
for n in nextchar, pre do
local p = rawget(properties,n)
if p then
local i = p.injections or p.preinjections
if i then
local yoffset = i.yoffset
if yoffset and yoffset ~= 0 then
setoffsets(n,false,yoffset)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
pre = insert_node_before(pre,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
insert_node_after(pre,n,fontkern(rightkern))
done = true
end
if hasmarks then
local pm = i.markbasenode
if pm then
processmark(pm,n,i)
end
end
end
end
end
end
if post then
-- left|post glyphs|right
for n in nextchar, post do
local p = rawget(properties,n)
if p then
local i = p.injections or p.postinjections
if i then
local yoffset = i.yoffset
if yoffset and yoffset ~= 0 then
setoffsets(n,false,yoffset)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
post = insert_node_before(post,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
insert_node_after(post,n,fontkern(rightkern))
done = true
end
if hasmarks then
local pm = i.markbasenode
if pm then
processmark(pm,n,i)
end
end
end
end
end
end
if replace then
-- left|replace glyphs|right
for n in nextchar, replace do
local p = rawget(properties,n)
if p then
local i = p.injections or p.replaceinjections
if i then
local yoffset = i.yoffset
if yoffset and yoffset ~= 0 then
setoffsets(n,false,yoffset)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
replace = insert_node_before(replace,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
insert_node_after(replace,n,fontkern(rightkern))
done = true
end
if hasmarks then
local pm = i.markbasenode
if pm then
processmark(pm,n,i)
end
end
end
end
end
end
if prevglyph then
if pre then
local p = rawget(properties,prevglyph)
if p then
local i = p.preinjections
if i then
-- glyph|pre glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
pre = insert_node_before(pre,pre,fontkern(rightkern))
done = true
end
end
end
end
if replace then
local p = rawget(properties,prevglyph)
if p then
local i = p.replaceinjections
if i then
-- glyph|replace glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
replace = insert_node_before(replace,replace,fontkern(rightkern))
done = true
end
end
end
end
end
if done then
setdisc(current,pre,post,replace)
end
prevglyph = nil
prevdisc = current
else
-- base = nil
prevglyph = nil
prevdisc = nil
end
prev = current
current = next
end
-- cursive
if hascursives and maxc > 0 then
local nx, ny = getoffsets(last)
for i=maxc,minc,-1 do
local ti = glyphs[i]
ny = ny + properties[ti].cursivedy
setoffsets(ti,false,ny) -- why not add ?
if trace_cursive then
showoffset(ti)
end
end
end
--
if nofmarks > 0 then
for i=1,nofmarks do
local m = marks[i]
local p = rawget(properties,m)
local i = p.injections
local b = i.markbasenode
processmark(b,m,i)
end
elseif hasmarks then
-- sometyhing bad happened
end
--
if keepregisteredcounts then
keepregisteredcounts = false
else
nofregisteredkerns = 0
nofregisteredpositions = 0
nofregisteredmarks = 0
nofregisteredcursives = 0
end
if trace_injections then
show_result(head)
end
return head
end
-- space triggers
local triggers = false
function nodes.injections.setspacekerns(font,sequence)
if triggers then
triggers[font] = sequence
else
triggers = { [font] = sequence }
end
end
local getthreshold
if context then
local threshold = 1 -- todo: add a few methods for context
local parameters = fonts.hashes.parameters
directives.register("otf.threshold", function(v) threshold = tonumber(v) or 1 end)
getthreshold = function(font)
local p = parameters[font]
local f = p.factor
local s = p.spacing
local t = threshold * (s and s.width or p.space or 0) - 2
return t > 0 and t or 0, f
end
else
injections.threshold = 0
getthreshold = function(font)
local p = fontdata[font].parameters
local f = p.factor
local s = p.spacing
local t = injections.threshold * (s and s.width or p.space or 0) - 2
return t > 0 and t or 0, f
end
end
injections.getthreshold = getthreshold
function injections.isspace(n,threshold,id)
if (id or getid(n)) == glue_code then
local w = getwidth(n)
if threshold and w > threshold then -- was >=
return 32
end
end
end
-- We have a plugin so that Kai can use the next in plain. Such a plugin is rather application
-- specific.
--
-- local getboth = nodes.direct.getboth
-- local getid = nodes.direct.getid
-- local getprev = nodes.direct.getprev
-- local getnext = nodes.direct.getnext
--
-- local whatsit_code = nodes.nodecodes.whatsit
-- local glyph_code = nodes.nodecodes.glyph
--
-- local function getspaceboth(n) -- fragile: what it prev/next has no width field
-- local prev, next = getboth(n)
-- while prev and (getid(prev) == whatsit_code or (getwidth(prev) == 0 and getid(prev) ~= glyph_code)) do
-- prev = getprev(prev)
-- end
-- while next and (getid(next) == whatsit_code or (getwidth(next) == 0 and getid(next) ~= glyph_code)) do
-- next = getnext(next)
-- end
-- end
--
-- injections.installgetspaceboth(getspaceboth)
local getspaceboth = getboth
function injections.installgetspaceboth(gb)
getspaceboth = gb or getboth
end
local function injectspaces(head)
if not triggers then
return head
end
local lastfont = nil
local spacekerns = nil
local leftkerns = nil
local rightkerns = nil
local factor = 0
local threshold = 0
local leftkern = false
local rightkern = false
local function updatefont(font,trig)
leftkerns = trig.left
rightkerns = trig.right
lastfont = font
threshold,
factor = getthreshold(font)
end
for n in nextglue, head do
local prev, next = getspaceboth(n)
local prevchar = prev and ischar(prev)
local nextchar = next and ischar(next)
if nextchar then
local font = getfont(next)
local trig = triggers[font]
if trig then
if lastfont ~= font then
updatefont(font,trig)
end
if rightkerns then
rightkern = rightkerns[nextchar]
end
end
end
if prevchar then
local font = getfont(prev)
local trig = triggers[font]
if trig then
if lastfont ~= font then
updatefont(font,trig)
end
if leftkerns then
leftkern = leftkerns[prevchar]
end
end
end
if leftkern then
local old = getwidth(n)
if old > threshold then
if rightkern then
if useitalickerns then
local lnew = leftkern * factor
local rnew = rightkern * factor
if trace_spaces then
report_spaces("%C [%p + %p + %p] %C",prevchar,lnew,old,rnew,nextchar)
end
head = insert_node_before(head,n,italickern(lnew))
insert_node_after(head,n,italickern(rnew))
else
local new = old + (leftkern + rightkern) * factor
if trace_spaces then
report_spaces("%C [%p -> %p] %C",prevchar,old,new,nextchar)
end
setwidth(n,new)
end
rightkern = false
else
if useitalickerns then
local new = leftkern * factor
if trace_spaces then
report_spaces("%C [%p + %p]",prevchar,old,new)
end
insert_node_after(head,n,italickern(new)) -- tricky with traverse but ok
else
local new = old + leftkern * factor
if trace_spaces then
report_spaces("%C [%p -> %p]",prevchar,old,new)
end
setwidth(n,new)
end
end
end
leftkern = false
elseif rightkern then
local old = getwidth(n)
if old > threshold then
if useitalickerns then
local new = rightkern * factor
if trace_spaces then
report_spaces("%C [%p + %p]",nextchar,old,new)
end
insert_node_after(head,n,italickern(new))
else
local new = old + rightkern * factor
if trace_spaces then
report_spaces("[%p -> %p] %C",nextchar,old,new)
end
setwidth(n,new)
end
end
rightkern = false
end
end
triggers = false
return head
end
--
function injections.handler(head,where)
if triggers then
head = injectspaces(head)
end
-- todo: marks only run too
if nofregisteredmarks > 0 or nofregisteredcursives > 0 then
if trace_injections then
report_injections("injection variant %a","everything")
end
return inject_everything(head,where)
elseif nofregisteredpositions > 0 then
if trace_injections then
report_injections("injection variant %a","positions")
end
return inject_positions_only(head,where)
elseif nofregisteredkerns > 0 then
if trace_injections then
report_injections("injection variant %a","kerns")
end
return inject_kerns_only(head,where)
else
return head
end
end
|
local util = require("pandoc_vim_help.util")
local M = {}
local link_target_prefix
function M.Meta(e)
link_target_prefix = e.link_target_prefix
return e
end
function M.Link(e)
if not link_target_prefix then
return e
end
if util.starts_with(e.target, "http://") or util.starts_with(e.target, "https://") then
return e
end
e.target = link_target_prefix .. e.target
return e
end
return M
|
-- Copyright (c) 2008 Mikael Lind
--
-- Permission is hereby granted, free of charge, to any person
-- obtaining a copy of this software and associated documentation
-- files (the "Software"), to deal in the Software without
-- restriction, including without limitation the rights to use,
-- copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following
-- conditions:
--
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-- OTHER DEALINGS IN THE SOFTWARE.
local import = require("import")
local mimic = require("mimic")
local move = import("move").move
local features = import("features")
local Tile = import("Tile").Tile
local level_map = [[
###############################################################################
#####################################################........##################
###################################################...........#################
###############.........###########################...........#################
############..................######################........###################
###########.....................####################....#######################
##########....................................#####....########################
##########........<.....................................#######################
###########........................########................####################
############......................#################...................#########
##############...................###################......................#####
###############....###........####################.........................####
##############....###############################...........>...............###
############.......##############################...........................###
#########............############################...........................###
#######...............############################.........................####
######................##############################.....................######
######...............##################################............############
########...........############################################################
###############################################################################
]]
local char_to_feature = {
["#"] = features.Wall,
["."] = features.Floor,
[">"] = features.StairDown,
["<"] = features.StairUp,
}
local function parse_tile(char)
local feature = char_to_feature[char]:new()
local tile = Tile:new()
move(feature, tile)
return tile
end
local function parse_line(line)
return mimic.list(mimic.map(line, parse_tile))
end
local function not_blank(value)
return not mimic.blank(value)
end
local function parse_map(map)
local lines = mimic.split(map, "\n")
lines = mimic.filter(lines, not_blank)
lines = mimic.map(lines, parse_line)
lines = mimic.list(lines)
for y, line in ipairs(lines) do
for x, tile in ipairs(line) do
tile.y = y
tile.x = x
end
end
return lines
end
Level = {}
function Level:new(level)
level = level or {}
setmetatable(level, self)
self.__index = self
level.grid = parse_map(level_map)
return level
end
|
-- NaoTH controller for the logfile based "simulator"
project "GeneralAlignment"
kind "ConsoleApp"
language "C++"
includedirs {
"../Source/GeneralAlignment/",
}
files {
"../Source/GeneralAlignment/**.cpp",
"../Source/GeneralAlignment/**.h",
"../Source/GeneralAlignment/**.hpp"
}
links {
}
targetname "generalalignment"
|
--[[
Shine No Rookies - Server
]]
local InfoHub = Shine.PlayerInfoHub
local Plugin = ...
Plugin.Version = "1.7"
Plugin.ConfigName = "NoRookies.json"
Plugin.DefaultConfig =
{
UseSteamTime = true,
MinPlayer = 0,
MinPlayerCom = 0,
DisableAfterRoundtime = 0,
MinPlaytime = 8,
MinComPlaytime = 8,
ShowInform = true,
InformMessage = "This server is not rookie friendly",
BlockTeams = true,
ShowSwitchAtBlock = false,
BlockCC = false,
AllowSpectating = false,
BlockMessage = "This server is not rookie friendly",
Kick = true,
Kicktime = 20,
KickMessage = "You will be kicked in %s seconds",
WaitMessage = "Please wait while we fetch your stats.",
Debug = false,
LastPluginVersion = "1.6"
}
Plugin.PrintName = "No Rookies"
Plugin.DisconnectReason = "You didn't fit to the required playtime"
Plugin.Conflicts = {
DisableThem = {
"rookiesonly"
},
DisableUs = {
"hiveteamrestriction"
}
}
local Enabled = true --used to temp disable the plugin in case the given player limit is reached
function Plugin:Initialise()
self.Enabled = true
--copy old minplayer setting to minplayercom
if self.Config.LastPluginVersion ~= self.Version then
self.Config.MinPlayerCom = self.Config.MinPlayer
self.Config.LastPluginVersion = self.Version
self:SaveConfig()
end
self:CheckForSteamTime()
self:BuildBlockMessage()
return true
end
function Plugin:OnFirstThink()
if Server.DisableQuickPlay and self.Config.BlockTeams and self.Config.MinPlaytime > 0 then
self:Print("Tagging Server as incompatible to the quickplay queue because a playtime restriction is not supported by it.")
Server.DisableQuickPlay()
end
end
function Plugin:CheckForSteamTime()
if self.Config.UseSteamTime or self.Config.ForceSteamTime then
InfoHub:Request( self.PrintName, "STEAMPLAYTIME" )
end
end
function Plugin:BuildBlockMessage()
self.BlockMessage = self.Config.BlockMessage
end
function Plugin:SetGameState( _, NewState )
if NewState == kGameState.Started and self.Config.DisableAfterRoundtime and self.Config.DisableAfterRoundtime > 0 then
self:CreateTimer( "Disable", self.Config.DisableAfterRoundtime * 60 , 1, function() Enabled = false end )
end
end
function Plugin:EndGame()
self:DestroyTimer( "Disable" )
Enabled = true
end
function Plugin:ValidateCommanderLogin( _, _, Player )
if not self.Config.BlockCC or not Player
or not Player.GetClient or Shine.GetHumanPlayerCount() < self.Config.MinPlayerCom then return end
return self:Check( Player, true )
end
function Plugin:JoinTeam( _, Player, NewTeam, _, ShineForce )
if not self.Config.BlockTeams then return end
if ShineForce or self.Config.AllowSpectating and NewTeam == kSpectatorIndex or NewTeam == kTeamReadyRoom then
self:DestroyTimer( string.format( "Kick_%s", Player:GetSteamId() ))
return
end
return self:Check( Player )
end
function Plugin:CheckValues( Playerdata, SteamId, ComCheck )
PROFILE("NoRookies:CheckValues()")
if not Enabled then return end
if not self.Passed then self.Passed = { [1] = {}, [2] = {} } end
if self.Passed[ComCheck and 2 or 1][SteamId] ~= nil then return self.Passed[ComCheck and 2 or 1][SteamId] end
--check the config first if we should process check on players joining a team
if not ComCheck then
if not self.Config.BlockTeams then
self.Passed[1][SteamId] = true
return true
end
if Shine.GetHumanPlayerCount() < self.Config.MinPlayer then return end
end
--check if Player fits to the PlayTime
local Playtime = Playerdata.playTime
if self.Config.UseSteamTime then
local SteamTime = InfoHub:GetSteamData( SteamId ).PlayTime
if SteamTime and SteamTime > Playtime then
Playtime = SteamTime
end
end
local Min = ComCheck and self.Config.MinComPlaytime or self.Config.MinPlaytime
local Check = Playtime >= Min * 3600
if self.Config.Debug then
Print(string.format("NoRookie Debug: Playtime of %s = %s secs, Passed Check %s? %s", SteamId, Playtime, ComCheck and 2 or 1, Check))
end
self.Passed[ComCheck and 2 or 1][SteamId] = Check
return Check
end
|
--
-- Ideal public usage:
--
-- p = Python.New()
-- p:Install({
-- Pip = true,
-- PythonDev = true,
-- VirtualEnv = true,
-- Gunicorn = true,
-- })
--
local Python = {}
Python.__index = Python
-- ----------------
-- private methods
-- ----------------
local function installPythonDev()
AptGet({
Method = "install",
Packages = {"python-dev"},
})
end
local function installVirtualEnv()
AptGet({
Method = "install",
Packages = {"python-virtualen"},
})
end
local function installGunicorn()
AptGet({
Method = "install",
Packages = {"python-virtualen"},
})
Service({
Name = "gunicorn",
Ensure = "running",
})
end
local function installPip()
AptGet({
Method = "install",
Packages = {"python-pip"},
})
end
-- -----------------
-- public stuff
-- -----------------
function Python.New()
local self = setmetatable({}, Python)
return self
end
function Python:Install(conf)
if conf["Pip"] then
installPip()
end
if conf["PythonDev"] then
installPythonDev()
end
if conf["VirtualEnv"] then
installVirtualEnv()
end
if conf["Gunicorn"] then
installGunicorn()
end
end
function Python:NewVirtualEnv(name)
-- we can obviously handle way more things
Exec({
Command = "virtualenv --distribute" .. name,
ExecutionDir = "/some/execution/dir",
RunAs = "root",
})
end
---
p = Python.New()
p:Install({
Pip = true,
PythonDev = false,
VirtualEnv = true,
Gunicorn = true,
})
p:NewVirtualEnv("foo")
|
local _, nCore = ...
local unpack = unpack
function nCore:CreateAnchor(name, width, height, location)
local anchorFrame = CreateFrame("Frame", name.."_Anchor", UIParent, "BackdropTemplate")
anchorFrame:SetSize(width, height)
anchorFrame:SetScale(1)
anchorFrame:SetPoint(unpack(location))
anchorFrame:SetFrameStrata("HIGH")
anchorFrame:SetMovable(true)
anchorFrame:SetClampedToScreen(true)
anchorFrame:SetUserPlaced(true)
anchorFrame:SetBackdrop({bgFile="Interface\\MINIMAP\\TooltipBackdrop-Background",})
anchorFrame:EnableMouse(true)
anchorFrame:RegisterForDrag("LeftButton")
anchorFrame:Hide()
anchorFrame.text = anchorFrame:CreateFontString(nil, "OVERLAY")
anchorFrame.text:SetAllPoints(anchorFrame)
anchorFrame.text:SetFont(STANDARD_TEXT_FONT, 13)
anchorFrame.text:SetText(name)
anchorFrame:SetScript("OnDragStart", function(self)
self:StartMoving()
end)
anchorFrame:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
end)
return anchorFrame
end
function nCore:IsTaintable()
return (InCombatLockdown() or (UnitAffectingCombat("player") or UnitAffectingCombat("pet")))
end
|
coslogon.logoffUser()
|
--[[
"A moment of silence for my old Ipad 3 as FGO EN ditched support for iOS 9"
- ryuga93
--]]
local ankuluaUtils = require "ankulua-utils"
local stringUtils = require "string-utils"
--Constants
--Weak, resist, etc. Compatiable for most server, but tricky, frequently fail.
local Card1AffinRegion = Region( 295,650,250,200)
local Card2AffinRegion = Region( 810,650,250,200)
local Card3AffinRegion = Region(1321,650,250,200)
local Card4AffinRegion = Region(1834,650,250,200)
local Card5AffinRegion = Region(2348,650,250,200)
local CardAffinRegionArray = {Card1AffinRegion, Card2AffinRegion, Card3AffinRegion, Card4AffinRegion, Card5AffinRegion}
--Buster, Art, Quick, etc.
local Card1TypeRegion = Region(200,1060,200,200)
local Card2TypeRegion = Region(730,1060,200,200)
local Card3TypeRegion = Region(1240,1060,200,200)
local Card4TypeRegion = Region(1750,1060,200,200)
local Card5TypeRegion = Region(2280,1060,200,200)
local CardTypeRegionArray = {Card1TypeRegion, Card2TypeRegion, Card3TypeRegion, Card4TypeRegion, Card5TypeRegion}
--*Rough* damage calculation by formula, you may tinker these to change card selection priority.
--https://pbs.twimg.com/media/C2nSYxcUoAAy_F2.jpg
local WeakMulti = 2.0
local NormalMulti = 1.0
local ResistMulti = 0.5
local BCard = 150
local ACard = 100
local QCard = 80
local ResistBuster = BCard * ResistMulti
local ResistArt = ACard * ResistMulti
local ResistQuick = QCard * ResistMulti
local WeakBuster = BCard * WeakMulti
local WeakArt = ACard * WeakMulti
local WeakQuick = QCard * WeakMulti
--User customizable BAQ selection priority.
local CardPriorityArray = {}
--Card selection pos for click, and array for AutoSkill.
local Card1Click = (Location(300,1000))
local Card2Click = (Location(750,1000))
local Card3Click = (Location(1300,1000))
local Card4Click = (Location(1800,1000))
local Card5Click = (Location(2350,1000))
local CardClickArray = {Card1Click, Card2Click, Card3Click, Card4Click, Card5Click}
--*Primitive* ways to spam NPs after priority target appeared in battle. IT WILL override autoskill NP skill. Check function ultcard()
local Ultcard1Click = (Location(1000,220))
local Ultcard2Click = (Location(1300,400))
local Ultcard3Click = (Location(1740,400))
local UltcardArray = {Ultcard1Click, Ultcard2Click, Ultcard3Click}
--functions
local init
local getUltcard
local checkCardAffin
local checkCardType
local ultcard
local calculateCardScore
local clickCommandCards
init = function()
--[[Considering:
Battle_CardPriority = "BAQ"
then:
CardPriorityArray = {"WB", "B", "RB", "WA", "A", "RA", "WQ", "Q", "RQ"}
--]]
local errorString = "Battle_CardPriority Error at '"
if Battle_CardPriority:len() == 3 then
for card in Battle_CardPriority:gmatch(".") do
if card:match("[^B^A^Q]") then
scriptExit(errorString ..card.. "': Only 'B', 'A' and 'Q' are allowed in simple mode.")
end
table.insert(CardPriorityArray, "W" .. card)
table.insert(CardPriorityArray, card)
table.insert(CardPriorityArray, "R" .. card)
end
else
local cardCounter = 0
for card in Battle_CardPriority:gmatch("[^,]+") do
card = stringUtils.trim(card)
if card:len() == 1 then
if card:match("[^B^A^Q]") then
scriptExit(errorString ..card.. "': Only 'B', 'A' and 'Q' are valid single character inputs.")
end
elseif card:len() == 2 then
if card:match("^[^W^R][^B^A^Q]-") or card:match("^[WR][^B^A^Q]")then
scriptExit(errorString ..card.. "': Only 'WB', 'RB', 'WA', 'RA', 'WQ', and 'RQ are valid double characters inputs.")
end
elseif card:len() == 0 or card:len() > 2 then
scriptExit(errorString ..card.. "': Invalid input.")
end
table.insert(CardPriorityArray, card)
cardCounter = cardCounter +1
end
if cardCounter ~= 9 then
scriptExit(errorString ..Battle_CardPriority.. "': Extected 9 card priorities. Your input is either lacking or exceeding the available number.")
end
end
end
getUltcard = function(servantIndex)
return UltcardArray[servantIndex]
end
checkCardAffin = function(region)
if region:exists(GeneralImagePath .. "weak.png") then
return WeakMulti
end
if region:exists(GeneralImagePath .. "resist.png") then
return ResistMulti
else
return NormalMulti
end
end
checkCardType = function(region)
if region:exists(GeneralImagePath .. "buster.png") then
return BCard
end
if region:exists(GeneralImagePath .. "art.png") then
return ACard
end
if region:exists(GeneralImagePath .. "quick.png") then
return QCard
else
return BCard
end
end
ultcard = function()
local weCanSpam = Battle_NoblePhantasm == "spam"
local weAreInDanger = Battle_NoblePhantasm == "danger" and TargetChoosen == 1
local isAutoskillFinished = Enable_Autoskill == 0 or CleartoSpamNP == 1
if (weCanSpam or weAreInDanger) and isAutoskillFinished then
click(Ultcard1Click)
click(Ultcard2Click)
click(Ultcard3Click)
end
end
calculateCardScore = function(allCardTypeStorage)
local function calculate()
for cardSlot = 1, 5 do
local cardAffinity = checkCardAffin(CardAffinRegionArray[cardSlot])
local cardType = checkCardType(CardTypeRegionArray[cardSlot])
local cardScore = cardAffinity * cardType
if cardScore == WeakBuster then
table.insert(allCardTypeStorage.WB, cardSlot)
elseif cardScore == BCard then
table.insert(allCardTypeStorage.B, cardSlot)
elseif cardScore == ResistBuster then
table.insert(allCardTypeStorage.RB, cardSlot)
elseif cardScore == WeakArt then
table.insert(allCardTypeStorage.WA, cardSlot)
elseif cardScore == ACard then
table.insert(allCardTypeStorage.A, cardSlot)
elseif cardScore == ResistArt then
table.insert(allCardTypeStorage.RA, cardSlot)
elseif cardScore == WeakQuick then
table.insert(allCardTypeStorage.WQ, cardSlot)
elseif cardScore == QCard then
table.insert(allCardTypeStorage.Q, cardSlot)
else
table.insert(allCardTypeStorage.RQ, cardSlot)
end
end
return allCardTypeStorage
end
return ankuluaUtils.useSameSnapIn(calculate)
end
clickCommandCards = function()
local allCardTypeStorage =
{
WB = {}, B = {}, RB = {},
WA = {}, A = {}, RA = {},
WQ = {}, Q = {}, RQ = {}
}
local currentAllCardTypeStorages = calculateCardScore(allCardTypeStorage)
local clickCount = 0
ultcard()
wait(0.5)
for _, cardPriority in pairs(CardPriorityArray) do
local currentCardTypeStorage = currentAllCardTypeStorages[cardPriority]
for _, cardSlot in pairs(currentCardTypeStorage) do
click(CardClickArray[cardSlot])
clickCount = clickCount + 1
if clickCount == 3 then
return
end
end
end
end
return {
init = init,
getUltcard = getUltcard,
clickCommandCards = clickCommandCards,
}
|
object_tangible_furniture_rustic_armoire_rustic_s01 = object_tangible_furniture_rustic_shared_armoire_rustic_s01:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_rustic_armoire_rustic_s01, "object/tangible/furniture/rustic/armoire_rustic_s01.iff")
|
local defs = {}
defs["ImColor"] = "struct ImColor"
defs["ImDrawCallback"] = "void(*)(const ImDrawList* parent_list,const ImDrawCmd* cmd);"
defs["ImDrawChannel"] = "struct ImDrawChannel"
defs["ImDrawCmd"] = "struct ImDrawCmd"
defs["ImDrawCmdHeader"] = "struct ImDrawCmdHeader"
defs["ImDrawData"] = "struct ImDrawData"
defs["ImDrawFlags"] = "int"
defs["ImDrawIdx"] = "unsigned short"
defs["ImDrawList"] = "struct ImDrawList"
defs["ImDrawListFlags"] = "int"
defs["ImDrawListSharedData"] = "struct ImDrawListSharedData"
defs["ImDrawListSplitter"] = "struct ImDrawListSplitter"
defs["ImDrawVert"] = "struct ImDrawVert"
defs["ImFont"] = "struct ImFont"
defs["ImFontAtlas"] = "struct ImFontAtlas"
defs["ImFontAtlasCustomRect"] = "struct ImFontAtlasCustomRect"
defs["ImFontAtlasFlags"] = "int"
defs["ImFontBuilderIO"] = "struct ImFontBuilderIO"
defs["ImFontConfig"] = "struct ImFontConfig"
defs["ImFontGlyph"] = "struct ImFontGlyph"
defs["ImFontGlyphRangesBuilder"] = "struct ImFontGlyphRangesBuilder"
defs["ImGuiBackendFlags"] = "int"
defs["ImGuiButtonFlags"] = "int"
defs["ImGuiCol"] = "int"
defs["ImGuiColorEditFlags"] = "int"
defs["ImGuiComboFlags"] = "int"
defs["ImGuiCond"] = "int"
defs["ImGuiConfigFlags"] = "int"
defs["ImGuiContext"] = "struct ImGuiContext"
defs["ImGuiDataType"] = "int"
defs["ImGuiDir"] = "int"
defs["ImGuiDragDropFlags"] = "int"
defs["ImGuiFocusedFlags"] = "int"
defs["ImGuiHoveredFlags"] = "int"
defs["ImGuiID"] = "unsigned int"
defs["ImGuiIO"] = "struct ImGuiIO"
defs["ImGuiInputTextCallback"] = "int(*)(ImGuiInputTextCallbackData* data);"
defs["ImGuiInputTextCallbackData"] = "struct ImGuiInputTextCallbackData"
defs["ImGuiInputTextFlags"] = "int"
defs["ImGuiKey"] = "int"
defs["ImGuiKeyModFlags"] = "int"
defs["ImGuiListClipper"] = "struct ImGuiListClipper"
defs["ImGuiMemAllocFunc"] = "void*(*)(size_t sz,void* user_data);"
defs["ImGuiMemFreeFunc"] = "void(*)(void* ptr,void* user_data);"
defs["ImGuiMouseButton"] = "int"
defs["ImGuiMouseCursor"] = "int"
defs["ImGuiNavInput"] = "int"
defs["ImGuiOnceUponAFrame"] = "struct ImGuiOnceUponAFrame"
defs["ImGuiPayload"] = "struct ImGuiPayload"
defs["ImGuiPopupFlags"] = "int"
defs["ImGuiSelectableFlags"] = "int"
defs["ImGuiSizeCallback"] = "void(*)(ImGuiSizeCallbackData* data);"
defs["ImGuiSizeCallbackData"] = "struct ImGuiSizeCallbackData"
defs["ImGuiSliderFlags"] = "int"
defs["ImGuiSortDirection"] = "int"
defs["ImGuiStorage"] = "struct ImGuiStorage"
defs["ImGuiStoragePair"] = "struct ImGuiStoragePair"
defs["ImGuiStyle"] = "struct ImGuiStyle"
defs["ImGuiStyleVar"] = "int"
defs["ImGuiTabBarFlags"] = "int"
defs["ImGuiTabItemFlags"] = "int"
defs["ImGuiTableBgTarget"] = "int"
defs["ImGuiTableColumnFlags"] = "int"
defs["ImGuiTableColumnSortSpecs"] = "struct ImGuiTableColumnSortSpecs"
defs["ImGuiTableFlags"] = "int"
defs["ImGuiTableRowFlags"] = "int"
defs["ImGuiTableSortSpecs"] = "struct ImGuiTableSortSpecs"
defs["ImGuiTextBuffer"] = "struct ImGuiTextBuffer"
defs["ImGuiTextFilter"] = "struct ImGuiTextFilter"
defs["ImGuiTextRange"] = "struct ImGuiTextRange"
defs["ImGuiTreeNodeFlags"] = "int"
defs["ImGuiViewport"] = "struct ImGuiViewport"
defs["ImGuiViewportFlags"] = "int"
defs["ImGuiWindowFlags"] = "int"
defs["ImS16"] = "signed short"
defs["ImS32"] = "signed int"
defs["ImS64"] = "signed __int64"
defs["ImS8"] = "signed char"
defs["ImTextureID"] = "void*"
defs["ImU16"] = "unsigned short"
defs["ImU32"] = "unsigned int"
defs["ImU64"] = "unsigned __int64"
defs["ImU8"] = "unsigned char"
defs["ImVec2"] = "struct ImVec2"
defs["ImVec4"] = "struct ImVec4"
defs["ImWchar"] = "ImWchar16"
defs["ImWchar16"] = "unsigned short"
defs["ImWchar32"] = "unsigned int"
defs["const_iterator"] = "const value_type*"
defs["iterator"] = "value_type*"
defs["value_type"] = "T"
return defs
|
if not (GetLocale() == "deDE") then return end
local _, db = ...
|
-- Note: Premake5 crashes if there is no valid platform for a project.
-- Since this plugin is only supported on Windows, we must not define it
-- if the host platform is not Windows.
if not minko.platform.supports { "windows32", "windows64" } then
return
end
PROJECT_NAME = path.getname(os.getcwd())
minko.project.library("minko-plugin-" .. PROJECT_NAME)
files {
"lib/**.hpp",
"lib/**.h",
"lib/**.cpp",
"lib/**.c",
"include/**.hpp",
"src/**.cpp"
}
includedirs {
"include",
minko.plugin.path("sdl") .. "/include",
minko.plugin.path("sdl") .. "/lib/sdl/include"
}
|
function init()
local bounds = mcontroller.boundBox()
effect.addStatModifierGroup({
{stat = "jumpModifier", amount = 20.0}
})
end
function update(dt)
mcontroller.controlModifiers({
airJumpModifier = 7.0
})
end
function uninit()
end
|
local Native = require('lib.native.native')
---@class AbilityIntegerLevelField
local AbilityIntegerLevelField = {
ManaCost = Native.ConvertAbilityIntegerLevelField(0x616D6373), --ABILITY_ILF_MANA_COST
NumberOfWaves = Native.ConvertAbilityIntegerLevelField(0x48627A31), --ABILITY_ILF_NUMBER_OF_WAVES
NumberOfShards = Native.ConvertAbilityIntegerLevelField(0x48627A33), --ABILITY_ILF_NUMBER_OF_SHARDS
NumberOfUnitsTeleported = Native.ConvertAbilityIntegerLevelField(0x486D7431), --ABILITY_ILF_NUMBER_OF_UNITS_TELEPORTED
SummonedUnitCountHwe2 = Native.ConvertAbilityIntegerLevelField(0x48776532), --ABILITY_ILF_SUMMONED_UNIT_COUNT_HWE2
NumberOfImages = Native.ConvertAbilityIntegerLevelField(0x4F6D6931), --ABILITY_ILF_NUMBER_OF_IMAGES
NumberOfCorpsesRaisedUan1 = Native.ConvertAbilityIntegerLevelField(0x55616E31), --ABILITY_ILF_NUMBER_OF_CORPSES_RAISED_UAN1
MorphingFlags = Native.ConvertAbilityIntegerLevelField(0x456D6532), --ABILITY_ILF_MORPHING_FLAGS
StrengthBonusNrg5 = Native.ConvertAbilityIntegerLevelField(0x4E726735), --ABILITY_ILF_STRENGTH_BONUS_NRG5
DefenseBonusNrg6 = Native.ConvertAbilityIntegerLevelField(0x4E726736), --ABILITY_ILF_DEFENSE_BONUS_NRG6
NumberOfTargetsHit = Native.ConvertAbilityIntegerLevelField(0x4F636C32), --ABILITY_ILF_NUMBER_OF_TARGETS_HIT
DetectionTypeOfs1 = Native.ConvertAbilityIntegerLevelField(0x4F667331), --ABILITY_ILF_DETECTION_TYPE_OFS1
NumberOfSummonedUnitsOsf2 = Native.ConvertAbilityIntegerLevelField(0x4F736632), --ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_OSF2
NumberOfSummonedUnitsEfn1 = Native.ConvertAbilityIntegerLevelField(0x45666E31), --ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_EFN1
NumberOfCorpsesRaisedHre1 = Native.ConvertAbilityIntegerLevelField(0x48726531), --ABILITY_ILF_NUMBER_OF_CORPSES_RAISED_HRE1
StackFlags = Native.ConvertAbilityIntegerLevelField(0x48636134), --ABILITY_ILF_STACK_FLAGS
MinimumNumberOfUnits = Native.ConvertAbilityIntegerLevelField(0x4E647032), --ABILITY_ILF_MINIMUM_NUMBER_OF_UNITS
MaximumNumberOfUnitsNdp3 = Native.ConvertAbilityIntegerLevelField(0x4E647033), --ABILITY_ILF_MAXIMUM_NUMBER_OF_UNITS_NDP3
NumberOfUnitsCreatedNrc2 = Native.ConvertAbilityIntegerLevelField(0x4E726332), --ABILITY_ILF_NUMBER_OF_UNITS_CREATED_NRC2
ShieldLife = Native.ConvertAbilityIntegerLevelField(0x416D7333), --ABILITY_ILF_SHIELD_LIFE
ManaLossAms4 = Native.ConvertAbilityIntegerLevelField(0x416D7334), --ABILITY_ILF_MANA_LOSS_AMS4
GoldPerIntervalBgm1 = Native.ConvertAbilityIntegerLevelField(0x42676D31), --ABILITY_ILF_GOLD_PER_INTERVAL_BGM1
MaxNumberOfMiners = Native.ConvertAbilityIntegerLevelField(0x42676D33), --ABILITY_ILF_MAX_NUMBER_OF_MINERS
CargoCapacity = Native.ConvertAbilityIntegerLevelField(0x43617231), --ABILITY_ILF_CARGO_CAPACITY
MaximumCreepLevelDev3 = Native.ConvertAbilityIntegerLevelField(0x44657633), --ABILITY_ILF_MAXIMUM_CREEP_LEVEL_DEV3
MaxCreepLevelDev1 = Native.ConvertAbilityIntegerLevelField(0x44657631), --ABILITY_ILF_MAX_CREEP_LEVEL_DEV1
GoldPerIntervalEgm1 = Native.ConvertAbilityIntegerLevelField(0x45676D31), --ABILITY_ILF_GOLD_PER_INTERVAL_EGM1
DefenseReduction = Native.ConvertAbilityIntegerLevelField(0x46616531), --ABILITY_ILF_DEFENSE_REDUCTION
DetectionTypeFla1 = Native.ConvertAbilityIntegerLevelField(0x466C6131), --ABILITY_ILF_DETECTION_TYPE_FLA1
FlareCount = Native.ConvertAbilityIntegerLevelField(0x466C6133), --ABILITY_ILF_FLARE_COUNT
MaxGold = Native.ConvertAbilityIntegerLevelField(0x476C6431), --ABILITY_ILF_MAX_GOLD
MiningCapacity = Native.ConvertAbilityIntegerLevelField(0x476C6433), --ABILITY_ILF_MINING_CAPACITY
MaximumNumberOfCorpsesGyd1 = Native.ConvertAbilityIntegerLevelField(0x47796431), --ABILITY_ILF_MAXIMUM_NUMBER_OF_CORPSES_GYD1
DamageToTree = Native.ConvertAbilityIntegerLevelField(0x48617231), --ABILITY_ILF_DAMAGE_TO_TREE
LumberCapacity = Native.ConvertAbilityIntegerLevelField(0x48617232), --ABILITY_ILF_LUMBER_CAPACITY
GoldCapacity = Native.ConvertAbilityIntegerLevelField(0x48617233), --ABILITY_ILF_GOLD_CAPACITY
DefenseIncreaseInf2 = Native.ConvertAbilityIntegerLevelField(0x496E6632), --ABILITY_ILF_DEFENSE_INCREASE_INF2
InteractionType = Native.ConvertAbilityIntegerLevelField(0x4E657532), --ABILITY_ILF_INTERACTION_TYPE
GoldCostNdt1 = Native.ConvertAbilityIntegerLevelField(0x4E647431), --ABILITY_ILF_GOLD_COST_NDT1
LumberCostNdt2 = Native.ConvertAbilityIntegerLevelField(0x4E647432), --ABILITY_ILF_LUMBER_COST_NDT2
DetectionTypeNdt3 = Native.ConvertAbilityIntegerLevelField(0x4E647433), --ABILITY_ILF_DETECTION_TYPE_NDT3
StackingTypePoi4 = Native.ConvertAbilityIntegerLevelField(0x506F6934), --ABILITY_ILF_STACKING_TYPE_POI4
StackingTypePoa5 = Native.ConvertAbilityIntegerLevelField(0x506F6135), --ABILITY_ILF_STACKING_TYPE_POA5
MaximumCreepLevelPly1 = Native.ConvertAbilityIntegerLevelField(0x506C7931), --ABILITY_ILF_MAXIMUM_CREEP_LEVEL_PLY1
MaximumCreepLevelPos1 = Native.ConvertAbilityIntegerLevelField(0x506F7331), --ABILITY_ILF_MAXIMUM_CREEP_LEVEL_POS1
MovementUpdateFrequencyPrg1 = Native.ConvertAbilityIntegerLevelField(0x50726731), --ABILITY_ILF_MOVEMENT_UPDATE_FREQUENCY_PRG1
AttackUpdateFrequencyPrg2 = Native.ConvertAbilityIntegerLevelField(0x50726732), --ABILITY_ILF_ATTACK_UPDATE_FREQUENCY_PRG2
ManaLossPrg6 = Native.ConvertAbilityIntegerLevelField(0x50726736), --ABILITY_ILF_MANA_LOSS_PRG6
UnitsSummonedTypeOne = Native.ConvertAbilityIntegerLevelField(0x52616931), --ABILITY_ILF_UNITS_SUMMONED_TYPE_ONE
UnitsSummonedTypeTwo = Native.ConvertAbilityIntegerLevelField(0x52616932), --ABILITY_ILF_UNITS_SUMMONED_TYPE_TWO
MaxUnitsSummoned = Native.ConvertAbilityIntegerLevelField(0x55636235), --ABILITY_ILF_MAX_UNITS_SUMMONED
AllowWhenFullRej3 = Native.ConvertAbilityIntegerLevelField(0x52656A33), --ABILITY_ILF_ALLOW_WHEN_FULL_REJ3
MaximumUnitsChargedToCaster = Native.ConvertAbilityIntegerLevelField(0x52706235), --ABILITY_ILF_MAXIMUM_UNITS_CHARGED_TO_CASTER
MaximumUnitsAffected = Native.ConvertAbilityIntegerLevelField(0x52706236), --ABILITY_ILF_MAXIMUM_UNITS_AFFECTED
DefenseIncreaseRoa2 = Native.ConvertAbilityIntegerLevelField(0x526F6132), --ABILITY_ILF_DEFENSE_INCREASE_ROA2
MaxUnitsRoa7 = Native.ConvertAbilityIntegerLevelField(0x526F6137), --ABILITY_ILF_MAX_UNITS_ROA7
RootedWeapons = Native.ConvertAbilityIntegerLevelField(0x526F6F31), --ABILITY_ILF_ROOTED_WEAPONS
UprootedWeapons = Native.ConvertAbilityIntegerLevelField(0x526F6F32), --ABILITY_ILF_UPROOTED_WEAPONS
UprootedDefenseType = Native.ConvertAbilityIntegerLevelField(0x526F6F34), --ABILITY_ILF_UPROOTED_DEFENSE_TYPE
AccumulationStep = Native.ConvertAbilityIntegerLevelField(0x53616C32), --ABILITY_ILF_ACCUMULATION_STEP
NumberOfOwls = Native.ConvertAbilityIntegerLevelField(0x45736E34), --ABILITY_ILF_NUMBER_OF_OWLS
StackingTypeSpo4 = Native.ConvertAbilityIntegerLevelField(0x53706F34), --ABILITY_ILF_STACKING_TYPE_SPO4
NumberOfUnits = Native.ConvertAbilityIntegerLevelField(0x536F6431), --ABILITY_ILF_NUMBER_OF_UNITS
SpiderCapacity = Native.ConvertAbilityIntegerLevelField(0x53706131), --ABILITY_ILF_SPIDER_CAPACITY
IntervalsBeforeChangingTrees = Native.ConvertAbilityIntegerLevelField(0x57686132), --ABILITY_ILF_INTERVALS_BEFORE_CHANGING_TREES
AgilityBonus = Native.ConvertAbilityIntegerLevelField(0x49616769), --ABILITY_ILF_AGILITY_BONUS
IntelligenceBonus = Native.ConvertAbilityIntegerLevelField(0x49696E74), --ABILITY_ILF_INTELLIGENCE_BONUS
StrengthBonusIstr = Native.ConvertAbilityIntegerLevelField(0x49737472), --ABILITY_ILF_STRENGTH_BONUS_ISTR
AttackBonus = Native.ConvertAbilityIntegerLevelField(0x49617474), --ABILITY_ILF_ATTACK_BONUS
DefenseBonusIdef = Native.ConvertAbilityIntegerLevelField(0x49646566), --ABILITY_ILF_DEFENSE_BONUS_IDEF
Summon1Amount = Native.ConvertAbilityIntegerLevelField(0x49736E31), --ABILITY_ILF_SUMMON_1_AMOUNT
Summon2Amount = Native.ConvertAbilityIntegerLevelField(0x49736E32), --ABILITY_ILF_SUMMON_2_AMOUNT
ExperienceGained = Native.ConvertAbilityIntegerLevelField(0x49787067), --ABILITY_ILF_EXPERIENCE_GAINED
HitPointsGainedIhpg = Native.ConvertAbilityIntegerLevelField(0x49687067), --ABILITY_ILF_HIT_POINTS_GAINED_IHPG
ManaPointsGainedImpg = Native.ConvertAbilityIntegerLevelField(0x496D7067), --ABILITY_ILF_MANA_POINTS_GAINED_IMPG
HitPointsGainedIhp2 = Native.ConvertAbilityIntegerLevelField(0x49687032), --ABILITY_ILF_HIT_POINTS_GAINED_IHP2
ManaPointsGainedImp2 = Native.ConvertAbilityIntegerLevelField(0x496D7032), --ABILITY_ILF_MANA_POINTS_GAINED_IMP2
DamageBonusDice = Native.ConvertAbilityIntegerLevelField(0x49646963), --ABILITY_ILF_DAMAGE_BONUS_DICE
ArmorPenaltyIarp = Native.ConvertAbilityIntegerLevelField(0x49617270), --ABILITY_ILF_ARMOR_PENALTY_IARP
EnabledAttackIndexIob5 = Native.ConvertAbilityIntegerLevelField(0x496F6235), --ABILITY_ILF_ENABLED_ATTACK_INDEX_IOB5
LevelsGained = Native.ConvertAbilityIntegerLevelField(0x496C6576), --ABILITY_ILF_LEVELS_GAINED
MaxLifeGained = Native.ConvertAbilityIntegerLevelField(0x496C6966), --ABILITY_ILF_MAX_LIFE_GAINED
MaxManaGained = Native.ConvertAbilityIntegerLevelField(0x496D616E), --ABILITY_ILF_MAX_MANA_GAINED
GoldGiven = Native.ConvertAbilityIntegerLevelField(0x49676F6C), --ABILITY_ILF_GOLD_GIVEN
LumberGiven = Native.ConvertAbilityIntegerLevelField(0x496C756D), --ABILITY_ILF_LUMBER_GIVEN
DetectionTypeIfa1 = Native.ConvertAbilityIntegerLevelField(0x49666131), --ABILITY_ILF_DETECTION_TYPE_IFA1
MaximumCreepLevelIcre = Native.ConvertAbilityIntegerLevelField(0x49637265), --ABILITY_ILF_MAXIMUM_CREEP_LEVEL_ICRE
MovementSpeedBonus = Native.ConvertAbilityIntegerLevelField(0x496D7662), --ABILITY_ILF_MOVEMENT_SPEED_BONUS
HitPointsRegeneratedPerSecond = Native.ConvertAbilityIntegerLevelField(0x49687072), --ABILITY_ILF_HIT_POINTS_REGENERATED_PER_SECOND
SightRangeBonus = Native.ConvertAbilityIntegerLevelField(0x49736962), --ABILITY_ILF_SIGHT_RANGE_BONUS
DamagePerDuration = Native.ConvertAbilityIntegerLevelField(0x49636664), --ABILITY_ILF_DAMAGE_PER_DURATION
ManaUsedPerSecond = Native.ConvertAbilityIntegerLevelField(0x4963666D), --ABILITY_ILF_MANA_USED_PER_SECOND
ExtraManaRequired = Native.ConvertAbilityIntegerLevelField(0x49636678), --ABILITY_ILF_EXTRA_MANA_REQUIRED
DetectionRadiusIdet = Native.ConvertAbilityIntegerLevelField(0x49646574), --ABILITY_ILF_DETECTION_RADIUS_IDET
ManaLossPerUnitIdim = Native.ConvertAbilityIntegerLevelField(0x4964696D), --ABILITY_ILF_MANA_LOSS_PER_UNIT_IDIM
DamageToSummonedUnitsIdid = Native.ConvertAbilityIntegerLevelField(0x49646964), --ABILITY_ILF_DAMAGE_TO_SUMMONED_UNITS_IDID
MaximumNumberOfUnitsIrec = Native.ConvertAbilityIntegerLevelField(0x49726563), --ABILITY_ILF_MAXIMUM_NUMBER_OF_UNITS_IREC
DelayAfterDeathSeconds = Native.ConvertAbilityIntegerLevelField(0x49726364), --ABILITY_ILF_DELAY_AFTER_DEATH_SECONDS
RestoredLife = Native.ConvertAbilityIntegerLevelField(0x69726332), --ABILITY_ILF_RESTORED_LIFE
RestoredMana1ForCurrent = Native.ConvertAbilityIntegerLevelField(0x69726333), --ABILITY_ILF_RESTORED_MANA__1_FOR_CURRENT
HitPointsRestored = Native.ConvertAbilityIntegerLevelField(0x49687073), --ABILITY_ILF_HIT_POINTS_RESTORED
ManaPointsRestored = Native.ConvertAbilityIntegerLevelField(0x496D7073), --ABILITY_ILF_MANA_POINTS_RESTORED
MaximumNumberOfUnitsItpm = Native.ConvertAbilityIntegerLevelField(0x4974706D), --ABILITY_ILF_MAXIMUM_NUMBER_OF_UNITS_ITPM
NumberOfCorpsesRaisedCad1 = Native.ConvertAbilityIntegerLevelField(0x43616431), --ABILITY_ILF_NUMBER_OF_CORPSES_RAISED_CAD1
TerrainDeformationDurationMs = Native.ConvertAbilityIntegerLevelField(0x57727333), --ABILITY_ILF_TERRAIN_DEFORMATION_DURATION_MS
MaximumUnits = Native.ConvertAbilityIntegerLevelField(0x55647331), --ABILITY_ILF_MAXIMUM_UNITS
DetectionTypeDet1 = Native.ConvertAbilityIntegerLevelField(0x44657431), --ABILITY_ILF_DETECTION_TYPE_DET1
GoldCostPerStructure = Native.ConvertAbilityIntegerLevelField(0x4E737031), --ABILITY_ILF_GOLD_COST_PER_STRUCTURE
LumberCostPerUse = Native.ConvertAbilityIntegerLevelField(0x4E737032), --ABILITY_ILF_LUMBER_COST_PER_USE
DetectionTypeNsp3 = Native.ConvertAbilityIntegerLevelField(0x4E737033), --ABILITY_ILF_DETECTION_TYPE_NSP3
NumberOfSwarmUnits = Native.ConvertAbilityIntegerLevelField(0x556C7331), --ABILITY_ILF_NUMBER_OF_SWARM_UNITS
MaxSwarmUnitsPerTarget = Native.ConvertAbilityIntegerLevelField(0x556C7333), --ABILITY_ILF_MAX_SWARM_UNITS_PER_TARGET
NumberOfSummonedUnitsNba2 = Native.ConvertAbilityIntegerLevelField(0x4E626132), --ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_NBA2
MaximumCreepLevelNch1 = Native.ConvertAbilityIntegerLevelField(0x4E636831), --ABILITY_ILF_MAXIMUM_CREEP_LEVEL_NCH1
AttacksPrevented = Native.ConvertAbilityIntegerLevelField(0x4E736931), --ABILITY_ILF_ATTACKS_PREVENTED
MaximumNumberOfTargetsEfk3 = Native.ConvertAbilityIntegerLevelField(0x45666B33), --ABILITY_ILF_MAXIMUM_NUMBER_OF_TARGETS_EFK3
NumberOfSummonedUnitsEsv1 = Native.ConvertAbilityIntegerLevelField(0x45737631), --ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_ESV1
MaximumNumberOfCorpsesExh1 = Native.ConvertAbilityIntegerLevelField(0x65786831), --ABILITY_ILF_MAXIMUM_NUMBER_OF_CORPSES_EXH1
ItemCapacity = Native.ConvertAbilityIntegerLevelField(0x696E7631), --ABILITY_ILF_ITEM_CAPACITY
MaximumNumberOfTargetsSpl2 = Native.ConvertAbilityIntegerLevelField(0x73706C32), --ABILITY_ILF_MAXIMUM_NUMBER_OF_TARGETS_SPL2
AllowWhenFullIrl3 = Native.ConvertAbilityIntegerLevelField(0x69726C33), --ABILITY_ILF_ALLOW_WHEN_FULL_IRL3
MaximumDispelledUnits = Native.ConvertAbilityIntegerLevelField(0x69646333), --ABILITY_ILF_MAXIMUM_DISPELLED_UNITS
NumberOfLures = Native.ConvertAbilityIntegerLevelField(0x696D6F31), --ABILITY_ILF_NUMBER_OF_LURES
NewTimeOfDayHour = Native.ConvertAbilityIntegerLevelField(0x69637431), --ABILITY_ILF_NEW_TIME_OF_DAY_HOUR
NewTimeOfDayMinute = Native.ConvertAbilityIntegerLevelField(0x69637432), --ABILITY_ILF_NEW_TIME_OF_DAY_MINUTE
NumberOfUnitsCreatedMec1 = Native.ConvertAbilityIntegerLevelField(0x6D656331), --ABILITY_ILF_NUMBER_OF_UNITS_CREATED_MEC1
MinimumSpells = Native.ConvertAbilityIntegerLevelField(0x73706233), --ABILITY_ILF_MINIMUM_SPELLS
MaximumSpells = Native.ConvertAbilityIntegerLevelField(0x73706234), --ABILITY_ILF_MAXIMUM_SPELLS
DisabledAttackIndex = Native.ConvertAbilityIntegerLevelField(0x67726133), --ABILITY_ILF_DISABLED_ATTACK_INDEX
EnabledAttackIndexGra4 = Native.ConvertAbilityIntegerLevelField(0x67726134), --ABILITY_ILF_ENABLED_ATTACK_INDEX_GRA4
MaximumAttacks = Native.ConvertAbilityIntegerLevelField(0x67726135), --ABILITY_ILF_MAXIMUM_ATTACKS
BuildingTypesAllowedNpr1 = Native.ConvertAbilityIntegerLevelField(0x4E707231), --ABILITY_ILF_BUILDING_TYPES_ALLOWED_NPR1
BuildingTypesAllowedNsa1 = Native.ConvertAbilityIntegerLevelField(0x4E736131), --ABILITY_ILF_BUILDING_TYPES_ALLOWED_NSA1
AttackModification = Native.ConvertAbilityIntegerLevelField(0x49616131), --ABILITY_ILF_ATTACK_MODIFICATION
SummonedUnitCountNpa5 = Native.ConvertAbilityIntegerLevelField(0x4E706135), --ABILITY_ILF_SUMMONED_UNIT_COUNT_NPA5
UpgradeLevels = Native.ConvertAbilityIntegerLevelField(0x49676C31), --ABILITY_ILF_UPGRADE_LEVELS
NumberOfSummonedUnitsNdo2 = Native.ConvertAbilityIntegerLevelField(0x4E646F32), --ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_NDO2
BeastsPerSecond = Native.ConvertAbilityIntegerLevelField(0x4E737431), --ABILITY_ILF_BEASTS_PER_SECOND
TargetType = Native.ConvertAbilityIntegerLevelField(0x4E636C32), --ABILITY_ILF_TARGET_TYPE
Options = Native.ConvertAbilityIntegerLevelField(0x4E636C33), --ABILITY_ILF_OPTIONS
ArmorPenaltyNab3 = Native.ConvertAbilityIntegerLevelField(0x4E616233), --ABILITY_ILF_ARMOR_PENALTY_NAB3
WaveCountNhs6 = Native.ConvertAbilityIntegerLevelField(0x4E687336), --ABILITY_ILF_WAVE_COUNT_NHS6
MaxCreepLevelNtm3 = Native.ConvertAbilityIntegerLevelField(0x4E746D33), --ABILITY_ILF_MAX_CREEP_LEVEL_NTM3
MissileCount = Native.ConvertAbilityIntegerLevelField(0x4E637333), --ABILITY_ILF_MISSILE_COUNT
SplitAttackCount = Native.ConvertAbilityIntegerLevelField(0x4E6C6D33), --ABILITY_ILF_SPLIT_ATTACK_COUNT
GenerationCount = Native.ConvertAbilityIntegerLevelField(0x4E6C6D36), --ABILITY_ILF_GENERATION_COUNT
RockRingCount = Native.ConvertAbilityIntegerLevelField(0x4E766331), --ABILITY_ILF_ROCK_RING_COUNT
WaveCountNvc2 = Native.ConvertAbilityIntegerLevelField(0x4E766332), --ABILITY_ILF_WAVE_COUNT_NVC2
PreferHostilesTau1 = Native.ConvertAbilityIntegerLevelField(0x54617531), --ABILITY_ILF_PREFER_HOSTILES_TAU1
PreferFriendliesTau2 = Native.ConvertAbilityIntegerLevelField(0x54617532), --ABILITY_ILF_PREFER_FRIENDLIES_TAU2
MaxUnitsTau3 = Native.ConvertAbilityIntegerLevelField(0x54617533), --ABILITY_ILF_MAX_UNITS_TAU3
NumberOfPulses = Native.ConvertAbilityIntegerLevelField(0x54617534), --ABILITY_ILF_NUMBER_OF_PULSES
SummonedUnitTypeHwe1 = Native.ConvertAbilityIntegerLevelField(0x48776531), --ABILITY_ILF_SUMMONED_UNIT_TYPE_HWE1
SummonedUnitUin4 = Native.ConvertAbilityIntegerLevelField(0x55696E34), --ABILITY_ILF_SUMMONED_UNIT_UIN4
SummonedUnitOsf1 = Native.ConvertAbilityIntegerLevelField(0x4F736631), --ABILITY_ILF_SUMMONED_UNIT_OSF1
SummonedUnitTypeEfnu = Native.ConvertAbilityIntegerLevelField(0x45666E75), --ABILITY_ILF_SUMMONED_UNIT_TYPE_EFNU
SummonedUnitTypeNbau = Native.ConvertAbilityIntegerLevelField(0x4E626175), --ABILITY_ILF_SUMMONED_UNIT_TYPE_NBAU
SummonedUnitTypeNtou = Native.ConvertAbilityIntegerLevelField(0x4E746F75), --ABILITY_ILF_SUMMONED_UNIT_TYPE_NTOU
SummonedUnitTypeEsvu = Native.ConvertAbilityIntegerLevelField(0x45737675), --ABILITY_ILF_SUMMONED_UNIT_TYPE_ESVU
SummonedUnitTypes = Native.ConvertAbilityIntegerLevelField(0x4E656631), --ABILITY_ILF_SUMMONED_UNIT_TYPES
SummonedUnitTypeNdou = Native.ConvertAbilityIntegerLevelField(0x4E646F75), --ABILITY_ILF_SUMMONED_UNIT_TYPE_NDOU
AlternateFormUnitEmeu = Native.ConvertAbilityIntegerLevelField(0x456D6575), --ABILITY_ILF_ALTERNATE_FORM_UNIT_EMEU
PlagueWardUnitType = Native.ConvertAbilityIntegerLevelField(0x41706C75), --ABILITY_ILF_PLAGUE_WARD_UNIT_TYPE
AllowedUnitTypeBtl1 = Native.ConvertAbilityIntegerLevelField(0x42746C31), --ABILITY_ILF_ALLOWED_UNIT_TYPE_BTL1
NewUnitType = Native.ConvertAbilityIntegerLevelField(0x43686131), --ABILITY_ILF_NEW_UNIT_TYPE
ResultingUnitTypeEnt1 = Native.ConvertAbilityIntegerLevelField(0x656E7431), --ABILITY_ILF_RESULTING_UNIT_TYPE_ENT1
CorpseUnitType = Native.ConvertAbilityIntegerLevelField(0x47796475), --ABILITY_ILF_CORPSE_UNIT_TYPE
AllowedUnitTypeLoa1 = Native.ConvertAbilityIntegerLevelField(0x4C6F6131), --ABILITY_ILF_ALLOWED_UNIT_TYPE_LOA1
UnitTypeForLimitCheck = Native.ConvertAbilityIntegerLevelField(0x52616975), --ABILITY_ILF_UNIT_TYPE_FOR_LIMIT_CHECK
WardUnitTypeStau = Native.ConvertAbilityIntegerLevelField(0x53746175), --ABILITY_ILF_WARD_UNIT_TYPE_STAU
EffectAbility = Native.ConvertAbilityIntegerLevelField(0x496F6275), --ABILITY_ILF_EFFECT_ABILITY
ConversionUnit = Native.ConvertAbilityIntegerLevelField(0x4E646332), --ABILITY_ILF_CONVERSION_UNIT
UnitToPreserve = Native.ConvertAbilityIntegerLevelField(0x4E736C31), --ABILITY_ILF_UNIT_TO_PRESERVE
UnitTypeAllowed = Native.ConvertAbilityIntegerLevelField(0x43686C31), --ABILITY_ILF_UNIT_TYPE_ALLOWED
SwarmUnitType = Native.ConvertAbilityIntegerLevelField(0x556C7375), --ABILITY_ILF_SWARM_UNIT_TYPE
ResultingUnitTypeCoau = Native.ConvertAbilityIntegerLevelField(0x636F6175), --ABILITY_ILF_RESULTING_UNIT_TYPE_COAU
UnitTypeExhu = Native.ConvertAbilityIntegerLevelField(0x65786875), --ABILITY_ILF_UNIT_TYPE_EXHU
WardUnitTypeHwdu = Native.ConvertAbilityIntegerLevelField(0x68776475), --ABILITY_ILF_WARD_UNIT_TYPE_HWDU
LureUnitType = Native.ConvertAbilityIntegerLevelField(0x696D6F75), --ABILITY_ILF_LURE_UNIT_TYPE
UnitTypeIpmu = Native.ConvertAbilityIntegerLevelField(0x69706D75), --ABILITY_ILF_UNIT_TYPE_IPMU
FactoryUnitId = Native.ConvertAbilityIntegerLevelField(0x4E737975), --ABILITY_ILF_FACTORY_UNIT_ID
SpawnUnitIdNfyu = Native.ConvertAbilityIntegerLevelField(0x4E667975), --ABILITY_ILF_SPAWN_UNIT_ID_NFYU
DestructibleId = Native.ConvertAbilityIntegerLevelField(0x4E766375), --ABILITY_ILF_DESTRUCTIBLE_ID
UpgradeType = Native.ConvertAbilityIntegerLevelField(0x49676C75), --ABILITY_ILF_UPGRADE_TYPE
}
return AbilityIntegerLevelField
|
-- Generated by CSharp.lua Compiler
local System = System
System.namespace("Slipe.Client.Dx", function (namespace)
-- <summary>
-- Interface for drawable objects on render
-- </summary>
namespace.interface("IDrawable", function ()
return {}
end)
end)
|
local modpath = minetest.get_modpath("bromeliads")
-- Add everything:
local modname = "bromeliads"
local regBrom = function(color, capColor)
minetest.register_node("bromeliads:bromeliad_"..color, {
description = capColor .. " Bromeliad",
drawtype = "plantlike",
waving = 1,
visual_scale = 1.0,
tiles = {"bromeliads_"..color..".png"},
inventory_image = "bromeliads_"..color..".png",
wield_image = "bromeliads_"..color..".png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 2, flora = 1, attached_node = 1, bromeliad = 1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
end
regBrom("blue", "Blue")
regBrom("orange", "Orange")
regBrom("red", "Red")
regBrom("violet", "Violet")
regBrom("yellow", "Yellow")
local growaction = function(pos, node)
pos.y = pos.y + 1
local over = minetest.get_node(pos)
if over.name ~= "air" then
return
end
pos.y = pos.y - 1
local light = minetest.get_node_light(pos)
if not light or light < 4 then
return
end
local r = 15
local pos0 = {x = pos.x - r, y = pos.y - r, z = pos.z - r}
local pos1 = {x = pos.x + r, y = pos.y + r, z = pos.z + r}
if #minetest.find_nodes_in_area(pos0, pos1, "group:bromeliad") > 0 then
return
end
local r = math.random(1, 100)
if r == 1 then
if pos.y > 60 then
minetest.set_node(pos, {name="bromeliads:bromeliad_blue"})
else
minetest.set_node(pos, {name="bromeliads:bromeliad_violet"})
end
elseif r <= 10 then
minetest.set_node(pos, {name="bromeliads:bromeliad_yellow"})
elseif r <= 25 then
minetest.set_node(pos, {name="bromeliads:bromeliad_orange"})
else
minetest.set_node(pos, {name="bromeliads:bromeliad_red"})
end
end
minetest.register_abm({
nodenames = {"default:jungleleaves"},
interval = 60,
chance = 10,
catch_up = true,
action = growaction,
})
|
local _, private = ...
if private.isClassic then return end
--[[ Lua Globals ]]
-- luacheck: globals
--[[ Core ]]
local Aurora = private.Aurora
local Base = Aurora.Base
local Hook, Skin = Aurora.Hook, Aurora.Skin
local Util = Aurora.Util
do --[[ FrameXML\HelpTip.lua ]]
local directions = {
"Down",
"Left",
"Up",
"Right"
}
Hook.HelpTipTemplateMixin = {}
function Hook.HelpTipTemplateMixin:AnchorArrow(rotationInfo, alignment)
local point, anchor, arrowAnchor, offsetX, offsetY = self:GetPoint()
if rotationInfo.swapOffsets then
offsetX = 4
else
offsetY = 4
end
self.Arrow:SetPoint(point, anchor, arrowAnchor, offsetX, offsetY)
end
function Hook.HelpTipTemplateMixin:RotateArrow(rotation)
local Arrow = self.Arrow
local direction = directions[rotation]
if direction == "Left" or direction == "Right" then
Arrow:SetSize(17, 41)
else
Arrow:SetSize(41, 17)
end
Base.SetTexture(Arrow.Arrow, "arrow"..direction)
end
end
do --[[ FrameXML\HelpTip.xml ]]
function Skin.HelpTipTemplate(Frame)
Skin.GlowBoxTemplate(Frame)
Skin.UIPanelCloseButton(Frame.CloseButton)
Skin.UIPanelButtonTemplate(Frame.OkayButton)
Skin.GlowBoxArrowTemplate(Frame.Arrow)
end
end
function private.FrameXML.HelpTip()
Util.Mixin(_G.HelpTipTemplateMixin, Hook.HelpTipTemplateMixin)
Util.Mixin(_G.HelpTip.framePool, Hook.ObjectPoolMixin)
end
|
cc = cc or {}
---EventListener object
---@class EventListener : Ref
local EventListener = {}
cc.EventListener = EventListener
--------------------------------
--- Enables or disables the listener.<br>
---note Only listeners with `enabled` state will be able to receive events.<br>
---When an listener was initialized, it's enabled by default.<br>
---An event listener can receive events when it is enabled and is not paused.<br>
---paused state is always false when it is a fixed priority listener.<br>
---param enabled True if enables the listener.
---@param enabled bool
---@return EventListener
function EventListener:setEnabled(enabled) end
--------------------------------
--- Checks whether the listener is enabled.<br>
---return True if the listener is enabled.
---@return bool
function EventListener:isEnabled() end
--------------------------------
--- Clones the listener, its subclasses have to override this method.
---@return EventListener
function EventListener:clone() end
--------------------------------
--- Checks whether the listener is available.<br>
---return True if the listener is available.
---@return bool
function EventListener:checkAvailable() end
return EventListener
|
local addonName, addonScope = ...
local data = addonScope.data
local AL = addonScope.AL
local ALIL = addonScope.ALIL
local NORMAL_DIFF = addonScope.NORMAL_DIFF
local ALLIANCE_DIFF = addonScope.ALLIANCE_DIFF
local HORDE_DIFF = addonScope.HORDE_DIFF
local LOAD_DIFF = addonScope.LOAD_DIFF
local NORMAL_ITTYPE = addonScope.NORMAL_ITTYPE
local PROF_ITTYPE = addonScope.PROF_ITTYPE
local roleType_Tank = addonScope.roleType_Tank
local roleType_Heal = addonScope.roleType_Heal
local roleType_DPS = addonScope.roleType_DPS
local _FileRole = "Beast Mastery"
local _FileClass = "Hunter"
local _FilePrefix = _FileRole.." ".._FileClass
local el_Gems = { --Extra List : Gems
name = "Gems",
ExtraList = true,
TableType = PROF_ITTYPE,
[NORMAL_DIFF] = {
{ 01, "INV_MISC_DESECRATED_MAILHELM", nil, "Meta Gem" },
{ 02, 39961 }, { 17, 32765 },
{ 04, "INV_MISC_GEM_01", nil, "Primary"},
{ 05, 31085 },
{ 07, "INV_MISC_GEM_03", nil, "Meta Fit Gems"},
{ 08, 31103 },
}
}
local el_HeadShoulder = { --Extra List: Shoulder Items
name = "Head Glyph, Shoulder Inscription, Meta Fit Gems",
ExtraList = true,
TableType = NORMAL_ITTYPE,
[NORMAL_DIFF] = {
{ 01, "INV_MISC_DESECRATED_MAILHELM", nil, "Head Glyph"},
{ 02, 29192 },
{ 04, "INV_MISC_DESECRATED_MAILSHOULDER", nil, "Shoulder Inscription"},
{ 05, 23548 }, { 20, 28888 },
{ 07, "INV_MISC_GEM_03", nil, "Meta Fit Gems"},
{ 08, 38547 }, { 23, 30556 },
{ 09, 30556 }, { 24, 28362 },
}
}
local el_GearEnchants = { --Extra List: Gear Enchants
name = "Gear Enchants",
ExtraList = true,
TableType = PROF_ITTYPE,
[NORMAL_DIFF] = {
{ 01 , "INV_MISC_CAPE_20", nil, "Back" },
{ 02, 34004 },
{ 04, "INV_MISC_DESECRATED_MAILCHEST", nil, "Chest" }, { 19 , "INV_MISC_DESECRATED_MAILBRACER", nil, "Wrist" },
{ 05, 27960 }, { 20, 34002 },
{ 07 , "INV_MISC_DESECRATED_MAILPANTS", nil, "Legs" }, { 22 , "INV_MISC_DESECRATED_MAILGLOVE", nil, "Hands" },
{ 08, 35554 }, { 23, 25080 },
{ 10 , "INV_MISC_DESECRATED_MAILBOOTS", nil, "Feet" },
{ 11, 27951 },
},
}
local el_offEnchants = { --Extra List: Ring/Wep/Sheild Enchants
name = "Ring/Wep/Sheild Enchants",
ExtraList = true,
TableType = PROF_ITTYPE,
[NORMAL_DIFF] = {
{ 01, "INV_JEWELRY_RING_23", nil, "Ring Enchant" },
{ 02, 27920 },
{ 04, "INV_SWORD_65", nil, "Weapon Enchant"},
{ 05, 23800 }, { 20, 27977 },
{ 07, "INV_WEAPON_BOW_07", nil, "Guns and Bows" },
{ 08, 22793 }, { 23, 30332 },
},
}
data[ _FilePrefix ] ={
name = _FilePrefix,
ContentType = roleType_DPS,
LoadDifficulty = LOAD_DIFF,
TableType = NORMAL_ITTYPE,
gameVersion = 2,
items = {
{
name = "Absolute BIS",
[NORMAL_DIFF] = {
{ 01, 28275 }, { 16, 28828 },
{ 02, 29381 }, { 17, 30739 },
{ 03, 27801 }, { 18, 28545 },
{ 04, 24259 }, { 19, 28757 },
{ 05, 28228 }, { 20, 28791 },
{ 06, 29246 }, { 21, 28830 },
{ 07, 27474 }, { 22, 29383 },
{ 09, 28435 },
{ 11, 28772 },
{ 12, 18714 },
}
},
{ --Head Slot
name = "Head",
[NORMAL_DIFF] = {
{1,28275, nil, nil, "Best" },
{2,29081, nil, nil, "Optional" },
{3,31109, nil, nil, "Optional" },
{4,31106, nil, nil, "Optional" },
{5,31281, nil, nil, "Optional" },
{6,27414, nil, nil, "Optional" },
}
},
{ --Shoulders
name = "Shoulders",
[NORMAL_DIFF] = {
{1,27801, nil, nil, "Best" },
{2,25790, nil, nil, "Optional", [ATLASLOOT_IT_ALLIANCE] = true, [ATLASLOOT_IT_HORDE] = false },
{3,27797, nil, nil, "Optional" },
{4,27434, nil, nil, "Optional" },
},
},
{ --Cloak
name = "Cloak",
[NORMAL_DIFF] = {
{1,24259, nil, nil, "Best" },
{2,29382, nil, nil, "Optional" },
{3,28777, nil, nil, "Optional" },
{4,28672, nil, nil, "Optional" },
{5,27878, nil, nil, "Optional" },
{6,27892, nil, nil, "Optional" },
},
},
{ --Chest
name = "Chest",
[NORMAL_DIFF] = {
{1,28228, nil, nil, "Best" },
{2,29525, nil, nil, "Best" },
{3,29515, nil, nil, "Optional" },
{4,30933, nil, nil, "Optional" },
},
},
{ --Wrist
name = "Wrist",
[NORMAL_DIFF] = {
{1,29246, nil, nil, "Best" },
{2,29527, nil, nil, "Best" },
{3,25697, nil, nil, "Optional" },
{4,29517, nil, nil, "Optional" },
},
},
{ --Gloves
name = "Gloves",
[NORMAL_DIFF] = {
{1,27474, nil, nil, "Best" },
{2,28506, nil, nil, "Optional" },
{3,28827, nil, nil, "Optional" },
{4,25685, nil, nil, "Optional" },
},
},
{ --Belt
name = "Belt",
[NORMAL_DIFF] = {
{1,28828, nil, nil, "Best" },
{2,28750, nil, nil, "Optional" },
{3,29247, nil, nil, "Optional" },
{4,29526, nil, nil, "Optional" },
{5,27760, nil, nil, "Optional" },
{6,29516, nil, nil, "Optional" },
{7,28656, nil, nil, "Optional" },
},
},
{ --Legs
name = "Legs",
[NORMAL_DIFF] = {
{1,30739, nil, nil, "Best" },
{2,28741, nil, nil, "Optional" },
{3,30538, nil, nil, "Optional" },
{4,27874, nil, nil, "Optional" },
{5,27837, nil, nil, "Optional" },
},
},
{ --Boots
name = "Boots",
[NORMAL_DIFF] = {
{1,28545, nil, nil, "Best" },
{2,25686, nil, nil, "Optional" },
{3,28746, nil, nil, "Optional" },
{4,28669, nil, nil, "Optional" },
{5,29248, nil, nil, "Optional" },
},
},
{ --Neck
name = "Neck",
[NORMAL_DIFF] = {
{1,29381, nil, nil, "Best" },
{2,28509, nil, nil, "Optional" },
{3,28674, nil, nil, "Optional" },
{4,19377, nil, nil, "Optional" },
{5,28343, nil, nil, "Optional" },
{6,25562, nil, nil, "Optional" },
},
},
{ --Rings
name = "Rings",
[NORMAL_DIFF] = {
{1,28791, nil, nil, "Best" },
{2,28757, nil, nil, "Best" },
{3,28649, nil, nil, "Best" },
{4,31920, nil, nil, "Optional" },
{5,30860, nil, nil, "Optional" },
{6,31077, nil, nil, "Optional" },
{7,23038, nil, nil, "Optional" },
{8,27925, nil, nil, "Optional" },
{9,30973, nil, nil, "Optional" },
},
},
{ --Trinkets
name = "Trinkets",
[NORMAL_DIFF] = {
{1,28830, nil, nil, "Best" },
{2,29383, nil, nil, "Best" },
{3,28288, nil, nil, "Optional" },
{4,28034, nil, nil, "Optional" },
{5,21670, nil, nil, "Optional" },
{6,28041, nil, nil, "Optional" },
},
},
{ --Main Hand
name = "Main Hand",
[NORMAL_DIFF] = {
{1,27846, nil, nil, "Best" },
{2,29121, nil, nil, "Optional" },
{3,28524, nil, nil, "Optional" },
{4,28584, nil, nil, "Optional" },
{5,28263, nil, nil, "Optional" },
{6,21673, nil, nil, "Optional" },
{7,30277, nil, nil, "Optional" },
},
},
{ --Offhand
name = "Offhand",
[NORMAL_DIFF] = {
{1,28572, nil, nil, "Best" },
{2,28315, nil, nil, "Optional" },
{3,29372, nil, nil, "Optional" },
{4,29121, nil, nil, "Optional" },
{5,23242, nil, nil, "Optional" },
},
},
{ --Two-Handed
name = "Two-Handed",
[NORMAL_DIFF] = {
{1,28435, nil, nil, "Best" },
{2,28587, nil, nil, "Optional" },
{3,27903, nil, nil, "Optional" },
{4,29356, nil, nil, "Optional" },
{5,23039, nil, nil, "Optional" },
{6,29329, nil, nil, "Optional" },
},
},
{ --Ranged Weapon
name = "Ranged Weapon",
[NORMAL_DIFF] = {
{1,28772, nil, nil, "Best" },
{2,30724, nil, nil, "Best" },
{3,28581, nil, nil, "Optional" },
{4,29351, nil, nil, "Optional" },
{5,31323, nil, nil, "Optional" },
{6, nil, nil, nil, "Optional", [ATLASLOOT_IT_HORDE] = 29152, [ATLASLOOT_IT_ALLIANCE] = 29151 },
{7,28504, nil, nil, "Optional" },
{8,22812, nil, nil, "Optional" },
{09,31303, nil, nil, "Optional" },
},
},
{ --Quivers/Arros, Pouches/Ammo
name = "Quivers/Arros, Pouches/Ammo",
[NORMAL_DIFF] = {
{ 01, "INV_MISC_QUIVER_09", nil, "Quivers" }, { 16, "INV_AMMO_ARROW_02", nil, "Arrows" },
{ 02, 18714 }, { 17, 31949 },
{ 03, [ATLASLOOT_IT_HORDE] = 29143, [ATLASLOOT_IT_ALLIANCE] = 29144 }, { 18, 30611 },
{ 04, 19319 }, { 19, 28056 },
{ 06, "INV_MISC_BAG_09_RED", nil, "Ammo Pouches" }, { 21, "INV_AMMO_BULLET_02", nil, "Bullets" },
{ 07, 29118 }, { 22, [ATLASLOOT_IT_HORDE] = 32882, [ATLASLOOT_IT_ALLIANCE] = 32883 },
{ 08, 19320 }, { 23, 30612 },
{ 24, 28061 },
},
},
el_Gems,
el_HeadShoulder,
el_GearEnchants,
el_offEnchants,
},
}
|
-----------------------------------------------------
ITEM.name = "Chartogne - Taillet 1902"
ITEM.desc = "Bottle of Chartogne - Taillet Champagne, 1902."
ITEM.category = "Alcohols"
ITEM.model = "models/foodnhouseholditems/champagne2.mdl"
ITEM.hunger = 10
ITEM.thirst = 40
ITEM.empty = false
ITEM.permit = "consumables"
ITEM.price = 40
ITEM.uniqueID = "moderate champagne"
|
local function find_digest_in_process_set(digest, threshold)
local process_cursor = 0
local job_cursor = 0
local pattern = "*" .. digest .. "*"
local found = false
log_debug("Searching in process list",
"for digest:", digest,
"cursor:", process_cursor)
repeat
local process_paginator = redis.call("SSCAN", "processes", process_cursor, "MATCH", "*")
local next_process_cursor = process_paginator[1]
local processes = process_paginator[2]
log_debug("Found number of processes:", #processes, "next cursor:", next_process_cursor)
for _, process in ipairs(processes) do
local workers_key = process .. ":workers"
log_debug("searching in process set:", process,
"for digest:", digest,
"cursor:", process_cursor)
local jobs = redis.call("HGETALL", workers_key)
if #jobs == 0 then
log_debug("No entries in:", workers_key)
else
for i = 1, #jobs, 2 do
local jobstr = jobs[i +1]
if string.find(jobstr, digest) then
log_debug("Found digest", digest, "in:", workers_key)
found = true
break
end
local job = cjson.decode(jobstr)
if job.payload.created_at > threshold then
found = true
break
end
end
end
if found == true then
break
end
end
process_cursor = next_process_cursor
until found == true or process_cursor == "0"
return found
end
|
-- Server Objects
includeFile("custom_content/tangible/deed/player_house_deed/musty_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/jedi_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/vipbunker_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/atat_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/bespin_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/commando_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/emperors_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/hangar_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/jabbas_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/ns_hut_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/rebel_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/relaxation_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/sith_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/sandcrawler_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/sm_hut_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/tree_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/vehicle_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/yoda_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/yt1300_house_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/gen_large_win_s01_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/gen_large_win_s02_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/gen_medium_win_s01_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/gen_medium_win_s02_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/gen_small_win_s01_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/gen_small_win_s02_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/nab_small_win_s01_deed.lua")
includeFile("custom_content/tangible/deed/player_house_deed/tat_small_win_s01_deed.lua")
|
local export = {}
function export.new()
local api = {}
local log = require('log')
local checks = require('checks')
local netbox = require('net.box')
local query = require('model.query').model()
-----------------
-- API methods --
-----------------
function api.create_database()
local query_space = box.schema.space.create(query.SPACE_NAME, {
if_not_exists = true
})
query_space:format({
{'id', 'string'},
{'title', 'string'},
{'host', 'string'},
{'port', 'unsigned'},
{'type', 'string'},
{'user', 'string', is_nullable = true},
{'password', 'string', is_nullable = true},
{'query', 'string'},
{'updated_ts', 'unsigned'},
{'parent_id', 'string', is_nullable = true},
{'flags', 'unsigned'},
{'args', 'array'},
})
query_space:create_index(query.PRIMARY_INDEX, {
type = 'TREE',
unique = true,
parts = {query.ID, 'string'},
if_not_exists = true
})
end
function api.query(opts)
checks({
host = 'string',
port = 'number',
user = '?string',
password = '?string',
type = 'string',
query = 'string',
args = '?table',
})
local connection = netbox.connect(opts.host, opts.port, {user=opts.user, password=opts.password})
if connection.error then
return false, connection.error
end
log.info('Connection OK')
local ret = {}
if opts.type == 'Call' then
log.info('Making call()')
ret = connection:call(opts.query, opts.args or {})
else
log.info('Making eval()')
ret = connection:eval(opts.query)
end
connection:close()
if type(ret) ~= 'table' then
ret = { ret }
end
return true, ret
end
function api.save_query(opts)
checks({
id = 'string',
title = '?string',
host = 'string',
port = 'number',
user = '?string',
password = '?string',
type = 'string',
query = 'string',
parent_id = '?string',
flags = '?number',
args = '?table',
})
query.upsert({
[query.ID] = opts.id,
[query.TITLE] = opts.title,
[query.HOST] = opts.host,
[query.PORT] = opts.port,
[query.USER] = opts.user,
[query.PASSWORD] = opts.password,
[query.TYPE] = opts.type,
[query.QUERY] = opts.query,
[query.PARENT_ID] = opts.parent_id,
[query.FLAGS] = opts.flags,
[query.ARGS] = opts.args,
})
end
function api.get_queries()
local data = query.get()
local result = {}
for k,v in pairs(data) do
result[k] = query.serialize(v)
end
return result
end
function api.delete_query(id)
query.delete(id)
end
return api
end
return export
|
data.raw["assembling-machine"]["centrifuge"].fast_replaceable_group = "centrifuge"
data.raw["boiler"]["heat-exchanger"].fast_replaceable_group = "heat-exchanger"
data.raw["reactor"]["nuclear-reactor"].fast_replaceable_group = "nuclear-reactor"
|
-- Reload recipes and technologies
for _, force in pairs(game.forces) do
force.reset_recipes()
force.reset_technologies()
-- Generate technology and recipe tables
local tech = force.technologies
local recipes = force.recipes
-- Unlock researched recipes
if tech["atomic-bomb"].researched then
recipes["atomic-bomb-from-Pu-239"].enabled = true
end
if tech["kovarex-enrichment-process"].researched then
recipes["nuclear-fuel-from-Pu-239"].enabled = true
end
if tech["nuclear-fuel-reprocessing"].researched then
recipes["plutonium-purification-process"].enabled = true
recipes["mox-fuel-cell-from-RGPu-239"].enabled = true
recipes["mox-fuel-cell-from-Pu-239"].enabled = true
recipes["mox-fuel-reprocessing"].enabled = true
end
if tech["breeder-reactor"].researched then
recipes["breeder-fuel-cell-from-Pu-239"].enabled = true
end
force.print({"message.head", {"message.tech-migration", "1.1.0"}}, {r=1,g=0.75,b=0,a=1})
end
|
local list = {"proton", "neutron", "electron", "anti-electron", "anti-proton","muon", "up-quark", "down-quark", "photon", "strange-quark", "electron-neutrino", "muon-neutrino", "tauon", "charm-quark", "bottom-quark", "tau-neutrino", "w-boson", "z-boson", "top-quark", "gluon", "higgs-boson"}
for k,v in pairs(list) do
data:extend({
{
type = "item",
name = v,
localised_name = {"item-name.possible_collision_case",{"item-name."..v}},
localised_description = {"item-description.possible_collision_case"},
icons = {
{
icon = "__fundamental_physics__/graphics/item/"..v..".png",
},
},
icon_size = 32,
order = string.char(96+k),
flags = {"goes-to-quickbar"},
subgroup = "fundamental-physics-standard-model",
stack_size = 100,
},
})
end
data:extend({
{
type = "recipe",
name = "particle-collision-10mev",
category = "particle-accelerator",
enabled = false,
energy_required = 10,
subgroup = "fundamental-physics-standard-model",
order = "a",
icons = {
{
icon = "__fundamental_physics__/graphics/item/accelerator.png",
},
{
icon = "__fundamental_physics__/graphics/item/"..list[1]..".png",
scale = 0.5,
shift = {-10, 12}
},
{
icon = "__fundamental_physics__/graphics/item/"..list[3]..".png",
scale = 0.5,
shift = {10, 12}
},
},
icon_size = 32,
ingredients = {},
results = {
{list[1], 8},
{list[2], 6},
{list[3], 8},
{list[4], 2},
{list[5], 1},
},
},
{
type = "recipe",
name = "particle-collision-100mev",
category = "particle-accelerator",
enabled = false,
energy_required = 15,
subgroup = "fundamental-physics-standard-model",
order = "b",
icons = {
{
icon = "__fundamental_physics__/graphics/item/accelerator.png",
},
{
icon = "__fundamental_physics__/graphics/item/"..list[6]..".png",
scale = 0.5,
shift = {-10, 12}
},
{
icon = "__fundamental_physics__/graphics/item/"..list[7]..".png",
scale = 0.5,
shift = {10, 12}
},
},
icon_size = 32,
ingredients = {},
results = {
{list[6], 6},
{list[7], 4},
{list[8], 2},
{list[9], 1},
},
},
{
type = "recipe",
name = "particle-collision-1gev",
category = "particle-accelerator-gev",
enabled = false,
energy_required = 20,
subgroup = "fundamental-physics-standard-model",
order = "c",
icons = {
{
icon = "__fundamental_physics__/graphics/item/accelerator.png",
},
{
icon = "__fundamental_physics__/graphics/item/"..list[10]..".png",
scale = 0.5,
shift = {-10, 12}
},
{
icon = "__fundamental_physics__/graphics/item/"..list[11]..".png",
scale = 0.5,
shift = {10, 12}
},
},
icon_size = 32,
ingredients = {},
results = {
{list[10], 5},
{list[11], 4},
{list[12], 2},
{list[13], 1},
},
},
{
type = "recipe",
name = "particle-collision-10gev",
category = "particle-accelerator-gev",
enabled = false,
energy_required = 25,
subgroup = "fundamental-physics-standard-model",
order = "d",
icons = {
{
icon = "__fundamental_physics__/graphics/item/accelerator.png",
},
{
icon = "__fundamental_physics__/graphics/item/"..list[15]..".png",
scale = 0.5,
shift = {-10, 12}
},
{
icon = "__fundamental_physics__/graphics/item/"..list[16]..".png",
scale = 0.5,
shift = {10, 12}
},
},
icon_size = 32,
ingredients = {},
results = {
{list[14], 6},
{list[15], 4},
{list[16], 1},
},
},
{
type = "recipe",
name = "particle-collision-100gev",
category = "particle-accelerator-gev",
enabled = false,
energy_required = 30,
subgroup = "fundamental-physics-standard-model",
order = "e",
icons = {
{
icon = "__fundamental_physics__/graphics/item/accelerator.png",
},
{
icon = "__fundamental_physics__/graphics/item/"..list[18]..".png",
scale = 0.5,
shift = {-10, 12}
},
{
icon = "__fundamental_physics__/graphics/item/"..list[19]..".png",
scale = 0.5,
shift = {10, 12}
},
},
icon_size = 32,
ingredients = {},
results = {
{list[17], 6},
{list[18], 4},
{list[19], 1},
{list[20], 1},
},
},
{
type = "recipe",
name = "particle-collision-250gev",
category = "particle-accelerator-gev",
enabled = false,
energy_required = 40,
subgroup = "fundamental-physics-standard-model",
order = "f",
icons = {
{
icon = "__fundamental_physics__/graphics/item/accelerator.png",
},
{
icon = "__fundamental_physics__/graphics/item/"..list[21]..".png",
scale = 0.5,
shift = {-10, 12}
},
{
icon = "__fundamental_physics__/graphics/item/"..list[20]..".png",
scale = 0.5,
shift = {10, 12}
},
},
icon_size = 32,
ingredients = {},
results = {
{list[20], 2},
{list[21], 1},
},
},
})
mylib.add_angel_num_icon(data.raw.recipe["particle-collision-10mev"],1)
mylib.add_angel_num_icon(data.raw.recipe["particle-collision-100mev"],2)
mylib.add_angel_num_icon(data.raw.recipe["particle-collision-1gev"],3)
mylib.add_angel_num_icon(data.raw.recipe["particle-collision-10gev"],4)
mylib.add_angel_num_icon(data.raw.recipe["particle-collision-100gev"],5)
mylib.add_angel_num_icon(data.raw.recipe["particle-collision-250gev"],6)
-- generate collision case -> report recipes
local amount_func = mylib.cal_amount_func(1,10)
for k,v in pairs(list) do
data:extend({
{
type = "recipe",
name = "standard-model-"..v,
localised_name = {"recipe-name.standard-model-analysis",{"item-name."..v}},
category = "fundamental-physics-standard-model",
enabled = true,
hidden = true,
energy_required = 100,
subgroup = "fundamental-physics-standard-model",
order = "a",
icon_size = 32,
icons = {
{
icon = "__fundamental_physics__/graphics/item/research-report-"..math.floor(k/#list*6+1)..".png",
},
},
ingredients =
{
{v, 50}
},
results = {
{"research-report-2", mylib.cal_amount(k, #list, amount_func, 0.5, 0.5)},
{"research-report-3", mylib.cal_amount(k, #list, amount_func, 0.5, 0.3)},
{"research-report-4", mylib.cal_amount(k, #list, amount_func, 0.5, 0.2)},
{"research-report-5", mylib.cal_amount(k, #list, amount_func, 0.5, 0.1)},
{"research-report-6", mylib.cal_amount(k, #list, amount_func, 0.5, 0)},
},
}
})
mylib.add_productivity_limitation("standard-model-"..v)
end
|
local path = "?;?.lua;../?;../?.lua"
package.path = path
|
local Mod = GameMain:GetMod("CanVox.NewCharRandomizer")
Mod.InputFilter = Mod.InputFilter or {}
local filter = {
Name = "Basic",
DisplayName = "Basic",
Sort = 4000,
DefaultPriority = 6000,
Age = {
Min = 23,
Max = 40,
},
Stats = {
Total = {
Min = 21,
MainMin = 23,
},
Luck = {
Min = 4,
}
},
YaoGuai = {
MaxYaoGuai = 1,
NotMain = true,
MinTribulationDays = 190,
},
ForceBackstory = {100006}, -- +Luck Reincarnated
SkillLevels = {
Qi = {
Min = 6,
},
SocialContact = {
MainMin = 8,
},
},
SkillGroups = {
CultivatorSkills = {
Hits = {
Min = 1,
MainMin = 3,
},
Default = {
CutoffLevel = {
Min = 10,
},
CrowdCost = 1,
InspValue = 0,
},
Qi = {
CrowdCost = 0,
},
SocialContact = {},
Medicine = {
Prerequisites = {
DanQi = {
Min = 8,
},
},
},
Manual = {
Prerequisites = {
DanQi = {
Min = 8,
},
},
},
DouFa = {
CutoffLevel = {
Min = 4,
MainMin = 6,
},
CrowdCost = 0.3,
},
},
WorkSkills = {
Hits = {
Min = 3,
MainMin = 1,
},
Default = {
CutoffEvalCurrent = {
Min = 25,
},
CrowdCost = 1,
InspValue = 0.5,
},
Fight = {
CrowdCost = 1.5,
},
Medicine = {
CrowdCost = 1.5,
},
Cooking = {
CrowdCost = 1.5,
},
Building = {
CrowdCost = 0.5,
},
Farming = {
CrowdCost = 0.5,
},
Mining = {},
Art = {
Prerequisites = {
Manual = {
Min = 25,
},
},
CrowdCost = 1.5,
},
Manual = {
InspValue = 1,
},
},
},
}
table.insert(Mod.InputFilter, filter)
|
--[[
MIT License
Copyright (c) 2019 Michael Wiesendanger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]--
local mod = pvpw
local me = {}
mod.profilesMenu = me
me.tag = "ProfilesMenu"
-- the currently selected profile in the profile list
local currentSelectedProfile = nil
--[[
Popup dialog for choosing a profile name
]]--
StaticPopupDialogs["PVPW_CHOOSE_PROFILE_NAME"] = {
text = pvpw.L["choose_profile_name_dialog_text"],
button1 = pvpw.L["choose_profile_name_accept_button"],
button2 = pvpw.L["choose_profile_name_cancel_button"],
OnShow = function (self, data)
local editBox = me.FindDialogElementByName(
this:GetChildren(), "StaticPopup3EditBox")
local button1 = me.FindDialogElementByName(
this:GetChildren(), "StaticPopup3Button1")
if editBox ~= nil and button1 ~= nil then
button1:Disable()
editBox:SetText("") -- reset text to empty
end
end,
OnAccept = function()
-- retrieve text input from editfield
for _, child in ipairs({this:GetParent():GetChildren()}) do
if string.find(child:GetName(), "StaticPopup3EditBox") then
me.SaveCurrentProfile(child:GetText())
return
end
end
end,
EditBoxOnTextChanged = function ()
local editBox = me.FindDialogElementByName(
this:GetParent():GetChildren(), "StaticPopup3EditBox")
local button1 = me.FindDialogElementByName(
this:GetParent():GetChildren(), "StaticPopup3Button1")
if editBox ~= nil and button1 ~= nil then
if string.len(editBox:GetText()) > 0 then
button1:Enable()
else
button1:Disable()
end
end
end,
timeout = 0,
whileDead = true,
preferredIndex = 3,
hasEditBox = true,
maxLetters = mod.profile.GetMaxProfileNameLength()
}
--[[
Popup dialog warning before loading a profile
]]--
StaticPopupDialogs["PVPW_CHANGE_PROFILE_WARNING"] = {
text = pvpw.L["confirm_override_profile_dialog_text"],
button1 = pvpw.L["confirm_override_profile_yes_button"],
button2 = pvpw.L["confirm_override_profile_no_button"],
OnAccept = function(default)
if default then
mod.profile.ActivateDefaultProfile()
else
mod.profile.ActivateProfile(currentSelectedProfile)
me.ProfileListUpdate() -- update visual list
end
end,
timeout = 0,
whileDead = true,
preferredIndex = 4
}
function me.InitProfilesMenu()
mod.logger.LogDebug(me.tag, "Loaded ProfilesMenu")
me.SetupUI()
end
function me.SetupUI()
-- create save configuration button
local saveConfigurationButton = CreateFrame(
"Button",
PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_SAVE_CURRENT_CONFIGURATION_BUTTON,
UIParent,
"UIPanelButtonTemplate"
)
saveConfigurationButton:SetPoint(
"BOTTOMLEFT",
PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_LIST_FRAME,
"BOTTOMLEFT",
0, -35
)
saveConfigurationButton:SetHeight(32)
saveConfigurationButton:SetText(pvpw.L["save_current_profile_button"])
saveConfigurationButton:SetScript('OnClick', me.SaveCurrentProfileButtonOnClick)
saveConfigurationButton:SetParent(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_FRAME)
mod.guiHelper.ResizeButtonToText(saveConfigurationButton)
saveConfigurationButton:Show()
-- create delete profile button
local deleteProfileButton = CreateFrame(
"Button",
PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_DELETE_SELECTED_PROFILE_BUTTON,
UIParent,
"UIPanelButtonTemplate"
)
deleteProfileButton:SetPoint(
"LEFT",
PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_SAVE_CURRENT_CONFIGURATION_BUTTON,
"RIGHT",
0, 0
)
deleteProfileButton:SetHeight(32)
deleteProfileButton:SetText(pvpw.L["delete_selected_profile_button"])
deleteProfileButton:SetScript("OnClick", me.DeleteSelectedProfileButtonOnClick)
deleteProfileButton:SetParent(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_FRAME)
mod.guiHelper.ResizeButtonToText(deleteProfileButton)
deleteProfileButton:Show()
-- create load profile button
local loadProfileButton = CreateFrame(
"Button",
PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_LOAD_SELECTED_PROFILE_BUTTON,
UIParent,
"UIPanelButtonTemplate"
)
loadProfileButton:SetPoint(
"LEFT",
PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_DELETE_SELECTED_PROFILE_BUTTON,
"RIGHT",
0, 0
)
loadProfileButton:SetHeight(32)
loadProfileButton:SetText(pvpw.L["set_active_profile_button"])
loadProfileButton:SetScript("OnClick", me.LoadSelectedProfileButtonOnClick)
loadProfileButton:SetParent(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_FRAME)
mod.guiHelper.ResizeButtonToText(loadProfileButton)
loadProfileButton:Show()
-- create load profile button
local loadDefaultProfileButton = CreateFrame(
"Button",
PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_LOAD_DEFAULT_PROFILE_BUTTON,
UIParent,
"UIPanelButtonTemplate"
)
loadDefaultProfileButton:SetPoint(
"LEFT",
PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_LOAD_SELECTED_PROFILE_BUTTON,
"RIGHT",
0, 0
)
loadDefaultProfileButton:SetHeight(32)
loadDefaultProfileButton:SetText(pvpw.L["load_default_profile_button"])
loadDefaultProfileButton:SetScript("OnClick", me.LoadDefaultProfileButtonOnClick)
loadDefaultProfileButton:SetParent(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILES_FRAME)
mod.guiHelper.ResizeButtonToText(loadDefaultProfileButton)
loadDefaultProfileButton:Show()
end
--[[
Helper function to find elements inside a static popup dialog
@param {table} context
@param {string} elementName
@return {table | nil}
the element that was found or nil if none could be found
]]--
function me.FindDialogElementByName(context, elementName)
for _, child in ipairs({context:GetParent():GetChildren()}) do
if string.find(child:GetName(), elementName) then
return child
end
end
return nil
end
--[[
FauxScrollFrame callback for profileslist
]]--
function me.ProfileListUpdate()
local profiles = PVPWarnProfiles
local offset = FauxScrollFrame_GetOffset(PVPW_ProfileListScrollFrame)
FauxScrollFrame_Update(PVPW_ProfileListScrollFrame, profiles and table.getn(profiles) or 0, 5, 24)
me.ClearCellList(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILE_LIST_CELL, 5)
for i = 1, 5 do
local profileCell = getglobal(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILE_LIST_CELL .. i)
local profileName = getglobal(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILE_LIST_CELL .. i .. "_ProfileName")
local profileStatus = getglobal(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILE_LIST_CELL .. i .. "_ProfileStatus")
local idx = offset + i
if idx <= table.getn(profiles) then
profileName:SetText(profiles[idx].name)
profileCell:Show()
else
profileCell:Hide()
end
end
end
--[[
Cell onClick callback for profileslist cells
]]--
function me.ProfileListCellOnClick()
local index = FauxScrollFrame_GetOffset(PVPW_ProfileListScrollFrame) + this:GetID()
currentSelectedProfile = index
-- clear all current highlighting
me.ClearCellList(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILE_LIST_CELL, 5)
this.selectedItem = true
getglobal(this:GetName() .. "Highlight"):Show()
end
--[[
Button callback to save the current user configuration. This will invoke a popup
dialog for the user to choose a name for the profile.
]]--
function me.SaveCurrentProfileButtonOnClick()
StaticPopup_Show("PVPW_CHOOSE_PROFILE_NAME")
end
--[[
Given the player has a profile selected in the list this will delete the profile.
The users current configuration however will not be touched by this.
]]--
function me.DeleteSelectedProfileButtonOnClick()
if currentSelectedProfile == nil then
mod.logger.PrintUserError(pvpw.L["user_message_select_profile_before_delete"])
else
mod.profile.DeleteProfile(currentSelectedProfile)
currentSelectedProfile = nil
me.ClearCellList(PVPW_CONSTANTS.ELEMENT_PVPW_PROFILE_LIST_CELL, 5)
me.ProfileListUpdate() -- update visual list
end
end
--[[
Given the player has a profile selected in the list this will activate the profile.
The users current configuration will be overriden
]]--
function me.LoadSelectedProfileButtonOnClick()
if currentSelectedProfile == nil then
mod.logger.PrintUserError(pvpw.L["user_message_select_profile_before_load"])
else
StaticPopup_Show("PVPW_CHANGE_PROFILE_WARNING")
end
end
function me.LoadDefaultProfileButtonOnClick()
local dialog = StaticPopup_Show("PVPW_CHANGE_PROFILE_WARNING")
if dialog then
dialog.data = true
end
end
--[[
Save current player configuration as a profile
@param {string} profileName
]]--
function me.SaveCurrentProfile(profileName)
mod.profile.AddNewProfile(
profileName,
PVPWarnOptions.spellList,
PVPWarnOptions.spellSelfAvoidList,
PVPWarnOptions.spellEnemyAvoidList
)
me.ProfileListUpdate() -- update visual list
end
--[[
@param {string} baseName
name of the button to clear
@param {number} count
amount of buttons to clear
@param {boolean} visual
whether to clear only visual or also logically
]]--
function me.ClearCellList(baseName, count, visual)
for i = 1, count do
if not visual then
getglobal(baseName .. i).selectedItem = false
end
getglobal(baseName .. i .. "Highlight"):Hide()
end
end
|
function moveCamKeys()
local keyDown = love.keyboard.isDown
local keys = {
{"a", 1, 0.1}; {"d", 1, -0.1},
{"q", 2, 0.1}; {"e", 2, -0.1},
{"s", 3, 0.1}; {"w", 3, -0.1},
}
for _,k in ipairs(keys) do
if keyDown(k[1]) then
local raw_offset = {0, 0, 0}
raw_offset[k[2]] = k[3]
local offset = applyInverseCameraRotation(raw_offset, camRotation)
camOffset = vectorAddition(camOffset, offset)
end
end
end
function turnCamKeys()
local keyDown = love.keyboard.isDown
local keys = {
--{"k", 1, 5}; {"i", 1, -5},
{"j", 2, 5}; {"l", 2, -5},
--{"u", 3, 5}; {"o", 3, -5},
}
for _,k in ipairs(keys) do
if keyDown(k[1]) then
camRotation[k[2]] = camRotation[k[2]] + k[3]
end
end
end
function miscKeys(key)
if key == "r" then
camOffset = {0, 0, 0}
camRotation = {0, 0, 0}
elseif key == "n" then
showStarLabels = not showStarLabels
end
end
|
local cjson = require "cjson"
local http = require "resty.http"
local balancer = require "ngx.balancer"
local _M = {}
_M._VERSION="0.1"
function indexOf(array, value)
for i, v in ipairs(array) do
if v == value then
return i
end
end
return nil
end
function _M:refresh(tag)
local cli = http.new()
local res, err = cli:request_uri("http://127.0.0.1:8500/v1/catalog/services")
if not res then
ngx.log(ngx.ERR, "upstreams refresh failed: ", err)
return
end
local data = cjson.decode(res.body)
for key, value in pairs(data) do
if not tag or indexOf(value, tag) then
self.update(key)
end
end
end
function _M.update(name)
local cli = http.new()
local res, err = cli:request_uri("http://127.0.0.1:8500/v1/health/service/"..name.."?passing=1")
if not res then
ngx.log(ngx.ERR, "upstreams update failed: ", err)
return
end
local data = cjson.decode(res.body)
local upstreams = {}
for i, v in ipairs(data) do
upstreams[i] = {ip=v.Service.Address, port=v.Service.Port}
end
ngx.shared.lreu_upstream:set(name, cjson.encode(upstreams))
if upstreams then
ngx.log(ngx.INFO, "upstreams update: ", table.getn(upstreams))
end
end
function _M.rr(name)
if not name then
local m = ngx.re.match(ngx.var.host, (ngx.re.sub(ngx.var.server_name, "\\*", "([a-z0-9]+)")))
if not m then
return false
end
name = m[1]
end
local data = ngx.shared.lreu_upstream:get(name);
if not data then
return false
end
local upstreams = cjson.decode(data);
local length = table.getn(upstreams);
local pick = upstreams[1 == length and 1 or math.random(1, length)];
if pick then
balancer.set_current_peer(pick.ip, pick.port);
return true
end
return false
end
return _M
|
local itemTypes = {}
local npc_coins = { 10, 33, 88, 103, 138, 152, 251, 252, 253, 258, 274 }
local npc_radishes = { 9, 184, 185, 249 }
local npc_fire_plants = { 14, 182, 183 }
local npc_ice_plants = { 264, 277 }
local npc_lives = { 90, 186, 187 }
local npc_shells = { 5, 7, 24, 73, 113, 114, 115, 116, 172, 174 } --Scrabbed: 195
local npc_blueGoopas = { 55, 119 }
local block_bricks = { 4, 188, 60, 90 }
function itemTypes.tableContainsValue(tbl, val)
for i = 1, #tbl do
if(tbl[i] == val)then
return true
end
end
return false
end
function itemTypes.isNpcCoin(npcID)
return itemTypes.tableContainsValue(npc_coins, npcID)
end
function itemTypes.isNpcRadish(npcID)
return itemTypes.tableContainsValue(npc_radishes, npcID)
end
function itemTypes.isNpcFirePlant(npcID)
return itemTypes.tableContainsValue(npc_fire_plants, npcID)
end
function itemTypes.isNpcLife(npcID)
return itemTypes.tableContainsValue(npc_lives, npcID)
end
function itemTypes.isNpcIcePlant(npcID)
return itemTypes.tableContainsValue(npc_ice_plants, npcID)
end
function itemTypes.isBlueGoopa(npcID)
return itemTypes.tableContainsValue(npc_blueGoopas, npcID)
end
function itemTypes.isNpcShell(npcID)
return itemTypes.tableContainsValue(npc_shells, npcID)
end
function itemTypes.isBlockBrick(npcID)
return itemTypes.tableContainsValue(block_bricks, npcID)
end
return itemTypes
|
-- Format for overwriting define values:
--
-- NDefines.NDiplomacy.DEMESNE_BASE_MAX_SIZE = 2.0
NDefines.NDiplomacy.LONG_REIGN_YEARS_START = 50
NDefines.NDiplomacy.MAX_LONG_REIGN_BONUS = 20
NDefines.NDiplomacy.RETIRE_TO_MONASTERY_INTERACTION_PIETY = 100000
NDefines.NDiplomacy.RETIRE_TO_MONASTERY_INTERACTION_ENABLED = 0
NDefines.NCharacter.WRONG_GOV_FORM_TAX_MOD = 0
NDefines.NCharacter.WRONG_GOV_FORM_LEVY_MOD = 0
-- NDefines.NCharacter.PORTRAIT_MID_AGE_THRESHOLD = 30
-- NDefines.NCharacter.PORTRAIT_OLD_AGE_THRESHOLD = 9000
-- NDefines.NCharacter.AGE_OLD = 2000
-- NDefines.NCharacter.AGE_VERY_OLD = 3000
NDefines.NCharacter.NOT_SPOUSE_FERTILITY_MULT = 0.25
NDefines.NCharacter.MALE_ATTRACTION_CUTOFF = 3000
NDefines.NCharacter.FEMALE_ATTRACTION_CUTOFF = 3000
NDefines.NCharacter.MAX_CROWN_LAW_CHANGES = 10
NDefines.NMilitary.MAX_LEADERSHIP_TRAITS = 5
NDefines.NGraphics.NUMBER_OF_PROPERTIES = 19
NDefines.NAI.BASE_AI_ARMY_SIZE = 10000
NDefines.NAI.AI_ASSAULT_RATIO = 2
NDefines.NMilitary.MERCENARY_MAINTENANCE_FACTOR = 100
NDefines.NMilitary.MERCENARY_VASSAL_MAINTENANCE_FACTOR = 0.5
NDefines.NMilitary.MERCENARY_HIRE_COST_FACTOR = 1.0
NDefines.NMilitary.HOLY_ORDER_HIRE_COST_FACTOR = 1.0
NDefines.NMilitary.SPECIAL_TROOPS_GRAPHICAL_FACTOR = 500
NDefines.NMilitary.HOLDING_LEVY_SIZE_OWNER_MARTIAL_BASE = 0.800
NDefines.NMilitary.HOLDING_LEVY_SIZE_OWNER_MARTIAL_MULT = 0.02
NDefines.NMilitary.COMMAND_MODIFIER_MARTIAL_MULTIPLIER = 0.03
NDefines.NMilitary.RETINUE_FROM_REALMSIZE = 1.0
NDefines.NMilitary.RETINUE_HIRE_COST_MULTIPLIER = 3
NDefines.NMilitary.RETINUE_INCREASE_PER_TECH = 1.5
NDefines.NMilitary.RETINUE_REINFORCE_COST = 3
NDefines.NMilitary.MIN_RETINUE = 600
NDefines.NTechnology.DONT_EXECUTE_TECH_BEFORE = 767
NDefines.NTechnology.IDEAL_YEAR_LEVEL_0 = 767
NDefines.NTechnology.IDEAL_YEAR_LEVEL_8 = 2050
NDefines.NRulerDesigner.MAX_AGE = 900
NDefines.NEngine.EVENT_PROCESS_OFFSET = 20
NDefines.NEconomy.TAX_TO_LOOT_MULTIPLIER = 0.2
NDefines.NDiplomacy.DEFENSIVE_PACT_SIZE_RATIO = 1.0
NDefines.NInfamy.WAR_REALM_CHANGE_VALUE = 1.3
NDefines.NInfamy.MIN_INFAMY_PER_WAR_PROVINCE = 12
NDefines.NInfamy.MAX_INFAMY_PER_WAR_PROVINCE = 30
NDefines.NCharacter.COURT_SIZE_CHILD_PENALTY_THRESHOLD = 15
NDefines.NEngine.COURTIER_EVENT_PROCESS_OFFSET = 100
NDefines.NEngine.EVENT_PROCESS_OFFSET = 30
NDefines.NCharacter.MAX_JOINED_FACTIONS = 4
NDefines.NCharacter.NON_AGGRESSION_PACT_BLOCKS_FACTIONS = 0
NDefines.NDiplomacy.DEFENSIVE_PACT_THREAT_SIZE_START = 0.0
NDefines.NDiplomacy.EVERY_DEFENSIVE_PACT_JOIN_THREAT = 0.50
NDefines.NDiplomacy.OTHER_DEFENSIVE_PACT_JOIN_THREAT = 0.15
NDefines.NDiplomacy.SHORT_REIGN_YEARS_END = 1
NDefines.NDiplomacy.LONG_REIGN_YEARS_START = 200
NDefines.NDiplomacy.MAX_LONG_REIGN_BONUS = 0
NDefines.NDiplomacy.SHORT_REIGN_OPINION_MULT = 0
NDefines.NDiplomacy.LONG_REIGN_OPINION_MULT = 0
NDefines.NAI.COALITION_JOIN_THRESHOLD = 90
NDefines.NAI.COALITION_LEAVE_THRESHOLD = 70
NDefines.NAI.COALITION_TROOP_STRENGTH_THREAT_RATIO = 1.2
NDefines.NAI.COALITION_THREAT_MAX_DISTANCE = 250
NDefines.NAI.COALITION_SCARY_TROOP_STRENGTH_THREAT_RATIO = 2.0
NDefines.NAI.FACTION_EXPIRATION_MONTHS = 18
NDefines.NAI.FACTION_EXPIRED_MONTHS = 3
NDefines.NAI.DOW_AGGRESSION_FACTOR = 0.33
NDefines.NCharacter.MAX_JOINED_FACTIONS = 4
|
--
-- Created by IntelliJ IDEA.
-- User: damian
-- Date: 13/01/2017
-- Time: 23:54
-- To change this template use File | Settings | File Templates.
--
SectionB = {}
function SectionB:new()
o = {activeBassBlocks={}}
setmetatable(o, self)
self.__index = self
return o
end
function SectionB:HandleKick()
end
function SectionB:HandleHiHat()
end
function SectionB:HandleSnare()
--local size = kll.RandomNormal(0.6, 0.8);
--local length = 10
--local section = gEnvironment:AddTunnelSection(length, size, 32, 5)
--section:SetPosition(kll.gvec3(0,0,-1))
--section:SetAlpha(0.5)
local pos = kll.gvec3(-0.6,0,-1)
local size = kll.gvec3(0.2, 8, 0.01)
local block = gEnvironment:AddBlock(pos, size)
block:SetLightingEnabled(false)
block:SetShininess(0)
--block:SetAlpha(0.5)
local fade = FadeBehaviour:new(block, 0.0001)
gBehaviours:AddBehaviour(fade)
gLighting:InjectEnergy(1)
end
function SectionB:HandleBassNoteOn(pitch, velocity)
local height = 0.01
local depth = 0.03
local width = kll.RandomNormal(0.3, 0.33);
width = width * (1-(pitch-35)/30)
if gScenes:GetSceneIndex() == 9 then
width = width * 1.3
end
local size = kll.gvec3(height, width, depth)
size = size*4;
local startPitch = 55
local pitchYScale = -1/70
if gScenes:GetSceneIndex() == 9 then
pitchYScale = -1/40
end
local x = ((pitch-startPitch)*pitchYScale)
local z = 0
--print("p " .. pitch .. " v " .. velocity)
local block = gEnvironment:AddBlock(kll.gvec3(x,0,z), size)
--block:SetVelocity(kll.gvec3(0,0,1))
local fadeSpeed = 0.02
local fallSpeed = 4
if gScenes:GetSceneIndex() == 8 or gScenes:GetSceneIndex() == 9 then
fadeSpeed = 0.1
fallSpeed = 2
end
local fall = FallBehaviour:new(block, kll.gvec3(0,0,fallSpeed))
gBehaviours:AddBehaviour(fall)
--local rotate = AddRotationBehaviour:new(block, kll.gvec3(0, 10*kll.RandomNormal(), 0))
--gBehaviours:AddBehaviour(rotate)
local fade = FadeBehaviour:new(block, fadeSpeed)
gBehaviours:AddBehaviour(fade)
self.activeBassBlocks[pitch] = block
end
function SectionB:Enter()
end
function SectionB:Update(dt)
for index,block in pairs(self.activeBassBlocks) do
if gEnvironment:HasObject(block) then
local d = block:GetScaledDimensions()
local growSpeed = 1
if gScenes:GetSceneIndex() == 8 or gScenes:GetSceneIndex() == 9 then
growSpeed = 3
else
growSpeed = 1 * (1-d.x)
end
d.z = d.z + dt * growSpeed
block:SetScaledDimensions(d)
end
end
end
function SectionB:HandleBassNoteOff(pitch, velocity)
self.activeBassBlocks[pitch] = nil
end
function SectionB:HandleVocalNoteOn(pitch, velocity)
local scene = gScenes:GetSceneIndex()
if scene < 7 then
local x = -(((pitch - 52)/10) * 3) + 1
gBoids:SetFlockCenter(kll.gvec3(x, 0, -3), 3)
elseif scene < 9 then
local x = (((pitch - 52)/10) * 3) - 1
gBoids:SetFlockCenter(kll.gvec3(x, 0, -3), 3)
else
local x = -((((pitch - 52)/10) * 5) - 1)
gBoids:SetFlockCenter(kll.gvec3(0, x, 0), 3)
end
gBoids:SetCohesion(0, 10)
end
function SectionB:HandleVocalNoteOff(pitch, velocity)
gBoids:SetFlockCenter(kll.gvec3(0, 0, -3), 0.02)
gBoids:SetCohesion(0.2, 0)
end
|
-- Created by Elfansoer
--[[
Ability checklist (erase if done/checked):
- Scepter Upgrade
- Break behavior
- Linken/Reflect behavior
- Spell Immune/Invulnerable/Invisible behavior
- Illusion behavior
- Stolen behavior
]]
--------------------------------------------------------------------------------
modifier_generic_leashed_lua = class({})
--------------------------------------------------------------------------------
-- Classifications
function modifier_generic_leashed_lua:IsHidden()
return true
end
function modifier_generic_leashed_lua:IsDebuff()
return true
end
function modifier_generic_leashed_lua:IsStunDebuff()
return false
end
function modifier_generic_leashed_lua:IsPurgable()
if not IsServer() then return end
return self.purgable
end
function modifier_generic_leashed_lua:GetAttributes()
return MODIFIER_ATTRIBUTE_MULTIPLE
end
--------------------------------------------------------------------------------
-- Initializations
function modifier_generic_leashed_lua:OnCreated( kv )
if not IsServer() then return end
self.parent = self:GetParent()
--[[
kv data (default):
center_x/y (origin)
radius (300)
rooted (true)
purgable (true)
]]
-- load types
self.rooted = true
self.purgable = true
if kv.rooted then self.rooted = kv.rooted==1 end
if kv.purgable then self.purgable = kv.purgable==1 end
if self.rooted then self:SetStackCount(1) end
-- load values
self.radius = kv.radius or 300
if kv.center_x and kv.center_y then
self.center = Vector( kv.center_x, kv.center_y, 0 )
else
self.center = self:GetParent():GetOrigin()
end
-- consts
self.max_speed = 550
self.min_speed = 0.1
self.max_min = self.max_speed-self.min_speed
self.half_width = 50
end
function modifier_generic_leashed_lua:OnRefresh( kv )
end
function modifier_generic_leashed_lua:OnRemoved()
end
function modifier_generic_leashed_lua:OnDestroy()
if not IsServer() then return end
if self.endCallback then
self.endCallback()
end
end
--------------------------------------------------------------------------------
-- Modifier Effects
function modifier_generic_leashed_lua:DeclareFunctions()
local funcs = {
MODIFIER_PROPERTY_MOVESPEED_LIMIT,
}
return funcs
end
function modifier_generic_leashed_lua:GetModifierMoveSpeed_Limit( params )
if not IsServer() then return end
-- get data
local parent_vector = self.parent:GetOrigin()-self.center
local parent_direction = parent_vector:Normalized()
local actual_distance = parent_vector:Length2D()
local wall_distance = self.radius-actual_distance
-- if outside of leash, destroy
if wall_distance<(-self.half_width) then
self:Destroy()
return 0
end
-- calculate facing angle
local parent_angle = VectorToAngles(parent_direction).y
local unit_angle = self:GetParent():GetAnglesAsVector().y
local wall_angle = math.abs( AngleDiff( parent_angle, unit_angle ) )
-- calculate movespeed limit
local limit = 0
if wall_angle<=90 then
-- facing outside
if wall_distance<0 then
-- at max radius
limit = self.min_speed
-- self:RemoveMotions()
else
-- about to max radius, interpolate
limit = (wall_distance/self.half_width)*self.max_min + self.min_speed
end
end
return limit
end
--------------------------------------------------------------------------------
-- Status Effects
function modifier_generic_leashed_lua:CheckState()
local state = {
[MODIFIER_STATE_TETHERED] = self:GetStackCount()==1,
}
return state
end
--------------------------------------------------------------------------------
-- Helper
function modifier_generic_leashed_lua:SetEndCallback( func )
self.endCallback = func
end
|
if battle == 2 then
character_2:UseSkill(1)
end
|
local xxtea = require 'xxtea'
local function randstr(n)
local t = {}
for i = 1, math.random(0, n) do
t[i] = string.char(math.random(0, 255))
end
return table.concat(t)
end
math.randomseed(os.time())
for i = 1, 1000 do
local str = randstr(10000)
local key = randstr(16)
assert(xxtea.decrypt(xxtea.encrypt(str, key), key) == str)
end
assert(not pcall(xxtea.decrypt, 'abc'))
|
--[[
Name: Sink-2.0
Revision: $Rev: 71 $
Author(s): Rabbit (rabbit.magtheridon@gmail.com), Antiarc (cheal@gmail.com)
Website: http://rabbit.nihilum.eu
Documentation: http://wiki.wowace.com/index.php/Sink-2.0
SVN: http://svn.wowace.com/wowace/trunk/SinkLib/Sink-2.0
Description: Library that handles chat output.
Dependencies: LibStub, SharedMedia-3.0 (optional)
License: GPL v2 or later.
]]
--[[
Copyright (C) 2008 Rabbit
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
]]
-----------------------------------------------------------------------
-- Sink-2.0
local SINK20 = "LibSink-2.0"
local SINK20_MINOR = 90000 + tonumber(("$Revision: 71 $"):match("(%d+)"))
local sink = LibStub:NewLibrary(SINK20, SINK20_MINOR)
if not sink then return end
-- Start upgrade
sink.storageForAddon = sink.storageForAddon or {}
sink.override = sink.override or {}
sink.msbt_registered_fonts = sink.msbt_registered_fonts or {}
sink.registeredScrollAreaFunctions = sink.registeredScrollAreaFunctions or {}
sink.handlers = sink.handlers or {}
sink.stickyAddons = sink.stickyAddons or {
Blizzard = true,
MikSBT = true,
SCT = true,
Parrot = true,
BCF = true,
}
-- Upgrade complete
local L_DEFAULT = "Default"
local L_DEFAULT_DESC = "Route output from this addon through the first available handler, preferring scrolling combat text addons if available."
local L_ROUTE = "Route output from this addon through %s."
local L_SCT = "Scrolling Combat Text"
local L_MSBT = "MikSBT"
local L_BIGWIGS = "BigWigs"
local L_BCF = "BlinkCombatFeedback"
local L_UIERROR = "Blizzard Error Frame"
local L_CHAT = "Chat"
local L_BLIZZARD = "Blizzard FCT"
local L_RW = "Raid Warning"
local L_PARROT = "Parrot"
local L_CHANNEL = "Channel"
local L_OUTPUT = "Output"
local L_OUTPUT_DESC = "Where to route the output from this addon."
local L_SCROLL = "Sub section"
local L_SCROLL_DESC = "Set the sub section where messages should appear.\n\nOnly available for some output sinks."
local L_STICKY = "Sticky"
local L_STICKY_DESC = "Set messages from this addon to appear as sticky.\n\nOnly available for some output sinks."
local L_NONE = "None"
local L_NONE_DESC = "Hide all messages from this addon."
local L_NOTINCHANNEL = " (You tried sending this to the channel %s, but it appears you are not there.)"
local l = GetLocale()
if l == "koKR" then
L_DEFAULT = "기본"
L_DEFAULT_DESC = "처음으로 사용 가능한 트레이너를 통해 이 애드온으로부터 출력을 보냅니다."
L_ROUTE = "%s|1을;를; 통해 이 애드온의 메시지를 출력합니다."
L_SCT = "Scrolling Combat Text"
L_MSBT = "MikSBT"
L_BIGWIGS = "BigWigs"
L_BCF = "블링크의 전투 메세지"
L_UIERROR = "블리자드 오류 창"
L_CHAT = "대화창"
L_BLIZZARD = "블리자드 FCT"
L_RW = "공격대 경보"
L_PARROT = "Parrot"
L_OUTPUT = "출력"
L_OUTPUT_DESC = "어디에 이 애드온의 메시지를 출력할지 선택합니다."
L_SCROLL = "스크롤 영역"
L_SCROLL_DESC = "메시지를 출력할 스크룰 영역을 설정합니다.\n\nParrot, SCT나 MikSBT만 사용 가능합니다."
L_STICKY = "점착"
L_STICKY_DESC = "달라붙는 것처럼 보일 이 애드온의 메시지를 설정합니다.\n\n블리자드 FCT, Parrot, SCT나 MikSBT만 사용 가능합니다."
L_NONE = "없음"
L_NONE_DESC = "이 애드온의 모든 메시지를 숨김니다."
elseif l == "frFR" then
L_DEFAULT = "Par défaut"
L_DEFAULT_DESC = "Transmet la sortie de cet addon via le premier handler disponible, de préférence les textes de combat défilants s'il y en a."
L_ROUTE = "Transmet la sortie de cet addon via %s."
L_SCT = "Scrolling Combat Text"
L_MSBT = "MikSBT"
L_BIGWIGS = "BigWigs"
L_BCF = "BlinkCombatFeedback"
L_UIERROR = "Cadre des erreurs"
L_CHAT = "Fenêtre de discussion"
L_BLIZZARD = "TCF de Blizzard"
L_RW = "Avertissement raid"
L_PARROT = "Parrot"
L_CHANNEL = "Canal"
L_OUTPUT = "Sortie"
L_OUTPUT_DESC = "Destination de la sortie de cet addon."
L_SCROLL = "Sous-section"
L_SCROLL_DESC = "Définit la sous-section où les messages doivent apparaitre.\n\nDisponible uniquement dans certains cas."
L_STICKY = "En évidence"
L_STICKY_DESC = "Fait en sortie que les messages de cet addon apparaissent en évidence.\n\nDisponible uniquement dans certains cas."
L_NONE = "Aucun"
L_NONE_DESC = "Masque tous les messages provenant de cet addon."
elseif l == "deDE" then
L_DEFAULT = "Voreinstellung"
L_DEFAULT_DESC = "Leitet die Ausgabe von diesem Addon zum ersten verfügbaren Ausgabeort, vorzugsweise Scrollende Kampf Text Addons wenn verfügbar."
L_ROUTE = "Schickt die Meldungen dieses Addons an %s."
L_SCT = "Scrolling Combat Text(SCT)"
L_MSBT = "MikSBT"
L_BIGWIGS = "BigWigs"
L_BCF = "BlinkCombatFeedback"
L_UIERROR = "Blizzard's Fehler Fenster"
L_CHAT = "Im Chat"
L_BLIZZARD = "Blizzard's schwebenden Kampftext"
L_RW = "Schlachtzug's Warnung"
L_PARROT = "Parrot"
L_OUTPUT = "Ausgabe"
L_OUTPUT_DESC = "Wohin die Meldungen des Addons gesendet werden soll."
L_SCROLL = "Scroll Bereich"
L_SCROLL_DESC = "Setzt die Scroll Bereich, wo die Meldungen erscheinen sollen.\n\nNur verfügbar für Parrot, SCT oder MikSBT."
L_STICKY = "Stehend"
L_STICKY_DESC = "Läßt Nachrichten von diesem Addon als stehende Nachrichten erscheinen.\n\nNur verfügbar für Blizzard FCT, Parrot, SCT oder MikSBT."
L_NONE = "Nirgends"
L_NONE_DESC = "Versteckt alle Meldungen von diesem Addon."
elseif l == "zhCN" then
L_DEFAULT = "默认"
L_DEFAULT_DESC = "插件的输出方式取决于第一个可用插件,例如有 SCT 插件,则优先使用。"
L_ROUTE = "经由%s显示信息。"
L_SCT = "SCT"
L_MSBT = "MikSBT"
L_BIGWIGS = "BigWigs"
L_BCF = "BlinkCombatFeedback"
L_UIERROR = "Blizzard 错误框体"
L_CHAT = "聊天框体"
L_BLIZZARD = "系统自带滚动战斗信息"
L_RW = "团队警告"
L_PARROT = "Parrot"
L_CHANNEL = "频道"
L_OUTPUT = "输出模式"
L_OUTPUT_DESC = "设置显示位置。"
L_SCROLL = "滚动区域"
L_SCROLL_DESC = "设置滚动信息显示位置。\n\n只有 Parrot、SCT 及 MikSBT 支持。"
L_STICKY = "固定"
L_STICKY_DESC = "设置信息固定显示位置。\n\n只有系统自带滚动战斗信息、Parrot、SCT 及 MikSBT 支持。"
L_NONE = "隐藏"
L_NONE_DESC = "隐藏所有来自插件的信息。"
elseif l == "zhTW" then
L_DEFAULT = "預設"
L_DEFAULT_DESC = "插件輸出經由第一個可使用的處理器顯示,如果有 SCT 的話,則優先使用。"
L_ROUTE = "插件輸出經由%s顯示。"
L_SCT = "SCT"
L_MSBT = "MikSBT"
L_BIGWIGS = "BigWigs"
L_BCF = "BlinkCombatFeedback"
L_UIERROR = "Blizzard 錯誤訊息框架"
L_CHAT = "聊天視窗"
L_BLIZZARD = "Blizzard 浮動戰鬥文字"
L_RW = "團隊警告"
L_PARROT = "Parrot"
L_OUTPUT = "顯示模式"
L_OUTPUT_DESC = "插件輸出經由哪裡顯示。"
L_SCROLL = "滾動區域"
L_SCROLL_DESC = "設定滾動訊息出現位置。\n\n只有 Parrot,SCT 及 MikSBT 有支援。"
L_STICKY = "固定"
L_STICKY_DESC = "設定使用固定訊息。\n\n只有 Blizzard 浮動戰鬥文字,Parrot,SCT 及 MikSBT 有支援。"
L_NONE = "隱藏"
L_NONE_DESC = "隱藏所有插件輸出。"
elseif l == "ruRU" then
L_DEFAULT = "По умолчанию"
L_DEFAULT_DESC = "Маршрут вывода сообщений данного аддона через первое доступное устройство, предпочитая доступные аддоны прокрутки текста боя."
L_ROUTE = "Маршрут вывода сообщений данного аддона через %s."
L_SCT = "SCT"
L_MSBT = "MikSBT"
L_BIGWIGS = "BigWigs"
L_BCF = "BlinkCombatFeedback"
L_UIERROR = "Фрейм ошибок Blizzard"
L_CHAT = "Чат"
L_BLIZZARD = "Blizzard FCT"
L_RW = "Объявление рейду"
L_PARROT = "Parrot"
L_CHANNEL = "Канал"
L_OUTPUT = "Вывод"
L_OUTPUT_DESC = "Куда выводить сообщения данного аддона."
L_SCROLL = "Область прокрутки"
L_SCROLL_DESC = "Назначить область прокрутки куда должны выводиться сообщения.\n\nДоступно только для Parrotа, SCT или MikSBT."
L_STICKY = "Клейкий"
L_STICKY_DESC = "Сделать сообщения данного аддона клейкими.\n\nДоступно только для Blizzard FCT, Parrot, SCT или MikSBT."
L_NONE = "Нету"
L_NONE_DESC = "Скрыть все сообщения данного аддона."
end
local SML = LibStub("LibSharedMedia-3.0", true)
local _G = getfenv(0)
local function getSticky(addon)
return sink.storageForAddon[addon] and sink.storageForAddon[addon].sink20Sticky or nil
end
-- Thanks to Antiarc and his Soar-1.0 library for most of the 'meat' of the
-- sink-specific functions.
local function parrot(addon, text, r, g, b, font, size, outline, sticky, loc, icon)
local location = sink.storageForAddon[addon] and sink.storageForAddon[addon].sink20ScrollArea or "Notification"
local s = getSticky(addon) or sticky
Parrot:ShowMessage(text, location, s, r, g, b, font, size, outline, icon)
end
local sct_color = {}
local function sct(addon, text, r, g, b, font, size, outline, sticky, _, icon)
sct_color.r, sct_color.g, sct_color.b = r, g, b
local loc = sink.storageForAddon[addon] and sink.storageForAddon[addon].sink20ScrollArea or "Messages"
local location = (loc == "Outgoing" and SCT.FRAME1) or (loc == "Incoming" and SCT.FRAME2) or SCT.MSG
local s = getSticky(addon) or sticky
SCT:DisplayCustomEvent(text, sct_color, s, location, nil, icon)
end
local msbt_outlines = {["NORMAL"] = 1, ["OUTLINE"] = 2, ["THICKOUTLINE"] = 3}
local function msbt(addon, text, r, g, b, font, size, outline, sticky, _, icon)
if font and SML and not sink.msbt_registered_fonts[font] then
MikSBT.RegisterFont(font, SML:Fetch("font", font))
sink.msbt_registered_fonts[font] = true
end
local location = sink.storageForAddon[addon] and sink.storageForAddon[addon].sink20ScrollArea or MikSBT.DISPLAYTYPE_NOTIFICATION
local s = getSticky(addon) or sticky
MikSBT.DisplayMessage(text, location, s, r * 255, g * 255, b * 255, size, font, msbt_outlines[outline], icon)
end
local bcf_outlines = {NORMAL = "", OUTLINE = "OUTLINE", THICKOUTLINE = "THICKOUTLINE"}
local function bcf(addon, text, r, g, b, font, size, outline, sticky, _, icon)
if icon then text = "|T"..icon..":20:20:-5|t"..text end
local loc = sink.storageForAddon[addon] and sink.storageForAddon[addon].sink20ScrollArea or "Sticky"
local s = getSticky(addon) or sticky
BlinkCombatFeedback:DisplayCustomEvent({display = {msg = text, color = ("%02x%02x%02x"):format(r * 255, g * 255, b * 255), scrollArea = loc, scrollType = s and "Sticky" or "up", size = size, outling = bcf_outlines[outline], align = "center", font = font}})
end
local function blizzard(addon, text, r, g, b, font, size, outline, sticky, _, icon)
if icon then text = "|T"..icon..":20:20:-5|t"..text end
if tostring(SHOW_COMBAT_TEXT) ~= "0" then
local s = getSticky(addon) or sticky
CombatText_AddMessage(text, CombatText_StandardScroll, r, g, b, s and "crit" or nil, false)
else
UIErrorsFrame:AddMessage(text, r, g, b, 1.0)
end
end
sink.channelMapping = sink.channelMapping or {
[SAY] = "SAY",
[PARTY] = "PARTY",
[BATTLEGROUND] = "BATTLEGROUND",
[GUILD_CHAT] = "GUILD",
[OFFICER_CHAT] = "OFFICER",
[YELL] = "YELL",
[RAID] = "RAID",
[RAID_WARNING] = "RAID_WARNING",
[GROUP] = "GROUP",
}
sink.frame = sink.frame or CreateFrame("Frame")
sink.frame:RegisterEvent("CHANNEL_UI_UPDATE")
sink.frame:RegisterEvent("PLAYER_ENTERING_WORLD")
do
local newChannels = {}
local function loop(...)
wipe(newChannels)
for i = 1, select("#", ...), 2 do
local id, name = select(i, ...)
newChannels[name] = true
end
for k, v in pairs(sink.channelMapping) do
if v == "CHANNEL" and not newChannels[k] then
sink.channelMapping[k] = nil
end
end
for k in pairs(newChannels) do sink.channelMapping[k] = "CHANNEL" end
end
local function rescanChannels() loop(GetChannelList()) end
sink.frame:SetScript("OnEvent", rescanChannels)
rescanChannels()
end
local function channel(addon, text)
-- Sanitize the text, remove all color codes.
text = text:gsub("(|c%x%x%x%x%x%x%x%x)", ""):gsub("(|r)", "")
local loc = sink.storageForAddon[addon] and sink.storageForAddon[addon].sink20ScrollArea or "SAY"
local chan = sink.channelMapping[loc]
if chan == "GROUP" then
chan = select(2, IsInInstance()) == "pvp" and "BATTLEGROUND" or (UnitInRaid("player") and "RAID" or "PARTY")
if chan == "PARTY" and GetNumPartyMembers() == 0 then chan = "SAY" end
elseif chan == "CHANNEL" then
local id, name = GetChannelName(loc)
if name then
SendChatMessage(text, "CHANNEL", nil, id)
else
print(text .. L_NOTINCHANNEL)
end
return
end
SendChatMessage(text, chan or "SAY")
end
local function chat(addon, text, r, g, b, _, _, _, _, _, icon)
if icon then text = "|T"..icon..":15|t"..text end
DEFAULT_CHAT_FRAME:AddMessage(text, r, g, b)
end
local function uierror(addon, text, r, g, b, _, _, _, _, _, icon)
if icon then text = "|T"..icon..":20:20:-5|t"..text end
UIErrorsFrame:AddMessage(text, r, g, b, 1.0)
end
local rw
do
local white = {r = 1, g = 1, b = 1}
function rw(addon, text, r, g, b, _, _, _, _, _, icon)
if r or g or b then
local c = "|cff" .. string.format("%02x%02x%02x", (r or 0) * 255, (g or 0) * 255, (b or 0) * 255)
text = c .. text .. "|r"
end
if icon then text = "|T"..icon..":20:20:-5|t"..text end
RaidNotice_AddMessage(RaidWarningFrame, text, white)
end
end
local function noop() --[[ noop! ]] end
local handlerPriority = { "Parrot", "SCT", "MikSBT", "BCF" }
-- Thanks to ckk for these
local customHandlersEnabled = {
Parrot = function()
if not _G.Parrot then return end
return _G.Parrot.IsEnabled and _G.Parrot:IsEnabled() or _G.Parrot:IsActive()
end,
SCT = function()
return _G.SCT and _G.SCT:IsEnabled()
end,
BCF = function()
return bcfDB and bcfDB["enable"]
end,
}
-- Default to version 5 or higher now
local msbtVersion = tonumber(string.match(GetAddOnMetadata("MikScrollingBattleText", "Version") or "","^%d+%.%d+")) or 5
local isMSBTFive = math.floor(msbtVersion) > 4 and true or nil
if isMSBTFive then
customHandlersEnabled.MikSBT = function()
return _G.MikSBT and not _G.MikSBT.IsModDisabled()
end
else
customHandlersEnabled.MikSBT = function()
return _G.MikSBT and _G.MSBTProfiles and _G.MSBTProfiles.GetSavedVariables() and not MSBTProfiles.GetSavedVariables().UserDisabled
end
end
local currentHandler = nil
local function getPrioritizedSink()
if currentHandler then
local check = customHandlersEnabled[currentHandler]
if check and check() then
return sink.handlers[currentHandler]
end
end
for i, v in next, handlerPriority do
local check = customHandlersEnabled[v]
if check and check() then
currentHandler = v
return sink.handlers[v]
end
end
if SHOW_COMBAT_TEXT and tostring(SHOW_COMBAT_TEXT) ~= "0" then
return blizzard
end
return chat
end
local function pour(addon, text, r, g, b, ...)
local func = sink.override and sink.handlers[sink.override] or nil
if not func and sink.storageForAddon[addon] and sink.storageForAddon[addon].sink20OutputSink then
local h = sink.storageForAddon[addon].sink20OutputSink
func = sink.handlers[h]
-- If this sink is not available now, find one manually.
if customHandlersEnabled[h] and not customHandlersEnabled[h]() then
func = nil
end
end
if not func then
func = getPrioritizedSink()
end
if not func then func = chat end
func(addon, text, r or 1, g or 1, b or 1, ...)
end
function sink:Pour(textOrAddon, ...)
local t = type(textOrAddon)
if t == "string" then
pour(self, textOrAddon, ...)
elseif t == "number" then
pour(self, tostring(textOrAddon), ...)
elseif t == "table" then
pour(textOrAddon, ...)
else
error("Invalid argument 2 to :Pour, must be either a string or a table.")
end
end
local sinks
do
-- Maybe we want to hide them instead of disable
local function shouldDisableSCT()
return not _G.SCT
end
local function shouldDisableMSBT()
return not _G.MikSBT
end
local function shouldDisableBCF()
return not ( bcfDB and bcfDB["enable"] )
end
local function shouldDisableParrot()
return not _G.Parrot
end
local function shouldDisableFCT()
return not SHOW_COMBAT_TEXT or tostring(SHOW_COMBAT_TEXT) == "0"
end
local sctFrames = {"Incoming", "Outgoing", "Messages"}
local msbtFrames = nil
local tmp = {}
local function getScrollAreasForAddon(addon)
if type(addon) ~= "string" then return nil end
if addon == "Parrot" then
if Parrot.GetScrollAreasChoices then
return Parrot:GetScrollAreasChoices()
else
return Parrot:GetScrollAreasValidate()
end
elseif addon == "MikSBT" then
if isMSBTFive then
if not msbtFrames then
msbtFrames = {}
for key, name in MikSBT.IterateScrollAreas() do
table.insert(msbtFrames, name)
end
end
return msbtFrames
else
return MikSBT.GetScrollAreaList()
end
elseif addon == "BCF" then
if bcfDB then
local bcfAreas = {}
for i = 1, #bcfDB["scrollAreas"] do
bcfAreas[#bcfAreas + 1] = bcfDB["scrollAreas"][i]["name"]
end
return bcfAreas
end
elseif addon == "SCT" then
return sctFrames
elseif addon == "Channel" then
wipe(tmp)
for k in pairs(sink.channelMapping) do
tmp[#tmp + 1] = k
end
return tmp
elseif sink.registeredScrollAreaFunctions[addon] then
return sink.registeredScrollAreaFunctions[addon]()
end
return nil
end
local emptyTable, args, options = {}, {}, {}
sinks = {
Default = {L_DEFAULT, L_DEFAULT_DESC},
SCT = {L_SCT, nil, shouldDisableSCT},
MikSBT = {L_MSBT, nil, shouldDisableMSBT},
BCF = {L_BCF, nil, shouldDisableBCF},
Parrot = {L_PARROT, nil, shouldDisableParrot},
Blizzard = {L_BLIZZARD, nil, shouldDisableFCT},
RaidWarning = {L_RW},
ChatFrame = {L_CHAT},
Channel = {L_CHANNEL},
UIErrorsFrame = {L_UIERROR},
None = {L_NONE, L_NONE_DESC}
}
local function getAce2SinkOptions(key, opts)
local name, desc, hidden = unpack(opts)
args["Ace2"][key] = {
type = "toggle",
name = name,
desc = desc or L_ROUTE:format(name),
isRadio = true,
hidden = hidden
}
end
function sink.GetSinkAce2OptionsDataTable(addon)
options["Ace2"][addon] = options["Ace2"][addon] or {
output = {
type = "group",
name = L_OUTPUT,
desc = L_OUTPUT_DESC,
pass = true,
get = function(key)
if not sink.storageForAddon[addon] then
return "Default"
end
if tostring(key) == "nil" then
-- Means AceConsole wants to list the output option,
-- so we should show which sink is currently used.
return sink.storageForAddon[addon].sink20OutputSink or L_DEFAULT
end
if key == "ScrollArea" then
return sink.storageForAddon[addon].sink20ScrollArea
elseif key == "Sticky" then
return sink.storageForAddon[addon].sink20Sticky
else
if sink.storageForAddon[addon].sink20OutputSink == key then
local sa = getScrollAreasForAddon(key)
options["Ace2"][addon].output.args.ScrollArea.validate = sa or emptyTable
options["Ace2"][addon].output.args.ScrollArea.disabled = not sa
options["Ace2"][addon].output.args.Sticky.disabled = not sink.stickyAddons[key]
end
return sink.storageForAddon[addon].sink20OutputSink and sink.storageForAddon[addon].sink20OutputSink == key or nil
end
end,
set = function(key, value)
if not sink.storageForAddon[addon] then return end
if key == "ScrollArea" then
sink.storageForAddon[addon].sink20ScrollArea = value
elseif key == "Sticky" then
sink.storageForAddon[addon].sink20Sticky = value
elseif value then
local sa = getScrollAreasForAddon(key)
options["Ace2"][addon].output.args.ScrollArea.validate = sa or emptyTable
options["Ace2"][addon].output.args.ScrollArea.disabled = not sa
options["Ace2"][addon].output.args.Sticky.disabled = not sink.stickyAddons[key]
sink.storageForAddon[addon].sink20OutputSink = key
end
end,
args = args["Ace2"],
disabled = function()
return (type(addon.IsActive) == "function" and not addon:IsActive()) or nil
end
}
}
return options["Ace2"][addon]
end
-- Ace3 options data table format
local function getAce3SinkOptions(key, opts)
local name, desc, hidden = unpack(opts)
args["Ace3"][key] = {
type = "toggle",
name = name,
desc = desc or L_ROUTE:format(name),
hidden = hidden
}
end
function sink.GetSinkAce3OptionsDataTable(addon)
if not options["Ace3"][addon] then
options["Ace3"][addon] = {
type = "group",
name = L_OUTPUT,
desc = L_OUTPUT_DESC,
args = args["Ace3"],
get = function(info)
local key = info[#info]
if not sink.storageForAddon[addon] then
return "Default"
end
if tostring(key) == "nil" then
-- Means AceConsole wants to list the output option,
-- so we should show which sink is currently used.
return sink.storageForAddon[addon].sink20OutputSink or L_DEFAULT
end
if key == "ScrollArea" then
return sink.storageForAddon[addon].sink20ScrollArea
elseif key == "Sticky" then
return sink.storageForAddon[addon].sink20Sticky
else
if sink.storageForAddon[addon].sink20OutputSink == key then
local sa = getScrollAreasForAddon(key)
if sa then
for k,v in ipairs(sa) do
sa[k] = nil
sa[v] = v
end
end
options["Ace3"][addon].args.ScrollArea.values = sa or emptyTable
options["Ace3"][addon].args.ScrollArea.disabled = not sa
options["Ace3"][addon].args.Sticky.disabled = not sink.stickyAddons[key]
end
return sink.storageForAddon[addon].sink20OutputSink and sink.storageForAddon[addon].sink20OutputSink == key or nil
end
end,
set = function(info, v)
local key = info[#info]
if not sink.storageForAddon[addon] then return end
if key == "ScrollArea" then
sink.storageForAddon[addon].sink20ScrollArea = v
elseif key == "Sticky" then
sink.storageForAddon[addon].sink20Sticky = v
elseif v then
local sa = getScrollAreasForAddon(key)
if sa then
for k,v in ipairs(sa) do
sa[k] = nil
sa[v] = v
end
end
options["Ace3"][addon].args.ScrollArea.values = sa or emptyTable
options["Ace3"][addon].args.ScrollArea.disabled = not sa
options["Ace3"][addon].args.Sticky.disabled = not sink.stickyAddons[key]
sink.storageForAddon[addon].sink20OutputSink = key
end
end,
disabled = function()
return (type(addon.IsEnabled) == "function" and not addon:IsEnabled()) or nil
end,
}
end
return options["Ace3"][addon]
end
local sinkOptionGenerators = {
["Ace2"] = getAce2SinkOptions,
["Ace3"] = getAce3SinkOptions
}
for generatorName, generator in pairs(sinkOptionGenerators) do
options[generatorName] = options[generatorName] or {}
args[generatorName] = args[generatorName] or {}
for name, opts in pairs(sinks) do
generator(name, opts)
end
end
args["Ace2"].ScrollArea = {
type = "text",
name = L_SCROLL,
desc = L_SCROLL_DESC,
validate = emptyTable,
order = -1,
disabled = true
}
args["Ace2"].Sticky = {
type = "toggle",
name = L_STICKY,
desc = L_STICKY_DESC,
validate = emptyTable,
order = -2,
disabled = true
}
args["Ace3"].ScrollArea = {
type = "select",
name = L_SCROLL,
desc = L_SCROLL_DESC,
values = emptyTable,
order = -1,
disabled = true
}
args["Ace3"].Sticky = {
type = "toggle",
name = L_STICKY,
desc = L_STICKY_DESC,
order = -2,
disabled = true
}
function sink:RegisterSink(shortName, name, desc, func, scrollAreaFunc, hasSticky)
assert(type(shortName) == "string")
assert(type(name) == "string")
assert(type(desc) == "string" or desc == nil)
assert(type(func) == "function" or type(func) == "string")
assert(type(scrollAreas) == "function" or scrollAreas == nil)
assert(type(hasSticky) == "boolean" or hasSticky == nil)
if sinks[shortName] or sink.handlers[shortName] then
error("There's already a sink by the short name %q.", shortName)
end
sinks[shortName] = {name, desc}
-- Save it for library upgrades.
if not sink.registeredSinks then sink.registeredSinks = {} end
sink.registeredSinks[shortName] = sinks[shortName]
if type(func) == "function" then
sink.handlers[shortName] = func
else
sink.handlers[shortName] = function(...)
self[func](self, ...)
end
end
if type(scrollAreaFunc) == "function" then
sink.registeredScrollAreaFunctions[shortName] = scrollAreaFunc
elseif type(scrollAreaFunc) == "string" then
sink.registeredScrollAreaFunctions[shortName] = function(...)
return self[scrollAreaFunc](self, ...)
end
end
sink.stickyAddons[shortName] = hasSticky and true or nil
for k, v in pairs(sinkOptionGenerators) do
v(shortName, sinks[shortName])
end
end
end
function sink.SetSinkStorage(addon, storage)
assert(type(addon) == "table")
assert(type(storage) == "table", "Storage must be a table")
sink.storageForAddon[addon] = storage
end
-- Sets a sink override for -all- addons, librarywide.
function sink:SetSinkOverride(override)
assert(type(override) == "string" or override == nil)
if override and not sink.handlers[override] then
error("There's no %q sink.", override)
end
sink.override = override
end
-- Put this at the bottom, because we need the local functions to exist first.
local handlers = {
Parrot = parrot,
SCT = sct,
MikSBT = msbt,
BCF = bcf,
ChatFrame = chat,
Channel = channel,
UIErrorsFrame = uierror,
Blizzard = blizzard,
RaidWarning = rw,
None = noop,
}
-- Overwrite any handler functions from the old library
for k, v in pairs(handlers) do
sink.handlers[k] = v
end
-----------------------------------------------------------------------
-- Embed handling
sink.embeds = sink.embeds or {}
local mixins = {
"Pour", "RegisterSink", "SetSinkStorage",
"GetSinkAce2OptionsDataTable", "GetSinkAce3OptionsDataTable"
}
function sink:Embed(target)
sink.embeds[target] = true
for _,v in pairs(mixins) do
target[v] = sink[v]
end
return target
end
for addon in pairs(sink.embeds) do
sink:Embed(addon)
end
|
-- this function gives time in ms; must be changed depending on system
return draw.gettime
|
---------------------------------------------
-- Vitriolic Shower
-- Description: Expels a caustic stream at targets in a fan-shaped area of effect. Additional effect: Burn
-- Type: Magical
-- Utsusemi/Blink absorb: Wipes shadow
-- Range: Cone
---------------------------------------------
require("scripts/globals/status")
require("scripts/globals/monstertpmoves")
---------------------------------------------
function onMobSkillCheck(target, mob, skill)
return 0
end
function onMobWeaponSkill(target, mob, skill)
local typeEffect = tpz.effect.BURN
local power = math.random(15, 35)
MobStatusEffectMove(mob, target, typeEffect, power, 3, 60)
local dmgmod = 2
local info = MobMagicalMove(mob, target, skill, mob:getWeaponDmg()*2.7, tpz.magic.ele.FIRE, dmgmod, TP_NO_EFFECT)
local dmg = MobFinalAdjustments(info.dmg, mob, skill, target, MOBSKILL_MAGICAL, MOBPARAM_FIRE, MOBPARAM_WIPE_SHADOWS)
target:takeDamage(dmg, mob, tpz.attackType.MAGICAL, tpz.damageType.FIRE)
return dmg
end
|
-- rcore.cz
-- Some-RP.cz
-- forum.some-rp.cz
ESX = nil
AdminPlayers = {}
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterCommand('tag', function(source,args)
local xPlayer = ESX.GetPlayerFromId(source)
if AdminPlayers[source] == nil then
if Config.TagByPermission then
AdminPlayers[source] = {source = source, permission = xPlayer.getPermissions()}
else
AdminPlayers[source] = {source = source, group = xPlayer.getGroup()}
end
TriggerClientEvent('chat:addMessage',source, { args = { 'Tag', 'Právě jste si zapl tag' }, color = { 255, 50, 50 } })
else
AdminPlayers[source] = nil
TriggerClientEvent('chat:addMessage',source, { args = { 'Tag', 'Právě jste si vypnul tag' }, color = { 255, 50, 50 } })
end
TriggerClientEvent('relisoft_tag:set_admins',-1,AdminPlayers)
end)
ESX.RegisterServerCallback('relisoft_tag:getAdminsPlayers',function(source,cb)
cb(AdminPlayers)
end)
AddEventHandler('esx:playerDropped', function(source)
if AdminPlayers[source] ~= nil then
AdminPlayers[source] = nil
end
TriggerClientEvent('relisoft_tag:set_admins',-1,AdminPlayers)
end)
|
arrestPlayer = function(thief, cop, command)
local i = thief
local player = cop
local thiefData = players[thief]
local copData = players[cop]
if not copData then
eventNewPlayer(cop)
return arrestPlayer(thief, cop, command)
elseif not thiefData then
eventNewPlayer(thief)
return arrestPlayer(thief, cop, command)
end
checkIfPlayerIsDriving(thief)
removeImages(thief)
ui.removeTextArea(1012, thief)
ui.removeTextArea(5001, thief)
closeMenu(920, thief)
removeTimer(thiefData.timer)
job_fire(thief)
eventTextAreaCallback(1, thief, 'closeVaultPassword', true)
players[thief].place = 'police'
players[thief].blockScreen = true
players[thief].robbery.arrested = true
players[thief].robbery.robbing = false
players[thief].robbery.usingShield = false
players[thief].robbery.whenWasArrested = os.time()
players[thief].robbery.escaped = false
players[thief].timer = {}
players[thief].bankPassword = nil
if thief ~= 'Robber' then
closeInterface(thief, nil, nil, nil, nil, nil, true)
players[thief].timer = addTimer(function(j)
local time = room.robbing.prisonTimer - j
local thiefPosition = ROOM.playerList[thief]
ui.addTextArea(98900000000, string.format("<b><font color='#371616'><p align='center'>"..translate('looseMgs', thief), time), thief, 253, 368, 290, nil, 1, 1, 0, true)
if j == room.robbing.prisonTimer then
removeTimer(thiefData.timer)
players[thief].robbery.arrested = false
players[thief].blockScreen = false
players[thief].timer = {}
TFM.movePlayer(thief, 8020, 6400, false)
showOptions(thief)
end
if thiefPosition.x > 8040 and thiefPosition.y > 6260 and thiefPosition.x < 8500 and thiefPosition.y < 6420 then return end
TFM.movePlayer(thief, math.random(8055, 8330), 6400, false)
end, 1000, command and 30 or room.robbing.prisonTimer)
end
giveExperiencePoints(thief, 10)
giveExperiencePoints(cop, 30)
local complement = i:gmatch('(.-)#[0-9]+$')()
if not i:match('#0000') then
complement = i:gsub('#', '<g>#')
end
for name in next, ROOM.playerList do
if name ~= cop then
TFM.chatMessage(string.format(translate('captured', name), complement), name)
end
end
TFM.chatMessage(string.format(translate('arrestedPlayer', cop), complement), cop)
local sidequest = sideQuests[copData.sideQuests[1]].type
if string.find(sidequest, 'type:arrest') then
sideQuest_update(cop, 1)
end
giveCoin(jobs['police'].coins, cop, true)
job_updatePlayerStats(cop, 1)
players[cop].time = os.time() + 10000
end
|
Ground = {
def = "ground_actor",
position = {0, -11},
tag = "spawned",
layer = "foreground",
}
Bouncy = {
def = "physics_event_actor",
position = {0, 8},
layer = "foreground",
tag = "spawned",
}
Hud = {
def = "simple_actor",
size = 3,
position = {0, 1},
alpha = 1.0,
layer = "hud",
color = {0, 0, 1},
tag = "spawned",
}
WayInBack = {
def = "simple_actor",
color = {1, 1, 0},
size = 3,
position = {0, -3},
alpha = 1.0,
layer = "background",
tag = "spawned",
}
|
local a=loadstring(game:HttpGet("https://raw.githubusercontent.com/miroeramaa/TurtleLib/main/TurtleUiLib.lua"))()local b=a:Window("Scripts")local c=a:Window("LocalPlayer")local d=a:Window("Teleport Areas")local e=a:Window("FE Commands")e:Button("Become Manager",function()local f=game:GetService("Teams").Manager:GetPlayers()[1]if f.Character.Humanoid.Sit then game:GetService("StarterGui"):SetCore("SendNotification",{Title="Make Manager Script",Text="Failed Because Manager is Sitting",Duration=5})return end;yes=game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame;pcall(function()local g={[1]="QuitJob",[2]=game:GetService("Players").LocalPlayer}game:GetService("ReplicatedStorage").ManagerChannel:FireServer(unpack(g))local g={[1]=true}workspace.MessageService.DialogButtonPressed:FireServer(unpack(g))workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;local g={[1]="GiveItem",[2]=495886176}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))game.Players.LocalPlayer.Character.Humanoid.Name=1;local h=game.Players.LocalPlayer.Character["1"]:Clone()h.Parent=game.Players.LocalPlayer.Character;h.Name="Humanoid"wait(0.1)game.Players.LocalPlayer.Character["1"]:Destroy()workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;game.Players.LocalPlayer.Character.Animate.Disabled=true;wait(0.1)game.Players.LocalPlayer.Character.Animate.Disabled=false;game.Players.LocalPlayer.Character.Humanoid.DisplayDistanceType="None"wait(.20)local i="PaintBucket"for j,k in pairs(game:GetService("Players").LocalPlayer.Backpack:GetChildren())do if k:IsA("Tool")and k.Name==i then k.Parent=game:GetService("Players").LocalPlayer.Character end end;game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(f.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(f.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(f.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(f.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(f.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(f.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(f.Character.HumanoidRootPart.Position)wait(2)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(11.819767951965,1.1243584156036,21.870401382446)wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(11.819767951965,1.1243584156036,21.870401382446)wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(11.819767951965,1.1243584156036,21.870401382446)wait(2)game.Players.LocalPlayer.Character:Destroy()wait(2)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(23.7,2.59944,6.5)wait(.50)game:GetService("Players").LocalPlayer.Character:FindFirstChildOfClass("Humanoid"):ChangeState("Jumping")wait(.20)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=yes;game.Players.LocalPlayer.PlayerGui.MainGui.Menu.Backpack.Tools.Shortcut:Destroy()end)end)e:Box("Kill Player",function(l,m)if m and game.Players[l]then if game.Players[l].Character.Humanoid.Sit then game:GetService("StarterGui"):SetCore("SendNotification",{Title="Kill Player Script",Text="Failed Because Player is Sitting",Duration=5})return end;yes=game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame;pcall(function()local g={[1]="GiveItem",[2]=495886176}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))wait(.20)game.Players.LocalPlayer.Character.Humanoid.Name=1;local h=game.Players.LocalPlayer.Character["1"]:Clone()h.Parent=game.Players.LocalPlayer.Character;h.Name="Humanoid"wait(0.1)game.Players.LocalPlayer.Character["1"]:Destroy()workspace.CurrentCamera.CameraSubject=game.Players[l].Character;game.Players.LocalPlayer.Character.Animate.Disabled=true;wait(0.1)game.Players.LocalPlayer.Character.Animate.Disabled=false;game.Players.LocalPlayer.Character.Humanoid.DisplayDistanceType="None"wait(.20)local i="PaintBucket"for j,k in pairs(game:GetService("Players").LocalPlayer.Backpack:GetChildren())do if k:IsA("Tool")and k.Name==i then k.Parent=game:GetService("Players").LocalPlayer.Character end end;game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[l].Character.HumanoidRootPart.CFrame;wait(.10)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[l].Character.HumanoidRootPart.CFrame;wait(.10)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[l].Character.HumanoidRootPart.CFrame;wait(.10)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[l].Character.HumanoidRootPart.CFrame;wait(.10)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[l].Character.Head.CFrame;wait(.10)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[l].Character.HumanoidRootPart.CFrame;wait(.10)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[l].Character.HumanoidRootPart.CFrame;wait(.10)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[l].Character.Head.CFrame;wait(.10)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[l].Character.HumanoidRootPart.CFrame;wait(1)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(85.092697143555,-39.80192565918,434.20581054688)wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(85.092697143555,-39.80192565918,434.20581054688)wait(5)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=yes end)end;wait(4)game.Players.LocalPlayer.PlayerGui.MainGui.Menu.Backpack.Tools.Shortcut:Destroy()end)e:Box("Skydive Player",function(n,m)if m and game.Players[n]then if game.Players[n].Character.Humanoid.Sit then game:GetService("StarterGui"):SetCore("SendNotification",{Title="Skydive Player Script",Text="Failed Because Player is Sitting",Duration=5})return end;yes=game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame;pcall(function()local g={[1]="GiveItem",[2]=495886176}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))wait(.20)workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;game.Players.LocalPlayer.Character.Humanoid.Name=1;local h=game.Players.LocalPlayer.Character["1"]:Clone()h.Parent=game.Players.LocalPlayer.Character;h.Name="Humanoid"wait(0.1)game.Players.LocalPlayer.Character["1"]:Destroy()workspace.CurrentCamera.CameraSubject=game.Players[n].Character;game.Players.LocalPlayer.Character.Animate.Disabled=true;wait(0.1)game.Players.LocalPlayer.Character.Animate.Disabled=false;game.Players.LocalPlayer.Character.Humanoid.DisplayDistanceType="None"wait(.20)local i="PaintBucket"for j,k in pairs(game:GetService("Players").LocalPlayer.Backpack:GetChildren())do if k:IsA("Tool")and k.Name==i then k.Parent=game:GetService("Players").LocalPlayer.Character end end;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[n].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[n].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[n].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[n].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[n].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[n].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[n].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[n].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[n].Character.HumanoidRootPart.CFrame;wait(1)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(-742.62884521484,64574.03125,393.12066650391)wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(-742.62884521484,64574.03125,393.12066650391)wait(5)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=yes end)end;wait(4)workspace.CurrentCamera.CameraSubject=game.Players.LocalPlayer.Character;game.Players.LocalPlayer.PlayerGui.MainGui.Menu.Backpack.Tools.Shortcut:Destroy()end)e:Box("Bring Player",function(o,p)if p and game.Players[o]then if game.Players[o].Character.Humanoid.Sit then game:GetService("StarterGui"):SetCore("SendNotification",{Title="Bring Player Script",Text="Failed Because Player is Sitting",Duration=5})return end;yes=game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame;pcall(function()local g={[1]="GiveItem",[2]=495886176}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))wait(.20)game.Players.LocalPlayer.Character.Humanoid.Name=1;local h=game.Players.LocalPlayer.Character["1"]:Clone()h.Parent=game.Players.LocalPlayer.Character;h.Name="Humanoid"wait(0.1)game.Players.LocalPlayer.Character["1"]:Destroy()workspace.CurrentCamera.CameraSubject=game.Players[o].Character;game.Players.LocalPlayer.Character.Animate.Disabled=true;wait(0.1)game.Players.LocalPlayer.Character.Animate.Disabled=false;game.Players.LocalPlayer.Character.Humanoid.DisplayDistanceType="None"wait(.20)local i="PaintBucket"for j,k in pairs(game:GetService("Players").LocalPlayer.Backpack:GetChildren())do if k:IsA("Tool")and k.Name==i then k.Parent=game:GetService("Players").LocalPlayer.Character end end;game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[o].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[o].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[o].Character.Head.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[o].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[o].Character.Head.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[o].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[o].Character.HumanoidRootPart.CFrame;wait(.05)wait(1)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=yes end)end;wait(5)game.Players.LocalPlayer.PlayerGui.MainGui.Menu.Backpack.Tools.Shortcut:Destroy()game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=yes end)e:Box("Kick Player",function(q,r)if r then if game.Players[q]then if game.Players[q].Character.Humanoid.Sit then game:GetService("StarterGui"):SetCore("SendNotification",{Title="Kick Player Script",Text="Failed Because Player is Sitting",Duration=5})return end;pcall(function()workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;yes=game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame;local g={[1]="GiveItem",[2]=495886176}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))wait(.20)game.Players.LocalPlayer.Character.Humanoid.Name=1;local h=game.Players.LocalPlayer.Character["1"]:Clone()h.Parent=game.Players.LocalPlayer.Character;h.Name="Humanoid"wait(0.1)game.Players.LocalPlayer.Character["1"]:Destroy()workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;game.Players.LocalPlayer.Character.Animate.Disabled=true;wait(0.1)game.Players.LocalPlayer.Character.Animate.Disabled=false;game.Players.LocalPlayer.Character.Humanoid.DisplayDistanceType="None"wait(.70)local i="PaintBucket"for j,k in pairs(game:GetService("Players").LocalPlayer.Backpack:GetChildren())do if k:IsA("Tool")and k.Name==i then k.Parent=game:GetService("Players").LocalPlayer.Character end end;game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.Head.CFrame;game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[q].Character.HumanoidRootPart.CFrame;wait(1)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(81.148887634277,-0.07208026945591,-286.22467041016)wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(80.7802,0.20001,-284.692)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(81.148887634277,-0.07208026945591,-286.22467041016)wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(80.7802,0.20001,-284.692)wait(.08)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(81.148887634277,-0.07208026945591,-286.22467041016)wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(80.7802,0.20001,-284.692)wait(1)game.Players.LocalPlayer.Character:Destroy()wait(4)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=yes end)end;wait(5)game.Players.LocalPlayer.PlayerGui.MainGui.Menu.Backpack.Tools.Shortcut:Destroy()if game.Players[q].Character~=nil then game:GetService("StarterGui"):SetCore("SendNotification",{Title="Kick Player Script",Text=game.Players[q].Name.." was died while kicking him, Try Kick him again",Duration=5})return end end end)e:Box("Make Manager",function(s,t)if t and game.Players[s]then if game.Players[s].Character.Humanoid.Sit then game:GetService("StarterGui"):SetCore("SendNotification",{Title="Make Manager Script",Text="Failed Because Target Player is Sitting",Duration=5})return end;local u=game:GetService("Teams").Manager:GetPlayers()[1]if u.Character.Humanoid.Sit then game:GetService("StarterGui"):SetCore("SendNotification",{Title="Make Manager Script",Text="You can't Make Player Manager because Current Manager is Sitting",Duration=5})return end;pcall(function()yes=game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame;workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;local g={[1]="GiveItem",[2]=495886176}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))game.Players.LocalPlayer.Character.Humanoid.Name=1;local h=game.Players.LocalPlayer.Character["1"]:Clone()h.Parent=game.Players.LocalPlayer.Character;h.Name="Humanoid"wait(0.1)game.Players.LocalPlayer.Character["1"]:Destroy()workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;game.Players.LocalPlayer.Character.Animate.Disabled=true;wait(0.1)game.Players.LocalPlayer.Character.Animate.Disabled=false;game.Players.LocalPlayer.Character.Humanoid.DisplayDistanceType="None"wait(.20)local i="PaintBucket"for j,k in pairs(game:GetService("Players").LocalPlayer.Backpack:GetChildren())do if k:IsA("Tool")and k.Name==i then k.Parent=game:GetService("Players").LocalPlayer.Character end end;game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(u.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(u.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(u.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(u.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(u.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(u.Character.HumanoidRootPart.Position)wait(.05)game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(u.Character.HumanoidRootPart.Position)wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(11.819767951965,1.1243584156036,21.870401382446)wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(11.819767951965,1.1243584156036,21.870401382446)wait(1)game.Players.LocalPlayer.Character:Destroy()wait(4)workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;game.Players.LocalPlayer.PlayerGui.MainGui.Menu.Backpack.Tools.Shortcut:Destroy()local g={[1]="GiveItem",[2]=495886176}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))wait(.20)game.Players.LocalPlayer.Character.Humanoid.Name=1;local h=game.Players.LocalPlayer.Character["1"]:Clone()h.Parent=game.Players.LocalPlayer.Character;h.Name="Humanoid"wait(0.1)game.Players.LocalPlayer.Character["1"]:Destroy()workspace.CurrentCamera.CameraSubject=game.Workspace.Street2;game.Players.LocalPlayer.Character.Animate.Disabled=true;wait(0.1)game.Players.LocalPlayer.Character.Animate.Disabled=false;game.Players.LocalPlayer.Character.Humanoid.DisplayDistanceType="None"wait(.20)local i="PaintBucket"for j,k in pairs(game:GetService("Players").LocalPlayer.Backpack:GetChildren())do if k:IsA("Tool")and k.Name==i then k.Parent=game:GetService("Players").LocalPlayer.Character end end;game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[s].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[s].Character.HumanoidRootPart.CFrame;wait(.05)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[s].Character.HumanoidRootPart.CFrame;wait(.10)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=game.Players[s].Character.HumanoidRootPart.CFrame;workspace.ManagerChair.Seat.CFrame=CFrame.new(2300.7,2.59944,6.5)wait(1)for j=1,100 do game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(23.7,2.59944,6.5)end;wait(5)game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=yes;wait(2)workspace.ManagerChair.Seat.CFrame=CFrame.new(23.7,2.59944,6.5)end)end;wait(4)game.Players.LocalPlayer.PlayerGui.MainGui.Menu.Backpack.Tools.Shortcut:Destroy()end)e:Toggle("Sit All Players",false,function(v)if not game.JointsService:FindFirstChild("Tot Slide")then workspace.MessageService.Dialog.Dialog:Fire("Script Warning","You Need Have ''Tot Slide'' In Your House, Costs 380 Coin, ReExecute Script after you Put It","ok","",true,true)else getgenv().trinbbbbbkets=v;while true do wait(.60)if getgenv().trinbbbbbkets then pcall(function()for j,w in pairs(game.Players:GetPlayers())do for j,k in pairs(game:GetService("JointsService"):GetDescendants())do if k:IsA("RemoteEvent")and k.Name=="TouchEvent"or k.Parent=="Tot Slide"then k:FireServer(w.Character.HumanoidRootPart,game:GetService("JointsService")["Tot Slide"].Trip)for j,x in pairs(game.Workspace.Customers:GetChildren())do k:FireServer(x:FindFirstChildOfClass("Humanoid"),game:GetService("JointsService")["Tot Slide"].Trip)end end end end end)end end end end)e:Toggle("Anti-Oven Fire",false,function(y)getgenv().heee=y;while true do wait(.40)if getgenv().heee then pcall(function()for j,k in pairs(game.Players:GetPlayers())do local g={[1]=k.Character.UpperTorso}workspace.GameService.ExtinguishFire:FireServer(unpack(g))for j,k in pairs(game.Workspace.AllDough:GetChildren())do local g={[1]=k}workspace.GameService.ExtinguishFire:FireServer(unpack(g))end end end)end end end)e:Toggle("Break Leaderboard",false,function(z)getgenv().nnnnnnnnnnnn=z;while true do wait()if getgenv().nnnnnnnnnnnn then pcall(function()game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Cashier")game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Cook")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Delivery")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Supplier")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","On Break")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Cashier")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Cook")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Delivery")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Supplier")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","On Break")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Cook")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Delivery")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Cook")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Delivery")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Cashier")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Supplier")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","On Break")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Cook")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Delivery")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Supplier")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","On Break")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Cook")wait(.02)game:GetService("ReplicatedStorage").PlayerChannel:FireServer("ChangeJob","Delivery")game.Players.LocalPlayer.Character.Pants:Destroy()game.Players.LocalPlayer.Character.Shirt:Destroy()end)end end end)e:Label("UnAnchor Commands",Color3.fromRGB(127,143,166))e:Toggle("UnAnchor Trees",false,function(A)getgenv().nhekee=A;while true do wait(.50)if getgenv().nhekee then pcall(function()for j,k in pairs(game.Workspace.Trees:GetDescendants())do if k.Name=="Tree"or k.Name=="DeadTree"then workspace.Main.UprootTree:FireServer(k)end end end)end end end)e:Toggle("UnAnchor Mailboxes",false,function(B)getgenv().hekee=B;while true do wait(1)if getgenv().hekee then pcall(function()for j,k in pairs(game.Workspace.Houses:GetDescendants())do if k.Name=="Mailbox"and k.Parent:IsA("Model")then local g={[1]=k.Parent}workspace.Main.KnockMailbox:FireServer(unpack(g))end end end)end end end)c:Button("Clown Head",function()local g={[1]="LoadAvatarAsset",[2]=4272833564,[3]="HatAccessory"}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))end)c:Button("Amogus Head",function()local g={[1]="LoadAvatarAsset",[2]=6532372710,[3]="HatAccessory"}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))end)c:Button("Sus Head",function()local g={[1]="LoadAvatarAsset",[2]=6564572490,[3]="HatAccessory"}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))end)c:Button("Smile1 Head",function()local g={[1]="LoadAvatarAsset",[2]=6711806832,[3]="HatAccessory"}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))end)c:Button("Smile2 Head",function()local g={[1]="LoadAvatarAsset",[2]=6809319263,[3]="HatAccessory"}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))end)c:Button("1 Eye Head",function()local g={[1]="LoadAvatarAsset",[2]=6773734422,[3]="HatAccessory"}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))end)c:Box("Custom Hat",function(C,D)if D then local g={[1]="LoadAvatarAsset",[2]=tonumber(C),[3]="HatAccessory"}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))end end)c:Button("Reset Outfit",function()local g={[1]="ResetAvatarAppearance",[2]=true}game:GetService("ReplicatedStorage").PlayerChannel:FireServer(unpack(g))end)c:Slider("Walkspeed",16,120,5,function(E)game:GetService("Players").LocalPlayer.Character.Humanoid.WalkSpeed=E end)c:Slider("JumpPower",50,300,20,function(E)game:GetService("Players").LocalPlayer.Character.Humanoid.JumpPower=E end)e:Button("Bring Trees Mailboxes",function()if getgenv().nhekee or getgenv().hekee then local F={}local G={}for H,I in pairs(workspace:GetDescendants())do if game.Players.LocalPlayer.Character:FindFirstChild('Head')and I:IsA("BasePart"or"UnionOperation"or"Model")and I.Anchored==false and not I:IsDescendantOf(game.Players.LocalPlayer.Character)and I.Name=="Torso"==false and I.Name=="Head"==false and I.Name=="Right Arm"==false and I.Name=="Left Arm"==false and I.Name=="Right Leg"==false and I.Name=="Left Leg"==false and I.Name=="HumanoidRootPart"==false then for j,w in pairs(I:GetChildren())do if w:IsA("BodyPosition")or w:IsA("BodyGyro")then w:Destroy()end end;local J=Instance.new("BodyPosition")J.Parent=I;J.MaxForce=Vector3.new(math.huge,math.huge,math.huge)table.insert(F,J)if not table.find(G,I)then table.insert(G,I)end end end;for j,w in pairs(F)do w.Position=game.Players.LocalPlayer.Character.Head.Position end;wait(1)for j,k in pairs(G)do for j,w in pairs(k:GetChildren())do if w:IsA("BodyPosition")or w:IsA("BodyGyro")then w:Destroy()end end end;G={}else workspace.MessageService.Dialog.Dialog:Fire("Bring Script Warning","Enable UnAnchor Trees and UnAnchor Mailboxes","ok","",true,true)end end)c:Toggle("Noclip",false,function(K)getgenv().trfffffinketcs=K;game:GetService("RunService").RenderStepped:Connect(function()if getgenv().trfffffinketcs then game.Players.LocalPlayer.Character.Humanoid:ChangeState(11)end end)end)c:Button("Rejoin Server",function()game:GetService("TeleportService"):Teleport(game.PlaceId)end)c:Button("Reset Character",function()game.Players.LocalPlayer.Character:Remove()end)b:Label("UnAnchored Fun Script",Color3.fromRGB(127,143,166))b:Button("0 Gravity Unanchored Things",function()spawn(function()while true do game.Players.LocalPlayer.MaximumSimulationRadius=math.pow(math.huge,math.huge)*math.huge;game.Players.LocalPlayer.SimulationRadius=math.pow(math.huge,math.huge)*math.huge;game:GetService("RunService").Stepped:wait()end end)local function L(I)if I:FindFirstChild("BodyForce")then return end;local M=Instance.new("BodyForce")M.Force=I:GetMass()*Vector3.new(0,workspace.Gravity,0)M.Parent=I end;for j,k in ipairs(workspace:GetDescendants())do if k:IsA("Part")and k.Anchored==false then if not k:IsDescendantOf(game.Players.LocalPlayer.Character)then L(k)end end end;workspace.DescendantAdded:Connect(function(I)if I:IsA("Part")and I.Anchored==false then if not I:IsDescendantOf(game.Players.LocalPlayer.Character)then L(I)end end end)end)b:Button("Spin Teleport Unanchored [E]",function()local N=game:GetService("UserInputService")local O=game:GetService("Players").LocalPlayer:GetMouse()local P=Instance.new("Folder",game:GetService("Workspace"))local Q=Instance.new("Part",P)local R=Instance.new("Attachment",Q)Q.Anchored=true;Q.CanCollide=false;Q.Transparency=1;local S=O.Hit+Vector3.new(0,5,0)local T=coroutine.create(function()settings().Physics.AllowSleep=false;while game:GetService("RunService").RenderStepped:Wait()do for H,U in next,game:GetService("Players"):GetPlayers()do if U~=game:GetService("Players").LocalPlayer then U.MaximumSimulationRadius=0;sethiddenproperty(U,"SimulationRadius",0)end end;game:GetService("Players").LocalPlayer.MaximumSimulationRadius=math.pow(math.huge,math.huge)setsimulationradius(math.huge)end end)coroutine.resume(T)local function V(k)if k:IsA("Part")and k.Anchored==false and k.Parent:FindFirstChild("Humanoid")==nil and k.Parent:FindFirstChild("Head")==nil and k.Name~="Handle"then O.TargetFilter=k;for H,W in next,k:GetChildren()do if W:IsA("BodyAngularVelocity")or W:IsA("BodyForce")or W:IsA("BodyGyro")or W:IsA("BodyPosition")or W:IsA("BodyThrust")or W:IsA("BodyVelocity")or W:IsA("RocketPropulsion")then W:Destroy()end end;if k:FindFirstChild("Attachment")then k:FindFirstChild("Attachment"):Destroy()end;if k:FindFirstChild("AlignPosition")then k:FindFirstChild("AlignPosition"):Destroy()end;if k:FindFirstChild("Torque")then k:FindFirstChild("Torque"):Destroy()end;k.CanCollide=false;local X=Instance.new("Torque",k)X.Torque=Vector3.new(100000,100000,100000)local Y=Instance.new("AlignPosition",k)local Z=Instance.new("Attachment",k)X.Attachment0=Z;Y.MaxForce=9999999999999999;Y.MaxVelocity=math.huge;Y.Responsiveness=200;Y.Attachment0=Z;Y.Attachment1=R end end;for H,k in next,game:GetService("Workspace"):GetDescendants()do V(k)end;game:GetService("Workspace").DescendantAdded:Connect(function(k)V(k)end)N.InputBegan:Connect(function(_,a0)if _.KeyCode==Enum.KeyCode.E and not a0 then S=O.Hit+Vector3.new(0,5,0)end end)spawn(function()while game:GetService("RunService").RenderStepped:Wait()do R.WorldCFrame=S end end)end)b:Label("Server-Side 1",Color3.fromRGB(127,143,166))b:Box("FE Play Song",function(a1,a2)if a2 then getgenv().audioId=a1;getgenv().soundVolume=10;local a3=game:GetService("Players").LocalPlayer.PlayerGui.MainGui.Menu.Emotions;local a4=game:GetService("Players").LocalPlayer.PlayerGui.MainGui.Menu.Emotions.ScrollingFrame.List;local a5=game:GetService("Players").LocalPlayer.PlayerGui.MainGui.Menu.Emotions.ScrollingFrame.List.Template;local a6={["Name"]='Clap',["GroupColor"]='Bright blue'}local a7={["Sleep"]={["SoundLooped"]=true,["R15"]=4308418502,["FaceId"]=66329905,["Object"]='Sleep',["Name"]='Sleep',["R6"]=868450390,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["Volume"]=soundVolume,["MovementCancel"]=true},["Bye"]={["Name"]='Bye',["R6"]=154179312,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308390587,["Object"]='Bye'},["Point"]={["Name"]='Point',["R6"]=154188723,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308408568,["Object"]='Point'},["Bathtub"]={["Name"]='Bathtub',["R6"]=1799552363,["Priority"]='Enum.AnimationPriority.Core',["R15"]=1794938782,["Object"]='Bathtub'},["Glee"]={["Object"]='Glee',["Name"]='Glee',["FaceId"]=27802003,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308399012,["R6"]=154159852},["Coffin"]={["Name"]='Coffin',["MovementCancel"]=true,["R15"]=2506115448,["Priority"]='Enum.AnimationPriority.Action',["Object"]='Coffin',["R6"]=2506141081},["Twist"]={["Name"]='Twist',["MovementCancel"]=true,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308333353,["Object"]='Twist'},["ToolHold"]={["Name"]='ToolHold',["R6"]=182393478,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308323620,["Object"]='ToolHold'},["Confused"]={["Object"]='Confused',["Name"]='Confused',["FaceId"]=120250454,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308393154,["R6"]=154183110},["DrinkSmoothie"]={["Object"]='DrinkSmoothie',["Priority"]='Enum.AnimationPriority.Action',["Name"]='DrinkSmoothie',["R15"]=3339779154},["DrinkCoffee"]={["Object"]='DrinkCoffee',["Priority"]='Enum.AnimationPriority.Action',["Name"]='DrinkCoffee',["R15"]=3339576493},["Shocked"]={["Object"]='Shocked',["Name"]='Shocked',["FaceId"]=1601874588,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=1602091152,["R6"]=1620310558},["Laugh"]={["Object"]='Laugh',["Name"]='Laugh',["FaceId"]=32063242,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308402710,["R6"]=154166518},["Idle"]={["Name"]='Idle',["Weight"]=0.4,["R15"]=507766388,["Priority"]='Enum.AnimationPriority.Core',["Object"]='Idle',["R6"]=180435571},["Jump"]={["Name"]='Jump',["Weight"]=0.7,["R15"]=507765000,["Priority"]='Enum.AnimationPriority.Core',["Object"]='Jump',["R6"]=125750702},["Sad"]={["Object"]='Sad',["Name"]='Sad',["FaceId"]=76690153,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308410706,["R6"]=153230853},["Run"]={["Name"]='Run',["Weight"]=1,["R15"]=507767714,["Priority"]='Enum.AnimationPriority.Core',["Object"]='Run',["R6"]=180426354},["Swim"]={["Name"]='Swim',["R6"]=865902879,["Priority"]='Enum.AnimationPriority.Core',["R15"]=507784897,["Object"]='Swim'},["SwimIdle"]={["Name"]='SwimIdle',["Weight"]=0.5,["R15"]=507785072,["Priority"]='Enum.AnimationPriority.Core',["Object"]='SwimIdle',["R6"]=865918502},["ConfusionOrb"]={["Name"]='ConfusionOrb',["R6"]=866550588,["Priority"]='Enum.AnimationPriority.Action',["R15"]=866541157,["Object"]='ConfusionOrb'},["Punch"]={["Name"]='Punch',["R6"]=3175899997,["Priority"]='Enum.AnimationPriority.Action',["R15"]=3175791062,["Object"]='Punch'},["Amazed"]={["Object"]='Amazed',["Name"]='Amazed',["FaceId"]=45528113,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=154174346,["R6"]=154174346},["Walk"]={["Name"]='Walk',["Weight"]=0.6,["R15"]=507777826,["Priority"]='Enum.AnimationPriority.Core',["Object"]='Walk',["R6"]=180426354},["Swing"]={["Name"]='Swing',["MovementCancel"]=true,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308330448,["Object"]='Swing'},["Shuffle"]={["Name"]='Shuffle',["MovementCancel"]=true,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308343244,["Object"]='Shuffle'},["Whistle"]={["Object"]='Whistle',["Name"]='Whistle',["Weight"]=0.4,["R15"]=4308430737,["Priority"]='Enum.AnimationPriority.Action',["R6"]=180435571,["FaceId"]=22877631},["Cheer"]={["Object"]='Cheer',["Name"]='Cheer',["FaceId"]=27802003,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=507770677,["R6"]=129423030},["Evil"]={["Object"]='Evil',["Name"]='Evil',["FaceId"]=1604383339,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308438228,["R6"]=1620296629},["HipHop"]={["Name"]='HipHop',["MovementCancel"]=true,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308346808,["Object"]='HipHop'},["Dance2"]={["Name"]='Dance2',["MovementCancel"]=true,["R15"]=507776043,["Priority"]='Enum.AnimationPriority.Action',["Object"]='Dance2',["R6"]=182436842},["Dance3"]={["Name"]='Dance3',["MovementCancel"]=true,["R15"]=507777268,["Priority"]='Enum.AnimationPriority.Action',["Object"]='Dance3',["R6"]=182436935},["SitSeat"]={["Name"]='SitSeat',["Weight"]=0.99,["R15"]=2506281703,["Priority"]='Enum.AnimationPriority.Core',["Object"]='SitSeat',["R6"]=178130996},["Think"]={["Object"]='Think',["Name"]='Think',["FaceId"]=209715003,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308415882,["R6"]=154185274},["Wave"]={["Name"]='Wave',["R6"]=128777973,["Priority"]='Enum.AnimationPriority.Action',["R15"]=507770239,["Object"]='Wave'},["Eat"]={["Object"]='Eat',["Priority"]='Enum.AnimationPriority.Action',["Name"]='Eat',["R15"]=3343204532},["Fall"]={["Name"]='Fall',["Weight"]=0.7,["R15"]=507767968,["Priority"]='Enum.AnimationPriority.Core',["Object"]='Fall',["R6"]=180436148},["ThrowCoin"]={["Name"]='ThrowCoin',["R6"]=156055482,["Priority"]='Enum.AnimationPriority.Action',["R15"]=867194400,["Object"]='ThrowCoin'},["Easy"]={["Name"]='Easy',["MovementCancel"]=true,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308337079,["Object"]='Easy'},["Driving"]={["Name"]='Driving',["Weight"]=0.99,["R15"]=866020346,["Priority"]='Enum.AnimationPriority.Core',["Object"]='Driving',["R6"]=178130996},["Sit"]={["Name"]='Sit',["MovementCancel"]=true,["R15"]=4308421826,["Priority"]='Enum.AnimationPriority.Action',["Object"]='Sit',["R6"]=868508890},["SleepSeat"]={["SoundLooped"]=true,["R15"]=4308318405,["FaceId"]=66329905,["Object"]='SleepSeat',["Name"]='SleepSeat',["R6"]=869468579,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["Volume"]=soundVolume,["MovementCancel"]=true},["Marashin"]={["Name"]='Marashin',["MovementCancel"]=true,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308362239,["Object"]='Marashin'},["Scared"]={["Object"]='Scared',["Name"]='Scared',["FaceId"]=47206380,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308413393,["R6"]=154170755},["Clap"]={["Name"]='Clap',["R6"]=868730451,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308424082,["Object"]='Clap'},["HipHop2"]={["Name"]='HipHop2',["MovementCancel"]=true,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308356261,["Object"]='HipHop2'},["Die"]={["Object"]='Die',["R15"]=4308443969,["Name"]='Die',["MovementCancel"]=true,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R6"]=1620270981,["FaceId"]=1604616024},["Disgust"]={["Object"]='Disgust',["Name"]='Disgust',["FaceId"]=1598203828,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308435046,["R6"]=1620305485},["Hi"]={["Name"]='Hi',["R6"]=154179312,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308390587,["Object"]='Hi'},["Flair"]={["Name"]='Flair',["MovementCancel"]=true,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308358633,["Object"]='Flair'},["Dance"]={["Name"]='Dance',["MovementCancel"]=true,["R15"]=507771019,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["Object"]='Dance',["R6"]=182435998},["Climb"]={["Name"]='Climb',["R6"]=180436334,["Priority"]='Enum.AnimationPriority.Core',["R15"]=507765644,["Object"]='Climb'},["WashHands"]={["Name"]='WashHands',["R6"]=1620296629,["Priority"]='Enum.AnimationPriority.Action',["R15"]=1799726387,["Object"]='WashHands'},["ScaredOpeingPumpkin"]={["Object"]='ScaredOpeingPumpkin',["Name"]='ScaredOpeingPumpkin',["FaceId"]=47206380,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Idle',["R15"]=867226524,["R6"]=154170755},["Angry"]={["Object"]='Angry',["Name"]='Angry',["FaceId"]=14020216,["SoundId"]=audioId,["Priority"]='Enum.AnimationPriority.Action',["R15"]=4308387518,["R6"]=154168543}}local a8=game:GetService("Workspace").Main.LoadSoundsIntoHead;for a9,aa in pairs(game:service'Players'.LocalPlayer.Character.Head:GetChildren())do if aa:IsA'Sound'then aa:Destroy()end end;a8:FireServer(a7)wait(.75)game:GetService("Players").LocalPlayer.PlayerGui.UIEvents.ListItemPressed:Fire(a3,a4,a5,a6)end end)b:Toggle("FE Spam Sounds",false,function(ab)getgenv().hit=ab;while wait()do if getgenv().hit then for j,k in pairs(game.Workspace:GetDescendants())do if k:IsA("Sound")then k:Play()end end end end end)b:Toggle("Spam Boxes",false,function(ac)getgenv().trin1eeeeeekets=ac;while true do wait(.20)if getgenv().trin1eeeeeekets then pcall(function()for H,k in pairs(workspace.SupplyButtons:GetDescendants())do if k:IsA("TouchTransmitter")then firetouchinterest(game.Players.LocalPlayer.Character.HumanoidRootPart,k.Parent,0)wait()firetouchinterest(game.Players.LocalPlayer.Character.HumanoidRootPart,k.Parent,1)end end end)end end end)b:Label("Auto Farm",Color3.fromRGB(127,143,166))b:Button("Autofarm Gui",function()loadstring(game:HttpGet("https://gist.githubusercontent.com/TurkOyuncu99/9b9d62e9068d795f708c51551d439d21/raw/84a28a8d1fc501b9d200e8a2bd7cc831df0fbacf/gistfile1.txt",true))()end)d:Label("Teleport Area",Color3.fromRGB(127,143,166))d:Button("Starting Zone",function()game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(49,3,198)end)d:Button("Cashier Area",function()game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(48,4,80)end)d:Button("Cook Area",function()game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(42,4,61)end)d:Button("Boxer Area",function()game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(55,4,31)end)d:Button("Supplier Area",function()game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(8,13,-1020)end)d:Button("Delivery Area",function()game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(64,4,-17)end)d:Button("Manager Area",function()game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(23.7,2.59944,6.5)end)d:Box("Goto Player",function(ad,ae)if ae and game.Players[ad]then game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame=CFrame.new(game.Players[ad].Character.HumanoidRootPart.Position)end end)b:Button("Anti Vote Kick",function()game:GetService("RunService").Heartbeat:Connect(function()if game.Players.LocalPlayer.PlayerGui.MainGui.Prompts.Ban.KickPlayer.Text==game.Players.LocalPlayer.Name then game:GetService("TeleportService"):Teleport(game.PlaceId)end end)end)a:Keybind("Tab")pcall(function()for j,k in pairs(game:GetDescendants())do if k:IsA("Model")and k.Name=="Tot Slide"and k:FindFirstChildWhichIsA"RemoteEvent"then k.Parent=game.JointsService end end;workspace.MessageService.Dialog.Dialog:Fire("Important","Made By ameicaa","ok","",true,true)game.Workspace["Teleport to Party Island"]:Destroy()game.ReplicatedStorage.LibraryFolder.ErrorLoggerLocal:Destroy()game.Workspace.Main.DataStoreError:Destroy()game.Workspace.Main.RecordLocalError:Destroy()game:GetService("RunService").RenderStepped:Connect(function()game.Players.LocalPlayer.PlayerGui.MainGui.Other.PaintBucketColorPicker.Visible=false;game.Players.LocalPlayer.PlayerGui.MainGui.Notifications.PaintBucketHelp.Visible=false;game.Players.LocalPlayer.PlayerGui.MainGui.Notifications.DoubleTime.Visible=false end)while wait(20)do for j,k in pairs(game:GetService("Players"):GetChildren())do if k.Name~=game:GetService("Players").LocalPlayer.Name and k.DisplayName~=k.Name then k.Name=k.DisplayName end end end end)
|
data:extend(
{
{
type = "recipe",
name = "pneumatic-tube",
enabled = true,
ingredients =
{
{"copper-plate", 2},
{"iron-gear-wheel", 3}
},
result = "pneumatic-tube",
result_count = 2,
requester_paste_multiplier = 4
}
}
)
|
local path = string.sub(..., 1, string.len(...) - string.len(".row"))
local layout = require(path..'.layout')
---@class Row
local row = {}
row.__index = row
---@return layout
function row.new()
local self = setmetatable({}, row)
return layout(self, self.draw)
end
function row:draw(x, y, width, height, children, hpad, vpad, alignX)
local carriagePos = 0
if children then
for i, e in ipairs(children) do
local w, _ = e:getSize()
e:draw(x+carriagePos, y+vpad)
carriagePos = carriagePos + w + hpad
end
end
end
return row
|
-- Some helpers around löve functions.
local LG = love.graphics
-- rotates the scene around the given x,y point.
local function rotateAround(x, y, angle)
if angle and angle ~= 0 then
LG.translate(x, y)
LG.rotate(angle)
LG.translate(-x, -y)
end
end
-- scale around the given x,y point.
local function scaleAround(x, y, scale)
if scale and scale ~= 1 then
LG.translate(x, y)
LG.scale(scale)
LG.translate(-x, -y)
end
end
-- this prints a text on the y coordinate centered across the screen.
-- for some reason I cannot get the same results with love.graphics.printf
local function printCenter(text, y)
local f = LG.getFont()
local x = ( SCREEN_WIDTH - f:getWidth(text) ) / 2
local offset = f:getWidth("X") / 10
local r, g, b, a = love.graphics.getColor()
LG.setColor(0, 0, 0)
LG.print(text, x + offset, y + offset)
LG.setColor(r, g, b, a)
LG.print(text, x, y)
end
return {
rotateAround = rotateAround,
scaleAround = scaleAround,
printCenter = printCenter,
}
|
-- code128-encode.lua by ywnico
-- Code 128 encoding following https://en.wikipedia.org/wiki/Code_128
local patterns = {
[0] = {1,1,0,1,1,0,0,1,1,0,0},
[1] = {1,1,0,0,1,1,0,1,1,0,0},
[2] = {1,1,0,0,1,1,0,0,1,1,0},
[3] = {1,0,0,1,0,0,1,1,0,0,0},
[4] = {1,0,0,1,0,0,0,1,1,0,0},
[5] = {1,0,0,0,1,0,0,1,1,0,0},
[6] = {1,0,0,1,1,0,0,1,0,0,0},
[7] = {1,0,0,1,1,0,0,0,1,0,0},
[8] = {1,0,0,0,1,1,0,0,1,0,0},
[9] = {1,1,0,0,1,0,0,1,0,0,0},
[10] = {1,1,0,0,1,0,0,0,1,0,0},
[11] = {1,1,0,0,0,1,0,0,1,0,0},
[12] = {1,0,1,1,0,0,1,1,1,0,0},
[13] = {1,0,0,1,1,0,1,1,1,0,0},
[14] = {1,0,0,1,1,0,0,1,1,1,0},
[15] = {1,0,1,1,1,0,0,1,1,0,0},
[16] = {1,0,0,1,1,1,0,1,1,0,0},
[17] = {1,0,0,1,1,1,0,0,1,1,0},
[18] = {1,1,0,0,1,1,1,0,0,1,0},
[19] = {1,1,0,0,1,0,1,1,1,0,0},
[20] = {1,1,0,0,1,0,0,1,1,1,0},
[21] = {1,1,0,1,1,1,0,0,1,0,0},
[22] = {1,1,0,0,1,1,1,0,1,0,0},
[23] = {1,1,1,0,1,1,0,1,1,1,0},
[24] = {1,1,1,0,1,0,0,1,1,0,0},
[25] = {1,1,1,0,0,1,0,1,1,0,0},
[26] = {1,1,1,0,0,1,0,0,1,1,0},
[27] = {1,1,1,0,1,1,0,0,1,0,0},
[28] = {1,1,1,0,0,1,1,0,1,0,0},
[29] = {1,1,1,0,0,1,1,0,0,1,0},
[30] = {1,1,0,1,1,0,1,1,0,0,0},
[31] = {1,1,0,1,1,0,0,0,1,1,0},
[32] = {1,1,0,0,0,1,1,0,1,1,0},
[33] = {1,0,1,0,0,0,1,1,0,0,0},
[34] = {1,0,0,0,1,0,1,1,0,0,0},
[35] = {1,0,0,0,1,0,0,0,1,1,0},
[36] = {1,0,1,1,0,0,0,1,0,0,0},
[37] = {1,0,0,0,1,1,0,1,0,0,0},
[38] = {1,0,0,0,1,1,0,0,0,1,0},
[39] = {1,1,0,1,0,0,0,1,0,0,0},
[40] = {1,1,0,0,0,1,0,1,0,0,0},
[41] = {1,1,0,0,0,1,0,0,0,1,0},
[42] = {1,0,1,1,0,1,1,1,0,0,0},
[43] = {1,0,1,1,0,0,0,1,1,1,0},
[44] = {1,0,0,0,1,1,0,1,1,1,0},
[45] = {1,0,1,1,1,0,1,1,0,0,0},
[46] = {1,0,1,1,1,0,0,0,1,1,0},
[47] = {1,0,0,0,1,1,1,0,1,1,0},
[48] = {1,1,1,0,1,1,1,0,1,1,0},
[49] = {1,1,0,1,0,0,0,1,1,1,0},
[50] = {1,1,0,0,0,1,0,1,1,1,0},
[51] = {1,1,0,1,1,1,0,1,0,0,0},
[52] = {1,1,0,1,1,1,0,0,0,1,0},
[53] = {1,1,0,1,1,1,0,1,1,1,0},
[54] = {1,1,1,0,1,0,1,1,0,0,0},
[55] = {1,1,1,0,1,0,0,0,1,1,0},
[56] = {1,1,1,0,0,0,1,0,1,1,0},
[57] = {1,1,1,0,1,1,0,1,0,0,0},
[58] = {1,1,1,0,1,1,0,0,0,1,0},
[59] = {1,1,1,0,0,0,1,1,0,1,0},
[60] = {1,1,1,0,1,1,1,1,0,1,0},
[61] = {1,1,0,0,1,0,0,0,0,1,0},
[62] = {1,1,1,1,0,0,0,1,0,1,0},
[63] = {1,0,1,0,0,1,1,0,0,0,0},
[64] = {1,0,1,0,0,0,0,1,1,0,0},
[65] = {1,0,0,1,0,1,1,0,0,0,0},
[66] = {1,0,0,1,0,0,0,0,1,1,0},
[67] = {1,0,0,0,0,1,0,1,1,0,0},
[68] = {1,0,0,0,0,1,0,0,1,1,0},
[69] = {1,0,1,1,0,0,1,0,0,0,0},
[70] = {1,0,1,1,0,0,0,0,1,0,0},
[71] = {1,0,0,1,1,0,1,0,0,0,0},
[72] = {1,0,0,1,1,0,0,0,0,1,0},
[73] = {1,0,0,0,0,1,1,0,1,0,0},
[74] = {1,0,0,0,0,1,1,0,0,1,0},
[75] = {1,1,0,0,0,0,1,0,0,1,0},
[76] = {1,1,0,0,1,0,1,0,0,0,0},
[77] = {1,1,1,1,0,1,1,1,0,1,0},
[78] = {1,1,0,0,0,0,1,0,1,0,0},
[79] = {1,0,0,0,1,1,1,1,0,1,0},
[80] = {1,0,1,0,0,1,1,1,1,0,0},
[81] = {1,0,0,1,0,1,1,1,1,0,0},
[82] = {1,0,0,1,0,0,1,1,1,1,0},
[83] = {1,0,1,1,1,1,0,0,1,0,0},
[84] = {1,0,0,1,1,1,1,0,1,0,0},
[85] = {1,0,0,1,1,1,1,0,0,1,0},
[86] = {1,1,1,1,0,1,0,0,1,0,0},
[87] = {1,1,1,1,0,0,1,0,1,0,0},
[88] = {1,1,1,1,0,0,1,0,0,1,0},
[89] = {1,1,0,1,1,0,1,1,1,1,0},
[90] = {1,1,0,1,1,1,1,0,1,1,0},
[91] = {1,1,1,1,0,1,1,0,1,1,0},
[92] = {1,0,1,0,1,1,1,1,0,0,0},
[93] = {1,0,1,0,0,0,1,1,1,1,0},
[94] = {1,0,0,0,1,0,1,1,1,1,0},
[95] = {1,0,1,1,1,1,0,1,0,0,0},
[96] = {1,0,1,1,1,1,0,0,0,1,0},
[97] = {1,1,1,1,0,1,0,1,0,0,0},
[98] = {1,1,1,1,0,1,0,0,0,1,0},
[99] = {1,0,1,1,1,0,1,1,1,1,0},
[100] = {1,0,1,1,1,1,0,1,1,1,0},
[101] = {1,1,1,0,1,0,1,1,1,1,0},
[102] = {1,1,1,1,0,1,0,1,1,1,0},
[103] = {1,1,0,1,0,0,0,0,1,0,0},
[104] = {1,1,0,1,0,0,1,0,0,0,0},
[105] = {1,1,0,1,0,0,1,1,1,0,0},
[106] = {1,1,0,0,0,1,1,1,0,1,0,1,1},
["QUIET"] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
}
-- https://stackoverflow.com/a/29177437
local function concatTables(t1, t2)
for _,v in ipairs(t2) do
table.insert(t1, v)
end
return t1
end
-- test if input string is ISO/IEC 8859-1 aka Latin-1
function isStringLatin1(str)
if pcall(utf8ToLatin1, str) then
return true
else
return false
end
end
-- convert string to ISO/IEC 8859-1 aka Latin-1
-- from http://lua-users.org/lists/lua-l/2015-02/msg00170.html
function utf8ToLatin1(s)
local r = ''
for _, c in utf8.codes(s) do
r = r .. string.char(c)
end
return r
end
-- Code A
-- ASCII value or special code -> numeric value of pattern
local function codeAGetval(var)
if type(var) == "number" then
if (var >= 32) and (var <= 95) then
return var - 32
elseif (var >= 0) and (var <= 31) then
return var + 64
end
elseif type(var) == "string" then
if var == "FNC3" then return 96
elseif var == "FNC2" then return 97
elseif var == "SHIFTB" then return 98
elseif var == "CODEC" then return 99
elseif var == "CODEB" then return 100
elseif var == "FNC4" then return 101
elseif var == "FNC1" then return 102
elseif var == "STARTA" then return 103
elseif var == "STARTB" then return 104
elseif var == "STARTC" then return 105
elseif var == "STOP" then return 106
end
end
assert(false) -- invalid input
end
-- Code B
-- ASCII value or special code -> numeric value of pattern
local function codeBGetval(var)
if type(var) == "number" then
if (var >= 32) and (var <= 127) then
return var - 32
end
elseif type(var) == "string" then
if var == "FNC3" then return 96
elseif var == "FNC2" then return 97
elseif var == "SHIFTA" then return 98
elseif var == "CODEC" then return 99
elseif var == "FNC4" then return 100
elseif var == "CODEA" then return 101
elseif var == "FNC1" then return 102
elseif var == "STARTA" then return 103
elseif var == "STARTB" then return 104
elseif var == "STARTC" then return 105
elseif var == "STOP" then return 106
end
end
print(var)
assert(false) -- invalid input
end
-- Code C
-- numeric (NOT ASCII!) value or special code -> numeric value of pattern
local function codeCGetval(var)
if type(var) == "number" then
if (var >= 0) and (var <= 99) then
return var
end
elseif type(var) == "string" then
if var == "CODEB" then return 100
elseif var == "CODEA" then return 101
elseif var == "FNC1" then return 102
elseif var == "STARTA" then return 103
elseif var == "STARTB" then return 104
elseif var == "STARTC" then return 105
elseif var == "STOP" then return 106
end
end
assert(false) -- invalid input
end
local function codeABGetval(code, var)
if code == "A" then
return codeAGetval(var)
elseif code == "B" then
return codeBGetval(var)
else
assert(false)
end
end
local function codeABCGetval(code, var)
assert(type(var) == "string")
if code == "A" then
return codeAGetval(var)
elseif code == "B" then
return codeBGetval(var)
elseif code == "C" then
return codeCGetval(var)
else
assert(false)
end
end
local function getChecksum(vals)
local checksum = vals[1]
for pos = 1,(#vals-1) do
checksum = checksum + pos*vals[pos+1]
end
checksum = checksum % 103
return checksum
end
-- [quiet zone] [start code] [data] [checksum] [stop code] [quiet zone]
-- default to B, unless A is necessary
-- use C for 4+ digits at start/end, or 6+ digits in middle
-- Ideally we would use double FNC4 for 4+ 128-255 characters, but we're not
-- going to be that efficient. Instead, we'll do FNC4 before every high char.
-- It seems like there should rarely be 4 high values in a row.
local function code128EncodeVals(str)
-- rewrite str as a list of bytes
local str_latin = utf8ToLatin1(str)
local str_bytes = {}
for j = 1,#str_latin do
str_bytes[j] = string.byte(str_latin, j)
end
-- construct an array representing which code to use for each byte
-- ultimately it should read "A", "B", or "C" for each byte, but we first
-- initialize it to ""
local str_codes = {}
for j = 1,#str_bytes do
str_codes[j] = ""
end
----- Start with C
-- find strings of 4+ numbers at start or end, or 6+ numbers in the middle
-- of the string
local C_start_i,C_start_i2 = string.find(str_latin, "^%d%d%d%d+")
local C_end_i = string.find(str_latin, "%d%d%d%d+$")
local C_is = {}
if C_start_i then C_is[1] = C_start_i end
local C_mid_search_i = C_start_i2 or 1
while C_mid_search_i do
local C_mid_i,C_mid_i2 = string.find(str_latin, "%d%d%d%d%d%d+", C_mid_search_i)
if C_mid_i and ((not C_end_i) or (C_mid_i < C_end_i)) then
C_is[#C_is+1] = C_mid_i
C_mid_search_i = C_mid_i2
else
C_mid_search_i = nil
end
end
if C_end_i then C_is[#C_is+1] = C_end_i end
for cj = 1,#C_is do
local j = C_is[cj]
for k = j,#str_latin,2 do
local this_2char = string.sub(str_latin, k, k+1)
if string.find(this_2char, "%d%d") then
str_codes[k] = "C"
str_codes[k+1] = "C"
else
break
end
end
end
----- Now find chars which should be encoded B or A
local cur_code = "B"
for j = 1,#str_latin do
if str_codes[j] == "C" then
cur_code = "B"
else
local this_char_byte = str_bytes[j] % 128
if this_char_byte < 32 then
cur_code = "A"
elseif this_char_byte > 95 then
cur_code = "B"
end
str_codes[j] = cur_code
end
end
-- We now have the code (A,B,C) to use for each character and can construct
-- the encoded values. The only remaining thing to be careful of is chars
-- with byte value > 127, for which we need FNC4 beforehand.
local encoded_vals = {}
local k = 1
local skip = false
for j = 1,#str_bytes do
if skip then
skip = false
else
local prev_code = str_codes[j-1]
local cur_code = str_codes[j]
local next_code = str_codes[j+1]
local this_byte = str_bytes[j]
if j == 1 then
encoded_vals[k] = codeAGetval("START" .. cur_code)
k = k + 1
elseif cur_code ~= prev_code then
encoded_vals[k] = codeABCGetval(prev_code, "CODE" .. cur_code)
k = k + 1
end
if cur_code == "C" then
local this_num = tonumber(string.sub(str_latin, j, j))
if next_code == "C" then
this_num = tonumber(string.sub(str_latin, j, j+1))
skip = true
end
encoded_vals[k] = codeCGetval(this_num)
else
if this_byte > 127 then
encoded_vals[k] = codeABCGetval(cur_code, "FNC4")
k = k + 1
end
encoded_vals[k] = codeABGetval(cur_code, this_byte % 128)
end
k = k + 1
end
end
-- checksum
encoded_vals[k] = getChecksum(encoded_vals)
k = k + 1
encoded_vals[k] = codeAGetval("STOP")
return encoded_vals
end
function code128Encode(str)
local output = {}
local vals = code128EncodeVals(str)
output = concatTables(output, patterns["QUIET"])
for j = 1,#vals do
output = concatTables(output, patterns[vals[j]])
end
output = concatTables(output, patterns["QUIET"])
return output
end
-- This can be called in one of two ways:
-- 1. code128EncodeBMP(str, output_file, aspect_height, aspect_width)
-- In this case the height of the barcode will be determined by the provided
-- aspect ratio, while the width will be set by the number of bars in the
-- code.
-- 2. code128EncodeBMP(str, output_file, height)
-- In this case the height of the barcode will be set in pixels by 'height',
-- while the width will be set by the number of bars in the code.
function code128EncodeBMP(str, output_file, height_temp, width_temp)
local code = code128Encode(str)
-- to be safe, we will fail if str does not end in '.bmp'
assert((#output_file >= 5) and (output_file:sub(-4,-1):lower() == '.bmp'))
local width = #code
local height = nil
if not width_temp then
-- if width_temp is not provided, then the height variable is absolute
height = height_temp
else
-- otherwise, it is relative
height = math.ceil(height_temp * width / width_temp)
end
-- create the bitmap
local bitmap = require("bitmap")
local palettes = require("bitmap/palettes")
local bmp = bitmap.create(width, height)
for x = 1,width do
for y = 1,height do
bmp[y][x] = 1 - code[x]
end
end
bmp:save(output_file, 'RGB1', palettes.palette_2)
end
|
--------------------------------------------------------------------------
-- This derived class of MName handles the latest modifiers for both
-- prereq and load.
--
-- @classmod MN_Latest
require("strict")
--------------------------------------------------------------------------
-- Lmod License
--------------------------------------------------------------------------
--
-- Lmod is licensed under the terms of the MIT license reproduced below.
-- This means that Lmod is free software and can be used for both academic
-- and commercial purposes at absolutely no cost.
--
-- ----------------------------------------------------------------------
--
-- Copyright (C) 2008-2014 Robert McLay
--
-- Permission is hereby granted, free of charge, to any person obtaining
-- a copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
-- without limitation the rights to use, copy, modify, merge, publish,
-- distribute, sublicense, and/or sell copies of the Software, and to
-- permit persons to whom the Software is furnished to do so, subject
-- to the following conditions:
--
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
--
--------------------------------------------------------------------------
local M = inheritsFrom(MName)
local MT = require("MT")
local concatTbl = table.concat
local dbg = require("Dbg"):dbg()
M.my_name = "latest"
local s_steps = {
MName.find_exact_match,
MName.find_latest,
}
--------------------------------------------------------------------------
-- Show the latest modifier.
-- @param self A MName object
function M.show(self)
local a = {}
a[#a+1] = self._actName
a[#a+1] = "(\""
a[#a+1] = self:sn()
a[#a+1] = "\")"
return concatTbl(a,"")
end
--------------------------------------------------------------------------
-- Find the latest version for module.
-- @param self A MName object
local function latestVersion(self)
local mt = MT:mt()
local sn = self:sn()
local pathA = mt:locationTbl(sn)
if (pathA == nil or #pathA == 0) then
return false
end
local found, t = self:find_latest(pathA)
return extractVersion(t.modFullName, sn)
end
--------------------------------------------------------------------------
-- Do a prereq check to see if version is latest one.
-- @param self A MName object.
function M.prereq(self)
dbg.start{"MN_Latest:prereq()"}
local mt = MT:mt()
local sn = self:sn()
if (not mt:have(sn, "active")) then
return self:show()
end
local version = latestVersion(self)
if (not version) then
return self:show()
end
local sv = mt:Version(sn)
if (sv ~= version) then
return self:show()
end
return false
end
--------------------------------------------------------------------------
-- Check to see if the currently loaded module is the latest.
-- @param self A MName object.
function M.isloaded(self)
local mt = MT:mt()
local sn = self:sn()
if (not mt:have(sn, "active")) then
return self:isPending()
end
local version = latestVersion(self)
if (not version) then
return false
end
local mt = MT:mt()
local sv = mt:Version(self:sn())
return sv == version
end
--------------------------------------------------------------------------
-- Check to see if the isPending module is the latest.
-- @param self A MName object.
function M.isPending(self)
local mt = MT:mt()
local sn = self:sn()
if (not mt:have(sn, "pending")) then
return false
end
local version = latestVersion(self)
if (not version) then
return false
end
local mt = MT:mt()
local sv = mt:Version(self:sn())
return sv == version
end
--------------------------------------------------------------------------
-- Return the steps used in the Latest class.
function M.steps()
return s_steps
end
return M
|
local Root = script:GetCustomProperty("Root"):WaitForObject()
local enabled = Root:GetCustomProperty("Enabled")
if not enabled then
return
end
local Commands = require(script:GetCustomProperty("Commands"))
function seperateMessage(Message)
return {CoreString.Split(Message, " ")}
end
function VerifyPlayer()
end
function ReturnPlayerByName(name)
for _,player in pairs(Game.GetPlayers()) do
if string.find(string.upper( player.name ), string.upper( name)) then
return player
end
end
end
function ReturnCommandsAsString()
local helpstring = ""
for name,_ in pairs(Commands) do
helpstring = helpstring .. name .." "
end
return helpstring
end
local PlayerHandler =
{
["@a"] = function(func, player, message) for _, player in pairs(Game.GetPlayers()) do func(player, message) end end,
["@e"] = function(func, player, message) for _, player in pairs(Game.GetPlayers( {ignorePlayers = player})) do func(player, message) end end,
["@p"] = function(func, player, message) func(player,message) end,
}
if(Environment.IsServer()) then
function RecieveMessage(player,message)
message = tostring( message["message"])
if not (string.sub(message, 1, 1) == "/") then return end
message = string.sub(message, 2, #message)
Newmessage = seperateMessage(message)
if(Commands[Newmessage[1]]) then
local ReturnMessage = "Command successful"
if(Newmessage[2]) then
if(PlayerHandler[Newmessage[2]]) then PlayerHandler[Newmessage[2]](Commands[Newmessage[1]],player,Newmessage)
else
if not ReturnPlayerByName(Newmessage[2]) then return end
ReturnMessage = Commands[Newmessage[1]](ReturnPlayerByName(Newmessage[2]), Newmessage) or ReturnMessage
end
elseif (not Newmessage[2]) then
ReturnMessage = Commands[Newmessage[1]](player, Newmessage) or ReturnMessage
end
end
end
end
if(Environment.IsClient())then
Events.Connect("CommandPanel.Submit", function(message)
Newmessage = seperateMessage(message)
if(Commands[Newmessage[1]]) then
if(Commands[Newmessage[1]] == "HELP") then return Events.Broadcast("CommandPanel.WriteToPanel", ReturnCommandsAsString()) end
ReliableEvents.BroadcastToServer("CommandPanel.Recieve", message)
else
Events.Broadcast("CommandPanel.WriteToPanel", "404, Not Found")
end
end )
Events.Connect("CommandPanel.Reply", function(Text)
Events.Broadcast("CommandPanel.WriteToPanel", Text)
end )
end
Chat.receiveMessageHook:Connect(RecieveMessage)
|
---------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0221-multiple-modules.md
-- Description:
-- HMI sent capabilities where every type of modules have only one module available to the SDL.
-- Mobile App sends "ButtonPress" request with omitted "moduleId" parameter to the SDL.
-- Check that SDL correctly processes "ButtonPress" request from mobile App, adding the default value of "moduleId"
-- parameter to the request to the HMI and use the parameter in further communication with HMI and mobile App.
--
-- Preconditions:
-- 1) SDL and HMI are started
-- 2) HMI sent all module types capabilities to the SDL
-- 3) Mobile is connected to the SDL
-- 4) App is registered and activated
--
-- Steps:
-- 1) App sends "ButtonPress"(moduleType = "RADIO", buttonName = "VOLUME_DOWN", buttonPressMode = "LONG") request
-- to the SDL
-- Check:
-- SDL resends "Buttons.ButtonPress"
-- (moduleType = "RADIO", moduleId = "00bd6d93", buttonName = "VOLUME_DOWN", buttonPressMode = "LONG")
-- request to the HMI adding the default value of "moduleId"
-- HMI sends "Buttons.ButtonPress"
-- (moduleType = "RADIO", moduleId = "00bd6d93", buttonName = "VOLUME_DOWN", buttonPressMode = "LONG")
-- response to the SDL
-- SDL sends "ButtonPress"(resultCode = SUCCESS", success = true) response to the App
-- 2) App sends "ButtonPress"(moduleType = "CLIMATE", buttonName = "FAN_DOWN", buttonPressMode = "LONG") request
-- to the SDL
-- Check:
-- SDL resends "Buttons.ButtonPress"
-- (moduleType = "CLIMATE", moduleId = "2df6518c", buttonName = "FAN_DOWN", buttonPressMode = "LONG")
-- request to the HMI adding the default value of "moduleId"
-- HMI sends "Buttons.ButtonPress"
-- (moduleType = "CLIMATE", moduleId = "2df6518c", buttonName = "FAN_DOWN", buttonPressMode = "LONG")
-- response to the SDL
-- SDL sends "ButtonPress"(resultCode = SUCCESS", success = true) response to the App
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require("test_scripts/RC/MultipleModules/commonRCMulModules")
--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
--[[ Local Variables ]]
local requestModuleData = {
RADIO = {
moduleType = "RADIO",
buttonName = "VOLUME_DOWN",
buttonPressMode = "LONG",
},
CLIMATE = {
moduleType = "CLIMATE",
buttonName = "FAN_DOWN",
buttonPressMode = "LONG"
}
}
local moduleIdMap = {
RADIO = common.getRcCapabilities().RADIO[1].moduleInfo.moduleId,
CLIMATE = common.getRcCapabilities().CLIMATE[1].moduleInfo.moduleId
}
--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("RAI", common.registerApp)
runner.Step("PTU", common.policyTableUpdate, { common.PTUfunc })
runner.Step("Activate App", common.activateApp)
runner.Title("Test")
for moduleType, moduleData in pairs(requestModuleData) do
runner.Step("Send ButtonPress request with omitted moduleId for ".. moduleData.moduleType .." module",
common.sendButtonPressNoModuleId, { moduleIdMap[moduleType], moduleData, 1 })
end
runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
|
LookupTable = {}
function LookupTable.new(XMin, XMax, YMin, YMax, Size, DataPoints)
-- Make shallow copy of data
local DP = { unpack(DataPoints) }
-- And sort it by X value
table.sort(DP, function (a,b) return a[1] < b[1] end)
-- Add proper boundaries so we don't have to deal with the edges
if DP[1][1] > XMin then
table.insert(DP, 1, { XMin, YMin })
end
if DP[#DP][1] < XMax then
table.insert(DP, { XMax, YMax })
end
-- Now build lookup table
local LT = {}
for x = XMin,XMax,((XMax - XMin) / Size) do
-- Find closest data point >= x
local i = 0
repeat
i = i + 1
until DP[i][1] >= x
if x == DP[i][1] then
-- Serendipitous!
table.insert(LT, { unpack(DP[i]) })
else
-- Interpolate between this and previous
local x0,y0 = unpack(DP[i-1])
local x1,y1 = unpack(DP[i])
table.insert(LT, { x, y0+(x-x0)*(y1-y0)/(x1-x0) })
end
end
local self = {}
self.XMin = XMin
self.XMax = XMax
self.Step = (XMax - XMin) / Size
self.YMin = YMin
self.YMax = YMax
self.Table = LT
self.Lookup = LookupTable.Lookup
return self
end
function LookupTable:Lookup(x)
-- Boundary check
if x < self.XMin then
return self.YMin
elseif x > self.XMax then
return self.YMax
end
-- Figure out (zero-based) index into lookup table
local i = 1+math.floor((x - self.XMin) / self.Step)
local x0,y0 = unpack(self.Table[i])
if x == x0 or i == #self.Table then
-- Exact match or end of table
return y0
else
-- Interpolate
local x1,y1 = unpack(self.Table[i+1])
return y0+(x-x0)*(y1-y0)/(x1-x0)
end
end
|
-----------------------------------
-- Area: Grand Palace of Hu'Xzoi
-- NPC: Particle Gate
-- !pos -39 0 -319 34
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
player:startEvent(172)
return 1
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
|
_player=_player||player local cable={}local net_cache={}function cable.receive(id,callback)if SERVER then cable.check_networked_string(id)end return net.Receive(id,function(length,player)local c_len=net.ReadUInt(8)local c_tables=table.map(string.split(net.ReadString(),";"),function(v)return tonumber(v)end)local args={}if c_len>0 then for i=1,c_len do table.insert(args,net.ReadType())end end if c_tables then for k,v in ipairs(c_tables)do args[v]=pon.decode(args[v])end end if IsValid(player)then callback(player,unpack(args))else callback(unpack(args))end end)end local function write_sendable_args(...)local args={ ... }local length=0 local table_header=""local send={}for k,v in ipairs(args)do length=length+1 if!istable(v)then table.insert(send,v!=nil&&v||!1)else table.insert(send,pon.encode(v))table_header=table_header..tostring(length)..";"end end net.WriteUInt(length,8)net.WriteString(table_header)for k,v in ipairs(send)do net.WriteType(v)end end if SERVER then function cable.check_networked_string(id)if!net_cache[id]then net_cache[id]=util.AddNetworkString(id)return!1 end return!!1 end function cable.send(player,id,...)if isstring(player)then error("cable.send - bad argument #1 (must not be a string)\n")end if!cable.check_networked_string(id)then local args={ ... }timer.Simple(0.1,function()cable.send(player,id,unpack(args))end)return end if!istable(player)then if IsValid(player)then player={player}else player=_player.GetAll()end end net.Start(id)write_sendable_args(...)net.Send(player)end else function cable.send(id,...)net.Start(id)write_sendable_args(...)net.SendToServer()end end return cable
|
--[[
tp8_bend
__ ______ __ __
| \ / \ | \ | \
_| $$_ ______ | $$$$$$\ | $$____ ______ _______ ____| $$
| $$ \ / \ | $$__/ $$ | $$ \ / \ | \ / $$
\$$$$$$ | $$$$$$\ >$$ $$ | $$$$$$$\| $$$$$$\| $$$$$$$\| $$$$$$$
| $$ __ | $$ | $$| $$$$$$ | $$ | $$| $$ $$| $$ | $$| $$ | $$
| $$| \| $$__/ $$| $$__/ $$ | $$__/ $$| $$$$$$$$| $$ | $$| $$__| $$
\$$ $$| $$ $$ \$$ $$______| $$ $$ \$$ \| $$ | $$ \$$ $$
\$$$$ | $$$$$$$ \$$$$$$| \\$$$$$$$ \$$$$$$$ \$$ \$$ \$$$$$$$
| $$ \$$$$$$
| $$
\$$
How to Use: Press E to 'link' with the entity. Press R to record a starting position, q to draw a line between the previous recorded position, and
t to "press okay" and validate the points recorded. Pressing t does not record a new point.
TODO: spell gave more pts than ply provided
Models: shoe: models/props_junk/Shoe001a.mdl
hula: models/props_lab/huladoll.mdl
soda: models/props_junk/PopCan01a.mdl
kettle: models/props_interiors/pot01a.mdl
alcohol: models/props_junk/garbage_glassbottle002a.mdl
baby: models/props_c17/doll01.mdl
tiny rock: models/props_junk/rock001a.mdl
Sounds: garrysmod/save_load1.wav to 4
train: ambient/alarms/razortrain_horn1.wav
ambient/alarms/train_horn2.wav
ambient/alarms/train_horn_distant1.wav
tricity: ambient/energy/zap5.wav 6 9 weapons/gauss/fire1.wav
fireball: ambient/fire/gascan_ignite1.wav ambient/levels/streetwar/city_battle10.wav
ignite: ambient/fire/ignite.wav
shore: ambient/levels/canals/shore1.wav 1234
zap: ambient/levels/citadel/weapon_disintegrate4.wav 1234
zap2: ambient/levels/labs/electric_explosion1.wav 1-6
wind,windup:ambient/levels/labs/teleport_preblast_suckin1.wav
thunder: ambient/levels/labs/teleport_postblast_thunder1.wav ambient/levels/streetwar/city_battle11.wav
bleeps: ambient/levels/prison/radio_random1.wav 1-15
rocks: ambient/levels/streetwar/building_rubble1.wav 123
metalrip: ambient/levels/streetwar/city_battle12.wav
distantexplo ambient/levels/streetwar/city_battle17.wav 18 19
chant: ambient/levels/streetwar/city_chant1.wav
metalmove: ambient/machines/wall_move1.wav 1234
many metal in this folder ambient/materials/metal_stress3.wav
punch: ambient/voices/citizen_punches2.wav
old msg: friends/message.wav
wind: hl1/ambience/des_wind2.wav
water: npc/ichthyosaur/snap_miss.wav
]]
AddCSLuaFile()
ENT.Type = "anim"
ENT.Model = "models/props_junk/Shoe001a.mdl"
ENT.Up = {"vo/npc/female01/upthere01.wav", "vo/npc/female01/upthere02.wav"}
ENT.Down = {"vo/npc/male01/getdown02.wav"}
ENT.Back = {"vo/npc/male01/overhere01.wav"}
ENT.Fwd = {"vo/npc/vortigaunt/forward.wav", "vo/npc/vortigaunt/onward.wav", "vo/npc/vortigaunt/yesforward.wav"}
ENT.Left = {"vo/ravenholm/shotgun_keepitclose.wav"}
ENT.Right = {"vo/npc/vortigaunt/vanswer12.wav"}
ENT.Gene = {"vo/npc/vortigaunt/satisfaction.wav", "vo/npc/vortigaunt/ourplacehere.wav", "vo/npc/vortigaunt/dreamed.wav"}
ENT.Jay = {"ambient/levels/streetwar/building_rubble1.wav", "ambient/levels/streetwar/building_rubble2.wav", "ambient/levels/streetwar/building_rubble3.wav", "ambient/levels/streetwar/building_rubble4.wav"}
ENT.JayModels = {"models/props_debris/barricade_tall01a.mdl", "models/props_debris/barricade_tall03a.mdl", "models/props_wasteland/rockcliff01k.mdl"}
ENT.playa = nil
ENT.positions = {}
ENT.isTracking = false
ENT.devMode = true
ENT.maxSpellPoints = 24
ENT.angularTolerance = 15
function ENT:Initialize()
self:SetModel(self.Model)
if SERVER then
self:SetUseType( SIMPLE_USE )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:EnableGravity(false)
phys:SetMass(25)
end
self.trail = nil
end
self.line = {Angle(4.7419967651367,1.0958023071289,0), Angle(17.125537872314,0.0041580200195313,0)}
self.jay = {Angle(7.375301361084,0.659912109375,0), Angle(-0.33096694946289,-22.220092773438,0)}
self.joanHex = {Angle(1.634220123291,56.13777923584,0), Angle(0.026218414306641,55.002319335938,0), Angle(-0.85479736328125,61.571804046631,0), Angle(0.84221267700195,-298.59231567383,0), Angle(-0.45262145996094,67.301147460938,0), Angle(-1.55615234375,60.476013183594,0)}
self.spellAngles = {self.line, self.jay, self.joanHex}
self.plyAngles = {}
end
--Have use set the ply on the ent and ent on ply
--player presses q
--ENT:startTracking() ent uses this to start tracking own position (solves the syncing problem)
--player releases q
--if it works, then cast spell where player is looking or something. Depends on spell. Like fire hands vs. rock toss up and punch
--DAB SPELL???
--for two handed motions, just have to make sure both ents passed their part of the spell required movements... might want a global list to pair them...
--due to this pairing of ents, it is possible to have multiperson spells be made with >2 bendables.
--[[
▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀
▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄
▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░░░░░░░░░░░▌
▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀█░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀▀▀
▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌
▐░▐░▌ ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▄▄▄▄█░█▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄
▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░▌ ▐░░░░░░░░░░░▌
▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀
]]
function ENT:validate()
--validate amongst various spells
-- analyze if the player's movements match any of the spells...
print("Validating...")
--use self.tally for getting what spells to check
--this should be preprocessed at init.
local isGoodToCast = false
local castDone = false
--calculate angles of positions for player
self.plyAngles = {}
for i=1,#self.positions-1 do
table.insert(self.plyAngles, self.positions[i]:Angle() - self.positions[i+1]:Angle())
end
self.plyRotated = self.plyAngles
--[[prints out the angles the player just recorded
this is how you add a new spell!]]
if self.devMode && #self.positions > 1 then
local addNewSpellCode = "{"
local angles = "{"
for i=1,#self.positions-1 do
addNewSpellCode = addNewSpellCode.."Vector("..self.positions[i].x..","..self.positions[i].y..","..self.positions[i].z.."), "
if i < #self.plyAngles then
angles = angles.."Angle("..self.plyAngles[i].x..","..self.plyAngles[i].y..","..self.plyAngles[i].z.."), "
end
if i > 0 && i % 25 == 0 then
print(addNewSpellCode)
print(angles)
addNewSpellCode = ""
angles = ""
end
end
addNewSpellCode = addNewSpellCode.."Vector("..self.positions[#self.positions].x.. ","..self.positions[#self.positions].y..","..self.positions[#self.positions].z..")}"
print(addNewSpellCode)
angles = angles.."Angle("..self.plyAngles[#self.plyAngles].x.. ","..self.plyAngles[#self.plyAngles].y..","..self.plyAngles[#self.plyAngles].z..")}"
print(angles)
end
for spell=1,#self.spellAngles do
print("Spell: "..spell.. " ******************************************************************************************")
if !castDone then
isGoodToCast = true
print(#self.plyAngles..", "..#self.spellAngles[spell])
for i=1,#self.spellAngles[spell] do
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
if !self:similarDistance(self.plyAngles[i], self.spellAngles[spell][i], self.angularTolerance) then
isGoodToCast = false
print(i.. ": is bad")
break --skips the rest of this spell
end
end
if isGoodToCast then
castDone = true
self:cast(spell)
end
else break end --once cast, don't even bother comparing...
end
end
--[[
,o888888o. .8. d888888o. 8888888 8888888888
8888 `88. .888. .`8888:' `88. 8 8888
,8 8888 `8. :88888. 8.`8888. Y8 8 8888
88 8888 . `88888. `8.`8888. 8 8888
88 8888 .8. `88888. `8.`8888. 8 8888
88 8888 .8`8. `88888. `8.`8888. 8 8888
88 8888 .8' `8. `88888. `8.`8888. 8 8888
`8 8888 .8' .8' `8. `88888. 8b `8.`8888. 8 8888
8888 ,88' .888888888. `88888. `8b. ;8.`8888 8 8888
`8888888P' .8' `8. `88888. `Y8888P ,88P' 8 8888
]]
function ENT:cast(spell)
print("cast: "..spell)
if spell == 1 then
--line
self:EmitSound(Sound(self.Up[math.random(#self.Up)]))
elseif spell == 2 then
--jay
self:EmitSound(Sound(self.Jay[math.random(#self.Jay)]))
local stepsUp = 75
local height = 55
if SERVER then
self.playa:SetPos(self:GetPos() + Vector(0,0,30))
self.playa:SetVelocity(Vector(0,0,290))
--raise rock out of ground to lift
rock = ents.Create("prop_physics")
if ( !IsValid( rock ) ) then return end
rock:SetPos(self.playa:GetPos() + Vector(0,0,-1*height-35))
rock:SetModel(self.JayModels[math.random(#self.JayModels)])
rock:PhysicsInit( SOLID_VPHYSICS )
--rock:SetSolid( SOLID_VPHYSICS )
rock:GetPhysicsObject():EnableGravity(false)
rock:GetPhysicsObject():SetMass(25)
rock:SetAngles(Angle(0,math.random(0,359),0))
rock:Spawn()
rock:GetPhysicsObject():EnableMotion(false)
--slide rock up
for i=1,stepsUp do
timer.Simple( (i/stepsUp)/3, function() rock:SetPos(rock:GetPos()+Vector(0,0,height/stepsUp)) end )
end
--slide rock into ground
timer.Simple(5, function()
for i=1,stepsUp do
timer.Simple( i/stepsUp, function() rock:SetPos(rock:GetPos()+Vector(0,0,-2.5*height/stepsUp)) end )
end
end)
--remove all rocks ever created. Maybe global array and remove them all if they exist
timer.Simple( 7, function()
rock:Remove()
end )
end
elseif spell == 3 then
--self:EmitSound(Sound(self.Gene[math.random(#self.Gene)]))
--shoot lightning
--self.playa:GetForward()
self:EmitSound(Sound(self.Jay[math.random(#self.Jay)]))
else
error("Error: spell not defined")
end
end
--[[function ENT:Draw()
--draw all the lines in a list
--render.DrawLine( Vector startPos, Vector endPos, table color = Color( 255, 255, 255 ), boolean writeZ = false )
end]]
--q is 27 add
--r is 28 start
--t = 30 end
-- https://wiki.facepunch.com/gmod/Enums/KEY
hook.Add( "PlayerButtonDown", "ButtonUpWikiExample", function( ply, button )
-- print( ply:Nick() .. " pressed " .. (button) )
if button == 27 && ply.entitty != nil then
--update start position via table.insert
for i=1,#ply.entitty do
ply.entitty[i]:newVertex()
end
elseif button == 28 && ply.entitty != nil then
--start position
for i=1,#ply.entitty do
ply.entitty[i]:startTracking()
end
elseif button == 30 && ply.entitty != nil then
--end position
for i=1,#ply.entitty do
ply.entitty[i]:endTracking()
end
end
end)
function ENT:startTracking()
self.isTracking = true
self.positions = {}
table.insert(self.positions, self.playa:GetPos() - self:GetPos())
self.tally = 1
self.trail = util.SpriteTrail(self, 0, self.playa:GetColor(), false, 5, 1, 5, 1/(15+1)*0.5, "trails/plasma.vmt")
end
function ENT:newVertex()
if !self.isTracking then return end
if self.tally < self.maxSpellPoints+1 then -- allow only up to 24 entries
self.tally = self.tally + 1
table.insert(self.positions, self.playa:GetPos() - self:GetPos())
--TODO: some logic here for when the ent is in ?or near? water.
end
end
function ENT:endTracking()
if self.isTracking then
self.isTracking = false
self:validate()
SafeRemoveEntity( self.trail )
self.positions = {}
end
end
function ENT:Use(ply)
self.playa = ply
if !IsValid(ply.entitty) then ply.entitty = {} end
table.insert(ply.entitty, self)
--print("used")
end
function ENT:OnRemove()
--once ent is removed, remove self from player's entitty table of linked bend(ables) entities.
if self.playa != nil && self.playa.entitty != nil then
for i=1,#self.playa.entitty do
if self.playa.entitty[i] == self then
table.remove(self.playa.entitty, i)
end
end
end
end
function ENT:similarDistance(new, old, distance)
--each component may not be more than 'distance' different + or - from 'orig'
print("new.x: "..new.x.." - "..old.x.." :old.x ".."new.y: "..new.y.." - "..old.y.." :old.y ".."new.z: "..new.z.." - "..old.z.." :old.z")
local truth = true
local nox = math.abs(new.x - old.x)
local noy = math.abs(new.y - old.y)
local noz = math.abs(new.z - old.z)
--the 360-distance fixes the issue where the angle is like -359 due to going over an axis
if (nox > distance) && (nox < 360-distance) then
truth = false
end
if (noy > distance) && (noy < 360-distance) then
truth = false
end
if (noz > distance) && (noz < 360-distance) then
truth = false
end
--if truth then print("truth") end
return truth
end
--TODO: for debugging, remove when done
function ENT:vectorToString(vec)
local toReturn = ""
toReturn = "("..vec.x..", "..vec.y..", "..vec.z..")"
return toReturn
end
|
Config = {}
Config.RestrictedChannels = 20 -- channels that are encrypted (EMS, Fire and police can be included there) if we give eg 10, channels from 1 - 10 will be encrypted
Config.enableCmd = true -- /radio command should be active or not (if not you have to carry the item "radio") true / false
Config.messages = {
['not_on_radio'] = 'You are currently not on any radio',
['on_radio'] = 'You are currently on the radio: <b>',
['joined_to_radio'] = 'You joined the radio: <b>',
['restricted_channel_error'] = 'You can not join encrypted channels!',
['you_on_radio'] = 'You are already on the radio: <b>',
['you_leave'] = 'You left the radio: <b>'
}
|
-- Make Y behave like other capitals D, C...
vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true })
-- Fast nohls
vim.api.nvim_set_keymap('n', '<TAB><CR>', ':nohls<CR>', { noremap = true })
-- Editing and sourcing the vimrc faster
vim.api.nvim_set_keymap('n', '<leader>ev', ':find $MYVIMRC<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>sv', ':source $MYVIMRC<CR>', { noremap = true })
-- Moving in (local)quickfix list easily
vim.api.nvim_set_keymap('n', '[Q', ':cfirst<CR>zz', { noremap = true })
vim.api.nvim_set_keymap('n', ']Q', ':clast<CR>zz', { noremap = true })
vim.api.nvim_set_keymap('n', ']q', ':cnext<CR>zz', { noremap = true })
vim.api.nvim_set_keymap('n', '[q', ':cprev<CR>zz', { noremap = true })
vim.api.nvim_set_keymap('n', '[L', ':lfirst<CR>zz', { noremap = true })
vim.api.nvim_set_keymap('n', ']L', ':llast<CR>zz', { noremap = true })
vim.api.nvim_set_keymap('n', ']l', ':lnext<CR>zz', { noremap = true })
vim.api.nvim_set_keymap('n', '[l', ':lprev<CR>zz', { noremap = true })
-- Moving with buffers easily
vim.api.nvim_set_keymap('n', '[b', ':bprevious<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '[b', ':bnext<CR>', { noremap = true })
-- Fast Make and compiler
vim.api.nvim_set_keymap('n', '<Leader>c', ':compiler<Space>', { noremap = true })
vim.api.nvim_set_keymap('n', '<Leader>M', ':silent make % <BAR> copen<CR><C-W>k', { noremap = true })
vim.api.nvim_set_keymap('n', '<Leader>n', ':cclose <BAR> lclose<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>qo', ':copen | wincmd p<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>lo', ':lopen | wincmd p<CR>', { noremap = true, silent = true })
-- Inserting new line above or below
vim.api.nvim_set_keymap('n', '[<Space>', ':silent insert<CR><CR>.<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', ']<Space>', ':silent append<CR><CR>.<CR>', { noremap = true })
-- Fast filetype detection
vim.api.nvim_set_keymap('n', '<leader>,', ':filetype detect<CR>', { noremap = true })
-- Fast creation for tags
vim.api.nvim_set_keymap('n', '<leader>t', ':silent !ctags -R .<CR>', { noremap = true })
-- Fast explore
-- Explanation: Set fast L to toggle explorer
-- Not be annoyed by Lsp{function}
vim.api.nvim_command [[ command L Lexplore ]]
-- Clean buffer that are already deleted in the system
-- Try to debug this
vim.api.nvim_command [[ command Clean bufdo if !filereadable(bufname()) | bdelete! | endif ]]
vim.api.nvim_command [[ command TSRestart write | edit | TSBufEnable highlight ]]
-- Switch to current directory for the file
-- Locally
vim.api.nvim_set_keymap('n', '\\lcd', ':lcd %:p:h<CR>', { noremap = true })
-- Globally
vim.api.nvim_set_keymap('n', '\\cd', ':cd %:p:h<CR>', { noremap = true })
-- Switch to root directory of the project
vim.api.nvim_set_keymap('n', '\\rd', ':lua require("find_root").switch_root(0)<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '\\lrd', ':lua require("find_root").switch_root(1)<CR>', {noremap = true})
|
--[[ Copyright (c) 2009 Peter "Corsix" Cawley
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. --]]
local object = {}
object.id = "cabinet"
object.thob = 2
object.name = _S.object.cabinet
object.tooltip = _S.tooltip.objects.cabinet
object.ticks = false
object.build_preview_animation = 5054
object.idle_animations = {
north = 80,
east = 82,
}
object.usage_animations = {
north = {
in_use = {
Doctor = 88,
},
},
east = {
in_use = {
Doctor = 90,
},
},
}
local anim_mgr = TheApp.animation_manager
anim_mgr:setMarker(object.usage_animations.east.in_use, {-1, 0})
anim_mgr:setMarker(object.usage_animations.north.in_use, {-1, 0})
object.orientations = {
north = {
footprint = { {0, 0, complete_cell = true}, {0, 1, only_passable = true} },
use_position = "passable",
use_animate_from_use_position = true,
},
east = {
footprint = { {0, 0, complete_cell = true}, {-1, 0, only_passable = true} },
use_position = "passable",
},
south = {
footprint = { {0, 0, complete_cell = true}, {0, -1, only_passable = true} },
use_position = "passable",
},
west = {
footprint = { {0, 0, complete_cell = true}, {1, 0, only_passable = true} },
use_position = "passable",
use_animate_from_use_position = true,
},
}
return object
|
return
function(t)
assert_table(t)
local result = {}
for k, v in pairs(t) do
result[#result + 1] = {key = k, value = v}
end
return result
end
|
--[[
Visual Novel Example
]]
scenes = {}
fonts = {}
colors = {
menuitem = Color.from_hex('#AAAAAA'),
bg = Color.from_hex('#333333'),
white = Color.from_hex("#ffffff")
}
game.on('init', function()
-- create a font.
font_tex1 = assets.load_texture("fonts/arial_20.png")
font_sm1 = assets.load_spritemap("fonts/arial_20.json")
fonts.arial_20 = Font(font_tex1, font_sm1)
-- load the scenes
scenes.menu = include('scenes.menu')
scenes.chapter1 = include('scenes.chapter1')
-- set some rendering variables.
renderer.set_clear_color(colors.bg)
renderer.set_blend(false)
-- set the initial scene to use
game.set_scene(scenes.menu.handle)
end)
|
-- For the love of furry heck, THIS PLACE NEEDS A CLEAN!
-- Props will autotaunt at specified intervals
local isEnabled = false
local isProp = false
local delay = PHX.CVAR.AutoTauntDelay:GetInt() or 6
local started = false
local timerID = "ph_autotaunt_timer"
local teamCheckTimer = "ph_autotaunt_teamchecktimer"
local xStart
local xEnd
local y
local w = 140
local h = 30
local previousTime
local tweenTime = 0
local state
local function TimeLeft()
local ply = LocalPlayer()
local lastTauntTime = ply:GetNWFloat("LastTauntTime")
local nextTauntTime = lastTauntTime + delay
local currentTime = CurTime()
return nextTauntTime - currentTime
end
local function TimeleftRTaunt()
local ply = LocalPlayer()
local lastTauntTime = ply:GetNWFloat("LastTauntTime")
local nextRandomTime = lastTauntTime + PHX.CVAR.NormalTauntDelay:GetInt()
local curTime = CurTime()
return nextRandomTime - curTime
end
local function TimeleftCTaunt()
local ply = LocalPlayer()
local lastTauntTime = ply:GetNWFloat("localLastTauntTime", 0)
local nextCustomTime = lastTauntTime + PHX.CVAR.CustomTauntDelay:GetInt()
local curTime = CurTime()
return nextCustomTime - curTime
end
-- a: amplitude
-- p: period
local function outElastic(t, b, c, d, a, p)
local pi = math.pi
if t == 0 then return b end
t = t / d
if t == 1 then return b + c end
if not p then p = d * 0.3 end
local s
if not a or a < math.abs(c) then
a = c
s = p / 4
else
s = p / (2 * pi) * math.asin(c / a)
end
return a * math.pow(2, - 10 * t) * math.sin((t * d - s) * (2 * pi) / p) + c + b
end
local function AutoTauntPaint()
if !isEnabled || !isProp || !started then return; end
if tweenTime < 1 then
x = outElastic(tweenTime, xStart, xEnd - xStart, 1, 1, 0.5)
local cTime = CurTime()
tweenTime = tweenTime + (cTime - previousTime)
previousTime = cTime
end
local timeLeft = math.ceil(TimeLeft())
local percentage = timeLeft / delay
local txt = PHX:FTranslate("HUD_AUTOTAUNT_ALT", timeLeft)
draw.RoundedBox(5, x, y, w, h, Color(0, 0, 0, 200))
draw.RoundedBox(5, x + 5, y + 5, (w - 10) * percentage, h - 10, Color(200, 0, 0, 200))
draw.DrawText(txt, "HunterBlindLockFont", x + 70, ScrH() - 57, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
end
local matw = Material("vgui/phehud/res_wep")
local posw = { x = ScrW() - 480, y = ScrH()-130 }
local indic = {
auto = Material("vgui/phehud/ataunt_timer"),
cust = Material("vgui/phehud/ctaunt_timer"),
rand = Material("vgui/phehud/taunt_timer")
}
local function CreateTauntIndicators( material, color, tx, ty, w, h )
if LocalPlayer():Team() == TEAM_PROPS then
surface.SetDrawColor( color )
surface.SetMaterial( material )
surface.DrawTexturedRect(tx, ty, w, h)
end
end
local delayR = PHX.CVAR.NormalTauntDelay:GetInt()
local delayC = PHX.CVAR.CustomTauntDelay:GetInt()
-- /!\ NOTICE: This is prototype, will improved or changed sometime in future.
local function AutoTauntPaint_phx()
-- Thanks for Jay#8422 for reminiding lol
--if (not isEnabled or not started) then return; end
if IsValid(LocalPlayer()) && LocalPlayer():Alive() && LocalPlayer():Team() == TEAM_PROPS && isEnabled && started then
local timeLeft = math.ceil(TimeLeft())
local percentage = timeLeft / delay
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( matw )
surface.DrawTexturedRect( posw.x, posw.y, 480, 120 )
surface.SetDrawColor( Color(200,40,40) )
draw.NoTexture()
draw.Circle( ScrW()-58, posw.y + 60, percentage * 45, 24 )
draw.DrawText( PHX:FTranslate("HUD_AUTOTAUNT", timeLeft) , "PHX.TopBarFont", ScrW() - 164, posw.y + 83, color_white, TEXT_ALIGN_RIGHT )
CreateTauntIndicators(indic.auto, Color(255,255,255,180), ScrW()-88, posw.y + 28, 64, 64)
local r = math.Round(TimeleftRTaunt())
local c = math.Round(TimeleftCTaunt())
local colR = Color(255,255,255,50)
local colC = Color(255,255,255,50)
local literalR = r + 1 .."s"
local literalC = c .."s"
if r < 0 then
literalR = "(✓)"
colR = Color(20,255,20,220)
end
if c < 0 then
literalC = "(✓)"
colC = Color(20,230,230,220)
end
draw.DrawText(PHX:FTranslate("HUD_PROP_TAUNT_TIME"), "PHX.AmmoFont", posw.x + 96, posw.y + 50, color_white, TEXT_ALIGN_CENTER)
draw.DrawText(PHX:FTranslate("HUD_PROP_CTAUNT_TIME"), "PHX.AmmoFont", posw.x + 212, posw.y + 50, color_white, TEXT_ALIGN_CENTER)
draw.DrawText(literalR, "PHX.TopBarFont", posw.x + 96 + 50, posw.y + 18, color_white, TEXT_ALIGN_CENTER)
draw.DrawText(literalC, "PHX.TopBarFont", posw.x + 212 + 50, posw.y + 19, color_white, TEXT_ALIGN_CENTER)
CreateTauntIndicators(indic.rand, colR, posw.x + 72, posw.y + 2, 50, 50)
CreateTauntIndicators(indic.cust, colC, posw.x + 190, posw.y + 2, 50, 50)
end
end
hook.Add("HUDPaint", "PH_AutoTauntPaint", function()
state = PHX.CLCVAR.NewHUD:GetBool()
if state and (not matw:IsError()) then
AutoTauntPaint_phx()
else
AutoTauntPaint()
end
end)
local function RemoveTimer()
if timer.Exists(timerID) then
timer.Destroy(timerID)
end
end
local function CheckAutoTaunt()
local timeLeft = TimeLeft()
local ply = LocalPlayer()
-- Stop everything under these conditions
if !ply:Alive() || ply:Team() != TEAM_PROPS then
started = false
RemoveTimer()
PHX.VerboseMsg("[PHX AutoTaunt] Blocked!")
return
end
end
local function Setup()
local ply = LocalPlayer()
isEnabled = PHX.CVAR.AutoTauntEnable:GetBool()
isProp = ply:Team() == TEAM_PROPS
started = true
previousTime = CurTime()
tweenTime = 0
if isEnabled && isProp then
delay = PHX.CVAR.AutoTauntDelay:GetInt()
timer.Create(timerID, 1, 0, CheckAutoTaunt)
end
end
local function CheckPlayer()
local ply = LocalPlayer()
if ply:Alive() && ply:Team() == TEAM_PROPS then
if timer.Exists(teamCheckTimer) then
timer.Destroy(teamCheckTimer)
end
Setup()
return true
end
return false
end
local function AutoTauntSpawn()
xStart = ScrW() + 200
xEnd = ScrW() - 195
y = ScrH() - 65
if !CheckPlayer() then
timer.Create(teamCheckTimer, 0.1, 10, CheckPlayer)
end
end
net.Receive("AutoTauntSpawn", function() AutoTauntSpawn() end)
local function AutoTauntRoundEnd()
started = false
RemoveTimer()
end
net.Receive("AutoTauntRoundEnd", function() AutoTauntRoundEnd() end)
|
object_tangible_item_entertainer_console_stage_generated_backdrop_wide_04 = object_tangible_item_entertainer_console_shared_stage_generated_backdrop_wide_04:new {
}
ObjectTemplates:addTemplate(object_tangible_item_entertainer_console_stage_generated_backdrop_wide_04, "object/tangible/item/entertainer_console/stage_generated_backdrop_wide_04.iff")
|
-- Server Objects
includeFile("custom_content/static/structure/dathomir/biohazard_sign_01.lua")
includeFile("custom_content/static/structure/dathomir/biohazard_sign_02.lua")
includeFile("custom_content/static/structure/dathomir/biohazard_sign_03.lua")
includeFile("custom_content/static/structure/dathomir/deathtrooper_pile.lua")
includeFile("custom_content/static/structure/dathomir/decal_arrow_left.lua")
includeFile("custom_content/static/structure/dathomir/decal_arrow_right.lua")
includeFile("custom_content/static/structure/dathomir/decal_dltby.lua")
includeFile("custom_content/static/structure/dathomir/decal_hlpgm.lua")
includeFile("custom_content/static/structure/dathomir/decal_htchbrkn.lua")
includeFile("custom_content/static/structure/dathomir/decal_mtpsd.lua")
includeFile("custom_content/static/structure/dathomir/decal_smear_01.lua")
includeFile("custom_content/static/structure/dathomir/decal_smear_02.lua")
includeFile("custom_content/static/structure/dathomir/decal_smear_03.lua")
includeFile("custom_content/static/structure/dathomir/decal_splatt_01.lua")
includeFile("custom_content/static/structure/dathomir/decal_splatt_02.lua")
includeFile("custom_content/static/structure/dathomir/decal_splatt_03.lua")
includeFile("custom_content/static/structure/dathomir/helmet_on_hook.lua")
includeFile("custom_content/static/structure/dathomir/outbreak_hasty_wall_s01.lua")
includeFile("custom_content/static/structure/dathomir/outbreak_hasty_wall_s02.lua")
includeFile("custom_content/static/structure/dathomir/outbreak_hasty_wall_s03.lua")
includeFile("custom_content/static/structure/dathomir/shackled_undead_wall.lua")
includeFile("custom_content/static/structure/dathomir/static_lung_vat.lua")
includeFile("custom_content/static/structure/dathomir/static_science_desk.lua")
includeFile("custom_content/static/structure/dathomir/static_undead_eye.lua")
includeFile("custom_content/static/structure/dathomir/static_undead_heart.lua")
includeFile("custom_content/static/structure/dathomir/static_undead_jaw.lua")
includeFile("custom_content/static/structure/dathomir/static_undead_liver.lua")
includeFile("custom_content/static/structure/dathomir/static_undead_lungs.lua")
includeFile("custom_content/static/structure/dathomir/static_undead_stomach.lua")
includeFile("custom_content/static/structure/dathomir/static_undead_tooth.lua")
includeFile("custom_content/static/structure/dathomir/static_zombie_arm.lua")
includeFile("custom_content/static/structure/dathomir/static_zombie_foot.lua")
includeFile("custom_content/static/structure/dathomir/static_zombie_hand.lua")
includeFile("custom_content/static/structure/dathomir/static_zombie_head.lua")
includeFile("custom_content/static/structure/dathomir/static_zombie_leg.lua")
|
recipes = {
sauce = {
require = {
tomato = 3,
water = 1,
salt = 1,
},
},
hotsauce = {
require = {
tomato = 3,
pepper = 2,
water = 1,
salt = 1,
},
},
pizza = {
require = {
wheatFlour = 1,
tomato = 2,
sauce = 1,
oregano = 2,
milk = 2,
cheese = 1,
},
},
cookies = {
require = {
wheatFlour = 1,
milk = 1,
sugar = 1,
chocolate = 1,
},
},
hotChocolate = {
require = {
milk = 1,
chocolate = 2,
},
},
milkShake = {
require = {
blueberries = 1,
milk = 1,
sugar = 1,
},
},
lemonade = {
require = {
lemon = 2,
water = 1,
sugar = 1,
},
},
lobsterBisque = {
require = {
fish_Lobster = 1,
milk = 1,
salt = 1,
},
},
bread = {
require = {
water = 1,
wheatFlour = 1,
salt = 1,
sugar = 1,
},
},
bruschetta = {
require = {
bread = 1,
tomato = 1,
oregano = 1,
},
},
waffles = {
require = {
sugar = 1,
salt = 1,
egg = 1,
wheatFlour = 3,
milk = 1,
honey = 1,
},
},
grilledLobster = {
require = {
fish_Lobster = 1,
salt = 2,
lemon = 3,
},
},
frogSandwich = {
require = {
fish_Frog = 1,
bread = 1,
tomato = 1,
},
},
chocolateCake = {
require = {
chocolate = 2,
milk = 1,
egg = 3,
sugar = 1,
wheatFlour = 3,
},
},
salad = {
require = {
tomato = 2,
egg = 1,
cheese = 1,
lettuce = 2,
},
},
pierogies = {
require = {
cheese = 1,
wheatFlour = 2,
egg = 2,
salt = 1,
potato = 2,
},
},
frenchFries = {
require = {
potato = 2,
salt = 1,
},
},
pudding = {
require = {
milk = 2,
sugar = 1,
egg = 3
},
},
garlicBread = {
require = {
bread = 1,
garlic = 1,
cheese = 1,
oregano = 1,
salt = 1,
},
},
}
|
--Automatically generated by SWGEmu Spawn Tool v0.12 loot editor.
jedi_belt_01 = {
minimumLevel = 0,
maximumLevel = -1,
customObjectName = "",
directObjectTemplate = "object/tangible/loot/loot_schematic/armor_jedi_belt_01_schematic.iff",
craftingValues = {},
customizationStringNames = {},
customizationValues = {},
}
addLootItemTemplate("jedi_belt_01", jedi_belt_01)
|
-- MODULE CONFIG.LUA
-- by Garran Plum
--
-- GP Configuration for this individual mod.
-- IMPORT GP OBJECT
local myMod, GP = ...
-- MY CONFIG Mod Name
local modName = "casaDeFruta"
-- MY CONFIG Paths
local pathList = {"Worker_1", "Worker_2", "Transport", "Visitor"}
local trayPathList = {"Worker_1", "Transport"}
-- MY CONFIG Jobs
local jobs = {
FISHMONGER = {Work = "MARKET_TENDER", Walk = "WALKING", Delay = 7},
BERRYTENDER = {Work = "MARKET_TENDER", Walk = "WALKING", Delay = 7}
}
-- MY CONFIG Workplaces
local workplaces = {
FISH_PRODUCER = {
Job = "FISHMONGER",
Positions = 1,
Produces = {FISH = 0},
Requires = {FISH = 1},
Carries = {FISH = 5}
},
FISH_GENERATOR = {Produces = {FISH = 5}, Rate = 0.03125},
BERRY_PRODUCER = {
Job = "BERRYTENDER",
Positions = 1,
Produces = {BERRIES = 0},
Requires = {BERRIES = 1},
Carries = {BERRIES = 5}
}
}
-- MY CONFIG Categories
local categories = {
BARREL = {
Barrel = {
Function = "FISH_PRODUCER",
PathNodes = pathList,
PathTypes = {DEFAULT = "Worker_1"}
}
},
CRATE = {
Crate = {
Order = 2,
Function = "FISH_GENERATOR",
PathNodes = pathList,
PathTypes = {DEFAULT = "Transport"}
},
CRATE_FLAT_IRON = {
Order = 1,
AssetRegistered = true,
BuildingRegistered = true
},
Crate_Stack = {
Order = 1,
Function = "FISH_GENERATOR",
PathNodes = pathList,
PathTypes = {DEFAULT = "Transport"}
}
},
PRODUCE_CRATE = {
Produce_Crate = {
Function = "BERRY_PRODUCER",
PathNodes = trayPathList,
PathTypes = {DEFAULT = "Worker_1"}
}
},
TROUGH = {TROUGH_HAY = {AssetRegistered = true, BuildingRegistered = true}},
BUCKET = {
BUCKET_WATER = {AssetRegistered = true, BuildingRegistered = true}
},
TABLE = {
TABLE_WOOD1 = {AssetRegistered = true, BuildingRegistered = true},
TABLE_WOOD2 = {AssetRegistered = true, BuildingRegistered = true}
},
SEATING = {
BENCH_WOOD1 = {AssetRegistered = true, BuildingRegistered = true},
STOOL_WOOD1 = {AssetRegistered = true, BuildingRegistered = true},
STOOL_WOOD2 = {AssetRegistered = true, BuildingRegistered = true}
},
FRIENDS = {Black_Cat = {}, Coon_Cat = {}, Boxer_Dog = {}, Collie_Dog = {}},
DECOR = {
BUILDING_PART_MARKET_BLUE_TENT = {
Order = 1,
AssetRegistered = true,
BuildingRegistered = true
},
BUILDING_PART_MARKET_FOOD_SIGN = {
Order = 2,
AssetRegistered = true,
BuildingRegistered = true
},
Flower_Yellow = {Order = 3},
Flower_Blue = {Order = 4},
Flower_Orange = {Order = 5}
}
}
-- MY CONFIG Model Files
local modelFiles = {
[modName] = {"PRODUCE_CRATE"},
fishBarrel = {"CRATE", "DECOR", "BARREL"},
friends = {"FRIENDS"}
}
-- MY CONFIG Node Types
-- local nodeTypes = {MINOR = {"FISH"}}
-- MY CONFIG Monuments
local monuments = {
CASA_DE_FRUTA = {
Categories = {
BARREL = {Order = 1},
CRATE = {Order = 2},
PRODUCE_CRATE = {Order = 3},
BUCKET = {Order = 4},
TROUGH = {Order = 5},
TABLE = {Order = 6},
SEATING = {Order = 7},
FRIENDS = {Order = 8},
DECOR = {Order = 9}
},
Type = "FOOD_PRODUCTION",
Function = {},
Logo = "BUILDING_PART_MARKET_FOOD_SIGN"
}
}
-- WARNING!
--
-- MY CONFIG Ends Here. Changing code below this line will change *GPS*, not just your mod!
-- As an alternative to the code above, you may return your own config table.
--
--
-- Create the config table.
local config = {
version = GP:gpsVersion(),
remix = remix or {},
modName = modName,
modelFiles = modelFiles or {},
categories = categories or {},
nodeTypes = nodeTypes or {},
jobs = jobs or {},
workplaces = workplaces or {},
generators = generators or {},
monuments = monuments or {},
buildings = buildings or {},
logo = logo or {}
}
-- Return config to loader
return config
|
--[[
Copyright (c) 2019, Vsevolod Stakhov <vsevolod@highsecure.ru>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--
--[[ Lua LPEG grammar based on https://github.com/xolox/lua-lxsh/ ]]
local lpeg = require "lpeg"
local P = lpeg.P
local R = lpeg.R
local S = lpeg.S
local D = R'09' -- Digits
local I = R('AZ', 'az', '\127\255') + '_' -- Identifiers
local B = -(I + D) -- Word boundary
local EOS = -lpeg.P(1) -- end of string
-- Pattern for long strings and long comments.
local longstring = #(P'[[' + (P'[' * P'='^0 * '[')) * P(function(input, index)
local level = input:match('^%[(=*)%[', index)
if level then
local _, last = input:find(']' .. level .. ']', index, true)
if last then return last + 1 end
end
end)
-- String literals.
local singlequoted = P"'" * ((1 - S"'\r\n\f\\") + (P'\\' * 1))^0 * "'"
local doublequoted = P'"' * ((1 - S'"\r\n\f\\') + (P'\\' * 1))^0 * '"'
-- Comments.
local eol = P'\r\n' + '\n'
local line = (1 - S'\r\n\f')^0 * eol^-1
local singleline = P'--' * line
local multiline = P'--' * longstring
-- Numbers.
local sign = S'+-'^-1
local decimal = D^1
local hexadecimal = P'0' * S'xX' * R('09', 'AF', 'af') ^ 1
local float = D^1 * P'.' * D^0 + P'.' * D^1
local maybeexp = (float + decimal) * (S'eE' * sign * D^1)^-1
local function compile_keywords(keywords)
local list = {}
for word in keywords:gmatch('%S+') do
list[#list + 1] = word
end
-- Sort by length
table.sort(list, function(a, b)
return #a > #b
end)
local pattern
for _, word in ipairs(list) do
local p = lpeg.P(word)
pattern = pattern and (pattern + p) or p
end
local AB = B + EOS -- ending boundary
return pattern * AB
end
-- Identifiers
local ident = I * (I + D)^0
local expr = ('.' * ident)^0
local patterns = {
{'whitespace', S'\r\n\f\t\v '^1},
{'constant', (P'true' + 'false' + 'nil') * B},
{'string', singlequoted + doublequoted + longstring},
{'comment', multiline + singleline},
{'number', hexadecimal + maybeexp},
{'operator', P'not' + '...' + 'and' + '..' + '~=' + '==' + '>=' + '<='
+ 'or' + S']{=>^[<;)*(%}+-:,/.#'},
{'keyword', compile_keywords([[
break do else elseif end for function if in local repeat return then until while
]])},
{'identifier', lpeg.Cmt(ident,
function(input, index)
return expr:match(input, index)
end)
},
{'error', 1},
}
local compiled
local function compile_patterns()
if not compiled then
local function process(elt)
local n,grammar = elt[1],elt[2]
return lpeg.Cc(n) * lpeg.P(grammar) * lpeg.Cp()
end
local any = process(patterns[1])
for i = 2, #patterns do
any = any + process(patterns[i])
end
compiled = any
end
return compiled
end
local function sync(token, lnum, cnum)
local lastidx
lnum, cnum = lnum or 1, cnum or 1
if token:find '\n' then
for i in token:gmatch '()\n' do
lnum = lnum + 1
lastidx = i
end
cnum = #token - lastidx + 1
else
cnum = cnum + #token
end
return lnum, cnum
end
local exports = {}
exports.gmatch = function(input)
local parser = compile_patterns()
local index, lnum, cnum = 1, 1, 1
return function()
local kind, after = parser:match(input, index)
if kind and after then
local text = input:sub(index, after - 1)
local oldlnum, oldcnum = lnum, cnum
index = after
lnum, cnum = sync(text, lnum, cnum)
return kind, text, oldlnum, oldcnum
end
end
end
exports.lex_to_table = function(input)
local out = {}
for kind, text, lnum, cnum in exports.gmatch(input) do
out[#out + 1] = {kind, text, lnum, cnum}
end
return out
end
return exports
|
local vm = require 'vm'
local ws = require 'workspace'
local furi = require 'file-uri'
local files = require 'files'
local function asString(source)
local literal = vm.getLiteral(source)
if type(literal) ~= 'string' then
return nil
end
local parent = source.parent
if parent and parent.type == 'callargs' then
local result
local call = parent.parent
local node = call.node
local lib = vm.getLibrary(node)
if not lib then
return
end
if lib.name == 'require' then
result = ws.findUrisByRequirePath(literal, true)
elseif lib.name == 'dofile'
or lib.name == 'loadfile' then
result = ws.findUrisByFilePath(literal, true)
end
if result and #result > 0 then
for i, uri in ipairs(result) do
uri = files.getOriginUri(uri)
local path = furi.decode(uri)
if files.eq(path:sub(1, #ws.path), ws.path) then
path = path:sub(#ws.path + 1)
end
path = path:gsub('^[/\\]*', '')
result[i] = ('[%s](%s)'):format(path, uri)
end
table.sort(result)
return table.concat(result, '\n')
end
end
end
local function tryLibrary(source)
local lib = vm.getLibrary(source)
if not lib then
return
end
return lib.description
end
return function (source)
if source.type == 'string' then
return asString(source)
end
return tryLibrary(source)
end
|
local PlatformService = nil
pcall(function() PlatformService = game:GetService('PlatformService') end)
local Actions = script.Parent.Parent.Actions
local SetRecentlyPlayedGamesFetching = require(Actions.SetRecentlyPlayedGamesFetching)
local SetRecentlyPlayedGames = require(Actions.SetRecentlyPlayedGames)
local RETRIES = 6
local RECENT_SORT_KEY = "-2"
local FEATURED_SORT_KEY = "8"
local function fetchRecentlyPlayedGamesAsync(store, numOfGames)
local success = false
local tryCount = 1
-- This retry logic is here for those cases where the appshell data model failed to get the recent sort and is retrying.
while tryCount <= RETRIES do
local sharedData = PlatformService:ReadSharedData() or {}
local gameCache = sharedData.games
if sharedData.sorts ~= nil and gameCache ~= nil then
local gamesIncluded = {}
local count = 0
local recentSortData = {}
if sharedData.sorts[RECENT_SORT_KEY] ~= nil and sharedData.sorts[RECENT_SORT_KEY].orderedSort ~= nil then
local recentSort = sharedData.sorts[RECENT_SORT_KEY].orderedSort
for i in ipairs(recentSort) do
if recentSort[i].HasData == false or count == numOfGames then
break
end
--Check if there are cached game data available.
local gameData = sharedData.games[tostring(recentSort[i].PlaceId)]
if gameData then
gamesIncluded[recentSort[i].PlaceId] = true
table.insert(recentSortData, gameData)
count = count + 1
end
end
end
if count < numOfGames then
-- Add recommended games to fill up the remining games.
if sharedData.sorts[FEATURED_SORT_KEY] ~= nil and sharedData.sorts[FEATURED_SORT_KEY].orderedSort ~= nil then
local backupSort = sharedData.sorts[FEATURED_SORT_KEY].orderedSort
for i in ipairs(backupSort) do
if backupSort[i].HasData == false or count == numOfGames then
break
end
local gameData = sharedData.games[tostring(backupSort[i].PlaceId)]
if gameData and gamesIncluded[backupSort[i].PlaceId] ~= true then
gamesIncluded[backupSort[i].PlaceId] = true
table.insert(recentSortData, gameData)
count = count + 1
end
end
end
end
if count >= numOfGames then
store:dispatch(SetRecentlyPlayedGames(recentSortData))
store:dispatch(SetRecentlyPlayedGamesFetching(false))
success = true
break
end
end
tryCount = tryCount + 1
wait(tryCount ^ 2)
end
if success == false then
store:dispatch(SetRecentlyPlayedGames(nil))
end
end
return function(numOfGames, forceUpdate)
return function(store)
local state = store:getState()
local isFetching = state.RecentlyPlayedGamesFetchingStatus.fetching
if isFetching then
return
elseif isFetching ~= nil and not forceUpdate then
return
end
store:dispatch(SetRecentlyPlayedGamesFetching(true))
spawn(function()
fetchRecentlyPlayedGamesAsync(store, numOfGames)
end)
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.