content stringlengths 5 1.05M |
|---|
-- Disable strict for Tarantool.
require("strict").off()
|
-- See LICENSE for terms
-- I use the mirror ball thingy to hide my shame
if not g_AvailableDlc.contentpack1 then
print("Base Walls Needs DLC Installed: Mysteries Resupply Pack (it's free)!")
return
end
local point = point
local table_find = table.find
local table_iclear = table.iclear
local table_rand = table.rand
local IsValidEntity = IsValidEntity
local SuspendPassEdits = SuspendPassEdits
local ResumePassEdits = ResumePassEdits
local GetConstructionController = GetConstructionController
local Translate = ChoGGi.ComFuncs.Translate
local icon_path = CurrentModPath .. "UI/"
local description = T(302535920011004, "It's a wall (use button to rotate after placing).") .. "\n\n"
local wall_types = {
ChoGGi_BaseWall = {
build_pos = 2,
display_name = T(302535920011005, "Adjustable Length Wall"),
display_name_pl = T(302535920011006, "Adjustable Length Walls"),
display_icon = icon_path .. "wall_adjust.png",
description = description,
},
ChoGGi_BaseWallCap = {
build_pos = 3,
display_name = T(302535920011007, "Wall Cap"),
display_name_pl = T(302535920011008, "Walls Cap"),
display_icon = icon_path .. "wall_cap.png",
description = description .. T(302535920011009, "Cap off a wall."),
},
ChoGGi_BaseWallCapSmall = {
build_pos = 4,
display_name = T(302535920011010, "Wall Cap Small"),
display_name_pl = T(302535920011011, "Walls Cap Small"),
display_icon = icon_path .. "wall_capsmall.png",
description = description .. T(302535920011012, "Cap off a wall chibi."),
},
ChoGGi_BaseTurnWallSmall = {
build_pos = 5,
display_name = T(302535920011013, "Turn Wall Small"),
display_name_pl = T(302535920011014, "Turn Walls Small"),
display_icon = icon_path .. "wall_turn.png",
description = description .. T(302535920011015, "Small turn gate."),
},
ChoGGi_BaseTurnWallLarge = {
build_pos = 6,
display_name = T(302535920011016, "Turn Wall Large"),
display_name_pl = T(302535920011017, "Turn Walls Large"),
display_icon = icon_path .. "wall_turnlarge.png",
description = description .. T(302535920011018, "Large turn gate."),
},
ChoGGi_BaseWallRamp = {
build_pos = 7,
display_name = T(302535920011019, "Drone Ramp"),
display_name_pl = T(302535920011020, "Drone Ramps"),
display_icon = "UI/Icons/Buildings/passage_ramp.tga",
description = description .. T(302535920011021, "Help the wee ones over the walls."),
},
}
-- used for the two holder corners
local corner_objects = {
"LightSphere",
"PlanetEarth",
"PlanetMars",
"Mystery_MirrorSphere",
}
local description_corner = T(302535920011022, "Something to use instead of the turns.") .. "\n\n"
-- add some corners joiners if people don't like the crappy curves
local corner_types = {
ChoGGi_CornerJoiner_Eye = {
build_pos = 1,
entity = "DefenceTurretPlatform",
display_name = T(302535920011023, "Eye"),
display_name_pl = T(302535920011024, "Eyes"),
display_icon = icon_path .. "corner_eye.png",
description = description_corner .. T(302535920011025, "Eyes always watching you."),
},
ChoGGi_CornerJoiner_Stumpy = {
build_pos = 2,
entity = "ReprocessingPlantBarrel",
display_name = T(302535920011026, "Stumpy"),
display_name_pl = T(302535920011027, "Stumpies"),
display_icon = icon_path .. "corner_stumpy.png",
description = description_corner .. T(302535920011028, "Hunk 'o stump."),
},
ChoGGi_CornerJoiner_Holder = {
build_pos = 3,
entity = "DefenceTurret",
display_name = T(302535920011029, "Holder Sphere"),
display_name_pl = T(302535920011030, "Holder Spheres"),
display_icon = icon_path .. "corner_holder.png",
description = description_corner .. T(302535920011031, "Glory be to the light (or planet or mirror)."),
objects = corner_objects,
},
-- add a switch corner button?
ChoGGi_CornerJoiner_Star = {
build_pos = 4,
entity = "RoverChinaSolarPanel",
display_name = T(302535920011032, "Mars Star"),
display_name_pl = T(302535920011033, "Mars Stars"),
display_icon = icon_path .. "corner_marsstar.png",
description = description_corner .. T(302535920011034, "Bask in the glory of Mother Mars."),
objects = corner_objects,
},
ChoGGi_CornerJoiner_Umbrella = {
build_pos = 5,
entity = "StirlingGeneratorCP3",
display_name = T(302535920011035, "Umbrella"),
display_name_pl = T(302535920011036, "Umbrellas"),
display_icon = icon_path .. "corner_umbrella.png",
description = description_corner .. T(302535920011037, "Protect the poor walls from the deadly sun."),
},
}
-- + - numbers intertwined (spacing between passages)
local offsets = {}
do -- offset points
local c_m = -1
local c_p = 0
for i = 500, 200500, 1000 do
c_p = c_p + 2
offsets[c_p] = point(i, 0, 0)
end
for i = -500, -200500, -1000 do
c_m = c_m + 2
offsets[c_m] = point(i, 0, 0)
end
--~ ex(offsets)
end -- do
-- simple ent obj, we don't need any attaches or whatnot for the entities
DefineClass.ChoGGi_BaseWallClass = {
__parents = {
"ComponentAttach",
},
building_scale = 25,
building_cap_entity = IsValidEntity("TubeChromeJoint")
and "TubeChromeJoint" or "TubeJoint",
building_scale_cap = 255,
building_cap_offset = point(-400, 0, 0),
building_cap_angle = 180 * 60,
offsets = offsets,
coll_flags = const.efWalkable,
-- table from types list
item_table = false,
current_holder_object = false,
-- wall/wall_adjust/corner
item_type = false,
-- we change this in build mode
spawn_wall_count = 1,
spawning_objs = false,
}
local OBaseWallClass
-- when we call it from building templates
local cursor_building = false
DefineClass.ChoGGi_BaseWalls = {
__parents = {
"Building",
},
-- buttons
ip_template = "ipChoGGi_BaseWalls",
-- store attached stuff
attached_objs = false,
}
function ChoGGi_BaseWalls:GameInit()
self.attached_objs = {}
end
-- default to reg pass
function ChoGGi_BaseWalls:SpawnBaseObj(cls, parent)
local obj = OBaseWallClass:new()
obj:ChangeEntity(cls or "PassageCovered")
if cursor_building then
cursor_building:Attach(obj)
else
(parent or self):Attach(obj)
end
if not parent and self.attached_objs then
self.attached_objs[#self.attached_objs+1] = obj
end
return obj
end
function ChoGGi_BaseWalls:SpawnPassages(amount, offset, angle, parent)
if not amount then
local obj = self:SpawnBaseObj()
if offset then
obj:SetAttachOffset(offset)
end
if angle then
obj:SetAttachAngle(angle)
end
return obj
end
-- we scaled them down to 25% so 4==1
-- had to go to 25, so we can fit "turn"s in one hex
amount = amount * 4
for i = 1, amount do
self:SpawnBaseObj(nil, parent):SetAttachOffset(self.offsets[i])
end
end
function ChoGGi_BaseWalls:SpawnTurn(offset)
local obj = self:SpawnBaseObj("PassageCoveredTurn")
if offset then
obj:SetAttachOffset(offset)
end
return obj
end
function ChoGGi_BaseWalls:SpawnJoint(parent)
local cap = OBaseWallClass:new()
cap:ChangeEntity(self.building_cap_entity)
cap:SetScale(self.building_scale_cap)
-- yes it needs the "do end"
do (parent or self):Attach(cap) end
return cap
end
function ChoGGi_BaseWalls:SpawnCap()
local entrance = self:SpawnBaseObj("PassageEntrance")
local cap = self:SpawnJoint(entrance)
cap:SetAttachOffset(self.building_cap_offset)
cap:SetAngle(self.building_cap_angle)
return entrance, cap
end
function ChoGGi_BaseWalls:SpawnShortTurnCover(offset, parent)
local obj = self:SpawnBaseObj("DomeDoorEntrance_01", parent)
if offset then
obj:SetAttachOffset(offset)
end
obj:SetAxisAngle(point(-2495, 1402, 2930), 16957)
return obj
end
function ChoGGi_BaseWalls:UpdateHoldee(obj, entity, mars_star)
if entity == "PlanetEarth" or entity == "PlanetMars" then
obj:SetState("idle")
obj:SetScale(mars_star and 20 or 25)
obj:SetAttachOffset(point(0, 0, mars_star and -20 or 190))
elseif entity == "Mystery_MirrorSphere" then
obj:SetState("idle2")
obj:SetScale(mars_star and 10 or 15)
obj:SetAttachOffset(point(0, 0, mars_star and -210 or 30))
elseif entity == "LightSphere" then
obj:SetState("idle")
obj:SetScale(mars_star and 90 or 110)
obj:SetAttachOffset(point(0, 0, mars_star and -30 or 270))
end
end
-- wall spawner
function ChoGGi_BaseWalls:SpawnWallAttaches(cursor_obj, count)
if self.spawning_objs then
return
end
self.spawning_objs = true
local id = (cursor_obj and cursor_obj.template or self).template_name
local item = wall_types[id] or wall_types.ChoGGi_BaseWall
self.item_table = item
self.item_type = "wall"
-- clear existing length (yeah i'm lazy sue me)
do (cursor_obj or self):DestroyAttaches() end
if self.attached_objs then
table_iclear(self.attached_objs)
end
-- not actual entity, but we use it to change skins
self.entity = self.entity ~= "InvisibleObject" and self.entity or "Passage"
-- speeds up adding/removing/etc with objects
SuspendPassEdits("ChoGGi.BaseWalls.SpawnAttaches")
if id == "ChoGGi_BaseWall" then
self:SpawnPassages(count or self.spawn_wall_count)
self.item_type = "wall_adjust"
-- two pass with a cap
elseif id == "ChoGGi_BaseWallCap" then
self:SpawnCap():SetAttachOffset(self.offsets[2])
self:SpawnPassages(nil,self.offsets[1])
self:SpawnPassages(nil,self.offsets[3])
-- just cap
elseif id == "ChoGGi_BaseWallCapSmall" then
self:SpawnCap():SetAttachOffset(self.offsets[3])
-- one hex degree turn
elseif id == "ChoGGi_BaseTurnWallSmall" then
local obj
-- two turns
self:SpawnTurn(self.offsets[4])
obj = self:SpawnTurn(point(750, 1300, 0))
obj:SetAttachAngle(18000)
-- and a straight, +1 to avoid flicker
obj = self:SpawnPassages(nil,point(1170, 620, 1), 7200)
-- somethings to cover up my shame
obj = self:SpawnBaseObj("InvisibleObject")
obj:SetScale(125)
obj:SetAttachOffset(point(-243, -332, -70))
obj:SetAxisAngle(point(2032, 2393, 2630), 21498)
-- no clue why this doesn't work but the below does... the magic of SM (if you can figure it out, pray tell)
--~ local x, z = 885, 231
--~ for _ = 1, 9 do
--~ x = x + 25
--~ z = z - 1
--~ self:SpawnShortTurnCover(point(x, 1360, z), obj)
--~ end
local x, z = 910, 230
self:SpawnShortTurnCover(point(x, 1360, z), obj)
x = x + 25
z = z - 1
self:SpawnShortTurnCover(point(x, 1320, z), obj)
x = x + 25
z = z - 1
self:SpawnShortTurnCover(point(x, 1280, z), obj)
x = x + 25
z = z - 1
self:SpawnShortTurnCover(point(x, 1240, z), obj)
x = x + 25
z = z - 1
self:SpawnShortTurnCover(point(x, 1200, z), obj)
x = x + 25
z = z - 1
self:SpawnShortTurnCover(point(x, 1160, z), obj)
x = x + 25
z = z - 1
self:SpawnShortTurnCover(point(x, 1120, z), obj)
x = x + 25
z = z - 1
self:SpawnShortTurnCover(point(x, 1080, z), obj)
x = x + 25
z = z - 1
self:SpawnShortTurnCover(point(x, 1040, z), obj)
-- two hex degree turn
elseif id == "ChoGGi_BaseTurnWallLarge" then
self:SpawnPassages(nil,point(-750, 1300, 0), 7200)
self:SpawnPassages(nil,point(-260, 450, 0), 7200)
-- +1 to avoid flicker
self:SpawnTurn(point(0, 0, 1))
self:SpawnPassages(nil,self.offsets[4])
self:SpawnPassages(nil,self.offsets[2])
-- something to cover up my shame
local shame = OBaseWallClass:new()
shame:SetAttachOffset(point(-30, -30, -620))
shame:SetScale(33)
shame:ChangeEntity("Mystery_MirrorSphere")
shame:SetColorModifier(0)
shame:SetState("static")
self:Attach(shame)
elseif id == "ChoGGi_BaseWallRamp" then
self:SpawnBaseObj("PassageRamp")
end
-- we don't use attached_objs for the building placement version
if self.attached_objs then
local attached = #self.attached_objs
self.spawn_wall_count = attached / 4
CreateRealTimeThread(function()
WaitMsg("OnRender")
for i = 1, attached do
self.attached_objs[i]:SetEnumFlags(self.coll_flags)
end
self.spawning_objs = false
ResumePassEdits("ChoGGi.BaseWalls.SpawnAttaches")
end)
else
self.spawning_objs = false
ResumePassEdits("ChoGGi.BaseWalls.SpawnAttaches")
end
end
-- corner spawner
function ChoGGi_BaseWalls:SpawnCornerAttaches(cursor_obj)
local id = (cursor_obj and cursor_obj.template or self).template_name
local item = corner_types[id] or corner_types.DefenceTurretPlatform
self.item_table = item
self.item_type = "corner"
-- speeds up adding/removing/etc with objects
SuspendPassEdits("ChoGGi.BaseWalls.SpawnCornerAttaches")
-- always spawn something
local obj = self:SpawnBaseObj(item.entity)
-- Colour, Roughness, Metallic (r/m go from -128 to 127)
if id == "ChoGGi_CornerJoiner_Eye" then
obj:SetAngle(1800)
obj:SetScale(263)
obj:SetAttachOffset(point(0, 0, -1036))
obj:SetColorizationMaterial(2, -4692187, 127, -48)
elseif id == "ChoGGi_CornerJoiner_Stumpy" then
obj:SetScale(175)
obj:SetAttachOffset(point(1170, -10, -1908))
obj:SetAxisAngle(point(0, -4096, 0), 5400)
obj:SetColorizationMaterial(1, -4692187, 127, -48)
elseif id == "ChoGGi_CornerJoiner_Holder" then
obj:SetScale(123)
obj:SetColorizationMaterial(1, -1, -128, 127)
obj:SetColorizationMaterial(2, -4692187, 127, -48)
obj:SetColorizationMaterial(3, -13480117, -128, 48)
local holdee = table_rand(item.objects)
obj = self:SpawnBaseObj(holdee, obj)
self:UpdateHoldee(obj, holdee)
self.current_holder_object = obj
-- set pos and such and attach what's needed
elseif id == "ChoGGi_CornerJoiner_Star" then
obj:SetScale(200)
obj:SetState("idle2")
obj:SetAxisAngle(point(4096, 0, 0), 10700)
obj:SetAttachOffset(point(0, 0, 395))
local holdee = table_rand(item.objects)
obj = self:SpawnBaseObj(holdee, obj)
self:UpdateHoldee(obj, holdee, true)
self.current_holder_object = obj
elseif id == "ChoGGi_CornerJoiner_Umbrella" then
obj:SetState("idleOpened")
obj:SetScale(125)
obj:SetAngle(1800)
obj:SetAttachOffset(point(0, 0, -928))
obj:SetColorizationMaterial(1, -13480117, -128, 48)
obj:SetColorizationMaterial(2, -1, -128, 127)
obj:SetColorizationMaterial(3, -4692187, 127, -48)
end
ResumePassEdits("ChoGGi.BaseWalls.SpawnCornerAttaches")
end
-- swap between stuff for the holder corners
function ChoGGi_BaseWalls:SwapHolder()
if not (self.current_holder_object or self.item_table.objects) then
return
end
-- grab the next entity
local idx = table_find(self.item_table.objects, self.current_holder_object.entity)
local next_ent = self.item_table.objects[idx+1]
if not next_ent then
next_ent = self.item_table.objects[1]
end
self.current_holder_object:ChangeEntity(next_ent)
local which_holder = self.current_holder_object:GetParent():GetEntity() ~= "DefenceTurret"
self:UpdateHoldee(self.current_holder_object, next_ent, which_holder)
end
-- stop showing the no drone commander sign
ChoGGi_BaseWalls.ShouldShowNoCCSign = empty_func
-- round and round she goes, and where she stops BOB knows
function ChoGGi_BaseWalls:Rotate(toggle)
self:SetAngle((self:GetAngle() or 0) + (toggle and 1 or -1)*60*60)
end
function ChoGGi_BaseWalls:AdjustWallLength(toggle)
-- true deflate, false engorge
self:AdjustLength(toggle and -2 or 2, self.spawn_wall_count)
end
local table_lookup = {
PassageCovered = "pass",
PassageCoveredFacet = "pass",
PassageCoveredGeoscape = "pass",
PassageCoveredPack = "pass",
PassageCoveredStar = "pass",
PassageCoveredTurn = "turn",
PassageCoveredTurnFacet = "turn",
PassageCoveredTurnGeoscape = "turn",
PassageCoveredTurnPack = "turn",
PassageCoveredTurnStar = "turn",
PassageEntrance = "enter",
PassageEntranceFacet = "enter",
PassageEntranceGeoscape = "enter",
PassageEntrancePack = "enter",
PassageEntranceStar = "enter",
PassageRamp = "ramp",
PassageRampFacet = "ramp",
PassageRampGeoscape = "ramp",
PassageRampPack = "ramp",
PassageRampStar = "ramp",
}
local lookup_skins = {
Passage = {
pass = "PassageCovered",
turn = "PassageCoveredTurn",
enter = "PassageEntrance",
ramp = "PassageRamp",
},
Facet = {
pass = "PassageCoveredFacet",
turn = "PassageCoveredTurnFacet",
enter = "PassageEntranceFacet",
ramp = "PassageRampFacet",
},
Geoscape = {
pass = "PassageCoveredGeoscape",
turn = "PassageCoveredTurnGeoscape",
enter = "PassageEntranceGeoscape",
ramp = "PassageRampGeoscape",
},
Pack = {
pass = "PassageCoveredPack",
turn = "PassageCoveredTurnPack",
enter = "PassageEntrancePack",
ramp = "PassageRampPack",
},
}
local pass_skins = {
"Passage",
"Facet",
"Geoscape",
"Pack",
}
-- dlc skin
if IsValidEntity("PassageCoveredStar") then
lookup_skins.Star = {
pass = "PassageCoveredStar",
turn = "PassageCoveredTurnStar",
enter = "PassageEntranceStar",
ramp = "PassageRampStar",
}
pass_skins[#pass_skins+1] = "Star"
end
local pass_skins_c = #pass_skins
function ChoGGi_BaseWalls:ChangeSkin(skin)
local lookup = lookup_skins[skin]
SuspendPassEdits("ChoGGi.BaseWalls.ChangeSkin")
-- we need to change each spawned entity
for i = 1, #self.attached_objs do
local obj = self.attached_objs[i]
obj:ChangeEntity(lookup[table_lookup[obj.entity]])
end
ResumePassEdits("ChoGGi.BaseWalls.ChangeSkin")
local idx = table_find(pass_skins, skin) + 1
if not pass_skins[idx] then
idx = 1
end
self.entity = pass_skins[idx]
end
function ChoGGi_BaseWalls:GetSkins()
if self.item_type == "wall" or self.item_type == "wall_adjust" then
return pass_skins, empty_table
end
end
-- used below and for build mode
local spawn_wall_count = 1
-- abort if we're already adjusting
local adjusting = false
function ChoGGi_BaseWalls:AdjustLength(size, current_size)
if adjusting or not IsValid(self) then
return
end
-- so we don't spam the spawn func
adjusting = true
spawn_wall_count = current_size + size
if spawn_wall_count < 1 then
spawn_wall_count = 1
elseif spawn_wall_count > 99 then
-- I could add more, but that's enough unless someone complains for more
-- I pre-make the list for speed
-- 202/4
spawn_wall_count = 100
end
-- no need to change if it's the same
if self.previous_count ~= spawn_wall_count then
-- speeds up adding/removing/etc with objects
SuspendPassEdits("ChoGGi.BaseWalls.AdjustLength")
-- get skin to reset new wall to
local entity = self.entity or "Passage"
local idx = table_find(pass_skins, entity) - 1
if not pass_skins[idx] then
if idx == 0 then
idx = pass_skins_c
else
idx = 1
end
end
entity = pass_skins[idx]
-- build menu or placed obj
if self:IsKindOf("ChoGGi_BaseWalls") then
self.spawn_wall_count = spawn_wall_count
self:SpawnWallAttaches()
else
-- we use self.spawn_wall_count for the first go
self.ChoGGi_bs.spawn_wall_count = spawn_wall_count
self.ChoGGi_bs:SpawnWallAttaches(self, spawn_wall_count)
end
self:ChangeSkin(entity)
ResumePassEdits("ChoGGi.BaseWalls.AdjustLength")
self.previous_count = spawn_wall_count
end
adjusting = false
end
DefineClass.ChoGGi_BaseWallCorner = {
__parents = {
"ChoGGi_BaseWalls",
"ChoGGi_BaseWallClass",
},
}
function ChoGGi_BaseWallCorner:GameInit()
self:SpawnCornerAttaches()
end
DefineClass.ChoGGi_BaseWall = {
__parents = {
"ChoGGi_BaseWalls",
"ChoGGi_BaseWallClass",
},
}
function ChoGGi_BaseWall:GameInit()
-- scales attaches
self:SetScale(self.building_scale)
self:SpawnWallAttaches()
end
function OnMsg.ClassesPostprocess()
OBaseWallClass = ChoGGi_BaseWallClass
local bc = BuildCategories
if not table.find(bc, "id", "ChoGGi_BaseWalls") then
bc[#bc+1] = {
id = "ChoGGi_BaseWalls",
name = T(302535920011039, "Base Walls"),
image = icon_path .. "bmc_basewalls.png",
--~ highlight = "UI/Icons/bmc_placeholder_shine.tga",
}
end
local IsMassUIModifierPressed = IsMassUIModifierPressed
local XTemplates = XTemplates
-- added to stuff spawned with object spawner
if XTemplates.ipChoGGi_BaseWalls then
XTemplates.ipChoGGi_BaseWalls:delete()
end
PlaceObj("XTemplate", {
group = "Infopanel Sections",
id = "ipChoGGi_BaseWalls",
PlaceObj("XTemplateTemplate", {
"__context_of_kind", "ChoGGi_BaseWalls",
"__template", "Infopanel",
}, {
------------------- Rotate
PlaceObj("XTemplateTemplate", {
"__template", "InfopanelButton",
"Icon", "UI/Icons/IPButtons/automated_mode_on.tga",
"RolloverTitle", T(1000077, "Rotate"),
"RolloverText", T(7519, "<left_click>") .. " "
.. T(312752058553, "Rotate Building Left").. "\n"
.. T(7366, "<right_click>") .. " "
.. T(306325555448, "Rotate Building Right"),
"RolloverHint", "",
"RolloverHintGamepad", T(7518, "ButtonA") .. " "
.. T(312752058553, "Rotate Building Left") .. " "
.. T(7618, "ButtonX") .. " " .. T(306325555448, "Rotate Building Right"),
"OnPress", function (self, gamepad)
self.context:Rotate(not gamepad and IsMassUIModifierPressed())
ObjModified(self.context)
end,
"AltPress", true,
"OnAltPress", function (self, gamepad)
if gamepad then
self.context:Rotate(gamepad)
else
self.context:Rotate(not IsMassUIModifierPressed())
end
ObjModified(self.context)
end,
}),
------------------- Rotate
------------------- Holdee Swap
PlaceObj("XTemplateTemplate", {
"__template", "InfopanelButton",
"__condition", function(_, context)
return context.current_holder_object
end,
"Icon", "UI/Icons/IPButtons/pin.tga",
"RolloverTitle", T(302535920011040, "Holdee Swap"),
"RolloverText", T(302535920011041, "Different strokes for different folks."),
"OnPress", function (self)
self.context:SwapHolder()
ObjModified(self.context)
end,
}),
------------------- Holdee Swap
------------------- Adjust length
PlaceObj("XTemplateTemplate", {
"__template", "InfopanelButton",
"__condition", function(_, context)
return context.item_type == "wall_adjust"
end,
"Icon", "UI/Icons/IPButtons/drill.tga",
"RolloverTitle", T(302535920011042, "Adjust Length"),
"RolloverText", T(302535920011043, [[Adjust length of placed wall.
<em>Would you care for another schnitzengruben?</em>]]),
"RolloverHint", T(7519, "<left_click>") .. " " .. T(1000541, "+") .. " "
.. T(7366, "<right_click>") .. " " .. T(1000540, "-"),
"RolloverHintGamepad", T(7518, "ButtonA") .. " " .. T(1000541, "+")
.. " " .. T(7618, "ButtonX") .. " " .. T(1000540, "-"),
"OnPress", function (self, gamepad)
self.context:AdjustWallLength(not gamepad and IsMassUIModifierPressed())
ObjModified(self.context)
end,
"AltPress", true,
"OnAltPress", function (self, gamepad)
if gamepad then
self.context:AdjustWallLength(gamepad)
else
self.context:AdjustWallLength(not IsMassUIModifierPressed())
end
ObjModified(self.context)
end,
}),
------------------- Adjust length
------------------- Salvage
PlaceObj('XTemplateTemplate', {
'comment', "salvage",
'__context_of_kind', "Demolishable",
'__condition', function (_, context) return context:ShouldShowDemolishButton() end,
'__template', "InfopanelButton",
'RolloverTitle', T(3973, --[[XTemplate ipBuilding RolloverTitle]] "Salvage"),
'RolloverHintGamepad', T(7657, --[[XTemplate ipBuilding RolloverHintGamepad]] "<ButtonY> Activate"),
'Id', "idSalvage",
'OnContextUpdate', function (self, context, ...)
local refund = context:GetRefundResources() or empty_table
local rollover = T(7822, "Destroy this building.")
if IsKindOf(context, "LandscapeConstructionSiteBase") then
self:SetRolloverTitle(T(12171, "Cancel Landscaping"))
rollover = T(12172, "Cancel this landscaping project. The terrain will remain in its current state")
end
if refund[1] then
rollover = rollover .. "<newline><newline>" .. T(7823, "<UIRefundRes> will be refunded upon salvage.")
end
self:SetRolloverText(rollover)
context:ToggleDemolish_Update(self)
end,
'OnPressParam', "ToggleDemolish",
'Icon', "UI/Icons/IPButtons/salvage_1.tga",
}, {
PlaceObj('XTemplateFunc', {
'name', "OnXButtonDown(self, button)",
'func', function (self, button)
if button == "ButtonY" then
return self:OnButtonDown(false)
elseif button == "ButtonX" then
return self:OnButtonDown(true)
end
return (button == "ButtonA") and "break"
end,
}),
PlaceObj('XTemplateFunc', {
'name', "OnXButtonUp(self, button)",
'func', function (self, button)
if button == "ButtonY" then
return self:OnButtonUp(false)
elseif button == "ButtonX" then
return self:OnButtonUp(true)
end
return (button == "ButtonA") and "break"
end,
}),
}),
------------------- Salvage
PlaceObj("XTemplateTemplate", {
"__template", "sectionCheats",
}),
}),
})
if BuildingTemplates.ChoGGi_BaseWall then
return
end
-- add our wall build objects
for id, item in pairs(wall_types) do
PlaceObj("BuildingTemplate", {
"Id", id,
"template_class", "ChoGGi_BaseWall",
--~ "construction_cost_Concrete", 1000,
"instant_build", true,
--~ "dome_forbidden", true,
"display_name", item.display_name,
"display_name_pl", item.display_name_pl,
"description", item.description or description,
"display_icon", item.display_icon,
"build_pos", item.build_pos,
-- changed below
--~ "entity", "Passage_Open",
"entity", "InvisibleObject",
"build_category", "ChoGGi_BaseWalls",
"Group", "Default",
"encyclopedia_exclude", true,
"on_off_button", false,
"prio_button", false,
"use_demolished_state", false,
"auto_clear", true,
})
end
-- and corner joiners
PlaceObj("BuildMenuSubcategory", {
build_pos = 1,
category = "ChoGGi_BaseWalls",
description = description_corner,
display_name = T(302535920011038, "Corner Joiners"),
group = "Default",
icon = icon_path .. "corner_subcat.png",
category_name = "ChoGGi_BaseWalls_Joiners",
id = "ChoGGi_BaseWalls_Joiners",
})
for id, item in pairs(corner_types) do
-- some are DLC
if IsValidEntity(item.entity) then
PlaceObj("BuildingTemplate", {
"Id", id,
"template_class", "ChoGGi_BaseWallCorner",
--~ "construction_cost_Concrete", 1000,
"instant_build", true,
--~ "dome_forbidden", true,
"display_name", item.display_name,
"display_name_pl", item.display_name_pl,
"description", item.description or description_corner,
"display_icon", item.display_icon,
"build_pos", item.build_pos,
-- needs something
"entity", "InvisibleObject",
"build_category", "ChoGGi_BaseWalls_Joiners",
"Group", "Default",
"encyclopedia_exclude", true,
"on_off_button", false,
"prio_button", false,
"use_demolished_state", false,
"auto_clear", true,
})
end
end
end
local Actions = ChoGGi.Temp.Actions
local c = #Actions
c = c + 1
Actions[c] = {ActionName = T(302535920011046, "BaseWalls") .. ": " .. T(302535920011044, "Adjust Longer"),
ActionId = "ChoGGi.AdjustWalls.Longer",
OnAction = function(self)
local ctrl = GetConstructionController()
if ctrl then
ChoGGi_BaseWalls.AdjustLength(ctrl.cursor_obj, 2, spawn_wall_count)
end
end,
ActionShortcut = "Shift-E",
ActionGamepad = "DPadLeft",
ActionBindable = true,
ActionMode = "AdjustAdjustWallsLength",
ActionMouseBindable = false,
}
c = c + 1
Actions[c] = {ActionName = T(302535920011046, "BaseWalls") .. ": " .. T(302535920011045, "Adjust Shorter"),
ActionId = "ChoGGi.AdjustWalls.Shorter",
OnAction = function(self)
local ctrl = GetConstructionController()
if ctrl then
ChoGGi_BaseWalls.AdjustLength(ctrl.cursor_obj, -2, spawn_wall_count)
end
end,
ActionShortcut = "Shift-Q",
ActionGamepad = "DPadRight",
ActionBindable = true,
ActionMode = "AdjustAdjustWallsLength",
ActionMouseBindable = false,
}
-- since we change the mode these don't work
c = c + 1
Actions[c] = {ActionName = T(302535920011046, "BaseWalls") .. ": " .. Translate(312752058553, "Rotate Building Left"),
ActionId = "ChoGGi.AdjustWalls.actionRotBuildingLeft",
ActionShortcut = "R",
ActionShortcut2 = "Shift-R",
ActionGamepad = "LeftShoulder",
ActionBindable = true,
ActionMode = "AdjustAdjustWallsLength",
ActionMouseBindable = false,
OnAction = function()
local obj = GetConstructionController()
if obj then
obj:Rotate(-1)
end
end,
}
c = c + 1
Actions[c] = {ActionName = "BaseWalls: " .. Translate(694856081085, "Rotate Building Right"),
ActionId = "ChoGGi.AdjustWalls.actionRotBuildingRight",
ActionShortcut = "T",
ActionShortcut2 = "Shift-T",
ActionGamepad = "RightShoulder",
ActionBindable = true,
ActionMode = "AdjustAdjustWallsLength",
ActionMouseBindable = false,
OnAction = function()
local obj = GetConstructionController()
if obj then
obj:Rotate(1)
end
end,
}
local shortcuts_mode
local orig_CursorBuilding_GameInit = CursorBuilding.GameInit
function CursorBuilding:GameInit(...)
local id = self.template and self.template.template_name
-- skip not ours
if not (wall_types[id] or corner_types[id]) then
return orig_CursorBuilding_GameInit(self, ...)
end
local bs = ChoGGi_BaseWall
self.ChoGGi_bs = bs
-- set this so spawn funcs use it as parent
cursor_building = self
-- use keys to adjust length
if id == "ChoGGi_BaseWall" then
shortcuts_mode = XShortcutsTarget and XShortcutsTarget:GetActionsMode()
XShortcutsSetMode("AdjustAdjustWallsLength")
end
--~ local dlg = ChoGGi.ComFuncs.OpenInExamineDlg(self)
--~ dlg:EnableAutoRefresh()
--~ CreateRealTimeThread(function()
--~ Sleep(1000)
--~ local dlg = ChoGGi.ComFuncs.OpenInExamineDlg(self.template)
--~ dlg:EnableAutoRefresh()
--~ end)
-- always spawn whatever
if self.template.build_category == "ChoGGi_BaseWalls" then
self:SetScale(bs.building_scale)
bs:SpawnWallAttaches(self)
else
bs:SpawnCornerAttaches(self)
end
return orig_CursorBuilding_GameInit(self, ...)
end
local orig_CursorBuilding_Done = CursorBuilding.Done
function CursorBuilding:Done(...)
cursor_building = false
if shortcuts_mode then
XShortcutsSetMode(shortcuts_mode)
shortcuts_mode = false
end
--~ self.ChoGGi_bs_mode = nil
return orig_CursorBuilding_Done(self, ...)
end
-- skip the Missing spot 'Top' in 'ConstructionSite' state 'idle' msg
local orig_AttachToObject = AttachToObject
function AttachToObject(to, childclass, spot_type, ...)
return orig_AttachToObject(
to, childclass, to:HasSpot(spot_type) and spot_type, ...
)
end
local orig_AttachPartToObject = AttachPartToObject
function AttachPartToObject(to, part, spot_type, ...)
return orig_AttachPartToObject(
to, part, to:HasSpot(spot_type) and spot_type, ...
)
end
|
/*
@library : rlib
@docs : https://docs.rlib.io
IF YOU HAVE NOT DIRECTLY RECEIVED THESE FILES FROM THE DEVELOPER, PLEASE CONTACT THE DEVELOPER
LISTED ABOVE.
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE
('CCPL' OR 'LICENSE'). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF
THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS
OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS
YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND
ONLY TO THE EXTENT OF ANY RIGHTS HELD IN THE LICENSED WORK BY THE LICENSOR. THE LICENSOR MAKES NO
REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR
OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MARKETABILITY, MERCHANTIBILITY,
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY,
OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
*/
/*
library
*/
local base = rlib
local helper = base.h
local design = base.d
local ui = base.i
/*
* localization > misc
*/
local cfg = base.settings
local mf = base.manifest
/*
* PANEL
*/
local PANEL = { }
/*
* Init
*/
function PANEL:Init( )
self:Declarations( )
self:SetSize ( 40, 15 )
self:SetCursor ( 'hand' )
self.enabled = false
end
/*
* FirstRun
*/
function PANEL:FirstRun( )
if ui:ok( self ) then
self:RequestFocus( )
end
self.bInitialized = true
end
/*
* IsEnabled
*
* @return : bool
*/
function PANEL:IsEnabled( )
return ( ( self.enabled == 1 or tostring( self.enabled ) == 'true' ) and true ) or false
end
/*
* OnMousePressed
*/
function PANEL:OnMousePressed( )
surface.PlaySound( 'ui/buttonclick.wav' )
self.enabled = not self.enabled
self:onOptionChanged( )
end
/*
* onOptionChanged
*/
function PANEL:onOptionChanged( ) end
/*
* PerformLayout
*/
function PANEL:PerformLayout( )
/*
* initialize only
*/
if not self.bInitialized then
self:FirstRun( )
end
end
/*
* Paint
*
* @param : int w
* @param : int h
*/
function PANEL:Paint( w, h )
local clr_main = self.hover and self.clr_main_h or self.clr_main_n
local clr_togg_n = ( self:IsEnabled( ) and self.clr_togg_e ) or self.clr_togg_n
local clr_togg_h = self.clr_togg_h
draw.RoundedBox( 8, 0, 0, w, h, clr_main )
if self:IsEnabled( ) then
design.circle( w - 10, 10, 7, 25, clr_togg_n )
if self.hover then
design.circle( w - 10, 10, 7, 25, clr_togg_h )
end
else
design.circle( 10, 10, 7, 25, clr_togg_n )
if self.hover then
design.circle( 10, 10, 7, 25, clr_togg_h )
end
end
end
/*
* Declarations
*/
function PANEL:Declarations( )
self.bInitialized = false
/*
* declare > colors
*/
self.clr_main_n = Color( 255, 255, 255, 5 )
self.clr_main_h = Color( 255, 255, 255, 9 )
self.clr_togg_n = Color( 214, 103, 144 )
self.clr_togg_e = Color( 103, 136, 214 )
self.clr_togg_h = Color( 255, 255, 255, 30 )
end
/*
* DefineControl
*/
derma.DefineControl( 'rlib.ui.toggle', 'rlib toggle', PANEL, 'EditablePanel' ) |
local state = {}
state._NAME = ...
local Body = require'Body'
local t_entry, t_update, t_exit
local timeout = 10.0
require'hcm'
function state.entry()
print(state._NAME..' Entry' )
local t_entry_prev = t_entry
t_entry = Body.get_time()
t_update = t_entry
hcm.get_arm_target()
hcm.set_arm_task(2)
hcm.set_arm_execute(1)
end
function state.update()
local t = Body.get_time()
local dt = t - t_update
t_update = t
--we really don't need the bodyinit
if (t-t_entry>1.0) then return "init" end
end
function state.exit()
print(state._NAME..' Exit' )
end
return state
|
AddCSLuaFile()
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Grenade_Ent"
ENT.Author = "Zenolisk"
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Spawnable = true
ENT.Category = "Rebellion"
if SERVER then
function ENT:Initialize()
-- Boiler plate
self.Entity:SetModel( "models/props_lab/pipesystem03a.mdl" )
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
timer.Simple(3, function()
if IsValid(self.Entity) then
self:Destruct()
end
end)
local zfire = ents.Create( "env_spark" )
zfire:SetPos( self.Entity:GetPos() )
zfire:SetParent( self.Entity )
zfire:Spawn()
zfire:Activate()
end
function ENT:Use( activator, caller )
end
function ENT:Destruct()
self:EmitSound( "ambient/explosions/explode_" .. math.random( 1, 9 ) .. ".wav" )
local d = DamageInfo()
d:SetDamage( 100 )
d:SetDamageType( DMG_CLUB )
d:SetAttacker(self)
util.BlastDamageInfo(d, self:GetPos(), 400)
local vPoint = self:GetPos()
local effectdata = EffectData()
effectdata:SetStart(vPoint)
effectdata:SetOrigin(vPoint)
effectdata:SetScale(0.1)
util.Effect("Explosion", effectdata)
self:Remove()
end
function ENT:PhysicsCollide(data, phys)
if data.Speed > 50 then
self.Entity:EmitSound( Format( "physics/metal/metal_grenade_impact_hard%s.wav", math.random( 1, 3 ) ) )
end
local impulse = -data.Speed * data.HitNormal * 0.1 + (data.OurOldVelocity * -0.1)
phys:ApplyForceCenter(impulse)
end
else
--CL code
end |
-- NoIndex: true
local Element = {}
-- Add all of the element data to the element classes
--Element.classes = GUI.req(GUI.script_path .. "modules/data_Elements.lua")()
Element.classes = require("data_Elements")
function Element.select_elm(elm)
GUI.elms.GB_frm_sel_elm.elm = elm.name
GUI.elms.GB_frm_sel_elm.z = 10
GUI.redraw_z[10] = true
Properties.init_properties(elm)
end
function Element.deselect_elm()
GUI.elms.GB_frm_sel_elm.elm = nil
GUI.elms.GB_frm_sel_elm.z = -2
GUI.redraw_z[10] = true
Properties.clear_properties()
end
function Element.duplicate_elm(elm)
local new_name = Element.get_new_elm_name(elm.type)
local x, y = Element.get_new_elm_coords(GUI.mouse.x, GUI.mouse.y)
Properties.recreate_elm(elm, new_name, false, x, y)
end
function Element.delete_elm(elm)
if GUI.elms.GB_frm_sel_elm.elm == elm.name then Element.deselect_elm() end
elm:redraw()
elm:delete()
-- Giving GUI.Update a new element to perform the subsequent :onmouseup(),
-- otherwise it will get stuck and not allow any new LMB input.
--GUI.mouse_down_elm = GUI.elms.GB_frm_bg
--GUI.forcemouseup()
end
-- Shift+drag to move elements
function Element.drag_elm(elm)
elm.x, elm.y = Element.get_new_elm_coords( GUI.mouse.x - GUI.mouse.off_x,
GUI.mouse.y - GUI.mouse.off_y)
GUI.elms.GB_frm_sel_elm.x, GUI.elms.GB_frm_sel_elm.y = elm.x, elm.y
GUI.elms.GB_frm_sel_elm:redraw()
elm:init()
elm:redraw()
GUI.Val("GB_prop_x", elm.x)
GUI.Val("GB_prop_y", elm.y)
end
-- CAN STAY HERE
function Element.get_new_elm_name(type)
local i = 1
while true do
if not GUI.elms[type..i] then
return type..i
else
i = i + 1
end
end
end
-- Global --> Recreate element
function Element.add_GB_methods(elm)
function elm:onmouseup()
-- Just a placeholder to keep elms from doing anything on Shift and
-- messing up the other methods
if GUI.mouse.cap & 8 == 8 then
-- Alt+click to delete
elseif GUI.mouse.cap & 16 == 16 then
Element.delete_elm(self)
else
GUI[self.type].onmouseup(self)
end
end
function elm:onmousedown()
-- Shift+click to select
if GUI.mouse.cap & 8 == 8 then
if GUI.elms.GB_frm_sel_elm.elm ~= self.name then Element.select_elm(self) end
--self.focus = false
else
GUI[self.type].onmousedown(self)
end
end
function elm:ondrag()
-- Shift+click to move elm
if GUI.mouse.cap & 8 == 8 then
Element.drag_elm(self)
else
GUI[self.type].ondrag(self)
end
end
end
-- Global --> Recreate element
function Element.store_elm_defaults(elm)
local defaults = {}
local creation = elm.GB.creation
local extra = GUI.table_find(creation, "^$") + 1
local extra_props = {table.unpack(creation, extra)}
for i = 1, #extra_props do
defaults[extra_props[i]] = elm[extra_props[i]]
end
elm.prop_defaults = defaults
end
-- NEEDS PREFS (move prefs to global GB state?)
function Element.get_new_elm_coords(x, y)
local off = Menu.h
if Prefs.preferences.grid_snap then
x = GUI.nearestmultiple(x, Prefs.preferences.grid_size)
y = GUI.nearestmultiple(y - off, Prefs.preferences.grid_size)
+ off
end
return x, y
end
function Element.create_new_elm(class)
if not class then return end
local name = Element.get_new_elm_name(class)
local x, y = Element.get_new_elm_coords(GUI.mouse.x, GUI.mouse.y)
GUI.New(name, class, 11, x, y, table.unpack(GUI[class].GB.defaults) )
GUI.elms[name].caption = name
GUI.elms[name]:init()
Element.add_GB_methods(GUI.elms[name])
Element.store_elm_defaults(GUI.elms[name])
end
-- Returns two tables
-- 'props' can be placed in a GUI.New call with table.concat(props, ", ")
function Element.get_elm_params(elm)
local params = elm.GB.properties
--[[
-- Values common to all elms
local props = {
name = '"'..elm.name..'"',
type = '"'..elm.type..'"',
z = elm.z,
x = Element.format_property_to_code(elm.x),
y = Element.format_property_to_code(elm.y - Menu.h)
}
]]--
-- 'type' isn't part of the editable properties, so we need to add it here
local props = {type = Element.format_property_to_code(elm.type)}
-- Grab any extra creation parameters
for i = 1, #params do
local prop = params[i].prop
if prop then
-- Exception for Menubar menus because they're special
local val
if elm.type == "Menubar" and prop == "menus" then
local menus, tmp = elm[prop], {}
for i = 1, #menus do
tmp[#tmp + 1] = '{title = "' .. menus[i].title .. '", options = {}}'
end
val = "{" .. table.concat(tmp,", ") .. "}"
-- Exception for sliders changing direction
elseif elm.type == "Slider" and prop == "w" then
val = Element.format_property_to_code( math.max(elm.w, elm.h) )
else
val = Element.format_property_to_code( elm[prop] )
end
props[prop] = val
end
end
return props
end
-- NO DEPENDENCIES
-- Format values as proper code
function Element.format_property_to_code(val)
if type(val) == "string" then
return '"' .. val .. '"'
elseif type(val) == "number" then
-- Was fucking up Slider.inc with decimal values.
-- Will this break anything else?
--val = math.floor(val)
elseif type(val) == "boolean" then
return tostring(val)
elseif type(val) == "table" then
local strs = {}
for i = 1, #val do
if type(val[i]) == "string" then
strs[#strs+1] = '"' .. val[i] .. '"'
else
strs[#strs+1] = tostring(val[i])
end
end
return "{" .. table.concat(strs, ", ") .. "}"
end
return val
end
local right_click_menu = {
strs = {
"#Insert element:",
"",
"Duplicate selected element",
},
opts = {
"",
"",
"duplicate",
}
}
function Element.get_new_elm_menu()
local strs, opts = {right_click_menu.strs[1]}, {right_click_menu.opts[1]}
local idx = 2
for class in GUI.kpairs(Element.classes) do
if not GUI[class].GB.hidden then
strs[idx] = class
opts[idx] = class
idx = idx + 1
end
end
strs[idx], opts[idx] = "", ""
strs[idx + 1], opts[idx + 1] = right_click_menu.strs[3], right_click_menu.opts[3]
return strs, opts
end
function Element.new_elm_menu()
gfx.x, gfx.y = GUI.mouse.x, GUI.mouse.y
local strs, opts = Element.get_new_elm_menu()
local ret = gfx.showmenu(table.concat(strs, "|"))
if ret == 0 then return end
local seps = 0
for i = 1, ret do
if strs[i] == "" then seps = seps + 1 end
end
ret = ret + seps
local opt = opts[ret]
if opt == "duplicate" then
if GUI.elms.GB_frm_sel_elm.elm then
Element.duplicate_elm(GUI.elms[GUI.elms.GB_frm_sel_elm.elm])
end
else
Element.create_new_elm(opt)
end
end
return Element |
return loadfile('zstd-crt.lua')(true)
|
-- --------------------
-- TellMeWhen
-- Originally by Nephthys of Hyjal <lieandswell@yahoo.com>
-- Other contributions by:
-- Sweetmms of Blackrock, Oozebull of Twisting Nether, Oodyboo of Mug'thol,
-- Banjankri of Blackrock, Predeter of Proudmoore, Xenyr of Aszune
-- Currently maintained by
-- Cybeloras of Aerie Peak/Detheroc/Mal'Ganis
-- --------------------
if not TMW then return end
local TMW = TMW
local L = TMW.L
local print = TMW.print
local tonumber, tostring, type, pairs, ipairs, tinsert, tremove, sort, select, wipe, next, rawget, rawset, assert, pcall, error, getmetatable, setmetatable, unpack =
tonumber, tostring, type, pairs, ipairs, tinsert, tremove, sort, select, wipe, next, rawget, rawset, assert, pcall, error, getmetatable, setmetatable, unpack
local strfind, strmatch, format, gsub, gmatch, strsub, strtrim, strsplit, strlower, strrep, strchar, strconcat, strjoin =
strfind, strmatch, format, gsub, gmatch, strsub, strtrim, strsplit, strlower, strrep, strchar, strconcat, strjoin
local math, max, ceil, floor, random, abs =
math, max, ceil, floor, random, abs
local _G, coroutine, table, GetTime, CopyTable, tostringall, geterrorhandler, C_Timer =
_G, coroutine, table, GetTime, CopyTable, tostringall, geterrorhandler, C_Timer
local UnitAura, IsUsableSpell, GetSpecialization, GetSpecializationInfo, GetFramerate =
UnitAura, IsUsableSpell, GetSpecialization, GetSpecializationInfo, GetFramerate
local debugprofilestop = debugprofilestop_SAFE
---------------------------------
-- TMW.Class.Formatter
---------------------------------
local Formatter = TMW:NewClass("Formatter"){
OnNewInstance = function(self, fmt)
self.fmt = fmt
end,
Format = function(self, value)
local type = type(self.fmt)
if type == "string" then
return format(self.fmt, value)
elseif type == "table" then
return self.fmt[value]
elseif type == "function" then
return self.fmt(value)
else
return value
end
end,
SetFormattedText = function(self, frame, value)
frame:SetText(self:Format(value))
end,
}
Formatter:MakeInstancesWeak()
-- Some commonly used formatters.
Formatter{
NONE = Formatter:New(TMW.NULLFUNC),
PASS = Formatter:New(tostring),
F_0 = Formatter:New("%.0f"),
F_1 = Formatter:New("%.1f"),
F_2 = Formatter:New("%.2f"),
PERCENT = Formatter:New("%s%%"),
PERCENT100 = Formatter:New(function(value)
return ("%s%%"):format(value*100)
end),
PERCENT100_F0 = Formatter:New(function(value)
return ("%.0f%%"):format(value*100)
end),
PLUSPERCENT = Formatter:New("+%s%%"),
D_SECONDS = Formatter:New(D_SECONDS),
S_SECONDS = Formatter:New(L["ANIM_SECONDS"]),
PIXELS = Formatter:New(L["ANIM_PIXELS"]),
COMMANUMBER = Formatter:New(function(k)
k = gsub(k, "(%d)(%d%d%d)$", "%1,%2", 1)
local found
repeat
k, found = gsub(k, "(%d)(%d%d%d),", "%1,%2,", 1)
until found == 0
return k
end),
TIME_COLONS = Formatter:New(function(value)
return TMW:FormatSeconds(value, nil, 1)
end),
TIME_COLONS_FORCEMINS = Formatter:New(function(seconds)
if abs(seconds) == math.huge then
return tostring(seconds)
end
if seconds < 0 then
error("This function doesn't support negative seconds")
end
local y = seconds / 31556925
local d = (seconds % 31556925) / 86400
local h = (seconds % 31556925 % 86400) / 3600
local m = (seconds % 31556925 % 86400 % 3600) / 60
local s = (seconds % 31556925 % 86400 % 3600 % 60)
if y >= 0x7FFFFFFE then
return "OVERFLOW"
end
s = tonumber(format("%.1f", s))
if s < 10 then
s = "0" .. s
end
if y >= 1 then return format("%d:%d:%02d:%02d:%s", y, d, h, m, s) end
if d >= 1 then return format("%d:%02d:%02d:%s", d, h, m, s) end
if h >= 1 then return format("%d:%02d:%s", h, m, s) end
return format("%d:%s", m, s)
end),
-- GLOBALS: DAY_ONELETTER_ABBR, HOUR_ONELETTER_ABBR, MINUTE_ONELETTER_ABBR, SECOND_ONELETTER_ABBR, SECONDS_ABBR
TIME_YDHMS = Formatter:New(function(seconds)
if abs(seconds) == math.huge then
return tostring(seconds)
end
if seconds < 0 then
error("This function doesn't support negative seconds")
end
local y = seconds / 31556926
local d = (seconds % 31556926) / 86400
local h = (seconds % 31556926 % 86400) / 3600
local m = (seconds % 31556926 % 86400 % 3600) / 60
local s = (seconds % 31556926 % 86400 % 3600 % 60)
if y >= 0x7FFFFFFE then
return "OVERFLOW"
end
local str = ""
if y >= 1 then
str = str .. format("%dy", y)
end
if d >= 1 then
local fmt = DAY_ONELETTER_ABBR:gsub(" ", "")
str = str .. " " .. format(fmt, d)
end
if h >= 1 then
local fmt = HOUR_ONELETTER_ABBR:gsub(" ", "")
str = str .. " " .. format(fmt, h)
end
if m >= 1 then
local fmt = MINUTE_ONELETTER_ABBR:gsub(" ", "")
str = str .. " " .. format(fmt, m)
end
if tonumber(format("%.1f", s)) == s then
s = tostring(s)
else
s = format("%0.1f", s)
end
local fmt
if str == "" then
fmt = SECONDS_ABBR:gsub("%%d", "%%s"):lower()
else
fmt = SECOND_ONELETTER_ABBR:gsub("%%d ", "%%s"):lower()
end
str = str .. " " .. format(fmt, s)
return str:trim()
end),
TIME_0ABSENT = Formatter:New(function(value)
local s = Formatter.TIME_YDHMS:Format(value)
if value == 0 then
s = s .. " ("..L["ICONMENU_ABSENT"]..")"
end
return s
end),
TIME_0USABLE = Formatter:New(function(value)
local s = Formatter.TIME_YDHMS:Format(value)
if value == 0 then
s = s .. " ("..L["ICONMENU_USABLE"]..")"
end
return s
end),
BOOL = Formatter:New{[0]=L["TRUE"], [1]=L["FALSE"]},
BOOL_USABLEUNUSABLE = Formatter:New{[0]=L["ICONMENU_USABLE"], [1]=L["ICONMENU_UNUSABLE"]},
BOOL_PRESENTABSENT = Formatter:New{[0]=L["ICONMENU_PRESENT"], [1]=L["ICONMENU_ABSENT"]},
}
---------------------------------
-- Function Caching
---------------------------------
local cacheMetatable = {
__mode == 'kv'
}
function TMW:MakeFunctionCached(obj, method)
local func
if type(obj) == "table" and type(method) == "string" then
func = obj[method]
elseif type(obj) == "function" then
func = obj
else
error("Usage: TMW:MakeFunctionCached(object/function [, method])")
end
local cache = setmetatable({}, cacheMetatable)
local wrapper = function(...)
local cachestring = strjoin("\031", tostringall(...))
if cache[cachestring] then
return cache[cachestring]
end
local ret1, ret2 = func(...)
if ret2 ~= nil then
error("Cannot cache functions with more than 1 return arg")
end
cache[cachestring] = ret1
return ret1
end
if type(obj) == "table" then
obj[method] = wrapper
end
return wrapper, cache
end
function TMW:MakeSingleArgFunctionCached(obj, method)
-- MakeSingleArgFunctionCached is MUCH more efficient than MakeFunctionCached
-- and should be used whenever there is only 1 input arg
local func, firstarg
if type(obj) == "table" and type(method) == "string" then
func = obj[method]
firstarg = obj
elseif type(obj) == "function" then
func = obj
else
error("Usage: TMW:MakeFunctionCached(object/function [, method])", 2)
end
local cache = setmetatable({}, cacheMetatable)
local wrapper = function(arg1In, arg2In)
local param1, param2 = arg1In, arg2In
if firstarg and firstarg == arg1In then
arg1In = arg2In
elseif arg2In ~= nil then
error("Cannot MakeSingleArgFunctionCached functions with more than 1 arg", 2)
end
if cache[arg1In] then
return cache[arg1In]
end
local ret1, ret2 = func(param1, param2)
if ret2 ~= nil then
error("Cannot cache functions with more than 1 return arg", 2)
end
cache[arg1In] = ret1
return ret1
end
if type(obj) == "table" then
obj[method] = wrapper
end
return wrapper
end
---------------------------------
-- Output & Errors
---------------------------------
local warn = {}
function TMW:ResetWarn()
for k, v in pairs(warn) do
-- reset warnings so they can happen again
if type(k) == "string" then
warn[k] = nil
end
end
end
function TMW:DoInitialWarn()
for k, v in ipairs(warn) do
TMW:Print(v)
warn[k] = true
end
TMW.Warned = true
TMW.DoInitialWarn = TMW.NULLFUNC
end
function TMW:Warn(text)
if warn[text] then
return
elseif TMW.Warned then
TMW:Print(text)
warn[text] = true
elseif not TMW.tContains(warn, text) then
tinsert(warn, text)
end
end
function TMW:Debug(...)
if TMW.debug or not TMW.Initialized then
TMW.print(format(...))
end
end
function TMW:Error(text, ...)
text = text or ""
local success, result = pcall(format, text, ...)
if success then
text = result
end
geterrorhandler()("TellMeWhen: " .. text)
end
function TMW:Assert(statement, text, ...)
if not statement then
text = text or "Assertion Failed!"
local success, result = pcall(format, text, ...)
if success then
text = result
end
geterrorhandler()("TellMeWhen: " .. text)
end
end
---------------------------------
-- Generic String Utilities
---------------------------------
local mult = {
1, -- seconds per second
60, -- seconds per minute
60*60, -- seconds per hour
60*60*24, -- seconds per day
60*60*24*365.242199, -- seconds per year
}
function TMW.toSeconds(str)
-- converts a string (e.g. "1:45:37") into the number of seconds that it represents (eg. 6337)
str = ":" .. str:trim(": ") -- a colon is needed at the beginning so that gmatch will catch the first unit of time in the string (minutes, hours, etc)
local _, numcolon = str:gsub(":", ":") -- count the number of colons in the string so that we can keep track of what multiplier we are on (since we start with the highest unit of time)
local seconds = 0
for num in str:gmatch(":([0-9%.]*)") do -- iterate over all units of time and their value
if tonumber(num) and mult[numcolon] then -- make sure that it is valid (there is a number and it isnt a unit of time higher than a year)
seconds = seconds + mult[numcolon]*num -- multiply the number of units by the number of seconds in that unit and add the appropriate amount of time to the running count
end
numcolon = numcolon - 1 -- decrease the current unit of time that is being worked with (even if it was an invalid unit and failed the above check)
end
return seconds
end
local function replace(text, find, rep)
-- using this allows for the replacement of "; " to "; " in one external call
assert(not strfind(rep, find), "RECURSION DETECTED: FIND=".. find.. " REP=".. rep)
while strfind(text, find) do
text = gsub(text, find, rep)
end
return text
end
function TMW:CleanString(text)
local frame
if type(text) == "table" and text.GetText then
frame = text
text = text:GetText()
end
if not text then error("No text to clean!") end
text = strtrim(text, "; \t\r\n")-- remove all leading and trailing semicolons, spaces, tabs, and newlines
text = replace(text, "[^:] ;", "; ") -- remove all spaces before semicolons
text = replace(text, "; ", ";") -- remove all spaces after semicolons
text = replace(text, ";;", ";") -- remove all double semicolons
text = replace(text, " :", ":") -- remove all single spaces before colons
text = replace(text, ": ", ": ") -- remove all double spaces after colons (DONT REMOVE ALL DOUBLE SPACES EVERYWHERE, SOME SPELLS HAVE TYPO'd NAMES WITH 2 SPACES!)
text = gsub(text, ";", "; ") -- add spaces after all semicolons. Never used to do this, but it just looks so much better (DONT USE replace!).
if frame then
frame:SetText(text)
end
return text
end
function TMW:CleanPath(path)
if not path then
return ""
end
return path:trim():gsub("\\\\", "/"):gsub("\\", "/"), nil
end
function TMW:SplitNames(input)
input = TMW:CleanString(input)
local tbl = { strsplit(";", input) }
if #tbl == 1 and tbl[1] == "" then
tbl[1] = nil
end
for a, b in ipairs(tbl) do
local new = strtrim(b) --remove spaces from the beginning and end of each name
tbl[a] = tonumber(new) or new -- turn it into a number if it is one
end
return tbl
end
TMW.SplitNamesCached = TMW.SplitNames
TMW:MakeSingleArgFunctionCached(TMW, "SplitNamesCached")
function TMW:FormatSeconds(seconds, skipSmall, keepTrailing)
local ret = ""
if abs(seconds) == math.huge then
return tostring(seconds)
elseif seconds < 0 then
ret = "-"
seconds = -seconds
end
local y = seconds / 31556926
local d = (seconds % 31556926) / 86400
local h = (seconds % 31556926 % 86400) / 3600
local m = (seconds % 31556926 % 86400 % 3600) / 60
local s = (seconds % 31556926 % 86400 % 3600 % 60)
local ns
if skipSmall then
ns = format("%d", s)
else
ns = format("%.1f", s)
if not keepTrailing then
ns = tonumber(ns)
end
end
if s < 10 and seconds >= 60 then
ns = "0" .. ns
end
if y >= 0x7FFFFFFE then
ret = ret .. format("OVERFLOW:%d:%02d:%02d:%s", d, h, m, ns)
elseif y >= 1 then
ret = ret .. format("%d:%d:%02d:%02d:%s", y, d, h, m, ns)
elseif d >= 1 then
ret = ret .. format("%d:%02d:%02d:%s", d, h, m, ns)
elseif h >= 1 then
ret = ret .. format("%d:%02d:%s", h, m, ns)
elseif m >= 1 then
ret = ret .. format("%d:%s", m, ns)
else
ret = ret .. ns
end
return ret
end
---------------------------------
-- Color Utilities
---------------------------------
local flagMap = {
d = "desaturate"
}
local function parseFlagString(flagString)
if not flagString or #flagString == 0 then
return nil
end
local ret = {}
for i = 1, #flagString do
local f = flagString:sub(i,i)
ret[flagMap[f] or f] = true
end
return ret
end
local function parseFlagTable(tbl)
if not tbl then return "" end
local ret = ""
for k, v in pairs(tbl) do
if v then
local f = TMW.tContains(flagMap, k)
if f or #k == 1 then
ret = ret .. (f or k)
end
end
end
return ret
end
function TMW:RGBATableToStringWithoutFlags(table)
if type(table) == "string" then
return table
end
return TMW:RGBAToString(table.r, table.g, table.b, table.a)
end
function TMW:RGBATableToStringWithFallback(table, fallbackStr)
if type(table) == "string" then
return table
elseif not table then
return fallbackStr
end
local r, g, b, a, flags = TMW:StringToRGBA(fallbackStr)
return TMW:RGBAToString(table.r or r, table.g or g, table.b or b, table.a or a, table.flags or flags)
end
local function to8Bit(v)
return floor(v * 0xFF + 0.5)
end
function TMW:RGBAToString(r, g, b, a, flags)
return format("%02x%02x%02x%02x%s", to8Bit(a or 1), to8Bit(r), to8Bit(g), to8Bit(b), parseFlagTable(flags))
end
function TMW:StringToRGBA(str)
local a, r, g, b, flagString = str:match("(%x%x)(%x%x)(%x%x)(%x%x)(.*)")
return tonumber(r, 0x10) / 0xFF, tonumber(g, 0x10) / 0xFF, tonumber(b, 0x10) / 0xFF, tonumber(a, 0x10) / 0xFF, parseFlagString(flagString)
end
function TMW:StringToCachedRGBATable(str)
if type(str) == "table" then
return str
end
local r, g, b, a, flags = TMW:StringToRGBA(str)
return {r=r,g=g,b=b,a=a, flags=flags}
end
TMW:MakeFunctionCached(TMW, "StringToCachedRGBATable")
-- Adapted from https://github.com/mjackson/mjijackson.github.com/blob/master/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript.txt
function TMW:RGBToHSV(r, g, b)
local max, min = max(r, g, b), min(r, g, b)
local h, s, v
v = max
local d = max - min
if max == 0 then
s = 0 else s = d / max
end
if max == min then
h = 0 -- achromatic
else
if max == r then
h = (g - b) / d
if g < b then
h = h + 6
end
elseif max == g then
h = (b - r) / d + 2
elseif max == b then
h = (r - g) / d + 4
end
h = h / 6
end
return h, s, v
end
function TMW:HSVToRGB(h, s, v)
local r, g, b
local i = floor(h * 6)
local f = h * 6 - i
local p = v * (1 - s)
local q = v * (1 - f * s)
local t = v * (1 - (1 - f) * s)
i = i % 6
if i == 0 then r, g, b = v, t, p
elseif i == 1 then r, g, b = q, v, p
elseif i == 2 then r, g, b = p, v, t
elseif i == 3 then r, g, b = p, q, v
elseif i == 4 then r, g, b = t, p, v
elseif i == 5 then r, g, b = v, p, q
end
return r, g, b
end
local getColorsTemp = {}
function TMW:GetColors(colorSettings, enableSetting, ...)
if not colorSettings then
error("colorSettings missing")
end
for n, settings, length in TMW:Vararg(...) do
if n == length or settings[enableSetting] then
if type(colorSettings) == "table" then
for i = 1, #colorSettings do
getColorsTemp[i] = settings[colorSettings[i]]
end
return unpack(getColorsTemp, 1, #colorSettings)
else
return settings[colorSettings]
end
end
end
end
function TMW:ColorStringToCachedHSVATable(str)
local r, g, b, a, flags = TMW:StringToRGBA(str)
local h, s, v = TMW:RGBToHSV(r, g, b)
return {h=h, s=s, v=v, a=a, flags=flags}
end
TMW:MakeFunctionCached(TMW, "ColorStringToCachedHSVATable")
function TMW:HSVAToColorString(h, s, v, a, flags)
local r, g, b = TMW:HSVToRGB(h, s, v)
return TMW:RGBAToString(r, g, b, a, flags)
end
---------------------------------
-- Table Utilities
---------------------------------
function TMW.approachTable(t, ...)
for i=1, select("#", ...) do
local k = select(i, ...)
if type(k) == "function" then
t = k(t)
else
t = t[k]
end
if not t then return end
end
return t
end
function TMW.shallowCopy(t)
local new = {}
for k, v in pairs(t) do
new[k] = v
end
return new
end
function TMW.tContains(table, item, returnNum)
local firstkey
local num = 0
for k, v in pairs(table) do
if v == item then
if not returnNum then
-- Return only the key of the first match
return k
else
num = num + 1
firstkey = firstkey or k
end
end
end
-- Return the key of the first match and also the total number of matches
return firstkey, num
end
function TMW.tDeleteItem(table, item, onlyOne)
local i = 1
local removed
while table[i] do
if item == table[i] then
tremove(table, i)
if onlyOne then
return true
end
removed = true
else
i = i + 1
end
end
return removed
end
function TMW.tRemoveDuplicates(table)
local offs = 0
-- Start at the end of the table so that we don't remove duplicates from the beginning
for k = #table, 1, -1 do
-- offs is adjusted each time something is removed so that we don't waste time
-- searching for nil values when the table is shifted by a duplicate removal
k = k + offs
-- If we have reached the beginning of the table, we are done.
if k <= 0 then
return table
end
-- item is the value being searched for
local item = table[k]
-- prevIndex tracks the last index where the searched-for value was found
local prevIndex
-- Once again start the iteration from the end because we don't want to have to
-- deal with index shifting when we remove a value
for i = #table, 1, -1 do
if table[i] == item then
-- We found a match. If there has already been another match, remove that match
-- and record this match as being the first one (closes to index 0) in the table.
if prevIndex then
tremove(table, prevIndex)
offs = offs - 1
end
-- Queue this match for removal should we find another match closer to the beginning.
prevIndex = i
end
end
end
-- Done. Return the table for ease-of-use.
return table
end
local comp_default = function(a,b) return a < b end
function TMW.binaryInsert(table, value, comp)
-- http://lua-users.org/wiki/BinaryInsert
comp = comp or comp_default
local iStart, iEnd, iMid, iState =
1, #table, 1, 0
while iStart <= iEnd do
iMid = floor((iStart+iEnd) / 2)
if comp(value, table[iMid]) then
iEnd, iState = iMid-1, 0
else
iStart, iState = iMid+1, 1
end
end
tinsert(table, iMid + iState, value)
return (iMid+iState)
end
function TMW.OrderSort(a, b)
a = a.Order or a.order
b = b.Order or b.order
if a and b then
return a < b
else
error("Missing 'order' or 'Order' key for values of OrderedTable")
end
end
function TMW:SortOrderedTables(parentTable)
sort(parentTable, TMW.OrderSort)
return parentTable
end
function TMW:CopyWithMetatable(source, blocker)
local dest = {}
for k, v in pairs(source) do
local keyBlocker = blocker and blocker[k]
if keyBlocker ~= true then
if type(v) == "table" then
dest[k] = TMW:CopyWithMetatable(v, keyBlocker)
else
dest[k] = v
end
end
end
return setmetatable(dest, getmetatable(source))
end
function TMW:CopyInPlaceWithMetatable(source, dest, blocker)
setmetatable(dest, getmetatable(source))
for key in pairs(source) do
local keyBlocker = blocker and blocker[key]
if keyBlocker ~= true then
if type(source[key]) == "table" then
if type(dest[key]) ~= "table" then
dest[key] = {}
end
TMW:CopyInPlaceWithMetatable(source[key], dest[key], keyBlocker)
else
dest[key] = source[key]
end
end
end
end
function TMW:CopyTableInPlaceUsingDestinationMeta(src, dest, allowUnmatchedSourceTables)
-- src and dest must have congruent data structure.
-- There are no safety checks to ensure this.
-- Save the original metatable so it doesn't get overwritten.
local metatemp = getmetatable(src)
setmetatable(src, getmetatable(dest))
for k in pairs(src) do
if type(dest[k]) == "table" and type(src[k]) == "table" then
TMW:CopyTableInPlaceUsingDestinationMeta(src[k], dest[k], allowUnmatchedSourceTables)
elseif allowUnmatchedSourceTables and type(dest[k]) ~= "table" and type(src[k]) == "table" then
dest[k] = {}
TMW:CopyTableInPlaceUsingDestinationMeta(src[k], dest[k], allowUnmatchedSourceTables)
elseif type(src[k]) ~= "table" then
dest[k] = src[k]
end
end
-- Restore the old metatable
setmetatable(src, metatemp)
return dest
end
function TMW:DeepCompare(t1, t2)
-- heavily modified version of http://snippets.luacode.org/snippets/Deep_Comparison_of_Two_Values_3
-- attempt direct comparison
if t1 == t2 then
return true
end
-- if the values are not the same (they made it through the check above) AND they are not both tables, then they cannot be the same, so exit.
local ty1 = type(t1)
if ty1 ~= "table" or ty1 ~= type(t2) then
return false
end
-- compare table values
-- compare table 1 with table 2
for k1, v1 in pairs(t1) do
local v2 = t2[k1]
-- don't bother calling DeepCompare on the values if they are the same - it will just return true.
-- Only call it if the values are different (they are either 2 tables, or they actually are different non-table values)
-- by adding the (v1 ~= v2) check, efficiency is increased by about 300%.
if v1 ~= v2 and not TMW:DeepCompare(v1, v2) then
return false
end
end
-- compare table 2 with table 1
for k2, v2 in pairs(t2) do
local v1 = t1[k2]
-- see comments for t1
if v1 ~= v2 and not TMW:DeepCompare(v1, v2) then
return false
end
end
return true
end
do -- TMW.shellsortDeferred
-- From http://lua-users.org/wiki/LuaSorting - shellsort
-- Written by Rici Lake. The author disclaims all copyright and offers no warranty.
--
-- This module returns a single function (not a table) whose interface is upwards-
-- compatible with the interface to table.sort:
--
-- array = shellsort(array, before, n)
-- array is an array of comparable elements to be sorted in place
-- before is a function of two arguments which returns true if its first argument
-- should be before the second argument in the second result. It must define
-- a total order on the elements of array.
-- Alternatively, before can be one of the strings "<" or ">", in which case
-- the comparison will be done with the indicated operator.
-- If before is omitted, the default value is "<"
-- n is the number of elements in the array. If it is omitted, #array will be used.
-- For convenience, shellsort returns its first argument.
-- A036569
local incs = { 8382192, 3402672, 1391376,
463792, 198768, 86961, 33936,
13776, 4592, 1968, 861, 336,
112, 48, 21, 7, 3, 1 }
local execCap = 17
local start = 0
local function ssup(v, testval)
return v < testval
end
local function ssdown(v, testval)
return v > testval
end
local function ssgeneral(t, n, before, progressCallback, progressCallbackArg)
local lastProgress = 100
for idx, h in ipairs(incs) do
local count = 1
for i = h + 1, n do
local v = t[i]
for j = i - h, 1, -h do
local testval = t[j]
if not before(v, testval) then break end
t[i] = testval; i = j
end
t[i] = v
count = count + 1
if (count % 200 == 0) and debugprofilestop() - start > execCap then
local progress = #incs - idx + 1
if progressCallback and progress ~= lastProgress then
if progressCallbackArg then
progressCallback(progressCallbackArg, progress)
else
progressCallback(progress)
end
lastProgress = progress
end
coroutine.yield()
end
end
end
return t
end
local coroutines = {}
local function shellsort(t, before, n, callback, callbackArg, progressCallback, progressCallbackArg)
n = n or #t
if not before or before == "<" then
ssgeneral(t, n, ssup, progressCallback, progressCallbackArg)
elseif before == ">" then
ssgeneral(t, n, ssdown, progressCallback, progressCallbackArg)
else
ssgeneral(t, n, before, progressCallback, progressCallbackArg)
end
if callbackArg ~= nil then
callback(callbackArg)
else
callback()
end
coroutines[t] = nil
end
local timer
local function OnUpdate()
local table, co = next(coroutines)
if table then
if coroutine.status(co) == "dead" then
-- This might happen if there was an error thrown before the coroutine could finish.
coroutines[table] = nil
return
end
-- dynamic execution cap based on framerate.
-- this will keep us from dropping the user's framerate too much
-- without doing so little sorting that the process goes super slowly.
-- subtract a little bit to account for CPU usage for other things, like the game itself.
execCap = 1000/max(20, GetFramerate()) - 5
start = debugprofilestop()
assert(coroutine.resume(co))
end
if not next(coroutines) then
timer:Cancel()
timer = nil
end
end
-- The purpose of shellSortDeferred is to have a sort that won't
-- lock up the game when we sort huge things.
function TMW.shellsortDeferred(t, before, n, callback, callbackArg, progressCallback, progressCallbackArg)
local co = coroutine.create(shellsort)
coroutines[t] = co
start = debugprofilestop()
if not timer then
timer = C_Timer.NewTicker(0.001, OnUpdate)
end
assert(coroutine.resume(co, t, before, n, callback, callbackArg, progressCallback, progressCallbackArg))
end
end
---------------------------------
-- Iterator Functions
---------------------------------
do -- InNLengthTable
local states = {}
local function getstate(k, t)
local state = wipe(tremove(states) or {})
state.k = k
state.t = t
return state
end
local function iter(state)
state.k = state.k + 1
if state.k > (state.t.n or #state.t) then -- #t enables iteration over tables that have not yet been upgraded with an n key (i.e. imported data from old versions)
tinsert(states, state)
return
end
-- return state.t[state.k], state.k --OLD, STUPID IMPLEMENTATION
return state.k, state.t[state.k]
end
--- Iterates over an array-style table that has a key "n" to indicate the length of the table.
-- Returns (key, value) pairs for each iteration.
function TMW:InNLengthTable(arg)
if arg then
return iter, getstate(0, arg)
else
error("Bad argument #1 to 'TMW:InNLengthTable(arg)'. Expected table, got nil.", 2)
end
end
end
do -- ordered pairs
local tables = {}
local unused = {}
local sortByValues, compareFunc, reverse
-- An alternative comparison function that can handle mismatched types.
local function betterCompare(a, b)
local ta, tb = type(a), type(b)
if ta ~= tb then
if reverse then
return ta > tb
end
return ta < tb
elseif ta == "number" or ta == "string" then
if reverse then
return a > b
end
return a < b
elseif ta == "boolean" then
if reverse then
return b == true
end
return a == true
else
if reverse then
return tostring(a) > tostring(b)
end
return tostring(a) < tostring(b)
end
end
local function sorter(a, b)
if sortByValues then
a, b = sortByValues[a], sortByValues[b]
end
if compareFunc then
return compareFunc(a, b)
end
if reverse then
return a > b
end
return a < b
--return compare(a, b)
end
local function orderedNext(orderedIndex, state)
local t = tables[orderedIndex]
if state == nil then
local key = orderedIndex[1]
return key, t[key]
end
local key
for i = 1, #orderedIndex do
if orderedIndex[i] == state then
key = orderedIndex[i+1]
break
end
end
if key then
return key, t[key]
end
unused[#unused+1] = wipe(orderedIndex)
tables[orderedIndex] = nil
return
end
--- Iterates over the table in an ordered fashion, without modifying the table.
-- @param t [table] The table to iterate over
-- @param compare [function|nil] The comparison function that will be used for sorting the keys or values of the table. Defaults to regular ascending order.
-- @param byValues [boolean|nil] True to have the iteration order based on values (values will be passed to the compare function if defined), false/nil to sort by keys.
-- @param rev [boolean|nil] True to reverse the sorted order of the iteration.
-- @return Iterator that will return (key, value) for each iteration.
function TMW:OrderedPairs(t, compare, byValues, rev)
if not next(t) then
return TMW.NULLFUNC
end
local orderedIndex = tremove(unused) or {}
local type_comparand = nil
for key, value in pairs(t) do
orderedIndex[#orderedIndex + 1] = key
-- Determine the types of what we're comparing by.
-- If we find more than one type, use betterCompare since it handles type mismatches.
if compare == nil then
local oldType = type_comparand
if byValues then
type_comparand = type(value)
else
type_comparand = type(key)
end
if oldType ~= type_comparand then
compare = compare or betterCompare
end
end
end
reverse = rev
compareFunc = compare
if byValues then
sortByValues = t
else
sortByValues = nil
end
sort(orderedIndex, sorter)
tables[orderedIndex] = t
return orderedNext, orderedIndex
end
end
---------------------------------
-- Tooltips
---------------------------------
local function TTOnEnter(self)
-- GLOBALS: GameTooltip, HIGHLIGHT_FONT_COLOR, NORMAL_FONT_COLOR
if (not self.__ttshowchecker or TMW.get(self[self.__ttshowchecker], self))
and (self.__title or self.__text)
then
TMW:TT_Anchor(self)
if self.__ttMinWidth then
GameTooltip:SetMinimumWidth(self.__ttMinWidth)
end
GameTooltip:AddLine(TMW.get(self.__title, self), HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b, false)
local text = TMW.get(self.__text, self)
if text then
GameTooltip:AddLine(text, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, not self.__noWrapTooltipText)
end
GameTooltip:Show()
end
end
local function TTOnLeave(self)
GameTooltip:Hide()
end
function TMW:TT_Anchor(f)
GameTooltip:SetOwner(f, "ANCHOR_NONE")
GameTooltip:SetPoint("TOPLEFT", f, "BOTTOMRIGHT", 0, 0)
end
function TMW:TT(f, title, text, actualtitle, actualtext, showchecker)
-- setting actualtitle or actualtext true cause it to use exactly what is passed in for title or text as the text in the tooltip
-- if these variables arent set, then it will attempt to see if the string is a global variable (e.g. "MAXIMUM")
-- if they arent set and it isnt a global, then it must be a TMW localized string, so use that
TMW:ValidateType(2, "TMW:TT()", f, "frame")
f.__title = TMW:TT_Parse(title, actualtitle)
f.__text = TMW:TT_Parse(text, actualtext)
f.__ttshowchecker = showchecker
if not f.__ttHooked then
f.__ttHooked = 1
f:HookScript("OnEnter", TTOnEnter)
f:HookScript("OnLeave", TTOnLeave)
else
if not f:GetScript("OnEnter") then
f:HookScript("OnEnter", TTOnEnter)
end
if not f:GetScript("OnLeave") then
f:HookScript("OnLeave", TTOnLeave)
end
end
end
function TMW:TT_Parse(text, literal)
if text then
return (literal and text) or _G[text] or L[text]
else
return text
end
end
function TMW:TT_Copy(src, dest)
TMW:TT(dest, src.__title, src.__text, 1, 1, src.__ttshowchecker)
end
function TMW:TT_Update(f)
if GetMouseFocus() == f and f:IsMouseOver() and f:IsVisible() then
f:GetScript("OnLeave")(f)
if not f.IsEnabled or f:IsEnabled() or (f:IsObjectType("Button") and f:GetMotionScriptsWhileDisabled()) then
f:GetScript("OnEnter")(f)
end
end
end
---------------------------------
-- Misc. Utilities
---------------------------------
function TMW.get(value, ...)
local type = type(value)
if type == "function" then
return value(...)
elseif type == "table" then
return value[...]
else
return value
end
end
function TMW.NULLFUNC()
-- Do nothing
end
function TMW.oneUpString(string)
if string:find("%d+") then
local num = tonumber(string:match("(%d+)"))
if num then
string = string:gsub(("(%d+)"), num + 1, 1)
return string
end
end
return string .. " 2"
end
TMW.CompareFuncs = {
-- more efficient than a big elseif chain.
["=="] = function(a, b) return a == b end,
["~="] = function(a, b) return a ~= b end,
[">="] = function(a, b) return a >= b end,
["<="] = function(a, b) return a <= b end,
["<"] = function(a, b) return a < b end,
[">"] = function(a, b) return a > b end,
}
local animator = CreateFrame("Frame")
animator.frames = {}
animator.OnUpdate = function()
for f in pairs(animator.frames) do
if TMW.time - f.__animateHeight_startTime > f.__animateHeight_duration then
animator.frames[f] = nil
f:SetHeight(f.__animateHeight_end)
else
local pct = (TMW.time - f.__animateHeight_startTime)/f.__animateHeight_duration
f:SetHeight((pct*f.__animateHeight_delta)+f.__animateHeight_start)
end
end
if not next(animator.frames) then
animator:SetScript("OnUpdate", nil)
end
end
function TMW:AnimateHeightChange(f, endHeight, duration)
f.__animateHeight_start = f:GetHeight()
f.__animateHeight_end = endHeight
f.__animateHeight_delta = f.__animateHeight_end - f.__animateHeight_start
f.__animateHeight_startTime = TMW.time
f.__animateHeight_duration = duration
animator.frames[f] = true
animator:SetScript("OnUpdate", animator.OnUpdate)
end
---------------------------------
-- WoW API Helpers
---------------------------------
function TMW.SpellHasNoMana(spell)
-- TODO: in warlords, you can't determine spell costs anymore. Thanks, blizzard!
-- This function used to get the spell cost, and determine usability from that,
-- but we can't do that anymore. It was a more reliable method because IsUsableSpell
-- was broken for some abilities (like Jab)
local _, nomana = IsUsableSpell(spell)
return nomana
end
function TMW.GetRuneCooldownDuration()
-- Round to a precision of 3 decimal points for comparison with returns from GetSpellCooldown
local _, duration = GetRuneCooldown(1)
if not duration then return 0 end
return floor(duration * 1e3 + 0.5) / 1e3
end
local function spellCostSorter(a, b)
local hasA = a.requiredAuraID ~= 0 and a.hasRequiredAura
local hasB = b.requiredAuraID ~= 0 and b.hasRequiredAura
if hasA ~= hasB then
return hasA
end
hasA = a.hasRequiredAura
hasB = b.hasRequiredAura
if hasA ~= hasB then
return hasA
end
return a.requiredAuraId == 0
end
function TMW.GetSpellCost(spell)
local costs = GetSpellPowerCost(spell)
if not costs or #costs == 0 then
return nil, nil
end
local cost
if #costs == 1 then
cost = costs[1]
else
sort(costs, spellCostSorter)
cost = costs[1]
end
if cost.requiredAuraID ~= 0 and not cost.hasRequiredAura then
return nil, cost
end
if cost.cost == 0 and cost.costPercent > 0 then
return UnitPower("player", cost.type) * cost.costPercent / 100, cost
else
return cost.cost, cost
end
end
function TMW.GetCurrentSpecializationRole()
-- Watch for PLAYER_SPECIALIZATION_CHANGED for changes to this func's return, and to
-- UPDATE_SHAPESHIFT_FORM if the player is a warrior.
local currentSpec = GetSpecialization()
if not currentSpec then
return nil
end
local _, _, _, _, _, role = GetSpecializationInfo(currentSpec)
return role
end
do -- TMW:GetParser()
local Parser, LT1, LT2, LT3, RT1, RT2, RT3
function TMW:GetParser()
if not Parser then
Parser = CreateFrame("GameTooltip")
LT1 = Parser:CreateFontString()
RT1 = Parser:CreateFontString()
Parser:AddFontStrings(LT1, RT1)
LT2 = Parser:CreateFontString()
RT2 = Parser:CreateFontString()
Parser:AddFontStrings(LT2, RT2)
LT3 = Parser:CreateFontString()
RT3 = Parser:CreateFontString()
Parser:AddFontStrings(LT3, RT3)
end
return Parser, LT1, LT2, LT3, RT1, RT2, RT3
end
end
-- From Interface/GlueXML/CharacterCreate
local RACE_ICON_TCOORDS = {
["HUMAN_MALE"] = {0, 0.125, 0, 0.25},
["DWARF_MALE"] = {0.125, 0.25, 0, 0.25},
["GNOME_MALE"] = {0.25, 0.375, 0, 0.25},
["NIGHTELF_MALE"] = {0.375, 0.5, 0, 0.25},
["TAUREN_MALE"] = {0, 0.125, 0.25, 0.5},
["SCOURGE_MALE"] = {0.125, 0.25, 0.25, 0.5},
["TROLL_MALE"] = {0.25, 0.375, 0.25, 0.5},
["ORC_MALE"] = {0.375, 0.5, 0.25, 0.5},
["HUMAN_FEMALE"] = {0, 0.125, 0.5, 0.75},
["DWARF_FEMALE"] = {0.125, 0.25, 0.5, 0.75},
["GNOME_FEMALE"] = {0.25, 0.375, 0.5, 0.75},
["NIGHTELF_FEMALE"] = {0.375, 0.5, 0.5, 0.75},
["TAUREN_FEMALE"] = {0, 0.125, 0.75, 1.0},
["SCOURGE_FEMALE"] = {0.125, 0.25, 0.75, 1.0},
["TROLL_FEMALE"] = {0.25, 0.375, 0.75, 1.0},
["ORC_FEMALE"] = {0.375, 0.5, 0.75, 1.0},
["BLOODELF_MALE"] = {0.5, 0.625, 0.25, 0.5},
["BLOODELF_FEMALE"] = {0.5, 0.625, 0.75, 1.0},
["DRAENEI_MALE"] = {0.5, 0.625, 0, 0.25},
["DRAENEI_FEMALE"] = {0.5, 0.625, 0.5, 0.75},
["GOBLIN_MALE"] = {0.625, 0.750, 0.25, 0.5},
["GOBLIN_FEMALE"] = {0.625, 0.750, 0.75, 1.0},
["WORGEN_MALE"] = {0.625, 0.750, 0, 0.25},
["WORGEN_FEMALE"] = {0.625, 0.750, 0.5, 0.75},
["PANDAREN_MALE"] = {0.750, 0.875, 0, 0.25},
["PANDAREN_FEMALE"] = {0.750, 0.875, 0.5, 0.75},
}
function TMW:GetRaceIconCoords(race)
local token = race:upper() .. "_" .. (UnitSex('player') == 2 and "MALE" or "FEMALE")
return {
(RACE_ICON_TCOORDS[token][1]+.01),
(RACE_ICON_TCOORDS[token][2]-.01),
(RACE_ICON_TCOORDS[token][3]+.02),
(RACE_ICON_TCOORDS[token][4]-.02) }
end
TMW:MakeSingleArgFunctionCached(TMW, "GetRaceIconCoords")
function TMW:TryGetNPCName(id)
local tooltip, LT1 = TMW:GetParser()
tooltip:SetOwner(UIParent, "ANCHOR_NONE")
tooltip:SetHyperlink( string.format( "unit:Creature-0-0-0-0-%d:0000000000", id))
return LT1:GetText()
end
---------------------------------
-- User-Defined Lua Import Detection
---------------------------------
local detectors = {}
function TMW:RegisterLuaImportDetector(func)
detectors[func] = true
end
local function recursivelyDetectLua(results, table, ...)
if type(table) == "table" then
for func in pairs(detectors) do
local success, code, name = TMW.safecall(func, table, ...)
if success and code then
tinsert(results, {code = code, name = name})
end
end
for a, b in pairs(table) do
recursivelyDetectLua(results, b, a, ...)
end
end
end
function TMW:DetectImportedLua(table)
local results = {}
recursivelyDetectLua(results, table)
if #results == 0 then
return nil
end
return results
end
|
-- import
config = require "config"
flower = require "flower"
tiled = require "flower.tiled"
widget = require "flower.widget"
audio = require "flower.audio"
spine = require "flower.spine"
dungeon = require "flower.dungeon"
fsm = require "flower.fsm"
tasker = require "flower.tasker"
-- audio initialize
audio.init()
-- open window
flower.openWindow()
-- open scene
flower.openScene("main_scene")
|
local Parachute_list = {}
function Spawn(x, y, z)
local pickup = CreatePickup(818, x, y, z)
table.insert(Parachute_list, pickup)
end
AddFunctionExport("Spawn", Spawn)
function SetParachutePlayer(player, value)
AttachPlayerParachute(player, value)
end
AddFunctionExport("SetParachutePlayer", SetParachutePlayer)
AddEvent("OnPlayerPickupHit", function(player, pickup)
for k,v in pairs(Parachute_list) do
if v == pickup then
DestroyPickup(pickup)
AttachPlayerParachute(player, true)
Parachute_list[k] = nil
end
end
end)
AddRemoteEvent("parachute:disable", function(player)
AttachPlayerParachute(player, false)
end) |
--[[
Copyright 2020 Teverse
@File core/client/characterController.lua
@Author(s) Jay
--]]
print("loading chars")
local controller = {}
-- set to false for debugging purposes.
local CLIENT_PREDICTION = false
controller.character = nil -- server creates this
controller.camera = require("tevgit:core/client/cameraController.lua")
local forward = quaternion:setEuler(0, controller.camera.cameraRotation:getEuler().y, 0)
local function setupCharacterLocally(client, char)
local nameTag = engine.construct("guiTextBox", engine.interface, {
name = client.id,
size = guiCoord(0, 100, 0, 16),
align = enums.align.middle,
text = client.name,
textColour = colour(1, 1, 1),
backgroundAlpha = 0,
fontSize = 16,
fontFile = "local:moskBold.ttf"
})
workspace.camera:onSync("changed", function()
local inFrontOfCamera, screenPos = workspace.camera:worldToScreen(char.position + vector3(0,char.size.y/2,0))
if inFrontOfCamera then
nameTag.visible = true
nameTag.position = guiCoord(0, screenPos.x - 50, 0, screenPos.y)
else
nameTag.visible = false
end
end)
end
local function characterSpawnedHandler(newClientId)
print('waiting for mne')
repeat wait() until engine.networking.me
if engine.networking.me.id == newClientId then
print("Waiting for my character")
repeat wait() until workspace[engine.networking.me.id]
print('GOT my CHAR')
controller.character = workspace[engine.networking.me.id]
setupCharacterLocally(engine.networking.me, controller.character)
print('set up')
-- controller.character.physics=false
if controller.camera then
-- controller.character.opacity = 0
--controller.camera.camera.position = vector3(0,90,0)
--controller.camera.camera:lookAt(vector3(0,0,0))
controller.camera.setTarget(controller.character)
end
else
print("Waiting for other character")
repeat wait() until workspace[newClientId]
print("got other character")
local client = engine.networking.clients:getClientFromId(newClientId)
setupCharacterLocally(client, workspace[newClientId])
end
end
engine.networking.clients:clientConnected(function (client)
characterSpawnedHandler(client.id)
end)
for _,v in pairs(engine.networking.clients.children)do
characterSpawnedHandler(v.id)
end
controller.keyBinds = {
[enums.key.w] = 1,
[enums.key.up] = 1,
[enums.key.s] = 2,
[enums.key.down] = 2,
[enums.key.a] = 3,
[enums.key.left] = 3,
[enums.key.d] = 4,
[enums.key.right] = 4,
[enums.key.space] = 5
}
controller.keyBindsDir = {
vector3(0,0,1), --w
vector3(0,0,-1), --s
vector3(-1,0,0), --a
vector3(1,0,0) -- d
}
controller.keys = {
false,
false,
false,
false,
false
}
local isPredicting = false
local updatePrediction = function()
local totalForce = vector3()
local moved = false
for i, pressed in pairs(controller.keys) do
if pressed then
moved=true
totalForce = totalForce + (forward * controller.keyBindsDir[i])
end
end
if CLIENT_PREDICTION and moved then
--controller.character:applyImpulse(totalForce * 10)
local f = totalForce*10
f.y = controller.character.linearVelocity.y
local lv = vector3(f.x, 0, f.z)
if lv ~= vector3(0,0,0) then
print(lv)
controller.character.rotation = quaternion:setLookRotation(lv:normal())
end
controller.character.linearVelocity = f
end
return moved
end
-- The purpose of this function is to predict how the server will move the character
-- based on the input we send.
local function predictServerMovementOnClient(direction)
if not controller.character then return end
if direction == 5 then
controller.character:applyImpulse(0,300,0)
return nil
elseif controller.keys[direction] == nil then
return nil
end
controller.keys[direction] = true
if not isPredicting then
isPredicting = true
print("Predicting")
engine.graphics:onSync("frameDrawn",function()
if not updatePrediction() then
print("Ending prediction")
isPredicting =false
self:disconnect() -- no input from user.
end
end)
end
end
engine.input:keyPressed(function (inputObj)
if controller.keyBinds[inputObj.key] then
forward = quaternion:setEuler(0, controller.camera.cameraRotation:getEuler().y + math.rad(180), 0)
if CLIENT_PREDICTION then
predictServerMovementOnClient(controller.keyBinds[inputObj.key])
end
engine.networking:toServer("characterSetInputStarted", controller.keyBinds[inputObj.key], controller.camera.cameraRotation)
end
end)
engine.input:keyReleased(function (inputObj)
if controller.keyBinds[inputObj.key] then
engine.networking:toServer("characterSetInputEnded", controller.keyBinds[inputObj.key])
controller.keys[controller.keyBinds[inputObj.key]] = false
end
end)
return controller |
minetest.register_craftitem("chemistry:flask", {
description = "Flask",
inventory_image = "chemistry_flask.png",
liquids_pointable = true,
on_use = function(itemstack, user, pt)
if pt.type == "node" then
local item = chemistry.nodes[minetest.get_node(pt.under).name]
if item and user:get_inventory():room_for_item("main", item) then
user:get_inventory():add_item("main", item)
itemstack:take_item()
end
end
return itemstack
end,
})
minetest.register_craft({
output = "chemistry:flask",
recipe = {
{"vessels:glass_bottle"}
},
})
|
vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function()
use { 'wbthomason/packer.nvim' }
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
use {
'kyazdani42/nvim-tree.lua', requires = 'kyazdani42/nvim-web-devicons',
config = function() require'nvim-tree'.setup {} end
}
use {
"folke/which-key.nvim",
config = function() require("which-key").setup {} end
}
use { "morhetz/gruvbox" }
use { "neovim/nvim-lspconfig" }
use { "williamboman/nvim-lsp-installer" }
use { "hrsh7th/cmp-nvim-lsp" }
use { "hrsh7th/cmp-buffer" }
use { "hrsh7th/nvim-cmp" }
use { "saadparwaiz1/cmp_luasnip" }
use { "L3MON4D3/LuaSnip" }
use { "shadmansaleh/lualine.nvim" }
use { "romgrk/barbar.nvim" }
use { "ChristianChiarulli/dashboard-nvim" }
use { "fladson/vim-kitty" }
use { "knubie/vim-kitty-navigator", run="cp ./*.py ~/.config/kitty/" }
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
use { 'tzachar/cmp-tabnine', run='./install.sh', requires = 'hrsh7th/nvim-cmp'}
use { 'onsails/lspkind-nvim' }
use { 'windwp/nvim-autopairs', config = function() require('nvim-autopairs').setup() end }
use { 'Shatur/neovim-cmake',
requires = { { 'skywind3000/asyncrun.vim' }, { 'mfussenegger/nvim-dap' } }
}
use {'mhinz/vim-signify'}
use {'tpope/vim-fugitive'}
use {'tpope/vim-rhubarb'}
use {'junegunn/gv.vim'}
use {'Pocco81/DAPInstall.nvim'}
use {'nvim-telescope/telescope-dap.nvim'}
use {'skywind3000/asyncrun.extra'}
end)
|
fx =
{
style = "STYLE_LIGHT",
properties =
{
property_02 =
{
name = "Offset",
type = "VARTYPE_ARRAY_TIMEVECTOR3",
value =
{
entry_00 =
{ 0, 0, 0, 0, },
entry_01 =
{ 1, 0, 0, 0, }, }, },
property_01 =
{
name = "Colour",
type = "VARTYPE_ARRAY_TIMECOLOUR",
value =
{
entry_00 =
{ 0, 0.1, 0.1, 0.1, 1, },
entry_01 =
{ 0.1, 1, 1, 1, 1, },
entry_02 =
{ 0.4, 1, 1, 1, 1, },
entry_03 =
{ 0.6, 0.36792, 0.36792, 0.36792, 1, },
entry_04 =
{ 0.7, 0.24528, 0.24528, 0.24528, 1, },
entry_05 =
{ 0.8, 0.19811, 0.19811, 0.19811, 1, },
entry_06 =
{ 0.9, 0.15094, 0.15094, 0.15094, 1, },
entry_07 =
{ 1, 0.1, 0.1, 0.1, 1, }, }, },
property_04 =
{
name = "Duration",
type = "VARTYPE_FLOAT",
value = 7, },
property_03 =
{
name = "Loop",
type = "VARTYPE_BOOL",
value = 1, },
property_05 =
{
name = "Priority",
type = "VARTYPE_INT",
value = 0, },
property_00 =
{
name = "Radius",
type = "VARTYPE_ARRAY_TIMEFLOAT",
value =
{ 0, 500, 1, 500, }, }, }, }
|
local _, ns = ...
local ApplyUiScale = ns.utility.ApplyUiScale
local stylesheet = ns.stylesheet
local height = ApplyUiScale(stylesheet.health.height)
local padding = ApplyUiScale(stylesheet.generic.padding)
local borderSize = ApplyUiScale(stylesheet.generic.barBorder)
function ns.elements.AddHealthBar(self, unit)
local health = ns.elements.StatusBar:new(self)
health:SetHeight(height)
health:SetBorderSize(borderSize)
health:SetPoint("TOPLEFT", padding, -padding)
health:SetPoint("TOPRIGHT", -padding, -padding)
health.colorHealth = true
health.colorReaction = unit ~= "player"
health.frequentUpdates = true
self.Health = health
end
|
return {
VGitViewWordAdd = {
bg = '#5d7a22',
fg = nil,
},
VGitViewWordRemove = {
bg = '#960f3d',
fg = nil,
},
VGitSignAdd = {
fg = '#d7ffaf',
bg = nil,
},
VGitSignChange = {
fg = '#7AA6DA',
bg = nil,
},
VGitSignRemove = {
fg = '#e95678',
bg = nil,
},
VGitIndicator = {
fg = '#f92672',
bg = nil,
},
VGitStatus = {
fg = '#bb9af7',
bg = '#3b4261',
},
VGitBorder = {
fg = '#504945',
bg = nil,
},
}
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
require("lualib_bundle");
local ____exports = {}
____exports.Input = __TS__Class()
local Input = ____exports.Input
Input.name = "Input"
function Input.prototype.____constructor(self, bindings)
if bindings == nil then
bindings = {}
end
self.bindings = bindings
end
function Input.prototype.bind(self, scancode, action_name)
self.bindings[action_name] = scancode
end
function Input.prototype.isDown(self, action_name)
if action_name then
return love.keyboard.isDown(self.bindings[action_name])
end
for action_name in pairs(self.bindings) do
if love.keyboard.isDown(self.bindings[action_name]) then
return true
end
end
return false
end
function Input.prototype.getKeyPressed(self)
local keypressed = {}
for action_name in pairs(self.bindings) do
local key = self.bindings[action_name]
if love.keyboard.isDown(key) then
__TS__ArrayPush(keypressed, action_name)
end
end
return keypressed
end
return ____exports
|
if managers.system_menu:is_active() then
do return end
end
UT.openMenu(UT.menus.main()) |
-- scaffolding entry point for stb
return dofile("stb.lua")
|
-- Used by the meshes.
register_material(`Small`, {
})
print "Loading Test.08.mesh"
disk_resource_load(`Test.08.mesh`)
print "Using Test.08.mesh"
b08 = gfx_body_make(`Test.08.mesh`)
print "Loading Test.08.mesh"
disk_resource_load(`Test.10.mesh`)
print "Using Test.08.mesh"
b10 = gfx_body_make(`Test.10.mesh`)
|
local colors = require("CHPastel.utils").colors
local Group = require("CHPastel.utils").Group
Group.new("NvimStringSpecial", colors.green, nil, nil)
Group.new("NvimInvalidStringSpecial", colors.green, nil, nil)
|
slot2 = "SlwhView"
SlwhView = class(slot1)
slot2 = "slwh.view.ccs.SlwhLoadingCcsView"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhRoomCcsView"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhBankCcsView"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhBattleCcsView"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhMenuItemCcsView"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhNoticeCcsPane"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhJettonCcsView"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhRewardCcsView"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhRuleCcsView"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhOnlineCcsView"
requireLuaFromModule(slot1)
slot2 = "slwh.view.ccs.SlwhJettonNewCcsView"
requireLuaFromModule(slot1)
ccs.SlwhRoomView = SlwhRoomCcsView
ccs.SlwhBankCcsView = SlwhBankCcsView
ccs.SlwhBattleCcsView = SlwhBattleCcsView
ccs.SlwhJettonCcsView = SlwhJettonCcsView
ccs.SlwhNoticeCcsPane = SlwhNoticeCcsPane
ccs.SlwhMenuItemCcsView = SlwhMenuItemCcsView
ccs.SlwhRuleCcsView = SlwhRuleCcsView
ccs.SlwhLoadingCcsView = SlwhLoadingCcsView
ccs.SlwhJettonNewCcsView = SlwhJettonNewCcsView
ccs.SlwhOnlineCcsView = SlwhOnlineCcsView
SlwhView.ctor = function (slot0, slot1, slot2)
slot0.model = slot1
slot0.controller = slot2
slot8 = "module/slwh/csb/layer/Slwh.csb"
ClassUtil.extends(slot4, slot0, BaseModuleUIView, true)
slot0._maskOpacity = 0
slot6 = false
slot0.setRootClickable(slot4, slot0)
end
SlwhView.onShow = function (slot0)
slot3 = slot0
BaseModuleUIView.onShow(slot2)
end
SlwhView.onHide = function (slot0)
slot3 = slot0
BaseModuleUIView.onHide(slot2)
end
SlwhView.bindChildrenViews = function (slot0)
slot5 = slot0
slot12 = true
slot0.bindTabView(slot6, slot0, slot1, "module/slwh/csb/layer/SlwhRoom.csb", slot4, VIEW_TYPE_ROOM)
slot12 = true
slot0.bindTabView(slot6, slot0, slot1, "module/slwh/csb/layer/SlwhBattle.csb", slot4, VIEW_TYPE_BATTLE)
slot12 = false
slot0.bindTabView(slot6, slot0, slot2, "module/slwh/csb/layer/SlwhLoading.csb", "isShowingLoading", true)
slot10 = slot0
slot12 = false
slot0.bindTabView(slot6, slot0, slot0.getRootView("module/slwh/csb/layer/SlwhLoading.csb").layerMenu, "module/slwh/csb/layer/SlwhMenu.csb", "isShowingMenu", true)
slot10 = "isShowingRule"
slot0.bindPopUpChildView(slot6, slot0, "rule", "module/slwh/csb/layer/SlwhRule.csb")
slot10 = "isShowingSetting"
slot0.bindPopUpChildView(slot6, slot0, "setting", "module/slwh/csb/layer/SlwhSetting.csb")
slot10 = "isShowingBank"
slot0.bindPopUpChildView(slot6, slot0, "bank", "module/slwh/csb/layer/SlwhBank.csb")
slot12 = slot0:getRootView().layer_tips
slot0.bindPopUpChildView(slot6, slot0, "jetton_panel", "module/slwh/csb/layer/SlwhJettonNew.csb", "isShowingJetton", true)
slot10 = "isShowingOnline"
slot0.bindPopUpChildView(slot6, slot0, "online", "module/slwh/csb/layer/SlwhOnline.csb")
slot7 = slot0
slot0.model.noticeControl = slot0.getRootView(slot6).layerGameNotice
slot9 = slot0
slot0.model._layerTips = slot0.getRootView("online").layer_tips
end
SlwhView.hide = function (slot0, slot1, slot2, slot3)
slot9 = slot3
BaseModuleUIView.hide(slot5, slot0, slot1, slot2)
slot6 = audioMgr
audioMgr.playMainMusic(slot5)
end
SlwhView.destroy = function (slot0)
slot3 = slot0
BaseModuleUIView.destroy(slot2)
slot0.model = nil
slot0.controller = nil
end
return
|
--- enemy that is accompanied by an escort
My.EventHandler:register("onEnemySpawn", function(_, enemyInfo)
local escortConfig = enemyInfo:getConfig().escort
if escortConfig == nil then return end
local spawns = {}
Cron.regular(function(self)
if not enemyInfo:isSpawned() then
Cron.abort(self)
else
for i, droneInfo in ipairs(spawns) do
if not droneInfo:isSpawned() then
table.remove(spawns, i)
end
end
if Util.size(spawns) < escortConfig.max then
local droneInfo = My.EnemyInfo(escortConfig.template.name)
local drone = droneInfo:spawnEnemyShip()
local x, y = enemyInfo:getShipObject():getPosition()
drone:setPosition(x, y)
Ship:withOrderQueue(drone)
drone:addOrder(Order:defend(enemyInfo:getShipObject(), {minDefendTime = 9999}))
drone:addOrder(Order:roaming())
table.insert(spawns, droneInfo)
end
end
end, escortConfig.interval, escortConfig.interval / 2)
end) |
--intermediate interface info generator
local format, gsub, unescape = string.format, string.gsub, unescape
local pairs, ipairs, next = pairs, ipairs, next
--------------------------------------------------------------------
module('yu', package.seeall)
local getDeclName = getDeclName
local getType, getTypeDecl = getType, getTypeDecl
local isBuiltinType, getBuiltinType = isBuiltinType, getBuiltinType
local getConstNode, constToString = getConstNode, constToString
--------------------------------------------------------------------
local yigenModule, yigenClass, yigenFunc, yigenEnum, yigenNode, yigenVar, yigenSignal
--------------------------------------------------------------------
----YI Generator----
--------------------------------------------------------------------
function yigenNode( gen, node )
local tag = node.tag
local name = node.name
gen:cr()
gen:appendf('%s = {', name)
gen:ii()
gen:cr()
gen:appendf('tag = %q ; name = %q ; refname = %q ;', tag, name , node.refname)
gen:cr()
gen:appendf('p0 = %d; p1 = %d;', node.p0, node.p1)
if tag == 'funcdecl' or tag == 'methoddecl' then
if node.abstract then
gen:cr()
gen'abstract = true ;'
end
if node.final then
gen:cr()
gen'final = true ;'
end
yigenFunc(gen,node)
elseif tag == 'var' then
yigenVar(gen,node)
elseif tag == 'classdecl' then
yigenClass(gen,node)
elseif tag == 'enumdecl' then
yigenEnum(gen,node)
elseif tag == 'import' then
yigenImport(gen, node)
elseif tag == 'signaldecl' then
yigenSignal(gen, node)
else
error('unsupported yi generation:'..tag)
end
gen:di()
gen:cr()
gen'};'
gen:cr()
end
function yigenFunc(gen,f)
yigenType(gen, f.type)
end
function yigenImport(gen, i)
gen:cr()
gen:appendf('path = %q;', i.mod.path)
end
function yigenClass(gen,c)
if c.superclass then
gen:cr()
gen:appendf('superclass = %q ;', c.superclass.name)
end
if c.abstract then
gen:cr()
gen'abstract = true;'
end
gen:cr()
gen'scope = {'
gen:ii()
local scope=c.scope
--member
for k, v in pairs(scope) do
if not v.private then
yigenNode(gen, v)
end
end
gen:di() gen:cr()
gen'};'
end
function yigenVar(gen,v)
gen:cr()
gen:appendf('vtype = %q;',v.vtype)
yigenType(gen , v.type)
end
function yigenEnum(gen,e)
gen:cr()
gen'scope={'
for i,t in pairs(e.items) do
gen:appendf(' %s = %d,', t.name, t.value.v)
end
gen'};'
end
function yigenModule(gen,m)
--info
gen'return {'
gen:ii()
gen:cr()
gen:cr()
gen'----module info--'
gen:cr()
gen:appendf('file=%q;', m.file)
gen:cr()
gen:appendf('name=%q;', m.name)
gen:cr()
gen'line_offset={'
local off1=0
for l,off in ipairs(m.lineOffset) do
gen:append((off-off1)..',')
off1=off
end
gen'};'
gen:cr()
gen'import={'
gen:ii()
for i,node in ipairs(m.heads) do
if node.tag == 'import' then
ex=node.mod
gen:cr()
gen'{'
gen:appendf("path = %q,",ex.path)
if node.alias then
gen:appendf("alias = %q,",node.alias)
end
gen'},'
end
end
gen:di()
gen:cr()
gen'};'
gen:cr()
gen:cr()
gen'----interface info--'
gen:cr()
--scope
gen:cr()
gen'scope={'
gen:ii()
local scope=m.scope
for k, v in pairs(scope) do
if not v.private then
yigenNode(gen, v)
end
end
gen:di()
gen:cr()
gen'}'
gen:cr()
gen:di()
gen:cr()
gen'}'
gen:cr()
end
function yigenType(gen, t, typekey)
local td = getTypeDecl(t)
gen:cr()
gen:appendf('%s = ', typekey or 'type')
local tag=td.tag
if tag=='functype' then --make signature
gen'{'
gen:ii()
gen:cr()
gen'tag = "functype";'
gen:cr()
gen:appendf('name = %q; ', td.name)
--args
gen:cr()
if next(td.args) then
gen'args = {'
gen:ii()
for i,arg in ipairs(td.args) do
gen:cr()
gen'{'
gen:ii()
gen:cr()
gen:appendf('name = %q;',arg.name)
yigenType(gen, arg.type, 'type')
if arg.value then
gen:cr()
local c, extra = getConstNode( arg.value )
gen:appendf( 'value = {%s};', constToString( c ) )
if extra and extra.tag == 'enumitem' then
gen:cr()
gen:appendf( 'item = %q;', extra.name )
end
end
gen:di()
gen:cr()
gen'},'
end
gen:di()
gen:cr()
gen'};'
else
gen'args = {} ;'
end
gen:cr()
local ret=td.rettype
gen'rettype = {'
gen:ii()
if ret.tag=='mulrettype' then
for i, rt in ipairs(ret.types) do
gen:cr()
gen'{'
gen:ii()
if rt.alias then
gen:cr()
gen:appendf('alias=%q;',rt.alias)
end
yigenType(gen, rt)
gen:di()
gen'},'
end
else
gen:cr()
gen'{'
gen:ii()
if ret.alias then
gen:cr()
gen:appendf('alias=%q;',ret.alias)
end
yigenType(gen, ret)
gen:di()
gen:cr()
gen'}'
end
gen:di()
gen:cr()
gen'}' --end of ret
gen:di()
gen:cr()
gen'};' --end of functype
elseif tag=='tabletype' then
gen'{'
gen:ii()
gen:cr()
gen'tag = "tabletype";'
gen:cr()
gen:appendf('name = %q;', td.name or '??')
yigenType(gen, td.ktype, 'ktype')
yigenType(gen, td.etype, 'etype')
gen:di()
gen:cr()
gen'};'
elseif tag=='vararg' then
gen'{'
gen:ii()
gen:cr()
gen'tag = "vararg";'
gen:cr()
gen:appendf('name = %q;', td.name or '??')
yigenType(gen, td.type, "type")
gen:di()
gen:cr()
gen'};'
else
if not td.name then table.foreach(td,print) end
gen:appendf( '%q ;', td.name)
end
end
function generateInterface(m)
local gen=newCodeWriter({noindent=true})
yigenModule(gen, m)
return gen:tostring()
end
--------------------------------------------------------------------
----YI Loader----
--------------------------------------------------------------------
local yiloadNode, yiloadClass, yiloadVar, yiloadFunc, yiloadType, yiloadImport
local function yifindExternSymbol( entryModule, name, searchSeq ) --should be safe without check duplications
local externModules = entryModule.externModules
if externModules then
entryModule._seq = searchSeq --a random table as sequence
for p,m in pairs(externModules) do
if m.__seq ~= searchSeq and not entryModule.namedExternModule[m] then
m.__seq = searchSeq
local decl = m.scope[name]
if decl and not decl.private then
return decl
end
decl = yifindExternSymbol(m,name,searchSeq)
if decl then return decl end
end
end
end
return nil
end
local function yifindSymbol( m, name )
local s = getBuiltinType( name )
if s then return s end
s = m.scope[name]
if s then return s end
s = yifindExternSymbol( m, name, {} )
assert(s)
return s
-- error('todo extern symbol:'..name)
end
function yiloadNode( d )
if d.resolveState == 'done' then return end
local tag = d.tag
if tag == 'funcdecl' or tag == 'methoddecl' then
yiloadFunc(d)
elseif tag == 'var' then
yiloadVar(d)
elseif tag == 'classdecl' then
yiloadClass(d)
elseif tag == 'enumdecl' then
yiloadEnum(d)
elseif tag == 'import' then
yiloadImport(d)
end
d.resolveState = 'done'
end
function yiloadFunc( f )
f.type=yiloadType(f.module, f.type)
end
function yiloadClass( c )
for k, d in pairs(c.scope) do
d.module = c.module
yiloadNode(d)
end
c.valuetype = true
c.type = classMetaType
if c.superclass then
c.superclass = yifindSymbol(c.module, c.superclass)
end
end
function yiloadEnum( e )
e.valuetype = true
e.type = enumMetaType
local scope = e.scope --convert to resolver acceptable format
for k,v in pairs(scope) do
scope[k] = {
tag = 'enumitem',
name = k,
value = makeNumberConst(v),
type = e,
resolveState = 'done',
}
end
e.items=newitems
end
function yiloadImport( i )
local name = i.name
for m in pairs( i.module.namedExternModule ) do
if m.path == i.path then
i.mod = m
break
end
end
if not i.mod then error('FATAL: named module not found:'..name) end
i.type = moduleMetaType
end
function yiloadVar( v )
v.type=yiloadType(v.module, v.type)
end
function yiloadType( m, t )
local tt = type(t)
if tt == 'string' then
return yifindSymbol(m, t)
elseif tt == 'table' then
local tag=t.tag
if tag == 'functype' then
t.resolveState = 'done'
t.valuetype = true
t.type = funcMetaType
local args=t.args
for i, arg in ipairs(args) do
arg.tag = 'arg'
arg.type = yiloadType( m, arg.type )
if arg.value then
local v = arg.value[1]
local argType = arg.type
if argType == nilType then arg.value = nilConst
elseif argType == numberType then arg.value = makeNumberConst(v)
elseif argType == stringType then arg.value = makeStringConst(v)
elseif argType == booleanType then arg.value = makeBooleanConst(v)
elseif argType.tag == 'enumdecl' then
if v == nil then
arg.value = nilConst
else
if argType.resolveState ~= 'done' then
yiloadNode( argType )
end
local item = argType.scope[ arg.item ]
assert( type(item) == 'table', type(item) )
arg.value = item
end
else
error("FATAL:unsupported arg value type:" .. argType.name)
end
end
end
local ret=t.rettype
local converted = {}
for i, rt in ipairs(ret) do
converted[i] = yiloadType( m, rt.type )
end
if #converted>1 then
t.rettype = {
tag = 'mulrettype',
types = converted
}
else
t.rettype = converted[1]
end
return t
elseif tag == 'tabletype' then
t.valuetype = true
t.type = tableMetaType
t.ktype = yiloadType( m, t.ktype )
t.etype = yiloadType( m, t.etype )
t.resolveState = 'done'
return t
elseif tag=='vararg' then
t.valuetype = false
t.type = yiloadType( m, t.type )
t.resolveState = 'done'
return t
else
error("???")
end
end
end
local function fixpath( p )
p = string.gsub(p,'\\','/')
return p
end
local function stripExt( p )
p = fixpath(p)
p = string.gsub(p,'%..*$','')
return p
end
function loadInterface( data, imports, namedExternModule )
local m={}
m.file = data.file
m.path = data.file
m.name = data.name
m.modpath = stripExt(m.path)
local externModules = {}
for im, mod in pairs(imports) do
externModules[mod.path] = mod
end
m.externModules = externModules
m.namedExternModule = namedExternModule
m.lineOffset = data.line_offset
m.scope = data.scope
m.module = m
for k, d in pairs(m.scope) do
d.module = m
yiloadNode(d)
end
m.resolveState = 'done'
return m
end
|
function onEvent(name, value1, value2)
if name == 'Hide HUD' then
value1=tonumber(value1);
if value1 == 1 then --hide
setProperty('scoreTxt.visible', false);
setProperty('healthBar.visible', false);
setProperty('healthBarBG.visible', false);
setProperty('iconP1.visible', false);
setProperty('iconP2.visible', false);
setProperty('botplayTxt.visible', false);
setProperty('timeBar.visible', false);
setProperty('timeBarBG.visible', false);
setProperty('timeTxt.visible', false);
elseif value1 == 0 then --bring it back
setProperty('scoreTxt.visible', true);
setProperty('healthBar.visible', true);
setProperty('healthBarBG.visible', true);
setProperty('iconP1.visible', true);
setProperty('iconP2.visible', true);
if botPlay == true then --in case it's supposed to stay hidden
setProperty('botplayTxt.visible', true);
end
setProperty('timeBar.visible', true);
setProperty('timeBarBG.visible', true);
setProperty('timeTxt.visible', true);
end
end
end |
-- -----------------------------------------------------------------------------
-- Parse
-- -----------------------------------------------------------------------------
describe('String.parse', function()
spec('short string', function()
assert.has_subtable({ '' }, parse.String('""'))
assert.has_subtable({ 'hello' }, parse.String('"hello"'))
assert.has_subtable({ 'hello' }, parse.String("'hello'"))
assert.has_subtable({ 'hello\\nworld' }, parse.String("'hello\\nworld'"))
assert.has_subtable({ '\\\\' }, parse.String("'\\\\'"))
assert.has_error(function()
parse.String('"hello')
end)
assert.has_error(function()
parse.String('"hello\nworld"')
end)
end)
spec('long string', function()
assert.has_subtable({ ' hello world ' }, parse.String('[[ hello world ]]'))
assert.has_subtable({ 'hello\nworld' }, parse.String('[[hello\nworld]]'))
assert.has_subtable({ 'a{bc}d' }, parse.String('[[a\\{bc}d]]'))
assert.has_subtable({ 'a[[b' }, parse.String('[=[a[[b]=]'))
assert.has_error(function()
parse.String('[[hello world')
end)
assert.has_error(function()
parse.String('[[hello world {2]]')
end)
end)
spec('interpolation', function()
assert.has_subtable(
{ 'hello ', { value = '3' } },
parse.String('"hello {3}"')
)
assert.has_subtable(
{ 'hello ', { value = '3' } },
parse.String("'hello {3}'")
)
assert.has_subtable(
{ 'hello ', { value = '3' } },
parse.String('[[hello {3}]]')
)
end)
end)
-- -----------------------------------------------------------------------------
-- Compile
-- -----------------------------------------------------------------------------
describe('String.compile', function()
spec('compile short string', function()
assert.are.equal('"hello"', compile.String('"hello"'))
assert.are.equal("'hello'", compile.String("'hello'"))
assert.are.equal("'hello\\nworld'", compile.String("'hello\\nworld'"))
assert.are.equal("'\\\\'", compile.String("'\\\\'"))
end)
spec('compile long string', function()
assert.eval('hello world', compile.String('[[hello world]]'))
assert.eval(' hello\nworld', compile.String('[[ hello\nworld]]'))
assert.eval('a{bc}d', compile.String('[[a\\{bc}d]]'))
assert.eval('a[[b', compile.String('[=[a[[b]=]'))
end)
spec('compile interpolation', function()
assert.eval('hello 3', compile.String('"hello {3}"'))
assert.eval('hello 3', compile.String("'hello {3}'"))
assert.eval('hello 3', compile.String('[[hello {3}]]'))
end)
end)
|
local ViewBase = require("games/common2/module/viewBase");
local MatchToolbarView = class(ViewBase,false);
local l_index = 0;
local getIndex = function ( ... )
l_index = l_index + 1;
return l_index;
end
MatchToolbarView.s_controls =
{
shield = getIndex();
menu_btn = getIndex();
more_view = getIndex();
exit_btn = getIndex();
setting_btn = getIndex();
menu_view = getIndex();
};
MatchToolbarView.ctor = function (self, seat, layoutConfig)
super(self, layoutConfig);
self:setFillParent(true,true);
self.m_ctrl = MatchToolbarView.s_controls;
self:_init();
CommonRoomTimer2.getInstance():addCallBack(self, self.onUpdateTime);
EventDispatcher.getInstance():register(Event.Call,self,self.onNativeEvent);
NativeEvent.getInstance():getBatteryLevel();
end
MatchToolbarView.dtor = function (self)
CommonRoomTimer2.getInstance():clean(self);
EventDispatcher.getInstance():unregister(Event.Call,self,self.onNativeEvent);
end
MatchToolbarView._init = function (self)
self.m_shield = self:findViewById(self.m_ctrl.shield);
self.m_moreView = self:findViewById(self.m_ctrl.more_view);
if self.m_shield then
self.m_shield:setVisible(false);
end
if self.m_moreView then
self.m_moreView:setVisible(false);
end
end
MatchToolbarView.parseConfig = function(self, config)
config = table.verify(config);
local menu_view_config = table.verify(config.menu_view);
if not table.isEmpty(menu_view_config) then
local menu_view = self:findViewById(self.m_ctrl.menu_view);
menu_view:setPos(menu_view_config.x,menu_view_config.y);
if menu_view_config.align then
menu_view:setAlign(menu_view_config.align);
end
end
self:_initMenuBtnView(config.menu_btn_config);
end
--配置菜单按钮的位置
MatchToolbarView._initMenuBtnView = function(self,menu_btn_config)
if not table.isEmpty(menu_btn_config) then
local menu_btn = self:findViewById(self.m_ctrl.menu_btn);
menu_btn:setPos(menu_btn_config.x,menu_btn_config.y);
if menu_btn_config.align then
menu_btn:setAlign(menu_btn_config.align);
end
end
end
MatchToolbarView.hideMoreView = function (self)
if self.m_moreView then
self.m_moreView:setVisible(true);
self.m_moreView:removeProp(1);
self.m_moreView:removeProp(2);
local width, height = self.m_moreView:getSize();
self.m_moreView:addPropTransparency(1,kAnimNormal,100,0,1,0);
local lastAnim = self.m_moreView:addPropScale(2,kAnimNormal,100,0,1,0,1,0,kCenterXY,width,0);
if lastAnim then
lastAnim:setDebugName("MatchToolbarView|hideMoreView|lastAnim");
lastAnim:setEvent(self, function ( ... )
self.m_moreView:removeProp(1);
self.m_moreView:removeProp(2);
self.m_moreView:setVisible(false);
end);
else
self.m_moreView:setVisible(false);
end
end
if self.m_shield then
self.m_shield:setVisible(false);
end
end
MatchToolbarView.showMoreView = function (self)
if self.m_moreView then
self.m_moreView:setVisible(true);
self.m_moreView:removeProp(1);
self.m_moreView:removeProp(2);
local width, height = self.m_moreView:getSize();
self.m_moreView:addPropTransparency(1,kAnimNormal,100,0,0,1);
local lastAnim = self.m_moreView:addPropScale(2,kAnimNormal,100,0,0,1,0,1,kCenterXY,width,0);
if lastAnim then
lastAnim:setDebugName("MatchToolbarView|hideMoreView|lastAnim");
lastAnim:setEvent(self, function ( ... )
self.m_moreView:removeProp(1);
self.m_moreView:removeProp(2);
self.m_moreView:setVisible(true);
end);
else
self.m_moreView:setVisible(true);
end
end
if self.m_shield then
self.m_shield:setVisible(true);
end
end
MatchToolbarView.onShieldClick = function (self, finger_action, x, y, drawing_id_first, drawing_id_current)
if finger_action == kFingerUp then
self:hideMoreView();
end
end
MatchToolbarView.onMenuBtnClick = function (self)
if self.m_moreView:getVisible() then
self:hideMoreView();
else
self:showMoreView();
end
end
MatchToolbarView.onExitBtnClick = function (self)
self:hideMoreView();
end
MatchToolbarView.onSettingBtnClick = function (self)
self:hideMoreView();
self:_showSettingWindow();
end
--弹出设置窗口
MatchToolbarView._showSettingWindow = function(self)
local action = GameMechineConfig.ACTION_NS_CREATVIEW;
local data = {viewName = GameMechineConfig.VIEW_SETTING}
MechineManage.getInstance():receiveAction(action,data);
local action = GameMechineConfig.ACTION_NS_OPEN_SETTING;
MechineManage.getInstance():receiveAction(action);
end
MatchToolbarView.s_controlConfig =
{
[MatchToolbarView.s_controls.shield] = {"shield"};
[MatchToolbarView.s_controls.menu_btn] = {"menu_view","menu_btn"};
[MatchToolbarView.s_controls.more_view] = {"menu_view","more_view"};
[MatchToolbarView.s_controls.exit_btn] = {"menu_view","more_view","exit_btn"};
[MatchToolbarView.s_controls.setting_btn] = {"menu_view","more_view","setting_btn"};
[MatchToolbarView.s_controls.menu_view] = {"menu_view"};
};
MatchToolbarView.s_controlFuncMap =
{
[MatchToolbarView.s_controls.shield] = MatchToolbarView.onShieldClick;
[MatchToolbarView.s_controls.menu_btn] = MatchToolbarView.onMenuBtnClick;
[MatchToolbarView.s_controls.exit_btn] = MatchToolbarView.onExitBtnClick;
[MatchToolbarView.s_controls.setting_btn] = MatchToolbarView.onSettingBtnClick;
};
return MatchToolbarView;
|
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
local widget = require 'widget'
local otherSoundEffect = require 'gameLogic.otherSoundEffect'
-- local forward references
local currentPage
local currentRank
local lastScore
local numberOfPages
local rankTable
local beginX, endX
local font = storyboard.state.font
local userRank, userFacebookID
local soundEffect
-------------------- HELPER FUNCTIONS -----------------------
-- check whether the user swipes left/right, and change the leaderboard score correspondingly
-- if user swipes right, it shows the next page of scores (vice versa)
local function flipPages()
local xDistance = math.abs(endX - beginX)
if xDistance > 50 then
if beginX > endX then
--swipe left, turn to previous page
if currentPage < numberOfPages then
soundEffect:play("swipe")
for i = 1, rankTable[currentPage].numChildren, 1 do
transition.to(rankTable[currentPage][i][1], {time=300, x = -450 - 20})
transition.to(rankTable[currentPage][i][2], {time=300, x = -450 - 80})
transition.to(rankTable[currentPage][i][3], {time=300, x = -450 - 250})
end
for i = 1, rankTable[currentPage+1].numChildren, 1 do
transition.to(rankTable[currentPage+1][i][1], {time=300, x=rankTable[currentPage+1][i][1].xPosition})
transition.to(rankTable[currentPage+1][i][2], {time=300, x=rankTable[currentPage+1][i][2].xPosition})
transition.to(rankTable[currentPage+1][i][3], {time=300, x=rankTable[currentPage+1][i][3].xPosition})
end
currentPage = currentPage + 1
end
else
-- swipe right, turn to next page
if currentPage > 1 then
soundEffect:play("swipe")
for i = 1, rankTable[currentPage].numChildren, 1 do
transition.to(rankTable[currentPage][i][1], {time=300, x = 450 + 20})
transition.to(rankTable[currentPage][i][2], {time=300, x = 450 + 80})
transition.to(rankTable[currentPage][i][3], {time=300, x = 450 + 250})
end
for i = 1, rankTable[currentPage-1].numChildren, 1 do
transition.to(rankTable[currentPage-1][i][1], {time=300, x = rankTable[currentPage-1][i][1].xPosition})
transition.to(rankTable[currentPage-1][i][2], {time=300, x = rankTable[currentPage-1][i][2].xPosition})
transition.to(rankTable[currentPage-1][i][3], {time=300, x = rankTable[currentPage-1][i][3].xPosition})
end
currentPage = currentPage - 1
end
end
end
end
-- swipe listener (TOUCH EVENT)
local function swipe(event)
if event.phase == "began" then
beginX = event.x
end
if event.phase == "ended" and beginX then
endX = event.x
if pcall(flipPages) then
-- do nothing
else
end
end
end
-- trims a long name into a less characters name.
-- For example, if a name "Sharon Amfbfihebidc Liangberg" => "Sharon A. L."
local function trimName(name)
-- split name into parts
local nameTable = {}
for i in string.gmatch(name, "%a+") do
table.insert(nameTable, i)
end
-- case if: user name has first_name, middle_name, and last_name
if #nameTable == 3 then
local first_name = nameTable[1]
local middle_name = nameTable[2]
local last_name = nameTable[3]
if string.len(first_name) > 13 then
first_name = first_name:sub(0, 13) .. "."
end
middle_name = middle_name:sub(0, 1) .. "."
last_name = last_name:sub(0,1) .. "."
return (first_name .. " " .. middle_name .. " " .. last_name)
-- case if: user has first_name, and last_name
elseif #nameTable == 2 then
local first_name = nameTable[1]
local last_name = nameTable[2]
if string.len(first_name) > 13 then
first_name = first_name:sub(0, 13) .. "."
end
last_name = last_name:sub(0,1) .. "."
return (first_name .. " " .. last_name)
-- case if: user has first_name only
elseif #nameTable == 1 then
local first_name = nameTable[1]
if string.len(first_name) > 13 then
first_name = first_name:sub(0, 13) .. "."
end
return (first_name)
end
end
-- show the header name of each columns(rank, name, score)
local function displayHeader()
local group = display.newGroup()
local rankText = display.newText("Rank#", 5, 13, font, 17)
group:insert(rankText)
local nameText = display.newText("Name", 80, 13, font, 17)
group:insert(nameText)
local scoreText = display.newText("Score", 240, 13, font, 17)
group:insert(scoreText)
return group
end
-- shows one user's leaderboard score in one row
local function displayFriendsScore(i, name, score, fbid)
local group = display.newGroup()
-- if user's rank
if score < lastScore then
lastScore = score
currentRank = currentRank + 1
end
rank = currentRank
if fbid == userFacebookID then
userRank = rank
end
-- rank text
local rankNumberText = display.newText(rank, 450, 28*i+47, font, 14)
rankNumberText.anchorX, rankNumberText.anchorY = 0, 0
rankNumberText.xPosition = 30
rankNumberText.yPosition = 28*i+47
group:insert(rankNumberText)
-- user's friends' name text
local playerName = trimName(name)
local nameText = display.newText(playerName, 450, 28*i+47, font, 14)
nameText.anchorX, nameText.anchorY = 0, 0
nameText.xPosition = 84
nameText.yPosition = 28*i+47
group:insert(nameText)
-- score text
local scoreText = display.newText(score, 450, 28*i+47, font, 14)
scoreText.anchorX, scoreText.anchorY = 0, 0
scoreText.xPosition = 265
scoreText.yPosition = 28*i+47
group:insert(scoreText)
return group
end
-- display 10 users's leaderboard score
local function displayTenFriendsScore(pageNum, data)
local group = display.newGroup()
local firstIndexPosition = (pageNum)*10 + 1
if firstIndexPosition <= #data then
local min = math.min(10, #data - (pageNum*10))
for i=1, min, 1 do
local index = i+(pageNum)*10
local name = data[index][1]
local score = data[index][3]
local facebookID = data[index][2]
local rankEntry = displayFriendsScore(i, name, score, facebookID)
group:insert(rankEntry)
end
end
return group
end
-- shows information at the bottom (just your score)
local function displayFooter()
local group = display.newGroup()
local yourScoreText = display.newText("Your Score", 230, 360, font, 18)
group:insert(yourScoreText)
return group
end
-- shows your score
local function displayUserScore(name, score, rank)
local group = display.newGroup()
local rankText = display.newText(rank, 29, 385, font, 18)
group:insert(rankText)
local username = trimName(name)
local nameText = display.newText(username, 84, 385, font, 18)
group:insert(nameText)
local scoreText = display.newText(score, 263, 385, font, 18)
scoreText.anchorX, scoreText.anchorY = .5, .5
group:insert(scoreText)
return group
end
-----------------------------------------------------------
-- Called when the scene's view does not exist:
function scene:createScene( event )
local group = self.view
soundEffect = otherSoundEffect.new()
local background = display.newImageRect("images/leaderboardMenu.png", display.contentWidth, display.contentHeight)
background.anchorX, background.anchorY = .5, .5
background.x = display.contentCenterX
background.y = display.contentCenterY
group:insert(background)
userFacebookID = event.params.myScoreInformation[1][2]
--userFacebookID = "100006269852943"
currentPage = 1
currentRank = 1
--lastScore = 0
local data = event.params.friendsInformation
lastScore = data[1][3]
--[[
local data = {
{"Sharon Amfbfihebidc Liangberg", "100006269852943", 38}, --1
{"James Amfbffhecjaa Warmanstein", "100006266853011", 30},
{"Maria Amfbgehebgbb Wongberg", "100006275852722", 28},
{"Donna Amfbfdegcjha Chengwitzsenescumansteinbergsonsky", "100006264573081", 20},
{"Mary Amfbgceabffe Moiduwitz", "100006273512665", 19},
{"Mike Amfbegaabedb Rosenthalstein", "100006257112542", 13},
{"Richard Amfbfbbaaicf Warmanman", "100006262211936", 8},
{"Dorothy Amfbfajdbjdd Letuchyson", "100006261042044", 0},
{"Richard Amfbfbbaaicf Warmanman", "100006262211936", 8},
{"Dorothy Amfbfajdbjdd Letuchyson", "100006261042044", 0}, -- 10
{"Richard Amfbfbbaaicf Warmanman", "100006262211936", 8}, -- 11
{"Dorothy Amfbfajdbjdd Letuchyson", "100006261042044", 0},
{"Sharon Amfbfihebidc Liangberg", "100006269852943", 38},
{"James Amfbffhecjaa Warmanstein", "100006266853011", 30},
{"Maria Amfbgehebgbb Wongberg", "100006275852722", 28},
{"Donna Amfbfdegcjha Chengwitzsenescumansteinbergsonsky", "100006264573081", 20},
{"Mary Amfbgceabffe Moiduwitz", "100006273512665", 19},
{"Mike Amfbegaabedb Rosenthalstein", "100006257112542", 13},
{"Richard Amfbfbbaaicf Warmanman", "100006262211936", 8},
{"Dorothy Amfbfajdbjdd Letuchyson", "100006261042044", 0}, -- 20
{"Richard Amfbfbbaaicf Warmanman", "100006262211936", 8},
{"Dorothy Amfbfajdbjdd Letuchyson", "100006261042044", 0},
{"Dorothy Amfbfajdbjdd Letuchyson", "100006261042044", 0},
{"Dorothy Amfbfajdbjdd Letuchyson", "100006261042044", 0},
}
--]]
numberOfPages = math.floor(#data/10)
if #data%10 ~= 0 then
numberOfPages = numberOfPages + 1
end
--local header = displayHeader()
--group:insert(header)
rankTable = display.newGroup()
for i = 0, numberOfPages, 1 do
local rankPage = displayTenFriendsScore(i, data)
rankTable:insert(rankPage)
end
for i = 1, rankTable[1].numChildren, 1 do
rankTable[1][i][1].x = rankTable[1][i][1].xPosition
rankTable[1][i][2].x = rankTable[1][i][2].xPosition
rankTable[1][i][3].x = rankTable[1][i][3].xPosition
end
group:insert(rankTable)
local myInformation = event.params.myScoreInformation
local myScore = myInformation[1][3]
local myName = myInformation[1][1]
local footer = displayFooter()
group:insert(footer)
--local userScore = displayUserScore(data[1][1], data[1][3], userRank)
--group:insert(userScore)
local userScore = displayUserScore(myName, myScore, userRank)
group:insert(userScore)
local function backButtonListener(event)
if event.phase == "ended" then
soundEffect:play("back")
storyboard.gotoScene("home-scene", "fade", 800)
end
end
local backButton = widget.newButton{
defaultFile = "images/buttons/buttonBack.png",
overFile = "images/buttons/buttonBackonclick.png",
onEvent = backButtonListener
}
backButton.x = display.contentCenterX
backButton.y = 447
group:insert(backButton)
end
-- Called BEFORE scene has moved onscreen:
function scene:willEnterScene( event )
local group = self.view
end
-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
Runtime:addEventListener("touch", swipe)
local BGM = require 'gameLogic.backgroundMusic'
BGM.play("main")
end
-- Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view
Runtime:removeEventListener("touch", swipe)
end
-- Called AFTER scene has finished moving offscreen:
function scene:didExitScene( event )
local group = self.view
soundEffect:dispose()
soundEffect = nil
end
-- Called prior to the removal of scene's "view" (display group)
function scene:destroyScene( event )
local group = self.view
currentPage = nil
currentRank = nil
lastScore = nil
numberOfPages = nil
userRank = nil
userFacebookID = nil
rankTable:removeSelf()
rankTable = nil
beginX = nil
endX = nil
group:removeSelf()
group = nil
end
-- Called if/when overlay scene is displayed via storyboard.showOverlay()
function scene:overlayBegan( event )
local group = self.view
local overlay_name = event.sceneName -- name of the overlay scene
end
-- Called if/when overlay scene is hidden/removed via storyboard.hideOverlay()
function scene:overlayEnded( event )
local group = self.view
local overlay_name = event.sceneName -- name of the overlay scene
end
---------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
---------------------------------------------------------------------------------
-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )
-- "willEnterScene" event is dispatched before scene transition begins
scene:addEventListener( "willEnterScene", scene )
-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )
-- "exitScene" event is dispatched before next scene's transition begins
scene:addEventListener( "exitScene", scene )
-- "didExitScene" event is dispatched after scene has finished transitioning out
scene:addEventListener( "didExitScene", scene )
-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )
-- "overlayBegan" event is dispatched when an overlay scene is shown
scene:addEventListener( "overlayBegan", scene )
-- "overlayEnded" event is dispatched when an overlay scene is hidden/removed
scene:addEventListener( "overlayEnded", scene )
---------------------------------------------------------------------------------
return scene |
object_tangible_food_generic_shared_drink_aludium_pu36 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/food/generic/shared_drink_aludium_pu36.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_food_generic_shared_drink_aludium_pu36, "object/tangible/food/generic/shared_drink_aludium_pu36.iff")
|
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013 Fabien Fleutot and others.
--
-- All rights reserved.
--
-- This program and the accompanying materials are made available
-- under the terms of the Eclipse Public License v1.0 which
-- accompanies this distribution, and is available at
-- http://www.eclipse.org/legal/epl-v10.html
--
-- This program and the accompanying materials are also made available
-- under the terms of the MIT public license which accompanies this
-- distribution, and is available at http://www.lua.org/license.html
--
-- Contributors:
-- Fabien Fleutot - API and implementation
--
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--
-- Summary: metalua parser, statement/block parser. This is part of the
-- definition of module [mlp].
--
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--
-- Exports API:
-- * [mlp.stat()]
-- * [mlp.block()]
-- * [mlp.for_header()]
--
-------------------------------------------------------------------------------
local lexer = require 'lua.grammar.lexer'
local gg = require 'lua.grammar.generator'
local annot = require 'lua.compiler.parser.annot.generator'
--------------------------------------------------------------------------------
-- List of all keywords that indicate the end of a statement block. Users are
-- likely to extend this list when designing extensions.
--------------------------------------------------------------------------------
return function(M)
local _M = gg.future(M)
M.block_terminators = { "else", "elseif", "end", "until", ")", "}", "]" }
-- FIXME: this must be handled from within GG!!!
-- FIXME: there's no :add method in the list anyway. Added by gg.list?!
function M.block_terminators :add(x)
if type (x) == "table" then for _, y in ipairs(x) do self :add (y) end
else table.insert (self, x) end
end
----------------------------------------------------------------------------
-- list of statements, possibly followed by semicolons
----------------------------------------------------------------------------
M.block = gg.list {
name = "statements block",
terminators = M.block_terminators,
primary = function (lx)
-- FIXME use gg.optkeyword()
local x = M.stat (lx)
if lx:is_keyword (lx:peek(), ";") then lx:next() end
return x
end }
----------------------------------------------------------------------------
-- Helper function for "return <expr_list>" parsing.
-- Called when parsing return statements.
-- The specific test for initial ";" is because it's not a block terminator,
-- so without it gg.list would choke on "return ;" statements.
-- We don't make a modified copy of block_terminators because this list
-- is sometimes modified at runtime, and the return parser would get out of
-- sync if it was relying on a copy.
----------------------------------------------------------------------------
local return_expr_list_parser = gg.multisequence{
{ ";" , builder = function() return { } end },
default = gg.list {
_M.expr, separators = ",", terminators = M.block_terminators } }
local for_vars_list = gg.list{
name = "for variables list",
primary = _M.id,
separators = ",",
terminators = "in" }
----------------------------------------------------------------------------
-- for header, between [for] and [do] (exclusive).
-- Return the `Forxxx{...} AST, without the body element (the last one).
----------------------------------------------------------------------------
function M.for_header (lx)
local vars = M.id_list(lx)
if lx :is_keyword (lx:peek(), "=") then
if #vars ~= 1 then
gg.parse_error (lx, "numeric for only accepts one variable")
end
lx:next() -- skip "="
local exprs = M.expr_list (lx)
if #exprs < 2 or #exprs > 3 then
gg.parse_error (lx, "numeric for requires 2 or 3 boundaries")
end
return { tag="Fornum", vars[1], unpack (exprs) }
else
if not lx :is_keyword (lx :next(), "in") then
gg.parse_error (lx, '"=" or "in" expected in for loop')
end
local exprs = M.expr_list (lx)
return { tag="Forin", vars, exprs }
end
end
----------------------------------------------------------------------------
-- Function def parser helper: id ( . id ) *
----------------------------------------------------------------------------
local function fn_builder (list)
local acc = list[1]
local first = acc.lineinfo.first
for i = 2, #list do
local index = M.id2string(list[i])
local li = lexer.new_lineinfo(first, index.lineinfo.last)
acc = { tag="Index", acc, index, lineinfo=li }
end
return acc
end
local func_name = gg.list{ _M.id, separators = ".", builder = fn_builder }
----------------------------------------------------------------------------
-- Function def parser helper: ( : id )?
----------------------------------------------------------------------------
local method_name = gg.onkeyword{ name = "method invocation", ":", _M.id,
transformers = { function(x) return x and x.tag=='Id' and M.id2string(x) end } }
----------------------------------------------------------------------------
-- Function def builder
----------------------------------------------------------------------------
local function funcdef_builder(x)
local name, method, func = unpack(x)
if method then
name = { tag="Index", name, method,
lineinfo = {
first = name.lineinfo.first,
last = method.lineinfo.last } }
table.insert (func[1], 1, {tag="Id", "self"})
end
local r = { tag="Set", {name}, {func} }
r[1].lineinfo = name.lineinfo
r[2].lineinfo = func.lineinfo
return r
end
----------------------------------------------------------------------------
-- if statement builder
----------------------------------------------------------------------------
local function if_builder (x)
local cond_block_pairs, else_block, r = x[1], x[2], {tag="If"}
local n_pairs = #cond_block_pairs
for i = 1, n_pairs do
local cond, block = unpack(cond_block_pairs[i])
r[2*i-1], r[2*i] = cond, block
end
if else_block then table.insert(r, #r+1, else_block) end
return r
end
--------------------------------------------------------------------------------
-- produce a list of (expr,block) pairs
--------------------------------------------------------------------------------
local elseifs_parser = gg.list {
gg.sequence { _M.expr, "then", _M.block , name='elseif parser' },
separators = "elseif",
terminators = { "else", "end" }
}
local annot_expr = gg.sequence {
_M.expr,
gg.onkeyword{ "#", gg.future(M, 'annot').tf },
builder = function(x)
local e, a = unpack(x)
if a then return { tag='Annot', e, a }
else return e end
end }
local annot_expr_list = gg.list {
primary = annot.opt(M, _M.expr, 'tf'), separators = ',' }
------------------------------------------------------------------------
-- assignments and calls: statements that don't start with a keyword
------------------------------------------------------------------------
local function assign_or_call_stat_parser (lx)
local e = annot_expr_list (lx)
local a = lx:is_keyword(lx:peek())
local op = a and M.assignments[a]
-- TODO: refactor annotations
if op then
--FIXME: check that [e] is a LHS
lx :next()
local annots
e, annots = annot.split(e)
local v = M.expr_list (lx)
if type(op)=="string" then return { tag=op, e, v, annots }
else return op (e, v) end
else
assert (#e > 0)
if #e > 1 then
gg.parse_error (lx,
"comma is not a valid statement separator; statement can be "..
"separated by semicolons, or not separated at all")
elseif e[1].tag ~= "Call" and e[1].tag ~= "Invoke" then
local typename
if e[1].tag == 'Id' then
typename = '("'..e[1][1]..'") is an identifier'
elseif e[1].tag == 'Op' then
typename = "is an arithmetic operation"
else typename = "is of type '"..(e[1].tag or "<list>").."'" end
gg.parse_error (lx,
"This expression %s; "..
"a statement was expected, and only function and method call "..
"expressions can be used as statements", typename);
end
return e[1]
end
end
M.local_stat_parser = gg.multisequence{
-- local function <name> <func_val>
{ "function", _M.id, _M.func_val, builder =
function(x)
local vars = { x[1], lineinfo = x[1].lineinfo }
local vals = { x[2], lineinfo = x[2].lineinfo }
return { tag="Localrec", vars, vals }
end },
-- local <id_list> ( = <expr_list> )?
default = gg.sequence{
gg.list{
primary = annot.opt(M, _M.id, 'tf'),
separators = ',' },
gg.onkeyword{ "=", _M.expr_list },
builder = function(x)
local annotated_left, right = unpack(x)
local left, annotations = annot.split(annotated_left)
return {tag="Local", left, right or { }, annotations }
end } }
------------------------------------------------------------------------
-- statement
------------------------------------------------------------------------
M.stat = gg.multisequence {
name = "statement",
{ "do", _M.block, "end", builder =
function (x) return { tag="Do", unpack (x[1]) } end },
{ "for", _M.for_header, "do", _M.block, "end", builder =
function (x) x[1][#x[1]+1] = x[2]; return x[1] end },
{ "function", func_name, method_name, _M.func_val, builder=funcdef_builder },
{ "while", _M.expr, "do", _M.block, "end", builder = "While" },
{ "repeat", _M.block, "until", _M.expr, builder = "Repeat" },
{ "local", _M.local_stat_parser, builder = unpack },
{ "return", return_expr_list_parser, builder =
function(x) x[1].tag='Return'; return x[1] end },
{ "break", builder = function() return { tag="Break" } end },
{ "-{", gg.future(M, 'meta').splice_content, "}", builder = unpack },
{ "if", gg.nonempty(elseifs_parser), gg.onkeyword{ "else", M.block }, "end",
builder = if_builder },
default = assign_or_call_stat_parser }
M.assignments = {
["="] = "Set"
}
function M.assignments:add(k, v) self[k] = v end
return M
end |
-- Copyright (c) 2017-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the license found in the LICENSE file in
-- the root directory of this source tree. An additional grant of patent rights
-- can be found in the PATENTS file in the same directory.
--
--[[
--
-- Common search functions used for sentence generation. A search function is
-- expected to return a table containing the following functions, all operating
-- on mini-batches:
-- - `init(bsz, source)` will be called prior to generation
-- - `prune(step, ldist)` is called at every generation step with the model
-- output, which are scores for all words in the dictionary after
-- LogSoftMax. This function
-- is expected to return a table with the following entries:
-- - `nextIn`: model input for the next generation step (dictionary
-- indices).
-- - `nextHid`: index for hidden state propagation
-- - `eos`: boolean flag indicating if generation should be stopped.
-- Except for `eos`, these are all tensors of size (bsz * beam).
-- - `results()`: returns three items: a (bsz * beam) table of hypotheses, each
-- being a tensor with word indices, a (bsz * beam) tensor with
-- corresponding scores (e.g. average log-probabilities), and a
-- (bsz * beam) table of attention scores, each being a 2D tensor
-- with (targetlength X sourcelength) entries.
--
-- The methods above will be called from a model's generate() function.
--
--]]
local visdom = require 'visdom'
local argcheck = require 'argcheck'
local plstringx = require 'pl.stringx'
local tds = require 'tds'
local mutils = require 'fairseq.models.utils'
local clib = require 'fairseq.clib'
local search = {}
function search.greedy(ttype, dict, maxlen)
-- Greedy search: at each step, select the symbol with the highest
-- log-probabilities.
local logprobs = torch.Tensor():type(ttype)
local lengths = torch.Tensor():type(ttype)
local notEos = torch.Tensor():type(ttype)
local nextHid = torch.LongTensor()
local outs = torch.Tensor():type(ttype)
local ascores = {}
local sourcelen = nil
local f = {}
f.init = function(bsz, sample)
logprobs:resize(bsz):fill(0)
lengths:resize(bsz):fill(0)
notEos:resize(bsz):fill(1)
outs:resize(maxlen + 1, bsz)
ascores = {}
sourcelen = sample.source:size(1)
-- Propagation of hidden states is fixed since there's only one active
-- hypothesis per sentence.
nextHid:resize(bsz):copy(torch.range(1, bsz))
end
local maxScores = torch.Tensor():type(ttype)
local maxIndices, isEos
if not ttype:match('torch.Cuda.*') then
maxIndices = torch.LongTensor()
isEos = torch.ByteTensor()
else
maxIndices = torch.CudaLongTensor()
isEos = torch.CudaByteTensor()
end
f.prune = function(step, ldist, attnscores)
maxScores, maxIndices = torch.topk(maxScores, maxIndices, ldist, 1, 2,
true)
local maxScoresV = maxScores:view(-1)
local maxIndicesV = maxIndices:view(-1)
logprobs:add(torch.cmul(notEos, maxScoresV))
lengths:add(notEos)
isEos = maxIndicesV.eq(isEos, maxIndicesV, dict:getEosIndex())
notEos:maskedFill(isEos, 0)
outs:narrow(1, step, 1):copy(maxIndices)
local as = torch.FloatTensor(attnscores:size()):copy(attnscores)
table.insert(ascores, as)
return {
nextIn = maxIndices,
nextHid = nextHid,
eos = notEos:sum() < 1,
}
end
f.results = function()
local bsz = logprobs:nElement()
local hypotheses = {}
local attentions = {}
for i = 1, bsz do
hypotheses[i] = torch.LongTensor(lengths[i])
hypotheses[i]:copy(outs:sub(1, lengths[i], i, i))
attentions[i] = torch.FloatTensor(lengths[i], sourcelen)
for j = 1, lengths[i] do
attentions[i]:narrow(1, j, 1):copy(ascores[j]:narrow(1, i, 1))
end
end
return hypotheses, torch.cdiv(logprobs, lengths), attentions
end
return f
end
search.beam = argcheck{
{name='ttype', type='string'},
{name='dict', type='Dictionary'},
{name='srcdict', type='Dictionary'},
{name='beam', type='number'},
{name='lenPenalty', type='number', default=1.0},
{name='unkPenalty', type='number', default=0},
{name='subwordPenalty', type='number', default=0},
{name='coveragePenalty', type='number', default=0},
{name='vocab', type='tds.Hash', opt=true},
{name='subwordContSuffix', type='string', default='|'},
call = function(ttype, dict, srcdict, beam, lenPenalty,
unkPenalty, subwordPenalty, coveragePenalty, vocab, subwordContSuffix)
-- Beam search: Keep track of `beam` hypotheses per sentence, move
-- finished hypothesis (EOS symol) out of the beam (`finalized` table)
-- and stop once there are `beam` finished hypotheses per sentence.
local hidOffsets = nil
local hscores = torch.Tensor():type(ttype)
local ones = torch.Tensor(dict:size()):type(ttype):fill(1)
local notEos = 0
-- Previous outputs and attention distributions
local outs = {}
local ascores = {}
-- Backpointers
local backp = {}
local finalized = {}
local sourcelen = nil
local f = {}
local swcLen = subwordContSuffix:len()
-- The penalty tensor is added to the log-probs produced by the model.
local penalties = torch.Tensor(dict:size()):type(ttype):fill(0)
penalties[dict:getEosIndex()] = 0
penalties[dict:getUnkIndex()] = -unkPenalty
for i = 1, dict:size() do
if dict:getSymbol(i):sub(-swcLen) == subwordContSuffix then
penalties[i] = -subwordPenalty
end
end
local bpenalties = nil
local srcVocab = {}
f.init = function(bsz, sample)
hscores:resize(bsz * beam):fill(0)
-- e.g. for beam = 4: 111155559999...
hidOffsets = torch.range(0, (bsz * beam) - 1)
:long():div(beam):mul(beam) + 1
outs, ascores = {}, {}
backp, finalized = {}, {}, {}
for i = 1, bsz do finalized[i] = {} end
notEos = bsz
sourcelen = sample.source:size(1)
bpenalties = torch.expand(penalties:view(1, -1), bsz * beam,
dict:size())
if vocab then
-- Add source sentence words to the vocabulary
local sourceT = sample.source:t()
for i = 1, sourceT:size(1) do
srcVocab[i] = tds.Hash()
-- narrow() is used to skip the end-of-sentence token.
local str = srcdict:getString(
sourceT[i]:narrow(1, 1, sourceT[i]:size(1) - 1)
)
-- TODO(jgehring) Implement a dictionary for sub-words that
-- takes care of proper string assembly.
str = str:gsub(subwordContSuffix .. ' ', '')
for _, w in ipairs(plstringx.split(str)) do
-- Add this word and all all prefixes
for j = 1, w:len() do
srcVocab[i][w:sub(1, j)] = 1
end
end
end
end
end
local function backtraceWord(step, bp, cur)
local w = dict:getSymbol(cur)
if w:sub(-swcLen) == subwordContSuffix then
w = w:sub(1, -swcLen - 1)
end
for l = step - 1, 1, -1 do
local prev = dict:getSymbol(outs[l][bp])
if prev:sub(-swcLen) ~= subwordContSuffix then
break
end
w = prev:sub(1, -swcLen - 1) .. w
bp = backp[l][bp]
end
return w
end
local function coverageP(attn)
-- Coverage penalty according to https://arxiv.org/abs/1609.08144
-- attn is a hypo X source tensor.
return attn:sum(1):clamp(0, 1):log():sum()
end
local function selectHypos(step, bsz, scores, indices, ds)
local selScores = torch.FloatTensor(bsz, beam)
local selIndices = torch.LongTensor(bsz, beam)
local eos = dict:getEosIndex()
for i = 1, bsz do
local scoresI, indicesI = scores[i], indices[i]
local selScoresI, selIndicesI = selScores[i], selIndices[i]
local maxk = scoresI:size(1)
local j, k = 1, 1
while j <= beam and k <= maxk do
if indicesI[k] % ds + 1 ~= eos then
-- Not eos: select for next round if word is in vocab
if vocab then
local bp = math.floor(indicesI[k] / ds) + 1 + ((i-1) * beam)
local bidx = math.floor(i / beam) + 1
local word = backtraceWord(step, bp, (indicesI[k] % ds) + 1)
if vocab[word] or srcVocab[bidx][word] then
selScoresI[j], selIndicesI[j] = scoresI[k], indicesI[k]
j = j + 1
end
else
selScoresI[j], selIndicesI[j] = scoresI[k], indicesI[k]
j = j + 1
end
elseif #finalized[i] < beam then
-- Eos: backtrace and store in finalized
local bp = math.floor(indicesI[k] / ds) + 1 + ((i-1) * beam)
-- scores contains the sum of logprobs for all words in the
-- hypothesis.
local score = scoresI[k] / math.pow(step, lenPenalty)
local hypo = torch.LongTensor(step)
local attn = torch.FloatTensor(step, sourcelen)
hypo[step] = eos
attn:narrow(1, step, 1):copy(
ascores[step]:narrow(1, (i-1) * beam + j, 1)
)
for l = step - 1, 1, -1 do
hypo[l] = outs[l][bp]
attn:narrow(1, l, 1):copy(ascores[l]:narrow(1, bp, 1))
bp = backp[l][bp]
end
score = score + coveragePenalty * coverageP(attn)
table.insert(finalized[i], {
hypo = hypo,
score = score,
attn = attn,
})
if #finalized[i] == beam then
-- The list of finalized hypotheses for this sentence is
-- full, so consider this sentence as done. It will
-- still be part of future mini-batches, though.
notEos = notEos - 1
end
end
k = k + 1
end
-- Not enough non-finalized hypotheses to fill the search beam
-- or there's a sufficient number of finalized hypotheses already:
-- simply clone the worst candidate hypothesis (hack).
while j <= beam do
selScoresI[j], selIndicesI[j] = scoresI[k-1], indicesI[k-1]
j = j + 1
end
end
return selScores, selIndices
end
local topScores = torch.Tensor():type(ttype)
local topIndices
if not ttype:match('torch.Cuda.*') then
topIndices = torch.LongTensor()
else
topIndices = torch.CudaLongTensor()
end
local scoresBuf = torch.Tensor():type(ttype)
f.prune = function(step, ldist, attnscores)
local as = torch.FloatTensor(attnscores:size()):copy(attnscores)
table.insert(ascores, as)
local vocabsize = ldist:size(2)
local ldistp = ldist:add(bpenalties:narrow(2, 1, vocabsize)):t()
-- Add log-probs of hypotheses at the previous time-step so ldistp will
-- represent the total log-probability for each new hypothesis.
ldistp:addr(1, ones:narrow(1, 1, vocabsize), hscores)
ldistp = ldistp:t()
local bsz = ldistp:size(1) / beam
-- Select candidate hypotheses.
-- The model produces a (bsz * beam X vocabsize) tensor, but for
-- pruning we'll work with a (bsz X beam * vocabsize) tensor. This
-- makes it possible to use a single topk() call. Whenever we work
-- with the top indices later, it's important to remember that they
-- refer to a beam * vocabsize slice, i.e. the actual symbol
-- index is (index-1 % vocabsize) + 1, while the candidate in the
-- beam the new hypothesis was produced from is floor(index /
-- vocabsize + 1.
local bdist
if step == 1 then
-- For the first step, all hypotheses are equal (they start from the
-- same token) so we simply select candidates from the first one in
-- the beam.
bdist = ldistp:unfold(1, 1, beam):squeeze(3)
else
bdist = ldistp:view(bsz, ldistp:size(2) * beam)
end
topScores, topIndices = clib.topk(
topScores, topIndices, bdist, beam * 2)
topIndices:add(-1)
local selScores, selIndices = selectHypos(step, bsz,
topScores:float(), topIndices:float(), vocabsize)
-- Determine actual dictionary indices and hidden state propagation
-- indices.
local selIndices1 = selIndices:view(-1)
local nextIn = torch.remainder(selIndices1, vocabsize) + 1
local nextHid = torch.div(selIndices1, vocabsize)
nextHid = nextHid + hidOffsets
hscores = mutils.sendtobuf(selScores:view(-1), scoresBuf)
table.insert(outs, nextIn)
table.insert(backp, nextHid)
return {
nextIn = nextIn,
nextHid = nextHid,
eos = notEos <= 0,
}
end
f.results = function()
local hypos = {}
local scores = {}
local attns = {}
for i, v in ipairs(finalized) do
assert(#v == beam, string.format(
"beam search didn't return enough hypotheses: %d", #v)
)
table.sort(v, function(a, b) return a.score > b.score end)
for j = 1, beam do
table.insert(hypos, v[j].hypo)
table.insert(scores, v[j].score)
table.insert(attns, v[j].attn)
end
end
return hypos, torch.FloatTensor(scores), attns
end
return f
end}
search.visualize = argcheck{
{name='sf', type='table'},
{name='dict', type='Dictionary'},
{name='sourceDict', type='Dictionary'},
{name='host', type='string'},
{name='port', type='number'},
call = function(sf, dict, sourceDict, host, port)
-- Wrapper for search functions that visualizes attention scores using
-- visdom.
local plot = visdom{server = 'http://' .. host, port = port}
plot.ipv6 = false
local batchsize, source, remapFn = nil, nil, nil
local f = {}
f.init = function(bsz, sample)
batchsize = bsz
source = sample.source:t()
if sample.targetVocab then
remapFn = function(idx) return sample.targetVocab[idx] end
else
remapFn = nil
end
return sf.init(bsz, sample)
end
f.prune = sf.prune
f.results = function()
local res = table.pack(sf.results())
-- Plot attention scores for best hypothesis
local attn = res[3]
local beam = #res[1] / batchsize
for i = 1, batchsize do
local idx = (i - 1) * beam + 1
-- Categorical labels are supposed to be unique, so each word will
-- be prefixed with its index
local ssrc = plstringx.split(sourceDict:getString(source[idx]))
for j = 1, #ssrc do
ssrc[j] = string.format('[%d] %s', j, ssrc[j])
end
local rest
if remapFn then
rest = res[1][idx]:clone():apply(remapFn)
else
rest = res[i][idx]
end
local shyp = plstringx.split(dict:getString(rest))
for j = 1, #shyp do
shyp[j] = string.format('[%d] %s', j, shyp[j])
end
plot:heatmap{
X = attn[idx]:t(),
options = {
columnnames = shyp,
rownames = ssrc,
},
}
end
return table.unpack(res)
end
return f
end}
return search
|
--Start of Global Scope---------------------------------------------------------
-- This is an area sensor so we select false here.
local lineScanSensor = false
-- Create a background model.
local meanThreshold = 0.0
local varianceThreshold = 10.0
local minDefectArea = 20
local backgroundModel = Image.BackgroundModel.createGaussian(lineScanSensor)
-- Create an edge matcher object. Used to center the object in all images.
local edgeMatcher = Image.Matching.EdgeMatcher.create()
edgeMatcher:setRotationRange(0.2)
local teachRegion = Image.PixelRegion.createRectangle(0, 0, 400, 400);
local edgeMatcherTeached = false
local objectRegionTeach
local teachPose
-- Create a viewer.
local viewer = View.create("viewer2D1")
local prDecoObj = View.PixelRegionDecoration.create()
prDecoObj:setColor(0,255,0, 70)
local prDecoDefect = View.PixelRegionDecoration.create()
prDecoDefect:setColor(255,0,0, 70)
local tDecoTeach = View.TextDecoration.create()
tDecoTeach:setPosition(80, 40)
tDecoTeach:setSize(20)
local tDecoOK = View.TextDecoration.create()
tDecoOK:setPosition(180, 50)
tDecoOK:setColor(0,255,0)
tDecoOK:setSize(30)
local tDecoFail = View.TextDecoration.create()
tDecoFail:setPosition(180, 50)
tDecoFail:setColor(255,0,0)
tDecoFail:setSize(30)
--End of Global Scope-----------------------------------------------------------
--Start of Function and Event Scope---------------------------------------------
-- Teach the background model on specified images.
local function teachBackGroundModel(image)
-- Teach the edge matcher on the first image. This is performed to obtain the background model ROI.
if edgeMatcherTeached == false then
-- Set min downsample factor
minDsf,_ = matcher:getDownsampleFactorLimits(image)
edgeMatcher:setDownsampleFactor(minDsf)
teachPose = edgeMatcher:teach(image, teachRegion)
local edges = edgeMatcher:getModelPoints()
local edgesPr = Image.PixelRegion.createFromPoints(edges:transform(teachPose), image)
objectRegionTeach = Image.PixelRegion.getConvexHull(edgesPr)
if teachPose ~= nil then
edgeMatcherTeached = true
backgroundModel:setRegionOfInterest(objectRegionTeach)
end
end
-- Update background model with this new observation
if edgeMatcherTeached then
-- Set min downsample factor
minDsf,_ = matcher:getDownsampleFactorLimits(image)
edgeMatcher:setDownsampleFactor(minDsf)
local poseTransform = edgeMatcher:match(image)
-- Transform image to teach position
local T = Transform.compose(Transform.invert(poseTransform[1]), teachPose)
local imAtTeach = Image.transform(image, T, "LINEAR")
viewer:clear()
local imid = viewer:addImage(imAtTeach)
viewer:addPixelRegion(objectRegionTeach, prDecoObj, nil, imid)
viewer:addText("Creating model of object", tDecoTeach, nil, imid)
viewer:present()
-- Update the background model
backgroundModel:add(imAtTeach, objectRegionTeach)
end
end
-- Compare image with the created background model
local function compareBackGroundModel(image)
local poseTransform = edgeMatcher:match(image)
-- Transform image to teach position
local T = Transform.compose(Transform.invert(poseTransform[1]), teachPose)
local imAtTeach = Image.transform(image, T, "LINEAR")
-- Use model to get parts of the image that don't belong
local fg = backgroundModel:compare(imAtTeach, "ALL", meanThreshold, varianceThreshold)
-- Transform foreground to live image
local TtoLive = Transform.compose(Transform.invert(teachPose), poseTransform[1])
local fgLive = Image.PixelRegion.transform(fg, TtoLive, image)
-- Filter away small regions
local defectRegions = Image.PixelRegion.findConnected(fgLive, minDefectArea)
-- Display a visualization of the model
viewer:clear()
local imid = viewer:addImage(image)
viewer:addPixelRegion(defectRegions, prDecoDefect, nil, imid)
if #defectRegions == 0 then
viewer:addText("OK!", tDecoOK, nil, imid)
else
viewer:addText("Fail!", tDecoFail, nil, imid)
end
viewer:present()
end
local function main()
-- Teach object apperance
print("\nCreating object appearance model")
for k = 1,5 do
local im = Image.load('resources/ok/' .. tostring(k-1) .. '.png')
teachBackGroundModel(im)
Script.sleep(500)
end
print("\nModel created")
Script.sleep(1000)
-- Visualize model
-- Get the model content
local modelImages = backgroundModel:getModelImages()
local modelIms = Image.concatenate(modelImages[1], modelImages[2])
viewer:clear()
local imid = viewer:addImage(modelIms)
tDecoTeach:setPosition(250, 30)
viewer:addText("Created object appearance model", tDecoTeach, nil, imid)
tDecoTeach:setPosition(150, 60)
viewer:addText("Mean:", tDecoTeach, nil, imid)
tDecoTeach:setPosition(570, 60)
viewer:addText("Variance:", tDecoTeach, nil, imid)
viewer:present()
Script.sleep(3000)
-- Detect objects with defects
print("\nRun detection")
for k = 1,7 do
local im = Image.load('resources/mix/' .. tostring(k-1) .. '.png')
compareBackGroundModel(im)
Script.sleep(1500)
end
print("\nApp finished.")
end
--The following registration is part of the global scope which runs once after startup
--Registration of the 'main' function to the 'Engine.OnStarted' event
Script.register("Engine.OnStarted", main)
--End of Function and Event Scope--------------------------------------------------
|
object_draft_schematic_chemistry_component_stimpack_load_charger = object_draft_schematic_chemistry_component_shared_stimpack_load_charger:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_chemistry_component_stimpack_load_charger, "object/draft_schematic/chemistry/component/stimpack_load_charger.iff")
|
----------------------------------------------------------------------------------------------------
--
-- All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-- its licensors.
--
-- For complete copyright and license terms please see the LICENSE at the root of this
-- distribution (the "License"). All use of this software is governed by the License,
-- or, if provided, by the license below or the license accompanying this file. Do not
-- remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--
--
----------------------------------------------------------------------------------------------------
local ShrinkToFitDropdown =
{
Properties =
{
TextContent = {default = EntityId()},
NoneOption = {default = EntityId()},
UniformOption = {default = EntityId()},
WidthOnlyOption = {default = EntityId()},
},
}
function ShrinkToFitDropdown:OnActivate()
self.radioButtonGroupBusHandler = UiRadioButtonGroupNotificationBus.Connect(self, self.entityId);
end
function ShrinkToFitDropdown:OnRadioButtonGroupStateChange(checkedRadioButton)
if (checkedRadioButton == self.Properties.NoneOption) then
UiTextBus.Event.SetShrinkToFit(self.Properties.TextContent, eUiTextShrinkToFit_None)
elseif (checkedRadioButton == self.Properties.UniformOption) then
UiTextBus.Event.SetShrinkToFit(self.Properties.TextContent, eUiTextShrinkToFit_Uniform)
elseif (checkedRadioButton == self.Properties.WidthOnlyOption) then
UiTextBus.Event.SetShrinkToFit(self.Properties.TextContent, eUiTextShrinkToFit_WidthOnly)
end
end
function ShrinkToFitDropdown:OnDeactivate()
self.radioButtonGroupBusHandler:Disconnect()
end
return ShrinkToFitDropdown
|
local SurveyPage = class('SurveyPage', Widget)
function SurveyPage:initialize(x,y,w,h)
Widget.initialize(self,x,y,w,h)
end
return SurveyPage
|
-- Item data (c) Grinding Gear Games
return {
-- Weapon: Wand
[[
托沃卧【仿品】
狂风法杖
等级需求: 65, 212 Int
联盟: 夺宝奇兵
固定基底词缀: 1
法术伤害提高 (35-39)%
施法速度提高 (15-25)%
暴击球达到最大数量时,失去所有的暴击球
暴击球达到最大数量时,获得 1 个狂怒球
每个狂怒球可使冰霜伤害提高 (15-20)%
你击中冻结的敌人时,有 50% 几率获得一个暴击球
暴击球抵达上限时承受 500 冰霜伤害
]],
[[
峡湾之星【仿品】
贤者法杖
等级需求: 30, 119 Int
联盟: 夺宝奇兵
固定基底词缀: 1
法术伤害提高 (17-21)%
攻击速度提高 (5-10)%
该装备的攻击暴击率提高 (20-40)%
攻击可以额外发射 1 个投射物
]],
[[
冥约【仿品】
符文法杖
等级需求: 40, 131 Int
replica: true
联盟: 夺宝奇兵
固定基底词缀: 1
法术伤害提高 (22-26)%
+(10-20) 智慧
召唤生物的移动速度提高 (40-50)%
召唤生物的伤害提高 (50-70)%
+6 愤怒狂灵数量上限
保留 30% 生命
不能搭配【异灵之体】
召唤的幻灵数量上限 +3
]],
[[
碎月
朽木法杖
联盟: 竞赛专用
插槽: W-W-W
固定基底词缀: 1
法术伤害提高 (8-12)%
法术伤害提高 20%
施法速度提高 12%
4% 几率使敌人受到冰冻,感电与点燃
每秒回复 2 魔力
]],
[[
艾贝拉斯之角
羊角法杖
版本: 2.3.0以前
版本: 当前
等级需求: 6, 29 Int
固定基底词缀: 2
{variant:1}法术伤害提高 (9-12)%
{variant:2}法术伤害提高 (10-14)%
火焰伤害提高 (20-30)%
法术附加 (4-6) - (8-12) 基础火焰伤害
攻击和法术暴击率提高 (40-60)%
击败被点燃的敌人回复 +10 生命
敌人被点燃的持续时间缩短 25%
]],[[
艾普之怒
灵石法杖
版本: 2.3.0以前
版本: 3.7.0以前
版本: 3.11.0以前
版本: 当前
等级需求: 62, 212 Int
固定基底词缀: 2
{variant:1}法术伤害提高 (17-20)%
{variant:2,3,4}法术伤害提高 (38-42)%
{variant:1,2}法术附加 (50-65) - (90-105) 基础混沌伤害
{variant:3,4}法术附加 (90-130) - (140-190) 基础混沌伤害
施法速度提高 (25-30)%
+(5-10)% 混沌抗性
{variant:1,2,3}技能魔力消耗提高 40%
{variant:4}+40 技能魔力消耗
{variant:3,4}你造成的烈毒的伤害生效速度加快 20%
]],[[
灰烬行者
石英法杖
版本: 3.8.0以前
版本: 当前
等级需求: 18, 65 Int
固定基底词缀: 1
法术伤害提高 (18-22)%
{variant:1}附加 (10-14) - (18-22) 基础火焰伤害
{variant:2}+(15-25)% 持续火焰伤害加成
法术附加 (4-6) - (7-9) 基础火焰伤害
{variant:1}燃烧伤害提高 (40-50)%
{variant:2}燃烧伤害提高 (20-30)%
火焰伤害击中时有 (16-22)% 几率点燃敌人
击败敌人时有 10% 几率触发 8 级的【召唤愤怒狂灵】
]],[[
宇蚀
水晶法杖
升级: 使用 预言【蔽目之光】 升级为 传奇【日耀之冠】
版本: 2.2.0以前
版本: 2.3.0以前
版本: 3.10.0以前
版本: 当前
等级需求: 45, 146 Int
固定基底词缀: 2
{variant:1,2}法术伤害提高 (14-18)%
{variant:3,4}法术伤害提高 (29-33)%
{variant:1,2,3}附加 (18-22) - (36-44) 基础物理伤害
{variant:4}附加 (30-45) - (60-80) 基础火焰伤害
{variant:4}攻击速度提高 (6-10)%
{variant:1}+(18-30)% 攻击和法术暴击伤害加成
{variant:2,3,4}+(27-33)% 攻击和法术暴击伤害加成
照亮范围扩大 20%
周围敌人被致盲
对致盲的敌人时,攻击和法术暴击率提高 (120-140)%
]],[[
日耀之冠
水晶法杖
版本: 3.10.0以前
版本: 当前
源: 由 传奇【宇蚀】 使用 预言【蔽目之光】 升级
等级需求: 63, 146 Int
固定基底词缀: 1
法术伤害提高 (29-33)%
装备时触发 20 级的主动技能【失明光环】
{variant:1}附加 (18-22) - (36-44) 基础物理伤害
{variant:2}附加 (30-45) - (60-80) 基础火焰伤害
{variant:2}攻击速度提高 (6-10)%
+(27-33)% 攻击和法术暴击伤害加成
照亮范围扩大 20%
对致盲的敌人时,攻击和法术暴击率提高 (120-140)%
照亮范围的扩大和缩小也同样作用于命中值
该武器击中致盲敌人时,附加 (145-157) - (196-210) 基础火焰伤害
]],[[
生机之记
朽木法杖
等级需求: 2
固定基底词缀: 1
法术伤害提高 (8-12)%
此物品上装备的【法术技能石】等级 +1
法术伤害提高 (20-28)%
施法速度提高 (5-8)%
+(15-20) 最大生命
+(15-20) 最大魔力
施放法术后 1 秒内回复 (6-8) 生命
]],[[
冥约
符文法杖
版本: 2.3.0以前
版本: 3.0.0以前
版本: 3.8.0以前
版本: 当前
等级需求: 40, 131 Int
固定基底词缀: 2
{variant:1}法术伤害提高 (12-16)%
{variant:2,3,4}法术伤害提高 (22-26)%
+(10-20) 智慧
{variant:1,2,3}召唤生物的移动速度提高 (10-20)%
{variant:4}召唤生物的移动速度提高 (20-30)%
{variant:1,2,3}召唤生物的伤害提高 (10-30)%
{variant:4}召唤生物的伤害提高 (50-70)%
+1 魔卫数量上限
+1 灵体数量上限
{variant:1,2}+2 魔侍数量上限
{variant:3,4}+1 魔侍数量上限
保留 30% 生命
不能搭配【异灵之体】
]],[[
泣月
魔性法杖
版本: 2.0.0以前
版本: 2.3.0以前
版本: 3.0.0以前
版本: 当前
等级需求: 59, 188 Int
固定基底词缀: 2
{variant:1,2}法术伤害提高 (15-19)%
{variant:3,4}法术伤害提高 (33-37)%
{variant:1,2,3}此物品上的技能石受到 5 级的 致盲 辅助
{variant:4}此物品上的技能石受到 20 级的 致盲 辅助
法术伤害提高 (30-40)%
{variant:1}物理伤害提高 125%
{variant:2,3}物理伤害提高 175%
{variant:4}物理伤害提高 (250-275)%
+10 智慧
闪电伤害提高 (20-30)%
施法速度提高 10%
击中时有 10% 几率致盲敌人
]],[[
抹灭
魔角法杖
版本: 2.3.0以前
版本: 3.10.0以前
版本: 当前
等级需求: 56, 179 Int
固定基底词缀: 2
{variant:1}法术伤害提高 (15-18)%
{variant:2,3}法术伤害提高 (31-35)%
{variant:1,2}附加 (24-30) - (80-92) 基础物理伤害
{variant:3}附加 (25-50) - (85-125) 基础物理伤害
该装备的攻击暴击率提高 (26-32)%
获得额外混沌伤害,其数值等同于物理伤害的 (13-15)%
你击败的敌人有 20% 几率爆炸,造成等同该敌人最大生命四分之一的混沌伤害
]],[[
皮斯卡托的慧眼
狂风法杖
版本: 2.3.0以前
版本: 2.6.0以前
版本: 当前
等级需求: 65, 212 Int
固定基底词缀: 2
{variant:1}法术伤害提高 (16-19)%
{variant:2,3}法术伤害提高 (35-39)%
没有物理伤害
攻击速度提高 (10-18)%
+(340-400) 命中值
该装备的攻击暴击率提高 (20-30)%
此武器攻击造成的火焰、冰霜、闪电伤害提高 (100-115)%
{variant:3}此武器的攻击穿透 5% 火焰、冰霜、闪电抗性
]],[[
诗人之笔
粗纹法杖
等级需求: 12
固定基底词缀: 1
法术伤害提高 (11-15)%
人物等级每到达 25 级,该插槽内的【主动技能石】等级 +1
玩家等级每提高 3 级,该武器攻击时便附加 3 - 5 物理伤害
攻击速度提高 (8-12)%
当你攻击时触发一个插槽内的法术
]],[[
混响
螺纹法杖
升级: 使用 预言【力量扩大】 升级为 传奇【增幅杖】
版本: 2.3.0以前
版本: 3.11.0以前
版本: 当前
等级需求: 24, 83 Int
固定基底词缀: 2
{variant:1}法术伤害提高 (10-14)%
{variant:2,3}法术伤害提高 (15-19)%
{variant:1,2}此物品上装备的技能石等级 +1
{variant:3}此物品上装备的技能石等级 +2
{variant:1,2}此物品上的技能石受到 1 级的 施法回响 辅助
{variant:3}此物品上的技能石受到 10 级的 施法回响 辅助
+(10-30) 智慧
]],[[
增幅杖
螺纹法杖
版本: 3.11.0以前
版本: 当前
源: 由 传奇【混响】 使用 预言【力量扩大】 升级
等级需求: 36, 83 Int
固定基底词缀: 1
法术伤害提高 (15-19)%
{variant:1}此物品上装备的技能石等级 +1
{variant:2}此物品上装备的技能石等级 +2
{variant:1}此物品上的技能石受到 1 级的 施法回响 辅助
{variant:2}此物品上的技能石受到 10 级的 施法回响 辅助
{variant:1}此物品上的技能石受到 1 级的 增大范围 辅助
{variant:2}此物品上的技能石受到 10 级的 法术凝聚 辅助
{variant:1}此物品上的技能石由 1 级的 精准破坏 辅助
{variant:2}此物品上的技能石由 10 级的 精准破坏 辅助
+(10-30) 智慧
]],[[
日耀之影
贤者法杖
版本: 3.5.0以前
版本: 当前
等级需求: 30, 119 Int
固定基底词缀: 1
法术伤害提高 (17-21)%
获得额外混沌伤害,其数值等同于火焰、冰霜、闪电伤害的 (10-20)%
暴击无法造成伤害
{variant:1}近期若打出过暴击,则法术伤害提高 120%
{variant:2}若你在过去 8 秒内打出过暴击,则法术伤害提高 200%
]],[[
低伏暗光
狂风法杖
源:源: 传奇Boss【裂界者】 专属掉落 (T6地图或以上)
版本: 3.4.0以前
版本: 当前
等级需求: 65
固定基底词缀: 1
法术伤害提高 (35-39)%
法术伤害提高 (20-45)%
法术附加 (26-35) - (95-105) 闪电伤害
每个暴击球 +(6-10)% 暴击伤害加成
每个暴击球 +0.3% 攻击和法术基础暴击率
每个暴击球可使法术格挡几率提高 2%
每个暴击球可使法术附加 3 - 9 基础闪电伤害
{variant:1}近期内你若打出过暴击,则每有 1 个暴击球,就会每秒受到 400 闪电伤害
{variant:2}近期内你的技能若打出过暴击,则每有 1 个暴击球,就会每秒受到 200 闪电伤害
裂界之器
]],[[
禁锢暴风
粗纹法杖
版本: 2.3.0以前
版本: 当前
等级需求: 12, 47 Int
固定基底词缀: 2
{variant:1}法术伤害提高 (9-13)%
{variant:2}法术伤害提高 (11-15)%
物理伤害提高 (40-60)%
附加 1 - (35-45) 基础闪电伤害
魔力回复速度提高 (15-25)%
+1 暴击球数量上限
击败敌人有 (25-35)% 几率获得暴击球
]],[[
托沃崩
螺纹法杖
联盟: 裂隙
源: 地图【托沃领域】 或 传奇Boss【崩雪‧托沃】 专属掉落
升级: 使用 通货【托沃的祝福】 升级为 传奇【托沃卧】
等级需求: 24, 83 Int
固定基底词缀: 1
法术伤害提高 (15-19)%
施法速度提高 (10-15)%
击败被冰冻的敌人时有 50% 几率获得暴击球
每个暴击球为法术附加 10 - 20 基础冰霜伤害
击败 1 个被冰冻敌人时 +(20-25) 魔力
]],[[
托沃卧
狂风法杖
联盟: 裂隙
源: 由 传奇【托沃崩】 使用 通货【托沃的祝福】 升级
等级需求: 65, 212 Int
固定基底词缀: 1
法术伤害提高 (35-39)%
施法速度提高 (10-15)%
击败被冰冻的敌人时有 50% 几率获得暴击球
每个暴击球为法术附加 15 - 25 基础冰霜伤害
暴击球达到最大数量时,失去所有的暴击球
暴击球达到最大数量时,获得 1 个狂怒球
每个狂怒球可使冰霜伤害提高 (10-15)%
]],[[
峡湾之星
贤者法杖
版本: 2.3.0以前
版本: 当前
等级需求: 30, 119 Int
固定基底词缀: 2
{variant:1}法术伤害提高 (11-14)%
{variant:2}法术伤害提高 (17-21)%
物理伤害提高 (80-120)%
附加 (5-8) - (13-17) 基础物理伤害
攻击速度提高 (5-10)%
该装备的攻击暴击率提高 (10-20)%
此物品上的技能石可以发射 1 个额外投射物
]],[[
潜能魔棒
箴言法杖
版本: 2.3.0以前
版本: 当前
等级需求: 68, 245 Int
固定基底词缀: 2
{variant:1}法术伤害提高 (16-20)%
{variant:2}法术伤害提高 (36-40)%
法术伤害降低 80%
施法速度提高 (10-20)%
攻击和法术暴击率提高 (50-65)%
+(40-50) 最大魔力
+1 暴击球数量上限
每个暴击球可使法术伤害提高 25%
]],
}
|
local platforms = workspace.platforms
function setTransparency(transparency)
for i,v in pairs(platforms:GetChildren()) do
v.Transparency = transparency
wait(0.2)
end
end
while(true) do
setTransparency(100)
wait(4)
setTransparency(0)
wait(1)
end
|
--[[
init.lua
Created: 10/09/2021 15:46:48
Description: Autogenerated script file for the map garden_end.
]]--
-- Commonly included lua functions and data
require 'common'
-- Package name
local garden_end = {}
-- Local, localized strings table
-- Use this to display the named strings you added in the strings files for the map!
-- Ex:
-- local localizedstring = MapStrings['SomeStringName']
local MapStrings = {}
-------------------------------
-- Map Callbacks
-------------------------------
---garden_end.Init
--Engine callback function
function garden_end.Init(map)
--This will fill the localized strings table automatically based on the locale the game is
-- currently in. You can use the MapStrings table after this line!
MapStrings = COMMON.AutoLoadLocalizedStrings()
end
---garden_end.Enter
--Engine callback function
function garden_end.Enter(map)
if SV.garden_end.ExpositionComplete then
garden_end.PrepareReturnVisit()
end
UI:WaitShowTitle(GAME:GetCurrentGround().Name:ToLocal(), 20)
GAME:WaitFrames(30)
UI:WaitHideTitle(20)
GAME:FadeIn(20)
-- if exposition complete, hide the cutscene trigger
end
--------------------------------------------------
-- Map Setup Functions
--------------------------------------------------
function garden_end.PrepareReturnVisit()
GROUND:Hide("Cutscene_Trigger")
GROUND:Hide("Shaymin")
GROUND:Hide("Berry_Basket_Red")
GROUND:Hide("Berry_Basket_Blue_1")
GROUND:Hide("Berry_Basket_Blue_2")
GROUND:Hide("Berry_Basket_Blue_3")
GROUND:Hide("Berry_Basket_Blue_4")
end
-------------------------------
-- Entities Callbacks
-------------------------------
function garden_end.Cutscene_Trigger_Touch(obj, activator)
DEBUG.EnableDbgCoro() --Enable debugging this coroutine
local shaymin = CH('Shaymin')
GAME:CutsceneMode(true)
-- move camera up a little more: center at 196, 264
GAME:MoveCamera(204, 248, 30, false)
local turnTime = 4
GAME:WaitFrames(30)
-- turn left
GROUND:CharAnimateTurnTo(shaymin, Direction.UpLeft, turnTime)
GAME:WaitFrames(40)
-- turn right
GROUND:CharAnimateTurnTo(shaymin, Direction.UpRight, turnTime)
GAME:WaitFrames(40)
-- turn left
GROUND:CharAnimateTurnTo(shaymin, Direction.UpLeft, turnTime)
GAME:WaitFrames(40)
-- exclaim
SOUND:PlayBattleSE("EVT_Emote_Exclaim_2")
GROUND:CharSetEmote(shaymin, 3, 1)
-- turn around
GROUND:CharAnimateTurnTo(shaymin, Direction.Down, turnTime)
-- oh, a visitor?
UI:SetSpeaker(STRINGS:Format("\\uE040"), true, 492, 0, 0, RogueEssence.Data.Gender.Unknown)
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_001']))
GROUND:CharSetEmote(shaymin, 4, 4)
GAME:WaitFrames(30)
-- introduce self
UI:SetSpeaker(shaymin)
UI:SetSpeakerEmotion("Happy")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_002'], shaymin:GetDisplayName()))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_003']))
-- get ready for picnic
GAME:FadeOut(false, 30)
GROUND:TeleportTo(shaymin, 176, 216, Direction.Right)
GROUND:TeleportTo(activator, 216, 216, Direction.Left)
GROUND:Hide("Berry_Basket_Blue_1")
GROUND:Hide("Berry_Basket_Blue_2")
GROUND:Unhide("Berry_Basket_Blue_3")
GROUND:Unhide("Berry_Basket_Blue_4")
GAME:WaitFrames(60)
GAME:FadeIn(30)
if GAME:InRogueMode() then
-- TODO
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_001']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_001']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_001']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_020']))
-- if in rogue mode, give different dialogue and bank money
GAME:AddToPlayerMoneyBank(100000)
else
UI:SetSpeakerEmotion("Normal")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_004']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_005']))
GROUND:CharSetAnim(activator, "Walk", false)
GAME:WaitFrames(60)
UI:SetSpeakerEmotion("Happy")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_006'], _DATA.Save.ActiveTeam.Name))
GROUND:CharSetEmote(shaymin, 4, 4)
GAME:WaitFrames(60)
UI:SetSpeakerEmotion("Normal")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_007']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_008']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_009']))
UI:SetSpeakerEmotion("Inspired")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_010']))
GAME:WaitFrames(60)
GROUND:CharAnimateTurnTo(shaymin, Direction.Up, turnTime)
GAME:WaitFrames(30)
UI:SetSpeakerEmotion("Normal")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_011']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_012']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_013']))
GROUND:CharAnimateTurnTo(shaymin, Direction.Right, turnTime)
UI:SetSpeakerEmotion("Worried")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_014']))
GROUND:CharAnimateTurnTo(shaymin, Direction.DownRight, turnTime)
GROUND:CharSetAnim(shaymin, "Walk", false)
GAME:WaitFrames(30)
GROUND:CharAnimateTurnTo(shaymin, Direction.Right, turnTime)
GROUND:CharSetAnim(shaymin, "Walk", false)
GAME:WaitFrames(60)
UI:SetSpeakerEmotion("Normal")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_015']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_016']))
UI:SetSpeakerEmotion("Happy")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_017']))
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_018']))
GROUND:CharSetEmote(shaymin, 4, 4)
GAME:WaitFrames(30)
-- if not in rogue mode, have them join the team
local mon_id = RogueEssence.Dungeon.MonsterID(492, 0, 0, Gender.Genderless)
local player = _DATA.Save.ActiveTeam:CreatePlayer(_DATA.Save.Rand, mon_id, 50, -1, 0)
player.MetAt = _ZONE.CurrentGround:GetColoredName()
player.MetLoc = RogueEssence.Dungeon.ZoneLoc(_ZONE.CurrentZoneID, _ZONE.CurrentMapID)
_DATA.Save.ActiveTeam.Players:Add(player)
SOUND:PlayFanfare("Fanfare/JoinTeam")
UI:ResetSpeaker()
UI:WaitShowDialogue(STRINGS:Format(RogueEssence.StringKey("MSG_RECRUIT"):ToLocal(), shaymin:GetDisplayName(), _DATA.Save.ActiveTeam.Name))
GAME:WaitFrames(30)
UI:SetSpeaker(shaymin)
UI:SetSpeakerEmotion("Normal")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_019']))
UI:SetSpeakerEmotion("Happy")
UI:WaitShowDialogue(STRINGS:Format(MapStrings['Expo_Cutscene_Line_020']))
-- By the way, have you seen my Gracidea? It should be deeper in the garden...
-- Ah, it's nothing...
-- UI:WaitShowDialogue("By the way, have you seen any Gracidea?")
-- UI:WaitShowDialogue("They are said to bloom deep in the garden...")
-- By the way, that Gracidea you have there...
-- I'm thankful that you've found it.
-- When I use that flower, my appearance changes! I can show you when we go on an adventure together.
end
SV.garden_end.ExpositionComplete = true
SOUND:FadeOutBGM()
GAME:FadeOut(false, 30)
GAME:CutsceneMode(false)
GAME:WaitFrames(90)
COMMON.EndDungeonDay(RogueEssence.Data.GameProgress.ResultType.Cleared, 1, -1, 3, 2)
end
function garden_end.South_Exit_Touch(obj, activator)
DEBUG.EnableDbgCoro() --Enable debugging this coroutine
-- ask to complete the dungeon and go back
UI:ResetSpeaker()
UI:ChoiceMenuYesNo(STRINGS:FormatKey("DLG_ASK_EXIT_DUNGEON"), false)
UI:WaitForChoice()
ch = UI:ChoiceResult()
if ch then
SOUND:FadeOutBGM()
GAME:FadeOut(false, 30)
GAME:WaitFrames(120)
if GAME:InRogueMode() then
GAME:AddToPlayerMoneyBank(100000)
end
COMMON.EndDungeonDay(RogueEssence.Data.GameProgress.ResultType.Cleared, 1, -1, 3, 2)
end
end
return garden_end
|
function SetRandomAngle(ent)
-- Randomize starting angles
local angles = ent:GetAngles()
angles.yaw = math.random() * math.pi * 2
ent:SetAngles(angles)
-- To make sure physics model is updated without waiting a tick
ent:UpdatePhysicsModel()
end
local old_MarineTeam_OnResetComplete = MarineTeam.OnResetComplete or Team.OnResetComplete
function MarineTeam:OnResetComplete()
if old_MarineTeam_OnResetComplete then
old_MarineTeam_OnResetComplete(self)
end
for index, powerPoint in ientitylist(Shared.GetEntitiesWithClassname("PowerPoint")) do
if powerPoint:HasConsumerRequiringPower() and powerPoint:GetPowerState() == PowerPoint.kPowerState.unsocketed
then
powerPoint:SocketPowerNode()
end
end
end
function MarineTeam:SpawnInitialStructures(techPoint)
local weapons = {
-- Shotgun.kMapName, Shotgun.kMapName, Shotgun.kMapName,
-- GrenadeLauncher.kMapName,
-- Flamethrower.kMapName,
-- HeavyMachineGun.kMapName,
LayMines.kMapName, LayMines.kMapName, LayMines.kMapName,
LayMines.kMapName, LayMines.kMapName, LayMines.kMapName
}
if not GetGameInfoEntity():GetIsDedicated() then
table.insert(weapons, Jetpack.kMapName)
end
assert(techPoint ~= nil)
local origin = techPoint:GetOrigin()
local ip = CreateEntity(InfantryPortal.kMapName, origin, kMarineTeamType)
if ip then ip:SetConstructionComplete() ; SetRandomAngle(ip) end
-- local pg_origin = SNTL_SpreadedPlacementFromOrigin(GetExtents(kTechId.PhaseGate), origin, 1, 2, 5)
-- local pg = pg_origin and CreateEntity(PhaseGate.kMapName, pg_origin[1], kMarineTeamType)
-- if pg then pg:SetConstructionComplete() ; SetRandomAngle(pg) end
for i = 1, 2 do
local armslab_origin = SNTL_SpreadedPlacementFromOrigin(GetExtents(kTechId.ArmsLab), origin, 1, 2, 5)
local armslab = armslab_origin and CreateEntity(ArmsLab.kMapName, armslab_origin[1], kMarineTeamType)
if armslab then armslab:SetConstructionComplete() ; SetRandomAngle(armslab) end
end
for i = 1, 2 do
local MAC_origin = SNTL_SpreadedPlacementFromOrigin(GetExtents(kTechId.MAC), origin, 1, 2, 5)
local MAC = MAC_origin and CreateEntity(MAC.kMapName, MAC_origin[1], kMarineTeamType)
end
local armory_origin = SNTL_SpreadedPlacementFromOrigin(GetExtents(kTechId.Armory), origin, 1, 2, 5)
local armory = armory_origin and CreateEntity(Armory.kMapName, armory_origin[1], kMarineTeamType)
if armory then armory:SetConstructionComplete() ; SetRandomAngle(armory) end
local proto_origin = SNTL_SpreadedPlacementFromOrigin(GetExtents(kTechId.PrototypeLab), origin, 1, 2, 5)
local proto = proto_origin and CreateEntity(PrototypeLab.kMapName, proto_origin[1], kMarineTeamType)
if proto then proto:SetConstructionComplete() ; SetRandomAngle(proto) end
-- Spawn a few weapons as well
local weapons_origins = SNTL_SpreadedPlacementFromOrigin(GetExtents(kTechId.Shotgun), origin, 1, 2, 5)
local weapons_origins = SNTL_SpreadedPlacementFromOrigin(GetExtents(kTechId.Shotgun), weapons_origins[1], #weapons, 0, 2)
for i, orig in ipairs(weapons_origins) do
local weapon = CreateEntity(weapons[i], orig + Vector(0, 0.5, 0), kMarineTeamType)
if weapon and weapon.GetVariantModel and weapon.SetModel then
weapon:SetModel( weapon:GetVariantModel() )
end
end
-- -------------------
local unlockedResearches = {
-- kTechId.Weapons1,
-- kTechId.Weapons2,
-- kTechId.Armor1
}
local marinetechtree = GetTechTree(kTeam1Index)
for _, up in ipairs(unlockedResearches) do
if (up and marinetechtree:GetTechNode(up) and not marinetechtree:GetTechNode(up):GetResearched())
then -- Unlock if not already on
local armslab = GetEntitiesForTeam("ArmsLab", kMarineTeamType)
if (#armslab > 0) then
marinetechtree:GetTechNode(up):SetResearched(true)
marinetechtree:QueueOnResearchComplete(up, armslab[1])
end
end
end
local unlockedWeapons = {
-- kTechId.GrenadeTech
}
for _, up in ipairs(unlockedWeapons) do
if (up and marinetechtree:GetTechNode(up) and not marinetechtree:GetTechNode(up):GetResearched())
then -- Unlock if not already on
local AA = GetEntitiesForTeam("AdvancedArmory", kMarineTeamType)
if (#AA > 0) then
marinetechtree:GetTechNode(up):SetResearched(true)
marinetechtree:QueueOnResearchComplete(up, AA[1])
end
end
end
return
end
function MarineTeam:GetHasTeamLost()
PROFILE("PlayingTeam:GetHasTeamLost")
if GetGamerules():GetGameStarted() and not Shared.GetCheatsEnabled() then
-- Team can't respawn if they don't have any more ips, and lose if they are all dead
local activePlayers = self:GetHasActivePlayers()
local abilityToRespawn = self:GetHasAbilityToRespawn()
local numGates = 0
for _, pg in ipairs(GetEntitiesForTeam("PhaseGate", kMarineTeamType)) do
if pg and pg:GetIsAlive() then
numGates = numGates + 1
end
end
if (not activePlayers and not abilityToRespawn) or
(self:GetNumPlayers() == 0) or (numGates == 0) or self:GetHasConceded() then
return true
end
end
return false
end
function getRtPoints(classname)
local rt = {}
local cl = classname
if (cl == nil) then
cl = "ResourcePoint"
end
if (cl == "TechPoint" or cl == "ResourcePoint" or cl == "PowerPoint") then
local rts = Shared.GetEntitiesWithClassname(cl)
for index, entity in ientitylist(rts) do
table.insert(rt, entity)
end
else
for index, entity in ipairs(GetEntities(cl)) do
table.insert(rt, entity)
end
end
return rt
end
function getRandomRT()
local rt = getRtPoints()
if (#rt == 0) then
rt = getRtPoints("TechPoint")
end
rt_nb = math.random(1, #rt)
return rt[rt_nb]
end
function getRandomPowerNode()
local rt = GetEntities("PowerPoint")
rt_nb = math.random(1, #rt)
return rt[rt_nb]
end
function MarineTeam:randomBonusDrop()
if SNTL_LimitCallFrequency(MarineTeam.randomBonusDrop, 5) then return end
local nb_drop = #GetEntities("AmmoPack")-- + #GetEntities("MedPack") + #GetEntities("CatPack")
if (nb_drop < 13) then
local ent = nil
local rt = nil
rt = nil--getRandomRT()
for i = 0, 10 do -- Choose a RT with no drop if possible
local hasRtDropAlready = false
local _rt = getRandomRT()
if (math.random() < 0.5) then
_rt = getRandomPowerNode()
end
-- Prevent drop in bases
if (_rt) then
if #GetEntitiesForTeamWithinRange("Armory", 1, _rt:GetOrigin(), 40) == 0
and #GetEntitiesForTeamWithinRange("Player", 1, _rt:GetOrigin(), 30) == 0
then
for _, dropName in ipairs({"AmmoPack", "MedPack", "CatPack"}) do
if (#GetEntitiesForTeamWithinRange(dropName, 2, _rt:GetOrigin(), 4) > 1) then
hasRtDropAlready = true
break
end
end
if (hasRtDropAlready == false) then
rt = _rt
break
end
end
end
end
if (rt) then
local rand = math.random()
local spawnPoint = nil
for e = 0, 3 do
spawnPoint = SNTL_SpreadedPlacementFromOrigin(GetExtents(kTechId.ArmsLab), rt:GetOrigin(), 1, 2, 5)
if (spawnPoint) then
spawnPoint = spawnPoint[1]
break
end
end
if (spawnPoint) then
ent = CreateEntity(AmmoPack.kMapName, spawnPoint, 1)
end
end
end
end
function MarineTeam:UpdateUpgrades(timePassed)
if SNTL_LimitCallFrequency(MarineTeam.UpdateUpgrades, 1) then return end
local marinetechtree = GetTechTree(kTeam1Index)
local UnlockOrder = {
{kTechId.Weapons1, kTechId.GrenadeTech, kTechId.ShotgunTech,
kTechId.Armor1, kTechId.MinesTech,
kTechId.Weapons2, kTechId.AdvancedArmoryUpgrade, kTechId.AdvancedArmoryUpgrade,
kTechId.HeavyMachineGunTech,
kTechId.JetpackTech, kTechId.Armor2,
kTechId.Weapons3, kTechId.ExosuitTech,
}
}
local totalUpgrades = 0
for i, ups in ipairs(UnlockOrder) do
for j, up in ipairs(ups) do
totalUpgrades = totalUpgrades + 1
end
end
local marines = GetEntitiesForTeam("Player", kMarineTeamType)
local marine = #marines > 0 and marines[1]
if not marine then
return
end
local respawnLeft = GetGameInfoEntity():GetNumMarineRespawnLeft()
local respawnMax = GetGameInfoEntity():GetNumMarineRespawnMax()
local eggFraction = respawnLeft / respawnMax
-- local eggFraction = GetGameInfoEntity():GetNumEggs() / GetGameInfoEntity():GetNumMaxEggs()
local upNum = -2
local upgradeResearching = false
for i, ups in ipairs(UnlockOrder) do
for j, up in ipairs(ups) do
-- Only research if marines are actually pushing aliens
-- X% of the tech tree is locked until the marines don't have any remaining spawn
-- Log("%s / %s", ((totalUpgrades / 100 * 5) + upNum) / totalUpgrades, 1 - eggFraction)
if respawnLeft > 0 then
if ((totalUpgrades / 100 * 0) + upNum) / totalUpgrades >= 1 - eggFraction then
return
end
end
upNum = upNum + 1
local node = marinetechtree:GetTechNode(up)
if node then
-- Log("[sntl] GetCanResearch(): %s", node:GetCanResearch())
if up == kTechId.AdvancedArmoryUpgrade then
upgradeResearching = true
for _, a in ipairs(GetEntitiesForTeam("Armory", kMarineTeamType)) do
if a:GetTechId() == kTechId.AdvancedArmory then
upgradeResearching = false
break
end
end
elseif not node:GetResearched() then
upgradeResearching = true
end
if not node:GetResearched() and not node:GetResearching() and not node:GetHasTech()
then -- Unlock if not already on
local ents = {"ArmsLab", "Armory", "PrototypeLab"}
for _, entName in ipairs(ents) do
local alreadyResearching = false
for _, ent in ipairs(GetEntitiesForTeam(entName, kMarineTeamType)) do
if ent:GetIsResearching() and ent:GetResearchingId() == up then
alreadyResearching = true
break
end
end
if alreadyResearching then
break
end
for _, ent in ipairs(GetEntitiesForTeam(entName, kMarineTeamType)) do
local techAllowed = false
if ent.GetTechButtons then
for _, tech in ipairs(ent:GetTechButtons()) do
if tech == up then
techAllowed = true
break
end
end
end
if techAllowed and ent:GetCanResearch() and not ent:GetIsResearching() then
Log("[sntl] Researching %s", EnumToString(kTechId, up))
ent:SetResearching(node, marine)
-- return
ent.researchProgress = 0.01 -- Hack so the GetIsResearching() will return true
break
end
end
end
end
end
end
if upgradeResearching then
break
end
end
-- local unlockedWeapons = {
-- -- kTechId.GrenadeTech
-- }
-- for _, up in ipairs(unlockedWeapons) do
-- if (up and marinetechtree:GetTechNode(up) and not marinetechtree:GetTechNode(up):GetResearched())
-- then -- Unlock if not already on
-- local AA = GetEntitiesForTeam("AdvancedArmory", kMarineTeamType)
-- if (#AA > 0) then
-- marinetechtree:GetTechNode(up):SetResearched(true)
-- marinetechtree:QueueOnResearchComplete(up, AA[1])
-- end
-- end
-- end
end
local function GetArmorLevel(self)
local armorLevels = 0
local techTree = self:GetTechTree()
if techTree then
if techTree:GetHasTech(kTechId.Armor3) then
armorLevels = 3
elseif techTree:GetHasTech(kTechId.Armor2) then
armorLevels = 2
elseif techTree:GetHasTech(kTechId.Armor1) then
armorLevels = 1
end
end
return armorLevels
end
local function SNTL_MarineTeam_Update(self, timePassed)
if Server and GetGamerules():GetGameStarted() then
self:randomBonusDrop()
self:UpdateUpgrades(timePassed)
end
end
function MarineTeam:Update(timePassed)
PROFILE("MarineTeam:Update")
PlayingTeam.Update(self, timePassed)
-- Update distress beacon mask
self:UpdateGameMasks(timePassed)
-- if GetGamerules():GetGameStarted() then
-- CheckForNoIPs(self)
-- end
local armorLevel = GetArmorLevel(self)
for index, player in ipairs(GetEntitiesForTeam("Player", self:GetTeamNumber())) do
player:UpdateArmorAmount(armorLevel)
end
SNTL_MarineTeam_Update(self, timePassed)
end
-- -- Disable the "We need an Infantry portal" voice warning
-- ReplaceUpValue(MarineTeam.Update, "CheckForNoIPs",
-- function (self) return end,
-- { LocateRecurse = true; CopyUpValues = true; } )
|
-- add target
target("lcurses")
-- enable this target?
if not has_config("curses") and not has_config("pdcurses") then
set_default(false)
end
-- make as a static library
set_kind("static")
-- add deps
add_deps("luajit")
if is_plat("windows") and has_config("pdcurses") then
add_deps("pdcurses")
end
-- add the common source files
add_files("lcurses.c")
add_defines("XM_CONFIG_API_HAVE_CURSES", {public = true})
-- add options
if is_plat("windows") then
add_options("pdcurses")
else
add_options("curses")
end
|
local t = Def.ActorFrame{};
local InputOfArrow = function( event )
if not event then return end
if event.type == "InputEventType_Repeat" then
if event.button == "Start" or event.button == "Center" or event.button == "Back" then
MESSAGEMAN:Broadcast('Confirm')
SCREENMAN:GetTopScreen():StartTransitioningScreen("SM_GoToNextScreen")
end
end
end;
t[#t+1] = Def.ActorFrame{
name = "YEY";
InitCommand=cmd();
OnCommand=function(self)
SCREENMAN:GetTopScreen():AddInputCallback(InputOfArrow)
self:sleep(1):queuecommand("ISLA")
end;
LoadActor( THEME:GetPathS("Common","start") )..{
ConfirmMessageCommand=cmd(play);
};
LoadActor( THEME:GetPathS("Common","cancel") )..{
NopeMessageCommand=cmd(play);
};
LoadActor( THEME:GetPathS("Common","value") )..{
ChanMessageCommand=cmd(play);
};
};
t[#t+1]=Def.Quad{
OnCommand=cmd(visible,false;sleep,9999999);
};
t[#t+1] = LoadActor("StarVector");
t[#t+1] = Def.Quad{
OnCommand=function(self)
local RowOptions = {}
local files = FILEMAN:GetDirListing(THEMEDIR().."/Modules/",false,false)
for _,file in pairs(files) do
local pl,pr = string.find( file, "RowOption." )
local sl,sr = string.find( file, ".lua" )
if pl ~= nil and pl == 1 and pr + 1 <= sl - 1 then
RowOptions[#RowOptions+1] = string.sub( file, pr + 1, sl - 1 )
end
end
end;
};
return t; |
--------------------------------------
-- Spell: Yain: Ichi
-- Grants Enmity Down +15 for Caster
--------------------------------------
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/magic")
--------------------------------------
function onMagicCastingCheck(caster, target, spell)
return 0
end
function onSpellCast(caster, target, spell)
caster:delStatusEffect(tpz.effect.ENMITY_BOOST)
caster:addStatusEffect(tpz.effect.PAX, 15, 0, 300)
return tpz.effect.PAX
end
|
--[[
Author: Ractidous
Date: 27.01.2015.
Create the particle effect and projectiles.
]]
function FireMacropyre( event )
local caster = event.caster
local ability = event.ability
local pathLength = event.cast_range
local pathRadius = event.path_radius
local duration = event.duration
local startPos = caster:GetAbsOrigin()
local endPos = startPos + caster:GetForwardVector() * pathLength
ability.macropyre_startPos = startPos
ability.macropyre_endPos = endPos
ability.macropyre_expireTime = GameRules:GetGameTime() + duration
-- Create particle effect
local particleName = "particles/units/heroes/hero_jakiro/jakiro_macropyre.vpcf"
local pfx = ParticleManager:CreateParticle( particleName, PATTACH_ABSORIGIN, caster )
ParticleManager:SetParticleControl( pfx, 0, startPos )
ParticleManager:SetParticleControl( pfx, 1, endPos )
ParticleManager:SetParticleControl( pfx, 2, Vector( duration, 0, 0 ) )
ParticleManager:SetParticleControl( pfx, 3, startPos )
-- Generate projectiles
pathRadius = math.max( pathRadius, 64 )
local projectileRadius = pathRadius * math.sqrt(2)
local numProjectiles = math.floor( pathLength / (pathRadius*2) ) + 1
local stepLength = pathLength / ( numProjectiles - 1 )
local dummyModifierName = "modifier_macropyre_destroy_tree_datadriven"
for i=1, numProjectiles do
local projectilePos = startPos + caster:GetForwardVector() * (i-1) * stepLength
ProjectileManager:CreateLinearProjectile( {
Ability = ability,
-- EffectName = "",
vSpawnOrigin = projectilePos,
fDistance = 64,
fStartRadius = projectileRadius,
fEndRadius = projectileRadius,
Source = caster,
bHasFrontalCone = false,
bReplaceExisting = false,
iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY,
iUnitTargetFlags = DOTA_UNIT_TARGET_FLAG_NONE,
iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_CREEP + DOTA_UNIT_TARGET_MECHANICAL,
fExpireTime = ability.macropyre_expireTime,
bDeleteOnHit = false,
vVelocity = Vector( 0, 0, 0 ), -- Don't move!
bProvidesVision = false,
-- iVisionRadius = 0,
-- iVisionTeamNumber = caster:GetTeamNumber(),
} )
-- Create dummy to destroy trees
if i~=1 and GridNav:IsNearbyTree( projectilePos, pathRadius, true ) then
local dummy = CreateUnitByName( "npc_dota_thinker", projectilePos, false, caster, caster, caster:GetTeamNumber() )
ability:ApplyDataDrivenModifier( caster, dummy, dummyModifierName, {} )
end
end
end
--[[
Author: Ractidous
Data: 27.01.2015.
Apply a dummy modifier that periodcally checks whether the target is within the macropyre's path.
]]
function ApplyDummyModifier( event )
local caster = event.caster
local target = event.target
local ability = event.ability
local modifierName = event.modifier_name
local duration = ability.macropyre_expireTime - GameRules:GetGameTime()
ability:ApplyDataDrivenModifier( caster, target, modifierName, { duration = duration } )
end
--[[
Author: Ractidous
Date: 27.01.2015.
Check whether the target is within the path, and apply damage if neccesary.
]]
function CheckMacropyre( event )
local caster = event.caster
local target = event.target
local ability = event.ability
local pathRadius = event.path_radius
local damage = event.damage
local targetPos = target:GetAbsOrigin()
targetPos.z = 0
local distance = DistancePointSegment( targetPos, ability.macropyre_startPos, ability.macropyre_endPos )
if distance < pathRadius then
-- Apply damage
ApplyDamage( {
ability = ability,
attacker = caster,
victim = target,
damage = damage,
damage_type = ability:GetAbilityDamageType(),
} )
end
end
--[[
Author: Ractidous
Date: 27.01.2015.
Distance between a point and a segment.
]]
function DistancePointSegment( p, v, w )
local l = w - v
local l2 = l:Dot( l )
t = ( p - v ):Dot( w - v ) / l2
if t < 0.0 then
return ( v - p ):Length2D()
elseif t > 1.0 then
return ( w - p ):Length2D()
else
local proj = v + t * l
return ( proj - p ):Length2D()
end
end |
require 'torch'
require 'nn'
local CVAE = {}
function CVAE.create_encoder_network(x_size, y_size, z_size, hidden_size)
-- the encoder network
local encoder = nn.Sequential()
encoder:add(nn.JoinTable(1,1))
encoder:add(nn.Linear(x_size + y_size, hidden_size))
encoder:add(nn.ReLU(true))
-- construct mu and log variance in parallel
local mu_logv = nn.ConcatTable()
mu_logv:add(nn.Linear(hidden_size, z_size))
mu_logv:add(nn.Linear(hidden_size, z_size))
encoder:add(mu_logv)
return encoder
end
function CVAE.create_prior_network(x_size, z_size, hidden_size)
-- the prior network
local prior = nn.Sequential()
prior:add(nn.Linear(x_size, hidden_size))
prior:add(nn.ReLU(true))
-- construct mu and log variance in parallel
local mu_logv = nn.ConcatTable()
mu_logv:add(nn.Linear(hidden_size, z_size))
mu_logv:add(nn.Linear(hidden_size, z_size))
prior:add(mu_logv)
return prior
end
function CVAE.create_prior_gmm_network(x_size, z_size, k_size, hidden_size)
-- the prior network
local prior = nn.Sequential()
prior:add(nn.Linear(x_size, hidden_size))
prior:add(nn.ReLU(true))
-- construct mu and log variance
local mu_logv_pi = nn.ConcatTable()
for i = 1,2*k_size do
mu_logv_pi:add(nn.Linear(hidden_size, z_size))
end
-- construct weights
local pi_model = nn.Sequential()
pi_model:add(nn.Linear(hidden_size, k_size))
pi_model:add(nn.SoftMax())
mu_logv_pi:add(pi_model)
-- push everything into prior network
prior:add(mu_logv_pi)
return prior
end
function CVAE.create_decoder_network(x_size, y_size, z_size, hidden_size)
-- the decoder network
local decoder = nn.Sequential()
decoder:add(nn.JoinTable(1,1))
decoder:add(nn.Linear(x_size + z_size, hidden_size))
decoder:add(nn.ReLU(true))
decoder:add(nn.Linear(hidden_size, y_size))
decoder:add(nn.Sigmoid(true))
return decoder
end
return CVAE
|
--
-- tests/actions/vstudio/vc2010/test_filters.lua
-- Validate generation of filter blocks in Visual Studio 2010 C/C++ projects.
-- Copyright (c) 2011 Jason Perkins and the Premake project
--
T.vs2010_filters = { }
local suite = T.vs2010_filters
local vc2010 = premake.vstudio.vc2010
--
-- Setup/teardown
--
local sln, prj
local os_uuid
function suite.setup()
os_uuid = os.uuid
os.uuid = function() return "00112233-4455-6677-8888-99AABBCCDDEE" end
_ACTION = "vs2010"
sln, prj = test.createsolution()
end
function suite.teardown()
os.uuid = os_uuid
end
local function prepare()
premake.bake.buildconfigs()
sln.vstudio_configs = premake.vstudio.buildconfigs(sln)
end
--
-- Filter identifiers sections
--
function suite.UniqueIdentifiers_IsEmpty_OnRootFilesOnly()
files { "hello.c", "goodbye.c" }
prepare()
vc2010.filteridgroup(prj)
test.isemptycapture()
end
function suite.UniqueIdentifiers_MergeCommonSubfolders()
files { "src/hello.c", "src/goodbye.c" }
prepare()
vc2010.filteridgroup(prj)
test.capture [[
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{00112233-4455-6677-8888-99AABBCCDDEE}</UniqueIdentifier>
</Filter>
</ItemGroup>
]]
end
function suite.UniqueIdentifiers_ListAllSubfolders()
files { "src/hello.c", "src/departures/goodbye.c" }
prepare()
vc2010.filteridgroup(prj)
test.capture [[
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{00112233-4455-6677-8888-99AABBCCDDEE}</UniqueIdentifier>
</Filter>
<Filter Include="src\departures">
<UniqueIdentifier>{00112233-4455-6677-8888-99AABBCCDDEE}</UniqueIdentifier>
</Filter>
</ItemGroup>
]]
end
function suite.UniqueIdentifiers_ListVpaths()
files { "hello.c", "goodbye.c" }
vpaths { ["Source Files"] = "**.c" }
prepare()
vc2010.filteridgroup(prj)
test.capture [[
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{00112233-4455-6677-8888-99AABBCCDDEE}</UniqueIdentifier>
</Filter>
</ItemGroup>
]]
end
function suite.UniqueIdentifiers_ListRealAndVpaths()
files { "hello.h", "goodbye.c" }
vpaths { ["Source Files"] = "*.c", ["Header Files"] = "*.h" }
prepare()
vc2010.filteridgroup(prj)
test.capture [[
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{00112233-4455-6677-8888-99AABBCCDDEE}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{00112233-4455-6677-8888-99AABBCCDDEE}</UniqueIdentifier>
</Filter>
</ItemGroup>
]]
end
--
-- File/filter assignment tests
--
function suite.FileFilters_NoFilter_OnRootFile()
files { "hello.c", "goodbye.c" }
prepare()
vc2010.filefiltergroup(prj, "ClCompile")
test.capture [[
<ItemGroup>
<ClCompile Include="hello.c" />
<ClCompile Include="goodbye.c" />
</ItemGroup>
]]
end
function suite.FileFilters_NoFilter_OnRealPath()
files { "src/hello.c" }
prepare()
vc2010.filefiltergroup(prj, "ClCompile")
test.capture [[
<ItemGroup>
<ClCompile Include="src\hello.c">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
]]
end
function suite.FileFilters_HasFilter_OnVpath()
files { "src/hello.c" }
vpaths { ["Source Files"] = "**.c" }
prepare()
vc2010.filefiltergroup(prj, "ClCompile")
test.capture [[
<ItemGroup>
<ClCompile Include="src\hello.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
]]
end
function suite.FileFilters_OnIncludeSection()
files { "hello.c", "hello.h", "hello.rc", "hello.txt" }
prepare()
vc2010.filefiltergroup(prj, "ClInclude")
test.capture [[
<ItemGroup>
<ClInclude Include="hello.h" />
</ItemGroup>
]]
end
function suite.FileFilters_OnResourceSection()
files { "hello.c", "hello.h", "hello.rc", "hello.txt" }
prepare()
vc2010.filefiltergroup(prj, "ResourceCompile")
test.capture [[
<ItemGroup>
<ResourceCompile Include="hello.rc" />
</ItemGroup>
]]
end
function suite.FileFilters_OnNoneSection()
files { "hello.c", "hello.h", "hello.rc", "hello.txt" }
prepare()
vc2010.filefiltergroup(prj, "None")
test.capture [[
<ItemGroup>
<None Include="hello.txt" />
</ItemGroup>
]]
end
|
data:extend(
{
{
-- region-cloner_Selection-Tool
type = "selection-tool",
name = "region-cloner_selection-tool",
icon_size = 128,
icon = "__region-cloner__/graphics/lazy-bastard.png",
flags = {"goes-to-quickbar", "hidden"},
subgroup = "tool",
order = "a",
stack_size = 1,
selection_color = {r = 0, g = 1, b = 0},
selection_mode = {"any-tile"},
selection_cursor_box_type = "entity",
alt_selection_color = {r = 1, g = 0, b = 0},
alt_selection_mode = {"any-entity", "deconstruct"},
alt_selection_cursor_box_type = "not-allowed",
always_include_tiles = true
}
})
|
-- Returns a single function, `typecheck`, that acts as a decorator to add type
-- checking to other functions.
-- `typecheck`'s parameters are a list describing the types accepted by the
-- decorated function, and may be:
-- * A string of a Lua type, to match that type, or 'any', to match anything
-- * A function taking the value, argument position, and argument count, with
-- the last two provided for formatting errors, expecting the function to
-- return success, a description of the expected value, and a description of
-- the received value
-- * A table to check a set of the above two
-- * '*' or '+' in the last position to indicate 0-or-more or 1-or-more
-- repetition of the previous argument, respectively
-- For example:
-- local addAsNumber = typecheck('number', 'string') .. function(a, b)
-- return a + tonumber(b)
-- end
-- Obviously that is a bit trivial, but it becomes more useful when you want to
-- detect type errors at the edge of an API rather than in the middle of a call
-- `typecheck` is bootstrapped onto itself if you want to see an example of a
-- function to check arguments
-- Typechecking can be disabled into a no-op by setting TYPECHECK_DISABLE to a
-- truthy value. There will then be no overhead to function calls which are
-- otherwise decorated.
if _G.TYPECHECK_DISABLE then
local t = setmetatable({}, {
__concat = function(t, f)
return f
end
})
return function()
return t
end
end
local errors = assert(require('errors'))
-- True if the argument is a value that `type(x)` can return for any x.
local is_lua_type = function(s)
return s == 'boolean' or s == 'function' or s == 'nil' or s == 'number'
or s == 'string' or s == 'table' or s == 'thread' or s == 'userdata'
end
local mt = {
__concat = function(t, f)
-- Wrap the function we just received
return function(...)
local nargs = select('#', ...)
if t.rules[t.rules.n] == '*' then
-- If the rule is a star, it can be zero or more of the last type, so subtract 2 for the star and last type
if nargs < t.rules.n - 2 then
errors.bad_argument(nargs + 1, string.format('at least %d argument(s)', t.rules.n - 2), string.format('%d argument(s)', nargs))
end
elseif t.rules[t.rules.n] == '+' then
-- If the rule is a plus, it can be one or more of the last type, so subtract 1 for the plus
if nargs < t.rules.n - 1 then
errors.bad_argument(nargs + 1, string.format('at least %d argument(s)', t.rules.n - 1), string.format('%d argument(s)', nargs))
end
else
-- The last rule is a regular one, so check both sides
if nargs < t.rules.n then
-- If we have too few arguments, the error is on the argument we didn't provide
errors.bad_argument(nargs + 1, string.format('%d argument(s)', t.rules.n), string.format('%d argument(s)', nargs))
elseif nargs > t.rules.n then
-- If we have too many argument, the error is on the argument after the last rule
errors.bad_argument(t.rules.n + 1, string.format('%d argument(s)', t.rules.n), string.format('%d argument(s)', nargs))
end
end
-- We iterate the rules separately to allow repetition
local current_rule = 1
-- Iterate over the arguments we received in the wrapped call
for i = 1, nargs do
local arg = select(i, ...)
local arg_type = type(arg)
-- This goto is used for repetition at the end, allowing us to check the same argument by backing up and repeating a rule check
::begin_check::
local rule = t.rules[current_rule]
local ty = type(rule)
if ty == 'function' then
local success, expected, got = rule(arg, i, nargs)
if not success then
errors.bad_argument(i, expected, got)
end
elseif ty == 'string' then
if rule == '*' or rule == '+' then
-- These exist only at the end, back up the rule we're looking at and repeat
current_rule = current_rule - 1
goto begin_check
elseif rule ~= 'any' then
-- If we don't allow anything,
if arg_type ~= rule then
-- Then it has to be a Lua type
errors.bad_argument(i, rule, arg_type)
end
end
else --ty == 'table'
-- We'll build up a list of failed items to use in the case of everything failing
local passed = false
local expectations = {}
for j, subrule in ipairs(rule) do
-- The internal rules are pretty much like above, but this time as elements of the table,
-- so we'll iterate over those independently
if type(subrule) == 'function' then
local success, expected = subrule(arg, i, nargs)
if success then
passed = true
break
else
expectations[j] = expected
end
else --type(subrule) == 'string'
if arg_type == subrule then
passed = true
break
else
expectations[j] = subrule
end
end
end
if not passed then
errors.bad_argument(i, table.concat(expectations, ' or '), arg_type)
end
end
current_rule = current_rule + 1
end
-- Everything passed, finally return the result of the function call
return f(...)
end
end
}
return (function(f)
-- `f` is the function which constructs rules tables for the validator
-- Bootstrap typechecking onto these functions which are an API,
-- had to wait
mt.__concat = f('table', 'function') .. mt.__concat
errors.bad_argument = f('number', 'string', 'string') .. errors.bad_argument
-- Validates the arguments to typecheck
local check = function(rule, i, nargs)
local ty = type(rule)
if ty == 'string' then
if rule == '*' or rule == '+' then
-- Repetition has to come at the end
if i == 1 or i ~= nargs then
return false, 'repetition after arguments', 'it before'
end
elseif not is_lua_type(rule) and rule ~= 'any' then
-- Or has to be a Lua type or any
return false, 'lua type or repetition', rule
end
elseif ty == 'table' then
if #rule < 1 then
return false, 'table with 1 or more elements', 'table with 0 elements'
end
for j, subrule in ipairs(rule) do
-- Tables act mostly like above, but no repetition since they're a set
local ty = type(subrule)
if ty == 'string' then
if not is_lua_type(subrule) then
return false, string.format('lua type at index %d', j), subrule
end
elseif ty ~= 'function' then
return false, string.format('function or string at index %d', j), ty
end
end
elseif ty ~= 'function' then
return false, 'function or string or table', ty
end
-- Everything passed
return true
end
-- And now wrap the rules construction function (`typecheck`) itself
return f(check, '*') .. f
end)(function(...)
-- Construct the structure used by the verification function
return setmetatable({
rules = {n = select('#', ...), ...},
}, mt)
end)
|
--[[
file:cx_system.lua
desc:策略
auth:Carol Luo
]]
local class = require("class")
local pokerSystem = require("poker.system")
---@class cx_system:pokerSystem
local cx_system = class(pokerSystem)
local this = cx_system
---构造
function cx_system:ctor()
end
return cx_system |
data:extend({
{
type = "item",
name = "crusher-1",
icon = "__Engineersvsenvironmentalist__/graphics/icons/processors/crusher.png",
flags = {"goes-to-quickbar"},
subgroup = "basic-crushing",
order = "f",
place_result = "crusher-1",
stack_size = 50
},
{
type = "recipe",
name = "crusher-1",
ingredients = {
{"wall", 1},
{"iron-gear-wheel",4},
{"stupid-ai",1},
},
enabled = true,
result = "crusher-1"
},
{
type = "assembling-machine",
name = "crusher-1",
icon = "__Engineersvsenvironmentalist__/graphics/icons/processors/crusher.png",
flags = {"placeable-neutral", "placeable-player", "player-creation"},
minable = {mining_time = 1, result = "crusher-1"},
max_health = 250,
corpse = "big-remnants",
resistances =
{
{
type = "fire",
percent = 80
}
},
collision_box = {{-1.2, -1.2}, {1.2, 1.2}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
module_specification =
{
module_slots = 1,
module_info_icon_shift = {0, 0.5},
module_info_multi_row_initial_height_modifier = -0.3
},
ingredient_count = 1,
result_inventory_size = 5,
crafting_speed = 0.1,
crafting_categories = {"crusher"},
energy_usage = "131MW",
energy_source =
{
type = "burner",
effectivity = 1,
fuel_inventory_size = 1,
emissions = 0.0000013740,
smoke =
{
{
name = "smoke",
deviation = {0.1, 0.1},
frequency = 3
}
}
},
working_sound =
{
sound =
{
filename = "__base__/sound/electric-furnace.ogg",
volume = 0.7
},
apparent_volume = 1.5
},
animation =
{
filename = "__Engineersvsenvironmentalist__/graphics/entity/processors/crusher-base.png",
priority = "high",
width = 129,
height = 100,
frame_count = 1,
shift = {0.421875, 0}
},
working_visualisations = {
animation =
{
filename = "__Engineersvsenvironmentalist__/graphics/entity/processors/crusher-gears.png",
priority = "high",
width = 25,
height = 15,
frame_count = 4,
animation_speed = 0.2,
shift = {0.015625, 0.890625}
}
},
fast_replaceable_group = "crusher",
allowed_effects = {"consumption", "speed", "productivity"},
}
})
data:extend({
{
type = "item",
name = "crusher-2",
icon = "__Engineersvsenvironmentalist__/graphics/icons/processors/crusher.png",
flags = {"goes-to-quickbar"},
subgroup = "basic-crushing",
order = "f",
place_result = "crusher-2",
stack_size = 50
},
{
type = "recipe",
name = "crusher-2",
ingredients = {
{"wall", 500},
{"iron-gear-wheel",2000},
{"small-ai",1},
},
enabled = false,
result = "crusher-2"
},
{
type = "assembling-machine",
name = "crusher-2",
icon = "__Engineersvsenvironmentalist__/graphics/icons/processors/crusher.png",
flags = {"placeable-neutral", "placeable-player", "player-creation"},
minable = {mining_time = 1, result = "crusher-2"},
max_health = 250,
corpse = "big-remnants",
resistances =
{
{
type = "fire",
percent = 80
}
},
collision_box = {{-1.2, -1.2}, {1.2, 1.2}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
module_specification =
{
module_slots = 1,
module_info_icon_shift = {0, 0.5},
module_info_multi_row_initial_height_modifier = -0.3
},
ingredient_count = 1,
result_inventory_size = 5,
crafting_speed = 1,
crafting_categories = {"crusher"},
energy_usage = "375MW",
energy_source =
{
type = "burner",
effectivity = 1,
fuel_inventory_size = 1,
emissions = 0.000013740,
smoke =
{
{
name = "smoke",
deviation = {0.1, 0.1},
frequency = 3
}
}
},
working_sound =
{
sound =
{
filename = "__base__/sound/electric-furnace.ogg",
volume = 0.7
},
apparent_volume = 1.5
},
animation =
{
filename = "__Engineersvsenvironmentalist__/graphics/entity/processors/crusher-base.png",
priority = "high",
width = 129,
height = 100,
frame_count = 1,
shift = {0.421875, 0}
},
working_visualisations = {
animation =
{
filename = "__Engineersvsenvironmentalist__/graphics/entity/processors/crusher-gears.png",
priority = "high",
width = 25,
height = 15,
frame_count = 4,
animation_speed = 0.2,
shift = {0.015625, 0.890625}
}
},
fast_replaceable_group = "crusher",
allowed_effects = {"consumption", "speed", "productivity"},
}
})
data:extend({
{
type = "item",
name = "crusher-3",
icon = "__Engineersvsenvironmentalist__/graphics/icons/processors/crusher.png",
flags = {"goes-to-quickbar"},
subgroup = "basic-crushing",
order = "f",
place_result = "crusher-3",
stack_size = 50
},
{
type = "recipe",
name = "crusher-3",
ingredients = {
{"wall", 3000},
{"iron-gear-wheel",20000},
{"small-ai",1},
},
enabled = false,
result = "crusher-3"
},
{
type = "assembling-machine",
name = "crusher-3",
icon = "__Engineersvsenvironmentalist__/graphics/icons/processors/crusher.png",
flags = {"placeable-neutral", "placeable-player", "player-creation"},
minable = {mining_time = 1, result = "crusher-3"},
max_health = 250,
corpse = "big-remnants",
resistances =
{
{
type = "fire",
percent = 80
}
},
collision_box = {{-1.2, -1.2}, {1.2, 1.2}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
module_specification =
{
module_slots = 3,
module_info_icon_shift = {0, 0.5},
module_info_multi_row_initial_height_modifier = -0.3
},
ingredient_count = 1,
result_inventory_size = 5,
crafting_speed = 5,
crafting_categories = {"crusher"},
energy_usage = "3750MW",
energy_source =
{
type = "electric",
usage_priority = "secondary-input",
emissions = 0.000007200,
},
working_sound =
{
sound =
{
filename = "__base__/sound/electric-furnace.ogg",
volume = 0.7
},
apparent_volume = 1.5
},
animation =
{
filename = "__Engineersvsenvironmentalist__/graphics/entity/processors/crusher-base.png",
priority = "high",
width = 129,
height = 100,
frame_count = 1,
shift = {0.421875, 0}
},
working_visualisations = {
animation =
{
filename = "__Engineersvsenvironmentalist__/graphics/entity/processors/crusher-gears.png",
priority = "high",
width = 25,
height = 15,
frame_count = 4,
animation_speed = 0.2,
shift = {0.015625, 0.890625}
}
},
fast_replaceable_group = "crusher",
allowed_effects = {"consumption", "speed", "productivity"},
}
})
data:extend({
{
type = "item",
name = "crusher-4",
icon = "__Engineersvsenvironmentalist__/graphics/icons/processors/crusher.png",
flags = {"goes-to-quickbar"},
subgroup = "basic-crushing",
order = "f",
place_result = "crusher-4",
enabled = false,
stack_size = 50
},
{
type = "recipe",
name = "crusher-4",
ingredients = {
{"wall", 5000},
{"advanced-machine-parts",30000},
{"small-ai",1},
},
enabled = false,
result = "crusher-4"
},
{
type = "assembling-machine",
name = "crusher-4",
icon = "__Engineersvsenvironmentalist__/graphics/icons/processors/crusher.png",
flags = {"placeable-neutral", "placeable-player", "player-creation"},
minable = {mining_time = 1, result = "crusher-3"},
max_health = 250,
corpse = "big-remnants",
resistances =
{
{
type = "fire",
percent = 80
}
},
collision_box = {{-1.2, -1.2}, {1.2, 1.2}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
module_specification =
{
module_slots = 1,
module_info_icon_shift = {0, 0.5},
module_info_multi_row_initial_height_modifier = -0.3
},
ingredient_count = 1,
result_inventory_size = 5,
crafting_speed = 25,
crafting_categories = {"crusher"},
energy_usage = "9990MW",
energy_source =
{
type = "electric",
usage_priority = "secondary-input",
emissions = 0.000007206,
},
working_sound =
{
sound =
{
filename = "__base__/sound/electric-furnace.ogg",
volume = 0.7
},
apparent_volume = 1.5
},
animation =
{
filename = "__Engineersvsenvironmentalist__/graphics/entity/processors/crusher-base.png",
priority = "high",
width = 129,
height = 100,
frame_count = 1,
shift = {0.421875, 0}
},
working_visualisations = {
animation =
{
filename = "__Engineersvsenvironmentalist__/graphics/entity/processors/crusher-gears.png",
priority = "high",
width = 25,
height = 15,
frame_count = 4,
animation_speed = 0.2,
shift = {0.015625, 0.890625}
}
},
fast_replaceable_group = "crusher",
allowed_effects = {"consumption", "speed", "productivity"},
}
}) |
bt = require("bullet")
local player={}
-- bcanvas = love.graphics.newCanvas( 20, 70 )
-- bcanvas:renderTo(function()
-- love.graphics.setColor(255, 255, 255)
-- love.graphics.rectangle("fill", 1, 1, 19, 69)
-- end);
local function drawbullet(v)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(bimg, v.x, v.y, v.angle, 0.54, 0.17, -20, 50)
-- love.graphics.setColor(255, 0, 0, 255)
-- love.graphics.rectangle("line",v.x,v.y,10,10)
end
function player.create(tab)love.graphics.setColor(255, 255, 255, 255)
for k,v in pairs(tab) do
player[k] = v
end
end
function player.fire(self,x,y)
bt:add({x=self.x,y=self.y,angle=self.fangle,speed=600,type=player_bullet_type})
end
function player.draw(self)
love.graphics.setColor(150, 150, 150, 255)
local k,ox,oy=0.97,3*(1-2*self.x/love.graphics.getWidth()),3*(1-2*self.y/love.graphics.getHeight())
love.graphics.draw(pp[self.hp],self.x+ox,self.y+oy,self.fangle+math.pi/2,0.44*k,0.44*k,37,89)
local k,ox,oy=0.98,2*(1-2*self.x/love.graphics.getWidth()),2*(1-2*self.y/love.graphics.getHeight())
love.graphics.draw(pp[self.hp],self.x+ox,self.y+oy,self.fangle+math.pi/2,0.44*k,0.44*k,37,89)
local k,ox,oy=0.99,1*(1-2*self.x/love.graphics.getWidth()),1*(1-2*self.y/love.graphics.getHeight())
love.graphics.draw(pp[self.hp],self.x+ox,self.y+oy,self.fangle+math.pi/2,0.44*k,0.44*k,37,89)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(pp[self.hp],self.x,self.y,self.fangle+math.pi/2,0.44,0.44,37,89)
-- love.graphics.line(self.x, self.y, self.x+100*math.cos(self.fangle), self.y+100*math.sin(self.fangle))
end
function player.limit(self)
self.x = math.min(self.x, love.graphics.getWidth()-5)
self.x = math.max(self.x, 5)
self.y = math.min(self.y, love.graphics.getHeight()-5)
self.y = math.max(self.y, 5)
end
function player.init(self)
player_bullet_type = bt.addtype(drawbullet,10,10)
pp = {
love.graphics.newImage("res/player/hp1.png"),
love.graphics.newImage("res/player/hp2.png"),
love.graphics.newImage("res/player/hp3.png")
}
bimg = love.graphics.newImage("res/100_100.png")
end
return player
|
if not modules then modules = { } end modules ['mtx-fonts'] = {
version = 1.001,
comment = "companion to mtxrun.lua",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
local getargument = environment.getargument
local setargument = environment.setargument
local givenfiles = environment.files
local suffix, addsuffix, removesuffix, replacesuffix = file.suffix, file.addsuffix, file.removesuffix, file.replacesuffix
local nameonly, basename, joinpath, collapsepath = file.nameonly, file.basename, file.join, file.collapsepath
local lower = string.lower
local concat = table.concat
local write_nl = texio.write_nl
local otlversion = 3.103
local helpinfo = [[
<?xml version="1.0"?>
<application>
<metadata>
<entry name="name">mtx-fonts</entry>
<entry name="detail">ConTeXt Font Database Management</entry>
<entry name="version">1.00</entry>
</metadata>
<flags>
<category name="basic">
<subcategory>
<flag name="convert"><short>save open type font in raw table</short></flag>
<flag name="unpack"><short>save a tma file in a more readable format</short></flag>
</subcategory>
<subcategory>
<flag name="reload"><short>generate new font database (use <ref name="force"/> when in doubt)</short></flag>
<flag name="reload"><short><ref name="simple"/>:generate luatex-fonts-names.lua (not for context!)</short></flag>
</subcategory>
<subcategory>
<flag name="list"><short><ref name="name"/>: list installed fonts, filter by name [<ref name="pattern"/>]</short></flag>
<flag name="list"><short><ref name="spec"/>: list installed fonts, filter by spec [<ref name="filter"/>]</short></flag>
<flag name="list"><short><ref name="file"/>: list installed fonts, filter by file [<ref name="pattern"/>]</short></flag>
</subcategory>
<subcategory>
<flag name="pattern" value="str"><short>filter files using pattern</short></flag>
<flag name="filter" value="list"><short>key-value pairs</short></flag>
<flag name="all"><short>show all found instances (combined with other flags)</short></flag>
<flag name="info"><short>give more details</short></flag>
<flag name="trackers" value="list"><short>enable trackers</short></flag>
<flag name="statistics"><short>some info about the database</short></flag>
<flag name="names"><short>use name instead of unicodes</short></flag>
<flag name="cache" value="str"><short>use specific cache (otl or otf)</short></flag>
</subcategory>
</category>
</flags>
<examples>
<category>
<title>Examples</title>
<subcategory>
<example><command>mtxrun --script font --list somename (== --pattern=*somename*)</command></example>
</subcategory>
<subcategory>
<example><command>mtxrun --script font --list --name somename</command></example>
<example><command>mtxrun --script font --list --name --pattern=*somename*</command></example>
</subcategory>
<subcategory>
<example><command>mtxrun --script font --list --spec somename</command></example>
<example><command>mtxrun --script font --list --spec somename-bold-italic</command></example>
<example><command>mtxrun --script font --list --spec --pattern=*somename*</command></example>
<example><command>mtxrun --script font --list --spec --filter="fontname=somename"</command></example>
<example><command>mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed"</command></example>
<example><command>mtxrun --script font --list --spec --filter="familyname=crap*,weight=bold,style=italic"</command></example>
</subcategory>
<subcategory>
<example><command>mtxrun --script font --list --all</command></example>
<example><command>mtxrun --script font --list --file somename</command></example>
<example><command>mtxrun --script font --list --file --all somename</command></example>
<example><command>mtxrun --script font --list --file --pattern=*somename*</command></example>
</subcategory>
<subcategory>
<example><command>mtxrun --script font --convert texgyrepagella-regular.otf</command></example>
<example><command>mtxrun --script font --convert --names texgyrepagella-regular.otf</command></example>
</subcategory>
</category>
</examples>
</application>
]]
local application = logs.application {
name = "mtx-fonts",
banner = "ConTeXt Font Database Management 0.21",
helpinfo = helpinfo,
}
local report = application.report
-- todo: fc-cache -v en check dirs, or better is: fc-cat -v | grep Directory
if not fontloader then fontloader = fontforge end
local function loadmodule(filename)
local fullname = resolvers.findfile(filename,"tex")
if fullname and fullname ~= "" then
dofile(fullname)
end
end
-- loader code
loadmodule("char-def.lua")
loadmodule("font-ini.lua")
loadmodule("font-log.lua")
loadmodule("font-con.lua")
loadmodule("font-cft.lua")
loadmodule("font-enc.lua")
loadmodule("font-agl.lua")
loadmodule("font-cid.lua")
loadmodule("font-map.lua")
loadmodule("font-oti.lua")
loadmodule("font-otr.lua")
loadmodule("font-cff.lua")
loadmodule("font-ttf.lua")
loadmodule("font-tmp.lua")
loadmodule("font-dsp.lua")
loadmodule("font-oup.lua")
loadmodule("font-otl.lua")
loadmodule("font-onr.lua")
-- extra code
loadmodule("font-syn.lua")
loadmodule("font-trt.lua")
loadmodule("font-mis.lua")
scripts = scripts or { }
scripts.fonts = scripts.fonts or { }
function fonts.names.statistics()
fonts.names.load()
local data = fonts.names.data
local statistics = data.statistics
local function counted(t)
local n = { }
for k, v in next, t do
n[k] = table.count(v)
end
return table.sequenced(n)
end
report("cache uuid : %s", data.cache_uuid)
report("cache version : %s", data.cache_version)
report("number of trees : %s", #data.datastate)
report()
report("number of fonts : %s", statistics.fonts or 0)
report("used files : %s", statistics.readfiles or 0)
report("skipped files : %s", statistics.skippedfiles or 0)
report("duplicate files : %s", statistics.duplicatefiles or 0)
report("specifications : %s", #data.specifications)
report("families : %s", table.count(data.families))
report()
report("mappings : %s", counted(data.mappings))
report("fallbacks : %s", counted(data.fallbacks))
report()
report("used styles : %s", table.sequenced(statistics.used_styles))
report("used variants : %s", table.sequenced(statistics.used_variants))
report("used weights : %s", table.sequenced(statistics.used_weights))
report("used widths : %s", table.sequenced(statistics.used_widths))
report()
report("found styles : %s", table.sequenced(statistics.styles))
report("found variants : %s", table.sequenced(statistics.variants))
report("found weights : %s", table.sequenced(statistics.weights))
report("found widths : %s", table.sequenced(statistics.widths))
end
function fonts.names.simple(alsotypeone)
local simpleversion = 1.001
local simplelist = { "ttf", "otf", "ttc", alsotypeone and "afm" or nil }
local name = "luatex-fonts-names.lua"
local path = collapsepath(caches.getwritablepath("..","..","generic","fonts","data"))
fonts.names.filters.list = simplelist
fonts.names.version = simpleversion -- this number is the same as in font-dum.lua
report("generating font database for 'luatex-fonts' version %s",fonts.names.version)
fonts.names.identify(true)
local data = fonts.names.data
if data then
local simplemappings = { }
local simplified = {
mappings = simplemappings,
version = simpleversion,
cache_version = simpleversion,
}
local specifications = data.specifications
for i=1,#simplelist do
local format = simplelist[i]
for tag, index in next, data.mappings[format] do
local s = specifications[index]
simplemappings[tag] = { s.rawname or nameonly(s.filename), s.filename, s.subfont }
end
end
if environment.arguments.nocache then
report("not using cache path %a",path)
else
dir.mkdirs(path)
if lfs.isdir(path) then
report("saving names on cache path %a",path)
name = joinpath(path,name)
else
report("invalid cache path %a",path)
end
end
report("saving names in %a",name)
io.savedata(name,table.serialize(simplified,true))
local data = io.loaddata(resolvers.findfile("luatex-fonts-syn.lua","tex")) or ""
local dummy = string.match(data,"fonts%.names%.version%s*=%s*([%d%.]+)")
if tonumber(dummy) ~= simpleversion then
report("warning: version number %s in 'font-dum' does not match database version number %s",dummy or "?",simpleversion)
end
elseif lfs.isfile(name) then
os.remove(name)
end
end
function scripts.fonts.reload()
if getargument("simple") then
fonts.names.simple(getargument("typeone"))
else
fonts.names.load(true,getargument("force"))
end
end
local function fontweight(fw)
if fw then
return string.format("conflict: %s", fw)
else
return ""
end
end
local function indeed(f,s)
if s and s ~= "" then
report(f,s)
end
end
local function showfeatures(tag,specification)
report()
indeed("mapping : %s",tag)
indeed("fontname : %s",specification.fontname)
indeed("fullname : %s",specification.fullname)
indeed("filename : %s",specification.filename)
indeed("family : %s",specification.familyname or "<nofamily>")
-- indeed("subfamily : %s",specification.subfamilyname or "<nosubfamily>")
indeed("weight : %s",specification.weight or "<noweight>")
indeed("style : %s",specification.style or "<nostyle>")
indeed("width : %s",specification.width or "<nowidth>")
indeed("variant : %s",specification.variant or "<novariant>")
indeed("subfont : %s",specification.subfont or "")
indeed("fweight : %s",fontweight(specification.fontweight))
-- maybe more
local instancenames = specification.instancenames
if instancenames then
report()
indeed("instances : % t",instancenames)
end
local features = fonts.helpers.getfeatures(specification.filename,not getargument("nosave"))
if features then
for what, v in table.sortedhash(features) do
local data = features[what]
if data and next(data) then
report()
report("%s features:",what)
report()
report("feature script languages")
report()
for f,ff in table.sortedhash(data) do
local done = false
for s, ss in table.sortedhash(ff) do
if s == "*" then s = "all" end
if ss ["*"] then ss["*"] = nil ss.all = true end
if done then
f = ""
else
done = true
end
report("% -8s % -8s % -8s",f,s,concat(table.sortedkeys(ss), " ")) -- todo: padd 4
end
end
end
end
else
report("no features")
end
report()
collectgarbage("collect")
end
local function reloadbase(reload)
if reload then
report("fontnames, reloading font database")
names.load(true,getargument("force"))
report("fontnames, done\n\n")
end
end
local function list_specifications(t,info)
if t then
local s = table.sortedkeys(t)
if info then
for k=1,#s do
local v = s[k]
showfeatures(v,t[v])
end
else
for k=1,#s do
local v = s[k]
local entry = t[v]
s[k] = {
entry.familyname or "<nofamily>",
-- entry.subfamilyname or "<nosubfamily>",
entry.weight or "<noweight>",
entry.style or "<nostyle>",
entry.width or "<nowidth>",
entry.variant or "<novariant>",
entry.fontname,
entry.filename,
entry.subfont or "",
fontweight(entry.fontweight),
}
end
table.insert(s,1,{"familyname","weight","style","width","variant","fontname","filename","subfont","fontweight"})
table.insert(s,2,{"","","","","","","","",""})
utilities.formatters.formatcolumns(s)
for k=1,#s do
write_nl(s[k])
end
end
end
end
local function list_matches(t,info)
if t then
local s, w = table.sortedkeys(t), { 0, 0, 0, 0 }
if info then
for k=1,#s do
local v = s[k]
showfeatures(v,t[v])
collectgarbage("collect") -- in case we load a lot
end
else
for k=1,#s do
local v = s[k]
local entry = t[v]
s[k] = {
v,
entry.familyname,
entry.fontname,
entry.filename,
tostring(entry.subfont or ""),
concat(entry.instancenames or { }, " "),
}
end
table.insert(s,1,{"identifier","familyname","fontname","filename","subfont","instances"})
table.insert(s,2,{"","","","","","",""})
utilities.formatters.formatcolumns(s)
for k=1,#s do
write_nl(s[k])
end
end
end
end
function scripts.fonts.list()
local all = getargument("all")
local info = getargument("info")
local reload = getargument("reload")
local pattern = getargument("pattern")
local filter = getargument("filter")
local given = givenfiles[1]
reloadbase(reload)
if getargument("name") then
if pattern then
--~ mtxrun --script font --list --name --pattern=*somename*
list_matches(fonts.names.list(string.topattern(pattern,true),reload,all),info)
elseif filter then
report("not supported: --list --name --filter",name)
elseif given then
--~ mtxrun --script font --list --name somename
list_matches(fonts.names.list(given,reload,all),info)
else
report("not supported: --list --name <no specification>",name)
end
elseif getargument("spec") then
if pattern then
--~ mtxrun --script font --list --spec --pattern=*somename*
report("not supported: --list --spec --pattern",name)
elseif filter then
--~ mtxrun --script font --list --spec --filter="fontname=somename"
list_specifications(fonts.names.getlookups(filter),info)
elseif given then
--~ mtxrun --script font --list --spec somename
list_specifications(fonts.names.collectspec(given,reload,all),info)
else
report("not supported: --list --spec <no specification>",name)
end
elseif getargument("file") then
if pattern then
--~ mtxrun --script font --list --file --pattern=*somename*
list_specifications(fonts.names.collectfiles(string.topattern(pattern,true),reload,all),info)
elseif filter then
report("not supported: --list --spec",name)
elseif given then
--~ mtxrun --script font --list --file somename
list_specifications(fonts.names.collectfiles(given,reload,all),info)
else
report("not supported: --list --file <no specification>",name)
end
elseif pattern then
--~ mtxrun --script font --list --pattern=*somename*
list_matches(fonts.names.list(string.topattern(pattern,true),reload,all),info)
elseif given then
--~ mtxrun --script font --list somename
list_matches(fonts.names.list(given,reload,all),info)
elseif all then
pattern = "*"
list_matches(fonts.names.list(string.topattern(pattern,true),reload,all),info)
else
report("not supported: --list <no specification>",name)
end
end
function scripts.fonts.unpack()
local name = removesuffix(basename(givenfiles[1] or ""))
if name and name ~= "" then
local cacheid = getargument("cache") or "otl"
local cache = containers.define("fonts", cacheid, otlversion, true) -- cache is temp
local cleanname = containers.cleanname(name)
local data = containers.read(cache,cleanname)
if data then
local savename = addsuffix(cleanname .. "-unpacked","tma")
report("fontsave, saving data in %s",savename)
if data.creator == "context mkiv" then
fonts.handlers.otf.readers.unpack(data)
end
io.savedata(savename,table.serialize(data,true))
else
report("unknown file %a in cache %a",name,cacheid)
end
end
end
function scripts.fonts.convert() -- new save
local name = givenfiles[1] or ""
local sub = givenfiles[2] or ""
if name and name ~= "" then
local filename = resolvers.findfile(name) -- maybe also search for opentype
if filename and filename ~= "" then
local suffix = lower(suffix(filename))
if suffix == 'ttf' or suffix == 'otf' or suffix == 'ttc' then
local data = fonts.handlers.otf.readers.loadfont(filename,sub)
if data then
fonts.handlers.otf.readers.compact(data)
fonts.handlers.otf.readers.rehash(data,getargument("names") and "names" or "unicodes")
local savename = replacesuffix(lower(data.metadata.fullname or filename),"lua")
table.save(savename,data)
report("font: %a saved as %a",filename,savename)
else
report("font: %a not loaded",filename)
end
else
report("font: %a not saved",filename)
end
else
report("font: %a not found",name)
end
else
report("font: no name given")
end
end
if getargument("names") then
setargument("reload",true)
setargument("simple",true)
end
if getargument("list") then
scripts.fonts.list()
elseif getargument("reload") then
scripts.fonts.reload()
elseif getargument("convert") then
scripts.fonts.convert()
elseif getargument("unpack") then
scripts.fonts.unpack()
elseif getargument("statistics") then
fonts.names.statistics()
elseif getargument("exporthelp") then
application.export(getargument("exporthelp"),givenfiles[1])
else
application.help()
end
|
-------------------- HELPERS -------------------------------
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
local g = vim.g -- a table to access global variables
local opt = vim.opt -- to set options
local function map(mode, lhs, rhs, opts)
local options = {noremap = true}
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
-------------------- PLUGINS -------------------------------
cmd 'packadd paq-nvim' -- load the package manager
require('paq-nvim') {
{'savq/paq-nvim', opt = true}; -- paq-nvim manages itself
-- tree-sitter
'nvim-treesitter/nvim-treesitter';
--
-- Comments
'terrortylor/nvim-comment';
-- telescope
'nvim-lua/popup.nvim';
'nvim-lua/plenary.nvim';
'nvim-telescope/telescope.nvim';
-- lsp
'neovim/nvim-lspconfig';
'neovim/nvim-lspconfig';
'kabouzeid/nvim-lspinstall';
'glepnir/lspsaga.nvim';
'folke/trouble.nvim';
-- colors, colors, colors and icons
'kyazdani42/nvim-web-devicons';
'norcalli/nvim-base16.lua';
}
-------------------- OPTIONS -------------------------------
opt.completeopt = {'menuone', 'noinsert', 'noselect'} -- Completion options (for deoplete)
opt.expandtab = true -- Use spaces instead of tabs
opt.hidden = true -- Enable background buffers
opt.ignorecase = true -- Ignore case
opt.joinspaces = false -- No double spaces with join
opt.list = true -- Show some invisible characters
opt.number = true -- Show line numbers
opt.relativenumber = true -- Relative line numbers
opt.scrolloff = 4 -- Lines of context
opt.shiftround = true -- Round indent
opt.shiftwidth = 2 -- Size of an indent
opt.sidescrolloff = 8 -- Columns of context
opt.smartcase = true -- Do not ignore case with capitals
opt.smartindent = true -- Insert indents automatically
opt.splitbelow = true -- Put new windows below current
opt.splitright = true -- Put new windows right of current
opt.tabstop = 2 -- Number of spaces tabs count for
opt.termguicolors = true -- True color support
opt.wrap = false -- Disable line wrap
-------------------- Color Management ------------------------------
-- this is set by base16-manager
cmd 'let g:nvcode_termcolors=256'
local base16 = require 'base16'
base16(base16.themes[vim.env.BASE16_THEME or "3024"], true)
-------------------- MAPPINGS ------------------------------
g.mapleader = ','
map('', '<leader>c', '"+y') -- Copy to clipboard in normal, visual, select and operator modes
-- <Tab> to navigate the completion menu
map('i', '<S-Tab>', 'pumvisible() ? "\\<C-p>" : "\\<Tab>"', {expr = true})
map('i', '<Tab>', 'pumvisible() ? "\\<C-n>" : "\\<Tab>"', {expr = true})
-- Save!
map('', '<C-s>', '<esc>:w<cr>')
map('i', '<C-s>', '<esc>:w<cr>')
map('n', '<C-l>', '<cmd>noh<CR>') -- Clear highlights
map('n', '<leader>o', 'm`o<Esc>``') -- Insert a newline in normal mode
-------------------- TREE-SITTER ---------------------------
require('nvim-treesitter.configs').setup {
ensure_installed = "maintained",
highlight = {enable = true}
}
-------------------- LSP -----------------------------------
local lsp = require 'lspconfig'
-- For ccls we use the default settings
lsp.ccls.setup {}
-- root_dir is where the LSP server will start: here at the project root otherwise in current folder
lsp.pyls.setup {root_dir = lsp.util.root_pattern('.git', fn.getcwd())}
map('n', '<space>,', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>')
map('n', '<space>;', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>')
map('n', '<space>a', '<cmd>lua vim.lsp.buf.code_action()<CR>')
map('n', '<space>d', '<cmd>lua vim.lsp.buf.definition()<CR>')
map('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>')
map('n', '<space>h', '<cmd>lua vim.lsp.buf.hover()<CR>')
map('n', '<space>m', '<cmd>lua vim.lsp.buf.rename()<CR>')
map('n', '<space>r', '<cmd>lua vim.lsp.buf.references()<CR>')
map('n', '<space>s', '<cmd>lua vim.lsp.buf.document_symbol()<CR>')
-------------------- COMMANDS ------------------------------
cmd 'au TextYankPost * lua vim.highlight.on_yank {on_visual = false}' -- disabled in visual mode
|
config = {
closed = 1,
open_right = 0.99,
open_left = -0.99,
opened = 0.0
}
|
local function filter(o, f)
local r = {}
for k, v in pairs(o) do if f(v, k) then r[k] = v end end
return r
end
return filter
|
Config = {}
Config.Exercises = {
["Pushups"] = {
["idleDict"] = "amb@world_human_push_ups@male@idle_a",
["idleAnim"] = "idle_c",
["actionDict"] = "amb@world_human_push_ups@male@base",
["actionAnim"] = "base",
["actionTime"] = 1100,
["enterDict"] = "amb@world_human_push_ups@male@enter",
["enterAnim"] = "enter",
["enterTime"] = 3050,
["exitDict"] = "amb@world_human_push_ups@male@exit",
["exitAnim"] = "exit",
["exitTime"] = 3400,
["actionProcent"] = 1,
["actionProcentTimes"] = 3,
},
["Situps"] = {
["idleDict"] = "amb@world_human_sit_ups@male@idle_a",
["idleAnim"] = "idle_a",
["actionDict"] = "amb@world_human_sit_ups@male@base",
["actionAnim"] = "base",
["actionTime"] = 3400,
["enterDict"] = "amb@world_human_sit_ups@male@enter",
["enterAnim"] = "enter",
["enterTime"] = 4200,
["exitDict"] = "amb@world_human_sit_ups@male@exit",
["exitAnim"] = "exit",
["exitTime"] = 3700,
["actionProcent"] = 1,
["actionProcentTimes"] = 10,
},
["Chins"] = {
["idleDict"] = "amb@prop_human_muscle_chin_ups@male@idle_a",
["idleAnim"] = "idle_a",
["actionDict"] = "amb@prop_human_muscle_chin_ups@male@base",
["actionAnim"] = "base",
["actionTime"] = 3000,
["enterDict"] = "amb@prop_human_muscle_chin_ups@male@enter",
["enterAnim"] = "enter",
["enterTime"] = 1600,
["exitDict"] = "amb@prop_human_muscle_chin_ups@male@exit",
["exitAnim"] = "exit",
["exitTime"] = 3700,
["actionProcent"] = 1,
["actionProcentTimes"] = 10,
},
}
Config.Locations = { -- REMINDER. If you want it to set coords+heading then enter heading, else put nil ( ["h"] )
{["x"] = -1200.08, ["y"] = -1571.15, ["z"] = 4.6115 - 0.98, ["h"] = 214.37, ["exercise"] = "Chins"},
{["x"] = -1205.0118408203, ["y"] = -1560.0671386719,["z"] = 4.614236831665 - 0.98, ["h"] = nil, ["exercise"] = "Situps"},
{["x"] = -1203.3094482422, ["y"] = -1570.6759033203, ["z"] = 4.6079330444336 - 0.98, ["h"] = nil, ["exercise"] = "Pushups"},
--{["x"] = -1206.76, ["y"] = -1572.93, ["z"] = 4.61 - 0.98, ["h"] = nil, ["exercise"] = "Pushups"},
-- ^^ You can add more locations like this
}
Config.Blips = {
[1] = {["x"] = -1201.0078125, ["y"] = -1568.3903808594, ["z"] = 4.6110973358154, ["id"] = 311, ["color"] = 49, ["scale"] = 1.0, ["text"] = "The Gym"},
}
|
print( math.pi ) |
PERK.name = "Armor Technician (Intelligence)"
PERK.description = "Training to maintain, repair and modify armor."
PERK.shortname = "Armor Technician (INT)"
PERK.parent = "intelligence" |
-----------------------------------
-- Area: Port Bastok
-- NPC: Talib
-- Starts Quest: Beauty and the Galka
-- Starts & Finishes Quest: Shady Business
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/shop");
require("scripts/globals/quests");
local ID = require("scripts/zones/Port_Bastok/IDs");
-----------------------------------
function onTrade(player,npc,trade)
if (player:getQuestStatus(BASTOK,tpz.quest.id.bastok.SHADY_BUSINESS) >= QUEST_ACCEPTED) then
if (trade:hasItemQty(642,4) and trade:getItemCount() == 4) then
player:startEvent(91);
end
elseif (player:getQuestStatus(BASTOK,tpz.quest.id.bastok.BEAUTY_AND_THE_GALKA) == QUEST_ACCEPTED) then
if (trade:hasItemQty(642,1) and trade:getItemCount() == 1) then
player:startEvent(3);
end
end
end;
function onTrigger(player,npc)
BeautyAndTheGalka = player:getQuestStatus(BASTOK,tpz.quest.id.bastok.BEAUTY_AND_THE_GALKA);
if (BeautyAndTheGalka == QUEST_COMPLETED) then
player:startEvent(90);
elseif (BeautyAndTheGalka == QUEST_ACCEPTED or player:getCharVar("BeautyAndTheGalkaDenied") >= 1) then
player:startEvent(4);
else
player:startEvent(2);
end
end;
function onEventUpdate(player,csid,option)
-- printf("CSID2: %u",csid);
-- printf("RESULT2: %u",option);
end;
function onEventFinish(player,csid,option)
if (csid == 2 and option == 0) then
player:addQuest(BASTOK,tpz.quest.id.bastok.BEAUTY_AND_THE_GALKA);
elseif (csid == 2 and option == 1) then
player:setCharVar("BeautyAndTheGalkaDenied",1);
elseif (csid == 3) then
player:tradeComplete();
player:addKeyItem(tpz.ki.PALBOROUGH_MINES_LOGS);
player:messageSpecial(ID.text.KEYITEM_OBTAINED,tpz.ki.PALBOROUGH_MINES_LOGS);
elseif (csid == 90) then
ShadyBusiness = player:getQuestStatus(BASTOK,tpz.quest.id.bastok.SHADY_BUSINESS);
if (ShadyBusiness == QUEST_AVAILABLE) then
player:addQuest(BASTOK,tpz.quest.id.bastok.SHADY_BUSINESS);
end
elseif (csid == 91) then
ShadyBusiness = player:getQuestStatus(BASTOK,tpz.quest.id.bastok.SHADY_BUSINESS);
if (ShadyBusiness == QUEST_ACCEPTED) then
player:addFame(NORG,100);
player:completeQuest(BASTOK,tpz.quest.id.bastok.SHADY_BUSINESS);
else
player:addFame(NORG,80);
end
player:tradeComplete();
player:addGil(GIL_RATE*350);
player:messageSpecial(ID.text.GIL_OBTAINED,GIL_RATE*350);
end
end; |
local M = {}
local COLORS = {"万","筒","条"}
function M.get_color(card)
return math.floor((card-1)/9) + 1
end
function M.get_color_str(card)
local color = M.get_color(card)
return COLORS[color]
end
function M.get_card_str(index)
if index >= 1 and index <= 9 then
return index .. "万"
elseif index >= 10 and index <= 18 then
return (index - 9) .. "筒"
elseif index >= 19 and index <= 27 then
return (index - 18) .. "条"
end
local t = {"东","西","南","北","中","发","白"}
return t[index - 27]
end
function M.print(tbl)
local str = ""
local card_str
for i=1,34 do
if tbl[i] > 0 then
card_str = M.get_card_str(i)
end
if tbl[i] == 1 then
str = str .. card_str
elseif tbl[i] == 2 then
str = str .. card_str .. card_str
elseif tbl[i] == 3 then
str = str .. card_str .. card_str .. card_str
elseif tbl[i] == 4 then
str = str .. card_str .. card_str .. card_str .. card_str
end
end
print(str)
end
-- 创建一幅牌,牌里存的不是牌本身,而是牌的序号
function M.create(zi)
local t = {}
local num = 3*9
if zi then
num = num + 7
end
for i=1,num do
for _=1,4 do
table.insert(t, i)
end
end
return t
end
-- 洗牌
function M.shuffle(t)
for i=#t,2,-1 do
local tmp = t[i]
local index = math.random(1, i - 1)
t[i] = t[index]
t[index] = tmp
end
end
function M.can_peng(hand_cards, card)
return hand_cards[card] >= 2
end
function M.can_angang(hand_cards, card)
return hand_cards[card] == 4
end
function M.can_diangang(hand_cards, card)
return hand_cards[card] == 3
end
function M.can_chi(hand_cards, card1, card2)
if not hand_cards[card1] or not hand_cards[card2] then
return false
end
if hand_cards[card1] == 0 or hand_cards[card2] == 0 then
return false
end
local color1 = CardDefine[hand_cards[card1]] & 0xf0
local color2 = CardDefine[hand_cards[card2]] & 0xf0
if color1 ~= color2 then
return false
end
-- 本种花色不能吃
if not CardType[color1].chi then
return false
end
return true
end
function M.can_left_chi(hand_cards, card)
return M.can_chi(hand_cards, card + 1, card + 2)
end
function M.can_middle_chi(hand_cards, card)
return M.can_chi(hand_cards, card - 1, card + 1)
end
function M.can_right_chi(hand_cards, card)
return M.can_chi(hand_cards, card - 2, card - 1)
end
return M
|
--[[
Author: Jxl
Description: A serializer module
]]
local Serializer = {}
do
local CENTER_OFFSET = Vector3.new(1, 0, 0)
Serializer.__index = Serializer
setmetatable(Serializer, {
__tostring = function()
return "Serializer"
end
})
function Serializer.new(Start, End)
return setmetatable({
Start = Start,
End = End
}, Serializer)
end
function Serializer:Round(Number)
if typeof(Number) == "number" then
return math.round(Number / 3) * 3
end
end
function Serializer:Format(CF)
local x, y, z, m11, m12, m13, m21, m22, m23, m31, m32, m33 = CF:components()
return CFrame.new(self:Round(x), self:Round(y), self:Round(z), m11, m12, m13, m21, m22, m23, m31, m32, m33)
end
function Serializer:SetStart(Start)
self.Start = Start
end
function Serializer:SetEnd(End)
self.End = End
end
function Serializer:Serialize()
local Start, End = Vector3.new(math.min(self.Start.X, self.End.X), math.min(self.Start.Y, self.End.Y), math.min(self.Start.Z, self.End.Z)), Vector3.new(math.max(self.Start.X, self.End.X), math.max(self.Start.Y, self.End.Y), math.max(self.Start.Z, self.End.Z))
local Region = Region3.new(Start, End)
local Output = {}
local Model = Instance.new("Model")
for i, v in next, workspace:FindPartsInRegion3(Region, nil, math.huge) do
if v.Parent.Name == "Blocks" then
local Clone = v:Clone()
if not (Clone:FindFirstChild("Text") or Clone:FindFirstChild("top") or Clone:FindFirstChild("bottom")) then
Clone:ClearAllChildren()
end
Clone.Parent = Model
if Output[v.Name] == nil then
Output[v.Name] = {}
end
end
end
local CF, Size = Model:GetBoundingBox()
local Start, End = CF.Position - Size / 2, CF.Position + Size / 2
local Center = self:Format(CFrame.new((Start + End) / 2)) - CENTER_OFFSET
for i, v in next, Model:GetChildren() do
local Inserted = {}
if v.ClassName == "Model" then
Inserted.C = {Center:ToObjectSpace(v.PrimaryPart.CFrame):components()}
elseif v:IsA("BasePart") then
Inserted.C = {Center:ToObjectSpace(v.CFrame):components()};
if v:FindFirstChild("bottom") and v.bottom.Transparency == 1 then
Inserted.U = true
end
if v:FindFirstChild("Text") then
Inserted.T = v.Text.Value
end
end
table.insert(Output[v.Name], Inserted)
end
return {Size = {Size.X, Size.Y, Size.Z}, Blocks = Output}
end
end
return Serializer |
-- Fix for the old reference
return require "lspconfig"
|
-- Generated by CSharp.lua Compiler
local System = System
System.namespace("Slipe.Client.Peds", function (namespace)
-- <summary>
-- Represents a PedVoice group and name
-- </summary>
namespace.struct("PedVoice", function (namespace)
local getDISABLED, getGEN_BBDYG1, getGEN_BBDYG2, getGEN_BFORI, getGEN_BFOST, getGEN_BFYBE, getGEN_BFYBU, getGEN_BFYCRP,
getGEN_BFYPRO, getGEN_BFYRI, getGEN_BFYST, getGEN_BIKDRUG, getGEN_BIKERA, getGEN_BIKERB, getGEN_BMOCD, getGEN_BMORI,
getGEN_BMOSEC, getGEN_BMOST, getGEN_BMOTR1, getGEN_BMYAP, getGEN_BMYBE, getGEN_BMYBOUN, getGEN_BMYBOX, getGEN_BMYBU,
getGEN_BMYCG, getGEN_BMYCON, getGEN_BMYCR, getGEN_BMYDJ, getGEN_BMYDRUG, getGEN_BMYMOUN, getGEN_BMYPOL1, getGEN_BMYPOL2,
getGEN_BMYRI, getGEN_BMYST, getGEN_BYMPI, getGEN_CWFOFR, getGEN_CWFOHB, getGEN_CWFYFR1, getGEN_CWFYFR2, getGEN_CWFYHB1,
getGEN_CWMOFR1, getGEN_CWMOHB1, getGEN_CWMOHB2, getGEN_CWMYFR, getGEN_CWMYHB1, getGEN_CWMYHB2, getGEN_DNFOLC1, getGEN_DNFOLC2,
getGEN_DNFYLC, getGEN_DNMOLC1, getGEN_DNMOLC2, getGEN_DNMYLC, getGEN_DWFOLC, getGEN_DWFYLC1, getGEN_DWFYLC2, getGEN_DWMOLC1,
getGEN_DWMOLC2, getGEN_DWMYLC1, getGEN_DWMYLC2, getGEN_HFORI, getGEN_HFOST, getGEN_HFYBE, getGEN_HFYPRO, getGEN_HFYRI,
getGEN_HFYST, getGEN_HMORI, getGEN_HMOST, getGEN_HMYBE, getGEN_HMYCM, getGEN_HMYCR, getGEN_HMYDRUG, getGEN_HMYRI,
getGEN_HMYST, getGEN_IMYST, getGEN_IRFYST, getGEN_IRMYST, getGEN_MAFFA, getGEN_MAFFB, getGEN_MALE01, getGEN_NOVOICE,
getGEN_OFORI, getGEN_OFOST, getGEN_OFYRI, getGEN_OFYST, getGEN_OMOBOAT, getGEN_OMOKUNG, getGEN_OMORI, getGEN_OMOST,
getGEN_OMYRI, getGEN_OMYST, getGEN_SBFORI, getGEN_SBFOST, getGEN_SBFYPRO, getGEN_SBFYRI, getGEN_SBFYST, getGEN_SBFYSTR,
getGEN_SBMOCD, getGEN_SBMORI, getGEN_SBMOST, getGEN_SBMOTR1, getGEN_SBMOTR2, getGEN_SBMYCR, getGEN_SBMYRI, getGEN_SBMYST,
getGEN_SBMYTR3, getGEN_SFYPRO, getGEN_SHFYPRO, getGEN_SHMYCR, getGEN_SMYST, getGEN_SMYST2, getGEN_SOFORI, getGEN_SOFOST,
getGEN_SOFYBU, getGEN_SOFYRI, getGEN_SOFYST, getGEN_SOMOBU, getGEN_SOMORI, getGEN_SOMOST, getGEN_SOMYAP, getGEN_SOMYBU,
getGEN_SOMYRI, getGEN_SOMYST, getGEN_SWFOPRO, getGEN_SWFORI, getGEN_SWFOST, getGEN_SWFYRI, getGEN_SWFYST, getGEN_SWFYSTR,
getGEN_SWMOCD, getGEN_SWMORI, getGEN_SWMOST, getGEN_SWMOTR1, getGEN_SWMOTR2, getGEN_SWMOTR3, getGEN_SWMOTR4, getGEN_SWMOTR5,
getGEN_SWMYCR, getGEN_SWMYHP1, getGEN_SWMYHP2, getGEN_SWMYRI, getGEN_SWMYST, getGEN_VBFYPRO, getGEN_VBFYST2, getGEN_VBMOCD,
getGEN_VBMYCR, getGEN_VBMYELV, getGEN_VHFYPRO, getGEN_VHFYST3, getGEN_VHMYCR, getGEN_VHMYELV, getGEN_VIMYELV, getGEN_VWFYPRO,
getGEN_VWFYST1, getGEN_VWFYWAI, getGEN_VWMOTR1, getGEN_VWMOTR2, getGEN_VWMYAP, getGEN_VWMYBJD, getGEN_VWMYCD, getGEN_VWMYCR,
getGEN_WFOPJ, getGEN_WFORI, getGEN_WFOST, getGEN_WFYBE, getGEN_WFYBU, getGEN_WFYCRK, getGEN_WFYCRP, getGEN_WFYJG,
getGEN_WFYLG, getGEN_WFYPRO, getGEN_WFYRI, getGEN_WFYRO, getGEN_WFYST, getGEN_WFYSTEW, getGEN_WMOMIB, getGEN_WMOPJ,
getGEN_WMOPREA, getGEN_WMORI, getGEN_WMOSCI, getGEN_WMOST, getGEN_WMOTR1, getGEN_WMYBE, getGEN_WMYBMX, getGEN_WMYBOUN,
getGEN_WMYBOX, getGEN_WMYBP, getGEN_WMYBU, getGEN_WMYCD1, getGEN_WMYCD2, getGEN_WMYCH, getGEN_WMYCON, getGEN_WMYCONB,
getGEN_WMYCR, getGEN_WMYDRUG, class, __ctor1__, __ctor2__
__ctor1__ = function (this)
end
-- <summary>
-- Build a ped voice from a group and name
-- </summary>
__ctor2__ = function (this, group, name)
this.Group = group
this.Name = name
end
getDISABLED = function ()
return System.new(class, 2, "PED_TYPE_DISABLED")
end
getGEN_BBDYG1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BBDYG1")
end
getGEN_BBDYG2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BBDYG2")
end
getGEN_BFORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BFORI")
end
getGEN_BFOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BFOST")
end
getGEN_BFYBE = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BFYBE")
end
getGEN_BFYBU = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BFYBU")
end
getGEN_BFYCRP = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BFYCRP")
end
getGEN_BFYPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BFYPRO")
end
getGEN_BFYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BFYRI")
end
getGEN_BFYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BFYST")
end
getGEN_BIKDRUG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BIKDRUG")
end
getGEN_BIKERA = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BIKERA")
end
getGEN_BIKERB = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BIKERB")
end
getGEN_BMOCD = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMOCD")
end
getGEN_BMORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMORI")
end
getGEN_BMOSEC = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMOSEC")
end
getGEN_BMOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMOST")
end
getGEN_BMOTR1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMOTR1")
end
getGEN_BMYAP = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYAP")
end
getGEN_BMYBE = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYBE")
end
getGEN_BMYBOUN = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYBOUN")
end
getGEN_BMYBOX = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYBOX")
end
getGEN_BMYBU = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYBU")
end
getGEN_BMYCG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYCG")
end
getGEN_BMYCON = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYCON")
end
getGEN_BMYCR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYCR")
end
getGEN_BMYDJ = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYDJ")
end
getGEN_BMYDRUG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYDRUG")
end
getGEN_BMYMOUN = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYMOUN")
end
getGEN_BMYPOL1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYPOL1")
end
getGEN_BMYPOL2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYPOL2")
end
getGEN_BMYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYRI")
end
getGEN_BMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BMYST")
end
getGEN_BYMPI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_BYMPI")
end
getGEN_CWFOFR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWFOFR")
end
getGEN_CWFOHB = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWFOHB")
end
getGEN_CWFYFR1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWFYFR1")
end
getGEN_CWFYFR2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWFYFR2")
end
getGEN_CWFYHB1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWFYHB1")
end
getGEN_CWMOFR1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWMOFR1")
end
getGEN_CWMOHB1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWMOHB1")
end
getGEN_CWMOHB2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWMOHB2")
end
getGEN_CWMYFR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWMYFR")
end
getGEN_CWMYHB1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWMYHB1")
end
getGEN_CWMYHB2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_CWMYHB2")
end
getGEN_DNFOLC1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DNFOLC1")
end
getGEN_DNFOLC2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DNFOLC2")
end
getGEN_DNFYLC = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DNFYLC")
end
getGEN_DNMOLC1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DNMOLC1")
end
getGEN_DNMOLC2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DNMOLC2")
end
getGEN_DNMYLC = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DNMYLC")
end
getGEN_DWFOLC = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DWFOLC")
end
getGEN_DWFYLC1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DWFYLC1")
end
getGEN_DWFYLC2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DWFYLC2")
end
getGEN_DWMOLC1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DWMOLC1")
end
getGEN_DWMOLC2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DWMOLC2")
end
getGEN_DWMYLC1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DWMYLC1")
end
getGEN_DWMYLC2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_DWMYLC2")
end
getGEN_HFORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HFORI")
end
getGEN_HFOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HFOST")
end
getGEN_HFYBE = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HFYBE")
end
getGEN_HFYPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HFYPRO")
end
getGEN_HFYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HFYRI")
end
getGEN_HFYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HFYST")
end
getGEN_HMORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HMORI")
end
getGEN_HMOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HMOST")
end
getGEN_HMYBE = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HMYBE")
end
getGEN_HMYCM = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HMYCM")
end
getGEN_HMYCR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HMYCR")
end
getGEN_HMYDRUG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HMYDRUG")
end
getGEN_HMYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HMYRI")
end
getGEN_HMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_HMYST")
end
getGEN_IMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_IMYST")
end
getGEN_IRFYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_IRFYST")
end
getGEN_IRMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_IRMYST")
end
getGEN_MAFFA = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_MAFFA")
end
getGEN_MAFFB = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_MAFFB")
end
getGEN_MALE01 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_MALE01")
end
getGEN_NOVOICE = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_NOVOICE")
end
getGEN_OFORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OFORI")
end
getGEN_OFOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OFOST")
end
getGEN_OFYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OFYRI")
end
getGEN_OFYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OFYST")
end
getGEN_OMOBOAT = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OMOBOAT")
end
getGEN_OMOKUNG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OMOKUNG")
end
getGEN_OMORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OMORI")
end
getGEN_OMOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OMOST")
end
getGEN_OMYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OMYRI")
end
getGEN_OMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_OMYST")
end
getGEN_SBFORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBFORI")
end
getGEN_SBFOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBFOST")
end
getGEN_SBFYPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBFYPRO")
end
getGEN_SBFYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBFYRI")
end
getGEN_SBFYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBFYST")
end
getGEN_SBFYSTR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBFYSTR")
end
getGEN_SBMOCD = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBMOCD")
end
getGEN_SBMORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBMORI")
end
getGEN_SBMOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBMOST")
end
getGEN_SBMOTR1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBMOTR1")
end
getGEN_SBMOTR2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBMOTR2")
end
getGEN_SBMYCR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBMYCR")
end
getGEN_SBMYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBMYRI")
end
getGEN_SBMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBMYST")
end
getGEN_SBMYTR3 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SBMYTR3")
end
getGEN_SFYPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SFYPRO")
end
getGEN_SHFYPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SHFYPRO")
end
getGEN_SHMYCR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SHMYCR")
end
getGEN_SMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SMYST")
end
getGEN_SMYST2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SMYST2")
end
getGEN_SOFORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOFORI")
end
getGEN_SOFOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOFOST")
end
getGEN_SOFYBU = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOFYBU")
end
getGEN_SOFYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOFYRI")
end
getGEN_SOFYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOFYST")
end
getGEN_SOMOBU = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOMOBU")
end
getGEN_SOMORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOMORI")
end
getGEN_SOMOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOMOST")
end
getGEN_SOMYAP = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOMYAP")
end
getGEN_SOMYBU = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOMYBU")
end
getGEN_SOMYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOMYRI")
end
getGEN_SOMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SOMYST")
end
getGEN_SWFOPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWFOPRO")
end
getGEN_SWFORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWFORI")
end
getGEN_SWFOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWFOST")
end
getGEN_SWFYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWFYRI")
end
getGEN_SWFYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWFYST")
end
getGEN_SWFYSTR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWFYSTR")
end
getGEN_SWMOCD = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMOCD")
end
getGEN_SWMORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMORI")
end
getGEN_SWMOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMOST")
end
getGEN_SWMOTR1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMOTR1")
end
getGEN_SWMOTR2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMOTR2")
end
getGEN_SWMOTR3 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMOTR3")
end
getGEN_SWMOTR4 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMOTR4")
end
getGEN_SWMOTR5 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMOTR5")
end
getGEN_SWMYCR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMYCR")
end
getGEN_SWMYHP1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMYHP1")
end
getGEN_SWMYHP2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMYHP2")
end
getGEN_SWMYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMYRI")
end
getGEN_SWMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_SWMYST")
end
getGEN_VBFYPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VBFYPRO")
end
getGEN_VBFYST2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VBFYST2")
end
getGEN_VBMOCD = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VBMOCD")
end
getGEN_VBMYCR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VBMYCR")
end
getGEN_VBMYELV = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VBMYELV")
end
getGEN_VHFYPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VHFYPRO")
end
getGEN_VHFYST3 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VHFYST3")
end
getGEN_VHMYCR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VHMYCR")
end
getGEN_VHMYELV = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VHMYELV")
end
getGEN_VIMYELV = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VIMYELV")
end
getGEN_VWFYPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VWFYPRO")
end
getGEN_VWFYST1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VWFYST1")
end
getGEN_VWFYWAI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VWFYWAI")
end
getGEN_VWMOTR1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VWMOTR1")
end
getGEN_VWMOTR2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VWMOTR2")
end
getGEN_VWMYAP = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VWMYAP")
end
getGEN_VWMYBJD = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VWMYBJD")
end
getGEN_VWMYCD = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VWMYCD")
end
getGEN_VWMYCR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_VWMYCR")
end
getGEN_WFOPJ = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFOPJ")
end
getGEN_WFORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFORI")
end
getGEN_WFOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFOST")
end
getGEN_WFYBE = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYBE")
end
getGEN_WFYBU = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYBU")
end
getGEN_WFYCRK = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYCRK")
end
getGEN_WFYCRP = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYCRP")
end
getGEN_WFYJG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYJG")
end
getGEN_WFYLG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYLG")
end
getGEN_WFYPRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYPRO")
end
getGEN_WFYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYRI")
end
getGEN_WFYRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYRO")
end
getGEN_WFYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYST")
end
getGEN_WFYSTEW = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WFYSTEW")
end
getGEN_WMOMIB = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMOMIB")
end
getGEN_WMOPJ = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMOPJ")
end
getGEN_WMOPREA = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMOPREA")
end
getGEN_WMORI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMORI")
end
getGEN_WMOSCI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMOSCI")
end
getGEN_WMOST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMOST")
end
getGEN_WMOTR1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMOTR1")
end
getGEN_WMYBE = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYBE")
end
getGEN_WMYBMX = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYBMX")
end
getGEN_WMYBOUN = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYBOUN")
end
getGEN_WMYBOX = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYBOX")
end
getGEN_WMYBP = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYBP")
end
getGEN_WMYBU = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYBU")
end
getGEN_WMYCD1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYCD1")
end
getGEN_WMYCD2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYCD2")
end
getGEN_WMYCH = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYCH")
end
getGEN_WMYCON = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYCON")
end
getGEN_WMYCONB = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYCONB")
end
getGEN_WMYCR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYCR")
end
getGEN_WMYDRUG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYDRUG")
end
-- too many local variables (limit is 200)
local const = {}
const.getGEN_WMYGAR = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYGAR")
end
const.getGEN_WMYGOL1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYGOL1")
end
const.getGEN_WMYGOL2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYGOL2")
end
const.getGEN_WMYJG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYJG")
end
const.getGEN_WMYLG = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYLG")
end
const.getGEN_WMYMECH = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYMECH")
end
const.getGEN_WMYMOUN = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYMOUN")
end
const.getGEN_WMYPLT = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYPLT")
end
const.getGEN_WMYRI = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYRI")
end
const.getGEN_WMYRO = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYRO")
end
const.getGEN_WMYSGRD = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYSGRD")
end
const.getGEN_WMYSKAT = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYSKAT")
end
const.getGEN_WMYST = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYST")
end
const.getGEN_WMYTX1 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYTX1")
end
const.getGEN_WMYTX2 = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYTX2")
end
const.getGEN_WMYVA = function ()
return System.new(class, 2, "PED_TYPE_GEN", "VOICE_GEN_WMYVA")
end
const.getEMG_ARMY1 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_ARMY1")
end
const.getEMG_ARMY2 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_ARMY2")
end
const.getEMG_ARMY3 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_ARMY3")
end
const.getEMG_EMT1 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_EMT1")
end
const.getEMG_EMT2 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_EMT2")
end
const.getEMG_EMT3 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_EMT3")
end
const.getEMG_EMT4 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_EMT4")
end
const.getEMG_EMT5 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_EMT5")
end
const.getEMG_FBI2 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_FBI2")
end
const.getEMG_FBI3 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_FBI3")
end
const.getEMG_FBI4 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_FBI4")
end
const.getEMG_FBI5 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_FBI5")
end
const.getEMG_FBI6 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_FBI6")
end
const.getEMG_LAPD1 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LAPD1")
end
const.getEMG_LAPD2 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LAPD2")
end
const.getEMG_LAPD3 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LAPD3")
end
const.getEMG_LAPD4 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LAPD4")
end
const.getEMG_LAPD5 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LAPD5")
end
const.getEMG_LAPD6 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LAPD6")
end
const.getEMG_LAPD7 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LAPD7")
end
const.getEMG_LAPD8 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LAPD8")
end
const.getEMG_LVPD1 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LVPD1")
end
const.getEMG_LVPD2 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LVPD2")
end
const.getEMG_LVPD3 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LVPD3")
end
const.getEMG_LVPD4 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LVPD4")
end
const.getEMG_LVPD5 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_LVPD5")
end
const.getEMG_MCOP1 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_MCOP1")
end
const.getEMG_MCOP2 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_MCOP2")
end
const.getEMG_MCOP3 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_MCOP3")
end
const.getEMG_MCOP4 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_MCOP4")
end
const.getEMG_MCOP5 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_MCOP5")
end
const.getEMG_MCOP6 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_MCOP6")
end
const.getEMG_PULASKI = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_PULASKI")
end
const.getEMG_RCOP1 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_RCOP1")
end
const.getEMG_RCOP2 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_RCOP2")
end
const.getEMG_RCOP3 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_RCOP3")
end
const.getEMG_RCOP4 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_RCOP4")
end
const.getEMG_SFPD1 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_SFPD1")
end
const.getEMG_SFPD2 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_SFPD2")
end
const.getEMG_SFPD3 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_SFPD3")
end
const.getEMG_SFPD4 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_SFPD4")
end
const.getEMG_SFPD5 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_SFPD5")
end
const.getEMG_SWAT1 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_SWAT1")
end
const.getEMG_SWAT2 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_SWAT2")
end
const.getEMG_SWAT4 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_SWAT4")
end
const.getEMG_SWAT6 = function ()
return System.new(class, 2, "PED_TYPE_EMG", "VOICE_EMG_SWAT6")
end
const.getPLY_AG = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_AG")
end
const.getPLY_AG2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_AG2")
end
const.getPLY_AR = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_AR")
end
const.getPLY_AR2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_AR2")
end
const.getPLY_CD = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_CD")
end
const.getPLY_CD2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_CD2")
end
const.getPLY_CF = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_CF")
end
const.getPLY_CF2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_CF2")
end
const.getPLY_CG = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_CG")
end
const.getPLY_CG2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_CG2")
end
const.getPLY_CR = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_CR")
end
const.getPLY_CR2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_CR2")
end
const.getPLY_PG = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_PG")
end
const.getPLY_PG2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_PG2")
end
const.getPLY_PR = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_PR")
end
const.getPLY_PR2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_PR2")
end
const.getPLY_WG = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_WG")
end
const.getPLY_WG2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_WG2")
end
const.getPLY_WR = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_WR")
end
const.getPLY_WR2 = function ()
return System.new(class, 2, "PED_TYPE_PLAYER", "VOICE_PLY_WR2")
end
const.getGNG_BALLAS1 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_BALLAS1")
end
const.getGNG_BALLAS2 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_BALLAS2")
end
const.getGNG_BALLAS3 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_BALLAS3")
end
const.getGNG_BALLAS4 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_BALLAS4")
end
const.getGNG_BALLAS5 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_BALLAS5")
end
const.getGNG_BIG_BEAR = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_BIG_BEAR")
end
const.getGNG_CESAR = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_CESAR")
end
const.getGNG_DNB1 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_DNB1")
end
const.getGNG_DNB2 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_DNB2")
end
const.getGNG_DNB3 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_DNB3")
end
const.getGNG_DNB5 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_DNB5")
end
const.getGNG_DWAINE = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_DWAINE")
end
const.getGNG_FAM1 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_FAM1")
end
const.getGNG_FAM2 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_FAM2")
end
const.getGNG_FAM3 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_FAM3")
end
const.getGNG_FAM4 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_FAM4")
end
const.getGNG_FAM5 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_FAM5")
end
const.getGNG_JIZZY = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_JIZZY")
end
const.getGNG_LSV1 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_LSV1")
end
const.getGNG_LSV2 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_LSV2")
end
const.getGNG_LSV3 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_LSV3")
end
const.getGNG_LSV4 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_LSV4")
end
const.getGNG_LSV5 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_LSV5")
end
const.getGNG_MACCER = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_MACCER")
end
const.getGNG_MAFBOSS = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_MAFBOSS")
end
const.getGNG_OGLOC = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_OGLOC")
end
const.getGNG_RYDER = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_RYDER")
end
const.getGNG_SFR1 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_SFR1")
end
const.getGNG_SFR2 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_SFR2")
end
const.getGNG_SFR3 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_SFR3")
end
const.getGNG_SFR4 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_SFR4")
end
const.getGNG_SFR5 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_SFR5")
end
const.getGNG_SMOKE = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_SMOKE")
end
const.getGNG_STRI1 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_STRI1")
end
const.getGNG_STRI2 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_STRI2")
end
const.getGNG_STRI4 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_STRI4")
end
const.getGNG_STRI5 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_STRI5")
end
const.getGNG_SWEET = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_SWEET")
end
const.getGNG_TBONE = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_TBONE")
end
const.getGNG_TORENO = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_TORENO")
end
const.getGNG_TRUTH = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_TRUTH")
end
const.getGNG_VLA1 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VLA1")
end
const.getGNG_VLA2 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VLA2")
end
const.getGNG_VLA3 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VLA3")
end
const.getGNG_VLA4 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VLA4")
end
const.getGNG_VLA5 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VLA5")
end
const.getGNG_VMAFF1 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VMAFF1")
end
const.getGNG_VMAFF2 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VMAFF2")
end
const.getGNG_VMAFF3 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VMAFF3")
end
const.getGNG_VMAFF4 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VMAFF4")
end
const.getGNG_VMAFF5 = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_VMAFF5")
end
const.getGNG_WOOZIE = function ()
return System.new(class, 2, "PED_TYPE_GANG", "VOICE_GNG_WOOZIE")
end
const.getGFD_BARBARA = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_BARBARA")
end
const.getGFD_BMOBAR = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_BMOBAR")
end
const.getGFD_BMYBARB = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_BMYBARB")
end
const.getGFD_BMYTATT = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_BMYTATT")
end
const.getGFD_CATALINA = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_CATALINA")
end
const.getGFD_DENISE = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_DENISE")
end
const.getGFD_HELENA = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_HELENA")
end
const.getGFD_KATIE = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_KATIE")
end
const.getGFD_MICHELLE = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_MICHELLE")
end
const.getGFD_MILLIE = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_MILLIE")
end
const.getGFD_POL_ANN = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_POL_ANN")
end
const.getGFD_WFYBURG = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_WFYBURG")
end
const.getGFD_WFYCLOT = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_WFYCLOT")
end
const.getGFD_WMYAMMO = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_WMYAMMO")
end
const.getGFD_WMYBARB = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_WMYBARB")
end
const.getGFD_WMYBELL = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_WMYBELL")
end
const.getGFD_WMYCLOT = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_WMYCLOT")
end
const.getGFD_WMYPIZZ = function ()
return System.new(class, 2, "PED_TYPE_GFD", "VOICE_GFD_WMYPIZZ")
end
const.getGEN_BFYST = getGEN_BFYST
const.getGEN_BIKDRUG = getGEN_BIKDRUG
const.getGEN_BIKERA = getGEN_BIKERA
const.getGEN_BIKERB = getGEN_BIKERB
const.getGEN_BMOCD = getGEN_BMOCD
const.getGEN_BMORI = getGEN_BMORI
const.getGEN_BMOSEC = getGEN_BMOSEC
const.getGEN_BMOST = getGEN_BMOST
const.getGEN_BMOTR1 = getGEN_BMOTR1
const.getGEN_BMYAP = getGEN_BMYAP
const.getGEN_BMYBE = getGEN_BMYBE
const.getGEN_BMYBOUN = getGEN_BMYBOUN
const.getGEN_BMYBOX = getGEN_BMYBOX
const.getGEN_BMYBU = getGEN_BMYBU
const.getGEN_BMYCG = getGEN_BMYCG
const.getGEN_BMYCON = getGEN_BMYCON
const.getGEN_BMYCR = getGEN_BMYCR
const.getGEN_BMYDJ = getGEN_BMYDJ
const.getGEN_BMYDRUG = getGEN_BMYDRUG
const.getGEN_BMYMOUN = getGEN_BMYMOUN
const.getGEN_BMYPOL1 = getGEN_BMYPOL1
const.getGEN_BMYPOL2 = getGEN_BMYPOL2
const.getGEN_BMYRI = getGEN_BMYRI
const.getGEN_BMYST = getGEN_BMYST
const.getGEN_BYMPI = getGEN_BYMPI
const.getGEN_CWFOFR = getGEN_CWFOFR
const.getGEN_CWFOHB = getGEN_CWFOHB
const.getGEN_CWFYFR1 = getGEN_CWFYFR1
const.getGEN_CWFYFR2 = getGEN_CWFYFR2
const.getGEN_CWFYHB1 = getGEN_CWFYHB1
const.getGEN_CWMOFR1 = getGEN_CWMOFR1
const.getGEN_CWMOHB1 = getGEN_CWMOHB1
const.getGEN_CWMOHB2 = getGEN_CWMOHB2
const.getGEN_CWMYFR = getGEN_CWMYFR
const.getGEN_CWMYHB1 = getGEN_CWMYHB1
const.getGEN_CWMYHB2 = getGEN_CWMYHB2
const.getGEN_DNFOLC1 = getGEN_DNFOLC1
const.getGEN_DNFOLC2 = getGEN_DNFOLC2
const.getGEN_DNFYLC = getGEN_DNFYLC
const.getGEN_DNMOLC1 = getGEN_DNMOLC1
const.getGEN_DNMOLC2 = getGEN_DNMOLC2
const.getGEN_DNMYLC = getGEN_DNMYLC
const.getGEN_DWFOLC = getGEN_DWFOLC
const.getGEN_DWFYLC1 = getGEN_DWFYLC1
const.getGEN_DWFYLC2 = getGEN_DWFYLC2
const.getGEN_DWMOLC1 = getGEN_DWMOLC1
const.getGEN_DWMOLC2 = getGEN_DWMOLC2
const.getGEN_DWMYLC1 = getGEN_DWMYLC1
const.getGEN_DWMYLC2 = getGEN_DWMYLC2
const.getGEN_HFORI = getGEN_HFORI
const.getGEN_HFOST = getGEN_HFOST
const.getGEN_HFYBE = getGEN_HFYBE
const.getGEN_HFYPRO = getGEN_HFYPRO
const.getGEN_HFYRI = getGEN_HFYRI
const.getGEN_HFYST = getGEN_HFYST
const.getGEN_HMORI = getGEN_HMORI
const.getGEN_HMOST = getGEN_HMOST
const.getGEN_HMYBE = getGEN_HMYBE
const.getGEN_HMYCM = getGEN_HMYCM
const.getGEN_HMYCR = getGEN_HMYCR
const.getGEN_HMYDRUG = getGEN_HMYDRUG
const.getGEN_HMYRI = getGEN_HMYRI
const.getGEN_HMYST = getGEN_HMYST
const.getGEN_IMYST = getGEN_IMYST
const.getGEN_IRFYST = getGEN_IRFYST
const.getGEN_IRMYST = getGEN_IRMYST
const.getGEN_MAFFA = getGEN_MAFFA
const.getGEN_MAFFB = getGEN_MAFFB
const.getGEN_MALE01 = getGEN_MALE01
const.getGEN_NOVOICE = getGEN_NOVOICE
const.getGEN_OFORI = getGEN_OFORI
const.getGEN_OFOST = getGEN_OFOST
const.getGEN_OFYRI = getGEN_OFYRI
const.getGEN_OFYST = getGEN_OFYST
const.getGEN_OMOBOAT = getGEN_OMOBOAT
const.getGEN_OMOKUNG = getGEN_OMOKUNG
const.getGEN_OMORI = getGEN_OMORI
const.getGEN_OMOST = getGEN_OMOST
const.getGEN_OMYRI = getGEN_OMYRI
const.getGEN_OMYST = getGEN_OMYST
const.getGEN_SBFORI = getGEN_SBFORI
const.getGEN_SBFOST = getGEN_SBFOST
const.getGEN_SBFYPRO = getGEN_SBFYPRO
const.getGEN_SBFYRI = getGEN_SBFYRI
const.getGEN_SBFYST = getGEN_SBFYST
const.getGEN_SBFYSTR = getGEN_SBFYSTR
const.getGEN_SBMOCD = getGEN_SBMOCD
const.getGEN_SBMORI = getGEN_SBMORI
const.getGEN_SBMOST = getGEN_SBMOST
const.getGEN_SBMOTR1 = getGEN_SBMOTR1
const.getGEN_SBMOTR2 = getGEN_SBMOTR2
const.getGEN_SBMYCR = getGEN_SBMYCR
const.getGEN_SBMYRI = getGEN_SBMYRI
const.getGEN_SBMYST = getGEN_SBMYST
const.getGEN_SBMYTR3 = getGEN_SBMYTR3
const.getGEN_SFYPRO = getGEN_SFYPRO
const.getGEN_SHFYPRO = getGEN_SHFYPRO
const.getGEN_SHMYCR = getGEN_SHMYCR
const.getGEN_SMYST = getGEN_SMYST
const.getGEN_SMYST2 = getGEN_SMYST2
const.getGEN_SOFORI = getGEN_SOFORI
const.getGEN_SOFOST = getGEN_SOFOST
const.getGEN_SOFYBU = getGEN_SOFYBU
const.getGEN_SOFYRI = getGEN_SOFYRI
const.getGEN_SOFYST = getGEN_SOFYST
const.getGEN_SOMOBU = getGEN_SOMOBU
const.getGEN_SOMORI = getGEN_SOMORI
const.getGEN_SOMOST = getGEN_SOMOST
const.getGEN_SOMYAP = getGEN_SOMYAP
const.getGEN_SOMYBU = getGEN_SOMYBU
const.getGEN_SOMYRI = getGEN_SOMYRI
const.getGEN_SOMYST = getGEN_SOMYST
const.getGEN_SWFOPRO = getGEN_SWFOPRO
const.getGEN_SWFORI = getGEN_SWFORI
const.getGEN_SWFOST = getGEN_SWFOST
const.getGEN_SWFYRI = getGEN_SWFYRI
const.getGEN_SWFYST = getGEN_SWFYST
const.getGEN_SWFYSTR = getGEN_SWFYSTR
const.getGEN_SWMOCD = getGEN_SWMOCD
const.getGEN_SWMORI = getGEN_SWMORI
const.getGEN_SWMOST = getGEN_SWMOST
const.getGEN_SWMOTR1 = getGEN_SWMOTR1
const.getGEN_SWMOTR2 = getGEN_SWMOTR2
const.getGEN_SWMOTR3 = getGEN_SWMOTR3
const.getGEN_SWMOTR4 = getGEN_SWMOTR4
const.getGEN_SWMOTR5 = getGEN_SWMOTR5
const.getGEN_SWMYCR = getGEN_SWMYCR
const.getGEN_SWMYHP1 = getGEN_SWMYHP1
const.getGEN_SWMYHP2 = getGEN_SWMYHP2
const.getGEN_SWMYRI = getGEN_SWMYRI
const.getGEN_SWMYST = getGEN_SWMYST
const.getGEN_VBFYPRO = getGEN_VBFYPRO
const.getGEN_VBFYST2 = getGEN_VBFYST2
const.getGEN_VBMOCD = getGEN_VBMOCD
const.getGEN_VBMYCR = getGEN_VBMYCR
const.getGEN_VBMYELV = getGEN_VBMYELV
const.getGEN_VHFYPRO = getGEN_VHFYPRO
const.getGEN_VHFYST3 = getGEN_VHFYST3
const.getGEN_VHMYCR = getGEN_VHMYCR
const.getGEN_VHMYELV = getGEN_VHMYELV
const.getGEN_VIMYELV = getGEN_VIMYELV
const.getGEN_VWFYPRO = getGEN_VWFYPRO
const.getGEN_VWFYST1 = getGEN_VWFYST1
const.getGEN_VWFYWAI = getGEN_VWFYWAI
const.getGEN_VWMOTR1 = getGEN_VWMOTR1
const.getGEN_VWMOTR2 = getGEN_VWMOTR2
const.getGEN_VWMYAP = getGEN_VWMYAP
const.getGEN_VWMYBJD = getGEN_VWMYBJD
const.getGEN_VWMYCD = getGEN_VWMYCD
const.getGEN_VWMYCR = getGEN_VWMYCR
const.getGEN_WFOPJ = getGEN_WFOPJ
const.getGEN_WFORI = getGEN_WFORI
const.getGEN_WFOST = getGEN_WFOST
const.getGEN_WFYBE = getGEN_WFYBE
const.getGEN_WFYBU = getGEN_WFYBU
const.getGEN_WFYCRK = getGEN_WFYCRK
const.getGEN_WFYCRP = getGEN_WFYCRP
const.getGEN_WFYJG = getGEN_WFYJG
const.getGEN_WFYLG = getGEN_WFYLG
const.getGEN_WFYPRO = getGEN_WFYPRO
const.getGEN_WFYRI = getGEN_WFYRI
const.getGEN_WFYRO = getGEN_WFYRO
const.getGEN_WFYST = getGEN_WFYST
const.getGEN_WFYSTEW = getGEN_WFYSTEW
const.getGEN_WMOMIB = getGEN_WMOMIB
const.getGEN_WMOPJ = getGEN_WMOPJ
const.getGEN_WMOPREA = getGEN_WMOPREA
const.getGEN_WMORI = getGEN_WMORI
const.getGEN_WMOSCI = getGEN_WMOSCI
const.getGEN_WMOST = getGEN_WMOST
const.getGEN_WMOTR1 = getGEN_WMOTR1
const.getGEN_WMYBE = getGEN_WMYBE
const.getGEN_WMYBMX = getGEN_WMYBMX
const.getGEN_WMYBOUN = getGEN_WMYBOUN
const.getGEN_WMYBOX = getGEN_WMYBOX
const.getGEN_WMYBP = getGEN_WMYBP
const.getGEN_WMYBU = getGEN_WMYBU
const.getGEN_WMYCD1 = getGEN_WMYCD1
const.getGEN_WMYCD2 = getGEN_WMYCD2
const.getGEN_WMYCH = getGEN_WMYCH
const.getGEN_WMYCON = getGEN_WMYCON
const.getGEN_WMYCONB = getGEN_WMYCONB
const.getGEN_WMYCR = getGEN_WMYCR
const.getGEN_WMYDRUG = getGEN_WMYDRUG
const.getGEN_WMYGAR = getGEN_WMYGAR
const.getGEN_WMYGOL1 = getGEN_WMYGOL1
const.getGEN_WMYGOL2 = getGEN_WMYGOL2
const.getGEN_WMYJG = getGEN_WMYJG
const.getGEN_WMYLG = getGEN_WMYLG
const.getGEN_WMYMECH = getGEN_WMYMECH
const.getGEN_WMYMOUN = getGEN_WMYMOUN
const.getGEN_WMYPLT = getGEN_WMYPLT
const.getGEN_WMYRI = getGEN_WMYRI
const.getGEN_WMYRO = getGEN_WMYRO
const.getGEN_WMYSGRD = getGEN_WMYSGRD
const.getGEN_WMYSKAT = getGEN_WMYSKAT
const.getGEN_WMYST = getGEN_WMYST
const.getGEN_WMYTX1 = getGEN_WMYTX1
const.getGEN_WMYTX2 = getGEN_WMYTX2
const.getGEN_WMYVA = getGEN_WMYVA
const.getGFD_BARBARA = getGFD_BARBARA
const.getGFD_BMOBAR = getGFD_BMOBAR
const.getGFD_BMYBARB = getGFD_BMYBARB
const.getGFD_BMYTATT = getGFD_BMYTATT
const.getGFD_CATALINA = getGFD_CATALINA
const.getGFD_DENISE = getGFD_DENISE
const.getGFD_HELENA = getGFD_HELENA
const.getGFD_KATIE = getGFD_KATIE
const.getGFD_MICHELLE = getGFD_MICHELLE
const.getGFD_MILLIE = getGFD_MILLIE
const.getGFD_POL_ANN = getGFD_POL_ANN
const.getGFD_WFYBURG = getGFD_WFYBURG
const.getGFD_WFYCLOT = getGFD_WFYCLOT
const.getGFD_WMYAMMO = getGFD_WMYAMMO
const.getGFD_WMYBARB = getGFD_WMYBARB
const.getGFD_WMYBELL = getGFD_WMYBELL
const.getGFD_WMYCLOT = getGFD_WMYCLOT
const.getGFD_WMYPIZZ = getGFD_WMYPIZZ
const.getGNG_BALLAS1 = getGNG_BALLAS1
const.getGNG_BALLAS2 = getGNG_BALLAS2
const.getGNG_BALLAS3 = getGNG_BALLAS3
const.getGNG_BALLAS4 = getGNG_BALLAS4
const.getGNG_BALLAS5 = getGNG_BALLAS5
const.getGNG_BIG_BEAR = getGNG_BIG_BEAR
const.getGNG_CESAR = getGNG_CESAR
const.getGNG_DNB1 = getGNG_DNB1
const.getGNG_DNB2 = getGNG_DNB2
const.getGNG_DNB3 = getGNG_DNB3
const.getGNG_DNB5 = getGNG_DNB5
const.getGNG_DWAINE = getGNG_DWAINE
const.getGNG_FAM1 = getGNG_FAM1
const.getGNG_FAM2 = getGNG_FAM2
const.getGNG_FAM3 = getGNG_FAM3
const.getGNG_FAM4 = getGNG_FAM4
const.getGNG_FAM5 = getGNG_FAM5
const.getGNG_JIZZY = getGNG_JIZZY
const.getGNG_LSV1 = getGNG_LSV1
const.getGNG_LSV2 = getGNG_LSV2
const.getGNG_LSV3 = getGNG_LSV3
const.getGNG_LSV4 = getGNG_LSV4
const.getGNG_LSV5 = getGNG_LSV5
const.getGNG_MACCER = getGNG_MACCER
const.getGNG_MAFBOSS = getGNG_MAFBOSS
const.getGNG_OGLOC = getGNG_OGLOC
const.getGNG_RYDER = getGNG_RYDER
const.getGNG_SFR1 = getGNG_SFR1
const.getGNG_SFR2 = getGNG_SFR2
const.getGNG_SFR3 = getGNG_SFR3
const.getGNG_SFR4 = getGNG_SFR4
const.getGNG_SFR5 = getGNG_SFR5
const.getGNG_SMOKE = getGNG_SMOKE
const.getGNG_STRI1 = getGNG_STRI1
const.getGNG_STRI2 = getGNG_STRI2
const.getGNG_STRI4 = getGNG_STRI4
const.getGNG_STRI5 = getGNG_STRI5
const.getGNG_SWEET = getGNG_SWEET
const.getGNG_TBONE = getGNG_TBONE
const.getGNG_TORENO = getGNG_TORENO
const.getGNG_TRUTH = getGNG_TRUTH
const.getGNG_VLA1 = getGNG_VLA1
const.getGNG_VLA2 = getGNG_VLA2
const.getGNG_VLA3 = getGNG_VLA3
const.getGNG_VLA4 = getGNG_VLA4
const.getGNG_VLA5 = getGNG_VLA5
const.getGNG_VMAFF1 = getGNG_VMAFF1
const.getGNG_VMAFF2 = getGNG_VMAFF2
const.getGNG_VMAFF3 = getGNG_VMAFF3
const.getGNG_VMAFF4 = getGNG_VMAFF4
const.getGNG_VMAFF5 = getGNG_VMAFF5
const.getGNG_WOOZIE = getGNG_WOOZIE
const.getPLY_AG = getPLY_AG
const.getPLY_AG2 = getPLY_AG2
const.getPLY_AR = getPLY_AR
const.getPLY_AR2 = getPLY_AR2
const.getPLY_CD = getPLY_CD
const.getPLY_CD2 = getPLY_CD2
const.getPLY_CF = getPLY_CF
const.getPLY_CF2 = getPLY_CF2
const.getPLY_CG = getPLY_CG
const.getPLY_CG2 = getPLY_CG2
const.getPLY_CR = getPLY_CR
const.getPLY_CR2 = getPLY_CR2
const.getPLY_PG = getPLY_PG
const.getPLY_PG2 = getPLY_PG2
const.getPLY_PR = getPLY_PR
const.getPLY_PR2 = getPLY_PR2
const.getPLY_WG = getPLY_WG
const.getPLY_WG2 = getPLY_WG2
const.getPLY_WR = getPLY_WR
const.getPLY_WR2 = getPLY_WR2
class = {
getDISABLED = getDISABLED,
getGEN_BBDYG1 = getGEN_BBDYG1,
getGEN_BBDYG2 = getGEN_BBDYG2,
getGEN_BFORI = getGEN_BFORI,
getGEN_BFOST = getGEN_BFOST,
getGEN_BFYBE = getGEN_BFYBE,
getGEN_BFYBU = getGEN_BFYBU,
getGEN_BFYCRP = getGEN_BFYCRP,
getGEN_BFYPRO = getGEN_BFYPRO,
getGEN_BFYRI = getGEN_BFYRI,
getGEN_BFYST = getGEN_BFYST,
getGEN_BIKDRUG = getGEN_BIKDRUG,
getGEN_BIKERA = getGEN_BIKERA,
getGEN_BIKERB = getGEN_BIKERB,
getGEN_BMOCD = getGEN_BMOCD,
getGEN_BMORI = getGEN_BMORI,
getGEN_BMOSEC = getGEN_BMOSEC,
getGEN_BMOST = getGEN_BMOST,
getGEN_BMOTR1 = getGEN_BMOTR1,
getGEN_BMYAP = getGEN_BMYAP,
getGEN_BMYBE = getGEN_BMYBE,
getGEN_BMYBOUN = getGEN_BMYBOUN,
getGEN_BMYBOX = getGEN_BMYBOX,
getGEN_BMYBU = getGEN_BMYBU,
getGEN_BMYCG = getGEN_BMYCG,
getGEN_BMYCON = getGEN_BMYCON,
getGEN_BMYCR = getGEN_BMYCR,
getGEN_BMYDJ = getGEN_BMYDJ,
getGEN_BMYDRUG = getGEN_BMYDRUG,
getGEN_BMYMOUN = getGEN_BMYMOUN,
getGEN_BMYPOL1 = getGEN_BMYPOL1,
getGEN_BMYPOL2 = getGEN_BMYPOL2,
getGEN_BMYRI = getGEN_BMYRI,
getGEN_BMYST = getGEN_BMYST,
getGEN_BYMPI = getGEN_BYMPI,
getGEN_CWFOFR = getGEN_CWFOFR,
getGEN_CWFOHB = getGEN_CWFOHB,
getGEN_CWFYFR1 = getGEN_CWFYFR1,
getGEN_CWFYFR2 = getGEN_CWFYFR2,
getGEN_CWFYHB1 = getGEN_CWFYHB1,
getGEN_CWMOFR1 = getGEN_CWMOFR1,
getGEN_CWMOHB1 = getGEN_CWMOHB1,
getGEN_CWMOHB2 = getGEN_CWMOHB2,
getGEN_CWMYFR = getGEN_CWMYFR,
getGEN_CWMYHB1 = getGEN_CWMYHB1,
getGEN_CWMYHB2 = getGEN_CWMYHB2,
getGEN_DNFOLC1 = getGEN_DNFOLC1,
getGEN_DNFOLC2 = getGEN_DNFOLC2,
getGEN_DNFYLC = getGEN_DNFYLC,
getGEN_DNMOLC1 = getGEN_DNMOLC1,
getGEN_DNMOLC2 = getGEN_DNMOLC2,
getGEN_DNMYLC = getGEN_DNMYLC,
getGEN_DWFOLC = getGEN_DWFOLC,
getGEN_DWFYLC1 = getGEN_DWFYLC1,
getGEN_DWFYLC2 = getGEN_DWFYLC2,
getGEN_DWMOLC1 = getGEN_DWMOLC1,
getGEN_DWMOLC2 = getGEN_DWMOLC2,
getGEN_DWMYLC1 = getGEN_DWMYLC1,
getGEN_DWMYLC2 = getGEN_DWMYLC2,
getGEN_HFORI = getGEN_HFORI,
getGEN_HFOST = getGEN_HFOST,
getGEN_HFYBE = getGEN_HFYBE,
getGEN_HFYPRO = getGEN_HFYPRO,
getGEN_HFYRI = getGEN_HFYRI,
getGEN_HFYST = getGEN_HFYST,
getGEN_HMORI = getGEN_HMORI,
getGEN_HMOST = getGEN_HMOST,
getGEN_HMYBE = getGEN_HMYBE,
getGEN_HMYCM = getGEN_HMYCM,
getGEN_HMYCR = getGEN_HMYCR,
getGEN_HMYDRUG = getGEN_HMYDRUG,
getGEN_HMYRI = getGEN_HMYRI,
getGEN_HMYST = getGEN_HMYST,
getGEN_IMYST = getGEN_IMYST,
getGEN_IRFYST = getGEN_IRFYST,
getGEN_IRMYST = getGEN_IRMYST,
getGEN_MAFFA = getGEN_MAFFA,
getGEN_MAFFB = getGEN_MAFFB,
getGEN_MALE01 = getGEN_MALE01,
getGEN_NOVOICE = getGEN_NOVOICE,
getGEN_OFORI = getGEN_OFORI,
getGEN_OFOST = getGEN_OFOST,
getGEN_OFYRI = getGEN_OFYRI,
getGEN_OFYST = getGEN_OFYST,
getGEN_OMOBOAT = getGEN_OMOBOAT,
getGEN_OMOKUNG = getGEN_OMOKUNG,
getGEN_OMORI = getGEN_OMORI,
getGEN_OMOST = getGEN_OMOST,
getGEN_OMYRI = getGEN_OMYRI,
getGEN_OMYST = getGEN_OMYST,
getGEN_SBFORI = getGEN_SBFORI,
getGEN_SBFOST = getGEN_SBFOST,
getGEN_SBFYPRO = getGEN_SBFYPRO,
getGEN_SBFYRI = getGEN_SBFYRI,
getGEN_SBFYST = getGEN_SBFYST,
getGEN_SBFYSTR = getGEN_SBFYSTR,
getGEN_SBMOCD = getGEN_SBMOCD,
getGEN_SBMORI = getGEN_SBMORI,
getGEN_SBMOST = getGEN_SBMOST,
getGEN_SBMOTR1 = getGEN_SBMOTR1,
getGEN_SBMOTR2 = getGEN_SBMOTR2,
getGEN_SBMYCR = getGEN_SBMYCR,
getGEN_SBMYRI = getGEN_SBMYRI,
getGEN_SBMYST = getGEN_SBMYST,
getGEN_SBMYTR3 = getGEN_SBMYTR3,
getGEN_SFYPRO = getGEN_SFYPRO,
getGEN_SHFYPRO = getGEN_SHFYPRO,
getGEN_SHMYCR = getGEN_SHMYCR,
getGEN_SMYST = getGEN_SMYST,
getGEN_SMYST2 = getGEN_SMYST2,
getGEN_SOFORI = getGEN_SOFORI,
getGEN_SOFOST = getGEN_SOFOST,
getGEN_SOFYBU = getGEN_SOFYBU,
getGEN_SOFYRI = getGEN_SOFYRI,
getGEN_SOFYST = getGEN_SOFYST,
getGEN_SOMOBU = getGEN_SOMOBU,
getGEN_SOMORI = getGEN_SOMORI,
getGEN_SOMOST = getGEN_SOMOST,
getGEN_SOMYAP = getGEN_SOMYAP,
getGEN_SOMYBU = getGEN_SOMYBU,
getGEN_SOMYRI = getGEN_SOMYRI,
getGEN_SOMYST = getGEN_SOMYST,
getGEN_SWFOPRO = getGEN_SWFOPRO,
getGEN_SWFORI = getGEN_SWFORI,
getGEN_SWFOST = getGEN_SWFOST,
getGEN_SWFYRI = getGEN_SWFYRI,
getGEN_SWFYST = getGEN_SWFYST,
getGEN_SWFYSTR = getGEN_SWFYSTR,
getGEN_SWMOCD = getGEN_SWMOCD,
getGEN_SWMORI = getGEN_SWMORI,
getGEN_SWMOST = getGEN_SWMOST,
getGEN_SWMOTR1 = getGEN_SWMOTR1,
getGEN_SWMOTR2 = getGEN_SWMOTR2,
getGEN_SWMOTR3 = getGEN_SWMOTR3,
getGEN_SWMOTR4 = getGEN_SWMOTR4,
getGEN_SWMOTR5 = getGEN_SWMOTR5,
getGEN_SWMYCR = getGEN_SWMYCR,
getGEN_SWMYHP1 = getGEN_SWMYHP1,
getGEN_SWMYHP2 = getGEN_SWMYHP2,
getGEN_SWMYRI = getGEN_SWMYRI,
getGEN_SWMYST = getGEN_SWMYST,
getGEN_VBFYPRO = getGEN_VBFYPRO,
getGEN_VBFYST2 = getGEN_VBFYST2,
getGEN_VBMOCD = getGEN_VBMOCD,
getGEN_VBMYCR = getGEN_VBMYCR,
getGEN_VBMYELV = getGEN_VBMYELV,
getGEN_VHFYPRO = getGEN_VHFYPRO,
getGEN_VHFYST3 = getGEN_VHFYST3,
getGEN_VHMYCR = getGEN_VHMYCR,
getGEN_VHMYELV = getGEN_VHMYELV,
getGEN_VIMYELV = getGEN_VIMYELV,
getGEN_VWFYPRO = getGEN_VWFYPRO,
getGEN_VWFYST1 = getGEN_VWFYST1,
getGEN_VWFYWAI = getGEN_VWFYWAI,
getGEN_VWMOTR1 = getGEN_VWMOTR1,
getGEN_VWMOTR2 = getGEN_VWMOTR2,
getGEN_VWMYAP = getGEN_VWMYAP,
getGEN_VWMYBJD = getGEN_VWMYBJD,
getGEN_VWMYCD = getGEN_VWMYCD,
getGEN_VWMYCR = getGEN_VWMYCR,
getGEN_WFOPJ = getGEN_WFOPJ,
getGEN_WFORI = getGEN_WFORI,
getGEN_WFOST = getGEN_WFOST,
getGEN_WFYBE = getGEN_WFYBE,
getGEN_WFYBU = getGEN_WFYBU,
getGEN_WFYCRK = getGEN_WFYCRK,
getGEN_WFYCRP = getGEN_WFYCRP,
getGEN_WFYJG = getGEN_WFYJG,
getGEN_WFYLG = getGEN_WFYLG,
getGEN_WFYPRO = getGEN_WFYPRO,
getGEN_WFYRI = getGEN_WFYRI,
getGEN_WFYRO = getGEN_WFYRO,
getGEN_WFYST = getGEN_WFYST,
getGEN_WFYSTEW = getGEN_WFYSTEW,
getGEN_WMOMIB = getGEN_WMOMIB,
getGEN_WMOPJ = getGEN_WMOPJ,
getGEN_WMOPREA = getGEN_WMOPREA,
getGEN_WMORI = getGEN_WMORI,
getGEN_WMOSCI = getGEN_WMOSCI,
getGEN_WMOST = getGEN_WMOST,
getGEN_WMOTR1 = getGEN_WMOTR1,
getGEN_WMYBE = getGEN_WMYBE,
getGEN_WMYBMX = getGEN_WMYBMX,
getGEN_WMYBOUN = getGEN_WMYBOUN,
getGEN_WMYBOX = getGEN_WMYBOX,
getGEN_WMYBP = getGEN_WMYBP,
getGEN_WMYBU = getGEN_WMYBU,
getGEN_WMYCD1 = getGEN_WMYCD1,
getGEN_WMYCD2 = getGEN_WMYCD2,
getGEN_WMYCH = getGEN_WMYCH,
getGEN_WMYCON = getGEN_WMYCON,
getGEN_WMYCONB = getGEN_WMYCONB,
getGEN_WMYCR = getGEN_WMYCR,
getGEN_WMYDRUG = getGEN_WMYDRUG,
getGEN_WMYGAR = const.getGEN_WMYGAR,
getGEN_WMYGOL1 = const.getGEN_WMYGOL1,
getGEN_WMYGOL2 = const.getGEN_WMYGOL2,
getGEN_WMYJG = const.getGEN_WMYJG,
getGEN_WMYLG = const.getGEN_WMYLG,
getGEN_WMYMECH = const.getGEN_WMYMECH,
getGEN_WMYMOUN = const.getGEN_WMYMOUN,
getGEN_WMYPLT = const.getGEN_WMYPLT,
getGEN_WMYRI = const.getGEN_WMYRI,
getGEN_WMYRO = const.getGEN_WMYRO,
getGEN_WMYSGRD = const.getGEN_WMYSGRD,
getGEN_WMYSKAT = const.getGEN_WMYSKAT,
getGEN_WMYST = const.getGEN_WMYST,
getGEN_WMYTX1 = const.getGEN_WMYTX1,
getGEN_WMYTX2 = const.getGEN_WMYTX2,
getGEN_WMYVA = const.getGEN_WMYVA,
getEMG_ARMY1 = const.getEMG_ARMY1,
getEMG_ARMY2 = const.getEMG_ARMY2,
getEMG_ARMY3 = const.getEMG_ARMY3,
getEMG_EMT1 = const.getEMG_EMT1,
getEMG_EMT2 = const.getEMG_EMT2,
getEMG_EMT3 = const.getEMG_EMT3,
getEMG_EMT4 = const.getEMG_EMT4,
getEMG_EMT5 = const.getEMG_EMT5,
getEMG_FBI2 = const.getEMG_FBI2,
getEMG_FBI3 = const.getEMG_FBI3,
getEMG_FBI4 = const.getEMG_FBI4,
getEMG_FBI5 = const.getEMG_FBI5,
getEMG_FBI6 = const.getEMG_FBI6,
getEMG_LAPD1 = const.getEMG_LAPD1,
getEMG_LAPD2 = const.getEMG_LAPD2,
getEMG_LAPD3 = const.getEMG_LAPD3,
getEMG_LAPD4 = const.getEMG_LAPD4,
getEMG_LAPD5 = const.getEMG_LAPD5,
getEMG_LAPD6 = const.getEMG_LAPD6,
getEMG_LAPD7 = const.getEMG_LAPD7,
getEMG_LAPD8 = const.getEMG_LAPD8,
getEMG_LVPD1 = const.getEMG_LVPD1,
getEMG_LVPD2 = const.getEMG_LVPD2,
getEMG_LVPD3 = const.getEMG_LVPD3,
getEMG_LVPD4 = const.getEMG_LVPD4,
getEMG_LVPD5 = const.getEMG_LVPD5,
getEMG_MCOP1 = const.getEMG_MCOP1,
getEMG_MCOP2 = const.getEMG_MCOP2,
getEMG_MCOP3 = const.getEMG_MCOP3,
getEMG_MCOP4 = const.getEMG_MCOP4,
getEMG_MCOP5 = const.getEMG_MCOP5,
getEMG_MCOP6 = const.getEMG_MCOP6,
getEMG_PULASKI = const.getEMG_PULASKI,
getEMG_RCOP1 = const.getEMG_RCOP1,
getEMG_RCOP2 = const.getEMG_RCOP2,
getEMG_RCOP3 = const.getEMG_RCOP3,
getEMG_RCOP4 = const.getEMG_RCOP4,
getEMG_SFPD1 = const.getEMG_SFPD1,
getEMG_SFPD2 = const.getEMG_SFPD2,
getEMG_SFPD3 = const.getEMG_SFPD3,
getEMG_SFPD4 = const.getEMG_SFPD4,
getEMG_SFPD5 = const.getEMG_SFPD5,
getEMG_SWAT1 = const.getEMG_SWAT1,
getEMG_SWAT2 = const.getEMG_SWAT2,
getEMG_SWAT4 = const.getEMG_SWAT4,
getEMG_SWAT6 = const.getEMG_SWAT6,
getPLY_AG = const.getPLY_AG,
getPLY_AG2 = const.getPLY_AG2,
getPLY_AR = const.getPLY_AR,
getPLY_AR2 = const.getPLY_AR2,
getPLY_CD = const.getPLY_CD,
getPLY_CD2 = const.getPLY_CD2,
getPLY_CF = const.getPLY_CF,
getPLY_CF2 = const.getPLY_CF2,
getPLY_CG = const.getPLY_CG,
getPLY_CG2 = const.getPLY_CG2,
getPLY_CR = const.getPLY_CR,
getPLY_CR2 = const.getPLY_CR2,
getPLY_PG = const.getPLY_PG,
getPLY_PG2 = const.getPLY_PG2,
getPLY_PR = const.getPLY_PR,
getPLY_PR2 = const.getPLY_PR2,
getPLY_WG = const.getPLY_WG,
getPLY_WG2 = const.getPLY_WG2,
getPLY_WR = const.getPLY_WR,
getPLY_WR2 = const.getPLY_WR2,
getGNG_BALLAS1 = const.getGNG_BALLAS1,
getGNG_BALLAS2 = const.getGNG_BALLAS2,
getGNG_BALLAS3 = const.getGNG_BALLAS3,
getGNG_BALLAS4 = const.getGNG_BALLAS4,
getGNG_BALLAS5 = const.getGNG_BALLAS5,
getGNG_BIG_BEAR = const.getGNG_BIG_BEAR,
getGNG_CESAR = const.getGNG_CESAR,
getGNG_DNB1 = const.getGNG_DNB1,
getGNG_DNB2 = const.getGNG_DNB2,
getGNG_DNB3 = const.getGNG_DNB3,
getGNG_DNB5 = const.getGNG_DNB5,
getGNG_DWAINE = const.getGNG_DWAINE,
getGNG_FAM1 = const.getGNG_FAM1,
getGNG_FAM2 = const.getGNG_FAM2,
getGNG_FAM3 = const.getGNG_FAM3,
getGNG_FAM4 = const.getGNG_FAM4,
getGNG_FAM5 = const.getGNG_FAM5,
getGNG_JIZZY = const.getGNG_JIZZY,
getGNG_LSV1 = const.getGNG_LSV1,
getGNG_LSV2 = const.getGNG_LSV2,
getGNG_LSV3 = const.getGNG_LSV3,
getGNG_LSV4 = const.getGNG_LSV4,
getGNG_LSV5 = const.getGNG_LSV5,
getGNG_MACCER = const.getGNG_MACCER,
getGNG_MAFBOSS = const.getGNG_MAFBOSS,
getGNG_OGLOC = const.getGNG_OGLOC,
getGNG_RYDER = const.getGNG_RYDER,
getGNG_SFR1 = const.getGNG_SFR1,
getGNG_SFR2 = const.getGNG_SFR2,
getGNG_SFR3 = const.getGNG_SFR3,
getGNG_SFR4 = const.getGNG_SFR4,
getGNG_SFR5 = const.getGNG_SFR5,
getGNG_SMOKE = const.getGNG_SMOKE,
getGNG_STRI1 = const.getGNG_STRI1,
getGNG_STRI2 = const.getGNG_STRI2,
getGNG_STRI4 = const.getGNG_STRI4,
getGNG_STRI5 = const.getGNG_STRI5,
getGNG_SWEET = const.getGNG_SWEET,
getGNG_TBONE = const.getGNG_TBONE,
getGNG_TORENO = const.getGNG_TORENO,
getGNG_TRUTH = const.getGNG_TRUTH,
getGNG_VLA1 = const.getGNG_VLA1,
getGNG_VLA2 = const.getGNG_VLA2,
getGNG_VLA3 = const.getGNG_VLA3,
getGNG_VLA4 = const.getGNG_VLA4,
getGNG_VLA5 = const.getGNG_VLA5,
getGNG_VMAFF1 = const.getGNG_VMAFF1,
getGNG_VMAFF2 = const.getGNG_VMAFF2,
getGNG_VMAFF3 = const.getGNG_VMAFF3,
getGNG_VMAFF4 = const.getGNG_VMAFF4,
getGNG_VMAFF5 = const.getGNG_VMAFF5,
getGNG_WOOZIE = const.getGNG_WOOZIE,
getGFD_BARBARA = const.getGFD_BARBARA,
getGFD_BMOBAR = const.getGFD_BMOBAR,
getGFD_BMYBARB = const.getGFD_BMYBARB,
getGFD_BMYTATT = const.getGFD_BMYTATT,
getGFD_CATALINA = const.getGFD_CATALINA,
getGFD_DENISE = const.getGFD_DENISE,
getGFD_HELENA = const.getGFD_HELENA,
getGFD_KATIE = const.getGFD_KATIE,
getGFD_MICHELLE = const.getGFD_MICHELLE,
getGFD_MILLIE = const.getGFD_MILLIE,
getGFD_POL_ANN = const.getGFD_POL_ANN,
getGFD_WFYBURG = const.getGFD_WFYBURG,
getGFD_WFYCLOT = const.getGFD_WFYCLOT,
getGFD_WMYAMMO = const.getGFD_WMYAMMO,
getGFD_WMYBARB = const.getGFD_WMYBARB,
getGFD_WMYBELL = const.getGFD_WMYBELL,
getGFD_WMYCLOT = const.getGFD_WMYCLOT,
getGFD_WMYPIZZ = const.getGFD_WMYPIZZ,
__ctor__ = {
__ctor1__,
__ctor2__
},
__metadata__ = function (out)
return {
properties = {
{ "DISABLED", 0x20E, class, getDISABLED },
{ "EMG_ARMY1", 0x20E, class, getEMG_ARMY1 },
{ "EMG_ARMY2", 0x20E, class, getEMG_ARMY2 },
{ "EMG_ARMY3", 0x20E, class, getEMG_ARMY3 },
{ "EMG_EMT1", 0x20E, class, getEMG_EMT1 },
{ "EMG_EMT2", 0x20E, class, getEMG_EMT2 },
{ "EMG_EMT3", 0x20E, class, getEMG_EMT3 },
{ "EMG_EMT4", 0x20E, class, getEMG_EMT4 },
{ "EMG_EMT5", 0x20E, class, getEMG_EMT5 },
{ "EMG_FBI2", 0x20E, class, getEMG_FBI2 },
{ "EMG_FBI3", 0x20E, class, getEMG_FBI3 },
{ "EMG_FBI4", 0x20E, class, getEMG_FBI4 },
{ "EMG_FBI5", 0x20E, class, getEMG_FBI5 },
{ "EMG_FBI6", 0x20E, class, getEMG_FBI6 },
{ "EMG_LAPD1", 0x20E, class, getEMG_LAPD1 },
{ "EMG_LAPD2", 0x20E, class, getEMG_LAPD2 },
{ "EMG_LAPD3", 0x20E, class, getEMG_LAPD3 },
{ "EMG_LAPD4", 0x20E, class, getEMG_LAPD4 },
{ "EMG_LAPD5", 0x20E, class, getEMG_LAPD5 },
{ "EMG_LAPD6", 0x20E, class, getEMG_LAPD6 },
{ "EMG_LAPD7", 0x20E, class, getEMG_LAPD7 },
{ "EMG_LAPD8", 0x20E, class, getEMG_LAPD8 },
{ "EMG_LVPD1", 0x20E, class, getEMG_LVPD1 },
{ "EMG_LVPD2", 0x20E, class, getEMG_LVPD2 },
{ "EMG_LVPD3", 0x20E, class, getEMG_LVPD3 },
{ "EMG_LVPD4", 0x20E, class, getEMG_LVPD4 },
{ "EMG_LVPD5", 0x20E, class, getEMG_LVPD5 },
{ "EMG_MCOP1", 0x20E, class, getEMG_MCOP1 },
{ "EMG_MCOP2", 0x20E, class, getEMG_MCOP2 },
{ "EMG_MCOP3", 0x20E, class, getEMG_MCOP3 },
{ "EMG_MCOP4", 0x20E, class, getEMG_MCOP4 },
{ "EMG_MCOP5", 0x20E, class, getEMG_MCOP5 },
{ "EMG_MCOP6", 0x20E, class, getEMG_MCOP6 },
{ "EMG_PULASKI", 0x20E, class, getEMG_PULASKI },
{ "EMG_RCOP1", 0x20E, class, getEMG_RCOP1 },
{ "EMG_RCOP2", 0x20E, class, getEMG_RCOP2 },
{ "EMG_RCOP3", 0x20E, class, getEMG_RCOP3 },
{ "EMG_RCOP4", 0x20E, class, getEMG_RCOP4 },
{ "EMG_SFPD1", 0x20E, class, getEMG_SFPD1 },
{ "EMG_SFPD2", 0x20E, class, getEMG_SFPD2 },
{ "EMG_SFPD3", 0x20E, class, getEMG_SFPD3 },
{ "EMG_SFPD4", 0x20E, class, getEMG_SFPD4 },
{ "EMG_SFPD5", 0x20E, class, getEMG_SFPD5 },
{ "EMG_SWAT1", 0x20E, class, getEMG_SWAT1 },
{ "EMG_SWAT2", 0x20E, class, getEMG_SWAT2 },
{ "EMG_SWAT4", 0x20E, class, getEMG_SWAT4 },
{ "EMG_SWAT6", 0x20E, class, getEMG_SWAT6 },
{ "GEN_BBDYG1", 0x20E, class, getGEN_BBDYG1 },
{ "GEN_BBDYG2", 0x20E, class, getGEN_BBDYG2 },
{ "GEN_BFORI", 0x20E, class, getGEN_BFORI },
{ "GEN_BFOST", 0x20E, class, getGEN_BFOST },
{ "GEN_BFYBE", 0x20E, class, getGEN_BFYBE },
{ "GEN_BFYBU", 0x20E, class, getGEN_BFYBU },
{ "GEN_BFYCRP", 0x20E, class, getGEN_BFYCRP },
{ "GEN_BFYPRO", 0x20E, class, getGEN_BFYPRO },
{ "GEN_BFYRI", 0x20E, class, getGEN_BFYRI },
{ "GEN_BFYST", 0x20E, class, const.getGEN_BFYST },
{ "GEN_BIKDRUG", 0x20E, class, const.getGEN_BIKDRUG },
{ "GEN_BIKERA", 0x20E, class, const.getGEN_BIKERA },
{ "GEN_BIKERB", 0x20E, class, const.getGEN_BIKERB },
{ "GEN_BMOCD", 0x20E, class, const.getGEN_BMOCD },
{ "GEN_BMORI", 0x20E, class, const.getGEN_BMORI },
{ "GEN_BMOSEC", 0x20E, class, const.getGEN_BMOSEC },
{ "GEN_BMOST", 0x20E, class, const.getGEN_BMOST },
{ "GEN_BMOTR1", 0x20E, class, const.getGEN_BMOTR1 },
{ "GEN_BMYAP", 0x20E, class, const.getGEN_BMYAP },
{ "GEN_BMYBE", 0x20E, class, const.getGEN_BMYBE },
{ "GEN_BMYBOUN", 0x20E, class, const.getGEN_BMYBOUN },
{ "GEN_BMYBOX", 0x20E, class, const.getGEN_BMYBOX },
{ "GEN_BMYBU", 0x20E, class, const.getGEN_BMYBU },
{ "GEN_BMYCG", 0x20E, class, const.getGEN_BMYCG },
{ "GEN_BMYCON", 0x20E, class, const.getGEN_BMYCON },
{ "GEN_BMYCR", 0x20E, class, const.getGEN_BMYCR },
{ "GEN_BMYDJ", 0x20E, class, const.getGEN_BMYDJ },
{ "GEN_BMYDRUG", 0x20E, class, const.getGEN_BMYDRUG },
{ "GEN_BMYMOUN", 0x20E, class, const.getGEN_BMYMOUN },
{ "GEN_BMYPOL1", 0x20E, class, const.getGEN_BMYPOL1 },
{ "GEN_BMYPOL2", 0x20E, class, const.getGEN_BMYPOL2 },
{ "GEN_BMYRI", 0x20E, class, const.getGEN_BMYRI },
{ "GEN_BMYST", 0x20E, class, const.getGEN_BMYST },
{ "GEN_BYMPI", 0x20E, class, const.getGEN_BYMPI },
{ "GEN_CWFOFR", 0x20E, class, const.getGEN_CWFOFR },
{ "GEN_CWFOHB", 0x20E, class, const.getGEN_CWFOHB },
{ "GEN_CWFYFR1", 0x20E, class, const.getGEN_CWFYFR1 },
{ "GEN_CWFYFR2", 0x20E, class, const.getGEN_CWFYFR2 },
{ "GEN_CWFYHB1", 0x20E, class, const.getGEN_CWFYHB1 },
{ "GEN_CWMOFR1", 0x20E, class, const.getGEN_CWMOFR1 },
{ "GEN_CWMOHB1", 0x20E, class, const.getGEN_CWMOHB1 },
{ "GEN_CWMOHB2", 0x20E, class, const.getGEN_CWMOHB2 },
{ "GEN_CWMYFR", 0x20E, class, const.getGEN_CWMYFR },
{ "GEN_CWMYHB1", 0x20E, class, const.getGEN_CWMYHB1 },
{ "GEN_CWMYHB2", 0x20E, class, const.getGEN_CWMYHB2 },
{ "GEN_DNFOLC1", 0x20E, class, const.getGEN_DNFOLC1 },
{ "GEN_DNFOLC2", 0x20E, class, const.getGEN_DNFOLC2 },
{ "GEN_DNFYLC", 0x20E, class, const.getGEN_DNFYLC },
{ "GEN_DNMOLC1", 0x20E, class, const.getGEN_DNMOLC1 },
{ "GEN_DNMOLC2", 0x20E, class, const.getGEN_DNMOLC2 },
{ "GEN_DNMYLC", 0x20E, class, const.getGEN_DNMYLC },
{ "GEN_DWFOLC", 0x20E, class, const.getGEN_DWFOLC },
{ "GEN_DWFYLC1", 0x20E, class, const.getGEN_DWFYLC1 },
{ "GEN_DWFYLC2", 0x20E, class, const.getGEN_DWFYLC2 },
{ "GEN_DWMOLC1", 0x20E, class, const.getGEN_DWMOLC1 },
{ "GEN_DWMOLC2", 0x20E, class, const.getGEN_DWMOLC2 },
{ "GEN_DWMYLC1", 0x20E, class, const.getGEN_DWMYLC1 },
{ "GEN_DWMYLC2", 0x20E, class, const.getGEN_DWMYLC2 },
{ "GEN_HFORI", 0x20E, class, const.getGEN_HFORI },
{ "GEN_HFOST", 0x20E, class, const.getGEN_HFOST },
{ "GEN_HFYBE", 0x20E, class, const.getGEN_HFYBE },
{ "GEN_HFYPRO", 0x20E, class, const.getGEN_HFYPRO },
{ "GEN_HFYRI", 0x20E, class, const.getGEN_HFYRI },
{ "GEN_HFYST", 0x20E, class, const.getGEN_HFYST },
{ "GEN_HMORI", 0x20E, class, const.getGEN_HMORI },
{ "GEN_HMOST", 0x20E, class, const.getGEN_HMOST },
{ "GEN_HMYBE", 0x20E, class, const.getGEN_HMYBE },
{ "GEN_HMYCM", 0x20E, class, const.getGEN_HMYCM },
{ "GEN_HMYCR", 0x20E, class, const.getGEN_HMYCR },
{ "GEN_HMYDRUG", 0x20E, class, const.getGEN_HMYDRUG },
{ "GEN_HMYRI", 0x20E, class, const.getGEN_HMYRI },
{ "GEN_HMYST", 0x20E, class, const.getGEN_HMYST },
{ "GEN_IMYST", 0x20E, class, const.getGEN_IMYST },
{ "GEN_IRFYST", 0x20E, class, const.getGEN_IRFYST },
{ "GEN_IRMYST", 0x20E, class, const.getGEN_IRMYST },
{ "GEN_MAFFA", 0x20E, class, const.getGEN_MAFFA },
{ "GEN_MAFFB", 0x20E, class, const.getGEN_MAFFB },
{ "GEN_MALE01", 0x20E, class, const.getGEN_MALE01 },
{ "GEN_NOVOICE", 0x20E, class, const.getGEN_NOVOICE },
{ "GEN_OFORI", 0x20E, class, const.getGEN_OFORI },
{ "GEN_OFOST", 0x20E, class, const.getGEN_OFOST },
{ "GEN_OFYRI", 0x20E, class, const.getGEN_OFYRI },
{ "GEN_OFYST", 0x20E, class, const.getGEN_OFYST },
{ "GEN_OMOBOAT", 0x20E, class, const.getGEN_OMOBOAT },
{ "GEN_OMOKUNG", 0x20E, class, const.getGEN_OMOKUNG },
{ "GEN_OMORI", 0x20E, class, const.getGEN_OMORI },
{ "GEN_OMOST", 0x20E, class, const.getGEN_OMOST },
{ "GEN_OMYRI", 0x20E, class, const.getGEN_OMYRI },
{ "GEN_OMYST", 0x20E, class, const.getGEN_OMYST },
{ "GEN_SBFORI", 0x20E, class, const.getGEN_SBFORI },
{ "GEN_SBFOST", 0x20E, class, const.getGEN_SBFOST },
{ "GEN_SBFYPRO", 0x20E, class, const.getGEN_SBFYPRO },
{ "GEN_SBFYRI", 0x20E, class, const.getGEN_SBFYRI },
{ "GEN_SBFYST", 0x20E, class, const.getGEN_SBFYST },
{ "GEN_SBFYSTR", 0x20E, class, const.getGEN_SBFYSTR },
{ "GEN_SBMOCD", 0x20E, class, const.getGEN_SBMOCD },
{ "GEN_SBMORI", 0x20E, class, const.getGEN_SBMORI },
{ "GEN_SBMOST", 0x20E, class, const.getGEN_SBMOST },
{ "GEN_SBMOTR1", 0x20E, class, const.getGEN_SBMOTR1 },
{ "GEN_SBMOTR2", 0x20E, class, const.getGEN_SBMOTR2 },
{ "GEN_SBMYCR", 0x20E, class, const.getGEN_SBMYCR },
{ "GEN_SBMYRI", 0x20E, class, const.getGEN_SBMYRI },
{ "GEN_SBMYST", 0x20E, class, const.getGEN_SBMYST },
{ "GEN_SBMYTR3", 0x20E, class, const.getGEN_SBMYTR3 },
{ "GEN_SFYPRO", 0x20E, class, const.getGEN_SFYPRO },
{ "GEN_SHFYPRO", 0x20E, class, const.getGEN_SHFYPRO },
{ "GEN_SHMYCR", 0x20E, class, const.getGEN_SHMYCR },
{ "GEN_SMYST", 0x20E, class, const.getGEN_SMYST },
{ "GEN_SMYST2", 0x20E, class, const.getGEN_SMYST2 },
{ "GEN_SOFORI", 0x20E, class, const.getGEN_SOFORI },
{ "GEN_SOFOST", 0x20E, class, const.getGEN_SOFOST },
{ "GEN_SOFYBU", 0x20E, class, const.getGEN_SOFYBU },
{ "GEN_SOFYRI", 0x20E, class, const.getGEN_SOFYRI },
{ "GEN_SOFYST", 0x20E, class, const.getGEN_SOFYST },
{ "GEN_SOMOBU", 0x20E, class, const.getGEN_SOMOBU },
{ "GEN_SOMORI", 0x20E, class, const.getGEN_SOMORI },
{ "GEN_SOMOST", 0x20E, class, const.getGEN_SOMOST },
{ "GEN_SOMYAP", 0x20E, class, const.getGEN_SOMYAP },
{ "GEN_SOMYBU", 0x20E, class, const.getGEN_SOMYBU },
{ "GEN_SOMYRI", 0x20E, class, const.getGEN_SOMYRI },
{ "GEN_SOMYST", 0x20E, class, const.getGEN_SOMYST },
{ "GEN_SWFOPRO", 0x20E, class, const.getGEN_SWFOPRO },
{ "GEN_SWFORI", 0x20E, class, const.getGEN_SWFORI },
{ "GEN_SWFOST", 0x20E, class, const.getGEN_SWFOST },
{ "GEN_SWFYRI", 0x20E, class, const.getGEN_SWFYRI },
{ "GEN_SWFYST", 0x20E, class, const.getGEN_SWFYST },
{ "GEN_SWFYSTR", 0x20E, class, const.getGEN_SWFYSTR },
{ "GEN_SWMOCD", 0x20E, class, const.getGEN_SWMOCD },
{ "GEN_SWMORI", 0x20E, class, const.getGEN_SWMORI },
{ "GEN_SWMOST", 0x20E, class, const.getGEN_SWMOST },
{ "GEN_SWMOTR1", 0x20E, class, const.getGEN_SWMOTR1 },
{ "GEN_SWMOTR2", 0x20E, class, const.getGEN_SWMOTR2 },
{ "GEN_SWMOTR3", 0x20E, class, const.getGEN_SWMOTR3 },
{ "GEN_SWMOTR4", 0x20E, class, const.getGEN_SWMOTR4 },
{ "GEN_SWMOTR5", 0x20E, class, const.getGEN_SWMOTR5 },
{ "GEN_SWMYCR", 0x20E, class, const.getGEN_SWMYCR },
{ "GEN_SWMYHP1", 0x20E, class, const.getGEN_SWMYHP1 },
{ "GEN_SWMYHP2", 0x20E, class, const.getGEN_SWMYHP2 },
{ "GEN_SWMYRI", 0x20E, class, const.getGEN_SWMYRI },
{ "GEN_SWMYST", 0x20E, class, const.getGEN_SWMYST },
{ "GEN_VBFYPRO", 0x20E, class, const.getGEN_VBFYPRO },
{ "GEN_VBFYST2", 0x20E, class, const.getGEN_VBFYST2 },
{ "GEN_VBMOCD", 0x20E, class, const.getGEN_VBMOCD },
{ "GEN_VBMYCR", 0x20E, class, const.getGEN_VBMYCR },
{ "GEN_VBMYELV", 0x20E, class, const.getGEN_VBMYELV },
{ "GEN_VHFYPRO", 0x20E, class, const.getGEN_VHFYPRO },
{ "GEN_VHFYST3", 0x20E, class, const.getGEN_VHFYST3 },
{ "GEN_VHMYCR", 0x20E, class, const.getGEN_VHMYCR },
{ "GEN_VHMYELV", 0x20E, class, const.getGEN_VHMYELV },
{ "GEN_VIMYELV", 0x20E, class, const.getGEN_VIMYELV },
{ "GEN_VWFYPRO", 0x20E, class, const.getGEN_VWFYPRO },
{ "GEN_VWFYST1", 0x20E, class, const.getGEN_VWFYST1 },
{ "GEN_VWFYWAI", 0x20E, class, const.getGEN_VWFYWAI },
{ "GEN_VWMOTR1", 0x20E, class, const.getGEN_VWMOTR1 },
{ "GEN_VWMOTR2", 0x20E, class, const.getGEN_VWMOTR2 },
{ "GEN_VWMYAP", 0x20E, class, const.getGEN_VWMYAP },
{ "GEN_VWMYBJD", 0x20E, class, const.getGEN_VWMYBJD },
{ "GEN_VWMYCD", 0x20E, class, const.getGEN_VWMYCD },
{ "GEN_VWMYCR", 0x20E, class, const.getGEN_VWMYCR },
{ "GEN_WFOPJ", 0x20E, class, const.getGEN_WFOPJ },
{ "GEN_WFORI", 0x20E, class, const.getGEN_WFORI },
{ "GEN_WFOST", 0x20E, class, const.getGEN_WFOST },
{ "GEN_WFYBE", 0x20E, class, const.getGEN_WFYBE },
{ "GEN_WFYBU", 0x20E, class, const.getGEN_WFYBU },
{ "GEN_WFYCRK", 0x20E, class, const.getGEN_WFYCRK },
{ "GEN_WFYCRP", 0x20E, class, const.getGEN_WFYCRP },
{ "GEN_WFYJG", 0x20E, class, const.getGEN_WFYJG },
{ "GEN_WFYLG", 0x20E, class, const.getGEN_WFYLG },
{ "GEN_WFYPRO", 0x20E, class, const.getGEN_WFYPRO },
{ "GEN_WFYRI", 0x20E, class, const.getGEN_WFYRI },
{ "GEN_WFYRO", 0x20E, class, const.getGEN_WFYRO },
{ "GEN_WFYST", 0x20E, class, const.getGEN_WFYST },
{ "GEN_WFYSTEW", 0x20E, class, const.getGEN_WFYSTEW },
{ "GEN_WMOMIB", 0x20E, class, const.getGEN_WMOMIB },
{ "GEN_WMOPJ", 0x20E, class, const.getGEN_WMOPJ },
{ "GEN_WMOPREA", 0x20E, class, const.getGEN_WMOPREA },
{ "GEN_WMORI", 0x20E, class, const.getGEN_WMORI },
{ "GEN_WMOSCI", 0x20E, class, const.getGEN_WMOSCI },
{ "GEN_WMOST", 0x20E, class, const.getGEN_WMOST },
{ "GEN_WMOTR1", 0x20E, class, const.getGEN_WMOTR1 },
{ "GEN_WMYBE", 0x20E, class, const.getGEN_WMYBE },
{ "GEN_WMYBMX", 0x20E, class, const.getGEN_WMYBMX },
{ "GEN_WMYBOUN", 0x20E, class, const.getGEN_WMYBOUN },
{ "GEN_WMYBOX", 0x20E, class, const.getGEN_WMYBOX },
{ "GEN_WMYBP", 0x20E, class, const.getGEN_WMYBP },
{ "GEN_WMYBU", 0x20E, class, const.getGEN_WMYBU },
{ "GEN_WMYCD1", 0x20E, class, const.getGEN_WMYCD1 },
{ "GEN_WMYCD2", 0x20E, class, const.getGEN_WMYCD2 },
{ "GEN_WMYCH", 0x20E, class, const.getGEN_WMYCH },
{ "GEN_WMYCON", 0x20E, class, const.getGEN_WMYCON },
{ "GEN_WMYCONB", 0x20E, class, const.getGEN_WMYCONB },
{ "GEN_WMYCR", 0x20E, class, const.getGEN_WMYCR },
{ "GEN_WMYDRUG", 0x20E, class, const.getGEN_WMYDRUG },
{ "GEN_WMYGAR", 0x20E, class, const.getGEN_WMYGAR },
{ "GEN_WMYGOL1", 0x20E, class, const.getGEN_WMYGOL1 },
{ "GEN_WMYGOL2", 0x20E, class, const.getGEN_WMYGOL2 },
{ "GEN_WMYJG", 0x20E, class, const.getGEN_WMYJG },
{ "GEN_WMYLG", 0x20E, class, const.getGEN_WMYLG },
{ "GEN_WMYMECH", 0x20E, class, const.getGEN_WMYMECH },
{ "GEN_WMYMOUN", 0x20E, class, const.getGEN_WMYMOUN },
{ "GEN_WMYPLT", 0x20E, class, const.getGEN_WMYPLT },
{ "GEN_WMYRI", 0x20E, class, const.getGEN_WMYRI },
{ "GEN_WMYRO", 0x20E, class, const.getGEN_WMYRO },
{ "GEN_WMYSGRD", 0x20E, class, const.getGEN_WMYSGRD },
{ "GEN_WMYSKAT", 0x20E, class, const.getGEN_WMYSKAT },
{ "GEN_WMYST", 0x20E, class, const.getGEN_WMYST },
{ "GEN_WMYTX1", 0x20E, class, const.getGEN_WMYTX1 },
{ "GEN_WMYTX2", 0x20E, class, const.getGEN_WMYTX2 },
{ "GEN_WMYVA", 0x20E, class, const.getGEN_WMYVA },
{ "GFD_BARBARA", 0x20E, class, const.getGFD_BARBARA },
{ "GFD_BMOBAR", 0x20E, class, const.getGFD_BMOBAR },
{ "GFD_BMYBARB", 0x20E, class, const.getGFD_BMYBARB },
{ "GFD_BMYTATT", 0x20E, class, const.getGFD_BMYTATT },
{ "GFD_CATALINA", 0x20E, class, const.getGFD_CATALINA },
{ "GFD_DENISE", 0x20E, class, const.getGFD_DENISE },
{ "GFD_HELENA", 0x20E, class, const.getGFD_HELENA },
{ "GFD_KATIE", 0x20E, class, const.getGFD_KATIE },
{ "GFD_MICHELLE", 0x20E, class, const.getGFD_MICHELLE },
{ "GFD_MILLIE", 0x20E, class, const.getGFD_MILLIE },
{ "GFD_POL_ANN", 0x20E, class, const.getGFD_POL_ANN },
{ "GFD_WFYBURG", 0x20E, class, const.getGFD_WFYBURG },
{ "GFD_WFYCLOT", 0x20E, class, const.getGFD_WFYCLOT },
{ "GFD_WMYAMMO", 0x20E, class, const.getGFD_WMYAMMO },
{ "GFD_WMYBARB", 0x20E, class, const.getGFD_WMYBARB },
{ "GFD_WMYBELL", 0x20E, class, const.getGFD_WMYBELL },
{ "GFD_WMYCLOT", 0x20E, class, const.getGFD_WMYCLOT },
{ "GFD_WMYPIZZ", 0x20E, class, const.getGFD_WMYPIZZ },
{ "GNG_BALLAS1", 0x20E, class, const.getGNG_BALLAS1 },
{ "GNG_BALLAS2", 0x20E, class, const.getGNG_BALLAS2 },
{ "GNG_BALLAS3", 0x20E, class, const.getGNG_BALLAS3 },
{ "GNG_BALLAS4", 0x20E, class, const.getGNG_BALLAS4 },
{ "GNG_BALLAS5", 0x20E, class, const.getGNG_BALLAS5 },
{ "GNG_BIG_BEAR", 0x20E, class, const.getGNG_BIG_BEAR },
{ "GNG_CESAR", 0x20E, class, const.getGNG_CESAR },
{ "GNG_DNB1", 0x20E, class, const.getGNG_DNB1 },
{ "GNG_DNB2", 0x20E, class, const.getGNG_DNB2 },
{ "GNG_DNB3", 0x20E, class, const.getGNG_DNB3 },
{ "GNG_DNB5", 0x20E, class, const.getGNG_DNB5 },
{ "GNG_DWAINE", 0x20E, class, const.getGNG_DWAINE },
{ "GNG_FAM1", 0x20E, class, const.getGNG_FAM1 },
{ "GNG_FAM2", 0x20E, class, const.getGNG_FAM2 },
{ "GNG_FAM3", 0x20E, class, const.getGNG_FAM3 },
{ "GNG_FAM4", 0x20E, class, const.getGNG_FAM4 },
{ "GNG_FAM5", 0x20E, class, const.getGNG_FAM5 },
{ "GNG_JIZZY", 0x20E, class, const.getGNG_JIZZY },
{ "GNG_LSV1", 0x20E, class, const.getGNG_LSV1 },
{ "GNG_LSV2", 0x20E, class, const.getGNG_LSV2 },
{ "GNG_LSV3", 0x20E, class, const.getGNG_LSV3 },
{ "GNG_LSV4", 0x20E, class, const.getGNG_LSV4 },
{ "GNG_LSV5", 0x20E, class, const.getGNG_LSV5 },
{ "GNG_MACCER", 0x20E, class, const.getGNG_MACCER },
{ "GNG_MAFBOSS", 0x20E, class, const.getGNG_MAFBOSS },
{ "GNG_OGLOC", 0x20E, class, const.getGNG_OGLOC },
{ "GNG_RYDER", 0x20E, class, const.getGNG_RYDER },
{ "GNG_SFR1", 0x20E, class, const.getGNG_SFR1 },
{ "GNG_SFR2", 0x20E, class, const.getGNG_SFR2 },
{ "GNG_SFR3", 0x20E, class, const.getGNG_SFR3 },
{ "GNG_SFR4", 0x20E, class, const.getGNG_SFR4 },
{ "GNG_SFR5", 0x20E, class, const.getGNG_SFR5 },
{ "GNG_SMOKE", 0x20E, class, const.getGNG_SMOKE },
{ "GNG_STRI1", 0x20E, class, const.getGNG_STRI1 },
{ "GNG_STRI2", 0x20E, class, const.getGNG_STRI2 },
{ "GNG_STRI4", 0x20E, class, const.getGNG_STRI4 },
{ "GNG_STRI5", 0x20E, class, const.getGNG_STRI5 },
{ "GNG_SWEET", 0x20E, class, const.getGNG_SWEET },
{ "GNG_TBONE", 0x20E, class, const.getGNG_TBONE },
{ "GNG_TORENO", 0x20E, class, const.getGNG_TORENO },
{ "GNG_TRUTH", 0x20E, class, const.getGNG_TRUTH },
{ "GNG_VLA1", 0x20E, class, const.getGNG_VLA1 },
{ "GNG_VLA2", 0x20E, class, const.getGNG_VLA2 },
{ "GNG_VLA3", 0x20E, class, const.getGNG_VLA3 },
{ "GNG_VLA4", 0x20E, class, const.getGNG_VLA4 },
{ "GNG_VLA5", 0x20E, class, const.getGNG_VLA5 },
{ "GNG_VMAFF1", 0x20E, class, const.getGNG_VMAFF1 },
{ "GNG_VMAFF2", 0x20E, class, const.getGNG_VMAFF2 },
{ "GNG_VMAFF3", 0x20E, class, const.getGNG_VMAFF3 },
{ "GNG_VMAFF4", 0x20E, class, const.getGNG_VMAFF4 },
{ "GNG_VMAFF5", 0x20E, class, const.getGNG_VMAFF5 },
{ "GNG_WOOZIE", 0x20E, class, const.getGNG_WOOZIE },
{ "Group", 0x6, System.String },
{ "Name", 0x6, System.String },
{ "PLY_AG", 0x20E, class, const.getPLY_AG },
{ "PLY_AG2", 0x20E, class, const.getPLY_AG2 },
{ "PLY_AR", 0x20E, class, const.getPLY_AR },
{ "PLY_AR2", 0x20E, class, const.getPLY_AR2 },
{ "PLY_CD", 0x20E, class, const.getPLY_CD },
{ "PLY_CD2", 0x20E, class, const.getPLY_CD2 },
{ "PLY_CF", 0x20E, class, const.getPLY_CF },
{ "PLY_CF2", 0x20E, class, const.getPLY_CF2 },
{ "PLY_CG", 0x20E, class, const.getPLY_CG },
{ "PLY_CG2", 0x20E, class, const.getPLY_CG2 },
{ "PLY_CR", 0x20E, class, const.getPLY_CR },
{ "PLY_CR2", 0x20E, class, const.getPLY_CR2 },
{ "PLY_PG", 0x20E, class, const.getPLY_PG },
{ "PLY_PG2", 0x20E, class, const.getPLY_PG2 },
{ "PLY_PR", 0x20E, class, const.getPLY_PR },
{ "PLY_PR2", 0x20E, class, const.getPLY_PR2 },
{ "PLY_WG", 0x20E, class, const.getPLY_WG },
{ "PLY_WG2", 0x20E, class, const.getPLY_WG2 },
{ "PLY_WR", 0x20E, class, const.getPLY_WR },
{ "PLY_WR2", 0x20E, class, const.getPLY_WR2 }
},
methods = {
{ ".ctor", 0x206, __ctor2__, System.String, System.String }
}
}
end
}
return class
end)
end)
|
strman = {};
strman.Words = {["a"]=true, ["b"]=true, ["c"]=true, ["d"]=true, ["e"]=true, ["f"]=true,
["g"]=true, ["h"]=true, ["i"]=true, ["j"]=true, ["k"]=true, ["l"]=true,
["m"]=true, ["n"]=true, ["o"]=true, ["p"]=true, ["q"]=true, ["r"]=true,
["s"]=true, ["t"]=true, ["u"]=true, ["v"]=true, ["w"]=true, ["x"]=true,
["y"]=true, ["z"]=true,
["A"]=true, ["B"]=true, ["C"]=true, ["D"]=true, ["E"]=true, ["F"]=true,
["G"]=true, ["H"]=true, ["I"]=true, ["J"]=true, ["K"]=true, ["L"]=true,
["M"]=true, ["N"]=true, ["O"]=true, ["P"]=true, ["Q"]=true, ["R"]=true,
["S"]=true, ["T"]=true, ["U"]=true, ["V"]=true, ["W"]=true, ["X"]=true,
["Y"]=true, ["Z"]=true};
strman.str2table = function (str)
local t = {};
local len = string.len(str);
local arr = {0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
local j = 0;
for i=1,len do
if i > j then
local c = string.byte(str, i);
local offset = 1;
if c < 0xc0 then
offset = 1;
elseif c < 0xe0 then
offset = 2;
elseif c < 0xf0 then
offset = 3;
elseif c < 0xf8 then
offset = 4;
elseif c < 0xfc then
offset = 5;
end
t[#t+1] = string.sub(str, i, i+offset-1);
j = i+offset-1;
end
end
return t;
end
strman.split = function (s, p)
local t = strman.str2table(s);
if '' == p then
return t;
end
local np = strman.str2table(p);
local nt = {};
local ts = '';
ignore = 0;
for i=1,#t do
if i > ignore then
local same = true;
for j=1,#np do
local index = i+j-1;
if t[index] ~= np[j] then
same = false;
end
end
if same then
nt[#nt+1] = ts;
ts = '';
ignore = i+#np-1;
else
ts = ts .. t[i];
end
end
end
nt[#nt+1] = ts;
return nt;
end
strman.chars = function (value)
return strman.split(value, '');
end
strman.substr = function (value, start, length)
local t = strman.str2table(value);
local ns = '';
local e = start + length - 1;
for i=1,#t do
if i < start then
elseif i > e then
return ns;
else
ns = ns .. t[i];
end
end
return ns;
end
strman.toUpperCase = function (value)
return string.upper(value);
end
strman.startsWith = function (value, search)
local len = #strman.str2table(search);
return strman.substr(value, 1, len) == search;
end
strman.append = function ( ... )
local arg = {...};
local ns = '';
for i=1,#arg do
ns = ns .. arg[i];
end
return ns;
end
strman.ensureleft = function (value, substr)
return strman.append(substr, value);
end
strman.inequal = function (stringA, stringB)
return stringA ~= stringB;
end
strman.surround = function (value, left, right)
return strman.append(left, value, right);
end
strman.truncate = function (value, length, substr)
if nil == substr then
substr = '';
end
local ns = strman.substr(value, 1, length);
return strman.append(ns, substr);
end
strman.replace = function (value, stra, strb)
local t = strman.split(value, stra);
local ns = '';
local len = #t-1;
for i=1,len do
ns = ns .. t[i] .. strb;
end
ns = ns .. t[#t];
return ns;
end
strman.leftTrim = function (value)
local t = strman.str2table(value);
for i=1,#t do
if ' ' ~= t[i] then
return strman.substr(value, i, #t);
end
end
return '';
end
strman.rightTrim = function (value)
local t = strman.str2table(value);
for i=#t,1,-1 do
if ' ' ~= t[i] then
return strman.substr(value, 1, i);
end
end
return '';
end
strman.trim = function (value)
return strman.leftTrim(strman.rightTrim(value))
end
strman.collapseWhitespace = function (value)
local t = strman.str2table(value);
local s = '';
for i=1,#t do
if ' ' ~= t[i] then
s = s .. t[i];
end
end
return s;
end
strman.indexOf = function (value, needle)
local t = strman.str2table(value);
local np = strman.str2table(needle);
for i=1,#t do
local same = true;
for j=1,#np do
local index = i+j-1;
if t[index] ~= np[j] then
same = false;
end
end
if same then
return i;
end
end
return -1;
end
strman.isInteger = function (value)
return tonumber(value) ~= nil;
end
strman.endsWith = function (value, search)
local t = strman.str2table(value);
local np = strman.str2table(search);
for i=0,#np-1 do
if np[#np-i] ~= t[#t-i] then
return false;
end
end
return true;
end
strman.ensureright = function (value, substr)
return strman.append(value, substr);
end
strman.insert = function (value, substr, index)
local t = strman.str2table(value);
local ns = '';
for i=1,#t do
if i == index then
ns = ns .. substr .. t[i];
else
ns = ns .. t[i];
end
end
return ns;
end
strman.toLowerCase = function (value)
return string.lower(value);
end
strman.equal = function (stringA, stringB)
return stringA == stringB;
end
strman.compare = function (stringA, stringB)
if stringA == stringB then
return 0;
end
if stringA > stringB then
return 1;
end
return -1;
end
strman.isLowerCase = function (value)
return value == strman.toLowerCase(value);
end
strman.removeEmptyStrings = function ( ... )
local t = {...};
local s = '';
for i=1,#t do
if " " == t[i] or '' == t[i] or nil == t[i] then
else
s = s .. t[i];
end
end
return s;
end
strman.param2table = function ( ... )
return {...};
end
strman.lastIndexOf = function (value, needle)
local t = strman.str2table(value);
local np = strman.str2table(needle);
for i=#t,1,-1 do
local same = true;
for j=1,#np do
local index = i-j+1;
if t[index] ~= np[#np-j+1] then
same = false;
end
end
if same then
return i-#np+1;
end
end
return -1;
end
strman.contains = function (value, needle)
local index = strman.indexOf(value, needle);
return index > -1;
end
strman.first = function (value, n)
return strman.substr(value, 1, n);
end
strman.isString = function (value)
if strman.isInteger(value) then
return false;
end
return type(value) == "string";
end
strman.removeLeft = function (value, prefix)
local t = strman.str2table(prefix);
local vt = strman.str2table(value);
return strman.substr(value, #t+1, #vt);
end
strman.at = function(value, index)
local t = strman.str2table(value);
return t[index];
end
strman.containsAll = function (value, needles)
for i=1,#needles do
if not strman.contains(value, needles[i]) then
return false;
end
end
return true;
end
strman.format = string.format;
strman.isUpperCase = function (value)
return value == strman.toUpperCase(value);
end
strman.removeNoWords = function(value)
local t = strman.str2table(value);
local nt = {};
for i=1,#t do
if strman.Words[t[i]] == true then
nt[#nt+1] = t[i];
end
end
return table.concat(nt);
end
return strman; |
require("core/eventDispatcher");
require("common/nativeEvent");
require("gameData/dataInterfaceBase");
require("gameData/clientInfo");
require("hall/gameData/videosdk/videosdkConstants");
require("hall/userInfo/data/userInfoData");
require("hall/setting/data/settingDataInterface");
VideoSDKHelper = class(DataInterfaceBase);
VideoSDKHelper.Delegate = {
onVideoCmdLogin = "onVideoCmdLogin";
onVideoCmdMicrophoneOpen = "onVideoCmdMicrophoneOpen";
onVideoCmdMicrophoneClose = "onVideoCmdMicrophoneClose";
onVideoCmdUsersStatusChange = "onVideoCmdUsersStatusChange";
onVideoCmdMicrophoneOpenError = "onVideoCmdMicrophoneOpenError";
-- onVideoCmdNetworkChange = "onVideoCmdNetworkChange";
};
VideoSDKHelper.getInstance = function()
if not VideoSDKHelper.s_instance then
VideoSDKHelper.s_instance = new(VideoSDKHelper);
end
return VideoSDKHelper.s_instance;
end
VideoSDKHelper.releaseInstance = function()
delete(VideoSDKHelper.s_instance);
VideoSDKHelper.s_instance = nil;
end
VideoSDKHelper.ctor = function(self)
EventDispatcher.getInstance():register(Event.Call, self, self.onNativeEvent);
self:reset();
end
VideoSDKHelper.dtor = function(self)
EventDispatcher.getInstance():unregister(Event.Call, self, self.onNativeEvent);
self:_deleteAllTimer();
end
VideoSDKHelper.reset = function(self)
self.m_isLogined = false; -- 保证开关麦克风和登出请求在登入之后
self.m_isLogining = false; -- 保证不会同时存在多个登入请求
self.m_isMicrophoneOpened = false; -- 保证关闭麦克风请求在开启麦克风之后
self.m_isMicrophoneOperating = false; -- 保证麦克风操作是原子操作
self:resetUserList();
end
VideoSDKHelper.resetUserList = function(self)
if not table.isEmpty(self.m_userList) then
for k, v in pairs(self.m_userList) do
self.m_userList[k] = false;
end
self:refreshUsersStatus();
end
self.m_userList = {};
end
VideoSDKHelper.login = function(self, gameId, roomId)
self.m_gameId = gameId;
self.m_roomId = roomId;
self.m_loginCount = 1;
self:_login(self.m_gameId, self.m_roomId);
end
VideoSDKHelper.logout = function(self)
self:_log("VideoSDKHelper.logout", "isLogined", self.m_isLogined);
self:reset();
self:_deleteAllTimer();
NativeEvent.getInstance():videoLogout();
end
VideoSDKHelper.openMicrophone = function(self)
self:_log("VideoSDKHelper.openMicrophone", "isLogined", self.m_isLogined, "isOperating", self.m_isMicrophoneOperating);
if not self.m_isLogined and not self.m_isMicrophoneOperating then
self:_log("VideoSDKHelper.openMicrophone", "return");
return;
end
self:_createTimeoutTimer(self.onVideoCmdMicrophoneOperateFail);
self.m_isMicrophoneOpened = true;
self.m_isMicrophoneOperating = true;
UBReport.getInstance():report(UBConfig.kVideoMicrophoneUse, string.format("gameId%s_roomId%s", self.m_gameId or "", self.m_roomId or ""))
dict_set_string(VideoSDKConstants.DICT_NAME, VideoSDKConstants.KEY_NETWORK_TIPS, kTextChatRealTimeOperateTipsNetwork);
NativeEvent.getInstance():videoOpenMicrophone();
end
VideoSDKHelper.closeMicrophone = function(self)
self:_log("VideoSDKHelper.closeMicrophone", "isLogined", self.m_isLogined, "isOperating", self.m_isMicrophoneOperating,
"isOpened", self.m_isMicrophoneOpened);
if not self.m_isLogined and not self.m_isMicrophoneOpened and not self.m_isMicrophoneOperating then
self:_log("VideoSDKHelper.closeMicrophone", "return");
return;
end
self:_createTimeoutTimer(self.onVideoCmdMicrophoneOperateFail);
self.m_isMicrophoneOpened = false;
UBReport.getInstance():report(UBConfig.kVideoMicrophoneUseEnd, string.format("gameId%s_roomId%s", self.m_gameId or "", self.m_roomId or ""))
NativeEvent.getInstance():videoCloseMicrophone();
end
VideoSDKHelper.isLogined = function(self)
return self.m_isLogined;
end
VideoSDKHelper.refreshUsersStatus = function(self, isLogined)
local userId = isLogined and self.m_userListFinalUserId or nil;
self:notify(VideoSDKHelper.Delegate.onVideoCmdUsersStatusChange, self.m_userList, userId);
end
VideoSDKHelper.setMicrophoneState = function(self, state)
self.m_microphoneState = state;
end
VideoSDKHelper.getMicrophoneState = function(self)
return self.m_microphoneState;
end
-- VideoSDKHelper.isNetWorkSupport = function(self)
-- local ret = true;
-- local networkType = NativeEvent.getInstance():getNetworkType();
-- if networkType == -1 or (networkType == 2 and not Region_video_support_2G) then
-- ret = false;
-- end
-- self:_log("VideoSDKHelper.isNetWorkSupport", "networkType", networkType, "ret", ret);
-- return ret;
-- end
-- VideoSDKHelper.isNetWorkSupportByType = function(self, networkType)
-- local ret = true;
-- if networkType == -1 or (networkType == 2 and not Region_video_support_2G) then
-- ret = false;
-- end
-- self:_log("VideoSDKHelper.isNetWorkSupportByType", "networkType", networkType, "ret", ret);
-- return ret;
-- end
-----------------------------------------------------------------------------------
-- 未定义指令
VideoSDKHelper.onVideoCmdUndefine = function(self, data)
-- donothing
end
-- 登录成功
VideoSDKHelper.onVideoCmdLoginSuccess = function(self, data)
self:_deleteTimer();
self.m_isLogined = true;
self.m_isLogining = false;
self:notify(VideoSDKHelper.Delegate.onVideoCmdLogin, self.m_isLogined);
self:refreshUsersStatus(true);
end
-- 登录失败
VideoSDKHelper.onVideoCmdLoginFail = function(self, data)
self.m_isLogined = false;
self.m_isLogining = false;
self:notify(VideoSDKHelper.Delegate.onVideoCmdLogin, self.m_isLogined);
self._onTimer();
end
-- 麦克风开启回调
VideoSDKHelper.onVideoCmdMicrophoneOpen = function(self, data)
self:_deleteTimeoutTimer();
self.m_isMicrophoneOperating = false;
self:notify(VideoSDKHelper.Delegate.onVideoCmdMicrophoneOpen, true);
end
-- 麦克风关闭回调
VideoSDKHelper.onVideoCmdMicrophoneClose = function(self, data)
self:_deleteTimeoutTimer();
self.m_isMicrophoneOperating = false;
self:notify(VideoSDKHelper.Delegate.onVideoCmdMicrophoneClose, true);
end
-- 麦克风操作失败回调
VideoSDKHelper.onVideoCmdMicrophoneOperateFail = function(self, data)
self:_deleteTimeoutTimer();
self.m_isMicrophoneOperating = false;
if self.m_isMicrophoneOpened then
self:notify(VideoSDKHelper.Delegate.onVideoCmdMicrophoneOpen, false);
else
self:notify(VideoSDKHelper.Delegate.onVideoCmdMicrophoneClose, false);
end
end
VideoSDKHelper.onVideoCmdUsersStatusChange = function(self, data)
local isEnable = tonumber(data.isEnable.__value) or 0;
local userId = tonumber(data.userId.__value);
if not userId then
return;
end
self.m_userList[userId] = isEnable == 1;
self.m_userListFinalUserId = userId;
if self.m_isLogined then
self:notify(VideoSDKHelper.Delegate.onVideoCmdUsersStatusChange, self.m_userList, userId);
end
end
-- 麦克风开启错误,权限问题
VideoSDKHelper.onVideoCmdMicrophoneOpenError = function(self, data)
self:notify(VideoSDKHelper.Delegate.onVideoCmdMicrophoneOpenError);
end
-- 操作被阻塞
VideoSDKHelper.onVideoCmdDialogShowing = function(self, data)
self:_deleteTimeoutTimer();
end
-- -- 网络状态改变
-- VideoSDKHelper.onVideoCmdNetworkChange = function(self, data)
-- local networkType = tonumber(data.networkType.__value) or -1;
-- self:notify(VideoSDKHelper.Delegate.onVideoCmdNetworkChange, networkType);
-- end
-- 用户离开
VideoSDKHelper.onVideoCmdUserLeave = function(self, data)
audio_exit_record();
kMusicPlayer:play(kMusicPlayer:getCurSoundIndex(), true)
audio_enter_record();
end
-- 指令处理
VideoSDKHelper.videoResultCallback = function(self, isSuccess, data, result)
self:_log("VideoSDKHelper.videoResultCallback", "result", result, data);
if not (isSuccess and data and data.cmd) then
return;
end
local cmd = tostring(data.cmd.__value) or "";
local func = VideoSDKHelper.s_cmdEventFuncMap[cmd];
if func then
func(self, data);
end
end
-- 原生回调
VideoSDKHelper.onNativeEvent = function(self, param, ...)
if self.s_nativeEventFuncMap[param] then
self.s_nativeEventFuncMap[param](self, ...);
end
end
----------------------------------------------------------------------
VideoSDKHelper._login = function(self, gameId, roomId)
if self.m_isLogined or self.m_isLogining then
return;
end
self:_log(string.format("第%s次尝试登录", self.m_loginCount));
local appId = gameId; -- 以gameId作为appId
local userId = kUserInfoData:getUserId();
local support2G = RegionConfigDataInterface.getInstance():getVideoSupport2GFlag() and 1 or 0;
local networkType = VideoSDKConstants.VersionMap[NETWORK_TYPE];
dict_set_int(VideoSDKConstants.DICT_NAME, VideoSDKConstants.KEY_APP_ID, appId);
dict_set_int(VideoSDKConstants.DICT_NAME, VideoSDKConstants.KEY_USER_ID, userId);
dict_set_int(VideoSDKConstants.DICT_NAME, VideoSDKConstants.KEY_ROOM_ID, roomId);
dict_set_int(VideoSDKConstants.DICT_NAME, VideoSDKConstants.KEY_SUPPORT_2G, support2G);
dict_set_int(VideoSDKConstants.DICT_NAME, VideoSDKConstants.KEY_VERSION, networkType[1]);
self:_log("VideoSDKHelper.login","appId",appId,"userId",userId,"roomId",roomId, "support2G", support2G,
"networkType", NETWORK_TYPE, "version", networkType[2]);
self:_createTimer();
self.m_isLogining = true;
NativeEvent.getInstance():videoLogin();
end
-----------------------------------------------------------------------------
VideoSDKHelper._createTimer = function(self)
self:_deleteTimer();
self.m_timer = new(Timer, "video_sdk", 15, self, self._onTimer);
end
VideoSDKHelper._deleteTimer = function(self)
if self.m_timer then
delete(self.m_timer);
self.m_timer = nil;
end
end
VideoSDKHelper._onTimer = function(self)
if not self then
return;
end
self:_deleteTimer();
self.m_loginCount = self.m_loginCount + 1;
self.m_isLogining = false;
if self.m_loginCount <= 5 then
self:_login(self.m_gameId, self.m_roomId);
end
end
VideoSDKHelper._createTimeoutTimer = function(self, func)
self:_log("VideoSDKHelper._createTimeoutTimer");
self:_deleteTimeoutTimer();
self.m_timeoutTimer = new(Timer, "video_sdk_timeout", 8, self, self._onTimeout, func);
end
VideoSDKHelper._onTimeout = function(self, func)
if not self then
return;
end
self:_log("VideoSDKHelper._onTimeout");
self:_deleteTimeoutTimer();
if func then
func(self);
end
end
VideoSDKHelper._deleteTimeoutTimer = function(self)
self:_log("VideoSDKHelper._deleteTimeoutTimer");
if self.m_timeoutTimer then
delete(self.m_timeoutTimer);
self.m_timeoutTimer = nil;
end
end
VideoSDKHelper._deleteAllTimer = function(self)
self:_deleteTimer();
self:_deleteTimeoutTimer();
end
VideoSDKHelper._log = function(self, ...)
Log.d("VideoSDK", ...);
end
VideoSDKHelper.s_cmdEventFuncMap = {
[VideoSDKConstants.CMD_UNDEFINE] = VideoSDKHelper.onVideoCmdUndefine;
[VideoSDKConstants.CMD_LOGIN_SUCCESS] = VideoSDKHelper.onVideoCmdLoginSuccess;
[VideoSDKConstants.CMD_LOGIN_FAIL] = VideoSDKHelper.onVideoCmdLoginFail;
[VideoSDKConstants.CMD_MICROPHONE_OPEN] = VideoSDKHelper.onVideoCmdMicrophoneOpen;
[VideoSDKConstants.CMD_MICROPHONE_CLOSE] = VideoSDKHelper.onVideoCmdMicrophoneClose;
[VideoSDKConstants.CMD_MICROPHONE_OPERATE_FAIL] = VideoSDKHelper.onVideoCmdMicrophoneOperateFail;
[VideoSDKConstants.CMD_USERS_STATUS_CHANGE] = VideoSDKHelper.onVideoCmdUsersStatusChange;
[VideoSDKConstants.CMD_MICROPHONE_OPEN_ERROR] = VideoSDKHelper.onVideoCmdMicrophoneOpenError;
[VideoSDKConstants.CMD_DIALOG_SHOWING] = VideoSDKHelper.onVideoCmdDialogShowing;
[VideoSDKConstants.CMD_USER_LEAVE] = VideoSDKHelper.onVideoCmdUserLeave;
};
VideoSDKHelper.s_nativeEventFuncMap = {
["videoResultCallback"] = VideoSDKHelper.videoResultCallback;
};
|
local ok, null_ls = pcall(require, "null-ls")
if not ok then
return
end
local formatting = null_ls.builtins.formatting
local diagnostics = null_ls.builtins.diagnostics
local code_actions = null_ls.builtins.code_actions
null_ls.setup {
sources = {
diagnostics.hadolint,
diagnostics.eslint_d,
formatting.prettierd,
formatting.stylua,
formatting.gofmt,
formatting.taplo,
formatting.shfmt.with {
filetypes = { "sh", "bash", "zsh" },
},
code_actions.eslint_d,
},
on_attach = function(client)
if client.resolved_capabilities.document_formatting then
vim.cmd "autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()"
end
end,
}
|
return {
UniqueId = "editor.$native.string",
Name = "Default String Editor",
Description = "The string editor included with PropertiesMod",
Attribution = "",
Filters = {"Primitive:string"},
EntryPoint = "main",
} |
xpcall(function()
newoption {
trigger = "builddir",
value = "path",
description = "Output directory for build/ files."
}
newoption {
trigger = "bindir",
value = "path",
description = "Root directory for bin/ files."
}
dofile('tools/build/init.lua')
-- perform component processing
if _OPTIONS['game'] == 'dummy' then
return
end
root_cwd = os.getcwd()
-- initialize components
dofile('components/config.lua')
dofile('vendor/config.lua')
load_privates('privates_config.lua')
component
{
name = 'platform:' .. os.get(),
rawName = os.get(),
vendor = { dummy = true }
}
workspace "CitizenMP"
configurations { "Debug", "Release" }
symbols "On"
characterset "Unicode"
flags { "No64BitChecks" }
flags { "NoIncrementalLink", "NoEditAndContinue", "NoMinimalRebuild" } -- this breaks our custom section ordering in citilaunch, and is kind of annoying otherwise
includedirs {
"shared/",
"client/shared/",
"../vendor/jitasm/",
"../vendor/rapidjson/include/",
"../vendor/fmtlib/",
"deplibs/include/",
os.getenv("BOOST_ROOT")
}
defines { "GTEST_HAS_PTHREAD=0", "BOOST_ALL_NO_LIB" }
defines { "_HAS_AUTO_PTR_ETC" } -- until boost gets fixed
libdirs { "deplibs/lib/" }
location ((_OPTIONS['builddir'] or "build/") .. _OPTIONS['game'])
if os.is('windows') then
buildoptions '/std:c++latest'
systemversion '10.0.15063.0'
end
-- special build dirs for FXServer
if _OPTIONS['game'] == 'server' then
location ("build/server/" .. os.get())
architecture 'x64'
defines 'IS_FXSERVER'
end
-- debug output
configuration "Debug*"
targetdir ((_OPTIONS['bindir'] or "bin/") .. _OPTIONS['game'] .. "/debug")
defines "NDEBUG"
-- this slows down the application a lot
defines { '_ITERATOR_DEBUG_LEVEL=0' }
-- allow one level of inlining
if os.is('windows') then
buildoptions '/Ob1'
end
-- special path for server
if _OPTIONS['game'] == 'server' then
targetdir ("bin/server/" .. os.get() .. "/debug")
end
-- release output
configuration "Release*"
targetdir ((_OPTIONS['bindir'] or "bin/") .. _OPTIONS['game'] .. "/release")
defines "NDEBUG"
optimize "Speed"
if _OPTIONS['game'] == 'server' then
targetdir ("bin/server/" .. os.get() .. "/release")
end
configuration "game=five"
architecture 'x64'
defines "GTA_FIVE"
configuration "windows"
links { "winmm" }
configuration "not windows"
buildoptions {
"-fPIC", -- required to link on AMD64
}
links { "c++" }
-- TARGET: launcher
if _OPTIONS['game'] ~= 'server' then
-- game launcher
include 'client/launcher'
include 'client/console'
else
include 'server/launcher'
end
-- TARGET: corert
include 'client/citicore'
if _OPTIONS['game'] ~= 'server' then
project "CitiGame"
targetname "CitizenGame"
language "C++"
kind "SharedLib"
includedirs { 'client/citicore/' }
files
{
"client/common/Error.cpp",
"client/citigame/Launcher.cpp",
"client/common/StdInc.cpp"
}
links { "Shared", "citicore" }
defines "COMPILING_GAME"
pchsource "client/common/StdInc.cpp"
pchheader "StdInc.h"
end
local buildHost = os.getenv("COMPUTERNAME") or 'dummy'
--[[if buildHost == 'FALLARBOR' then
project "CitiMono"
targetname "CitizenFX.Core"
language "C#"
kind "SharedLib"
files { "client/clrcore/**.cs" }
links { "System" }
configuration "Debug*"
targetdir "bin/debug/citizen/clr/lib/mono/4.5"
configuration "Release*"
targetdir "bin/release/citizen/clr/lib/mono/4.5"
end]]
group ""
-- TARGET: shared component
include "client/shared"
group "vendor"
if _OPTIONS['game'] ~= 'server' then
project "libcef_dll"
targetname "libcef_dll_wrapper"
language "C++"
kind "StaticLib"
defines { "USING_CEF_SHARED", "NOMINMAX", "WIN32", "WRAPPING_CEF_SHARED" }
flags { "NoIncrementalLink", "NoMinimalRebuild" }
includedirs { ".", "../vendor/cef" }
buildoptions "/MP"
files
{
"../vendor/cef/libcef_dll/**.cc",
"../vendor/cef/libcef_dll/**.cpp",
"../vendor/cef/libcef_dll/**.h"
}
end
-- run components
group "components"
do_components()
-- vendor is last so it can trigger even if it were merely tagged
group "vendor"
do_vendor()
end, function(e)
print(e)
print(debug.traceback())
os.exit(1)
end)
|
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
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
$Id$
]]--
--[[
LuCI - Lua Configuration Interface
$Id: users.lua 12/12/2014 by Hostle
]]--
module("luci.controller.admin.users", package.seeall)
function index()
local nw = require "luci.dispatcher"
local user = nw.get_user()
if user == "root" then
entry({"admin", "users"}, alias("admin", "users", "users"), _("Edit Users"), 55).index = true
entry({"admin", "users", "users"}, cbi("admin_users/users"), _("User Options"), 60)
end
if user ~= "root" then
name = string.sub(user:upper(),0,1) .. user:sub(2,-1)
entry({"admin", "users"}, alias("admin", "users", "passwd"), _(name.."s Options"), 55).index = true
entry({"admin", "users", "passwd"}, cbi("admin_users/passwd"), _("Password"), 62)
end
end
--## modified passwd function from system.lua, usses user to determine which users password to change ##--
function action_passwd()
local p1 = luci.http.formvalue("pwd1")
local p2 = luci.http.formvalue("pwd2")
local stat = nil
if p1 or p2 then
if p1 == p2 then
stat = luci.sys.user.setpasswd(user, p1)
else
stat = 10
end
end
luci.template.render("admin_users/passwd", {stat=stat})
end
|
local vmf = get_mod("VMF")
-- This variable is defined here and not in widget data initialization function because some error messages
-- require it to be dumped to game log.
local _unfolded_raw_widgets_data
-- Stores used setting_ids for initializable mod. Is used to detect if 2 widgets use the same setting_id
local _defined_mod_settings
-- #####################################################################################################################
-- ##### Local functions ###############################################################################################
-- #####################################################################################################################
-- #############################
-- # Default collapsed widgets #
-- #############################
-- @BUG: you can set it for disabled checkbox and it will be displayed as collapsed @TODO: fix it for new mod options
local function initialize_collapsed_widgets(mod, collapsed_widgets)
local new_collapsed_widgets = {}
for i, collapsed_widget_name in ipairs(collapsed_widgets) do
if type(collapsed_widget_name) == "string" then
new_collapsed_widgets[collapsed_widget_name] = true
else
vmf.throw_error("'collapsed_widgets[%d]' is not a string", i)
end
end
local options_menu_collapsed_widgets = vmf:get("options_menu_collapsed_widgets")
options_menu_collapsed_widgets[mod:get_name()] = new_collapsed_widgets
vmf:set("options_menu_collapsed_widgets", options_menu_collapsed_widgets)
end
-- ################
-- # Widgets data #
-- ################
-- ---------------------------------------------------------------------------------------------------------------------
-- ----| Header |-------------------------------------------------------------------------------------------------------
-- ---------------------------------------------------------------------------------------------------------------------
local function initialize_header_data(mod, data)
local new_data = {}
new_data.type = data.type
new_data.index = data.index
new_data.mod_name = mod:get_name()
new_data.readable_mod_name = mod:get_readable_name()
new_data.tooltip = mod:get_description()
new_data.is_togglable = mod:get_internal_data("is_togglable") and not mod:get_internal_data("is_mutator")
new_data.is_collapsed = vmf:get("options_menu_collapsed_mods")[mod:get_name()]
for _, favorited_mod_name in ipairs(vmf:get("options_menu_favorite_mods")) do
if favorited_mod_name == new_data.mod_name then
new_data.is_favorited = true
end
end
return new_data
end
-- ---------------------------------------------------------------------------------------------------------------------
-- ----| Generic |------------------------------------------------------------------------------------------------------
-- ---------------------------------------------------------------------------------------------------------------------
local function validate_generic_widget_data(data)
local setting_id = data.setting_id
if type(setting_id) ~= "string" then
vmf:dump(_unfolded_raw_widgets_data, "widgets", 1)
vmf.throw_error("[widget#%d (%s)]: 'setting_id' field is required and must have 'string' type. " ..
"See dumped table in game log for reference.", data.index, data.type)
end
if not data.localize and not data.title then
vmf.throw_error("[widget \"%s\" (%s)]: lacks 'title' field (localization is disabled)", setting_id, data.type)
end
if data.title and type(data.title) ~= "string" then
vmf.throw_error("[widget \"%s\" (%s)]: 'title' field must have 'string' type", setting_id, data.type)
end
if data.tooltip and type(data.tooltip) ~= "string" then
vmf.throw_error("[widget \"%s\" (%s)]: 'tooltip' field must have 'string' type", setting_id, data.type)
end
if _defined_mod_settings[setting_id] then
vmf:dump(_unfolded_raw_widgets_data, "widgets", 1)
vmf.throw_error("Widgets %d and %d have the same setting_id (\"%s\"). See dumped table in game log for reference.",
_defined_mod_settings[setting_id], data.index, setting_id)
else
_defined_mod_settings[setting_id] = data.index
end
end
local function localize_generic_widget_data(mod, data)
if data.localize then
data.title = mod:localize(data.title or data.setting_id)
if data.tooltip then
data.tooltip = mod:localize(data.tooltip)
else
data.tooltip = vmf.quick_localize(mod, data.setting_id .. "_description")
end
end
end
-- The data that applies to any widget, except for header
local function initialize_generic_widget_data(mod, data, localize)
local new_data = {}
-- Automatically generated values
new_data.index = data.index
new_data.parent_index = data.parent_index
new_data.depth = data.depth
new_data.mod_name = mod:get_name()
-- Defined in widget
new_data.type = data.type
new_data.setting_id = data.setting_id
new_data.title = data.title -- optional, if (localize == true)
new_data.tooltip = data.tooltip -- optional
new_data.default_value = data.default_value
-- Overwrite global optons localization setting if widget defined it
if data.localize == nil then
new_data.localize = localize
else
new_data.localize = data.localize
end
validate_generic_widget_data(new_data)
localize_generic_widget_data(mod, new_data)
new_data.tooltip = new_data.tooltip and (new_data.title .. "\n" .. new_data.tooltip)
return new_data
end
-- ---------------------------------------------------------------------------------------------------------------------
-- ----| Group |--------------------------------------------------------------------------------------------------------
-- ---------------------------------------------------------------------------------------------------------------------
local function initialize_group_data(mod, data, localize, collapsed_widgets)
local new_data = initialize_generic_widget_data(mod, data, localize)
if not data.sub_widgets or not (#data.sub_widgets > 0) then
vmf.throw_error("[widget \"%s\" (group)]: must have at least 1 sub_widget", data.setting_id)
end
new_data.is_collapsed = collapsed_widgets[data.setting_id]
return new_data
end
-- ---------------------------------------------------------------------------------------------------------------------
-- ----| Checkbox |-----------------------------------------------------------------------------------------------------
-- ---------------------------------------------------------------------------------------------------------------------
local function validate_checkbox_data(data)
if type(data.default_value) ~= "boolean" then
vmf.throw_error("[widget \"%s\" (checkbox)]: 'default_value' field is required and must have 'boolean' type",
data.setting_id)
end
end
local function initialize_checkbox_data(mod, data, localize, collapsed_widgets)
local new_data = initialize_generic_widget_data(mod, data, localize)
new_data.is_collapsed = collapsed_widgets[data.setting_id]
validate_checkbox_data(new_data)
return new_data
end
-- ---------------------------------------------------------------------------------------------------------------------
-- ----| Dropdown |-----------------------------------------------------------------------------------------------------
-- ---------------------------------------------------------------------------------------------------------------------
local allowed_dropdown_values = {
boolean = true,
string = true,
number = true
}
local function validate_dropdown_data(data)
if not allowed_dropdown_values[type(data.default_value)] then
vmf.throw_error("[widget \"%s\" (dropdown)]: 'default_value' field is required and must have 'string', " ..
"'number' or 'boolean' type", data.setting_id)
end
if type(data.options) ~= "table" then
vmf.throw_error("[widget \"%s\" (dropdown)]: 'options' field is required and must have 'table' type",
data.setting_id)
end
if #data.options < 2 then
vmf.throw_error("[widget \"%s\" (dropdown)]: 'options' table must have at least 2 elements", data.setting_id)
end
local default_value = data.default_value
local default_value_match = false
local used_values = {}
for i, option in ipairs(data.options) do
local option_value = option.value
if type(option.text) ~= "string" then
vmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]'-> 'text' field is required and must have " ..
"'string' type", data.setting_id, i)
end
if not allowed_dropdown_values[type(option_value)] then
vmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]'-> 'value' field is required and must have " ..
"'string', 'number' or 'boolean' type", data.setting_id, i)
end
if option.show_widgets and type(option.show_widgets) ~= "table" then
vmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]'-> 'show_widgets' field must have 'table' type",
data.setting_id, i)
end
if used_values[option_value] then
vmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]' has 'value' field set to the same value " ..
"as one of previous options", data.setting_id, i)
end
used_values[option_value] = true
if default_value == option_value then
default_value_match = true
end
end
if not default_value_match then
vmf.throw_error("[widget \"%s\" (dropdown)]: 'default_value' field contains value not defined in 'options' field",
data.setting_id)
end
end
local function localize_dropdown_data(mod, data)
local options = data.options
local localize = data.localize
if options.localize ~= nil then
localize = options.localize
end
if localize then
for _, option in ipairs(options) do
option.text = mod:localize(option.text)
end
end
end
local function initialize_dropdown_data(mod, data, localize, collapsed_widgets)
local new_data = initialize_generic_widget_data(mod, data, localize)
new_data.is_collapsed = collapsed_widgets[data.setting_id]
new_data.options = data.options
validate_dropdown_data(new_data)
localize_dropdown_data(mod, new_data)
-- Converting show_widgets from human-readable form to vmf-options-readable
-- i.e. {[1] = 2, [2] = 3, [3] = 5} -> {[113] = true, [114] = true, [116] = true}
-- Where the 2nd set of numbers are the real widget numbers of subwidgets
if data.sub_widgets ~= nil then
for i, option in ipairs(data.options) do
if option.show_widgets then
local new_show_widgets = {}
for j, sub_widget_index in ipairs(option.show_widgets) do
if data.sub_widgets[sub_widget_index] then
new_show_widgets[data.sub_widgets[sub_widget_index].index] = true
else
vmf.throw_error("[widget \"%s\" (dropdown)]: 'options -> [%d] -> show_widgets -> [%d] \"%s\"' points " ..
"to non-existing sub_widget", data.setting_id, i, j, sub_widget_index)
end
end
option.show_widgets = new_show_widgets
end
end
end
return new_data
end
-- ---------------------------------------------------------------------------------------------------------------------
-- ----| Keybind |------------------------------------------------------------------------------------------------------
-- ---------------------------------------------------------------------------------------------------------------------
local allowed_keybind_triggers = {
pressed = true,
released = true,
held = true
}
local allowed_keybind_types = {
function_call = true,
view_toggle = true,
mod_toggle = true
}
local allowed_modifier_keys = {
ctrl = true,
alt = true,
shift = true
}
local function validate_keybind_data(data)
if data.keybind_global and type(data.keybind_global) ~= "boolean" then
vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_global' field must have 'boolean' type", data.setting_id)
end
if not allowed_keybind_triggers[data.keybind_trigger] then
vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_trigger' field is required and must contain string " ..
"\"pressed\", \"released\" or \"held\"", data.setting_id)
end
local keybind_type = data.keybind_type
if not allowed_keybind_types[keybind_type] then
vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_type' field is required and must contain string " ..
"\"function_call\", \"view_toggle\" or \"mod_toggle\"", data.setting_id)
end
if keybind_type == "function_call" and type(data.function_name) ~= "string" then
vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_type' is set to \"function_call\" so 'function_name' " ..
"field is required and must have 'string' type", data.setting_id)
end
if keybind_type == "view_toggle" and type(data.view_name) ~= "string" then
vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_type' is set to \"view_toggle\" so 'view_name' " ..
"field is required and must have 'string' type", data.setting_id)
end
local default_value = data.default_value
if type(default_value) ~= "table" then
vmf.throw_error("[widget \"%s\" (keybind)]: 'default_value' field is required and must have 'table' type",
data.setting_id)
end
if #default_value > 4 then
vmf.throw_error("[widget \"%s\" (keybind)]: table stored in 'default_value' field can't exceed 4 elements",
data.setting_id)
end
if default_value[1] and not vmf.can_bind_as_primary_key(default_value[1]) then
vmf.throw_error("[widget \"%s\" (keybind)]: 'default_value[1]' must be a valid key name", data.setting_id)
end
if default_value[2] and not allowed_modifier_keys[default_value[2]] or
default_value[3] and not allowed_modifier_keys[default_value[3]] or
default_value[4] and not allowed_modifier_keys[default_value[4]]
then
vmf.throw_error("[widget \"%s\" (keybind)]: 'default_value [2], [3] and [4]' can be only strings: \"ctrl\", " ..
"\"alt\" and \"shift\" (in no particular order)", data.setting_id)
end
local used_keys = {}
for _, key in ipairs(default_value) do
if used_keys[key] then
vmf.throw_error("[widget \"%s\" (keybind)]: you can't define the same key in 'default_value' table twice",
data.setting_id)
end
used_keys[key] = true
end
end
local function initialize_keybind_data(mod, data, localize)
local new_data = initialize_generic_widget_data(mod, data, localize)
new_data.keybind_global = data.keybind_global -- optional
new_data.keybind_trigger = data.keybind_trigger
new_data.keybind_type = data.keybind_type
new_data.function_name = data.function_name -- required, if (keybind_type == "function_call")
new_data.view_name = data.view_name -- required, if (keybind_type == "view_toggle")
validate_keybind_data(new_data)
return new_data
end
-- ---------------------------------------------------------------------------------------------------------------------
-- ----| Numeric |------------------------------------------------------------------------------------------------------
-- ---------------------------------------------------------------------------------------------------------------------
local function validate_numeric_data(data)
if data.unit_text and type(data.unit_text) ~= "string" then
vmf.throw_error("[widget \"%s\" (numeric)]: 'unit_text' field must have 'string' type", data.setting_id)
end
if type(data.decimals_number) ~= "number" then
vmf.throw_error("[widget \"%s\" (numeric)]: 'decimals_number' field must have 'number' type", data.setting_id)
end
if data.decimals_number < 0 then -- @TODO: eventually do max cap as well
vmf.throw_error("[widget \"%s\" (numeric)]: 'decimals_number' value can't be lower than zero", data.setting_id)
end
local range = data.range
if type(range) ~= "table" then
vmf.throw_error("[widget \"%s\" (numeric)]: 'range' field is required and must have 'table' type", data.setting_id)
end
if #range ~= 2 then
vmf.throw_error("[widget \"%s\" (numeric)]: 'range' field must contain an array-like table with 2 elements",
data.setting_id)
end
local range_min = range[1]
local range_max = range[2]
if type(range_min) ~= "number" or type(range_max) ~= "number" then
vmf.throw_error("[widget \"%s\" (numeric)]: table stored in 'range' field must contain only numbers",
data.setting_id)
end
if range_min > range_max then
vmf.throw_error("[widget \"%s\" (numeric)]: 'range[2]' must be bigger than 'range[1]'", data.setting_id)
end
local default_value = data.default_value
if type(default_value) ~= "number" then
vmf.throw_error("[widget \"%s\" (numeric)]: 'default_value' field is required and must have 'number' type",
data.setting_id)
end
if default_value < range_min or default_value > range_max then
vmf.throw_error("[widget \"%s\" (numeric)]: 'default_value' field must contain number fitting set 'range'",
data.setting_id)
end
end
local function localize_numeric_data(mod, data)
if data.localize and data.unit_text then
data.unit_text = mod:localize(data.unit_text)
end
end
local function initialize_numeric_data(mod, data, localize)
local new_data = initialize_generic_widget_data(mod, data, localize)
new_data.unit_text = data.unit_text -- optional
new_data.range = data.range
new_data.decimals_number = data.decimals_number or 0 -- optional
validate_numeric_data(new_data)
localize_numeric_data(mod, new_data)
return new_data
end
-- ---------------------------------------------------------------------------------------------------------------------
-- ----| Other function |-----------------------------------------------------------------------------------------------
-- ---------------------------------------------------------------------------------------------------------------------
local function initialize_widget_data(mod, data, localize, collapsed_widgets)
if data.type == "header" then
return initialize_header_data(mod, data)
elseif data.type == "group" then
return initialize_group_data(mod, data, localize, collapsed_widgets)
elseif data.type == "checkbox" then
return initialize_checkbox_data(mod, data, localize, collapsed_widgets)
elseif data.type == "dropdown" then
return initialize_dropdown_data(mod, data, localize, collapsed_widgets)
elseif data.type == "keybind" then
return initialize_keybind_data(mod, data, localize)
elseif data.type == "numeric" then
return initialize_numeric_data(mod, data, localize)
end
-- if data.type is incorrect, returns nil
end
local allowed_parent_widget_types = {
header = true,
group = true,
checkbox = true,
dropdown = true
}
local function unfold_table(unfolded_table, unfoldable_table, parent_index, depth)
for i = 1, #unfoldable_table do
local nested_table = unfoldable_table[i]
if type(nested_table) == "table" then
table.insert(unfolded_table, nested_table)
nested_table.depth = depth
nested_table.index = #unfolded_table
nested_table.parent_index = parent_index
local nested_table_sub_widgets = allowed_parent_widget_types[nested_table.type] and nested_table.sub_widgets
if nested_table_sub_widgets then
if type(nested_table_sub_widgets) == "table" then
unfold_table(unfolded_table, nested_table_sub_widgets, #unfolded_table, depth + 1)
else
vmf:dump(unfolded_table, "widgets", 1)
vmf.throw_error("'sub_widgets' field of widget [%d] is not a table, it's %s. See dumped table in game log " ..
"for reference.", #unfolded_table, type(nested_table_sub_widgets))
end
end
else
vmf:dump(unfolded_table, "widgets", 1)
vmf.throw_error("sub_widget#%d of widget [%d] is not a table, it's %s. " ..
"See dumped table in game log for reference.", i, parent_index, type(nested_table))
end
end
return unfolded_table
end
local function initialize_mod_options_widgets_data(mod, widgets_data, localize)
widgets_data = widgets_data or {}
-- Override global localize option if it's set for widgets data
if widgets_data.localize ~= nil then
localize = widgets_data.localize
end
local initialized_data = {}
-- Define widget data for header widget, because it's not up to modders to define it.
local header_widget_data = {type = "header", sub_widgets = widgets_data}
-- Put data of all widgets in one-dimensional array in order they will be displayed in mod options.
_unfolded_raw_widgets_data = unfold_table({header_widget_data}, widgets_data, 1, 1)
-- Load info about widgets previously collapsed by user
local collapsed_widgets = vmf:get("options_menu_collapsed_widgets")[mod:get_name()] or {}
-- Before starting widgets data initialization, clear this table. It's used to detect if 2 widgets
-- defined the same setting_id.
_defined_mod_settings = {}
-- Initialize widgets' data.
for _, widget_data in ipairs(_unfolded_raw_widgets_data) do
local initialized_widget_data = initialize_widget_data(mod, widget_data, localize, collapsed_widgets)
if initialized_widget_data then
table.insert(initialized_data, initialized_widget_data)
else
vmf:dump(_unfolded_raw_widgets_data, "widgets", 1)
vmf.throw_error("[widget#%d]: 'type' field must contain valid widget type name. " ..
"See dumped table in game log for reference.", widget_data.index, widget_data.type)
end
end
return initialized_data
end
-- ################################################
-- # Default settings and keybinds initialization #
-- ################################################
local function initialize_default_settings_and_keybinds(mod, initialized_widgets_data)
for i = 2, #initialized_widgets_data do
local data = initialized_widgets_data[i]
if mod:get(data.setting_id) == nil and data.type ~= "group" then
mod:set(data.setting_id, data.default_value)
end
if data.type == "keybind" then
vmf.add_mod_keybind(mod, data.setting_id, data.keybind_global, data.keybind_trigger, data.keybind_type,
mod:get(data.setting_id), data.function_name, data.view_name)
end
end
end
-- #####################################################################################################################
-- ##### VMF internal functions and variables ##########################################################################
-- #####################################################################################################################
-- Is used in Mod Options to create options widgets
vmf.options_widgets_data = {}
-- Initializes mod's options data. If this function is called with 'options.widgets' not specified, it just creates
-- widget data with single header with checkbox.
function vmf.initialize_mod_options(mod, options)
options = options or {}
-- If this is the first time user launches this mod, set collapsed widgets list to default one.
if options.collapsed_widgets and not vmf.mod_has_settings(mod) then
initialize_collapsed_widgets(mod, options.collapsed_widgets)
end
-- Initialize mod's options widgets data.
local initialized_widgets_data = initialize_mod_options_widgets_data(mod, options.widgets, options.localize ~= false)
-- Initialize mod's settings that were not initialized before by setting them to their default values.
-- Also, initialize mod's keybinds.
initialize_default_settings_and_keybinds(mod, initialized_widgets_data)
-- Insert initialized widgets data to the table which will be used by Mod Options to built options widgets list
-- for this mod.
table.insert(vmf.options_widgets_data, initialized_widgets_data)
end
-- #####################################################################################################################
-- ##### Script ########################################################################################################
-- #####################################################################################################################
if type(vmf:get("options_menu_favorite_mods")) ~= "table" then
vmf:set("options_menu_favorite_mods", {})
end
if type(vmf:get("options_menu_collapsed_mods")) ~= "table" then
vmf:set("options_menu_collapsed_mods", {})
end
if type(vmf:get("options_menu_collapsed_widgets")) ~= "table" then
vmf:set("options_menu_collapsed_widgets", {})
end
|
local client_module = require('lsp-selection-range.client')
local utils = require('lsp-selection-range.tests.helpers.utils')
local simple_php = require('lsp-selection-range.tests.helpers.simple-php')
local stub = require('luassert.stub')
describe('client', function()
describe('select()', function()
local function create_client(name, server_capabilities)
return { name = name, server_capabilities = server_capabilities }
end
local buf_get_clients
local php_client = create_client('php', { selectionRangeProvider = true })
local lua_client = create_client('lua', { selectionRangeProvider = false })
local ts_client = create_client('ts', { selectionRangeProvider = true })
---@vararg Client
local function attach_clients_to_current_buffer(...)
buf_get_clients.returns({ ... })
end
before_each(function()
buf_get_clients = stub(vim.lsp, 'buf_get_clients')
buf_get_clients.returns({})
end)
after_each(function()
buf_get_clients:revert()
end)
it('returns "nil" when there is no client', function()
local client = client_module.select()
assert.same(nil, client, 'no client must be returned')
end)
it('returns "nil" when no client have the "selectionRangeProvider" capability', function()
attach_clients_to_current_buffer(lua_client)
local client = client_module.select()
assert.same(nil, client, 'no client must be returned')
end)
it('returns the only client with the "selectionRangeProvider" capability', function()
attach_clients_to_current_buffer(php_client, lua_client)
local client = client_module.select()
assert.same(php_client, client, 'the "php" client must be returned')
end)
it('asks the user to select the client to use when more than one are eligible', function()
local ui_select = stub(vim.ui, 'select')
attach_clients_to_current_buffer(ts_client, lua_client, php_client)
ui_select.invokes(function(clients, opts, on_choice)
assert.same(clients[1].name, opts.format_item(clients[1]), 'clients must be formated by name')
assert.same({ php_client, ts_client }, clients, 'clients must be sorted by name')
on_choice(clients[2]) -- Select "ts" client
end)
local client = client_module.select()
assert.same(ts_client, client, 'the "ts" client must be returned')
ui_select:revert()
end)
end)
describe('select_by_filetype()', function()
local predefined_client = { name = 'php_server' }
local predifined_client_selector = function()
return predefined_client
end
after_each(function()
-- Since I use a local variable I need to reload the module between each test
require('plenary.reload').reload_module('lsp-selection-range.client')
client_module = require('lsp-selection-range.client')
end)
it('returns the client provided by the selector when there is no filetype', function()
local selected_client = client_module.select_by_filetype(predifined_client_selector)()
assert.same(predefined_client, selected_client)
end)
it('asks the selector only once when a client is returned', function()
vim.cmd('set ft=php')
local error_selector = function()
error('this selector must not be called!')
end
client_module.select_by_filetype(predifined_client_selector)()
local selected_client = client_module.select_by_filetype(error_selector)()
assert.same(predefined_client, selected_client)
end)
it('handles multiple filetypes simultaneously', function()
local servers = {
php = { name = 'php_server' },
lua = { name = 'lua_server' },
}
local function select_for_filetype(filetype)
vim.cmd('set ft=' .. filetype)
return client_module.select_by_filetype(function()
return servers[vim.api.nvim_buf_get_option(0, 'filetype')] or nil
end)()
end
-- Initialize the cache
select_for_filetype('php')
select_for_filetype('lua')
select_for_filetype('vim')
assert.same(servers.php, select_for_filetype('php'))
assert.same(servers.lua, select_for_filetype('lua'))
assert.same(nil, select_for_filetype('vim'))
end)
it('keeps asking the selector when no client is returned', function()
vim.cmd('set ft=php')
local nil_selector = function()
return nil
end
client_module.select_by_filetype(nil_selector)()
local selected_client = client_module.select_by_filetype(predifined_client_selector)()
assert.same(predefined_client, selected_client)
end)
end)
describe('fetch_selection_range()', function()
local client = { name = 'fake_client' }
local request_sync, notify
before_each(function()
request_sync = stub(client, 'request_sync')
request_sync.returns({ res = nil })
notify = stub(vim, 'notify')
end)
after_each(function()
request_sync:revert()
notify:revert()
end)
it('notifies when reaching the request times out', function()
request_sync.returns(nil, 'error message')
client_module.fetch_selection_range(client, {}, 1)
assert.stub(notify).was_called_with('fake_client: timeout: error message', 4)
end)
it('notifies when the server responded with an error', function()
request_sync.returns({ err = { code = '007', message = 'Bond, James Bond!' } })
client_module.fetch_selection_range(client, {})
assert.stub(notify).was_called_with('fake_client: 007: Bond, James Bond!', 4)
end)
it('generates params when not provided', function()
vim.cmd('edit ' .. simple_php.file_path)
utils.move_cursor_to(simple_php.positions.on_last_return_var)
client_module.fetch_selection_range(client)
assert.stub(request_sync).was_called_with('textDocument/selectionRange', {
textDocument = { uri = 'file://' .. vim.api.nvim_buf_get_name(0) },
positions = { simple_php.positions.on_last_return_var },
}, nil, nil)
vim.cmd('bdelete!')
end)
it('returns `nil` when the server does not provide a result', function()
request_sync.returns({ result = {} })
local selection_range = client_module.fetch_selection_range(client)
assert.same(nil, selection_range)
end)
it('returns the selection range when the server provide a result', function()
local expected_selection_range = simple_php.selection_ranges.from_last_return.variable
request_sync.returns({ result = { expected_selection_range } })
local selection_range = client_module.fetch_selection_range(client)
assert.same(expected_selection_range, selection_range)
end)
end)
end)
|
solution "RecastDetour"
location "3rdparty/recast/_project/"
targetdir "3rdparty/recast/_build/"
language "C++"
configurations { "Release" }
platforms { "x64" }
flags {
"FatalWarnings",
"NoPCH",
"NoExceptions",
"NoRTTI",
"NoEditAndContinue"
}
project "Recast"
kind "StaticLib"
flags { "ReleaseRuntime", "WinMain" }
configuration { "Release" }
files {
"3rdparty/recast/Recast/Source/**.cpp",
"3rdparty/recast/Detour/Source/**.cpp"
}
includedirs {
"3rdparty/recast/Recast/Include/",
"3rdparty/recast/Detour/Include/"
} |
local unpack = table.unpack or require "compat53.module".table.unpack -- 5.1's unpack doesn't work on userdata
local result = {}
local result_mt = {
__name = "pg result";
__index = result;
}
local function new_result(pgpsql_library, res)
return setmetatable({
pgsql = assert(pgpsql_library);
raw_result = assert(res);
}, result_mt)
end
local return_result
function result_mt:__len()
return self.raw_result:ntuples()
end
local function next_tuple(self, last)
if last >= self.raw_result:ntuples() then -- https://github.com/arcapos/luapgsql/issues/44
return nil
end
last = last + 1
local tuple = self.raw_result[last]
-- if tuple == nil then
-- return nil
-- end
return last, unpack(tuple)
end
function result:fields()
local n = self.raw_result:nfields()
local t = {}
for i=1, n do
t[i] = self.raw_result:fname(i)
end
return unpack(t, 1, n)
end
function result:tuples()
return next_tuple, self, 0
end
local function get_conn_result(conn)
local res = conn.raw_connection:getResult()
if res == nil then
return nil
end
return new_result(conn.pgsql, res)
end
local function new_copy_out(conn)
return get_conn_result, conn
end
local copy_in = {}
local copy_in_mt = {
__name = "pg copy-in result";
__index = copy_in;
}
function copy_in:write(data)
assert(not self.is_closed, "copy-in is closed")
local ok = self.conn.raw_connection:putCopyData(data)
if not ok then
return nil, self.conn.raw_connection:errorMessage(), self.conn.raw_connection:status()
end
return ok
end
function copy_in:close(err)
assert(not self.is_closed, "copy-in is closed")
local ok = self.conn.raw_connection:putCopyEnd(err)
if not ok then
return nil, self.conn.raw_connection:errorMessage(), self.conn.raw_connection:status()
end
self.is_closed = true
return return_result(self.conn, self.conn.raw_connection:getResult())
end
local function new_copy_in(conn)
return setmetatable({
conn = conn;
is_closed = false;
}, copy_in_mt);
end
-- Helper for returning resultss
return_result = function (conn, res)
if not res then
return nil, conn.raw_connection:errorMessage(), conn.raw_connection:status()
end
local status = res:status()
if status == conn.pgsql.PGRES_TUPLES_OK then
return new_result(conn.pgsql, res)
elseif status == conn.pgsql.PGRES_COMMAND_OK then
local cmdStatus = res:cmdStatus()
local tuples = tonumber(res:cmdTuples(), 10)
local oid = res:oidValue()
if oid == 0 then -- See https://github.com/arcapos/luapgsql/issues/43
oid = nil
end
-- TODO: free result ASAP https://github.com/arcapos/luapgsql/issues/42
return cmdStatus, tuples, oid
elseif status == conn.pgsql.PGRES_COPY_IN then
return new_copy_in(conn)
elseif status == conn.pgsql.PGRES_COPY_OUT then
return new_copy_out(conn)
else
local errmsg = res:errorMessage()
-- TODO: free result ASAP https://github.com/arcapos/luapgsql/issues/42
return nil, errmsg, status
end
end
return {
new = new_result;
return_result = return_result;
}
|
local m={}
function m:decoder(callback, server, conn, data)
print("decoder",callback,conn:ip())
return callback(server,conn,data)
end
return m |
RegisterServerEvent('json:dataStructure')
AddEventHandler('json:dataStructure', function(data)
print(json.encode(data))
end)
RegisterServerEvent('qb-radialmenu:trunk:server:Door')
AddEventHandler('qb-radialmenu:trunk:server:Door', function(open, plate, door)
TriggerClientEvent('qb-radialmenu:trunk:client:Door', -1, plate, door, open)
end) |
-- Make a table that behaves like PHP tables, retaining the order elements are entered in.
if not php then php = {} end
function php:Table(...)
local newTable,keys,values={},{},{}
newTable.pairs=function(self) -- pairs iterator
local count=0
return function()
count=count+1
return keys[count],values[keys[count]]
end
end
newTable.count=function(self) -- count return
return table.getn(keys)
end
setmetatable(newTable,{
__newindex=function(self,key,value)
if not self[key] then table.insert(keys,key)
elseif value==nil then -- Handle item delete
local count=1
while keys[count]~=key do count = count + 1 end
table.remove(keys,count)
end
values[key]=value -- replace/create
end,
__index=function(self,key) return values[key] end
})
return newTable
end
return php
|
-- Global variables
Global = {
currentInteriorId = 0,
-- The current interior is set to True by 'interiorIdObserver'
Online = {
isInsideApartmentHi1 = false,
isInsideApartmentHi2 = false,
isInsideHouseHi1 = false,
isInsideHouseHi2 = false,
isInsideHouseHi3 = false,
isInsideHouseHi4 = false,
isInsideHouseHi5 = false,
isInsideHouseHi6 = false,
isInsideHouseHi7 = false,
isInsideHouseHi8 = false,
isInsideHouseLow1 = false,
isInsideHouseMid1 = false
},
Biker = {
isInsideClubhouse1 = false,
isInsideClubhouse2 = false
},
FinanceOffices = {
isInsideOffice1 = false,
isInsideOffice2 = false,
isInsideOffice3 = false,
isInsideOffice4 = false
},
HighLife = {
isInsideApartment1 = false,
isInsideApartment2 = false,
isInsideApartment3 = false,
isInsideApartment4 = false,
isInsideApartment5 = false,
isInsideApartment6 = false
},
-- Set all interiors variables to false
-- The loop inside 'interiorIdObserver' will set them to true
ResetInteriorVariables = function()
for _, parentKey in pairs{"Biker", "FinanceOffices", "HighLife"} do
local t = Global[parentKey]
for key in pairs(t) do
t[key] = false
end
end
end
}
exports('GVariables', function()
return Global
end)
exports('EnableIpl', function(ipl, activate)
return EnableIpl(ipl, activate)
end)
exports('GetPedheadshotTexture', function(ped)
return GetPedheadshotTexture(ped)
end)
-- Load or remove IPL(s)
function EnableIpl(ipl, activate)
if IsTable(ipl) then
for key, value in pairs(ipl) do
EnableIpl(value, activate)
end
else
if activate then
if not IsIplActive(ipl) then RequestIpl(ipl) end
else
if IsIplActive(ipl) then RemoveIpl(ipl) end
end
end
end
-- Enable or disable the specified props in an interior
function SetIplPropState(interiorId, props, state, refresh)
if refresh == nil then refresh = false end
if IsTable(interiorId) then
for key, value in pairs(interiorId) do
SetIplPropState(value, props, state, refresh)
end
else
if IsTable(props) then
for key, value in pairs(props) do
SetIplPropState(interiorId, value, state, refresh)
end
else
if state then
if not IsInteriorPropEnabled(interiorId, props) then EnableInteriorProp(interiorId, props) end
else
if IsInteriorPropEnabled(interiorId, props) then DisableInteriorProp(interiorId, props) end
end
end
if refresh == true then RefreshInterior(interiorId) end
end
end
function CreateNamedRenderTargetForModel(name, model)
local handle = 0
if not IsNamedRendertargetRegistered(name) then
RegisterNamedRendertarget(name, false)
end
if not IsNamedRendertargetLinked(model) then
LinkNamedRendertarget(model)
end
if IsNamedRendertargetRegistered(name) then
handle = GetNamedRendertargetRenderId(name)
end
return handle
end
function DrawEmptyRect(name, model)
local step = 250
local timeout = 5 * 1000
local currentTime = 0
local renderId = CreateNamedRenderTargetForModel(name, model)
while (not IsNamedRendertargetRegistered(name)) do
Citizen.Wait(step)
currentTime = currentTime + step
if (currentTime >= timeout) then return false end
end
if (IsNamedRendertargetRegistered(name)) then
SetTextRenderId(renderId)
SetUiLayer(4)
DrawRect(0.5, 0.5, 1.0, 1.0, 0, 0, 0, 0)
SetTextRenderId(GetDefaultScriptRendertargetRenderId())
ReleaseNamedRendertarget(0, name)
end
return true
end
function SetupScaleform(movieId, scaleformFunction, parameters)
BeginScaleformMovieMethod(movieId, scaleformFunction)
N_0x77fe3402004cd1b0(name)
if (IsTable(parameters)) then
for i = 0, Tablelength(parameters) - 1 do
local p = parameters["p" .. tostring(i)]
if (p.type == "bool") then
PushScaleformMovieMethodParameterBool(p.value)
elseif (p.type == "int") then
PushScaleformMovieMethodParameterInt(p.value)
elseif (p.type == "float") then
PushScaleformMovieMethodParameterFloat(p.value)
elseif (p.type == "string") then
PushScaleformMovieMethodParameterString(p.value)
elseif (p.type == "buttonName") then
PushScaleformMovieMethodParameterButtonName(p.value)
end
end
end
EndScaleformMovieMethod()
N_0x32f34ff7f617643b(movieId, 1)
end
function LoadStreamedTextureDict(texturesDict)
local step = 1000
local timeout = 5 * 1000
local currentTime = 0
RequestStreamedTextureDict(texturesDict, 0)
while not HasStreamedTextureDictLoaded(texturesDict) do
Citizen.Wait(step)
currentTime = currentTime + step
if (currentTime >= timeout) then return false end
end
return true
end
function LoadScaleform(scaleform)
local step = 1000
local timeout = 5 * 1000
local currentTime = 0
local handle = RequestScaleformMovie(scaleform)
while (not HasScaleformMovieLoaded(handle)) do
Citizen.Wait(step)
currentTime = currentTime + step
if (currentTime >= timeout) then return -1 end
end
return handle
end
function GetPedheadshot(ped)
local step = 1000
local timeout = 5 * 1000
local currentTime = 0
local pedheadshot = RegisterPedheadshot(ped)
while not IsPedheadshotReady(pedheadshot) do
Citizen.Wait(step)
currentTime = currentTime + step
if (currentTime >= timeout) then return -1 end
end
return pedheadshot
end
function GetPedheadshotTexture(ped)
local textureDict = nil
local pedheadshot = GetPedheadshot(ped)
if (pedheadshot ~= -1) then
textureDict = GetPedheadshotTxdString(pedheadshot)
local IsTextureDictLoaded = LoadStreamedTextureDict(textureDict)
if (not IsTextureDictLoaded) then
Citizen.Trace("ERROR: BikerClubhouseDrawMembers - Textures dictionnary \"" .. tostring(textureDict) .. "\" cannot be loaded.")
end
else
Citizen.Trace("ERROR: BikerClubhouseDrawMembers - PedHeadShot not ready.")
end
return textureDict
end
-- Check if a variable is a table
function IsTable(T)
return type(T) == 'table'
end
-- Return the number of elements of the table
function Tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
|
local d = require "sl-defines"
local u = require "sl-util"
local cf = require "control-forces"
local rd = require "sl-render"
local export = {}
-- tState states
export.MOVE = 0
export.WANDER = 1
export.FOLLOW = 2 -- TODO Does this state still make sense? We don't chase things after spotting them so much, now...
-- Since the turtle has to 'chase' foes it spots, we don't want it to wander
-- too close to the max range of the searchlight
local bufferedRange = d.searchlightRange - (d.searchlightSpotRadius)
------------------------
-- Helper Functions --
------------------------
local function makeMoveOrders(target, followingEntity, ignoreFoes)
local distraction = defines.distraction.by_enemy
if ignoreFoes then
distraction = defines.distraction.none
end
local command = {type = defines.command.go_to_location,
distraction = distraction,
pathfind_flags = {low_priority = true,
cache = false,
allow_paths_through_own_entities = true,
prefer_straight_paths = false,},
radius = 0.2
}
if followingEntity then
command.destination_entity = target
else
command.destination = target
end
return command
end
local function IssueFollowCommand(turtle, entity, ignoreFoes)
turtle.set_command(makeMoveOrders(entity, true, ignoreFoes))
end
local function IssueMoveCommand(turtle, waypoint, ignoreFoes)
turtle.set_command(makeMoveOrders(waypoint, false, ignoreFoes))
end
-- tWanderParams = .radius, .rotation, .min, .max
-- tAdjParams = .angleStart, .len, .min, .max
local function ValidateAndSetParams(g, forceRedraw)
g.tAdjParams = {} -- init / reset
-- Blueprints ignore orientation,
-- so we will ignore orientation
local rot = u.clampDeg(g.tWanderParams.rotation, 0)
local rad = u.clampDeg(g.tWanderParams.radius, 360)
if rad == 360 then
g.tAdjParams.angleStart = 0
g.tAdjParams.len = math.pi * 2
else
local angleLHS = rot - (rad / 2)
-- Need to wrap around the unit circle
if angleLHS < 0 then
angleLHS = angleLHS + 360
end
-- Convert from degrees to radians
g.tAdjParams.angleStart = (angleLHS / 180) * math.pi
g.tAdjParams.len = (rad / 180) * math.pi
end
-- And adjust again so that 0/360 is at the 'top' and
-- then proceeds clockwise
-- (Instead of 0/360 being on the x axis and proceeding clockwise,
-- which isn't even how the unit circle works!
-- So, we might as well make our rotation resemble an actual clock )
g.tAdjParams.angleStart = g.tAdjParams.angleStart - (math.pi/2)
local min = u.clamp(g.tWanderParams.min, 1, d.searchlightRange, 1)
local max = d.searchlightRange
if g.tWanderParams.max ~= 0 then
max = u.clamp(g.tWanderParams.max, 1, d.searchlightRange, d.searchlightRange)
end
if min > max then
max = min
end
g.tAdjParams.min = min
g.tAdjParams.max = max
-- Show new search area
rd.DrawSearchArea(g.light, nil, g.light.force, forceRedraw)
end
local function MakeWanderWaypoint(g)
if not g.tAdjParams then
ValidateAndSetParams(g)
end
-- math.random doesn't like floats, so, multiply by 100 and floor it
local angle = nil
local start = math.floor(g.tAdjParams.angleStart * 100)
local len = math.floor(g.tAdjParams.len * 100)
if len == 0 then
angle = start / 100
else
angle = math.random(start, start + len) / 100
end
local min = u.clamp(g.tAdjParams.min, 1, bufferedRange, 1)
local max = u.clamp(g.tWanderParams.max, 1, bufferedRange, bufferedRange)
if min < max then
distance = math.random(min, max)
else
distance = min
end
return u.ScreenOrientationToPosition(g.light.position, angle, distance)
end
local function RespawnTurtle(turtle, position)
local g = global.unum_to_g[turtle.unit_number]
local newT = export.SpawnTurtle(g.light, g.light.surface, position)
g.turtle = newT
global.unum_to_g[newT.unit_number] = g
global.unum_to_g[turtle.unit_number] = nil
if g.light.shooting_target == turtle then
g.light.shooting_target = newT
end
turtle.destroy()
return g
end
local function Turtleport(turtle, origin, position)
if not position then
return
end
local tpBufferRange = bufferedRange + 2
-- If position is too far from the origin for the searchlight to attack it,
-- calculate a slightly-closer position with the same angle and use that
if not u.WithinRadius(position, origin, tpBufferRange) then
local vecOriginPos = {x = position.x - origin.x,
y = position.y - origin.y}
local theta = math.atan2(vecOriginPos.y, vecOriginPos.x)
position = u.ScreenOrientationToPosition(origin, theta, tpBufferRange)
end
if not turtle.teleport(position) then
-- The teleport failed for some reason, so respawn
RespawnTurtle(turtle, nil)
end
end
------------------------
-- Aperiodic Events --
------------------------
export.CheckForTurtleEscape = function(g)
if not u.WithinRadius(g.turtle.position, g.light.position, d.searchlightRange - 0.2) then
-- If the searchlight started attacking something else while the turtle was distracted and out of range,
-- then we may as well sic the turtle on it, too
if g.light.shooting_target ~= nil then
g.turtle.teleport(g.light.shooting_target.position)
else
Turtleport(g.turtle, g.light.position, g.turtle.position)
end
end
if g.light.name == d.searchlightBaseName then
g.light.shooting_target = g.turtle
end
end
export.TurtleWaypointReached = function(g)
if g.tState == export.WANDER then
export.WanderTurtle(g)
-- retarget turtle just in case something happened
g.light.shooting_target = g.turtle
elseif g.tState == export.FOLLOW and g.tCoord.speed then
-- If the foe can move, keep chasing it
export.TurtleChase(g, g.tCoord)
elseif g.tState == export.FOLLOW then
-- (If the foe can't move, then we can probably stop ordering the turtle around)
g.turtle.set_command({type = defines.command.stop,
distraction = defines.distraction.none,
})
else
g.turtle.set_command({type = defines.command.stop,
distraction = defines.distraction.by_enemy,
})
end
end
-- If a turtle fails a command, respawn it and reissue its current command
export.TurtleFailed = function(turtle)
local g = RespawnTurtle(turtle, turtle.position)
if g.tState == export.MOVE then
local translatedCoord = u.TranslateCoordinate(g, g.tCoord)
IssueMoveCommand(g.turtle, translatedCoord, false)
elseif g.tState == export.FOLLOW then
export.TurtleChase(g, g.tCoord)
else
export.WanderTurtle(g)
end
end
export.ResumeTurtleDuty = function(gestalt, turtlePositionToResume)
local turtle = gestalt.turtle
Turtleport(turtle, gestalt.light.position, turtlePositionToResume)
if gestalt.tOldState == export.MOVE then
export.ManualTurtleMove(gestalt, gestalt.tOldCoord)
else
export.WanderTurtle(gestalt)
end
end
-- location is expected to be the searchlight's last shooting target,
-- if it was targeting something.
export.SpawnTurtle = function(sl, surface, location)
if location == nil then
-- Start in front of the turret's base, wrt orientation
location = u.OrientationToPosition(sl.position, sl.orientation, 3)
end
local turtle = surface.create_entity{name = d.turtleName,
position = location,
force = cf.PrepareTurtleForce(sl.force),
fast_replace = false,
create_build_effect_smoke = false}
turtle.destructible = false
return turtle
end
------------------------
-- Turtle Commands --
------------------------
-- If we set our first waypoint in the same direction as the searchlight orientation,
-- but further away, it makes the searchlight appear to "start up"
export.WindupTurtle = function(gestalt, turtle)
local c = gestalt.signal.get_control_behavior()
gestalt.tWanderParams.rotation = c.get_signal(d.circuitSlots.rotateSlot).count
gestalt.tWanderParams.radius = c.get_signal(d.circuitSlots.radiusSlot).count
gestalt.tWanderParams.min = c.get_signal(d.circuitSlots.minSlot).count
gestalt.tWanderParams.max = c.get_signal(d.circuitSlots.maxSlot).count
ValidateAndSetParams(gestalt, false)
local windupWaypoint = u.OrientationToPosition(gestalt.light.position,
gestalt.light.orientation,
math.random(d.searchlightRange / 8,
d.searchlightRange - 2))
export.WanderTurtle(gestalt, windupWaypoint)
end
export.WanderTurtle = function(gestalt, waypoint)
gestalt.tState = export.WANDER
gestalt.tCoord = export.WANDER
if waypoint == nil then
waypoint = MakeWanderWaypoint(gestalt)
end
gestalt.turtle.speed = d.searchlightWanderSpeed
IssueMoveCommand(gestalt.turtle, waypoint, false)
end
export.SetDefaultWanderParams = function(g)
g.tWanderParams =
{
radius = 0,
rotation = 0,
min = 0,
max = 0
}
end
-- These parameters will be read in MakeWanderWaypoint
export.UpdateWanderParams = function(g, rad, rot, min, max)
local change = false
if not g.tWanderParams then
export.SetDefaultWanderParams(g)
change = true
end
local new = {radius = rad, rotation = rot, min = min, max = max}
for key, item in pairs(g.tWanderParams) do
if item ~= new[key] then
g.tWanderParams[key] = new[key]
change = true
end
end
if change then
ValidateAndSetParams(g, true)
if g.tState == export.WANDER then
export.WanderTurtle(g)
end
end
end
export.ManualTurtleMove = function(gestalt, coord)
if gestalt.tState == export.MOVE
and gestalt.tCoord.x == coord.x
and gestalt.tCoord.y == coord.y then
return -- Already servicing this coordinate
end
local turtle = gestalt.turtle
-- Don't interrupt a turtle that's trying to attack a foe
if turtle.distraction_command then
return
end
local translatedCoord = u.TranslateCoordinate(gestalt, coord)
if gestalt.tState == export.MOVE then
local trans_tCoord = u.TranslateCoordinate(gestalt, gestalt.tCoord)
if trans_tCoord.x == translatedCoord.x
and trans_tCoord.y == translatedCoord.y then
return -- Already servicing this coordinate
end
end
gestalt.tState = export.MOVE
gestalt.tCoord = coord
turtle.speed = d.searchlightRushSpeed
IssueMoveCommand(turtle, translatedCoord, false)
end
export.TurtleChase = function(gestalt, entity)
if gestalt.tState == export.MOVE then
gestalt.tOldState = export.MOVE
gestalt.tOldCoord = {x=gestalt.tCoord.x, y=gestalt.tCoord.y}
elseif gestalt.tState == export.WANDER then
gestalt.tOldState = export.WANDER
gestalt.tOldCoord = export.WANDER
end
gestalt.tState = export.FOLLOW
gestalt.tCoord = entity
gestalt.turtle.speed = entity.speed or d.searchlightRushSpeed
IssueFollowCommand(gestalt.turtle, entity, true)
end
return export
|
-- NOTE: Obtained from https://github.com/otalk/mod_turncredentials/blob/master/mod_turncredentials.lua
-- XEP-0215 implementation for time-limited turn credentials
-- Copyright (C) 2012-2014 Philipp Hancke
-- This file is MIT/X11 licensed.
--turncredentials_secret = "keepthissecret";
--turncredentials = {
-- { type = "stun", host = "8.8.8.8" },
-- { type = "turn", host = "8.8.8.8", port = 3478 },
-- { type = "turn", host = "8.8.8.8", port = 80, transport = "tcp" }
--}
-- for stun servers, host is required, port defaults to 3478
-- for turn servers, host is required, port defaults to tcp,
-- transport defaults to udp
-- hosts can be a list of server names / ips for random
-- choice loadbalancing
local st = require "util.stanza";
local hmac_sha1 = require "util.hashes".hmac_sha1;
local base64 = require "util.encodings".base64;
local os_time = os.time;
local secret = module:get_option_string("turncredentials_secret");
local ttl = module:get_option_number("turncredentials_ttl", 86400);
local hosts = module:get_option("turncredentials") or {};
if not (secret) then
module:log("error", "turncredentials not configured");
return;
end
function random(arr)
local index = math.random(1, #arr);
return arr[index];
end
module:hook_global("config-reloaded", function()
module:log("debug", "config-reloaded")
secret = module:get_option_string("turncredentials_secret");
ttl = module:get_option_number("turncredentials_ttl", 86400);
hosts = module:get_option("turncredentials") or {};
end);
module:hook("iq-get/host/urn:xmpp:extdisco:1:services", function(event)
local origin, stanza = event.origin, event.stanza;
if origin.type ~= "c2s" then
return;
end
local now = os_time() + ttl;
local userpart = tostring(now);
local nonce = base64.encode(hmac_sha1(secret, tostring(userpart), false));
local reply = st.reply(stanza):tag("services", {xmlns = "urn:xmpp:extdisco:1"})
for idx, item in pairs(hosts) do
if item.type == "stun" or item.type == "stuns" then
-- stun items need host and port (defaults to 3478)
reply:tag("service", item):up();
elseif item.type == "turn" or item.type == "turns" then
local turn = {}
-- turn items need host, port (defaults to 3478),
-- transport (defaults to udp)
-- username, password, ttl
turn.type = item.type;
turn.port = item.port;
turn.transport = item.transport;
turn.username = userpart;
turn.password = nonce;
turn.ttl = ttl;
if item.hosts then
turn.host = random(item.hosts)
else
turn.host = item.host
end
reply:tag("service", turn):up();
end
end
origin.send(reply);
return true;
end);
|
win = addWindow{width=400,height=500}
grafic = addControl{window=win, typex="funcgraph2",width=300,height=300,expand=true}
function createpoly(val1)
local t = {}
local steps = 200
for i=0,steps do
local x = linearmap(0,steps,0,2,i)
t[#t+1] = {x,math.pow(x,val1)}
end
grafic:val(t)
end
panel = addPanel{type="vbox"}
curr_panel = panel
slider = Slider("val",0,4,1,function(v) print(v);createpoly(v) end)
Button("but",function() createpoly(slider.value)end) |
-- -- Copyright 2012 Rackspace
--
-- 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.
--
module(..., package.seeall);
local alien = require 'alien'
local util = require 'util'
local Check = util.Check
local log = util.log
local os = require 'os'
local struct = require 'alien.struct'
local stats = {
{"GetCpuReservationMHz","ref uint","cpu_reservation_mhz",Check.enum.uint32},
{"GetCpuLimitMHz","ref uint","cpu_limit_mhz",Check.enum.uint32},
{"GetCpuShares","ref uint","cpu_shares",Check.enum.uint32},
{"GetCpuUsedMs","pointer","cpu_used_ms",Check.enum.gauge},
{"GetHostProcessorSpeed","ref uint","host_processor_speed",Check.enum.uint32},
{"GetMemReservationMB","ref uint","mem_reservation_mb",Check.enum.uint32},
{"GetMemLimitMB","ref uint","mem_limit_mb",Check.enum.uint32},
{"GetMemShares","ref uint","mem_shares",Check.enum.uint32},
{"GetMemMappedMB","ref uint","mem_mapped_mb",Check.enum.uint32},
{"GetMemActiveMB","ref uint","mem_active_mb",Check.enum.uint32},
{"GetMemOverheadMB","ref uint","mem_overhead_mb",Check.enum.uint32},
{"GetMemBalloonedMB","ref uint","mem_ballooned_mb",Check.enum.uint32},
{"GetMemSwappedMB","ref uint","mem_swapped_mb",Check.enum.uint32},
{"GetMemSharedMB","ref uint","mem_shared_mb",Check.enum.uint32},
{"GetMemSharedSavedMB","ref uint","mem_shared_saved_mb",Check.enum.uint32},
{"GetMemUsedMB","ref uint","mem_used_mb",Check.enum.uint32},
{"GetElapsedMs","pointer","elapsed_ms",Check.enum.gauge},
{"GetCpuStolenMs","pointer","cpu_stolen_ms",Check.enum.gauge},
{"GetMemTargetSizeMB","pointer","mem_target_size_mb",Check.enum.uint64},
{"GetHostNumCpuCores","pointer","host_numcpu_cores",Check.enum.uint64},
{"GetHostCpuUsedMs","pointer","host_cpuused_ms",Check.enum.gauge},
{"GetHostMemSwappedMB","pointer","host_memswapped_mb",Check.enum.uint64},
{"GetHostMemSharedMB","pointer","host_memshared_mb",Check.enum.uint64},
{"GetHostMemUsedMB","pointer","host_memused_mb",Check.enum.uint64},
{"GetHostMemPhysMB","pointer","host_memphys_mb",Check.enum.uint64},
{"GetHostMemPhysFreeMB","pointer","host_memphys_free_mb",Check.enum.uint64},
{"GetHostMemKernOvhdMB","pointer","host_memkern_ovhd_mb",Check.enum.uint64},
{"GetHostMemMappedMB","pointer","host_memmapped_mb",Check.enum.uint64},
{"GetHostMemUnmappedMB","pointer","host_memunmapped_mb",Check.enum.uint64},
}
local ptrptr = alien.defstruct{
{ "ptr", "pointer" },
}
local ulongptr = alien.defstruct{
{ "val", "ulong" },
}
local uintptr = alien.defstruct{
{ "val", "uint" },
}
local VMGUESTLIB_ERROR_SUCCESS = 0 -- No error
local VMGUESTLIB_ERROR_OTHER = 1 -- Other error
local VMGUESTLIB_ERROR_NOT_RUNNING_IN_VM = 2 -- Not running in a VM
local VMGUESTLIB_ERROR_NOT_ENABLED = 3 -- GuestLib not enabled on the host.
local VMGUESTLIB_ERROR_NOT_AVAILABLE = 4 -- This stat not available on this host.
local VMGUESTLIB_ERROR_NO_INFO = 5 -- UpdateInfo() has never been called.
local VMGUESTLIB_ERROR_MEMORY = 6 -- Not enough memory
local VMGUESTLIB_ERROR_BUFFER_TOO_SMALL = 7 -- Buffer too small
local VMGUESTLIB_ERROR_INVALID_HANDLE = 8 -- Handle is invalid
local VMGUESTLIB_ERROR_INVALID_ARG = 9 -- One or more arguments were invalid
local VMGUESTLIB_ERROR_UNSUPPORTED_VERSION = 10 -- The host doesnt support this request
local function get_vmware(path)
local vmware = alien.load(path .. "/vmGuestLib")
local err
-- Open Handle
--VMGuestLibError VMGuestLib_OpenHandle(VMGuestLibHandle *handle); // OUT
--VMGuestLibError VMGuestLib_CloseHandle(VMGuestLibHandle handle); // IN
vmware.VMGuestLib_OpenHandle:types("int", "pointer")
vmware.VMGuestLib_CloseHandle:types("int", "pointer")
-- Update info
-- VMGuestLibError VMGuestLib_UpdateInfo(VMGuestLibHandle handle); // IN
vmware.VMGuestLib_UpdateInfo:types("int", "pointer")
-- VMGuestLibError VMGuestLib_GetSessionId(VMGuestLibHandle handle, // IN
-- VMSessionId *id); // OUT
vmware.VMGuestLib_GetSessionId:types("int", "pointer", "pointer")
-- char const * VMGuestLib_GetErrorText(VMGuestLibError error); // IN
vmware.VMGuestLib_GetErrorText:types("string", "int")
-- Iterate over all the VM Guest lib
for key, value in pairs(stats) do
vmware["VMGuestLib_" .. value[1]]:types("int", "pointer", value[2])
end
return vmware
end
function vm_err_out(vmware, msg, err)
local fmt = msg .. ": " .. vmware.VMGuestLib_GetErrorText(err)
return fmt
end
function record_stat(rcheck, vmware, vmgl_handle, func, alien_type,
metric, metric_type, args)
local value, err
-- Since most all are ref types, pass the value back
if alien_type == "pointer" then
-- Allocate the right buffer
local ptr
if metric_type == Check.enum.uint64 then
ptr = ulongptr:new()
else
ptr = uintptr:new()
end
err = vmware["VMGuestLib_" .. func](vmgl_handle, ptr())
-- Unpack the value?
value = ptr.val
else
err, value = vmware["VMGuestLib_" .. func](vmgl_handle, value)
end
-- Check the error code
if err ~= VMGUESTLIB_ERROR_SUCCESS then
-- Don't record it
--rcheck:set_error("unable to get " .. metric)
return err
end
-- Record the actual metric
rcheck:add_metric(metric, value, metric_type)
return err
end
function run(rcheck, args)
if equus.p_is_windows() == 1 then
rcheck:set_error("vmware guest API check is not supported on windows")
return rcheck
end
if args.path == nil then
args.path = '/usr/lib'
else
args.path = args.path[1]
end
local vmgl_handle
local vmware = get_vmware(args.path)
-- TODO: The right way to allocate a pointer of a pointer?
vmgl_handle = ptrptr:new()
-- Open the handle to the new session
err = vmware.VMGuestLib_OpenHandle(vmgl_handle())
if err ~= VMGUESTLIB_ERROR_SUCCESS then
rcheck:set_error(vm_err_out(vmware, "unable to open handle", err))
return rcheck
end
run_check(vmware, args, rcheck, vmgl_handle)
err = vmware.VMGuestLib_CloseHandle(vmgl_handle.ptr)
if err ~= VMGUESTLIB_ERROR_SUCCESS then
rcheck:set_error(vm_err_out(vmware, "unable to close handle", err))
return rcheck
end
end
function run_check(vmware, args, rcheck, vmgl_handle)
local vmgl_session, err, test
local i = 0
vmgl_session = ulongptr:new()
-- Attempt to retrieve the session info
err = vmware.VMGuestLib_UpdateInfo(vmgl_handle.ptr)
if err ~= VMGUESTLIB_ERROR_SUCCESS then
rcheck:set_error(vm_err_out(vmware, "update info failed", err))
return rcheck
end
-- Open the session
err = vmware.VMGuestLib_GetSessionId(vmgl_handle.ptr, vmgl_session())
if err ~= VMGUESTLIB_ERROR_SUCCESS then
rcheck:set_error(vm_err_out(vmware, "failed to get the session id", err))
return rcheck
end
if vmgl_session.val == VMGUESTLIB_ERROR_SUCCESS then
rcheck:set_error("error: session id returned 0")
return rcheck
end
-- Ready to start collecting some data
for key, value in pairs(stats) do
err = record_stat(rcheck, vmware, vmgl_handle.ptr, value[1],
value[2], value[3], value[4], args)
if err ~= VMGUESTLIB_ERROR_SUCCESS then
if err == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION or
err == VMGUESTLIB_ERROR_NOT_AVAILABLE then
-- Don't do anything
else
rcheck:set_error("error retrieving %s", value[1])
return rcheck
end
else
i = i + 1
end
end
-- Set the status
rcheck:set_status("tracking %d metrics successfully", i)
return rcheck
end
|
return { version = "1.1", luaversion = "5.1", orientation = "orthogonal", width = 50, height = 50, tilewidth = 32, tileheight = 32, properties = {}, tilesets = { { name = "Tiles", firstgid = 1, tilewidth = 32, tileheight = 32, spacing = 0, margin = 0, image = "maptiles.png", imagewidth = 96, imageheight = 32, properties = {}, tiles = { { id = 0, properties = { ["number"] = "1.2", ["solid"] = "false" } }, { id = 1, properties = { ["solid"] = "false" } }, { id = 2, properties = { ["solid"] = "true" } } } }, { name = "Tiles2", firstgid = 4, tilewidth = 32, tileheight = 32, spacing = 0, margin = 0, image = "maptiles2.png", imagewidth = 96, imageheight = 32, properties = {}, tiles = { { id = 0, properties = { ["solid"] = "false" } }, { id = 1, properties = { ["solid"] = "false" } } } } }, layers = { { type = "tilelayer", name = "map", x = 0, y = 0, width = 50, height = 50, visible = true, opacity = 1, properties = {}, encoding = "lua", data = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 4, 1, 2, 2, 2, 1, 4, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, 4, 4, 1, 1, 2, 2, 2, 1, 1, 4, 4, 1, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }, { type = "objectgroup", name = "objects", visible = true, opacity = 1, properties = {}, objects = { { name = "dragon", type = "", x = 1344, y = 1184, width = 64, height = 64, properties = { ["_class"] = "Dragon" } }, { name = "Player", type = "", x = 288, y = 96, width = 32, height = 32, properties = { ["_the"] = "player" } } } }, { type = "tilelayer", name = "map2", x = 0, y = 0, width = 50, height = 50, visible = true, opacity = 1, properties = {}, encoding = "lua", data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } }
|
data:extend({
{
type = "item",
name = "ash",
icon = "__Engineersvsenvironmentalist__/graphics/icons/materials/ash.png",
flags = {"goes-to-main-inventory"},
subgroup = "coal-base",
order = "g4[other]",
stack_size = 5000,
}
}) |
local BuildOrderDispatcher = require("BuildOrderDispatcher")
local ItemTransferOrderDispatcher = require("ItemTransferOrderDispatcher")
local Sequence = require("Sequence")
local Runner = { }
local metatable = { __index = Runner }
function Runner.set_metatable(instance)
if getmetatable(instance) ~= nil then return end
setmetatable(instance, metatable)
Sequence.set_metatable(instance.sequence)
BuildOrderDispatcher.set_metatable(instance.build_order_dispatcher)
ItemTransferOrderDispatcher.set_metatable(instance.item_transfer_order_dispatcher)
end
-- Create a new runner, returns nil if sequence is empty
function Runner.new(sequence)
fail_if_missing(sequence)
local sequence_start = sequence.waypoints[1]
if sequence_start == nil then
return nil
end
local new = {
sequence = sequence,
waypoint_index = 1,
build_order_dispatcher = BuildOrderDispatcher.new(),
in_progress_build_orders = nil,
pending_mine_orders = { },
in_progress_mine_order = nil,
mine_order_started_tick = 0,
pending_craft_orders = { },
pending_craft_orders_num_crafted = { },
item_transfer_order_dispatcher = ItemTransferOrderDispatcher.new(),
opened_item_transfer_container = nil
}
Runner.set_metatable(new)
new:_process_waypoint_orders(sequence_start)
return new
end
function Runner:_process_waypoint_orders(waypoint)
fail_if_missing(waypoint)
for k, order in pairs(waypoint.build_orders) do
self.build_order_dispatcher:add_order(order)
end
for _, mine_order in pairs(waypoint.mine_orders) do
self.pending_mine_orders[mine_order] = mine_order
end
for _, craft_order in pairs(waypoint.craft_orders) do
self.pending_craft_orders[craft_order] = craft_order
self.pending_craft_orders_num_crafted[craft_order] = 0
end
for _, item_transfer_order in pairs(waypoint.item_transfer_orders) do
self.item_transfer_order_dispatcher:add_order(item_transfer_order)
end
end
-- returns if the character has arrived at the waypoint
function Runner:_set_walking_state()
local character = self.player.character
if character == nil then
return
end
local direction_to_waypoint = nil
local waypoint = self:_get_next_waypoint()
if waypoint ~= nil then
direction_to_waypoint = waypoint:get_direction(character)
end
character.walking_state = {
walking = direction_to_waypoint ~= nil,
direction = direction_to_waypoint
}
end
function Runner:_step_build_state()
local dispatcher = self.build_order_dispatcher
local orders = dispatcher:find_chainable_completable_orders_some_near_player(self.player)
if orders == nil then
return
end
local completed_orders = { }
local _, first_order = next(orders)
-- One frame is needed to insert the item_stack into the players hand.
-- Dragging the mouse allows one item to be placed per frame.
-- However an infinite amount can be placed by clicking multiple different pixels one frame.
-- If the item stack depletes in-game it will be automatically replenished mid-frame by the engine.
-- So spam away ;)
if first_order:is_order_item_in_cursor_stack(self.player) == false then
if first_order:move_order_item_to_cursor_stack(self.player) == true then
return
else
self.in_progress_build_orders = nil
end
else
for i, order in pairs(orders) do
if order:spawn_entity_through_player(self.player) == true then
table.insert(completed_orders, order)
end
end
end
for _, order in pairs(completed_orders) do
dispatcher:remove_order(order)
end
end
-- returns true if mining is in progress (and player mouse can't be used for another task)
function Runner:_step_mine_state()
local character = self.player.character
if self.in_progress_mine_order == nil then
-- find the next mine order
for _, mine_order in pairs(self.pending_mine_orders) do
-- ensure tool durability remains
if character ~= nil and mine_order:has_sufficient_tool_durability(character) == false then
log_error{"TAS-err-specific", "Runner", "TAS does not yet know how to calculate time spent mining when a mining tool is about to break. Ensure that the character never runs out of mining tools. Cheating and breaking the last tool before mining." }
character.get_inventory(defines.inventory.player_tools)[1].clear()
end
if mine_order:can_mine(character) then
self.pending_mine_orders[mine_order] = nil
self.in_progress_mine_order = mine_order
self.mine_order_started_tick = game.tick
break
end
end
end
local mine_order = self.in_progress_mine_order
if mine_order == nil then
return false
end
-- Add one tick to hover over the entity and allow player::selected to update, then mining begins.
-- The `channeling` aspect of of mining is so funny. You must hold the key down throughout
-- however within a frame the player can let go of the key, then build and mess with their inventory.
-- As long as the key is pressed again at the end of the frame the channel will continue.
local ticks_spent_mining = game.tick - self.mine_order_started_tick
local time_to_mine_once = mine_order:get_mining_time(character) + 1
-- check if resources should be awarded
if ticks_spent_mining % time_to_mine_once == 0 and self.mine_order_started_tick ~= game.tick then
local success = mine_order:mine(character)
if success == false then error() end
mine_order:remove_durability(character)
if ticks_spent_mining / time_to_mine_once >= mine_order:get_count() then
-- mine order complete!
self.in_progress_mine_order = nil
else
-- mine for another round
-- ensure tool durability remains
if mine_order:has_sufficient_tool_durability(character) == false then
log_error{"TAS-err-specific", "Runner", "TAS does not yet know how to calculate time spent mining when a mining tool is about to break. Ensure that the character never runs out of mining tools or clear the slot before it's final use. Cheating and breaking the last tool before mining." }
character.get_inventory(defines.inventory.player_tools)[1].clear()
end
end
end
return true
end
function Runner:_step_craft_state()
local craft_orders_completed = { }
-- We do not have to wait one frame to begin hovering over a button,
-- and multiple buttons can be pressed multiple times per frame.
-- AND you can press buttons and finish by hovering over an entity
-- Therefor crafting doesn't occupy the mouse at all.
-- So spam that shit ;)
-- However crafting has to be done BEFORE mining or building that frame,
-- and crafting cancels mining.
for _, craft_order in pairs(self.pending_craft_orders) do
local num_crafted = self.pending_craft_orders_num_crafted[craft_order]
local craft_order_total = craft_order:get_count()
local num_remaining = craft_order_total - num_crafted
for i = 1, num_remaining do
local num_started = self.player.begin_crafting( { count = 1, recipe = craft_order.recipe_name, silent = false })
if num_started == 0 then
break
end
num_crafted = num_crafted + num_started
-- mutating a list causes the next loop iteration to be undefined.
-- It is OK to mutate here because we are exiting the loop immediately.
self.pending_craft_orders_num_crafted[craft_order] = nil
self.pending_craft_orders[craft_order] = nil
return true
end
self.pending_craft_orders_num_crafted[craft_order] = num_crafted
if num_crafted >= craft_order_total then
table.insert(craft_orders_completed, craft_order)
end
end
for _, order in ipairs(craft_orders_completed) do
self.pending_craft_orders_num_crafted[craft_order] = nil
self.pending_craft_orders[craft_order] = nil
end
end
function Runner:_step_item_transfer_state()
local order_group = self.item_transfer_order_dispatcher:find_orders_for_container(self.player)
if order_group == nil then
return
end
local _, order = next(order_group)
local container_entity = order:get_entity()
if container_entity == nil then error() end
if self.opened_item_transfer_container ~= container_entity then
self.opened_item_transfer_container = container_entity
return
end
for _, order in pairs(order_group) do
if order:can_transfer(self.player) == true then
order:transfer(self.player)
self.item_transfer_order_dispatcher:remove_order(order)
end
end
end
function Runner:_should_move_to_next_waypoint()
local waypoint = self:_get_next_waypoint()
if waypoint == nil then
return false
end
if self.player.controller_type == defines.controllers.character then
return waypoint:has_character_arrived(self.player.character) == true
elseif self.player.controller_type == defines.controllers.god then
return true
else
return false
end
end
function Runner:step()
local player = self.player
if player == nil then
return
elseif is_valid(player) == false then
self.player = nil
end
if player.controller_type == defines.controllers.ghost then
return -- do respawn here
end
local character = player.character -- may be nil!
local waypoint = self:_get_current_waypoint()
local immobile = self:_step_mine_state()
self:_step_build_state()
self:_step_craft_state()
self:_step_item_transfer_state()
-- walk towards waypoint
if immobile == false then
self:_set_walking_state()
end
-- move ahead in the sequence
while self:_should_move_to_next_waypoint() == true do
self.waypoint_index = self.waypoint_index + 1
self:_process_waypoint_orders(self:_get_current_waypoint())
self:_set_walking_state()
end
end
--[Comment]
-- Sets the player that this runner will control while stepping.
function Runner:set_player(player)
if player ~= nil and is_valid(player) == false then
error()
end
self.player = player
end
function Runner:get_sequence()
return self.sequence
end
function Runner:_get_current_waypoint()
return self.sequence.waypoints[self.waypoint_index]
end
function Runner:_get_next_waypoint()
return self.sequence.waypoints[self.waypoint_index + 1]
end
return Runner |
--[[
Things to do
Lump close dungeon/raids into one, (nexus/oculus/eoe) (DONE)
Maybe implement lockout info on tooltip (Don't know if I want too, better addons for tracking it exist) (DONE anyway)
]]--
local DEBUG = false
local HandyNotes = LibStub("AceAddon-3.0"):GetAddon("HandyNotes", true)
if not HandyNotes then return end
local L = LibStub("AceLocale-3.0"):GetLocale("HandyNotes_DungeonLocations")
local iconDefault = "Interface\\Icons\\TRADE_ARCHAEOLOGY_CHESTOFTINYGLASSANIMALS"
local iconDungeon = "Interface\\MINIMAP\\Dungeon"
local iconRaid = "Interface\\MINIMAP\\Raid"
local iconMixed = "Interface\\Addons\\HandyNotes_DungeonLocations\\merged.tga"
local iconGray = "Interface\\Addons\\HandyNotes_DungeonLocations\\gray.tga"
local db
local mapToContinent = { }
local nodes = { }
local minimap = { } -- For nodes that need precise minimap locations but would look wrong on zone or continent maps
local alterName = { }
local extraInfo = { }
local legionInstancesDiscovered = { } -- Extrememly bad juju, needs fixing in BfA
local coordToDungeon = { } -- If it isn't obvious by now, I have no idea how to actually program
if (DEBUG) then
HNDL_NODES = nodes
HNDL_MINIMAP = minimap
HNDL_ALTERNAME = alterName
--HNDL_LOCKOUTS = lockouts
end
local LOCKOUTS = { }
local function updateLockouts()
table.wipe(LOCKOUTS)
for i=1,GetNumSavedInstances() do
local name, id, reset, difficulty, locked, extended, instanceIDMostSig, isRaid, maxPlayers, difficultyName, numEncounters, encounterProgress = GetSavedInstanceInfo(i)
if (locked) then
--print(name, difficultyName, numEncounters, encounterProgress)
if (not LOCKOUTS[name]) then
LOCKOUTS[name] = { }
end
LOCKOUTS[name][difficultyName] = encounterProgress .. "/" .. numEncounters
end
end
end
local pluginHandler = { }
function pluginHandler:OnEnter(uiMapId, coord) -- Copied from handynotes
--GameTooltip:AddLine("text" [, r [, g [, b [, wrap]]]])
-- Maybe check for situations where minimap and node coord overlaps
local nodeData = nil
--if (not nodes[mapFile][coord]) then return end
if (coordToDungeon[coord]) then
nodeData = coordToDungeon[coord]
end
if (minimap[mapFile] and minimap[mapFile][coord]) then
nodeData = minimap[mapFile][coord]
end
if (nodes[mapFile] and nodes[mapFile][coord]) then
nodeData = nodes[mapFile][coord]
end
if (not nodeData) then return end
local tooltip = self:GetParent() == WorldMapButton and WorldMapTooltip or GameTooltip
if ( self:GetCenter() > UIParent:GetCenter() ) then -- compare X coordinate
tooltip:SetOwner(self, "ANCHOR_LEFT")
else
tooltip:SetOwner(self, "ANCHOR_RIGHT")
end
if (not nodeData.name) then return end
local instances = { strsplit("\n", nodeData.name) }
updateLockouts()
for i, v in pairs(instances) do
--print(i, v)
if (db.lockouts and (LOCKOUTS[v] or (alterName[v] and LOCKOUTS[alterName[v]]))) then
if (LOCKOUTS[v]) then
--print("Dungeon/Raid is locked")
for a,b in pairs(LOCKOUTS[v]) do
--tooltip:AddLine(v .. ": " .. a .. " " .. b, nil, nil, nil, false)
tooltip:AddDoubleLine(v, a .. " " .. b, 1, 1, 1, 1, 1, 1)
end
end
if (alterName[v] and LOCKOUTS[alterName[v]]) then
for a,b in pairs(LOCKOUTS[alterName[v]]) do
--tooltip:AddLine(v .. ": " .. a .. " " .. b, nil, nil, nil, false)
tooltip:AddDoubleLine(v, a .. " " .. b, 1, 1, 1, 1, 1, 1)
end
end
else
tooltip:AddLine(v, nil, nil, nil, false)
end
end
tooltip:Show()
end
function pluginHandler:OnLeave(mapFile, coord)
if self:GetParent() == WorldMapButton then
WorldMapTooltip:Hide()
else
GameTooltip:Hide()
end
end
do
local tablepool = setmetatable({}, {__mode = 'k'})
local function deepCopy(object)
local lookup_table = {}
local function _copy(object)
if type(object) ~= "table" then
return object
elseif lookup_table[object] then
return lookup_table[object]
end
local new_table = {}
lookup_table[object] = new_table
for index, value in pairs(object) do
new_table[_copy(index)] = _copy(value)
end
return setmetatable(new_table, getmetatable(object))
end
return _copy(object)
end
local function iter(t, prestate)
if not t then return end
local data = t.data
local state, value = next(data, prestate)
if value then
if (not coordToDungeon[state]) then
coordToDungeon[state] = value
end
local icon, alpha
if (value.type == "Dungeon") then
icon = iconDungeon
elseif (value.type == "Raid") then
icon = iconRaid
elseif (value.type == "Mixed") then
icon = iconMixed
else
icon = iconDefault
end
local allLocked = true
local anyLocked = false
if value.name == nil then value.name = value.id end
local instances = { strsplit("\n", value.name) }
for i, v in pairs(instances) do
if (not LOCKOUTS[v] and not LOCKOUTS[alterName[v]]) then
allLocked = false
else
anyLocked = true
end
end
-- I feel like this inverted lockout thing could be done far better
if ((anyLocked and db.invertlockout) or (allLocked and not db.invertlockout) and db.lockoutgray) then
icon = iconGray
end
if ((anyLocked and db.invertlockout) or (allLocked and not db.invertlockout) and db.uselockoutalpha) then
alpha = db.lockoutalpha
else
alpha = db.zoneAlpha
end
--print('Minimap', t.minimapUpdate, legionInstancesDiscovered[value.id])
if not legionInstancesDiscovered[value.id] or t.minimapUpdate then
return state, nil, icon, db.zoneScale, alpha
end
state, value = next(data, state)
end
wipe(t)
tablepool[t] = true
end
-- This is a funky custom iterator we use to iterate over every zone's nodes
-- in a given continent + the continent itself
local function iterCont(t, prestate)
if not t then return end
if not db.continent then return end
local zone = t.C[t.Z]
local data = nodes[zone]
local state, value
while zone do
if data then -- Only if there is data for this zone
state, value = next(data, prestate)
while state do -- Have we reached the end of this zone?
if (not coordToDungeon[state]) then
coordToDungeon[state] = value
end
local icon, alpha
if (value.type == "Dungeon") then
icon = iconDungeon
elseif (value.type == "Raid") then
icon = iconRaid
elseif (value.type == "Mixed") then
icon = iconMixed
else
icon = iconDefault
end
local allLocked = true
local anyLocked = false
local instances = { strsplit("\n", value.name) }
for i, v in pairs(instances) do
if (not LOCKOUTS[v] and not LOCKOUTS[alterName[v]]) then
allLocked = false
else
anyLocked = true
end
end
-- I feel like this inverted lockout thing could be done far better
if ((anyLocked and db.invertlockout) or (allLocked and not db.invertlockout) and db.lockoutgray) then
icon = iconGray
end
if ((anyLocked and db.invertlockout) or (allLocked and not db.invertlockout) and db.uselockoutalpha) then
alpha = db.lockoutalpha
else
alpha = db.continentAlpha
end
if not value.hideOnContinent or zone == t.contId then -- Show on continent?
return state, zone, icon, db.continentScale, alpha
end
state, value = next(data, state) -- Get next data
end
end
-- Get next zone
t.Z = next(t.C, t.Z)
zone = t.C[t.Z]
data = nodes[zone]
prestate = nil
end
wipe(t)
tablepool[t] = true
end
function pluginHandler:GetNodes2(uiMapId, isMinimapUpdate)
--print(uiMapId)
local C = deepCopy(HandyNotes:GetContinentZoneList(uiMapId)) -- Is this a continent?
-- I copy the table so I can add in the continent map id
if C then
table.insert(C, uiMapId)
local tbl = next(tablepool) or {}
tablepool[tbl] = nil
tbl.C = C
tbl.Z = next(C)
tbl.contId = uiMapId
return iterCont, tbl, nil
else -- It is a zone
if (nodes[uiMapId] == nil) then return iter end -- Throws error if I don't do this
--print('zone')
local tbl = next(tablepool) or {}
tablepool[tbl] = nil
--print(isMinimapUpdate)
tbl.minimapUpdate = isMinimapUpdate
if (isMinimapUpdate and minimap[uiMapId]) then
tbl.data = minimap[uiMapId]
else
tbl.data = nodes[uiMapId]
end
return iter, tbl, nil
end
end
end
local waypoints = {}
local function setWaypoint(mapFile, coord)
local dungeon = nodes[mapFile][coord]
local waypoint = nodes[dungeon]
if waypoint and TomTom:IsValidWaypoint(waypoint) then
return
end
local title = dungeon.name
local x, y = HandyNotes:getXY(coord)
--print(x, y)
waypoints[dungeon] = TomTom:AddWaypoint(mapFile, x, y, {
title = dungeon.name,
persistent = nil,
minimap = true,
world = true
})
end
function pluginHandler:OnClick(button, pressed, mapFile, coord)
if (not pressed) then return end
--print(button, pressed, mapFile, coord)
if (button == "RightButton" and db.tomtom and TomTom) then
setWaypoint(mapFile, coord)
return
end
if (button == "LeftButton" and db.journal) then
if (not EncounterJournal_OpenJournal) then
UIParentLoadAddOn('Blizzard_EncounterJournal')
end
local dungeonID
--[[if (type(nodes[mapFile][coord].id) == "table") then
dungeonID = nodes[mapFile][coord].id[1]
else
dungeonID = nodes[mapFile][coord].id
end]]--
if (coordToDungeon[coord] and type(coordToDungeon[coord].id) == "table") then
dungeonID = coordToDungeon[coord].id[1]
else
dungeonID = coordToDungeon[coord].id
end
if (not dungeonID) then return end
--dungeonID)
local name, _, _, _, _, _, _, link = EJ_GetInstanceInfo(dungeonID)
if not link then return end
local difficulty = string.match(link, 'journal:.-:.-:(.-)|h')
if (not dungeonID or not difficulty) then return end
EncounterJournal_OpenJournal(difficulty, dungeonID)
end
end
local defaults = {
profile = {
zoneScale = 3,
zoneAlpha = 1,
continentScale = 3,
continentAlpha = 1,
continent = true,
tomtom = true,
journal = true,
checkForPOI = false,
lockouts = true,
lockoutgray = true,
uselockoutalpha = false,
lockoutalpha = 1,
invertlockout = false,
hideVanilla = false,
hideOutland = false,
hideNorthrend = false,
hideCata = false,
hidePandaria = false,
hideDraenor = false,
hideBrokenIsles = false,
hideBfa = false,
show = {
Dungeon = true,
Raid = true,
Mixed = true,
},
},
}
local Addon = CreateFrame("Frame")
Addon:RegisterEvent("PLAYER_LOGIN")
Addon:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end)
local function updateStuff()
updateLockouts()
HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations")
end
function Addon:PLAYER_ENTERING_WORLD()
if (not self.faction) then
self.faction = UnitFactionGroup("player")
--print("Faction", self.faction)
self:PopulateTable()
self:PopulateMinimap()
self:ProcessTable()
end
updateLockouts()
self:CheckForPOIs()
updateStuff()
end
function Addon:PLAYER_LOGIN()
local options = {
type = "group",
name = "DungeonLocations",
desc = "Locations of dungeon and raid entrances.",
get = function(info) return db[info[#info]] end,
set = function(info, v) db[info[#info]] = v HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
args = {
desc = {
name = L["These settings control the look and feel of the icon."],
type = "description",
order = 0,
},
zoneScale = {
type = "range",
name = L["Zone Scale"],
desc = L["The scale of the icons shown on the zone map"],
min = 0.2, max = 12, step = 0.1,
order = 10,
},
zoneAlpha = {
type = "range",
name = L["Zone Alpha"],
desc = L["The alpha of the icons shown on the zone map"],
min = 0, max = 1, step = 0.01,
order = 20,
},
continentScale = {
type = "range",
name = L["Continent Scale"],
desc = L["The scale of the icons shown on the continent map"],
min = 0.2, max = 12, step = 0.1,
order = 10,
},
continentAlpha = {
type = "range",
name = L["Continent Alpha"],
desc = L["The alpha of the icons shown on the continent map"],
min = 0, max = 1, step = 0.01,
order = 20,
},
continent = {
type = "toggle",
name = L["Show on Continent"],
desc = L["Show icons on continent map"],
order = 1,
},
tomtom = {
type = "toggle",
name = L["Enable TomTom integration"],
desc = L["Allow right click to create waypoints with TomTom"],
order = 2,
},
journal = {
type = "toggle",
name = L["Journal Integration"],
desc = L["Allow left click to open journal to dungeon or raid"],
order = 2,
},
checkForPOI = {
type = "toggle",
name = L["Don't show discovered dungeons"],
desc = L["This will check for legion and bfa dungeons that have already been discovered. THIS IS KNOWN TO CAUSE TAINT, ENABLE AT OWN RISK."],
order = 2.1,
},
showheader = {
type = "header",
name = L["Filter Options"],
order = 24,
},
showDungeons = {
type = "toggle",
name = L["Show Dungeons"],
desc = L["Show dungeon locations on the map"],
order = 24.1,
get = function() return db.show["Dungeon"] end,
set = function(info, v) db.show["Dungeon"] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
showRaids = {
type = "toggle",
name = L["Show Raids"],
desc = L["Show raid locations on the map"],
order = 24.2,
get = function() return db.show["Raid"] end,
set = function(info, v) db.show["Raid"] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
showMixed = {
type = "toggle",
name = L["Show Mixed"],
desc = L["Show mixed (dungeons + raids) locations on the map"],
order = 24.2,
get = function() return db.show["Mixed"] end,
set = function(info, v) db.show["Mixed"] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
lockoutheader = {
type = "header",
name = L["Lockout Options"],
order = 25,
},
lockouts = {
type = "toggle",
name = L["Lockout Tooltip"],
desc = L["Show lockout information on tooltips"],
order = 25.1,
},
lockoutgray = {
type = "toggle",
name = L["Lockout Gray Icon"],
desc = L["Use gray icon for dungeons and raids that are locked to any extent"],
order = 25.11,
},
uselockoutalpha = {
type = "toggle",
name = L["Use Lockout Alpha"],
desc = L["Use a different alpha for dungeons and raids that are locked to any extent"],
order = 25.2,
},
lockoutalpha = {
type = "range",
name = L["Lockout Alpha"],
desc = L["The alpha of dungeons and raids that are locked to any extent"],
min = 0, max = 1, step = 0.01,
order = 25.3,
},
invertlockout = {
type = "toggle",
name = L["Invert Lockout"],
desc = L["Turn mixed icons grey when ANY dungeon or raid listed is locked"],
order = 25.4,
},
hideheader = {
type = "header",
name = L["Hide Instances"],
order = 26,
},
hideVanilla = {
type = "toggle",
name = L["Hide Vanilla"],
desc = L["Hide all Vanilla nodes from the map"],
order = 26.1,
set = function(info, v) db[info[#info]] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
hideOutland = {
type = "toggle",
name = L["Hide Outland"],
desc = L["Hide all Outland nodes from the map"],
order = 26.2,
set = function(info, v) db[info[#info]] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
hideNorthrend = {
type = "toggle",
name = L["Hide Northrend"],
desc = L["Hide all Northrend nodes from the map"],
order = 26.3,
set = function(info, v) db[info[#info]] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
hideCata = {
type = "toggle",
name = L["Hide Cataclysm"],
desc = L["Hide all Cataclysm nodes from the map"],
order = 26.4,
set = function(info, v) db[info[#info]] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
hidePandaria = {
type = "toggle",
name = L["Hide Pandaria"],
desc = L["Hide all Pandaria nodes from the map"],
order = 26.5,
set = function(info, v) db[info[#info]] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
hideDraenor = {
type = "toggle",
name = L["Hide Draenor"],
desc = L["Hide all Draenor nodes from the map"],
order = 26.6,
set = function(info, v) db[info[#info]] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
hideBrokenIsles = {
type = "toggle",
name = L["Hide Broken Isles"],
desc = L["Hide all Broken Isle nodes from the map"],
order = 26.7,
set = function(info, v) db[info[#info]] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
hideBfA = {
type = "toggle",
name = L["Hide Battle for Azeroth"],
desc = L["Hide all BfA nodes from the map"],
order = 26.7,
set = function(info, v) db[info[#info]] = v self:FullUpdate() HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "DungeonLocations") end,
},
},
}
HandyNotes:RegisterPluginDB("DungeonLocations", pluginHandler, options)
self.db = LibStub("AceDB-3.0"):New("HandyNotes_DungeonLocationsDB", defaults, true)
db = self.db.profile
Addon:RegisterEvent("PLAYER_ENTERING_WORLD") -- Check for any lockout changes when we zone
end
-- I only put a few specific nodes on the minimap, so if the minimap is used in a zone then I need to add all zone nodes to it except for the specific ones
-- This could also probably be done better maybe
-- Looks like this function used to rely on the map id, changed so it doesn't error but needs further testing
function Addon:PopulateMinimap() -- This use to ignore duplicate dungeon's but now it doesn't
--print('Populating minimap')
local temp = { }
for k,v in pairs(nodes) do
if (minimap[k]) then
--print('Minimap already exists')
for a,b in pairs(minimap[k]) do -- Looks at the nodes we already have on the minimap and marks them down in a temp table
temp[a] = true
end
for c,d in pairs(v) do -- Looks at the nodes in the normal node table and if they are also not in the temp table then add them to the minimap
if (not temp[c] and not d.hideOnMinimap) then
minimap[k][c] = d
end
end
end
end
end
function Addon:PopulateTable()
table.wipe(nodes)
table.wipe(minimap)
-- [COORD] = { Dungeonname/ID, Type(Dungeon/Raid/Mixed), hideOnContinent(Bool), LFGDungeonID if Applicable, nil placeholder for id later, other dungeons }
-- I feel like I should change all this to something like:
-- [COORD] = {
-- name = "Dungeon Name", -- after processing, wouldn't exist before
-- ids = { }, -- Either one id for single or multiple id's in table for merged ones
-- hideOnContinent = true/false
-- hideOnMinimap = true/false, since I've redid some things, the function that puts nodes on the minimap only considers nodes to be the same if the have the same coordinates
-- lfgid = { }, Either one id for single or multiple id's in table; though I don't know if tables gaurantee order
-- },
-- VANILLA
if (not self.db.profile.hideVanilla) then
nodes[327] = { -- AhnQirajTheFallenKingdom
[59001430] = {
id = 743,
type = "Raid",
hideOnContinent = true
}, -- Ruins of Ahn'Qiraj Silithus 36509410, World 42308650
[46800750] = { id = 744,
type = "Raid",
hideOnContinent = true
}, -- Temple of Ahn'Qiraj Silithus 24308730, World 40908570
}
nodes[63] = { -- Ashenvale
--[16501100] = { 227, type = "Dungeon" }, -- Blackfathom Deeps 14101440 May look more accurate
[14001310] = {
id = 227,
type = "Dungeon",
}, -- Blackfathom Deeps, not at portal but look
}
nodes[15] = { -- Badlands
[41801130] = {
id = 239,
type = "Dungeon",
}, -- Uldaman
[58463690] = {
id = 239,
type = "Dungeon",
hideOnMinimap = true,
}, -- Uldaman (Secondary Entrance)
}
minimap[15] = { -- Badlands
[60683744] = {
id = 239,
type = "Dungeon"
}, -- Uldaman (Secondary Entrance)
}
nodes[10] = { -- Barrens
[42106660] = {
id = 240,
type = "Dungeon",
cont = true,
}, -- Wailing Caverns
}
nodes[36] = { -- BurningSteppes
[20303260] = {
id = { 66, 228, 229, 559, 741, 742 },
type = "Mixed",
hideOnContinent = true,
}, -- Blackrock mountain dungeons and raids
[23202630] = {
id = 73,
type = "Raid",
hideOnContinent = true,
}, -- Blackwind Descent
}
nodes[42] = { -- DeadwindPass
[46907470] = {
id = 745,
type = "Raid",
hideOnContinent = true,
}, -- Karazhan
[46707020] = {
id = 860,
type = "Dungeon",
hideOnContinent = true,
}, -- Return to Karazhan
}
nodes[66] = { -- Desolace
[29106250] = {
id = 232,
type = "Dungeon",
}, -- Maraudon 29106250 Door at beginning
}
nodes[27] = { -- DunMorogh
[29903560] = {
id = 231,
type = "Dungeon",
}, -- Gnomeregan
}
nodes[70] = { -- Dustwallow
[52907770] = {
id = 760,
type = "Raid",
}, -- Onyxia's Lair
}
nodes[23] = { -- EasternPlaguelands
[27201160] = {
id = 236,
lfgid = 40,
type = "Dungeon",
}, -- Stratholme World 52902870
[43401940] = {
id = 236,
lfgid = 274,
type = "Dungeon", -- Stratholme Service Entrance
},
}
nodes[69] = { -- Feralas
[65503530] = {
id = 230,
lfgid = 34,
type = "Dungeon",
--hideOnContinent = true,
}, -- Dire Maul, probably dire maul east
[60403070] = {
id = 230,
lfgid = 36,
type = "Dungeon",
hideOnContinent = true,
hideOnMinimap = true,
}, -- Dire Maul West (probably) One spot between the two actual entrances
-- Captial Gardens, 60.3 31.3; 60.4 30.7; 60.3 30.1; 429
-- North Maybe?, 62.5 24.9;
[62502490] = {
id = 230,
lfgid = 38,
type = "Dungeon",
hideOnContinent = true,
}, -- Dire Maul, probaly dire maul north
[77053693] = {
id = 230,
lfgid = 34,
type = "Dungeon",
hideOnContinent = true,
}, -- Dire Maul (at Lariss Pavillion)
}
nodes[85] = { -- Orgrimmar
[52405800] = {
id = 226,
type = "Dungeon",
}, -- Ragefire Chasm Cleft of Shadow 70104880
}
nodes[32] = { -- SearingGorge
[41708580] = {
id = { 66, 228, 229, 559, 741, 742 },
type = "Mixed",
hideOnContinent = true,
},
[43508120] = {
id = 73,
type = "Raid",
hideOnContinent = true,
}, -- Blackwind Descent
}
nodes[81] = { -- Silithus
[36208420] = {
id = 743,
type = "Raid",
}, -- Ruins of Ahn'Qiraj
[23508620] = {
id = 744,
type = "Raid",
}, -- Temple of Ahn'Qiraj
}
nodes[21] = { -- Silverpine
[44806780] = {
id = 64,
type = "Dungeon",
}, -- Shadowfang Keep
}
nodes[199] = { -- SouthernBarrens
[40909450] = {
id = 234,
type = "Dungeon",
}, -- Razorfen Kraul
}
nodes[84] = { -- StormwindCity
[50406640] = {
id = 238,
type = "Dungeon",
}, -- The Stockade
}
nodes[50] = { -- StranglethornJungle
[72203290] = {
id = 76,
type = "Dungeon",
}, -- Zul'Gurub
}
nodes[224] = { -- StranglethornVale Jungle and Cape are subzones of this zone (weird)
[63402180] = {
id = 76,
type = "Dungeon",
}, -- Zul'Gurub
}
nodes[51] = { -- SwampOfSorrows
[69505250] = {
id = 237,
type = "Dungeon",
}, -- The Temple of Atal'hakkar
}
nodes[71] = { --Tanaris
[65604870] = {
id = { 279, 255, 251, 750, 184, 185, 186, 187 },
type = "Mixed",
},
--[[[61006210] = { "The Culling of Stratholme",
type = "Dungeon" }, --65604870 May look more accurate and merge all CoT dungeons/raids
[57006230] = { "The Black Morass", type = "Dungeon" },
[54605880] = { 185, type = "Dungeon" }, -- Well of Eternity
[55405350] = { "The Escape from Durnholde", type = "Dungeon" },
[57004990] = { "The Battle for Mount Hyjal", type = "Raid" },
[60905240] = { 184, type = "Dungeon" }, -- End Time
[61705190] = { 187, type = "Raid" }, -- Dragon Soul
[62705240] = { 186, type = "Dungeon" }, -- Hour of Twilight Merge END ]]--
[39202130] = {
id = 241,
type = "Dungeon",
}, -- Zul'Farrak
}
nodes[18] = { -- Tirisfal
[85303220] = {
id = 311,
type = "Dungeon",
hideOnContinent = true,
}, -- Scarlet Halls
[84903060] = {
id = 316,
type = "Dungeon",
hideOnContinent = true,
}, -- Scarlet Monastery
}
nodes[64] = { -- ThousandNeedles
[47402360] = {
id = 233,
type = "Dungeon",
}, -- Razorfen Downs
}
nodes[22] = { -- WesternPlaguelands
[69007290] = {
id = 246,
type = "Dungeon",
}, -- Scholomance World 50903650
}
nodes[52] = { -- Westfall
--[38307750] = { 63, type = "Dungeon" }, -- Deadmines 43707320 May look more accurate
[43107390] = {
id = 63,
type = "Dungeon",
}, -- Deadmines
}
-- Vanilla Continent, For things that should be shown or merged only at the continent level
nodes[13] = { -- Eastern Kingdoms
[46603050] = {
id = { 311, 316 },
type = "Dungeon",
cont = true,
}, -- Scarlet Halls/Monastery
[47316942] = {
id = { 66, 73, 228, 229, 559, 741, 742 },
type = "Mixed",
}, -- Blackrock mount instances, merged in blackwind descent at continent level
--[38307750] = { 63, type = "Dungeon" }, -- Deadmines 43707320,
[49508190] = {
id = { 745, 860 },
type = "Mixed",
}, -- Karazhan/Return to Karazhan
}
nodes[12] = { -- Kalimdor
[44006850] = {
id = 230,
type = "Dungeon"
}, -- Maul
}
minimap[69] = { -- Feralas
[65503530] = {
id = 230,
lfgid = 34,
type = "Dungeon",
hideOnContinent = true,
}, -- Dire Maul - Warpwood Quarter
[62502490] = {
id = 230,
lfgid = 38,
type = "Dungeon",
hideOnContinent = true,
}, -- Dire Maul, probaly dire maul north
[60303130] = {
id = 230,
lfgid = 36,
type = "Dungeon",
hideOnContinent = true,
}, -- Dire Maul, probably dire maul west, two entrances to same dungeon
[60303010] = {
id = 230,
lfgid = 36,
type = "Dungeon",
hideOnContinent = true,
}, -- Dire Maul, probably dire maul west
}
-- Vanilla Subzone maps
nodes[33] = { -- BlackrockMountain
[71305340] = {
id = 66,
type = "Dungeon",
}, -- Blackrock Caverns
[38701880] = {
id = 228,
type = "Dungeon",
}, -- Blackrock Depths
[80504080] = {
id = 229,
type = "Dungeon",
}, -- Lower Blackrock Spire
[79003350] = {
id = 559,
type = "Dungeon",
}, -- Upper Blackrock Spire
[54208330] = {
id = 741,
type = "Raid",
}, -- Molten Core
[64207110] = {
id = 742,
type = "Raid",
}, -- Blackwing Lair
}
nodes[75] = { -- CavernsofTime
[57608260] = {
id = 279,
type = "Dungeon",
}, -- The Culling of Stratholme
[36008400] = {
id = 255,
type = "Dungeon",
}, -- The Black Morass
[26703540] = {
id = 251,
type = "Dungeon",
}, -- Old Hillsbrad Foothills
[35601540] = {
id = 750,
type = "Raid",
}, -- The Battle for Mount Hyjal
[57302920] = {
id = 184,
type = "Dungeon",
}, -- End Time
[22406430] = {
id = 185,
type = "Dungeon",
}, -- Well of Eternity
[67202930] = {
id = 186,
type = "Dungeon",
}, -- Hour of Twilight
[61702640] = {
id = 187,
type = "Raid",
}, -- Dragon Soul
}
nodes[55] = { -- DeadminesWestfall
[25505090] = {
id = 63,
type = "Dungeon",
}, -- Deadmines
}
nodes[67] = { -- MaraudonOutside Wicked Grotto I swapped the lfgid for this one and the 26 one to better match map name
[78605600] = {
id = 232,
lfgid = 272,
type = "Dungeon",
}, -- Maraudon 36006430
}
nodes[68] = { -- Maraudon Foulspore Cavern
[52102390] = {
id = 232,
lfgid = 26,
type = "Dungeon"
}, -- Maraudon 30205450
[44307680] = {
id = 232,
lfgid = 273,
type = "Dungeon",
}, -- Maraudon
}
nodes[469] = { -- NewTinkertownStart
[31703450] = {
id = 231,
type = "Dungeon",
}, -- Gnomeregan
}
nodes[30] = { -- New Tinker Town
[30167457] = {
id = 231,
type = "Dungeon"
}, -- Gnomeregan
[44631377] = {
id = 231,
type = "Dungeon",
}, -- Gnomeregan
}
nodes[19] = { -- Internal Zone ScarletMonasteryEntrance
[68802420] = {
id = 316,
type = "Dungeon",
}, -- Scarlet Monastery
[78905920] = {
id = 311,
type = "Dungeon",
}, -- Scarlet Halls
}
nodes[11] = {
[55106640] = {
id = 240,
type = "Dungeon",
}, -- Wailing Caverns
}
end
-- OUTLAND
if (not self.db.profile.hideOutland) then
nodes[105] = { -- BladesEdgeMountains
[69302370] = {
id = 746,
type = "Raid",
}, -- Gruul's Lair World 45301950
}
nodes[95] = { -- Ghostlands
[85206430] = {
id = 77,
type = "Dungeon",
}, -- Zul'Aman World 58302480
}
nodes[100] = { -- Hellfire
--[47505210] = { 747,type = "Raid" }, -- Magtheridon's Lair World 56705270
--[47605360] = { 248, type = "Dungeon" }, -- Hellfire Ramparts World 56805310 Stone 48405240 World 57005280
--[47505200] = { 259, type = "Dungeon" }, -- The Shattered Halls World 56705270
--[46005180] = { 256, type = "Dungeon" }, -- The Blood Furnace World 56305260
[47205220] = {
id = { 248, 256, 259, 747 },
type = "Mixed",
hideOnMinimap = true,
}, -- Hellfire Ramparts, The Blood Furnace, The Shattered Halls, Magtheridon's Lair
}
nodes[109] = { -- Netherstorm
[71705500] = {
id = 257,
type = "Dungeon",
}, -- The Botanica
[70606980] = {
id = 258,
type = "Dungeon",
}, -- The Mechanar World 65602540
[74405770] = {
id = 254,
type = "Dungeon",
}, -- The Arcatraz World 66802160
[73806380] = {
id = 749,
type = "Raid",
}, -- The Eye World 66602350
}
nodes[108] = { -- TerokkarForest
[34306560] = {
id = 247,
type = "Dungeon",
}, -- Auchenai Crypts World 44507890
[39705770] = {
id = 250,
type = "Dungeon",
}, -- Mana-Tombs World 46107640
[44906560] = {
id = 252,
type = "Dungeon",
}, -- Sethekk Halls World 47707890 Summoning Stone For Auchindoun 39806470, World: 46207860
[39607360] = {
id = 253,
type = "Dungeon",
}, -- Shadow Labyrinth World 46108130
}
nodes[104] = { -- ShadowmoonValley
[71004660] = {
id = 751,
type = "Raid",
}, -- Black Temple World 72608410
}
nodes[122] = { -- Sunwell, Isle of Quel'Danas
[61303090] = {
id = 249,
type = "Dungeon",
}, -- Magisters' Terrace
[44304570] = {
id = 752,
type = "Raid",
}, -- Sunwell Plateau World 55300380
}
nodes[102] = { -- Zangarmarsh
--[54203450] = { 262, type = "Dungeon" }, -- Underbog World 35804330
--[48903570] = { 260, type = "Dungeon" }, -- Slave Pens World 34204370
--[51903280] = { 748, type = "Raid" }, -- Serpentshrine Cavern World 35104280
[50204100] = {
id = { 260, 261, 262, 748 },
type = "Mixed",
hideOnMinimap = true,
}, -- Mixed Location
}
minimap[100] = { -- Hellfire
[47605360] = {
id = 248,
type = "Dungeon",
}, -- Hellfire Ramparts World 56805310 Stone 48405240 World 57005280
[46005180] = {
id = 256,
type = "Dungeon",
}, -- The Blood Furnace World 56305260
[48405180] = {
id = 259,
type = "Dungeon",
}, -- The Shattered Halls World 56705270, Old 47505200. Adjusted for clarity
[46405290] = {
id = 747,
type = "Raid",
}, -- Magtheridon's Lair World 56705270, Old 47505210. Adjusted for clarity
}
minimap[102] = { -- Zangarmarsh
[48903570] = {
id = 260,
type = "Dungeon",
}, -- Slave Pens World 34204370
[50303330] = {
id = 261,
type = "Dungeon",
}, -- The Steamvault
[54203450] = {
id = 262,
type = "Dungeon",
}, -- Underbog World 35804330
[51903280] = {
id = 748,
type = "Raid",
}, -- Serpentshrine Cavern World 35104280
}
end
-- NORTHREND (16 Dungeons, 9 Raids)
if (not self.db.profile.hideNorthrend) then
nodes[114] = { --"BoreanTundra"
[27602660] = {
id = { 282, 756, 281 },
type = "Mixed",
},
-- Oculus same as eye of eternity
--[27502610] = { "The Nexus", type = "Dungeon" },
}
nodes[125] = {
[66726812] = {
id = 283,
type = "Dungeon",
hideOnContinent = true,
}, -- The Violet Hold
}
nodes[127] = {
[28203640] = {
id = 283,
type = "Dungeon",
}, -- The Violet Hold
}
nodes[115] = { -- Dragonblight
[28505170] = {
id = 271,
type = "Dungeon",
cont = true,
}, -- Ahn'kahet: The Old Kingdom
[26005090] = {
id = 272,
type = "Dungeon",
}, -- Azjol-Nerub
[87305100] = {
id = 754,
type = "Raid",
}, -- Naxxramas
[61305260] = {
id = 761,
type = "Raid",
}, -- The Ruby Sanctum
[60005690] = {
id = 755,
type = "Raid",
}, -- The Obsidian Sanctum
}
nodes[117] = { -- HowlingFjord
--[57304680] = { 285, type = "Dungeon" }, -- Utgarde Keep, more accurate but right underneath Utgarde Pinnacle
[58005000] = {
id = 285,
type = "Dungeon",
}, -- Utgarde Keep, at doorway entrance
[57204660] = {
id = 286,
type = "Dungeon",
}, -- Utgarde Pinnacle
}
nodes[118] = { -- IcecrownGlacier
[54409070] = {
id = { 276, 278, 280 },
type = "Dungeon",
hideOnMinimap = true,
}, -- The Forge of Souls, Halls of Reflection, Pit of Saron
[74202040] = {
id = 284,
type = "Dungeon",
hideOnContinent = true,
}, -- Trial of the Champion
[75202180] = {
id = 757,
type = "Raid",
hideOnContinent = true,
}, -- Trial of the Crusader
[53808720] = {
id = 758,
type = "Raid",
}, -- Icecrown Citadel
}
nodes[123] = { -- LakeWintergrasp
[50001160] = {
id = 753,
type = "Raid",
}, -- Vault of Archavon
}
nodes[120] = { -- TheStormPeaks
[45302140] = {
id = 275,
type = "Dungeon",
}, -- Halls of Lightning
[39602690] = {
id = 277,
type = "Dungeon",
}, -- Halls of Stone
[41601770] = {
id = 759,
type = "Raid",
}, -- Ulduar
}
nodes[121] = { -- ZulDrak
[28508700] = {
id = 273,
type = "Dungeon",
}, -- Drak'Tharon Keep 17402120 Grizzly Hills
[76202110] = {
id = 274,
type = "Dungeon",
}, -- Gundrak Left Entrance
[81302900] = {
id = 274,
type = "Dungeon",
}, -- Gundrak Right Entrance
}
-- NORTHREND MINIMAP, For things that would be too crowded on the continent or zone maps but look correct on the minimap
minimap[118] = { -- IcecrownGlacier
[54908980] = {
id = 280,
type = "Dungeon",
hideOnContinent = true,
}, -- The Forge of Souls
[55409080] = {
id = 276,
type = "Dungeon",
hideOnContinent = true,
}, -- Halls of Reflection
[54809180] = {
id = 278,
type = "Dungeon",
hideOnContinent = true,
}, -- Pit of Saron 54409070 Summoning stone in the middle of last 3 dungeons
}
-- NORTHREND CONTINENT, For things that should be shown or merged only at the continent level
nodes[113] = { -- Northrend
--[80407600] = { 285, type = "Dungeon", false, 286 }, -- Utgarde Keep, Utgarde Pinnacle CONTINENT MERGE Location is slightly incorrect
[47501750] = {
id = { 757, 284 },
type = "Mixed",
showOnContinent = true,
}, -- Trial of the Crusader and Trial of the Champion
}
end
-- CATACLYSM
if (not self.db.profile.hideCata) then
nodes[207] = { -- Deepholm
[47405210] = {
id = 67,
type = "Dungeon",
}, -- The Stonecore (Maelstrom: 51002790)
}
nodes[198] = { -- Hyjal
[47307810] = {
id = 78,
type = "Raid",
}, -- Firelands
}
nodes[244] = { -- TolBarad
[46104790] = {
id = 75,
type = "Raid",
}, -- Baradin Hold
}
nodes[241] = { -- TwilightHighlands
[19105390] = {
id = 71,
type = "Dungeon",
}, -- Grim Batol World 53105610
[34007800] = {
id = 72,
type = "Raid",
}, -- The Bastion of Twilight World 55005920
}
nodes[249] = { -- Uldum
[76808450] = {
id = 68,
type = "Dungeon",
}, -- The Vortex Pinnacle
[60506430] = {
id = 69,
type = "Dungeon",
}, -- Lost City of Tol'Vir
[69105290] = {
id = 70,
type = "Dungeon",
}, -- Halls of Origination
[38308060] = {
id = 74,
type = "Raid",
}, -- Throne of the Four Winds
}
nodes[203] = { -- Vashjir
[48204040] = {
id = 65,
type = "Dungeon",
hideOnContinent = true,
}, -- Throne of Tides
}
nodes[204] = { -- VashjirDepths
[69302550] = {
id = 65,
type = "Dungeon",
}, -- Throne of Tides
}
end
-- PANDARIA
if (not self.db.profile.hidePandaria) then
nodes[422] = { -- DreadWastes
[38803500] = {
id = 330,
type = "Raid",
}, -- Heart of Fear
}
nodes[504] = { -- IsleoftheThunderKing
[63603230] = {
id = 362,
type = "Raid",
hideOnContinent = true
}, -- Throne of Thunder
}
nodes[379] = { -- KunLaiSummit
[59503920] = {
id = 317,
type = "Raid",
}, -- Mogu'shan Vaults
[36704740] = {
id = 312,
type = "Dungeon",
}, -- Shado-Pan Monastery
}
nodes[433] = { -- TheHiddenPass
[48306130] = {
id = 320,
type = "Raid",
}, -- Terrace of Endless Spring
}
nodes[371] = { -- TheJadeForest
[56205790] = {
id = 313,
type = "Dungeon",
}, -- Temple of the Jade Serpent
}
nodes[388] = { -- TownlongWastes
[34708150] = {
id = 324,
type = "Dungeon",
}, -- Siege of Niuzao Temple
}
nodes[390 ] = { -- ValeofEternalBlossoms
[15907410] = {
id = 303,
type = "Dungeon",
}, -- Gate of the Setting Sun
[80803270] = {
id = 321,
type = "Dungeon",
}, -- Mogu'shan Palace
[74104200] = {
id = 369,
type = "Raid",
}, -- Siege of Orgrimmar
}
nodes[376] = { -- ValleyoftheFourWinds
[36106920] = {
id = 302,
type = "Dungeon",
}, -- Stormstout Brewery
}
-- PANDARIA Continent, For things that should be shown or merged only at the continent level
nodes[424] = { -- Pandaria
[23100860] = {
id = 362,
type = "Raid",
}, -- Throne of Thunder, looked weird so manually placed on continent
}
end
-- DRAENOR
if (not self.db.profile.hideDraenor) then
nodes[525] = { -- FrostfireRidge
[49902470] = {
id = 385,
type = "Dungeon",
}, -- Bloodmaul Slag Mines
}
nodes[543] = { -- Gorgrond
[51502730] = {
id = 457,
type = "Raid",
}, -- Blackrock Foundry
[55103160] = {
id = 536,
type = "Dungeon",
}, -- Grimrail Depot
[59604560] = {
id = 556,
type = "Dungeon",
}, -- The Everbloom
[45401350] = {
id = 558,
type = "Dungeon",
}, -- Iron Docks
}
nodes[550] = { -- NagrandDraenor
[32903840] = {
id = 477,
type = "Raid",
}, -- Highmaul
}
nodes[539] = { -- ShadowmoonValleyDR
[31904260] = {
id = 537,
type = "Dungeon",
}, -- Shadowmoon Burial Grounds
}
nodes[542] = { -- SpiresOfArak
[35603360] = {
id = 476,
type = "Dungeon",
}, -- Skyreach
}
nodes[535] = { -- Talador
[46307390] = {
id = 547,
type = "Dungeon",
}, -- Auchindoun
}
nodes[534] = { -- TanaanJungle
[45605360] = {
id = 669,
type = "Raid",
}, -- Hellfire Citadel
}
end
if (not self.db.profile.hideBrokenIsles) then -- FIX ME
-- Legion Dungeons/Raids for minimap and continent map for consistency
-- This seems to be the only legion dungeon/raid that isn't shown at all
-- I have made this into an ugly abomination
nodes[619] = { } -- BrokenIsles
nodes[619][35402850] = {
id = { 762, 768 },
type = "Mixed",
hideOnMinimap = true,
} -- The Emerald Nightmare 35102910
nodes[619][65003870] = {
id = { 721, 861 },
type = "Mixed",
hideOnMinimap = true,
} -- Halls of Valor/Trial of Valor
nodes[619][46704780] = {
id = { 726, 786 },
type = "Mixed",
hideOnMinimap = true,
}
nodes[619][46606550] = {
id = 777,
type = "Dungeon",
hideOnMinimap = true,
} -- Assault on Violet Hold
nodes[619][56506240] = { -- Always show because merged
id = { 875, 900 },
type = "Mixed",
hideOnMinimap = true,
} -- Tomb of Sargeras and Cathedral of the Night
nodes[627] = { -- Dalaran70
[66406850] = {
id = 777,
type = "Dungeon",
hideOnContinent = true,
}, -- Assault on Violet Hold
}
if (not legionInstancesDiscovered[946]) then
nodes[885] = { -- ArgusCore
[54786241] = {
id = 946,
type = "Raid",
}, -- Antorus, the burning throne
}
else
minimap[885] = {
[54786241] = {
id = 946,
type = "Raid",
}, -- Antorus, the burning throne
}
end
if (not legionInstancesDiscovered[945]) then
nodes[882] = { -- ArgusMacAree
-- 22.20 55.84
[22205584] = {
id = 945,
type = "Dungeon",
}, -- Seat of the Triumvirate
}
else
minimap[882] = {
-- 22.20 55.84
[22205584] = {
id = 945,
type = "Dungeon",
}, -- Seat of the Triumvirate
}
end
if (not legionInstancesDiscovered[716]) then
nodes[630] = { } -- Azsuna
nodes[630][61204110] = {
id = 716,
type = "Dungeon",
}
else
minimap[630] = { }
minimap[630][61204110] = {
id = 716,
type = "Dungeon",
}
nodes[619][38805780] = {
id = 716,
type = "Dungeon",
hideOnMinimap = true,
}
end
if (not legionInstancesDiscovered[707]) then
if (not nodes[630]) then -- Azsuna
nodes[630] = { }
end
nodes[630][48308030] = {
id = 707,
type = "Dungeon"
}
else
if (not minimap[630]) then
minimap[630] = { }
end
minimap[630][48308030] = {
id = 707,
type = "Dungeon"
}
nodes[619][34207210] = {
id = 707,
type = "Dungeon",
hideOnMinimap = true,
}
end
if (not legionInstancesDiscovered[875]) then -- Tomb of Sargeras
nodes[646] = { }
nodes[646][64602070] = {
id = 875,
type = "Raid",
hideOnContinent = true,
}
else
minimap[619] = {
[64602070] = {
id = 875,
type = "Raid",
},
}
end
if (not legionInstancesDiscovered[900]) then
if (not nodes[646]) then -- BrokenShore
nodes[646] = { }
end
nodes[646][64701660] = {
id = 900,
type = "Dungeon",
hideOnContinent = true,
}
else
if (not minimap[646]) then
minimap[646] = { }
end
minimap[646][64701660] = {
id = 900,
type = "Dungeon",
}
end
if (not legionInstancesDiscovered[767]) then
nodes[650] = { -- Highmountain
[49606860] = {
id = 767,
type = "Dungeon",
},
}
else
minimap[650] = {
[49606860] = {
id = 767,
type = "Dungeon",
},
}
nodes[619][47302810] = {
id = 767,
type = "Dungeon",
hideOnMinimap = true,
}
end
if (not legionInstancesDiscovered[861]) then
nodes[634] = { } -- Stormheim
nodes[634][71107280] = {
id = 861,
type = "Raid",
hideOnContinent = true,
}
else
minimap[634] = {
[71107280] = {
id = 861,
type = "Raid",
},
}
end
if (not legionInstancesDiscovered[721]) then
if (not nodes[634]) then
nodes[634] = { }
end
nodes[634][72707050] = {
id = 721,
type = "Dungeon",
hideOnContinent = true,
}
else
if (not minimap[634]) then
minimap[634] = { }
end
minimap[634][72707050] = {
id = 721,
type = "Dungeon",
}
end
if (not legionInstancesDiscovered[727]) then
if (not nodes[634]) then
nodes[634] = { }
end
nodes[634][52504530] = {
id = 727,
type = "Dungeon",
}
else
if (not minimap[634]) then
minimap[634] = { }
end
minimap[634][52504530] = {
id = 727,
type = "Dungeon",
}
nodes[619][59003060] = {
id = 727,
type = "Dungeon",
hideOnMinimap = true,
}
end
if (not legionInstancesDiscovered[726]) then
nodes[680] = { -- Suramar
[41106170] = {
id = 726,
type = "Dungeon",
hideOnContinent = true,
},
}
else
minimap[680] = {
[41106170] = {
id = 726,
type = "Dungeon",
},
}
end
if (not legionInstancesDiscovered[800]) then
if (not nodes[680]) then
nodes[680] = { }
end
nodes[680][50806550] = {
id = 800,
type = "Dungeon",
}
else
if (not minimap[680]) then
minimap[680] = { }
end
minimap[680][50806550] = {
id = 800,
type = "Dungeon",
}
nodes[619][49104970] = {
id = 800,
type = "Dungeon",
hideOnMinimap = true,
}
end
if (not legionInstancesDiscovered[786]) then
if (not nodes[680]) then
nodes[680] = { }
end
nodes[680][44105980] = {
id = 786,
type = "Raid",
hideOnContinent = true,
}
else
if (not minimap[680]) then
minimap[680] = { }
end
minimap[680][44105980] = {
id = 786,
type = "Raid",
}
end
if (not legionInstancesDiscovered[740]) then
nodes[641] = { -- Valsharah
[37205020] = {
id = 740,
type = "Dungeon",
},
}
else
minimap[641] = {
[37205020] = {
id = 740,
type = "Dungeon",
},
}
nodes[619][29403300] = {
id = 740,
type = "Dungeon",
hideOnMinimap = true,
}
end
if (not legionInstancesDiscovered[762]) then
if (not nodes[641]) then
nodes[641] = { }
end
nodes[641][59003120] = {
id = 762,
type = "Dungeon",
hideOnContinent = true,
}
else
if (not minimap[641]) then
minimap[641] = { }
end
minimap[641][59003120] = {
id = 762,
type = "Dungeon",
}
end
if (not legionInstancesDiscovered[768]) then
if (not nodes[641]) then
nodes[641] = { }
end
nodes[641][56303680] = {
id = 768,
type = "Raid",
hideOnContinent = true,
}
else
if (not minimap[641]) then
minimap[641] = { }
end
minimap[641][56303680] = {
id = 768,
type = "Raid",
}
end
end
if (not self.db.profile.hideBfA) then
nodes[862] = { } -- Zuldazar
nodes[863] = { } -- Nazmir
nodes[864] = { } -- Vol'Dun
nodes[895] = { } -- Tiragarde Sound
nodes[896] = { } -- Drustvar
nodes[942] = { } -- Stormsong Valley
nodes[1165] = { } -- Dazar'alor
nodes[1169] = { } -- Tol Dagor
nodes[875] = { } -- Zandalar
nodes[876] = { } --Kul'Tiras
nodes[862][43323947] = {
id = 968,
type = "Dungeon",
}
if (self.faction == "Alliance") then
nodes[862][39227137] = {
id = 1012,
type = "Dungeon",
} -- The MOTHERLODE ALLIANCE
end
if (self.faction == "Horde") then
nodes[862][55995989] = {
id = 1012,
type = "Dungeon",
} -- The MOTHERLODE HORDE
end
nodes[862][37463948] = {
id = 1041,
type = "Dungeon",
}
nodes[863][51386483] = {
id = 1022,
type = "Dungeon",
} -- The Underrot
nodes[863][53886268] = {
id = 1031,
type = "Raid",
} -- Uldir
nodes[864][51932484] = {
id = 1030,
type = "Dungeon",
} -- Temple of Sethraliss
nodes[895][84457887] = {
id = 1001,
type = "Dungeon",
} -- Freehold
nodes[1165][44049256] = {
id = 1012,
type = "Dungeon",
} -- The MOTHERLODE HORDE
nodes[1169][39576833] = {
id = 1002,
type = "Dungeon",
} -- Tol Dagor
nodes[896][33681233] = {
id = 1021,
type = "Dungeon",
} -- Waycrest Manor
nodes[942][78932647] = {
id = 1036,
type = "Dungeon",
} -- Shrine of Storm
nodes[876][68262354] = {
id = 1177,
type = "Raid",
} -- Crucible of Storms
minimap[942] = { }
minimap[942][83934677] = {
id = 1177,
type = "Raid",
} -- Crucible of Storms
if (self.faction == "Alliance") then
nodes[895][74752350] = {
id = 1023, -- LFG 1700, 1701
type = "Dungeon",
} -- Siege of Boralus
nodes[876][62005250] = {
id = 1176,
type = "Raid",
} -- Battle of Dazar'alor
end
if (self.faction == "Horde") then
nodes[895][88305105] = {
id = 1023,
type = "Dungeon",
} -- Siege of Boralus
nodes[875][56005350] = {
id = 1176,
type = "Raid",
} -- Battle of Dazar'alor
end
--[[nodes[1161] = { } -- Boralus
nodes[1161][71961540] = {
id = 1023, -- LFG 1700, 1701
type = "Dungeon",
} -- Siege of Boralus
-- end ]]--
end
end
function Addon:ProcessTable()
table.wipe(alterName)
-- These are the same on the english client, I put them here cause maybe they change in other locales. This list was somewhat automatically generated
-- I may be over thinking this
alterName[321] = 1467 -- Mogu'shan Palace
alterName[758] = 280 -- Icecrown Citadel
alterName[476] = 1010 -- Skyreach
alterName[233] = 20 -- Razorfen Downs
alterName[751] = 196 -- Black Temple
alterName[536] = 1006 -- Grimrail Depot
alterName[861] = 1439 -- Trial of Valor
alterName[756] = 1423 -- The Eye of Eternity
alterName[716] = 1175 -- Eye of Azshara
alterName[76] = 334 -- Zul'Gurub
alterName[77] = 340 -- Zul'Aman
alterName[757] = 248 -- Trial of the Crusader
alterName[236] = 1458 -- Stratholme
alterName[745] = 175 -- Karazhan
alterName[271] = 1016 -- Ahn'kahet: The Old Kingdom
alterName[330] = 534 -- Heart of Fear
alterName[186] = 439 -- Hour of Twilight
alterName[229] = 32 -- Lower Blackrock Spire
alterName[279] = 210 -- The Culling of Stratholme
alterName[385] = 1005 -- Bloodmaul Slag Mines
alterName[253] = 181 -- Shadow Labyrinth
alterName[276] = 256 -- Halls of Reflection
alterName[69] = 1151 -- Lost City of the Tol'vir
alterName[187] = 448 -- Dragon Soul
alterName[274] = 1017 -- Gundrak
alterName[252] = 180 -- Sethekk Halls
alterName[65] = 1150 -- Throne of the Tides
alterName[70] = 321 -- Halls of Origination
alterName[707] = 1044 -- Vault of the Wardens
--alterName[283] = 1297 -- The Violet Hold (This likely points to the hunter scenario within)
alterName[283] = 221 -- The Violet Hold -> Violet Hold
alterName[875] = 1527 -- Tomb of Sargeras
alterName[75] = 329 -- Baradin Hold
alterName[800] = 1319 -- Court of Stars
alterName[64] = 327 -- Shadowfang Keep
alterName[760] = 257 -- Onyxia's Lair
alterName[777] = 1209 -- Assault on Violet Hold
alterName[311] = 473 -- Scarlet Halls
alterName[755] = 238 -- The Obsidian Sanctum
alterName[726] = 1190 -- The Arcway
alterName[275] = 1018 -- Halls of Lightning
alterName[277] = 213 -- Halls of Stone
alterName[241] = 24 -- Zul'Farrak
alterName[762] = 1202 -- Darkheart Thicket
alterName[786] = 1353 -- The Nighthold
alterName[727] = 1192 -- Maw of Souls
alterName[362] = 634 -- Throne of Thunder
alterName[759] = 244 -- Ulduar
alterName[317] = 532 -- Mogu'shan Vaults
alterName[272] = 241 -- Azjol-Nerub
alterName[558] = 1007 -- Iron Docks
alterName[247] = 178 -- Auchenai Crypts
alterName[273] = 215 -- Drak'Tharon Keep
alterName[324] = 1465 -- Siege of Niuzao Temple
alterName[754] = 227 -- Naxxramas
alterName[753] = 240 -- Vault of Archavon
alterName[286] = 1020 -- Utgarde Pinnacle
alterName[280] = 252 -- The Forge of Souls
alterName[67] = 1148 -- The Stonecore
alterName[747] = 176 -- Magtheridon's Lair
alterName[258] = 192 -- The Mechanar
alterName[281] = 1019 -- The Nexus
alterName[369] = 766 -- Siege of Orgrimmar
alterName[184] = 1152 -- End Time
alterName[740] = 1205 -- Black Rook Hold
alterName[742] = 50 -- Blackwing Lair
alterName[457] = 900 -- Blackrock Foundry
alterName[313] = 1469 -- Temple of the Jade Serpent
alterName[556] = 1003 -- The Everbloom
alterName[248] = 188 -- Hellfire Ramparts
alterName[768] = 1350 -- The Emerald Nightmare
alterName[721] = 1473 -- Halls of Valor
alterName[231] = 14 -- Gnomeregan
alterName[900] = 1488 -- Cathedral of Eternal Night
alterName[257] = 191 -- The Botanica
alterName[302] = 1466 -- Stormstout Brewery
alterName[669] = 989 -- Hellfire Citadel
alterName[559] = 1004 -- Upper Blackrock Spire
alterName[741] = 48 -- Molten Core
alterName[78] = 362 -- Firelands
alterName[547] = 1008 -- Auchindoun
alterName[537] = 1009 -- Shadowmoon Burial Grounds
alterName[477] = 897 -- Highmaul
alterName[261] = 185 -- The Steamvault
alterName[746] = 177 -- Gruul's Lair
alterName[303] = 1464 -- Gate of the Setting Sun
alterName[66] = 323 -- Blackrock Caverns
alterName[249] = 1154 -- Magisters' Terrace
alterName[278] = 1153 -- Pit of Saron
alterName[73] = 314 -- Blackwing Descent
alterName[316] = 474 -- Scarlet Monastery
alterName[246] = 472 -- Scholomance
alterName[226] = 4 -- Ragefire Chasm
alterName[63] = 326 -- Deadmines
alterName[227] = 10 -- Blackfathom Deeps
alterName[285] = 242 -- Utgarde Keep
alterName[185] = 437 -- Well of Eternity
alterName[250] = 1013 -- Mana-Tombs
alterName[312] = 1468 -- Shado-Pan Monastery
alterName[748] = 194 -- Serpentshrine Cavern
alterName[320] = 834 -- Terrace of Endless Spring
alterName[284] = 249 -- Trial of the Champion
alterName[234] = 16 -- Razorfen Kraul
alterName[240] = 1 -- Wailing Caverns
alterName[68] = 1147 -- The Vortex Pinnacle
alterName[74] = 318 -- Throne of the Four Winds
alterName[767] = 1207 -- Neltharion's Lair
alterName[72] = 316 -- The Bastion of Twilight
alterName[239] = 22 -- Uldaman
alterName[282] = 1296 -- The Oculus
alterName[71] = 1149 -- Grim Batol
alterName[254] = 1011 -- The Arcatraz
-- This is a list of the ones that absolutely do not match in the english client
alterName[743] = 160 -- Ruins of Ahn'Qiraj -> Ahn'Qiraj Ruins
alterName[749] = 193 -- The Eye -> Tempest Keep
alterName[761] = 1502 -- The Ruby Sanctum -> Ruby Sanctum
alterName[744] = 161 -- Temple of Ahn'Qiraj -> Ahn'Qiraj Temple
for i,v in pairs(nodes) do
for j,u in pairs(v) do
self:UpdateInstanceNames(u)
end
end
for i,v in pairs(minimap) do
for j,u in pairs(v) do
if (not u.name) then -- Don't process if node was already handled above
self:UpdateInstanceNames(u)
end
end
end
end
-- Takes ids and fetchs and stores data to node.name
function Addon:UpdateInstanceNames(node)
local dungeonInfo = EJ_GetInstanceInfo
local id = node.id
if (node.lfgid) then
dungeonInfo = GetLFGDungeonInfo
id = node.lfgid
end
if (type(id) == "table") then
for i,v in pairs(node.id) do
local name = dungeonInfo(v)
self:UpdateAlter(v, name)
if (node.name) then
node.name = node.name .. "\n" .. name
else
node.name = name
end
end
elseif (id) then
node.name = dungeonInfo(id)
self:UpdateAlter(id, node.name)
end
end
-- The goal here is to have a table of IDs that correspond between the GetLFGDungeonInfo and EJ_GetInstanceInfo functions
-- I check if the names are different and if so then use both when checking for lockouts
-- This can probably be done better but I don't know how
-- I'm putting this in because on the english client, certain raids have a different lockout name than their journal counterpart e.g The Eye and Tempest Keep
-- If it's messed up in english then it's probably messed up elsewhere and I don't even know if this will help
function Addon:UpdateAlter(id, name)
if (alterName[id]) then
local alternativeName, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, alternativeName2 = GetLFGDungeonInfo(alterName[id])
--local alternativeName = GetLFGDungeonInfo(alterName[id])
if (alternativeName2 and alternativeName == name) then
alternativeName = alternativeName2
end
if (alternativeName) then
if (alternativeName == name) then
--print("EJ and LFG names both match, removing", name, "from table")
--alterName[id] = nil
else
alterName[id] = nil
alterName[name] = alternativeName
--print("Changing",id,"to",name,"and setting alter value to",alternativeName)
end
end
end
end
function Addon:ProcessExtraInfo() -- Could use this to add required levels and things, may do later or not
table.wipe(extraInfo)
if (true) then return end
--[[ for i=1,2000 do -- Do this less stupidly
local name, typeID, subtypeID, minLevel, maxLevel, recLevel, minRecLevel, maxRecLevel, expansionLevel, groupID, textureFilename, difficulty, maxPlayers, description, isHoliday, bonusRepAmount, minPlayers, isTimeWalker, name2, minGearLevel = GetLFGDungeonInfo(i)
end]]
end
function Addon:FullUpdate()
self:PopulateTable()
self:PopulateMinimap()
self:ProcessTable()
--self:ProcessExtraInfo()
end
-- Looks through the legions maps and checks if the default blizzard thingies are visible.
function Addon:CheckForPOIs()
if (not db.checkForPOI) then return end -- The Pin enumeration seems to cause taint so disabled by default fo rnow
if (WorldMapFrame:IsVisible()) then return end -- This function will interrupt the user if map is open while we do stuff
local needsUpdate = false
local LegionBfaInstanceMapIDs = { 627, 630, 634, 641, 646, 650, 680, 862, 863, 864, 895, 896, 942, 1169 }
for k,v in pairs(LegionBfaInstanceMapIDs) do
WorldMapFrame:SetMapID(v)
for pin in WorldMapFrame:EnumeratePinsByTemplate("DungeonEntrancePinTemplate") do
local instanceId = pin.journalInstanceID
if not legionInstancesDiscovered[instanceId] then
--print(pin.name, 'Discovered')
legionInstancesDiscovered[instanceId] = true
needsUpdate = true
end
end
end
if (needsUpdate) then self:FullUpdate() end
end
|
--[[
*****************************************************************************
Project l2dbus
Released under the MIT License (MIT)
Copyright (c) 2013 XS-Embedded LLC
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.
*****************************************************************************
*****************************************************************************
@file init.lua
@author Glenn Schmottlach
@brief The core (low-level) l2dbus module.
*****************************************************************************
--]]
local l2dbus = require("l2dbus_core")
-- Called when this module is run as a program
local function main(arg)
print("Module: " .. string.match(arg[0], "^(.+)%.lua"))
local info = l2dbus.getVersion()
print("L2DBUS Version: " .. info.l2dbusVerStr)
print("CDBUS Version: " .. info.cdbusVerStr)
print(string.format("D-Bus Version: %d.%d.%d",
info.dbusMajor, info.dbusMinor, info.dbusRelease))
print("Author: " .. info.author)
print(info.copyright)
end
l2dbus.isMain = function()
return debug.getinfo(4) == nil
end
-- Determine the context in which the module is used
if l2dbus.isMain() then
-- The module is being run as a program
main(arg)
else
-- The module is being loaded rather than run
return l2dbus
end
|
-- ===========================================================================
-- Base File
-- ===========================================================================
include("DiplomacyRibbon_Expansion1.lua");
include("diplomacyribbon_CQUI.lua"); |
--[[
KahLua Kore - party and raid monitoring.
WWW: http://kahluamod.com/kore
Git: https://github.com/kahluamods/kore
IRC: #KahLua on irc.freenode.net
E-mail: me@cruciformer.com
Please refer to the file LICENSE.txt for the Apache License, Version 2.0.
Copyright 2008-2021 James Kean Johnston. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]
local KKOREPARTY_MAJOR = "KKoreParty"
local KKOREPARTY_MINOR = 4
local KRP, oldminor = LibStub:NewLibrary(KKOREPARTY_MAJOR, KKOREPARTY_MINOR)
if (not KRP) then
return
end
local assert = assert
local GetNumRaidMembers = GetNumGroupMembers or GetNumRaidMembers
local GetNumPartyMembers = GetNumSubgroupMembers or GetNumPartyMembers
KRP.debug_id = KKOREPARTY_MAJOR
local K, KM = LibStub:GetLibrary("KKore")
assert(K, "KKoreParty requires KKore")
assert(tonumber(KM) >= 4, "KKoreParty requires KKore r4 or later")
K:RegisterExtension(KRP, KKOREPARTY_MAJOR, KKOREPARTY_MINOR)
local printf = K.printf
local tinsert = table.insert
local function debug(lvl,...)
K.debug("kore", lvl, ...)
end
KRP.initialised = false
--
-- Whenever a user is in a raid they are automatically in a party too, which
-- is their raid group. It may be useful to know who the current group members
-- are so we will maintain both lists.
--
-- KRP.in_party therefore doubles as what we used to call KRP.in_either
-- because it is also set when a user in in a raid. Thus KRP.in_party is
-- true when a user is in a party, raid or BG, if they are in a raid, and
-- in_bg if they are in a battleground.
--
-- Is the player in a party
KRP.in_party = false
-- Is the player in a raid
KRP.in_raid = false
-- Is the player in a battleground
KRP.in_bg = false
-- The number of players in the party or raid (including ourselves)
KRP.num_party = 0
KRP.num_raid = 0
-- The raid sub-group the player is in, or 0 if not in a raid.
KRP.subgroup = 0
-- The raid ID for the player. This is the X in unit name "raidX". 0 if not
-- in a raid.
KRP.raidid = 0
-- Is the player both in a party and the party leader
KRP.is_pl = false
-- Is the player both in a raid and the raid leader
KRP.is_rl = false
-- Is the player both in a raid and the raid leader OR an assistant
KRP.is_aorl = false
-- Is the player both in a party / raid and the master looter
KRP.is_ml = false
-- Which party member (0 for player) is the master looter, or nil if none.
KRP.party_mlid = nil
-- Which raid member is the master looter, or nil if none.
KRP.raid_mlid = nil
-- Full name of the current master looter or nil if none.
KRP.master_looter = nil
-- Full name of the current party or raid leader or nil if none.
KRP.leader = nil
-- The list of players in the party or raid, or nil if not in one.
-- Each element in the table is indexed by the full player name, and is itself
-- a table with the following members:
-- .name - same as the index - the full player name
-- .level - the player level
-- .class - the player's class (K.ClassIndex)
-- .faction - players faction
-- .is_guilded - true if the player is in our guild
-- .guildrankidx - guild rank index if in our guild
-- .is_gm - true if the player is our guild GM
-- .unitid - the unit ID (party3, raid17, player etc)
-- .subgroup - the raid subgroup or 0 if we're in a party not a raid
-- .raidid - the X in raidX if we are in a raid
-- .partyid - the X in partyX, 0 for ourselves
-- .is_pl - true if player is the party leader, false otherwise
-- .is_rl - true if the player is the raid leader, false otherwise
-- .is_aorl - true if player is raid leader OR assist, false otherwise
-- .is_ml - true if the player is the master looter
-- .group_role - GROUP_ROLE_NONE for party members, or NONE, TANK or ASSIST
-- .online - true if the player is online otherwise false
-- .dead - true if the player is dead false otherwise
-- .afk - true if teh player is AFK false otherwise
-- .guid - unit GUID
-- .maxhp - player's max HP
-- .powertype - player's power type (MANA, RAGE, ENERGY etc)
-- .maxpower - players maximum power
-- .cantrade - true if they are within trading distance otherwise false
-- .inrange - true if unit is in range
KRP.players = nil
-- The list of player names in the players party. Includes us.
KRP.party = nil
-- The list of players in the raid or nil if not in a raid.
KRP.raid = nil
-- The list of players in the various raid groups or nil if not in a raid.
-- This is an array of 8 tables when it is non-nil.
KRP.raidgroups = nil
KRP.LOOT_METHOD_UNKNOWN = 0
KRP.LOOT_METHOD_FREEFORALL = 1
KRP.LOOT_METHOD_ROUNDROBIN = 2
KRP.LOOT_METHOD_MASTER = 3
KRP.LOOT_METHOD_GROUP = 4
KRP.LOOT_METHOD_NEEDB4GREED = 5
KRP.LOOT_METHOD_PERSONAL = 6
local LOOT_METHOD_UNKNOWN = KRP.LOOT_METHOD_UNKNWON
local LOOT_METHOD_FREEFORALL = KRP.LOOT_METHOD_FREEFORALL
local LOOT_METHOD_ROUNDROBIN = KRP.LOOT_METHOD_ROUNDROBIN
local LOOT_METHOD_MASTER = KRP.LOOT_METHOD_MASTER
local LOOT_METHOD_GROUP = KRP.LOOT_METHOD_GROUP
local LOOT_METHOD_NEEDB4GREED = KRP.LOOT_METHOD_NEEDB4GREED
local LOOT_METHOD_PERSONAL = KRP.LOOT_METHOD_PERSONAL
local method_to_number = {
["unknown"] = LOOT_METHOD_UNKNOWN,
["freeforall"] = LOOT_METHOD_FREEFORALL,
["roundrobin"] = LOOT_METHOD_ROUNDROBIN,
["master"] = LOOT_METHOD_MASTER,
["group"] = LOOT_METHOD_GROUP,
["needbeforegreed"] = LOOT_METHOD_NEEDB4GREED,
["personalloot"] = LOOT_METHOD_PERSONAL,
}
-- Party or raid loot method
KRP.loot_method = LOOT_METHOD_UNKNOWN
-- Loot threshold
KRP.loot_threshold = 0
KRP.GROUP_ROLE_NONE = 0
KRP.GROUP_ROLE_TANK = 1
KRP.GROUP_ROLE_ASSIST = 2
local GROUP_ROLE_NONE = KRP.GROUP_ROLE_NONE
local GROUP_ROLE_TANK = KRP.GROUP_ROLE_TANK
local GROUP_ROLE_ASSIST = KRP.GROUP_ROLE_ASSIST
local group_role_to_number = {
["NONE"] = GROUP_ROLE_NONE,
["MAINTANK"] = GROUP_ROLE_TANK,
["MAINASSIST"] = GROUP_ROLE_ASSIST,
}
KRP.RC_NOCHECK = 0
KRP.RC_READY = 1
KRP.RC_NOTREADY = 2
KRP.RC_WAITING = 3
KRP.RC_AWAY = 4
local RC_NOCHECK = KRP.RC_NOCHECK
local RC_READY = KRP.RC_READY
local RC_NOTREADY = KRP.RC_NOTREADY
local RC_WAITING = KRP.RC_WAITING
local RC_AWAY = KRP.RC_AWAY
local rc_to_number = {
["none"] = RC_NOCHECK,
["ready"] = RC_READY,
["notready"] = RC_NOTREADY,
["waiting"] = RC_WAITING,
["away"] = RC_AWAY,
}
KRP.ready_checking = false
-------------------------------------------------------------------------------
KRP.addons = {}
KRP.valid_callbacks = {
["new_player"] = true,
["update_group_start"] = true,
["update_group_end"] = true,
["in_group_changed"] = true,
["loot_method"] = true,
["leader_changed"] = true,
["role_changed"] = true,
["in_party_changed"] = true,
["in_raid_changed"] = true,
["in_bg_changed"] = true,
["readycheck_start"] = true,
["readycheck_reply"] = true,
["readycheck_end"] = true,
}
--
-- Reset ready check related variables
--
local function reset_ready()
KRP.ready_checking = false
KRP.ready = nil
KRP.ready_timeout = nil
KRP.ready_start = nil
end
--
-- Utility function to reset loot method related variables.
--
local function reset_loot_method()
KRP.is_ml = false
KRP.master_looter = nil
KRP.party_mlid = nil
KRP.raid_mlid = nil
KRP.loot_method = LOOT_METHOD_UNKNOWN
KRP.loot_threshold = 0
end
--
-- Utility function to reset leader related variables.
--
local function reset_group_leader()
KRP.is_pl = false
KRP.is_rl = false
KRP.is_aorl = false
KRP.leader = nil
end
--
-- Utility function to reset role related variables.
--
local function reset_role()
KRP.group_role = GROUP_ROLE_NONE
end
--
-- Utility function to reset group related variables.
--
local function reset_group()
reset_group_leader()
reset_loot_method()
reset_role()
reset_ready()
KRP.in_party = false
KRP.in_raid = false
KRP.in_bg = false
KRP.num_party = 0
KRP.num_raid = 0
KRP.subgroup = 0
KRP.raidid = 0
KRP.raid = nil
KRP.party = nil
KRP.players = nil
KRP.raidgroups = nil
end
local function update_loot_method_internal()
reset_loot_method()
if ((not KRP.in_party) or KRP.in_bg) then
return
end
local lm, pmlid, rmlid = GetLootMethod()
local mlname = nil
KRP.party_mlid = pmlid
KRP.raid_mlid = rmlid
KRP.loot_method = method_to_number[lm or "unknown"] or LOOT_METHOD_UNKNOWN
if (KRP.loot_method == LOOT_METHOD_MASTER) then
if (pmlid ~= nil) then
if (pmlid == 0) then
mlname = K.player.name
else
mlname = K.FullUnitName("party" .. pmlid)
end
end
if (rmlid ~= nil) then
mlname = K.FullUnitName("raid" .. rmlid)
end
if (mlname and KRP.players) then
for k, v in pairs(KRP.players) do
if (v.is_ml) then
if (k ~= mlname) then
v.is_ml = false
end
end
if (k == mlname) then
v.is_ml = true
end
end
end
end
if (mlname and mlname == K.player.name) then
KRP.is_ml = true
else
KRP.is_ml = false
end
KRP.master_looter = mlname
KRP.loot_threshold = GetLootThreshold()
end
--
-- Function: KRP.UpdateLootMethod()
-- Purpose : Updates the various loot method related settings, namely:
-- loot_method, party_mlid, raid_mlid, master_looter, is_ml
-- Fires : LOOT_METHOD_UPDATED(new_method_id)
--
function KRP.UpdateLootMethod(evtonly)
if (not KRP.initialised) then
return false
end
if (not evtonly) then
update_loot_method_internal()
end
KRP:DoCallbacks("loot_method", KRP.loot_method)
end
local function update_leader_internal()
local old_leader = KRP.leader
local prn
reset_group_leader()
if (not KRP.in_party and not KRP.in_bg) then
return
end
if (UnitIsGroupAssistant("player")) then
KRP.is_aorl = true
end
if (UnitIsGroupLeader("player")) then
if (KRP.in_party) then
KRP.is_pl = true
end
if (KRP.in_raid) then
KRP.is_pl = false
KRP.is_rl = true
KRP.is_aorl = true
end
if (KRP.is_pl or KRP.is_rl) then
KRP.leader = K.player.name
end
else
if (KRP.in_party and not KRP.in_raid and not KRP.in_bg) then
local npm = GetNumPartyMembers()
for i = 1, npm do
prn = "party" .. i
if (UnitExists(prn)) then
if (UnitIsGroupLeader(prn)) then
KRP.leader = K.FullUnitName(prn)
end
end
end
end
if (KRP.in_raid) then
local num_raiders = KRP.num_raid
for i = 1, num_raiders do
prn = "raid" .. i
if (UnitExists(prn)) then
if (UnitIsGroupLeader(prn)) then
KRP.leader = K.FullUnitName(prn)
end
end
end
end
end
if (KRP.players) then
if (old_leader and KRP.players[old_leader]) then
KRP.players[old_leader].is_rl = false
KRP.players[old_leader].is_pl = false
KRP.players[old_leader].is_aorl = false
if (KRP.in_raid) then
prn = "raid" .. KRP.players[old_leader].raidid
if (UnitIsGroupAssistant(prn)) then
KRP.players[old_leader].is_aorl = true
end
end
end
prn = KRP.leader
if (KRP.players[prn]) then
KRP.players[prn].is_pl = true
KRP.players[prn].is_rl = false
KRP.players[prn].is_aorl = false
if (KRP.in_raid) then
KRP.players[prn].is_pl = false
KRP.players[prn].is_rl = true
KRP.players[prn].is_aorl = true
end
end
end
end
--
-- Function: KRP.UpdateLeader()
-- Purpose : Updates the various group leader related settings, namely:
-- is_pl, is_rl, is_aorl, leader.
-- Fires : LEADER_CHANGED()
--
function KRP.UpdateLeader(evtonly)
if (not KRP.initialised) then
return false
end
local old_leader = KRP.leader
if (not evtonly) then
update_leader_internal()
end
if (old_leader ~= KRP.leader) then
KRP:DoCallbacks("leader_changed")
end
end
local function update_role_internal()
reset_role()
if (not KRP.in_party and not KRP.in_bg) then
return
end
if (GetPartyAssignment("MAINTANK", "player")) then
KRP.group_role = GROUP_ROLE_TANK
elseif (GetPartyAssignment("MAINASSIST", "player")) then
KRP.group_role = GROUP_ROLE_ASSIST
else
KRP.group_role = GROUP_ROLE_NONE
end
if (KRP.players and KRP.players[K.player.name]) then
KRP.players[K.player.name].group_role = KRP.group_role
end
end
--
-- Function: KRP.UpdateRole()
-- Purpose : Updates the group role variable: group_role.
-- Fires : ROLE_CHANGED(role)
--
function KRP.UpdateRole(evtonly)
if (not KRP.initialised) then
return false
end
local old_role = KRP.group_role
if (not evtonly) then
update_role_internal()
end
if (KRP.group_role ~= old_role) then
KRP:DoCallbacks("role_changed")
end
end
local krp_flag_events = false
--
-- This function updates various unit flags. Some small amount of code from
-- UpdateLeader() is duplicated here. This function is called from two places
-- with very different data access requirements, hence the long argument list.
-- First, it is called from the populate_unit() closure, during which time none
-- of the group variables are valid yet. Secondly it is called from an event
-- handler for UNIT_FLAGS, when the group variables ARE in place.
--
local function update_unit_flags(unm, pt, in_party, in_raid, players)
local urn
local inparty = in_party or KRP.in_party
local inraid = in_raid or KRP.in_raid
local plist = players or KRP.players
if (pt) then
urn = pt.name
else
urn = K.FullUnitName(unm)
end
if (not urn or urn == "" or urn == "Unknown") then
return
end
if (not pt) then
if (not plist or not plist[urn]) then
return
end
end
local ptbl = pt or plist[urn]
if (not ptbl) then
return
end
if (UnitExists(unm)) then
if (UnitIsConnected(unm)) then
ptbl.online = true
else
ptbl.online = false
end
if (UnitIsDeadOrGhost(unm)) then
ptbl.dead = true
else
ptbl.dead = false
end
if (UnitIsAFK(unm)) then
ptbl.afk = true
else
ptbl.afk = false
end
ptbl.guid = UnitGUID(unm)
ptbl.maxhp = UnitHealthMax(unm) or 0
local _, powertype = UnitPowerType(unm)
ptbl.powertype = powertype or "MANA" -- Fall back to mana as a default
ptbl.maxpower = UnitPowerMax(unm) or 0
ptbl.cantrade = CheckInteractDistance(unm, 2) or false
local irange, rced = UnitInRange(unm)
if (rced and not irange) then
ptbl.inrange = false
else
ptbl.inrange = true
end
ptbl.is_aorl = false
ptbl.is_pl = false
ptbl.is_rl = false
if (UnitIsGroupLeader(unm)) then
if (inparty) then
ptbl.is_pl = true
end
if (inraid) then
ptbl.is_pl = false
ptbl.is_rl = true
ptbl.is_aorl = true
if (UnitIsGroupAssistant(unm)) then
ptbl.is_aorl = true
end
end
end
end
end
local function update_group_internal(fire_party, fire_raid, fire_bg)
if (not KRP.initialised) then
return false
end
local old_inparty = KRP.in_party
local old_inraid = KRP.in_raid
local old_inbg = KRP.in_bg
local in_party, in_raid, in_bg = false, false, false
local changed = false
local players, party, raid, raidgroups
local nrm = GetNumRaidMembers()
local npm = GetNumPartyMembers()
local _, itype = IsInInstance()
local prn
if (not K.local_realm or K.local_realm == "") then
return false
end
KRP:DoCallbacks("update_group_start", old_inparty, old_inraid, old_inbg)
if (IsInGroup()) then
in_party = true
end
if (IsInRaid()) then
in_raid = true
in_party = true
end
if ((itype == "pvp") or (itype == "arena") or UnitInBattleground("player")) then
in_bg = true
end
if (not in_bg and not in_party) then
if (krp_flag_events) then
KRP:UnregisterEvent("PLAYER_FLAGS_CHANGED")
krp_flag_events = false
end
reset_group()
KRP:DoCallbacks("in_group_changed", in_party, in_raid, in_bg)
KRP:DoCallbacks("update_group_end", in_party, in_raid, in_bg)
return true
end
players = {}
--
-- When we are in either a party or a raid, we build up a list of players
-- that are in that party or raid. We retrieve certain useful values for
-- those players such as their class, level and a bunch of other things.
-- We also give all registered addons a chance to add extra information
-- to each player entry via the "new_player" callback. The callback is
-- passed the player table we are adding and if it needs to add any members
-- to the table the member names should begin with an addon-specific prefix.
-- For example, KSK may add a variable "ksk_userid" to the player.
--
-- After all this had been done the players table will contain the full list
-- of players in the party or raid. Other tables such as the party or raid
-- table will simply contain player references into this players table
-- indexed by the player full name (Name-realm).
--
-- Also note that our own name always appears in the players list if we
-- are in either a raid or party.
--
-- To a large degree this table can simply be thought of as a cache for
-- the info returned by GetRaidRosterInfo() or an amalgmation of other
-- calls getting the same info if we are just in a party.
--
local player = {}
local function populate_unit(ptbl, unm)
ptbl.name = K.FullUnitName(unm)
if (not ptbl.name or ptbl.name == "Unknown" or ptbl.name == "") then
ptbl.name = nil
return
end
ptbl.level = UnitLevel(unm)
ptbl.class = K.ClassIndex[select(2, UnitClass(unm))]
ptbl.faction = UnitFactionGroup(unm)
if (K.player.is_guilded and UnitIsInMyGuild(unm)) then
ptbl.is_guilded = true
local kgi = K.guild.roster.name[ptbl.name]
if (kgi) then
local kri = K.guild.roster.id[kgi]
ptbl.guildrankidx = kri.rank
if (ptbl.guildrankidx == 1) then
ptbl.is_gm = true
else
ptbl.is_gm = false
end
else
ptbl.guildrankidx = 0
ptbl.is_gm = false
end
else
ptbl.is_guilded = false
ptbl.guildrankidx = 0
ptbl.is_gm = false
end
end
-- Always add ourselves to the players list
populate_unit(player, "player")
if (not player.name) then
return false
end
player.unitid = "player"
player.is_ml = KRP.is_ml
player.subgroup = 0
player.raidid = 0
player.partyid = 0
player.group_role = GROUP_ROLE_NONE
players[player.name] = player
update_unit_flags("player", player, in_party, in_raid, players)
players[player.name] = player
KRP:DoCallbacks("new_player", players[player.name])
if (in_party) then
party = {}
party[0] = player.name
for i = 1, npm do
prn = "party" .. i
if (UnitExists(prn)) then
player = {}
player.partyid = i
player.unitid = prn
player.is_ml = false
-- If we're in raid then dont do this check else each raid party
-- will erroneous get this party member number marked as master looter.
if (not in_raid) then
if (KRP.party_mlid and KRP.party_mlid == i) then
player.is_ml = true
end
end
player.subgroup = 0
player.raidid = 0
player.group_role = GROUP_ROLE_NONE
populate_unit(player, prn)
if (player.name) then
players[player.name] = player
update_unit_flags(prn, player, in_party, in_raid, players)
players[player.name] = player
KRP:DoCallbacks("new_player", players[player.name])
party[i] = player.name
else
return false
end
end
end
end
--
-- It is possible, even probable that we may end up calculating player info
-- for a player that was already processed during party processing above.
-- That's OK but addons need to be aware of this and never use any form of
-- index other than the name into tables.
--
if (in_raid) then
raid = {}
raidgroups = {}
for i = 1, NUM_RAID_GROUPS do
raidgroups[i] = {}
end
for i = 1, nrm do
prn = "raid" .. i
if (UnitExists(prn)) then
local nm, rank, subgrp, _, _, _, _, _, _, role, ml = GetRaidRosterInfo(i)
if (nm) then
player = {}
player.unitid = prn
player.subgroup = subgrp
player.raidid = i
player.group_role = group_role_to_number[role or "NONE"] or GROUP_ROLE_NONE
populate_unit(player, prn)
if (player.name) then
players[player.name] = player
update_unit_flags(prn, player, in_party, in_raid, players)
-- Overwrite is_rl and is_aorl computed during update_unit_flags().
if (rank == 2) then
player.is_rl = true
else
player.is_rl = false
end
if (rank > 0) then
player.is_aorl = true
else
player.is_aorl = false
end
if (ml) then
player.is_ml = true
else
player.is_ml = false
end
players[player.name] = player
KRP:DoCallbacks("new_player", players[player.name])
raid[i] = player.name
tinsert(raidgroups[subgrp], player.name)
else
return false
end
end
end
end
end
-- Update all of the table members, setting the in_party or in_raid stuff
-- last so that the party and raid tables can be in place before we change
-- those settings.
reset_group()
KRP.players = players
KRP.party = party
KRP.raid = raid
KRP.raidgroups = raidgroups
KRP.num_raid = nrm
KRP.num_party = npm
KRP.in_party = in_party
KRP.in_raid = in_raid
KRP.in_bg = in_bg
player = players[K.player.name]
KRP.subgroup = player.subgroup
KRP.raidid = player.raidid
update_loot_method_internal()
update_leader_internal()
update_role_internal()
-- Send out all of the change events
if (fire_party or old_inparty ~= KRP.in_party) then
KRP:DoCallbacks("in_party_changed", in_party)
changed = true
end
if (fire_raid or old_inraid ~= KRP.in_raid) then
KRP:DoCallbacks("in_raid_changed", in_raid)
changed = true
end
if (fire_bg or old_inbg ~= KRP.in_bg) then
KRP:DoCallbacks("in_bg_changed", in_bg)
changed = true
end
if (changed) then
KRP:DoCallbacks("in_group_changed", in_party, in_raid, in_bg)
end
--
-- We need to register for certain events if we haven't already.
--
if (not krp_flag_events) then
KRP:RegisterEvent("PLAYER_FLAGS_CHANGED", function(evt, unitid)
update_unit_flags(unitid, nil, nil, nil, nil)
end)
krp_flag_events = true
end
KRP:DoCallbacks("update_group_end", in_party, in_raid, in_bg)
return true
end
--
-- Function: KRP.UpdateGroup(fire_party, fire_raid, fire_bg)
-- fire_XXX - fire the specified change event even if the state
-- hasn't changed. This is most commonly done when you want to
-- refresh the raid data and have all of the various callbacks
-- run after information that the callbacks may use has changed.
-- Purpose : Updates the various group related settings, namely:
-- in_party, in_raid, in_bg, subgroup, num_party, num_raid,
-- raid, party, players
-- Fires : IN_RAID_CHANGED(is_in_raid)
-- IN_PARTY_CHANGED(is_in_party)
-- IN_BATTLEGROUND_CHANGED(is_in_bg)
-- Callback in_group_changed(in_party, in_raid, in_bg)
--
function KRP.UpdateGroup(fire_party, fire_raid, fire_bg)
if (fire_party == nil) then
fire_party = true
end
if (fire_raid == nil) then
fire_raid = true
end
if (fire_bg == nil) then
fire_bg = true
end
if (not KRP.initialised) then
return false
end
if (not update_group_internal(fire_party, fire_raid, fire_bg)) then
K:ScheduleTimer(function()
update_group_internal(fire_party, fire_raid, fire_bg)
end, 1.0)
return false
end
return true
end
-- Function to deal with the start of a readycheck. This will mark all users
-- in the raid as unknown, except for the person who initiated the readycheck.
local function ready_check_start(evt, started_by, timeout, ...)
if (not KRP.initialised) then
return
end
local nm = K.FullUnitName(started_by)
if (not nm or not KRP.in_party or not KRP.players or not KRP.players[nm]) then
reset_ready()
return
end
KRP.ready_start = time()
KRP.ready_timeout = tonumber(timeout)
KRP.ready_checking = true
KRP.ready = {}
for k, v in pairs(KRP.players) do
KRP.ready[k] = RC_WAITING
end
KRP.ready[nm] = RC_READY
KRP:DoCallbacks("readycheck_start")
end
-- Function to deal with a reply to a ready check
local function ready_check_confirm(evt, unit, status, ...)
if (not KRP.initialised or not KRP.ready_checking or not KRP.ready) then
return
end
local nm = K.FullUnitName(unit)
if (not nm or nm == "" or not KRP.ready or not KRP.ready[nm]) then
return
end
if (status) then
KRP.ready[nm] = RC_READY
else
KRP.ready[nm] = RC_NOTREADY
end
KRP:DoCallbacks("readycheck_reply", nm, KRP.ready[nm])
end
-- And finally a function to deal with the end of a ready check
local function ready_check_ended(evt, ...)
if (not KRP.initialised or not KRP.ready_checking or not KRP.ready) then
return
end
KRP.ready_checking = false
KRP.ready_timeout = nil
KRP.ready_start = nil
for k, v in pairs(KRP.ready) do
if (v == RC_WAITING) then
KRP.ready[k] = RC_AWAY
end
end
KRP:DoCallbacks("readycheck_end")
end
local function krp_refresh(fire_party, fire_raid, fire_bg)
if (not KRP.initialised) then
return
end
if (KRP.UpdateGroup(fire_party, fire_raid, fire_bg)) then
KRP.UpdateLootMethod(true)
KRP.UpdateLeader(true)
KRP.UpdateRole(true)
end
end
function KRP:OnLateInit()
if (KRP.initialised) then
return
end
K:RegisterEvent("PARTY_LOOT_METHOD_CHANGED", function(evt)
KRP.UpdateLootMethod(false)
end)
K:RegisterEvent("PARTY_LEADER_CHANGED", function(evt)
KRP.UpdateLeader(false)
end)
K:RegisterEvent("PLAYER_ROLES_ASSIGNED", function(evt)
KRP.UpdateRole(false)
end)
K:RegisterEvent("GROUP_ROSTER_UPDATE", function(evt)
KRP.UpdateGroup(false, false, false)
end)
K:RegisterEvent("RAID_ROSTER_UPDATE", function(evt)
KRP.UpdateGroup(false, false, false)
end)
K:RegisterEvent("READY_CHECK", ready_check_start)
K:RegisterEvent("READY_CHECK_CONFIRM", ready_check_confirm)
K:RegisterEvent("READY_CHECK_FINISHED", ready_check_ended)
KRP.initialised = true
krp_refresh()
end
K:RegisterMessage("PLAYER_INFO_UPDATED", function(evt, ...)
krp_refresh(true, true, true)
end)
--
-- When an addon is suspended or resumed, we need to do a refresh because
-- the addon may have callbacks that have either been populated and now
-- need to be removed (addon suspended) or needs to add new data via the
-- callbacks (addon resumed). So we trap these two events and use them to
-- schedule a refresh.
--
function KRP:OnActivateAddon(name, onoff)
krp_refresh(true, true, true)
end
--
-- Utility functions that more than one mod will likely need.
--
function KRP.ClassString(str, class)
local sn
if (type(str) == "table") then
sn = str.name
class = str.class
else
sn = str
end
if (KRP.in_party and KRP.players) then
local pinfo = KRP.players[sn]
if (pinfo) then
return K.ClassColorsEsc[class] .. sn .. "|r"
else
return "|cff808080" .. sn .. "|r"
end
end
return K.ClassColorsEsc[class] .. sn .. "|r"
end
function KRP.ShortClassString(str, class)
local sn
if (type(str) == "table") then
sn = str.name
class = str.class
else
sn = str
end
if (KRP.in_party and KRP.players) then
local pinfo = KRP.players[sn]
sn = Ambiguate(sn, "guild")
if (pinfo) then
return K.ClassColorsEsc[class] .. sn .. "|r"
else
return "|cff808080" .. sn .. "|r"
end
end
sn = Ambiguate(sn, "guild")
return K.ClassColorsEsc[class] .. sn .. "|r"
end
function KRP.AlwaysClassString(str, class)
local sn, class = str, class
if (type(str) == "table") then
sn = str.name
class = str.class
end
return K.ClassColorsEsc[class] .. sn .. "|r"
end
function KRP.ShortAlwaysClassString(str, class)
local sn, class = str, class
if (type(str) == "table") then
sn = str.name
class = str.class
end
sn = Ambiguate(sn, "guild")
return K.ClassColorsEsc[class] .. sn .. "|r"
end
|
local is_car =
Concord.component(
function(_)
end
)
return is_car
|
#!/usr/bin/env lua
local state = require("utils.luastate")
local pretty = require("pl.pretty")
local l2dbus = require("l2dbus")
local function onTimeout(tm, disp)
print("Exiting mainloop...")
disp:stop()
end
local function onFilterMatch(match, msg, ud)
local msgType = msg:getType()
io.stdout:write(l2dbus.Message.msgTypeToString(msgType) .. " sender=" ..
tostring(msg:getSender()) .. " -> dest=" ..
tostring(msg:getDestination()) .. " serial=" ..
tostring(msg:getSerial()))
if (l2dbus.Message.METHOD_CALL == msgType) or
(l2dbus.Message.SIGNAL == msgType) then
io.stdout:write(" path=" .. tostring(msg:getObjectPath()) ..
" interface=" .. tostring(msg:getInterface()) ..
" member=" .. tostring(msg:getMember()))
elseif l2dbus.Message.ERROR == msgType then
io.stdout:write(" name=" .. tostring(msg:getErrorName()))
end
local result = msg:getArgsAsArray()
print()
for i=1,#result do
if type(result[i]) == "table" then
io.stdout:write("table: " .. pretty.write(result[i], " ") .. "\n")
else
print(" " .. type(result[i]) .. ": " .. tostring(result[i]))
end
end
end
local function main()
l2dbus.Trace.setFlags(l2dbus.Trace.ERROR, l2dbus.Trace.WARN)
--l2dbus.Trace.setFlags(l2dbus.Trace.ALL)
local mainLoop
if (arg[1] == "--glib") or (arg[1] == "-g") then
mainLoop = require("l2dbus_glib").MainLoop.new()
else
local ev = require("ev")
local evLoop = ev.Loop.default
evLoop:now()
mainLoop = require("l2dbus_ev").MainLoop.new(evLoop)
end
local disp = l2dbus.Dispatcher.new(mainLoop)
assert( nil ~= disp )
local conn = l2dbus.Connection.openStandard(disp, l2dbus.Dbus.BUS_SESSION)
assert( nil ~= conn )
local callFilter = {msgType=l2dbus.Dbus.MESSAGE_TYPE_METHOD_CALL, eavesdrop=true}
local returnFilter = {msgType=l2dbus.Dbus.MESSAGE_TYPE_METHOD_RETURN, eavesdrop=true}
local signalFilter = {msgType=l2dbus.Dbus.MESSAGE_TYPE_SIGNAL, eavesdrop=true}
local errorFilter = {msgType=l2dbus.Dbus.MESSAGE_TYPE_ERROR, eavesdrop=true}
local hnd = {}
hnd[1] = conn:registerMatch(callFilter, onFilterMatch, "onMethodCall")
hnd[2] = conn:registerMatch(returnFilter, onFilterMatch, "onMethodReturn")
hnd[3] = conn:registerMatch(errorFilter, onFilterMatch, "onError")
hnd[4] = conn:registerMatch(signalFilter, onFilterMatch, "onSignal")
local timeout = l2dbus.Timeout.new(disp, 10000, false, onTimeout, disp)
timeout:setEnable(true)
print("Starting main loop")
disp:run(l2dbus.Dispatcher.DISPATCH_WAIT)
-- Free all resources
for i = 1,#hnd do
conn:unregisterMatch(hnd[i])
hnd[i] = nil
end
conn = nil
disp = nil
end
print("Hit Return to continue")
io.stdin:read("*l")
print("Starting program")
main()
l2dbus.shutdown()
collectgarbage("collect")
print("Dump after nil'ing out everything")
state.dump_stats(io.stdout)
|
return {'injagen','injecteren','injectie','injectiegeweer','injectiehars','injectiemotor','injectienaald','injectiespuit','injector','injectieplaats','injectieflacon','injectiepomp','injectiesysteem','injectievloeistof','injectiemateriaal','injaag','injaagde','injaagden','injaagt','injecteer','injecteerde','injecteerden','injecteert','injectiebouten','injecties','injectiespuiten','injectoren','injectors','injecterend','injectiemotoren','injectienaalden','injoeg','injectiemotors','injectieplaatsen','injectiesystemen','injectiespuitje','injectieflacons','injectievloeistoffen'} |
-- ======= Copyright (c) 2003-2016, Unknown Worlds Entertainment, Inc. All rights reserved. =====
--
-- lua\menu\GUIMainMenu_BadgesSelection.lua
--
-- Created by: Sebastian Schuck (sebastian@naturalselection2.com)
--
-- ========= For more information, visit us at http://www.unknownworlds.com =====================
class 'GUIBadgesSelection' (Window)
local function GetBadges()
local badgerow = {} --array of selected badges
local badges = {} --lookup table for selected badges
for i = 1, 10 do
local sSavedBadge = Client.GetOptionString( string.format("Badge%s", i), "" )
if sSavedBadge and sSavedBadge ~= "" then
local badgeid = rawget(gBadges, sSavedBadge) or gBadges.none
--check if we own the badge
local ownedBadges = Badges_GetOwnedBadges()
badgeid = badgeid > gBadges.none and ownedBadges[badgeid] and badgeid or gBadges.none
badgerow[i] = badgeid
badges[badgeid] = true
end
end
return badgerow, badges
end
function GUIBadgesSelection:ReloadBadgeOrder()
local i = 1
for _, badge in ipairs(self.activeBadges) do
if badge:GetIsVisible() then
badge:SetLeftOffset(GUIScale(10) + (i-1)* GUIScale(36))
i = i + 1
end
end
self.playername:SetLeftOffset(GUIScale(10) + (i-1)* GUIScale(36))
end
function GUIBadgesSelection:LoadBadges()
local main = self
local badges, selectedbadges = GetBadges()
for i = 1, 10 do
local badge = badges[i]
if badge and badge > gBadges.none then
local badgeTexture = Badges_GetBadgeData(badge).unitStatusTexture
self.activeBadges[i].badgeId = badge
self.activeBadges[i]:SetBackgroundTexture(badgeTexture)
self.activeBadges[i]:SetIsVisible(true)
else
self.activeBadges[i]:SetIsVisible(false)
end
end
self:ReloadBadgeOrder()
for i, avaibleBadge in ipairs(self.avaibleBadges) do
avaibleBadge:Uninitialize()
self.avaibleBadges[i]= nil
end
local i = 0
local ownedBadges = Badges_GetOwnedBadges()
for _, badge in ipairs(gBadges) do
local badgeid = gBadges[badge]
if badgeid > gBadges.none and ownedBadges[badgeid] and not selectedbadges[badgeid] then
i = i + 1
self.avaibleBadges[i] = CreateMenuElement(self.avaibleRow, "Image")
self.avaibleBadges[i]:SetCSSClass("badge")
local badgeData = Badges_GetBadgeData(badgeid)
local badgeTexture = badgeData.unitStatusTexture
self.avaibleBadges[i].badgeId = badgeid
self.avaibleBadges[i].badgeData = badgeData
self.avaibleBadges[i].columns = ownedBadges[badgeid]
self.avaibleBadges[i]:SetLeftOffset(GUIScale(5) + (i % 10 + 1) * GUIScale(36))
self.avaibleBadges[i]:SetBackgroundTexture(badgeTexture)
self.avaibleBadges[i]:SetIsVisible(math.ceil(i/10) == self.avaibleBadges.index)
local activeBadges = self.activeBadges
self.avaibleBadges[i].OnMouseDown = function(self)
local columns = Badges_GetBadgeColumns(self.columns)
for i = 1, #columns do
activeBadges[columns[i]]:SetBackgroundTexture(self.badgeData.unitStatusTexture) --Todo proper highlight
activeBadges[columns[i]]:SetIsVisible(true)
end
main:ReloadBadgeOrder()
self.mousedown = true
self.originalPosition = self.background:GetPosition()
self.lastmouseX, self.lastmouseY = Client.GetCursorPosScreen()
end
self.avaibleBadges[i].OnMouseUp = function(self)
local columns = Badges_GetBadgeColumns(self.columns)
local mouseX, mouseY = Client.GetCursorPosScreen()
for i = 1, #columns do
local activeBadge = activeBadges[columns[i]]
if GUIItemContainsPoint(activeBadge.background, mouseX, mouseY) then
SelectBadge(self.badgeId, columns[i])
break
end
end
self.background:SetPosition(self.originalPosition)
self.mousedown = false
main:LoadBadges()
end
self.avaibleBadges[i].OnMouseOver = function(self)
if self.mousedown then
local mouseX, mouseY = Client.GetCursorPosScreen()
local deltaX, deltaY = self.lastmouseX - mouseX, self.lastmouseY - mouseY
self.lastmouseX, self.lastmouseY = mouseX, mouseY
local oldPos = self.background:GetPosition()
local newPos = Vector(oldPos.x - deltaX, oldPos.y - deltaY, oldPos.z)
self.background:SetPosition(newPos)
end
end
end
end
local maxrow = math.ceil(i/10)
if maxrow > 1 then
local main = self
self.previousBadges = CreateMenuElement(self.avaibleRow, "Image")
self.previousBadges:SetCSSClass("badge")
self.previousBadges:SetBackgroundTexture(kArrowHorizontalButtonTexture)
self.previousBadges:SetTextureCoords(kArrowMinCoords)
self.previousBadges:AddEventCallbacks({
OnClick = function(self)
main.avaibleBadges.index = main.avaibleBadges.index - 1
if main.avaibleBadges.index == 0 then
main.avaibleBadges.index = maxrow
end
main:LoadBadges()
end
})
self.nextBadges = CreateMenuElement(self.avaibleRow, "Image")
self.nextBadges:SetCSSClass("badge")
self.nextBadges:SetBackgroundTexture(kArrowHorizontalButtonTexture)
self.nextBadges:SetTextureCoords(kArrowMaxCoords)
self.nextBadges:SetLeftOffset(GUIScale(5) + 11 * GUIScale(36))
self.nextBadges:AddEventCallbacks({
OnClick = function(self)
main.avaibleBadges.index = main.avaibleBadges.index + 1
if main.avaibleBadges.index > maxrow then
main.avaibleBadges.index = 1
end
main:LoadBadges()
end
})
else
for i, badge in ipairs(self.avaibleBadges) do
badge:SetLeftOffset( GUIScale(5) + (i-1)* GUIScale(36))
end
end
end
function GUIBadgesSelection:Initialize()
Window.Initialize(self)
self:SetWindowName("Badge Selection")
self:SetInitialVisible(false)
self:DisableResizeTile()
self:DisableSlideBar()
self:DisableTitleBar()
self:DisableContentBox()
self:DisableCloseButton()
self:SetLayer(kGUILayerMainMenuDialogs)
self.title = CreateMenuElement(self, "Font")
self.title:SetCSSClass("title")
self.title:SetText(Locale.ResolveString("BADGE_SELECTION_HELP"))
self.activeBadgesBackground = CreateMenuElement(self, "Image")
self.activeBadgesBackground:SetCSSClass("badgerow")
self.activeBadgesHighlight = CreateMenuElement(self.activeBadgesBackground, "Image")
self.activeBadgesHighlight:SetCSSClass("badgerowhighlight")
self.playername = CreateMenuElement(self.activeBadgesBackground, "Font")
self.playername:SetCSSClass("playername")
self.playername:SetText(OptionsDialogUI_GetNickname())
self.activeBadges = {}
local main = self
for i = 1, 10 do
self.activeBadges[i] = CreateMenuElement(self.activeBadgesBackground, "Image")
self.activeBadges[i]:SetCSSClass("badge")
self.activeBadges[i]:AddEventCallbacks({ OnClick = function(self) SelectBadge(gBadges.disabled, i) main:LoadBadges() end })
self.activeBadges[i]:SetIsVisible(false)
end
self.avaibleRow = CreateMenuElement(self, "Image")
self.avaibleRow:SetCSSClass("badgerow2")
self.avaibleBadges = {
index = 1
}
self.applyButton = CreateMenuElement(self, "MenuButton")
self.applyButton:SetText(Locale.ResolveString("CLOSE"))
self.applyButton:AddEventCallbacks({ OnClick = function()
self:SetIsVisible(false)
end})
self.applyButton:SetCSSClass("playnow")
self:SetIsVisible(false)
end
function GUIBadgesSelection:OnEscape()
self:SetIsVisible(false)
end
function GUIBadgesSelection:SetIsVisible(visible)
Window.SetIsVisible(self, visible)
if visible then self:LoadBadges() end
end
function GUIBadgesSelection:GetTagName()
return "badgeselection"
end
|
AddEvent("OnKeyPress", function(key)
if (GetPlayerVehicle(GetPlayerId()) == 0 and not IsInPlayerMenuUI and not IsInSpawnUI) then
if (key == "Ampersand" or key == OnlineKeys.RESET_ANIMATION_KEY) then
CallRemoteEvent("PlayAnimationPMENU", "STOP")
elseif GetInputMode() ~= input_while_in_ui then
local keyid
for i, v in ipairs(AnimationsKeys) do
if (v[1] == key or v[2] == key) then
keyid = i
break
end
end
if keyid then
CallRemoteEvent("PlayAnimationKey", keyid)
end
end
end
end) |
-- need to update the Lua path to point to the local flatbuffers implementation
package.path = string.format("../lua/?.lua;%s",package.path)
package.path = string.format("./lua/?.lua;%s",package.path)
-- require the library
local flatbuffers = require("flatbuffers")
local binaryArray = flatbuffers.binaryArray-- for hex dump utility
-- require the files generated from the schema
local weapon = require("MyGame.Sample.Weapon")
local monster = require("MyGame.Sample.Monster")
local vec3 = require("MyGame.Sample.Vec3")
local color = require("MyGame.Sample.Color")
local equipment = require("MyGame.Sample.Equipment")
-- get access to the builder, providing an array of size 1024
local builder = flatbuffers.Builder(1024)
local weaponOne = builder:CreateString("Sword")
local weaponTwo = builder:CreateString("Axe")
-- Create the first 'Weapon'
weapon.Start(builder)
weapon.AddName(builder, weaponOne)
weapon.AddDamage(builder, 3)
local sword = weapon.End(builder)
-- Create the second 'Weapon'
weapon.Start(builder)
weapon.AddName(builder, weaponTwo)
weapon.AddDamage(builder, 5)
local axe = weapon.End(builder)
-- Serialize a name for our mosnter, called 'orc'
local name = builder:CreateString("Orc")
-- Create a `vector` representing the inventory of the Orc. Each number
-- could correspond to an item that can be claimed after he is slain.
-- Note: Since we prepend the bytes, this loop iterates in reverse.
monster.StartInventoryVector(builder, 10)
for i=10,1,-1 do
builder:PrependByte(i)
end
local inv = builder:EndVector(10)
-- Create a FlatBuffer vector and prepend the weapons.
-- Note: Since we prepend the data, prepend them in reverse order.
monster.StartWeaponsVector(builder, 2)
builder:PrependUOffsetTRelative(axe)
builder:PrependUOffsetTRelative(sword)
local weapons = builder:EndVector(2)
-- Create our monster by using Start() andEnd()
monster.Start(builder)
monster.AddPos(builder, vec3.CreateVec3(builder, 1.0, 2.0, 3.0))
monster.AddHp(builder, 300)
monster.AddName(builder, name)
monster.AddInventory(builder, inv)
monster.AddColor(builder, color.Red)
monster.AddWeapons(builder, weapons)
monster.AddEquippedType(builder, equipment.Weapon)
monster.AddEquipped(builder, axe)
local orc = monster.End(builder)
-- Call 'Finish()' to instruct the builder that this monster is complete.
builder:Finish(orc)
-- Get the flatbuffer as a string containing the binary data
local bufAsString = builder:Output()
-- Convert the string representation into binary array Lua structure
local buf = flatbuffers.binaryArray.New(bufAsString)
-- Get an accessor to the root object insert the buffer
local mon = monster.GetRootAsMonster(buf, 0)
assert(mon:Mana() == 150)
assert(mon:Hp() == 300)
assert(mon:Name() == "Orc")
assert(mon:Color() == color.Red)
assert(mon:Pos():X() == 1.0)
assert(mon:Pos():Y() == 2.0)
assert(mon:Pos():Z() == 3.0)
for i=1,mon:InventoryLength() do
assert(mon:Inventory(i) == i)
end
local expected = {
{w = 'Sword', d = 3},
{w = 'Axe', d = 5}
}
for i=1,mon:WeaponsLength() do
assert(mon:Weapons(i):Name() == expected[i].w)
assert(mon:Weapons(i):Damage() == expected[i].d)
end
assert(mon:EquippedType() == equipment.Weapon)
local unionWeapon = weapon.New()
unionWeapon:Init(mon:Equipped().bytes,mon:Equipped().pos)
assert(unionWeapon:Name() == "Axe")
assert(unionWeapon:Damage() == 5)
print("The Lua FlatBuffer example was successfully created and verified!") |
local Me = game.Players.LocalPlayer
if script.Parent.className ~= "HopperBin" then
local h = Instance.new("HopperBin", Me.Backpack)
h.Name = ""
sc = Instance.new("ScreenGui")
sc.Name = "Invisible"
sc.Parent = Me.PlayerGui
t = Instance.new("TextLabel")
t.BackgroundTransparency = 0.75
t.Name = "Text - Reset"
t.Parent = sc
t.Position = UDim2.new(0, 0, 0, 150)
t.Size = UDim2.new(0, 200, 0, 200)
t.Text = ""
t.Visible = true
t2 = Instance.new("TextLabel")
t2.BackgroundTransparency = 0.3
t2.Name = "Text - Reset"
t2.Parent = sc
t2.Position = UDim2.new(0, 0, 0, 150)
t2.Size = UDim2.new(0, 0, 0, 200)
t2.Text = ""
t2.Visible = true
script.Parent = h
end
local bin = script.Parent
function onSelected(mouse)
mouse.Button1Down:connect(function()
brick = mouse.Target
t.Text = brick.Name
for i = 0, 1, 0.05 do
t2.Size = t2.Size + UDim2.new(0, 10, 0, 0)
wait()
end
local tool = Instance.new("Tool", Me.Backpack)
tool.Name = "" ..brick.Name.. ""
brick.Parent = tool
brick.Name = "Handle"
t2.Size = UDim2.new(0, 0, 0, 200)
t.Text = ""
end)
mouse.KeyDown:connect(function(key)
if key == "q" then
brick = mouse.Target
bin.Name = brick.Name
end
end)
end
function onDesel(mouse)
end
bin.Selected:connect(onSelected)
bin.Deselected:connect(onDesel)
|
local b4={}; for k,v in pairs(_ENV) do b4[k]=v end
require"tricks"
local fails=0
for _,f in pairs(arg) do
if f ~= "ok.lua" and f ~= "lua" then
local ok,msg = pcall(function () dofile(f) end)
if ok
then color("green","%s",f)
else color("red","%s",tostring(msg)); fails=fails+1 end end end
for k,v in pairs(_ENV) do
if not b4[k] and type(v) ~= "function" then
print("?? ",k,type(v)) end end
os.exit(fails)
|
supplyLimit("Fighter", 100);
supplyLimit("Scout", 24);
supplyLimit("Interceptor", 100);
supplyLimit("Bomber", 100);
supplyLimit("LanceFighter", 100);
supplyLimit("Defenders", 25);
supplyLimit("Defensefighters", 15);
supplyLimit("CloakedFighters", 25);
--
-- Vaygr FamilyOverride Fighter 170
-- Vaygr ShipOverride Interceptor 140
-- Vaygr ShipOverride Bomber 140
--
supplyLimit("Corvette", 60);
supplyLimit("MinelayerCorvette",6);
supplyLimit("CommandCorvette",3);
supplyLimit("SalvageCorvette",18);
--
-- Vaygr FamilyOverride Corvette 80
--
supplyLimit("Frigate", 30);
supplyLimit("DefenseFieldFrigate",3);
supplyLimit("CaptureFrigate",8);
--
-- Kushan FamilyOverride Frigate 24
-- Taiidan FamilyOverride Frigate 24
--
supplyLimit("Capital", 15);
supplyLimit("Destroyer", 7);
supplyLimit("MissileDestroyer", 3);
supplyLimit("Carrier", 4);
supplyLimit("Battlecruiser",3);
supplyLimit("HeavyCruiser",3);
supplyLimit("Shipyard", 1);
--
supplyLimit("Utility", 55);
supplyLimit("Probe", 8);
supplyLimit("ECMProbe", 8);
supplyLimit("ProximitySensor", 8);
--
supplyLimit("Resource", 31);
supplyLimit("ResourceCollector", 26);
supplyLimit("ResourceController", 5);
--
supplyLimit("NonCombat", 40);
supplyLimit("Probe_hw1", 8);
supplyLimit("ProximitySensor_hw1", 8);
supplyLimit("Research", 1);
supplyLimit("Research1", 1);
supplyLimit("Research2", 1);
supplyLimit("Research3", 1);
supplyLimit("Research4", 1);
supplyLimit("Research5", 1);
supplyLimit("CloakGenerator", 6);
supplyLimit("GravWellGenerator", 6);
supplyLimit("SensorArray", 6);
--
supplyLimit("Platform", 30);
supplyLimit("HyperspacePlatform", 8);
--
supplyLimit("Mothership", 1);
--
supplyLimit("SinglePlayerMisc", 100);
-- Generic Indents
supplyIndent("Scout", 1);
supplyIndent("Interceptor", 1);
supplyIndent("Bomber", 1);
supplyIndent("MinelayerCorvette", 1);
supplyIndent("Destroyer", 1);
supplyIndent("Carrier", 1);
-- Race Specific Indents
supplyIndent("LanceFighter", 1);
supplyIndent("Defenders", 1);
supplyIndent("Defensefighters", 1);
supplyIndent("CloakedFighters", 1);
supplyIndent("CommandCorvette", 1);
supplyIndent("SalvageCorvette", 1);
supplyIndent("DefenseFieldFrigate", 1);
supplyIndent("CaptureFrigate", 1);
supplyIndent("MissileDestroyer", 1);
supplyIndent("Battlecruiser", 1);
supplyIndent("HeavyCruiser", 1);
supplyIndent("Shipyard", 1);
supplyIndent("ResourceCollector", 1);
supplyIndent("ResourceController", 1);
supplyIndent("Probe", 1);
supplyIndent("Probe_hw1", 1);
supplyIndent("ProximitySensor", 1);
supplyIndent("ProximitySensor_hw1", 1);
supplyIndent("CloakGenerator", 1);
supplyIndent("GravWellGenerator", 1);
supplyIndent("ECMProbe", 1);
supplyIndent("SensorArray", 1);
supplyIndent("HyperspacePlatform", 1);
-- Display Rules
supplyShow("Fighter", "Always");
supplyShow("Corvette", "Always");
supplyShow("Frigate", "Always");
supplyShow("Capital", "Always");
supplyShow("Utility", "NotEmpty");
supplyShow("Resource", "NotEmpty");
supplyShow("Platform", "NotEmpty");
supplyShow("Mothership", "Never");
supplyShow("SinglePlayerMisc", "Never");
supplyShow("NonCombat", "NotEmpty");
supplyShow("Research", "Never");
supplyShow("Research1", "Never");
supplyShow("Research2", "Never");
supplyShow("Research3", "Never");
supplyShow("Research4", "Never");
supplyShow("Research5", "Never");
|
paddleselectstate=class{_includes=basestate}
skin=1
size=2
function paddleselectstate:update(dt)
if love.keyboard.waspressed('escape') then
love.event.quit()
end
if love.keyboard.waspressed('return') then
gStatemachine:change('serve')
end
if love.keyboard.waspressed('left') then
skin=skin-1
if skin<1 then
skin=4
end
end
if love.keyboard.waspressed('right') then
skin=skin+1
if skin>4 then
skin=1
end
end
end
function paddleselectstate:render()
love.graphics.setFont(large)
love.graphics.printf("Select Paddle",0,virtual_height/4,virtual_width,'center')
love.graphics.setFont(medium)
love.graphics.printf("Press enter to begin",0,virtual_height/4+40,virtual_width,'center')
love.graphics.draw(main,gFrames['paddles'][size+4*(skin-1)],virtual_width/2-32,virtual_height-40)
end |
require("os")
os.execute("wifi") |
local Slot = {}
function Slot:new(name, x, y, width, height, image, imageHover, bgImage, placementType, object)
object = object or {
name = name,
x = x,
y = y,
width = width,
height = height,
image = image,
imageHover = imageHover,
button = Button:new(x, y, width, height, image, imageHover),
pet = nil,
bgImage = bgImage,
placementType = placementType or "summon"
}
object.button.onclick = function()
status = object.name.." clicked"
if SelectedPet ~= nil then
object:assignPet(SelectedPet)
SelectedPet = nil
toggleSlots()
end
end
setmetatable(object, self)
self.__index = self
return object
end
function Slot:assignPet(pet)
-- TODO: check placementType before assigning, or even showing the slot in the first place
if pet.placementType == self.placementType then
self.pet = Pet:new(pet.name, pet.spawnrate, pet.width, pet.height,
Anime:new("image_idle", pet.image_idle.spriteSheet, pet.width, pet.height, pet.duration),
Anime:new("image_pet", pet.image_pet.spriteSheet, pet.width, pet.height, pet.duration),
pet.price)
self.pet:start()
end
pet.slot = self
end
function Slot:draw()
-- TODO: check placementType before assigning, or even showing the slot in the first place
self.bgImage:draw(self.x, self.y)
self.button:draw()
if self.pet ~= nil then
self.pet:draw(self.x, self.y)
end
end
return Slot
|
package.path = package.path .. ";data/scripts/lib/?.lua"
include ("randomext")
ESCCUtil = include("esccutil")
-- Don't remove or alter the following comment, it tells the game the namespace this script lives in. If you remove it, the script will break.
-- namespace Afterburn
Afterburn = {}
local self = Afterburn
self._Debug = 0
self._Data = {}
self._Data._TimeInPhase = 0
self._Data._BoostMode = false
function Afterburn.getUpdateInterval()
return 2 --Update every 2 seconds.
end
function Afterburn.updateServer(_TimeStep)
local _MethodName = "Update Server"
self._Data._TimeInPhase = self._Data._TimeInPhase + _TimeStep
local _Entity = Entity()
local _ShowAnimation = false
--1 minute out, 30 seconds in.
if self._Data._BoostMode then
if self._Data._TimeInPhase >= 20 then
--20 seconds have passed. Flip us to being OUT of the mode
self._Data._BoostMode = false
self._Data._TimeInPhase = 0
Afterburn.Log(_MethodName, "Exiting boost mode.")
_Entity:addMultiplier(acceleration, 0.125)
_Entity:addMultiplier(velocity, 0.125)
else
--blink to give a visual indication of the ship being in MAXIMUM Afterburn
_ShowAnimation = true
end
else
if self._Data._TimeInPhase >= 30 then
--30 seconds have passed. Flip us to being IN the mode.
self._Data._BoostMode = true
self._Data._TimeInPhase = 0
Afterburn.Log(_MethodName, "Entering boost mode.")
_Entity:addMultiplier(acceleration, 8)
_Entity:addMultiplier(velocity, 8)
_ShowAnimation = true
end
end
if _ShowAnimation then
local direction = random():getDirection()
broadcastInvokeClientFunction("animation", direction)
end
end
function Afterburn.animation(direction)
ESCCUtil.compatibleJumpAnimation(Entity(), direction, ColorRGB(1.0, 1.0, 0.0), 0.2)
end
--region #CLIENT / SERVER functions
function Afterburn.Log(_MethodName, _Msg)
if self._Debug == 1 then
print("[Afterburn] - [" .. tostring(_MethodName) .. "] - " .. tostring(_Msg))
end
end
--endregion |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.